|
|
@@ -743,6 +743,68 @@ namespace PCLCommunication
|
|
|
LogNet_BeforeSaveToFile(roomcode);
|
|
|
lbl.AppendLine(roomcode);
|
|
|
|
|
|
+ #region 防伪码
|
|
|
+ if (ConnSetting.SE_CODE_FLAG)
|
|
|
+ {
|
|
|
+ // 读取防伪码
|
|
|
+ int lianti = 222;
|
|
|
+ string se_code1 = m.GetHexData("D", lianti, 6);
|
|
|
+ if (!string.IsNullOrWhiteSpace(se_code1) &&
|
|
|
+ se_code1.StartsWith("8100"))
|
|
|
+ {
|
|
|
+ se_code1 = se_code1.Substring(4);
|
|
|
+ if (se_code1.StartsWith("0"))
|
|
|
+ { se_code1 = null; }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ { se_code1 = null; }
|
|
|
+
|
|
|
+ int zhineng = 222;
|
|
|
+ string se_code2 = m.GetHexData("D", zhineng, 6);
|
|
|
+ if (!string.IsNullOrWhiteSpace(se_code2) &&
|
|
|
+ se_code2.StartsWith("8100"))
|
|
|
+ {
|
|
|
+ se_code2 = se_code2.Substring(4);
|
|
|
+ if (se_code2.StartsWith("0"))
|
|
|
+ { se_code2 = null; }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ { se_code2 = null; }
|
|
|
+
|
|
|
+ string se_code = null;
|
|
|
+ if (!string.IsNullOrWhiteSpace(se_code1))
|
|
|
+ { se_code = se_code1; }
|
|
|
+ else if (!string.IsNullOrWhiteSpace(se_code2))
|
|
|
+ { se_code = se_code2; }
|
|
|
+
|
|
|
+ if (string.IsNullOrWhiteSpace(se_code))
|
|
|
+ {
|
|
|
+ ConnSetting.SetPLCError2(m, lbl, "读取防伪码失败");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrWhiteSpace(ConnSetting.INI_PATH_UserCode))
|
|
|
+ {
|
|
|
+ this.lblUsercode.Text = INIUtil.Read("iBOSS.MES", "UserCode", ConnSetting.INI_PATH_UserCode);
|
|
|
+ ConnSetting.MESInfo.UserCode = this.lblUsercode.Text;
|
|
|
+ }
|
|
|
+ string se_result = SmartDeviceProxy.Instance.Invoke<string>(
|
|
|
+ p => p.CheckSecurityCodeByBarcode(
|
|
|
+ ConnSetting.MESInfo.AccountCode,
|
|
|
+ ConnSetting.MESInfo.UserCode,
|
|
|
+ barcode,
|
|
|
+ se_code
|
|
|
+ ));
|
|
|
+
|
|
|
+ // 返回状态(成功、失败)
|
|
|
+ if (se_result != "OK")
|
|
|
+ {
|
|
|
+ ConnSetting.SetPLCError2(m, lbl, "防伪码:" + this.lblUsercode.Text + " " + se_result);
|
|
|
+ simplifyServer.SendMessage(arg1, "0000");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
// 自动工序计件
|
|
|
string scode = "OK";
|
|
|
if (ConnSetting.AutoPost)
|