From f2bc08e28dda7022202f07217f6a3c150f818af7 Mon Sep 17 00:00:00 2001
From: zhaowc <526854230@qq.com>
Date: 星期一, 20 一月 2025 08:32:16 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/liudongl/jc24-wms
---
Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs | 145 +++++++++++++++++++++++++++++++++++++++---------
1 files changed, 118 insertions(+), 27 deletions(-)
diff --git a/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs b/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
index eb2d920..50a3dd7 100644
--- a/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
@@ -21,6 +21,7 @@
using WMS.Entity.SysEntity;
using WMS.IBLL.IBllAsnServer;
using WMS.Entity.BllQualityEntity;
+using WMS.Entity.BllCheckEntity;
namespace WMS.BLL.BllAsnServer
{
@@ -77,12 +78,13 @@
{
throw new Exception("鍗曟嵁鍙蜂笉鍙负绌�!");
}
- if (model.AsnDetailNo == 0)
- {
- throw new Exception("鍗曟嵁鏄庣粏涓嶅彲涓虹┖!");
- }
+ //if (model.AsnDetailNo == 0)
+ //{
+ // throw new Exception("鍗曟嵁鏄庣粏涓嶅彲涓虹┖!");
+ //}
//鏍规嵁鍗曟嵁鍙疯幏鍙栧叆搴撳崟鎬诲崟
- notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.AsnNo && a.OrderCode == model.OrderCode);
+ notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.AsnNo);
+ //notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.AsnNo && a.OrderCode == model.OrderCode);
if (notice.Status != "0" && notice.Status != "1" && notice.Status != "2")
{
throw new Exception("璇ュ崟鎹凡鍏冲崟!");
@@ -96,7 +98,8 @@
throw new Exception("鎵规涓嶈兘涓虹┖!");
}
// 楠岃瘉鍏ュ簱鍗曟槑缁嗘槸鍚﹀瓨鍦�
- detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailNo && m.ASNNo == model.AsnNo && m.LotNo == model.LotNo && m.SkuNo == model.SkuNo);
+ detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.ASNNo == notice.ASNNo && m.LotNo == model.LotNo && m.SkuNo == model.SkuNo);
+ //detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailNo && m.ASNNo == model.AsnNo && m.LotNo == model.LotNo && m.SkuNo == model.SkuNo);
if (detail == null)
{
throw new Exception("褰撳墠鐗╂枡鍙婃壒娆′笌鍗曟嵁鏃犲叧鑱旓紝璇锋牳瀹�!");
@@ -176,18 +179,19 @@
#endregion
//鍒ゆ柇鎵樼洏缁戝畾淇℃伅涓槸鍚︽湁
- var bind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNDetailNo == model.AsnDetailNo && m.PalletNo == model.PalletNo && m.Status != "2");
+ var bind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNDetailNo == detail.Id && m.PalletNo == model.PalletNo && m.Status != "2");
var bindId = 0;
+ var boxQtyZong = model.Detail.Sum(m => m.Qty);
if (bind == null)
{
bind = new BllPalletBind
{
- ASNNo = model.AsnNo,
- ASNDetailNo = model.AsnDetailNo,
+ ASNNo = notice.ASNNo,
+ ASNDetailNo = detail.Id,
PalletNo = model.PalletNo,
PalletNo2 = "",
PalletNo3 = "",
- Qty = model.Qty,
+ Qty = boxQtyZong,
FullQty = pNum,
Status = "0",//绛夊緟鎵ц
Type = model.Type, //鎵樼洏绫诲瀷 0鐗╂枡鎵� 1绌烘墭鐩樻墭
@@ -211,7 +215,8 @@
}
else
{
- throw new Exception("缁勭洏淇℃伅閲嶅");
+ //throw new Exception("缁勭洏淇℃伅閲嶅");
+ return;
}
@@ -230,8 +235,8 @@
{
var boxInfo = new BllBoxInfo()
{
- ASNNo = model.AsnNo,
- ASNDetailNo = model.AsnDetailNo,
+ ASNNo = notice.ASNNo,
+ ASNDetailNo = detail.Id,
OrderCode = box.OrderCode,
BindNo = bindId,
BoxNo = box.BoxNo,
@@ -270,10 +275,10 @@
}
else if (model.Type == "0")//鐗╂枡鎵�
{
- if (model.Detail.Count(m => m.OrderCode != detail.OrderDetailCode) > 0)
- {
- throw new Exception($"鎵樼洏缁戝畾鏄庣粏涓紝鍚湁绠辩爜鐢熶骇宸ュ崟涓嶄竴鑷�");
- }
+ //if (model.Detail.Count(m => m.OrderCode != detail.OrderDetailCode) > 0)
+ //{
+ // throw new Exception($"鎵樼洏缁戝畾鏄庣粏涓紝鍚湁绠辩爜鐢熶骇宸ュ崟涓嶄竴鑷�");
+ //}
if (model.Detail.Count(m => m.SkuNo != model.SkuNo || m.LotNo != model.LotNo) > 0)
{
throw new Exception($"鎵樼洏缁戝畾鏄庣粏涓紝鍚湁绠辩爜鐗╂枡鎴栨壒娆′笉涓�鑷�");
@@ -288,8 +293,8 @@
boxFullQty += box.Qty;
var boxInfo = new BllBoxInfo()
{
- ASNNo = model.AsnNo,
- ASNDetailNo = model.AsnDetailNo,
+ ASNNo = detail.ASNNo,
+ ASNDetailNo = detail.Id,
OrderCode = box.OrderCode,
BindNo = bindId,
BoxNo = box.BoxNo,
@@ -314,8 +319,8 @@
Standard = box.Standard,
PackageStandard = box.PackageStandard,
StoreTime = box.StoreTime,
- QtyCount = (int)box.QtyCount,
- QtyOrd = (int)box.QtyOrd,
+ QtyCount = box.QtyCount.HasValue? (int)box.QtyCount : 0,
+ QtyOrd = box.QtyOrd.HasValue ? (int)box.QtyOrd : 0,
CreateUser = userId,
CreateTime = comTime,
};
@@ -376,9 +381,9 @@
// 鏇存敼鎵樼洏浣跨敤鐘舵��
var sqlStr = $"update SysPallets set Status = '1' where PalletNo = '{model.PalletNo}';";
//娣诲姞鎵樼洏璁板綍琛ㄦ暟鎹�
- sqlStr += $"insert into LogPalletTrack values('{model.PalletNo}','{model.AsnNo}','缁勭洏','0',getDate(),{userId},NULL,NULL);";
+ sqlStr += $"insert into LogPalletTrack values('{model.PalletNo}','{notice.ASNNo}','缁勭洏','0',getDate(),{userId},NULL,NULL);";
Db.Ado.ExecuteCommand(sqlStr);
- new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "鎵樼洏缁戝畾", model.AsnNo, "娣诲姞", $"娣诲姞浜嗘墭鐩樼爜涓猴細{model.PalletNo}鐨勭粍鐩樹俊鎭�", userId);
+ new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "鎵樼洏缁戝畾", notice.ASNNo, "娣诲姞", $"娣诲姞浜嗘墭鐩樼爜涓猴細{model.PalletNo}鐨勭粍鐩樹俊鎭�", userId);
Db.CommitTran();
}
@@ -491,6 +496,7 @@
.GroupBy((a, b) => new
{
a.PalletNo,
+ a.BindNo,
a.BoxNo,
a.SkuNo,
a.SkuName,
@@ -508,6 +514,7 @@
.Select((a, b) => new BoxInfoDto()
{
BoxNo = a.BoxNo,
+ BindNo = a.BindNo,
PalletNo = a.PalletNo,
Qty = SqlFunc.AggregateSum(a.Qty),
FullQty = a.FullQty,
@@ -538,9 +545,10 @@
/// <param name="boxNo">绠辩爜</param>
/// <param name="boxNo3">鏀爜</param>
/// <returns></returns>
- public List<BoxInfoDto> GetBoxInfoByBoxNo(string boxNo, string boxNo3)
+ public List<BoxInfoDto> GetBoxInfoByBoxNo(string bindNo, string boxNo, string boxNo3)
{
Expression<Func<BllBoxInfo, bool>> item = Expressionable.Create<BllBoxInfo>()
+ .AndIF(!string.IsNullOrWhiteSpace(bindNo), it => it.BindNo == int.Parse(bindNo))
.AndIF(!string.IsNullOrWhiteSpace(boxNo), it => it.BoxNo == boxNo.Trim())
.AndIF(!string.IsNullOrWhiteSpace(boxNo3), it => it.BoxNo3.Contains(boxNo3.Trim()))
.And(m => m.IsDel == "0")
@@ -1179,7 +1187,7 @@
EndLocate = beingTask.EndLocat, // 鐩爣浣嶇疆
EndRoadway = beingTask.EndRoadway, // 鐩爣宸烽亾
TaskNo = beingTask.TaskNo, // 浠诲姟鍙�
- TaskType = "0",// 浠诲姟绫诲瀷 (鍑哄簱)
+ TaskType = "0",// 浠诲姟绫诲瀷 (鍏ュ簱)
OutMode = "", //鐩爣鍦板潃
Order = 1
};
@@ -1901,9 +1909,9 @@
EndLocate = beingTask.EndLocat, // 鐩爣浣嶇疆
EndRoadway = beingTask.EndRoadway, // 鐩爣宸烽亾
TaskNo = beingTask.TaskNo, // 浠诲姟鍙�
- TaskType = "0",// 浠诲姟绫诲瀷 (鍑哄簱)
+ TaskType = "0",// 浠诲姟绫诲瀷 (鍑哄簱)
OutMode = "", //鐩爣鍦板潃
- Order = 1
+ Order = 1
};
if (beingTask.IsSuccess == 0)
{
@@ -2520,6 +2528,7 @@
SkuName = boxInfo.SkuName,
Standard = sku.Standard,
ProductionTime = boxInfo.ProductionTime,
+ ExpirationTime = boxInfo.ExpirationTime,
SupplierLot = boxInfo.SupplierLot,
InspectStatus = boxInfo.InspectStatus,
InspectMark = boxInfo.InspectMark,
@@ -2693,6 +2702,7 @@
SkuName = demo.SkuName,
Standard = noticeDetail.Standard,
ProductionTime = demo.ProductionTime,
+ ExpirationTime = demo.ExpirationTime,
SupplierLot = demo.SupplierLot,
InspectStatus = demo.InspectStatus,
InspectMark = demo.InspectMark,
@@ -3178,6 +3188,87 @@
}
+ //鐢宠缂犺啘鍏ュ簱
+ public int RequestPackWcs(string palletNo)
+ {
+ try
+ {
+ int t = -1;
+ //楠岃瘉鎵樼洏鏉$爜鏄惁涓虹┖
+ if (string.IsNullOrEmpty(palletNo))
+ {
+ throw new Exception("鏈壘鍒拌鎵樼洏鏉$爜锛�"+ palletNo);
+ }
+ var palletBindList = Db.Queryable<BllPalletBind>().Where(m => m.IsDel == "0" && m.PalletNo == palletNo && m.Status == "1").OrderByDescending(m=>m.CreateTime).First();
+ if (palletBindList.IsBale == "1")
+ {
+ t = 1;
+ }
+ return t;
+
+ }
+ catch (Exception e)
+ {
+ throw new Exception(e.Message);
+
+ }
+ }
+
+ //鐢宠鎷嗚啘鍑哄簱
+ public int RequestUnPackWcs(string palletNo)
+ {
+ try
+ {
+ int t = -1;
+ //楠岃瘉鎵樼洏鏉$爜鏄惁涓虹┖
+ if (string.IsNullOrEmpty(palletNo))
+ {
+ throw new Exception("鏈壘鍒拌鎵樼洏鏉$爜锛�" + palletNo);
+ }
+ var palletBindList = Db.Queryable<DataStockDetail>().Where(m => m.IsDel == "0" && m.PalletNo == palletNo && m.LocatNo.Substring(0,1) != "B").First();
+ if (palletBindList.IsBale == "2")
+ {
+ palletBindList.IsBale = "0";
+ Db.Updateable(palletBindList).ExecuteCommand();
+ t = 1;
+ }
+
+ return t;
+ }
+ catch (Exception e)
+ {
+ throw new Exception(e.Message);
+
+ }
+ }
+
+ //缂犺啘瀹屾垚
+ public int RequestPackedWcs(string palletNo)
+ {
+ try
+ {
+ int t = -1;
+ //楠岃瘉鎵樼洏鏉$爜鏄惁涓虹┖
+ if (string.IsNullOrEmpty(palletNo))
+ {
+ throw new Exception("鏈壘鍒拌鎵樼洏鏉$爜锛�" + palletNo);
+ }
+ var palletBindList = Db.Queryable<BllPalletBind>().Where(m => m.IsDel == "0" && m.PalletNo == palletNo && m.Status == "1").OrderByDescending(m => m.CreateTime).First();
+ if (palletBindList.IsBale == "1")
+ {
+ palletBindList.IsBale = "2";
+ Db.Updateable(palletBindList).ExecuteCommand();
+ t = 1;
+ }
+
+ return t;
+ }
+ catch (Exception e)
+ {
+ throw new Exception(e.Message);
+
+ }
+ }
////閲嶆柊涓嬪彂鍏ュ簱浠诲姟
//public OutCommandDto AgainSendAsnTask(string taskNo, int userId, string url)
--
Gitblit v1.8.0