From 87110c04df904eb4947587a34f3fc5a1eb45eb7e Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期日, 12 十月 2025 16:21:11 +0800
Subject: [PATCH] 入库单据开发导入入库单功能;

---
 Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs |   72 +++++++++++++++++++++++++++++++++--
 1 files changed, 67 insertions(+), 5 deletions(-)

diff --git a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
index 8ff0456..2c91721 100644
--- a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
@@ -275,7 +275,7 @@
 
             try
             {
-                if (model.Origin == "褰曞叆")
+                if (model.Origin == "褰曞叆" || model.Origin == "瀵煎叆")
                 {
                     model.ASNNo = new Common().GetMaxNo("ASN");
                 }
@@ -290,6 +290,7 @@
                         throw new Exception("鍗曟嵁绫诲瀷涓嶅彲涓虹┖!");
                     }
                 }
+
                 
                 lock (AsnLock)
                 {
@@ -422,12 +423,16 @@
                             {
                                 throw new Exception("涓嶅厤妫�鐗╂枡杩囨湡鏃ユ湡杞崲澶辫触");
                             }
-                            lot1 = lot12.ToString();
-                            lot2 = lot22.ToString();
+                            lot1 = lot12.ToString("yyyy-MM-dd");
+                            lot2 = lot22.ToString("yyyy-MM-dd");
                         }
                         if (string.IsNullOrWhiteSpace(detailModel.PackagNo))
                         {
-                            throw new Exception("鍖呰涓嶈兘涓虹┖");
+                            detailModel.PackagNo = sku.PackagNo;
+                            if (string.IsNullOrWhiteSpace(detailModel.PackagNo))
+                            {
+                                throw new Exception("鍖呰涓嶈兘涓虹┖");
+                            }
                         }
                         // 璁$畻鍑烘�婚噾棰�
                         detailModel.Money = detailModel.Price * detailModel.Qty;
@@ -436,7 +441,7 @@
                             ASNNo = model.ASNNo,
                             SkuNo = detailModel.SkuNo,
                             SkuName = detailModel.SkuName,
-                            Standard = detailModel.Standard,
+                            Standard = sku.Standard,
                             LotNo = detailModel.LotNo == null ? "" : detailModel.LotNo.Trim(),
                             LotText = detailModel.LotText,
                             Qty = (decimal)detailModel.Qty,
@@ -500,6 +505,63 @@
             }
         }
 
+        //瀵煎叆鍏ュ簱鍗曟嵁
+        public string ImportArrivalNotice(ArrivalNoticeVms models)
+        {
+            string strMessage = "";
+            try
+            {
+                if (models.ListArrivalNotice.Count <= 0)
+                {
+                    strMessage = "-1:鏂囦欢鍐呮棤鏁版嵁璇锋牳瀹�!";
+                }
+                var num = 0;
+                int CreateUser = Convert.ToInt32(models.CreateUser);
+                List<string> noticeList = new List<string>();
+                foreach (ArrivalNoticeVm model in models.ListArrivalNotice)
+                {
+                    try
+                    {
+                        model.CreateUser = models.CreateUser;
+                        model.Origin = "瀵煎叆";
+                        var msg = AddArrivalNotice(model);
+                        strMessage += msg;
+                        if (msg == "")
+                        {
+                            num += 1;
+                            var hasBoxItem = noticeList.Exists(x => x == model.ASNNo);
+                            if (!hasBoxItem)
+                            {
+                                noticeList.Add(model.ASNNo);
+                            }
+                        }
+                    }
+                    catch
+                    {
+                        // ignored
+                    }
+                }
+                if (num > 0)
+                {
+                    new OperationASNServer().AddLogOperationAsn("鍏ュ簱浣滀笟", "鍏ュ簱鍗曟嵁", $"鍏卞鍏ヤ簡{noticeList.Count}鏉″崟鎹�", "瀵煎叆", $"鍏卞鍏ヤ簡{noticeList.Count}鏉″崟鎹�", CreateUser);
+                }
+                if (strMessage.Contains("-1") && num > 0)
+                {
+                    return "閮ㄥ垎瀵煎叆鎴愬姛" + strMessage;
+                }
+                if (num > 0)
+                {
+                    return "瀵煎叆鎴愬姛" + strMessage;
+                }
+
+                return strMessage;
+            }
+            catch (Exception ex)
+            {
+                throw new Exception(ex.Message);
+            }
+        }
+
         /// <summary>
         /// 缂栬緫鍏ュ簱鍗曟嵁
         /// </summary>

--
Gitblit v1.8.0