Ver Fonte

工序不可到达也返回产品信息

qinqi há 1 ano atrás
pai
commit
1dc706bf59
2 ficheiros alterados com 28 adições e 2 exclusões
  1. 14 1
      wwwroot/api/plc/plc_shiyou3227.ashx
  2. 14 1
      wwwroot/api/plc/plc_shiyou3228.ashx

+ 14 - 1
wwwroot/api/plc/plc_shiyou3227.ashx

@@ -120,7 +120,20 @@ public class plc_shiyou3227 : IHttpHandler
                     }
                     else
                     {
-                        s7.Write<short>(PLC.dbResult, Convert.ToInt16(3));
+                        DataTable goodsType = GetGoodinfo(barCode);
+
+                        if (goodsType != null  && goodsType.Rows.Count > 0)
+                        {
+                            bool goodscodeflag = PlcWriteRepeat<short>(PLC.dbGoodsCode, Convert.ToInt16(goodsType.Rows[0]["SEATCOVERCODE"].ToString()));
+                            bool goodstypeflag = PlcWriteRepeat<short>(PLC.dbGoodsType, Convert.ToInt16(goodsType.Rows[0]["GOODSTYPENAME"].ToString()));
+                            bool barcodeflag = PlcWriteRepeat<string>(PLC.dbBarcode, barCode);
+                            bool resultflag = PlcWriteRepeat<short>(PLC.dbResult, Convert.ToInt16(3));
+                            result.Add(new JObject(new JProperty("PLC读出(核对)", PLC.dbResult + " = " + s7.Read<short>(PLC.dbResult) + ";" + PLC.dbGoodsCode + " = " + s7.Read<short>(PLC.dbGoodsCode) + ";"+ PLC.dbGoodsType + " = " + s7.Read<short>(PLC.dbGoodsType) + ";" + PLC.dbBarcode + " = " + s7.Read<string>(PLC.dbBarcode, 11))));
+                        }
+                        else
+                        {
+                            s7.Write<short>(PLC.dbResult, Convert.ToInt16(2));
+                        } 
                     }
 
                 }

+ 14 - 1
wwwroot/api/plc/plc_shiyou3228.ashx

@@ -121,7 +121,20 @@ public class plc_shiyou3228 : IHttpHandler
                     }
                     else
                     {
-                        s7.Write<short>(PLC.dbResult, Convert.ToInt16(3));
+                        DataTable goodsType = GetGoodinfo(barCode);
+
+                        if (goodsType != null  && goodsType.Rows.Count > 0)
+                        {
+                            bool goodscodeflag = PlcWriteRepeat<short>(PLC.dbGoodsCode, Convert.ToInt16(goodsType.Rows[0]["SEATCOVERCODE"].ToString()));
+                            bool goodstypeflag = PlcWriteRepeat<short>(PLC.dbGoodsType, Convert.ToInt16(goodsType.Rows[0]["GOODSTYPENAME"].ToString()));
+                            bool barcodeflag = PlcWriteRepeat<string>(PLC.dbBarcode, barCode);
+                            bool resultflag = PlcWriteRepeat<short>(PLC.dbResult, Convert.ToInt16(3));
+                            result.Add(new JObject(new JProperty("PLC读出(核对)", PLC.dbResult + " = " + s7.Read<short>(PLC.dbResult) + ";" + PLC.dbGoodsCode + " = " + s7.Read<short>(PLC.dbGoodsCode) + ";"+ PLC.dbGoodsType + " = " + s7.Read<short>(PLC.dbGoodsType) + ";" + PLC.dbBarcode + " = " + s7.Read<string>(PLC.dbBarcode, 11))));
+                        }
+                        else
+                        {
+                            s7.Write<short>(PLC.dbResult, Convert.ToInt16(2));
+                        }
                     }
 
                 }