From 2b41b8903accb120df1ae29aac6342c124cc78d8 Mon Sep 17 00:00:00 2001
From: zxx <Zxx@HanInfo>
Date: 星期四, 03 七月 2025 17:29:18 +0800
Subject: [PATCH] 大件

---
 HH.WCS.Mobox3/HH.WCS.Mobox3.XiaoMi/wms/ContainerHelper.cs |   66 ++++++++++++++++++++++++++++++++-
 1 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.XiaoMi/wms/ContainerHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.XiaoMi/wms/ContainerHelper.cs
index 2e83cbe..866be10 100644
--- a/HH.WCS.Mobox3/HH.WCS.Mobox3.XiaoMi/wms/ContainerHelper.cs
+++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.XiaoMi/wms/ContainerHelper.cs
@@ -576,7 +576,41 @@
             //1.0 鏌ヨ揣浣嶅鍣ㄨ〃
             return result;
         }
-
+        /// <summary>
+        /// 灏忕背 缁戝畾璐т綅瀹瑰櫒琛�+        /// </summary>
+        /// <param name="cntr"></param>
+        /// <returns></returns>
+        internal static bool BindLocCntrsXm(string loc, string cntr, string itemCode, string itemName, string BatchNo, string issueMode, int num)
+        {
+            bool result = true;
+            List<string> list = new List<string>(cntr.Split(','));
+            var db = new SqlHelper<object>().GetInstance();
+            for (int i = 0; i < list.Count; i++)
+            {
+                if (!string.IsNullOrEmpty(list[i]))
+                {
+                    string cntrCode = list[i];
+                    if (db.Queryable<LocCntrRel>().Count(a => a.S_CNTR_CODE.Trim() == cntrCode) == 0)
+                    {
+                        var cir = new LocCntrRel { S_LOC_CODE = loc, S_CNTR_CODE = cntrCode };
+                        var con = new Container { S_CODE = cntrCode, N_DETAIL_COUNT = 1, C_FULL = "2" };//榛樿婊�涓诲姩缁戝畾鏈嶅姟鐢�+                        db.Insertable<LocCntrRel>(cir).ExecuteCommand();
+                        db.Insertable<Container>(con).ExecuteCommand();
+                        if (!string.IsNullOrEmpty(itemCode))
+                        {
+                            LogHelper.Info($"缁戝畾瀹瑰櫒鍙傛暟锛歿JsonConvert.SerializeObject(con)}");
+                            ContainerHelper.BindCntrItemXm(cntrCode, itemCode, itemName, BatchNo, issueMode, num);
+                            ////鏈夌墿鏂欑殑璇濆氨鏄弧鐨�+                            //con.C_FULL = "2";
+                            //db.Updateable(con).UpdateColumns(it => it.C_FULL).ExecuteCommand();
+                        }
+                    }
+                }
+            }
+            //1.0 鏌ヨ揣浣嶅鍣ㄨ〃
+            return result;
+        }
         /// <summary>
         /// 缁戝畾璐т綅瀹瑰櫒琛�         /// </summary>
@@ -623,7 +657,35 @@
             {
                 LogHelper.Info($"BindCntrItem=============");
                 db.BeginTran();
-                var cir = new CntrItemDetail { S_CNTR_CODE = trayCode, S_ITEM_CODE = itemCode, S_ITEM_NAME = itemName};
+                var cir = new CntrItemDetail { S_CNTR_CODE = trayCode, S_ITEM_CODE = itemCode, S_ITEM_NAME = itemName };
+                db.Insertable<CntrItemDetail>(cir).ExecuteCommand();
+                db.Ado.CommitTran();
+                res = true;
+                LogHelper.Info($"缁戝畾瀹瑰櫒鐗╂枡琛ㄦ墭鐩橈細{trayCode}鐗╂枡缂栫爜锛歿itemCode}鐗╂枡鍚嶇О锛歿itemName}");
+            }
+            catch (Exception ex)
+            {
+                LogHelper.Error("BindCntrItem:" + ex.Message, ex);
+                db.Ado.RollbackTran();
+            }
+            return res;
+        }
+        /// <summary>
+        /// 灏忕背 缁戝畾瀹瑰櫒鐗╂枡琛�+        /// </summary>
+        /// <param name="itemCode"></param>
+        /// <param name="batchNo"></param>
+        /// <param name="qty"></param>
+        /// <returns></returns>
+        internal static bool BindCntrItemXm(string trayCode, string itemCode, string itemName, string BatchNo, string issueMode, int num)
+        {
+            var res = false;
+            var db = new SqlHelper<object>().GetInstance();
+            try
+            {
+                LogHelper.Info($"BindCntrItem=============");
+                db.BeginTran();
+                var cir = new CntrItemDetail { S_CNTR_CODE = trayCode, S_ITEM_CODE = itemCode, S_ITEM_NAME = itemName, S_BATCH_NO = itemName, F_QTY = num, S_ITEM_SPEC = issueMode };
                 db.Insertable<CntrItemDetail>(cir).ExecuteCommand();
                 db.Ado.CommitTran();
                 res = true;

--
Gitblit v1.9.1