From 1dbb47d9132f36ab3c427c4e7eb0376521d52df9 Mon Sep 17 00:00:00 2001
From: Demo <Demo@DESKTOP-CPA90BF>
Date: 星期二, 12 三月 2024 16:58:42 +0800
Subject: [PATCH] Merge branch 'csc'

---
 Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs    |  134 +++++++++++++++++++
 Wms/Wms/Controllers/PdaSoController.cs          |   23 +++
 Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs         |   38 +++++
 Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs         |    7 +
 Wms/Wms/Controllers/BllAsnController.cs         |   40 +++++
 Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs |   15 ++
 Pda/View/SoSetting/SampleOut.html               |   48 ++++--
 HTML/views/ASNSetting/LabelBox.html             |  110 +++++++++++++++
 8 files changed, 399 insertions(+), 16 deletions(-)

diff --git a/HTML/views/ASNSetting/LabelBox.html b/HTML/views/ASNSetting/LabelBox.html
index ec5c961..86b5a37 100644
--- a/HTML/views/ASNSetting/LabelBox.html
+++ b/HTML/views/ASNSetting/LabelBox.html
@@ -121,9 +121,31 @@
 							lay-filter="LAY-app-contlist-search">
 							<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>鎼滅储
 						</button>
-						<button class="layui-btn layui-btn-sm layuiadmin-btn-list buDaLabelClass" style="margin-left: 5px;" lay-event="BuDaLabel" id="BuDaLabel">
+						<button class="layui-btn layui-btn-sm layuiadmin-btn-list layui-btn-normal buDaLabelClass" style="margin-left: 5px;" lay-event="BuDaLabel" id="BuDaLabel">
 							<i class="layui-icon layui-icon-print layuiadmin-button-btn"></i>琛ユ墦鏍囩
 						</button>
+						<button class="layui-btn layui-btn-sm layuiadmin-btn-list layui-btn-danger delLabelClass" style="margin-left: 5px;" lay-event="delLabel" id="delLabel">
+							<i class="layui-icon layui-icon-delete layuiadmin-button-btn"></i>鍒犻櫎鏍囩
+						</button>
+					</div>
+					<!-- 纭鍑哄簱鍙e脊绐� -->
+					<div class="layui-inline" id="divDelLotNo" style="display: none; padding-top: 10px;">
+						<div class="layui-inline">
+							<label class="layui-form-label">鍏ュ簱鍗曟嵁</label>
+							<div class="layui-input-inline" style="width: 220px;">
+								<input type="text" id="AsnNoSelect" name="AsnNoSelect" placeholder="鍏ュ簱鍗曟嵁" autocomplete="off" class="layui-input">
+								 
+							</div>
+						</div>
+						<div class="layui-inline DivLoadingArea" style="margin-top: 10px;">
+							<label class="layui-form-label">鎵规鍙�</label>
+							<div class="layui-input-inline" style="width: 220px;">
+								<select name="LotNoSelect" id="LotNoSelect" lay-search>
+									<option value=""></option> 
+								</select>
+							</div>
+						</div>							
+						 
 					</div>
 				</div>
 			</div>
@@ -289,7 +311,85 @@
 					// btn: ['鍙栨秷']
 				});
             });
-             
+			$("#AsnNoSelect").on('input', function () {
+
+				if ($("#AsnNoSelect").val() == "" || $("#AsnNoSelect").val().length < 16) {
+					return
+				}
+				if ($("#AsnNoSelect").val().length >= 16) {
+					$("#AsnNoSelect").val($("#AsnNoSelect").val().substr(-16))
+				}
+				GetLotNoByAsnNo()
+			})
+			function GetLotNoByAsnNo() {
+
+				$("#LotNoSelect").empty()
+                $("#LotNoSelect").append('<option value =>' + '</option>');
+				form.render('select');
+				var param = {
+					asnNo: $("#AsnNoSelect").val(),
+				};
+				sendData(IP + "/BllAsn/GetLotNoListByAsn", param, 'get', function(res) {
+					if (res.code == 0) { //鎴愬姛
+						for (var i = 0; i < res.data.length; i++) {
+							$("#LotNoSelect").append('<option value =' + res.data[i] + '>' + res.data[i] + '</option>');
+						} 
+						form.render('select');
+					} else { //涓嶆垚鍔�
+						layer.msg(res.msg, {
+							icon: 2,
+							time: 3000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+						}, function() {
+							 
+						});
+					} 
+				});
+			}
+
+            //鍒犻櫎鏍囩
+			$('#delLabel').on('click', function () {
+
+				layer.open({
+					type: 1,
+					title: '鍒犻櫎鏍囩',
+					content: $('#divDelLotNo'),
+					maxmin: false,
+					area: ['350px','340px'],
+					btn: ['纭畾', '鍙栨秷'],
+					yes: function(index, layero) { 
+						var param = {
+							AsnNo: $('#AsnNoSelect').val(),
+							LotNo: $('#LotNoSelect').val(),
+						};
+						sendData(IP + "/BllAsn/DelLabelByAsnNo", param, 'post', function(res) {
+							if (res.code == 0) { //鎴愬姛
+								bindTable();
+								layer.msg(res.msg, {
+									icon: 1,
+									time: 1500 //1绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+								}, function() {
+									$('#AsnNoSelect').val("");
+									$("#LotNoSelect").empty()
+									$("#LotNoSelect").append('<option value =>' + '</option>');
+									form.render('select');
+								});
+							} else { //涓嶆垚鍔�
+								layer.msg(res.msg, {
+									icon: 2,
+									time: 3000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+								}, function() {
+									bindTable();
+									$('#AsnNoSelect').val("");
+									$("#LotNoSelect").empty()
+									$("#LotNoSelect").append('<option value =>' + '</option>');
+									form.render('select');
+								});
+							}
+							layer.close(index);
+						});
+					}
+				});
+            });
 
 
 			// // 鍒犻櫎绠辨敮淇℃伅
@@ -421,6 +521,7 @@
 			function setRight() {
 				$(function () {
 					$(".buDaLabelClass").hide(); 
+					$(".delLabelClass").hide(); 
 				});
 				sendData(IP + "/Basis/GetRoleRightList", {}, 'get', function (res) {
 					if (res.code == 0) { //鎴愬姛 
@@ -430,6 +531,11 @@
 									$(".buDaLabelClass").show();
 								});
 							} 
+							if (res.data[k].MenuName == "鍒犻櫎鏍囩") {
+								$(function () {
+									$(".delLabelClass").show();
+								});
+							} 
 						}
 					} else { //涓嶆垚鍔�
 						layer.msg('鑾峰彇鏉冮檺淇℃伅澶辫触', {
diff --git a/Pda/View/SoSetting/SampleOut.html b/Pda/View/SoSetting/SampleOut.html
index 75d9bf8..4fc9be3 100644
--- a/Pda/View/SoSetting/SampleOut.html
+++ b/Pda/View/SoSetting/SampleOut.html
@@ -613,18 +613,6 @@
 				checkPalletState()
 			})
 
-			form.on('switch(IsZhengTuo)', function (obj) {
-				if (obj.elem.checked) {
-					$('#BoxDIv').attr("style", "display:none")
-					isContinue="1";
-				} else {					
-					$('#BoxDIv').attr("style", "display:block")
-					isContinue="0";
-				}
-				$('#boxNo').val("");
-				$('#boxNo3').val("");
-			});
-
 			//绠辩爜鏂囨湰妗嗗洖杞︿簨浠�
 			$("#boxNo").blur(function () {
 				GetBoxInfo();
@@ -645,7 +633,7 @@
 				synData(IP + "/PdaSo/IsEnableOkPalletNo", param, 'post', function (res) {
                     
 					if (res.code == 0) { //鎴愬姛 
-                        synData(IP + "/PdaSo/IsEnableOkPalletNo", param, 'post', function (res) {
+                        synData(IP + "/PdaSo/GetSampleType", param, 'get', function (res) {
                             if (res.code == 0){
                                 if (res.data == "0") {//搴撳唴鍙栨牱
                                     $('#kuneilabel').show();
@@ -680,7 +668,39 @@
 					}
 				});
 			}
-			//涓嬫媺鍗曟嵁閫変腑鍚庝簨浠�
+			
+            //鍒濆鍖栨覆鏌� 鍏ュ簱鍗�
+			function updateAsnBillList() {
+
+                $("#bar").empty()
+                $("#bar").append('<option value =>' + '</option>');
+                form.render('select');
+
+                var param = {
+                    PalletNo: $("#palletNo").val(),
+                };
+                synData(IP + "/PdaSo/GetRunSoNoticeList", param, 'post', function (res) {
+                    if (res.code == 0) { //鎴愬姛
+                        console.log(res.data);
+                        for (var i = 0; i < res.data.length; i++) {
+                            if (i == 0) {
+                                $("#bar").append('<option value =' + res.data[i] + ' selected>' + res.data[i] + '</option>');
+                            } else {
+                                $("#bar").append('<option value =' + res.data[i] + '>' + res.data[i] + '</option>');
+                            }
+                        }
+                        form.render('select');
+
+                    } else { //涓嶆垚鍔�
+                        layer.msg(res.msg, {
+                            icon: 2,
+                            time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+                        });
+                    }
+                });
+            }
+
+            //涓嬫媺鍗曟嵁閫変腑鍚庝簨浠�
 			form.on('select(getbar)', function (data) {
 				if ($('#palletNo').val() == "") {
 					layer.msg("璇疯緭鍏ユ墭鐩樻潯鐮�", {
diff --git a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
index 26c7d4e..8c2988c 100644
--- a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
@@ -1590,5 +1590,139 @@
                 throw new Exception(e.Message);
             }
         }
+
+        //鏍规嵁鍏ュ簱鍗曞彿杩囧幓鍗曟嵁涓嬫墍鏈夋壒娆″彿
+        public List<string> GetLotNoListByAsn(string asnNo)
+        {
+            try
+            {
+                var data = new List<string>();
+                var asnList = Db.Queryable<BllArrivalNoticeDetail>().Where(m => m.IsDel == "0" && m.ASNNo == asnNo).ToList();
+                if (asnList.Count == 0)
+                {
+                    throw new Exception("鏈煡璇㈠埌璇ュ崟鎹彿鐨勪俊鎭�");
+                }
+
+                foreach (var item in asnList)
+                {
+                    if (string.IsNullOrWhiteSpace(item.LotNo))
+                    {
+                        continue;
+                    }
+
+                    var strList = item.LotNo.Split(";");
+                    foreach (var str in strList)
+                    {
+                        if (string.IsNullOrWhiteSpace(str))
+                        {
+                            continue;
+                        }
+                        data.Add(str);
+                    }
+                }
+
+                return data;
+            }
+            catch (Exception e)
+            {
+                throw new Exception(e.Message);
+            }
+        }
+
+        //鍒犻櫎鍗曟嵁涓嬪崟涓垨澶氫釜鎵规鐨勬爣绛�
+        public void DelLabelByAsnNo(string asnNo,string lotNo, int userId)
+        {
+            try
+            {
+                var asnList = Db.Queryable<BllArrivalNoticeDetail>().Where(m => m.IsDel == "0" && m.ASNNo == asnNo).ToList();
+                if (asnList.Count == 0)
+                {
+                    throw new Exception("鏈煡璇㈠埌璇ュ崟鎹彿鐨勪俊鎭�");
+                }
+
+                Db.BeginTran();
+
+                //鎵规涓虹┖锛氬綋鍓嶅崟鎹笅鎵�鏈夋壒娆$殑鏍囩鍏ㄩ儴鍒犻櫎锛� 鏈夋壒娆★細浼ゅ褰撳墠鍗曟嵁涓嬪綋鍓嶆壒娆$殑鏍囩
+                if (string.IsNullOrWhiteSpace(lotNo)) //鍒犻櫎鍏ㄩ儴鏍囩
+                {
+                    var labelList = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.ASNNo == asnNo).ToList();
+                    if (labelList.Count(m => m.Status != "0") >= 1)
+                    {
+                        throw new Exception("褰撳墠鍗曟嵁鎵规鐨勬爣绛惧凡鏈夊凡浣跨敤锛屼笉鑳藉垹闄�");
+                    }
+
+                    foreach (var item in asnList)
+                    {
+                        if (string.IsNullOrWhiteSpace(item.LotNo))
+                        {
+                            continue;
+                        }
+
+                        item.LotNo = "";
+                        Db.Updateable(item).ExecuteCommand();
+
+                    }
+                    Db.Deleteable(labelList).ExecuteCommand();
+                }
+                else  //鍒犻櫎鍥哄畾鎵规鏍囩
+                {
+                    var labelList = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.ASNNo == asnNo && m.LotNo == lotNo).ToList();
+                    if (labelList.Count(m=>m.Status != "0") >= 1 )
+                    {
+                        throw new Exception("褰撳墠鍗曟嵁鎵规鐨勬爣绛惧凡鏈夊凡浣跨敤锛屼笉鑳藉垹闄�");
+                    }
+
+                    foreach (var item in asnList)
+                    {
+                        if (string.IsNullOrWhiteSpace(item.LotNo) || item.LotNo!=lotNo)
+                        {
+                            continue;
+                        }
+
+                        var strList = item.LotNo.Split(";");
+                        var updateLotNo = "";
+                        foreach (var str in strList)
+                        {
+                            if (string.IsNullOrWhiteSpace(str) || str == lotNo)
+                            {
+                                continue;
+                            }
+
+                            if (string.IsNullOrWhiteSpace(updateLotNo))
+                            {
+                                updateLotNo = str;
+                            }
+                            else
+                            {
+                                updateLotNo += ";" + str;
+                            }
+                             
+                        }
+
+                        item.LotNo = updateLotNo;
+                        Db.Updateable(item).ExecuteCommand();
+
+                    }
+                    Db.Deleteable(labelList).ExecuteCommand();
+                }
+
+                Db.CommitTran();
+
+                var msg = $"鍒犻櫎浜嗗崟鎹彿锛歿asnNo}";
+                if (!string.IsNullOrWhiteSpace(lotNo))
+                {
+                    msg += $"銆佹壒娆″彿锛歿lotNo}";
+                }
+                msg += "鐨勬爣绛句俊鎭�";
+
+                new OperationASNServer().AddLogOperationAsn("鍏ュ簱浣滀笟", "鐗╂枡鏍囩", asnNo, "鍒犻櫎", msg, userId);
+            }
+            catch (Exception e)
+            {
+                Db.RollbackTran();
+                throw new Exception(e.Message);
+            }
+        }
+
     }
 }
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
index 87286b4..f2b5cc7 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
@@ -1300,6 +1300,16 @@
                     m.IsDel == "0" && m.PalletNo == palletNo && m.Status != "5" && m.Status != "6");
                 if (allot!=null)
                 {
+                    var soNo = Db.Queryable<BllExportNotice>()
+                        .First(m => m.IsDel == "0" && m.SONo == allot.SONo);
+                    if (soNo == null)
+                    {
+                        throw new Exception("鏈壘鍒版墭鐩樹笂鍑哄簱鍗曟嵁淇℃伅");
+                    } 
+                    if (soNo.Type != "3")
+                    {
+                        throw new Exception("璇ユ墭鐩樹笉鏄彇鏍锋墭鐩�");
+                    } 
                     type = "0";//搴撳唴鍙栨牱
                 }
                 else
@@ -1313,5 +1323,33 @@
                 throw new Exception(e.Message);
             }
         }
+
+        //鏍规嵁鎵樼洏鍙疯幏鍙栧叆搴撳崟鎹�
+        public List<string> GetAsnNoByPallet(string palletNo)
+        {
+            try
+            {
+                var type = "";
+                var detail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == palletNo);
+                if (detail == null)
+                {
+                    throw new Exception("褰撳墠鎵樼洏鏈湪搴撳瓨涓�");
+                }
+
+                var list = new List<string>();
+                if (string.IsNullOrWhiteSpace(detail.ASNNo))
+                {
+                    throw new Exception("鏈煡璇㈠埌璇ユ墭鐩樼殑鍏ュ簱鍗曚俊鎭�");
+                }
+                list.Add(detail.ASNNo);
+                return list;
+            }
+            catch (Exception e)
+            {
+                throw new Exception(e.Message);
+            }
+        }
+
+
     }
 }
diff --git a/Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs b/Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs
index 0b2d515..30fdad5 100644
--- a/Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs
+++ b/Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs
@@ -70,5 +70,20 @@
         List<BoxInfoDto> GetBuDaLabelList(string boxNo, string endBoxNo, string boxNo2, string endBoxNo2, string type,
             int userId);
 
+        /// <summary>
+        /// 鏍规嵁鍏ュ簱鍗曞彿杩囧幓鍗曟嵁涓嬫墍鏈夋壒娆″彿
+        /// </summary>
+        /// <param name="asnNo">鍏ュ簱鍗曞彿</param>
+        /// <returns>鎵规鍙烽泦鍚�</returns>
+        List<string> GetLotNoListByAsn(string asnNo);
+
+        /// <summary>
+        /// 鍒犻櫎鍗曟嵁涓嬪崟涓垨澶氫釜鎵规鐨勬爣绛�
+        /// </summary>
+        /// <param name="asnNo">鍏ュ簱鍗曞彿</param>
+        /// <param name="lotNo">鎵规鍙�</param>
+        /// <param name="userId">鎿嶄綔浜篒D</param>
+        void DelLabelByAsnNo(string asnNo, string lotNo,int userId);
+
     }
 }
diff --git a/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs b/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs
index fbaedcf..0b1509b 100644
--- a/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs
+++ b/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs
@@ -122,5 +122,12 @@
         /// <returns>0锛氬簱鍐呭彇鏍枫��1锛氬簱鍓嶅彇鏍�</returns>
         string GetSampleType(string palletNo);
 
+        /// <summary>
+        /// 鏍规嵁鎵樼洏鍙疯幏鍙栧叆搴撳崟鎹�(搴撳墠鍙栨牱鍑哄簱涓氬姟)
+        /// </summary>
+        /// <param name="palletNo">鎵樼洏鍙�</param>
+        /// <returns>鍗曟嵁闆嗗悎</returns>
+        List<string> GetAsnNoByPallet(string palletNo);
+
     }
 }
diff --git a/Wms/Wms/Controllers/BllAsnController.cs b/Wms/Wms/Controllers/BllAsnController.cs
index 86365ac..d6db2ab 100644
--- a/Wms/Wms/Controllers/BllAsnController.cs
+++ b/Wms/Wms/Controllers/BllAsnController.cs
@@ -946,7 +946,47 @@
             }
         }
 
+        //鏍规嵁鍏ュ簱鍗曞彿杩囧幓鍗曟嵁涓嬫墍鏈夋壒娆″彿
+        [HttpGet]
+        public IActionResult GetLotNoListByAsn(string asnNo)
+        {
+            try
+            {
+                var list = _BoxInfoSvc.GetLotNoListByAsn(asnNo);
+                return Ok(new { code = 0, msg = "鎴愬姛鑾峰彇鍗曟嵁涓嬫墍鏈夋壒娆″彿淇℃伅", data = list });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, count = 0, msg = e.Message });
+            }
+        }
 
+        //鍒犻櫎鍗曟嵁涓嬪崟涓垨澶氫釜鎵规鐨勬爣绛�
+        [HttpPost]
+        public IActionResult DelLabelByAsnNo(LabelBoxInfoVm model)
+        {
+            try
+            {
+                //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
+                var claimsIdentity = this.User.Identity as ClaimsIdentity;
+                if (claimsIdentity == null)
+                {
+                    return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
+                }
+                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
+                if (string.IsNullOrWhiteSpace(userId))
+                {
+                    return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
+                }
+                _BoxInfoSvc.DelLabelByAsnNo(model.AsnNo,model.LotNo,int.Parse(userId));
+                return Ok(new { code = 0, msg = "鎴愬姛鑾峰彇鍗曟嵁涓嬫墍鏈夋壒娆″彿淇℃伅", data = "" });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, count = 0, msg = e.Message });
+            }
+        }
+        
 
         #endregion
     }
diff --git a/Wms/Wms/Controllers/PdaSoController.cs b/Wms/Wms/Controllers/PdaSoController.cs
index b320755..bc959a6 100644
--- a/Wms/Wms/Controllers/PdaSoController.cs
+++ b/Wms/Wms/Controllers/PdaSoController.cs
@@ -373,5 +373,28 @@
 
         }
 
+        /// <summary>
+        /// 鏍规嵁鎵樼洏鍙疯幏鍙栧叆搴撳崟鎹�
+        /// </summary>
+        /// <param name="palletNo">鎵樼洏鍙�</param>
+        /// <returns></returns>
+        [HttpGet]
+        public IActionResult GetAsnNoByPallet(string palletNo)
+        {
+            try
+            {
+                var type = _pdaSoSvc.GetAsnNoByPallet(palletNo);
+
+                return Ok(new { data = type, code = 0, msg = "鑾峰彇鍏ュ簱鍗曟嵁" });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { data = "", code = 1, msg = "鑾峰彇鍏ュ簱鍗曟嵁閿欒锛�" + e.Message });
+            }
+
+        }
+
+
+
     }
 }

--
Gitblit v1.8.0