From a03addb5fbf4da382275f3c9dff8dbc916c4e021 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期三, 17 九月 2025 09:52:01 +0800
Subject: [PATCH] 其他出库、其他入库:子表件数可以输入为0 乔一客户物料即时库存报表:把米数和件数的合计加上去 (按生产订单)客户订单:过滤条件改为模糊查询

---
 WebTM/views/质量管理/来料检验单/QC_Add_Edit_POStockInCheckBillList.html |  592 +++++++++++++++++++++++++++++++++--------------------------
 1 files changed, 330 insertions(+), 262 deletions(-)

diff --git "a/WebTM/views/\350\264\250\351\207\217\347\256\241\347\220\206/\346\235\245\346\226\231\346\243\200\351\252\214\345\215\225/QC_Add_Edit_POStockInCheckBillList.html" "b/WebTM/views/\350\264\250\351\207\217\347\256\241\347\220\206/\346\235\245\346\226\231\346\243\200\351\252\214\345\215\225/QC_Add_Edit_POStockInCheckBillList.html"
index 2569a90..705a9e8 100644
--- "a/WebTM/views/\350\264\250\351\207\217\347\256\241\347\220\206/\346\235\245\346\226\231\346\243\200\351\252\214\345\215\225/QC_Add_Edit_POStockInCheckBillList.html"
+++ "b/WebTM/views/\350\264\250\351\207\217\347\256\241\347\220\206/\346\235\245\346\226\231\346\243\200\351\252\214\345\215\225/QC_Add_Edit_POStockInCheckBillList.html"
@@ -79,7 +79,7 @@
                                     </div>
                                     <div class="layui-row">
                                         <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" name="HMaterName" id="HMaterName" class="layui-input" value="" style="float:left;width:150px;">
                                                 <input type="hidden" name="HMaterID" id="HMaterID" class="layui-input" value="" style="float:left;width:150px;">
@@ -106,7 +106,7 @@
                                             <label class="layui-form-label">妫�楠屽憳</label>
                                             <div class="layui-input-inline">
                                                 <input type="text" name="HFirstCheckEmpName" id="HFirstCheckEmpName" class="layui-input" value="" style="float:left;width:150px;">
-                                                <input type="hidden" name="HFirstCheckEmpID" id="HFirstCheckEmpID" class="layui-input" value="" style="float:left;width:150px;">
+                                                <input type="hidden" name="HFirstCheckEmp" id="HFirstCheckEmp" class="layui-input" value="" style="float:left;width:150px;">
                                                 <button type="button" lay-submit="" class="layui-btn" lay-filter="HEmpList" style="width:40px;">
                                                     <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
                                                 </button>
@@ -291,6 +291,19 @@
                 , laydate = layui.laydate
                 , element = layui.element;
 
+            //#region 鍒ゆ柇鏄惁鐧诲綍 鏈櫥褰曞垯璺冲埌鐧诲綍椤�
+            if (sessionStorage.login != "login") {
+                layer.confirm("鐧诲綍澶辨晥锛岃閲嶆柊鐧诲綍锛�", {
+                    icon: 4, skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず", closeBtn: 0, btn: ['閲嶆柊鐧诲綍']
+                }, function () { window.location.href = "../../user/login.html"; });
+            }
+            //#endregion
+
+            //#region 鑾峰彇鍙傛暟
+            laydate.render({
+                elem: '#HDate'
+
+            });
             var params = get_UrlVars();
             if (typeof (params[params[0]]) == "undefined") {
                 var OperationType = 1;//鎿嶄綔绫诲瀷
@@ -302,47 +315,50 @@
                 var closeType = params[params[3]];  //鍏抽棴绫诲瀷
             }
             var hID = params[params[1]];//缂栬緫鏌ョ湅
-            //甯歌鐢ㄦ硶
-            laydate.render({
-                elem: '#HDate'
+            //#endregion
 
-            });
-            //鍒ゆ柇鏄惁鐧诲綍 鏈櫥褰曞垯璺冲埌鐧诲綍椤�
-            //if (sessionStorage.login != "login") {
-            //    layer.confirm("鐧诲綍澶辨晥锛岃閲嶆柊鐧诲綍锛�", {
-            //        icon: 4, skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず", closeBtn: 0, btn: ['閲嶆柊鐧诲綍']
-            //    }, function () { window.location.href = "../../user/login.html"; });
-            //}
+            //鐩稿叧鍙橀噺
             var tableReload = table.reload;
             var option = {
                 elem: '#mainTable'
                 , toolbar: '#toolbarDemo'
+                , totalRow: true
                 , height: 500
                 , limit: 500 //姣忛〉榛樿鏄剧ず鐨勬暟閲�
                 //,url: '/demo/table/user/' //鏁版嵁鎺ュ彛
                 , page: true //寮�鍚垎椤�
                 , cols: [[ //琛ㄥご
-                    { type: 'checkbox', fixed: 'left' }
+                    { type: 'checkbox', fixed: 'left', totalRowText: '鍚堣琛�'}
                     , { templet: '#xuhao', title: '搴忓彿', sort: true, fixed: 'left', event: "qwe", width: 100 }
-                    , { field: 'HQCCheckClassID', title: 'HQCCheckClassID', edit: 'text', width: 100, hide: true }
+                    , { field: 'HQCCheckClassID', title: 'HQCCheckClassID', edit: 'text', width: 100, hide: true, totalRow: true }
                     , { field: 'HQCCheckClassNumber', title: '妫�楠岄」鐩被鍒�', edit: 'text', event: "HQCCheckClassCheck", width: 100 }
-                    , { field: 'HQCCheckClassName', title: '妫�楠岄」鐩被鍒悕绉�', edit: 'text', width: 100, hide: true }
+                    , { field: 'HQCCheckClassName', title: '妫�楠岄」鐩被鍒悕绉�', edit: 'text', width: 100 }
                     , { field: 'HQCCheckItemID', title: 'HQCCheckItemID', edit: 'text', hide: true }
                     , { field: 'HQCCheckItemNumber', title: '妫�楠岄」鐩�', edit: 'text', event: "HQCCheckItemCheck", width: 100 }
-                    , { field: 'HQCCheckItemName', title: '妫�楠岄」鐩悕绉�', edit: 'text', width: 100, hide: true }
+                    , { field: 'HQCCheckItemName', title: '妫�楠岄」鐩悕绉�', edit: 'text', width: 100}
                     , { field: 'HQCRelValue', title: '妫�楠屾暟鎹�', edit: 'text' }
                     , { field: 'HResult', title: '鍒ゅ畾', edit: 'text', event: "" }
                     , { field: 'HQCStd', title: '妫�楠屾爣鍑�', edit: 'text', event: "" }
-                    , { field: 'HProcCheckEmpID', title: 'HProcCheckEmpID', edit: 'text', width: 100, hide: true }
+                    , { field: 'HProcCheckEmp', title: 'HProcCheckEmp', edit: 'text', width: 100, hide: true }
                     , { field: 'HProcCheckEmpName', title: '妫�娴嬪憳', edit: 'text', event: 'HProcCheckEmpCheck', width: 150 }
-                    , { field: 'HProcCheckEmpNumber', title: '妫�娴嬪憳浠g爜', edit: 'text', width: 100, hide: true }
-                    , { field: 'HProcCheckTime', title: '妫�娴嬫棩鏈�', event: "", edit: 'text' }
+                    //, { field: 'HProcCheckEmpNumber', title: '妫�娴嬪憳浠g爜', edit: 'text', width: 100, hide: true }
+                    , { field: 'HProcCheckTime', title: '妫�娴嬫棩鏈�', event: "HDate" }
                     , { field: 'HRemark', title: '澶囨敞', edit: 'text' }
                     , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 150 }
                 ]]
             };
+
+            var date = new Date();
+            var day = date.getDate();
+            var month = date.getMonth() + 1;
+            var year = date.getFullYear();
+            var shijian = year + "-" + month + "-" + day;
+
+
             //鍒ゆ柇鏄惁鏂板
             if (OperationType == 1) {
+                createBillNo()
+
                 $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd"));
                 $("#HMaker").val(sessionStorage["HUserName"]);
               
@@ -350,34 +366,187 @@
                 option.data = [{
                     "HQCCheckClassID": " ", "HQCCheckClassNumber": " ", "HQCCheckClassName": " ", "HQCCheckItemID": " ",
                     "HQCCheckItemNumber": " ", "HQCCheckItemName": " ", "HQCRelValue": "  ", "HResult": "   "
-                    , "HQCStd": 0, "HProcCheckEmpID": " ", "HProcCheckEmpNumber": " ", "HProcCheckEmpName": " ", "HProcCheckTime": "  ", "HRemark": "  "
+                    , "HQCStd": 0, "HProcCheckEmp": " ", "HProcCheckEmpNumber": " ", "HProcCheckEmpName": " ", "HProcCheckTime": "  ", "HRemark": "  "
                 }];
                 table.render(option);
             }
             else {
                 $("#HInterID").val(hID);//淇敼鏃朵富琛↖D
-                //缂栬緫鍔犺浇鏁版嵁
-                $.ajax({
-                    url: GetWEBURL() + '/QC_POStockInCheckBill/QC_POStockInCheckBillListProjectDetai',
-                    type: "GET",
-                    data: { "sqlWhere": "and HInterID=" + hID },
-                    success: function (result) {
-                        //console.log(result);
-                        //console.log('gouba' + result);
-                        if (result.count == 1) {
-                            option.data = result.data;
-                            table.render(option);
+                RoadBillMain(hID);
+                RoadBillSub(hID);
+            }
 
-                        } else {
-                            layer.alert(result.code + result.Message, { icon: 5 });
+
+            //#region 琛ㄥご淇℃伅浠撳簱寮圭獥
+            form.on('submit(HSupList)', function () {
+                //椤甸潰灞�-鑷畾涔�
+                layer.open({
+                    type: 2,
+                    skin: 'layui-layer-rim', //鍔犱笂杈规
+                    title: '渚涘簲鍟嗗垪琛�',
+                    closeBtn: 1,
+                    shift: 2,
+                    area: ['80%', '80%'],
+                    maxmin: true,
+                    content: ['../../鍩虹璧勬枡/閲囪喘鍩虹璧勬枡/Gy_Supplier.html?Type=HSup', 'yes'],
+                    btn: ['纭畾', '鍙栨秷']
+                    , btn1: function (index, layero) {
+
+                        //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
+                        var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
+                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
+                        if (checkStatus.data.length === 0) {
+                            return layer.msg('璇烽�夋嫨鏁版嵁');
                         }
-                    }, error: function () {
-                        layer.close(index0);
-                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                        $("#HSupName").val(checkStatus.data[0].渚涘簲鍟嗗悕绉�);
+                        $("#HSupID").val(checkStatus.data[0].HItemID);
+                        layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                    }
+                    , btn2: function (index, layero) {
+                        //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
+                        //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+                    },
+                    end: function () {
+
+                    },
+                    success: function (layero, index) {
+
                     }
                 });
-            }
-            //澶村伐鍏锋爮浜嬩欢
+            });
+            //#endregion
+
+            //#region 琛ㄥご淇℃伅浜у搧鍐呯爜
+            form.on('submit(HMaterList)', function () {
+                //椤甸潰灞�-鑷畾涔�
+                layer.open({
+                    type: 2,
+                    skin: 'layui-layer-rim', //鍔犱笂杈规
+                    title: '浜у搧鍐呯爜鍒楄〃',
+                    closeBtn: 1,
+                    shift: 2,
+                    area: ['80%', '80%'],
+                    maxmin: true,
+                    content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Material.html', 'yes'],
+                    btn: ['纭畾', '鍙栨秷']
+                    , btn1: function (index, layero) {
+
+                        //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
+                        var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
+                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
+                        if (checkStatus.data.length === 0) {
+                            return layer.msg('璇烽�夋嫨鏁版嵁');
+                        }
+                        $("#HMaterName").val(checkStatus.data[0].鐗╂枡鍚嶇О);
+                        $("#HMaterID").val(checkStatus.data[0].HItemID);
+                        layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                    }
+                    , btn2: function (index, layero) {
+                        //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
+                        //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+                    },
+                    end: function () {
+
+                    },
+                    success: function (layero, index) {
+
+                    }
+                });
+            });
+            //#endregion
+
+            //#region 妫�楠屽憳寮圭獥
+            form.on('submit(HEmpList)', function () {
+                //椤甸潰灞�-鑷畾涔�
+                layer.open({
+                    type: 2,
+                    skin: 'layui-layer-rim', //鍔犱笂杈规
+                    title: '妫�楠屽憳鍒楄〃',
+                    closeBtn: 1,
+                    shift: 2,
+                    area: ['80%', '80%'],
+                    maxmin: true,
+                    content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_EmployeeList.html?Type=HEmp', 'yes'],
+                    btn: ['纭畾', '鍙栨秷']
+                    , btn1: function (index, layero) {
+
+                        //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
+                        var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
+                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
+                        if (checkStatus.data.length === 0) {
+                            return layer.msg('璇烽�夋嫨鏁版嵁');
+                        }
+                        $("#HFirstCheckEmpName").val(checkStatus.data[0].鑱屽憳鍚嶇О);
+                        $("#HFirstCheckEmp").val(checkStatus.data[0].HItemID);
+                        layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                    }
+                    , btn2: function (index, layero) {
+                        //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
+                        //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+                    },
+                    end: function () {
+
+                    },
+                    success: function (layero, index) {
+
+                    }
+                });
+            });
+            //#endregion
+
+            //#region 閫�鍑�
+            form.on('submit(Exit)', function (data) {
+                if (params[1] != null) {
+                    Pub_Close(1);
+                } else if (params[1] == null) {
+                    Pub_Close(2);
+                }
+            });
+            //#endregion
+
+            //#region 淇濆瓨
+            form.on('submit(Saver)', function (data) {
+                //debugger;
+                data.field.HMaker = sessionStorage["HUserName"];//鍒跺崟浜�
+                var sMainStr = JSON.stringify(data.field);
+                var sSubStr = JSON.stringify(table.cache['mainTable']);
+                var sMainSub = sMainStr + ';' + sSubStr + ';' + sessionStorage["HUserName"];
+                if (!AllowLoadData(sSubStr))//鏁版嵁楠岃瘉
+                {
+                    return false;
+                }
+                $.ajax(
+                    {
+                        type: "POST",
+                        url: GetWEBURL() + "/QC_POStockInCheckBill/AddBill", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                        async: true,
+                        data: { "msg": sMainSub },
+                        dataType: "json",
+                        success: function (data) {
+                            if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                layer.msg(data.Message, { time: 1 * 1000, icon: 1 }, function () {
+                                    $('#add-btn').addClass("layui-btn-disabled").attr("disabled", true);
+                                    var index = parent.layer.getFrameIndex(window.name); //鍏堝緱鍒板綋鍓峣frame灞傜殑绱㈠紩
+                                    parent.layer.close(index); //鍐嶆墽琛屽叧闂�
+                                });
+                            }
+                            else {
+
+                                f_alert(data.Message);
+                                console.log("Reason" + sMainStr + "sub:" + JSON.stringify(layui.table.cache.mainTable));
+                            }
+                            layer.closeAll("loading");
+                        },
+                        error: function (err) {
+
+                            f_alert("閿欒:" + err);
+                            console.log("Reason" + sMainStr);
+                        }
+                    });
+            });
+            //#endregion
+
+            //#region 澶村伐鍏锋爮浜嬩欢
             var rowid = 0;
             var rows = 0;
             table.on('toolbar(mainTable)', function (obj) {
@@ -387,7 +556,7 @@
                 var NewRow = {
                     "HQCCheckClassID": " ", "HQCCheckClassNumber": " ", "HQCCheckClassName": " ", "HQCCheckItemID": " ",
                     "HQCCheckItemNumber": " ", "HQCCheckItemName": " ", "HQCRelValue": "  ", "HResult": "   "
-                    , "HQCStd": 0, "HProcCheckEmpID": " ", "HProcCheckEmpNumber": " ", "HProcCheckEmpName": " ", "HProcCheckTime": "  ", "HRemark": "  " };
+                    , "HQCStd": 0, "HProcCheckEmp": " ", "HProcCheckEmpNumber": " ", "HProcCheckEmpName": " ", "HProcCheckTime": "  ", "HRemark": "  " };
                 switch (obj.event) {
                     case 'btn-AddLine':
                         //table.cache["mainTable"].push(AddRow[rows]);
@@ -417,7 +586,9 @@
                         break;
                 }
             });
-            //琛屽唴浜嬩欢
+            //#endregion
+
+            //#region 琛屽唴浜嬩欢
             table.on('tool(mainTable)', function (obj) {
                 var data = obj.data;
                 var rowIndex = $(obj.tr).attr("data-index");
@@ -490,13 +661,13 @@
                                 shift: 2,
                                 area: ['80%', '80%'],
                                 maxmin: true,
-                                content: ['../../../views/Baseset/鍩虹璧勬枡/Gy_QCCheckItemListView.html', 'yes'],
+                                content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_CheckItem.html', 'yes'],
                                 btn: ['纭畾', '鍙栨秷']
                                 , btn1: function (index, layero) {
 
                                     //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
                                     var iframeWindow = window['layui-layer-iframe' + index];
-                                    var checkStatus = iframeWindow.layui.table.checkStatus('ck-table');
+                                    var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');
                                     if (checkStatus.data.length === 0) {
                                         return layer.msg('璇烽�夋嫨鏁版嵁');
                                     }
@@ -528,22 +699,22 @@
                                 shift: 2,
                                 area: ['80%', '80%'],
                                 maxmin: true,
-                                content: ['../../../views/Baseset/鍩虹璧勬枡/Gy_EmployeeList.html ','yes'],
+                                content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_EmployeeList.html', 'yes'],
                                 btn: ['纭畾', '鍙栨秷']
                                 , btn1: function (index, layero) {
 
                                     //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
                                     var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
-                                    var checkStatus = iframeWindow.layui.table.checkStatus('ck-table');//鑾峰彇table鐨別lem:"#test"
+                                    var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
                                     if (checkStatus.data.length === 0) {
                                         return layer.msg('璇烽�夋嫨鏁版嵁');
                                     }
 
                                     //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                                     obj.update({
-                                        HProcCheckEmpName: checkStatus.data[0].HName
-                                        , HProcCheckEmpID: checkStatus.data[0].HItemID
-                                        , HProcCheckEmpNumber: checkStatus.data[0].HNumber
+                                        HProcCheckEmpName: checkStatus.data[0].鑱屽憳鍚嶇О
+                                        , HProcCheckEmp: checkStatus.data[0].HItemID
+                                        , HProcCheckEmpNumber: checkStatus.data[0].鑱屽憳浠g爜
                                     });
 
                                     layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
@@ -564,9 +735,26 @@
 
                     }
                 })
+
+                //璁剧疆 鍙戣揣鏃堕棿
+                if (obj.event == 'HDate') {
+                    var data = obj.data;
+                    var field = $(this).data('field');
+                    laydate.render({
+                        elem: this.firstChild
+                        , show: true //鐩存帴鏄剧ず
+                        , closeStop: this
+                        , done: function (nowDate) {
+                            //鏃堕棿閫夋嫨瀹屾垚锛岃鏁版嵁鏇存柊
+                            data[field] = nowDate;
+                            obj.update(data);
+                        }
+                    });
+                }
             });
+            //#endregion
            
-            //鐩戝惉鍗曞厓鏍肩紪杈�
+            //#region 鐩戝惉鍗曞厓鏍肩紪杈�
             table.on('edit(mainTable)', function (obj) {
                 // 鍗曞厓鏍肩紪杈戜箣鍓嶇殑鍊�
                 var oldText = $(this).prev().text();
@@ -629,12 +817,49 @@
                     default:
                 }
             });
+            //#endregion
+
+            //#region 鏃ユ湡澶勭悊
+            function formatDate(date) {
+                var d = new Date(date),
+                    month = '' + (d.getMonth() + 1),
+                    day = '' + d.getDate(),
+                    year = d.getFullYear();
+
+                if (month.length < 2) month = '0' + month;
+                if (day.length < 2) day = '0' + day;
+
+                return [year, month, day].join('-');
+            }
+            //#endregion
+
+            //#region 鐢熸垚鍗曟嵁鍙�
+            function createBillNo() {
+                //鑾峰彇鏈�澶у崟鎹彿 new
+                $("#HInterID").val("0");
+                $("#HBillNo").val("");
+                $.ajax({
+                    url: GetWEBURL() + "/Web/GetMAXNum",
+                    type: "GET",
+                    data: { "HBillType": '7503' },
+                    success: function (d) {
+                        //console.log(d.data);
+                        $("#HBillNo").val(d.data[0].HBillNo);
+                        $("#HDate").val(shijian);
+                        $("#HInterID").val(d.data[0].HInterID);
+                    }
+                });
+            }
+            //#endregion
+
+            //#region 缂栬緫鍒濆鍖�-琛ㄥご
             function RoadBillMain(hID)//鍔犺浇琛ㄥご
             {
                 //alert(hID);
                 //鏌ヨ妫�楠屾柟妗堝崟鏄惁瀛樺湪
                 $.ajax({
                     url: GetWEBURL() + "/QC_POStockInCheckBill/QC_POStockInCheckBillListCheckDetail",
+                    async: false,
                     type: "GET",
                     data: {
                         "HID": hID
@@ -649,13 +874,13 @@
                                 , "HDate": formatDate(data.鏃ユ湡)
                                 , "HSupID": data.HSupID
                                 , "HSupName": data.渚涘簲鍟嗗悕绉�
-                                , "HMater": data.浜у搧鍚嶇О
-                                , "HMaterID": data.浜у搧ID
-                                , "HMaterNumber": data.浜у搧鍐呯爜
+                                , "HMaterName": data.浜у搧鍚嶇О
+                                , "HMaterID": data.HMaterID
+                                , "HMaterName": data.浜у搧鍚嶇О
                                 , "HInStockQty": data.鍏ュ簱鏁伴噺
                                 , "HRightQty": data.鍚堟牸鏁伴噺
-                                , "HEmpName": data.妫�楠屽憳鍚嶇О
-                                , "HFirstCheckEmp": data.妫�楠屽憳
+                                , "HFirstCheckEmpName": data.妫�楠屽憳鍚嶇О
+                                , "HFirstCheckEmp": data.妫�楠屽憳鍐呯爜
                                 , "HCheckQty": data.鎶芥鏁伴噺
                                 , "HBadQty": data.涓嶅悎鏍兼暟閲�
                                 , "HSteelStoveNo": data.閽㈡潗鐐夊彿
@@ -669,218 +894,41 @@
                         } else {
                             layer.alert(result.msg, { icon: 5, btn: ['閫�鍑�'], time: 100000, offset: 't' });
                         }
-                    }, error: function () {
+                    }, error: function (e) {
                         layer.alert("鍙戠敓閿欒!", { icon: 5 });
                     }
                 });
             }
+            //#endregion
 
-
-            var date = new Date();
-            var day = date.getDate();
-            var month = date.getMonth() + 1;
-            var year = date.getFullYear();
-            var shijian = year + "-" + month + "-" + day;
-
-            //鍒ゆ柇鏄惁鏂板
-            if (hID == null || hID == 0) {
-                //鑾峰彇鏈�澶у崟鎹彿 new
-                $("#HInterID").val("0");
-                $("#HBillNo").val("");
+            //#region 缂栬緫鍒濆鍖�-瀛愯〃
+            function RoadBillSub(hID)//鍔犺浇瀛愯〃
+            {
+                //缂栬緫鍔犺浇鏁版嵁
                 $.ajax({
-                    url: GetWEBURL() + "/Web/GetMAXNum",
+                    url: GetWEBURL() + '/QC_POStockInCheckBill/QC_POStockInCheckBillListProjectDetai',
+                    async: false,
                     type: "GET",
-                    data: { "HBillType": '7503' },
-                    success: function (d) {
-                        //console.log(d.data);
-                        $("#HBillNo").val(d.data[0].HBillNo);
-                        $("#HDate").val(shijian);
-                        $("#HInterID").val(0);
+                    data: { "sqlWhere": "and HInterID=" + hID },
+                    success: function (result) {
+                        //console.log(result);
+                        //console.log('gouba' + result);
+                        if (result.count == 1) {
+                            option.data = result.data;
+                            table.render(option);
+
+                        } else {
+                            layer.alert(result.code + result.Message, { icon: 5 });
+                        }
+                    }, error: function (e) {
+                        layer.close(index0);
+                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
                     }
                 });
             }
-            else {//濡傛灉淇敼鍒欒蛋涓嬮潰 new
-                RoadBillMain(hID);
-                /* RoadBillSub(linterid);*/
-            }
-
-            //琛ㄥご淇℃伅浠撳簱寮圭獥
-            form.on('submit(HSupList)', function () {
-                //椤甸潰灞�-鑷畾涔�
-                layer.open({
-                    type: 2,
-                    skin: 'layui-layer-rim', //鍔犱笂杈规
-                    title: '渚涘簲鍟嗗垪琛�',
-                    closeBtn: 1,
-                    shift: 2,
-                    area: ['80%', '80%'],
-                    maxmin: true,
-                    content: ['../../../views/Baseset/鍩虹璧勬枡/Gy_SupplierList.html', 'yes'],
-                    btn: ['纭畾', '鍙栨秷']
-                    , btn1: function (index, layero) {
-
-                        //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
-                        var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
-                        var checkStatus = iframeWindow.layui.table.checkStatus('ck-table');//鑾峰彇table鐨別lem:"#test"
-                        if (checkStatus.data.length === 0) {
-                            return layer.msg('璇烽�夋嫨鏁版嵁');
-                        }
-                        $("#HSupName").val(checkStatus.data[0].HName);
-                        $("#HSupID").val(checkStatus.data[0].HItemID);
-                        layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
-                    }
-                    , btn2: function (index, layero) {
-                        //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
-                        //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
-                    },
-                    end: function () {
-
-                    },
-                    success: function (layero, index) {
-
-                    }
-                });
-            });
-
-
-            //琛ㄥご淇℃伅浜у搧鍐呯爜
-            form.on('submit(HMaterList)', function () {
-                //椤甸潰灞�-鑷畾涔�
-                layer.open({
-                    type: 2,
-                    skin: 'layui-layer-rim', //鍔犱笂杈规
-                    title: '浜у搧鍐呯爜鍒楄〃',
-                    closeBtn: 1,
-                    shift: 2,
-                    area: ['80%', '80%'],
-                    maxmin: true,
-                    content: ['../../../views/Baseset/鍩虹璧勬枡/Gy_MaterialList.html', 'yes'],
-                    btn: ['纭畾', '鍙栨秷']
-                    , btn1: function (index, layero) {
-
-                        //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
-                        var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
-                        var checkStatus = iframeWindow.layui.table.checkStatus('ck-table');//鑾峰彇table鐨別lem:"#test"
-                        if (checkStatus.data.length === 0) {
-                            return layer.msg('璇烽�夋嫨鏁版嵁');
-                        }
-                        $("#HMaterName").val(checkStatus.data[0].HName);
-                        $("#HMaterID").val(checkStatus.data[0].HItemID);
-                        layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
-                    }
-                    , btn2: function (index, layero) {
-                        //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
-                        //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
-                    },
-                    end: function () {
-
-                    },
-                    success: function (layero, index) {
-
-                    }
-                });
-            });
-
-            //妫�楠屽憳寮圭獥
-            form.on('submit(HEmpList)', function () {
-                //椤甸潰灞�-鑷畾涔�
-                layer.open({
-                    type: 2,
-                    skin: 'layui-layer-rim', //鍔犱笂杈规
-                    title: '妫�楠屽憳鍒楄〃',
-                    closeBtn: 1,
-                    shift: 2,
-                    area: ['80%', '80%'],
-                    maxmin: true,
-                    content: ['../../../views/Baseset/鍩虹璧勬枡/Gy_EmployeeList.html', 'yes'],
-                    btn: ['纭畾', '鍙栨秷']
-                    , btn1: function (index, layero) {
-
-                        //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
-                        var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
-                        var checkStatus = iframeWindow.layui.table.checkStatus('ck-table');//鑾峰彇table鐨別lem:"#test"
-                        if (checkStatus.data.length === 0) {
-                            return layer.msg('璇烽�夋嫨鏁版嵁');
-                        }
-                        $("#HFirstCheckEmpName").val(checkStatus.data[0].HName);
-                        $("#HFirstCheckEmpID").val(checkStatus.data[0].HItemID);
-                        layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
-                    }
-                    , btn2: function (index, layero) {
-                        //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
-                        //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
-                    },
-                    end: function () {
-
-                    },
-                    success: function (layero, index) {
-
-                    }
-                });
-            });
-
-            //閫�鍑�
-            form.on('submit(Exit)', function (data) {
-                if (OperationType == 1) {
-                    Pub_Close(closeType);//鐩存帴鏂板closeType鍊间负2锛屽垪琛ㄨ皟鏂板closeType鍊间粠鍒楄〃浼犻��
-                }
-                else if (OperationType == 3) {
-                    Pub_Close(closeType);
-                }
-                else {
-                    Pub_Close(2);
-                }
-            });
-            function formatDate(date) {
-                var d = new Date(date),
-                    month = '' + (d.getMonth() + 1),
-                    day = '' + d.getDate(),
-                    year = d.getFullYear();
-
-                if (month.length < 2) month = '0' + month;
-                if (day.length < 2) day = '0' + day;
-
-                return [year, month, day].join('-');
-            }
-            form.on('submit(Saver)', function (data) {//淇濆瓨
-                //debugger;
-                data.field.HMaker = sessionStorage["HUserName"];//鍒跺崟浜�
-                var sMainStr = JSON.stringify(data.field);
-                var sSubStr = JSON.stringify(table.cache['mainTable']);
-                var sMainSub = sMainStr + ';' + sSubStr + ';' + sessionStorage["HUserName"];
-                if (!AllowLoadData(sSubStr))//鏁版嵁楠岃瘉
-                {
-                    return false;
-                }
-                $.ajax(
-                    {
-                        type: "POST",
-                        url: GetWEBURL() + "/QC_POStockInCheckBill/AddBill", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
-                        async: true,
-                        data: { "msg": sMainSub },
-                        dataType: "json",
-                        success: function (data) {
-                            if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
-                                layer.msg(data.Message, { time: 1 * 1000, icon: 1 }, function () {
-                                    $('#add-btn').addClass("layui-btn-disabled").attr("disabled", true);
-                                    var index = parent.layer.getFrameIndex(window.name); //鍏堝緱鍒板綋鍓峣frame灞傜殑绱㈠紩
-                                    parent.layer.close(index); //鍐嶆墽琛屽叧闂�
-                                });
-                            }
-                            else {
-
-                                f_alert(data.Message);
-                                console.log("Reason" + sMainStr + "sub:" + JSON.stringify(layui.table.cache.mainTable));
-                            }
-                            layer.closeAll("loading");
-                        },
-                        error: function (err) {
-
-                            f_alert("閿欒:" + err);
-                            console.log("Reason" + sMainStr);
-                        }
-                    });
-            });
+            //#endregion
+           
+            //#region 鏃犳晥浠g爜
             function f_alert(sMsg) {
                 layer.alert(sMsg, { icon: 5 });
 
@@ -895,13 +943,14 @@
                     //}
                 }
             });
-
-
+            //#endregion
         });
         //瀹氫箟鍏ㄥ眬鍙橀噺
         var HReasonName, ReasonID, EmpName, SQProcName,
             ProcID, ZRProcName, QRName
             ;
+        //#region 瀛愰〉闈㈣皟鐢ㄨ繑鍥炴暟鎹柟娉�
+        //杩斿洖涓嶈壇鍘熷洜
         function GetHReasonValue(obj)  //杩斿洖涓嶈壇鍘熷洜
         {
             HReasonName = obj[0].HName;
@@ -919,6 +968,7 @@
             $("#HProcID").val(obj[0].HItemID);
             $("#HProcNumber").val(obj[0].宸ュ簭浠g爜);
         }
+        //杩斿洖閮ㄩ棬
         function GetHDeptNameValue(obj) {  //杩斿洖閮ㄩ棬
             $("#HDepName").val(obj[0].HName);
             $("#HDeptID").val(obj[0].HItemID);
@@ -930,17 +980,36 @@
             $("#HUnitID").val(obj[0].HItemID);
             $("#HUnitNumber").val(obj[0].HNumber);
         }
-
+        //杩斿洖璐d换浜�
         function GetHKeeperValue(obj) {  //杩斿洖璐d换浜�
             EmpName = obj[0].HName;
         }
+        //杩斿洖璐d换宸ュ簭
         function GetHZRValue(obj) {   //杩斿洖璐d换宸ュ簭
             ZRProcName = obj[0].宸ュ簭;
         }
+        //杩斿洖涓嶈壇纭浜�
         function GetHWorkerValue(obj) {  //杩斿洖涓嶈壇纭浜�
             QRName = obj[0].HName;
         }
-        //闈炵┖楠岃瘉
+        //渚涘簲鍟�
+        function GetHSupNameValue(obj) {   //渚涘簲鍟�
+            $("#HSupName").val(obj[0].渚涘簲鍟嗗悕绉�);
+            $("#HSupID").val(obj[0].HItemID);
+        }
+        //鐗╂枡
+        function GetMaterValue(obj) {  //鐗╂枡
+            $("#HMaterName").val(obj[0].鐗╂枡鍚嶇О);
+            $("#HMaterID").val(obj[0].HItemID);
+        }
+        //璐ㄦ鍛�
+        function GetHEmpValue(obj) {  //璐ㄦ鍛�
+            $("#HFirstCheckEmpName").val(obj[0].鑱屽憳鍚嶇О);
+            $("#HFirstCheckEmp").val(obj[0].HItemID);
+        }
+        //#endregion
+
+        //#region 闈炵┖楠岃瘉
         function AllowLoadData(sSubStr) {
             var HStockStyle = $("#HStockStyle").val();
             var Result = true;
@@ -990,12 +1059,11 @@
             //    }
             //}
             /*else {*/
-               /* return Result = true;*/
+            /* return Result = true;*/
             //}
             return Result;
         }
-
-
+        //#endregion
     </script>
 </body>
 </html>
\ No newline at end of file

--
Gitblit v1.9.1