From cb4ee362c99bc7902663c3134e6b0f103434946a Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期一, 30 六月 2025 14:10:40 +0800
Subject: [PATCH] PDA增加仓库收货页面

---
 Pda/View/AsnSetting/WarehouseTake.html   |  158 ++++++++++++++++++++++++++
 Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs |    6 +
 Wms/Wms/Controllers/PdaAsnController.cs  |   33 +++++
 Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs |  108 ++++++++++++++++++
 4 files changed, 305 insertions(+), 0 deletions(-)

diff --git a/Pda/View/AsnSetting/WarehouseTake.html b/Pda/View/AsnSetting/WarehouseTake.html
new file mode 100644
index 0000000..60afce2
--- /dev/null
+++ b/Pda/View/AsnSetting/WarehouseTake.html
@@ -0,0 +1,158 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+	<meta name="viewport" content="user-scalable=0,width=device-width,initial-scale=1.0" />
+	<meta charset="UTF-8" />
+	<!-- <meta name="viewport" content="width=device-width, initial-scale=0.665, minimum-scale=0.5, maximum-scale=1, user-scalable=no" /> -->
+	<!-- <meta name="viewport" content="width=device-width, initial-scale=0.665" /> -->
+	<meta http-equiv="X-UA-Compatible" content="ie=edge" />
+	<title>Boxline PDA</title>
+
+	<link rel="stylesheet" href="/layui/css/layui.css" />
+	<link rel="stylesheet" href="/css/style.css" />
+	<script src="/js/adaptive.js"></script>
+	<link rel="stylesheet" href="/css/my.css" />
+	<style type="text/css">
+		.layout-bill-info {
+			height: auto;
+			/* background-color: #009E94; */
+		}
+
+		.btn-ok-blue {
+			border: none;
+			color: #FFFFFF;
+			background-color: #0a93e3;
+			width: 48%;
+			height: 36px;
+			border-radius: 5px;
+		}
+
+		.btn-ok-red {
+			border: none;
+			color: #FFFFFF;
+			background-color: #9f1707;
+			width: 48%;
+			height: 36px;
+			border-radius: 5px;
+		}
+
+		.btn-ok-blue:active {
+			opacity: 0.8;
+		}
+
+		.btn-ok-red:active {
+			opacity: 0.8;
+		}
+
+		.foot-container {
+			text-align: center;
+			/* background-color: #007DDB; */
+		}
+	</style>
+	<link rel="stylesheet" href="/css/adapter.css" />
+</head>
+
+<body>
+	<div id="" class="main-content">
+		<div id="" class="layout-title">
+			<table border="" cellspacing="" cellpadding="">
+				<tr>
+					<td class="img-back"><a href="../index.html"><img src="/assets/back.jpg"></a></td>
+					<td class="title-text" lang>浠撳簱鏀惰揣</td>
+					<td class="title-menu-icon"><img id="menuImg" src="/assets/menu.jpg"></td>
+				</tr>
+			</table>
+		</div>
+		<div id="" class="layout-sub-content">
+			<div id="menuList" class="menu">
+				<ul class="" style="text-align: center;">
+					<li><a href="../index.html" lang>涓婚〉</a></li>
+					<!-- <li><a href="productEnterConfirm.html">鍏ュ簱淇℃伅纭</a></li> -->
+					<li><a href="../login.html" lang>閲嶆柊鐧诲綍</a></li>
+				</ul>
+			</div>
+
+			<div id="" class="layout-bill-info">
+				<form class="layui-form" action="" style="height: auto;">
+					<div id="" class="layui-form-item layout-input">
+						<label class="layui-form-label" lang>鎵樼洏鏉$爜锛�</label>
+						<div class="layui-input-block">
+							<input id="PalletNo" type="text" lay-verify="stock" lang langholder placeholder="璇锋壂鎻忔墭鐩樻潯鐮�"
+								autocomplete="off" class="layui-input">
+						</div>
+					</div>
+				</form>
+				<div id="" style="text-align: center;">
+					<button class="btn-ok-blue" type="button" lay-submit lay-filter="formBind">纭鏀惰揣</button>
+				</div>
+			</div>
+
+		</div>
+	</div>
+	<script src="/js/jquery-3.5.1.min.js"></script>
+	<script src="/layui/layui.js"></script>
+	<script src="/js/public.js"></script>
+	<script src="/js/language.js"></script>
+	<script src="/js/jquery.cookie.js"></script>
+	<script>
+		layui.use(['form', 'jquery'], function () {
+			var form = layui.form
+
+			//纭鍏ュ簱
+			form.on('submit(formBind)', function (data) {
+				
+				if (!$("#PalletNo").val()) {
+					layer.msg('璇锋壂鎻忔墭鐩樻潯鐮�', {
+						icon: 2,
+						time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+					});
+					return;
+				}
+				var param = {
+					PalletNo: $("#PalletNo").val()
+				}
+				sendData(IP + "/PdaAsn/ConfirmTakeOf", param, 'post', function (res) {
+					if (res.code == 0) { //鎴愬姛 
+						layer.msg(res.msg, {
+							icon: 1,
+							time: 2500 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+						}, function () {
+							$("#PalletNo").val('')
+							$("#LocatNo").val('')
+						});
+					} else { //涓嶆垚鍔�
+						layer.msg(res.msg, {
+							icon: 2,
+							time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+						}, function () {
+							//鍥炶皟
+						});
+					}
+				});
+				return false; //闃绘琛ㄥ崟璺宠浆銆傚鏋滈渶瑕佽〃鍗曡烦杞紝鍘绘帀杩欐鍗冲彲銆�
+			});
+
+			form.verify({
+				stock: [/^[\S]{8}$/, '鎵樼洏鏉$爜蹇呴』涓哄叚浣嶅瓧绗�']
+			});
+
+			
+			$("#menuImg").click(function (e) {
+				e.stopPropagation()
+
+				if ($("#menuList").is(":hidden")) {
+					$("#menuList").show()
+				} else {
+					$("#menuList").hide()
+				}
+			})
+			$('body').click(function () {
+				// //console.log("body")
+				$("#menuList").hide()
+			})
+		})
+	</script>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
index 360d22c..805a2b3 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -29,6 +29,7 @@
 using Model.ModelVm.SysVm;
 using System.Security.Cryptography.X509Certificates;
 using AutoMapper.Configuration.Annotations;
+using Utility;
 
 namespace WMS.BLL.BllPdaServer
 {
@@ -6512,6 +6513,113 @@
         }
         #endregion
 
+        #region 浠撳簱鏀惰揣
+        /// <summary>
+        /// 浠撳簱纭鏀惰揣
+        /// </summary>
+        /// <param name="model"></param>
+        public void ConfirmTakeOf(string palletNo,int userId)
+        {
+            try
+            {
+                #region 楠岃瘉淇℃伅
+                if (string.IsNullOrEmpty(palletNo))
+                {
+                    throw new Exception("鎵樼洏鏉$爜涓嶈兘涓虹┖!");
+                }
+
+                //鑾峰彇鎵樼洏淇℃伅
+                var pallet = Db.Queryable<SysPallets>().First(w => w.IsDel == "0" && w.PalletNo == palletNo);
+                //楠岃瘉鎵樼洏淇℃伅鏄惁涓虹┖
+                if (pallet == null)
+                {
+                    throw new Exception("鎵樼洏淇℃伅涓嶅瓨鍦紝璇锋鏌�!");
+                }
+                if (pallet.Status == "0")
+                {
+                    throw new Exception("鎵樼洏鏈娇鐢紝璇锋鏌�!");
+                }
+                #endregion
+
+                //鑾峰彇搴撳瓨鏄庣粏淇℃伅
+                var stockDetailList = Db.Queryable<DataStockDetail>().Where(s => s.IsDel == "0" && s.PalletNo == palletNo).ToList();
+                //楠岃瘉搴撳瓨鏄庣粏淇℃伅鏄惁瀛樺湪
+                if (stockDetailList.Count<=0)
+                {
+                    throw new Exception("搴撳瓨鏄庣粏涓嶅瓨鍦紝璇锋鏌ュ簱瀛樹俊鎭�!");
+                }
+                //寮�鍚簨鍔�
+                Db.BeginTran();
+
+                foreach (var item in stockDetailList)
+                {
+                    if (item.AreaNo != "B06" && item.AreaNo != "B07" && item.AreaNo != "B09")
+                    {
+                        throw new Exception("璇ユ墭鐩橀潪绾胯竟鍥炲簱鎵樼洏!");
+                    }
+                    //搴撳瓨鎬昏〃
+                    var stock = Db.Queryable<DataStock>().First(w => w.IsDel == "0" && w.SkuNo == item.SkuNo && w.LotNo == item.LotNo);
+                    if (stock == null)
+                    {
+                        throw new Exception($"鏈煡璇㈠埌璇ユ墭鐩樹笂鐗╂枡缂栫爜涓�:{item.SkuNo}鐨勫簱瀛樹俊鎭�!");
+                    }
+
+                    var boxInfoList = Db.Queryable<DataBoxInfo>().Where(w => w.IsDel == "0" && w.PalletNo == palletNo && w.SkuNo == item.SkuNo && w.LotNo == item.LotNo).ToList();
+                    if (boxInfoList.Count > 0)
+                    {
+                        foreach (var box in boxInfoList)
+                        {
+                            var bllBox = Db.Queryable<BllBoxInfo>().First(w => w.IsDel == "0" && w.Status != "0");
+                            if (bllBox != null)
+                            {
+                                bllBox.Status = "0";
+                                bllBox.ASNDetailNo = null;
+                                bllBox.BindNo = null;
+                                bllBox.PalletNo = "";
+                                //鏇存柊绠辨敮鏄庣粏琛�
+                                Db.Updateable(bllBox).ExecuteCommand();
+                            }
+                        }
+                        //鍒犻櫎搴撳瓨绠辩爜淇℃伅
+                        Db.Deleteable(boxInfoList).ExecuteCommand();
+                    }
+                    
+                    //鍒犻櫎鎴栦慨鏀瑰簱瀛�
+                    stock.Qty -= (decimal)item.Qty;
+                    if (stock.Qty <= 0)
+                    {
+                        Db.Deleteable(stock).ExecuteCommand();
+                    }
+                    else
+                    {
+                        Db.Updateable(stock).ExecuteCommand();
+                    }
+                    //鍒犻櫎搴撳瓨鏄庣粏
+                    Db.Deleteable(item).ExecuteCommand();
+
+                    //鍒ゆ柇鎵樼洏涓婅繕鏈夋病鏈夊叾浠栫墿鏂�
+                    var palletData = Db.Queryable<DataStockDetail>().First(w => w.IsDel == "0" && w.PalletNo == palletNo && w.Id != item.Id);
+                    if (palletData == null)
+                    {
+                        pallet.Status = "0";
+                        Db.Updateable(pallet).ExecuteCommand();
+                    }
+                }
+
+                new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "浠撳簱鏀惰揣", palletNo, "瀹屾垚", $"鍦≒DA涓婂畬鎴愭墭鐩樼爜涓猴細{palletNo}鐨勪粨搴撴敹璐ф搷浣�", userId);
+
+                //鎻愪氦浜嬪姟
+                Db.CommitTran();
+            }
+            catch (Exception ex)
+            {
+                //鍥炴粴浜嬪姟
+                Db.RollbackTran();
+                throw ex;
+            }
+        }
+        #endregion
+
         #region JC23鍙栨牱涓氬姟鎺ュ彛
 
         //鑾峰彇鏈粍鎵樻垨宸茬粍鎵樼殑绠辩爜绾у埆
diff --git a/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs b/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
index c6beb28..297ec9e 100644
--- a/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
+++ b/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
@@ -146,6 +146,12 @@
         //骞冲簱纭鍏ュ簱
         void ConfirmInStock(PalletBindVm model);
 
+        /// <summary>
+        /// 浠撳簱纭鏀惰揣
+        /// </summary>
+        /// <param name="model"></param>
+        void ConfirmTakeOf(string palletNo, int userId);
+
         //鏍规嵁绠辩爜鍚戣拷婧郴缁熻姹傜淇℃伅
         List<BoxInfoDto> GetFMBindBoxInfos(string boxno,string url);
 
diff --git a/Wms/Wms/Controllers/PdaAsnController.cs b/Wms/Wms/Controllers/PdaAsnController.cs
index efc36c8..e2b9bc7 100644
--- a/Wms/Wms/Controllers/PdaAsnController.cs
+++ b/Wms/Wms/Controllers/PdaAsnController.cs
@@ -938,5 +938,38 @@
             }
         }
         #endregion
+
+        #region 浠撳簱鏀惰揣
+        /// <summary>
+        /// 浠撳簱纭鏀惰揣
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult ConfirmTakeOf(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("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
+                }
+
+                _PdaAsnSvc.ConfirmTakeOf(model.PalletNo, int.Parse(UserId));
+
+                return Ok(new { code = 0, msg = "鏀惰揣鎴愬姛!" });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+        }
+        #endregion
     }
 }

--
Gitblit v1.8.0