From 145f894535e510213095184d408f1795759346bf Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期五, 20 六月 2025 16:13:45 +0800
Subject: [PATCH] 入库批次号改为选择性填写
---
HTML/views/ASNSetting/ArrivalNoticeDetail.html | 14 ++--
Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs | 23 +++++--
Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs | 89 +++++++++++++++++++----------
Wms/Model/ModelVm/BllAsnVm/ArrivalNoticeDetailVm.cs | 5 +
Wms/WMS.Entity/BllAsnEntity/BllArrivalNoticeDetail.cs | 5 +
5 files changed, 92 insertions(+), 44 deletions(-)
diff --git a/HTML/views/ASNSetting/ArrivalNoticeDetail.html b/HTML/views/ASNSetting/ArrivalNoticeDetail.html
index c978bfa..7c9a7ee 100644
--- a/HTML/views/ASNSetting/ArrivalNoticeDetail.html
+++ b/HTML/views/ASNSetting/ArrivalNoticeDetail.html
@@ -658,13 +658,13 @@
}
console.log(TypeNum)
- if (TypeNum == 0) {
- layer.msg("璇疯緭鍏ユ壒娆★紒", {
- icon: 2,
- time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
- });
- return -1;
- }
+ // if (TypeNum == 0) {
+ // layer.msg("璇疯緭鍏ユ壒娆★紒", {
+ // icon: 2,
+ // time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+ // });
+ // return -1;
+ // }
}
diff --git a/Wms/Model/ModelVm/BllAsnVm/ArrivalNoticeDetailVm.cs b/Wms/Model/ModelVm/BllAsnVm/ArrivalNoticeDetailVm.cs
index 8993c90..af1262f 100644
--- a/Wms/Model/ModelVm/BllAsnVm/ArrivalNoticeDetailVm.cs
+++ b/Wms/Model/ModelVm/BllAsnVm/ArrivalNoticeDetailVm.cs
@@ -147,6 +147,11 @@
public string Lot6 { get; set; }
/// <summary>
+ /// 鏍囩甯稿��
+ /// </summary>
+ public string BoxCodeStr { get; set; }
+
+ /// <summary>
/// 鑷畾涔夊垪1
/// </summary>
public string UDF1 { get; set; }
diff --git a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
index edf83da..880f59b 100644
--- a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
@@ -353,12 +353,27 @@
detailModel.LotNo = maxLotNo;
}
}
- if (model.Type == "0" || model.Type == "1" || model.Type == "2" || model.Type == "3" || model.Type == "4" && model.Type == "8")
+ //if (model.Type == "0" || model.Type == "1" || model.Type == "2" || model.Type == "3" || model.Type == "4" && model.Type == "8")
+ //{
+ // if (string.IsNullOrWhiteSpace(detailModel.LotNo))
+ // {
+ // throw new Exception("褰撳墠鍗曟嵁绫诲瀷鎵规涓嶅彲涓虹┖!");
+ // }
+ //}
+ detailModel.BoxCodeStr = detailModel.LotNo;
+ if (string.IsNullOrWhiteSpace(detailModel.LotNo))
{
- if (string.IsNullOrWhiteSpace(detailModel.LotNo))
+ string toDayTime = DateTime.Now.ToString("yyyyMM");
+ var maxBoxCodeStr = Db.Queryable<BllArrivalNoticeDetail>().Where(m => m.IsDel == "0" && m.BoxCodeStr.Contains("BK") && m.CreateTime.ToString("yyyyMMdd") == DateTime.Now.ToString("yyyyMMdd")).Max(m => m.BoxCodeStr);
+ if(string.IsNullOrWhiteSpace(maxBoxCodeStr))
{
- throw new Exception("褰撳墠鍗曟嵁绫诲瀷鎵规涓嶅彲涓虹┖!");
+ maxBoxCodeStr = "BK" + toDayTime.Substring(2, 4) + "0001";
}
+ else
+ {
+ maxBoxCodeStr = "BK" + (int.Parse(maxBoxCodeStr.Replace("BK", "")) + 1).ToString();
+ }
+ detailModel.BoxCodeStr = maxBoxCodeStr;
}
// 鍒ゆ柇鏄惁宸插瓨鍦ㄥ綋鍓嶆槑缁�
@@ -412,7 +427,7 @@
SkuNo = detailModel.SkuNo,
SkuName = detailModel.SkuName,
Standard = detailModel.Standard,
- LotNo = detailModel.LotNo.Trim(),
+ LotNo = detailModel.LotNo == null ? "" : detailModel.LotNo.Trim(),
LotText = detailModel.LotText,
Qty = (decimal)detailModel.Qty,
PackagNo = detailModel.PackagNo,
@@ -428,6 +443,7 @@
InspectStatus = "0",
Lot1 = lot1, //鐢熶骇鏃ユ湡
Lot2 = lot2, // 杩囨湡鏃ユ湡
+ BoxCodeStr = detailModel.BoxCodeStr,
UDF1 = detailModel.UDF1,
UDF2 = detailModel.UDF2,
UDF3 = detailModel.UDF3,
@@ -553,13 +569,13 @@
return strMessage;
}
- if (model.Type == "0" || model.Type == "2" || model.Type == "3" || model.Type == "4")
- {
- if (string.IsNullOrWhiteSpace(detailModel.LotNo))
- {
- throw new Exception("褰撳墠鍗曟嵁绫诲瀷鎵规涓嶅彲涓虹┖!");
- }
- }
+ //if (model.Type == "0" || model.Type == "2" || model.Type == "3" || model.Type == "4")
+ //{
+ // if (string.IsNullOrWhiteSpace(detailModel.LotNo))
+ // {
+ // throw new Exception("褰撳墠鍗曟嵁绫诲瀷鎵规涓嶅彲涓虹┖!");
+ // }
+ //}
if (TypeLot.Contains(model.Type))
{
@@ -589,29 +605,39 @@
//鐢熸垚鑷湁鎵规
if (detailModel.Id == 0 || detailModel.Id == null || string.IsNullOrWhiteSpace(detailModel.LotNo))
{
- var notice = Db.Queryable<BllArrivalNotice>().Where(m => m.IsDel == "0" && TypeLot.Contains(m.Type)).Select(m => m.ASNNo).ToList();
- if (string.IsNullOrWhiteSpace(maxLotNo))
+ //var notice = Db.Queryable<BllArrivalNotice>().Where(m => m.IsDel == "0" && TypeLot.Contains(m.Type)).Select(m => m.ASNNo).ToList();
+ //if (string.IsNullOrWhiteSpace(maxLotNo))
+ //{
+ // maxLotNo = Db.Queryable<BllArrivalNoticeDetail>().Where(m => m.IsDel == "0" && !string.IsNullOrWhiteSpace(m.LotNo) && notice.Contains(m.ASNNo)).Max(m => m.LotNo);
+ //}
+ //if (string.IsNullOrWhiteSpace(maxLotNo))
+ //{
+ // maxLotNo = toDayTime.Substring(2, 6) + "0001";
+ //}
+ //else
+ //{
+ // var lotStr = maxLotNo.Substring(0, 6);
+ // var timeStr = toDayTime.Substring(2, 6);
+ // if (lotStr == timeStr)
+ // {
+ // maxLotNo = toDayTime.Substring(2, 6) + (int.Parse(maxLotNo.Substring(6, 4)) + 1).ToString().PadLeft(4, '0');
+ // }
+ // else
+ // {
+ // maxLotNo = timeStr + "0001";
+ // }
+ //}
+ //detailModel.LotNo = maxLotNo;
+ var maxBoxCodeStr = Db.Queryable<BllArrivalNoticeDetail>().Where(m => m.IsDel == "0" && m.BoxCodeStr.Contains("BK") && m.CreateTime.ToString("yyyyMMdd") == DateTime.Now.ToString("yyyyMMdd")).Max(m => m.BoxCodeStr);
+ if (string.IsNullOrWhiteSpace(maxBoxCodeStr))
{
- maxLotNo = Db.Queryable<BllArrivalNoticeDetail>().Where(m => m.IsDel == "0" && !string.IsNullOrWhiteSpace(m.LotNo) && notice.Contains(m.ASNNo)).Max(m => m.LotNo);
- }
- if (string.IsNullOrWhiteSpace(maxLotNo))
- {
- maxLotNo = toDayTime.Substring(2, 6) + "0001";
+ maxBoxCodeStr = "BK" + toDayTime.Substring(2, 4) + "0001";
}
else
{
- var lotStr = maxLotNo.Substring(0, 6);
- var timeStr = toDayTime.Substring(2, 6);
- if (lotStr == timeStr)
- {
- maxLotNo = toDayTime.Substring(2, 6) + (int.Parse(maxLotNo.Substring(6, 4)) + 1).ToString().PadLeft(4, '0');
- }
- else
- {
- maxLotNo = timeStr + "0001";
- }
+ maxBoxCodeStr = "BK" + (int.Parse(maxBoxCodeStr.Replace("BK", "")) + 1).ToString();
}
- detailModel.LotNo = maxLotNo;
+ detailModel.BoxCodeStr = maxBoxCodeStr;
}
if (detailModel.Id == 0 || detailModel.Id == null)
@@ -630,7 +656,7 @@
SkuNo = detailModel.SkuNo,
SkuName = detailModel.SkuName,
Standard = detailModel.Standard,
- LotNo = detailModel.LotNo.Trim(),
+ LotNo = detailModel.LotNo == null ? "" : detailModel.LotNo.Trim(),
LotText = detailModel.LotText,
Qty = (decimal)detailModel.Qty,
PackagNo = detailModel.PackagNo,
@@ -646,6 +672,7 @@
InspectStatus = "0",
Lot1 = detailModel.Lot1,
Lot2 = detailModel.Lot2,
+ BoxCodeStr = detailModel.BoxCodeStr,
UDF1 = detailModel.UDF1,
UDF2 = detailModel.UDF2,
UDF3 = detailModel.UDF3,
@@ -695,7 +722,7 @@
detailModel.Money = detailModel.Price * detailModel.Qty;
dbDetail.Qty = (decimal)detailModel.Qty;
- dbDetail.LotNo = detailModel.LotNo;
+ dbDetail.LotNo = detailModel.LotNo == null ? "" : detailModel.LotNo.Trim();
dbDetail.Money = detailModel.Money;
dbDetail.LotText = detailModel.LotText;
dbDetail.SupplierLot = detailModel.SupplierLot;
diff --git a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
index 3aa92c5..57e902e 100644
--- a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
@@ -597,9 +597,13 @@
{
throw new Exception("鍗曟嵁鏁伴噺涓嶈兘灏忎簬绛変簬0");
}
- if (string.IsNullOrWhiteSpace(asnList.LotNo))
+ //if (string.IsNullOrWhiteSpace(asnList.LotNo))
+ //{
+ // throw new Exception("鍗曟嵁鎵规鍙蜂笉鑳戒负绌�");
+ //}
+ if (string.IsNullOrWhiteSpace(asnList.BoxCodeStr))
{
- throw new Exception("鍗曟嵁鎵规鍙蜂笉鑳戒负绌�");
+ throw new Exception("鍗曟嵁绠辩爜甯稿�间笉鑳戒负绌�");
}
var asn = Db.Queryable<BllArrivalNotice>().First(m => m.ASNNo == asnList.ASNNo && m.IsDel == "0");
if (asn == null)
@@ -723,9 +727,16 @@
string maxLotNoStr = ""; //鎵规鍙�
string maxBoxCode = ""; //绠辩爜鍙�
-
- maxLotNoStr = asnList.LotNo;
- maxBoxCode = label.Where(m => m.LotNo == maxLotNoStr).Max(a => a.BoxNo);
+
+ maxLotNoStr = asnList.BoxCodeStr;//asnList.LotNo;
+ if (string.IsNullOrEmpty(asnList.LotNo))
+ {
+ maxBoxCode = label.Where(m => m.ASNDetailNo == asnList.Id).Max(a => a.BoxNo);
+ }
+ else
+ {
+ maxBoxCode = label.Where(m => m.LotNo == maxLotNoStr).Max(a => a.BoxNo);
+ }
#endregion
for (int i = 1; i <= labelNum; i++)
@@ -772,7 +783,7 @@
Status = "0",
SkuNo = asnList.SkuNo,
SkuName = asnList.SkuName,
- LotNo = maxLotNoStr,
+ LotNo = asnList.LotNo,//maxLotNoStr,
Standard = asnList.Standard,
PackageStandard = packStr,
SupplierLot = supplierLot,
diff --git a/Wms/WMS.Entity/BllAsnEntity/BllArrivalNoticeDetail.cs b/Wms/WMS.Entity/BllAsnEntity/BllArrivalNoticeDetail.cs
index c8a1948..9953fda 100644
--- a/Wms/WMS.Entity/BllAsnEntity/BllArrivalNoticeDetail.cs
+++ b/Wms/WMS.Entity/BllAsnEntity/BllArrivalNoticeDetail.cs
@@ -171,6 +171,11 @@
public string Lot6 { get; set; }
/// <summary>
+ /// 鏍囩甯稿��
+ /// </summary>
+ public string BoxCodeStr { get; set; }
+
+ /// <summary>
/// 鑷畾涔夊垪1
/// </summary>
public string UDF1 { get; set; }
--
Gitblit v1.8.0