|
|
@@ -1,6 +1,7 @@
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Data;
|
|
|
+using System.ServiceModel.Channels;
|
|
|
using System.Text;
|
|
|
using System.Windows.Forms;
|
|
|
using Curtain.DataAccess;
|
|
|
@@ -50,6 +51,8 @@ namespace PCLCommunication
|
|
|
{
|
|
|
Start(false);
|
|
|
}
|
|
|
+
|
|
|
+ //SimplifyServer_ReceivedBytesEvent(new AppSession(), (HslCommunication.NetHandle)2,null);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
@@ -656,6 +659,17 @@ namespace PCLCommunication
|
|
|
|
|
|
m = ConnSetting.PLC_ConnServer[flag.ToString()];
|
|
|
|
|
|
+ //byte[] byteCode11 = Encoding.ASCII.GetBytes(barcode + "$");
|
|
|
+ //result = m.SetData("D", 496, 6, byteCode11);
|
|
|
+ //LogNet_BeforeSaveToFile(JsonUtil.FromObject(m));
|
|
|
+ //lbl.AppendLine(JsonUtil.FromObject(m));
|
|
|
+ //if (!result)
|
|
|
+ //{
|
|
|
+ // LogNet_BeforeSaveToFile("PLC操作失败");
|
|
|
+ // lbl.AppendLine("PLC操作失败");
|
|
|
+ // return;
|
|
|
+ //}
|
|
|
+
|
|
|
try
|
|
|
{
|
|
|
m.Always = true;
|
|
|
@@ -744,6 +758,7 @@ namespace PCLCommunication
|
|
|
lbl.AppendLine(roomcode);
|
|
|
|
|
|
#region 防伪码
|
|
|
+ /*
|
|
|
if (ConnSetting.SE_CODE_FLAG)
|
|
|
{
|
|
|
// ==================================================================
|
|
|
@@ -858,6 +873,84 @@ namespace PCLCommunication
|
|
|
lbl.AppendLine($"绑定 防伪码[{se_result}] ");
|
|
|
}
|
|
|
}
|
|
|
+ */
|
|
|
+ // 1 获取条码对应的产品型号,是否需要绑定防伪码
|
|
|
+ DataRow dr = ConnSetting.GetGoodsInfo(barcode);
|
|
|
+ if (dr == null)
|
|
|
+ {
|
|
|
+ //LogNet_BeforeSaveToFile("写入 D281 错误标识 : 0 条码不存在" + barcode);
|
|
|
+ //lbl.AppendLine("写入 D281 错误标识 : 0 条码不存在" + barcode);
|
|
|
+ //// 写入 D281 错误标识
|
|
|
+ //bool result = m.SetData("D", 281, 1, "0001");
|
|
|
+ //LogNet_BeforeSaveToFile(JsonUtil.FromObject(m));
|
|
|
+ //lbl.AppendLine(JsonUtil.FromObject(m));
|
|
|
+ //if (!result)
|
|
|
+ //{
|
|
|
+ // LogNet_BeforeSaveToFile("PLC操作失败");
|
|
|
+ // lbl.AppendLine("PLC操作失败");
|
|
|
+ //}
|
|
|
+
|
|
|
+ ConnSetting.SetPLCError2(m, lbl, "条码不存在:" + barcode);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ string SECURITYCODEBINDFLAG = dr["SECURITYCODEBINDFLAG"] + "";
|
|
|
+ string goodstypeid = dr["goodstypeid"] + "";
|
|
|
+ // 1. 扫码类型(int)【0:无动作,1:启动智能扫码枪 2:启动连体扫码枪】
|
|
|
+ string gt_code = "0000";
|
|
|
+ if (SECURITYCODEBINDFLAG == "1")
|
|
|
+ {
|
|
|
+ if (goodstypeid == "3" || goodstypeid == "4")
|
|
|
+ {
|
|
|
+ // 非智能
|
|
|
+ gt_code = "0002";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // 智能
|
|
|
+ gt_code = "0001";
|
|
|
+ }
|
|
|
+ LogNet_BeforeSaveToFile("写入 D492 : " + gt_code + " 条码型号 " + barcode);
|
|
|
+ lbl.AppendLine("写入 D492 : " + gt_code + " 条码型号 " + barcode);
|
|
|
+ // 写入 D281 错误标识
|
|
|
+ result = m.SetData("D", 492, 1, gt_code);
|
|
|
+ LogNet_BeforeSaveToFile(JsonUtil.FromObject(m));
|
|
|
+ lbl.AppendLine(JsonUtil.FromObject(m));
|
|
|
+ if (!result)
|
|
|
+ {
|
|
|
+ LogNet_BeforeSaveToFile("PLC操作失败");
|
|
|
+ lbl.AppendLine("PLC操作失败");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ LogNet_BeforeSaveToFile("写入 D496 条码 : " + barcode);
|
|
|
+ lbl.AppendLine("写入 D496 条码 : " + barcode);
|
|
|
+ // 写入 D150 当前工号
|
|
|
+ byte[] byteCode1 = Encoding.ASCII.GetBytes(barcode + "$");
|
|
|
+ result = m.SetData("D", 496, 6, byteCode1);
|
|
|
+ LogNet_BeforeSaveToFile(JsonUtil.FromObject(m));
|
|
|
+ lbl.AppendLine(JsonUtil.FromObject(m));
|
|
|
+ if (!result)
|
|
|
+ {
|
|
|
+ LogNet_BeforeSaveToFile("PLC操作失败");
|
|
|
+ lbl.AppendLine("PLC操作失败");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogNet_BeforeSaveToFile("写入 D492 : 条码不需要绑定 " + barcode);
|
|
|
+ lbl.AppendLine("写入 D492 : 条码不需要绑定 " + barcode);
|
|
|
+ // 写入 D281 错误标识
|
|
|
+ result = m.SetData("D", 492, 1, gt_code);
|
|
|
+ LogNet_BeforeSaveToFile(JsonUtil.FromObject(m));
|
|
|
+ lbl.AppendLine(JsonUtil.FromObject(m));
|
|
|
+ if (!result)
|
|
|
+ {
|
|
|
+ LogNet_BeforeSaveToFile("PLC操作失败");
|
|
|
+ lbl.AppendLine("PLC操作失败");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
#endregion
|
|
|
|
|
|
// 自动工序计件
|