|
|
@@ -129,71 +129,61 @@ namespace UAS_MES_NEW.Make
|
|
|
JObject dataObj = JObject.Parse(dataString);
|
|
|
string serial = dataObj["Serial"].ToString();
|
|
|
|
|
|
+ //ShowMsg(1, $"第{currCount}次接收,客户端:{e.ClientId}, {name}类型信息, 序列号: {serial}");
|
|
|
+ ShowMsg(1, $"第{currCount}次接收,客户端:{e.ClientId}, {name}类型信息({e.Message})");
|
|
|
+
|
|
|
string mesSuc = "0", mesMsg = "";
|
|
|
- SQL.Clear();
|
|
|
- SQL.Append($@"select * from makeprocess where mp_sncode = '{serial}' and mp_stepcode = '{User.CurrentStepCode}'"); // 本站过站记录
|
|
|
- dt = (DataTable)dh.ExecuteSql(SQL.ToString(), "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
+ if (name == "VerifyData")
|
|
|
{
|
|
|
- mesSuc = "1";
|
|
|
- mesMsg = "已重复过站";
|
|
|
-
|
|
|
SQL.Clear();
|
|
|
- SQL.Append($@"select * from makeserial where ms_sncode = '{serial}' and ms_nextstepcode = '{User.CurrentStepCode}'"); // 站位回退可烧录
|
|
|
+ SQL.Append($@"select * from makeprocess where mp_sncode = '{serial}' and mp_stepcode = '{User.CurrentStepCode}'"); // 本站过站记录
|
|
|
dt = (DataTable)dh.ExecuteSql(SQL.ToString(), "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- mesSuc = "0";
|
|
|
- mesMsg = "";
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- mesSuc = "0";
|
|
|
- }
|
|
|
+ mesSuc = "1";
|
|
|
+ mesMsg = "已重复过站";
|
|
|
|
|
|
- //ShowMsg(1, $"第{currCount}次接收,客户端:{e.ClientId}, {name}类型信息, 序列号: {serial}");
|
|
|
- ShowMsg(1, $"第{currCount}次接收,客户端:{e.ClientId}, {name}类型信息({e.Message})");
|
|
|
+ SQL.Clear();
|
|
|
+ SQL.Append($@"select * from makeserial where ms_sncode = '{serial}' and ms_nextstepcode = '{User.CurrentStepCode}'"); // 站位回退可烧录
|
|
|
+ dt = (DataTable)dh.ExecuteSql(SQL.ToString(), "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ mesSuc = "0";
|
|
|
+ mesMsg = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, serial, User.UserCode, out omakeCode, out oMsid, out oErrorMessage))
|
|
|
- {
|
|
|
- if (LogicHandler.SetStepResult(omakeCode, User.UserSourceCode, serial, "产测软件对接", "OK", User.UserCode, out oErrorMessage))
|
|
|
+ if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, serial, User.UserCode, out omakeCode, out oMsid, out oErrorMessage))
|
|
|
{
|
|
|
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, omakeCode, User.UserLineCode, User.UserSourceCode, "产测软件对接", "产测软件对接成功", serial, "");
|
|
|
-
|
|
|
- ShowMsg(1, $"序列号: {serial} 过站处理成功");
|
|
|
+ ma_code.Text = omakeCode;
|
|
|
FirstStepPaseJSON(e.ClientId, currCount, serial, mesSuc, mesMsg);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- ShowMsg(0, $"NG,序列号: {serial} 过站失败,{oErrorMessage}");
|
|
|
+ ShowMsg(0, $"NG,序列号: {serial} 归属核对失败,{oErrorMessage}");
|
|
|
FirstStepPaseJSON(e.ClientId, currCount, serial, "1", oErrorMessage);
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
+ else if(name == "DetectionResult")
|
|
|
{
|
|
|
- ShowMsg(0, $"NG,序列号: {serial} 归属核对失败,{oErrorMessage}");
|
|
|
- FirstStepPaseJSON(e.ClientId, currCount, serial, "1", oErrorMessage);
|
|
|
- }
|
|
|
-
|
|
|
- #region
|
|
|
- /*if (currCount == 1)
|
|
|
- {
|
|
|
-
|
|
|
+ if (LogicHandler.SetStepResult(ma_code.Text, User.UserSourceCode, serial, "产测软件对接", "OK", User.UserCode, out oErrorMessage))
|
|
|
+ {
|
|
|
+ LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "产测软件对接", "产测软件对接成功", serial, "");
|
|
|
+ ShowMsg(1, $"序列号: {serial} 过站处理成功");
|
|
|
+ SecondStepPaseJSON(e.ClientId, currCount, serial, "0", mesMsg);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShowMsg(0, $"NG,序列号: {serial} 过站失败,{oErrorMessage}");
|
|
|
+ SecondStepPaseJSON(e.ClientId, currCount, serial, "1", oErrorMessage);
|
|
|
+ }
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- ShowMsg(1, $"第{currCount}次接收,客户端:{e.ClientId}, {name}类型信息, 序列号: {serial} 已处理过");
|
|
|
- FirstStepPaseJSON(e.ClientId, currCount, serial, "0", "已处理过");
|
|
|
- }*/
|
|
|
- #endregion
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
ShowMsg(0, $"NG,序列号: 产测软件解析失败,{ex.Message}");
|
|
|
FirstStepPaseJSON(e.ClientId, currCount, "", "2", "产测软件返回信息解析错误,未知序列号");
|
|
|
}
|
|
|
-
|
|
|
//currCount = currCount == 2 ? 0 : currCount;
|
|
|
}));
|
|
|
}
|
|
|
@@ -202,12 +192,12 @@ namespace UAS_MES_NEW.Make
|
|
|
{
|
|
|
var dataObject = new
|
|
|
{
|
|
|
+ Serial = sn,
|
|
|
ErrorCode = errCode,
|
|
|
- ErrorMsg = msg,
|
|
|
- Serial = sn
|
|
|
+ ErrorMsg = msg
|
|
|
};
|
|
|
string dataJson = JsonConvert.SerializeObject(dataObject, Formatting.None);
|
|
|
- VerifyResultMessage message = new VerifyResultMessage
|
|
|
+ ResponseMessage message = new ResponseMessage
|
|
|
{
|
|
|
Name = "VerifyResult",
|
|
|
Data = dataJson
|
|
|
@@ -256,6 +246,26 @@ namespace UAS_MES_NEW.Make
|
|
|
#endregion
|
|
|
}
|
|
|
|
|
|
+ private void SecondStepPaseJSON(string cliId, int currCount, string sn, string subRes, string msg)
|
|
|
+ {
|
|
|
+ var dataObject = new
|
|
|
+ {
|
|
|
+ Serial = sn,
|
|
|
+ SubmitResult = subRes,
|
|
|
+ ErrorMessage = msg
|
|
|
+ };
|
|
|
+ string dataJson = JsonConvert.SerializeObject(dataObject, Formatting.None);
|
|
|
+ ResponseMessage message = new ResponseMessage
|
|
|
+ {
|
|
|
+ Name = "SubmitResponse",
|
|
|
+ Data = dataJson
|
|
|
+ };
|
|
|
+
|
|
|
+ string jsonMessage = JsonConvert.SerializeObject(message, Formatting.None);
|
|
|
+ string sendMsg = _server.SendMessage(cliId, jsonMessage);
|
|
|
+ ShowMsg(sendMsg.StartsWith("OK") ? 1 : 0, sendMsg);
|
|
|
+ }
|
|
|
+
|
|
|
private void SocketServer_ReceivedMsg(object sender, ReceivedMsgEventArgs e)
|
|
|
{
|
|
|
this.Invoke(new Action(() =>
|
|
|
@@ -351,6 +361,17 @@ namespace UAS_MES_NEW.Make
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
+
|
|
|
+ public class ResponseMessage
|
|
|
+ {
|
|
|
+ [JsonProperty("Name")]
|
|
|
+ public string Name { get; set; }
|
|
|
+
|
|
|
+ [JsonProperty("Data")]
|
|
|
+ public string Data { get; set; }
|
|
|
+ }
|
|
|
+
|
|
|
+ #region
|
|
|
public class VerifyResultData
|
|
|
{
|
|
|
[JsonProperty("ErrorCode")]
|
|
|
@@ -363,16 +384,6 @@ namespace UAS_MES_NEW.Make
|
|
|
public string Serial { get; set; }
|
|
|
}
|
|
|
|
|
|
- public class VerifyResultMessage
|
|
|
- {
|
|
|
- [JsonProperty("Name")]
|
|
|
- public string Name { get; set; } = "VerifyResult";
|
|
|
-
|
|
|
- [JsonProperty("Data")]
|
|
|
- public string Data { get; set; }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
public class SubmitResponseData
|
|
|
{
|
|
|
[JsonProperty("Serial")]
|
|
|
@@ -384,16 +395,7 @@ namespace UAS_MES_NEW.Make
|
|
|
[JsonProperty("ErrorMessage")]
|
|
|
public string ErrorMessage { get; set; } = "";
|
|
|
}
|
|
|
-
|
|
|
- public class SubmitResponseMessage
|
|
|
- {
|
|
|
- [JsonProperty("Name")]
|
|
|
- public string Name { get; set; } = "SubmitResponse";
|
|
|
-
|
|
|
- [JsonProperty("Data")]
|
|
|
- public string Data { get; set; }
|
|
|
- }
|
|
|
-
|
|
|
+ #endregion
|
|
|
|
|
|
public class ReceivedDatasEventArgs : EventArgs
|
|
|
{
|