From db34c41cbb3df2c21b57d10bbe83ea206d9428d6 Mon Sep 17 00:00:00 2001
From: 王 垚 <1402714037@qq.com>
Date: 星期三, 29 十二月 2021 09:20:57 +0800
Subject: [PATCH] 安瑞 增加  物料编码显示

---
 WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_BarCodeBill.html | 1060 +++++++++++++++++++++++++++++++---------------------------
 1 files changed, 560 insertions(+), 500 deletions(-)

diff --git a/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_BarCodeBill.html b/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_BarCodeBill.html
index 69227c2..9b56bce 100644
--- a/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_BarCodeBill.html
+++ b/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_BarCodeBill.html
@@ -102,21 +102,21 @@
                             </ul>
                             <div class="layui-tab-content">
                                 <div class="layui-tab-item layui-show">
-                                <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
+                                    <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-normal">鏅�氭潯鐮�</button>-->
-                                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-box">鍐呭绠辨潯鐮�</button>
+                                            <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-box">鍐呭绠辨潯鐮�</button>-->
 
                                         </div>
                                     </script>
                                 </div>
                             </div>
-                        </div> 
+                        </div>
                         <!--<blockquote class="layui-elem-quote">鏉$爜</blockquote>-->
                     </form>
-            </div>
-            
+                </div>
+
             </div>
         </div>
     </div>
@@ -140,7 +140,7 @@
             //  }
             //});
         }
-        function isPositiveIntegerTimes(x,y){
+        function isPositiveIntegerTimes(x, y) {
             if (x > y) {
                 var flag = x;
                 x = y;
@@ -150,14 +150,11 @@
             if (x == 0) {
                 return true;
             }
-            else
-           {
-                if (z == 0) 
-                {
+            else {
+                if (z == 0) {
                     return true;
                 }
-                else
-                {
+                else {
                     return false;
                 }
             }
@@ -172,7 +169,7 @@
             var day = date.getDate();
             var mm = "'" + month + "'";
             var dd = "'" + day + "'";
-                             
+
             //鍗曚綅鏁板墠闈㈠姞0
             if (mm.length == 3) {
                 month = "0" + month;
@@ -183,6 +180,15 @@
 
             var time = date.getFullYear() + "-" + month + "-" + day
             return time;
+        }
+        function DateDiff(sDate1, sDate2) {    //sDate1鍜宻Date2鏄�2002-12-18鏍煎紡
+            var aDate, oDate1, oDate2, iDays
+            aDate = sDate1.split("-")
+            oDate1 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0])    //杞崲涓�12-18-2002鏍煎紡
+            aDate = sDate2.split("-")
+            oDate2 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0])
+            iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24)    //鎶婄浉宸殑姣鏁拌浆鎹负澶╂暟
+            return iDays
         }
         function getUrlVars() {
             var vars = [], hash;
@@ -197,9 +203,30 @@
         var params = getUrlVars();
         var linterid = params[params[0]];
         var lentryid = params[params[1]];
-      // debugger;
+        var type = params[params[2]];
+        //鍘熺敓鎴愭潯鐮佹柟娉�(閫佽揣鍗曢粯璁�)
+        var mainUrl = "GetHBarCodeShowBillMain"; //琛ㄥご鏁版嵁鍔犺浇ajax
+        var subUrl = "GetHBarCodeShowBillSub";//琛ㄤ綋鏁版嵁鍔犺浇ajax h_v_SRM_POInStockBillSub_ForWeb2
+        var saveBarCode = "GetBarcodeSaveBillBox";//鏉$爜鐢熸垚淇濆瓨鏂规硶ajax
+        var openTmpListType = "SRM_POInStockBillList"; //鏉$爜鎵撳嵃鎸夐挳 寮瑰嚭鐣岄潰
+        //閲囪喘璁㈠崟鏉$爜鐢熸垚瑙勫垯
+        if (type == 'SRM_POOrderBillList') {
+            mainUrl = 'GetHBarCodeShowBillMainBycg';
+            subUrl = "GetHBarCodeShowBillSubBycg"; //h_v_Cg_POOrderBillSub_ForWeb2
+            saveBarCode = "GetBarcodeSaveBillBoxBycg";
+            openTmpListType = 'SRM_POOrderBillList';
+
+        }
+        //濮斿璁㈠崟
+        else if (type == 'SRM_EntrustOrderBill') {
+            mainUrl = 'GetHBarCodeShowBillMainBywy';
+            subUrl = "GetHBarCodeShowBillSubBywy"; //h_v_srm_EntrustOrderBillSub_ForWeb2
+            saveBarCode = "GetBarcodeSaveBillBoxBycg";//璋冪敤閲囪喘鏁版嵁
+            openTmpListType = 'SRM_POOrderBillList';
+        }
+        // debugger;
         $.ajax({
-            url: GetWEBURL()+"GetHBarCodeShowBillMain",
+            url: GetWEBURL() + mainUrl,
             type: "GET",
             data: { "sMsg": linterid },
             success: function (d) {
@@ -223,18 +250,17 @@
             }
         });
 
-
         layui.config({
             base: '../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
         }).extend({
             index: 'lib/index' //涓诲叆鍙fā鍧�
         }).use(['index', 'table', 'form', 'element', 'layer', 'laydate'], function () {
             var table = layui.table
-            ,$ = layui.$
-            , form = layui.form
-            , layer = layui.layer
-            , laydate = layui.laydate
-            , element = layui.element; //Tab鐨勫垏鎹㈠姛鑳斤紝鍒囨崲浜嬩欢鐩戝惉绛夛紝闇�瑕佷緷璧杄lement妯″潡
+                , $ = layui.$
+                , form = layui.form
+                , layer = layui.layer
+                , laydate = layui.laydate
+                , element = layui.element; //Tab鐨勫垏鎹㈠姛鑳斤紝鍒囨崲浜嬩欢鐩戝惉绛夛紝闇�瑕佷緷璧杄lement妯″潡
 
             //鐢熸垚鍝佺鐮�
             form.on('submit(HBarcodeSaverPZ)', function (data) {//淇濆瓨
@@ -246,64 +272,64 @@
                 var sMainSub = sMainStr + ';' + sSubStr;
                 layer.load(3)
                 $.ajax(
-                {
-                    type: "POST",
-                    url: GetWEBURL()+"GetBarcodeSaveBillVarieties", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
-                    async: true,
-                    data: { "msg": sMainSub },
-                    dataType: "json",
-                    success: function (data) {
-                        if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
-                            layer.msg(data.Message, { icon: 1 });
-                            element.tabDelete('tabDemo', '2'); //鍒犻櫎
-                            element.tabAdd('tabDemo', {
-                                title: '鏉$爜淇℃伅'
-                              , content: '<table class="layui-hide" id="subTable" lay-filter="subTable"></table>' //鏀寔浼犲叆(html浠g爜锛変笉鎸佹敮鐩存帴浼犲叆html椤甸潰
-                              , id: '2' //閫夐」鍗℃爣棰樼殑lay-id灞炴�у��
-                            });
-                            
-                             table.render({
-                                 elem: '#subTable'
-                              , url:  GetWEBURL()+'GetHBarCodeShowBillSub2'
-                              //, toolbar: '#toolbarDemo1'
-                              , defaultToolbar: ['filter', 'exports']
-                              , where: { sMsg: linterid }
-                              , cols: [[
-                                 // , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100, sort: true, fixed: true edit: 'text', hide: true }     
-                               , { field: 'HItemID', title: 'HItemID', width: 100, hide: true }
-                               , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, hide: true }
-                               , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 200 }
-                               , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 200 }
-                               , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 200 }
-                               , { field: 'HBarCode', 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: 'HBatchNo', title: '鎵规', width: 100 }
-                               , { field: 'HEndQty', title: '鏄惁灏剧', width: 100 }
-                               , { field: 'HKFDate', title: '鐢熶骇鏃ユ湡', width: 100 }
-                               , { field: 'HKFPeriod', title: '淇濊川鏈�', width: 100 }
-                               , { field: 'HKFDQDate', title: '鍒版湡鏃ユ湡', width: 100 }
-                              ]]
-                                // , data: [linterid]
-                            //  , page: true
-                              , done: function () {
-                                  layer.closeAll("loading");
-                              }
-                             });
-                             element.tabChange('tabDemo', '2');
+                    {
+                        type: "POST",
+                        url: GetWEBURL() + "GetBarcodeSaveBillVarieties", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                        async: true,
+                        data: { "msg": sMainSub },
+                        dataType: "json",
+                        success: function (data) {
+                            if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                layer.msg(data.Message, { icon: 1 });
+                                element.tabDelete('tabDemo', '2'); //鍒犻櫎
+                                element.tabAdd('tabDemo', {
+                                    title: '鏉$爜淇℃伅'
+                                    , content: '<table class="layui-hide" id="subTable" lay-filter="subTable"></table>' //鏀寔浼犲叆(html浠g爜锛変笉鎸佹敮鐩存帴浼犲叆html椤甸潰
+                                    , id: '2' //閫夐」鍗℃爣棰樼殑lay-id灞炴�у��
+                                });
+
+                                table.render({
+                                    elem: '#subTable'
+                                    , url: GetWEBURL() + 'GetHBarCodeShowBillSub2'
+                                    //, toolbar: '#toolbarDemo1'
+                                    , defaultToolbar: ['filter', 'exports']
+                                    , where: { sMsg: linterid }
+                                    , cols: [[
+                                        // , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100, sort: true, fixed: true edit: 'text', hide: true }
+                                        , { field: 'HItemID', title: 'HItemID', width: 100, hide: true }
+                                        , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, hide: true }
+                                        , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 200 }
+                                        , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 200 }
+                                        , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 200 }
+                                        , { field: 'HBarCode', 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: 'HBatchNo', title: '鎵规', width: 100 }
+                                        , { field: 'HEndQty', title: '鏄惁灏剧', width: 100 }
+                                        , { field: 'HKFDate', title: '鐢熶骇鏃ユ湡', width: 100 }
+                                        , { field: 'HKFPeriod', title: '淇濊川鏈�', width: 100 }
+                                        , { field: 'HKFDQDate', title: '鍒版湡鏃ユ湡', width: 100 }
+                                    ]]
+                                    // , data: [linterid]
+                                    //  , page: true
+                                    , done: function () {
+                                        layer.closeAll("loading");
+                                    }
+                                });
+                                element.tabChange('tabDemo', '2');
+                            }
+                            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);
-                    }
-                });
+                    });
                 return false;
             });
             //鐢熸垚鍞竴鐮�
@@ -316,64 +342,64 @@
                 var sMainSub = sMainStr + ';' + sSubStr;
                 layer.load(3)
                 $.ajax(
-                {
-                    type: "POST",
-                    url: GetWEBURL()+"GetBarcodeSaveBillOnly", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
-                    async: true,
-                    data: { "msg": sMainSub },
-                    dataType: "json",
-                    success: function (data) {
-                        if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
-                            layer.msg(data.Message, { icon: 1 });
-                            element.tabDelete('tabDemo', '2'); //鍒犻櫎
-                            element.tabAdd('tabDemo', {
-                                title: '鏉$爜淇℃伅'
-                              , content: '<table class="layui-hide" id="subTable" lay-filter="subTable"></table>' //鏀寔浼犲叆(html浠g爜锛変笉鎸佹敮鐩存帴浼犲叆html椤甸潰
-                              , id: '2' //閫夐」鍗℃爣棰樼殑lay-id灞炴�у��
-                            });
-                            table.render({
-                                elem: '#subTable'
-                             , url:  GetWEBURL()+'GetHBarCodeShowBillSub2'
-                             , toolbar: '#toolbarDemo1'
-                             , defaultToolbar: ['filter', 'exports']
-                             , where: { sMsg: linterid }
-                             , cols: [[
-                                 // , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100, sort: true, fixed: true edit: 'text', hide: true }                         
-                               , { field: 'HItemID', title: 'HItemID', width: 100, hide: true }
-                               , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, hide: true }
-                               , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 200 }
-                               , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 200 }
-                               , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 200 }
-                               , { field: 'HBarCode', 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: 'HBatchNo', title: '鎵规', width: 100 }
-                               , { field: 'HEndQty', title: '鏄惁灏剧', width: 100 }
-                               , { field: 'HKFDate', title: '鐢熶骇鏃ユ湡', width: 100 }
-                               , { field: 'HKFPeriod', title: '淇濊川鏈�', width: 100 }
-                               , { field: 'HKFDQDate', title: '鍒版湡鏃ユ湡', width: 100 }
+                    {
+                        type: "POST",
+                        url: GetWEBURL() + "GetBarcodeSaveBillOnly", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                        async: true,
+                        data: { "msg": sMainSub },
+                        dataType: "json",
+                        success: function (data) {
+                            if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                layer.msg(data.Message, { icon: 1 });
+                                element.tabDelete('tabDemo', '2'); //鍒犻櫎
+                                element.tabAdd('tabDemo', {
+                                    title: '鏉$爜淇℃伅'
+                                    , content: '<table class="layui-hide" id="subTable" lay-filter="subTable"></table>' //鏀寔浼犲叆(html浠g爜锛変笉鎸佹敮鐩存帴浼犲叆html椤甸潰
+                                    , id: '2' //閫夐」鍗℃爣棰樼殑lay-id灞炴�у��
+                                });
+                                table.render({
+                                    elem: '#subTable'
+                                    , url: GetWEBURL() + 'GetHBarCodeShowBillSub2'
+                                    , toolbar: '#toolbarDemo1'
+                                    , defaultToolbar: ['filter', 'exports']
+                                    , where: { sMsg: linterid }
+                                    , cols: [[
+                                        // , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100, sort: true, fixed: true edit: 'text', hide: true }
+                                        , { field: 'HItemID', title: 'HItemID', width: 100, hide: true }
+                                        , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, hide: true }
+                                        , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 200 }
+                                        , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 200 }
+                                        , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 200 }
+                                        , { field: 'HBarCode', 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: 'HBatchNo', title: '鎵规', width: 100 }
+                                        , { field: 'HEndQty', title: '鏄惁灏剧', width: 100 }
+                                        , { field: 'HKFDate', title: '鐢熶骇鏃ユ湡', width: 100 }
+                                        , { field: 'HKFPeriod', title: '淇濊川鏈�', width: 100 }
+                                        , { field: 'HKFDQDate', title: '鍒版湡鏃ユ湡', width: 100 }
 
-                             ]]
-                                // , data: [linterid]
-                                //  , page: true
-                             , done: function () {
-                                 layer.closeAll("loading");
-                             }
-                            });
-                            element.tabChange('tabDemo', '2');
+                                    ]]
+                                    // , data: [linterid]
+                                    //  , page: true
+                                    , done: function () {
+                                        layer.closeAll("loading");
+                                    }
+                                });
+                                element.tabChange('tabDemo', '2');
+                            }
+                            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);
-                    }
-                });
+                    });
                 return false;
             });
             //鐢熸垚鍐呭绠辩爜
@@ -386,138 +412,138 @@
                 var sMainSub = sMainStr + ';' + sSubStr;
                 layer.load(3)
                 $.ajax(
-                {
-                    type: "POST",
-                    url: GetWEBURL()+"GetBarcodeSaveBillBox", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
-                    async: true,
-                    data: { "msg": sMainSub },
-                    dataType: "json",
-                    success: function (data) {
-                        if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
-                            layer.msg(data.Message, { icon: 1 });
-                            element.tabDelete('tabDemo', '2'); //鍒犻櫎
-                            element.tabDelete('tabDemo', '3'); //鍒犻櫎
-                            element.tabAdd('tabDemo', {
-                                title: '澶栫鏉$爜'
-                              , content: '<table class="layui-hide" id="subTable" lay-filter="subTable"></table>' //鏀寔浼犲叆(html浠g爜锛変笉鎸佹敮鐩存帴浼犲叆html椤甸潰
-                              , id: '2' //閫夐」鍗℃爣棰樼殑lay-id灞炴�у��
-                            });
-                            table.render({
-                                elem: '#subTable'
-                             , url:  GetWEBURL()+'GetHBarCodeShowBillSub3'
-                             , toolbar: '#toolbarDemo1'
-                             , defaultToolbar: ['filter', 'exports']
-                             , where: { sMsg: linterid }
-                             , cols: [[
-                                 // , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100, sort: true, fixed: true edit: 'text', hide: true } 
-                               , { field: 'HItemID', title: 'HItemID', width: 100, hide: true }
-                               , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, hide: true }
-                               , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 200 }
-                               , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 200 }
-                               , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 200 }
-                               , { field: 'HBarCode', 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: 'HBatchNo', title: '鎵规', width: 100 }
-                               , { field: 'HEndQty', title: '鏄惁灏剧', width: 100 }
-                               , { field: 'HKFDate', title: '鐢熶骇鏃ユ湡', width: 100 }
-                               , { field: 'HKFPeriod', title: '淇濊川鏈�', width: 100 }
-                               , { field: 'HKFDQDate', title: '鍒版湡鏃ユ湡', width: 100 }
+                    {
+                        type: "POST",
+                        url: GetWEBURL() + saveBarCode, //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                        async: true,
+                        data: { "msg": sMainSub },
+                        dataType: "json",
+                        success: function (data) {
+                            if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                layer.msg(data.Message, { icon: 1 });
+                                element.tabDelete('tabDemo', '2'); //鍒犻櫎
+                                element.tabDelete('tabDemo', '3'); //鍒犻櫎
+                                element.tabAdd('tabDemo', {
+                                    title: '澶栫鏉$爜'
+                                    , content: '<table class="layui-hide" id="subTable" lay-filter="subTable"></table>' //鏀寔浼犲叆(html浠g爜锛変笉鎸佹敮鐩存帴浼犲叆html椤甸潰
+                                    , id: '2' //閫夐」鍗℃爣棰樼殑lay-id灞炴�у��
+                                });
+                                table.render({
+                                    elem: '#subTable'
+                                    , url: GetWEBURL() + 'GetHBarCodeShowBillSub3'  //h_v_Web_BarCodeBill_ForWeb1
+                                    , toolbar: '#toolbarDemo1'
+                                    , defaultToolbar: ['filter', 'exports']
+                                    , where: { sMsg: linterid }
+                                    , cols: [[
+                                        // , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100, sort: true, fixed: true edit: 'text', hide: true }
+                                        , { field: 'HItemID', title: 'HItemID', width: 100, hide: true }
+                                        , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, hide: true }
+                                        , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 200 }
+                                        , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 200 }
+                                        , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 200 }
+                                        , { field: 'HBarCode', 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: 'HBatchNo', title: '鎵规', width: 100 }
+                                        , { field: 'HEndQty', title: '鏄惁灏剧', width: 100 }
+                                        , { field: 'HKFDate', title: '鐢熶骇鏃ユ湡', width: 100 }
+                                        , { field: 'HKFPeriod', title: '淇濊川鏈�', width: 100 }
+                                        , { field: 'HKFDQDate', title: '鍒版湡鏃ユ湡', width: 100 }
 
-                             ]]
-                                // , data: [linterid]
-                                //  , page: true
-                             , done: function () {
-                                 layer.closeAll("loading");
-                             }
-                            });
-                            element.tabAdd('tabDemo', {
-                                title: '鍐呯鏉$爜'
-                                , content: '<table class="layui-hide" id="subTable2" lay-filter="subTable2"></table>' //鏀寔浼犲叆(html浠g爜锛変笉鎸佹敮鐩存帴浼犲叆html椤甸潰
-                                , id: '3' //閫夐」鍗℃爣棰樼殑lay-id灞炴�у��
-                            });
-                            table.render({
-                                elem: '#subTable2'
-                             , url:  GetWEBURL()+'GetHBarCodeShowBillSub4'
-                             , toolbar: '#toolbarDemo2'
-                             , defaultToolbar: ['filter', 'exports']
-                             , where: { sMsg: linterid }
-                             , cols: [[
-                                 // , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100, sort: true, fixed: true edit: 'text', hide: true }        
-                               , { field: 'HItemID', title: 'HItemID', width: 100, hide: true }
-                               , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, hide: true }
-                               , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 200 }
-                               , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 200 }
-                               , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 200 }
-                               , { field: 'HBarCode', 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: 'HBatchNo', title: '鎵规', width: 100 }
-                               , { field: 'HEndQty', title: '鏄惁灏剧', width: 100 }
-                               , { field: 'HKFDate', title: '鐢熶骇鏃ユ湡', width: 100 }
-                               , { field: 'HKFPeriod', title: '淇濊川鏈�', width: 100}
-                               , { field: 'HKFDQDate', title: '鍒版湡鏃ユ湡', width: 100 }
+                                    ]]
+                                    // , data: [linterid]
+                                    //  , page: true
+                                    , done: function () {
+                                        layer.closeAll("loading");
+                                    }
+                                });
+                                element.tabAdd('tabDemo', {
+                                    title: '鍐呯鏉$爜'
+                                    , content: '<table class="layui-hide" id="subTable2" lay-filter="subTable2"></table>' //鏀寔浼犲叆(html浠g爜锛変笉鎸佹敮鐩存帴浼犲叆html椤甸潰
+                                    , id: '3' //閫夐」鍗℃爣棰樼殑lay-id灞炴�у��
+                                });
+                                table.render({
+                                    elem: '#subTable2'
+                                    , url: GetWEBURL() + 'GetHBarCodeShowBillSub4'
+                                    , toolbar: '#toolbarDemo2'
+                                    , defaultToolbar: ['filter', 'exports']
+                                    , where: { sMsg: linterid }
+                                    , cols: [[
+                                        // , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100, sort: true, fixed: true edit: 'text', hide: true }
+                                        , { field: 'HItemID', title: 'HItemID', width: 100, hide: true }
+                                        , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, hide: true }
+                                        , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 200 }
+                                        , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 200 }
+                                        , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 200 }
+                                        , { field: 'HBarCode', 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: 'HBatchNo', title: '鎵规', width: 100 }
+                                        , { field: 'HEndQty', title: '鏄惁灏剧', width: 100 }
+                                        , { field: 'HKFDate', title: '鐢熶骇鏃ユ湡', width: 100 }
+                                        , { field: 'HKFPeriod', title: '淇濊川鏈�', width: 100 }
+                                        , { field: 'HKFDQDate', title: '鍒版湡鏃ユ湡', width: 100 }
 
-                             ]]
-                                // , data: [linterid]
-                                //  , page: true
-                             , done: function () {
-                                 layer.closeAll("loading");
-                             }
-                            });
-                            element.tabChange('tabDemo', '2');
+                                    ]]
+                                    // , data: [linterid]
+                                    //  , page: true
+                                    , done: function () {
+                                        layer.closeAll("loading");
+                                    }
+                                });
+                                element.tabChange('tabDemo', '2');
+                            }
+                            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);
-                    }
-                });
+                    });
                 return false;
             });
 
-      form.on('submit(Print)', function (data) {//鎵撳嵃
-        var data1 = layui.table.cache["subTable"]
-        , data2 = layui.table.cache["subTable2"];
-        var rows = '';
-        var rows2 = '';
-        for (var i = 0; i < data1.length; i++) {
-            rows += data1[i].HItemID.toString() + ',';
-            rows2 += data1[i].HBarCode.toString() + ',';
-        }
-        for (var j = 0; j < data2.length; j++) {
-            rows += data2[j].HItemID.toString() + ',';
-            rows2 += data2[j].HBarCode.toString() + ',';
-        }
-        rows = rows.substring(rows.length - 1, 0);
-        rows2 = rows2.substring(rows2.length - 1, 0);
-        if (rows == "") {
-            layer.msg("鑷冲皯閫夋嫨涓�琛岃褰曪紒")
-        }
-        else {
-            layer.open({
-                type: 2
-                , area: ['50%', '50%']
-                , title: '鎵撳嵃妯$増閫夋嫨'
-                , shade: 0.6 //閬僵閫忔槑搴�
-                , maxmin: false //鍏佽鍏ㄥ睆鏈�灏忓寲
-                , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
-                , content: ['../../views/BaseSet/SRM_OpenTmpList.html?linterid=' + rows.toString() + '&HBarcode=' + rows2.toString() + '&Type=HBarCodePrint', 'yes']
-                , resize: false
-                //, cancel: function () {
-                //    $(".layui-btn").removeClass("layui-btn-disabled");
-                //}
-            })
-        }
-        });
+            form.on('submit(Print)', function (data) {//鎵撳嵃
+                var data1 = layui.table.cache["subTable"]
+                    , data2 = layui.table.cache["subTable2"];
+                var rows = '';
+                var rows2 = '';
+                for (var i = 0; i < data1.length; i++) {
+                    rows += data1[i].HItemID.toString() + ',';
+                    rows2 += data1[i].HBarCode.toString() + ',';
+                }
+                for (var j = 0; j < data2.length; j++) {
+                    rows += data2[j].HItemID.toString() + ',';
+                    rows2 += data2[j].HBarCode.toString() + ',';
+                }
+                rows = rows.substring(rows.length - 1, 0);
+                rows2 = rows2.substring(rows2.length - 1, 0);
+                if (rows == "") {
+                    layer.msg("鑷冲皯閫夋嫨涓�琛岃褰曪紒")
+                }
+                else {
+                    layer.open({
+                        type: 2
+                        , area: ['50%', '50%']
+                        , title: '鎵撳嵃妯$増閫夋嫨'
+                        , shade: 0.6 //閬僵閫忔槑搴�
+                        , maxmin: false //鍏佽鍏ㄥ睆鏈�灏忓寲
+                        , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
+                        , content: ['../../views/BaseSet/SRM_OpenTmpList.html?linterid=' + rows.toString() + '&HBarcode=&Type=' + openTmpListType, 'yes']
+                        , resize: false
+                        //, cancel: function () {
+                        //    $(".layui-btn").removeClass("layui-btn-disabled");
+                        //}
+                    })
+                }
+            });
             form.on('submit(Exit)', function (data) {//閫�鍑�
                 var index = parent.layer.getFrameIndex(window.name); //鍏堝緱鍒板綋鍓峣frame灞傜殑绱㈠紩
                 parent.layer.close(index); //鍐嶆墽琛屽叧闂�
@@ -534,68 +560,53 @@
                 }
             });
             layer.load(3)
+
             table.render({
                 elem: '#mainTable'
-              , url:  GetWEBURL()+'GetHBarCodeShowBillSub'
-              , toolbar: '#toolbarDemo' //寮�鍚ご閮ㄥ伐鍏锋爮锛屽苟涓哄叾缁戝畾宸︿晶妯℃澘
-              , defaultToolbar: ['filter', 'exports']
-              , where: { sMsg: linterid, sMsg2: lentryid }
-              , cols: [[
-              , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, 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: 'HMinQty', title: '鍐呯鍖呰鏁�', width: 100, edit: 'text' }
-              , { field: 'HBQty', title: '鍐呯鏁�', width: 100 }
-              , { field: 'HWXQty', title: '澶栫鍖呰鏁�', width: 100, edit: 'text' }
-              , { field: 'HWBQty', title: '澶栫鏁�', width: 100 }
-              , { field: 'HPrice', title: '鍗曚环', width: 100, hide: true }
-              , { field: 'HMoney', title: '閲戦', width: 100, hide: true }
-              , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100 }
-              , { field: 'HBatchNo', title: '鎵规', width: 100, edit: 'text' }
-              , { field: 'HKFDate', title: '鐢熶骇鏃ユ湡', align: 'center', width: 150 }//, data_field: 'HKFDate', event: "chooseHKFDate" 
-              , { field: 'HKFPeriod', title: '淇濊川鏈�', width: 100 }//, edit: 'text', event: "inputHKFPeriod"
-              , { field: 'HKFDQDate', title: '鍒版湡鏃ユ湡', align: 'center', width: 150 }//, data_field: 'HKFDQDate', event: "chooseHKFDQDate" 
-              //, { field: 'HDate', title: '瑕佹眰浜よ揣鏃ユ湡', width: 150 }
-              , { 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 }
-              , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', width: 200 }
-              , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 150, hide: true }
-              , { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 150, hide: true }
-              , { field: 'HSupID', title: '渚涘簲鍟咺D', width: 150, hide: true }
+                , url: GetWEBURL() + subUrl
+                , toolbar: '#toolbarDemo' //寮�鍚ご閮ㄥ伐鍏锋爮锛屽苟涓哄叾缁戝畾宸︿晶妯℃澘
+                , defaultToolbar: ['filter', 'exports']
+                , where: { sMsg: linterid, sMsg2: lentryid }
+                , cols: [[
+                    , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, hide: true }
+                    , { field: 'HMaterShortNumber', title: '鐗╂枡缂栫爜', width: 120 }
+                    , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 120 }
+                    , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 120 }
+                    , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 120 }
+                    , { 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: 'HMinQty', title: '鍐呯鍖呰鏁�', width: 100, edit: 'text' }
+                    , { field: 'HBQty', title: '鍐呯鏁�', width: 100 }
+                    , { field: 'HWXQty', title: '澶栫鍖呰鏁�', width: 100 }
+                    , { field: 'HWBQty', title: '澶栫鏁�', width: 100, edit: 'text' }
+                    , { field: 'HPrice', title: '鍗曚环', width: 100, hide: true }
+                    , { field: 'HMoney', title: '閲戦', width: 100, hide: true }
+                    , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100 }
+                    , { field: 'HBatchNo', title: '鎵规', width: 100, edit: 'text' }
+                    //, { field: 'HBeginDate', title: '鐢熶骇鏃ユ湡', width: 120, data_field: 'HBeginDate', event: "chooseHBeginDate" }
+                    //, { field: 'HEndDate', title: '澶辨晥鏃ユ湡', width: 120, data_field: 'HEndDate', event: "chooseHEndDate" }
+                    , { field: 'HKFDate', title: '鐢熶骇鏃ユ湡', align: 'center', width: 150, data_field: 'HKFDate', event: "chooseHKFDate" }//
+                    , { field: 'HKFPeriod', title: '淇濊川鏈�', width: 100, edit: 'text', event: "inputHKFPeriod" }//
+                    , { field: 'HKFDQDate', title: '鍒版湡鏃ユ湡', align: 'center', width: 150, data_field: 'HKFDQDate', event: "chooseHKFDQDate" }//
+                    //, { field: 'HDate', title: '瑕佹眰浜よ揣鏃ユ湡', width: 150 }
+                    , { 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 }
+                    , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', width: 200 }
+                    , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 150, hide: true }
+                    , { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 150, hide: true }
+                    , { field: 'HSupID', title: '渚涘簲鍟咺D', width: 150, hide: true }
+                    , { field: 'HSupName', title: '渚涘簲鍟嗗悕绉�', width: 150, hide: true }
 
-              ]]
-              // , data: [linterid]
-             // , page: true
-                //, height: 500
-                
+                ]]
                 , done: function (res, curr, count) {
-                    //鏃ユ湡鎺т欢
-                    //$(".layui-input-date").each(function (i) {
-                    //    layui.laydate.render({
-                    //        elem: this
-                    //        ,format: "yyyy-MM-dd"
-                    //        , value: this.value
-                    //        ,trigger:'click'//閲囩敤click寮瑰嚭
-                    //        , done: function (value, date, endDate) {
-                    //            table.cache.mainTable.
-                    //            //if (res && res.data[i]) {
-                    //            //    $.extend(res.data[i], { 'HKFDate': value })
-                    //            //}
-                    //        }
-                    //    });
-                    //});
-
                     console.log(res);
                     layer.closeAll("loading");
                 }
@@ -605,95 +616,97 @@
                 var checkStatus = table.checkStatus(obj.config.id);
                 switch (obj.event) {
 
-                        //鑷畾涔夊ご宸ュ叿鏍�
+                    //鑷畾涔夊ご宸ュ叿鏍�
                     case 'btn-normal':
                         table.render({
                             elem: '#mainTable'
-                          , url:  GetWEBURL()+'GetHBarCodeShowBillSub'
-                          , toolbar: '#toolbarDemo' //寮�鍚ご閮ㄥ伐鍏锋爮锛屽苟涓哄叾缁戝畾宸︿晶妯℃澘
-                          , defaultToolbar: ['filter', 'exports']
-                          , where: { sMsg: linterid, sMsg2: lentryid }
-                          , cols: [[
-                            , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, 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: 'HMinQty', title: '鏈�灏忓寘瑁呮暟', width: 100, edit: 'text' }
-                            , { field: 'HBQty', title: '鏉$爜寮犳暟', width: 100 }
-                            , { field: 'HPrice', title: '鍗曚环', width: 100, hide: true }
-                            , { field: 'HMoney', title: '閲戦', width: 100, hide: true }
-                            , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100 }
-                            , { field: 'HBatchNo', title: '鎵规', width: 100, edit: 'text' }
-                            , { field: 'HKFDate', title: '鐢熶骇鏃ユ湡', align: 'center', width: 150, data_field: 'HKFDate', event: "chooseHKFDate" }
-                            , { field: 'HKFPeriod', title: '淇濊川鏈�', width: 100, edit: 'text', event: "inputHKFPeriod" }
-                            , { field: 'HKFDQDate', title: '鍒版湡鏃ユ湡', align: 'center', width: 150, data_field: 'HKFDQDate', event: "chooseHKFDQDate" }
-                            //, { field: 'HDate', title: '瑕佹眰浜よ揣鏃ユ湡', width: 150 }
-                            , { 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 }
-                            , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', width: 200 }
-                            , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 150, hide: true }
-                            , { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 150, hide: true }
-                            , { field: 'HSupID', title: '渚涘簲鍟咺D', width: 150, hide: true }
-                          ]]
-                          , done: function () {
-                              layer.closeAll("loading");
-                          }
+                            , url: GetWEBURL() + 'GetHBarCodeShowBillSub'
+                            , toolbar: '#toolbarDemo' //寮�鍚ご閮ㄥ伐鍏锋爮锛屽苟涓哄叾缁戝畾宸︿晶妯℃澘
+                            , defaultToolbar: ['filter', 'exports']
+                            , where: { sMsg: linterid, sMsg2: lentryid }
+                            , cols: [[
+                                , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, 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: 'HMinQty', title: '鏈�灏忓寘瑁呮暟', width: 100, edit: 'text' }
+                                , { field: 'HBQty', title: '鏉$爜寮犳暟', width: 100 }
+                                , { field: 'HPrice', title: '鍗曚环', width: 100, hide: true }
+                                , { field: 'HMoney', title: '閲戦', width: 100, hide: true }
+                                , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100 }
+                                , { field: 'HBatchNo', title: '鎵规', width: 100, edit: 'text' }
+                                //, { field: 'HBeginDate', title: '鐢熶骇鏃ユ湡', width: 120, data_field: 'HBeginDate', event: "chooseHBeginDate" }
+                                //, { field: 'HEndDate', title: '澶辨晥鏃ユ湡', width: 120, data_field: 'HEndDate', event: "chooseHEndDate" }
+                                , { field: 'HKFDate', title: '鐢熶骇鏃ユ湡', align: 'center', width: 150, data_field: 'HKFDate', event: "chooseHKFDate" }
+                                , { field: 'HKFPeriod', title: '淇濊川鏈�', width: 100, edit: 'text', event: "inputHKFPeriod" }
+                                , { field: 'HKFDQDate', title: '鍒版湡鏃ユ湡', align: 'center', width: 150, data_field: 'HKFDQDate', event: "chooseHKFDQDate" }
+                                //, { field: 'HDate', title: '瑕佹眰浜よ揣鏃ユ湡', width: 150 }
+                                , { 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 }
+                                , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', width: 200 }
+                                , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 150, hide: true }
+                                , { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 150, hide: true }
+                                , { field: 'HSupID', title: '渚涘簲鍟咺D', width: 150, hide: true }
+                            ]]
+                            , done: function () {
+                                layer.closeAll("loading");
+                            }
                         });
                         break;
                     case "btn-box":
                         table.render({
                             elem: '#mainTable'
-                          , url:  GetWEBURL()+'GetHBarCodeShowBillSub'
-                          , toolbar: '#toolbarDemo' //寮�鍚ご閮ㄥ伐鍏锋爮锛屽苟涓哄叾缁戝畾宸︿晶妯℃澘
-                          , defaultToolbar: ['filter', 'exports']
-                          , where: { sMsg: linterid, sMsg2: lentryid }
-                          , cols: [[
-                            , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, 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: 'HMinQty', title: '鍐呯鍖呰鏁�', width: 100, edit: 'text' }
-                            , { field: 'HBQty', title: '鍐呯鏁�', width: 100 }
-                            , { field: 'HWXQty', title: '澶栫鍖呰鏁�', width: 100, edit: 'text' }
-                            , { field: 'HWBQty', title: '澶栫鏁�', width: 100 }
-                            , { field: 'HPrice', title: '鍗曚环', width: 100, hide: true }
-                            , { field: 'HMoney', title: '閲戦', width: 100, hide: true }
-                            , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100 }
-                            , { field: 'HBatchNo', title: '鎵规', width: 100, edit: 'text' }
-                            , { field: 'HKFDate', title: '鐢熶骇鏃ユ湡', align: 'center', width: 150, data_field: 'HKFDate', event: "chooseHKFDate" }
-                            , { field: 'HKFPeriod', title: '淇濊川鏈�', width: 100, edit: 'text', event: "inputHKFPeriod" }
-                            , { field: 'HKFDQDate', title: '鍒版湡鏃ユ湡', align: 'center', width: 150, data_field: 'HKFDQDate', event: "chooseHKFDQDate" }
-                            //, { field: 'HDate', title: '瑕佹眰浜よ揣鏃ユ湡', width: 150 }
-                            , { 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 }
-                            , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', width: 200 }
-                            , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 150, hide: true }
-                            , { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 150, hide: true }
-                            , { field: 'HSupID', title: '渚涘簲鍟咺D', width: 150, hide: true }
-                          ]]
-                          , done: function () {
-                              layer.closeAll("loading");
-                          }
+                            , url: GetWEBURL() + 'GetHBarCodeShowBillSub'
+                            , toolbar: '#toolbarDemo' //寮�鍚ご閮ㄥ伐鍏锋爮锛屽苟涓哄叾缁戝畾宸︿晶妯℃澘
+                            , defaultToolbar: ['filter', 'exports']
+                            , where: { sMsg: linterid, sMsg2: lentryid }
+                            , cols: [[
+                                , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, 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: 'HMinQty', title: '鍐呯鍖呰鏁�', width: 100, edit: 'text' }
+                                , { field: 'HBQty', title: '鍐呯鏁�', width: 100 }
+                                , { field: 'HWXQty', title: '澶栫鍖呰鏁�', width: 100, edit: 'text' }
+                                , { field: 'HWBQty', title: '澶栫鏁�', width: 100 }
+                                , { field: 'HPrice', title: '鍗曚环', width: 100, hide: true }
+                                , { field: 'HMoney', title: '閲戦', width: 100, hide: true }
+                                , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100 }
+                                , { field: 'HBatchNo', title: '鎵规', width: 100, edit: 'text' }
+                                , { field: 'HKFDate', title: '鐢熶骇鏃ユ湡', align: 'center', width: 150, data_field: 'HKFDate', event: "chooseHKFDate" }
+                                , { field: 'HKFPeriod', title: '淇濊川鏈�', width: 100, edit: 'text', event: "inputHKFPeriod" }
+                                , { field: 'HKFDQDate', title: '鍒版湡鏃ユ湡', align: 'center', width: 150, data_field: 'HKFDQDate', event: "chooseHKFDQDate" }
+                                //, { field: 'HDate', title: '瑕佹眰浜よ揣鏃ユ湡', width: 150 }
+                                , { 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 }
+                                , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', width: 200 }
+                                , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 150, hide: true }
+                                , { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 150, hide: true }
+                                , { field: 'HSupID', title: '渚涘簲鍟咺D', width: 150, hide: true }
+                            ]]
+                            , done: function () {
+                                layer.closeAll("loading");
+                            }
                         });
                         break;
 
@@ -703,35 +716,67 @@
             //鐩戝惉琛屽伐鍏蜂簨浠�
             table.on('tool(mainTable)', function (obj) {
                 var data = obj.data;
-                if(obj.event === 'chooseHKFDate'){
+                if (obj.event === 'chooseHKFDate') {
                     var field = $(this).data('field');
                     laydate.render({
                         elem: this.firstChild
-                      , show: true //鐩存帴鏄剧ず
-                      , closeStop: this
-                      , done: function (value, date) {
-                          data[field] = value;
-                          obj.update(data);
-                          if (parseInt(obj.data.HKFPeriod) >= 0) {
-                              var sKFDQDate = addDate(value, parseInt(obj.data.HKFPeriod));
-                              obj.update({
-                                  HKFDQDate: sKFDQDate,
-                              });
-                          }
-                      }
+                        , show: true //鐩存帴鏄剧ず
+                        , closeStop: this
+                        , done: function (value, date) {
+                            data[field] = value;
+                            obj.update(data);
+                            if (parseInt(obj.data.HKFPeriod) >= 0) {
+                                var sKFDQDate = addDate(value, parseInt(obj.data.HKFPeriod));
+                                obj.update({
+                                    HKFDQDate: sKFDQDate,
+                                });
+                            }
+                        }
                     });
                 }
                 else if (obj.event == 'chooseHKFDQDate') {
                     var field = $(this).data('field');
                     laydate.render({
                         elem: this.firstChild
-                      , show: true //鐩存帴鏄剧ず
-                      , closeStop: this
-                      , done: function (value, date) {
-                          data[field] = value;
-                          obj.update(data);
+                        , show: true //鐩存帴鏄剧ず
+                        , closeStop: this
+                        , done: function (value, date) {
+                            data[field] = value;
+                            obj.update(data);
+                            if (obj.data.HKFDQDate != "" && obj.data.HKFDate != "") {
+                                var days = DateDiff(obj.data.HKFDQDate, obj.data.HKFDate);
+                                obj.update({
+                                    HKFPeriod: days,
+                                });
+                            }
+                        }
+                    });
+                }
+                else if (obj.event == 'chooseHBeginDate') {
+                    var field = $(this).data('field');
+                    laydate.render({
+                        elem: this.firstChild
+                        , show: true //鐩存帴鏄剧ず
+                        , closeStop: this
+                        , done: function (value, date) {
+                            data[field] = value;
+                            obj.update(data);
 
-                      }});
+                        }
+                    });
+                }
+                else if (obj.event == 'chooseHEndDate') {
+                    var field = $(this).data('field');
+                    laydate.render({
+                        elem: this.firstChild
+                        , show: true //鐩存帴鏄剧ず
+                        , closeStop: this
+                        , done: function (value, date) {
+                            data[field] = value;
+                            obj.update(data);
+
+                        }
+                    });
                 }
                 else if (obj.event == 'inputHKFPeriod') {
                     $(obj.tr).find(".layui-table-edit").keyup(function () {
@@ -753,81 +798,96 @@
             //    }
             //});
             table.on('edit(mainTable)', function (obj) { //娉細edit鏄浐瀹氫簨浠跺悕锛宼est鏄痶able鍘熷瀹瑰櫒鐨勫睘鎬� lay-filter="瀵瑰簲鐨勫��"
-               var value = obj.value //寰楀埌淇敼鍚庣殑鍊�
-                  ,data = obj.data //寰楀埌鎵�鍦ㄨ鎵�鏈夐敭鍊�
-                  , field = obj.field; //寰楀埌瀛楁
-               var HMinQty = 0;
-               var HWXQty = 0;
-               var HKFPeriod = 0;
-               if (obj.data.HMinQty != undefined)
-               {
-                   HMinQty = parseFloat(obj.data.HMinQty);
-               }
-               if (obj.data.HWXQty != undefined) {
-                   HWXQty = parseFloat(obj.data.HWXQty);
-               }
-               if (obj.data.HKFPeriod != undefined) {
-                   HKFPeriod = parseFloat(obj.data.HKFPeriod);
-               }
-               HKFPeriod
-               switch(field){
-                   case "HMinQty":
-                       if (HMinQty>0){
-                           if (HWXQty >= 0) {
-                               if (isPositiveIntegerTimes(parseFloat(obj.value), HWXQty)) //澶栫鍖呰鏁拌兘琚唴绠卞寘瑁呮暟鏁撮櫎
-                               {
-                                   obj.update({
-                                       HBQty: Math.ceil(parseFloat(obj.data.HQty) / parseFloat(obj.value)),
-                                   });
-                               }
-                               else {
-                                   //obj.update({
-                                   //    HMinQty: 0,
-                                   //});
-                                   f_alert("澶栫鍖呰鏁板繀椤绘槸鍐呯鍖呰鏁扮殑鏁存暟鍊�!");
-                               }
-                           }
-                       }
-                       else
-                       {
-                           //obj.update({
-                           //    HMinQty: 0,
-                           //});
-                           f_alert("鍐呯鍖呰鏁颁笉鑳戒负璐熸暟!");
-                       }
-                       break;
-                   case "HWXQty":
-                       if (HWXQty > 0) {
-                           if (HMinQty >= 0) {
-                               if (isPositiveIntegerTimes(HMinQty, parseFloat(obj.value))) //澶栫鍖呰鏁拌兘琚唴绠卞寘瑁呮暟鏁撮櫎
-                               {
-                                   obj.update({
-                                       HWBQty: Math.ceil(parseFloat(obj.data.HQty) / parseFloat(obj.value)),
-                                   });
-                               }
-                               else {
-                                   //obj.update({
-                                   //    HWXQty: 0,
-                                   //});
-                                   f_alert("澶栫鍖呰鏁板繀椤绘槸鍐呯鍖呰鏁扮殑鏁存暟鍊�!");
-                               }
-                           }
-                       } 
-                       else {
-                           //obj.update({
-                           //    HWXQty: 0,
-                           //});
-                           f_alert("澶栫鍖呰鏁颁笉鑳戒负璐熸暟!");
-                       }
-                       break;
-                   case "HKFPeriod":
-                       if (HKFPeriod >= 0) {
-                           var sKFDQDate = addDate(obj.data.HKFDate, HKFPeriod);
-                           obj.update({
-                               HKFDQDate: sKFDQDate,
-                           });
-                       }
-         }
+                var value = obj.value //寰楀埌淇敼鍚庣殑鍊�
+                    , data = obj.data //寰楀埌鎵�鍦ㄨ鎵�鏈夐敭鍊�
+                    , field = obj.field; //寰楀埌瀛楁
+                var HMinQty = 0;
+                var HWXQty = 0;
+                var HKFPeriod = 0;
+                var HWBQty = 0;
+                var HBQty = 0;
+                if (obj.data.HMinQty != undefined) {
+                    HMinQty = parseFloat(obj.data.HMinQty);
+                }
+                if (obj.data.HWXQty != undefined) {
+                    HWXQty = parseFloat(obj.data.HWXQty);
+                }
+                if (obj.data.HKFPeriod != undefined) {
+                    HKFPeriod = parseFloat(obj.data.HKFPeriod);
+                }
+                if (obj.data.HWBQty != undefined) {
+                    HWBQty = parseFloat(obj.data.HWBQty);
+                }
+                if (obj.data.HBQty != undefined) {
+                    HBQty = parseFloat(obj.data.HBQty);
+                }
+                switch (field) {
+                    case "HMinQty":
+                        if (HMinQty < 0) {
+                            f_alert("鍐呯鍖呰鏁颁笉鑳戒负璐熸暟!");
+                        }
+                        else if (HWBQty > HBQty) {
+                            f_alert("澶栫鏁伴噺涓嶈兘瓒呭嚭鍐呯鏁伴噺")
+                            return;
+                        }
+                        else (HWXQty >= 0)
+                        {
+                            obj.update({
+                                //澶栫鍖呰鎬绘暟 =  鍐呯鏁伴噺/澶栫鏁伴噺 * 鍐呯鍖呰鏁伴噺
+                                HBQty: Math.ceil(parseFloat(obj.data.HQty) / parseFloat(obj.value)),
+                                HWXQty: Math.ceil(parseFloat(obj.data.HBQty) / parseFloat(obj.data.HWBQty)) * parseFloat(obj.data.HMinQty),
+                            });
+                        }
+                        break;
+                    case "HWBQty": //澶栫涓暟鍙戠敓鍙樺寲
+                        if (HWBQty < 0) {
+                            f_alert("澶栫鏁伴噺涓嶈兘涓鸿礋鏁�")
+                            return;
+                        }
+                        else if (HWBQty > HBQty) {
+                            f_alert("澶栫鏁伴噺涓嶈兘瓒呭嚭鍐呯鏁伴噺")
+                            return;
+                        }
+                        else {
+                            obj.update({
+                                //澶栫鍖呰鎬绘暟 =  鍐呯鏁伴噺/澶栫鏁伴噺 * 鍐呯鍖呰鏁伴噺
+                                HWXQty: Math.ceil(parseFloat(obj.data.HBQty) / parseFloat(obj.data.HWBQty)) * parseFloat(obj.data.HMinQty),
+                                //HWXQty: 12
+                            });
+                        }
+                        break;
+                    //case "HWXQty":
+                    //    if (HWXQty > 0) {
+                    //        if (HMinQty >= 0) {
+                    //            if (isPositiveIntegerTimes(HMinQty, parseFloat(obj.value))) //澶栫鍖呰鏁拌兘琚唴绠卞寘瑁呮暟鏁撮櫎
+                    //            {
+                    //                obj.update({
+                    //                    HWBQty: Math.ceil(parseFloat(obj.data.HQty) / parseFloat(obj.value)),
+                    //                });
+                    //            }
+                    //            else {
+                    //                //obj.update({
+                    //                //    HWXQty: 0,
+                    //                //});
+                    //                f_alert("澶栫鍖呰鏁板繀椤绘槸鍐呯鍖呰鏁扮殑鏁存暟鍊�!");
+                    //            }
+                    //        }
+                    //    }
+                    //    else {
+                    //        //obj.update({
+                    //        //    HWXQty: 0,
+                    //        //});
+                    //        f_alert("澶栫鍖呰鏁颁笉鑳戒负璐熸暟!");
+                    //    }
+                    //    break;
+                    case "HKFPeriod":
+                        if (HKFPeriod >= 0) {
+                            var sKFDQDate = addDate(obj.data.HKFDate, HKFPeriod);
+                            obj.update({
+                                HKFDQDate: sKFDQDate,
+                            });
+                        }
+                }
 
 
             });
@@ -839,20 +899,20 @@
                         page: {
                             curr: 1 //閲嶆柊浠庣 1 椤靛紑濮�
                         }
-                      , where: {
-                          key: {
-                              id: demoReload.val()
-                          }
-                      }
+                        , where: {
+                            key: {
+                                id: demoReload.val()
+                            }
+                        }
                     });
                 }
             };
-           
+
             $('.test-table-reload-btn .layui-btn').on('click', function () {
                 var type = $(this).data('type');
                 active[type] ? active[type].call(this) : '';
             });
-           });
+        });
     </script>
 </body>
 </html>
\ No newline at end of file

--
Gitblit v1.9.1