Commit 6152572f LN

io模块操作增加subType

1 个父辈 022d033f
正在显示 46 个修改的文件 包含 537 行增加988 行删除
...@@ -16,15 +16,11 @@ namespace OnlineStore.Common ...@@ -16,15 +16,11 @@ namespace OnlineStore.Common
/// 系统启动时自动启动料仓,=1时自动启动,并隐藏窗口,=0时不需要 /// 系统启动时自动启动料仓,=1时自动启动,并隐藏窗口,=0时不需要
/// </summary> /// </summary>
public static string App_AutoRun = "App_AutoRun"; public static string App_AutoRun = "App_AutoRun";
/// <summary>
/// 系统主界面标题
/// </summary>
public static string App_Title = "App_Title";
public static string http_server = "http.server"; public static string http_server = "http.server";
public static string Store_CID = "Store_CID"; public static string Store_CID = "Store_CID";
public static string Store_ID = "Store_ID";
/// <summary> /// <summary>
/// 料仓数量 /// 料仓数量
......
...@@ -127,9 +127,9 @@ namespace OnlineStore.Common ...@@ -127,9 +127,9 @@ namespace OnlineStore.Common
{ {
try try
{ {
if (key.Equals("") || value.Equals("")) if (key.Equals("") )
{ {
//return; return;
} }
//增加的内容写在appSettings段下 <add key="RegCode" value="0"/> //增加的内容写在appSettings段下 <add key="RegCode" value="0"/>
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
......
...@@ -41,6 +41,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -41,6 +41,10 @@ namespace OnlineStore.DeviceLibrary
#endregion #endregion
public abstract bool OpenCard();
public abstract bool CloseCard();
public abstract bool IsHomeMoveEnd(string portName, short slvAddr); public abstract bool IsHomeMoveEnd(string portName, short slvAddr);
public abstract bool AbsMoveIsEnd(string portName, short axisNo, int targetPosition, int canErrorCount, out bool countError); public abstract bool AbsMoveIsEnd(string portName, short axisNo, int targetPosition, int canErrorCount, out bool countError);
......
...@@ -10,6 +10,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -10,6 +10,15 @@ namespace OnlineStore.DeviceLibrary
{ {
public class HCAxisManager : AxisManager public class HCAxisManager : AxisManager
{ {
public override bool OpenCard()
{
return HCBoardManager.OpenCard();
}
public override bool CloseCard()
{
return HCBoardManager.CloseCard();
}
public override void AbsMove(string portName, short slvAddr, int targetPosition, int targetSpeed=0,int ptpAcc=0,int ptpDec=0) public override void AbsMove(string portName, short slvAddr, int targetPosition, int targetSpeed=0,int ptpAcc=0,int ptpDec=0)
{ {
HCBoardManager.AbsMove((short)slvAddr, targetPosition, targetSpeed, ptpAcc, ptpDec); HCBoardManager.AbsMove((short)slvAddr, targetPosition, targetSpeed, ptpAcc, ptpDec);
...@@ -141,5 +150,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -141,5 +150,6 @@ namespace OnlineStore.DeviceLibrary
} }
return false; return false;
} }
} }
} }
...@@ -467,6 +467,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -467,6 +467,15 @@ namespace OnlineStore.DeviceLibrary
return GetCoilData(portName, reviceData, ACCMDManager.Home_Single); return GetCoilData(portName, reviceData, ACCMDManager.Home_Single);
} }
public override bool OpenCard()
{
return true;
}
public override bool CloseCard()
{
return true;
}
} }
/// <summary> /// <summary>
/// 记录最后一次获得的寄存器的值 /// 记录最后一次获得的寄存器的值
......
...@@ -118,10 +118,10 @@ ...@@ -118,10 +118,10 @@
<None Include="StoreConfig\AC\BoxConfig_2.csv"> <None Include="StoreConfig\AC\BoxConfig_2.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="StoreConfig\AC\StoreConfig.csv"> <None Include="StoreConfig\AC\BoxConfig_1.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="StoreConfig\AC\BoxConfig_1.csv"> <None Include="StoreConfig\AC\StoreConfig.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>
......
...@@ -26,7 +26,7 @@ namespace OnlineStore.DeviceLibrary.IO ...@@ -26,7 +26,7 @@ namespace OnlineStore.DeviceLibrary.IO
{ {
if (!HCBoardManager.CardInitOk()) if (!HCBoardManager.CardInitOk())
{ {
HCBoardManager.InitCard(); HCBoardManager.OpenCard();
} }
} }
} }
......
...@@ -17,47 +17,66 @@ namespace OnlineStore.DeviceLibrary ...@@ -17,47 +17,66 @@ namespace OnlineStore.DeviceLibrary
#region KNDIO #region KNDIO
public static void IOMove(string ioType, IO_VALUE ioValue) public static void IOMove(string ioType, IO_VALUE ioValue, int subType )
{ {
if (StoreManager.Config.DOList.ContainsKey(ioType)) if (string.IsNullOrEmpty(ioType))
{
return;
}
ConfigIO configIo = GetDO(ioType, subType);
if (configIo != null)
{ {
ConfigIO configIo = StoreManager.Config.DOList[ioType]; instance.WriteSingleDO(configIo.IO_IP, configIo.SlaveID, configIo.GetIOAddr(), ioValue);
instance.WriteSingleDO(configIo.IO_IP, configIo.SlaveID, configIo.GetIOAddr(), ioValue); Thread.Sleep(10);
Thread.Sleep(60);
} }
else else
{ {
LogUtil.error("没有DO=" + ioType); LogUtil.error("未找到DO,[" + ioType + "][" + subType + "]");
} }
} }
public static IO_VALUE IOValue(string ioType) public static IO_VALUE IOValue(string ioType, int subType)
{ {
IO_VALUE ioValue = IO_VALUE.LOW; if (string.IsNullOrEmpty(ioType))
if (StoreManager.Config.DIList.ContainsKey(ioType))
{ {
ConfigIO configIo = StoreManager.Config.DIList[ioType]; return IO_VALUE.None;
ioValue = instance.GetDIValue(configIo.IO_IP, configIo.SlaveID, configIo.GetIOAddr());
//UpdateDoValue(ioType, ioValue);
} }
else if (StoreManager.Config.DOList.ContainsKey(ioType)) IO_VALUE ioValue = IO_VALUE.None;
ConfigIO configIo = GetDI(ioType, subType);
if (configIo == null)
{ {
ConfigIO configIo = StoreManager.Config.DOList[ioType]; configIo = GetDO(ioType, subType);
ioValue = instance.GetDOValue(configIo.IO_IP, configIo.SlaveID, configIo.GetIOAddr()); }
if (configIo != null)
{
if (configIo.ProType.Equals(ConfigItemType.DI))
{
ioValue = instance.GetDIValue(configIo.IO_IP, configIo.SlaveID, configIo.GetIOAddr());
}
else
{
ioValue = instance.GetDOValue(configIo.IO_IP, configIo.SlaveID, configIo.GetIOAddr());
}
} }
else else
{ {
LogUtil.error("没有DO=" + ioType); LogUtil.error("未找到IO[" + ioType + "][" + subType + "]");
} }
return ioValue; return ioValue;
} }
public static IO_VALUE DOValue(string ioType) public static IO_VALUE DOValue(string ioType, int subType)
{ {
IO_VALUE ioValue = IO_VALUE.LOW; if (string.IsNullOrEmpty(ioType))
if (StoreManager.Config.DOList.ContainsKey(ioType)) {
return IO_VALUE.None;
}
IO_VALUE ioValue = IO_VALUE.None;
ConfigIO configIo = GetDO(ioType, subType);
if (configIo != null)
{ {
ConfigIO configIo = StoreManager.Config.DOList[ioType];
ioValue = instance.GetDOValue(configIo.IO_IP, configIo.SlaveID, configIo.GetIOAddr()); ioValue = instance.GetDOValue(configIo.IO_IP, configIo.SlaveID, configIo.GetIOAddr());
} }
else else
...@@ -66,6 +85,92 @@ namespace OnlineStore.DeviceLibrary ...@@ -66,6 +85,92 @@ namespace OnlineStore.DeviceLibrary
} }
return ioValue; return ioValue;
} }
public static IO_VALUE DIValue(string ioType, int subType)
{
if (string.IsNullOrEmpty(ioType))
{
return IO_VALUE.None;
}
IO_VALUE ioValue = IO_VALUE.None;
ConfigIO configIo = GetDI(ioType, subType);
if (configIo != null)
{
ioValue = instance.GetDIValue(configIo.IO_IP, configIo.SlaveID, configIo.GetIOAddr());
}
else
{
LogUtil.error("未找到 DI [" + ioType + "][" + subType + "]");
}
return ioValue;
}
internal static ConfigIO GetIO(string ioType, int subType)
{
ConfigIO configIo = GetDI(ioType, subType);
if (configIo == null)
{
configIo = GetDO(ioType, subType);
}
return configIo;
}
internal static ConfigIO GetDI(string ioType, int subType)
{
ConfigIO configIo = null;
if (subType <= 0)
{
if (StoreManager.Config.DIList.ContainsKey(ioType))
{
return StoreManager.Config.DIList[ioType];
}
}
else
{
if (StoreManager.allConfigMap.ContainsKey(subType))
{
if (StoreManager.allConfigMap[subType].DIList.ContainsKey(ioType))
{
return StoreManager.allConfigMap[subType].DIList[ioType];
}
}
}
if (configIo == null && subType > 0)
{
if (StoreManager.Config.DIList.ContainsKey(ioType))
{
return StoreManager.Config.DIList[ioType];
}
}
return configIo;
}
internal static ConfigIO GetDO(string ioType, int subType)
{
ConfigIO configIo = null;
if (subType <= 0)
{
if (StoreManager.Config.DOList.ContainsKey(ioType))
{
return StoreManager.Config.DOList[ioType];
}
}
else
{
if (StoreManager.allConfigMap.ContainsKey(subType))
{
if (StoreManager.allConfigMap[subType].DOList.ContainsKey(ioType))
{
return StoreManager.allConfigMap[subType].DOList[ioType];
}
}
}
if (configIo == null && subType > 0)
{
if (StoreManager.Config.DOList.ContainsKey(ioType))
{
return StoreManager.Config.DOList[ioType];
}
}
return configIo;
}
#endregion #endregion
public static void Init() public static void Init()
{ {
......
...@@ -35,3 +35,4 @@ PRO,0,是否使用料盘检测信号,IsUse_Tray_Check,0,,,,,,,,,,,, ...@@ -35,3 +35,4 @@ PRO,0,是否使用料盘检测信号,IsUse_Tray_Check,0,,,,,,,,,,,,
PRO,0,是否调试状态,ISDebug,0,,,,,,,,,,,, PRO,0,是否调试状态,ISDebug,0,,,,,,,,,,,,
PRO,,每次吹气的时间(分钟),BlowAir_Time,10,,, PRO,,每次吹气的时间(分钟),BlowAir_Time,10,,,
PRO,,两次吹气间隔(分钟),BlowAir_Interval,10,,, PRO,,两次吹气间隔(分钟),BlowAir_Interval,10,,,
PRO,,温湿度端口号,Humiture_Port,COM5,,,
...@@ -35,3 +35,4 @@ PRO,0,是否使用料盘检测信号,IsUse_Tray_Check,0,,,,,,,,,,,, ...@@ -35,3 +35,4 @@ PRO,0,是否使用料盘检测信号,IsUse_Tray_Check,0,,,,,,,,,,,,
PRO,0,是否调试状态,ISDebug,0,,,,,,,,,,,, PRO,0,是否调试状态,ISDebug,0,,,,,,,,,,,,
PRO,,每次吹气的时间(分钟),BlowAir_Time,10,,, PRO,,每次吹气的时间(分钟),BlowAir_Time,10,,,
PRO,,两次吹气间隔(分钟),BlowAir_Interval,10,,, PRO,,两次吹气间隔(分钟),BlowAir_Interval,10,,,
PRO,,温湿度端口号,Humiture_Port,COM5,,,
...@@ -34,12 +34,6 @@ DO,0,设备照明ON,Device_Led,8,HC,Y09, ...@@ -34,12 +34,6 @@ DO,0,设备照明ON,Device_Led,8,HC,Y09,
,,,,14,HC,Y15, ,,,,14,HC,Y15,
,,,,15,HC,Y16, ,,,,15,HC,Y16,
,,,,,,, ,,,,,,,
PRO,,需要吹气的温度(温度标准),Max_Temperature,0,,,
PRO,,需要吹气的湿度(湿度标准),Max_Humidity,10,,,
PRO,,每次吹气的时间(分钟),BlowAir_Time,10,,,
PRO,,两次吹气间隔(分钟),BlowAir_Interval,10,,,
PRO,,温湿度端口号,Humiture_Port,COM5,,,
,,,,,,, ,,,,,,,
PRO,,气压检测IO关闭需要持续的时间,AirCheckSeconds,3,,, PRO,,气压检测IO关闭需要持续的时间,AirCheckSeconds,3,,,
PRO,,预警温度,WarnTemperate,80,,, PRO,0,IO信号超时时间(毫秒),IOSingle_TimerOut,10000,,,,,,,,,,,,
PRO,,预警湿度,WarnHumidity,80,,,
...@@ -170,7 +170,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -170,7 +170,7 @@ namespace OnlineStore.DeviceLibrary
} }
else if (wait.WaitType == 2) else if (wait.WaitType == 2)
{ {
wait.IsEnd = IOManager.IOValue(wait.IoType).Equals(wait.IoValue); wait.IsEnd = IOValue(wait.IoType).Equals(wait.IoValue);
int timeOutMs = Config.IOSingle_TimerOut; int timeOutMs = Config.IOSingle_TimerOut;
if (MoveInfo.MoveStep.Equals(StoreMoveStep.SO_28_WaitTake)) if (MoveInfo.MoveStep.Equals(StoreMoveStep.SO_28_WaitTake))
{ {
...@@ -199,7 +199,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -199,7 +199,7 @@ namespace OnlineStore.DeviceLibrary
isOk = false; isOk = false;
break; break;
} }
else if ((!wait.IsEnd) && MoveInfo.MoveStep.Equals(StoreMoveStep.SO_28_WaitTake) && LineConnect.CanReSend()) else if ((!wait.IsEnd) && MoveInfo.MoveStep.Equals(StoreMoveStep.SO_28_WaitTake) && lineConnect.CanReSend())
{ {
//判断是否需要重发入库结束命令 //判断是否需要重发入库结束命令
SendOutStoreEnd(MoveInfo); SendOutStoreEnd(MoveInfo);
...@@ -216,7 +216,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -216,7 +216,7 @@ namespace OnlineStore.DeviceLibrary
if (ww != null && ww.WaitType.Equals(2) && Config.DOList.ContainsKey(ww.IoType)) if (ww != null && ww.WaitType.Equals(2) && Config.DOList.ContainsKey(ww.IoType))
{ {
isLog = true; isLog = true;
IOManager.IOMove(ww.IoType, ww.IoValue); IOMove(ww.IoType, ww.IoValue);
msg += ww.ToStr() + ","; msg += ww.ToStr() + ",";
} }
} }
...@@ -298,7 +298,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -298,7 +298,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error( Name + " 启动入库【" + posId + "】出错,找不到库位信息"); LogUtil.error( Name + " 启动入库【" + posId + "】出错,找不到库位信息");
return; return;
} }
if (IOManager.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.HIGH)) if (IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.HIGH))
{ {
LogUtil.error( Name + " 启动入库【" + posId + "】出错,叉子料盘检测有料"); LogUtil.error( Name + " 启动入库【" + posId + "】出错,叉子料盘检测有料");
return; return;
...@@ -315,7 +315,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -315,7 +315,7 @@ namespace OnlineStore.DeviceLibrary
//StoreMove.WaitList.Add(WaitResultInfo.WaitTime(100)); //StoreMove.WaitList.Add(WaitResultInfo.WaitTime(100));
//StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.HIGH)); //StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.HIGH));
if (IOManager.IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.HIGH)) if (IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.HIGH))
{ {
doorCheckWatch.Restart(); doorCheckWatch.Restart();
} }
...@@ -391,7 +391,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -391,7 +391,7 @@ namespace OnlineStore.DeviceLibrary
if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_00_TrayCheck)) if (MoveInfo.MoveStep.Equals(StoreMoveStep.SI_00_TrayCheck))
{ {
//判断是否有料盘信号 //判断是否有料盘信号
if (IOManager.IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.HIGH) && StoreManager.checkWatch(doorCheckWatch, 1000, false)) if (IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.HIGH) && StoreManager.checkWatch(doorCheckWatch, 1000, false))
{ {
SI_02_Move(moveP); SI_02_Move(moveP);
} }
...@@ -420,7 +420,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -420,7 +420,7 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.MoveStep == StoreMoveStep.SI_02_InOutAxisHome) else if (MoveInfo.MoveStep == StoreMoveStep.SI_02_InOutAxisHome)
{ {
if (IOManager.IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.LOW))
{ {
string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosInfo.PosId : ""; string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosInfo.PosId : "";
CodeMsg = "入库[" + posId + "]叉子去取料前,未检测到进料口有料"; CodeMsg = "入库[" + posId + "]叉子去取料前,未检测到进料口有料";
...@@ -476,7 +476,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -476,7 +476,7 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.MoveStep == StoreMoveStep.SI_07_DeviceBackFromDoor) else if (MoveInfo.MoveStep == StoreMoveStep.SI_07_DeviceBackFromDoor)
{ {
if (IOManager.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.LOW))
{ {
string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosInfo.PosId : ""; string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosInfo.PosId : "";
CodeMsg = "入库[" + posId + "]叉子取料后退后,未检测到料叉有料"; CodeMsg = "入库[" + posId + "]叉子取料后退后,未检测到料叉有料";
...@@ -498,8 +498,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -498,8 +498,8 @@ namespace OnlineStore.DeviceLibrary
ACAxisMove(Config.Middle_Axis, moveP.Middle_P2, Config.MiddleAxis_P1_Speed); ACAxisMove(Config.Middle_Axis, moveP.Middle_P2, Config.MiddleAxis_P1_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P3, Config.UpDownAxis_P3_Speed); ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P3, Config.UpDownAxis_P3_Speed);
//关闭舱门 //关闭舱门
//IOManager.IOMove(IO_Type.Door_Down, IO_VALUE.HIGH); //IOMove(IO_Type.Door_Down, IO_VALUE.HIGH);
//IOManager.IOMove(IO_Type.Door_Up, IO_VALUE.LOW); //IOMove(IO_Type.Door_Up, IO_VALUE.LOW);
CloseDoor(false); CloseDoor(false);
} }
else if (MoveInfo.MoveStep == StoreMoveStep.SI_09_MoveToBag) else if (MoveInfo.MoveStep == StoreMoveStep.SI_09_MoveToBag)
...@@ -510,7 +510,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -510,7 +510,7 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.MoveStep == StoreMoveStep.SI_10_LocationCylinder_Down) else if (MoveInfo.MoveStep == StoreMoveStep.SI_10_LocationCylinder_Down)
{ {
//IOManager.IOMove(IO_Type.LocationCylinder_Down, IO_VALUE.LOW); //IOMove(IO_Type.LocationCylinder_Down, IO_VALUE.LOW);
InStoreLog("入库:SI_11 叉子进入库位中,进出轴至P3(库位取放料点) [" + moveP.InOut_P3 + "] "); InStoreLog("入库:SI_11 叉子进入库位中,进出轴至P3(库位取放料点) [" + moveP.InOut_P3 + "] ");
MoveInfo.NextMoveStep(StoreMoveStep.SI_11_DeviceToBag); MoveInfo.NextMoveStep(StoreMoveStep.SI_11_DeviceToBag);
ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed); ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
...@@ -590,7 +590,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -590,7 +590,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error( Name + " 启动出库【" + posId + "】出错,找不到库位信息"); LogUtil.error( Name + " 启动出库【" + posId + "】出错,找不到库位信息");
return false; return false;
} }
if (IOManager.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.HIGH)) if (IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.HIGH))
{ {
LogUtil.error( Name + " 启动出库【" + posId + "】出错,叉子料盘检测有料"); LogUtil.error( Name + " 启动出库【" + posId + "】出错,叉子料盘检测有料");
return false; return false;
...@@ -666,7 +666,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -666,7 +666,7 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.MoveStep == StoreMoveStep.SO_06_InoutToP1) else if (MoveInfo.MoveStep == StoreMoveStep.SO_06_InoutToP1)
{ {
if (IOManager.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.LOW))
{ {
string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosInfo.PosId : ""; string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosInfo.PosId : "";
CodeMsg = "出库[" + posId + "]叉子从库位退出后,未检测到料叉有料"; CodeMsg = "出库[" + posId + "]叉子从库位退出后,未检测到料叉有料";
...@@ -782,7 +782,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -782,7 +782,7 @@ namespace OnlineStore.DeviceLibrary
//OutStoreLog("出库:检测料仓门口料盘信号 "); //OutStoreLog("出库:检测料仓门口料盘信号 ");
//StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.HIGH)); //StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.HIGH));
if (IOManager.IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.LOW))
{ {
string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosInfo.PosId : ""; string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosInfo.PosId : "";
string barcode = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosInfo.barcode : ""; string barcode = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosInfo.barcode : "";
...@@ -864,13 +864,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -864,13 +864,13 @@ namespace OnlineStore.DeviceLibrary
} }
private void SendOutStoreEnd(StoreMoveInfo storeMove) private void SendOutStoreEnd(StoreMoveInfo storeMove)
{ {
int hasTray = (int)IOManager.IOValue(IO_Type.TrayCheck_Door); int hasTray = (int)IOValue(IO_Type.TrayCheck_Door);
int ss = (int)storeStatus; int ss = (int)storeStatus;
if (IsDebug) if (IsDebug)
{ {
ss = (int)StoreStatus.Debugging; ss = (int)StoreStatus.Debugging;
} }
StoreSendBean store = new StoreSendBean(Config.DeviceID, Config.CID, (int)storeStatus, (int)storeRunStatus, hasTray, (int)alarmType); StoreSendBean store = lineConnect.GetBean((int)storeStatus, (int)storeRunStatus, hasTray, (int)alarmType);
store.data.Add(ParamDefine.posId, MoveInfo.MoveParam.PosInfo.PosId); store.data.Add(ParamDefine.posId, MoveInfo.MoveParam.PosInfo.PosId);
store.data.Add(ParamDefine.plateH, MoveInfo.MoveParam.PosInfo.PlateH.ToString()); store.data.Add(ParamDefine.plateH, MoveInfo.MoveParam.PosInfo.PlateH.ToString());
store.data.Add(ParamDefine.plateW, MoveInfo.MoveParam.PosInfo.PlateW.ToString()); store.data.Add(ParamDefine.plateW, MoveInfo.MoveParam.PosInfo.PlateW.ToString());
...@@ -887,7 +887,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -887,7 +887,7 @@ namespace OnlineStore.DeviceLibrary
//store.urgentReel = storeMove.MoveParam.PosInfo.urgentReel; //store.urgentReel = storeMove.MoveParam.PosInfo.urgentReel;
//store.rfid = storeMove.MoveParam.PosInfo.rfid; //store.rfid = storeMove.MoveParam.PosInfo.rfid;
//store.rfidLoc = storeMove.MoveParam.PosInfo.rfidLoc; //store.rfidLoc = storeMove.MoveParam.PosInfo.rfidLoc;
LineConnect.OutStoreEnd(store); lineConnect.OutStoreEnd(store);
} }
private void SO_53_InoutToP2() private void SO_53_InoutToP2()
...@@ -917,10 +917,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -917,10 +917,10 @@ namespace OnlineStore.DeviceLibrary
// return true; // return true;
//} //}
//if (IOManager.IOValue(IO_Type.LocationCylinder_Down).Equals(IO_VALUE.HIGH) //if (IOValue(IO_Type.LocationCylinder_Down).Equals(IO_VALUE.HIGH)
// && IOManager.IOValue(IO_Type.LocationCylinder_Up).Equals(IO_VALUE.LOW) // && IOValue(IO_Type.LocationCylinder_Up).Equals(IO_VALUE.LOW)
// && IOManager.IOValue(IO_Type.LocationCylinder2_Down).Equals(IO_VALUE.HIGH) // && IOValue(IO_Type.LocationCylinder2_Down).Equals(IO_VALUE.HIGH)
// && IOManager.IOValue(IO_Type.LocationCylinder2_Up).Equals(IO_VALUE.LOW)) // && IOValue(IO_Type.LocationCylinder2_Up).Equals(IO_VALUE.LOW))
//{ //{
// return true; // return true;
//} //}
......
using Asa; using Asa;
using HuichuanLibrary;
using log4net; using log4net;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
...@@ -34,7 +35,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -34,7 +35,8 @@ namespace OnlineStore.DeviceLibrary
lineConfig.IOSingle_TimerOut = 5000; lineConfig.IOSingle_TimerOut = 5000;
} }
Init(); Init();
InitTimer(); InitTimer();
this.baseConfig = lineConfig;
this.Config = lineConfig; this.Config = lineConfig;
this.DeviceID = lineConfig.DeviceID; this.DeviceID = lineConfig.DeviceID;
...@@ -42,8 +44,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -42,8 +44,10 @@ namespace OnlineStore.DeviceLibrary
Name = (" Store_" + Config.CID + " ").ToUpper(); Name = (" Store_" + Config.CID + " ").ToUpper();
List<string> ioList = new List<string>(); List<string> ioList = new List<string>();
HCBoardManager.InitConfig();
IOManager.Init(); IOManager.Init();
AxisManager.Init(); AxisManager.Init();
AxisManager.instance.OpenCard();
foreach (BoxConfig config in configList.Values) foreach (BoxConfig config in configList.Values)
...@@ -179,10 +183,23 @@ namespace OnlineStore.DeviceLibrary ...@@ -179,10 +183,23 @@ namespace OnlineStore.DeviceLibrary
{ {
try try
{ {
// 机器状态 顶灯显示
// 绿 黄 红
//机器复位中 闪 灭 灭
//机器待机中 亮 灭 灭
//机器出入库中 闪 闪 灭
//温湿度超限报警中 亮 闪 灭
//温湿度超限报警中超过30分钟 亮 闪 闪
//机器未启动 灭 灭 灭
//机器设备故障(非温湿度)报警 亮 灭 闪
//报警时只需要亮红灯
DateTime time = DateTime.Now; DateTime time = DateTime.Now;
bool isNeedAlarmLed = false; bool isNeedAlarmLed = false;
//bool isTemp30M = false;
bool isInOut = false; bool isInOut = false;
StoreRunStatus runs = StoreRunStatus.Wait; bool isReset = false;
//StoreRunStatus runs = StoreRunStatus.Wait;
foreach (BoxBean box in BoxMap.Values) foreach (BoxBean box in BoxMap.Values)
{ {
...@@ -190,18 +207,31 @@ namespace OnlineStore.DeviceLibrary ...@@ -190,18 +207,31 @@ namespace OnlineStore.DeviceLibrary
{ {
isNeedAlarmLed = true; isNeedAlarmLed = true;
} }
if (box.humBean.TempOrHumidityIsAlarm)
{
TimeSpan span = DateTime.Now - box.humBean.TempAlarmTime;
if (span.Minutes > 30)
{
//isTemp30M = true;
isNeedAlarmLed = true;
}
}
if (box.MoveInfo.MoveType.Equals(StoreMoveType.InStore) || box.MoveInfo.MoveType.Equals(StoreMoveType.OutStore)) if (box.MoveInfo.MoveType.Equals(StoreMoveType.InStore) || box.MoveInfo.MoveType.Equals(StoreMoveType.OutStore))
{ {
isInOut = true; isInOut = true;
} }
if (box.storeRunStatus > runs) if (box.storeRunStatus.Equals(StoreRunStatus.HomeMoving) || box.storeRunStatus.Equals(StoreRunStatus.Reset))
{ {
runs = box.storeRunStatus; isReset = true;
} }
} }
if (alarmType.Equals(StoreAlarmType.None).Equals(false) || isNoAirCheck || isInSuddenDown)
{
isNeedAlarmLed = true;
}
//黄灯 //黄灯
if (runs.Equals(StoreRunStatus.HomeMoving) || runs.Equals(StoreRunStatus.Reset)) if (isReset)
{ {
//开机执行中时黄灯闪烁 //开机执行中时黄灯闪烁
if (IsDoValue(IO_Type.RunSign_HddLed, IO_VALUE.HIGH)) if (IsDoValue(IO_Type.RunSign_HddLed, IO_VALUE.HIGH))
...@@ -220,10 +250,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -220,10 +250,7 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW); IOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW);
} }
} }
if (alarmType.Equals(StoreAlarmType.None).Equals(false) || isNoAirCheck || isInSuddenDown)
{
isNeedAlarmLed = true;
}
//忙碌中,判断是否有移栽在出入库执行,绿灯闪烁 //忙碌中,判断是否有移栽在出入库执行,绿灯闪烁
if (isInOut) if (isInOut)
{ {
...@@ -252,24 +279,33 @@ namespace OnlineStore.DeviceLibrary ...@@ -252,24 +279,33 @@ namespace OnlineStore.DeviceLibrary
{ {
IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW); IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
} }
if (UseBuzzer)
{
if (IsDoValue(IO_Type.Alarm_Buzzer, IO_VALUE.LOW))
{
IOMove(IO_Type.Alarm_Buzzer, IO_VALUE.HIGH);
}
}
} }
else if (IsDoValue(IO_Type.Alarm_HddLed, IO_VALUE.HIGH)) else if (IsDoValue(IO_Type.Alarm_HddLed, IO_VALUE.HIGH))
{ {
IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW); IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
} }
if ((!UseBuzzer) || (!isNeedAlarmLed))
{
if (IsDoValue(IO_Type.Alarm_Buzzer, IO_VALUE.HIGH))
{
IOMove(IO_Type.Alarm_Buzzer, IO_VALUE.LOW);
}
}
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(Name + "灯处理定时器出错:" + ex.ToString()); LogUtil.error(Name + "灯处理定时器出错:" + ex.ToString());
} }
Thread.Sleep(5); Thread.Sleep(5);
} }
private bool IsDoValue(string ioType, IO_VALUE ioValue)
{
return IOValue(ioType).Equals(ioValue);
}
#endregion #endregion
private IO_VALUE lastAutoRun = IO_VALUE.LOW; private IO_VALUE lastAutoRun = IO_VALUE.LOW;
...@@ -309,7 +345,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -309,7 +345,7 @@ namespace OnlineStore.DeviceLibrary
private void AirCheckProcess() private void AirCheckProcess()
{ {
IO_VALUE currAirValue = IOManager.IOValue(IO_Type.Airpressure_Check); IO_VALUE currAirValue = IOValue(IO_Type.Airpressure_Check);
if (isInSuddenDown) if (isInSuddenDown)
{ {
return; return;
......
...@@ -24,6 +24,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -24,6 +24,7 @@ namespace OnlineStore.DeviceLibrary
public static StoreConfig Config = null; public static StoreConfig Config = null;
private static bool isInit = false; private static bool isInit = false;
public static bool IsConnectServer = !ConfigAppSettings.GetValue(Setting_Init.http_server).Equals(""); public static bool IsConnectServer = !ConfigAppSettings.GetValue(Setting_Init.http_server).Equals("");
public static Dictionary<int, BaseConfig> allConfigMap = new Dictionary<int, BaseConfig>();
public StoreManager() public StoreManager()
{ {
} }
...@@ -50,6 +51,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -50,6 +51,7 @@ namespace OnlineStore.DeviceLibrary
{ {
try try
{ {
allConfigMap = new Dictionary<int, BaseConfig>();
BaseConfig.SubDIList = new Dictionary<int, Dictionary<string, ConfigIO>>(); BaseConfig.SubDIList = new Dictionary<int, Dictionary<string, ConfigIO>>();
BaseConfig.SubDOList = new Dictionary<int, Dictionary<string, ConfigIO>>(); BaseConfig.SubDOList = new Dictionary<int, Dictionary<string, ConfigIO>>();
BaseConfig.ProIOIpMap = new Dictionary<string, string>(); BaseConfig.ProIOIpMap = new Dictionary<string, string>();
...@@ -87,6 +89,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -87,6 +89,7 @@ namespace OnlineStore.DeviceLibrary
boxConfig.SetIO(0); boxConfig.SetIO(0);
boxConfig.SetIO(i); boxConfig.SetIO(i);
BoxList.Add(i, boxConfig); BoxList.Add(i, boxConfig);
allConfigMap.Add(i, boxConfig);
} }
string positionConfigFile = appPath + ConfigAppSettings.GetValue(Setting_Init.Store_Position_Config); string positionConfigFile = appPath + ConfigAppSettings.GetValue(Setting_Init.Store_Position_Config);
if (count > 1 || (!File.Exists(positionConfigFile))) if (count > 1 || (!File.Exists(positionConfigFile)))
...@@ -171,16 +174,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -171,16 +174,16 @@ namespace OnlineStore.DeviceLibrary
// } // }
// return Store; // return Store;
//} //}
public static string GetLocationPosId(int storeId, int width) public static string GetLocationPosId(int deviceID, int width)
{ {
if (storeId <= 0) if (deviceID <= 0)
{ {
string config = ConfigAppSettings.GetValue(Setting_Init.Location_PosID_ + width); string config = ConfigAppSettings.GetValue(Setting_Init.Location_PosID_ + width);
return config; return config;
} }
else else
{ {
string config = ConfigAppSettings.GetValue(Setting_Init.Location_PosID_ +storeId+"_"+ width); string config = ConfigAppSettings.GetValue(Setting_Init.Location_PosID_ +deviceID+"_"+ width);
return config; return config;
} }
} }
...@@ -224,7 +227,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -224,7 +227,7 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.error("保存配置文件失败:" + configFile); LogUtil.error("保存配置文件失败:" + configFile);
} }
allConfigMap[storeConfig.DeviceID] = storeConfig;
Store.BoxConfigMap[storeConfig.DeviceID] = storeConfig; Store.BoxConfigMap[storeConfig.DeviceID] = storeConfig;
Store.BoxMap[storeConfig.DeviceID].Config = storeConfig; Store.BoxMap[storeConfig.DeviceID].Config = storeConfig;
Store.BoxMap[storeConfig.DeviceID].MoveAxisConfig(); Store.BoxMap[storeConfig.DeviceID].MoveAxisConfig();
......
...@@ -423,23 +423,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -423,23 +423,17 @@ namespace OnlineStore.DeviceLibrary
public void IOMove(string IoType, IO_VALUE value) public void IOMove(string IoType, IO_VALUE value)
{ {
//IOManager.IOMove(IoType, value, baseConfig.DeviceID); IOManager.IOMove(IoType, value, baseConfig.DeviceID);
} }
public IO_VALUE IOValue(string IoType) public IO_VALUE IOValue(string IoType)
{ {
//return IOManager.IOValue(IoType, baseConfig.DeviceID); return IOManager.IOValue(IoType, baseConfig.DeviceID);
return IO_VALUE.LOW;
} }
/// <summary>
/// 阻塞等待IO信号,等到返回true,未等到返回false public bool IsDoValue(string ioType, IO_VALUE ioValue)
/// </summary>c
protected bool WaitIo(string ioType, IO_VALUE value, int timeOut, string errName = "")
{ {
//return WaitUtil.Wait(timeOut, delegate () { return IOValue(ioType).Equals(ioValue);
// return value.Equals(IOValue(ioType)); }
//}, errName);
return false;
}
public void LogInfo(string logInfo) public void LogInfo(string logInfo)
{ {
LogUtil.info(Name + logInfo); LogUtil.info(Name + logInfo);
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
<appSettings> <appSettings>
<!--是否开机自动启动料仓--> <!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="1" /> <add key="App_AutoRun" value="1" />
<add key="App_Title" value="AC_SA_料仓_左侧" />
<!-- 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)--> <!-- 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)-->
<add key="StartBlowValue" value="4" /> <add key="StartBlowValue" value="4" />
<!-- 停止吹气的判断值(配置值=服务器发送的湿度值-停止吹气值)--> <!-- 停止吹气的判断值(配置值=服务器发送的湿度值-停止吹气值)-->
...@@ -20,7 +19,7 @@ ...@@ -20,7 +19,7 @@
<add key="Store_ConfigPath" value="\StoreConfig\AC\StoreConfig.csv" /> <add key="Store_ConfigPath" value="\StoreConfig\AC\StoreConfig.csv" />
<add key="Box_ConfigPath" value="\StoreConfig\AC\BoxConfig.csv" /> <add key="Box_ConfigPath" value="\StoreConfig\AC\BoxConfig.csv" />
<add key="Store_Type" value="RC_AC_SA" /> <add key="Store_Type" value="RC_AC_SA" />
<add key="Store_CID" value="line-ac1" /> <add key="Store_CID" value="D1" />
<add key="Store_CID_1" value="line-ac-01" /> <add key="Store_CID_1" value="line-ac-01" />
<add key="Store_CID_2" value="line-ac-02" /> <add key="Store_CID_2" value="line-ac-02" />
<add key="Store_ID" value="7" /> <add key="Store_ID" value="7" />
......
using OnlineStore.DeviceLibrary;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.ACSingleStore
{
public class FormManager
{
//#03A9F4
//public static Color buttonColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255)))));
//public static Color buttonColor = System.Drawing.SystemColors.ActiveCaption;
//public static Color buttonColor = System.Drawing.Color.FromArgb(((int)((0x00))), ((int)((0x66))), ((int)(0xFF)));
//private static string skinFileName = Application.StartupPath + @"\Skins\Wave.ssk";
//private static string skinFileName = Application.StartupPath + @"\Skins\DiamondBlue.ssk";
//public static string SkinFileName
//{
// set
// {
// }
// get
// {
// if (SkinsList.Count <= 0)
// {
// SkinsList = GetSkinList();
// }
// if (SkinsList.Count > 0 && index >= 0)
// {
// return SkinsList[index];
// }
// return skinFileName;
// }
//}
//private static int index = -1;
//public static void DefaultSkin()
//{
// index = -1;
//}
//public static void NextSkin()
//{
// index++;
// if (index >= SkinsList.Count)
// {
// index = 0;
// }
//}
//public static List<string> SkinsList = new List<string>();
//private static List<string> GetSkinList()
//{
// List<string> returnList = new System.Collections.Generic.List<string>();
// string[] fileList = Directory.GetFiles(Application.StartupPath + @"\Skins");
// foreach (string sr in fileList)
// {
// if (sr.Contains(".ssk"))
// {
// returnList.Add(sr);
// }
// }
// return returnList;
//}
private static FrmAxisDebug debug = null;
public static void ShowAxisDebug(BoxBean store)
{
if (debug == null)
{
debug = new FrmAxisDebug(store);
debug.Show();
}
else
{
if (debug.IsDisposed)
{
debug = new FrmAxisDebug(store);
debug.Show();
}
else
{
debug.Activate();
}
}
}
private static FrmIOStatus frmIo = null;
public static void ShowIOShow(BoxBean store)
{
if (frmIo == null)
{
frmIo = new FrmIOStatus(store);
frmIo.Show();
}
else
{
if (frmIo.IsDisposed)
{
frmIo = new FrmIOStatus(store);
frmIo.Show();
}
else
{
frmIo.Activate();
}
}
}
}
}
...@@ -37,8 +37,9 @@ ...@@ -37,8 +37,9 @@
this.txtLineAddr = new System.Windows.Forms.TextBox(); this.txtLineAddr = new System.Windows.Forms.TextBox();
this.txthttpAddr = new System.Windows.Forms.TextBox(); this.txthttpAddr = new System.Windows.Forms.TextBox();
this.btnReset = new System.Windows.Forms.Button(); this.btnReset = new System.Windows.Forms.Button();
this.chbDebug = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.lblRightCid = new System.Windows.Forms.Label();
this.lblLeftCid = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.cmbPosition15 = new System.Windows.Forms.ComboBox(); this.cmbPosition15 = new System.Windows.Forms.ComboBox();
this.label6 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label();
...@@ -73,18 +74,18 @@ ...@@ -73,18 +74,18 @@
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(20, 118); this.label1.Location = new System.Drawing.Point(55, 121);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(104, 17); this.label1.Size = new System.Drawing.Size(65, 17);
this.label1.TabIndex = 0; this.label1.TabIndex = 0;
this.label1.Text = "请选择料仓编号:"; this.label1.Text = "料仓CID:";
// //
// btnNext // btnNext
// //
this.btnNext.Anchor = System.Windows.Forms.AnchorStyles.Top; this.btnNext.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.btnNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnNext.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnNext.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnNext.Location = new System.Drawing.Point(280, 167); this.btnNext.Location = new System.Drawing.Point(332, 190);
this.btnNext.Name = "btnNext"; this.btnNext.Name = "btnNext";
this.btnNext.Size = new System.Drawing.Size(120, 45); this.btnNext.Size = new System.Drawing.Size(120, 45);
this.btnNext.TabIndex = 275; this.btnNext.TabIndex = 275;
...@@ -96,9 +97,9 @@ ...@@ -96,9 +97,9 @@
// //
this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBack.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnBack.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBack.Location = new System.Drawing.Point(379, 538); this.btnBack.Location = new System.Drawing.Point(344, 576);
this.btnBack.Name = "btnBack"; this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(183, 45); this.btnBack.Size = new System.Drawing.Size(120, 45);
this.btnBack.TabIndex = 274; this.btnBack.TabIndex = 274;
this.btnBack.Text = "取消/返回"; this.btnBack.Text = "取消/返回";
this.btnBack.UseVisualStyleBackColor = false; this.btnBack.UseVisualStyleBackColor = false;
...@@ -111,7 +112,7 @@ ...@@ -111,7 +112,7 @@
this.cmbId.FormattingEnabled = true; this.cmbId.FormattingEnabled = true;
this.cmbId.Location = new System.Drawing.Point(128, 114); this.cmbId.Location = new System.Drawing.Point(128, 114);
this.cmbId.Name = "cmbId"; this.cmbId.Name = "cmbId";
this.cmbId.Size = new System.Drawing.Size(285, 29); this.cmbId.Size = new System.Drawing.Size(111, 29);
this.cmbId.TabIndex = 276; this.cmbId.TabIndex = 276;
this.cmbId.SelectedIndexChanged += new System.EventHandler(this.cmbId_SelectedIndexChanged); this.cmbId.SelectedIndexChanged += new System.EventHandler(this.cmbId_SelectedIndexChanged);
// //
...@@ -119,7 +120,7 @@ ...@@ -119,7 +120,7 @@
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(20, 30); this.label2.Location = new System.Drawing.Point(19, 30);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(104, 17); this.label2.Size = new System.Drawing.Size(104, 17);
this.label2.TabIndex = 277; this.label2.TabIndex = 277;
...@@ -129,7 +130,7 @@ ...@@ -129,7 +130,7 @@
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.Location = new System.Drawing.Point(44, 73); this.label3.Location = new System.Drawing.Point(43, 73);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(80, 17); this.label3.Size = new System.Drawing.Size(80, 17);
this.label3.TabIndex = 278; this.label3.TabIndex = 278;
...@@ -166,21 +167,10 @@ ...@@ -166,21 +167,10 @@
this.btnReset.UseVisualStyleBackColor = false; this.btnReset.UseVisualStyleBackColor = false;
this.btnReset.Click += new System.EventHandler(this.btnReset_Click); this.btnReset.Click += new System.EventHandler(this.btnReset_Click);
// //
// chbDebug
//
this.chbDebug.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.chbDebug.AutoSize = true;
this.chbDebug.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbDebug.Location = new System.Drawing.Point(125, 178);
this.chbDebug.Name = "chbDebug";
this.chbDebug.Size = new System.Drawing.Size(93, 25);
this.chbDebug.TabIndex = 282;
this.chbDebug.Text = "调试状态";
this.chbDebug.UseVisualStyleBackColor = true;
//
// groupBox1 // groupBox1
// //
this.groupBox1.Controls.Add(this.chbDebug); this.groupBox1.Controls.Add(this.lblRightCid);
this.groupBox1.Controls.Add(this.lblLeftCid);
this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.btnReset); this.groupBox1.Controls.Add(this.btnReset);
this.groupBox1.Controls.Add(this.btnNext); this.groupBox1.Controls.Add(this.btnNext);
...@@ -191,10 +181,34 @@ ...@@ -191,10 +181,34 @@
this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Location = new System.Drawing.Point(12, 6); this.groupBox1.Location = new System.Drawing.Point(12, 6);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(550, 236); this.groupBox1.Size = new System.Drawing.Size(550, 262);
this.groupBox1.TabIndex = 283; this.groupBox1.TabIndex = 283;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "料仓配置"; this.groupBox1.Text = "料仓地址配置";
//
// lblRightCid
//
this.lblRightCid.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lblRightCid.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.lblRightCid.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblRightCid.Location = new System.Drawing.Point(126, 203);
this.lblRightCid.Name = "lblRightCid";
this.lblRightCid.Size = new System.Drawing.Size(147, 32);
this.lblRightCid.TabIndex = 284;
this.lblRightCid.Text = "右侧:";
this.lblRightCid.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lblLeftCid
//
this.lblLeftCid.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lblLeftCid.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.lblLeftCid.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblLeftCid.Location = new System.Drawing.Point(126, 158);
this.lblLeftCid.Name = "lblLeftCid";
this.lblLeftCid.Size = new System.Drawing.Size(145, 30);
this.lblLeftCid.TabIndex = 283;
this.lblLeftCid.Text = "左侧:";
this.lblLeftCid.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
// groupBox2 // groupBox2
// //
...@@ -330,7 +344,7 @@ ...@@ -330,7 +344,7 @@
this.btnSavePosID.Anchor = System.Windows.Forms.AnchorStyles.Top; this.btnSavePosID.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.btnSavePosID.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnSavePosID.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSavePosID.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnSavePosID.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSavePosID.Location = new System.Drawing.Point(35, 538); this.btnSavePosID.Location = new System.Drawing.Point(104, 576);
this.btnSavePosID.Name = "btnSavePosID"; this.btnSavePosID.Name = "btnSavePosID";
this.btnSavePosID.Size = new System.Drawing.Size(120, 45); this.btnSavePosID.Size = new System.Drawing.Size(120, 45);
this.btnSavePosID.TabIndex = 277; this.btnSavePosID.TabIndex = 277;
...@@ -342,7 +356,7 @@ ...@@ -342,7 +356,7 @@
// //
this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Location = new System.Drawing.Point(12, 248); this.tabControl1.Location = new System.Drawing.Point(12, 277);
this.tabControl1.Name = "tabControl1"; this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0; this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(550, 261); this.tabControl1.Size = new System.Drawing.Size(550, 261);
...@@ -503,7 +517,7 @@ ...@@ -503,7 +517,7 @@
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(614, 668); this.ClientSize = new System.Drawing.Size(589, 654);
this.Controls.Add(this.btnSavePosID); this.Controls.Add(this.btnSavePosID);
this.Controls.Add(this.tabControl1); this.Controls.Add(this.tabControl1);
this.Controls.Add(this.btnBack); this.Controls.Add(this.btnBack);
...@@ -537,7 +551,6 @@ ...@@ -537,7 +551,6 @@
private System.Windows.Forms.TextBox txtLineAddr; private System.Windows.Forms.TextBox txtLineAddr;
private System.Windows.Forms.TextBox txthttpAddr; private System.Windows.Forms.TextBox txthttpAddr;
private System.Windows.Forms.Button btnReset; private System.Windows.Forms.Button btnReset;
private System.Windows.Forms.CheckBox chbDebug;
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.ComboBox cmbPosition7; private System.Windows.Forms.ComboBox cmbPosition7;
...@@ -561,5 +574,7 @@ ...@@ -561,5 +574,7 @@
public System.Windows.Forms.Label label9; public System.Windows.Forms.Label label9;
private System.Windows.Forms.ComboBox cmbBox2_7; private System.Windows.Forms.ComboBox cmbBox2_7;
public System.Windows.Forms.Label label10; public System.Windows.Forms.Label label10;
private System.Windows.Forms.Label lblRightCid;
private System.Windows.Forms.Label lblLeftCid;
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -18,7 +18,13 @@ namespace OnlineStore.ACSingleStore ...@@ -18,7 +18,13 @@ namespace OnlineStore.ACSingleStore
{ {
public delegate void PwdOK(int type); public delegate void PwdOK(int type);
public event PwdOK PwdOKFun; public event PwdOK PwdOKFun;
private int StoreId = 0;
private string cid = "";
private string cid1 = "";
private string cid2 = "";
private int LeftId = 0;
private int RightId = 0;
public FrmIdConfig() public FrmIdConfig()
{ {
//StoreId = storeId; //StoreId = storeId;
...@@ -32,22 +38,34 @@ namespace OnlineStore.ACSingleStore ...@@ -32,22 +38,34 @@ namespace OnlineStore.ACSingleStore
private void LoadData() private void LoadData()
{ {
cid = StoreManager.Config.CID;
cid1 = StoreManager.Store.BoxMap[1].CID;
cid2 = StoreManager.Store.BoxMap[2].CID;
LeftId = StoreManager.Store.BoxConfigMap[1].GetStoreId();
RightId = StoreManager.Store.BoxConfigMap[2].GetStoreId();
this.DialogResult = DialogResult.None; this.DialogResult = DialogResult.None;
txthttpAddr.Text = ConfigAppSettings.GetValue(Setting_Init.http_server); txthttpAddr.Text = ConfigAppSettings.GetValue(Setting_Init.http_server);
txtLineAddr.Text = ConfigAppSettings.GetValue(Setting_Init.LineServerIp); txtLineAddr.Text = ConfigAppSettings.GetValue(Setting_Init.LineServerIp);
cmbId.Items.Clear(); cmbId.Items.Clear();
int index = 0;
for (int i = 1; i <= 12; i++) for (int i = 1; i <= 12; i++)
{ {
cmbId.Items.Add("D"+i); string n = "D" + i;
cmbId.Items.Add(n);
if (cid.Equals(n))
{
index = i - 1;
}
} }
if (StoreId > 0 && StoreId <= cmbId.Items.Count) cmbId.SelectedIndex = index;
{
cmbId.SelectedIndex = StoreId - 1;
}
chbDebug.Checked = StoreManager.Store.IsDebug;
LoadPos(); LoadPos();
lblLeftCid.Text = "左侧 : " + cid1;
lblRightCid.Text = "右侧 : " + cid2;
} }
private List<string> allList1 = new List<string>(); private List<string> allList1 = new List<string>();
...@@ -90,9 +108,36 @@ namespace OnlineStore.ACSingleStore ...@@ -90,9 +108,36 @@ namespace OnlineStore.ACSingleStore
private void btnNext_Click(object sender, EventArgs e) private void btnNext_Click(object sender, EventArgs e)
{ {
SaveConfig();
} }
private void SaveConfig()
{
//int index = cmbId.SelectedIndex + 1;
DialogResult result = MessageBox.Show("更改料仓为[" + cid + "],左侧CID ["+cid1+"],右侧ICID ["+cid2+"] \r\n 重启客户端后生效", "确认提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
if (result.Equals(DialogResult.OK))
{
//string storeCID = "line-ac-" + index.ToString().PadLeft(2, '0');
ConfigAppSettings.SaveValue(Setting_Init.Store_CID, cid);
ConfigAppSettings.SaveValue(Setting_Init.Store_CID + "_1", cid1);
ConfigAppSettings.SaveValue(Setting_Init.Store_CID + "_2", cid2);
//如果总配置文件存在,保存到总的配置文件
string filePath1 = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.Store_Position_Config).Replace(".csv", "_1.csv");
LoadCSVLibrary.CSVPositionReader<ACStorePosition>.UpdatePostion(filePath1, LeftId);
string filePath2 = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.Store_Position_Config).Replace(".csv", "_2.csv");
LoadCSVLibrary.CSVPositionReader<ACStorePosition>.UpdatePostion(filePath2, RightId);
string httpstr = txthttpAddr.Text.Trim();
ConfigAppSettings.SaveValue(Setting_Init.http_server, httpstr);
string lineStr = txtLineAddr.Text.Trim();
ConfigAppSettings.SaveValue(Setting_Init.LineServerIp, lineStr);
LogUtil.info("更改料仓为[" + cid + "],左侧CID [" + cid1 + "],右侧ICID [" + cid2 + "],http_server ["+httpstr+"] ,LineServerIp ["+lineStr+"] ");
MessageBox.Show("保存成功,请重启客户端");
this.DialogResult = DialogResult.OK;
}
}
private void btnBack_Click(object sender, EventArgs e) private void btnBack_Click(object sender, EventArgs e)
{ {
this.DialogResult = DialogResult.Cancel; this.DialogResult = DialogResult.Cancel;
...@@ -152,10 +197,12 @@ namespace OnlineStore.ACSingleStore ...@@ -152,10 +197,12 @@ namespace OnlineStore.ACSingleStore
private void btnSavePosID_Click(object sender, EventArgs e) private void btnSavePosID_Click(object sender, EventArgs e)
{ {
SavePosition();
} }
private void SaveP(int storeId, ComboBox box, int width) private void SaveP(int storeId, ComboBox box, int width)
{ {
string key = Setting_Init.Location_PosID_ + storeId + "_" + width;
if (storeId.Equals(1)) if (storeId.Equals(1))
{ {
string value = box.Text; string value = box.Text;
...@@ -168,7 +215,8 @@ namespace OnlineStore.ACSingleStore ...@@ -168,7 +215,8 @@ namespace OnlineStore.ACSingleStore
{ {
value = ""; value = "";
} }
ConfigAppSettings.SaveValue(Setting_Init.Location_PosID_ + storeId + "_" + width, value); ConfigAppSettings.SaveValue(key, value);
LogUtil.info("更改配置:【" + key + "】=【" + value + "】");
} }
else if (storeId.Equals(2)) else if (storeId.Equals(2))
{ {
...@@ -182,41 +230,39 @@ namespace OnlineStore.ACSingleStore ...@@ -182,41 +230,39 @@ namespace OnlineStore.ACSingleStore
{ {
value = ""; value = "";
} }
ConfigAppSettings.SaveValue(Setting_Init.Location_PosID_ + storeId + "_" + width, value); ConfigAppSettings.SaveValue(key, value);
LogUtil.info("更改配置:【" + key + "】=【" + value + "】");
} }
} }
private void cmbId_SelectedIndexChanged(object sender, EventArgs e) private void cmbId_SelectedIndexChanged(object sender, EventArgs e)
{ {
int index = cmbId.SelectedIndex;
} if (index >= 0)
private void SaveConfig()
{
int index = cmbId.SelectedIndex + 1;
DialogResult result = MessageBox.Show("更改料仓编号为[" + index + "],需要重启客户端", "确认提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
if (result.Equals(DialogResult.OK))
{ {
// < add key = "Store_CID" value = "line-ac-01" /> int num = index + 1;
// <add key ="Store_ID" value ="1"/> cid = "D" + num;
string storeCID = "line-ac-" + index.ToString().PadLeft(2, '0'); if (num <= 6)
string storeId = index.ToString(); {
ConfigAppSettings.SaveValue(Setting_Init.Store_CID, storeCID); LeftId = num * 2 - 1;
ConfigAppSettings.SaveValue(Setting_Init.Store_ID, storeId); RightId = num * 2;
//如果总配置文件存在,保存到总的配置文件 cid1 = "line-ac-" + (LeftId).ToString().PadLeft(2, '0');
string filePath = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.Store_Position_Config); cid2 = "line-ac-" + (RightId).ToString().PadLeft(2, '0');
LoadCSVLibrary.CSVPositionReader<ACStorePosition>.UpdatePostion(filePath, index); }
else
{
LeftId = num * 2;
RightId = num * 2 - 1;
string httpstr = txthttpAddr.Text.Trim(); cid1 = "line-ac-" + (num * 2 ).ToString().PadLeft(2, '0');
ConfigAppSettings.SaveValue(Setting_Init.http_server, httpstr); cid2 = "line-ac-" + (num * 2 - 1).ToString().PadLeft(2, '0');
string lineStr = txtLineAddr.Text.Trim(); }
ConfigAppSettings.SaveValue(Setting_Init.LineServerIp, lineStr);
StoreManager.Store.IsDebug = chbDebug.Checked; lblLeftCid.Text = "左侧 : " + cid1;
ConfigAppSettings.SaveValue(Setting_Init.IsInDebug, chbDebug.Checked ? 1 : 0); lblRightCid.Text = "右侧 : " + cid2;
MessageBox.Show("保存成功,请重启客户端");
this.DialogResult = DialogResult.OK;
} }
} }
private void SavePosition() private void SavePosition()
{ {
......
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.CompilerServices;
using System.Threading;
using System.IO;
using System.Runtime.InteropServices;
using OnlineStore.DeviceLibrary;
using log4net;
using System.Reflection;
using UserFromControl;
using OnlineStore.LoadCSVLibrary;
using OnlineStore.Common;
namespace OnlineStore.ACSingleStore
{
public partial class FrmIOStatus : FrmBase
{
private int StoreId = 1;
private BoxBean boxBean;
//public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public FrmIOStatus()
{
Control.CheckForIllegalCrossThreadCalls = false;
InitializeComponent();
}
public FrmIOStatus(BoxBean store)
{
Control.CheckForIllegalCrossThreadCalls = false;
InitializeComponent();
this.boxBean = store;
this.StoreId = store.DeviceID;
LoadIOList();
}
Dictionary<string, IOTextControl> DIControlList = new Dictionary<string, IOTextControl>();
Dictionary<string, IOTextControl> DOControlList = new Dictionary<string, IOTextControl>();
private void LoadIOList()
{
int roleindex = 0;
this.tableLayoutPanel1.RowStyles.Clear();
this.tableLayoutPanel1.RowCount = boxBean.Config.DIList.Count;
foreach (ConfigIO ioValue in boxBean.Config.DIList.Values)
{
this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 28));
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + ioValue.Explain, ioValue.ProName);
this.tableLayoutPanel1.Controls.Add(control, 0, roleindex);
roleindex++;
DIControlList.Add(ioValue.ProName, control);
}
tableLayoutPanel2.RowStyles.Clear();
this.tableLayoutPanel2.RowCount = boxBean.Config.DOList.Count;
roleindex = 0;
foreach (ConfigIO ioValue in boxBean.Config.DOList.Values)
{
this.tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 28));
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + ioValue.Explain, ioValue.ProName);
this.tableLayoutPanel2.Controls.Add(control, 0, roleindex);
roleindex++;
DOControlList.Add(ioValue.ProName, control);
}
this.SuspendLayout(); //此处为不闪屏,一定要有的!
cmbWriteIO.DataSource = new List<ConfigIO>(boxBean.Config.DOList.Values);
cmbWriteIO.ValueMember = "ProName";
cmbWriteIO.DisplayMember = "DisplayStr";
}
private void timer1_Tick(object sender, EventArgs e)
{
if (chbAutoRead.Checked)
{
ReadIOList();
}
}
private void FrmTest_FormClosing(object sender, FormClosingEventArgs e)
{
//KNDAIManager.NeedShow = false;
try
{
if (this.timer1.Enabled)
{
this.timer1.Enabled = false;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.StackTrace, "Exception(异常)", MessageBoxButtons.OK, MessageBoxIcon.Error);
LogUtil.error( ex.StackTrace);
}
}
private ConfigIO GetSelectDO()
{
string text = cmbWriteIO.SelectedValue.ToString();
if (boxBean.Config.DOList.ContainsKey(text))
{
ConfigIO io = boxBean.Config.DOList[text];
return io;
}
return null;
}
IOTextControl selectControl = null;
private void cmbWriteIO_SelectedIndexChanged(object sender, EventArgs e)
{
if (cmbWriteIO.SelectedIndex >= 0)
{
ConfigIO io = GetSelectDO();
if (io != null)
{
// txtIp.Text = io.DeviceName;
txtDOIndex.Text = io.GetIOAddr().ToString();
txtDoName.Text = io.IO_IP;
IOTextControl newControl = DOControlList[io.ProName];
selectControl = newControl;
}
}
}
private void FrmStoreIOStatus_Load(object sender, EventArgs e)
{
//KNDAIManager.NeedShow = true;
}
private void cmbWriteIO_DrawItem(object sender, DrawItemEventArgs e)
{
if (e.Index < 0)
{
return;
}
e.DrawBackground();
e.DrawFocusRectangle();
if (cmbWriteIO.Items.Count > e.Index)
{
ConfigIO io = (ConfigIO)cmbWriteIO.Items[e.Index];
e.Graphics.DrawString(io.DisplayStr, e.Font, new SolidBrush(e.ForeColor), e.Bounds.X, e.Bounds.Y + 3);
}
}
private void btnReadIO_Click(object sender, EventArgs e)
{
ReadIOList();
}
private void ReadIOList()
{
foreach (string key in DIControlList.Keys)
{
IOTextControl control = DIControlList[key];
int iov = (int)IOManager.IOValue(key);
if (iov != control.IOValue)
{
control.IOValue = iov;
control.ShowData();
}
} foreach (string key in this.DOControlList.Keys)
{
IOTextControl control = DOControlList[key];
int iov = (int)IOManager.DOValue(key);
if (iov != control.IOValue)
{
control.IOValue = iov;
control.ShowData();
}
}
}
private void btnOpenDoor_Click(object sender, EventArgs e)
{
boxBean.OpenDoor(false);
}
private void btnCloseDoor_Click(object sender, EventArgs e)
{
boxBean.CloseDoor(false);
}
private void FrmIOStatus_Shown(object sender, EventArgs e)
{
timer1.Start();
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnOpenDo_Click(object sender, EventArgs e)
{
WriteDO(IO_VALUE.HIGH);
}
private void btnWriteSingleDO_Click(object sender, EventArgs e)
{
WriteDO(IO_VALUE.LOW);
}
private void WriteDO(IO_VALUE value)
{
string deviceName = txtDoName.Text;
int index = FormUtil.GetIntValue(txtDOIndex);
// IO_VALUE value = checkBox1.Checked ? IO_VALUE.HIGH : IO_VALUE.LOW;
int time = FormUtil.GetIntValue(txtWriteTime);
int slaveId = 0;
if (time > 0)
{
IOManager.instance.WriteSingleDO(deviceName, (byte)slaveId, (ushort)index, (IO_VALUE)value, time);
}
else
{
IOManager.instance.WriteSingleDO(deviceName, (byte)slaveId, (ushort)index, (IO_VALUE)value);
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 11</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
</metadata>
</root>
\ No newline at end of file \ No newline at end of file
...@@ -37,8 +37,6 @@ ...@@ -37,8 +37,6 @@
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.btnCopyLog = new System.Windows.Forms.Button();
this.btnClearLog = new System.Windows.Forms.Button();
this.logBox = new System.Windows.Forms.RichTextBox(); this.logBox = new System.Windows.Forms.RichTextBox();
this.lblWarnMsg = new System.Windows.Forms.Label(); this.lblWarnMsg = new System.Windows.Forms.Label();
this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.menuStrip1 = new System.Windows.Forms.MenuStrip();
...@@ -67,6 +65,10 @@ ...@@ -67,6 +65,10 @@
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
this.版本号ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.版本号ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator();
this.复制日志ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator();
this.清空日志ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.显示ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.显示ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
...@@ -102,8 +104,6 @@ ...@@ -102,8 +104,6 @@
this.tabPage1.Controls.Add(this.lblServerMsg); this.tabPage1.Controls.Add(this.lblServerMsg);
this.tabPage1.Controls.Add(this.groupBox4); this.tabPage1.Controls.Add(this.groupBox4);
this.tabPage1.Controls.Add(this.groupBox3); this.tabPage1.Controls.Add(this.groupBox3);
this.tabPage1.Controls.Add(this.btnCopyLog);
this.tabPage1.Controls.Add(this.btnClearLog);
this.tabPage1.Controls.Add(this.logBox); this.tabPage1.Controls.Add(this.logBox);
this.tabPage1.Location = new System.Drawing.Point(4, 29); this.tabPage1.Location = new System.Drawing.Point(4, 29);
this.tabPage1.Name = "tabPage1"; this.tabPage1.Name = "tabPage1";
...@@ -173,30 +173,6 @@ ...@@ -173,30 +173,6 @@
this.tableLayoutPanel1.Size = new System.Drawing.Size(218, 114); this.tableLayoutPanel1.Size = new System.Drawing.Size(218, 114);
this.tableLayoutPanel1.TabIndex = 102; this.tableLayoutPanel1.TabIndex = 102;
// //
// btnCopyLog
//
this.btnCopyLog.BackColor = System.Drawing.Color.White;
this.btnCopyLog.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCopyLog.Location = new System.Drawing.Point(14, 584);
this.btnCopyLog.Name = "btnCopyLog";
this.btnCopyLog.Size = new System.Drawing.Size(105, 35);
this.btnCopyLog.TabIndex = 191;
this.btnCopyLog.Text = "复制日志";
this.btnCopyLog.UseVisualStyleBackColor = false;
this.btnCopyLog.Click += new System.EventHandler(this.btnCopyLog_Click);
//
// btnClearLog
//
this.btnClearLog.BackColor = System.Drawing.Color.White;
this.btnClearLog.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnClearLog.Location = new System.Drawing.Point(125, 584);
this.btnClearLog.Name = "btnClearLog";
this.btnClearLog.Size = new System.Drawing.Size(105, 35);
this.btnClearLog.TabIndex = 190;
this.btnClearLog.Text = "清空日志";
this.btnClearLog.UseVisualStyleBackColor = false;
this.btnClearLog.Click += new System.EventHandler(this.btnClearLog_Click);
//
// logBox // logBox
// //
this.logBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.logBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
...@@ -391,7 +367,11 @@ ...@@ -391,7 +367,11 @@
this.帮助ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.帮助ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem3, this.toolStripMenuItem3,
this.toolStripSeparator9, this.toolStripSeparator9,
this.版本号ToolStripMenuItem}); this.版本号ToolStripMenuItem,
this.toolStripSeparator13,
this.复制日志ToolStripMenuItem,
this.toolStripSeparator12,
this.清空日志ToolStripMenuItem});
this.帮助ToolStripMenuItem.Name = "帮助ToolStripMenuItem"; this.帮助ToolStripMenuItem.Name = "帮助ToolStripMenuItem";
this.帮助ToolStripMenuItem.Size = new System.Drawing.Size(69, 25); this.帮助ToolStripMenuItem.Size = new System.Drawing.Size(69, 25);
this.帮助ToolStripMenuItem.Text = " 系统 "; this.帮助ToolStripMenuItem.Text = " 系统 ";
...@@ -399,22 +379,46 @@ ...@@ -399,22 +379,46 @@
// toolStripMenuItem3 // toolStripMenuItem3
// //
this.toolStripMenuItem3.Name = "toolStripMenuItem3"; this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(144, 26); this.toolStripMenuItem3.Size = new System.Drawing.Size(180, 26);
this.toolStripMenuItem3.Text = "料仓配置"; this.toolStripMenuItem3.Text = "料仓配置";
this.toolStripMenuItem3.Click += new System.EventHandler(this.toolStripMenuItem3_Click); this.toolStripMenuItem3.Click += new System.EventHandler(this.toolStripMenuItem3_Click);
// //
// toolStripSeparator9 // toolStripSeparator9
// //
this.toolStripSeparator9.Name = "toolStripSeparator9"; this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(141, 6); this.toolStripSeparator9.Size = new System.Drawing.Size(177, 6);
// //
// 版本号ToolStripMenuItem // 版本号ToolStripMenuItem
// //
this.版本号ToolStripMenuItem.Name = "版本号ToolStripMenuItem"; this.版本号ToolStripMenuItem.Name = "版本号ToolStripMenuItem";
this.版本号ToolStripMenuItem.Size = new System.Drawing.Size(144, 26); this.版本号ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.版本号ToolStripMenuItem.Text = "关于软件"; this.版本号ToolStripMenuItem.Text = "关于软件";
this.版本号ToolStripMenuItem.Click += new System.EventHandler(this.版本号ToolStripMenuItem_Click); this.版本号ToolStripMenuItem.Click += new System.EventHandler(this.版本号ToolStripMenuItem_Click);
// //
// toolStripSeparator13
//
this.toolStripSeparator13.Name = "toolStripSeparator13";
this.toolStripSeparator13.Size = new System.Drawing.Size(177, 6);
//
// 复制日志ToolStripMenuItem
//
this.复制日志ToolStripMenuItem.Name = "复制日志ToolStripMenuItem";
this.复制日志ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.复制日志ToolStripMenuItem.Text = "复制日志";
this.复制日志ToolStripMenuItem.Click += new System.EventHandler(this.复制日志ToolStripMenuItem_Click);
//
// toolStripSeparator12
//
this.toolStripSeparator12.Name = "toolStripSeparator12";
this.toolStripSeparator12.Size = new System.Drawing.Size(177, 6);
//
// 清空日志ToolStripMenuItem
//
this.清空日志ToolStripMenuItem.Name = "清空日志ToolStripMenuItem";
this.清空日志ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.清空日志ToolStripMenuItem.Text = "清空日志";
this.清空日志ToolStripMenuItem.Click += new System.EventHandler(this.清空日志ToolStripMenuItem_Click);
//
// notifyIcon1 // notifyIcon1
// //
this.notifyIcon1.ContextMenuStrip = this.contextMenuStrip1; this.notifyIcon1.ContextMenuStrip = this.contextMenuStrip1;
...@@ -503,8 +507,6 @@ ...@@ -503,8 +507,6 @@
private System.Windows.Forms.ToolStripMenuItem 复位RToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 复位RToolStripMenuItem;
internal System.Windows.Forms.RichTextBox logBox; internal System.Windows.Forms.RichTextBox logBox;
private System.Windows.Forms.Timer timer1; private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Button btnCopyLog;
private System.Windows.Forms.Button btnClearLog;
private System.Windows.Forms.ToolStripMenuItem 设置TToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 设置TToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 版本号ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 版本号ToolStripMenuItem;
private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.TabPage tabPage1;
...@@ -533,6 +535,10 @@ ...@@ -533,6 +535,10 @@
private System.Windows.Forms.ToolStripSeparator toolStripSeparator11; private System.Windows.Forms.ToolStripSeparator toolStripSeparator11;
private System.Windows.Forms.ToolStripMenuItem 开启DEBUG日志ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 开启DEBUG日志ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 板卡调试ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 板卡调试ToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator13;
private System.Windows.Forms.ToolStripMenuItem 复制日志ToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator12;
private System.Windows.Forms.ToolStripMenuItem 清空日志ToolStripMenuItem;
} }
} }
...@@ -19,7 +19,7 @@ using UserFromControl; ...@@ -19,7 +19,7 @@ using UserFromControl;
namespace OnlineStore.ACSingleStore namespace OnlineStore.ACSingleStore
{ {
internal partial class FrmStore : Form internal partial class FrmStore : FrmBase
{ {
public static StoreBean store = null; public static StoreBean store = null;
private List<TabPage> tabPageList = new List<TabPage>(); private List<TabPage> tabPageList = new List<TabPage>();
...@@ -36,8 +36,8 @@ namespace OnlineStore.ACSingleStore ...@@ -36,8 +36,8 @@ namespace OnlineStore.ACSingleStore
private void FrmMain_Load(object sender, EventArgs e) private void FrmMain_Load(object sender, EventArgs e)
{ {
FrmBase.GetVersion(); string version = GetVersion(true);
store = StoreManager.InitStore(); store = StoreManager.InitStore();
if (store == null) if (store == null)
{ {
...@@ -45,14 +45,8 @@ namespace OnlineStore.ACSingleStore ...@@ -45,14 +45,8 @@ namespace OnlineStore.ACSingleStore
return; return;
} }
LoadIOList(); LoadIOList();
foreach (BoxBean box in store.BoxMap.Values)
{ this.Text = "环形线料仓-" + store.Config.CID;
FrmBox frm = new FrmBox();
frm.boxBean = box;
AddForm(box.Name, frm);
}
this.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title);
int autoValue = ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun); int autoValue = ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun);
if (autoValue.Equals(1)) if (autoValue.Equals(1))
{ {
...@@ -70,8 +64,16 @@ namespace OnlineStore.ACSingleStore ...@@ -70,8 +64,16 @@ namespace OnlineStore.ACSingleStore
{ {
启用蜂鸣器ToolStripMenuItem.Text = "启用蜂鸣器"; 启用蜂鸣器ToolStripMenuItem.Text = "启用蜂鸣器";
} }
foreach (BoxBean box in store.BoxMap.Values)
{
FrmBox frm = new FrmBox();
frm.boxBean = box;
AddForm(box.Name, frm);
}
LoadOk = true; LoadOk = true;
LogUtil.logBox = this.logBox; LogUtil.logBox = this.logBox;
HCLogUtil.logBox = this.logBox;
this.timer1.Start(); this.timer1.Start();
} }
...@@ -187,7 +189,7 @@ namespace OnlineStore.ACSingleStore ...@@ -187,7 +189,7 @@ namespace OnlineStore.ACSingleStore
private void ExitApp() private void ExitApp()
{ {
DialogResult result = MessageBox.Show("是否确定退出包装料料仓客户端?", "提示", MessageBoxButtons.YesNo); DialogResult result = MessageBox.Show("是否确定退出料仓客户端?", "提示", MessageBoxButtons.YesNo);
if (result.Equals(DialogResult.Yes)) if (result.Equals(DialogResult.Yes))
{ {
//如果料仓还在运行状态,先关闭料仓 //如果料仓还在运行状态,先关闭料仓
...@@ -211,6 +213,7 @@ namespace OnlineStore.ACSingleStore ...@@ -211,6 +213,7 @@ namespace OnlineStore.ACSingleStore
IOManager.instance.CloseAllDO(); IOManager.instance.CloseAllDO();
IOManager.instance.CloseAllConnection(); IOManager.instance.CloseAllConnection();
AxisManager.instance.CloseAllPort(); AxisManager.instance.CloseAllPort();
AxisManager.instance.CloseCard();
//this.Close(); //this.Close();
System.Environment.Exit(System.Environment.ExitCode); System.Environment.Exit(System.Environment.ExitCode);
...@@ -247,7 +250,7 @@ namespace OnlineStore.ACSingleStore ...@@ -247,7 +250,7 @@ namespace OnlineStore.ACSingleStore
MessageBox.Show(store.Name + "当前状态:" + store.storeRunStatus + ",不能启动!"); MessageBox.Show(store.Name + "当前状态:" + store.storeRunStatus + ",不能启动!");
return; return;
} }
LogUtil.info( "开始启动"); LogUtil.info(store.Name+ "点击:启动");
startTimer.Interval = 300; startTimer.Interval = 300;
startTimer.Elapsed += timer_Elapsed; startTimer.Elapsed += timer_Elapsed;
startTimer.AutoReset = false; startTimer.AutoReset = false;
...@@ -305,11 +308,12 @@ namespace OnlineStore.ACSingleStore ...@@ -305,11 +308,12 @@ namespace OnlineStore.ACSingleStore
} }
private void 停止所有料仓TToolStripMenuItem_Click(object sender, EventArgs e) private void 停止所有料仓TToolStripMenuItem_Click(object sender, EventArgs e)
{ {
LogUtil.info(store.Name + "点击:停止");
if (store != null) if (store != null)
{ {
if (store.storeRunStatus.Equals(StoreRunStatus.Wait)) if (store.storeRunStatus.Equals(StoreRunStatus.Wait))
{ {
MessageBox.Show(store.Name + "包装料料仓未启动,不需要停止"); MessageBox.Show(store.Name + "料仓未启动,不需要停止");
return; return;
} }
if (store != null) if (store != null)
...@@ -322,9 +326,10 @@ namespace OnlineStore.ACSingleStore ...@@ -322,9 +326,10 @@ namespace OnlineStore.ACSingleStore
private void 复位RToolStripMenuItem_Click(object sender, EventArgs e) private void 复位RToolStripMenuItem_Click(object sender, EventArgs e)
{ {
LogUtil.info(store.Name + "点击:复位");
if (store.storeRunStatus.Equals(StoreRunStatus.Wait)) if (store.storeRunStatus.Equals(StoreRunStatus.Wait))
{ {
MessageBox.Show(store.Name + "包装料料仓未启动,无法复位"); MessageBox.Show(store.Name + "料仓未启动,无法复位");
return; return;
} }
store.Reset(); store.Reset();
...@@ -438,6 +443,7 @@ namespace OnlineStore.ACSingleStore ...@@ -438,6 +443,7 @@ namespace OnlineStore.ACSingleStore
} }
private void 退出ToolStripMenuItem_Click_1(object sender, EventArgs e) private void 退出ToolStripMenuItem_Click_1(object sender, EventArgs e)
{ {
LogUtil.info(store.Name + "点击:退出");
ExitApp(); ExitApp();
} }
...@@ -450,10 +456,12 @@ namespace OnlineStore.ACSingleStore ...@@ -450,10 +456,12 @@ namespace OnlineStore.ACSingleStore
{ {
if (toolStripMenuItem2.Text .Equals("启用调试")) if (toolStripMenuItem2.Text .Equals("启用调试"))
{ {
LogUtil.info(store.Name + "点击:启用调试");
DebugOpen(true ); DebugOpen(true );
} }
else else
{ {
LogUtil.info(store.Name + "点击:禁用调试");
DebugOpen(false); DebugOpen(false);
} }
} }
...@@ -602,6 +610,18 @@ namespace OnlineStore.ACSingleStore ...@@ -602,6 +610,18 @@ namespace OnlineStore.ACSingleStore
{ {
FrmHuiChuanTest frm = new FrmHuiChuanTest(); FrmHuiChuanTest frm = new FrmHuiChuanTest();
frm.ShowDialog(); frm.ShowDialog();
HCLogUtil.logBox = this.logBox;
}
private void 复制日志ToolStripMenuItem_Click(object sender, EventArgs e)
{
Clipboard.SetDataObject(logBox.Text);
MessageBox.Show("已复制日志到粘贴板!");
}
private void 清空日志ToolStripMenuItem_Click(object sender, EventArgs e)
{
LogUtil.ClearLog();
} }
} }
} }
...@@ -75,7 +75,6 @@ ...@@ -75,7 +75,6 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="FormManager.cs" />
<Compile Include="FrmAxisDebug.cs"> <Compile Include="FrmAxisDebug.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
...@@ -88,12 +87,6 @@ ...@@ -88,12 +87,6 @@
<Compile Include="FrmBase.Designer.cs"> <Compile Include="FrmBase.Designer.cs">
<DependentUpon>FrmBase.cs</DependentUpon> <DependentUpon>FrmBase.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="FrmIOStatus.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmIOStatus.Designer.cs">
<DependentUpon>FrmIOStatus.cs</DependentUpon>
</Compile>
<Compile Include="FrmAbout.cs"> <Compile Include="FrmAbout.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
...@@ -145,9 +138,6 @@ ...@@ -145,9 +138,6 @@
<EmbeddedResource Include="FrmBase.resx"> <EmbeddedResource Include="FrmBase.resx">
<DependentUpon>FrmBase.cs</DependentUpon> <DependentUpon>FrmBase.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="FrmIOStatus.resx">
<DependentUpon>FrmIOStatus.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmAbout.resx"> <EmbeddedResource Include="FrmAbout.resx">
<DependentUpon>FrmAbout.cs</DependentUpon> <DependentUpon>FrmAbout.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
......
...@@ -71,7 +71,7 @@ namespace OnlineStore.ACSingleStore ...@@ -71,7 +71,7 @@ namespace OnlineStore.ACSingleStore
// 如果进程的句柄为0,即代表没有找到该窗体,即该窗体隐藏的情况时 // 如果进程的句柄为0,即代表没有找到该窗体,即该窗体隐藏的情况时
if (process.MainWindowHandle.ToInt32().Equals(0)) if (process.MainWindowHandle.ToInt32().Equals(0))
{ {
string formTitle = ConfigAppSettings.GetValue(Setting_Init.App_Title); string formTitle = "环形线料仓-" + ConfigAppSettings.GetValue(Setting_Init.Store_CID);
// 获得窗体句柄 // 获得窗体句柄
formhwnd = FindWindow(null, formTitle); formhwnd = FindWindow(null, formTitle);
// 重新显示该窗体并切换到带入到前台 // 重新显示该窗体并切换到带入到前台
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
this.txtSpeed = new System.Windows.Forms.TextBox(); this.txtSpeed = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label();
this.txtFileName = new System.Windows.Forms.TextBox(); this.txtFileName = new System.Windows.Forms.TextBox();
this.ioStatusControl1 = new UserFromControl.IOStatusControl();
this.btnAbsMove = new System.Windows.Forms.Button(); this.btnAbsMove = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label();
...@@ -70,6 +69,8 @@ ...@@ -70,6 +69,8 @@
this.btnClear = new System.Windows.Forms.Button(); this.btnClear = new System.Windows.Forms.Button();
this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.ioSingle = new UserFromControl.IOTextControl();
this.groupBox6.SuspendLayout(); this.groupBox6.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
...@@ -96,6 +97,7 @@ ...@@ -96,6 +97,7 @@
// //
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left))); | System.Windows.Forms.AnchorStyles.Left)));
this.groupBox2.Controls.Add(this.ioSingle);
this.groupBox2.Controls.Add(this.txtP4Offset); this.groupBox2.Controls.Add(this.txtP4Offset);
this.groupBox2.Controls.Add(this.label10); this.groupBox2.Controls.Add(this.label10);
this.groupBox2.Controls.Add(this.txtP3Offset); this.groupBox2.Controls.Add(this.txtP3Offset);
...@@ -109,7 +111,6 @@ ...@@ -109,7 +111,6 @@
this.groupBox2.Controls.Add(this.txtSpeed); this.groupBox2.Controls.Add(this.txtSpeed);
this.groupBox2.Controls.Add(this.label8); this.groupBox2.Controls.Add(this.label8);
this.groupBox2.Controls.Add(this.txtFileName); this.groupBox2.Controls.Add(this.txtFileName);
this.groupBox2.Controls.Add(this.ioStatusControl1);
this.groupBox2.Controls.Add(this.btnAbsMove); this.groupBox2.Controls.Add(this.btnAbsMove);
this.groupBox2.Controls.Add(this.label3); this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.label7); this.groupBox2.Controls.Add(this.label7);
...@@ -258,16 +259,6 @@ ...@@ -258,16 +259,6 @@
this.txtFileName.TabIndex = 278; this.txtFileName.TabIndex = 278;
this.txtFileName.Text = "position.csv"; this.txtFileName.Text = "position.csv";
// //
// ioStatusControl1
//
this.ioStatusControl1.IOName = "检测信号";
this.ioStatusControl1.IOValue = 0;
this.ioStatusControl1.isCanClick = false;
this.ioStatusControl1.Location = new System.Drawing.Point(38, 401);
this.ioStatusControl1.Name = "ioStatusControl1";
this.ioStatusControl1.Size = new System.Drawing.Size(267, 69);
this.ioStatusControl1.TabIndex = 279;
//
// btnAbsMove // btnAbsMove
// //
this.btnAbsMove.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnAbsMove.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
...@@ -535,11 +526,33 @@ ...@@ -535,11 +526,33 @@
this.timer1.Interval = 1000; this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick); this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
// //
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Location = new System.Drawing.Point(715, 0);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(116, 24);
this.radioButton1.TabIndex = 251;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "radioButton1";
this.radioButton1.UseVisualStyleBackColor = true;
//
// ioSingle
//
this.ioSingle.IOName = "检测信号";
this.ioSingle.IOValue = 0;
this.ioSingle.isCanClick = false;
this.ioSingle.Location = new System.Drawing.Point(46, 425);
this.ioSingle.Name = "ioSingle";
this.ioSingle.Size = new System.Drawing.Size(202, 27);
this.ioSingle.TabIndex = 289;
//
// FrmPositionTool // FrmPositionTool
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1020, 719); this.ClientSize = new System.Drawing.Size(1020, 719);
this.Controls.Add(this.radioButton1);
this.Controls.Add(this.groupBox6); this.Controls.Add(this.groupBox6);
this.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "FrmPositionTool"; this.Name = "FrmPositionTool";
...@@ -553,6 +566,7 @@ ...@@ -553,6 +566,7 @@
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
...@@ -586,7 +600,6 @@ ...@@ -586,7 +600,6 @@
private System.Windows.Forms.TextBox txtPortName; private System.Windows.Forms.TextBox txtPortName;
private System.Windows.Forms.TextBox txtFileName; private System.Windows.Forms.TextBox txtFileName;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private UserFromControl.IOStatusControl ioStatusControl1;
private System.Windows.Forms.Button btnOpenFolder; private System.Windows.Forms.Button btnOpenFolder;
private System.Windows.Forms.Button btnExit; private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
...@@ -599,6 +612,8 @@ ...@@ -599,6 +612,8 @@
private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox txtP5Offset; private System.Windows.Forms.TextBox txtP5Offset;
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;
private System.Windows.Forms.RadioButton radioButton1;
private UserFromControl.IOTextControl ioSingle;
} }
} }
...@@ -23,12 +23,11 @@ namespace OnlineStore.ACSingleStore ...@@ -23,12 +23,11 @@ namespace OnlineStore.ACSingleStore
private string PortName = ""; private string PortName = "";
private short SlvAddr = 0; private short SlvAddr = 0;
private string IoIp = ""; private string IoIp = "";
private int IoIndex = 0; private int IoIndex = 0;
public string Axis_Brake = "";
private System.Timers.Timer toolTimer = new System.Timers.Timer(); private System.Timers.Timer toolTimer = new System.Timers.Timer();
private ConfigMoveAxis configAxis; private ConfigMoveAxis configAxis;
public FrmPositionTool(ConfigMoveAxis axis,string ioIp, int ioIndex) public FrmPositionTool(ConfigMoveAxis axis,string ioIp, int ioIndex,string name)
{ {
InitializeComponent(); InitializeComponent();
this.PortName = axis.DeviceName; this.PortName = axis.DeviceName;
...@@ -41,7 +40,7 @@ namespace OnlineStore.ACSingleStore ...@@ -41,7 +40,7 @@ namespace OnlineStore.ACSingleStore
toolTimer.Interval = 50; toolTimer.Interval = 50;
toolTimer.AutoReset = true; toolTimer.AutoReset = true;
toolTimer.Elapsed += ToolTimer_Elapsed; toolTimer.Elapsed += ToolTimer_Elapsed;
this.Text = name + "_升降轴位置调试";
FrmPositionTool.CheckForIllegalCrossThreadCalls = false; FrmPositionTool.CheckForIllegalCrossThreadCalls = false;
} }
...@@ -92,7 +91,7 @@ namespace OnlineStore.ACSingleStore ...@@ -92,7 +91,7 @@ namespace OnlineStore.ACSingleStore
bool isOn = AxisManager.instance.IsServeoOn(PortName, SlvAddr); bool isOn = AxisManager.instance.IsServeoOn(PortName, SlvAddr);
formStatus(isOn); formStatus(isOn);
timer1.Start(); timer1.Start();
ioStatusControl1.IOName = ResourceCulture.GetString("检测信号"); ioSingle.IOName = ResourceCulture.GetString("激光检测信号");
} }
private void btnServoOn_Click(object sender, EventArgs e) private void btnServoOn_Click(object sender, EventArgs e)
{ {
...@@ -110,15 +109,7 @@ namespace OnlineStore.ACSingleStore ...@@ -110,15 +109,7 @@ namespace OnlineStore.ACSingleStore
Thread.Sleep(100); Thread.Sleep(100);
AxisManager.instance.AlarmClear(PortName, SlvAddr); AxisManager.instance.AlarmClear(PortName, SlvAddr);
AxisManager.instance.ServoOn(PortName, SlvAddr); AxisManager.instance.ServoOn(PortName, SlvAddr);
try
{
IOManager.IOMove(Axis_Brake, IO_VALUE.HIGH);
}catch(Exception ex)
{
}
} }
private void btnServoOff_Click(object sender, EventArgs e) private void btnServoOff_Click(object sender, EventArgs e)
...@@ -127,14 +118,7 @@ namespace OnlineStore.ACSingleStore ...@@ -127,14 +118,7 @@ namespace OnlineStore.ACSingleStore
// toolTimer.Stop(); // toolTimer.Stop();
AxisManager.instance.SuddenStop(PortName, SlvAddr); AxisManager.instance.SuddenStop(PortName, SlvAddr);
Thread.Sleep(100); Thread.Sleep(100);
try
{
IOManager.IOMove(Axis_Brake, IO_VALUE.LOW);
}
catch (Exception ex)
{
}
AxisManager.instance.ServoOff(PortName, SlvAddr); AxisManager.instance.ServoOff(PortName, SlvAddr);
formStatus(false); formStatus(false);
} }
...@@ -158,23 +142,13 @@ namespace OnlineStore.ACSingleStore ...@@ -158,23 +142,13 @@ namespace OnlineStore.ACSingleStore
private void btnClear_Click(object sender, EventArgs e) private void btnClear_Click(object sender, EventArgs e)
{ {
this.richTextBox1.Text = ""; this.richTextBox1.Text = "";
}
private void btnRelMove_Click(object sender, EventArgs e)
{
int position = Convert.ToInt32(txtPosition.Text);
AxisManager.instance.RelMove(PortName, SlvAddr, position);
} }
private void btnHomeMove_Click(object sender, EventArgs e) private void btnHomeMove_Click(object sender, EventArgs e)
{ {
int speed = Convert.ToInt32(txtSpeed.Text); int speed = Convert.ToInt32(txtSpeed.Text);
AxisManager.instance.HomeMove(PortName, SlvAddr, configAxis.HomeHighSpeed,configAxis.HomeLowSpeed,configAxis.HomeAddSpeed); AxisManager.instance.HomeMove(PortName, SlvAddr, configAxis.HomeHighSpeed,configAxis.HomeLowSpeed,configAxis.HomeAddSpeed);
} }
private void btnSpeedMove_Click(object sender, EventArgs e)
{
int speed = Convert.ToInt32(txtSpeed.Text);
AxisManager.instance.SpeedMove(PortName, SlvAddr, speed);
}
private void btnGetActualPosition_Click(object sender, EventArgs e) private void btnGetActualPosition_Click(object sender, EventArgs e)
{ {
int value = AxisManager.instance.GetTargetPosition(PortName, SlvAddr); int value = AxisManager.instance.GetTargetPosition(PortName, SlvAddr);
...@@ -351,8 +325,8 @@ namespace OnlineStore.ACSingleStore ...@@ -351,8 +325,8 @@ namespace OnlineStore.ACSingleStore
{ {
try try
{ {
ioStatusControl1.IOValue = (int)GetSingleValue(); ioSingle.IOValue = (int)GetSingleValue();
ioStatusControl1.ShowData(); ioSingle.ShowData();
} }
catch (Exception ex) catch (Exception ex)
{ {
......
...@@ -21,7 +21,6 @@ namespace HuichuanLibrary ...@@ -21,7 +21,6 @@ namespace HuichuanLibrary
private List<Label> groupIOList = new List<Label>(); private List<Label> groupIOList = new List<Label>();
private void FrmHuiChuanTest_Load(object sender, EventArgs e) private void FrmHuiChuanTest_Load(object sender, EventArgs e)
{ {
HCLogUtil.logBox = richTextBox1;
DILabelList = new List<Label>(); DILabelList = new List<Label>();
DILabelList.Add(lblDI0); DILabelList.Add(lblDI0);
DILabelList.Add(lblDI1); DILabelList.Add(lblDI1);
...@@ -88,10 +87,11 @@ namespace HuichuanLibrary ...@@ -88,10 +87,11 @@ namespace HuichuanLibrary
FormStatus(false); FormStatus(false);
timerIO.Start(); timerIO.Start();
timerMain.Start(); timerMain.Start();
HCLogUtil.logBox = richTextBox1;
} }
private void btnInitBoard_Click(object sender, EventArgs e) private void btnInitBoard_Click(object sender, EventArgs e)
{ {
bool result = HCBoardManager.InitCard(); bool result = HCBoardManager.OpenCard();
if (result) if (result)
{ {
cmbAxisIndex.Items.Clear(); cmbAxisIndex.Items.Clear();
......
...@@ -59,7 +59,7 @@ namespace HuichuanLibrary ...@@ -59,7 +59,7 @@ namespace HuichuanLibrary
/// 初始化板卡 /// 初始化板卡
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public static bool InitCard() public static bool OpenCard()
{ {
try try
{ {
......
...@@ -60,6 +60,9 @@ ...@@ -60,6 +60,9 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="device_config.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="huichuan\x64\IMC_API_x64.dll"> <Content Include="huichuan\x64\IMC_API_x64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
...@@ -78,6 +81,9 @@ ...@@ -78,6 +81,9 @@
<Content Include="huichuan\x86\msvcr100d.dll"> <Content Include="huichuan\x86\msvcr100d.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="system_config.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="huichuan\x64\IMC_API_x64.lib"> <Content Include="huichuan\x64\IMC_API_x64.lib">
......
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
<Compile Include="storeConfig\ConfigProAttribute.cs" /> <Compile Include="storeConfig\ConfigProAttribute.cs" />
<Compile Include="storeConfig\config\BoxConfig.cs" /> <Compile Include="storeConfig\config\BoxConfig.cs" />
<Compile Include="storeConfig\config\StoreConfig.cs" /> <Compile Include="storeConfig\config\StoreConfig.cs" />
<Compile Include="storeConfig\config\StoreType.cs" />
<Compile Include="storeConfig\config\IO_Type.cs" /> <Compile Include="storeConfig\config\IO_Type.cs" />
<Compile Include="CSVAttribute.cs" /> <Compile Include="CSVAttribute.cs" />
<Compile Include="storeConfig\CSVConfigReader.cs" /> <Compile Include="storeConfig\CSVConfigReader.cs" />
......
...@@ -16,9 +16,27 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -16,9 +16,27 @@ namespace OnlineStore.LoadCSVLibrary
public const string IOIP_Str = "PRO_AOI_IP"; public const string IOIP_Str = "PRO_AOI_IP";
public int DeviceID { get; set; } public int DeviceID { get; set; }
public string CID { get; set; } public string CID { get; set; }
private int StoreId = 0;
public int GetStoreId()
{
if (StoreId <= 0)
{
string v = CID.Substring(CID.Length - 2, 2);
try
{
StoreId = Convert.ToInt32(v);
}
catch (Exception ex)
{
}
}
return StoreId;
}
public string DType { get; set; } public string DType { get; set; }
public string ConfigFilePath { get; set; } public string ConfigFilePath { get; set; }
...@@ -131,7 +149,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -131,7 +149,7 @@ namespace OnlineStore.LoadCSVLibrary
SubDIList[io.SubType].Add(io.ProName, io); SubDIList[io.SubType].Add(io.ProName, io);
} }
//if (!ioTypeList.Contains(con.ProName)) if (!ioTypeList.Contains(con.ProName))
{ {
AddBuffer(con, builder); AddBuffer(con, builder);
} }
...@@ -165,7 +183,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -165,7 +183,7 @@ namespace OnlineStore.LoadCSVLibrary
{ {
SubDOList[io.SubType].Add(io.ProName, io); SubDOList[io.SubType].Add(io.ProName, io);
} }
//if (!ioTypeList.Contains(con.ProName)) if (!ioTypeList.Contains(con.ProName))
{ {
AddBuffer(con, builder); AddBuffer(con, builder);
} }
......
...@@ -177,12 +177,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -177,12 +177,7 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary> /// </summary>
[ConfigProAttribute("IsUse_Tray_Check")] [ConfigProAttribute("IsUse_Tray_Check")]
public int IsUse_Tray_Check { get; set; } public int IsUse_Tray_Check { get; set; }
/// <summary> /// <summary>
/// PRO 压紧轴(轴4)P1速度 CompAxis_P1_Speed 100 /// PRO 压紧轴(轴4)P1速度 CompAxis_P1_Speed 100
...@@ -222,70 +217,14 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -222,70 +217,14 @@ namespace OnlineStore.LoadCSVLibrary
/// PRO,0,是否调试状态,ISDebug,0,,,,,,,,,,,, /// PRO,0,是否调试状态,ISDebug,0,,,,,,,,,,,,
/// </summary> /// </summary>
[ConfigProAttribute("ISDebug")] [ConfigProAttribute("ISDebug")]
public int ISDebug { get; set; } public int ISDebug { get; set; }
private Dictionary<string, ushort> DILengthMap = null;
private Dictionary<string, ushort> DOLengthMap = null;
public ushort GetDILength(string ip) public ushort GetDILength(string ip)
{ {
return 16; return 16;
//try
//{
// if (DILengthMap == null)
// {
// DILengthMap = new Dictionary<string, ushort>();
// string[] arrayList = IO_DILength.Split(';');
// foreach (string str in arrayList)
// {
// string[] arrStr = str.Split('#');
// if (arrStr.Length == 2)
// {
// string ioip = arrStr[0];
// ushort length = Convert.ToUInt16(arrStr[1]);
// DILengthMap.Add(ioip, length);
// }
// }
// }
//}
//catch (Exception ex)
//{
//}
//if (DILengthMap.ContainsKey(ip))
//{
// return DILengthMap[ip];
//}
//return 16;
} }
public ushort GetDOLength(string ip) public ushort GetDOLength(string ip)
{ {
return 16; return 16;
//try
//{
// if (DOLengthMap == null)
// {
// DOLengthMap = new Dictionary<string, ushort>();
// string[] arrayList = IO_DOLength.Split(';');
// foreach (string str in arrayList)
// {
// string[] arrStr = str.Split('#');
// if (arrStr.Length == 2)
// {
// string ioip = arrStr[0];
// ushort length = Convert.ToUInt16(arrStr[1]);
// DOLengthMap.Add(ioip, length);
// }
// }
// }
//}
//catch (Exception ex)
//{
//}
//if (DOLengthMap.ContainsKey(ip))
//{
// return DOLengthMap[ip];
//}
//return 16;
} }
} }
......
...@@ -25,109 +25,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -25,109 +25,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
return TypeList; return TypeList;
} }
///// <summary>
///// 料仓,DI 急停 SuddenStop_BTN X01 DI-01
///// </summary>
//public static string SuddenStop_BTN = "SuddenStop_BTN";
///// <summary>
///// 料仓 DI 复位 Reset_BTN X02 DI-02
///// </summary>
//public static string Reset_BTN = "Reset_BTN";
///// <summary>
///// DI,盘点,CheckPos,2,PRO_AOI_IP_1,0,盘点,X03,DI-03,0,
///// </summary>
//public static string CheckPos = "CheckPos";
///// <summary>
/////DI 自动运行 AutoRun_Signal
///// </summary>
//// public static string AutoRun_Signal = "AutoRun_Signal";
///// <summary>
///// 料仓DI。气压检测(料仓) Airpressure_Check
///// </summary>
//public static string Airpressure_Check = "Airpressure_Check";
///// <summary>
///// DI 料仓门口料盘检测 TrayCheck_1
///// </summary>
//public static string TrayCheck_Door = "TrayCheck_Door";
///// <summary>
///// DI 叉子料盘检测 TrayCheck_Fixture
///// </summary>
//public static string TrayCheck_Fixture = "TrayCheck_Fixture";
///// <summary>
///// 料仓IO。定位气缸上升端(料仓) LocationCylinder_Up
///// </summary>
//public static string LocationCylinder_Up = "LocationCylinder_Up";
///// <summary>
/////料仓IO。 定位气缸下降端(料仓) LocationCylinder_Down
///// </summary>
//public static string LocationCylinder_Down = "LocationCylinder_Down";
///// <summary>
///// 料仓IO。定位气缸上升端(料仓) LocationCylinder2_Up
///// </summary>
//public static string LocationCylinder2_Up = "LocationCylinder2_Up";
///// <summary>
/////料仓IO。 定位气缸下降端(料仓) LocationCylinder2_Down
///// </summary>
//public static string LocationCylinder2_Down = "LocationCylinder2_Down";
///// <summary>
///// 料仓DO 。料仓运转ON Run_Signal
///// </summary>
//public static string Run_Signal = "Run_Signal";
///// <summary>
///// 料仓DO 。料仓轴2刹车ON Axis_Brake
///// </summary>
//public static string Axis_Brake = "Axis_Brake";
///// <summary>
///// 料仓DO 。料仓吹气SOL ON StartOrStopBlow
///// </summary>
//public static string StartOrStopBlow = "StartOrStopBlow";
///// <summary>
///// DO 自动指示灯 AutoRun_HddLed
///// </summary>
//public static string AutoRun_HddLed = "AutoRun_HddLed";
///// <summary>
///// DO 待机指示灯 RunSign_HddLed
///// </summary>
//public static string RunSign_HddLed = "RunSign_HddLed";
///// <summary>
/////DO 故障指示灯 Alarm_HddLed
///// </summary>
//public static string Alarm_HddLed = "Alarm_HddLed";
///// <summary>
///// 吹气SOL Blow_Single
///// </summary>
//public static string Blow_Single = "Blow_Single";
///// <summary>
///// 进出料口门上升端 Door_Up
///// </summary>
//public static string Door_Up = "Door_Up";
///// <summary>
///// 进出料口门下降端 Door_Down
///// </summary>
//public static string Door_Down = "Door_Down";
//public static string DoorLimit = "DoorLimit";
///// <summary>
///// DO,0,报警蜂鸣器,Alarm_Buzzer,3,HC,Y04,
///// </summary>
//public static string Alarm_Buzzer = "Alarm_Buzzer";
///// <summary>
///// DO,0,设备照明ON,Device_Led,8,HC,Y09,
///// </summary>
//public static string Device_Led = "Device_Led";
/// <summary> /// <summary>
/// DI,0,急停,SuddenStop_BTN,0,HC,X00, /// DI,0,急停,SuddenStop_BTN,0,HC,X00,
...@@ -182,15 +80,15 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -182,15 +80,15 @@ namespace OnlineStore.LoadCSVLibrary
///// </summary> ///// </summary>
//public static string CheckPos = "CheckPos"; //public static string CheckPos = "CheckPos";
/// <summary> /// <summary>
/// DO,0,自动指示灯,AutoRun_HddLed,0,HC,Y01, /// DO,0,自动指示灯 绿灯,AutoRun_HddLed,0,HC,Y01,
/// </summary> /// </summary>
public static string AutoRun_HddLed = "AutoRun_HddLed"; public static string AutoRun_HddLed = "AutoRun_HddLed";
/// <summary> /// <summary>
/// DO,0,故障指示灯,Alarm_HddLed,1,HC,Y02, /// DO,0,故障指示灯 红灯,Alarm_HddLed,1,HC,Y02,
/// </summary> /// </summary>
public static string Alarm_HddLed = "Alarm_HddLed"; public static string Alarm_HddLed = "Alarm_HddLed";
/// <summary> /// <summary>
/// DO,0,待机指示灯,RunSign_HddLed,2,HC,Y03, /// DO,0,待机指示灯 黄灯 ,RunSign_HddLed,2,HC,Y03,
/// </summary> /// </summary>
public static string RunSign_HddLed = "RunSign_HddLed"; public static string RunSign_HddLed = "RunSign_HddLed";
/// <summary> /// <summary>
...@@ -231,7 +129,16 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -231,7 +129,16 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary> /// </summary>
HIGH = 1, HIGH = 1,
None=-1,
}
public class StoreType
{
/// <summary>
/// 松下伺服485通信单台料仓
/// </summary>
public static string RC_AC_SA = "RC_AC_SA";
} }
} }
...@@ -15,17 +15,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -15,17 +15,7 @@ namespace OnlineStore.LoadCSVLibrary
: base(id, cid, type, filepath) : base(id, cid, type, filepath)
{ {
} }
/// <summary>
/// 预警温度
/// </summary>
[ConfigProAttribute("WarnTemperate")]
public int WarnTemperate { get; set; }
/// <summary>
/// 预警湿度
/// </summary>
[ConfigProAttribute("WarnHumidity")]
public int WarnHumidity { get; set; }
/// <summary> /// <summary>
/// 气压检测IO关闭需要持续的时间(=3表示需要关闭三秒以上才算关闭) /// 气压检测IO关闭需要持续的时间(=3表示需要关闭三秒以上才算关闭)
/// </summary> /// </summary>
...@@ -39,28 +29,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -39,28 +29,7 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary> /// </summary>
[ConfigProAttribute("IOSingle_TimerOut", false)] [ConfigProAttribute("IOSingle_TimerOut", false)]
public int IOSingle_TimerOut { get; set; } public int IOSingle_TimerOut { get; set; }
///// <summary>
///// PRO 需要吹气的温度(温度标准) Max_Temperature 10
///// </summary>
//[ConfigProAttribute("Max_Temperature", false)]
//public int Max_Temperature { get; set; }
///// <summary>
///// PRO 需要吹气的湿度(湿度标准) Max_Humidity 10
///// </summary>
//[ConfigProAttribute("Max_Humidity", false)]
//public int Max_Humidity { get; set; }
///// <summary>
///// PRO 每次吹气的时间(分钟) BlowAir_Time 10
///// </summary>
//[ConfigProAttribute("BlowAir_Time", false)]
//public int BlowAir_Time { get; set; }
///// <summary>
///// PRO 两次吹气间隔(分钟) BlowAir_Interval 10
///// </summary>
//[ConfigProAttribute("BlowAir_Interval", false)]
//public int BlowAir_Interval { get; set; }
public int InoutAxis_PositionMax { get; set; } public int InoutAxis_PositionMax { get; set; }
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OnlineStore.LoadCSVLibrary
{
public class StoreType
{
///// <summary>
///// 双层在线料仓(电钢,康泰克板子,康奈德IO模块)料仓总配置
///// </summary>
//public static string RC_DB_LINE = "RC_DB_LINE";
///// <summary>
///// 双层在线料仓(电钢,康泰克板子,康奈德IO模块)单个料仓配置
///// </summary>
//public static string RC_DB_LA = "RC_DB_LA";
///// <summary>
///// 单台自动料仓 锁孔板PLC
///// </summary>
//public static string RC_PLC_SM = "RC_PLC_SM";
///// <summary>
///// 康泰克流水线料仓_子料仓
///// </summary>
//public static string RC_KTK_LA = "RC_KTK_LA";
///// <summary>
///// 康泰克流水线料仓_流水线
///// </summary>
//public static string RC_KTK_LINE = "RC_KTK_LINE";
///// <summary>
///// 康泰克单台料仓
///// </summary>
//public static string RC_KTK_SA = "RC_KTK_SA";
/// <summary>
/// 松下伺服485通信单台料仓
/// </summary>
public static string RC_AC_SA = "RC_AC_SA";
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!