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 ++++++++++------- ams/Hanhe.iWCS.JingmenGLMNorthProtocol/WMSHelper.cs | 9 ++++++++- ams/Hanhe.iWCS.JingmenGLMNorthProtocol/MESHelper.cs | 10 +++++++++- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/MESHelper.cs b/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/MESHelper.cs index 8f9d8bc..970ba44 100644 --- a/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/MESHelper.cs +++ b/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/MESHelper.cs @@ -294,6 +294,10 @@ /// </summary> public string oneTrayWeight { get; set; } = "0"; /// <summary> + /// 璁惧閫氶亾鏁版嵁1鈥斺�鎵樼洏绫诲瀷锛�2浣嶆暣鏁�+ /// </summary> + public string trayType { get; set; } = "0"; + /// <summary> /// 璁惧閫氶亾鏁版嵁2鈥斺�鍙犲寘鍚庡疄闄呴噸閲忥細32浣嶆暣鏁� /// </summary> public string addWeight { get; set; } = "0"; @@ -382,7 +386,7 @@ /// </summary> //public string trayCodeWeight { get; set; } = "0"; /// <summary> - /// 璁惧閫氶亾鏁版嵁2鈥斺�鍗曟墭姣涚锛�2浣嶆暣鏁�+ /// 璁惧閫氶亾鏁版嵁2鈥斺�鍗曟墭姣涢噸锛�2浣嶆暣鏁� /// </summary> public string oneTrayWeight1 { get; set; } = "0"; /// <summary> @@ -394,6 +398,10 @@ /// </summary> public string oneTrayWeight { get; set; } = "0"; /// <summary> + /// 璁惧閫氶亾鏁版嵁1鈥斺�鎵樼洏绫诲瀷锛�2浣嶆暣鏁�+ /// </summary> + public string trayType { get; set; } = "0"; + /// <summary> /// 璁惧閫氶亾鏁版嵁2鈥斺�鍙犲寘鍚庡疄闄呴噸閲忥細32浣嶆暣鏁� /// </summary> public string addWeight { get; set; } = "0"; 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); //琚嬪彿 //鍛樺伐缂栧彿 diff --git a/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/WMSHelper.cs b/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/WMSHelper.cs index 728deb5..d429892 100644 --- a/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/WMSHelper.cs +++ b/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/WMSHelper.cs @@ -93,6 +93,10 @@ /// 鎵樼洏鐮� /// </summary> public string trayCode { get; set; } + /// <summary> + /// 鎵樼洏绫诲瀷 + /// </summary> + public string trayType { get; set; } public string locationGear { get; set; } public List<ItemData> data { get; set; } //public List<TimeData> TimeData { get; set; } @@ -119,6 +123,7 @@ public string endBit { get; set; } public string trayDimension { get; set; } public string needCreateAMSTask { get; set; } + public string trayType { get; set; } public int priority { get; set; } //public int isFull { get; set; } public string projectCode { get; set; } @@ -426,6 +431,7 @@ //CMMLog.Info($"WMSIn-{startBit}:鏌ヨ鏉′欢锛歩tem_code={info.materialCode},璇诲嚭 ERPItemTable 琛ㄦ暟鎹负锛歿JsonConvert.SerializeObject(erpItemTableInfo)}"); model.locationGear = info.secondNg.ToString(); model.trayCode = info.trayCode; + model.trayType = info.trayType == "1" ? "鐢板瓧鎵� : info.trayType == "2" ? "宸濆瓧鎵� : ""; //string product = !string.IsNullOrEmpty(info.productType) ? info.productType : erpItemTableInfo.item_spec; model.data.Add(new ItemData() { @@ -547,7 +553,7 @@ return result; } - public static bool WMSEmptyOut(string endBit, string ItemCode, ref string taskNo, ref string trayCode) + public static bool WMSEmptyOut(string endBit, string ItemCode,string trayType, ref string taskNo, ref string trayCode) { bool result = false; HardwareAccessObject hao = HardwareAccessHelper.Instance.GetEquipmentsHAO(Constants.WMS_DEVICE_TYPE_WMS); @@ -559,6 +565,7 @@ model.endBit = endBit; model.projectCode = "glm"; model.needCreateAMSTask = "Y"; + model.trayType = trayType; string msgData = JsonConvert.SerializeObject(model); string reqStr = "鐗╂枡鍚�" + ItemCode + ";"; string feedback = ""; -- Gitblit v1.9.1