Commit 0fbcb89e LN

1

1 个父辈 03e70b29
......@@ -6,7 +6,7 @@
<appSettings>
<!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="1"/>
<add key="App_Title" value="AC_SA_料仓_1"/>
<add key="App_Title" value="包装料料仓"/>
<!-- 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)-->
<add key="StartBlowValue" value="4"/>
<!-- 停止吹气的判断值(配置值=服务器发送的湿度值-停止吹气值)-->
......@@ -20,8 +20,9 @@
<add key="Store_Position_Config" value="\StoreConfig\linePositions.csv"/>
<add key="BOX_ConfigPath" value="\StoreConfig\BoxConfig.csv"/>
<add key="Store_Type" value="RC_AC_PA"/>
<add key="Store_CID" value="line-ac1"/>
<add key ="Store_ID" value ="1"/>
<add key="Store_CID" value="line-ac"/>
<add key="Store_CID_1" value="line-ac1"/>
<add key="Store_CID_2" value="line-ac2"/>
<!--end one store config-->
<add key="ACBaudRate" value="115200" />
<add key="InOutDefaultPosition" value="8000"/>
......
......@@ -46,12 +46,15 @@ namespace OnlineStore.ACPackingStore
{
foreach (AC_BOX_Bean box in store.BoxMap.Values)
{
FrmBox frm = new FrmBox();
FrmBox frm = new FrmBox();
frm.BoxBean = box;
AddForm(box.Name, frm);
AddForm(box.Name, frm);
}
}
this.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title);
chbAutoRun.Checked = ConfigAppSettings.GetValue(Setting_Init.App_AutoRun).Equals(1);
HideForm();
LoadOk = true;
}
......@@ -318,19 +321,7 @@ namespace OnlineStore.ACPackingStore
FrmAbout about = new FrmAbout();
about.ShowDialog();
}
private void 扫码测试ToolStripMenuItem_Click(object sender, EventArgs e)
{
//store. GetCameraCode();
List<string> codes = CodeManager.CameraScan();
string result = "";
foreach (string s in codes)
{
result += s + "\r\n";
}
LogUtil.info("扫到二维码:" + result);
}
private void 二维码学习ToolStripMenuItem_Click(object sender, EventArgs e)
{
CodeLibrary.FrmCodeDecode frm = new CodeLibrary.FrmCodeDecode();
......@@ -350,7 +341,50 @@ namespace OnlineStore.ACPackingStore
private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
if (toolStripMenuItem2.Text .Equals("启用调试"))
{
DebugOpen(true );
}
else
{
DebugOpen(false);
}
}
private void DebugOpen(bool isopen)
{
foreach (TabPage tab in tabPageList)
{
bool find = false;
foreach (Control control in tab.Controls)
{
if (control is Panel)
{
foreach (Control con in control.Controls)
{
if (con is FrmBox)
{
FrmBox frm = (FrmBox)con;
frm.DebugStatus(isopen);
find = true;
break;
}
}
}
if (find)
{
break;
}
}
}
if (isopen)
{
toolStripMenuItem2.Text = "禁用调试";
}
else
{
toolStripMenuItem2.Text = "启用调试";
}
}
}
}
namespace OnlineStore.AssemblyLine
namespace OnlineStore.ACPackingStore
{
partial class AxisMoveControl
{
......@@ -74,6 +74,9 @@
//
// groupAxis
//
this.groupAxis.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupAxis.Controls.Add(this.comboBox1);
this.groupAxis.Controls.Add(this.label6);
this.groupAxis.Controls.Add(this.label1);
......@@ -115,9 +118,9 @@
this.groupAxis.Controls.Add(this.label46);
this.groupAxis.Controls.Add(this.label49);
this.groupAxis.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupAxis.Location = new System.Drawing.Point(9, 4);
this.groupAxis.Location = new System.Drawing.Point(5, 2);
this.groupAxis.Name = "groupAxis";
this.groupAxis.Size = new System.Drawing.Size(648, 367);
this.groupAxis.Size = new System.Drawing.Size(604, 367);
this.groupAxis.TabIndex = 218;
this.groupAxis.TabStop = false;
this.groupAxis.Text = "伺服运动";
......@@ -585,7 +588,7 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.groupAxis);
this.Name = "AxisMoveControl";
this.Size = new System.Drawing.Size(678, 388);
this.Size = new System.Drawing.Size(612, 374);
this.groupAxis.ResumeLayout(false);
this.groupAxis.PerformLayout();
this.ResumeLayout(false);
......
......@@ -12,7 +12,7 @@ using OnlineStore.Common;
using System.Threading;
using OnlineStore.LoadCSVLibrary;
namespace OnlineStore.AssemblyLine
namespace OnlineStore.ACPackingStore
{
public partial class AxisMoveControl : UserControl
{
......@@ -153,5 +153,6 @@ namespace OnlineStore.AssemblyLine
}
}
}
}
......@@ -23,8 +23,7 @@ namespace OnlineStore.Common
public static string http_server = "http.server";
public static string Store_CID = "Store_CID";
public static string Store_ID = "Store_ID";
public static string Store_CID = "Store_CID";
/// <summary>
/// 料仓数量
......@@ -59,10 +58,7 @@ namespace OnlineStore.Common
/// 配置文件路径 Data Matrix ECC 200.dcm
/// </summary>
public static string CodeParamPath = "CodeParamPath";
/// <summary>
/// 高度传感器转换系数
/// </summary>
public static string AI_ConvertPosition = "AI_ConvertPosition";
/// <summary>
/// 进出轴最大待机点,需要小于3000
/// </summary>
......@@ -84,10 +80,7 @@ namespace OnlineStore.Common
public static string LineServerIp = "LineServerIp";
public static string LineServerPort = "LineServerPort";
/// <summary>
/// 是否调试状态
/// </summary>
public static string IsInDebug = "IsInDebug";
public static string ACBaudRate = "ACBaudRate";
......
......@@ -25,54 +25,7 @@ namespace OnlineStore.Common
}
Interlocked.Increment(ref seq);
return seq;
}
public static string GetValue(string keyStr, string storeStr)
{
string key = keyStr + storeStr;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
return GetValue(keyStr);
}
else
{
return config.AppSettings.Settings[key].Value;
}
}
public static decimal GetNumValue(string keyStr, string storeStr)
{
string key = keyStr + storeStr;
decimal a = 0;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
return GetNumValue(keyStr);
}
else
{
{
Decimal.TryParse(config.AppSettings.Settings[key].Value, out a);
}
}
return a;
}
public static int GetIntValue(string keyStr, string storeStr)
{
string key = keyStr + storeStr;
int a = 0;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
return GetIntValue(keyStr);
}
else
{
{
Int32.TryParse(config.AppSettings.Settings[key].Value, out a);
}
} return a;
}
}
public static string GetValue(string key)
{
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
......
......@@ -44,6 +44,7 @@ namespace OnlineStore.DeviceLibrary
{
Init();
baseConfig = config;
CID = config.CID;
serverConnectTimer = new System.Timers.Timer();
serverConnectTimer.Interval = 1000;
serverConnectTimer.AutoReset = true;
......@@ -56,42 +57,32 @@ namespace OnlineStore.DeviceLibrary
IoCheckTimer.Elapsed += IoCheckTimer_Elapsed;
//添加调试
IsDebug = ConfigAppSettings.GetIntValue(Setting_Init.IsInDebug).Equals(1);
IsDebug =config.IsInDebug.Equals(1);
Name = ("料仓BOX_" + config.Id + " ").ToUpper();
this.DeviceID = config.Id;
Name = ("料仓BOX_" + config.DeviceID + " ").ToUpper();
this.DeviceID = config.DeviceID;
this.Config = config;
moveAxisList = new List<ConfigMoveAxis>();
MoveAxisConfig();
List<ACStorePosition> positionList = CSVPositionReader<ACStorePosition>.getPositionList();
List<ACBoxPosition> positionList = CSVPositionReader<ACBoxPosition>.getPositionList();
PositionNumList = new List<string>();
foreach (ACStorePosition position in positionList)
foreach (ACBoxPosition position in positionList)
{
if (position.StoreId.Equals(DeviceID))
{
bool result = ACStorePosition.CheckPosition(position, Config);
bool result = ACBoxPosition.CheckPosition(position, Config);
if (result)
{
PositionNumList.Add(position.PositionNum);
}
}
}
IOManager.Init();
IOManager.instance.ConnectionIOList(Config.DIODeviceNameList);
}
mainTimer.Enabled = false;
int isAuto = ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun);
if (isAuto == 1)
{
mainTimer.Enabled = true;
}
Thread.Sleep(300);
//默认三个灯都亮
IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.LOW);
IOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW);
}
}
private void IoCheckTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
......@@ -1152,7 +1143,7 @@ namespace OnlineStore.DeviceLibrary
int storeId = int.Parse(posArray[0]);
//根据发送的posId获取位置列表
ACStorePosition position = CSVPositionReader<ACStorePosition>.GetPositon(posId);
ACBoxPosition position = CSVPositionReader<ACBoxPosition>.GetPositon(posId);
if (position == null)
{ //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = "入库未找到库位:二维码【" + message + "】库位【" + posId + "】 ";
......@@ -1238,7 +1229,7 @@ namespace OnlineStore.DeviceLibrary
// //LineConnect.WaitInStoreList.Remove(posId);
//}
//根据发送的posId获取位置列表
ACStorePosition position = CSVPositionReader<ACStorePosition>.GetPositon(posId);
ACBoxPosition position = CSVPositionReader<ACBoxPosition>.GetPositon(posId);
if (position == null)
{ //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = "入库未找到库位:二维码【" + message + "】库位【" + posId + "】 ";
......@@ -1627,7 +1618,7 @@ namespace OnlineStore.DeviceLibrary
int storeId = int.Parse(posArray[0]);
//根据发送的posId获取位置列表
ACStorePosition position = CSVPositionReader<ACStorePosition>.GetPositon(posId);
ACBoxPosition position = CSVPositionReader<ACBoxPosition>.GetPositon(posId);
if (position == null)
{
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因
......
......@@ -46,7 +46,7 @@ namespace OnlineStore.DeviceLibrary
if (param.MoveP == null)
{
LineMoveP p = new LineMoveP();
ACStorePosition position = param.GetACPosition();
ACBoxPosition position = param.GetACPosition();
if (position == null)
{
LogUtil.error(LOGGER, Name + "出入库时发现param中取到的Position=null,没有库位不能执行出入库");
......
......@@ -48,8 +48,8 @@ namespace OnlineStore.DeviceLibrary
InitTimer();
baseConfig = lineConfig;
this.Config = lineConfig;
this.DeviceID = lineConfig.Id;
this.DeviceID = lineConfig.DeviceID;
MoveInfo = new StoreMoveInfo(DeviceID);
Name = (" Store_" + Config.CID + " ").ToUpper();
List<string> ioList = new List<string>();
......@@ -60,8 +60,8 @@ namespace OnlineStore.DeviceLibrary
AC_BOX_Bean equip = new AC_BOX_Bean(config);
AddDeviceName(ioList, config.DIODeviceNameList);
BoxMap.Add(config.Id, equip);
BoxConfigMap.Add(config.Id, config);
BoxMap.Add(config.DeviceID, equip);
BoxConfigMap.Add(config.DeviceID, config);
}
IOManager.Init();
......@@ -76,10 +76,13 @@ namespace OnlineStore.DeviceLibrary
addLastDI(IO_Type.Airpressure_Check, IOValue(IO_Type.Airpressure_Check));
addLastDI(IO_Type.SuddenStop_BTN, IOValue(IO_Type.SuddenStop_BTN));
addLastDI(IO_Type.Reset_BTN, IOValue(IO_Type.Reset_BTN));
IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.LOW);
IOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW);
mainTimer.Enabled = true;
IoCheckTimer.Enabled = true;
canStart = true;
});
}
......
......@@ -85,10 +85,26 @@ namespace OnlineStore.DeviceLibrary
{
string nameStr = i.ToString().PadLeft(1, '0');
string config = appPath + moveEquipConfig.Replace(".csv", "_" + nameStr + ".csv");
AC_BOX_Config moveConfig = CSVConfigReader.LoadBoxConfig(i, CID + "_" + i, "BOX", config);
string storeIdConfig = Setting_Init.Store_CID + "_" + i;
string boxCid = ConfigAppSettings.GetValue(storeIdConfig);
AC_BOX_Config moveConfig = CSVConfigReader.LoadBoxConfig(i, boxCid, "BOX", config);
AllConfigMap.Add(i, moveConfig);
storeConfig.Add(i, moveConfig);
}
string positionConfigFile = appPath + ConfigAppSettings.GetValue(Setting_Init.Store_Position_Config);
if (count > 1 || (!File.Exists(positionConfigFile)))
{
for (int i = 1; i <= count; i++)
{
string nameStr = i.ToString().PadLeft(1, '0');
string fileN = positionConfigFile. Replace(".csv", "_" + nameStr + ".csv");
CSVPositionReader<ACBoxPosition>.AddCSVFile(fileN);
}
}
else
{
CSVPositionReader<ACBoxPosition>.AddCSVFile(positionConfigFile);
}
LogUtil.info(LOGGER, "加载料仓完成!");
}
......@@ -112,16 +128,18 @@ namespace OnlineStore.DeviceLibrary
try
{
//位置配置到文件中
string appPath = Application.StartupPath;
string appPath = Application.StartupPath;
string configFile = appPath + ConfigAppSettings.GetValue(Setting_Init.BOX_ConfigPath);
bool result = CSVConfigReader.SaveBoxPosition(configFile, storeConfig);
if (!result)
{
LOGGER.Error("保存配置文件失败:" + configFile);
}
//Store.Config = storeConfig;
//Store.MoveAxisConfig();
AllConfigMap[storeConfig.DeviceID] = storeConfig;
Store.BoxConfigMap[storeConfig.DeviceID] = storeConfig;
Store.BoxMap[storeConfig.DeviceID].Config = storeConfig;
Store.BoxMap[storeConfig.DeviceID].MoveAxisConfig();
}
catch (Exception ex)
{
......
......@@ -107,7 +107,10 @@
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="StoreConfig\linePositions.csv">
<None Include="StoreConfig\linePositions_2.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="StoreConfig\linePositions_1.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="StoreConfig\StoreConfig.csv">
......
......@@ -119,3 +119,5 @@ PRO,需要吹气的湿度(湿度标准),Max_Humidity,10,,,,,,,
PRO,每次吹气的时间(分钟),BlowAir_Time,10,,,,,,,
PRO,两次吹气间隔(分钟),BlowAir_Interval,10,,,,,,,
PRO,温湿度端口号,Humiture_Port,COM2,,,,,,,
PRO,扫码的相机名称(多个用#分隔),CameraNameList,Name1#Name1,,,,,
PRO,是否是调试状态,IsInDebug,1,,,,,,,
......@@ -121,3 +121,6 @@ PRO,需要吹气的湿度(湿度标准),Max_Humidity,10,,,,,,,
PRO,每次吹气的时间(分钟),BlowAir_Time,10,,,,,,,
PRO,两次吹气间隔(分钟),BlowAir_Interval,10,,,,,,,
PRO,温湿度端口号,Humiture_Port,COM2,,,,,,,
PRO,扫码的相机名称(多个用#分隔),CameraNameList,Name1#Name1,,,,,
PRO,是否是调试状态,IsInDebug,1,,,,,,,
......@@ -64,15 +64,15 @@ namespace OnlineStore.DeviceLibrary
// IsSolderPaste = false;
//}
private ACStorePosition ACStoreP = null;
private ACBoxPosition ACStoreP = null;
public ACStorePosition GetACPosition()
public ACBoxPosition GetACPosition()
{
try
{
if (ACStoreP == null)
{
ACStoreP = CSVPositionReader<ACStorePosition>.GetPositon(PositionNum);
ACStoreP = CSVPositionReader<ACBoxPosition>.GetPositon(PositionNum);
}
}
catch (Exception ex)
......
......@@ -466,11 +466,11 @@ namespace OnlineStore.DeviceLibrary
}
public void IOMove(string IoType, IO_VALUE value)
{
IOManager.IOMove(IoType, value, baseConfig.Id);
IOManager.IOMove(IoType, value, baseConfig.DeviceID);
}
public IO_VALUE IOValue(string IoType)
{
return IOManager.IOValue(IoType, baseConfig.Id);
return IOManager.IOValue(IoType, baseConfig.DeviceID);
}
public void LogInfo(string logInfo)
......
......@@ -47,7 +47,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="CSVExection.cs" />
<Compile Include="position\ACSAStorePosition.cs" />
<Compile Include="position\ACBoxPosition.cs" />
<Compile Include="storeConfig\ConfigItemBase.cs" />
<Compile Include="storeConfig\ConfigProAttribute.cs" />
<Compile Include="storeConfig\config\Store_Config.cs" />
......
......@@ -10,7 +10,7 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// 松下伺服485控制,单台料仓
/// </summary>
public class ACStorePosition : StorePostionBase
public class ACBoxPosition : StorePostionBase
{ /// <summary>
/// 对应的料仓ID(流水线料仓需要用此字段区分哪个BOX)
/// </summary>
......@@ -67,7 +67,7 @@ namespace OnlineStore.LoadCSVLibrary
[CSVAttribute("进出轴进料口取料点P2")]
public int InOutAxis_DoorPosition_P2 { get; set; }
public static bool CheckPosition(ACStorePosition position, AC_BOX_Config Config)
public static bool CheckPosition(ACBoxPosition position, AC_BOX_Config Config)
{
try
{
......
......@@ -435,7 +435,37 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("Humiture_Port", true)]
public string Humiture_Port { get; set; }
/// <summary>
/// PRO,0,扫码的相机名称(多个用#分隔),CameraNameList,Name1#Name1,,,,,
/// </summary>
[ConfigProAttribute("CameraNameList")]
public string CameraNameList { get; set; }
/// <summary>
/// PRO,是否是调试状态,IsInDebug,1,,,,,,,
/// </summary>
[ConfigProAttribute("IsInDebug")]
public int IsInDebug { get; set; }
private List<string> CameraList = null;
public List<string> GetCameraList()
{
if (CameraList == null)
{
CameraList = new List<string>();
string[] arrayList = CameraNameList.Split('#');
foreach (string str in arrayList)
{
string camera = str.Trim();
if (string.IsNullOrEmpty(camera).Equals(false))
{
CameraList.Add(camera);
}
}
}
return CameraList;
}
protected override void initMustHavePro()
{
//MustHaveDIList = new List<string>();
......
......@@ -16,7 +16,7 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// ID
/// </summary>
public int Id { get; set; }
public int DeviceID { get; set; }
/// <summary>
/// 编号,与服务器通信的唯一标识
/// </summary>
......@@ -72,7 +72,7 @@ namespace OnlineStore.LoadCSVLibrary
initMustHavePro();
MustHaveDIList = new List<string>();
MustHaveDOList = new List<string>();
this.Id = id;
this.DeviceID = id;
this.CID = cid;
this.StoreType = type;
this.ConfigFilePath = filepath;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!