From 1b42335a7becd0a6e3d63d6ed230194754f33763 Mon Sep 17 00:00:00 2001
From: Administrator <Administrator@DESKTOP-5BIMHQ3>
Date: 星期一, 05 二月 2024 11:37:36 +0800
Subject: [PATCH] Merge branch 'wxw'
---
Wms/WMS.Entity/DataEntity/DataStockDetail.cs | 2
Pda/View/AsnSetting/pingKuEnter.html | 2
Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs | 3
Wms/Wms/Controllers/PdaAsnController.cs | 33 ++++
Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs | 375 +++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 413 insertions(+), 2 deletions(-)
diff --git a/Pda/View/AsnSetting/pingKuEnter.html b/Pda/View/AsnSetting/pingKuEnter.html
index 746dbea..03eaa90 100644
--- a/Pda/View/AsnSetting/pingKuEnter.html
+++ b/Pda/View/AsnSetting/pingKuEnter.html
@@ -409,7 +409,7 @@
ASNNo:$("#bar").val()
}
param.Qty=Number(param.Qty)
- sendData(IP + "/PdaAsn/CompleteInStock", param, 'post', function(res) {
+ sendData(IP + "/PdaAsn/ConfirmInStock", param, 'post', function(res) {
if (res.code == 0) { //鎴愬姛
layer.msg(res.msg, {
icon: 1,
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
index 676cfdc..dcec486 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -2004,5 +2004,380 @@
}
}
#endregion
+
+ #region 骞冲簱鍏ュ簱
+ /// <summary>
+ /// 骞冲簱纭鍏ュ簱
+ /// </summary>
+ /// <param name="model"></param>
+ public void ConfirmInStock(PalletBindVm model)
+ {
+ try
+ {
+ #region 楠岃瘉淇℃伅
+ if (string.IsNullOrEmpty(model.ASNNo))
+ {
+ throw new Exception("鍏ュ簱鍗曚笉鑳戒负绌�!");
+ }
+ if (string.IsNullOrEmpty(model.PalletNo))
+ {
+ throw new Exception("鎵樼洏鏉$爜涓嶈兘涓虹┖!");
+ }
+ if (string.IsNullOrEmpty(model.LocatNo))
+ {
+ throw new Exception("鍌ㄤ綅鍦板潃涓嶈兘涓虹┖!");
+ }
+ #endregion
+ //鑾峰彇褰撳墠鏃堕棿
+ DateTime serverTime = Db.Ado.GetDateTime("select GETDATE();");
+
+ #region 鏄惁鍥炴祦鍏ュ簱
+ int iscount = 0;
+ //搴撳瓨鏄庣粏淇℃伅
+ var stockDetail = Db.Queryable<DataStockDetail>().Where(a => a.IsDel == "0" && a.PalletNo == model.PalletNo).ToList();
+ //楠岃瘉搴撳瓨鏄惁鎷ユ湁璇ユ墭淇℃伅
+ if (stockDetail != null && stockDetail.Count > 0)
+ {
+ iscount = 1; //鍥炴祦鍏ュ簱
+ }
+ #endregion
+
+ #region 鎵樼洏缁戝畾淇℃伅
+ var bindInfo = Db.Queryable<BllPalletBind>().First(w => w.IsDel == "0" && w.ASNNo == model.ASNNo && w.PalletNo == model.PalletNo && w.Status != "2");
+ if (iscount == 0)
+ {
+ if (bindInfo == null)
+ {
+ throw new Exception("鎵樼洏缁戝畾淇℃伅涓嶅瓨鍦紝璇锋牳鏌�!");
+ }
+ if (!string.IsNullOrEmpty(bindInfo.WareHouseNo))
+ {
+ throw new Exception("璇ユ墭鐩樻湭鍦ㄥ簱澶栵紝璇锋牳鏌�!");
+ }
+ }
+
+ #endregion
+
+ #region 鍦扮爜淇℃伅(鍌ㄤ綅淇℃伅)
+ var storageLocat = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == model.LocatNo && w.Status == "0" && w.WareHouseNo == "W02");
+ if (storageLocat == null)
+ {
+ throw new Exception("鍌ㄤ綅淇℃伅涓嶅瓨鍦ㄦ垨闈炵┖闂茬姸鎬侊紝璇锋牳鏌�!");
+ }
+ #endregion
+
+ Db.BeginTran();//寮�鍚簨鍔�
+ if (iscount == 0)//姝e父鍏ュ簱
+ {
+ #region 绠辩爜淇℃伅
+ var boxInfoList = Db.Queryable<BllBoxInfo>().Where(w => w.IsDel == "0" && w.ASNNo == model.ASNNo).ToList();
+ //楠岃瘉绠辩爜淇℃伅鏄惁瀛樺湪
+ if (boxInfoList.Count <= 0)
+ {
+ throw new Exception("绠辩爜淇℃伅涓嶅瓨鍦紝璇锋牳鏌�!");
+ }
+ foreach (var item in boxInfoList)
+ {
+ item.Status = "2"; // 鏀瑰彉绠辨敮鍏崇郴琛ㄧ姸鎬侊細宸插叆搴�
+ item.UpdateTime = serverTime;
+ item.UpdateUser = model.CreateUser;
+ }
+ Db.Updateable(boxInfoList).ExecuteCommand();
+ #endregion
+
+ #region 鍏ュ簱鎬诲崟淇℃伅
+ var notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.Status != "3" && a.ASNNo == model.ASNNo);
+ //楠岃瘉鍏ュ簱鍗曟�诲崟鏄惁鍏抽棴
+ if (notice == null)
+ {
+ throw new Exception("鍏ュ簱鍗曟�诲崟淇℃伅涓嶅瓨鍦紝璇锋牳鏌�!");
+ }
+ //鍒ゆ柇鍏ュ簱鍗曟�诲崟鏄惁涓哄凡鍏抽棴
+ if (notice.Status == "3")
+ {
+ throw new Exception("鍏ュ簱鍗曟�诲崟宸插叧闂紝璇锋牳鏌�!");
+ }
+ #endregion
+
+ bool isFinsh = true;//鏄惁鍏ㄩ儴鍏ュ簱瀹屾垚
+ #region 鍏ュ簱鍗曟槑缁�
+ var noticeDetail = Db.Queryable<BllArrivalNoticeDetail>().First(w => w.IsDel == "0" && w.ASNNo == model.ASNNo && w.Id == bindInfo.ASNDetailNo);
+ if (noticeDetail == null)
+ {
+ throw new Exception("鍏ュ簱鍗曟槑缁嗕俊鎭笉瀛樺湪锛岃鏍告煡!");
+ }
+ noticeDetail.CompleteQty += bindInfo.Qty;//澧炲姞鍏ュ簱鏁伴噺
+ //鍒ゆ柇鍏ュ簱鏁伴噺澧炲姞鍚庢槸鍚﹀ぇ浜庣瓑浜庡崟鎹暟閲�
+ if (noticeDetail.CompleteQty >= noticeDetail.Qty)
+ {
+ noticeDetail.Status = "2";//鎵ц瀹屾垚
+ noticeDetail.CompleteTime = serverTime;
+ }
+ else
+ {
+ noticeDetail.Status = "1";//姝e湪鎵ц
+
+ isFinsh = false;
+ }
+ noticeDetail.UpdateUser = model.CreateUser;
+ noticeDetail.UpdateTime = serverTime;
+ Db.Updateable(noticeDetail).ExecuteCommand();
+ #endregion
+
+ #region 鐗╂枡淇℃伅
+ var sku = Db.Queryable<SysMaterials>().First(s => s.SkuNo == noticeDetail.SkuNo && s.IsDel == "0" && s.SkuName == noticeDetail.SkuName);
+ //鍒ゆ柇鐗╂枡淇℃伅鏄惁涓虹┖
+ if (sku == null)
+ {
+ throw new Exception("鐗╂枡淇℃伅涓嶅瓨鍦紝璇锋牳鏌�!");
+ }
+ #endregion
+
+ #region 搴撳瓨鎬昏〃
+ // 鍒ゆ柇褰撳墠鐗╂枡搴撳瓨琛ㄦ槸鍚﹀凡瀛樺湪
+ var stockModel = Db.Queryable<DataStock>().First(w => w.IsDel == "0" && w.SkuNo == noticeDetail.SkuNo && w.LotNo == bindInfo.LotNo && w.Standard == noticeDetail.Standard);
+ if (stockModel == null || stockModel.Id == 0)
+ {
+ stockModel = new DataStock
+ {
+ LotNo = bindInfo.LotNo,
+ LotText = bindInfo.LotText,
+ SupplierLot = bindInfo.SupplierLot,
+ SkuNo = noticeDetail.SkuNo,
+ SkuName = noticeDetail.SkuName,
+ Qty = bindInfo.Qty,
+ Standard = noticeDetail.Standard,
+ CreateUser = (int)model.CreateUser,
+ CreateTime = serverTime
+ };
+ //鏂板搴撳瓨鎬讳俊鎭�
+ Db.Insertable<DataStock>(stockModel).ExecuteCommand();
+ }
+ else
+ {
+ stockModel.Qty += bindInfo.Qty;
+ stockModel.UpdateUser = (int)model.CreateUser;
+ stockModel.UpdateTime = serverTime;
+ //淇敼搴撳瓨鎬讳俊鎭�
+ Db.Updateable(stockModel).ExecuteCommand();
+ }
+ #endregion
+
+ #region 搴撳瓨鏄庣粏琛�
+ // 鍒ゆ柇褰撳墠鎵樼洏鏄惁宸插瓨鍦紙鎷h揣鍥炲簱鎵樼洏锛�
+ var detailModel = Db.Queryable<DataStockDetail>().First(it => it.PalletNo == bindInfo.PalletNo && it.LotNo == bindInfo.LotNo && it.SkuNo == noticeDetail.SkuNo
+ && it.Standard == noticeDetail.Standard && it.IsDel == "0");
+ var stId = 0;
+ if (detailModel == null || detailModel.Id == 0)
+ {
+ // 娣诲姞搴撳瓨鏄庣粏琛�
+ detailModel = new DataStockDetail()
+ {
+ LotNo = bindInfo.LotNo,
+ LotText = bindInfo.LotText,
+ SupplierLot = noticeDetail.SupplierLot,
+ SkuNo = noticeDetail.SkuNo,
+ SkuName = noticeDetail.SkuName,
+ Standard = noticeDetail.Standard,
+ Qty = bindInfo.Qty,
+ LockQty = 0,
+ FrozenQty = 0,
+ InspectQty = bindInfo.Qty,
+ ASNNo = noticeDetail.ASNNo,
+ ASNDetailNo = (int)bindInfo.ASNDetailNo,
+ WareHouseNo = "W02",
+ RoadwayNo = "",
+ AreaNo = "",
+ LocatNo = model.LocatNo,
+ PalletNo = model.PalletNo,
+ PalletNo2 = bindInfo.PalletNo2,
+ PalletNo3 = bindInfo.PalletNo3,
+ CompleteTime = serverTime,
+ ProductionTime = bindInfo.ProductionTime,
+ ExpirationTime = bindInfo.ExpirationTime,
+ Status = "0",
+ InspectMark = bindInfo.InspectMark,
+ BitPalletMark = bindInfo.BitPalletMark,
+ InspectStatus = sku.IsInspect,// 缁勭洏鐨勬椂鍊欏氨瑕侀粯璁よ瀹氬ソ鏄惁鍚堟牸
+ PackagNo = sku.PackagNo,
+ IsBale = bindInfo.IsBale,
+ IsBelt = bindInfo.IsBelt,
+ CreateUser = (int)model.CreateUser,
+ CreateTime = serverTime
+ };
+ stId = Db.Insertable<DataStockDetail>(detailModel).ExecuteReturnIdentity();
+
+ }
+ else
+ {
+ stId = detailModel.Id;
+ detailModel.LocatNo = model.LocatNo;
+ detailModel.UpdateTime = serverTime;
+ detailModel.UpdateUser = (int)model.CreateUser;
+ // 鍙樻洿鍌ㄤ綅鍦板潃
+ Db.Updateable<DataStockDetail>(detailModel).UpdateColumns(it => new { it.LocatNo, it.UpdateTime, it.UpdateUser }).ExecuteCommand();
+ }
+ #endregion
+
+ #region 浠诲姟鍙婄粍鎵樹俊鎭�
+ //鍒涘缓浠诲姟淇℃伅
+ var taskNo = new Common().GetMaxNo("TK");
+ var exTask = new LogTask //鍏ュ簱浠诲姟
+ {
+ TaskNo = taskNo,
+ Sender = "WMS",
+ Receiver = "PDA",
+ IsSuccess = 1, //鏄惁涓嬪彂鎴愬姛 0澶辫触 1鎴愬姛
+ SendDate = serverTime, //鍙戦�佹椂闂�
+ BackDate = serverTime, //杩斿洖鏃堕棿
+ StartLocat = "",//璧峰浣嶇疆
+ EndLocat = "鍔涜骞冲簱",//鐩爣浣嶇疆
+ PalletNo = bindInfo.PalletNo,//鎵樼洏鐮�
+ IsSend = 0,//鏄惁鍙啀娆′笅鍙�
+ IsCancel = 0,//鏄惁鍙彇娑�
+ IsFinish = 0,//鏄惁鍙畬鎴�
+ Type = "0",//浠诲姟绫诲瀷 0 鍏ュ簱浠诲姟 1 鍑哄簱浠诲姟 2 绉诲簱浠诲姟
+ Status = "2",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚
+ OrderType = "0",//0 鍏ュ簱鍗� 1 鍑哄簱鍗� 2 鐩樼偣鍗� 3 绉诲簱鍗�
+ Msg = "鍔涜骞冲簱鐨勫叆搴撲换鍔�",
+ };
+ Db.Insertable(exTask).ExecuteCommand();
+
+ //淇敼缁勬墭鐘舵��
+ bindInfo.Status = "2"; //2 鍏ュ簱瀹屾垚
+ bindInfo.WareHouseNo = "W02";//鎵�灞炰粨搴�
+ bindInfo.LocatNo = model.LocatNo;//鍌ㄤ綅鍦板潃
+ bindInfo.UpdateTime = serverTime;
+ bindInfo.UpdateUser = model.CreateUser;
+ bindInfo.CompleteTime = serverTime; //瀹屾垚鏃堕棿
+ bindInfo.TaskNo = taskNo; //浠诲姟鍙�
+ Db.Updateable(bindInfo).ExecuteCommand();
+ #endregion
+
+ #region 搴撳瓨绠辨敮鏄庣粏琛�
+ // 鎻掑叆鏂扮粍鐨勭鏀俊鎭�
+ var comTime = DateTime.Now;
+ foreach (var item in boxInfoList)
+ {
+ var info = new DataBoxInfo()
+ {
+ StockDetailId = stId,
+ BindNo = bindInfo.Id,
+ BoxNo = item.BoxNo,
+ BoxNo2 = item.BoxNo2,
+ BoxNo3 = item.BoxNo3,
+ PalletNo = item.PalletNo,
+ PalletNo2 = item.PalletNo2,
+ PalletNo3 = item.PalletNo3,
+ Qty = item.Qty,
+ FullQty = item.FullQty,
+ Status = "2",
+ LotNo = item.LotNo,
+ LotText = item.LotText,
+ SkuNo = item.SkuNo,
+ SkuName = item.SkuName,
+ Standard = sku.Standard,
+ ProductionTime = item.ProductionTime,
+ SupplierLot = item.SupplierLot,
+ InspectMark = item.InspectMark,
+ BitBoxMark = item.BitBoxMark,
+ InspectStatus = item.InspectStatus,
+ //InspectTime = item.,
+
+ IsDel = "0",
+ CreateUser = 0,
+ CreateTime = comTime
+ };
+ Db.Insertable(info).ExecuteCommand();
+ }
+ #endregion
+
+ var entryList = Db.Queryable<BllArrivalNoticeDetail>().Where(w => w.IsDel == "0" && w.ASNNo == notice.ASNNo && w.Id != noticeDetail.Id && w.Status != "2").ToList();
+ if (isFinsh && entryList.Count <= 0)//鍏ュ簱鍗曟槑缁嗗叏閮ㄥ畬鎴�
+ {
+ //淇敼鍏ュ簱鍗曟�诲崟淇℃伅
+ notice.Status = "2";
+ notice.UpdateUser = model.CreateUser;
+ notice.UpdateTime = serverTime;
+ Db.Updateable(notice).ExecuteCommand();
+ }
+ else
+ {
+ //鍒ゆ柇鎬诲崟鐘舵�佹槸鍚︿负姝e湪鎵ц
+ if (notice.Status == "0")
+ {
+ //淇敼鍏ュ簱鍗曟�诲崟淇℃伅
+ notice.Status = "1";
+ notice.UpdateUser = model.CreateUser;
+ notice.UpdateTime = serverTime;
+ Db.Updateable(notice).ExecuteCommand();
+ }
+ }
+ }
+ else
+ {
+ //淇敼搴撳瓨鏄庣粏淇℃伅
+ foreach (var item in stockDetail)
+ {
+ item.Status = "0"; //鐘舵�佹洿鏀逛负寰呭垎閰�
+ item.WareHouseNo = "W02"; //鎵�灞炰粨搴�
+ item.LocatNo = model.LocatNo;//鍌ㄤ綅鍦板潃
+ item.UpdateTime = serverTime; //淇敼鏃堕棿
+ item.UpdateUser = model.CreateUser; //淇敼浜�
+ //淇敼搴撳瓨鏄庣粏淇℃伅
+ Db.Updateable(item).ExecuteCommand();
+ }
+ //鑾峰彇鎷h揣淇℃伅
+ var alotr = Db.Queryable<BllExportAllot>().First(a => a.IsDel == "0" && a.PalletNo == model.PalletNo && a.Status == "4");
+ if (alotr != null)
+ {
+ alotr.Status = "5"; //5 宸插畬鎴�
+ alotr.UpdateUser = model.CreateUser; //淇敼浜�
+ alotr.UpdateTime = serverTime; //淇敼鏃堕棿
+ //淇敼鎷h揣淇℃伅
+ Db.Updateable(alotr).ExecuteCommand();
+ }
+ #region 浠诲姟鍙婄粍鎵樹俊鎭�
+ //鍒涘缓浠诲姟淇℃伅
+ var taskNo = new Common().GetMaxNo("TK");
+ var exTask = new LogTask //鍏ュ簱浠诲姟
+ {
+ TaskNo = taskNo,
+ Sender = "WMS",
+ Receiver = "PDA",
+ IsSuccess = 1, //鏄惁涓嬪彂鎴愬姛 0澶辫触 1鎴愬姛
+ SendDate = DateTime.Now, //鍙戦�佹椂闂�
+ BackDate = DateTime.Now, //杩斿洖鏃堕棿
+ StartLocat = "",//璧峰浣嶇疆
+ EndLocat = "鍔涜骞冲簱",//鐩爣浣嶇疆
+ PalletNo = model.PalletNo,//鎵樼洏鐮�
+ IsSend = 0,//鏄惁鍙啀娆′笅鍙�
+ IsCancel = 0,//鏄惁鍙彇娑�
+ IsFinish = 0,//鏄惁鍙畬鎴�
+ Type = "0",//浠诲姟绫诲瀷 0 鍏ュ簱浠诲姟 1 鍑哄簱浠诲姟 2 绉诲簱浠诲姟
+ Status = "2",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚
+ OrderType = "0",//0 鍏ュ簱鍗� 1 鍑哄簱鍗� 2 鐩樼偣鍗� 3 绉诲簱鍗�
+ Msg = "鍔涜骞冲簱鐨勫洖搴撲换鍔�",
+ };
+ Db.Insertable(exTask).ExecuteCommand();
+ #endregion
+ }
+ storageLocat.Status = "1";//鐘舵�佸凡浣跨敤
+ storageLocat.UpdateTime = serverTime; //淇敼鏃堕棿
+ storageLocat.UpdateUser = model.CreateUser; //淇敼浜�
+ //淇敼鍌ㄤ綅淇℃伅
+ Db.Updateable(storageLocat).ExecuteCommand();
+
+ new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "骞冲簱鍏ュ簱", model.PalletNo, "瀹屾垚", $"鍦≒DA涓婂畬鎴愬崟鎹彿涓猴細{model.ASNNo}鐨勬墭鐩樼爜涓猴細{model.PalletNo}鐨勫钩搴撳叆搴撴搷浣�", (int)model.CreateUser);
+
+ Db.CommitTran();
+ }
+ catch (Exception ex)
+ {
+ Db.RollbackTran();
+ throw ex;
+ }
+ }
+ #endregion
}
}
diff --git a/Wms/WMS.Entity/DataEntity/DataStockDetail.cs b/Wms/WMS.Entity/DataEntity/DataStockDetail.cs
index 301fffc..dcd75c1 100644
--- a/Wms/WMS.Entity/DataEntity/DataStockDetail.cs
+++ b/Wms/WMS.Entity/DataEntity/DataStockDetail.cs
@@ -79,7 +79,7 @@
/// Default:
/// Nullable:True
/// </summary>
- public int? InspectQty { get; set; }
+ public decimal? InspectQty { get; set; }
/// <summary>
/// Desc:鍏ュ簱鍗曞彿
diff --git a/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs b/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
index 10d4b2c..bf70ee5 100644
--- a/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
+++ b/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
@@ -66,5 +66,8 @@
//鏍规嵁鍗曟嵁鍙疯幏鍙栧崟鎹槑缁嗗垪琛�
List<ArrivalNoticeDetailDto> GetBindArrivalNoticeDetails(ArrivalNoticeVm model);
+
+ //骞冲簱纭鍏ュ簱
+ void ConfirmInStock(PalletBindVm model);
}
}
diff --git a/Wms/Wms/Controllers/PdaAsnController.cs b/Wms/Wms/Controllers/PdaAsnController.cs
index c70ef85..f1067ab 100644
--- a/Wms/Wms/Controllers/PdaAsnController.cs
+++ b/Wms/Wms/Controllers/PdaAsnController.cs
@@ -508,5 +508,38 @@
}
}
#endregion
+
+ #region 骞冲簱鍏ュ簱
+ /// <summary>
+ /// 骞冲簱纭鍏ュ簱
+ /// </summary>
+ /// <param name="model"></param>
+ /// <returns></returns>
+ [HttpPost]
+ public IActionResult ConfirmInStock(PalletBindVm model)
+ {
+ try
+ {
+ var claimsIdentity = this.User.Identity as ClaimsIdentity;
+ if (claimsIdentity == null)
+ {
+ throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
+ }
+ string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
+ if (string.IsNullOrWhiteSpace(UserId))
+ {
+ throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
+ }
+ model.CreateUser = int.Parse(UserId);
+ _PdaAsnSvc.ConfirmInStock(model);
+
+ return Ok(new { code = 0, msg = "鍏ュ簱鎴愬姛!" });
+ }
+ catch (Exception e)
+ {
+ return Ok(new { code = 1, msg = e.Message });
+ }
+ }
+ #endregion
}
}
--
Gitblit v1.8.0