|
@@ -170,6 +170,8 @@ namespace MainForm
|
|
|
InitializeComponent();
|
|
|
CheckForIllegalCrossThreadCalls = false; // 不检查跨线程访问
|
|
|
|
|
|
+
|
|
|
+
|
|
|
_PLCLogNet = new LogNetDateTime(GlobalContext.PlcLogDir, GenerateMode.ByEveryDay); // 按天记录日志
|
|
|
_IOTMqttLogNet = new LogNetDateTime(GlobalContext.MqttLogDir, GenerateMode.ByEveryDay); // 按天记录日志
|
|
|
_AGVMqttLogNet = new LogNetDateTime(GlobalContext.MqttLogDir, GenerateMode.ByEveryDay); // 按天记录日志
|
|
@@ -387,6 +389,8 @@ namespace MainForm
|
|
|
{
|
|
|
param.parameter.equipment.deviceCode = GlobalContext.s7_1_device_code; // 装备编码
|
|
|
//param.parameter.equipment.stationCode = GlobalContext.s7_1_station; // ⼯位Id
|
|
|
+ xiaomiParm.stationCode = GlobalContext.s7_1_station;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
if (GlobalContext.IsUsePLC8)
|
|
@@ -411,8 +415,8 @@ namespace MainForm
|
|
|
|
|
|
XiaomiMqttClient_Extend.ParameterConfig(param);
|
|
|
//保存全局变量
|
|
|
- xiaomiParm.stationCode = param.parameter.equipment.deviceCode;
|
|
|
- xiaomiParm.deviceCode = param.parameter.equipment.stationCode;
|
|
|
+ xiaomiParm.stationCode = param.parameter.equipment.stationCode;
|
|
|
+ xiaomiParm.deviceCode = param.parameter.equipment.deviceCode;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -3564,6 +3568,7 @@ namespace MainForm
|
|
|
string tagBaseName = "g_OP30_MES"; //标签变量名称
|
|
|
string tagMesCommName = "mesCommToPC"; //标签变量名称
|
|
|
string tagAgvCommName = "agvCommFrmPC";
|
|
|
+ string tagiotComnName = "iotData";
|
|
|
string tagBarsetName = "BarcodeSet";
|
|
|
|
|
|
//s1PLCSignal_Old.Add("a1OEEPLC_FLAG", 0); // PLC_FLAG 节拍接口
|
|
@@ -3573,10 +3578,8 @@ namespace MainForm
|
|
|
// PLC数据字典 赋值
|
|
|
s3PLCData.Add("a3OEEType_left", 0); // 节拍类型(plc写入)
|
|
|
s3PLCData.Add("a3OEEPartNo_left", ""); // 物料码(物料码还未绑定载具SN时必填)
|
|
|
- s3PLCData.Add("a3OEEVehicleCode_left", ""); // 载具SN
|
|
|
s3PLCData.Add("a3OEEType_right", 0); // 节拍类型(plc写入)
|
|
|
s3PLCData.Add("a3OEEPartNo_right", ""); // 物料码(物料码还未绑定载具SN时必填)
|
|
|
- s3PLCData.Add("a3OEEVehicleCode_right", ""); // 载具SN
|
|
|
|
|
|
OP30_MesData_t stPLC_MesData; //PLC的MES数据
|
|
|
(int, string) result;
|
|
@@ -3596,9 +3599,11 @@ namespace MainForm
|
|
|
Stopwatch stopwatch1 = new Stopwatch();
|
|
|
Stopwatch stopwatch2 = new Stopwatch();
|
|
|
stopwatch1.Start();
|
|
|
-
|
|
|
stopwatch2.Start();
|
|
|
|
|
|
+ stPLC_MesData.Left.BarcodeSet.strCarrierBarcode = "A123456";
|
|
|
+ stPLC_MesData.Left.iotData.BeatAction = 1;
|
|
|
+
|
|
|
#region 一次性读取所有数据
|
|
|
|
|
|
// 一次性读取所有数据
|
|
@@ -3619,11 +3624,8 @@ namespace MainForm
|
|
|
xmDeviceStateData.right = (xmDeviceStateInt_L < 0 || xmDeviceStateInt_L > 7)
|
|
|
? XiaomiDeviceState.Unknown
|
|
|
: (XiaomiDeviceState)xmDeviceStateInt_R;
|
|
|
- s1PLCData["a1OEEPartNo"] =stPLC_MesData.Left.BarcodeSet.strProductBarcode; // 物料码(物料码还未绑定载具SN时必填)
|
|
|
- s1PLCData["a1OEEVehicleCode"] = stPLC_MesData.Left.BarcodeSet.strCarrierBarcode; // 载具SN
|
|
|
- s1PLCData["a1OEEType"] = stPLC_MesData.Left.iotData.BeatAction; // 节拍
|
|
|
- s1PLCData["a1OEEVehicleCode_right"] = stPLC_MesData.Right.BarcodeSet.strCarrierBarcode; // 载具SN
|
|
|
- s1PLCData["a1OEEType_right"] = stPLC_MesData.Right.iotData.BeatAction; // 节拍
|
|
|
+ s3PLCData["a3OEEType_left"] = stPLC_MesData.Left.iotData.BeatAction; // 节拍
|
|
|
+ s3PLCData["a3OEEType_right"] = stPLC_MesData.Right.iotData.BeatAction; // 节拍
|
|
|
}
|
|
|
|
|
|
#endregion 一次性读取所有数据
|
|
@@ -3640,6 +3642,9 @@ namespace MainForm
|
|
|
{
|
|
|
if (!ProgressState)
|
|
|
{
|
|
|
+ stationCode = "[OP31]";
|
|
|
+ stationName = "点散热胶装备1";
|
|
|
+ stationNameStr = stationCode + stationName;
|
|
|
uuid = Guid.NewGuid().ToString();//创建贯穿进出站的uuid
|
|
|
ProgressState = true;
|
|
|
Task.Run(() => S3进站(plcNo, stationNameStr, stPLC_MesData.Left,
|
|
@@ -3670,6 +3675,10 @@ namespace MainForm
|
|
|
{
|
|
|
if (!ProgressState)
|
|
|
{
|
|
|
+ stationCode = "[OP31]";
|
|
|
+ stationName = "点散热胶装备1";
|
|
|
+ stationNameStr = stationCode + stationName;
|
|
|
+
|
|
|
ProgressState = true;
|
|
|
Task.Run(() => S3出站(plcNo, stationNameStr, stPLC_MesData.Left,
|
|
|
tagBaseName + ".Left." + tagMesCommName, stationCode, stationName, "Left",
|
|
@@ -3701,6 +3710,11 @@ namespace MainForm
|
|
|
{
|
|
|
if (!ProgressState)
|
|
|
{
|
|
|
+ uuid = Guid.NewGuid().ToString();//创建贯穿进出站的uuid
|
|
|
+ stationCode = "[OP32]";
|
|
|
+ stationName = "点散热胶装备2";
|
|
|
+ stationNameStr = stationCode + stationName;
|
|
|
+
|
|
|
ProgressState = true;
|
|
|
Task.Run(() => S3进站(plcNo, stationNameStr, stPLC_MesData.Right,
|
|
|
tagBaseName + ".Right." + tagMesCommName,
|
|
@@ -3730,11 +3744,16 @@ namespace MainForm
|
|
|
{
|
|
|
if (!ProgressState)
|
|
|
{
|
|
|
+ stationCode = "[OP32]";
|
|
|
+ stationName = "点散热胶装备2";
|
|
|
+ stationNameStr = stationCode + stationName;
|
|
|
+
|
|
|
ProgressState = true;
|
|
|
Task.Run(() => S3出站(plcNo, stationNameStr, stPLC_MesData.Right,
|
|
|
tagBaseName + ".Right." + tagMesCommName, stationCode, stationName, "Right",
|
|
|
out ProgressState));
|
|
|
stPLC_MesData.Right.mesCommFrmPLC.cmd = 0;
|
|
|
+ uuid = "";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -3753,8 +3772,8 @@ namespace MainForm
|
|
|
try
|
|
|
{
|
|
|
#region 左工位 节拍
|
|
|
- int a3OEEType_left = (int)s3PLCData["a3OEEType_left"];
|
|
|
- int a3OEETypeGOld_left = (int)s3PLCSignal_Old["a3OEEType_left"];
|
|
|
+ int a3OEEType_left = Convert.ToInt32(s3PLCData["a3OEEType_left"]);
|
|
|
+ int a3OEETypeGOld_left = Convert.ToInt32(s3PLCSignal_Old["a3OEEType_left"]);
|
|
|
//若设备紧急复原后节拍重置
|
|
|
if (a3OEEType_left == 1)
|
|
|
{
|
|
@@ -3765,12 +3784,18 @@ namespace MainForm
|
|
|
{
|
|
|
stationNameStr = stationNameStr + "_Left";
|
|
|
//节拍需要成双成对,有开始就要有结束,例如有1上料开始就必须有2上料结束
|
|
|
- if ((a3OEETypeGOld_left == 1 && a3OEEType_left != 2) || (a3OEETypeGOld_left == 3 && a3OEEType_left != 4) ||
|
|
|
- (a3OEETypeGOld_left == 5 && a3OEEType_left != 6))
|
|
|
+ if ((a3OEETypeGOld_left == 1 && a3OEEType_left != 2) || (a3OEETypeGOld_left == 3 && a3OEEType_left != 4)
|
|
|
+ || (a3OEETypeGOld_left == 5 && a3OEEType_left != 6))
|
|
|
{
|
|
|
//写入PLC
|
|
|
- stPLC_MesData.Left.iotData.beatReturn = 2; //NG
|
|
|
- WriteResultToPlc(plcNo, stationNameStr, tagBaseName + ".Left." + tagMesCommName, 1, stPLC_MesData.Left.iotData);
|
|
|
+ IoT_DataSet_t iotData=new IoT_DataSet_t();
|
|
|
+ iotData.machineState = stPLC_MesData.Left.iotData.machineState;
|
|
|
+ iotData.work_type = stPLC_MesData.Left.iotData.work_type;
|
|
|
+ iotData.testStatus = stPLC_MesData.Left.iotData.testStatus;
|
|
|
+ iotData.BeatAction = stPLC_MesData.Left.iotData.BeatAction;
|
|
|
+ iotData.beatReturn = 2; //NG
|
|
|
+ iotData.fault_codes = stPLC_MesData.Left.iotData.fault_codes;
|
|
|
+ WriteResultToPlc(plcNo, stationNameStr, tagBaseName + ".Left." + tagiotComnName, 1, iotData);
|
|
|
AddMessage(LogType.Info,
|
|
|
stationNameStr +
|
|
|
$"_节拍接口-- 设备本次上传节拍[{a3OEEType_left}],未上传节拍[{a3OEETypeGOld_left}]的结束信号,请检查;总用时" +
|
|
@@ -3781,7 +3806,7 @@ namespace MainForm
|
|
|
else
|
|
|
{
|
|
|
Task.Run(() =>
|
|
|
- S3节拍接口(plcNo, stationNameStr, tagBaseName + ".Left." + tagMesCommName,
|
|
|
+ S3节拍接口(plcNo, stationNameStr, tagBaseName + ".Left." + tagiotComnName, stPLC_MesData.Left.BarcodeSet.strCarrierBarcode.ToString(),
|
|
|
stPLC_MesData.Left.iotData)); // MreTasks[4].Set();
|
|
|
}
|
|
|
s3PLCSignal_Old["a3OEEType_left"] = s3PLCData["a3OEEType_left"];
|
|
@@ -3789,8 +3814,9 @@ namespace MainForm
|
|
|
#endregion 左工位 节拍
|
|
|
|
|
|
#region 右工位 节拍
|
|
|
- int a3OEEType_right = (int)s3PLCData["a3OEEType_right"];
|
|
|
- int a3OEETypeGOld_right = (int)s3PLCSignal_Old["a3OEEType_right"];
|
|
|
+ int a3OEEType_right = Convert.ToInt32(s3PLCData["a3OEEType_right"]);
|
|
|
+ int a3OEETypeGOld_right = Convert.ToInt32(s3PLCSignal_Old["a3OEEType_right"]);
|
|
|
+
|
|
|
//若设备紧急复原后节拍重置
|
|
|
if (a3OEEType_right == 1)
|
|
|
{
|
|
@@ -3805,8 +3831,14 @@ namespace MainForm
|
|
|
(a3OEETypeGOld_right == 5 && a3OEEType_right != 6))
|
|
|
{
|
|
|
//写入PLC
|
|
|
- stPLC_MesData.Right.iotData.beatReturn = 2; //NG
|
|
|
- WriteResultToPlc(plcNo, stationNameStr, tagBaseName + ".Right." + tagMesCommName, 1, stPLC_MesData.Left.iotData);
|
|
|
+ IoT_DataSet_t iotData = new IoT_DataSet_t();
|
|
|
+ iotData.machineState = stPLC_MesData.Left.iotData.machineState;
|
|
|
+ iotData.work_type = stPLC_MesData.Left.iotData.work_type;
|
|
|
+ iotData.testStatus = stPLC_MesData.Left.iotData.testStatus;
|
|
|
+ iotData.BeatAction = stPLC_MesData.Left.iotData.BeatAction;
|
|
|
+ iotData.beatReturn = 2; //NG
|
|
|
+ iotData.fault_codes = stPLC_MesData.Left.iotData.fault_codes;
|
|
|
+ WriteResultToPlc(plcNo, stationNameStr, tagBaseName + ".Right." + tagMesCommName, 1, iotData);
|
|
|
AddMessage(LogType.Info,
|
|
|
stationNameStr +
|
|
|
$"_节拍接口-- 设备本次上传节拍[{a3OEEType_right}],未上传节拍[{a3OEETypeGOld_right}]的结束信号,请检查;总用时" +
|
|
@@ -3817,7 +3849,7 @@ namespace MainForm
|
|
|
else
|
|
|
{
|
|
|
Task.Run(() =>
|
|
|
- S3节拍接口(plcNo, stationNameStr, tagBaseName + ".Right." + tagMesCommName,
|
|
|
+ S3节拍接口(plcNo, stationNameStr, tagBaseName + ".Right." + tagMesCommName, stPLC_MesData.Right.BarcodeSet.strCarrierBarcode,
|
|
|
stPLC_MesData.Left.iotData)); // MreTasks[4].Set();
|
|
|
}
|
|
|
s3PLCSignal_Old["a3OEEType_right"] = s3PLCData["a3OEEType_right"];
|
|
@@ -5188,7 +5220,7 @@ namespace MainForm
|
|
|
/// <param name="plcNo">PLC编号</param>
|
|
|
private void ReadStation_S6(int plcNo)
|
|
|
{
|
|
|
- string stationCode = "[OP60]";
|
|
|
+ string stationCode = "[OP70]";
|
|
|
string stationName = "组上盖板";
|
|
|
string stationNameStr = stationCode + stationName;
|
|
|
string tagBaseName = "g_OP60_MES"; //标签变量名称
|
|
@@ -5736,7 +5768,7 @@ namespace MainForm
|
|
|
/// <param name="plcNo">PLC编号</param>
|
|
|
private void ReadStation_S7(int plcNo)
|
|
|
{
|
|
|
- string stationCode = "[OP70]";
|
|
|
+ string stationCode = "[OP80]";
|
|
|
string stationName = "上盖板锁螺丝";
|
|
|
string stationNameStr = stationCode + stationName;
|
|
|
string tagBaseName = "g_OP70_MES"; //标签变量名称
|
|
@@ -5828,6 +5860,8 @@ namespace MainForm
|
|
|
{
|
|
|
if (!ProgressState)
|
|
|
{
|
|
|
+ stationCode = "[OP81]";
|
|
|
+ stationName = "上盖板锁螺丝1";
|
|
|
uuid = Guid.NewGuid().ToString();//创建贯穿进出站的uuid
|
|
|
ProgressState = true;
|
|
|
Task.Run(() => S7进站(plcNo, stationNameStr, stPLC_MesData.Left,
|
|
@@ -5859,6 +5893,8 @@ namespace MainForm
|
|
|
{
|
|
|
if (!ProgressState)
|
|
|
{
|
|
|
+ stationCode = "[OP81]";
|
|
|
+ stationName = "上盖板锁螺丝1";
|
|
|
ProgressState = true;
|
|
|
Task.Run(() => S7出站(plcNo, stationNameStr, stPLC_MesData.Left,
|
|
|
tagBaseName + ".Left." + tagMesCommName, stationCode, stationName, "Left",
|
|
@@ -5890,6 +5926,9 @@ namespace MainForm
|
|
|
{
|
|
|
if (!ProgressState)
|
|
|
{
|
|
|
+ uuid = Guid.NewGuid().ToString();//创建贯穿进出站的uuid
|
|
|
+ stationCode = "[OP82]";
|
|
|
+ stationName = "上盖板锁螺丝2";
|
|
|
ProgressState = true;
|
|
|
Task.Run(() => S7进站(plcNo, stationNameStr, stPLC_MesData.Right,
|
|
|
tagBaseName + ".Right." + tagMesCommName,
|
|
@@ -5920,11 +5959,14 @@ namespace MainForm
|
|
|
{
|
|
|
if (!ProgressState)
|
|
|
{
|
|
|
+ stationCode = "[OP82]";
|
|
|
+ stationName = "上盖板锁螺丝2";
|
|
|
ProgressState = true;
|
|
|
Task.Run(() => S7出站(plcNo, stationNameStr, stPLC_MesData.Right,
|
|
|
tagBaseName + ".Right." + tagMesCommName, stationCode, stationName, "Right",
|
|
|
out ProgressState));
|
|
|
stPLC_MesData.Right.mesCommFrmPLC.cmd = 0;
|
|
|
+ uuid = "";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -5972,7 +6014,7 @@ namespace MainForm
|
|
|
else
|
|
|
{
|
|
|
Task.Run(() =>
|
|
|
- S3节拍接口(plcNo, stationNameStr, tagBaseName + ".Left." + tagMesCommName,
|
|
|
+ S7节拍接口(plcNo, stationNameStr, tagBaseName + ".Left." + tagMesCommName,
|
|
|
stPLC_MesData.Left.iotData)); // MreTasks[4].Set();
|
|
|
}
|
|
|
s7PLCSignal_Old["a7OEEType_left"] = s7PLCData["a7OEEType_left"];
|
|
@@ -6008,7 +6050,7 @@ namespace MainForm
|
|
|
else
|
|
|
{
|
|
|
Task.Run(() =>
|
|
|
- S3节拍接口(plcNo, stationNameStr, tagBaseName + ".Right." + tagMesCommName,
|
|
|
+ S7节拍接口(plcNo, stationNameStr, tagBaseName + ".Right." + tagMesCommName,
|
|
|
stPLC_MesData.Left.iotData)); // MreTasks[4].Set();
|
|
|
}
|
|
|
s7PLCSignal_Old["a7OEEType_right"] = s7PLCData["a7OEEType_right"];
|
|
@@ -6454,7 +6496,7 @@ namespace MainForm
|
|
|
/// <param name="plcNo">PLC编号</param>
|
|
|
private void ReadStation_S8(int plcNo)
|
|
|
{
|
|
|
- string stationCode = "[OP80]";
|
|
|
+ string stationCode = "[OP90]";
|
|
|
string stationName = "NG下料";
|
|
|
string stationNameStr = stationCode + stationName;
|
|
|
string tagBaseName = "g_OP80_MES"; //标签变量名称
|
|
@@ -6978,7 +7020,7 @@ namespace MainForm
|
|
|
/// <param name="plcNo">PLC编号</param>
|
|
|
private void ReadStation_S9(int plcNo)
|
|
|
{
|
|
|
- string stationCode = "[OP90]";
|
|
|
+ string stationCode = "[OP100]";
|
|
|
string stationName = "半成品下料";
|
|
|
string stationNameStr = stationCode + stationName;
|
|
|
string tagBaseName = "g_OP90_MES"; //标签变量名称
|
|
@@ -10377,7 +10419,7 @@ namespace MainForm
|
|
|
/// </summary>
|
|
|
/// <param name="plcNo">PLC编号</param>
|
|
|
/// <param name="stationNameStr">工站全称</param>
|
|
|
- private void S3节拍接口(int plcNo, string stationNameStr, string tagMesCommName, IoT_DataSet_t iot_data)
|
|
|
+ private void S3节拍接口(int plcNo, string stationNameStr, string tagMesCommName,string CarrierBarcode, IoT_DataSet_t iot_data)
|
|
|
{
|
|
|
Stopwatch stopwatch1 = new Stopwatch();
|
|
|
Stopwatch stopwatch2 = new Stopwatch();
|
|
@@ -10386,11 +10428,8 @@ namespace MainForm
|
|
|
try
|
|
|
{
|
|
|
stopwatch1.Start();
|
|
|
- string oEEType = ((int)s1PLCData["a3OEEType"]).ToString(); // 节拍类型(plc写入)
|
|
|
- string a3OEEPartNo = (string)s1PLCData["a3OEEPartNo"]; // 物料码
|
|
|
- a3OEEPartNo = a3OEEPartNo.Replace("\0", "");
|
|
|
- string a3OEEVehicleCode = (string)s1PLCData["a3OEEVehicleCode"]; // 载具SN
|
|
|
- a3OEEVehicleCode = a3OEEVehicleCode.Replace("\0", "");
|
|
|
+ string oEEType = iot_data.BeatAction.ToString(); // 节拍类型(plc写入)
|
|
|
+ string strProductBarcode = SQLHelper.GetProductBarcodeByCarrierCode(CarrierBarcode);//产品SN
|
|
|
|
|
|
bool actionBool = Enum.TryParse(oEEType, out XiaomiDeviceOEE deviceOEE);
|
|
|
if (!actionBool)
|
|
@@ -10406,48 +10445,66 @@ namespace MainForm
|
|
|
return;
|
|
|
}
|
|
|
//作业开始后要有物料和载具信息
|
|
|
- if (string.IsNullOrEmpty(a3OEEPartNo) && string.IsNullOrEmpty(a3OEEVehicleCode) &&
|
|
|
+ if (string.IsNullOrEmpty(strProductBarcode) && string.IsNullOrEmpty(CarrierBarcode) &&
|
|
|
Convert.ToInt32(oEEType) > 2)
|
|
|
{
|
|
|
stopwatch2.Start();
|
|
|
//写入PLC
|
|
|
- iot_data.beatReturn = 2; //NG
|
|
|
+ IoT_DataSet_t iotData = new IoT_DataSet_t();
|
|
|
+ iotData.machineState = iot_data.machineState;
|
|
|
+ iotData.work_type = iot_data.work_type;
|
|
|
+ iotData.testStatus = iot_data.testStatus;
|
|
|
+ iotData.BeatAction = iot_data.BeatAction;
|
|
|
+ iotData.beatReturn = 2; //NG
|
|
|
+ iotData.fault_codes = iot_data.fault_codes;
|
|
|
WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
|
|
|
stopwatch2.Stop();
|
|
|
AddMessage_Station(stationNameStr, LogType.Info,
|
|
|
- stationNameStr + $"_[{a3OEEVehicleCode}][{a3OEEPartNo}]上传节拍失败!物料码与载具SN不可都为空;总用时" +
|
|
|
+ stationNameStr + $"_[{CarrierBarcode}][{strProductBarcode}]上传节拍失败!物料码与载具SN不可都为空;总用时" +
|
|
|
stopwatch1.ElapsedMilliseconds + "ms;调用Iot用时" + stopwatch2.ElapsedMilliseconds + "ms");
|
|
|
return;
|
|
|
}
|
|
|
- else if (Convert.ToInt32(oEEType) > 2 && string.IsNullOrEmpty(a3OEEPartNo))
|
|
|
+ else if (Convert.ToInt32(oEEType) > 2 && string.IsNullOrEmpty(strProductBarcode))
|
|
|
{
|
|
|
stopwatch2.Start();
|
|
|
//写入PLC
|
|
|
- iot_data.beatReturn = 2; //NG
|
|
|
+ IoT_DataSet_t iotData = new IoT_DataSet_t();
|
|
|
+ iotData.machineState = iot_data.machineState;
|
|
|
+ iotData.work_type = iot_data.work_type;
|
|
|
+ iotData.testStatus = iot_data.testStatus;
|
|
|
+ iotData.BeatAction = iot_data.BeatAction;
|
|
|
+ iotData.beatReturn = 2; //NG
|
|
|
+ iotData.fault_codes = iot_data.fault_codes;
|
|
|
WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
|
|
|
stopwatch2.Stop();
|
|
|
AddMessage_Station(stationNameStr, LogType.Info,
|
|
|
- stationNameStr + $"_[{a3OEEVehicleCode}][{a3OEEPartNo}]上传节拍失败!物料码不可为空;总用时" +
|
|
|
+ stationNameStr + $"_[{CarrierBarcode}]上传节拍失败!物料码不可为空;总用时" +
|
|
|
stopwatch1.ElapsedMilliseconds + "ms;调用Iot用时" + stopwatch2.ElapsedMilliseconds + "ms");
|
|
|
return;
|
|
|
}
|
|
|
- else if (Convert.ToInt32(oEEType) > 2 && string.IsNullOrEmpty(a3OEEVehicleCode))
|
|
|
+ else if (Convert.ToInt32(oEEType) > 2 && string.IsNullOrEmpty(CarrierBarcode))
|
|
|
{
|
|
|
stopwatch2.Start();
|
|
|
//写入PLC
|
|
|
- iot_data.beatReturn = 2; //NG
|
|
|
+ IoT_DataSet_t iotData = new IoT_DataSet_t();
|
|
|
+ iotData.machineState = iot_data.machineState;
|
|
|
+ iotData.work_type = iot_data.work_type;
|
|
|
+ iotData.testStatus = iot_data.testStatus;
|
|
|
+ iotData.BeatAction = iot_data.BeatAction;
|
|
|
+ iotData.beatReturn = 2; //NG
|
|
|
+ iotData.fault_codes = iot_data.fault_codes;
|
|
|
WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
|
|
|
stopwatch2.Stop();
|
|
|
AddMessage_Station(stationNameStr, LogType.Info,
|
|
|
- stationNameStr + $"_[{a3OEEVehicleCode}][{a3OEEPartNo}]上传节拍失败!载具码不可为空;总用时" +
|
|
|
+ stationNameStr + $"_上传节拍失败!载具码不可为空;总用时" +
|
|
|
stopwatch1.ElapsedMilliseconds + "ms;调用Iot用时" + stopwatch2.ElapsedMilliseconds + "ms");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
short _result = 0;
|
|
|
+
|
|
|
// 上传OEE
|
|
|
- (short, string) result = SaveOEEData(plcNo, stationNameStr, deviceOEE, a3OEEPartNo, a3OEEVehicleCode);
|
|
|
-
|
|
|
+ (short, string) result = SaveOEEData(plcNo, stationNameStr, deviceOEE, strProductBarcode, CarrierBarcode);
|
|
|
_result = result.Item1;
|
|
|
resultStr = result.Item2;
|
|
|
|
|
@@ -10455,7 +10512,13 @@ namespace MainForm
|
|
|
{
|
|
|
stopwatch2.Start();
|
|
|
//写入PLC
|
|
|
- iot_data.beatReturn = 1; //OK
|
|
|
+ IoT_DataSet_t iotData = new IoT_DataSet_t();
|
|
|
+ iotData.machineState = iot_data.machineState;
|
|
|
+ iotData.work_type = iot_data.work_type;
|
|
|
+ iotData.testStatus = iot_data.testStatus;
|
|
|
+ iotData.BeatAction = iot_data.BeatAction;
|
|
|
+ iotData.beatReturn = 1;//OK
|
|
|
+ iotData.fault_codes = iot_data.fault_codes;
|
|
|
WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
|
|
|
OnMessage(LogType.Info, $"PLC{plcNo}_{stationNameStr} 节拍{iot_data.BeatAction}上传IOT成功!上传结果:" + resultStr);
|
|
|
stopwatch2.Stop();
|
|
@@ -10464,7 +10527,13 @@ namespace MainForm
|
|
|
{
|
|
|
stopwatch2.Start();
|
|
|
//写入PLC
|
|
|
- iot_data.beatReturn = 2; //NG
|
|
|
+ IoT_DataSet_t iotData = new IoT_DataSet_t();
|
|
|
+ iotData.machineState = iot_data.machineState;
|
|
|
+ iotData.work_type = iot_data.work_type;
|
|
|
+ iotData.testStatus = iot_data.testStatus;
|
|
|
+ iotData.BeatAction = iot_data.BeatAction;
|
|
|
+ iotData.beatReturn = 2; //NG
|
|
|
+ iotData.fault_codes = iot_data.fault_codes;
|
|
|
WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
|
|
|
stopwatch2.Stop();
|
|
|
AddMessage_Station(stationNameStr, LogType.Error,
|
|
@@ -10482,7 +10551,13 @@ namespace MainForm
|
|
|
// MES_Flag
|
|
|
stopwatch2.Start();
|
|
|
//写入PLC
|
|
|
- iot_data.beatReturn = 2; //NG
|
|
|
+ IoT_DataSet_t iotData = new IoT_DataSet_t();
|
|
|
+ iotData.machineState = iot_data.machineState;
|
|
|
+ iotData.work_type = iot_data.work_type;
|
|
|
+ iotData.testStatus = iot_data.testStatus;
|
|
|
+ iotData.BeatAction = iot_data.BeatAction;
|
|
|
+ iotData.beatReturn = 2; //NG
|
|
|
+ iotData.fault_codes = iot_data.fault_codes;
|
|
|
WriteResultToPlc(plcNo, stationNameStr, tagMesCommName, 1, iot_data);
|
|
|
stopwatch2.Stop();
|
|
|
}
|