|
|
@@ -34,9 +34,7 @@ public class plc_led_data : IHttpHandler
|
|
|
string road_no;
|
|
|
string rack;
|
|
|
string position;
|
|
|
- //入库是否成功标识
|
|
|
- bool WarehostingFlag;
|
|
|
- //入库返回失败提示
|
|
|
+ //返回失败提示
|
|
|
public string message = "";
|
|
|
|
|
|
public void ProcessRequest(HttpContext context)
|
|
|
@@ -55,7 +53,7 @@ public class plc_led_data : IHttpHandler
|
|
|
|
|
|
DataTable infoDt = new DataTable();
|
|
|
//写入PLC
|
|
|
- //SiemensS7.Open("172.19.26.241", 102);
|
|
|
+ SiemensS7.Open("172.19.26.244", 102);
|
|
|
//正式
|
|
|
//SiemensS7.Open("172.19.26.152", 102);
|
|
|
|
|
|
@@ -71,6 +69,7 @@ public class plc_led_data : IHttpHandler
|
|
|
// WHEN instr(g.goodsspecification, '地排') = 1 THEN 3
|
|
|
// WHEN instr(g.goodsspecification, '横排') = 1 THEN 4
|
|
|
// WHEN instr(g.goodsspecification, '295') = 1 THEN 5
|
|
|
+ // WHEN instr(g.goodsspecification, '220') = 1 THEN 6
|
|
|
// END AS goodsspecification
|
|
|
// ,CASE
|
|
|
// WHEN instr(gt.goodstypename, '连体') = 1 THEN 1
|
|
|
@@ -176,21 +175,28 @@ public class plc_led_data : IHttpHandler
|
|
|
string apiUrl = "http://" + HttpContext.Current.Request.Url.Host + ":" + HttpContext.Current.Request.Url.Port.ToString() + "/api/DKService/ExHGS3QR/AddWorkInfoHGS3_QR/?" + JsonClient.ParaToString(ht);
|
|
|
ApiLog.WriteApiLog("PLC_扫码", apiUrl, apiStatus, apiResult, apiId, apiBarcodeCount);
|
|
|
//===============================================
|
|
|
-
|
|
|
+ int i = 0;
|
|
|
//包装打印是否成功
|
|
|
if (Convert.ToBoolean(json["success"]) == true)
|
|
|
{
|
|
|
+ i = 1;
|
|
|
SiemensS7.Write<short>("420.0", Convert.ToInt16(1));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ i = 2;
|
|
|
SiemensS7.Write<short>("420.0", Convert.ToInt16(2));
|
|
|
}
|
|
|
- //if (Convert.ToInt16(1) != Convert.ToInt16(SiemensS7.Read<short>("420.0")))
|
|
|
- //{
|
|
|
- // //PLC补推
|
|
|
- // SiemensS7.Write<short>("420.0", Convert.ToInt16(1));
|
|
|
- //}
|
|
|
+ context.Response.Write(SiemensS7.Read<short>("420.0"));
|
|
|
+ if (i == 2)
|
|
|
+ {
|
|
|
+ //PLC补推
|
|
|
+ SiemensS7.Write<short>("420.0", Convert.ToInt16(2));
|
|
|
+ }
|
|
|
+ else if(i==1){
|
|
|
+ //PLC补推
|
|
|
+ SiemensS7.Write<short>("420.0", Convert.ToInt16(1));
|
|
|
+ }
|
|
|
Logger.Info("写入数据完成!barcode:" + context.Request["barcode"].ToString() + "一位数据位:" + SiemensS7.Read<short>("420.0"));
|
|
|
}
|
|
|
else
|
|
|
@@ -201,8 +207,8 @@ public class plc_led_data : IHttpHandler
|
|
|
//Logger.Info("无条码!");
|
|
|
}
|
|
|
|
|
|
- //context.Response.Write(new JsonResult(infoDt).ToJson());
|
|
|
- //SiemensS7.Close();
|
|
|
+ context.Response.Write(new JsonResult(infoDt).ToJson());
|
|
|
+ SiemensS7.Close();
|
|
|
}
|
|
|
catch (Exception ex )
|
|
|
{
|