From cb4067f68b5ec16ff9ea904998eb4156085d5a92 Mon Sep 17 00:00:00 2001
From: YL <YL@LAPTOP-SE03PLUR>
Date: 星期一, 01 十一月 2021 13:45:47 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/SRM-LAYUI

---
 WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_POInStockBill.html |  373 +++++++++++++++++++++++++++++++----------------------
 1 files changed, 217 insertions(+), 156 deletions(-)

diff --git a/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_POInStockBill.html b/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_POInStockBill.html
index b5f262e..d600c90 100644
--- a/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_POInStockBill.html
+++ b/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_POInStockBill.html
@@ -90,7 +90,12 @@
                                                         <input id="HDeptID" name="HDeptID" type="hidden" />
                                                     </div>
                                                 </div>
-
+                                                <div class="layui-col-xs3">
+                                                    <label class="layui-form-label"> 鐗╂祦鍗曞彿锛�</label>
+                                                    <div class="layui-input-inline">
+                                                        <input class="layui-input" name="HDeliveryNo" id="HDeliveryNo" autocomplete="off">
+                                                    </div>
+                                                </div>
 
                                             </div>
                                         </div>
@@ -169,6 +174,7 @@
                     <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
                     <script type="text/html" id="toolbarDemo">
                         <div class="layui-btn-container">
+                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Save"><i class="layui-icon layui-icon-tips"></i>淇濆瓨</button>
                             <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-view"><i class="layui-icon layui-icon-tips"></i>棰勮</button>
                             <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-print"><i class="layui-icon layui-icon-print"></i>鎵撳嵃</button>
                             <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-reload"><i class="layui-icon layui-icon-refresh"></i>鍒锋柊</button>
@@ -178,7 +184,7 @@
                     </script>
                     <blockquote class="layui-elem-quote">閫佽揣鍗�</blockquote>
                 </div>
-                        </div>
+            </div>
         </div>
     </div>
     <!--<script src="../../layuiadmin/layui/lay/modules/mobile/jquery-3.3.1.min.js"></script>-->
@@ -194,80 +200,82 @@
             index: 'lib/index' //涓诲叆鍙fā鍧�
         }).use(['index', 'table', 'form', 'element'], function () {
             var table = layui.table
-            , $ = layui.$
-            , form = layui.form
-            , element = layui.element; //Tab鐨勫垏鎹㈠姛鑳斤紝鍒囨崲浜嬩欢鐩戝惉绛夛紝闇�瑕佷緷璧杄lement妯″潡
+                , $ = layui.$
+                , form = layui.form
+                , element = layui.element; //Tab鐨勫垏鎹㈠姛鑳斤紝鍒囨崲浜嬩欢鐩戝惉绛夛紝闇�瑕佷緷璧杄lement妯″潡
 
-        function getUrlVars() {
-            var vars = [], hash;
-            var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
-            for (var i = 0; i < hashes.length; i++) {
-                hash = hashes[i].split('=');
-                vars.push(hash[0]);
-                vars[hash[0]] = hash[1];
-            }
-            return vars;
-        }
-        var params = getUrlVars();
-        var linterid = params[params[0]];
-        var lentryid = params[params[1]];
-        RoadBillMain(linterid);
-        RoadBillSub(linterid);
-        // debugger;
-        function RoadBillMain(linterid) {
-            $.ajax({
-                url: GetWEBURL()+"GetPOInStockShowBillMain",
-                type: "GET",
-                data: { "sMsg": linterid },
-                success: function (d) {
-                    console.log(d.data);
-                    //$("#HDate").val(d.)
-                    $("#HInterID").val(d.data[0].HInterID);
-                    $("#HBillNo").val(d.data[0].HBillNo);
-                    $("#HStatus").val(d.data[0].HStatus);
-                    $("#HInnerBillNo").val(d.data[0].HInnerBillNo);
-                    $("#HRemark").val(d.data[0].HRemark);
-                    $("#HDate").val(d.data[0].HDateForWeb);
-                    $("#HMaker").val(d.data[0].HMaker);
-                    $("#HMakerDate").val(d.data[0].HMakerDate)
-                    $("#HChecker").val(d.data[0].HChecker);
-                    $("#HCheckDate").val(d.data[0].HCheckDate);
-                    $("#HDeptID").val(d.data[0].HDeptID);
-                    $("#HDeptName").val(d.data[0].HDeptName);
-                    $("#HSupID").val(d.data[0].HSupID);
-                    $("#HSupName").val(d.data[0].HSupName);
-                    $("#HEmpID").val(d.data[0].HEmpID);
-                    $("#HEmpName").val(d.data[0].HEmpName);
-                    $("#HManagerID").val(d.data[0].HManagerID);
-                    $("#HManagerName").val(d.data[0].HManagerName);
+            function getUrlVars() {
+                var vars = [], hash;
+                var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
+                for (var i = 0; i < hashes.length; i++) {
+                    hash = hashes[i].split('=');
+                    vars.push(hash[0]);
+                    vars[hash[0]] = hash[1];
                 }
-            });
-        }
+                return vars;
+            }
+            var params = getUrlVars();
+            var linterid = params[params[0]];
+            var lentryid = params[params[1]];
+            var btntype = params[params[1]];
+            RoadBillMain(linterid);
+            RoadBillSub(linterid);
+            // debugger;
+            function RoadBillMain(linterid) {
+                $.ajax({
+                    url: GetWEBURL() + "GetPOInStockShowBillMain",
+                    type: "GET",
+                    data: { "sMsg": linterid },
+                    success: function (d) {
+                        console.log(d.data);
+                        //$("#HDate").val(d.)
+                        $("#HInterID").val(d.data[0].HInterID);
+                        $("#HBillNo").val(d.data[0].HBillNo);
+                        $("#HStatus").val(d.data[0].HStatus);
+                        $("#HInnerBillNo").val(d.data[0].HInnerBillNo);
+                        $("#HRemark").val(d.data[0].HRemark);
+                        $("#HDate").val(d.data[0].HDateForWeb);
+                        $("#HMaker").val(d.data[0].HMaker);
+                        $("#HMakerDate").val(d.data[0].HMakerDate)
+                        $("#HChecker").val(d.data[0].HChecker);
+                        $("#HCheckDate").val(d.data[0].HCheckDate);
+                        $("#HDeptID").val(d.data[0].HDeptID);
+                        $("#HDeptName").val(d.data[0].HDeptName);
+                        $("#HSupID").val(d.data[0].HSupID);
+                        $("#HSupName").val(d.data[0].HSupName);
+                        $("#HEmpID").val(d.data[0].HEmpID);
+                        $("#HEmpName").val(d.data[0].HEmpName);
+                        $("#HManagerID").val(d.data[0].HManagerID);
+                        $("#HManagerName").val(d.data[0].HManagerName);
+                        $("#HDeliveryNo").val(d.data[0].HDeliveryNo);
+                    }
+                });
+            }
 
             ///鍔犺浇鏄剧ず鏁版嵁
-        function RoadBillSub(linterid) {
-            $.ajax({
-                type: "get",
-                url: GetWEBURL()+"GetPOInStockShowBillSub",
-                async: true,
-                data: { sMsg: linterid},
-                success: function (result) {
-                    ajaxReturnData = JSON.parse(JSON.stringify(result)).data;
-                    table.reload('mainTable', {
-                        data: ajaxReturnData
-                        , height: 'full-10'
-                        , loading: false
-                        , done: function (index, res) {
+            function RoadBillSub(linterid) {
+                $.ajax({
+                    type: "get",
+                    url: GetWEBURL() + "GetPOInStockShowBillSub",
+                    async: true,
+                    data: { sMsg: linterid },
+                    success: function (result) {
+                        ajaxReturnData = JSON.parse(JSON.stringify(result)).data;
+                        table.reload('mainTable', {
+                            data: ajaxReturnData
+                            , height: 'full-10'
+                            , loading: false
+                            , done: function (index, res) {
 
-                        }
-                    });
-                },
-                error: function (result) {
-                    console.log(result);
-                    //layer.msg('鑾峰彇閲囪喘璁㈠崟鍑虹幇寮傚父', { icon: 2, time: 2000 });
-                }
-            });
-        }
+                            }
+                        });
+                    },
+                    error: function (result) {
+                        console.log(result);
+                        //layer.msg('鑾峰彇閲囪喘璁㈠崟鍑虹幇寮傚父', { icon: 2, time: 2000 });
+                    }
+                });
+            }
             //鐩戝惉鎻愪氦
             //form.verify({
             //    numberOrEmpty: function (value, item) {
@@ -278,48 +286,48 @@
             //        //}
             //    }
             //});
-        layer.load(3)
-        table.render({
-            elem: '#mainTable'
-          , url:  GetWEBURL()+'GetPOInStockShowBillSub'
-            , toolbar: '#toolbarDemo' //寮�鍚ご閮ㄥ伐鍏锋爮锛屽苟涓哄叾缁戝畾宸︿晶妯℃澘
-            , defaultToolbar: ['filter', 'exports']
-            //, where: { sMsg: linterid }
-          , where: { sMsg: linterid }
-          , cols: [[
-           // , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100,, sort: true, fixed: true edit: 'text', hide: true }
-            , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, edit: 'text', hide: true }
-            , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 100}
-            , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 200}
-            , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 200}
-            , { field: 'HUnitName', title: '璁¢噺鍗曚綅', width: 100}
-            , { field: 'HUnitNumber', title: '璁¢噺鍗曚綅浠g爜', width: 100, hide: true }
-            , { field: 'HUnitID', title: '璁¢噺鍗曚綅ID', width: 100, hide: true }
-            , { field: 'HQty', title: '鏁伴噺', width: 100}
-            , { field: 'HPrice', title: '鍗曚环', width: 100}
-            , { field: 'HMoney', title: '閲戦', width: 100}
-            , { field: 'HWHName', title: '鏀舵枡浠撳簱', width: 100 }
-            , { field: 'HWHNumber', title: '鏀舵枡浠撳簱浠g爜', width: 100, hide: true }
-            , { field: 'HWHID', title: '鏀舵枡浠撳簱ID', width: 100, hide: true }
-            , { field: 'HPOOrderInterID', title: '閲囪喘璁㈠崟涓诲唴鐮�', width: 150, hide: true }
-            , { field: 'HPOOrderEntryID', title: '閲囪喘璁㈠崟瀛愬唴鐮�', width: 150, hide: true }
-            , { field: 'HPOOrderBillNo', title: '閲囪喘璁㈠崟鍙�', width: 200 }
-            , { field: 'HWWOrderInterID', title: '濮斿璁㈠崟涓诲唴鐮�', width: 150, hide: true }
-            , { field: 'HWWOrderEntryID', title: '濮斿璁㈠崟瀛愬唴鐮�', width: 150, hide: true }
-            , { field: 'HWWOrderDetaiLID', title: '濮斿璁㈠崟鏄庣粏鍐呯爜', width: 150, hide: true }
-            , { field: 'HWWOrderBillNo', title: '濮斿璁㈠崟鍙�', width: 200 }
-            , { field: 'HSourceBillType', title: '婧愬崟绫诲瀷', width: 100, hide: true }
-            , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', width: 200}
-            , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 150, hide: true }
-            , { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 150, hide: true }
-          ]]
-            // , data: [linterid]
-            // , page: true
-            //, height: 500
-          , done: function () {
-              layer.closeAll("loading");
-          }
-        });
+            layer.load(3)
+            table.render({
+                elem: '#mainTable'
+                , url: GetWEBURL() + 'GetPOInStockShowBillSub'
+                , toolbar: '#toolbarDemo' //寮�鍚ご閮ㄥ伐鍏锋爮锛屽苟涓哄叾缁戝畾宸︿晶妯℃澘
+                , defaultToolbar: ['filter', 'exports']
+                //, where: { sMsg: linterid }
+                , where: { sMsg: linterid }
+                , cols: [[
+                    // , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100,, sort: true, fixed: true edit: 'text', hide: true }
+                    , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, edit: 'text', hide: true }
+                    , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 100 }
+                    , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 200 }
+                    , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 200 }
+                    , { field: 'HUnitName', title: '璁¢噺鍗曚綅', width: 100 }
+                    , { field: 'HUnitNumber', title: '璁¢噺鍗曚綅浠g爜', width: 100, hide: true }
+                    , { field: 'HUnitID', title: '璁¢噺鍗曚綅ID', width: 100, hide: true }
+                    , { field: 'HQty', title: '鏁伴噺', width: 100 }
+                    , { field: 'HPrice', title: '鍗曚环', width: 100 }
+                    , { field: 'HMoney', title: '閲戦', width: 100 }
+                    , { field: 'HWHName', title: '鏀舵枡浠撳簱', width: 100 }
+                    , { field: 'HWHNumber', title: '鏀舵枡浠撳簱浠g爜', width: 100, hide: true }
+                    , { field: 'HWHID', title: '鏀舵枡浠撳簱ID', width: 100, hide: true }
+                    , { field: 'HPOOrderInterID', title: '閲囪喘璁㈠崟涓诲唴鐮�', width: 150, hide: true }
+                    , { field: 'HPOOrderEntryID', title: '閲囪喘璁㈠崟瀛愬唴鐮�', width: 150, hide: true }
+                    , { field: 'HPOOrderBillNo', title: '閲囪喘璁㈠崟鍙�', width: 200 }
+                    , { field: 'HWWOrderInterID', title: '濮斿璁㈠崟涓诲唴鐮�', width: 150, hide: true }
+                    , { field: 'HWWOrderEntryID', title: '濮斿璁㈠崟瀛愬唴鐮�', width: 150, hide: true }
+                    , { field: 'HWWOrderDetaiLID', title: '濮斿璁㈠崟鏄庣粏鍐呯爜', width: 150, hide: true }
+                    , { field: 'HWWOrderBillNo', title: '濮斿璁㈠崟鍙�', width: 200 }
+                    , { field: 'HSourceBillType', title: '婧愬崟绫诲瀷', width: 100, hide: true }
+                    , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', width: 200 }
+                    , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 150, hide: true }
+                    , { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 150, hide: true }
+                ]]
+                // , data: [linterid]
+                // , page: true
+                //, height: 500
+                , done: function () {
+                    layer.closeAll("loading");
+                }
+            });
             //澶村伐鍏锋爮浜嬩欢
             table.on('toolbar(mainTable)', function (obj) {
                 var checkStatus = table.checkStatus(obj.config.id);
@@ -331,19 +339,45 @@
                         window.open("../../views/SRM/HBarPlanPrint.html?linterid=" + linterid + "&Type=HPOInStockBill");
                         break;
 
-                        //鑷畾涔夊ご宸ュ叿鏍忓彸渚у浘鏍� - 鎻愮ず
+                    //鑷畾涔夊ご宸ュ叿鏍忓彸渚у浘鏍� - 鎻愮ず
                     case 'btn-reload':
                         RoadBillMain(linterid);
                         RoadBillSub(linterid);
                         break;
-                      
+
                     case 'btn-exit':
                         var index = parent.layer.getFrameIndex(window.name); //鍏堝緱鍒板綋鍓峣frame灞傜殑绱㈠紩
                         parent.layer.close(index); //鍐嶆墽琛屽叧闂�
                         //layer.close(layer.index);
                         break;
+
+                    case 'btn-Save':
+                        var HDeliveryNo = $("#HDeliveryNo").val();
+                        if (btntype == "changebg") {
+                            $.ajax(
+                                {
+                                    type: "GET",
+                                    url: GetWEBURL() + "SavePOInStock", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                                    async: true,
+                                    data: { "HmainId": linterid, "HDeliveryNo": HDeliveryNo },
+                                    dataType: "json",
+                                    success: function (data) {
+                                        if (data.Message.indexOf("鎴愬姛") > 0) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                            layer.msg(data.Message, { icon: 1 });
+                                        }
+                                        else {
+                                            layer.msg(data.Message, { icon: 5 });
+                                        }
+                                        layer.closeAll("loading");
+                                    },
+                                    error: function (err) {
+                                        f_alert("閿欒:" + err);
+                                    }
+                                });
+                        }
+                        break;
                 };
-        });
+            });
             form.on('submit(Saver)', function (data) {//淇濆瓨
                 //debugger;
                 var sMainStr = JSON.stringify(data.field);
@@ -351,29 +385,56 @@
                 var sMainSub = sMainStr + ';' + sSubStr;
                 layer.load(3)
                 $.ajax(
-                {
-                    type: "POST",
-                    url: GetWEBURL()+"SaverPOInStock", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
-                    async: true,
+                    {
+                        type: "POST",
+                        url: GetWEBURL() + "SaverPOInStock", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                        async: true,
 
-                    data: { "msg": sMainSub },
-                    dataType: "json",
-                    success: function (data) {
-                        if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
-                            layer.msg(data.Message, { icon: 1 });
+                        data: { "msg": sMainSub },
+                        dataType: "json",
+                        success: function (data) {
+                            if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                layer.msg(data.Message, { icon: 1 });
+                            }
+                            else {
+                                layer.msg(data.Message, { icon: 5 });
+                            }
+                            layer.closeAll("loading");
+                        },
+                        error: function (err) {
+                            f_alert("閿欒:" + err);
                         }
-                        else {
-                            layer.msg(data.Message, { icon: 5 });
-                        }
-                        layer.closeAll("loading");
-                    },
-                    error: function (err) {
-                        f_alert("閿欒:" + err);
-                    }
-                });
+                    });
                 return false;
             });
-
+            form.on('submit(Save)', function (data) {//鏇存柊鐗╂祦鍗曞彿
+                //debugger;
+                //鑾峰彇涓婁釜椤甸潰浼犺繃鏉ョ殑鎸夐挳浜嬩欢
+                if (btntype == "changebg") {
+                    var HDeliveryNo = $("#HDeliveryNo").val();
+                    $.ajax(
+                        {
+                            type: "POST",
+                            url: GetWEBURL() + "SavePOInStock", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                            async: true,
+                            data: { "HmainId": linterid, "HDeliveryNo": HDeliveryNo },
+                            dataType: "json",
+                            success: function (data) {
+                                if (data.Message.indexOf("鎴愬姛") > 0) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                    layer.msg(data.Message, { icon: 1 });
+                                }
+                                else {
+                                    layer.msg(data.Message, { icon: 5 });
+                                }
+                                layer.closeAll("loading");
+                            },
+                            error: function (err) {
+                                f_alert("閿欒:" + err);
+                            }
+                        });
+                    return false;
+                }
+            });
 
 
 
@@ -382,26 +443,26 @@
                 //jiuajax浠庢湇鍔″櫒鑾峰彇
                 layer.load(3)
                 $.ajax(
-                {
-                    type: "POST",            
-                    url: GetWEBURL()+"SaverPOInStock", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
-                    async:true,
-                    data: { msg: sMainSub },
-                    dataType: "json",
-                    success: function (data) {
-                        if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
-                            layer.msg(data.Message, { icon: 1 });
+                    {
+                        type: "POST",
+                        url: GetWEBURL() + "SaverPOInStock", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                        async: true,
+                        data: { msg: sMainSub },
+                        dataType: "json",
+                        success: function (data) {
+                            if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                layer.msg(data.Message, { icon: 1 });
+                            }
+                            else {
+                                // $("#verifycode").click();
+                                layer.msg(data.Message, { icon: 5 });
+                            }
+                            layer.closeAll("loading");
+                        },
+                        error: function (err) {
+                            f_alert("閿欒:" + err);
                         }
-                        else {
-                            // $("#verifycode").click();
-                            layer.msg(data.Message, { icon: 5 });
-                        }
-                        layer.closeAll("loading");
-                    },
-                    error: function (err) {
-                        f_alert("閿欒:" + err);
-                    }
-                });
+                    });
             }
             function f_alert(sMsg) {
                 layer.alert(sMsg, { icon: 5 });
@@ -442,7 +503,7 @@
             //    return JSON.stringify(ajaxData).replace(/(")/g, "\\\"");
             //   // return false;
             //});
- 
+
             //function f_SaveBefore() {
             //    //淇濆瓨鍓嶅鐞�(瀛楁鏍煎紡锛歩nt绫诲瀷涓嶈兘涓虹┖锛屾棩鏈熺被鍨嬬鍚堟牸寮忥紝bool绫诲瀷)
             //    if ($("#HInterID").val() == '') {
@@ -456,7 +517,7 @@
                 var type = $(this).data('type');
                 active[type] ? active[type].call(this) : '';
             });
-           });
+        });
     </script>
 </body>
 </html>
\ No newline at end of file

--
Gitblit v1.9.1