From d14c5dd9ebf781216f5b613f4f757f1d13e27c75 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期六, 13 九月 2025 22:20:22 +0800
Subject: [PATCH] 生成条码添加用户,组织,工号,条码日期;启用物料信息方法替换;新增物料信息添加物料名称显示,物料信息校验不成功不允许保存,添加供应商过滤

---
 WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_MaterialBarCodeBill.html |  177 +++++++++--------------------------
 WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_MaterialHandingEdit.html |   23 +++
 WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_MaterialHanding.html     |   74 ++++++++++++--
 3 files changed, 125 insertions(+), 149 deletions(-)

diff --git a/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_MaterialBarCodeBill.html b/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_MaterialBarCodeBill.html
index 00c96da..9f84fde 100644
--- a/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_MaterialBarCodeBill.html
+++ b/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_MaterialBarCodeBill.html
@@ -539,7 +539,7 @@
 
                 var sMainStr = JSON.stringify(data.field);
                 var sSubStr = JSON.stringify(table.cache['mainTable']);
-                var sMainSub = sMainStr + ';' + sSubStr;
+                var sMainSub = sMainStr + ';' + sSubStr + ';' + sessionStorage["HUserName"] + ';' + sessionStorage["OrganizationID"];
                 var _sSubStr = JSON.parse(sSubStr);
                 for (var i = 0; i < _sSubStr.length; i++) {
                     if (_sSubStr[i].HQty > 0 && (_sSubStr[i].HMinQty == 0 || _sSubStr[i].HWXQty == 0)) {
@@ -616,7 +616,7 @@
                                         , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, hide: true }
                                         , { field: 'HBarItemID', title: '鏉$爜ID', width: 100, hide: true }
                                         , { field: 'HMaterNumber', title: '鐗╂枡缂栫爜', width: 120 }
-/*                                        , { field: 'LSH', title: '娴佹按鍙�', width: 120 }*/
+                                        /*                                        , { field: 'LSH', title: '娴佹按鍙�', width: 120 }*/
                                         /*                    , { field: 'HOldMaterNumber', title: '鏃х墿鏂欑紪鐮�', width: 120, hide: true }*/
                                         , { field: 'HMaterShortNumber', title: '鐗╂枡浠g爜', width: 120, hide: true }
                                         , { field: 'HSubjoin', title: '鐗╂枡绠�绉�', width: 120 }
@@ -634,7 +634,7 @@
                                         , { field: 'HEXPUNIT', title: '淇濊川鏈熷崟浣�', width: 100, hide: true }
                                         , { field: 'HSourceBillType', title: '鏉$爜绫诲瀷', width: 100, hide: true }
                                         , { field: 'HKFDate', title: '鐢熶骇鏃ユ湡', align: 'center', width: 150, hide: true }//, event: "chooseHKFDate"
-                                        , { field: 'HKFPeriod', title: '淇濊川鏈�', width: 100, hide: true}//
+                                        , { field: 'HKFPeriod', title: '淇濊川鏈�', width: 100, hide: true }//
                                         , { field: 'HKFDQDate', title: '鍒版湡鏃ユ湡', align: 'center', width: 150, hide: true }//, event: "chooseHKFDQDate"
                                         , { field: 'HSupID', title: '渚涘簲鍟咺D', width: 150, hide: true }
                                         , { field: 'HSupName', title: '渚涘簲鍟嗗悕绉�', width: 150, hide: true }
@@ -657,38 +657,38 @@
                                             var rowdata_1 = [];
 
                                             for (var i = 0; i < data.length; i++) {
-                                                
-                                                    rowdata_1.push({
-                                                        "HMaterID": data[i].HMaterID,
-                                                        "HBarItemID": data[i].HBarItemID,
-/*                                                        "LSH": data[i].HBarItemID,*/
-                                                        "HBarCode": data[i].HBarCode,
-                                                        "HMaterNumber": data[i].鐗╂枡浠g爜,
-                                                        "HMaterShortNumber": "",
-                                                        "HSubjoin": data[i].鐗╂枡绠�绉�,
-                                                        "HMaterName": data[i].鐗╂枡鍚嶇О,
-                                                        "HMaterModel": data[i].瑙勬牸鍨嬪彿,
-                                                        "HMinQty": data[i].鏍囧噯鍖呰鏁�,
-                                                        "HBQty": data[i].鏈�灏忓寘瑁呮暟,
-                                                        "HSourceBillType": data[i].鏉$爜绫诲瀷,
-                                                        "HBatchNo": data[i].鎵瑰彿,
-                                                        "HISKFPERIOD": data[i].鏄惁鍚敤淇濊川鏈� == null ? 0 : data[i].鏄惁鍚敤淇濊川鏈�,
-                                                        "HKFPeriod": data[i].淇濊川鏈� == null ? 0 : data[i].淇濊川鏈�,
-                                                        "HKFDQDate": data[i].鏈夋晥鏈�,
-                                                        "HKFDate": data[i].鐢熶骇鏃ユ湡,
-                                                        "HBatchManager": data[i].鏄惁鍚敤鎵瑰彿,
-                                                        "HSupID": data[i].HSupID,
-                                                        "HSupName": data[i].渚涘簲鍟嗗悕绉�,
-                                                        "HEXPUNIT": data[i].淇濊川鏈熷崟浣�,
-                                                        "HQty":data[i].鐢熸垚鏉$爜鏁伴噺 , // 鏈鐢熸垚鏉$爜鏁伴噺
-                                                        "biaoqianzhangshu": 1,
-                                                        "HStatusMan": data[i].宸ュ彿,
-                                                        "HBarCodeDate": data[i].鏉$爜鏃ユ湡,
-                                                        "HLSH": data[i].娴佹按鍙�,
-                                                    });
-                                                
-                                                
-                                                
+
+                                                rowdata_1.push({
+                                                    "HMaterID": data[i].HMaterID,
+                                                    "HBarItemID": data[i].HBarItemID,
+                                                    /*                                                        "LSH": data[i].HBarItemID,*/
+                                                    "HBarCode": data[i].HBarCode,
+                                                    "HMaterNumber": data[i].鐗╂枡浠g爜,
+                                                    "HMaterShortNumber": "",
+                                                    "HSubjoin": data[i].鐗╂枡绠�绉�,
+                                                    "HMaterName": data[i].鐗╂枡鍚嶇О,
+                                                    "HMaterModel": data[i].瑙勬牸鍨嬪彿,
+                                                    "HMinQty": data[i].鏍囧噯鍖呰鏁�,
+                                                    "HBQty": data[i].鏈�灏忓寘瑁呮暟,
+                                                    "HSourceBillType": data[i].鏉$爜绫诲瀷,
+                                                    "HBatchNo": data[i].鎵瑰彿,
+                                                    "HISKFPERIOD": data[i].鏄惁鍚敤淇濊川鏈� == null ? 0 : data[i].鏄惁鍚敤淇濊川鏈�,
+                                                    "HKFPeriod": data[i].淇濊川鏈� == null ? 0 : data[i].淇濊川鏈�,
+                                                    "HKFDQDate": data[i].鏈夋晥鏈�,
+                                                    "HKFDate": data[i].鐢熶骇鏃ユ湡,
+                                                    "HBatchManager": data[i].鏄惁鍚敤鎵瑰彿,
+                                                    "HSupID": data[i].HSupID,
+                                                    "HSupName": data[i].渚涘簲鍟嗗悕绉�,
+                                                    "HEXPUNIT": data[i].淇濊川鏈熷崟浣�,
+                                                    "HQty": data[i].鐢熸垚鏉$爜鏁伴噺, // 鏈鐢熸垚鏉$爜鏁伴噺
+                                                    "biaoqianzhangshu": 1,
+                                                    "HStatusMan": data[i].宸ュ彿,
+                                                    "HBarCodeDate": data[i].鏉$爜鏃ユ湡,
+                                                    "HLSH": data[i].娴佹按鍙�,
+                                                });
+
+
+
                                             }
 
                                             // 鏇存柊琛ㄦ牸鏁版嵁
@@ -698,104 +698,19 @@
                                     }
                                 });
                                 //#endregion
-                                
-                                            // #region 鎴愬姛鏉$爜灞曠ず
-                                            //$.ajax({
-                                            //    type: "GET",
-                                            //    url: GetWEBURL() + "/showHBarCodeBillDetail",
-                                            //    async: true,
-                                            //    data: { sMsg: lentryid, user: sessionStorage["Organization"] },
-                                            //    dataType: "json",
-                                            //    success: function (data_1) {
-                                            //        if (data_1.count != 0) {
-                                            //            var data = data_1.data;
-                                            //            var rowdata_1 = [];
-                                            //            var IDdif = data[0].HItemID;
-                                            //            for (var i = 0,k=1; i < data.length; i++,k++) {
-                                            //                    var totalQty = data[i].鐢熸垚鏉$爜鏁伴噺; // 鎬绘潯鐮佹暟
-                                            //                    var standardQty = data[i].鏍囧噯鍖呰鏁�; // 鏍囧噯鍖呰鏁�
-                                            //                    var labelCount = Math.ceil(totalQty / standardQty); // 璁$畻鏍囩鏁�
-                                            //                    var lastQty_sign = (totalQty % standardQty == 0) ? 0 : 1;//鍒ゆ柇鏄惁鏈変綑鏁�
 
-                                            //                if (k == labelCount && lastQty_sign==1) {
-                                            //                    rowdata_1.push({
-                                            //                        "HMaterID": data[i].HItemID,
-                                            //                        "HBarCode": data[i].HBarCode,
-                                            //                        "HMaterNumber": data[i].鐗╂枡浠g爜,
-                                            //                        "HMaterShortNumber": "",
-                                            //                        "HMaterName": data[i].鐗╂枡鍚嶇О,
-                                            //                        "HMaterModel": data[i].瑙勬牸鍨嬪彿,
-                                            //                        "HMinQty": standardQty ,
-                                            //                        "HBQty": data[i].鏈�灏忓寘瑁呮暟,
-                                            //                        "HSourceBillType": data[i].鏉$爜绫诲瀷,
-                                            //                        "HBatchNo": data[i].鎵瑰彿,
-                                            //                        "HISKFPERIOD": data[i].鏄惁鍚敤淇濊川鏈� == null ? 0 : data[i].鏄惁鍚敤淇濊川鏈�,
-                                            //                        "HKFPeriod": data[i].淇濊川鏈� == null ? 0 : data[i].淇濊川鏈�,
-                                            //                        "HKFDQDate": data[i].鏈夋晥鏈�,
-                                            //                        "HKFDate": data[i].鐢熶骇鏃ユ湡,
-                                            //                        "HBatchManager": data[i].鏄惁鍚敤鎵瑰彿,
-                                            //                        "HSupID": data[i].渚涘簲鍟嗕唬鐮�,
-                                            //                        "HSupName": data[i].渚涘簲鍟嗗悕绉�,
-                                            //                        "HEXPUNIT": data[i].淇濊川鏈熷崟浣�,
-                                            //                        "HQty": (totalQty % standardQty), // 鏈鐢熸垚鏉$爜鏁伴噺
-                                            //                        "biaoqianzhangshu": 1
-                                            //                    });
-                                            //                    k = 1;
-                                            //                }
-                                            //                else {
-                                            //                    rowdata_1.push({
-                                            //                        "HMaterID": data[i].HItemID,
-                                            //                        "HBarCode": data[i].HBarCode,
-                                            //                        "HMaterNumber": data[i].鐗╂枡浠g爜,
-                                            //                        "HMaterShortNumber": "",
-                                            //                        "HMaterName": data[i].鐗╂枡鍚嶇О,
-                                            //                        "HMaterModel": data[i].瑙勬牸鍨嬪彿,
-                                            //                        "HMinQty":  standardQty,
-                                            //                        "HBQty": data[i].鏈�灏忓寘瑁呮暟,
-                                            //                        "HSourceBillType": data[i].鏉$爜绫诲瀷,
-                                            //                        "HBatchNo": data[i].鎵瑰彿,
-                                            //                        "HISKFPERIOD": data[i].鏄惁鍚敤淇濊川鏈� == null ? 0 : data[i].鏄惁鍚敤淇濊川鏈�,
-                                            //                        "HKFPeriod": data[i].淇濊川鏈� == null ? 0 : data[i].淇濊川鏈�,
-                                            //                        "HKFDQDate": data[i].鏈夋晥鏈�,
-                                            //                        "HKFDate": data[i].鐢熶骇鏃ユ湡,
-                                            //                        "HBatchManager": data[i].鏄惁鍚敤鎵瑰彿,
-                                            //                        "HSupID": data[i].渚涘簲鍟嗕唬鐮�,
-                                            //                        "HSupName": data[i].渚涘簲鍟嗗悕绉�,
-                                            //                        "HEXPUNIT": data[i].淇濊川鏈熷崟浣�,
-                                            //                        "HQty": standardQty, // 鏈鐢熸垚鏉$爜鏁伴噺
-                                            //                        "biaoqianzhangshu": 1
-                                            //                    });
-                                            //                }
+                              
+                            } else {
+                                layer.msg(data.Message);
+                            }
 
-
-
-                                            //            }
-
-                                            //            option_Success.data = rowdata_1;
-                                            //            table.render(option_Success);
-
-                                            //        }
-                                            //        else {
-                                            //            // $("#verifycode").click();
-                                            //            f_alert(data.Message);
-                                            //        }
-                                            //        layer.closeAll("loading");
-                                            //    },
-                                            //    error: function (err) {
-                                            //        f_alert("閿欒:" + err);
-                                            //        layer.closeAll("loading");
-                                            //    }
-                                            //});
-                                            // #endregion 
-                                        }
-
-                                        layer.closeAll("loading");
-                                    },
-                                    error: function (err) {
-                                        f_alert("閿欒:" + err);
-                                    }
-                                });
-                                return false;
+                            layer.closeAll("loading");
+                        },
+                        error: function (err) {
+                            f_alert("閿欒:" + err);
+                        }
+                    });
+                return false;
             });
            //#endregion
 
diff --git a/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_MaterialHanding.html b/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_MaterialHanding.html
index d90cfc8..ad73dc5 100644
--- a/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_MaterialHanding.html
+++ b/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_MaterialHanding.html
@@ -623,27 +623,41 @@
             if (checkStatus.data.length === 1) {
                 var InterID = data[0].HItemID.toString();
                 var HMaterID = data[0].鐗╂枡ID.toString();
-                //閫昏緫瀹℃牳鏂规硶
+                var FirstID = sessionStorage["HSupIDs"];
+                var HSupID = FirstID.split(",")[0];
+                /*                var HSupID = "672189";*/
+
+                // 鍏堟鏌ユ槸鍚﹀瓨鍦ㄥ鏉¤褰�
                 $.ajax({
                     type: "GET",
-                    url: GetWEBURL() + "/MaterialHandingController/OpenMaterial", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
-                    data: { "HInterID": InterID, "IsUse": num, "CurUserName": sessionStorage["HUserName"], "HMaterID": HMaterID},
+                    url: GetWEBURL() + "/MaterialHandingController/CheckMaterialCount",
+                    data: {
+                        "HMaterID": HMaterID,
+                        "HSupID": HSupID,
+                        "HInterID": InterID
+                    },
                     success: function (result) {
-                        if (result.count == 1) {
-                            layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
-                                //// 寰楀埌frame绱㈠紩
-                                var index = layer.getFrameIndex(window.name);
-                                ////鍏抽棴褰撳墠frame
+                        if (result.count > 0) {
+                            // 瀛樺湪澶氭潯璁板綍锛屽脊鍑虹‘璁ゆ
+                            layer.confirm('鍚屼竴渚涘簲鍟嗕笅鐨勮鐗╂枡瀛樺湪澶氭潯璁板綍锛屾槸鍚﹀皢鍏朵綑璁板綍璁剧疆涓烘湭鍚敤锛�', {
+                                btn: ['纭畾', '鍙栨秷'],
+                                title: "鍚敤纭"
+                            }, function (index) {
+                                //浼�1锛屼娇鐢╱pdate
                                 layer.close(index);
-                                //淇敼涓哄姛鍚庡埛鏂扮晫闈�
-                                $("#btnSearch").trigger('click');
+                                callForEnable(InterID, HMaterID, HSupID, 1, num);
+                            }, function (index) {
+                                //浼�0锛岀洿鎺ュ惎鐢�
+                                layer.close(index);
+                                //callForEnable(InterID, HMaterID, HSupID, 0, num);
                             });
-
                         } else {
-                            layer.alert("宸茬粡鍚敤锛屼笉鍑嗗啀娆″惎鐢紒", { icon: 5 });
+                            // 娌℃湁澶氭潯璁板綍锛岀洿鎺ュ惎鐢�
+                            callForEnable(InterID, HMaterID, HSupID, 0, num);
                         }
-                    }, error: function () {
-                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                    },
+                    error: function () {
+                        layer.alert("妫�鏌ヨ褰曟暟閲忓け璐�!", { icon: 5 });
                     }
                 });
             }
@@ -652,7 +666,39 @@
             }
         }
 
+        function callForEnable(InterID, HMaterID, HSupID, disableOthers, num) {
+            $.ajax({
+                type: "GET",
+                url: GetWEBURL() + "/MaterialHandingController/OpenMaterial",
+                data: {
+                    "HInterID": InterID,
+                    "IsUse": num,
+                    "CurUserName": sessionStorage["HUserName"],
+                    "HMaterID": HMaterID,
+                    "HSupID": HSupID,
+                    "disableOthers": disableOthers
+                },
+                success: function (result) {
+                    if (result.count == 1) {
+                        layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
+                            // 寰楀埌frame绱㈠紩
+                            var index = layer.getFrameIndex(window.name);
+                            // 鍏抽棴褰撳墠frame
+                            layer.close(index);
+                            // 淇敼鎴愬姛鍚庡埛鏂扮晫闈�
+                            $("#btnSearch").trigger('click');
+                        });
+                    } else {
+                        layer.alert(result.Message, { icon: 5 });
+                    }
+                },
+                error: function () {
+                    layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                }
+            });
+        }
         //#endregion
+       
 
         function get_createBarCode() {
             var checkStatus = table.checkStatus('mainTable')
diff --git a/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_MaterialHandingEdit.html b/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_MaterialHandingEdit.html
index cdfbcbd..bd421ee 100644
--- a/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_MaterialHandingEdit.html
+++ b/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_MaterialHandingEdit.html
@@ -82,7 +82,7 @@
                                             </button>
                                         </div>
                                         <div class="layui-col-xs4 layui-inline">
-                                            <label class="layui-form-label">鐗╂枡鍚嶇О</label>
+                                            <label class="layui-form-label">鐗╂枡绠�绉�</label>
                                             <div class="layui-input-inline">
                                                 <input type="text" class="layui-input" name="HMaterName" id="HMaterName" onmouseover="this.title=this.value" style="float: left; width: 150px; background-color: #efefef4d; display: inline-block;" readonly>
                                                 <input type="hidden" name="HUserID" id="HUserID" value="0">
@@ -97,6 +97,12 @@
                                         </div>
                                     </div>
                                     <div class="layui-row">
+                                        <div class="layui-col-xs4 layui-inline">
+                                            <label class="layui-form-label">鐗╂枡鍚嶇О</label>
+                                            <div class="layui-input-inline">
+                                                <input type="text" class="layui-input" name="HMaterName0" id="HMaterName0" readonly>
+                                            </div>
+                                        </div>
                                         <div class="layui-col-xs4 layui-inline">
                                             <label class="layui-form-label">鏈�灏忓寘瑁�</label>
                                             <div class="layui-input-inline">
@@ -603,8 +609,13 @@
                     return;
                 }
             }
+            if ($("#HMaterID").val() == 0 || $("#HMaterID").val() == null || $("#HMaterID").val() == undefined) {
+                layer.msg("鐗╂枡淇℃伅鏈牎楠屾垚鍔燂紝涓嶅厑璁镐繚瀛橈紒");
+                return;
+            }
+
             var HMaterID = $('#HMaterNumber').val();
-            var sMainStr = JSON.stringify(data.field);
+            var sMainStr = JSON.stringify(data.field) + ';' + sessionStorage["OrganizationID"];
             //var sMainSub = sMainStr + ";" +  HMaterID;
             var itID = $('#HitemID').val();
             var index = layer.load();
@@ -764,7 +775,7 @@
             var HMaterID = $("#HMaterID").val();
             var user = sessionStorage["HUserName"];
             var OrganizationID = sessionStorage["OrganizationID"];
-            var SupID = $("#SupID").val();
+            var SupID = $("#HSupID").val();
 
             $.ajax({
                 type: "GET",
@@ -806,8 +817,12 @@
                         });
                     } else if (responseData.code === "1") {
 
-                        $("#HMaterName").val(responseData.data[0]["HSubjoin"] == null ? responseData.data[0]["HName"] : responseData.data[0]["HSubjoin"]);
+                        $("#HMaterName0").val(responseData.data[0]["HName"]);
+                        $("#HMaterName").val(responseData.data[0]["HSubjoin"]);
                         $("#HModel").val(responseData.data[0]["HModel"]);
+                        $("#HMaterID").val(responseData.data[0]["HItemID"]);
+
+                        
                         form.render('select');
                     } else {
                         layer.msg(responseData.Message || "鐗╂枡淇℃伅涓嶅瓨鍦�", { time: 5000 });

--
Gitblit v1.9.1