From bbeadfe2c0dd55405b83641751ad88874d0716f6 Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期五, 31 十月 2025 09:06:52 +0800
Subject: [PATCH] 完善物料标签的补打标签和合并标签功能

---
 Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs |   26 +++-
 HTML/views/ASNSetting/LabelMerge.html        |  149 ++++++++++++++++++++++++
 HTML/views/ASNSetting/LabelBox.html          |   21 +++
 HTML/views/ASNSetting/LabelChai.html         |  149 ++++++++++++++++++++++++
 4 files changed, 338 insertions(+), 7 deletions(-)

diff --git a/HTML/views/ASNSetting/LabelBox.html b/HTML/views/ASNSetting/LabelBox.html
index b3e85e2..35fc10f 100644
--- a/HTML/views/ASNSetting/LabelBox.html
+++ b/HTML/views/ASNSetting/LabelBox.html
@@ -338,6 +338,27 @@
 					// btn: ['鍙栨秷']
 				});
 			});
+			//鎷嗗垎鏍囩
+			$('#ChaiLabel').on('click', function () {
+				layer.open({
+					type: 2,
+					title: '鎷嗗垎鏍囩',
+					content: 'LabelChai.html',
+					maxmin: true,
+					area: ['430px', '290px'],
+					// btn: ['鍙栨秷']
+				});
+			});
+			$('#MergeLabel').on('click', function () {
+				layer.open({
+					type: 2,
+					title: '鍚堝苟鏍囩',
+					content: 'LabelMerge.html',
+					maxmin: true,
+					area: ['430px', '290px'],
+					// btn: ['鍙栨秷']
+				});
+			});
 			$("#AsnNoSelect").on('input', function () {
 
 				if ($("#AsnNoSelect").val() == "" || $("#AsnNoSelect").val().length < 16) {
diff --git a/HTML/views/ASNSetting/LabelChai.html b/HTML/views/ASNSetting/LabelChai.html
new file mode 100644
index 0000000..2105adf
--- /dev/null
+++ b/HTML/views/ASNSetting/LabelChai.html
@@ -0,0 +1,149 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="utf-8">
+    <title>鏍囩鎵撳嵃</title>
+    <meta name="renderer" content="webkit">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport"
+        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
+    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
+    <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
+    <style media="print">
+        @page {
+            size: auto;
+            margin: 0 0 0 20px;
+        }
+
+        .layui-input {
+            padding-left: 0px;
+        }
+
+        .layui-form-item {
+            margin-bottom: 2px;
+        }
+    </style>
+    <style>
+        .layui-form-item .layui-input-inline {
+            display: block;
+            float: none;
+            left: -3px;
+            width: auto;
+            margin: 0 0 10px 90px;
+        }
+
+        .hideCls {
+            display: none;
+        }
+
+        .showCls {
+            display: block;
+        }
+
+        .font-size12 {
+            font-size: 14px;
+        }
+
+        .font-size10 {
+            font-size: 10px;
+        }
+    </style>
+</head>
+
+<body>
+    <div style="width:100%;">
+        <div class="layui-form" style="padding: 30px 15px 0px; " id="button">
+            <div class="layui-form-item" style="margin-bottom:0px;">
+                <label class="layui-form-label" style="width: 60px;">绠辩爜</label>
+                <div class="layui-input-inline">
+                    <input type="text" id="BoxCode" name="BoxCode" placeholder="绠辩爜" autocomplete="off"
+                        class="layui-input">
+                </div>
+            </div>
+            <div class="layui-form-item" style="margin-bottom:0px;">
+                <label class="layui-form-label" style="width: 60px;">鎷嗗垎鏁伴噺</label>
+                <div class="layui-input-inline">
+                    <input type="number" id="ChaiQty" name="ChaiQty" placeholder="鎷嗗垎鏁伴噺" autocomplete="off"
+                        class="layui-input">
+                </div>
+            </div>
+            <div class="layui-form-item" style="margin-bottom:0px; text-align: center;">
+
+                <button id="btnChai" class="layui-btn layui-btn-edit" lay-event="Add"><i
+                        class="layui-icon">&#xe654;</i>鎷嗗垎</button>
+            </div>
+        </div>
+    </div>
+    <script src="../../layuiadmin/layui/layui.js"></script>
+    <script src="../../js/public.js"></script>
+    <script src="../../js/jquery-3.5.1.min.js"></script>
+    <script src="../../js/jquery.cookie.js"></script>
+    <script>
+        var boxcode = "";
+        layui.config({
+            base: '../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
+        }).extend({
+            index: 'lib/index' //涓诲叆鍙fā鍧�
+        }).use(['index', 'form', 'layer', 'laydate'], function () {
+
+            var $ = layui.$,
+                form = layui.form,
+                layer = layui.layer;
+            var laydate = layui.laydate;
+            var indes = layer.index;
+
+            var xun = 0;
+
+            $('#btnChai').on('click', function () {
+                if ($("#BoxCode").val()=='' || $("#BoxCode").val() == undefined) {
+                    layer.msg("璇疯緭鍏ョ鐮侊紒", {
+                        icon: 2,
+                        time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+                    });
+                    return -1;
+                }
+                if ($("#ChaiQty").val()=='' || $("#ChaiQty").val() == undefined || parseFloat($("#ChaiQty").val())<=0) {
+                    layer.msg("璇疯緭鍏ユ媶鍒嗘暟閲忥紒", {
+                        icon: 2,
+                        time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+                    });
+                    return -1;
+                }
+                var param = {
+                    BoxNo: $("#BoxCode").val(),
+                    ChaiQty:parseFloat($("#ChaiQty").val()),
+                };
+                synData(IP + "/BllAsn/ChaiLableBox", param, 'post', function (res) {
+                    if (res.code == 0) { //鎴愬姛    
+                        layer.msg(res.msg, {
+                            icon: 1,
+                            time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 
+                        }, function () {
+                            parent.location.reload();
+                            parent.layer.close(layer.index);
+                        });
+
+                    } else { //涓嶆垚鍔�
+                        layer.msg(res.msg, {
+                            icon: 2,
+                            time: 2500 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+                        }, function () { });
+                    }
+                });
+            });
+
+            // 鑾峰彇浼犻�掑弬鏁�
+            function getQueryString(name) {
+                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
+                var r = window.location.search.substr(1).match(reg);
+                if (r != null) return unescape(r[2]);
+                return null;
+            }
+        })
+
+    </script>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/HTML/views/ASNSetting/LabelMerge.html b/HTML/views/ASNSetting/LabelMerge.html
new file mode 100644
index 0000000..e88e3e6
--- /dev/null
+++ b/HTML/views/ASNSetting/LabelMerge.html
@@ -0,0 +1,149 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="utf-8">
+    <title>鏍囩鎵撳嵃</title>
+    <meta name="renderer" content="webkit">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport"
+        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
+    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
+    <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
+    <style media="print">
+        @page {
+            size: auto;
+            margin: 0 0 0 20px;
+        }
+
+        .layui-input {
+            padding-left: 0px;
+        }
+
+        .layui-form-item {
+            margin-bottom: 2px;
+        }
+    </style>
+    <style>
+        .layui-form-item .layui-input-inline {
+            display: block;
+            float: none;
+            left: -3px;
+            width: auto;
+            margin: 0 0 10px 90px;
+        }
+
+        .hideCls {
+            display: none;
+        }
+
+        .showCls {
+            display: block;
+        }
+
+        .font-size12 {
+            font-size: 14px;
+        }
+
+        .font-size10 {
+            font-size: 10px;
+        }
+    </style>
+</head>
+
+<body>
+    <div style="width:100%;">
+        <div class="layui-form" style="padding: 30px 15px 0px; " id="button">
+            <div class="layui-form-item" style="margin-bottom:0px;">
+                <label class="layui-form-label" style="width: 60px;">绠辩爜1</label>
+                <div class="layui-input-inline">
+                    <input type="text" id="BoxCode" name="BoxCode" placeholder="绠辩爜1" autocomplete="off"
+                        class="layui-input">
+                </div>
+            </div>
+            <div class="layui-form-item" style="margin-bottom:0px;">
+                <label class="layui-form-label" style="width: 60px;">绠辩爜2</label>
+                <div class="layui-input-inline">
+                    <input type="text" id="BoxCode2" name="BoxCode2" placeholder="绠辩爜2" autocomplete="off"
+                        class="layui-input">
+                </div>
+            </div>
+            <div class="layui-form-item" style="margin-bottom:0px; text-align: center;">
+
+                <button id="btnMerge" class="layui-btn layui-btn-edit" lay-event="Add"><i
+                        class="layui-icon">&#xe654;</i>鍚堝苟</button>
+            </div>
+        </div>
+    </div>
+    <script src="../../layuiadmin/layui/layui.js"></script>
+    <script src="../../js/public.js"></script>
+    <script src="../../js/jquery-3.5.1.min.js"></script>
+    <script src="../../js/jquery.cookie.js"></script>
+    <script>
+        var boxcode = "";
+        layui.config({
+            base: '../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
+        }).extend({
+            index: 'lib/index' //涓诲叆鍙fā鍧�
+        }).use(['index', 'form', 'layer', 'laydate'], function () {
+
+            var $ = layui.$,
+                form = layui.form,
+                layer = layui.layer;
+            var laydate = layui.laydate;
+            var indes = layer.index;
+
+            var xun = 0;
+
+            $('#btnMerge').on('click', function () {
+                if ($("#BoxCode").val() ==''|| $("#BoxCode").val() == undefined) {
+                    layer.msg("璇疯緭鍏ョ鐮�1锛�", {
+                        icon: 2,
+                        time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+                    });
+                    return -1;
+                }
+                if ($("#BoxCode2").val()=='' || $("#BoxCode2").val() == undefined) {
+                    layer.msg("璇疯緭鍏ョ鐮�2锛�", {
+                        icon: 2,
+                        time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+                    });
+                    return -1;
+                }
+                var param = {
+                    BoxNo: $("#BoxCode").val(),
+                    BoxNo2:$("#BoxCode2").val(),
+                };
+                synData(IP + "/BllAsn/MergeLableBox", param, 'post', function (res) {
+                    if (res.code == 0) { //鎴愬姛    
+                        layer.msg(res.msg, {
+                            icon: 1,
+                            time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 
+                        }, function () {
+                            parent.location.reload();
+                            parent.layer.close(layer.index);
+                        });
+
+                    } else { //涓嶆垚鍔�
+                        layer.msg(res.msg, {
+                            icon: 2,
+                            time: 2500 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+                        }, function () { });
+                    }
+                });
+            });
+
+            // 鑾峰彇浼犻�掑弬鏁�
+            function getQueryString(name) {
+                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
+                var r = window.location.search.substr(1).match(reg);
+                if (r != null) return unescape(r[2]);
+                return null;
+            }
+        })
+
+    </script>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
index ae97734..9e38ac1 100644
--- a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
@@ -1769,7 +1769,11 @@
                 }
                 //鏍囩淇℃伅
                 var boxList = Db.Queryable<BllBoxInfo>().Where(w => w.IsDel == "0" && w.BoxNo == boxNo).ToList();
-                if (boxList.Count != 1)
+                if (boxList.Count < 1)
+                {
+                    throw new Exception("璇ョ鐮佷俊鎭敊璇紝鏈煡鍒版绠辩爜淇℃伅");
+                }
+                if (boxList.Count > 1)
                 {
                     throw new Exception("璇ョ鐮佷俊鎭敊璇紝瀛樺湪澶氫釜姝ょ鐮佷俊鎭�");
                 }
@@ -1833,14 +1837,14 @@
                     StoreTime = boxInfo.StoreTime,
                     ExpirationTime = boxInfo.ExpirationTime,
 
-                    Origin = "WMS",
+                    Origin = "WMS鐢熸垚",
                     CreateUser = userId,
                     CreateTime = DateTime.Now,
                 };
                 Db.Insertable(boxModel).ExecuteCommand();
 
                 //娣诲姞鎿嶄綔鏃ュ織
-                new OperationASNServer().AddLogOperationAsn("鍏ュ簱浣滀笟", "鐗╂枡鏍囩", boxNo, "缂栬緫", $"鎷嗗垎浜嗙鐮亄boxInfo}鏁伴噺{chaiQty}鍒版柊绠辩爜{boxNoNew}", userId);
+                new OperationASNServer().AddLogOperationAsn("鍏ュ簱浣滀笟", "鐗╂枡鏍囩", boxNo, "缂栬緫", $"鎷嗗垎浜嗙鐮亄boxNo}鏁伴噺{chaiQty}鍒版柊绠辩爜{boxNoNew}", userId);
                 //鎻愪氦浜嬪姟
                 Db.CommitTran();
             }   
@@ -1867,7 +1871,11 @@
                 }
                 //鏍囩淇℃伅
                 var boxList = Db.Queryable<BllBoxInfo>().Where(w => w.IsDel == "0" && w.BoxNo == boxNo).ToList();
-                if (boxList.Count != 1)
+                if (boxList.Count < 1)
+                {
+                    throw new Exception($"{boxNo}璇ョ鐮佷俊鎭敊璇紝鏈煡鍒版绠辩爜淇℃伅");
+                }
+                if (boxList.Count > 1)
                 {
                     throw new Exception($"{boxNo}璇ョ鐮佷俊鎭敊璇紝瀛樺湪澶氫釜姝ょ鐮佷俊鎭�");
                 }
@@ -1877,7 +1885,11 @@
                     throw new Exception($"{boxNo}璇ョ鐮佷笉鏄湭缁勬墭鐘舵�侊紝涓嶅厑璁稿悎骞讹紒");
                 }
                 var boxList2 = Db.Queryable<BllBoxInfo>().Where(w => w.IsDel == "0" && w.BoxNo == boxNo2).ToList();
-                if (boxList2.Count != 1)
+                if (boxList2.Count < 1)
+                {
+                    throw new Exception($"{boxNo2}璇ョ鐮佷俊鎭敊璇紝鏈煡鍒版绠辩爜淇℃伅");
+                }
+                if (boxList2.Count > 1)
                 {
                     throw new Exception($"{boxNo2}璇ョ鐮佷俊鎭敊璇紝瀛樺湪澶氫釜姝ょ鐮佷俊鎭�");
                 }
@@ -1888,11 +1900,11 @@
                 }
                 if (boxInfo.SkuNo != boxInfo2.SkuNo || boxInfo.LotNo != boxInfo2.LotNo)
                 {
-                    throw new Exception($"涓や釜绠辩爜涓嶆槸鐗╂枡鎵规淇℃伅涓嶄竴鑷达紝涓嶅厑璁稿悎骞讹紒");
+                    throw new Exception($"涓や釜绠辩爜鐗╂枡鎵规淇℃伅涓嶄竴鑷达紝涓嶅厑璁稿悎骞讹紒");
                 }
                 if (boxInfo.ASNNo != boxInfo2.ASNNo || boxInfo.ASNDetailNo != boxInfo2.ASNDetailNo)
                 {
-                    throw new Exception($"涓や釜绠辩爜涓嶆槸鎵�灞炲叆搴撳崟淇℃伅涓嶄竴鑷达紝涓嶅厑璁稿悎骞讹紒");
+                    throw new Exception($"涓や釜绠辩爜鎵�灞炲叆搴撳崟淇℃伅涓嶄竴鑷达紝涓嶅厑璁稿悎骞讹紒");
                 }
                 if (boxInfo.Qty + boxInfo2.Qty > boxInfo.FullQty)
                 {

--
Gitblit v1.8.0