From 51f7eb771322a65ee552ca9b60280632f72760e6 Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期三, 15 十月 2025 16:55:08 +0800
Subject: [PATCH] 修改物料管理列表

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

diff --git a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
index 585aeea..cadc2e7 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,
@@ -493,6 +498,64 @@
                         return "-2:娣诲姞澶辫触鏁版嵁鍥炴粴!";
                     }
                 }
+            }
+            catch (Exception ex)
+            {
+                throw new Exception(ex.Message);
+            }
+        }
+
+        //瀵煎叆鍏ュ簱鍗曟嵁
+        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(Exception ex)
+                    {
+                        throw new Exception($"鐗╂枡缂栫爜锛歿model.AsnDetail[0].SkuNo},鐗╂枡鍚嶇О锛歿model.AsnDetail[0].SkuName}锛屽鍏ュけ璐ワ細"+ex.Message);
+                        // 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)
             {
@@ -777,10 +840,10 @@
                     return "-1:鍏ュ簱鍗曠姸鎬佸凡鍙樻洿锛屼笉鍙垹闄�!";
 
                 }
-                if (asnModel.Origin != "褰曞叆" && asnModel.Origin != "閲囪喘鍗�")
-                {
-                    return "-1:涓婃父绯荤粺涓嬪彂鐨勫崟鎹紝涓嶅彲鍒犻櫎;";
-                }
+                //if (asnModel.Origin != "褰曞叆" && asnModel.Origin != "閲囪喘鍗�")
+                //{
+                //    return "-1:涓婃父绯荤粺涓嬪彂鐨勫崟鎹紝涓嶅彲鍒犻櫎;";
+                //}
 
                 // 鍒犻櫎鎬诲崟
                 var editDateTime = DateTime.Now;

--
Gitblit v1.8.0