From cfdbd0eadeb5dbe4ff8872bb67f43ae8f323a799 Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期一, 13 十月 2025 09:35:13 +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