From 2f8733caf7ae5c94483fa332e0d3af69b61a0eb0 Mon Sep 17 00:00:00 2001
From: lss <2538410689@qq.com>
Date: 星期四, 03 七月 2025 23:09:25 +0800
Subject: [PATCH] 111

---
 HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/wms/ContainerHelper.cs |  111 +++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 95 insertions(+), 16 deletions(-)

diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/wms/ContainerHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/wms/ContainerHelper.cs
index d02801f..cb328ba 100644
--- a/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/wms/ContainerHelper.cs
+++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/wms/ContainerHelper.cs
@@ -1,6 +1,7 @@
 锘� using HH.WCS.JiaTong.models.other;
 using HH.WCS.JiaTong.util;
+using SqlSugar;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -41,11 +42,26 @@
         /// <summary>
         /// 鍒涘缓鎵樼洏鐗╂枡缁戝畾鍏崇郴
         /// </summary>
-        /// <param name="loc"></param>
-        /// <param name="cntr"></param>
-        /// <param name="itemcode"></param>
+        /// <param name="loc">璐т綅</param>
+        /// <param name="cntr">鎵樼洏</param>
+        /// <param name="itemcode">鐗╂枡缂栫爜</param>
+        /// <param name="itemname">鐗╂枡鍚嶇О</param>
+        /// <param name="itemtype">鐗╂枡绫诲瀷</param>
+        /// <param name="cntrtype">鎵樼洏绫诲瀷</param>
+        /// <param name="batch">鎵规鍙�/param>
+        /// <param name="wmslot">wms鍐呴儴鎵规鍙凤紝杞彂</param>
+        /// <param name="weight">閲嶉噺</param>
+        /// <param name="unit">鍗曚綅</param>
+        /// <param name="level">鐗╂枡绛夌骇</param>
+        /// <param name="tyreType">杞瀷</param>
+        /// <param name="supplier">渚涘簲鍟�/param>
+        /// <param name="receiveLot">鏀惰幏鎵规</param>
+        /// <param name="subpool">瀛愬簱</param>
+        /// <param name="expData">鐢熶骇鏃堕棿</param>
+        /// <param name="prdData">鍒版湡鏃堕棿</param>
         /// <returns></returns>
-        internal static bool CreateCntrItem(string loc, string cntr, string itemcode, string itemname, string itemtype, string cntrtype, string batch, string weight, string unit, string level = "")
+        internal static bool CreateCntrItem(string loc, string cntr, string itemcode, string itemname, string itemtype, string cntrtype,
+            string batch, string wmslot, string weight, string unit, string tyreType, string supplier, string receiveLot, string subpool, string expData = "", string prdData = "", string level = "",int qty =0, int qtycfg = 0)
         {
             var res = false;
             var db = new SqlHelper<object>().GetInstance();
@@ -63,14 +79,58 @@
                         db.Insertable<Container>(container).ExecuteCommand();
                     }
                     var cntritem = db.Queryable<CntrItemDetail>().Where(a => a.S_CNTR_CODE.Trim() == cntr).First();
-                    string[] kts = new string[] { "TP", "KT" };
-                    if (cntritem == null && !kts.Contains(itemcode))
+                   // string[] kts = new string[] { "TP", "KT" };
+                    if (cntritem == null)
                     {
                         var iteminfo = db.Queryable<TN_Material>().Where(a => a.S_ITEM_CODE.Trim() == itemcode && a.S_ITEM_NAME.Trim() == itemname).First();
-                        var cir = new CntrItemDetail { S_CNTR_CODE = cntr, S_ITEM_CODE = itemcode, S_ITEM_NAME = itemname, S_ITEM_SPEC = itemtype, S_WU = unit, F_WEIGHT = weight, S_BATCH_NO = batch, LEV = level };
+                        var cir = new CntrItemDetail
+                        {
+                            S_CNTR_CODE = cntr,
+                            S_ITEM_CODE = itemcode,
+                            S_ITEM_NAME = itemname,
+                            S_ITEM_SPEC = itemtype,
+                            S_WU = unit,
+                            F_WEIGHT = weight,
+                            S_BATCH_NO = batch,
+                            WmsLot = wmslot,
+                            LEV = level,
+                            TyreType = tyreType,
+                            S_SUPPLIER_NO = supplier,
+                            ReceiveLot = receiveLot,
+                            Subpool = subpool,
+                            D_EXP_DATE = prdData,
+                            D_PRD_DATE = expData,
+                            F_WEIGHT1= qty.ToString(),
+                            F_QTY1= qtycfg.ToString()
+                        };
                         db.Insertable<CntrItemDetail>(cir).ExecuteCommand();
                     }
-                    var cntrloc = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE.Trim() == cntr).First();
+                    else
+                    {
+                        cntritem.S_ITEM_CODE = itemcode;
+                        cntritem.S_ITEM_NAME = itemname;
+                        cntritem.S_ITEM_SPEC = itemtype;
+                        cntritem.F_WEIGHT = weight;
+                        cntritem.S_BATCH_NO = batch;
+                        cntritem.S_WU = unit;
+                        cntritem.F_WEIGHT = weight;
+                        cntritem.WmsLot = wmslot;
+                        cntritem.LEV = level;
+                        cntritem.TyreType = tyreType;
+                        cntritem.S_SUPPLIER_NO = supplier;
+                        cntritem.ReceiveLot = receiveLot;
+                        cntritem.Subpool = subpool;
+                        cntritem.D_EXP_DATE = prdData;
+                        cntritem.D_PRD_DATE = expData;
+                        cntritem. F_WEIGHT1 = qty.ToString();
+                        cntritem. F_QTY1 = qtycfg.ToString();
+                        if (db.Updateable<CntrItemDetail>(cntritem).ExecuteCommand() > 0)
+                        {
+                            LogHelper.Info($"鎵樼洏{cntr}锛氭洿鏂扮墿鏂檣itemcode}缁戝畾鍏崇郴鎴愬姛");
+                            res = true;
+                        }
+                    }
+                        var cntrloc = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE.Trim() == cntr).First();
                     if (cntrloc == null)
                     {
                         var loctp = new LocCntrRel { S_LOC_CODE = loc, S_CNTR_CODE = cntr };
@@ -98,11 +158,16 @@
         /// <summary>
         /// 鍒涘缓鎵樼洏鐗╂枡缁戝畾鍏崇郴
         /// </summary>
-        /// <param name="loc"></param>
-        /// <param name="cntr"></param>
-        /// <param name="itemcode"></param>
+        /// <param name="cntr">鎵樼洏鍙�/param>
+        /// <param name="itemcode">鐗╂枡缂栫爜</param>
+        /// <param name="itemname">鐗╂枡鍚嶇О</param>
+        /// <param name="batch">鎵规鍙�/param>
+        /// <param name="weight">閲嶉噺</param>
+        /// <param name="qty">鏁伴噺</param>
+        /// <param name="expData">鐢熶骇鏃堕棿</param>
+        /// <param name="prdData">鍒版湡鏃堕棿</param>
         /// <returns></returns>
-        internal static bool CreateCntrItem(string cntr, string itemcode, string itemname, string batch, string weight)
+        internal static bool CreateCntrItem(string cntr, string itemcode, string itemname, string batch, string weight, int qty, string expData = "", string prdData = "")
         {
             var res = false;
             var db = new SqlHelper<object>().GetInstance();
@@ -113,8 +178,18 @@
                 var cntritem = db.Queryable<CntrItemDetail>().Where(a => a.S_CNTR_CODE.Trim() == cntr).First();
                 if (cntritem == null)
                 {
-                  
-                    var cir = new CntrItemDetail { S_CNTR_CODE = cntr, S_ITEM_CODE = itemcode, S_ITEM_NAME = itemname, F_WEIGHT = weight, S_BATCH_NO = batch };
+
+                    var cir = new CntrItemDetail
+                    {
+                        S_CNTR_CODE = cntr,
+                        S_ITEM_CODE = itemcode,
+                        S_ITEM_NAME = itemname,
+                        F_WEIGHT = weight,
+                        S_BATCH_NO = batch,
+                        F_QTY = qty,
+                        D_EXP_DATE = prdData,
+                        D_PRD_DATE = expData
+                    };
                     if (db.Insertable<CntrItemDetail>(cir).ExecuteCommand() > 0)
                     {
                         LogHelper.Info($"鎵樼洏{cntr}锛氭坊鍔犵墿鏂檣itemcode}缁戝畾鍏崇郴鎴愬姛");
@@ -123,6 +198,7 @@
                     else
                     {
                         LogHelper.Info($"鎵樼洏{cntr}锛氭坊鍔犵墿鏂檣itemcode}缁戝畾鍏崇郴澶辫触");
+                        res = false;
                     }
 
                 }
@@ -132,7 +208,9 @@
                     cntritem.S_ITEM_NAME = itemname;
                     cntritem.F_WEIGHT = weight;
                     cntritem.S_BATCH_NO = batch;
-                  
+                    cntritem.D_EXP_DATE = prdData;
+                    cntritem.D_PRD_DATE = expData;
+
                     if (db.Updateable<CntrItemDetail>(cntritem).ExecuteCommand() > 0)
                     {
                         LogHelper.Info($"鎵樼洏{cntr}锛氭洿鏂扮墿鏂檣itemcode}缁戝畾鍏崇郴鎴愬姛");
@@ -141,6 +219,7 @@
                     else
                     {
                         LogHelper.Info($"鎵樼洏{cntr}锛氭洿鏂扮墿鏂檣itemcode}缁戝畾鍏崇郴澶辫触");
+                        res = false;
                     }
                 }
                 var con = db.Queryable<Container>().Where(a => a.S_CODE.Trim() == cntr).First();
@@ -150,7 +229,7 @@
                     db.Insertable<Container>(container).ExecuteCommand();
                 }
                 db.Ado.CommitTran();
-            
+
             }
             catch (Exception ex)
             {

--
Gitblit v1.9.1