|
@@ -36,6 +36,7 @@ using Org.BouncyCastle.Asn1.IsisMtt;
|
|
|
using System.Web.Services.Description;
|
|
|
using System.Numerics;
|
|
|
using MathNet.Numerics.RootFinding;
|
|
|
+using static System.Windows.Forms.VisualStyles.VisualStyleElement.Tab;
|
|
|
|
|
|
/*
|
|
|
* 注:本源码对外提供,所以有些地方使用中文命名方法及变量
|
|
@@ -1278,11 +1279,15 @@ namespace MainForm
|
|
|
try
|
|
|
{
|
|
|
XmMES_StationInResponse response = new XmMES_StationInResponse();
|
|
|
+ string resultJson = "";
|
|
|
string mesRet = string.Empty;
|
|
|
int i = 0;
|
|
|
while (i < 2) // 1009会多次尝试上传
|
|
|
{
|
|
|
response = XiaomiMESHttp_StationInbound.StationIn(inRequest_Body);
|
|
|
+
|
|
|
+ resultJson = JsonConvert.SerializeObject(response);
|
|
|
+
|
|
|
if (response != null && response.header.code == "200")
|
|
|
break;
|
|
|
else if (!mesRet.Contains("1009")) // 1009是未知错误
|
|
@@ -1292,21 +1297,20 @@ namespace MainForm
|
|
|
|
|
|
mesRet = $"[{response?.header?.code}]{response?.header?.desc}";
|
|
|
// 记录失败原因
|
|
|
- OnMessage(LogType.Error, "上传出站数据到MES服务器---失败!正在重新上传!接口报错信息:" + mesRet + "参数:" + json_Body);
|
|
|
+ OnMessage(LogType.Error, $"上传出站数据到MES服务器---失败!正在重新上传!请求参数:{json_Body},接口报错信息:" + mesRet);
|
|
|
}
|
|
|
-
|
|
|
|
|
|
if (response?.header?.code == "200")
|
|
|
{
|
|
|
string sql_Upd = stationIn.ToStringUpdateStatusByID(1);
|
|
|
string ret_Upd = SQLHelper_New.ExecuteNonQuery(sql_Upd, null);
|
|
|
result = ret_Upd == "成功" ? 1 : 6;
|
|
|
- AddMessage( LogType.Info, $"【进站数据 SN {stationIn.Sn}】上传MES服务器---成功");
|
|
|
+ AddMessage( LogType.Info, $"【进站数据 SN {stationIn.Sn}】上传MES服务器---成功,请求参数:{json_Body},返回参数:{resultJson}");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result = 5;
|
|
|
- AddMessage(LogType.Info, $"【进站数据 SN {stationIn.Sn}】上传MES服务器---失败!接口报错信息:" + mesRet);
|
|
|
+ AddMessage(LogType.Info, $"【进站数据 SN {stationIn.Sn}】上传MES服务器---失败!请求参数:{json_Body},接口报错信息:" + mesRet);
|
|
|
}
|
|
|
string sql_response = stationIn.ToStringUpdateStationInReturn_body(JsonConvert.SerializeObject(response));
|
|
|
SQLHelper_New.ExecuteNonQuery(sql_response, null);
|
|
@@ -1337,10 +1341,10 @@ namespace MainForm
|
|
|
/// <returns>上传成功时返回1;失败返回0</returns>
|
|
|
private int SwitctProcessData(string stationNameStr, List<TestItem> items, string equipmentCode, string processItem,
|
|
|
string workorder_code, string batch_num, string mtltmrk, string proDate,
|
|
|
- string supplierCode, string sn, bool pass, string vehicleSn, string vehicleSlot, string MachineId, string StationId, string PartBarcode,string direction="")
|
|
|
+ string supplierCode, string sn, bool pass, string vehicleSn, string vehicleSlot, string MachineId, string StationId, string PartBarcode,string jsonParm, string direction="")
|
|
|
{
|
|
|
return SaveProcessDataByDB(stationNameStr, items, equipmentCode, processItem, workorder_code, batch_num, mtltmrk,
|
|
|
- proDate, supplierCode, sn, pass, vehicleSn, vehicleSlot, MachineId, StationId, PartBarcode, direction);
|
|
|
+ proDate, supplierCode, sn, pass, vehicleSn, vehicleSlot, MachineId, StationId, PartBarcode, jsonParm, direction);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1358,7 +1362,7 @@ namespace MainForm
|
|
|
/// <returns>上传成功时返回1;失败返回0</returns>
|
|
|
public int SaveProcessDataByDB(string stationNameStr, List<TestItem> items, string equipmentCode,
|
|
|
string processItem, string workorder_code, string batch_num, string mtltmrk,
|
|
|
- string proDate, string supplierCode, string sn, bool pass, string vehicleSn, string vehicleSlot, string machineId, string stationId, string partBarcode,string direction="")
|
|
|
+ string proDate, string supplierCode, string sn, bool pass, string vehicleSn, string vehicleSlot, string machineId, string stationId, string partBarcode,string jsonParm,string direction="")
|
|
|
{
|
|
|
int upload = 0;
|
|
|
int result = 0;
|
|
@@ -2085,10 +2089,10 @@ namespace MainForm
|
|
|
Parameter_value = sn,
|
|
|
Parameter_unit = ""
|
|
|
});
|
|
|
-
|
|
|
+ string paramJson = JsonConvert.SerializeObject(stPLC_MesData.mesData);
|
|
|
//出站接口
|
|
|
int result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem
|
|
|
- , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "1", MachineId, StationId, "");
|
|
|
+ , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "1", MachineId, StationId, "", paramJson);
|
|
|
|
|
|
byte mesResultFrmWeb = (byte)(result1 == 1 ? 1 : 110);
|
|
|
|
|
@@ -2381,10 +2385,10 @@ namespace MainForm
|
|
|
Parameter_unit = ""
|
|
|
});
|
|
|
|
|
|
-
|
|
|
+ string paramJson = JsonConvert.SerializeObject(stPLC_MesData.mesData);
|
|
|
|
|
|
int result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem
|
|
|
- , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "1", MachineId, StationId, PartBarcode);
|
|
|
+ , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "1", MachineId, StationId, PartBarcode, paramJson);
|
|
|
|
|
|
byte mesResultFrmWeb = (byte)(result1 == 1 ? 1 : 110);
|
|
|
|
|
@@ -2772,8 +2776,9 @@ namespace MainForm
|
|
|
int result1 = 1;
|
|
|
//if (direction == "Right")
|
|
|
//{
|
|
|
- result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem
|
|
|
- , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "1", MachineId, StationId, "", direction);
|
|
|
+ string paramJson = JsonConvert.SerializeObject(stPLC_MesData.mesData);
|
|
|
+ result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem
|
|
|
+ , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "1", MachineId, StationId, "", paramJson, direction);
|
|
|
//}
|
|
|
|
|
|
|
|
@@ -3071,9 +3076,9 @@ namespace MainForm
|
|
|
Parameter_value = sn,
|
|
|
Parameter_unit = ""
|
|
|
});
|
|
|
-
|
|
|
+ string paramJson = JsonConvert.SerializeObject(stPLC_MesData.mesData);
|
|
|
int result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem
|
|
|
- , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "1", MachineId, StationId, "");
|
|
|
+ , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "1", MachineId, StationId, "", paramJson);
|
|
|
|
|
|
byte mesResultFrmWeb = (byte)(result1 == 1 ? 1 : 110);
|
|
|
|
|
@@ -3361,9 +3366,9 @@ namespace MainForm
|
|
|
Parameter_value = sn,
|
|
|
Parameter_unit = ""
|
|
|
});
|
|
|
-
|
|
|
+ string paramJson = JsonConvert.SerializeObject(stPLC_MesData.mesData);
|
|
|
int result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem
|
|
|
- , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "1", MachineId, StationId, PartBarcode);
|
|
|
+ , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "1", MachineId, StationId, PartBarcode, paramJson);
|
|
|
|
|
|
byte mesResultFrmWeb = (byte)(result1 == 1 ? 1 : 110);
|
|
|
|
|
@@ -3649,9 +3654,9 @@ namespace MainForm
|
|
|
Parameter_value = sn,
|
|
|
Parameter_unit = ""
|
|
|
});
|
|
|
-
|
|
|
+ string paramJson = JsonConvert.SerializeObject(stPLC_MesData.mesData);
|
|
|
int result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem
|
|
|
- , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "1", MachineId, StationId, "");
|
|
|
+ , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "1", MachineId, StationId, "", paramJson);
|
|
|
|
|
|
byte mesResultFrmWeb = (byte)(result1 == 1 ? 1 : 110);
|
|
|
|
|
@@ -4027,12 +4032,13 @@ namespace MainForm
|
|
|
});
|
|
|
|
|
|
int result1 = 1;
|
|
|
- if (direction == "Right")
|
|
|
- {
|
|
|
- SwitctProcessData(stationNameStr, items, equipmentCode, processItem
|
|
|
- , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "1", MachineId, StationId, "");
|
|
|
+ //if (direction == "Right")
|
|
|
+ //{
|
|
|
+ string paramJson = JsonConvert.SerializeObject(stPLC_MesData.mesData);
|
|
|
+ SwitctProcessData(stationNameStr, items, equipmentCode, processItem , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode
|
|
|
+ , sn, pass, CarrierBarcode, "1", MachineId, StationId, "", paramJson);
|
|
|
|
|
|
- }
|
|
|
+ //}
|
|
|
|
|
|
//if (direction == "Left")
|
|
|
//{
|
|
@@ -4345,8 +4351,9 @@ namespace MainForm
|
|
|
Parameter_unit = ""
|
|
|
});
|
|
|
|
|
|
+ string paramJson = JsonConvert.SerializeObject(stPLC_MesData.mesData);
|
|
|
int result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem
|
|
|
- , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "1", MachineId, StationId, "");
|
|
|
+ , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "1", MachineId, StationId, "", paramJson);
|
|
|
|
|
|
byte mesResultFrmWeb = (byte)(result1 == 1 ? 1 : 110);
|
|
|
|
|
@@ -4625,9 +4632,9 @@ namespace MainForm
|
|
|
Parameter_value = sn,
|
|
|
Parameter_unit = ""
|
|
|
});
|
|
|
-
|
|
|
+ string paramJson = JsonConvert.SerializeObject(stPLC_MesData.mesData);
|
|
|
int result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem
|
|
|
- , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "1", MachineId, StationId, "");
|
|
|
+ , workorder_code, batch_num, mtltmrk, plcDate_YMD, supplierCode, sn, pass, CarrierBarcode, "1", MachineId, StationId, "", paramJson);
|
|
|
|
|
|
byte mesResultFrmWeb = (byte)(result1 == 1 ? 1 : 110);
|
|
|
|
|
@@ -5337,7 +5344,7 @@ namespace MainForm
|
|
|
Parameter_value = a1Result == 1 ? "OK" : "NG",
|
|
|
Parameter_unit = ""
|
|
|
});
|
|
|
- int result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem
|
|
|
+ int result1 = SwitctProcessData_old(stationNameStr, items, equipmentCode, processItem
|
|
|
, workorder_code, mtltmrk, partNo1, pass, sn, "1");
|
|
|
|
|
|
// 产品2
|
|
@@ -5360,7 +5367,7 @@ namespace MainForm
|
|
|
Parameter_value = a1Result == 1 ? "OK" : "NG",
|
|
|
Parameter_unit = ""
|
|
|
});
|
|
|
- int result2 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem
|
|
|
+ int result2 = SwitctProcessData_old(stationNameStr, items, equipmentCode, processItem
|
|
|
, workorder_code, mtltmrk, partNo2, pass, sn, "2");
|
|
|
|
|
|
short result = 0;
|
|
@@ -6407,7 +6414,7 @@ namespace MainForm
|
|
|
Parameter_value = b1Part1Result == 1 ? "OK" : "NG",
|
|
|
Parameter_unit = ""
|
|
|
});
|
|
|
- result1 = SwitctProcessData(stationNameStr, items1, equipmentCode, processItem
|
|
|
+ result1 = SwitctProcessData_old(stationNameStr, items1, equipmentCode, processItem
|
|
|
, workorder_code, mtltmrk, b1ProductSN1, pass1, b1ProductSN, "1");
|
|
|
}
|
|
|
// 产品2
|
|
@@ -6435,7 +6442,7 @@ namespace MainForm
|
|
|
Parameter_value = b1Part2Result == 1 ? "OK" : "NG",
|
|
|
Parameter_unit = ""
|
|
|
});
|
|
|
- result2 = SwitctProcessData(stationNameStr, items2, equipmentCode, processItem
|
|
|
+ result2 = SwitctProcessData_old(stationNameStr, items2, equipmentCode, processItem
|
|
|
, workorder_code, mtltmrk, b1ProductSN2, pass2, b1ProductSN, "2");
|
|
|
}
|
|
|
|
|
@@ -7298,7 +7305,7 @@ namespace MainForm
|
|
|
Parameter_unit = ""
|
|
|
});
|
|
|
|
|
|
- int result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem
|
|
|
+ int result1 = SwitctProcessData_old(stationNameStr, items, equipmentCode, processItem
|
|
|
, workorder_code, mtltmrk, productSN, pass, sn, "1");
|
|
|
short result = (short)result1;
|
|
|
stopwatch2.Stop();
|
|
@@ -8397,7 +8404,7 @@ namespace MainForm
|
|
|
Parameter_unit = ""
|
|
|
});
|
|
|
|
|
|
- int result1 = SwitctProcessData(stationNameStr, items1, equipmentCode, processItem
|
|
|
+ int result1 = SwitctProcessData_old(stationNameStr, items1, equipmentCode, processItem
|
|
|
, workorder_code, mtltmrk, partNos[i], pass, sn, index);
|
|
|
|
|
|
results.Add(result1);
|
|
@@ -8927,7 +8934,7 @@ namespace MainForm
|
|
|
Parameter_unit = ""
|
|
|
});
|
|
|
|
|
|
- int result1 = SwitctProcessData(stationNameStr, items1, equipmentCode, processItem
|
|
|
+ int result1 = SwitctProcessData_old(stationNameStr, items1, equipmentCode, processItem
|
|
|
, workorder_code, mtltmrk, partNos[i], isPass, sn, index);
|
|
|
|
|
|
results.Add(result1);
|
|
@@ -9269,7 +9276,7 @@ namespace MainForm
|
|
|
Parameter_unit = ""
|
|
|
});
|
|
|
|
|
|
- int result1 = SwitctProcessData(stationNameStr, items1, equipmentCode, processItem
|
|
|
+ int result1 = SwitctProcessData_old(stationNameStr, items1, equipmentCode, processItem
|
|
|
, workorder_code, mtltmrk, partNos[i], isPass, sn, index);
|
|
|
|
|
|
results.Add(result1);
|
|
@@ -9643,7 +9650,7 @@ namespace MainForm
|
|
|
Parameter_unit = ""
|
|
|
});
|
|
|
|
|
|
- int result1 = SwitctProcessData(stationNameStr, items1, equipmentCode, processItem
|
|
|
+ int result1 = SwitctProcessData_old(stationNameStr, items1, equipmentCode, processItem
|
|
|
, workorder_code, mtltmrk, partNos[i], pass, sn, index);
|
|
|
results.Add(result1);
|
|
|
}
|
|
@@ -10276,7 +10283,7 @@ namespace MainForm
|
|
|
Parameter_unit = ""
|
|
|
});
|
|
|
|
|
|
- int result1 = SwitctProcessData(stationNameStr, items, equipmentCode, processItem
|
|
|
+ int result1 = SwitctProcessData_old(stationNameStr, items, equipmentCode, processItem
|
|
|
, workorder_code, mtltmrk, partNo, pass, sn, "1");
|
|
|
//int result = result1 == 1 ? 1 : (GlobalContext.IsSendProcessData ? 4 : 1);
|
|
|
short result = result1 == 1 ? (short)1 : (short)3;
|