From 5e04278c55e10c245a184057b6ae3bd8238dd93a Mon Sep 17 00:00:00 2001 From: zxx <Zxx@HanInfo> Date: 星期二, 01 七月 2025 14:24:28 +0800 Subject: [PATCH] xiaomi --- HH.WCS.Mobox3/HH.WCS.Mobox3.XiaoMi/wms/LocationHelper.cs | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 59 insertions(+), 0 deletions(-) diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.XiaoMi/wms/LocationHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.XiaoMi/wms/LocationHelper.cs index 4a375c0..c63ebbd 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.XiaoMi/wms/LocationHelper.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.XiaoMi/wms/LocationHelper.cs @@ -1,4 +1,5 @@ 锘縰sing HH.WCS.XiaoMi.util; +using Opc.Ua; using SqlSugar; using System; using System.Collections.Generic; @@ -404,6 +405,29 @@ } return res; } + public static bool UnBindingLocHj(string loc, string frame) + { + var res = false; + var db = new SqlHelper<object>().GetInstance(); + var location = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == loc).First(); + try + { + db.BeginTran(); + var lcrList = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE.Trim() == loc).ToList(); + var count = db.Deleteable<LocCntrRel>().Where(it => frame==it.S_FRAME_CODE.Trim() && it.S_LOC_CODE.Trim() == loc).ExecuteCommand(); + location.N_CURRENT_NUM = lcrList.Count - count; + location.S_LOCK_STATE = "鏃�; + location.N_LOCK_STATE = 0; + db.Updateable(location).UpdateColumns(it => new { it.N_CURRENT_NUM, it.S_LOCK_STATE, it.N_LOCK_STATE }).ExecuteCommand(); + db.CommitTran(); + res = true; + } + catch (Exception ex) + { + db.RollbackTran(); + } + return res; + } /// <summary> /// 璐т綅缁戝畾瀹瑰櫒 /// </summary> @@ -443,7 +467,42 @@ } return res; } + /// <summary> + /// 璐т綅缁戝畾璐ф灦 灏忕背 + /// </summary> + /// <param name="loc"></param> + /// <param name="cntrs"></param> + /// <returns></returns> + public static bool BindingLocHj(string loc, string frame) + { + var res = false; + var db = new SqlHelper<object>().GetInstance(); + var location = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == loc).First(); + try + { + var lcrList = db.Queryable<LocCntrRel>().Includes(a => a.Container).Where(a => a.S_LOC_CODE.Trim() == loc).ToList(); + db.BeginTran(); + int count = 0; + if (lcrList.Count(b => b.S_CNTR_CODE.Trim() == frame) == 0) + { + db.Insertable<LocCntrRel>(new LocCntrRel { S_LOC_CODE = loc, S_FRAME_CODE = frame }).ExecuteCommand(); + count++; + } + location.N_CURRENT_NUM = lcrList.Count + count; + location.N_LOCK_STATE = 0; + location.S_LOCK_STATE = "鏃�; + db.Updateable(location).UpdateColumns(it => new { it.N_CURRENT_NUM, it.S_LOCK_STATE, it.N_LOCK_STATE }).ExecuteCommand(); + db.CommitTran(); + res = true; + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + db.RollbackTran(); + } + return res; + } /// <summary> /// 鍒ゆ柇閫昏緫搴撳尯鏄惁鏈夊彲鐢ㄨ揣浣� /// </summary> -- Gitblit v1.9.1