From 62f58ae538c32889a9adae09cf54543f00eb9fea Mon Sep 17 00:00:00 2001
From: cjs <2216046164@qq.com>
Date: 星期二, 08 七月 2025 17:03:42 +0800
Subject: [PATCH] 111

---
 ams/Hanhe.iWCS.JingmenGLMNorthProtocol/PLCControl.cs |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/PLCControl.cs b/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/PLCControl.cs
index 600e210..5361853 100644
--- a/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/PLCControl.cs
+++ b/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/PLCControl.cs
@@ -2007,7 +2007,7 @@
                 //RegisterReadInPut 璇诲彇杈撳叆瀵勫瓨鍣ㄨ繕鏄緭鍑哄瘎瀛樺櫒寰呭畾,璇诲彇閫氶亾1鐨勬暟鎹�                 var result = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel
                 {
-                    dataNum = 1,
+                    dataNum = 2,
                     addr = plc.readAddr+1,
                     host = plc.ip,
                     port = plc.port
@@ -2022,7 +2022,10 @@
                         {
                             string wmstaskno = "";
                             string traycode = "";
-                            bool req = WMSHelper.WMSEmptyOut(plc.location, "", ref wmstaskno, ref traycode);
+                            string trayType = "";
+                            if (result.result[1] == 1) trayType = "鐢板瓧鎵�;
+                            else trayType = "宸濆瓧鎵�;
+                            bool req = WMSHelper.WMSEmptyOut(plc.location, "",trayType, ref wmstaskno, ref traycode);
                             if (req) CMMLog.Debug($"璋冪敤WMS鑾峰彇涓夋ゼ鎷嗙洏鏈虹敓鎴愪换鍔℃垚鍔燂紒");
                             else CMMLog.Debug($"璋冪敤WMS鑾峰彇涓夋ゼ鎷嗙洏鏈虹敓鎴愪换鍔″け璐ワ紒");
                         }
@@ -3014,7 +3017,7 @@
                     info.productWeight = Convert.ToInt32(Completion(result[4]) + Completion(result[5]), 2).ToString();
                     info.oneTrayWeight1 = Convert.ToInt32(Completion(result[6]) + Completion(result[7]), 2).ToString();
                     info.oneTrayWeight = Convert.ToInt32(Completion(result[8]) + Completion(result[9]), 2).ToString();
-                    //info.oneTrayWeight = Convert.ToInt32(Completion(result[10]) + Completion(result[11]), 2).ToString();
+                    info.trayType = Convert.ToInt32(Completion(result[10]), 2).ToString();
                     info.addState = Convert.ToInt32(Completion(result[11]), 2);
                     info.packageCode = Convert.ToInt32(Completion(result[12]), 2).ToString();
 
@@ -3026,7 +3029,7 @@
                     
 
                     CMMLog.Info($"鏁版嵁澶勭悊娴佺▼锛氳幏鍙朚ODBUS杞崲鍚庣殑鏁版嵁淇℃伅锛歭ocation:{info.location},trayCode:{info.trayCode},productWeight:{info.productWeight}" +
-                        $",oneTrayWeight1:{info.oneTrayWeight1},oneTrayWeight:{info.oneTrayWeight} "+
+                        $",oneTrayWeight1:{info.oneTrayWeight1},oneTrayWeight:{info.oneTrayWeight},trayType:{info.trayType} "+
                         $"addState:{info.addState},packageCode:{info.packageCode}");
 
                     #endregion
@@ -3082,7 +3085,7 @@
                     var query1 = Query.And(Query.EQ("machineNo", location), Query.EQ("trayCode", "0"));
                     UpdateBuilder updateBuider = Update.Set("location", info.location).
                         Set("trayCode", info.trayCode).Set("productWeight", info.productWeight).
-                        Set("oneTrayWeight", info.oneTrayWeight).Set("oneTrayWeight1", info.oneTrayWeight1).
+                        Set("oneTrayWeight", info.oneTrayWeight).Set("oneTrayWeight1", info.oneTrayWeight1).Set("trayType", info.trayType).
                         Set("addWeight", info.addWeight).Set("packNg", info.packNg).Set("secondNg", info.secondNg).Set("addState", info.addState).
                         Set("packageCode", info.packageCode).Set("jsonData", json).Set("modify", DateTime.Now);
                     MongoDBSingleton.Instance.Update<MachineInfo>(query1, updateBuider, "MachineInfo", UpdateFlags.None);
@@ -3100,7 +3103,7 @@
                     {
                         UpdateBuilder updateBuider = Update.Set("location", info.location).
                         Set("trayCode", info.trayCode).Set("productWeight", info.productWeight).
-                        Set("oneTrayWeight", info.oneTrayWeight).Set("oneTrayWeight1", info.oneTrayWeight1).
+                        Set("oneTrayWeight", info.oneTrayWeight).Set("oneTrayWeight1", info.oneTrayWeight1).Set("trayType", info.trayType).
                         Set("addWeight", info.addWeight).Set("packNg", info.packNg).Set("secondNg", info.secondNg).Set("addState", info.addState).
                         Set("packageCode", info.packageCode).Set("jsonData", json).Set("modify", DateTime.Now);
                         MongoDBSingleton.Instance.Update<MachineInfo>(query2, updateBuider, "MachineInfo", UpdateFlags.None);
@@ -3469,7 +3472,7 @@
                 num[b] = Convert.ToInt32(Convert.ToString(int.Parse(machine.oneTrayWeight), 2).PadLeft(32, '0').ToString().Substring(k, 16), 2);
             }
             //for (int b = 10; b <= 11; b++) num[b] = 0;// 鍙犲寘鍚庡疄闄呴噸閲�&& 澶嶇О缁撴灉 榛樿锛�
-            num[10] = string.IsNullOrEmpty(machine.palletLayers) ? 0 : int.Parse(machine.palletLayers);  //鏄惁闇�鍙犳墭鐩�+            num[10] = int.Parse(machineInfoTwo.trayType);  //鎵樼洏绫诲瀷
             num[11] = machine.addState; //鏄惁闇�鍙犲寘
             num[12] = int.Parse(machine.packageCode);  //琚嬪彿
             //鍛樺伐缂栧彿

--
Gitblit v1.9.1