From f025d969dcf4e664ef8f7f33ee2060e113c3adff Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期五, 30 五月 2025 20:56:58 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-LayUI

---
 WebTM/views/仓存管理/仓库调拨/Cc_LookingForReturnBill.html |  284 ++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 173 insertions(+), 111 deletions(-)

diff --git "a/WebTM/views/\344\273\223\345\255\230\347\256\241\347\220\206/\344\273\223\345\272\223\350\260\203\346\213\250/Cc_LookingForReturnBill.html" "b/WebTM/views/\344\273\223\345\255\230\347\256\241\347\220\206/\344\273\223\345\272\223\350\260\203\346\213\250/Cc_LookingForReturnBill.html"
index 0446aa0..f2a48c6 100644
--- "a/WebTM/views/\344\273\223\345\255\230\347\256\241\347\220\206/\344\273\223\345\272\223\350\260\203\346\213\250/Cc_LookingForReturnBill.html"
+++ "b/WebTM/views/\344\273\223\345\255\230\347\256\241\347\220\206/\344\273\223\345\272\223\350\260\203\346\213\250/Cc_LookingForReturnBill.html"
@@ -2,7 +2,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-    <title>褰掕繕鍗�</title>
+<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, maximum-scale=1">
@@ -50,34 +50,6 @@
                         <div class="layui-tab-content">
                             <!--琛ㄥご淇℃伅-->
                             <div class="layui-tab-item">
-                                <div class="layui-form-item" style="padding:0px;margin:0px">
-                                    <div class="layui-row">
-                                        <div class="layui-col-xs3">
-                                            <label class="layui-form-label" style="width:30px;padding-left:0px;">浠撳簱</label>
-                                        </div>
-                                        <div class="layui-col-xs6">
-                                            <input type="text" name="HWHName" id="HWHName" autocomplete="off" class="layui-input">
-                                            <input type="hidden" name="HWHID" id="HWHID" value="0" autocomplete="off" class="layui-input">
-                                        </div>
-                                        <div class="layui-col-xs3">
-                                            <button type="button" id="HWHID-BT" lay-submit="" class="layui-btn" lay-filter="HWHID-BT">...</button>
-                                        </div>
-                                    </div>
-                                </div>
-                                <div class="layui-form-item" style="padding:0px;margin:0px">
-                                    <div class="layui-row">
-                                        <div class="layui-col-xs3">
-                                            <label class="layui-form-label" style="width:30px;padding-left:0px;">浠撲綅</label>
-                                        </div>
-                                        <div class="layui-col-xs6">
-                                            <input type="text" name="HSPName" id="HSPName" autocomplete="off" class="layui-input">
-                                            <input type="hidden" name="HSPID" id="HSPID" value="0" autocomplete="off" class="layui-input">
-                                        </div>
-                                        <div class="layui-col-xs3">
-                                            <button type="button" id="HSpID-BT" lay-submit="" class="layui-btn" lay-filter="HSpID-BT">...</button>
-                                        </div>
-                                    </div>
-                                </div>
                                 <div class="layui-form-item" style="padding:0px;margin:0px">
                                     <div class="layui-row">
                                         <div class="layui-col-xs3">
@@ -143,6 +115,34 @@
                             </div>
                             <!--瀹炵墿涓婃灦-->
                             <div class="layui-tab-item layui-show">
+                                <div class="layui-form-item" style="padding:0px;margin:0px">
+                                    <div class="layui-row">
+                                        <div class="layui-col-xs3">
+                                            <label class="layui-form-label" style="width:30px;padding-left:0px;">浠撳簱</label>
+                                        </div>
+                                        <div class="layui-col-xs8">
+                                            <input type="text" name="HWHName" id="HWHName" autocomplete="off" class="layui-input" readonly>
+                                            <input type="hidden" name="HWHID" id="HWHID" value="0" autocomplete="off" class="layui-input">
+                                        </div>
+                                        <div class="layui-col-xs1">
+                                            <button type="button" id="HWHID-BT" lay-submit="" class="layui-btn" lay-filter="HWHID-BT" style="display:none;">...</button>
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="layui-form-item" style="padding:0px;margin:0px">
+                                    <div class="layui-row">
+                                        <div class="layui-col-xs3">
+                                            <label class="layui-form-label" style="width:30px;padding-left:0px;">浠撲綅</label>
+                                        </div>
+                                        <div class="layui-col-xs8">
+                                            <input type="text" name="HSPName" id="HSPName" autocomplete="off" class="layui-input">
+                                            <input type="hidden" name="HSPID" id="HSPID" value="0" autocomplete="off" class="layui-input">
+                                        </div>
+                                        <div class="layui-col-xs1">
+                                            <button type="button" id="HSpID-BT" lay-submit="" class="layui-btn" lay-filter="HSpID-BT" style="display:none">...</button>
+                                        </div>
+                                    </div>
+                                </div>
                                 <div class="layui-row">
                                     <div class="layui-col-xs3">
                                         <label class="layui-form-label" style="width:60px;padding-left:0px;margin-bottom: 1%;">瀹炵墿鏉$爜</label>
@@ -191,7 +191,7 @@
             if (sessionStorage.login != "login") {
                 layer.confirm("鐧诲綍澶辨晥锛岃閲嶆柊鐧诲綍锛�", {
                     icon: 4, skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず", closeBtn: 0, btn: ['閲嶆柊鐧诲綍']
-                }, function () { window.location.href = "user/login.html"; });
+                }, function () { window.location.href = "../../user/login.html"; });
             }
 
             //鍒濆鍩烘湰淇℃伅璧嬪��
@@ -205,6 +205,13 @@
             $("#HSource").val(sessionStorage["HSource"]);
             $("#HMakerID").val(sessionStorage["Czybm"]);
             $("#HMaker").val(sessionStorage["HUserName"]);
+
+            //鍒ゆ柇鐢ㄦ埛鏄惁缁戝畾鐝粍鍜岀敓浜ц祫婧�
+            if ($("#HGroupID").val() == 0 || $("#HSourceID").val() == 0) {
+                layer.confirm("璇ョ敤鎴锋湭缁戝畾鐝粍鎴栫敓浜ц祫婧愶紒涓嶅厑璁告壘璐э紒", {
+                    icon: 4, skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず", closeBtn: 0, btn: ['纭閫�鍑�']
+                }, function () { window.location.href = "../../index.html"; });
+            }
 
             //鑾峰彇鏈�澶у崟鎹彿 new
             $("#HInterID").val("");
@@ -229,15 +236,15 @@
                 , cellMinWidth: 90
                 , cols: [[
                     { type: 'numbers', title: '搴忓彿' }
-                    , { field: 'HIsStatus', title: '鏄惁鎵爜' }
-                    , { field: 'HSourceInterID', title: '婧愬崟ID', hide: true }
-                    , { field: 'HSourceBillNo', title: '婧愬崟鍙�', width: 110 }
-                    , { field: 'HMTONo', title: '鎵瑰彿', width: 180 }
-                    , { field: 'HStatus', title: '鍦ㄥ簱鐘舵��', width: 165 }
-                    , { field: 'HWhID', title: '浠撳簱ID', hide: true }
-                    , { field: 'HWhName', title: '浠撳簱' }
+                    , { field: 'HIsStatus', title: '鏄惁鎵爜', hide: true }
+                    , { field: 'HMTONo', title: '鎵瑰彿' }
                     , { field: 'HSPID', title: '浠撲綅ID', hide: true }
                     , { field: 'HSPName', title: '浠撲綅' }
+                    , { field: 'HStatus', title: '鍦ㄥ簱鐘舵��' }
+                    , { field: 'HWhID', title: '浠撳簱ID', hide: true }
+                    , { field: 'HWhName', title: '浠撳簱', width: 130 }
+                    , { field: 'HSourceInterID', title: '婧愬崟ID', hide: true }
+                    , { field: 'HSourceBillNo', title: '婧愬崟鍙�', width: 110 }
                     , { field: 'HGroupID', title: '鐝粍ID', hide: true }
                     , { field: 'HGroup', title: '鐝粍' }
                     , { field: 'HSourceID', title: '鐢熶骇璧勬簮ID', hide: true }
@@ -249,11 +256,11 @@
                     , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿' }
                     , { field: '鍗虫椂搴撳瓨', title: '鍗虫椂搴撳瓨' }
                     , { field: 'HBarCode', title: '鏉$爜缂栧彿', hide: true }
-                    , { field: 'HInterID', title: '鍗曟嵁ID' }
-                    , { field: 'HBillNo', title: '鍗曟嵁鍙�' }
-                    , { field: 'HMakerID', title: '鍒跺崟浜篒D' }
-                    , { field: 'HMaker', title: '鍒跺崟浜�' }
-                    , { field: 'HBillType', title: 'HBillType' }
+                    , { field: 'HInterID', title: '鍗曟嵁ID', hide: true }
+                    , { field: 'HBillNo', title: '鍗曟嵁鍙�', hide: true }
+                    , { field: 'HMakerID', title: '鍒跺崟浜篒D', hide: true }
+                    , { field: 'HMaker', title: '鍒跺崟浜�', hide: true }
+                    , { field: 'HBillType', title: 'HBillType', hide: true }
                 ]]
                 , text: {
                     none: '鏆傛棤鐩稿叧鏁版嵁锛岃鍏堟壂鎻忔簮鍗曞彿锛�' //榛樿锛氭棤鏁版嵁銆傛敞锛氳灞炴�т负 layui 2.2.5 寮�濮嬫柊澧�
@@ -269,15 +276,15 @@
                 , cellMinWidth: 90
                 , cols: [[
                     { type: 'numbers', title: '搴忓彿' }
-                    //, { field: 'HIsStatus', title: '鏄惁鎵爜' }
+                    , { field: 'HIsStatus', title: '鏄惁鎵爜' }
+                    , { field: 'HMTONo', title: '鎵瑰彿' }
+                    , { field: 'HSPID', title: '浠撲綅ID', hide: true }
+                    , { field: 'HSPName', title: '浠撲綅', hide: true }
+                    , { field: 'HStatus', title: '鍦ㄥ簱鐘舵��' }
+                    , { field: 'HWhID', title: '浠撳簱ID', hide: true }
+                    , { field: 'HWhName', title: '浠撳簱', width: 130, hide: true }
                     , { field: 'HSourceInterID', title: '婧愬崟ID', hide: true }
                     , { field: 'HSourceBillNo', title: '婧愬崟鍙�', width: 110 }
-                    , { field: 'HMTONo', title: '鎵瑰彿', width: 180 }
-                    , { field: 'HStatus', title: '鍦ㄥ簱鐘舵��', width: 165 }
-                    , { field: 'HWhID', title: '浠撳簱ID', hide: true }
-                    , { field: 'HWhName', title: '浠撳簱' }
-                    , { field: 'HSPID', title: '浠撲綅ID', hide: true }
-                    , { field: 'HSPName', title: '浠撲綅' }
                     , { field: 'HGroupID', title: '鐝粍ID', hide: true }
                     , { field: 'HGroup', title: '鐝粍' }
                     , { field: 'HSourceID', title: '鐢熶骇璧勬簮ID', hide: true }
@@ -308,8 +315,8 @@
             option2.data = [];
             table.render(option2);
 
-            //杩涘叆椤甸潰榛樿鍏夋爣鍦ㄦ簮鍗曞彿涓�
-            $("#HBarCode").focus();
+            //杩涘叆椤甸潰榛樿鍏夋爣鍦ㄤ粨浣嶄笂
+            $("#HSPName").focus();
 
             //鎵簮鍗曪紙鍖呰鍗曟潯鐮侊級--寮冪敤
             $('#HBarCode_Pack').on('keydown', function (event) {
@@ -367,6 +374,7 @@
                                 $("#HSourceBillNo").attr("readonly", "readonly");//婧愬崟鍙峰彧璇�
                                 $("#HSourceBillNo").css("background-color", "#efefef4d");
                                 element.tabChange('tab-LookingForBill', '2');  //璺宠浆椤电
+                                $("#HSPName").focus();
                             }
                             else {
                                 layer.close(index);
@@ -427,46 +435,82 @@
 
             //鎵疄鐗╂潯鐮�
             $('#HBarCode').on('keydown', function (event) {
-                var HBarCode = $('#HBarCode').val()
+                var HBarCode = $('#HBarCode').val();
                 if (event.keyCode == 13) {
-                    var index = layer.load();
-                    $.ajax({
-                        url: GetWEBURL() + "/LookingFor/getBarCodeDetails",
-                        type: "GET",
-                        data: { "HBarCode": HBarCode },
-                        success: function (result) {
-                            if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
-                                var data = result.data;
-                                option2.data = data;
-                                table.render(option2);
-                                var sSubStr = table.cache['bzd-table2'];
-                                sSubStr[0].HSourceID = $("#HSourceID").val();
-                                sSubStr[0].HSource = $("#HSource").val();
-                                sSubStr[0].HGroupID = $("#HGroupID").val();
-                                sSubStr[0].HGroup = $("#HGroup").val();
-                                sSubStr[0].HInterID = $("#HInterID").val();
-                                sSubStr[0].HBillNo = $("#HBillNo").val();
-                                sSubStr[0].HMakerID = $("#HMakerID").val();
-                                sSubStr[0].HMaker = $("#HMaker").val();
-                                option2.data = table.cache["bzd-table2"];
-                                table.render(option2);
+                    if ($("#HSPID").val() == 0) {
+                        layer.msg("璇峰厛鎵弿浠撲綅鐮�!", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                        return;
+                    }
+                    else
+                    {
+                        var index = layer.load();
+                        $.ajax({
+                            url: GetWEBURL() + "/LookingFor/getBarCodeDetails",
+                            type: "GET",
+                            data: { "HBarCode": HBarCode },
+                            success: function (result) {
+                                if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                    var sSubStr = result.data;
+                                    var tableStr = table.cache['bzd-table2'];
+                                    for (var i = 0; i < tableStr.length; i++) {
+                                        if (tableStr[i].HBarCode == sSubStr[0].HBarCode) {
+                                            layer.close(index);
+                                            $('#HBarCode').val("");
+                                            layer.msg("璇ュ疄鐗╁凡鎵爜锛岃鍕块噸澶嶆壂鐮�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                                            return;
+                                        }
+                                    }
+                                    var last = tableStr.length;
+                                        //if (tableStr.length >0 && tableStr[i-1].HBarCode == sSubStr[0].HBarCode) {
+                                        //    layer.close(index);
+                                        //    $('#HBarCode').val("");
+                                        //    layer.msg("璇ュ疄鐗╁凡鎵爜锛岃鍕块噸澶嶆壂鐮�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                                        //}
+                                        //else if (sSubStr[i].HStatus == null || sSubStr[i].HStatus == "" || sSubStr[i].HStatus == "鍦ㄥ簱")
+                                        //{
+                                        //    layer.close(index);
+                                        //    layer.msg("璇ュ疄鐗╁湪" + sSubStr[i].HWhName + "-" + sSubStr[i].HSPName+"锛屼笉鍏佽鎵爜", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                                        //}
+                                        //else {
+                                            //var data = result.data;
+                                            option2.data.push(sSubStr[0]);
+                                            table.render(option2);
+                                            sSubStr = table.cache['bzd-table2'];
+                                    sSubStr[last].HIsStatus = "鏄�";
+                                    sSubStr[last].HSourceID = $("#HSourceID").val();
+                                    sSubStr[last].HSource = $("#HSource").val();
+                                    sSubStr[last].HGroupID = $("#HGroupID").val();
+                                    sSubStr[last].HGroup = $("#HGroup").val();
+                                    sSubStr[last].HInterID = $("#HInterID").val();
+                                    sSubStr[last].HBillNo = $("#HBillNo").val();
+                                    sSubStr[last].HMakerID = $("#HMakerID").val();
+                                    sSubStr[last].HMaker = $("#HMaker").val();
+                                    sSubStr[last].HSPName = $("#HSPName").val();
+                                    sSubStr[last].HSPID = $("#HSPID").val();
+                                    sSubStr[last].HWHID = $("#HWHID").val();
+                                    sSubStr[last].HWhName = $("#HWHName").val();
+                                            option2.data = table.cache["bzd-table2"];
+                                            table.render(option2);
+                                            layer.close(index);
+                                            $('#HBarCode').val("");
+                                            layer.msg("鎵爜鎴愬姛锛�", { icon: 1, time: 1000 });
+                                        //}
+                                    //}
+
+                                }
+                                else {
+                                    option2.data = [];
+                                    table.render(option2);
+                                    layer.close(index);
+                                    layer.msg(result.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                                }
+                            },
+                            error: function (err) {
                                 layer.close(index);
-                                $('#HBarCode').val("");
-                                layer.close(index);
-                                layer.msg("鎵爜鎴愬姛锛�", { icon: 1, time: 1000 });
+                                layer.msg("鎺ュ彛璇锋眰澶辫触锛�" + err, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                             }
-                            else {
-                                option2.data = [];
-                                table.render(option2);
-                                layer.close(index);
-                                layer.msg(result.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                            }
-                        },
-                        error: function (err) {
-                            layer.close(index);
-                            layer.msg("鎺ュ彛璇锋眰澶辫触锛�" + err, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                        }
-                    });
+                        });
+                    }
                 }
             });
 
@@ -544,31 +588,22 @@
 
             //鎻愪氦
             form.on('submit(Saver)', function (data) {//鎻愪氦
-                //debugger;
-                //var sMainStr = JSON.stringify(data.field);
                 var tableData = table.cache['bzd-table2'];
-                //for (var i = 0; i < tableData.length; i++) {
-                //    if (tableData[i].HIsStatus == "鏄�" ) {
-
-                //    } else {
-                //        //绉婚櫎褰撳墠琛�
-                //        tableData.splice(i, 1);
-                //        i--;
-                //        option.data = tableData;
-                //        table.render(option);
-                //    }
-                //}
                 var sSubStr = JSON.stringify(tableData);
                 sSubStr = "{\"oSub\": " + sSubStr + "}";
-                //sSubStr = JSON.stringify(sSubStr);
-                //var json = "{\"oMain\":" + sMainStr + "},{\"oMain\":" + sSubStr + "}";
                 if (AllowLoadData(sSubStr, 'Saver') != false)//闈炵┖楠岃瘉
                 {
+                    //鍒ゆ柇涓婃灦搴撲綅鏄惁涓庢潯鐮佷腑搴撲綅涓�鑷�
+                    //var tableData = table.cache['bzd-table2'];
+                    //if ($("#HWHID").val() != tableData[0].HWhID || $("#HSPID").val() != tableData[0].HSPID) {
+                    //    layer.msg("褰撳墠搴撲綅涓庡疄闄呬笉绗︼紒", { icon: 4, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    //    return;
+                    //}
                     var index = layer.load();
                     $.ajax(
                     {
                         type: "POST",
-                            url: GetWEBURL() + "/LookingFor/set_SaveLookingForReturnBill_Json",
+                        url: GetWEBURL() + "/LookingFor/set_SaveLookingForReturnBill_Json",
                         //url:"http://localhost:12761/LookingFor/set_SaveLookingForReturnBill_Json",
                         async: true,
                         data: { "oMain": sSubStr },
@@ -607,20 +642,46 @@
                 }
             });
 
-
+            //鎵笂鏋朵粨浣�
             $('#HSPName').on('keydown', function (event) {      //鎵粨浣�
-                var HBarCode = $('#HSPName').val()
+                var HBarCode = $('#HSPName').val();
                 if (event.keyCode == 13) {
                     //鍒ゆ柇鏂囨湰妗嗘槸鍚︽湁鏁版嵁    new
                     $.ajax({
-                        url: GetWEBURL() + "/Web/GetSpName_Json",
+                        url: GetWEBURL() + "/LookingFor/getSpName_Json",
                         type: "GET",
                         data: { "HBarCode": HBarCode },
                         success: function (result) {
                             if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                //var tableData = table.cache['bzd-table2'];
+                                //if (tableData.length == 0) {
+                                //    layer.msg("璇峰厛鎵疄鐗╂潯鐮侊紒", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                                //    return;
+                                //}
+                                //if (result.data[0].HWHID != tableData[0].HWhID || result.data[0].HItemID != tableData[0].HSPID) {
+                                //    layer.msg("姝ゅ簱浣嶄笌瀹為檯涓嶇锛�", { icon: 4, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                                //} else {
                                 $("#HSPName").val(result.data[0].HName);
                                 $("#HSPID").val(result.data[0].HItemID);
-                                element.tabChange('tab-POStockInBill', '2');
+                                $("#HWHID").val(result.data[0].HWHID);
+                                $("#HWHName").val(result.data[0].HWhName);
+                                //鍚敤mes浠撲綅锛屾牴鎹�佷粨搴撹浆鎹㈡垚鏂颁粨搴�
+                                $.ajax({
+                                    url: GetWEBURL() + "/LookingFor/GetSpNameMES_Json",
+                                    type: "GET",
+                                    data: { "HERPWHID": $("#HWHID").val() },
+                                    success: function (result) {
+                                        if (result.count == 1) {
+                                            $("#HWhID").val(result.data[0].HMESWHID);
+                                            $("#HWHName").val(result.data[0].HMESWHNAME);
+                                            $("#HBarCode").focus();
+                                        }
+                                        else {
+                                            layer.msg(result.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                                        }
+                                        layer.closeAll("loading");
+                                    }
+                                });
                             }
                             else {
                                 layer.msg(result.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
@@ -655,6 +716,10 @@
                 }
             });
 
+
+
+
+        //浠ヤ笂涓簂ayui妯″潡
         });
 
         //杩斿洖浠撳簱
@@ -724,9 +789,6 @@
                         }
                     }
                 }
-            }
-            else {
-                return true;
             }
         }
     </script>

--
Gitblit v1.9.1