From eb0ad83719de660e5c4f7676aea4710625b6bd51 Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期四, 19 十二月 2024 21:55:43 +0800
Subject: [PATCH] WMS增加标准上下架功能事务

---
 Tiger.Business.WMS/iWMS/RePrintBarcode.cs                      |   18 
 Tiger.Business.WMS/Tiger.Business.WMS.csproj                   |   10 
 Tiger.Business.WMS/Transaction/Old/InMatStorage.cs             |    4 
 Tiger.Model.Net/Tiger.Model.Net.csproj                         |    3 
 Tiger.Model.Net/Entitys/WMS/Api/Output_Entitys.cs              |   43 
 Tiger.Model.Net/Entitys/WMS/Api/Input_Entitys.cs               |   12 
 Tiger.IBusiness.WMS/IWmsItem.cs                                |    8 
 Tiger.Business.WMS/Transaction/Old/ProductionMaterialReq.cs    |    4 
 Tiger.Business.WMS/Transaction/Old/OutWorkOrder.cs             |    4 
 Tiger.IBusiness.WMS/Transaction/IIn_Default.cs                 |   27 
 Tiger.Business.WMS/Common/Barcode.Analysis.cs                  |  213 ---
 Tiger.Business.MES/Common/WorkBatch.cs                         |    1 
 Tiger.Business.WMS/Transaction/Old/OutSplit.cs                 |    4 
 Tiger.IBusiness.WMS/IInventory.cs                              |   33 
 Tiger.IBusiness.WMS/Transaction/IOut_Default.cs                |   26 
 Tiger.Api/Autofac/SingleInstance.json                          |   14 
 Tiger.Api/Language.db                                          |    0 
 Tiger.Business.WMS/Transaction/In_Default.cs                   |  382 +++++
 Tiger.Business.WMS/Transaction/Old/OtherInLocationChecking.cs  |   50 
 Tiger.Business.WMS/Transaction/Old/OutNoBillcode.cs            |   10 
 Tiger.Business.WMS/Common/Barcode.cs                           |    2 
 Tiger.Business.WMS/Minsun/CustSupplyChecking.cs                |    2 
 Tiger.Business.WMS/Transaction/Old/OtherInLocation.cs          |  116 
 Tiger.Business.MES/WorkAction/YadaAssembly.cs                  |   20 
 Tiger.Business.WMS/Common/Inventory.cs                         |   38 
 Tiger.Business.WMS/Transaction/Old/OutSale.cs                  |    4 
 Tiger.Api/Controllers/Test/TestController.R.cs                 |   52 
 Tiger.Business.WMS/WMS_ITEM_Biz.cs                             |  104 
 Tiger.Business.WMS/Transaction/Old/InReceipt.cs                |    6 
 Tiger.Business.WMS/Minsun/InStorage.cs                         |    2 
 Tiger.Api/Program.cs                                           |   10 
 Tiger.Business.WMS/Transaction/Old/OutTransfer.cs              |    4 
 Tiger.Business.WMS/Transaction/Old/OutOther.cs                 |    4 
 Tiger.Business.WMS/Transaction/Old/CustSupplyCheckingNew.cs    |   50 
 Tiger.Model.Net/Entitys/WMS/WMS_ITEM.cs                        |   27 
 Tiger.Model.Net/Entitys/WMS/Api/ProdReqInput.cs                |   20 
 Tiger.Business.WMS/Minsun/iWMS.Minsun.cs                       |    0 
 Tiger.IBusiness.WMS/Minsun/IInventroyInfo.cs                   |    0 
 Tiger.Business.WMS/Transaction/Old/InFinished.cs               |    4 
 Tiger.IBusiness.WMS/Transaction/IOutNoBillcode.cs              |    2 
 Tiger.Model.Net/Entitys/WMS/WMS_SHELF.cs                       |    9 
 Tiger.Controllers.WMS/Controllers/WMSController.Out_Default.cs |  186 ++
 Tiger.Business.WMS/iWMS/iWMS.Minsun.cs                         | 2090 ++++++++++++++++++++++++++++++
 Tiger.Controllers.WMS/Controllers/WMSController.In_Default.cs  |  185 ++
 Tiger.Business.WMS/Transaction/Old/Resell.cs                   |    0 
 Tiger.Business.WMS/Transaction/Out_Default.cs                  |  256 +++
 Tiger.Business.WMS/Transaction/WmsCount.cs                     |    4 
 Tiger.Model.Net/Entitys/WMS/Api/BaseInput.cs                   |   17 
 Tiger.Business.WMS/Transaction/Old/CustomerSupplyInNew.cs      |    4 
 Tiger.Business.WMS/Transaction/Old/InProductionReturn.cs       |    6 
 Tiger.Business.WMS/Transaction/Old/LocationTransfer.cs         |    4 
 Tiger.Business.WMS/Transaction/WMSTransactionBase.cs           |   21 
 52 files changed, 3,616 insertions(+), 499 deletions(-)

diff --git a/Tiger.Api/Autofac/SingleInstance.json b/Tiger.Api/Autofac/SingleInstance.json
index 83804b8..9fbc03c 100644
--- a/Tiger.Api/Autofac/SingleInstance.json
+++ b/Tiger.Api/Autofac/SingleInstance.json
@@ -95,13 +95,13 @@
       "injectProperties": true,
       "instanceScope": "SingleInstance" //鐢熷懡鍛ㄦ湡
     },
-    {
-      "type": "Tiger.Business.WMS.RePrintBarcode,Tiger.Business.WMS",
-      "services": [ { "type": "Tiger.IBusiness.IRePrintBarcode,Tiger.IBusiness.WMS" } ],
-      "autoActivate": true,
-      "injectProperties": true,
-      "instanceScope": "SingleInstance" //鐢熷懡鍛ㄦ湡
-    },
+    //{
+    //  "type": "Tiger.Business.WMS.RePrintBarcode,Tiger.Business.WMS",
+    //  "services": [ { "type": "Tiger.IBusiness.IRePrintBarcode,Tiger.IBusiness.WMS" } ],
+    //  "autoActivate": true,
+    //  "injectProperties": true,
+    //  "instanceScope": "SingleInstance" //鐢熷懡鍛ㄦ湡
+    //},
     {
       "type": "Tiger.Business.BizContext,Tiger.Business",
       "services": [ { "type": "Tiger.IBusiness.IBizContext,Tiger.IBusiness" } ],
diff --git a/Tiger.Api/Controllers/Test/TestController.R.cs b/Tiger.Api/Controllers/Test/TestController.R.cs
index 80cdd05..d9ccad0 100644
--- a/Tiger.Api/Controllers/Test/TestController.R.cs
+++ b/Tiger.Api/Controllers/Test/TestController.R.cs
@@ -235,6 +235,37 @@
         [HttpGet]
         public async Task<IActionResult> D1Async(string param)
         {
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=01"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 01 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=02"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 02 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=03"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 03 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=04"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 04 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=05"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 05 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=06"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 06 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=07"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 07 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=08"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 08 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=09"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 09 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=10"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 10 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=11"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 11 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=12"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 12 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=13"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 13 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=14"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 14 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=15"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 15 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=16"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 16 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=17"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 17 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=18"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 18 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=19"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 19 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=20"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 20 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=21"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 21 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=22"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 22 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=23"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 23 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=24"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 24 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=25"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 25 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=26"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 26 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=27"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 27 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=28"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 28 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=29"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 29 Finished", ConsoleColor.Blue); });
+            Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=30"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 30 Finished", ConsoleColor.Blue); });
+            ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - Send Finished", ConsoleColor.Blue);
             //Logger.Scheduler.Info("杩欐槸涓�娆℃垚鍔熺殑娴嬭瘯");
             //var data = iBiz.Biz.Db.Queryable<BAS_CODE_RULE>()
             //    .IncludesAllFirstLayer()
@@ -310,17 +341,18 @@
         [HttpGet]
         public async Task<IActionResult> DoSomething(int duration, string code)
         {
-            Barcode b = new("asdasd");
             var begin = DateTime.Now;
-            while ((DateTime.Now - begin).TotalSeconds <= duration)
-            {
-                Thread.Sleep(1000);
-                var total = (DateTime.Now - begin).TotalSeconds;
-                var percent = total / duration;
-                ConsoleExt.WriteLine($"Working {begin:mmssfff} ... {(percent > 1 ? 1 : percent):P0} ...", ConsoleColor.Green);
-            }
-            Logger.Default.Info($"{begin:mmssfff} completed");
-            return Ok($"{begin:mmssfff} completed {b.DateCode}");
+            Work.Do(() => {
+                while ((DateTime.Now - begin).TotalSeconds <= duration)
+                {
+                    //Thread.Sleep(1000);
+                    var total = (DateTime.Now - begin).TotalSeconds;
+                    var percent = total / duration;
+                    //ConsoleExt.WriteLine($"Working {begin:mmssfff} ... {(percent > 1 ? 1 : percent):P0} ...", ConsoleColor.Green);
+                }
+                Logger.Default.Info($"{begin:mmssfff} completed");
+            });
+            return Ok($"{code.IsNullOrEmpty("", code + ": ")}{begin:mmssfff} completed");
         }
 
         [HttpPost]
diff --git a/Tiger.Api/Language.db b/Tiger.Api/Language.db
index 704ae6b..da6c80a 100644
--- a/Tiger.Api/Language.db
+++ b/Tiger.Api/Language.db
Binary files differ
diff --git a/Tiger.Api/Program.cs b/Tiger.Api/Program.cs
index 4599314..21de323 100644
--- a/Tiger.Api/Program.cs
+++ b/Tiger.Api/Program.cs
@@ -47,11 +47,13 @@
 	ConsoleExt.Write($"Link Start{(IsRunAsAdmin ? $" As Admin" : "")}", ConsoleColor.Cyan);
 	ConsoleExt.WriteLine($"  < <-<--<---<----< ==== < ===== < ====== ", ConsoleColor.DarkCyan);
 	Logger.Console.Info($"Begin to load {prod}");
-	
-	var options = new WebApplicationOptions
+
+    System.Net.ServicePointManager.DefaultConnectionLimit = 1024;
+
+    var options = new WebApplicationOptions
 	{
 	    Args = args,
-	    ContentRootPath = pathToContentRoot
+	    ContentRootPath = pathToContentRoot,
 	};
 
     var builder = WebApplication.CreateBuilder(options);
@@ -68,6 +70,7 @@
 	    });
 	    //builder.RegisterType<TestService>().As<ITest>();
 	});
+    
     Logger.Console.Info($"AutoFac container inject successful");
     var startup = new Startup(builder.Configuration);
 	startup.ConfigureServices(builder.Services);
@@ -84,7 +87,6 @@
         opt.Limits.MaxConcurrentUpgradedConnections = null;
         opt.Limits.MinRequestBodyDataRate = null;
     });
-    System.Net.ServicePointManager.DefaultConnectionLimit = 1024;
 
     if (isService)
 	{
diff --git a/Tiger.Business.MES/Common/WorkBatch.cs b/Tiger.Business.MES/Common/WorkBatch.cs
index 7d5fdaa..1fa994a 100644
--- a/Tiger.Business.MES/Common/WorkBatch.cs
+++ b/Tiger.Business.MES/Common/WorkBatch.cs
@@ -10,7 +10,6 @@
 using Tiger.IBusiness;
 using Tiger.Model.Entitys.MES.Position;
 using Tiger.Business.MES;
-using static Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser;
 using Org.BouncyCastle.Ocsp;
 using System.IO;
 
diff --git a/Tiger.Business.MES/WorkAction/YadaAssembly.cs b/Tiger.Business.MES/WorkAction/YadaAssembly.cs
index 3be3ab7..40b91d8 100644
--- a/Tiger.Business.MES/WorkAction/YadaAssembly.cs
+++ b/Tiger.Business.MES/WorkAction/YadaAssembly.cs
@@ -205,16 +205,16 @@
                         }
                     }
                     //濡傛灉褰撳墠鐗╂枡瀛樺湪澶囨枡琛ㄤ腑瀛樺湪鎺ㄨ崘鎵规锛屽垯涓婃枡鐗╂枡蹇呴』灞炰簬鍏舵帹鑽愭壒娆$殑鐗╂枡
-                    var suggest = MoPickList.Where(q => q.Code == item.ItemInfo.ITEM_CODE && !q.SuggestedBatch.IsNullOrEmpty()).Select(q => q.SuggestedBatch).ToList();
-                    if (isOK && suggest.Any())
-                    {
-                        isOK = false;
-                        //鍦ㄦ帹鑽愭壒娆℃墍灞炲伐鍗曠殑鏉$爜涓瓨鍦�
-                        if (MainDB.Queryable<BIZ_MES_WO_SN>().Any(q => suggest.Contains(q.WORK_ORDER) && (q.SN == input.SN || q.FLOW_SN == input.SN || q.TRAY_SN == input.SN)))
-                        {
-                            isOK = true;
-                        }
-                    }
+                    //var suggest = MoPickList.Where(q => q.Code == item.ItemInfo.ITEM_CODE && !q.SuggestedBatch.IsNullOrEmpty()).Select(q => q.SuggestedBatch).ToList();
+                    //if (isOK && suggest.Any())
+                    //{
+                    //    isOK = false;
+                    //    //鍦ㄦ帹鑽愭壒娆℃墍灞炲伐鍗曠殑鏉$爜涓瓨鍦�
+                    //    if (MainDB.Queryable<BIZ_MES_WO_SN>().Any(q => suggest.Contains(q.WORK_ORDER) && (q.SN == input.SN || q.FLOW_SN == input.SN || q.TRAY_SN == input.SN)))
+                    //    {
+                    //        isOK = true;
+                    //    }
+                    //}
                     //楠岃瘉閫氳繃鍒欎繚瀛樹笂鏂欎俊鎭�
                     if (isOK)
                     {
diff --git a/Tiger.Model.Net/Entitys/Barcode.cs b/Tiger.Business.WMS/Common/Barcode.Analysis.cs
similarity index 72%
copy from Tiger.Model.Net/Entitys/Barcode.cs
copy to Tiger.Business.WMS/Common/Barcode.Analysis.cs
index 6eb030d..f90cdbe 100644
--- a/Tiger.Model.Net/Entitys/Barcode.cs
+++ b/Tiger.Business.WMS/Common/Barcode.Analysis.cs
@@ -6,220 +6,13 @@
 using System.Text;
 using System.Text.RegularExpressions;
 
-namespace Tiger.Model
+namespace Tiger.Business.WMS
 {
     /// <summary>
-    /// 鏉$爜鍩虹被
+    /// 鏉$爜鍒嗘瀽鍩虹被
     /// </summary>
-    public class Barcode
+    public class BarcodeAnalysis
     {
-        public Barcode(string metaSn)
-        {
-            Analyse(MetaSn = metaSn);
-        }
-
-        /// <summary>
-        /// 鏉$爜锛堣В鏋愬悗鐨勬潯鐮侊級
-        /// </summary>
-        public string SN { get; set; }
-        /// <summary>
-        /// 鍏冩潯鐮侊紙鎵弿鍒扮殑鏉$爜锛�
-        /// </summary>
-        public string MetaSn { get; set; }
-        /// <summary>
-        /// 鏉$爜绫诲瀷
-        /// </summary>
-        public Types Type { get; set; }
-        /// <summary>
-        /// 鐗╂枡缂栫爜
-        /// </summary>
-        public string ItemCode { get; set; }
-        /// <summary>
-        /// 鐗╂枡鍚嶇О
-        /// </summary>
-        public string ItemName { get; set; }
-        /// <summary>
-        /// 鐗╂枡缂栫爜
-        /// </summary>
-        public ItemTypes ItemType { get; set; }
-        /// <summary>
-        /// 鐢熶骇鏃ユ湡缂栫爜
-        /// </summary>
-        public string DateCode { get; set; }
-        /// <summary>
-        /// 鐢熶骇鏃ユ湡
-        /// </summary>
-        public string ProdDateStr { get; set; }
-        /// <summary>
-        /// 鐢熶骇鏃ユ湡
-        /// </summary>
-        public DateTime? ProdDate { get => GetDateTime(ProdDateStr) ?? GetDateTime(PrintDateStr); }
-        /// <summary>
-        /// 鎵撳嵃鏃ユ湡
-        /// </summary>
-        public string PrintDateStr { get; set; }
-        /// <summary>
-        /// 渚涘簲鍟嗕唬鐮�
-        /// </summary>
-        public string SupplierCode { get; set; }
-        /// <summary>
-        /// 鎵规鍙�
-        /// </summary>
-        public string LotNo { get; set; }
-        /// <summary>
-        /// 璁㈠崟鍙�
-        /// </summary>
-        public string OrderNo { get; set; }
-        /// <summary>
-        /// 鍒堕�犲晢/浠e伐鍘傛枡鍙�
-        /// </summary>
-        public string OEMItemCode { get; set; }
-        /// <summary>
-        /// 娴佹按鐮�
-        /// </summary>
-        public string SerialNoStr { get; set; }
-        /// <summary>
-        /// 娴佹按鐮�
-        /// </summary>
-        public int? SerialNo { get => GetSerialNo(SerialNoStr); }
-
-        /// <summary>
-        /// 鍗曚綅
-        /// </summary>
-        public string Unit { get; set; }
-
-        /// <summary>
-        /// 鏁伴噺
-        /// </summary>
-        public string QtyStr { get; set; }
-        /// <summary>
-        /// 鏁伴噺
-        /// </summary>
-        public decimal? Qty { get => Convert.ToDecimal(GetDouble(QtyStr)); }
-
-        /// <summary>
-        /// 姣涢噸
-        /// </summary>
-        public string GrossWeightStr { get; set; }
-        /// <summary>
-        /// 姣涢噸
-        /// </summary>
-        public double? GrossWeight { get => GetDouble(QtyStr); }
-
-        /// <summary>
-        /// 鏂欏彿闀垮害
-        /// </summary>
-        public int ItemLength { get; set; }
-
-        /// <summary>
-        /// 鏂欏彿闀垮害
-        /// </summary>
-        public Exception AnalyseException { get; set; }
-
-        /// <summary>
-        /// 鏉$爜鏄惁鍚堟硶
-        /// </summary>
-        public bool IsRegular { get => Type != Types.Illegal; }
-
-        /// <summary>
-        /// 鏉$爜鏄惁鍘熸潗鏂欐潯鐮�
-        /// </summary>
-        public bool IsMaterialSN { get => !(new List<ItemTypes>() { ItemTypes.RawMaterial }).Contains(ItemType); }
-
-        /// <summary>
-        /// 鏍囩閲嶆墦娴佹按鐮佸瓧绗�
-        /// </summary>
-        public string ReprintNoStr { get; set; }
-        /// <summary>
-        /// 鏍囩閲嶆墦娴佹按鐮�
-        /// </summary>
-        public int? ReprintNo => GetReprintNo(ReprintNoStr);
-        /// <summary>
-        /// 鏍囩閲嶆墦涓�绾т笟鍔$紪鐮�
-        /// </summary>
-        public string ReprintBizCode1 { get; set; }
-        /// <summary>
-        /// 鏍囩閲嶆墦浜岀骇涓氬姟缂栫爜
-        /// </summary>
-        public string ReprintBizCode2 { get; set; }
-        /// <summary>
-        /// 鏄惁閲嶆墦鏍囩
-        /// </summary>
-        public bool IsReprintSn => SN.Contains("_");
-
-        /// <summary>
-        /// 鏄惁鎴枡閲嶆墦鏍囩
-        /// </summary>
-        public bool IsCutSn => ReprintBizCode1 == "C";
-
-        /// <summary>
-        /// 鏄惁閫�鏂欓噸鎵撴爣绛�
-        /// </summary>
-        public bool IsReturnSn => ReprintBizCode1 == "T";
-        /// <summary>
-        /// 鏄惁浜岀淮鐮�
-        /// </summary>
-        public bool IsQRCode => MetaSn.Contains(",");
-
-        public enum Types
-        {
-            /// <summary>
-            /// 闈炴硶鏉$爜
-            /// </summary>
-            [Description("闈炴硶鏉$爜")]
-            Illegal,
-            /// <summary>
-            /// 灏忓寘鏍囩
-            /// </summary>
-            [Description("灏忓寘鏍囩")]
-            Small,
-            /// <summary>
-            /// 涓寘鏍囩
-            /// </summary>
-            [Description("涓寘鏍囩")]
-            Middle,
-            /// <summary>
-            /// 澶栧寘鏍囩
-            /// </summary>
-            [Description("澶栧寘鏍囩")]
-            Outer,
-            /// <summary>
-            /// 鏍堟澘鏉$爜
-            /// </summary>
-            [Description("鏍堟澘鏉$爜")]
-            Pallet,
-            /// <summary>
-            /// 鎴愬搧鏍囩鏉$爜
-            /// </summary>
-            [Description("鎴愬搧鏍囩")]
-            Product,
-            /// <summary>
-            /// 鍏朵粬鏍囩鏉$爜
-            /// </summary>
-            [Description("鍏朵粬鏍囩")]
-            Other,
-        }
-
-        public enum ItemTypes
-        {
-            [Description("鏈煡绫诲瀷")]
-            Unknown,
-            [Description("婀挎晱鍏冧欢")]
-            HumidityMaterial,
-            [Description("SMT鍗婃垚鍝�")]
-            SmtSemiProduct,
-            [Description("DIP鍗婃垚鍝�")]
-            DipSemiProduct,
-            [Description("鎴愬搧")]
-            Product,
-            [Description("PCB")]
-            PCB,
-            [Description("杈呮枡")]
-            SubsidiaryMaterial,
-            [Description("鍘熸潗鏂�")]
-            RawMaterial,
-        }
-
         /// <summary>
         /// 鏉$爜鍒嗘瀽
         /// </summary>
diff --git a/Tiger.Model.Net/Entitys/Barcode.cs b/Tiger.Business.WMS/Common/Barcode.cs
similarity index 99%
rename from Tiger.Model.Net/Entitys/Barcode.cs
rename to Tiger.Business.WMS/Common/Barcode.cs
index 6eb030d..3fabc5b 100644
--- a/Tiger.Model.Net/Entitys/Barcode.cs
+++ b/Tiger.Business.WMS/Common/Barcode.cs
@@ -6,7 +6,7 @@
 using System.Text;
 using System.Text.RegularExpressions;
 
-namespace Tiger.Model
+namespace Tiger.Business.WMS
 {
     /// <summary>
     /// 鏉$爜鍩虹被
diff --git a/Tiger.Business.WMS/Common/Inventory.cs b/Tiger.Business.WMS/Common/Inventory.cs
new file mode 100644
index 0000000..2045de7
--- /dev/null
+++ b/Tiger.Business.WMS/Common/Inventory.cs
@@ -0,0 +1,38 @@
+锘縰sing Rhea.Common;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tiger.IBusiness;
+using Tiger.Model;
+
+namespace Tiger.Business.WMS
+{
+    /// <summary>
+    /// 鏉$爜搴撳瓨淇℃伅锛屽寘鎷粨搴擄紝鍌ㄥ尯锛岃揣鏋讹紝鍌ㄤ綅锛岀埗鏉$爜锛屽寘瑁呮槑缁嗙瓑
+    /// </summary>
+    public class Inventory : IInventory
+    {
+        public string SN { get; set; }
+        public Barcode Barcode { get; set; }
+        public bool IsQRCode => Barcode.IsQRCode;
+        public WMS_ITEM_EXT ExtInfo { get; set; }
+        public BAS_ITEM ItemInfo { get; set; }
+        public WMS_WAREHOUSE Warehouse { get; set; }
+        public WMS_REGION Region { get; set; }
+        public WMS_SHELF Shelf { get; set; }
+        public WMS_LOCATION Location { get; set; }
+        public WMS_ITEM_PKG ParentPkg { get; set; }
+        public List<WMS_ITEM_PKG> Packages { get; set; } = new List<WMS_ITEM_PKG>();
+        public List<WMS_ITEM> Items { get; set; } = new List<WMS_ITEM>();
+        public List<WMS_ITEM_EXT> ItemsExt { get; set; } = new List<WMS_ITEM_EXT>();
+        public List<WMS_ITEM_HIS> History { get; set; } = new List<WMS_ITEM_HIS>();
+        public List<WMS_ITEM.STATUSs> StatusList => Items.GroupBy(q => q.STATUS).Select(q => new { Status = q.Key.GetEnum<WMS_ITEM.STATUSs>(), Count = q.Count() }).OrderByDescending(q => q.Count).Select(q => q.Status).ToList();
+        public bool isNormalStatus => Items.Select(q => q.STATUS).Distinct().Count() == 1;
+        public WMS_ITEM.STATUSs Status => StatusList?.FirstOrDefault() ?? WMS_ITEM.STATUSs.NotExists;
+        public WMS_ITEM_PKG CurPkg => Packages.FirstOrDefault(q => q.SN == SN);
+        public bool isExists => CurPkg != null;
+        public bool isMinPackage => Items.Count == 1 && Items.Single().SN == SN;
+    }
+}
diff --git a/Tiger.Business.WMS/Minsun/CustSupplyChecking.cs b/Tiger.Business.WMS/Minsun/CustSupplyChecking.cs
index 358122d..d1f3b14 100644
--- a/Tiger.Business.WMS/Minsun/CustSupplyChecking.cs
+++ b/Tiger.Business.WMS/Minsun/CustSupplyChecking.cs
@@ -35,7 +35,7 @@
 
         #region Propertys & Variables
         public string UserCode { get; set; }
-        public static long UserId { get; set; }
+        public long UserId { get; set; }
         public string VenderCode { get; set; }
         public string LotNo { get; set; }
         public string SecondVenderCode { get; set; }
diff --git a/Tiger.Business.WMS/Minsun/InStorage.cs b/Tiger.Business.WMS/Minsun/InStorage.cs
index 5feec00..642983e 100644
--- a/Tiger.Business.WMS/Minsun/InStorage.cs
+++ b/Tiger.Business.WMS/Minsun/InStorage.cs
@@ -255,7 +255,7 @@
         /// </summary>
         /// <param name="input"></param>
         /// <returns></returns>
-        public async Task<CustSupplyInOutput> CustSupplyInIncompleteList(CustSupplyIncompleteInput input)
+        public static async Task<CustSupplyInOutput> CustSupplyInIncompleteList(CustSupplyIncompleteInput input)
         {
             var otherInScanList = await Biz.Db.Queryable<WMS_OTHERINSTOCK_SCAN>()
                         .Where(t => t.BUSINESSCODE.ToUpper() == input.receiptNo.ToUpper()
diff --git a/Tiger.Business.WMS/Minsun/iWMS.cs b/Tiger.Business.WMS/Minsun/iWMS.Minsun.cs
similarity index 100%
rename from Tiger.Business.WMS/Minsun/iWMS.cs
rename to Tiger.Business.WMS/Minsun/iWMS.Minsun.cs
diff --git a/Tiger.Business.WMS/Tiger.Business.WMS.csproj b/Tiger.Business.WMS/Tiger.Business.WMS.csproj
index 1316144..509e46a 100644
--- a/Tiger.Business.WMS/Tiger.Business.WMS.csproj
+++ b/Tiger.Business.WMS/Tiger.Business.WMS.csproj
@@ -10,11 +10,21 @@
   </PropertyGroup>
 
   <ItemGroup>
+    <Compile Remove="Minsun\**" />
+    <EmbeddedResource Remove="Minsun\**" />
+    <None Remove="Minsun\**" />
+  </ItemGroup>
+
+  <ItemGroup>
     <ProjectReference Include="..\Tiger.Business\Tiger.Business.csproj" />
     <ProjectReference Include="..\Tiger.IBusiness.WMS\Tiger.IBusiness.WMS.csproj" />
     <ProjectReference Include="..\Tiger.IBusiness\Tiger.IBusiness.csproj" />
   </ItemGroup>
 
+  <ItemGroup>
+    <Folder Include="Transaction\Yada\" />
+  </ItemGroup>
+
   <Target Name="PostBuild" AfterTargets="PostBuildEvent">
     <Exec Command="xcopy /r/y/i $(ProjectDir)$(OutDir)$(AssemblyName).dll $(SolutionDir)Tiger.Api\$(OutDir)&#xD;&#xA;xcopy /r/y/i $(ProjectDir)$(OutDir)$(AssemblyName).pdb $(SolutionDir)Tiger.Api\$(OutDir)" />
   </Target>
diff --git a/Tiger.Business.WMS/Transaction/In_Default.cs b/Tiger.Business.WMS/Transaction/In_Default.cs
new file mode 100644
index 0000000..2fc3bcb
--- /dev/null
+++ b/Tiger.Business.WMS/Transaction/In_Default.cs
@@ -0,0 +1,382 @@
+锘縰sing Rhea.Common;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Tiger.Model;
+using Tiger.IBusiness;
+using Tiger.Model.Sharetronic.Shelf;
+using Tiger.Business.WMS.Sharetronic.Shelf;
+using Microsoft.IdentityModel.Tokens;
+
+namespace Tiger.Business.WMS.Transaction
+{
+    /// <summary>
+    /// 鏍囧噯涓婃灦浜嬪姟
+    /// </summary>
+    public class In_Default : WMSTransactionBase, IIn_Default
+    {
+        public IIn_Default Init(string id, string userCode, string apiHost, string orgCode)
+        {
+            TransID = id;
+            UserCode = userCode;
+            ApiHost = apiHost;
+            OrgCode = orgCode;
+            Logger.Console.Info($"Start {this.GetType().Name} Transaction[ID: {TransID}]");
+            return this;
+        }
+
+        #region Propertys & Variables
+        public string UserCode { get; set; }
+        public long UserId { get; set; }
+        public string OrgCode { get; set; }
+        public Inventory CurInvItem { get; set; }
+        public ScanShelfInfo CurScanShelf { get; set; }
+        #endregion
+
+        #region Functions
+        /// <summary>
+        /// 鎵弿鐗╂枡骞跺鏍革紝濡傛灉鐗╂枡宸茬粡瀹屾垚绉诲簱鍒欒揣鏋朵笂浜伅鎻愰啋鍌ㄤ綅
+        /// </summary>
+        public async Task<ApiAction> ScanItem(BaseInput input)
+        {
+            var action = new ApiAction();
+            try
+            {
+                if (input.SN.IsNullOrEmpty())
+                {
+                    action.IsSuccessed = false;
+                    //action.LocaleMsg = Biz.L("鏉$爜涓嶈兘涓虹┖");
+                    action.LocaleMsg = Biz.L("WMS.Default.ScanItem.SnEmptyFailure");
+                    return action;
+                }
+                //璐ф灦涓虹┖鍒欐壂鎻忕殑璁や负鏄揣鏋�
+                if (string.IsNullOrEmpty(CurScanShelf?.RackCode))
+                {
+                    var _action = await ScanShelf(input.SN);
+                    action.LocaleMsg = _action.LocaleMsg;
+                    action.IsSuccessed = _action.IsSuccessed;
+                    action.Data = _action.Data;
+                    return action;
+                }
+
+                Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
+                if (!result.IsSuccessed)
+                {
+                    action.IsSuccessed = false;
+                    action.LocaleMsg = result.LocaleMsg;
+                    return action;
+                }
+                var inv = result.Data as Inventory;
+
+                //楠岃瘉鏉$爜鏄惁姝g‘
+                if (!inv.isNormalStatus || inv.Status.GetValue() != WMS_ITEM.STATUSs.NotExists.GetValue() && inv.Status.GetValue() <= WMS_ITEM.STATUSs.InStore.GetValue())
+                {
+                    action.IsSuccessed = false;
+                    //action.LocaleMsg = Biz.L("鐘舵�乕{0}]寮傚父锛岃閲嶆柊鎵弿");
+                    action.LocaleMsg = Biz.L("WMS.Default.ScanItem.StatusException", string.Join(',', inv.StatusList.Select(q => q.GetDesc())));
+                    return action;
+                }
+                //鐗╂枡楠岃瘉
+                if (inv.ItemInfo.IsNullOrEmpty() || inv.ItemInfo.IS_ACTIVE == "N")
+                {
+                    action.IsSuccessed = false;
+                    //action.LocaleMsg = Biz.L("鐗╂枡缂栫爜[{0}]涓嶅瓨鍦ㄦ垨鑰呰鐗╂枡鏈惎鐢�");
+                    action.LocaleMsg = Biz.L("WMS.Default.ScanItem.ItemCodeNotExistsOrNotActive", inv.ItemInfo.ITEM_CODE.IsNullOrEmpty(inv.Barcode.ItemCode));
+                    return action;
+                }
+
+                if (!inv.IsNullOrEmpty())
+                {
+                    if (inv.Items.Count == 0)
+                    {
+                        List<WMS_ITEM_HIS> ItemHistorys = new List<WMS_ITEM_HIS>();
+                        WMS_ITEM Item;
+                        WMS_ITEM_PKG ItemPkgs;
+
+                        Item = new()
+                        {
+                            SN = inv.Barcode.SN,
+                            ITEM_CODE = inv.Barcode.ItemCode,
+                            AUTH_ORG = input.AuthOption.CurOrg,
+                            STATUS = WMS_ITEM.STATUSs.WaitIn.GetValue(),
+                            QTY = inv.Barcode.Qty.ToDecimal(),
+                            PROD_DATE = inv.Barcode.DateCode.ToDateTime(),
+                            ERP_WH = CurScanShelf.WarehouseCode,
+                            UNIT = inv.Barcode.Unit,
+                        };
+
+                        WMS_ITEM_HIS his = new(Item, $"鏍囧噯涓婃灦鍏ュ簱");
+                        ItemHistorys.Add(his);
+                        ItemPkgs = new()
+                        {
+                            SN = inv.Barcode.SN,
+                            AUTH_ORG = input.AuthOption.CurOrg,
+                            ITEM_CODE = inv.Barcode.ItemCode,
+                            QTY = inv.Barcode.Qty.ToDecimal(),
+                            ERP_WH = CurScanShelf.WarehouseCode,
+                            UNIT = inv.Barcode.Unit,
+                        };
+
+                        var noExt = inv.Items.Where(q => !inv.ItemsExt.Any(s => s.SN == q.SN)).ToList();
+                        //鎵╁睍琛ㄤ笉瀛樺湪鏃舵柊寤�
+                        foreach (var item in noExt)
+                        {
+                            inv.ItemsExt.Add(new()
+                            {
+                                SN = item.SN,
+                                META_SN = inv.Barcode.MetaSn,
+                                QR_CODE = inv.Barcode.MetaSn
+                            });
+                        }
+
+                        inv.Items.Add(Item);
+                        inv.History.Add(his);
+                        inv.Packages.Add(ItemPkgs);
+                    }
+                    else if (inv.Items.Count == 1)
+                    {
+                        inv.Items.First().QTY = inv.Barcode.Qty.ToDecimal();
+                        inv.Items.First().ERP_WH = CurScanShelf.WarehouseCode;
+                        inv.Items.First().AUTH_ORG = input.AuthOption.CurOrg;
+
+                        inv.Packages.First().QTY = inv.Barcode.Qty.ToDecimal();
+                        inv.Packages.First().ERP_WH = CurScanShelf.WarehouseCode;
+                        inv.Packages.First().AUTH_ORG = input.AuthOption.CurOrg;
+                    }
+                    //濡傛灉鎵弿澶栫鐨勪笉鑳芥洿鏂版暟閲�
+                    else
+                    {
+                        foreach (var item in inv.Items)
+                        {
+                            item.ERP_WH = CurScanShelf.WarehouseCode;
+                            item.AUTH_ORG = input.AuthOption.CurOrg;
+                        }
+                        foreach (var item in inv.Packages)
+                        {
+                            item.ERP_WH = CurScanShelf.WarehouseCode;
+                            item.AUTH_ORG = input.AuthOption.CurOrg;
+                        }
+                    }
+                }
+
+                var nLocation = new WMS_LOCATION();
+                // 鍒ゆ柇鏄惁鏅鸿兘璐ф灦
+                if (CurScanShelf.Shelf.IsLightShelf)
+                {
+                    ShelfApiResult shelfApiResult = await Share.Shelf.PutOn(TransID, CurScanShelf.Shelf, inv.Items[0]);
+                    if (!shelfApiResult.IsSuccess)
+                    {
+                        action.IsSuccessed = false;
+                        action.LocaleMsg = Biz.L(shelfApiResult.GetData<string>());
+                        return action;
+                    }
+                    var reaultShelf = shelfApiResult.GetData<ShelfChangeModel>();
+
+                    nLocation = reaultShelf.GetLocation();
+                    if (nLocation == null)
+                    {
+                        action.IsSuccessed = false;
+                        //action.LocaleMsg = Biz.L($"璐ф灦[{0}]涓笉瀛樺湪id涓篬{1}]鐨勫偍浣嶏紝璇峰厛缁存姢璐ф灦淇℃伅");
+                        action.LocaleMsg = Biz.L("WMS.Default.ScanItem.LocationNotExistsInShelf", CurScanShelf.Shelf.SHELF_CODE, reaultShelf.ledAddr);
+                        return action;
+                    }
+                    var locationData = Biz.Db.Queryable<WMS_ITEM>().Where(q => q.LOCATION_ID == nLocation.ID).First();
+                    if (!locationData.IsNullOrEmpty())
+                    {
+                        action.IsSuccessed = false;
+                        //action.LocaleMsg = Biz.L("鍌ㄤ綅[{0}]宸插瓨鏈夌墿鏂橻{1}]锛岃妫�鏌ョ郴缁熷簱瀛樹俊鎭�");
+                        action.LocaleMsg = Biz.L($"WMS.Default.ScanShelf.ItemAlreadyExistsInLocation", nLocation.LOCATION_CODE, locationData.SN);
+                        return action;
+                    }
+                    CurScanShelf.LocationCode = nLocation.LOCATION_CODE;
+                }
+                else
+                {
+                    if (CurScanShelf.LocationCode.IsNullOrEmpty() || CurScanShelf.WarehouseCode.IsNullOrEmpty())
+                    {
+                        action.IsSuccessed = false;
+                        //action.LocaleMsg = Biz.L("璇疯緭鍏ユ垨鎵弿鏈夋晥鐨勮揣鏋�/鍌ㄤ綅鐮�");
+                        action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.ShelfCanNotEmpty");
+                        return action;
+                    }
+
+                    nLocation = await Biz.Db.Queryable<WMS_LOCATION>().Where(t => t.LOCATION_CODE == CurScanShelf.LocationCode && t.AUTH_ORG == OrgCode).FirstAsync();
+                }
+
+                //鍒ゆ柇鍌ㄤ綅鏄惁鍗曟斁
+                if (nLocation.IS_SINGLE == "Y" && inv.Items.Count > 1)
+                {
+                    action.IsSuccessed = false;
+                    //action.LocaleMsg = Biz.L("鍌ㄤ綅[{0}]鍙兘瀛樻斁涓�涓墿鏂�");
+                    action.LocaleMsg = Biz.L("WMS.Default.ScanItem.LocationSingleFailure", nLocation.LOCATION_CODE);
+                    return action;
+                }
+
+                //鎵ц涓婃灦
+                foreach (var item in inv.Items)
+                {
+                    item.TRANS_CODE = "In_Default";
+                    item.TRANS_NO = $"In_Default_{DateTime.Now:yyyyMMdd}";
+                }
+                Result<PutOnInfo> putonResult = WMS_ITEM_Biz.WmsItem.PutOn(inv, input.AuthOption, nLocation.LOCATION_CODE);
+                if (!putonResult.IsSuccessed)
+                {
+                    action.IsSuccessed = false;
+                    action.LocaleMsg = putonResult.LocaleMsg;
+                    return action;
+                }
+                PutOnInfo putOnInfo = putonResult.Data;
+
+                //淇濆瓨鍒版暟鎹簱
+                var db = Business.Biz.Db;
+                var dbTran = db.UseTran(() =>
+                {
+                    //鍏ュ簱
+                    db.Storageable(putOnInfo.Items, UserCode).ExecuteCommand();
+                    db.Storageable(putOnInfo.Packages, UserCode).ExecuteCommand();
+                    db.Insertable(putOnInfo.History, UserCode).ExecuteCommand();
+                    var x = db.Storageable(putOnInfo.ItemsExt, UserCode).ToStorage();
+                    x.AsInsertable.ExecuteCommand();//涓嶅瓨鍦ㄦ彃鍏�
+                    x.AsUpdateable.ExecuteCommand();//瀛樺湪鏇存柊
+                });
+                if (!dbTran.IsSuccess)
+                {
+                    Logger.Default.Fatal(dbTran.ErrorException, "Database transaction save exception");
+                    throw dbTran.ErrorException;
+                }
+                // 杩斿洖鍏朵粬鍏ュ簱瀵硅薄
+                action.Data = new DefaultInStoreOutput
+                {
+                    Barcode = inv.SN,
+                    MaterialCode = inv.ItemInfo.ITEM_CODE,
+                    MaterialName = inv.ItemInfo.ITEM_NAME,
+                    CurrentQty = inv.Items[0].QTY,
+                    Unit = inv.Items[0].UNIT,
+                    DateCode = inv.Items[0].PROD_DATE,
+                    WarehouseCode = putOnInfo.Warehouse.WH_CODE,
+                    RegionCode = putOnInfo.Region.REGION_CODE,
+                    ShelfCode = putOnInfo.Shelf.SHELF_CODE,
+                    LocationCode = putOnInfo.Location.LOCATION_CODE,
+                };
+                //action.LocaleMsg = Biz.L($"鎵弿鏉$爜[{0}]涓婃灦鍒板偍浣峓{1}]鎴愬姛");
+                action.LocaleMsg = Biz.L("WMS.Default.ScanItem.PutOnSucceeded", inv.SN, putOnInfo.Location.LOCATION_CODE);
+            }
+            catch (Exception ex)
+            {
+                //鍙栨秷褰撳墠鎿嶄綔
+                ResetInfo();
+                //action.CatchExceptionWithLog(ex, $"鎵弿鏉$爜[{input.SN}]澶嶆牳寮傚父");
+                action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.ScanItem.ScanException", input.SN));
+            }
+            return action;
+        }
+
+        /// <summary>
+        /// 鎵弿璐ф灦鎴栬�呭偍浣�
+        /// </summary>
+        public async Task<ApiAction<ScanShelfInfo>> ScanShelf(string Code)
+        {
+            var action = new ApiAction<ScanShelfInfo>();
+            try
+            {
+                if (Code.IsNullOrEmpty())
+                {
+                    action.IsSuccessed = false;
+                    //action.LocaleMsg = Biz.L("璇疯緭鍏ユ垨鎵弿鏈夋晥鐨勮揣鏋�/鍌ㄤ綅鐮�");
+                    action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.ShelfCanNotEmpty");
+                    return action;
+                }
+
+                CurScanShelf = new ScanShelfInfo();
+
+                // 鏌ヨ璐ф灦淇℃伅
+                var whUnit = await Biz.Db.Queryable<V_WH_UNIT>().Where(t => t.SHELF_CODE.ToUpper() == Code.ToUpper() && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync();
+
+                // 鎵弿璐ф灦浠g爜锛屼笖涓烘櫤鑳借揣鏋�
+                if (whUnit != null && whUnit.SHELF_TYPE == WMS_SHELF.SHELF_TYPEs.Smart.GetValue())
+                {
+                    CurScanShelf.Shelf = whUnit.Shelf;
+                    CurScanShelf.WarehouseCode = whUnit.WH_CODE;
+                    CurScanShelf.RegionCode = whUnit.REGION_CODE;
+                    CurScanShelf.ShelfCode = whUnit.SHELF_CODE;
+                    CurScanShelf.LocationCode = whUnit.LOCATION_CODE;
+                    CurScanShelf.ShelfType = whUnit.SHELF_TYPE;
+                    CurScanShelf.IsSmartRack = true;
+                }
+                // 鎵弿搴撲綅浠g爜
+                else
+                {
+                    var nLocation = await Biz.Db.Queryable<V_WH_UNIT>().Where(t => t.LOCATION_CODE.ToUpper() == Code.ToUpper() && t.AUTH_ORG == OrgCode).FirstAsync();
+                    if (nLocation == null)
+                    {
+                        action.IsSuccessed = false;
+                        //action.LocaleMsg = Biz.L("鍌ㄤ綅[{0}]涓嶅瓨鍦�");
+                        action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.LocationNotExist", Code);
+                        return action;
+                    }
+                    if (nLocation.IS_ACTIVE == "N")
+                    {
+                        action.IsSuccessed = false;
+                        //action.LocaleMsg = Biz.L("鎵弿鐨勫偍浣峓{0}]鏈惎鐢�");
+                        action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.ShelfOrLocationDisabled", Code);
+                        return action;
+                    }
+                    if (nLocation.Shelf.IsLightShelf || nLocation.Location.IS_SINGLE == "Y")
+                    {
+                        var locationData = Biz.Db.Queryable<WMS_ITEM>().Where(q => q.LOCATION_ID == nLocation.LOCATION_ID && q.AUTH_ORG == OrgCode).First();
+                        if (!locationData.IsNullOrEmpty())
+                        {
+                            action.IsSuccessed = false;
+                            //action.LocaleMsg = Biz.L("鍌ㄤ綅[{0}]宸插瓨鏈夌墿鏂橻{1}]锛岃妫�鏌ョ郴缁熷簱瀛樹俊鎭�");
+                            action.LocaleMsg = Biz.L($"WMS.Default.ScanShelf.ItemAlreadyExistsInLocation", Code, locationData.SN);
+                            return action;
+                        }
+                    }
+                    CurScanShelf.Location = nLocation.Location;
+                    CurScanShelf.WarehouseCode = nLocation.WH_CODE;
+                    CurScanShelf.RegionCode = nLocation.REGION_CODE;
+                    CurScanShelf.ShelfCode = nLocation.SHELF_CODE;
+                    CurScanShelf.LocationCode = nLocation.LOCATION_CODE;
+                    CurScanShelf.IsSmartRack = false;
+                }
+
+                CurScanShelf.IsScanShelf = true;
+                //action.LocaleMsg = Biz.L("鎵弿璐ф灦/鍌ㄤ綅[{0}]鎴愬姛");
+                action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.ScanSucceeded", Code);
+                action.Data = CurScanShelf;
+            }
+            catch (Exception ex)
+            {
+                //鍙栨秷褰撳墠鎿嶄綔
+                ResetInfo();
+                //action.CatchExceptionWithLog(ex, $"鎵弿璐ф灦/鍌ㄤ綅[{0}]寮傚父");
+                action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.ScanShelf.ScanException", Code));
+            }
+            return action;
+        }
+
+        #endregion
+
+        /// <summary>
+        /// 閲嶇疆褰撳墠鎿嶄綔锛屾湁闇�瑕佸垯閲嶅啓姝ゆ柟娉�
+        /// </summary>
+        public override void ResetInfo()
+        {
+            base.ResetInfo();
+            CurInvItem = null;
+            CurScanShelf = null;
+        }
+
+        public override bool Close(bool needSaveHistoryLog = false)
+        {
+            this.IsFinished = true;
+            return IsFinished ? base.Close(needSaveHistoryLog) : IsFinished;
+        }
+
+    }//endClass
+}
diff --git a/Tiger.Business.WMS/Transaction/CustSupplyCheckingNew.cs b/Tiger.Business.WMS/Transaction/Old/CustSupplyCheckingNew.cs
similarity index 95%
rename from Tiger.Business.WMS/Transaction/CustSupplyCheckingNew.cs
rename to Tiger.Business.WMS/Transaction/Old/CustSupplyCheckingNew.cs
index 341b8df..0263a49 100644
--- a/Tiger.Business.WMS/Transaction/CustSupplyCheckingNew.cs
+++ b/Tiger.Business.WMS/Transaction/Old/CustSupplyCheckingNew.cs
@@ -38,7 +38,7 @@
         #region Propertys & Variables
 
         public string UserCode { get; set; }
-        public static long UserId { get; set; }
+        public long UserId { get; set; }
         public string VenderCode { get; set; }
         public string LotNo { get; set; }
         public string SecondVenderCode { get; set; }
@@ -135,53 +135,53 @@
                     return action;
                 }
                 input.AuthOption.OrgCode = input.AuthOption.OrgCode.IsNullOrEmpty() ? input.AuthOption.CurOrg : input.AuthOption.OrgCode;
-                Result<Inventory> result = WMS_ITEM_Biz.WmsItem.GetK(input.SN, input.AuthOption, false);
+                Result<IInventory> result = WMS_ITEM_Biz.WmsItem.GetK(input.SN, input.AuthOption, false);
                 if (result.Flag != Result.Flags.Success)
                 {
                     action.IsSuccessed = false;
                     action.LocaleMsg = result.LocaleMsg;
                     return action;
                 }
-                var curBarcode = result.Data;
-                if (!curBarcode.IsQRCode)
+                var curInv = result.Data as Inventory;
+                if (!curInv.IsQRCode)
                 {
                     action.IsSuccessed = false;
-                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.NotQrCode", curBarcode.Barcode.MetaSn);
+                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.NotQrCode", curInv.Barcode.MetaSn);
                     return action;
                 }
                 //鍒ゆ柇鏉$爜鏄惁涓烘渶灏戝寘瑁�
-                if (!new[] { Barcode.Types.Small, Barcode.Types.Other }.Contains(curBarcode.Barcode.Type))
+                if (!new[] { Barcode.Types.Small, Barcode.Types.Other }.Contains(curInv.Barcode.Type))
                 {
                     action.IsSuccessed = false;
-                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.TypeError", curBarcode.SN);
+                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.TypeError", curInv.SN);
                     return action;
                 }
-                if (curBarcode.Items.Any())
+                if (curInv.Items.Any())
                 {
                     action.IsSuccessed = false;
-                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.ExistItem", curBarcode.ItemInfo?.ITEM_CODE);
+                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.ExistItem", curInv.ItemInfo?.ITEM_CODE);
                     return action;
                 }
 
-                if (string.IsNullOrEmpty(curBarcode.ItemInfo?.ITEM_CODE))
+                if (string.IsNullOrEmpty(curInv.ItemInfo?.ITEM_CODE))
                 {
                     action.IsSuccessed = false;
-                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.NotFound", curBarcode.ItemInfo?.ITEM_CODE);
+                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.NotFound", curInv.ItemInfo?.ITEM_CODE);
                     return action;
                 }
 
                 // 鍏跺畠鍏ュ簱娓呯偣涓嶈兘鎵叆鎷嗗寘鍚庡甫-1鐨勬爣绛�
-                if (curBarcode.isNormalStatus && curBarcode.Status == WMS_ITEM.STATUSs.WaitIn)
+                if (curInv.isNormalStatus && curInv.Status == WMS_ITEM.STATUSs.WaitIn)
                 {
                     action.IsSuccessed = false;
-                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.NotAllowIn", curBarcode.ItemInfo?.ITEM_CODE);
+                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.NotAllowIn", curInv.ItemInfo?.ITEM_CODE);
                     return action;
                 }
                 //鐗╂枡楠岃瘉
-                if (curBarcode.ItemInfo.IsNullOrEmpty() || curBarcode.ItemInfo.IS_ACTIVE == "N")
+                if (curInv.ItemInfo.IsNullOrEmpty() || curInv.ItemInfo.IS_ACTIVE == "N")
                 {
                     action.IsSuccessed = false;
-                    action.LocaleMsg = Biz.L("WMS.ProdMReq.ScanItem.ItemCodeNotExistsOrNotActive", curBarcode.ItemInfo.ITEM_CODE.IsNullOrEmpty(curBarcode.Barcode.ItemCode));
+                    action.LocaleMsg = Biz.L("WMS.ProdMReq.ScanItem.ItemCodeNotExistsOrNotActive", curInv.ItemInfo.ITEM_CODE.IsNullOrEmpty(curInv.Barcode.ItemCode));
                     return action;
                 }
                 OrgCode = input.AuthOption.CurOrg;
@@ -203,10 +203,10 @@
                     ID = Guid.NewGuid().ToString(),
                     BUSINESSCODE = UserCode,
                     WAREHOUSECODE = WarehouseCode,
-                    SN = curBarcode.SN,
-                    ITEM_CODE = curBarcode.ItemInfo.ITEM_CODE,
-                    QTY = curBarcode.Barcode.Qty ?? 0,
-                    DATECODE = curBarcode.Barcode.ProdDate ?? DateTime.MinValue,
+                    SN = curInv.SN,
+                    ITEM_CODE = curInv.ItemInfo.ITEM_CODE,
+                    QTY = curInv.Barcode.Qty ?? 0,
+                    DATECODE = curInv.Barcode.ProdDate ?? DateTime.MinValue,
                     LOTNO = LotNo, //item.Barcode.LotNo,
                     STATUS = WMS_ITEM.STATUSs.Counted.GetValue(),
                     META_SN = input.SN,
@@ -225,17 +225,17 @@
                     STATUS = scanResult.STATUS,
                     WH_CODE = scanResult.WAREHOUSECODE,
                     WH_NAME = WarehouseName,
-                    MName = curBarcode.ItemInfo.ITEM_NAME,
-                    MDesc = curBarcode.ItemInfo.SPEC,
-                    MUom = curBarcode.ItemInfo.UNIT
+                    MName = curInv.ItemInfo.ITEM_NAME,
+                    MDesc = curInv.ItemInfo.SPEC,
+                    MUom = curInv.ItemInfo.UNIT
                 };
 
                 //楠岃瘉鏉$爜鏄惁宸插仛杩囨竻鐐�
-                var nLogs = Biz.Db.Queryable<BIZ_ERP_OTH_IN_SN>().Where(t => t.SN.ToUpper() == curBarcode.SN.ToUpper()).First();
+                var nLogs = Biz.Db.Queryable<BIZ_ERP_OTH_IN_SN>().Where(t => t.SN.ToUpper() == curInv.SN.ToUpper()).First();
                 if (nLogs != null)
                 {
                     action.IsSuccessed = false;
-                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.BarcodeCounted", curBarcode.SN);
+                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.BarcodeCounted", curInv.SN);
                     return action;
                 }
 
@@ -247,7 +247,7 @@
                     AUTH_ORG = input.AuthOption.CurOrg,
                     CREATE_USER = UserCode,
                     OrderNo = UserCode,
-                    Barcodes = curBarcode.SN,
+                    Barcodes = curInv.SN,
                     CustomsNo = CustomsNo.Replace("锛�", ",").Trim().Split(',')[0],
                     AccountingNo = CustomsNo.Replace("锛�", ",").Trim().Split(',')[1],
                     CountsType = BIZ_ERP_CUSTOMS.CountsEnum.Incoming
diff --git a/Tiger.Business.WMS/Transaction/CustomerSupplyInNew.cs b/Tiger.Business.WMS/Transaction/Old/CustomerSupplyInNew.cs
similarity index 99%
rename from Tiger.Business.WMS/Transaction/CustomerSupplyInNew.cs
rename to Tiger.Business.WMS/Transaction/Old/CustomerSupplyInNew.cs
index 049f577..541d0f3 100644
--- a/Tiger.Business.WMS/Transaction/CustomerSupplyInNew.cs
+++ b/Tiger.Business.WMS/Transaction/Old/CustomerSupplyInNew.cs
@@ -144,14 +144,14 @@
                 }
                 var nLocation = new WMS_LOCATION();
                 input.AuthOption.OrgCode.IsNullOrEmpty(input.AuthOption.CurOrg);
-                Result<Inventory> result = WMS_ITEM_Biz.WmsItem.GetK(input.SN, input.AuthOption, true);
+                Result<IInventory> result = WMS_ITEM_Biz.WmsItem.GetK(input.SN, input.AuthOption, true);
                 if (!result.IsSuccessed)
                 {
                     action.IsSuccessed = false;
                     action.LocaleMsg = result.LocaleMsg;
                     return action;
                 }
-                var inv = result.Data;
+                var inv = result.Data as Inventory;
 
                 //鍒ゆ柇鏄惁涓�缁寸爜
                 if (!inv.IsQRCode)
diff --git a/Tiger.Business.WMS/Transaction/InFinished.cs b/Tiger.Business.WMS/Transaction/Old/InFinished.cs
similarity index 99%
rename from Tiger.Business.WMS/Transaction/InFinished.cs
rename to Tiger.Business.WMS/Transaction/Old/InFinished.cs
index 55e2d44..c329fec 100644
--- a/Tiger.Business.WMS/Transaction/InFinished.cs
+++ b/Tiger.Business.WMS/Transaction/Old/InFinished.cs
@@ -137,14 +137,14 @@
                     return action;
                 }
                 var nLocation = new WMS_LOCATION();
-                Result<Inventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
+                Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
                 if (!result.IsSuccessed)
                 {
                     action.IsSuccessed = false;
                     action.LocaleMsg = result.LocaleMsg;
                     return action;
                 }
-                var inv = result.Data;
+                var inv = result.Data as Inventory;
 
                 //楠岃瘉鏉$爜鏄惁姝g‘
                 if (!inv.isNormalStatus || inv.Status != WMS_ITEM.STATUSs.WaitIn)
diff --git a/Tiger.Business.WMS/Transaction/InMatStorage.cs b/Tiger.Business.WMS/Transaction/Old/InMatStorage.cs
similarity index 99%
rename from Tiger.Business.WMS/Transaction/InMatStorage.cs
rename to Tiger.Business.WMS/Transaction/Old/InMatStorage.cs
index 5e42c67..149e216 100644
--- a/Tiger.Business.WMS/Transaction/InMatStorage.cs
+++ b/Tiger.Business.WMS/Transaction/Old/InMatStorage.cs
@@ -70,14 +70,14 @@
                     return action;
                 }
                 var nLocation = new WMS_LOCATION();
-                Result<Inventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
+                Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
                 if (!result.IsSuccessed)
                 {
                     action.IsSuccessed = false;
                     action.LocaleMsg = result.LocaleMsg;
                     return action;
                 }
-                var inv = result.Data;
+                var inv = result.Data as Inventory;
                 //鍒ゆ柇鏄惁涓�缁寸爜
                 if (!inv.IsQRCode)
                 {
diff --git a/Tiger.Business.WMS/Transaction/InProductionReturn.cs b/Tiger.Business.WMS/Transaction/Old/InProductionReturn.cs
similarity index 99%
rename from Tiger.Business.WMS/Transaction/InProductionReturn.cs
rename to Tiger.Business.WMS/Transaction/Old/InProductionReturn.cs
index ccce5e4..024841b 100644
--- a/Tiger.Business.WMS/Transaction/InProductionReturn.cs
+++ b/Tiger.Business.WMS/Transaction/Old/InProductionReturn.cs
@@ -84,7 +84,7 @@
                 }
                 var nLocation = new WMS_LOCATION();
 
-                Result<Inventory> result = new();
+                Result<IInventory> result = new();
                 if (WarehouseName.Contains("瀹緵"))
                 {
                     result = WMS_ITEM_Biz.WmsItem.GetK(input.SN, input.AuthOption, true);
@@ -99,8 +99,8 @@
                     action.LocaleMsg = result.LocaleMsg;
                     return action;
                 }
-                //
-                var inv = result.Data;
+
+                var inv = result.Data as Inventory;
                 if (!inv.IsQRCode)
                 {
                     action.IsSuccessed = false;
diff --git a/Tiger.Business.WMS/Transaction/InReceipt.cs b/Tiger.Business.WMS/Transaction/Old/InReceipt.cs
similarity index 99%
rename from Tiger.Business.WMS/Transaction/InReceipt.cs
rename to Tiger.Business.WMS/Transaction/Old/InReceipt.cs
index a4edbd1..c2d278b 100644
--- a/Tiger.Business.WMS/Transaction/InReceipt.cs
+++ b/Tiger.Business.WMS/Transaction/Old/InReceipt.cs
@@ -30,7 +30,7 @@
         #region Propertys & Variables
 
         public string UserCode { get; set; }
-        public static long UserId { get; set; }
+        public long UserId { get; set; }
         public string VenderCode { get; set; }
         public string SecondVenderCode { get; set; }
         public string WarehouseCode { get; set; }
@@ -92,14 +92,14 @@
                 #endregion 鎶ュ叧鍗曞彿鍒ゆ柇
 
                 //瑙f瀽鏉$爜
-                Result<Inventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, false);
+                Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, false);
                 if (result.Flag != Result.Flags.Success)
                 {
                     action.IsSuccessed = false;
                     action.LocaleMsg = result.LocaleMsg;
                     return action;
                 }
-                inv = result.Data;
+                inv = result.Data as Inventory;
 
                 #region 鍒ゆ柇褰撳墠鏉$爜瀵瑰簲鐨凷RM鐘舵��
 
diff --git a/Tiger.Business.WMS/Transaction/LocationTransfer.cs b/Tiger.Business.WMS/Transaction/Old/LocationTransfer.cs
similarity index 98%
rename from Tiger.Business.WMS/Transaction/LocationTransfer.cs
rename to Tiger.Business.WMS/Transaction/Old/LocationTransfer.cs
index f8b0322..f68328c 100644
--- a/Tiger.Business.WMS/Transaction/LocationTransfer.cs
+++ b/Tiger.Business.WMS/Transaction/Old/LocationTransfer.cs
@@ -100,14 +100,14 @@
                     return action;
                 }
 
-                Result<Inventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
+                Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
                 if (!result.IsSuccessed)
                 {
                     action.IsSuccessed = false;
                     action.LocaleMsg = result.LocaleMsg;
                     return action;
                 }
-                var inv = result.Data;
+                var inv = result.Data as Inventory;
 
                 //楠岃瘉鏉$爜鏄惁姝g‘
                 if (!inv.isNormalStatus || !new[] { WMS_ITEM.STATUSs.InStore }.Contains(inv.Status))
diff --git a/Tiger.Business.WMS/Transaction/OtherInLocation.cs b/Tiger.Business.WMS/Transaction/Old/OtherInLocation.cs
similarity index 85%
rename from Tiger.Business.WMS/Transaction/OtherInLocation.cs
rename to Tiger.Business.WMS/Transaction/Old/OtherInLocation.cs
index 64b15c3..55ec6e4 100644
--- a/Tiger.Business.WMS/Transaction/OtherInLocation.cs
+++ b/Tiger.Business.WMS/Transaction/Old/OtherInLocation.cs
@@ -12,6 +12,7 @@
 using Tiger.IBusiness;
 using Tiger.Model.Sharetronic.Shelf;
 using Tiger.Business.WMS.Sharetronic.Shelf;
+using static Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser;
 
 namespace Tiger.Business.WMS.Transaction
 {
@@ -71,7 +72,7 @@
                 //褰搃nput.ReqType涓�0鏃讹細鏃犲伐鍗曞叆搴�
                 if (input.ReqType == 0)
                 {
-                    Result<Inventory> res = new();
+                    Result<IInventory> res = new();
                     if (WarehouseName.Contains("瀹緵"))
                     {
                         res = WMS_ITEM_Biz.WmsItem.GetK(input.SN, new() { UserId = "admin" }, true);
@@ -80,11 +81,12 @@
                     {
                         res = WMS_ITEM_Biz.WmsItem.Get(input.SN, new() { UserId = "admin" }, true);
                     }
+                    var inv = res.Data as Inventory;
                     //鍒ゆ柇鏄惁涓�缁寸爜
-                    if (!res.Data.IsQRCode)
+                    if (!inv.IsQRCode)
                     {
                         action.IsSuccessed = false;
-                        action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.NotQrCode", res.Data.Barcode.MetaSn);
+                        action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.NotQrCode", inv.Barcode.MetaSn);
                         return action;
                     }
                     if (!res.IsSuccessed)
@@ -93,110 +95,110 @@
                         action.LocaleMsg = res.LocaleMsg;
                         return action;
                     }
-                    if (res.Data.Status.GetValue() != WMS_ITEM.STATUSs.NotExists.GetValue() && res.Data.Status.GetValue() <= WMS_ITEM.STATUSs.InStore.GetValue())
+                    if (inv.Status.GetValue() != WMS_ITEM.STATUSs.NotExists.GetValue() && inv.Status.GetValue() <= WMS_ITEM.STATUSs.InStore.GetValue())
                     {
                         action.IsSuccessed = false;
-                        action.LocaleMsg = Biz.L("鐘舵�佸紓甯竰0}", string.Join(',', res.Data.StatusList.Select(x => x.GetDesc()))); //Biz.L("WMS.CustSupChk.ScanItem.StatusException", string.Join(',', res.Data.StatusList.Select(x => x.GetDesc())));
+                        action.LocaleMsg = Biz.L("鐘舵�佸紓甯竰0}", string.Join(',', inv.StatusList.Select(x => x.GetDesc()))); //Biz.L("WMS.CustSupChk.ScanItem.StatusException", string.Join(',', inv.StatusList.Select(x => x.GetDesc())));
                         return action;
                     }
                     //楠岃瘉鏉$爜鏄惁姝g‘
-                    //if (!res.Data.isNormalStatus || !new[] { WMS_ITEM.STATUSs.WaitIn }.Contains(res.Data.Status))
+                    //if (!inv.isNormalStatus || !new[] { WMS_ITEM.STATUSs.WaitIn }.Contains(inv.Status))
                     //{
                     //    action.IsSuccessed = false;
-                    //    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.StatusException", string.Join(',', res.Data.StatusList));
+                    //    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.StatusException", string.Join(',', inv.StatusList));
                     //    return action;
                     //}
                     //鐗╂枡楠岃瘉
-                    if (res.Data.ItemInfo.IsNullOrEmpty() || res.Data.ItemInfo.IS_ACTIVE == "N")
+                    if (inv.ItemInfo.IsNullOrEmpty() || inv.ItemInfo.IS_ACTIVE == "N")
                     {
                         action.IsSuccessed = false;
-                        action.LocaleMsg = Biz.L("WMS.ProdMReq.ScanItem.ItemCodeNotExistsOrNotActive", res.Data.ItemInfo.ITEM_CODE.IsNullOrEmpty(res.Data.Barcode.ItemCode));
+                        action.LocaleMsg = Biz.L("WMS.ProdMReq.ScanItem.ItemCodeNotExistsOrNotActive", inv.ItemInfo.ITEM_CODE.IsNullOrEmpty(inv.Barcode.ItemCode));
                         return action;
                     }
                     List<WMS_ITEM_HIS> ItemHistorys = new List<WMS_ITEM_HIS>();
                     WMS_ITEM Item;
                     WMS_ITEM_PKG ItemPkgs;
                     var IsNull = false;
-                    if (!res.Data.IsNullOrEmpty())
+                    if (!inv.IsNullOrEmpty())
                     {
-                        if (res.Data.Items.Count == 0)
+                        if (inv.Items.Count == 0)
                         {
                             IsNull = true;
                             Item = new()
                             {
-                                SN = res.Data.Barcode.SN,
-                                ITEM_CODE = WarehouseName.Contains("瀹緵") && !res.Data.Barcode.ItemCode.StartsWith("K") ? ("K" + res.Data.Barcode.ItemCode) : (res.Data.Barcode.ItemCode),
+                                SN = inv.Barcode.SN,
+                                ITEM_CODE = WarehouseName.Contains("瀹緵") && !inv.Barcode.ItemCode.StartsWith("K") ? ("K" + inv.Barcode.ItemCode) : (inv.Barcode.ItemCode),
                                 AUTH_ORG = input.AuthOption.CurOrg,
                                 STATUS = WMS_ITEM.STATUSs.WaitIn.GetValue(),
-                                QTY = res.Data.Barcode.Qty.ToDecimal(),
-                                PROD_DATE = res.Data.Barcode.DateCode.ToDateTime(),
+                                QTY = inv.Barcode.Qty.ToDecimal(),
+                                PROD_DATE = inv.Barcode.DateCode.ToDateTime(),
                                 ERP_WH = WarehouseCode,
-                                UNIT = res.Data.Barcode.Unit,
+                                UNIT = inv.Barcode.Unit,
                             };
 
                             WMS_ITEM_HIS his = new WMS_ITEM_HIS(Item, $"鏃犲崟鎹叆搴�");
                             ItemHistorys.Add(his);
                             ItemPkgs = new()
                             {
-                                SN = res.Data.Barcode.SN,
+                                SN = inv.Barcode.SN,
                                 AUTH_ORG = input.AuthOption.CurOrg,
-                                ITEM_CODE = WarehouseName.Contains("瀹緵") && !res.Data.Barcode.ItemCode.StartsWith("K") ? ("K" + res.Data.Barcode.ItemCode) : (res.Data.Barcode.ItemCode),
-                                QTY = res.Data.Barcode.Qty.ToDecimal(),
+                                ITEM_CODE = WarehouseName.Contains("瀹緵") && !inv.Barcode.ItemCode.StartsWith("K") ? ("K" + inv.Barcode.ItemCode) : (inv.Barcode.ItemCode),
+                                QTY = inv.Barcode.Qty.ToDecimal(),
                                 ERP_WH = WarehouseCode,
-                                UNIT = res.Data.Barcode.Unit,
+                                UNIT = inv.Barcode.Unit,
                             };
 
-                            res.Data.ItemsExt = Biz.Db.Queryable<WMS_ITEM_EXT>().Where(q => res.Data.Items.Any(s => s.SN == q.SN)).ToList();//鎵╁睍琛�
-                            //var data = result.Data.Items.Select(i => i.SN).ToList().Except(result.Data.ItemsExt.Select(i => i.SN).ToList());
-                            var data = res.Data.Items.Where(q => !res.Data.ItemsExt.Any(s => s.SN == q.SN)).ToList();
+                            inv.ItemsExt = Biz.Db.Queryable<WMS_ITEM_EXT>().Where(q => inv.Items.Any(s => s.SN == q.SN)).ToList();//鎵╁睍琛�
+                            //var data = inv.Items.Select(i => i.SN).ToList().Except(inv.ItemsExt.Select(i => i.SN).ToList());
+                            var data = inv.Items.Where(q => !inv.ItemsExt.Any(s => s.SN == q.SN)).ToList();
                             //鎵╁睍琛ㄤ笉瀛樺湪鏃舵柊寤�
                             if (data.Count > 0)
                             {
                                 foreach (var item in data)
                                 {
-                                    res.Data.ItemsExt.Add(new()
+                                    inv.ItemsExt.Add(new()
                                     {
                                         SN = item.SN,
-                                        SUPP_ITEM_CODE = res.Data.Barcode.OEMItemCode,
-                                        META_SN = res.Data.Barcode.MetaSn,
-                                        QR_CODE = res.Data.Barcode.MetaSn
+                                        SUPP_ITEM_CODE = inv.Barcode.OEMItemCode,
+                                        META_SN = inv.Barcode.MetaSn,
+                                        QR_CODE = inv.Barcode.MetaSn
                                     });
                                 }
                             }
 
-                            res.Data.Items.Add(Item);
-                            res.Data.History.Add(his);
-                            res.Data.Packages.Add(ItemPkgs);
+                            inv.Items.Add(Item);
+                            inv.History.Add(his);
+                            inv.Packages.Add(ItemPkgs);
                         }
-                        else if (res.Data.Items.Count == 1)
+                        else if (inv.Items.Count == 1)
                         {
-                            res.Data.Items.First().QTY = res.Data.Barcode.Qty.ToDecimal();
-                            res.Data.Items.First().ERP_WH = WarehouseCode;
-                            res.Data.Items.First().AUTH_ORG = input.AuthOption.CurOrg;
+                            inv.Items.First().QTY = inv.Barcode.Qty.ToDecimal();
+                            inv.Items.First().ERP_WH = WarehouseCode;
+                            inv.Items.First().AUTH_ORG = input.AuthOption.CurOrg;
 
-                            res.Data.Packages.First().QTY = res.Data.Barcode.Qty.ToDecimal();
-                            res.Data.Packages.First().ERP_WH = WarehouseCode;
-                            res.Data.Packages.First().AUTH_ORG = input.AuthOption.CurOrg;
+                            inv.Packages.First().QTY = inv.Barcode.Qty.ToDecimal();
+                            inv.Packages.First().ERP_WH = WarehouseCode;
+                            inv.Packages.First().AUTH_ORG = input.AuthOption.CurOrg;
                         }
                         //濡傛灉鎵弿澶栫鐨勪笉鑳芥洿鏂版暟閲� 2024-09-23 Ben Lin
                         else
                         {
-                            foreach (var item in res.Data.Items)
+                            foreach (var item in inv.Items)
                             {
-                                //item.QTY = res.Data.Barcode.Qty.ToDecimal();
+                                //item.QTY = inv.Barcode.Qty.ToDecimal();
                                 item.ERP_WH = WarehouseCode;
                                 item.AUTH_ORG = input.AuthOption.CurOrg;
                             }
-                            foreach (var item in res.Data.Packages)
+                            foreach (var item in inv.Packages)
                             {
-                                //item.QTY = res.Data.Barcode.Qty.ToDecimal();
+                                //item.QTY = inv.Barcode.Qty.ToDecimal();
                                 item.ERP_WH = WarehouseCode;
                                 item.AUTH_ORG = input.AuthOption.CurOrg;
                             }
                         }
                         //CustomerSupplyPuton.LocationCode = nLocation.LOCATION_CODE;
                     }
-                    foreach (var item in res.Data.Items)
+                    foreach (var item in inv.Items)
                     {
                         item.SOURCE_CODE = item.TRANS_CODE;
                         item.SOURCE_LINE = item.TRANS_LINE;
@@ -208,7 +210,7 @@
                     // 鍒ゆ柇鏄惁鏅鸿兘璐ф灦
                     if (CustomerSupplyPuton.IsSmartRack)
                     {
-                        ShelfApiResult shelfApiResult = await Share.Shelf.PutOn(TransID, Shelf, res.Data.Items[0]);
+                        ShelfApiResult shelfApiResult = await Share.Shelf.PutOn(TransID, Shelf, inv.Items[0]);
                         if (!shelfApiResult.IsSuccess)
                         {
                             action.IsSuccessed = false;
@@ -247,7 +249,7 @@
                     }
 
                     //鍒ゆ柇鍌ㄤ綅鏄惁鍗曟斁
-                    if (nLocation.IS_SINGLE == "Y" && res.Data.Items.Count > 1)
+                    if (nLocation.IS_SINGLE == "Y" && inv.Items.Count > 1)
                     {
                         action.IsSuccessed = false;
                         action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.LocationSingleFailure"); //$"鍌ㄤ綅鍙兘鍗曟斁涓�涓墿鏂�";
@@ -255,7 +257,7 @@
                     }
 
                     //鎵ц鍏ュ簱
-                    Result<PutOnInfo> putonResult = WMS_ITEM_Biz.WmsItem.PutOn(res.Data, input.AuthOption, nLocation.LOCATION_CODE);
+                    Result<PutOnInfo> putonResult = WMS_ITEM_Biz.WmsItem.PutOn(inv, input.AuthOption, nLocation.LOCATION_CODE);
                     if (!putonResult.IsSuccessed)
                     {
                         action.IsSuccessed = false;
@@ -293,35 +295,35 @@
                     // 杩斿洖鍏朵粬鍏ュ簱瀵硅薄
                     action.Data = new Model.Minsun.OtherInstockBarcodeOutput
                     {
-                        Barcode = res.Data.SN,
-                        MaterialCode = res.Data.Items[0].ITEM_CODE,
-                        //MaterialName = res.Data.Items[0].ITEM_NAME,
-                        //MaterialStandard = res.Data.ItemInfo.SPEC,
-                        InitialQty = res.Data.Barcode.Qty ?? 0,
-                        CurrentQty = res.Data.Barcode.Qty ?? 0,
-                        Unit = res.Data.Items[0].UNIT,
-                        DateCode = res.Data.Barcode.ProdDate ?? DateTime.MinValue,
-                        LotNo = res.Data.SN,  //鎵规鍙烽粯璁や负澶栧寘瑁呮潯鐮�
+                        Barcode = inv.SN,
+                        MaterialCode = inv.Items[0].ITEM_CODE,
+                        //MaterialName = inv.Items[0].ITEM_NAME,
+                        //MaterialStandard = inv.ItemInfo.SPEC,
+                        InitialQty = inv.Barcode.Qty ?? 0,
+                        CurrentQty = inv.Barcode.Qty ?? 0,
+                        Unit = inv.Items[0].UNIT,
+                        DateCode = inv.Barcode.ProdDate ?? DateTime.MinValue,
+                        LotNo = inv.SN,  //鎵规鍙烽粯璁や负澶栧寘瑁呮潯鐮�
                                               //SourceBillCode = billCode,
                         LocationCode = nLocation.LOCATION_CODE,
                         //ReceiptCode = barcodeScanned?.BUSINESSCODE,
                         //IncompleteTips = isCompleted ? "鏁伴噺锛�0 (0鐩�)" : iWMS.GetIncompleteTipsNew(barcodeScanned?.BUSINESSCODE, barcodeScanned?.ITEM_CODE),
                         IsScanShelf = false
                     };
-                    action.LocaleMsg = Biz.L("鍏ュ簱鎴愬姛{0}", res.Data.SN);
+                    action.LocaleMsg = Biz.L("鍏ュ簱鎴愬姛{0}", inv.SN);
 
                 }
                 //鍏朵粬鍏ュ簱
                 if (input.ReqType == 1)
                 {
-                    Result<Inventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
+                    Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
                     if (!result.IsSuccessed)
                     {
                         action.IsSuccessed = false;
                         action.LocaleMsg = result.LocaleMsg;
                         return action;
                     }
-                    var inv = result.Data;
+                    var inv = result.Data as Inventory;
 
                     //楠岃瘉鏉$爜鏄惁姝g‘
                     if (!inv.isNormalStatus || !new[] { WMS_ITEM.STATUSs.WaitIn }.Contains(inv.Status))
diff --git a/Tiger.Business.WMS/Transaction/OtherInLocationChecking.cs b/Tiger.Business.WMS/Transaction/Old/OtherInLocationChecking.cs
similarity index 93%
rename from Tiger.Business.WMS/Transaction/OtherInLocationChecking.cs
rename to Tiger.Business.WMS/Transaction/Old/OtherInLocationChecking.cs
index 3d40296..596f267 100644
--- a/Tiger.Business.WMS/Transaction/OtherInLocationChecking.cs
+++ b/Tiger.Business.WMS/Transaction/Old/OtherInLocationChecking.cs
@@ -33,7 +33,7 @@
         #region Propertys & Variables
 
         public string UserCode { get; set; }
-        public static long UserId { get; set; }
+        public long UserId { get; set; }
         public string VenderCode { get; set; }
         public string LotNo { get; set; }
         public string SecondVenderCode { get; set; }
@@ -109,49 +109,49 @@
                     return action;
                 }
                 input.AuthOption.OrgCode = input.AuthOption.OrgCode.IsNullOrEmpty() ? input.AuthOption.CurOrg : input.AuthOption.OrgCode;
-                Result<Inventory> result = WarehouseName.Contains("瀹緵") ? WMS_ITEM_Biz.WmsItem.GetK(input.SN, input.AuthOption, false) : WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, false);
+                Result<IInventory> result = WarehouseName.Contains("瀹緵") ? WMS_ITEM_Biz.WmsItem.GetK(input.SN, input.AuthOption, false) : WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, false);
                 if (result.Flag != Result.Flags.Success)
                 {
                     action.IsSuccessed = false;
                     action.LocaleMsg = result.LocaleMsg;
                     return action;
                 }
-                var curBarcode = result.Data;
-                if (!curBarcode.IsQRCode)
+                var curInv = result.Data as Inventory;
+                if (!curInv.IsQRCode)
                 {
                     action.IsSuccessed = false;
-                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.NotQrCode", curBarcode.Barcode.MetaSn);
+                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.NotQrCode", curInv.Barcode.MetaSn);
                     return action;
                 }
                 //鍒ゆ柇鏉$爜鏄惁涓烘渶灏戝寘瑁�
-                if (!new[] { Barcode.Types.Small, Barcode.Types.Other }.Contains(curBarcode.Barcode.Type))
+                if (!new[] { Barcode.Types.Small, Barcode.Types.Other }.Contains(curInv.Barcode.Type))
                 {
                     action.IsSuccessed = false;
-                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.TypeError", curBarcode.SN);
+                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.TypeError", curInv.SN);
                     return action;
                 }
                 //鍒ゆ柇鏉$爜鐘舵�佷负涓嶅瓨鍦ㄦ垨宸蹭笅鏋跺彲浠ユ竻鐐�(!nDisassembleBarcode.isNormalStatus ||)
                 //鐗╂枡楠岃瘉
-                if (curBarcode.ItemInfo.IsNullOrEmpty() || curBarcode.ItemInfo.IS_ACTIVE == "N")
+                if (curInv.ItemInfo.IsNullOrEmpty() || curInv.ItemInfo.IS_ACTIVE == "N")
                 {
                     action.IsSuccessed = false;
-                    action.LocaleMsg = Biz.L("WMS.ProdMReq.ScanItem.ItemCodeNotExistsOrNotActive", curBarcode.ItemInfo.ITEM_CODE.IsNullOrEmpty(curBarcode.Barcode.ItemCode));
+                    action.LocaleMsg = Biz.L("WMS.ProdMReq.ScanItem.ItemCodeNotExistsOrNotActive", curInv.ItemInfo.ITEM_CODE.IsNullOrEmpty(curInv.Barcode.ItemCode));
                     return action;
                 }
-                if (!new[] { WMS_ITEM.STATUSs.NotExists, WMS_ITEM.STATUSs.OffShelf }.Contains(curBarcode.Status))
+                if (!new[] { WMS_ITEM.STATUSs.NotExists, WMS_ITEM.STATUSs.OffShelf }.Contains(curInv.Status))
                 {
                     action.IsSuccessed = false;
-                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.ExistItem", curBarcode.ItemInfo.ITEM_CODE);
+                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.ExistItem", curInv.ItemInfo.ITEM_CODE);
                     return action;
                 }
                 BIZ_ERP_OTH_IN_SNExt snExt = new();
                 // BIZ_ERP_OTH_IN_SN scanResult = Business.Biz.Db.Queryable<BIZ_ERP_OTH_IN_SN>().Where(q=>q.SN==curBarcode.Barcode.SN).First();
                 //楠岃瘉鏉$爜鏄惁宸插仛杩囨竻鐐�
-                var scanResult = Biz.Db.Queryable<BIZ_ERP_OTH_IN_SN>().Where(t => t.SN.ToUpper() == curBarcode.SN.ToUpper()).First();
+                var scanResult = Biz.Db.Queryable<BIZ_ERP_OTH_IN_SN>().Where(t => t.SN.ToUpper() == curInv.SN.ToUpper()).First();
                 if (!scanResult.IsNullOrEmpty() && scanResult.STATUS > WMS_ITEM.STATUSs.Counted.GetValue())
                 {
                     action.IsSuccessed = false;
-                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.BarcodeCounted", curBarcode.SN);
+                    action.LocaleMsg = Biz.L("WMS.CustSupChk.ScanItem.BarcodeCounted", curInv.SN);
                     return action;
                 }
                 var isNo = true;
@@ -164,10 +164,10 @@
                     scanResult.CREATE_USER = UserCode;
                     scanResult.BUSINESSCODE = "OTH_" + UserCode;
                     scanResult.WAREHOUSECODE = WarehouseCode;
-                    scanResult.SN = curBarcode.Barcode.SN;
-                    scanResult.ITEM_CODE = curBarcode.Barcode.ItemCode;
-                    scanResult.QTY = curBarcode.Barcode.Qty ?? 0;
-                    scanResult.DATECODE = curBarcode.Barcode.ProdDate ?? DateTime.MinValue;
+                    scanResult.SN = curInv.Barcode.SN;
+                    scanResult.ITEM_CODE = curInv.Barcode.ItemCode;
+                    scanResult.QTY = curInv.Barcode.Qty ?? 0;
+                    scanResult.DATECODE = curInv.Barcode.ProdDate ?? DateTime.MinValue;
                     scanResult.LOTNO = LotNo; //item.Barcode.LotNo;
                     scanResult.STATUS = WMS_ITEM.STATUSs.Counted.GetValue();
                     scanResult.META_SN = input.SN;
@@ -179,10 +179,10 @@
                     //scanResult.ID = Guid.NewGuid().ToString();
                     scanResult.BUSINESSCODE = "OTH_" + UserCode;
                     scanResult.WAREHOUSECODE = WarehouseCode;
-                    scanResult.SN = curBarcode.SN;
-                    scanResult.ITEM_CODE = curBarcode.ItemInfo.ITEM_CODE;
-                    scanResult.QTY = curBarcode.Barcode.Qty ?? 0;
-                    scanResult.DATECODE = curBarcode.Barcode.ProdDate ?? DateTime.MinValue;
+                    scanResult.SN = curInv.SN;
+                    scanResult.ITEM_CODE = curInv.ItemInfo.ITEM_CODE;
+                    scanResult.QTY = curInv.Barcode.Qty ?? 0;
+                    scanResult.DATECODE = curInv.Barcode.ProdDate ?? DateTime.MinValue;
                     scanResult.LOTNO = LotNo; //item.Barcode.LotNo;
                     scanResult.STATUS = WMS_ITEM.STATUSs.Counted.GetValue();
                     scanResult.META_SN = input.SN;
@@ -201,9 +201,9 @@
                 snExt.STATUS = scanResult.STATUS;
                 snExt.WH_CODE = scanResult.WAREHOUSECODE;
                 snExt.WH_NAME = WarehouseName;
-                snExt.MName = curBarcode.ItemInfo?.ITEM_NAME;
-                snExt.MDesc = curBarcode.ItemInfo?.SPEC;
-                snExt.MUom = curBarcode.ItemInfo?.UNIT;
+                snExt.MName = curInv.ItemInfo?.ITEM_NAME;
+                snExt.MDesc = curInv.ItemInfo?.SPEC;
+                snExt.MUom = curInv.ItemInfo?.UNIT;
 
                 //淇濆瓨鍒版暟鎹簱
                 var db = Business.Biz.Db;
@@ -213,7 +213,7 @@
                     AUTH_ORG = input.AuthOption.CurOrg,
                     CREATE_USER = UserCode,
                     OrderNo = UserCode,
-                    Barcodes = curBarcode.SN,
+                    Barcodes = curInv.SN,
                     CustomsNo = CustomsNo.Replace("锛�", ",").Trim().Split(',')[0],
                     AccountingNo = CustomsNo.Replace("锛�", ",").Trim().Split(',')[1],
                     CountsType = BIZ_ERP_CUSTOMS.CountsEnum.OtherInput
diff --git a/Tiger.Business.WMS/Transaction/OutNoBillcode.cs b/Tiger.Business.WMS/Transaction/Old/OutNoBillcode.cs
similarity index 97%
rename from Tiger.Business.WMS/Transaction/OutNoBillcode.cs
rename to Tiger.Business.WMS/Transaction/Old/OutNoBillcode.cs
index 5fd86eb..4783b36 100644
--- a/Tiger.Business.WMS/Transaction/OutNoBillcode.cs
+++ b/Tiger.Business.WMS/Transaction/Old/OutNoBillcode.cs
@@ -67,9 +67,9 @@
         /// <summary>
         /// 鎵弿鐗╂枡骞跺鏍革紝濡傛灉鐗╂枡宸茬粡瀹屾垚绉诲簱鍒欒揣鏋朵笂浜伅鎻愰啋鍌ㄤ綅
         /// </summary>
-        public async Task<ApiAction<NoWorkOrderOutput>> ScanItem(BaseInput input)
+        public async Task<ApiAction<DefaultScanItemOutput>> ScanItem(BaseInput input)
         {
-            var action = new ApiAction<NoWorkOrderOutput>();
+            var action = new ApiAction<DefaultScanItemOutput>();
             try
             {
                 if (input.SN.IsNullOrEmpty())
@@ -80,14 +80,14 @@
                 }
 
                 //瑙f瀽鏉$爜
-                Result<Inventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
+                Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
                 if (!result.IsSuccessed)
                 {
                     action.IsSuccessed = false;
                     action.LocaleMsg = result.LocaleMsg;
                     return action;
                 }
-                CurInv = result.Data;
+                CurInv = result.Data as Inventory;
 
                 //楠岃瘉鏉$爜鏄惁姝g‘
                 if (!CurInv.isNormalStatus || CurInv.Status != WMS_ITEM.STATUSs.InStore)
@@ -215,7 +215,7 @@
                     throw dbTran.ErrorException;
                 }
 
-                action.Data = new NoWorkOrderOutput()
+                action.Data = new DefaultScanItemOutput()
                 {
                     SN = CurInv.SN,
                     ItemCode = CurInv.ItemInfo.ITEM_CODE,
diff --git a/Tiger.Business.WMS/Transaction/OutOther.cs b/Tiger.Business.WMS/Transaction/Old/OutOther.cs
similarity index 99%
rename from Tiger.Business.WMS/Transaction/OutOther.cs
rename to Tiger.Business.WMS/Transaction/Old/OutOther.cs
index e144659..e2ea672 100644
--- a/Tiger.Business.WMS/Transaction/OutOther.cs
+++ b/Tiger.Business.WMS/Transaction/Old/OutOther.cs
@@ -351,14 +351,14 @@
                 }
 
                 //瑙f瀽鏉$爜
-                Result<Inventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
+                Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
                 if (!result.IsSuccessed)
                 {
                     action.IsSuccessed = false;
                     action.LocaleMsg = result.LocaleMsg;
                     return action;
                 }
-                CurInv = result.Data;
+                CurInv = result.Data as Inventory;
 
                 //楠岃瘉鏉$爜鏄惁姝g‘
                 if (!CurInv.isNormalStatus || CurInv.Status != WMS_ITEM.STATUSs.InStore)
diff --git a/Tiger.Business.WMS/Transaction/OutSale.cs b/Tiger.Business.WMS/Transaction/Old/OutSale.cs
similarity index 99%
rename from Tiger.Business.WMS/Transaction/OutSale.cs
rename to Tiger.Business.WMS/Transaction/Old/OutSale.cs
index 59ddfa8..032c153 100644
--- a/Tiger.Business.WMS/Transaction/OutSale.cs
+++ b/Tiger.Business.WMS/Transaction/Old/OutSale.cs
@@ -277,14 +277,14 @@
                 }
 
                 //瑙f瀽鏉$爜
-                Result<Inventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
+                Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
                 if (!result.IsSuccessed)
                 {
                     action.IsSuccessed = false;
                     action.LocaleMsg = result.LocaleMsg;
                     return action;
                 }
-                CurInv = result.Data;
+                CurInv = result.Data as Inventory;
 
                 //楠岃瘉鏉$爜鏄惁姝g‘
                 if (!CurInv.isNormalStatus || CurInv.Status != WMS_ITEM.STATUSs.InStore)
diff --git a/Tiger.Business.WMS/Transaction/OutSplit.cs b/Tiger.Business.WMS/Transaction/Old/OutSplit.cs
similarity index 99%
rename from Tiger.Business.WMS/Transaction/OutSplit.cs
rename to Tiger.Business.WMS/Transaction/Old/OutSplit.cs
index b362074..161402b 100644
--- a/Tiger.Business.WMS/Transaction/OutSplit.cs
+++ b/Tiger.Business.WMS/Transaction/Old/OutSplit.cs
@@ -62,14 +62,14 @@
                     return action;
                 }
                 //瑙f瀽鏉$爜
-                Result<Inventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
+                Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
                 if (!result.IsSuccessed)
                 {
                     action.IsSuccessed = false;
                     action.LocaleMsg = result.LocaleMsg;
                     return action;
                 }
-                CurInv = result.Data;
+                CurInv = result.Data as Inventory;
                 if (string.IsNullOrEmpty(CurInv.ItemInfo?.ITEM_CODE))
                 {
                     action.IsSuccessed = false;
diff --git a/Tiger.Business.WMS/Transaction/OutTransfer.cs b/Tiger.Business.WMS/Transaction/Old/OutTransfer.cs
similarity index 99%
rename from Tiger.Business.WMS/Transaction/OutTransfer.cs
rename to Tiger.Business.WMS/Transaction/Old/OutTransfer.cs
index 5684fae..de4e63a 100644
--- a/Tiger.Business.WMS/Transaction/OutTransfer.cs
+++ b/Tiger.Business.WMS/Transaction/Old/OutTransfer.cs
@@ -284,14 +284,14 @@
                 }
 
                 //瑙f瀽鏉$爜
-                Result<Inventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
+                Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
                 if (!result.IsSuccessed)
                 {
                     action.IsSuccessed = false;
                     action.LocaleMsg = result.LocaleMsg;
                     return action;
                 }
-                CurInv = result.Data;
+                CurInv = result.Data as Inventory;
 
                 //楠岃瘉鏉$爜鏄惁姝g‘
                 if (!CurInv.isNormalStatus || CurInv.Status != WMS_ITEM.STATUSs.InStore)
diff --git a/Tiger.Business.WMS/Transaction/OutWorkOrder.cs b/Tiger.Business.WMS/Transaction/Old/OutWorkOrder.cs
similarity index 99%
rename from Tiger.Business.WMS/Transaction/OutWorkOrder.cs
rename to Tiger.Business.WMS/Transaction/Old/OutWorkOrder.cs
index f0b24b6..1dd7340 100644
--- a/Tiger.Business.WMS/Transaction/OutWorkOrder.cs
+++ b/Tiger.Business.WMS/Transaction/Old/OutWorkOrder.cs
@@ -371,14 +371,14 @@
                 }
 
                 //瑙f瀽鏉$爜
-                Result<Inventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
+                Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
                 if (!result.IsSuccessed)
                 {
                     action.IsSuccessed = false;
                     action.LocaleMsg = result.LocaleMsg;
                     return action;
                 }
-                CurInv = result.Data;
+                CurInv = result.Data as Inventory;
 
                 //楠岃瘉鏉$爜鏄惁姝g‘
                 if (!CurInv.isNormalStatus || CurInv.Status != WMS_ITEM.STATUSs.InStore)
diff --git a/Tiger.Business.WMS/Transaction/ProductionMaterialReq.cs b/Tiger.Business.WMS/Transaction/Old/ProductionMaterialReq.cs
similarity index 99%
rename from Tiger.Business.WMS/Transaction/ProductionMaterialReq.cs
rename to Tiger.Business.WMS/Transaction/Old/ProductionMaterialReq.cs
index 67482d1..6b4e19d 100644
--- a/Tiger.Business.WMS/Transaction/ProductionMaterialReq.cs
+++ b/Tiger.Business.WMS/Transaction/Old/ProductionMaterialReq.cs
@@ -497,14 +497,14 @@
                 }
 
                 //瑙f瀽鏉$爜
-                Result<Inventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
+                Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
                 if (!result.IsSuccessed)
                 {
                     action.IsSuccessed = false;
                     action.LocaleMsg = result.LocaleMsg;
                     return action;
                 }
-                CurInv = result.Data;
+                CurInv = result.Data as Inventory;
 
                 //楠岃瘉鏉$爜鏄惁姝g‘
                 if (!CurInv.isNormalStatus || CurInv.Status != WMS_ITEM.STATUSs.InStore)
diff --git a/Tiger.Business.WMS/Transaction/Resell.cs b/Tiger.Business.WMS/Transaction/Old/Resell.cs
similarity index 100%
rename from Tiger.Business.WMS/Transaction/Resell.cs
rename to Tiger.Business.WMS/Transaction/Old/Resell.cs
diff --git a/Tiger.Business.WMS/Transaction/Out_Default.cs b/Tiger.Business.WMS/Transaction/Out_Default.cs
new file mode 100644
index 0000000..88d5500
--- /dev/null
+++ b/Tiger.Business.WMS/Transaction/Out_Default.cs
@@ -0,0 +1,256 @@
+锘縰sing Rhea.Common;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Tiger.Model;
+using Tiger.IBusiness;
+using Org.BouncyCastle.Ocsp;
+
+namespace Tiger.Business.WMS.Transaction
+{
+    /// <summary>
+    /// 鏍囧噯涓嬫灦浜嬪姟
+    /// </summary>
+    public class Out_Default : WMSTransactionBase, IOut_Default
+    {
+        public IOut_Default Init(string id, string userCode, string apiHost, string orgCode)
+        {
+            TransID = id;
+            UserCode = userCode;
+            ApiHost = apiHost;
+            OrgCode = orgCode;
+           
+            Logger.Console.Info($"Start {this.GetType().Name} Transaction[ID: {TransID}]");
+            return this;
+        }
+
+        #region Propertys & Variables
+        public string UserCode { get; set; }
+        public long UserId { get; set; }
+        public string OrgCode { get; set; }
+        public Inventory CurInvItem { get; set; }
+        public ScanShelfInfo CurScanShelf { get; set; }
+        #endregion
+
+        #region Functions
+        /// <summary>
+        /// 鎵弿鐗╂枡骞跺鏍革紝濡傛灉鏄櫤鑳借揣鏋跺垯浜伅鎻愰啋鍌ㄤ綅
+        /// </summary>
+        public async Task<ApiAction<DefaultScanItemOutput>> ScanItem(BaseInput input)
+        {
+            var action = new ApiAction<DefaultScanItemOutput>();
+            try
+            {
+                if (input.SN.IsNullOrEmpty())
+                {
+                    action.IsSuccessed = false;
+                    //action.LocaleMsg = Biz.L("鏉$爜涓嶈兘涓虹┖");
+                    action.LocaleMsg = Biz.L("WMS.Default.ScanItem.SnEmptyFailure");
+                    return action;
+                }
+
+                //瑙f瀽鏉$爜
+                Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
+                if (!result.IsSuccessed)
+                {
+                    action.IsSuccessed = false;
+                    action.LocaleMsg = result.LocaleMsg;
+                    return action;
+                }
+                CurInvItem = result.Data as Inventory;
+
+                //楠岃瘉鏉$爜鏄惁姝g‘
+                if (!CurInvItem.isNormalStatus || CurInvItem.Status != WMS_ITEM.STATUSs.InStore)
+                {
+                    action.IsSuccessed = false;
+                    //action.LocaleMsg = Biz.L($"鐘舵�乕{0}]寮傚父锛岃閲嶆柊鎵弿");
+                    action.LocaleMsg = Biz.L("WMS.Default.ScanItem.StatusException", string.Join(',', CurInvItem.StatusList.Select(x => x.GetDesc())));
+                    return action;
+                }
+                //鍌ㄤ綅楠岃瘉
+                if (CurInvItem.Location.IsNullOrEmpty())
+                {
+                    action.IsSuccessed = false;
+                    //action.LocaleMsg = Biz.L($"鏉$爜[{0}]搴撳瓨淇℃伅寮傚父: 娌℃湁鍌ㄤ綅淇℃伅锛岃鍏堜笂鏋跺悗鍐嶆壂鎻�(鍌ㄤ綅Id: {1})");
+                    action.LocaleMsg = Biz.L("WMS.Default.ScanItem.LocationIsNull", CurInvItem.CurPkg.SN, CurInvItem.CurPkg.LOCATION_ID);
+                    return action;
+                }
+                //鐗╂枡楠岃瘉
+                if (CurInvItem.ItemInfo.IsNullOrEmpty() || CurInvItem.ItemInfo.IS_ACTIVE == "N")
+                {
+                    action.IsSuccessed = false;
+                    //action.LocaleMsg = Biz.L($"鐗╂枡缂栫爜[{0}]涓嶅瓨鍦ㄦ垨鑰呰鐗╂枡鏈惎鐢�");
+                    action.LocaleMsg = Biz.L("WMS.Default.ScanItem.ItemCodeNotExistsOrNotActive", CurInvItem.ItemInfo.ITEM_CODE.IsNullOrEmpty(CurInvItem.Barcode.ItemCode));
+                    return action;
+                }
+
+                //鍑哄簱涓嬫灦
+                foreach (var item in CurInvItem.Items)
+                {
+                    item.TRANS_CODE = "Out_Default";
+                    item.TRANS_NO = $"Out_Default_{DateTime.Now:yyyyMMdd}";
+                }
+                Result<TakeDownInfo> downResult = WMS_ITEM_Biz.WmsItem.TakeDown(CurInvItem, input.AuthOption, WMS_ITEM.STATUSs.Sended);
+                if (!downResult.IsSuccessed)
+                {
+                    action.IsSuccessed = false;
+                    action.LocaleMsg = downResult.LocaleMsg;
+                    return action;
+                }
+                TakeDownInfo downInfo = downResult.Data;
+
+                //鐏伅
+                if (CurInvItem.Shelf.IsLightShelf)
+                {
+                    await Share.Shelf.DownSingle(TransID, CurInvItem.Location);
+                }
+
+                //淇濆瓨鏁版嵁搴�
+                var db = Business.Biz.Db;
+                var dbTran = db.UseTran(() =>
+                {
+                    //涓嬫灦
+                    db.Updateable(downInfo.Items, UserCode).ExecuteCommand();
+                    db.Insertable(downInfo.History, UserCode).ExecuteCommand();
+                    db.Updateable(downInfo.Packages, UserCode).ExecuteCommand();
+                });
+                if (!dbTran.IsSuccess)
+                {
+                    Logger.Default.Fatal(dbTran.ErrorException, "Database transaction save exception");
+                    throw dbTran.ErrorException;
+                }
+
+                action.Data = new DefaultScanItemOutput()
+                {
+                    SN = CurInvItem.SN,
+                    ItemCode = CurInvItem.ItemInfo.ITEM_CODE,
+                    MaterialName = CurInvItem.ItemInfo.ITEM_NAME,
+                    Qty = CurInvItem.CurPkg.QTY,
+                    Unit = CurInvItem.CurPkg.UNIT,
+                    regionCode = CurInvItem.Region.REGION_CODE,
+                    locationCode = CurInvItem.Location?.LOCATION_CODE,
+                    DateCode = CurInvItem.Items[0].PROD_DATE,
+                    ScanAfCut = CurInvItem.Warehouse.SCAN_AF_CUT
+                };
+                //action.LocaleMsg = Biz.L($"鎵弿鏉$爜[{0}]浠庡偍浣峓{1}]涓嬫灦鎴愬姛");
+                action.LocaleMsg = Biz.L("WMS.Default.ScanItem.TakeDownSucceeded", action.Data.SN, action.Data.locationCode);
+            }
+            catch (Exception ex)
+            {
+                ResetInfo();
+                //action.CatchExceptionWithLog(ex, $"鎵弿鏉$爜[{input.SN}]澶嶆牳寮傚父");
+                action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.ScanItem.ScanException", action.Data.SN));
+            }
+            return action;
+        }
+
+        /// <summary>
+        /// 鎵弿璐ф灦鎴栬�呭偍浣�(渚涗寒鐏揣鏋朵娇鐢�)
+        /// </summary>
+        public async Task<ApiAction<ScanShelfInfo>> ScanShelf(string Code)
+        {
+            var action = new ApiAction<ScanShelfInfo>();
+            try
+            {
+                if (Code.IsNullOrEmpty())
+                {
+                    action.IsSuccessed = false;
+                    //action.LocaleMsg = Biz.L("璇疯緭鍏ユ垨鎵弿鏈夋晥鐨勮揣鏋�/鍌ㄤ綅鐮�");
+                    action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.ShelfCanNotEmpty");
+                    return action;
+                }
+
+                CurScanShelf = new ScanShelfInfo();
+
+                // 鏌ヨ璐ф灦淇℃伅
+                var whUnit = await Biz.Db.Queryable<V_WH_UNIT>().Where(t => t.SHELF_CODE.ToUpper() == Code.ToUpper() && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync();
+
+                // 鎵弿璐ф灦浠g爜锛屼笖涓烘櫤鑳借揣鏋�
+                if (whUnit != null && whUnit.SHELF_TYPE == WMS_SHELF.SHELF_TYPEs.Smart.GetValue())
+                {
+                    CurScanShelf.Shelf = whUnit.Shelf;
+                    CurScanShelf.WarehouseCode = whUnit.WH_CODE;
+                    CurScanShelf.RegionCode = whUnit.REGION_CODE;
+                    CurScanShelf.ShelfCode = whUnit.SHELF_CODE;
+                    CurScanShelf.LocationCode = whUnit.LOCATION_CODE;
+                    CurScanShelf.ShelfType = whUnit.SHELF_TYPE;
+                    CurScanShelf.IsSmartRack = true;
+                }
+                // 鎵弿鍌ㄤ綅浠g爜
+                else
+                {
+                    var nLocation = await Biz.Db.Queryable<V_WH_UNIT>().Where(t => t.LOCATION_CODE.ToUpper() == Code.ToUpper() && t.AUTH_ORG == OrgCode).FirstAsync();
+                    if (nLocation == null)
+                    {
+                        action.IsSuccessed = false;
+                        //action.LocaleMsg = Biz.L("鍌ㄤ綅[{0}]涓嶅瓨鍦�");
+                        action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.LocationNotExist", Code);
+                        return action;
+                    }
+                    if (nLocation.IS_ACTIVE == "N")
+                    {
+                        action.IsSuccessed = false;
+                        //action.LocaleMsg = Biz.L("鎵弿鐨勫偍浣峓{0}]鏈惎鐢�");
+                        action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.ShelfOrLocationDisabled", Code);
+                        return action;
+                    }
+                    //if (nLocation.Shelf.IsLightShelf || nLocation.Location.IS_SINGLE == "Y")
+                    //{
+                    //    var locationData = Biz.Db.Queryable<WMS_ITEM>().Where(q => q.LOCATION_ID == nLocation.LOCATION_ID && q.AUTH_ORG == OrgCode).First();
+                    //    if (!locationData.IsNullOrEmpty())
+                    //    {
+                    //        action.IsSuccessed = false;
+                    //        //action.LocaleMsg = Biz.L("鍌ㄤ綅[{0}]宸插瓨鏈夌墿鏂橻{1}]锛岃妫�鏌ョ郴缁熷簱瀛樹俊鎭�");
+                    //        action.LocaleMsg = Biz.L($"WMS.Default.ScanShelf.ItemAlreadyExistsInLocation", Code, locationData.SN);
+                    //        return action;
+                    //    }
+                    //}
+
+                    CurScanShelf.Location = nLocation.Location;
+                    CurScanShelf.WarehouseCode = nLocation.WH_CODE;
+                    CurScanShelf.RegionCode = nLocation.REGION_CODE;
+                    CurScanShelf.ShelfCode = nLocation.SHELF_CODE;
+                    CurScanShelf.LocationCode = nLocation.LOCATION_CODE;
+                    CurScanShelf.IsSmartRack = false;
+                }
+
+                CurScanShelf.IsScanShelf = true;
+                //action.LocaleMsg = Biz.L("鎵弿璐ф灦/鍌ㄤ綅[{0}]鎴愬姛");
+                action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.ScanSucceeded", Code);
+                action.Data = CurScanShelf;
+            }
+            catch (Exception ex)
+            {
+                //鍙栨秷褰撳墠鎿嶄綔
+                ResetInfo();
+                //action.CatchExceptionWithLog(ex, $"鎵弿璐ф灦/鍌ㄤ綅[{0}]寮傚父");
+                action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.ScanShelf.ScanException", Code));
+            }
+            return action;
+        }
+
+        #endregion
+
+        /// <summary>
+        /// 閲嶇疆褰撳墠鎿嶄綔锛屾湁闇�瑕佸垯閲嶅啓姝ゆ柟娉�
+        /// </summary>
+        public override void ResetInfo()
+        {
+            base.ResetInfo();
+            CurInvItem = null;
+            CurScanShelf = null;
+        }
+
+        public override bool Close(bool needSaveHistoryLog = false)
+        {
+            this.IsFinished = true;
+            return IsFinished ? base.Close(needSaveHistoryLog) : IsFinished;
+        }
+
+    }//endClass
+}
diff --git a/Tiger.Business.WMS/Transaction/WMSTransactionBase.cs b/Tiger.Business.WMS/Transaction/WMSTransactionBase.cs
index 725d6b4..b985a25 100644
--- a/Tiger.Business.WMS/Transaction/WMSTransactionBase.cs
+++ b/Tiger.Business.WMS/Transaction/WMSTransactionBase.cs
@@ -62,7 +62,28 @@
         /// 鎵ц涓潯鐮�
         /// </summary>
         public string ProcessingSn {  get; set; }
+        /// <summary>
+        /// 閲嶇疆浜嬪姟鎿嶄綔
+        /// </summary>
+        /// <returns></returns>
+        public ApiAction Reset()
+        {
+            var action = new ApiAction();
 
+            ResetInfo();
+            action.IsSuccessed = true;
+            //action.LocaleMsg = new($"鎿嶄綔宸查噸缃紝璇烽噸鏂版壂鎻�");
+            action.LocaleMsg = new("WMS.Transaction.Reset");
+
+            return action;
+        }
+        /// <summary>
+        /// 閲嶇疆褰撳墠鎿嶄綔锛屾湁闇�瑕佸垯閲嶅啓姝ゆ柟娉�
+        /// </summary>
+        public virtual void ResetInfo()
+        {
+            ProcessingSn = null;
+        }
         #endregion
 
         #region MQTT
diff --git a/Tiger.Business.WMS/Transaction/WmsCount.cs b/Tiger.Business.WMS/Transaction/WmsCount.cs
index 1b590f2..c99865e 100644
--- a/Tiger.Business.WMS/Transaction/WmsCount.cs
+++ b/Tiger.Business.WMS/Transaction/WmsCount.cs
@@ -205,14 +205,14 @@
                 }
 
                 //瑙f瀽鏉$爜
-                Result<Inventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
+                Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
                 if (!result.IsSuccessed)
                 {
                     action.IsSuccessed = false;
                     action.LocaleMsg = result.LocaleMsg;
                     return action;
                 }
-                CurInv = result.Data;
+                CurInv = result.Data as Inventory;
 
                 //楠岃瘉鏉$爜鏄惁姝g‘
                 if (!CurInv.isNormalStatus || CurInv.Status != WMS_ITEM.STATUSs.InStore)
diff --git a/Tiger.Business.WMS/WMS_ITEM_Biz.cs b/Tiger.Business.WMS/WMS_ITEM_Biz.cs
index d0e5965..c31f406 100644
--- a/Tiger.Business.WMS/WMS_ITEM_Biz.cs
+++ b/Tiger.Business.WMS/WMS_ITEM_Biz.cs
@@ -31,11 +31,12 @@
             /// <param name="option">鎺堟潈鏌ヨ閫夐」</param>
             /// <param name="doUnPack">鏄惁鍚屾椂鎵ц鎷嗗寘鎿嶄綔锛岃В闄や笌鐖舵潯鐮佷箣闂寸殑鍖呰鍏崇郴</param>
             /// <returns></returns>
-            public Result<Inventory> Get(string sn, AuthOption option, bool doUnPack)
+            public Result<IInventory> Get(string sn, AuthOption option, bool doUnPack)
             {
-                var result = new Result<Inventory>(Result.Flags.Success, new Inventory());
+                var result = new Result<IInventory>(Result.Flags.Success);
                 try
                 {
+                    var inv = new Inventory();
                     Barcode barcode = new Barcode(sn);
                     if (sn.IsNullOrEmpty())
                     {
@@ -61,24 +62,24 @@
                         //鍖呰琛ㄤ腑鎵惧埌鏉$爜
                         if (!query.IsNullOrEmpty() && query.QTY > 0)
                         {
-                            result.Data.SN = barcode.SN;
-                            result.Data.Barcode = barcode;
-                            result.Data.ExtInfo = query.ExtInfo;
-                            result.Data.ItemInfo = query.ItemInfo;
-                            result.Data.Warehouse = query.Warehouse;
-                            result.Data.Region = query.Region;
-                            result.Data.Shelf = query.Shelf;
-                            result.Data.Location = query.Location;
-                            result.Data.Packages = Biz.Db.Ado.UseStoredProcedure().SqlQuery<WMS_ITEM_PKG>("pkg_wms_get_item_pkg", new SugarParameter("root", barcode.SN));
-                            result.Data.Items = Biz.Db.Ado.UseStoredProcedure().SqlQuery<WMS_ITEM>("pkg_wms_get_items", new SugarParameter("root", barcode.SN));
-                            result.Data.ItemsExt = Biz.Db.Queryable<WMS_ITEM_EXT>().Where(q => result.Data.Items.Any(s => s.SN == q.SN)).ToList();
-                            //var data = result.Data.Items.Select(i => i.SN).ToList().Except(result.Data.ItemsExt.Select(i => i.SN).ToList());
-                            var data = result.Data.Items.Where(q => !result.Data.ItemsExt.Any(s => s.SN == q.SN)).ToList();
+                            inv.SN = barcode.SN;
+                            inv.Barcode = barcode;
+                            inv.ExtInfo = query.ExtInfo;
+                            inv.ItemInfo = query.ItemInfo;
+                            inv.Warehouse = query.Warehouse;
+                            inv.Region = query.Region;
+                            inv.Shelf = query.Shelf;
+                            inv.Location = query.Location;
+                            inv.Packages = Biz.Db.Ado.UseStoredProcedure().SqlQuery<WMS_ITEM_PKG>("pkg_wms_get_item_pkg", new SugarParameter("root", barcode.SN));
+                            inv.Items = Biz.Db.Ado.UseStoredProcedure().SqlQuery<WMS_ITEM>("pkg_wms_get_items", new SugarParameter("root", barcode.SN));
+                            inv.ItemsExt = Biz.Db.Queryable<WMS_ITEM_EXT>().Where(q => inv.Items.Any(s => s.SN == q.SN)).ToList();
+                            //var data = inv.Items.Select(i => i.SN).ToList().Except(inv.ItemsExt.Select(i => i.SN).ToList());
+                            var data = inv.Items.Where(q => !inv.ItemsExt.Any(s => s.SN == q.SN)).ToList();
                             if (data.Count > 0)
                             {
                                 foreach (var item in data)
                                 {
-                                    result.Data.ItemsExt.Add(new()
+                                    inv.ItemsExt.Add(new()
                                     {
                                         SN = item.SN,
                                         SUPP_ITEM_CODE = barcode.OEMItemCode,
@@ -90,12 +91,12 @@
                             result.LocaleMsg = new($"WMS.WmsItem.Barcode.Get{(doUnPack ? "UnPack" : "")}Success", barcode.SN, query.Parent?.SN);
                             if (!query.Parent.IsNullOrEmpty() && doUnPack && query.Parent.SN != query.SN)
                             {
-                                result.Data.ParentPkg = null;
+                                inv.ParentPkg = null;
                                 //淇濆瓨鏁版嵁鍒版暟鎹簱
                                 var db = Biz.Db;
                                 var dbTran = db.UseTran(() =>
                                 {
-                                    var unPackQty = result.Data.Items.Sum(q => q.QTY);
+                                    var unPackQty = inv.Items.Sum(q => q.QTY);
                                     db.Updateable<WMS_ITEM_PKG>().SetColumns(q => q.PARENT_SN == null).Where(q => q.ID == query.ID).ExecuteCommand();
                                     db.Updateable<WMS_ITEM_PKG>().SetColumns(q => q.QTY == q.QTY - unPackQty).Where(q => q.ID == query.Parent.ID).ExecuteCommand();
                                     if (!Biz.Db.Queryable<WMS_ITEM_PKG>().Any(q => q.PARENT_SN == query.PARENT_SN && q.SN != query.SN))
@@ -110,17 +111,18 @@
                             }
                             else
                             {
-                                result.Data.ParentPkg = query.Parent;
+                                inv.ParentPkg = query.Parent;
                             }
                         }
                         else
                         {
-                            result.Data.SN = barcode.SN;
-                            result.Data.Barcode = barcode;
-                            result.Data.ItemInfo = Biz.Db.Queryable<BAS_ITEM>().Where(q => q.ITEM_CODE == barcode.ItemCode).First();
+                            inv.SN = barcode.SN;
+                            inv.Barcode = barcode;
+                            inv.ItemInfo = Biz.Db.Queryable<BAS_ITEM>().Where(q => q.ITEM_CODE == barcode.ItemCode).First();
                             result.LocaleMsg = new($"WMS.WmsItem.Barcode.NotFound", barcode.SN);
                         }
                     }
+                    result.Data = inv;
                 }
                 catch (Exception ex)
                 {
@@ -137,11 +139,12 @@
             /// <param name="option">鎺堟潈鏌ヨ閫夐」</param>
             /// <param name="doUnPack">鏄惁鍚屾椂鎵ц鎷嗗寘鎿嶄綔锛岃В闄や笌鐖舵潯鐮佷箣闂寸殑鍖呰鍏崇郴</param>
             /// <returns></returns>
-            public Result<Inventory> GetK(string sn, AuthOption option, bool doUnPack)
+            public Result<IInventory> GetK(string sn, AuthOption option, bool doUnPack)
             {
-                var result = new Result<Inventory>(Result.Flags.Success, new Inventory());
+                var result = new Result<IInventory>(Result.Flags.Success, new Inventory());
                 try
                 {
+                    var inv = new Inventory();
                     Barcode barcode = new Barcode(sn);
                     barcode.ItemCode = (barcode.ItemCode.IsNullOrEmpty("K").StartsWith("K") ? "" : "K") + barcode.ItemCode;
                     if (sn.IsNullOrEmpty())
@@ -167,25 +170,25 @@
                         //鍖呰琛ㄤ腑鎵惧埌鏉$爜
                         if (!query.IsNullOrEmpty() && query.QTY > 0)
                         {
-                            result.Data.SN = barcode.SN;
-                            result.Data.Barcode = barcode;
-                            result.Data.ExtInfo = query.ExtInfo;
-                            result.Data.ItemInfo = query.ItemInfo;
-                            result.Data.Warehouse = query.Warehouse;
-                            result.Data.Region = query.Region;
-                            result.Data.Shelf = query.Shelf;
-                            result.Data.Location = query.Location;
-                            result.Data.Packages = Biz.Db.Ado.UseStoredProcedure().SqlQuery<WMS_ITEM_PKG>("pkg_wms_get_item_pkg", new SugarParameter("root", barcode.SN));
-                            result.Data.Items = Biz.Db.Ado.UseStoredProcedure().SqlQuery<WMS_ITEM>("pkg_wms_get_items", new SugarParameter("root", barcode.SN));
-                            result.Data.ItemsExt = Biz.Db.Queryable<WMS_ITEM_EXT>().Where(q => result.Data.Items.Any(s => s.SN == q.SN)).ToList();//鎵╁睍琛�
-                            //var data = result.Data.Items.Select(i => i.SN).ToList().Except(result.Data.ItemsExt.Select(i => i.SN).ToList());
-                            var data = result.Data.Items.Where(q => !result.Data.ItemsExt.Any(s => s.SN == q.SN)).ToList();
+                            inv.SN = barcode.SN;
+                            inv.Barcode = barcode;
+                            inv.ExtInfo = query.ExtInfo;
+                            inv.ItemInfo = query.ItemInfo;
+                            inv.Warehouse = query.Warehouse;
+                            inv.Region = query.Region;
+                            inv.Shelf = query.Shelf;
+                            inv.Location = query.Location;
+                            inv.Packages = Biz.Db.Ado.UseStoredProcedure().SqlQuery<WMS_ITEM_PKG>("pkg_wms_get_item_pkg", new SugarParameter("root", barcode.SN));
+                            inv.Items = Biz.Db.Ado.UseStoredProcedure().SqlQuery<WMS_ITEM>("pkg_wms_get_items", new SugarParameter("root", barcode.SN));
+                            inv.ItemsExt = Biz.Db.Queryable<WMS_ITEM_EXT>().Where(q => inv.Items.Any(s => s.SN == q.SN)).ToList();//鎵╁睍琛�
+                            //var data = inv.Items.Select(i => i.SN).ToList().Except(inv.ItemsExt.Select(i => i.SN).ToList());
+                            var data = inv.Items.Where(q => !inv.ItemsExt.Any(s => s.SN == q.SN)).ToList();
                             //鎵╁睍琛ㄤ笉瀛樺湪鏃舵柊寤�
                             if (data.Count > 0)
                             {
                                 foreach (var item in data)
                                 {
-                                    result.Data.ItemsExt.Add(new()
+                                    inv.ItemsExt.Add(new()
                                     {
                                         SN = item.SN,
                                         SUPP_ITEM_CODE = barcode.OEMItemCode,
@@ -198,12 +201,12 @@
 
                             if (!query.Parent.IsNullOrEmpty() && doUnPack && query.Parent.SN != query.SN)
                             {
-                                result.Data.ParentPkg = null;
+                                inv.ParentPkg = null;
                                 //淇濆瓨鏁版嵁鍒版暟鎹簱
                                 var db = Biz.Db;
                                 var dbTran = db.UseTran(() =>
                                 {
-                                    var unPackQty = result.Data.Items.Sum(q => q.QTY);
+                                    var unPackQty = inv.Items.Sum(q => q.QTY);
                                     db.Updateable<WMS_ITEM_PKG>().SetColumns(q => q.PARENT_SN == null).Where(q => q.ID == query.ID).ExecuteCommand();
                                     db.Updateable<WMS_ITEM_PKG>().SetColumns(q => q.QTY == q.QTY - unPackQty).Where(q => q.ID == query.Parent.ID).ExecuteCommand();
                                     if (!Biz.Db.Queryable<WMS_ITEM_PKG>().Any(q => q.PARENT_SN == query.PARENT_SN && q.SN != query.SN))
@@ -218,17 +221,18 @@
                             }
                             else
                             {
-                                result.Data.ParentPkg = query.Parent;
+                                inv.ParentPkg = query.Parent;
                             }
                         }
                         else
                         {
-                            result.Data.SN = barcode.SN;
-                            result.Data.Barcode = barcode;
-                            result.Data.ItemInfo = Biz.Db.Queryable<BAS_ITEM>().Where(q => q.ITEM_CODE == barcode.ItemCode).First();
+                            inv.SN = barcode.SN;
+                            inv.Barcode = barcode;
+                            inv.ItemInfo = Biz.Db.Queryable<BAS_ITEM>().Where(q => q.ITEM_CODE == barcode.ItemCode).First();
                             result.LocaleMsg = new($"WMS.WmsItem.Barcode.NotFound", barcode.SN);
                         }
                     }
+                    result.Data = inv;
                 }
                 catch (Exception ex)
                 {
@@ -245,11 +249,12 @@
             /// <param name="targetLocation">瑕佷笂鏋剁殑鍌ㄤ綅浠g爜</param>
             /// <param name="isTransfer">鏄惁绉诲簱鎿嶄綔</param>
             /// <returns></returns>
-            public Result<PutOnInfo> PutOn(Inventory inventory, AuthOption option, string targetLocation, bool isTransfer = false)
+            public Result<PutOnInfo> PutOn(IInventory inventory, AuthOption option, string targetLocation, bool isTransfer = false)
             {
                 var result = new Result<PutOnInfo>(Result.Flags.Success, new PutOnInfo());
                 try
                 {
+                    var inv = inventory as Inventory;
                     var location = Biz.Db.Queryable<V_WH_UNIT>().Where(q => q.LOCATION_CODE == targetLocation && q.AUTH_ORG == option.CurOrg).IncludesAllFirstLayer().First();
                     if (!location.IsNullOrEmpty())
                     {
@@ -260,7 +265,7 @@
                         foreach (var item in inventory.Items)
                         {
                             item.STATUS = WMS_ITEM.STATUSs.InStore.GetValue();
-                            item.SUPP_LOTNO = inventory.Barcode.LotNo;
+                            item.SUPP_LOTNO = inv.Barcode.LotNo;
                             item.FIRST_IN_DATE = item.FIRST_IN_DATE <= DateTime.MinValue ? DateTime.Now : item.FIRST_IN_DATE;
                             item.PROD_DATE = item.PROD_DATE <= DateTime.MinValue ? item.FIRST_IN_DATE : item.PROD_DATE;
                             item.WH_ID = location.WH_ID;
@@ -279,8 +284,8 @@
                         foreach (var item in inventory.ItemsExt)
                         {
                             item.AUTH_ORG = option.OrgCode;
-                            item.SN = inventory.Barcode.SN;
-                            item.SUPP_ITEM_CODE = inventory.Barcode.OEMItemCode;
+                            item.SN = inv.Barcode.SN;
+                            item.SUPP_ITEM_CODE = inv.Barcode.OEMItemCode;
                         }
 
                         result.Data.Items = inventory.Items;
@@ -307,8 +312,9 @@
             /// <param name="inventory">瑕佷笅鏋剁殑搴撳瓨瀵硅薄</param>
             /// <param name="option">鎺堟潈鏌ヨ閫夐」</param>
             /// <param name="status">涓嬫灦鍚庣姸鎬�</param>
+            /// <param name="clearLocation">鏄惁娓呯悊鍌ㄥ尯璐ф灦鍌ㄤ綅淇℃伅</param>
             /// <returns></returns>
-            public Result<TakeDownInfo> TakeDown(Inventory inventory, AuthOption option, WMS_ITEM.STATUSs status, bool clearLocation = true)
+            public Result<TakeDownInfo> TakeDown(IInventory inventory, AuthOption option, WMS_ITEM.STATUSs status, bool clearLocation = true)
             {
                 var result = new Result<TakeDownInfo>(Result.Flags.Success, new TakeDownInfo());
                 try
diff --git a/Tiger.Business.WMS/iWMS/RePrintBarcode.cs b/Tiger.Business.WMS/iWMS/RePrintBarcode.cs
index dd094ff..398db1f 100644
--- a/Tiger.Business.WMS/iWMS/RePrintBarcode.cs
+++ b/Tiger.Business.WMS/iWMS/RePrintBarcode.cs
@@ -20,11 +20,11 @@
     public class RePrintBarcode : IRePrintBarcode
     {
         #region Propertys & Variables
-        public static string UserCode { get; set; }
-        public static long UserId { get; set; }
-        public static string OrgCode { get; set; }
-        public static List<Inventory> invs { get; set; } = new();
-        public static Inventory CurInv { get; set; }
+        public string UserCode { get; set; }
+        public long UserId { get; set; }
+        public string OrgCode { get; set; }
+        public List<Inventory> invs { get; set; } = new();
+        public Inventory CurInv { get; set; }
         #endregion
         /// <summary>
         /// 琛ュ嵃鏉$爜
@@ -47,14 +47,14 @@
                 OrgCode = input.AuthOption.OrgCode;
 
                 //瑙f瀽鏉$爜
-                Result<Inventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
+                Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true);
                 if (!result.IsSuccessed)
                 {
                     action.IsSuccessed = false;
                     action.LocaleMsg = result.LocaleMsg;
                     return action;
                 }
-                CurInv = result.Data;
+                CurInv = result.Data as Inventory;
 
                 if (!CurInv.isExists)
                 {
@@ -289,14 +289,14 @@
                     return action;
                 }
                 //瑙f瀽鏉$爜
-                Result<Inventory> result = WMS_ITEM_Biz.WmsItem.Get(input.Barcode, new AuthOption { ByOrg = true, CurOrg = "DGXC", UserId = "admin" }, false);
+                Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.Barcode, new AuthOption { ByOrg = true, CurOrg = "DGXC", UserId = "admin" }, false);
                 if (!result.IsSuccessed)
                 {
                     action.IsSuccessed = false;
                     action.LocaleMsg = result.LocaleMsg;
                     return action;
                 }
-                var CurInv = result.Data;
+                var CurInv = result.Data as Inventory;
                 var newItem = CurInv.isExists ? CurInv.Items[0] : new WMS_ITEM()
                 {
                     AUTH_ORG = "DGXC",
diff --git a/Tiger.Business.WMS/iWMS/iWMS.Minsun.cs b/Tiger.Business.WMS/iWMS/iWMS.Minsun.cs
new file mode 100644
index 0000000..497a5c7
--- /dev/null
+++ b/Tiger.Business.WMS/iWMS/iWMS.Minsun.cs
@@ -0,0 +1,2090 @@
+锘縰sing Rhea.Common;
+using Tiger.Model;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using System.Linq;
+using Newtonsoft.Json;
+using Tiger.Model.Minsun;
+using System.Globalization;
+using System.Data;
+using System.Text.RegularExpressions;
+using Tiger.IBusiness;
+using Autofac;
+
+namespace Tiger.Business.WMS
+{
+    public partial class iWMS
+    {
+        /// <summary>
+        /// 閫氱敤鎵归噺鍏ュ簱
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        public static ApiAction MultiInStorageAsync(MultiInvInStorageInput input)
+        {
+            var action = new ApiAction();
+            try
+            {
+                string flag = "";
+                //淇濆瓨鍒版暟鎹簱
+                var db = Business.Biz.Db;
+                var dbTran = db.UseTran(() =>
+                {
+                    //鎻掑叆鎴栨洿鏂�  InvBarcode
+                    var x = db.Storageable(input.InvBarcodes)
+                       .WhereColumns(t => new { t.BARCODE })
+                       .ToStorage();
+                    x.AsInsertable.ExecuteCommand();
+                    x.AsUpdateable.IgnoreColumns(t => t.Id).ExecuteCommand();
+                    flag = "InvBarcode鏇存柊鎴愬姛";
+                    #region 鎻掑叆 InvStorageLotInfo
+                    var y = db.Storageable(input.InvStorageLotInfos)
+                       .WhereColumns(t => new { t.BARCODE })
+                       .ToStorage();
+                    y.AsInsertable.ExecuteCommand();
+                    y.AsUpdateable.IgnoreColumns(t => t.Id).ExecuteCommand();
+                    flag += "; InvStorageLotInfo鏇存柊鎴愬姛";
+                    #endregion
+
+                    #region 鎻掑叆 InvStorageInfo
+                    var z = db.Storageable(input.InvStorageInfos)
+                       .WhereColumns(t => new { t.WAREHOUSECODE, t.MATERIALCODE })
+                       .ToStorage();
+                    z.AsInsertable.ExecuteCommand();
+                    z.AsUpdateable.IgnoreColumns(t => t.Id).ExecuteCommand();
+                    #endregion
+                    flag += "; InvStorageInfo鏇存柊鎴愬姛";
+                    #region 鎻掑叆 InvScanMain 鍜� InvScanDetail
+
+                    var m = db.Storageable(input.InvScanMains)
+                        .ToStorage();
+                    m.AsInsertable.IgnoreColumns(t => t.LastModificationTime).ExecuteCommand();
+
+                    var o = db.Storageable(input.InvScanDetails)
+                        .WhereColumns(t => new { t.SCANMAINID, t.SOURCEDETAILLINE, t.WAREHOUSECODE, t.MATERIALCODE })
+                        .ToStorage();
+                    o.AsInsertable.ExecuteCommand();
+                    o.AsUpdateable.IgnoreColumns(t => t.Id).ExecuteCommand();
+                    #endregion
+                    flag += "; InvScanMain鏇存柊鎴愬姛";
+                    #region 鎻掑叆 InvBarcodeLog
+                    db.Insertable(input.InvBarcodeLogs).ExecuteCommand();
+                    #endregion
+                    flag += "; 鍏ュ簱鎴愬姛";
+                });
+                if (!dbTran.IsSuccess)
+                {
+                    action.IsSuccessed = false;
+                    action.Message = $"{flag} Error:{dbTran.ErrorException.Message}";
+                    action.Data = new MultiInvInStorageOutput
+                    {
+                        Message = $"{flag} Error:{dbTran.ErrorException.Message}",
+                        InvBarcodes = input.InvBarcodes
+                    };
+                    //throw dbTran.ErrorException;
+                }
+            }
+            catch (System.Exception ex)
+            {
+                action.CatchExceptionWithLog(ex, $"鍏ュ簱寮傚父");
+            }
+            action.Message = "OK";
+            action.Data = new MultiInvInStorageOutput
+            {
+                Message = "OK",
+                InvBarcodes = input.InvBarcodes
+            };
+            return action;
+        }
+
+        /// <summary>
+        /// 鑾峰緱鍒拌揣鍗曞畬鎴愪俊鎭�
+        /// </summary>
+        /// <param name="billcode"></param>
+        /// <param name="materialCode"></param>
+        /// <returns></returns>
+        public static string GetERP_RECEIPTTips(string billcode, string materialCode)
+        {
+            var tips = "";
+            var otherInDetails = Biz.Db.Queryable<BIZ_ERP_RECEIPT_SN>().Where(t => t.BILLCODE.ToUpper() == billcode.ToUpper()
+                                && t.ITEM_CODE.ToUpper() == materialCode.ToUpper()
+                                && t.STATUS <= WMS_ITEM.STATUSs.WaitIn.GetValue()).ToList();
+            //if (otherInDetails.Any())
+            {
+                tips += $"鏁伴噺锛歿otherInDetails.Sum(q => q.SCANQTY):N0}";
+            }
+            var otherInScanList = Biz.Db.Queryable<BIZ_ERP_RECEIPT_SN>().Where(t => t.BILLCODE.ToUpper() == billcode.ToUpper()
+                                && t.STATUS <= WMS_ITEM.STATUSs.WaitIn.GetValue()
+                                && t.ITEM_CODE.ToUpper() == materialCode.ToUpper()).ToList();
+            //if (otherInScanList.Any())
+            {
+                tips += $" ({otherInScanList.Count()} 鐩�)";
+            }
+            return tips;
+        }
+        /// <summary>
+        /// 鑾峰緱鍒拌揣鍗曞畬鎴愪俊鎭�
+        /// </summary>
+        /// <param name="billcode"></param>
+        /// <param name="materialCode"></param>
+        /// <returns></returns>
+        public static string GetERP_ReturnTips(string billcode, string materialCode)
+        {
+            var tips = "";
+            var otherInDetails = Biz.Db.Queryable<BIZ_ERP_PROD_RETURN_SN>().Where(t => t.BUSINESSCODE.ToUpper() == billcode.ToUpper()
+                                //&& t.ITEM_CODE.ToUpper() == materialCode.ToUpper()
+                                && t.STATUS <= WMS_ITEM.STATUSs.WaitIn.GetValue()).ToList();
+            //if (otherInDetails.Any())
+            {
+                tips += $"鏁伴噺锛歿otherInDetails.Sum(q => q.QTY):N0}";
+            }
+            var otherInScanList = Biz.Db.Queryable<BIZ_ERP_PROD_RETURN_SN>().Where(t => t.BUSINESSCODE.ToUpper() == billcode.ToUpper()
+                                && t.STATUS <= WMS_ITEM.STATUSs.WaitIn.GetValue()
+                                //&& t.ITEM_CODE.ToUpper() == materialCode.ToUpper()
+                                ).ToList();
+            //if (otherInScanList.Any())
+            {
+                tips += $" ({otherInScanList.Count()} 鐩�)";
+            }
+            return tips;
+        }
+
+        /// <summary>
+        /// 鑾峰緱鍏朵粬鍏ュ簱鍗曞畬鎴愪俊鎭�
+        /// </summary>
+        /// <param name="billcode"></param>
+        /// <param name="materialCode"></param>
+        /// <returns></returns>
+        public static string GetERP_OTH_INTips(string billcode, string materialCode)
+        {
+            var tips = "";
+            var otherInDetails = Biz.Db.Queryable<BIZ_ERP_OTH_IN_DTL>().Where(t => t.BILLCODE.ToUpper() == billcode.ToUpper()
+                                && t.ITEM_CODE.ToUpper() == materialCode.ToUpper()
+                                && t.LINESTATUS == BIZ_ERP_OTH_IN.STATUSs.WORKING.GetValue()).OrderBy(t => new { t.BILLCODE, t.BILLLINE }).ToList();
+            //if (otherInDetails.Any())
+            {
+                tips += $"鏁伴噺锛歿otherInDetails.Sum(q => q.PRQTY - q.QTY):N0}";
+            }
+            var otherInScanList = Biz.Db.Queryable<BIZ_ERP_OTH_IN_SN>().Where(t => t.BUSINESSCODE.ToUpper() == billcode.ToUpper()
+                                && t.STATUS <= WMS_ITEM.STATUSs.WaitIn.GetValue()
+                                && t.ITEM_CODE.ToUpper() == materialCode.ToUpper()).ToList();
+            //if (otherInScanList.Any())
+            {
+                tips += $" ({otherInScanList.Count()} 鐩�)";
+            }
+            return tips;
+        }
+        /// <summary>
+        /// 鑾峰緱鍏朵粬鍏ュ簱鍗曞畬鎴愪俊鎭�
+        /// </summary>
+        /// <param name="billcode"></param>
+        /// <param name="materialCode"></param>
+        /// <returns></returns>
+        public static string GetFinishedTips(string billcode, string materialCode)
+        {
+            var tips = "";
+            var otherInDetails = Biz.Db.Queryable<BIZ_ERP_PROD_IN_DTL>().Where(t => t.BILLCODE.ToUpper() == billcode.ToUpper()
+                                && t.ITEM_CODE.ToUpper() == materialCode.ToUpper()
+                                && t.LINESTATUS == BIZ_ERP_OTH_IN.STATUSs.WORKING.GetValue()).OrderBy(t => new { t.BILLCODE, t.BILLLINE }).ToList();
+            //if (otherInDetails.Any())
+            {
+                tips += $"鏁伴噺锛歿otherInDetails.Sum(q => q.PRQTY - q.INVENTORYQTY):N0}";
+            }
+            var otherInScanList = Biz.Db.Queryable<BIZ_ERP_PROD_IN_SN>().Where(t => t.BUSINESSCODE.ToUpper() == billcode.ToUpper()
+                                && t.STATUS <= WMS_ITEM.STATUSs.WaitIn.GetValue()
+                                && t.ITEM_CODE.ToUpper() == materialCode.ToUpper()).ToList();
+            //if (otherInScanList.Any())
+            {
+                tips += $" ({otherInScanList.Count()} 鐩�)";
+            }
+            return tips;
+        }
+        /// <summary>
+        /// 鑾峰緱鍏朵粬鍏ュ簱鍗曞畬鎴愪俊鎭�
+        /// </summary>
+        /// <param name="billcode"></param>
+        /// <param name="materialCode"></param>
+        /// <returns></returns>
+        public static string GetBIZ_ERP_PROD_INips(string billcode)
+        {
+            var tips = "";
+            //var otherInDetails = Biz.Db.Queryable<BIZ_ERP_OTH_IN_DTL>().Where(t => t.BILLCODE.ToUpper() == billcode.ToUpper()
+            //                    && t.ITEM_CODE.ToUpper() == materialCode.ToUpper()
+            //                    && t.LINESTATUS == BIZ_ERP_OTH_IN.STATUSs.WORKING.GetValue()).OrderBy(t => new { t.BILLCODE, t.BILLLINE }).ToList();
+            ////if (otherInDetails.Any())
+            //{
+            //    tips += $"鏁伴噺锛歿otherInDetails.Sum(q => q.PRQTY - q.QTY):N0}";
+            //}
+            var otherInScanList = Biz.Db.Queryable<BIZ_ERP_PROD_IN_SN>().Where(t => t.BUSINESSCODE.ToUpper() == billcode.ToUpper()
+                                && t.STATUS <= WMS_ITEM.STATUSs.WaitIn.GetValue()).ToList();
+            //if (otherInScanList.Any())
+            {
+                tips += $" 鎬绘暟锛�({otherInScanList.Count()})";
+            }
+            return tips;
+        }
+        /// <summary>
+        /// 鑾峰緱瀹屾垚淇℃伅
+        /// </summary>
+        /// <param name="billcode"></param>
+        /// <param name="materialCode"></param>
+        /// <returns></returns>
+        public static string GetIncompleteTips(string billcode, string materialCode)
+        {
+            var tips = "";
+            var otherInDetails = Biz.Db.Queryable<WMS_OTHERINSTOCK_D>().Where(t => t.BILLCODE.ToUpper() == billcode.ToUpper()
+                                && t.MATERIALCODE.ToUpper() == materialCode.ToUpper()
+                                && t.LINESTATUS == OtherInstockSides.Status.WORKING.ToString()).OrderBy(t => new { t.BILLCODE, t.BILLLINE }).ToList();
+            if (otherInDetails.Any())
+            {
+                tips += $"鏁伴噺锛歿otherInDetails.Sum(q => q.PRQTY - q.QTY):N0}";
+            }
+            var otherInScanList = Biz.Db.Queryable<WMS_OTHERINSTOCK_SCAN>().Where(t => t.BUSINESSCODE.ToUpper() == billcode.ToUpper()
+                                && t.MATERIALCODE.ToUpper() == materialCode.ToUpper()).OrderBy(t => new { t.BUSINESSCODE, t.BUSINESSLINE }).ToList();
+            if (otherInScanList.Any())
+            {
+                tips += $" ({otherInScanList.Count()} 鐩�)";
+            }
+            return tips;
+        }
+
+        /// <summary>
+        /// 瀹緵鏂欏叆搴撳畬鎴愪俊鎭�
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        public async Task<CustSupplyInOutput> CustSupplyInIncompleteList(CustSupplyIncompleteInput input)
+        {
+            var otherInScanList = await Biz.Db.Queryable<WMS_OTHERINSTOCK_SCAN>()
+                        .Where(t => t.BUSINESSCODE.ToUpper() == input.receiptNo.ToUpper()
+                                && t.MATERIALCODE.ToUpper() == input.materialCode.ToUpper())
+                        .ToListAsync();
+            var incompleteList = otherInScanList.OrderBy(q => q.STATUS == "Billed" ? 1 : (q.STATUS == "Complete" ? 3 : 2))
+                .Select(q => new
+                {
+                    Barcode = q.BARCODE,
+                    Qty = (int)q.QTY,
+                    Status = q.STATUS == "Billed" ? "寰呭叆搴�" : (q.STATUS == "Complete" ? "宸插叆搴�" : $"鍏朵粬({q.STATUS})")
+                });
+            return new CustSupplyInOutput() { result = JsonConvert.SerializeObject(incompleteList) };
+        }
+
+        /// <summary>
+        /// 鐗╂枡鍖呰绠$悊	鐗╂枡鍖呰灞傜骇:灏忓寘褰掑睘浜庡摢涓腑鍖呫�佷腑鍖呭綊灞炰簬鍝釜澶栧寘  wms_barcode 鏈�
+        /// </summary>
+        /// <param name="sn"></param>
+        /// <returns></returns>
+        public List<iPackageInfo> GetPackageInfo(string sn)
+        {
+            var query = new List<iPackageInfo>();
+            return query;
+        }
+
+        /// <summary>
+        /// 鐗╂枡鍏ュ簱淇℃伅	鐗╂枡鍚嶇О銆佺墿鏂欎唬鐮併�佺墿鏂欎緵搴斿晢銆佹暟閲忋�佸簱浣嶃�佸偍浣嶃�佹壒娆°�佸叆搴撴椂闂�
+        /// </summary>
+        /// <param name="param"></param>
+        /// <returns></returns>
+        public List<iInStoreInfo> GetInStoreInfo(iParams param)
+        {
+            var query = Biz.Db.Queryable<WMS_STORAGELOTINFO, WMS_BARCODE, WMS_BARCODE_LOG, WMS_MesMaterial>((t, b, l, m) =>
+                                new JoinQueryInfos(
+                                    JoinType.Left, t.BARCODE == b.BARCODE,
+                                    JoinType.Left, t.BARCODE == l.BARCODE,
+                                    JoinType.Left, t.MATERIALCODE == m.MCode
+                                    ))
+            .Where((t, b, l, m) => l.INOUTTYPE == 10)
+            .WhereIF(!string.IsNullOrEmpty(param.sn), (t, b, l, m) => t.BARCODE == param.sn)
+            .WhereIF(!string.IsNullOrEmpty(param.startDate), (t, b, l, m) => l.CreationTime >= Convert.ToDateTime(param.startDate))
+            .WhereIF(!string.IsNullOrEmpty(param.endDate), (t, b, l, m) => l.CreationTime < Convert.ToDateTime(param.endDate))
+            .Select((t, b, l, m) => new iInStoreInfo
+            {
+                sn = t.BARCODE,
+                MaterialCode = t.MATERIALCODE,
+                MaterialName = m.MDesc,
+                VendorCode = b.SUPPLIERCODE,
+                WarehouseCode = t.WAREHOUSECODE,
+                LocationCode = t.LOCATIONCODE,
+                LotNo = b.LOTNO,
+                SourceCode = b.SOURCEBARCODE,
+                QTY = t.QTY,
+                CreateDate = l.CreationTime,
+                UpdateDate = l.LastModificationTime
+            })
+            .ToList();
+            return query;
+        }
+
+        /// <summary>
+        /// 鐗╂枡鍑哄簱淇℃伅	棰嗘枡鍗曞彿銆侀鏂欐枡鍙枫�佹暟閲忋�佸簱浣嶃�佸偍浣嶃�佸嚭搴撴椂闂�   
+        /// </summary>
+        /// <param name="param"></param>
+        /// <returns></returns>
+        public List<iOutStoreInfo> GetOutStoreInfo(iParams param)
+        {
+            var query = Biz.Db.Queryable<WMS_BARCODE_LOG, WMS_MesMaterial>((t, m) =>
+                                new JoinQueryInfos(
+                                    JoinType.Left, t.MATERIALCODE == m.MCode
+                                    ))
+            .Where((t, m) => t.INOUTTYPE == 20 && !SqlFunc.IsNullOrEmpty(t.BILLCODE))
+            .WhereIF(!string.IsNullOrEmpty(param.sn), (t, m) => t.BARCODE == param.sn)
+            .WhereIF(!string.IsNullOrEmpty(param.startDate), (t, m) => t.CreationTime >= Convert.ToDateTime(param.startDate))
+            .WhereIF(!string.IsNullOrEmpty(param.endDate), (t, m) => t.CreationTime < Convert.ToDateTime(param.endDate))
+            .Select((t, m) => new iOutStoreInfo
+            {
+                sn = t.BARCODE,
+                MaterialCode = t.MATERIALCODE,
+                MaterialName = m.MDesc,
+                WarehouseCode = t.WAREHOUSECODE,
+                LocationCode = t.LOCATIONCODE,
+                BillCode = t.BILLCODE,
+                QTY = t.QTY,
+                CreateDate = t.CreationTime,
+                UpdateDate = t.LastModificationTime
+            })
+            .ToList();
+            return query;
+        }
+
+        /// <summary>
+        /// 鐗╂枡閫�鏂欎俊鎭�	閫�鏂欐枡鍙枫�侀��鏂欐椂闂淬�侀��鏂欐潯鐮併�侀��鏂欏簱浣嶃�佺О閲嶆竻鐐圭粨鏋�  
+        /// </summary>
+        /// <param name="param"></param>
+        /// <returns></returns>
+        public List<iReturnInfo> GetReturnInfo(iParamsBase param)
+        {
+            var query = Biz.Db.Queryable<WMS_BARCODE_LOG, WMS_MesMaterial>((t, m) =>
+                                new JoinQueryInfos(
+                                    JoinType.Left, t.MATERIALCODE == m.MCode
+                                    ))
+                .Where(t => t.SOURCEBILLTYPE == 25)
+                .WhereIF(!string.IsNullOrEmpty(param.startDate), (t, m) => t.CreationTime >= Convert.ToDateTime(param.startDate))
+                .WhereIF(!string.IsNullOrEmpty(param.endDate), (t, m) => t.CreationTime < Convert.ToDateTime(param.endDate))
+                .Select((t, m) => new iReturnInfo
+                {
+                    sn = t.BARCODE,
+                    MaterialCode = t.MATERIALCODE,
+                    MaterialName = m.MDesc,
+                    WarehouseCode = t.WAREHOUSECODE,
+                    CreateDate = t.CreationTime
+                })
+                .ToList();
+            return query;
+        }
+
+        /// <summary>
+        /// 鐗╂枡搴撳瓨淇℃伅
+        /// </summary>
+        /// <param name="param"></param>
+        /// <returns></returns>
+        public List<iStorageInfo> GetStorageInfo(iParamsBase param)
+        {
+            var query = Biz.Db.Queryable<WMS_STORAGELOTINFO, WMS_BARCODE, WMS_MesMaterial, MesVender>((t, b, m, v) =>
+                                new JoinQueryInfos(
+                                    JoinType.Left, t.BARCODE == b.BARCODE,
+                                    JoinType.Left, t.MATERIALCODE == m.MCode,
+                                    JoinType.Left, b.SUPPLIERCODE == v.VenderCode
+                                    ))
+            .WhereIF(!string.IsNullOrEmpty(param.startDate), (t, b, m, v) => t.CreationTime >= Convert.ToDateTime(param.startDate))
+            .WhereIF(!string.IsNullOrEmpty(param.endDate), (t, b, m, v) => t.CreationTime < Convert.ToDateTime(param.endDate))
+            .Select((t, b, m, v) => new iStorageInfo
+            {
+                MaterialCode = t.MATERIALCODE,
+                MaterialName = m.MDesc,
+                VenderCode = b.SUPPLIERCODE,
+                VenderName = v.VenderName,
+                Unit = m.MUom,
+                QTY = t.QTY,
+                UpdateDate = t.LastModificationTime ?? t.CreationTime
+            })
+            .ToList();
+            return query;
+        }
+
+        /// <summary>
+        /// 澶囨枡鍒嗗寘瑁呬俊鎭�	鎷嗗寘澶囨枡锛岄噸鏂扮粍鍖呯殑鍖呰鍙峰叧绯伙細鎷嗗寘缂栧彿銆佺粍鍖呭悗缂栧彿銆佺粍鍖呭悗鏁伴噺銆佸棰嗘枡鍗曞彿銆佹枡鍙�
+        /// </summary>
+        /// <param name="param"></param>
+        /// <returns></returns>
+        public List<iSplitInfo> GetSplitInfo(iParams param)
+        {
+            var query = Biz.Db.Queryable<WMS_BARCODE, WMS_MesMaterial>((t, m) =>
+                                new JoinQueryInfos(
+                                    JoinType.Left, t.MATERIALCODE == m.MCode
+                                    ))
+            .WhereIF(!string.IsNullOrEmpty(param.sn), (t, m) => t.BARCODE.Contains(param.sn))
+            .WhereIF(!string.IsNullOrEmpty(param.startDate), (t, m) => t.CreationTime >= Convert.ToDateTime(param.startDate))
+            .WhereIF(!string.IsNullOrEmpty(param.endDate), (t, m) => t.CreationTime < Convert.ToDateTime(param.endDate))
+            .Select((t, m) => new iSplitInfo
+            {
+                sn = t.BARCODE,
+                MaterialCode = t.MATERIALCODE,
+                MaterialName = m.MDesc,
+                ParentBoxBarcode = t.PARENTBOXBARCODE,
+                SourceCode = t.SOURCECODE,
+                QTY = t.PACKQTY,
+                UpdateDate = t.LastModificationTime
+            })
+            .ToList();
+            return query;
+        }
+
+        private static readonly IReceiptInfo _IReceiptInfo = BizContext.Container.Resolve<IReceiptInfo>();
+        /// <summary>
+        /// 鍒拌揣鍗曠敓鎴愭帴鍙�	娓呯偣绯荤粺 --> wms,  鎺ュ彛闇�wms瀹氫箟
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        public ApiAction GenerateReceipt(iReceiptInput input)
+        {
+            var action = new ApiAction();
+            bool isIQCOk = true;
+            try
+            {
+                string msg = "";
+                if (!input.iReceipts.Any())
+                {
+                    action.IsSuccessed = false;
+                    msg += $"{msg.IsNullOrEmpty("", "锛�")}娌℃湁鍙互鎻愪氦鐨勬竻鐐规暟鎹�";
+                    action.Message = msg;
+                    return action;
+                }
+
+                var judian = BizConfig.Configuration["JuDian"];
+                var requestJson = JsonConvert.SerializeObject(input);
+                var response = HttpHelper.PostAsync("http://172.18.8.56:9631/api/WMS/GenerateReceiptNew/", requestJson).Result;
+                action = JsonConvert.DeserializeObject<ApiAction>(response.Message);
+                return action;
+                //if (input.StrongHold != judian)
+                //{
+                //    var requestJson = JsonConvert.SerializeObject(input);
+                //    //if (input.StrongHold == "AHXC")
+                //    //{
+                //    //    var response = HttpHelper.PostAsync("http://172.18.8.56:9529/api/WMS/GenerateReceipt", requestJson).Result;
+                //    //    action = JsonConvert.DeserializeObject<ApiAction>(response.Message);
+                //    //    return action;
+                //    //}
+                //    if (input.StrongHold == "DGXC" || input.StrongHold == "AHXC")
+                //    {
+                //        //return _IReceiptInfo.GenerateReceipt(input); 
+
+                //        var response = HttpHelper.PostAsync("http://172.18.8.56:9631/api/WMS/GenerateReceiptNew/", requestJson).Result;
+                //        action = JsonConvert.DeserializeObject<ApiAction>(response.Message);
+                //        return action;
+                //    }
+                //    if (input.StrongHold == "XCSJ")
+                //    {
+                //        var response = HttpHelper.PostAsync("http://172.18.8.56:9527/api/WMS/GenerateReceipt/", requestJson).Result;
+                //        action = JsonConvert.DeserializeObject<ApiAction>(response.Message);
+                //        return action;
+                //    }
+                //}
+                var usercode = "00000";
+                switch (input.CompanyCode)
+                {
+                    case "XCQX":
+                        usercode = "LX0001";
+                        break;
+                    case "XCHF":
+                        usercode = "AA0001";
+                        break;
+                    case "XCTH":
+                        //usercode = "AA0001";
+                        break;
+                    case "XCTX":
+                        usercode = "TA0001";
+                        break;
+                }
+                //寰呮彁浜ゆ暟鎹寜鏉ユ簮鍗曞彿鍒嗙粍锛圓SN/PO锛�
+                var srcBills = input.iReceipts
+                        .Select(p => new { BillCode = p.DeliveryNo })
+                        .GroupBy(p => p.BillCode)
+                        .ToList();
+                List<WMS_RECEIPT_H> receiptHeaders = new List<WMS_RECEIPT_H>();
+                List<WMS_RECEIPT_D> receiptDetails = new List<WMS_RECEIPT_D>();
+                List<WMS_RECEIPT_SCAN> receiptScans = new List<WMS_RECEIPT_SCAN>();
+                List<Detail> details = new List<Detail>();
+                List<WMS_IQC_H> iqcHeaders = new List<WMS_IQC_H>();
+                List<WMS_PO_D> poDetails = new List<WMS_PO_D>();
+                int billid = 1;
+                foreach (var srcBill in srcBills)
+                {
+                    var asnHeader = Biz.Db.Queryable<WMS_SRM_ASN>().Where(x => x.DeliveryNo == srcBill.Key).First();
+                    if (asnHeader == null)
+                    {
+                        action.IsSuccessed = false;
+                        msg += $"{msg.IsNullOrEmpty("", "锛�")}SRM涓煡涓嶅埌鏁版嵁";
+                        action.Message = msg;
+                        return action;
+                    }
+                    //鑾峰彇ASN琛屾槑缁�
+                    var asnLines = Biz.Db.Queryable<WMS_SRM_ASN_LINES>().Where(x => x.DeliveryNo == srcBill.Key).ToList();
+                    if (asnLines == null)
+                    {
+                        action.IsSuccessed = false;
+                        msg += $"{msg.IsNullOrEmpty("", "锛�")}SRM涓煡涓嶅埌ASN琛屾槑缁�";
+                        action.Message = msg;
+                        return action;
+                    }
+                    var asnBarcodeList = Biz.Db.Queryable<WMS_SRMSNList>().Where(x => x.DeliveryNo == srcBill.Key).ToList();
+                    if (asnBarcodeList == null)
+                    {
+                        action.IsSuccessed = false;
+                        msg += $"{msg.IsNullOrEmpty("", "锛�")}SRM涓煡涓嶅埌ASN琛屾槑缁�";
+                        action.Message = msg;
+                        return action;
+                    }
+
+                    if (asnBarcodeList.Count > input.iReceipts.Where(x => x.DeliveryNo == srcBill.Key).ToList().Count)
+                    {
+                        action.IsSuccessed = false;
+                        msg += $"{msg.IsNullOrEmpty("", "锛�")}閫佽揣鍗昜{srcBill.Key}]杩樻湁鏉$爜鏈壂鎻忔竻鐐癸紝涓嶈兘鐢熸垚鍒拌揣鍗�";
+                        action.Message = msg;
+                        return action;
+                    }
+                    if (Biz.Db.Queryable<WMS_RECEIPT_SCAN>().Where(x => x.BILLCODE == srcBill.Key).Any())
+                    {
+                        action.IsSuccessed = false;
+                        msg += $"{msg.IsNullOrEmpty("", "锛�")}閫佽揣鍗昜{srcBill.Key}]宸茬粡鎵弿杩囦笉鑳藉啀鎵弿";
+                        action.Message = msg;
+                        return action;
+                    }
+                    List<string> asnLinesNum = new List<string>();
+                    asnLinesNum = asnLines.Select(x => x.productCode).Distinct().ToList();
+
+                    List<string> tempBarcodesNum = new List<string>();
+                    tempBarcodesNum = input.iReceipts.Where(x => x.DeliveryNo == srcBill.Key).ToList().Select(x => x.MaterialCode).Distinct().ToList();
+
+                    if (asnLinesNum.Count > tempBarcodesNum.Count)
+                    {
+                        action.IsSuccessed = false;
+                        msg += $"{msg.IsNullOrEmpty("", "锛�")}閫佽揣鍗昜{srcBill.Key}]杩樻湁鏂欏彿鏈壂鎻忔竻鐐癸紝涓嶈兘鐢熸垚鍒拌揣鍗�";
+                        return action;
+                    }
+
+                    msg += $"{msg.IsNullOrEmpty("", "锛�")}閫佽揣鍗昜{srcBill.Key}]鎬绘暟[{asnBarcodeList.Count}]锛屾壂鎻忔�绘暟[{input.iReceipts.Where(x => x.DeliveryNo == srcBill.Key).ToList().Count}]";
+
+                    // 鐢熸垚鏀舵枡鍗�
+                    // 鏂板缓涓�涓� Header 
+                    var nReceiptHeader = new WMS_RECEIPT_H
+                    {
+                        BILLCODE = GetBillNoByType("RECEIPT"),
+                        BILLDATE = DateTime.Now,
+                        STATUS = (int)WMS_RECEIPT_H.ReceiptStatus.Add,
+                        BIZTYPE = (int)WMS_RECEIPT_H.ReceiptBizType.PO,
+                        SUPPLIERCODE = asnHeader.innerVendorCode,
+                        CreationTime = DateTime.Now,
+                        CreatorUserId = 1
+                    };
+                    var nHeaderId = Biz.Db.Insertable(nReceiptHeader).ExecuteReturnBigIdentity();
+                    nReceiptHeader.Id = nHeaderId;
+
+                    // 鐢熸垚鏀舵枡鍗曡鏄庣粏
+                    var nLineSeq = 1;
+                    foreach (var asnLine in asnLines)
+                    {
+                        //璁㈠崟鐗╂枡琛�(鍞竴)
+                        int poline = Convert.ToInt32(asnLine.poLineNo.Split('-')[0]);
+                        var nOrderDetail = Biz.Db.Queryable<WMS_PO_D>().Where(x => x.BILLCODE.ToUpper() == asnLine.poErpNo.ToUpper() && x.BILLLINE == poline).First();
+                        if (asnBarcodeList == null)
+                        {
+                            action.IsSuccessed = false;
+                            msg += $"{msg.IsNullOrEmpty("", "锛�")}璁㈠崟涓煡涓嶅埌鏁版嵁";
+                            return action;
+                        }
+                        nOrderDetail.ARRIVALQTY = (nOrderDetail.ARRIVALQTY ?? 0) + asnLine.deliveryQty;
+                        poDetails.Add(nOrderDetail);
+
+                        //鎻掑叆鏀舵枡鍗曡
+                        var nReceiptDetail = new WMS_RECEIPT_D
+                        {
+                            BILLCODE = nReceiptHeader.BILLCODE,
+                            BILLLINE = nLineSeq++,
+                            BILLID = nHeaderId,
+                            LINESTATUS = (int)WMS_RECEIPT_H.ReceiptLineStatus.Add,
+                            MATERIALCODE = asnLine.productCode,
+                            UNITCODE = "",
+                            QTY = asnLine.deliveryQty,
+                            QTYPASS = 0,
+                            INSTOCKQTY = 0,
+                            RETURNQTY = 0,
+                            PRINTQTY = 0,
+                            ISGIVEAWAY = false,
+                            SOURCETYPE = (int)WMS_RECEIPT_H.SourceType.Asn,
+                            SOURCECODE = asnLine.DeliveryNo,
+                            SOURCELINE = string.IsNullOrEmpty(asnLine.extendN01) ? asnLine.lineNo : Convert.ToInt32(asnLine.extendN01 ?? "0"), //asnLine.lineNo,
+                            PONO = asnLine.poErpNo,
+                            POLINE = poline,
+                            LastModificationTime = DateTime.Now,
+                            CreationTime = DateTime.Now,
+                            CreatorUserId = 1
+                        };
+                        receiptDetails.Add(nReceiptDetail);
+                        details.Add(new Detail
+                        {
+                            pmdtseq = nLineSeq.ToString(),
+                            pmdt001 = string.IsNullOrEmpty(nReceiptDetail.PONO) ? asnLine.DeliveryNo : asnLine.poErpNo,
+                            pmdt002 = asnLine.lineNo.ToString(), //string.IsNullOrEmpty(nReceiptDetail.PONO) ? asnLine.lineNo.ToString() : poline.ToString(), 閲囪喘椤规
+                            pmdt003 = "1",
+                            pmdt004 = asnLine.poLineNo.Split('-').Length > 2 ? asnLine.poLineNo.Split('-')[2] : (asnLine.poLineNo ?? "1"), //閲囪喘鍒嗘壒搴�
+                            pmdt006 = asnLine.productCode, //"K7015AA016141",
+                                                           //pmdt018 = "鍒涚背绉戞妧",
+                            pmdt020 = asnLine.deliveryQty.ToString(),  //"100.00000",
+                            pmdtud011 = "0"
+                        });
+
+                        //鍒涘缓閫佹鍗�
+                        Result<WMS_IQC_H> result = CreateIqcHeader(nReceiptDetail, "Y", Biz.Db);
+                        if (result.Flag != Result.Flags.Success)
+                        {
+                            action.IsSuccessed = false;
+                            action.Message = result.Message;
+                            return action;
+                        }
+                        iqcHeaders.Add(result.Data);
+                        billid++;
+                    }
+
+                    //var asnScanTemp = await _tempRepository.GetAll().Where(x => x.CreatorUserId == (AbpSession.UserId ?? 0) && x.BillCode.ToUpper() == srcBill.Key.ToUpper()).ToListAsync();
+                    foreach (var scanTemp in input.iReceipts.Where(x => x.DeliveryNo == srcBill.Key).ToList())
+                    {
+                        WMS_RECEIPT_SCAN scanObj = new WMS_RECEIPT_SCAN
+                        {
+                            Id = Guid.NewGuid().ToString(),
+                            BILLCODE = scanTemp.DeliveryNo,
+                            BILLLINE = 0,
+                            SOURCETYPE = (int)WMS_RECEIPT_H.SourceType.Asn,
+                            MATERIALCODE = scanTemp.MaterialCode,
+                            BARCODE = scanTemp.SmallBarcode,
+                            SCAN_BARCODE = scanTemp.SCAN_BARCODE,
+                            CARTON = scanTemp.BigBarcode,
+                            PALLET = scanTemp.OuterBarcode,
+                            SUPPLIERCODE = scanTemp.innerVendorCode,
+                            DATECODE = DateTime.Now,
+                            //LOTNO = scanTemp.LotNo,
+                            SCANQTY = scanTemp.SCANQTY,
+                            //UNIT = scanTemp.Unit,
+                            //ISGIVEAWAY = scanTemp.IsGiveAway,
+                            RECEIPTNO = nReceiptHeader.BILLCODE,
+                            RECEIPTLINE = 0,
+                            STATEFLAG = WMS_RECEIPT_H.ReceiptLineStatus.PreInstock.ToString(),
+                            LastModificationTime = DateTime.Now,
+                            CreationTime = DateTime.Now,
+                            CreatorUserId = 1
+                        };
+                        receiptScans.Add(scanObj);
+                    }
+
+                    //璋冪敤T100鎺ュ彛鐢熸垚鍒拌揣鍗�
+                    var ret = ErpT100.GenerateCustReceipt(new CustReceiptInputParameter
+                    {
+                        parameter = new Parameter<Detail>
+                        {
+                            pmds000 = "1",
+                            pmdsdocno = "3438",
+                            pmdsdocdt = DateTime.Now.ToString("yyyy-MM-dd"), //"2023-04-26", //褰撳ぉ鏃堕棿
+                            pmds002 = usercode, // "00000", //UserCode == "admin" ? "00000" : UserCode, //"L36783", //鐢ㄦ埛ID
+                            pmds003 = "",
+                            pmds007 = nReceiptHeader.SUPPLIERCODE, //"C0006", //渚涘簲鍟嗕唬鐮�
+                            pmds010 = srcBill.Key, //"娴嬭瘯瀹緵鏂欐棤閲囪喘鏀惰揣", //閫佽揣鍗曞彿
+                                                   //pmdsud001 = SecondVenderCode, //"CM017", //浜岀骇渚涘簲缂栧彿
+                            detail = details
+                        },
+                        datakey = new Datakey
+                        {
+                            EntId = ApiConfig.IsTestServer ? "108" : "88",
+                            CompanyId = input.StrongHold
+                        }
+                    });
+                    if (ret.payload.std_data.execution.code == "0") //鎴愬姛
+                    {
+                        nReceiptHeader.ERP_BILL_CODE = ret.payload.std_data.parameter.docno;
+                        nReceiptHeader.STATUS = 3;
+                        receiptHeaders.Add(nReceiptHeader);
+                        action.Message += $"{action.Message.IsNullOrEmpty("", "锛�")}{ret.payload.std_data.execution.description}锛岃繑鍥炵殑鏀惰揣鍗曞彿锛歔{ret.payload.std_data.parameter.docno}]";
+
+                        #region 鐢熸垚閫佹鍗�
+                        foreach (var item in iqcHeaders)
+                        {
+                            var retIns = ErpT100.GenerateInspection(new InsInputParameter
+                            {
+                                parameter = new InsParameter
+                                {
+                                    pmdsdocno = ret.payload.std_data.parameter.docno,
+                                    pmdsdocdt = DateTime.Now.ToString("yyyy-MM-dd"),
+                                    pmdtseq = item.SOURCELINE.ToString(),
+                                    pmdt020 = item.QCQTY.ToString(),
+                                    qcbadocno = "3701",
+                                },
+                                datakey = new Datakey
+                                {
+                                    EntId = ApiConfig.IsTestServer ? "108" : "88",
+                                    CompanyId = input.StrongHold
+                                }
+                            });
+                            if (retIns.payload.std_data.execution.code != "0")
+                            {
+                                isIQCOk = false;
+                                action.IsSuccessed = false;
+                                action.Message = $"鍒拌揣鍗昜{ret.payload.std_data.parameter.docno}]锛屽綋鍓嶇敤鎴穂{usercode}]锛屼緵搴斿晢缂栧彿[{nReceiptHeader.SUPPLIERCODE}]锛岃繑鍥炵殑淇℃伅:{retIns.payload.std_data.execution.description}"; ;
+                                //return action;
+                            }
+                            else
+                            {
+                                action.Message += $"鍒拌揣鍗昜{ret.payload.std_data.parameter.docno}]锛屽綋鍓嶇敤鎴穂{usercode}]锛屼緵搴斿晢缂栧彿[{nReceiptHeader.SUPPLIERCODE}]锛岃繑鍥炵殑淇℃伅:{retIns.payload.std_data.execution.description}";
+                                item.ERP_BILL_CODE = retIns.payload.std_data.parameter.docno;
+                            }
+                        }
+                        #endregion
+                    }
+                    else //澶辫触
+                    {
+                        action.IsSuccessed = false;
+                        action.Message = $"褰撳墠鐢ㄦ埛[{usercode}]锛屼緵搴斿晢缂栧彿[{nReceiptHeader.SUPPLIERCODE}]锛岃繑鍥炵殑淇℃伅:{ret.payload.std_data.execution.description}";
+                        return action;
+                    }
+                }
+                var db = Business.Biz.Db;
+                //淇濆瓨鍒版暟鎹簱
+                var dbTran = db.UseTran(() =>
+                {
+                    if (receiptHeaders.Any())
+                    {
+                        db.Updateable(receiptHeaders, "system").ExecuteCommand();
+                    }
+                    if (poDetails.Any())
+                    {
+                        db.Updateable(poDetails, "system").ExecuteCommand();
+                    }
+                    if (receiptDetails.Any())
+                    {
+                        db.Insertable(receiptDetails, "system").ExecuteCommand();
+                    }
+                    if (receiptScans.Any())
+                    {
+                        db.Insertable(receiptScans, "system").ExecuteCommand();
+                    }
+                    if (action.IsSuccessed && isIQCOk)
+                    {
+                        db.Insertable(iqcHeaders).ExecuteCommand();
+                    }
+                });
+                if (!dbTran.IsSuccess)
+                {
+                    if (receiptHeaders.Any())
+                    {
+                        db.Deleteable(receiptHeaders).ExecuteCommand();
+                    }
+                    action.GetResponse().CatchExceptionWithLog(dbTran.ErrorException, $"鍒拌揣鍗曠敓鎴愬紓甯�");
+                }
+                action.Message += $"{msg.IsNullOrEmpty("", "锛�")}鍒拌揣鍗曞拰閫佹鍗曠敓鎴愭垚鍔燂紒";
+                return action;
+            }
+            catch (Exception ex)
+            {
+                return action.GetResponse().CatchExceptionWithLog(ex, $"鍒拌揣鍗曠敓鎴愬紓甯�");
+            }
+        }
+
+        private static readonly IProdMaterialReq _IProdMaterialReq = BizContext.Container.Resolve<IProdMaterialReq>();
+        /// <summary>
+        /// 鑾峰彇T100棰嗘枡鍗曟暟鎹�
+        /// </summary>
+        /// <param name="prd_hs"></param>
+        /// <returns></returns>
+        public ApiAction GetMaterialReq(List<WMS_PRDPICK_H> prd_hs)
+        {
+            var action = new ApiAction();
+            try
+            {
+                if (prd_hs.Count > 0)
+                {
+                    Work.DoAsync(() =>
+                    {
+                        Logger.Interface.Info($"寮�濮嬪紓姝ユ帹閫佸埌鏂版暟鎹簱");
+                        _IProdMaterialReq.GetMaterialReq(prd_hs);
+                    });
+                    return action;
+                    //var judian = BizConfig.Configuration["JuDian"];
+                    //foreach (var group in prd_hs.Select(q => q.ENTERPRISECODE).Distinct())
+                    //{
+                    //    List<WMS_PRDPICK_H> entity_h = new();
+                    //    List<WMS_PRDPICK_D> entity_d = new();
+                    //    //鏌ヨ鍑烘潵鐨勫垪琛�
+                    //    List<WMS_PRDPICK_D> list_d = new();
+                    //    DbClient db;
+                    //    List<WMS_PRDPICK_H> dtls=new();
+                    //    if (group == 88)
+                    //    {
+                    //        dtls = prd_hs.Where(q=>q.STRONGHOID== judian && q.ENTERPRISECODE==group).ToList();
+                    //        db = Business.Biz.Db;
+                    //        foreach (var ju in prd_hs.Where(q=>q.STRONGHOID!=judian).Select(q => q.STRONGHOID).Distinct())
+                    //        {
+                    //            if (ju == "AHXC")
+                    //            {
+                    //                var requestJson = JsonConvert.SerializeObject(prd_hs.Where(q => q.STRONGHOID == ju && q.ENTERPRISECODE == group).ToList());
+                    //                var response = HttpHelper.PostAsync("http://172.18.8.56:9529/api/WMS/GetMaterialReq", requestJson).Result;
+                    //                action = JsonConvert.DeserializeObject<ApiAction>(response.Message);
+                    //            }
+                    //            if (ju == "DGXC")
+                    //            {
+                    //                //var requestJson = JsonConvert.SerializeObject(prd_hs.Where(q => q.STRONGHOID == ju && q.ENTERPRISECODE == group).ToList());
+                    //                //var response = HttpHelper.PostAsync("http://172.18.8.56:9528/api/WMS/GetMaterialReq/", requestJson).Result;
+                    //                //action = JsonConvert.DeserializeObject<ApiAction>(response.Message);
+                    //            }
+                    //            if (ju == "XCSJ")
+                    //            {
+                    //                var requestJson = JsonConvert.SerializeObject(prd_hs.Where(q => q.STRONGHOID == ju && q.ENTERPRISECODE == group).ToList());
+                    //                var response = HttpHelper.PostAsync("http://172.18.8.56:9527/api/WMS/GetMaterialReq/", requestJson).Result;
+                    //                action = JsonConvert.DeserializeObject<ApiAction>(response.Message);
+                    //            }
+
+                    //        }
+                    //    }
+                    //    else
+                    //    {
+                    //        //dtls = prd_hs.Where(q =>  q.ENTERPRISECODE !=88 ).ToList();
+                    //        db = Biz.DataSource["Test"].Client;
+                    //    }
+                    //    foreach (var item_h in dtls)
+                    //    {
+                    //        var prd_h = Biz.Db.Queryable<WMS_PRDPICK_H>().Where(s => s.BILLCODE == item_h.BILLCODE).Single();
+                    //        if (prd_h?.STATUS != "COMPLETE")
+                    //        {
+                    //            prd_h = prd_h ?? new WMS_PRDPICK_H()
+                    //            {
+                    //                STATUS = "INIT",
+                    //                BIZTYPE = "1",
+                    //                CreationTime = DateTime.Now,
+                    //                CreatorUserId = 1,
+                    //            };
+                    //            prd_h.BILLCODE = item_h.BILLCODE;
+                    //            prd_h.BILLDATE = item_h.BILLDATE;
+                    //            prd_h.SOURCETYPE = item_h.SOURCETYPE;
+                    //            prd_h.STATUS = prd_h.STATUS == "DELETE"? "INIT": prd_h.STATUS;
+                    //            prd_h.REMARK = item_h.REMARK;
+                    //            prd_h.SOURCECODE = item_h.SOURCECODE;
+                    //            prd_h.LastModificationTime = DateTime.Now;
+                    //            //prd_h.ENTERPRISECODE = item_h.ENTERPRISECODE;
+                    //            //prd_h.STRONGHOID = item_h.STRONGHOID;
+
+                    //            entity_h.Add(prd_h);
+                    //        }
+                    //    }
+
+                    //    //淇濆瓨鍒版暟鎹簱
+                    //    var dbTran = db.UseTran(() =>
+                    //    {
+                    //        db.Storageable(entity_h, "system").ExecuteCommand();
+
+                    //    });
+                    //    if (!dbTran.IsSuccess)
+                    //    {
+                    //        action.CatchExceptionWithLog(dbTran.ErrorException, $"鏁版嵁淇濆瓨澶辫触");
+                    //    }
+
+                    //    //寮傛鎷夊彇鍗曡韩鍒楄〃
+                    //    Work.DoAsync(() =>
+                    //    {
+                    //        GenerateReqDetail(dtls,db);
+                    //    });
+                    //    action.Message += $"鎷夊彇棰嗘枡鍗曞崟澶村畬鎴愶紝璋冪敤寮傛鎷夊崟韬��";
+                    //}
+
+                }
+
+                return action;
+            }
+            catch (Exception ex)
+            {
+                return action.GetResponse().CatchExceptionWithLog(ex, $"棰嗘枡鍗曠敓鎴愬紓甯�");
+            }
+        }
+
+        /// <summary>
+        /// 鏍规嵁棰嗘枡鍗曞ご鎷夊崟韬�
+        /// </summary>
+        /// <param name="dtls"></param>
+        /// <param name="db"></param>
+        /// <returns></returns>
+        private static ApiAction GenerateReqDetail(List<WMS_PRDPICK_H> dtls, DbClient db)
+        {
+            Thread.Sleep(5000);
+            var action = new ApiAction();
+            try
+            {
+                var judian = BizConfig.Configuration["JuDian"];
+                List<WMS_PRDPICK_H> entity_h = new();
+                List<WMS_PRDPICK_D> entity_d = new();
+                List<WMS_TRANSFER_H> transferH = new();
+                List<WMS_SCTRWO_TRANSFER> sctrwos = new();
+                //鏌ヨ鍑烘潵鐨勫垪琛�
+                List<WMS_PRDPICK_D> list_dOld = new();
+                foreach (var item_h in dtls)
+                {
+                    var prd_h = Biz.Db.Queryable<WMS_PRDPICK_H>().Where(s => s.BILLCODE == item_h.BILLCODE).Single();
+                    if (prd_h?.STATUS != "COMPLETE")
+                    {
+                        var list_d = Biz.Db.Queryable<WMS_PRDPICK_D>().Where(s => s.BILLCODE == item_h.BILLCODE).ToList();
+
+                        var item_h_list = new List<WMS_PRDPICK_D>();
+                        var ret = DI.Resolve<IErpT100>().GetMaterialReqDetail(new ReqInputParameter
+                        {
+                            parameter = new reqParameter { sfdcdocno = item_h.BILLCODE },
+                            datakey = new Datakey
+                            {
+                                EntId = item_h.ENTERPRISECODE.ToString(),
+                                CompanyId = judian
+                            }
+                        });
+                        List<reqParameterReturn> ret_list = new List<reqParameterReturn>();
+                        if (ret.payload.std_data.execution.code != "0")
+                        {
+                            action.IsSuccessed = false;
+                            action.Message = $"閿欒淇℃伅锛歔{ret.payload.std_data.execution.description}]";
+                            Logger.Default.Info(action.Message);
+                            var dt = DateTime.Now;
+                            while ((dt - DateTime.Now).TotalSeconds < 10)
+                            {
+
+                            }
+                            var ret1 = DI.Resolve<IErpT100>().GetMaterialReqDetail(new ReqInputParameter
+                            {
+                                parameter = new reqParameter { sfdcdocno = item_h.BILLCODE },
+                                datakey = new Datakey
+                                {
+                                    EntId = item_h.ENTERPRISECODE.ToString(),
+                                    CompanyId = judian
+                                }
+                            });
+                            if (ret1.payload.std_data.execution.code != "0")
+                            {
+                                action.IsSuccessed = false;
+                                action.Message = $"閿欒淇℃伅锛歔{ret1.payload.std_data.execution.description}]";
+                                Logger.Default.Info(action.Message);
+                                return action;
+                            }
+                            else
+                            {
+                                ret_list = ret1.payload.std_data.parameter.@return;
+                            }
+                        }
+                        else
+                        {
+                            ret_list = ret.payload.std_data.parameter.@return;
+                        }
+                        foreach (var item in ret_list)
+                        {
+                            WMS_PRDPICK_D d = new WMS_PRDPICK_D
+                            {
+                                BILLCODE = item.sfdcdocno,
+                                BILLLINE = Convert.ToInt32(item.sfdcseq),
+                                UNITCODE = item.sfdc006,
+                                MATERIALCODE = item.sfdc004,
+                                PRQTY = Convert.ToDecimal(item.sfdc007),
+                                DELIVERYDATE = Convert.ToDateTime(item.sfdareqdt),
+                                WAREHOUSECODE = item.sfdc012,
+                                SOURCETYPE = Convert.ToInt32(item.sfdc003),
+                                SOURCECODE = item.sfdc001,
+                                SOURCELINE = Convert.ToInt32(item.sfdc002),
+                            };
+                            item_h_list.Add(d);
+                        }
+
+                        //淇濆瓨濮斿宸ュ崟鍙峰搴斿叧绯�
+                        WMS_SCTRWO_TRANSFER sctr = new WMS_SCTRWO_TRANSFER
+                        {
+                            ID = Guid.NewGuid().ToString("N"),
+                            ORIGINAL_WORKORDER = ret_list[0]?.sfdc001,
+                            TARGET_WORKORDER = ret_list[0]?.sfdc001_1
+                        };
+                        sctrwos.Add(sctr);
+                        action.Message += $"锛岄鏂欏崟鏄庣粏鑾峰彇鎴愬姛锛孾{string.Join(",", item_h_list.Select(x => x.BILLCODE + ";" + x.MATERIALCODE).ToList())},鑾峰彇鎬绘暟[{item_h_list.Count}]锛屾暟鎹簱涓�绘暟[{list_d.Count}]";
+                        action.Message += $"锛屽澶栧伐鍗曪紝[{string.Join(",", sctrwos.Select(x => x.ORIGINAL_WORKORDER + ";" + x.TARGET_WORKORDER).ToList())}";
+                        if (list_d.Count != item_h_list.Count)
+                        {
+                            foreach (var d in list_d) { d.PRQTY = 0; } //闇�姹傛暟閲忛兘寮勬垚0
+                        }
+                        int n = 0;
+                        List<WMS_PRDPICK_D> prdDList = new List<WMS_PRDPICK_D>();
+                        foreach (var item_d in item_h_list)
+                        {
+                            //鏍规嵁鍗曟嵁閲嶆柊鍒版暟鎹煡鎵剧浉搴旂殑鍗曟嵁鏄庣粏
+                            var prd_d = list_d.Where(s => s.BILLCODE == item_d.BILLCODE && s.BILLLINE == item_d.BILLLINE).FirstOrDefault();
+                            prd_d = prd_d ?? new WMS_PRDPICK_D()
+                            {
+                                LINESTATUS = "INIT",
+                                QTY = Convert.ToDecimal(0),
+                                CreationTime = DateTime.Now,
+                                CreatorUserId = 1,
+                            };
+                            prd_d.BILLCODE = item_d.BILLCODE;
+                            prd_d.BILLLINE = item_d.BILLLINE;
+                            prd_d.UNITCODE = item_d.UNITCODE;
+                            prd_d.MATERIALCODE = item_d.MATERIALCODE;
+                            prd_d.PRQTY = Convert.ToDecimal(item_d.PRQTY);
+                            prd_d.DELIVERYDATE = Convert.ToDateTime(item_d.DELIVERYDATE);
+                            prd_d.WAREHOUSECODE = item_d.WAREHOUSECODE;
+                            prd_d.LINESTATUS = prd_d.PRQTY == prd_d.QTY ? "COMPLETE" : Convert.ToDecimal(item_d.PRQTY) == 0 ? "COMPLETE" : prd_d.LINESTATUS == "DELETE" ? "INIT" : prd_d.LINESTATUS;
+                            prd_d.SOURCETYPE = item_d.SOURCETYPE;
+                            prd_d.SOURCECODE = item_d.SOURCECODE;
+                            prd_d.SOURCELINE = item_d.SOURCELINE;
+                            prd_d.LastModificationTime = item_d.LastModificationTime;
+                            list_d.RemoveAll(q => q.BILLCODE == item_d.BILLCODE && q.BILLLINE == item_d.BILLLINE);
+                            if (prd_d.LINESTATUS == "COMPLETE") { n++; }
+                            prdDList.Add(prd_d);
+                            entity_d.Add(prd_d);
+                        }
+                        if (prdDList.Count == n) { prd_h.STATUS = "COMPLETE"; }
+                        entity_h.Add(prd_h);
+                        list_dOld.AddRange(list_d);
+                        //妫�鏌ユ湁娌℃湁璋冩嫧鍗曪紝鏈夊氨鏇存柊鐘舵�佷负瀹屾垚
+                        var transferList = Biz.Db.Queryable<WMS_TRANSFER_H>().Where(s => s.SOURCECODE == prd_h.BILLCODE).ToList();
+                        if (transferList.Any())
+                        {
+                            foreach (var item in transferList)
+                            {
+                                item.STATUS = "COMPLETE2";
+                                item.LastModificationTime = DateTime.Now;
+                                item.SOURCECODE = prd_h.BILLCODE;
+                                transferH.Add(item);
+                                action.Message += $"锛岄鏂欏崟[{prd_h.BILLCODE}]瀵瑰簲璋冩嫧鍗昜{item.BILLCODE}]瀹屾垚";
+                            }
+                        }
+                    }
+                }
+                //淇濆瓨鍒版暟鎹簱
+                var dbTran = db.UseTran(() =>
+                {
+                    db.Storageable(entity_h, "system").ExecuteCommand();
+                    db.Storageable(entity_d, "system").ExecuteCommand();
+                    if (transferH.Any())
+                    {
+                        db.Updateable(transferH).ExecuteCommand();
+                    }
+                    if (sctrwos.Any())
+                    {
+                        //db.Insertable(sctrwos).ExecuteCommand();
+                        var y = db.Storageable(sctrwos)
+                        .WhereColumns(t => new { t.ORIGINAL_WORKORDER, t.TARGET_WORKORDER })
+                        .ToStorage();
+                        y.AsInsertable.ExecuteCommand();
+                        y.AsUpdateable.IgnoreColumns(t => t.ID).ExecuteCommand();
+                    }
+                    if (list_dOld.Any())
+                    {
+                        db.Deleteable(list_dOld).ExecuteCommand();
+                    }
+                });
+                if (!dbTran.IsSuccess)
+                {
+                    action.CatchExceptionWithLog(dbTran.ErrorException, $"鏁版嵁淇濆瓨澶辫触");
+                }
+                Logger.Default.Info(action.Message);
+                return action;
+            }
+            catch (System.Exception ex)
+            {
+                return action.GetResponse().CatchExceptionWithLog(ex, $"棰嗘枡鍗曠敓鎴愬紓甯�");
+            }
+        }
+
+        /// <summary>
+        /// 鎷嗚В鏉$爜
+        /// </summary>
+        /// <param name="nFullBarcode"></param>
+        /// <param name="nPackageBarcode"></param>
+        /// <returns></returns>
+        public static Result<InputBarcodeDto> SplitFullBarcode(string nFullBarcode, bool nPackageBarcode = false)
+        {
+            Result<InputBarcodeDto> result = new(Result.Flags.Success, $"瑙f瀽鏉$爜[{nFullBarcode}]鎴愬姛");
+            //璇嗗埆鏂扮殑璇嗗埆浜岀淮鐮佽鍒欙紝浠寮�澶达紝鍚﹀垯鎸夋棫璇嗗埆妯″紡
+            if (nFullBarcode.Substring(0, 1).ToUpper() == "V")
+            {
+                return SplitFullBarcodeNew(nFullBarcode, nPackageBarcode);
+            }
+
+            // 鏃ф牸寮忔潯鐮侊紝閮芥槸鏈�灏忔壒娆℃爣绛撅紝闈炲寘瑁呮爣绛�
+            nPackageBarcode = false;
+
+            //鏂版潯鐮佽В鏋�
+            var nSplitArray = nFullBarcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
+            if (nSplitArray.Length == 1) //涓�缁寸爜
+            {
+                result.Data = new InputBarcodeDto
+                {
+                    Barcode = nFullBarcode
+                };
+                return result;
+            }
+
+            var nOrderNo = "";
+            var nMaterialCode = "";
+            var nBarcodeLotNo = "";
+            var nLotQty = "";
+            var nLotDate = "";
+            var nStateFlag = "";
+            bool isBox = false;
+            var nLotNo = "";
+
+
+            foreach (string item in nSplitArray)
+            {
+                string itemKey = item.Substring(0, 1).ToUpper();
+                string itemValue = item.Substring(1);
+                if (itemKey == "V")
+                { //閲囪喘璁㈠崟鍙�
+                    nOrderNo = itemValue;
+                }
+                else if (itemKey == "P")
+                { //鏉$爜鏂欏彿
+                    nMaterialCode = itemValue;
+                }
+                else if (itemKey == "S")
+                { //鏉ユ枡澶栧寘鏉$爜   
+                    nBarcodeLotNo = itemValue;
+                    //nBarcodeLotNo = item;//PAG ID 瑙f瀽鍑烘潵鐨勬暟鎹墠缂�鈥淪鈥濅笉鐢ㄥ幓鎺�
+                    //if (itemValue.StartsWith("C") || itemValue.StartsWith("P")) //涓锛圕锛夊拰鏍堟澘锛圥锛夛紝闇�瑕佸啀娆″幓鎺変竴浣�
+                    //    nBarcodeLotNo = itemValue.Substring(1);
+                }
+                else if (itemKey == "Q")
+                { //鏉$爜鏁伴噺
+                    nLotQty = itemValue;
+                }
+                else if (itemKey == "D")
+                { //鐢熶骇鏃ユ湡(鍘绘帀-锛屽吋瀹瑰甫-鐨勬椂闂存牸寮忥紝鍚庨潰缁熶竴鏃堕棿瑙f瀽)
+                    nLotDate = itemValue;
+                    //nLotDate = itemValue.Replace("-", "");
+                }
+                else if (itemKey == "L")
+                { //鎵瑰彿
+                    nLotNo = itemValue;
+                }
+
+            }
+
+
+            if (nMaterialCode == "" || nLotQty == "" || nBarcodeLotNo == "")
+            {
+                result.Flag = Result.Flags.Failed;
+                result.Message = $"鏉$爜鏁版嵁鏈夎";
+                return result;
+            }
+
+
+            // 鍒ゆ柇鏍囩鏁伴噺鏄惁鍚堟硶
+            if (!decimal.TryParse(nLotQty, out decimal nBarcodeQty))
+            {
+                result.Flag = Result.Flags.Failed;
+                result.Message = $"鏉$爜鏍煎紡閿欒锛氭湭鍙栧埌姝g‘鐨勬潯鐮佹暟閲�";
+                return result;
+            }
+
+            // 瑙f瀽DateCode
+            DateTime nDateCode = DateTime.MinValue;
+            if (nLotDate != "")
+            {
+                //string dateTimeStr = nLotDate.Substring(0, 4) + "-" + nLotDate.Substring(4, 2) + "-" + nLotDate.Substring(6, 2);
+
+                //if (!DateTime.TryParse(dateTimeStr, out nDateCode))
+                ////if (!DateTime.TryParse(nLotDate, out DateTime nDateCode))
+                //{
+                //    throw new UserFriendlyException("鏉$爜鏍煎紡閿欒锛氭湭鍙栧埌姝g‘鐨勬壒娆℃棩鏈�");
+                //}
+
+                /// 鍘熷DateCode 涓烘棩鏈�
+                if (nLotDate.Length > 6)
+                {
+                    var sDate = nLotDate;
+                    if (nLotDate.Length == 7) { sDate = $"{nLotDate.Substring(0, 4)}0{nLotDate.Substring(4)}"; }
+                    IFormatProvider ifp = new CultureInfo("zh-CN", true);
+                    DateTime.TryParseExact(sDate, "yyyyMMdd", ifp, DateTimeStyles.None, out nDateCode);
+                }
+
+                /// 鍘熷DateCode 涓哄勾銆佸懆娆★紙YYYYWW / YYWW锛�
+                int yw = 0;
+                if (nLotDate.Length <= 6 && int.TryParse(nLotDate, out yw))
+                {
+                    nDateCode = GetWeekStartTime(nLotDate);
+                }
+
+                if (nDateCode == DateTime.MinValue)
+                {
+                    result.Flag = Result.Flags.Failed;
+                    result.Message = $"鏉$爜鏍煎紡閿欒锛氭湭鍙栧埌姝g‘鐨勬壒娆℃棩鏈�";
+                    return result;
+                }
+
+            }
+
+            // 鍒ゆ柇鐗╂枡浠g爜鏄惁鍚堟硶
+            var nMaterial = Biz.Db.Queryable<WMS_MesMaterial>().Where(q => q.MCode.ToUpper() == nMaterialCode.ToUpper() || q.MCode.ToUpper() == "K" + nMaterialCode.ToUpper()).First();
+            if (nMaterial == null)
+            {
+                result.Flag = Result.Flags.Failed;
+                result.Message = $"鏉$爜瀵瑰簲鐨勭墿鏂欎笉瀛樺湪";
+                return result;
+            }
+
+            // 鍒ゆ柇鍖呰鏉$爜鏍煎紡鏄惁鍚堟硶
+            if (nPackageBarcode && nBarcodeLotNo.Length != 12)
+            {
+                result.Flag = Result.Flags.Failed;
+                result.Message = $"鏉ユ枡澶栧寘鏉$爜鏍煎紡閿欒锛屽簲鍖呭惈12浣嶅瓧绗︾殑鎵规鍙�";
+                return result;
+            }
+
+            if (!nPackageBarcode && nMaterial.MtypeCode == "itemtype_semimanufacture" && nBarcodeLotNo.Length < 16) //5浣嶄緵搴斿晢+8浣嶆棩鏈�+3浣嶆祦姘寸爜
+            {
+                result.Flag = Result.Flags.Failed;
+                result.Message = $"鍗婃垚鍝佹潯鐮佺殑鎵规鏍煎紡閿欒锛屽簲鑷冲皯鍖呭惈16浣嶅瓧绗�";
+                return result;
+            }
+
+            if (!nPackageBarcode && nMaterial.MtypeCode == "itemtype_finishedproduct" && nBarcodeLotNo.Length < 17) //5浣嶄緵搴斿晢+8浣嶆棩鏈�+4浣嶆祦姘寸爜
+            {
+                result.Flag = Result.Flags.Failed;
+                result.Message = $"鎴愬搧绠卞彿鎵规鏍煎紡閿欒锛屽簲鑷冲皯鍖呭惈17浣嶅瓧绗�";
+                return result;
+            }
+
+            if (!nPackageBarcode && nMaterial.MtypeCode == "itemtype_rawmaterial" && nBarcodeLotNo.Length < 15)//4浣嶄緵搴斿晢+8浣嶆棩鏈�+4浣嶆祦姘寸爜
+            {
+                result.Flag = Result.Flags.Failed;
+                result.Message = $"鐗╂枡鏉$爜鎵规鏍煎紡閿欒锛屽簲鑷冲皯鍖呭惈15浣嶅瓧绗�";
+                return result;
+            }
+            result.Data = new InputBarcodeDto
+            {
+                OrderNo = nOrderNo,
+                Barcode = nBarcodeLotNo,
+                MaterialCode = nMaterial?.MCode,
+                MaterialName = nMaterial?.MName,
+                MaterialStandard = nMaterial?.MDesc,
+                MGroupCode = nMaterial?.MGroupCode,
+                Unit = nMaterial?.MUom,
+                LotQty = nBarcodeQty,
+                LotDate = nDateCode,
+                LotDateString = nLotDate,
+                PeriodDays = nMaterial.PERIODDAYS,
+                FIFO = nMaterial.FIFO,
+                SafeStorageQty = nMaterial.SAFEQTY,
+                StateFlag = nStateFlag,
+                IsBox = isBox,
+                //SnList = snList,
+                LotNo = nBarcodeLotNo,
+            };
+            return result;
+        }
+
+        /// <summary>
+        /// 鏈�鏂拌В鐮佽鍒�,SRM 鏍囩
+        /// 鎷嗚В鏉$爜
+        ///        渚濇鏄細
+        ///V锛歅O锛圡O锛�
+        ///P锛欳 P/N锛氭枡鍙�
+        ///N锛歂ame锛堢墿鏂欏悕绉帮級
+        ///Q锛歈TY锛堟暟閲忥級
+        ///U锛歎nit锛堝崟浣嶏級
+        ///M锛歁fr P/N锛堜緵搴斿晢鍐呴儴绠℃帶鐨勭墿鏂欑殑鏂欏彿锛�
+        ///D锛欴ate Code锛堢敓浜ф棩鏈燂紝鐗╂枡鐨勭敓浜ф棩鏈燂級
+        ///L锛歀ot Code锛堢敓浜х殑鎵规锛�
+        ///S锛歅AG ID锛堝皬鍖呮壒娆′唬鐮侊紝涔熷氨鏄潵鏂欏鍖呮潯鐮侊級
+        /// </summary>
+        /// <param name="nFullBarcode"></param>
+        /// <param name="nPackageBarcode"></param>
+        /// <returns></returns>
+        public static Result<InputBarcodeDto> SplitFullBarcodeNew(string nFullBarcode, bool nPackageBarcode = false)
+        {
+            Result<InputBarcodeDto> result = new(Result.Flags.Success, $"瑙f瀽鏉$爜[{nFullBarcode}]鎴愬姛");
+            var nSplitArray = nFullBarcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
+
+            var nOrderNo = "";
+            var nMaterialCode = "";
+            var nBarcodeLotNo = "";
+            var nLotQty = "";
+            var nLotDate = "";
+            var nStateFlag = "";
+            bool isBox = false;
+            var nLotNo = "";
+
+            List<Tuple<string, decimal>> snList = new List<Tuple<string, decimal>>();
+
+
+            foreach (string item in nSplitArray)
+            {
+                string itemKey = item.Substring(0, 1).ToUpper();
+                string itemValue = item.Substring(1);
+                if (itemKey == "V")
+                { //閲囪喘璁㈠崟鍙�
+                    nOrderNo = itemValue;
+                }
+                else if (itemKey == "P")
+                { //鏉$爜鏂欏彿
+                    nMaterialCode = itemValue;
+                }
+                else if (itemKey == "S")
+                { //鏉ユ枡澶栧寘鏉$爜   
+                    nBarcodeLotNo = itemValue;
+                }
+                else if (itemKey == "Q")
+                { //鏉$爜鏁伴噺
+                    nLotQty = itemValue;
+                }
+                else if (itemKey == "D")
+                {
+                    //鐢熶骇鏃ユ湡(鍘绘帀-锛屽吋瀹瑰甫-鐨勬椂闂存牸寮忥紝鍚庨潰缁熶竴鏃堕棿瑙f瀽)
+                    nLotDate = Regex.Replace(itemValue, @"[^0-9]+", "");
+                }
+                else if (itemKey == "L")
+                { //鎵瑰彿
+                    nLotNo = itemValue;
+                }
+
+            }
+
+            //鍒ゆ柇鏉$爜鏄惁鎷嗗垎杩囷紝鎷嗗垎杩囩殑涓嶅垽鏂槸鍚︿负ASN 2022/12/17 Ben Lin
+            //if (!nBarcodeLotNo.Contains("-1") && !nBarcodeLotNo.Contains("-2"))
+            if (nBarcodeLotNo.Substring(nBarcodeLotNo.Length - 3, 2) != "-1" && nBarcodeLotNo.Substring(nBarcodeLotNo.Length - 3, 2) != "-2") //璋冩暣鍒ゆ柇鎷嗗寘鏍囩鐨勬爣鍑�2023-1-2锛寃eikaiyong
+            {
+                // 鍒ゆ柇鍗曟嵁缂栧彿鏄惁涓篈SN, 濡傛灉鏄疉SN锛岃皟鐢ˋSN鏍囩瑙f瀽
+                if (BillIsAsn(nOrderNo))
+                {
+                    return SplitFullBarcodeAsn(nSplitArray, nPackageBarcode);
+                }
+            }
+
+            if (nMaterialCode == "" || nLotQty == "" || nBarcodeLotNo == "")
+            {
+                result.Flag = Result.Flags.Failed;
+                result.Message = $"鏉$爜鏁版嵁鏈夎";
+                return result;
+            }
+
+            var nInputSnDto = Biz.Db.Queryable<WMS_SRMSNList>().Where(q => q.OuterBarcode == nBarcodeLotNo || q.BigBarcode == nBarcodeLotNo).ToList();
+            if (nInputSnDto.Any())
+            {
+                isBox = true;
+                snList = nInputSnDto.Select(t => new Tuple<string, decimal>(t.SmallBarcode, t.IncludeQty)).ToList();
+            }
+
+
+            if (!decimal.TryParse(nLotQty, out decimal nBarcodeQty))
+            {
+                //throw new UserFriendlyException("鏉$爜鏍煎紡閿欒锛氭湭鍙栧埌姝g‘鐨勬潯鐮佹暟閲�");
+                result.Flag = Result.Flags.Failed;
+                result.Message = $"鏉$爜鏁版嵁鏈夎";
+                return result;
+            }
+            DateTime nDateCode = DateTime.Now;
+            if (nLotDate != "")
+            {
+                // 鍘熷DateCode 涓烘棩鏈�
+                if (nLotDate.Length > 6)
+                {
+                    IFormatProvider ifp = new CultureInfo("zh-CN", true);
+                    DateTime.TryParseExact(nLotDate, "yyyyMMdd", ifp, DateTimeStyles.None, out nDateCode);
+                }
+
+                // 鍘熷DateCode 涓哄勾銆佸懆娆★紙YYYYWW / YYWW锛�
+                int yw = 0;
+                if (nLotDate.Length <= 6 && int.TryParse(nLotDate, out yw))
+                {
+                    nDateCode = GetWeekStartTime(nLotDate);
+                }
+
+                if (nDateCode == DateTime.MinValue)
+                {
+                    result.Flag = Result.Flags.Failed;
+                    result.Message = $"鏉$爜[{nFullBarcode}]鏍煎紡閿欒锛氭湭鍙栧埌姝g‘鐨勬壒娆℃棩鏈�";
+                    return result;
+                }
+            }
+
+
+            var nMaterial = Biz.Db.Queryable<WMS_MesMaterial>().Where(q => q.MCode.ToUpper() == nMaterialCode.ToUpper()).First();
+            if (nMaterial == null)
+            {
+                result.Flag = Result.Flags.Failed;
+                result.Message = $"鏉$爜瀵瑰簲鐨勭墿鏂欎笉瀛樺湪";
+                return result;
+            }
+            if (!nPackageBarcode)
+            {
+                if (nPackageBarcode && nBarcodeLotNo.Length != 12)
+                {
+                    result.Flag = Result.Flags.Failed;
+                    result.Message = $"鏉ユ枡澶栧寘鏉$爜鏍煎紡閿欒锛屽簲鍖呭惈12浣嶅瓧绗︾殑鎵规鍙�";
+                    return result;
+                }
+                else if (!nPackageBarcode && nMaterial.MtypeCode == "itemtype_semimanufacture" && nBarcodeLotNo.Length < 16) //5浣嶄緵搴斿晢+8浣嶆棩鏈�+3浣嶆祦姘寸爜
+                {
+                    result.Flag = Result.Flags.Failed;
+                    result.Message = $"鍗婃垚鍝佹潯鐮佺殑鎵规鏍煎紡閿欒锛屽簲鑷冲皯鍖呭惈16浣嶅瓧绗�";
+                    return result;
+                }
+                else if (!nPackageBarcode && nMaterial.MtypeCode == "itemtype_finishedproduct" && nBarcodeLotNo.Length < 17) //5浣嶄緵搴斿晢+8浣嶆棩鏈�+4浣嶆祦姘寸爜
+                {
+                    result.Flag = Result.Flags.Failed;
+                    result.Message = $"鎴愬搧绠卞彿鎵规鏍煎紡閿欒锛屽簲鑷冲皯鍖呭惈17浣嶅瓧绗�";
+                    return result;
+                }
+                else if (!nPackageBarcode && nMaterial.MtypeCode == "itemtype_rawmaterial" && nBarcodeLotNo.Length < 15)//4浣嶄緵搴斿晢+8浣嶆棩鏈�+4浣嶆祦姘寸爜
+                {
+                    result.Flag = Result.Flags.Failed;
+                    result.Message = $"鐗╂枡鏉$爜鎵规鏍煎紡閿欒锛屽簲鑷冲皯鍖呭惈15浣嶅瓧绗�";
+                    return result;
+                }
+            }
+
+            result.Data = new InputBarcodeDto
+            {
+                OrderNo = nOrderNo,
+                Barcode = nBarcodeLotNo,
+                MaterialCode = nMaterialCode,
+                MaterialName = nMaterial?.MName,
+                MaterialStandard = nMaterial?.MDesc,
+                MGroupCode = nMaterial?.MGroupCode,
+                Unit = nMaterial?.MUom,
+                LotQty = nBarcodeQty,
+                LotDateString = nLotDate,
+                LotDate = nDateCode,
+                PeriodDays = nMaterial.PERIODDAYS,
+                FIFO = nMaterial.FIFO,
+                SafeStorageQty = nMaterial.SAFEQTY,
+                StateFlag = nStateFlag,
+                IsBox = isBox,
+                SnList = snList,
+                LotNo = nBarcodeLotNo,
+            };
+            return result;
+        }
+
+        /// <summary>
+        /// ASN鏍囩鏉$爜瑙f瀽
+        /// 鎷嗚В鏉$爜锛屼緷娆℃槸锛�
+        /// V锛歅O锛圡O锛�
+        /// P锛欳 P/N锛氭枡鍙�
+        /// N锛歂ame锛堢墿鏂欏悕绉帮級
+        /// Q锛歈TY锛堟暟閲忥級
+        /// U锛歎nit锛堝崟浣嶏級
+        /// M锛歁fr P/N锛堜緵搴斿晢鍐呴儴绠℃帶鐨勭墿鏂欑殑鏂欏彿锛�
+        /// D锛欴ate Code锛堢敓浜ф棩鏈燂紝鐗╂枡鐨勭敓浜ф棩鏈燂級
+        /// L锛歀ot Code锛堢敓浜х殑鎵规锛�
+        /// S锛歅AG ID锛堝皬鍖呮壒娆′唬鐮侊紝涔熷氨鏄潵鏂欏鍖呮潯鐮侊級
+        /// </summary>
+        /// <param name="nFullBarcode"></param>
+        /// <param name="nBarcodeType"></param>
+        /// <returns></returns>
+        public static Result<InputBarcodeDto> SplitFullBarcodeAsn(string[] nSplitArray, bool nPackageBarcode = false)
+        {
+            Result<InputBarcodeDto> result = new(Result.Flags.Success, $"瑙f瀽Asn鏉$爜鎴愬姛");
+            #region 鏂规硶鍙橀噺
+            // 鏉$爜鍙橀噺
+            var nAsnNo = "";
+            var nVendorCode = "";
+            var nMaterialCode = "";
+            var nBarcodeLotNo = "";
+            var nLotQty = "";
+            var nLotDate = "";
+            var nStateFlag = "";
+            bool isBox = false;
+            var nLotNo = "";
+
+            // 鏈�灏忓寘瑁呮潯鐮佸垪琛�
+            List<Tuple<string, decimal>> snList = new List<Tuple<string, decimal>>();
+            // 閫佽揣鍗曡鏄庣粏
+            List<InputAsnLineDto> asnLineList = new List<InputAsnLineDto>();
+            // 鏈�灏忓寘瑁呮潯鐮佹槑缁�
+            List<WMS_SRMSNList> snBarcodeList = new List<WMS_SRMSNList>();
+            var nCartonNo = "";
+            var nPalletNo = "";
+
+            // 鍙橀噺璧嬪��
+            foreach (string item in nSplitArray)
+            {
+                string itemKey = item.Substring(0, 1).ToUpper();
+                string itemValue = item.Substring(1);
+                if (itemKey == "V")
+                { //閫佽揣鍗曞彿
+                    nAsnNo = itemValue;
+                }
+                else if (itemKey == "P")
+                { //鏉$爜鏂欏彿
+                    nMaterialCode = itemValue;
+                }
+                else if (itemKey == "S")
+                { //鏉ユ枡澶栧寘鏉$爜   
+                    nBarcodeLotNo = itemValue;
+                    //nBarcodeLotNo = item;//PAG ID 瑙f瀽鍑烘潵鐨勬暟鎹墠缂�鈥淪鈥濅笉鐢ㄥ幓鎺�
+                    //if(itemValue.StartsWith("C")|| itemValue.StartsWith("P")) //涓锛圕锛夊拰鏍堟澘锛圥锛夛紝闇�瑕佸啀娆″幓鎺変竴浣�
+                    //    nBarcodeLotNo = itemValue.Substring(1);
+                }
+                else if (itemKey == "Q")
+                { //鏉$爜鏁伴噺
+                    nLotQty = itemValue;
+                }
+                else if (itemKey == "D")
+                { //鐢熶骇鏃ユ湡(鍘绘帀-锛屽吋瀹瑰甫-鐨勬椂闂存牸寮忥紝鍚庨潰缁熶竴鏃堕棿瑙f瀽)
+                  //nLotDate = itemValue.Replace("-", "");
+                    nLotDate = Regex.Replace(itemValue, @"[^0-9]+", "");
+                }
+                else if (itemKey == "L")
+                { //鎵瑰彿
+                    nLotNo = itemValue;
+                }
+
+            }
+            #endregion
+
+            #region 鏉$爜鏁版嵁鏍¢獙
+            if (nMaterialCode == "" || nLotQty == "" || nBarcodeLotNo == "")
+            {
+                //throw new UserFriendlyException("鏉$爜鏁版嵁鏈夎");
+                result.Flag = Result.Flags.Failed;
+                result.Message = $"鏉$爜鏁版嵁鏈夎";
+                return result;
+            }
+
+            // 鑾峰彇鏉$爜鍒楄〃 snBarcodeList
+            snBarcodeList = GetSrmBarcodeList(nBarcodeLotNo);
+
+            // 濡傛灉鏈�灏忓寘瑁呮爣绛捐褰曟暟澶т簬1锛屽垯涓哄寘瑁呮爣绛撅紝鍚﹀垯涓烘渶灏忓寘瑁呮爣绛�
+            if (BarcodeIsBox(nBarcodeLotNo))
+            {
+                isBox = true;
+            }
+
+            if (snBarcodeList.Any())
+            {
+                snList = snBarcodeList.Select(t => new Tuple<string, decimal>(t.SmallBarcode, t.IncludeQty)).ToList();
+                snBarcodeList = snBarcodeList.Select(t => new WMS_SRMSNList
+                {
+                    BILLCODE = t.BILLCODE,
+                    MATERIALCODE = t.MATERIALCODE,
+                    SmallBarcode = t.SmallBarcode,
+                    BigBarcode = t.BigBarcode,
+                    OuterBarcode = t.OuterBarcode,
+                    IncludeQty = t.IncludeQty
+                }).ToList();
+
+                // 鍒ゆ柇鏍囩鏉$爜绫诲瀷
+                // 鏄渶灏忓寘瑁呮潯鐮�
+                var smallBarcode = snBarcodeList.Where(t => t.SmallBarcode == nBarcodeLotNo).FirstOrDefault();
+                if (smallBarcode != null && !smallBarcode.SmallBarcode.IsNullOrEmpty())
+                {
+                    isBox = false;
+                    nCartonNo = smallBarcode.BigBarcode;
+                    nPalletNo = smallBarcode.OuterBarcode;
+                }
+
+                // 鏄绠辨潯鐮�
+                var bigBarcode = snBarcodeList.Where(t => t.BigBarcode == nBarcodeLotNo).FirstOrDefault();
+                if (bigBarcode != null && !bigBarcode.BigBarcode.IsNullOrEmpty())
+                {
+                    isBox = true;
+                    nCartonNo = bigBarcode.BigBarcode;
+                    nPalletNo = bigBarcode.OuterBarcode;
+                }
+
+                // 鏄爤鏉挎潯鐮�
+                var outerBarcode = snBarcodeList.Where(t => t.OuterBarcode == nBarcodeLotNo).FirstOrDefault();
+                if (outerBarcode != null && !outerBarcode.OuterBarcode.IsNullOrEmpty())
+                {
+                    isBox = true;
+                    nCartonNo = outerBarcode.BigBarcode;
+                    nPalletNo = outerBarcode.OuterBarcode;
+                }
+            }
+
+            // 楠岃瘉鏉$爜鏍囩鏁伴噺鏍煎紡鏄惁姝g‘
+            if (!decimal.TryParse(nLotQty, out decimal nBarcodeQty))
+            {
+                //throw new UserFriendlyException("鏉$爜鏍煎紡閿欒锛氭湭鍙栧埌姝g‘鐨勬潯鐮佹暟閲�");
+                result.Flag = Result.Flags.Failed;
+                result.Message = $"鏉$爜鏍煎紡閿欒锛氭湭鍙栧埌姝g‘鐨勬潯鐮佹暟閲�";
+                return result;
+            }
+
+            // 楠岃瘉鏉$爜鏍囩鏁伴噺涓嶴RM 鏈�灏忓寘瑁呮暟閲忓悎璁℃槸鍚︿竴鑷�
+            decimal snQtyTotal = snBarcodeList.Sum(t => t.IncludeQty);
+            if (nBarcodeQty != snQtyTotal)
+            {
+                //throw new UserFriendlyException("鏍囩鏁伴噺涓嶴RM鏈�灏忓寘瑁呮�绘暟閲忎笉涓�鑷�");
+                result.Flag = Result.Flags.Failed;
+                result.Message = $"鏍囩鏁伴噺涓嶴RM鏈�灏忓寘瑁呮�绘暟閲忎笉涓�鑷�";
+                return result;
+            }
+
+
+            DateTime nDateCode = DateTime.Now;
+            if (nLotDate != "")
+            {
+                //澧炲姞鍒ゆ柇鏃ユ湡鐨勬姏閿欐彁绀� 2022/07/27 Ben Lin, 2022/07/29 Ben Lin 鍐嶆鏇存柊
+                try
+                {
+                    string dateTimeStr = nLotDate.Substring(0, 4) + "-" + nLotDate.Substring(4, 2) + "-" + nLotDate.Substring(6, 2);
+                    if (nLotDate.Length < 7)
+                    {
+                        if (nLotDate.StartsWith("2") && nLotDate.Length == 6)
+                        {
+                            dateTimeStr = $"20{nLotDate.Substring(0, 2)}-{nLotDate.Substring(2, 2)}-{nLotDate.Substring(4, 2)}";
+                        }
+                        else
+                        {
+                            result.Flag = Result.Flags.Failed;
+                            result.Message = $"鏉$爜[{nBarcodeLotNo}]鏍煎紡閿欒锛氭湭鍙栧埌姝g‘鐨勬壒娆℃棩鏈�";
+                            return result;
+                        }
+                    }
+
+                    if (!DateTime.TryParse(dateTimeStr, out nDateCode))
+                    //if (!DateTime.TryParse(nLotDate, out DateTime nDateCode))
+                    {
+                        result.Flag = Result.Flags.Failed;
+                        result.Message = $"鏉$爜[{nBarcodeLotNo}]鏍煎紡閿欒锛氭湭鍙栧埌姝g‘鐨勬壒娆℃棩鏈�";
+                        return result;
+                    }
+                }
+                catch (System.Exception ex)
+                {
+                    //Logger.Info($"ASN鏍囩鏉$爜瑙f瀽 =>鏉$爜[{nBarcodeLotNo}]鏍煎紡閿欒锛氭湭鍙栧埌姝g‘鐨勬壒娆℃棩鏈燂紝{ex.Message}");
+                    result.Flag = Result.Flags.Failed;
+                    result.Message = $"鏉℃潯鐮乕{nBarcodeLotNo}]鏍煎紡閿欒锛氭湭鍙栧埌姝g‘鐨勬壒娆℃棩鏈燂紝{ex.Message}";
+                    return result;
+                }
+            }
+
+            var nMaterial = Biz.Db.Queryable<WMS_MesMaterial>().Where(t => t.MCode.ToUpper() == nMaterialCode.ToUpper()).First();
+            if (nMaterial == null)
+            {
+                result.Flag = Result.Flags.Failed;
+                result.Message = $"鏉$爜瀵瑰簲鐨勭墿鏂橻{nMaterialCode}]涓嶅瓨鍦�";
+                return result;
+            }
+            if (!nPackageBarcode)
+            {
+                if (nPackageBarcode && nBarcodeLotNo.Length != 12)
+                {
+                    result.Flag = Result.Flags.Failed;
+                    result.Message = $"鏉ユ枡澶栧寘鏉$爜鏍煎紡閿欒锛屽簲鍖呭惈12浣嶅瓧绗︾殑鎵规鍙�";
+                    return result;
+                }
+                else if (!nPackageBarcode && nMaterial.MtypeCode == "itemtype_semimanufacture" && nBarcodeLotNo.Length < 16) //5浣嶄緵搴斿晢+8浣嶆棩鏈�+3浣嶆祦姘寸爜
+                {
+                    result.Flag = Result.Flags.Failed;
+                    result.Message = $"鍗婃垚鍝佹潯鐮佺殑鎵规鏍煎紡閿欒锛屽簲鑷冲皯鍖呭惈16浣嶅瓧绗�";
+                    return result;
+                }
+                else if (!nPackageBarcode && nMaterial.MtypeCode == "itemtype_finishedproduct" && nBarcodeLotNo.Length < 17) //5浣嶄緵搴斿晢+8浣嶆棩鏈�+4浣嶆祦姘寸爜
+                {
+                    result.Flag = Result.Flags.Failed;
+                    result.Message = $"鎴愬搧绠卞彿鎵规鏍煎紡閿欒锛屽簲鑷冲皯鍖呭惈17浣嶅瓧绗�";
+                    return result;
+                }
+                else if (!nPackageBarcode && nMaterial.MtypeCode == "itemtype_rawmaterial" && nBarcodeLotNo.Length < 15)//4浣嶄緵搴斿晢+8浣嶆棩鏈�+4浣嶆祦姘寸爜
+                {
+                    result.Flag = Result.Flags.Failed;
+                    result.Message = $"鐗╂枡鏉$爜鎵规鏍煎紡閿欒锛屽簲鑷冲皯鍖呭惈15浣嶅瓧绗�";
+                    return result;
+                }
+            }
+            #endregion
+
+            #region 鑾峰彇閫佽揣鍗曟暟鎹�
+            // 濡傛灉鏍囩娌℃湁閫佽揣鍗曞彿锛屾牴鎹爣绛炬潯鐮佽幏鍙栭�佽揣鍗曞彿
+            if (nAsnNo.IsNullOrEmpty())
+            {
+                var asnList = GetSrmAsn(nBarcodeLotNo);
+                var asn = asnList.FirstOrDefault();
+                if (asn != null)
+                {
+                    nAsnNo = asn.DeliveryNo;
+                    nVendorCode = asn.VendorCode;
+                }
+            }
+
+            // 鑾峰彇閫佽揣鍗曡鏄庣粏 poLineList
+            List<InputAsnLineDto> asnLines = GetSrmAsnLines(nAsnNo, nMaterialCode);
+
+            if (asnLines != null && asnLines.Count > 0)
+            {
+                foreach (var line in asnLines)
+                {
+                    // 鍒嗗壊poLineNo锛�1-1-1锛夛紝鐢�-鍒嗗壊锛屽彇绗竴娈碉紝鑾峰彇 PoErpLine
+                    string[] splitLineNo = line.PoLineNo.Split('-');
+
+                    if (splitLineNo != null && splitLineNo.Count() > 0)
+                    {
+                        int erpPoLine = 0;
+                        int.TryParse(splitLineNo[0], out erpPoLine);
+                        line.PoErpLine = erpPoLine;
+                    }
+                }
+            }
+
+            #endregion
+            result.Data = new InputBarcodeDto
+            {
+                AsnNo = nAsnNo,
+                Barcode = nBarcodeLotNo,
+                VendorCode = nVendorCode,
+                MaterialCode = nMaterialCode,
+                MaterialName = nMaterial?.MName,
+                MaterialStandard = nMaterial?.MDesc,
+                MGroupCode = nMaterial?.MGroupCode,
+                Unit = nMaterial?.MUom,
+                LotQty = nBarcodeQty,
+                LotDateString = nLotDate,
+                LotDate = nDateCode,
+                PeriodDays = nMaterial.PERIODDAYS,
+                FIFO = nMaterial.FIFO,
+                SafeStorageQty = nMaterial.SAFEQTY,
+                StateFlag = nStateFlag,
+                IsBox = isBox,
+                SnList = snList,
+                LotNo = nBarcodeLotNo,
+                AsnLineList = asnLines,
+                SnBarcodeList = snBarcodeList,
+                CartonNo = nCartonNo,
+                PalletNo = nPalletNo
+            };
+            return result;
+        }
+
+
+        private static bool BarcodeIsBox(string barcode)
+        {
+            bool isBox = false;
+
+            // 浠嶹MS_SRM_ASN琛ㄦ煡鎵惧崟鎹紪鍙凤紝鍒ゆ柇鏄惁涓篈SN
+            if (Biz.Db.Queryable<WMS_SRMSNList>().Where(t => t.OuterBarcode == barcode || t.BigBarcode == barcode).Any())
+                isBox = true;
+
+            return isBox;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="inputBarcode"></param>
+        /// <returns></returns>
+        public static List<SRMSNStatus> GetSrmAsn(string inputBarcode)
+        {
+            var query = Biz.Db.Queryable<WMS_SRMSNList, WMS_SRM_ASN>((t, m) =>
+                                new JoinQueryInfos(
+                                    JoinType.Left, t.DeliveryNo == m.DeliveryNo
+                                    ))
+            .Where((t, m) => t.SmallBarcode == inputBarcode || t.BigBarcode == inputBarcode || t.OuterBarcode == inputBarcode)
+            .Select((t, m) => new SRMSNStatus
+            {
+                DeliveryNo = t.DeliveryNo,
+                VendorCode = m.innerVendorCode,
+                Status = m.status
+            })
+            .ToList();
+            return query;
+        }
+
+        /// <summary>
+        /// 鑾峰彇 SRM ASN 琛�
+        /// </summary>
+        /// <param name="inputAsnNo"></param>
+        /// <returns></returns>
+        public static List<InputAsnLineDto> GetSrmAsnLines(string inputAsnNo)
+        {
+            var query = Biz.Db.Queryable<WMS_SRM_ASN_LINES>()
+            .Where(t => t.DeliveryNo == inputAsnNo)
+            .Select(t => new InputAsnLineDto
+            {
+                DeliveryNo = t.DeliveryNo,
+                LineNo = t.lineNo,
+                ProductCode = t.productCode,
+                PurchaseType = t.purchaseType,
+                PoErpNo = t.poErpNo,
+                PoLineNo = t.poLineNo,
+                DeliveryQty = t.deliveryQty
+            })
+            .ToList();
+            return query;
+        }
+
+        /// <summary>
+        /// 鑾峰彇 SRM ASN 琛�
+        /// </summary>
+        /// <param name="inputAsnNo"></param>
+        /// <param name="inputMaterialCode"></param>
+        /// <returns></returns>
+        public static List<InputAsnLineDto> GetSrmAsnLines(string inputAsnNo, string inputMaterialCode)
+        {
+            var query = Biz.Db.Queryable<WMS_SRM_ASN_LINES>()
+            .Where(t => t.DeliveryNo == inputAsnNo && t.productCode == inputMaterialCode)
+            .Select(t => new InputAsnLineDto
+            {
+                DeliveryNo = t.DeliveryNo,
+                LineNo = t.lineNo,
+                ProductCode = t.productCode,
+                PurchaseType = t.purchaseType,
+                PoErpNo = t.poErpNo,
+                PoLineNo = t.poLineNo,
+                DeliveryQty = t.deliveryQty
+            })
+            .ToList();
+            return query;
+        }
+
+        /// <summary>
+        /// 鑾峰彇 SRM 鏉$爜鍒楄〃
+        /// </summary>
+        /// <param name="inputBarcode"></param>
+        /// <returns></returns>
+        public static List<WMS_SRMSNList> GetSrmBarcodeList(string inputBarcode)
+        {
+            return Biz.Db.Queryable<WMS_SRMSNList>().Where(t => t.OuterBarcode == inputBarcode || t.BigBarcode == inputBarcode || t.SmallBarcode == inputBarcode).ToList();
+        }
+
+        /// <summary>
+        /// 褰撳墠鍛ㄧ殑绗竴澶�(鏄熸湡涓�)
+        /// </summary>
+        /// <param name="yearWeek">鍛ㄦ暟锛屾牸寮忥細yyyywww</param>
+        /// <returns></returns>
+        private static DateTime GetWeekStartTime(string yearWeek)
+        {
+            //骞翠唤
+            int year = 0;
+            //鍛ㄦ暟
+            int weekNum = 0;
+
+            if (yearWeek.Length == 4)
+            {
+                year = 2000 + int.Parse(yearWeek.Substring(0, 2));
+                weekNum = int.Parse(yearWeek.Substring(2));
+            }
+
+            if (yearWeek.Length == 6)
+            {
+                year = int.Parse(yearWeek.Substring(0, 4));
+                weekNum = int.Parse(yearWeek.Substring(4));
+            }
+            //鏈勾1鏈�1鏃�
+            DateTime firstOfYear = new DateTime(year, 1, 1);
+            //鏈勾1鏈�1鏃ヤ笌鏈懆鏄熸湡涓�鐩稿樊鐨勫ぉ鏁�
+            int dayDiff = (firstOfYear.DayOfWeek == DayOfWeek.Sunday ? 7 : Convert.ToInt32(firstOfYear.DayOfWeek)) - 1;
+            //绗竴鍛ㄧ殑鏄熸湡涓�
+            DateTime firstDayOfFirstWeek = firstOfYear.AddDays(-dayDiff);
+            //褰撳墠鍛ㄧ殑鏄熸湡涓�
+            DateTime firstDayOfThisWeek = firstDayOfFirstWeek.AddDays((weekNum - 1) * 7);
+            return firstDayOfThisWeek;
+        }
+
+        // 鏍规嵁鍗曟嵁缂栧彿鍒ゆ柇鏄兘涓� ASN
+        private static bool BillIsAsn(string billCode)
+        {
+            // 浠嶹MS_SRM_ASN琛ㄦ煡鎵惧崟鎹紪鍙凤紝鍒ゆ柇鏄惁涓篈SN
+            return Biz.Db.Queryable<WMS_SRMSNList>().Where(q => q.DeliveryNo == billCode).Any();
+        }
+
+        /// <summary>
+        /// 鑾峰彇鍗曞彿鏍规嵁鍗曟嵁绫诲瀷
+        /// </summary>
+        /// <param name="billType"></param>
+        /// <returns></returns>
+        public static string GetBillNoByType(string billType)
+        {
+            //鏍规嵁BillType鍘昏〃涓壘鍒扮浉鍏冲墠缂�銆佹棩鏈熺爜銆佹祦姘村彿銆侀暱搴�
+            var billNoRule = Biz.Db.Queryable<MesBillNoHelper>().Where(t => t.BillType.Equals(billType)).ToList();
+            if (billNoRule.Count == 1)
+            {
+                var nowRule = billNoRule[0];
+                string prefix = nowRule.BillPrefix.Trim();
+                string datecode = nowRule.DateCode.Trim();
+                string today = DateTime.Now.ToString("yyyyMMdd");
+                int serial = nowRule.SerialNo;
+                int maxSerial = GetMaxNumByLength(nowRule.SerialNoLength);
+                if (serial >= maxSerial)
+                {
+                    return "over";
+                }
+                else
+                {
+                    if (datecode != string.Empty && datecode != today)
+                    {
+                        serial = 0;
+                        datecode = today;
+                    }
+                    string serialNo = (serial + 1).ToString().PadLeft(nowRule.SerialNoLength, '0');
+                    //update serialNo
+                    nowRule.DateCode = datecode;
+                    nowRule.SerialNo = serial + 1;
+                    Biz.Db.Updateable(nowRule).ExecuteCommand();
+                    //杩斿洖缂栧彿
+                    return prefix + datecode + serialNo;
+                }
+            }
+            else
+            {
+                return "";
+            }
+        }
+        private static int GetMaxNumByLength(int length)
+        {
+            if (length == 0)
+            {
+                return 0;
+            }
+            else
+            {
+                string strNum = string.Empty;
+                for (int i = 1; i <= length; i++)
+                {
+                    strNum += "9";
+                }
+                return Convert.ToInt32(strNum);
+            }
+        }
+
+        /// <summary>
+        /// 鐢熸垚閫佹鍗�
+        /// </summary>
+        /// <param name="detail"></param>
+        /// <param name="nUrgent"></param>
+        /// <returns></returns>
+        private static Result<WMS_IQC_H> CreateIqcHeader(WMS_RECEIPT_D detail, string nUrgent, DbClient db)
+        {
+            Result<WMS_IQC_H> result = new(Result.Flags.Success, $"鐢熸垚閫佹鍗曟垚鍔�");
+            var nMaterial = Biz.Db.Queryable<WMS_MesMaterial>().Where(t => t.MCode.ToUpper() == detail.MATERIALCODE.ToUpper()).First();
+            var nAql = Biz.Db.Queryable<WMS_IQCMATERIAL_AQL>().Where(t => t.MATERIALID.Equals(nMaterial.Id)).First();
+
+            var nIqcHeader = new WMS_IQC_H
+            {
+                BILLCODE = iWMS.GetBillNoByType("IQC"),
+                SOURCETYPE = (int)InventoryTransferSides.BillType.CustSupplyInStock,
+                SOURCECODE = detail.BILLCODE,
+                SOURCELINE = detail.BILLLINE,
+                PONO = detail.SOURCECODE,
+                POLINE = detail.POLINE ?? 0,
+                MEASURE = nUrgent,
+                QCTIMES = 0,
+                QCSTATUS = (int)IqcManagementSides.QCStatus.UnFinish, /*(int)IqcManagementSides.QCStatus.UnFinish,*/
+                QCRESULT = (int)IqcManagementSides.QCResult.Wait,
+                QCREVIEW = (int)IqcManagementSides.QCReview.UnReview,
+                CreationTime = DateTime.Now,
+                CreatorUserId = 1,
+                MATERIALCODE = detail.MATERIALCODE
+                //ReceiveQty = detail.Qty, //鐢熸垚閫佹鍗曞姞涓婃帴鏀舵暟閲� 2022/07/27 Ben Lin 2022/09/03 Ben Lin 娉ㄩ噴
+            };
+
+            var nIQCMaterial = Biz.Db.Queryable<WMS_IQCMATERIAL>().Where(t => t.MATERIALID.Equals(nMaterial.Id)).First();
+
+            if (nIQCMaterial == null)
+            {
+                nIqcHeader.QCLEVEL = (int)IqcManagementSides.QCLevel.NormalI;
+            }
+            //鍏嶆
+            else if (nIQCMaterial.CHECKTYPE == "Exemption")
+            {
+                nIqcHeader.QCLEVEL = (int)IqcManagementSides.QCLevel.Exemption;
+            }
+            //鎶芥
+            else if (nIQCMaterial.CHECKTYPE == "Sampling")
+            {
+                var nIQCMaterial2AQL = Biz.Db.Queryable<WMS_IQCMATERIAL_AQL>().Where(t => t.IQCMATERIALID.Equals(nIQCMaterial.Id)).ToList();
+                if (nIQCMaterial2AQL.Any())
+                {
+                    var nIQCMaterial2CheckItem = Biz.Db.Queryable<WMS_IQCMATERIAL_CHECKITEM>().Where(t => t.IQCMATERIALID.Equals(nIQCMaterial.Id)).ToList();
+                    if (nIQCMaterial2CheckItem.Any())
+                    {
+                        //楂樻II锛屾娊妫�鐗╂枡锛孉QL鍜屾楠岄」鐩兘缁存姢浜�
+                        nIqcHeader.QCLEVEL = (int)IqcManagementSides.QCLevel.HighII;
+                        Result<WMS_IQC_H> result1 = GetAqlSettingAsync(nAql, nIqcHeader, detail, db);
+                        if (result1.Flag != Result.Flags.Success)
+                        {
+                            result.Flag = result1.Flag;
+                            result.Message = result1.Message;
+                        }
+                        else
+                        {
+                            nIqcHeader = result1.Data;
+                        }
+                    }
+                    else
+                    {
+                        //楂樻I锛屾娊妫�鐗╂枡锛岀淮鎶や簡AQL銆佷絾鏄病鏈夌淮鎶ゆ楠岄」鐩�
+                        nIqcHeader.QCLEVEL = (int)IqcManagementSides.QCLevel.HighI;
+                        Result<WMS_IQC_H> result2 = GetAqlSettingAsync(nAql, nIqcHeader, detail, db);
+                        if (result2.Flag != Result.Flags.Success)
+                        {
+                            result.Flag = result2.Flag;
+                            result.Message = result2.Message;
+                        }
+                        else
+                        {
+                            nIqcHeader = result2.Data;
+                        }
+                    }
+                }
+                else
+                {
+                    var nIQCMaterial2CheckItem = Biz.Db.Queryable<WMS_IQCMATERIAL_CHECKITEM>().Where(t => t.IQCMATERIALID.Equals(nIQCMaterial.Id)).ToList();
+                    if (nIQCMaterial2CheckItem.Any())
+                    {
+                        //鏅II锛屾娊妫�鐗╂枡锛屾病鏈夌淮鎶QL銆佷絾鏄淮鎶や簡妫�楠岄」鐩�
+                        nIqcHeader.QCLEVEL = (int)IqcManagementSides.QCLevel.NormalII;
+                    }
+                    else
+                    {
+                        //鏅I锛屾娊妫�鐗╂枡锛屼絾鏄病鏈夌淮鎶QL鍜屾楠岄」鐩�
+                        nIqcHeader.QCLEVEL = (int)IqcManagementSides.QCLevel.NormalI;
+                    }
+                }
+            }
+            //鍏ㄦ
+            else if (nIQCMaterial.CHECKTYPE == "FullInspection")
+            {
+                nIqcHeader.QCLEVEL = (int)IqcManagementSides.QCLevel.FullInspection;
+                nIqcHeader.SAMPLENGQTY = detail.QTY;
+            }
+            result.Data = nIqcHeader;
+            return result;
+        }
+
+        private static Result<WMS_IQC_H> GetAqlSettingAsync(WMS_IQCMATERIAL_AQL nAql, WMS_IQC_H nIqcHeader, WMS_RECEIPT_D nDetail, DbClient db)
+        {
+            Result<WMS_IQC_H> result = new(Result.Flags.Success, $"鑾峰彇Aql鎴愬姛");
+            if (nAql.AUTOSTRICT == true)
+            {
+                nIqcHeader.STRICTLEVEL = nAql.CURRENTSTRICT.IsNullOrEmpty() ? nAql.DEFAULTSTRICT : nAql.CURRENTSTRICT;
+                nIqcHeader.LEVELCODE = nIqcHeader.STRICTLEVEL.ToUpper() == "NORMAL" ? nAql.NORMALLEVEL : (nIqcHeader.STRICTLEVEL.ToUpper() == "STRICT" ? nAql.STRICTLEVEL : nAql.RELAXLEVEL);
+                nIqcHeader.AQL = nIqcHeader.STRICTLEVEL.ToUpper() == "NORMAL" ? nAql.NORMALAQLLEVEL : (nIqcHeader.STRICTLEVEL.ToUpper() == "STRICT" ? nAql.STRICTAQLLEVEL : nAql.RELAXAQLLEVEL);
+            }
+            else
+            {
+                nIqcHeader.STRICTLEVEL = nAql.DEFAULTSTRICT;
+                nIqcHeader.LEVELCODE = nAql.DEFAULTLEVEL;
+                nIqcHeader.AQL = nAql.DEFAULTAQL;
+            }
+
+            //鎵惧埌璇� LevelCode鍜孉qlCode閰嶇疆涓嬶紝绗﹀悎鐨勬壒娆℃暟閲忚寖鍥�
+            var nAqlDetail = Biz.Db.Queryable<WMS_AQL_D>()
+                .Where(t => t.LEVELCODE.ToUpper() == nIqcHeader.LEVELCODE.ToUpper() && t.AQLCODE.ToUpper() == nIqcHeader.AQL.ToUpper())
+                .Where(t => t.LOTMAXQTY >= nDetail.QTY && t.LOTMAXQTY <= nDetail.QTY)
+                .First();
+
+            if (nAqlDetail == null)
+            {
+                result.Flag = Result.Flags.Failed;
+                result.Message = $"鏈兘鍦ㄦ按鍑哰{nIqcHeader.LEVELCODE}]涓嬬殑AQL[{nIqcHeader.AQL}]涓嬫壘鍒扮鍚圼{nDetail.QTY}]鐨勬壒娆¤寖鍥�";
+            }
+
+            nIqcHeader.BEGINQTY = nAqlDetail.LOTMINQTY;
+            nIqcHeader.ENDQTY = nAqlDetail.LOTMAXQTY;
+            nIqcHeader.SAMPLEQTY = nAqlDetail.SAMPLEQTY > nDetail.QTY ? nDetail.QTY : nAqlDetail.SAMPLEQTY;
+            result.Data = nIqcHeader;
+
+            return result;
+        }
+
+    }//endClass
+}
diff --git a/Tiger.Controllers.WMS/Controllers/WMSController.In_Default.cs b/Tiger.Controllers.WMS/Controllers/WMSController.In_Default.cs
new file mode 100644
index 0000000..d99a6ac
--- /dev/null
+++ b/Tiger.Controllers.WMS/Controllers/WMSController.In_Default.cs
@@ -0,0 +1,185 @@
+锘縰sing System;
+using System.Threading.Tasks;
+using Rhea.Common;
+using Tiger.Model;
+using Tiger.IBusiness;
+using Microsoft.AspNetCore.Mvc;
+using Tiger.Model.Minsun;
+using Autofac;
+
+namespace Tiger.Api.Controllers.WMS
+{
+    public partial class WMSController : ControllerBase
+    {
+        /// <summary>
+        /// GetTransaction(ApiAction(Data:UserId))
+        /// 鏍规嵁ApiAction鐨刬d杩斿洖涓�涓爣鍑嗕笂鏋朵簨鍔�
+        /// </summary>
+        /// <param name="action"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [Route("api/[controller]/In_Default/GetTransaction")]
+        public IActionResult In_Default_GetTransaction([FromBody] ApiAction<USER> action)
+        {
+            ApiAction response;
+            IIn_Default trans = null;
+            try
+            {
+                if (iBiz.WMS.Context.GetTransDic().ContainsKey(action.ID))
+                {
+                    trans = iBiz.WMS.Context.GetTransDic()[action.ID] as IIn_Default;
+                }
+                else
+                {
+                    trans = AutoFacContainer.Instance.Resolve<IIn_Default>().Init(action.ID, action.Data?.USER_CODE, Request.Host.Value, action.Data?.ORG_CODE);
+                    iBiz.WMS.Context.NewTransaction(HttpContext, trans);
+                }
+
+                response = action.GetResponse();
+            }
+            catch (System.Exception ex)
+            {
+                response = action.GetResponse().CatchExceptionWithLog(ex);
+            }
+            trans?.AddHistory(Request, action);
+            return Ok(response);
+        }
+
+        /// <summary>
+        /// CloseTransaction(ApiAction)
+        /// 鍏抽棴浜嬪姟
+        /// </summary>
+        /// <param name="action"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [Route("api/[controller]/In_Default/CloseTransaction")]
+        public IActionResult In_Default_CloseTransaction([FromBody] ApiAction action)
+        {
+            ApiAction response;
+            IIn_Default trans = null;
+            try
+            {
+                if (iBiz.WMS.Context.GetTransDic().ContainsKey(action.ID))
+                {
+                    trans = iBiz.WMS.Context.GetTransDic()[action.ID] as IIn_Default;
+                    if (!trans.IsFinished)
+                    {
+                        if (action.IsAsync)
+                        {
+                            response = action.GetResponse(trans.Close());
+                        }
+                        else
+                        {
+                            lock (trans.TransLock) { response = action.GetResponse(trans.Close()); }
+                        }
+                        response.Message = $"鏍囧噯涓婃灦浜嬪姟[ID:{action.ID}]鍏抽棴{(response.IsSuccessed ? "鎴愬姛" : "澶辫触")}";
+                    }
+                    else
+                    {
+                        response = action.GetResponse($"Transaction Error: 鏍囧噯涓婃灦浜嬪姟[ID:{action.ID}]宸茬粡鍏抽棴", false);
+                    }
+                }
+                else
+                {
+                    response = action.GetResponse($"Transaction Error: 鏍囧噯涓婃灦浜嬪姟[ID:{action.ID}]宸茬粡鍏抽棴", false);
+                }
+            }
+            catch (System.Exception ex)
+            {
+                response = action.GetResponse().CatchExceptionWithLog(ex);
+            }
+            trans?.AddHistory(Request, action);
+            return Ok(response);
+        }
+
+        /// <summary>
+        /// 鎵弿鍏ュ簱
+        /// </summary>
+        /// <param name="action"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [Route("api/[controller]/In_Default/ScanItem")]
+        public async Task<IActionResult> In_Default_ScanItemAsync([FromBody] ApiAction<BaseInput> action)
+        {
+            ApiAction response;
+            IIn_Default trans = null;
+            try
+            {
+                if (iBiz.WMS.Context.GetTransDic().ContainsKey(action.ID))
+                {
+                    trans = iBiz.WMS.Context.GetTransDic()[action.ID] as IIn_Default;
+                    if (!trans.IsFinished)
+                    {
+                        if (action.IsAsync)
+                        {
+                            response = action.GetResponse(await trans.ScanItem(action.Data));
+                        }
+                        else
+                        {
+                            lock (trans.TransLock) { response = action.GetResponse(trans.ScanItem(action.Data).Result); }
+                        }
+                    }
+                    else
+                    {
+                        response = action.GetResponse($"Transaction Error: 鏍囧噯涓婃灦浜嬪姟[ID:{action.ID}]宸茬粡鍏抽棴锛岃閲嶆柊鎵撳紑鏍囧噯涓婃灦鍔熻兘", false);
+                    }
+                }
+                else
+                {
+                    response = action.GetResponse($"Transaction Error: 鏍囧噯涓婃灦浜嬪姟[ID:{action.ID}]鏁版嵁涓㈠け锛岃閲嶆柊鎵撳紑鏍囧噯涓婃灦鍔熻兘", false);
+                }
+            }
+            catch (System.Exception ex)
+            {
+                response = action.GetResponse().CatchExceptionWithLog(ex);
+            }
+            trans?.AddHistory(Request, action);
+            return Ok(response);
+        }
+        /// <summary>
+        /// 鎵弿璐ф灦鎴栬�呭偍浣�
+        /// </summary>
+        /// <param name="action"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [Route("api/[controller]/In_Default/ScanShelf")]
+        public async Task<IActionResult> In_Default_ScanShelfAsync([FromBody] ApiAction action)
+        {
+            ApiAction response;
+            IIn_Default trans = null;
+            try
+            {
+                if (iBiz.WMS.Context.GetTransDic().ContainsKey(action.ID))
+                {
+                    trans = iBiz.WMS.Context.GetTransDic()[action.ID] as IIn_Default;
+                    if (!trans.IsFinished)
+                    {
+                        if (action.IsAsync)
+                        {
+                            response = action.GetResponse(await trans.ScanShelf(action.Data?.ToString()));
+                        }
+                        else
+                        {
+                            lock (trans.TransLock) { response = action.GetResponse(trans.ScanShelf(action.Data?.ToString()).Result); }
+                        }
+                    }
+                    else
+                    {
+                        response = action.GetResponse($"Transaction Error: 鏍囧噯涓婃灦浜嬪姟[ID:{action.ID}]宸茬粡鍏抽棴锛岃閲嶆柊鎵撳紑涓婃灦鍔熻兘", false);
+                    }
+                }
+                else
+                {
+                    response = action.GetResponse($"Transaction Error: 鏍囧噯涓婃灦浜嬪姟[ID:{action.ID}]鏁版嵁涓㈠け锛岃閲嶆柊鎵撳紑涓婃灦鍔熻兘", false);
+                }
+            }
+            catch (System.Exception ex)
+            {
+                response = action.GetResponse().CatchExceptionWithLog(ex);
+            }
+            trans?.AddHistory(Request, action);
+            return Ok(response);
+        }
+
+    }
+}
\ No newline at end of file
diff --git a/Tiger.Controllers.WMS/Controllers/WMSController.Out_Default.cs b/Tiger.Controllers.WMS/Controllers/WMSController.Out_Default.cs
new file mode 100644
index 0000000..a5de80e
--- /dev/null
+++ b/Tiger.Controllers.WMS/Controllers/WMSController.Out_Default.cs
@@ -0,0 +1,186 @@
+锘縰sing System;
+using System.Threading.Tasks;
+using Rhea.Common;
+using Tiger.Model;
+using Tiger.IBusiness;
+using Microsoft.AspNetCore.Mvc;
+using Tiger.Model.Minsun;
+using Autofac;
+
+namespace Tiger.Api.Controllers.WMS
+{
+    public partial class WMSController : ControllerBase
+    {
+        /// <summary>
+        /// GetTransaction(ApiAction(Data:UserId))
+        /// 鏍规嵁ApiAction鐨刬d杩斿洖涓�涓爣鍑嗕笅鏋朵簨鍔�
+        /// </summary>
+        /// <param name="action"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [Route("api/[controller]/Out_Default/GetTransaction")]
+        public IActionResult Out_Default_GetTransaction([FromBody] ApiAction<USER> action)
+        {
+            ApiAction response;
+            IOut_Default trans = null;
+            try
+            {
+                if (iBiz.WMS.Context.GetTransDic().ContainsKey(action.ID))
+                {
+                    trans = iBiz.WMS.Context.GetTransDic()[action.ID] as IOut_Default;
+                }
+                else
+                {
+                    trans = AutoFacContainer.Instance.Resolve<IOut_Default>().Init(action.ID, action.Data?.USER_CODE, Request.Host.Value, action.Data?.ORG_CODE);
+                    iBiz.WMS.Context.NewTransaction(HttpContext, trans);
+                }
+
+                response = action.GetResponse();
+            }
+            catch (System.Exception ex)
+            {
+                response = action.GetResponse().CatchExceptionWithLog(ex);
+            }
+            trans?.AddHistory(Request, action);
+            return Ok(response);
+        }
+
+        /// <summary>
+        /// CloseTransaction(ApiAction)
+        /// 鍏抽棴浜嬪姟
+        /// </summary>
+        /// <param name="action"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [Route("api/[controller]/Out_Default/CloseTransaction")]
+        public IActionResult Out_Default_CloseTransaction([FromBody] ApiAction action)
+        {
+            ApiAction response;
+            IOut_Default trans = null;
+            try
+            {
+                if (iBiz.WMS.Context.GetTransDic().ContainsKey(action.ID))
+                {
+                    trans = iBiz.WMS.Context.GetTransDic()[action.ID] as IOut_Default;
+                    if (!trans.IsFinished)
+                    {
+                        if (action.IsAsync)
+                        {
+                            response = action.GetResponse(trans.Close());
+                        }
+                        else
+                        {
+                            lock (trans.TransLock) { response = action.GetResponse(trans.Close()); }
+                        }
+                        response.Message = $"鏍囧噯涓嬫灦浜嬪姟[ID:{action.ID}]鍏抽棴{(response.IsSuccessed ? "鎴愬姛" : "澶辫触")}";
+                    }
+                    else
+                    {
+                        response = action.GetResponse($"Transaction Error: 鏍囧噯涓嬫灦浜嬪姟[ID:{action.ID}]宸茬粡鍏抽棴", false);
+                    }
+                }
+                else
+                {
+                    response = action.GetResponse($"Transaction Error: 鏍囧噯涓嬫灦浜嬪姟[ID:{action.ID}]宸茬粡鍏抽棴", false);
+                }
+            }
+            catch (System.Exception ex)
+            {
+                response = action.GetResponse().CatchExceptionWithLog(ex);
+            }
+            trans?.AddHistory(Request, action);
+            return Ok(response);
+        }
+
+        /// <summary>
+        /// 鎵弿鍏ュ簱
+        /// </summary>
+        /// <param name="action"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [Route("api/[controller]/Out_Default/ScanItem")]
+        public async Task<IActionResult> Out_Default_ScanItemAsync([FromBody] ApiAction<BaseInput> action)
+        {
+            ApiAction response;
+            IOut_Default trans = null;
+            try
+            {
+                if (iBiz.WMS.Context.GetTransDic().ContainsKey(action.ID))
+                {
+                    trans = iBiz.WMS.Context.GetTransDic()[action.ID] as IOut_Default;
+                    if (!trans.IsFinished)
+                    {
+                        if (action.IsAsync)
+                        {
+                            response = action.GetResponse(await trans.ScanItem(action.Data));
+                        }
+                        else
+                        {
+                            lock (trans.TransLock) { response = action.GetResponse(trans.ScanItem(action.Data).Result); }
+                        }
+                    }
+                    else
+                    {
+                        response = action.GetResponse($"Transaction Error: 鏍囧噯涓嬫灦浜嬪姟[ID:{action.ID}]宸茬粡鍏抽棴锛岃閲嶆柊鎵撳紑鏍囧噯涓嬫灦鍔熻兘", false);
+                    }
+                }
+                else
+                {
+                    response = action.GetResponse($"Transaction Error: 鏍囧噯涓嬫灦浜嬪姟[ID:{action.ID}]鏁版嵁涓㈠け锛岃閲嶆柊鎵撳紑鏍囧噯涓嬫灦鍔熻兘", false);
+                }
+            }
+            catch (System.Exception ex)
+            {
+                response = action.GetResponse().CatchExceptionWithLog(ex);
+            }
+            trans?.AddHistory(Request, action);
+            return Ok(response);
+        }
+
+        /// <summary>
+        /// 鎵弿璐ф灦鎴栬�呭偍浣�
+        /// </summary>
+        /// <param name="action"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [Route("api/[controller]/Out_Default/ScanShelf")]
+        public async Task<IActionResult> Out_Default_ScanShelfAsync([FromBody] ApiAction action)
+        {
+            ApiAction response;
+            IOut_Default trans = null;
+            try
+            {
+                if (iBiz.WMS.Context.GetTransDic().ContainsKey(action.ID))
+                {
+                    trans = iBiz.WMS.Context.GetTransDic()[action.ID] as IOut_Default;
+                    if (!trans.IsFinished)
+                    {
+                        if (action.IsAsync)
+                        {
+                            response = action.GetResponse(await trans.ScanShelf(action.Data?.ToString()));
+                        }
+                        else
+                        {
+                            lock (trans.TransLock) { response = action.GetResponse(trans.ScanShelf(action.Data?.ToString()).Result); }
+                        }
+                    }
+                    else
+                    {
+                        response = action.GetResponse($"Transaction Error: 鏍囧噯涓嬫灦浜嬪姟[ID:{action.ID}]宸茬粡鍏抽棴锛岃閲嶆柊鎵撳紑鏍囧噯涓嬫灦鍔熻兘", false);
+                    }
+                }
+                else
+                {
+                    response = action.GetResponse($"Transaction Error: 鏍囧噯涓嬫灦浜嬪姟[ID:{action.ID}]鏁版嵁涓㈠け锛岃閲嶆柊鎵撳紑鏍囧噯涓嬫灦鍔熻兘", false);
+                }
+            }
+            catch (System.Exception ex)
+            {
+                response = action.GetResponse().CatchExceptionWithLog(ex);
+            }
+            trans?.AddHistory(Request, action);
+            return Ok(response);
+        }
+
+    }
+}
\ No newline at end of file
diff --git a/Tiger.IBusiness.WMS/IInventory.cs b/Tiger.IBusiness.WMS/IInventory.cs
new file mode 100644
index 0000000..92ca054
--- /dev/null
+++ b/Tiger.IBusiness.WMS/IInventory.cs
@@ -0,0 +1,33 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tiger.Model;
+
+namespace Tiger.IBusiness
+{
+    public interface IInventory
+    {
+        public string SN { get; set; }
+        //public Barcode Barcode { get; set; }
+        //public bool IsQRCode => Barcode.IsQRCode;
+        public WMS_ITEM_EXT ExtInfo { get; set; }
+        public BAS_ITEM ItemInfo { get; set; }
+        public WMS_WAREHOUSE Warehouse { get; set; }
+        public WMS_REGION Region { get; set; }
+        public WMS_SHELF Shelf { get; set; }
+        public WMS_LOCATION Location { get; set; }
+        public WMS_ITEM_PKG ParentPkg { get; set; }
+        public List<WMS_ITEM_PKG> Packages { get; set; }
+        public List<WMS_ITEM> Items { get; set; }
+        public List<WMS_ITEM_EXT> ItemsExt { get; set; }
+        public List<WMS_ITEM_HIS> History { get; set; }
+        public List<WMS_ITEM.STATUSs> StatusList { get; }
+        public bool isNormalStatus { get; }
+        public WMS_ITEM.STATUSs Status { get; }
+        public WMS_ITEM_PKG CurPkg { get; }
+        public bool isExists { get; }
+        public bool isMinPackage { get; }
+    }
+}
diff --git a/Tiger.IBusiness.WMS/IWmsItem.cs b/Tiger.IBusiness.WMS/IWmsItem.cs
index 1e13a26..2c590ac 100644
--- a/Tiger.IBusiness.WMS/IWmsItem.cs
+++ b/Tiger.IBusiness.WMS/IWmsItem.cs
@@ -17,7 +17,7 @@
         /// <param name="option">鎺堟潈鏌ヨ閫夐」</param>
         /// <param name="doUnPack">鏄惁鍚屾椂鎵ц鎷嗗寘鎿嶄綔锛岃В闄や笌鐖舵潯鐮佷箣闂寸殑鍖呰鍏崇郴</param>
         /// <returns></returns>
-        public Result<Inventory> Get(string sn, AuthOption option, bool doUnPack);
+        public Result<IInventory> Get(string sn, AuthOption option, bool doUnPack);
         /// <summary>
         /// 瀹緵鏂欎笓鐢細鑾峰彇鏉$爜搴撳瓨淇℃伅锛屽寘鎷粨搴擄紝鍌ㄥ尯锛岃揣鏋讹紝鍌ㄤ綅锛岀埗鏉$爜锛屽寘瑁呮槑缁嗙瓑
         ///     娉細鐗╂枡缂栫爜鑷姩鍔燢鍒ゆ柇鍜屽鐞�
@@ -26,7 +26,7 @@
         /// <param name="option">鎺堟潈鏌ヨ閫夐」</param>
         /// <param name="doUnPack">鏄惁鍚屾椂鎵ц鎷嗗寘鎿嶄綔锛岃В闄や笌鐖舵潯鐮佷箣闂寸殑鍖呰鍏崇郴</param>
         /// <returns></returns>
-        public Result<Inventory> GetK(string sn, AuthOption option, bool doUnPack);
+        public Result<IInventory> GetK(string sn, AuthOption option, bool doUnPack);
         /// <summary>
         /// 涓婃灦
         /// </summary>
@@ -35,7 +35,7 @@
         /// <param name="targetLocation">瑕佷笂鏋剁殑鍌ㄤ綅浠g爜</param>
         /// <param name="isTransfer">鏄惁绉诲簱鎿嶄綔</param>
         /// <returns></returns>
-        public Result<PutOnInfo> PutOn(Inventory inventory, AuthOption option, string targetLocation, bool isTransfer = false);
+        public Result<PutOnInfo> PutOn(IInventory inventory, AuthOption option, string targetLocation, bool isTransfer = false);
         /// <summary>
         /// 涓嬫灦
         /// </summary>
@@ -43,7 +43,7 @@
         /// <param name="option">鎺堟潈鏌ヨ閫夐」</param>
         /// <param name="status">涓嬫灦鍚庣姸鎬侊紝榛樿涓轰笅鏋�(WMS_ITEM.STATUSs.OffShelf)</param>
         /// <returns></returns>
-        public Result<TakeDownInfo> TakeDown(Inventory inventory, AuthOption option, WMS_ITEM.STATUSs status, bool clearLocation = true);
+        public Result<TakeDownInfo> TakeDown(IInventory inventory, AuthOption option, WMS_ITEM.STATUSs status, bool clearLocation = true);
         /// <summary>
         /// 鏍规嵁SN鑾峰彇浜岀淮鐮佸唴瀹�
         /// </summary>
diff --git a/Tiger.IBusiness.WMS/IInventroyInfo.cs b/Tiger.IBusiness.WMS/Minsun/IInventroyInfo.cs
similarity index 100%
rename from Tiger.IBusiness.WMS/IInventroyInfo.cs
rename to Tiger.IBusiness.WMS/Minsun/IInventroyInfo.cs
diff --git a/Tiger.IBusiness.WMS/Transaction/IIn_Default.cs b/Tiger.IBusiness.WMS/Transaction/IIn_Default.cs
new file mode 100644
index 0000000..587a466
--- /dev/null
+++ b/Tiger.IBusiness.WMS/Transaction/IIn_Default.cs
@@ -0,0 +1,27 @@
+锘縰sing Rhea.Common;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tiger.Model;
+
+namespace Tiger.IBusiness
+{
+    public interface IIn_Default : IWMSTransaction
+    {
+        public IIn_Default Init(string id, string userCode, string apiHost, string orgCode);
+
+        /// <summary>
+        /// 鎵弿鐗╂枡骞跺鏍革紝濡傛灉鐗╂枡宸茬粡瀹屾垚绉诲簱鍒欒揣鏋朵笂浜伅鎻愰啋鍌ㄤ綅
+        /// </summary>
+        public Task<ApiAction> ScanItem(BaseInput input);
+
+        /// <summary>
+        /// 鎵弿璐ф灦鎴栬�呭偍浣�
+        /// </summary>
+        public Task<ApiAction<ScanShelfInfo>> ScanShelf(string Code);
+
+        public bool Close(bool needSaveHistoryLog = false);
+    }
+}
diff --git a/Tiger.IBusiness.WMS/Transaction/IOutNoBillcode.cs b/Tiger.IBusiness.WMS/Transaction/IOutNoBillcode.cs
index e2a725f..85de0da 100644
--- a/Tiger.IBusiness.WMS/Transaction/IOutNoBillcode.cs
+++ b/Tiger.IBusiness.WMS/Transaction/IOutNoBillcode.cs
@@ -14,7 +14,7 @@
         /// <summary>
         /// 鎵弿鐗╂枡骞跺鏍革紝濡傛灉鐗╂枡宸茬粡瀹屾垚绉诲簱鍒欒揣鏋朵笂浜伅鎻愰啋鍌ㄤ綅
         /// </summary>
-        public Task<ApiAction<NoWorkOrderOutput>> ScanItem(BaseInput input);
+        public Task<ApiAction<DefaultScanItemOutput>> ScanItem(BaseInput input);
 
         /// <summary>
         /// 鎵弿璐ф灦鎴栬�呭偍浣�
diff --git a/Tiger.IBusiness.WMS/Transaction/IOut_Default.cs b/Tiger.IBusiness.WMS/Transaction/IOut_Default.cs
new file mode 100644
index 0000000..69f9384
--- /dev/null
+++ b/Tiger.IBusiness.WMS/Transaction/IOut_Default.cs
@@ -0,0 +1,26 @@
+锘縰sing Rhea.Common;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tiger.Model;
+
+namespace Tiger.IBusiness
+{
+    public interface IOut_Default : IWMSTransaction
+    {
+        public IOut_Default Init(string id, string userCode, string apiHost, string orgCode);
+        /// <summary>
+        /// 鎵弿鐗╂枡骞跺鏍革紝濡傛灉鐗╂枡宸茬粡瀹屾垚绉诲簱鍒欒揣鏋朵笂浜伅鎻愰啋鍌ㄤ綅
+        /// </summary>
+        public Task<ApiAction<DefaultScanItemOutput>> ScanItem(BaseInput input);
+
+        /// <summary>
+        /// 鎵弿璐ф灦鎴栬�呭偍浣�
+        /// </summary>
+        public Task<ApiAction<ScanShelfInfo>> ScanShelf(string Code);
+
+        public bool Close(bool needSaveHistoryLog = false);
+    }
+}
diff --git a/Tiger.Model.Net/Entitys/WMS/Api/BaseInput.cs b/Tiger.Model.Net/Entitys/WMS/Api/BaseInput.cs
index 8742361..65e384d 100644
--- a/Tiger.Model.Net/Entitys/WMS/Api/BaseInput.cs
+++ b/Tiger.Model.Net/Entitys/WMS/Api/BaseInput.cs
@@ -50,4 +50,21 @@
     {
         public bool IsItemCodeList { get; set; }
     }
+
+    public class ScanShelfInfo
+    {
+        public string WarehouseCode { get; set; }
+        public string RegionCode { get; set; }
+        public string ShelfCode { get; set; }
+        public string LocationCode { get; set; }
+        public string RackCode => ShelfCode;
+        public bool IsSmartRack { get; set; }
+        public decimal Capacity { get; set; }
+        public int LotCount { get; set; }
+        public decimal MaxSize { get; set; }
+        public int ShelfType { get; set; }
+        public bool IsScanShelf { get; set; }
+        public WMS_SHELF Shelf { get; set; }
+        public WMS_LOCATION Location { get; set; }
+    }
 }
\ No newline at end of file
diff --git a/Tiger.Model.Net/Entitys/WMS/Api/Input_Entitys.cs b/Tiger.Model.Net/Entitys/WMS/Api/Input_Entitys.cs
new file mode 100644
index 0000000..adf0012
--- /dev/null
+++ b/Tiger.Model.Net/Entitys/WMS/Api/Input_Entitys.cs
@@ -0,0 +1,12 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tiger.Model.Minsun;
+
+namespace Tiger.Model
+{
+    
+}
diff --git a/Tiger.Model.Net/Entitys/WMS/Api/Output_Entitys.cs b/Tiger.Model.Net/Entitys/WMS/Api/Output_Entitys.cs
new file mode 100644
index 0000000..27566f0
--- /dev/null
+++ b/Tiger.Model.Net/Entitys/WMS/Api/Output_Entitys.cs
@@ -0,0 +1,43 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tiger.Model.Minsun;
+
+namespace Tiger.Model
+{
+    public class DefaultScanItemOutput
+    {
+        public int ReqType { get; set; }
+        public string ReqNo { get; set; }
+        public bool isExceed { get; set; }
+        public bool isCutting { get; set; }
+        public string SN { get; set; }
+        public string ItemCode { get; set; }
+        public string MaterialName { get; set; }
+        public decimal Qty { get; set; }
+        public decimal CutQty { get; set; }
+        public string regionCode { get; set; }
+        public string locationCode { get; set; }
+        public string ScanAfCut { get; set; }
+        public string Unit { get; set; }
+        public DateTime DateCode { get; set; }
+        public string Message { get; set; }
+    }
+
+    public class DefaultInStoreOutput
+    {
+        public string Barcode { get; set; }
+        public string MaterialCode { get; set; }
+        public string MaterialName { get; set; }
+        public decimal CurrentQty { get; set; }
+        public string Unit { get; set; }
+        public DateTime DateCode { get; set; }
+        public string WarehouseCode { get; set; }
+        public string RegionCode { get; set; }
+        public string ShelfCode { get; set; }
+        public string LocationCode { get; set; }
+    }
+}
diff --git a/Tiger.Model.Net/Entitys/WMS/Api/ProdReqInput.cs b/Tiger.Model.Net/Entitys/WMS/Api/ProdReqInput.cs
index 4ccf410..542b291 100644
--- a/Tiger.Model.Net/Entitys/WMS/Api/ProdReqInput.cs
+++ b/Tiger.Model.Net/Entitys/WMS/Api/ProdReqInput.cs
@@ -29,26 +29,6 @@
         public string ScanAfCut { get; set; }
     }
 
-    public class NoWorkOrderOutput
-    {
-        public int ReqType { get; set; }
-        public string ReqNo { get; set; }
-        public bool isExceed { get; set; }
-        public bool isCutting { get; set; }
-        public string SN { get; set; }
-        public string ItemCode { get; set; }
-        public string MaterialName { get; set; }
-        public decimal Qty { get; set; }
-        public decimal CutQty { get; set; }
-        public string regionCode { get; set; }
-        public string locationCode { get; set; }
-        public string ScanAfCut { get; set; }
-        public string Unit { get; set; }
-        public DateTime DateCode { get; set; }
-
-    }
-
-
     public class ProductionPickToMes
     {
         public string qrcode { get; set; }
diff --git a/Tiger.Model.Net/Entitys/WMS/WMS_ITEM.cs b/Tiger.Model.Net/Entitys/WMS/WMS_ITEM.cs
index ae775ba..2ea2ecf 100644
--- a/Tiger.Model.Net/Entitys/WMS/WMS_ITEM.cs
+++ b/Tiger.Model.Net/Entitys/WMS/WMS_ITEM.cs
@@ -252,33 +252,6 @@
     }//endClass
 
     /// <summary>
-    /// 鏉$爜搴撳瓨淇℃伅锛屽寘鎷粨搴擄紝鍌ㄥ尯锛岃揣鏋讹紝鍌ㄤ綅锛岀埗鏉$爜锛屽寘瑁呮槑缁嗙瓑
-    /// </summary>
-    public class Inventory
-    {
-        public string SN { get; set; }
-        public Barcode Barcode { get; set; }
-        public bool IsQRCode => Barcode.IsQRCode;
-        public WMS_ITEM_EXT ExtInfo { get; set; }
-        public BAS_ITEM ItemInfo { get; set; }
-        public WMS_WAREHOUSE Warehouse { get; set; }
-        public WMS_REGION Region { get; set; }
-        public WMS_SHELF Shelf { get; set; }
-        public WMS_LOCATION Location { get; set; }
-        public WMS_ITEM_PKG ParentPkg { get; set; }
-        public List<WMS_ITEM_PKG> Packages { get; set; } = new List<WMS_ITEM_PKG>();
-        public List<WMS_ITEM> Items { get; set; } = new List<WMS_ITEM>();
-        public List<WMS_ITEM_EXT> ItemsExt { get; set; } = new List<WMS_ITEM_EXT>();
-        public List<WMS_ITEM_HIS> History { get; set; } = new List<WMS_ITEM_HIS>();
-        public List<WMS_ITEM.STATUSs> StatusList => Items.GroupBy(q => q.STATUS).Select(q => new { Status = q.Key.GetEnum<WMS_ITEM.STATUSs>(), Count = q.Count() }).OrderByDescending(q => q.Count).Select(q => q.Status).ToList();
-        public bool isNormalStatus => Items.Select(q => q.STATUS).Distinct().Count() == 1;
-        public WMS_ITEM.STATUSs Status => StatusList?.FirstOrDefault() ?? WMS_ITEM.STATUSs.NotExists;
-        public WMS_ITEM_PKG CurPkg => Packages.FirstOrDefault(q => q.SN == SN);
-        public bool isExists => CurPkg != null;
-        public bool isMinPackage => Items.Count == 1 && Items.Single().SN == SN;
-    }
-
-    /// <summary>
     /// 涓婃灦鎵ц淇℃伅
     /// </summary>
     public class PutOnInfo
diff --git a/Tiger.Model.Net/Entitys/WMS/WMS_SHELF.cs b/Tiger.Model.Net/Entitys/WMS/WMS_SHELF.cs
index d8f9acb..99f85c2 100644
--- a/Tiger.Model.Net/Entitys/WMS/WMS_SHELF.cs
+++ b/Tiger.Model.Net/Entitys/WMS/WMS_SHELF.cs
@@ -3,6 +3,7 @@
 using System.Linq;
 using System.ComponentModel;
 using System.Collections.Generic;
+using Tiger.Model.Extensions;
 
 namespace Tiger.Model
 {
@@ -94,13 +95,15 @@
 		/// 澶囨敞
 		/// </summary>
 		public string REMARK { get; set; }
-        #endregion
+		#endregion
 
-        #region 铏氭嫙灞炴��
-        /*渚嬪瓙
+		#region 铏氭嫙灞炴��
+		/*渚嬪瓙
 		[SugarColumn(IsIgnore = true)]
 		public string FieldName { get; set; }
 		*/
+		[SugarColumn(IsIgnore = true)]
+		public bool IsLightShelf => SHELF_TYPE == WMS_SHELF.SHELF_TYPEs.Smart.GetValue() || SHELF_TYPE == WMS_SHELF.SHELF_TYPEs.QRCode.GetValue();
         #endregion
 
         #region 鏋氫妇鍙橀噺
diff --git a/Tiger.Model.Net/Tiger.Model.Net.csproj b/Tiger.Model.Net/Tiger.Model.Net.csproj
index 1012058..f42e92d 100644
--- a/Tiger.Model.Net/Tiger.Model.Net.csproj
+++ b/Tiger.Model.Net/Tiger.Model.Net.csproj
@@ -229,6 +229,8 @@
     <Compile Include="Entitys\SYS\SYS_CS_LOGIN.cs" />
     <Compile Include="Entitys\SYS\SYS_LOW_CODE.cs" />
     <Compile Include="Entitys\SYS\SYS_PDA_LOGIN.cs" />
+    <Compile Include="Entitys\WMS\Api\Input_Entitys.cs" />
+    <Compile Include="Entitys\WMS\Api\Output_Entitys.cs" />
     <Compile Include="Entitys\WMS\Api\Resell.cs" />
     <Compile Include="Entitys\WMS\Api\InFinished.cs" />
     <Compile Include="Entitys\WMS\Api\InReceiptCheckingInput.cs" />
@@ -556,7 +558,6 @@
     <Compile Include="Entitys\DigitalTwin\SeaStone\WebHook.cs" />
     <Compile Include="Entitys\SYS\USER.cs" />
     <Compile Include="Entitys\AnonymousEntity.cs" />
-    <Compile Include="Entitys\Barcode.cs" />
     <Compile Include="Entitys\ImportEntity.cs" />
     <Compile Include="Entitys\WMS\AgvActionResult.cs" />
     <Compile Include="Entitys\WMS\KanBan\WareHousing.cs" />

--
Gitblit v1.9.3