From be8b558b89a89deb3aa871fc2ddaacb7fb2197bd Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期一, 16 十月 2023 09:25:14 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-LayUI

---
 WebTM/views/仓存管理/条码生成/Gy_BarCodeBill.html |  123 ++++++++++++++++++++++++++--------------
 1 files changed, 79 insertions(+), 44 deletions(-)

diff --git "a/WebTM/views/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/Gy_BarCodeBill.html" "b/WebTM/views/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/Gy_BarCodeBill.html"
index 2dafc0c..e7ce3e2 100644
--- "a/WebTM/views/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/Gy_BarCodeBill.html"
+++ "b/WebTM/views/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/Gy_BarCodeBill.html"
@@ -87,12 +87,10 @@
                                                         <option value="3">閲囪喘璁㈠崟</option>
                                                         <option value="4">鏀舵枡閫氱煡鍗�</option>
                                                         <option value="5">濮斿璁㈠崟</option>
-                                                        <option value="6">閫�璐ч�氱煡鍗�</option>
-                                                        <option value="7">鍏朵粬鍏ュ簱鍗�</option>
-                                                        <option value="8">鐩存帴璋冩嫧鍗�</option>
-                                                        <option value="9">閲囪喘閫�鏂欏崟</option>
-                                                        <option value="10">鐢熶骇閫�鏂欏崟</option>
-                                                        <option value="11">缁勮鎷嗗嵏鍗�</option>
+                                                        <option value="6">鐢熶骇鍏ュ簱鍗�</option>
+                                                        <option value="7">閲囪喘鍏ュ簱鍗�</option>
+                                                        <option value="8">閿�鍞��璐у崟</option>
+                                                        <option value="9">鐢熶骇閫�鏂欏崟</option>
                                                     </select>
                                                 </div>
                                             </div>
@@ -220,26 +218,39 @@
             var HBatchNo = "";
             var BatchNoArray; //鐢ㄦ潵瀛樺偍鑾峰彇鍒扮殑鎵瑰彿锛屽湪鎵规鎸夐挳鍔熻兘涓敤鍒�
             var HMinQty2 = 0; //鐢ㄦ潵瀛樺偍杈撳叆鐨勬渶灏忓寘瑁呮暟锛屽湪鎵规鎸夐挳鍔熻兘涓敤鍒�
+
+            var HMaterInfo = "";  //瀛樺偍鐗╂枡淇℃伅
+            var HBarInfo = ""; //瀛樺偍鏉$爜淇℃伅
+            var HFileList = "";  //瀛樺偍妗f鍒楄〃
             //#endregion           
 
             //鐩戝惉褰撳墠澶勪簬鍝竴涓〉绛撅紝浼� HModName 鍊�
             element.on('tab(tab-TabTest)', function (data) {
+                HMaterInfo = table.cache['mainTable'];
                 var cur_title = data.elem.context.innerText;
                 if (cur_title == "鐗╂枡淇℃伅") {
                     HModName = "Gy_BarCodeBill";
                     //鍒锋柊琛ㄦ牸鏁版嵁
                     DisPlay_HideColumn();
+                    table.reload('mainTable', {
+                        data: HMaterInfo // 璋冪敤table.reload 閲嶆柊娓叉煋鏄剧ず鍔犺浇杩藉姞浜嗘暟鎹殑琛ㄦ牸
+                    });
                     
                 } else if (cur_title == "鏉$爜淇℃伅") {
                     HModName = "Gy_BarCodeBill_1";
                     //鍒锋柊琛ㄦ牸鏁版嵁
                     DisPlay_HideColumn1();
-                    
+                    table.reload('mainTable1', {
+                        data: HBarInfo // 璋冪敤table.reload 閲嶆柊娓叉煋鏄剧ず鍔犺浇杩藉姞浜嗘暟鎹殑琛ㄦ牸
+                    });
                 } else if (cur_title == "妗f鍒楄〃") {
                     HModName = "Gy_BarCodeBill_2";
                     //鍒锋柊琛ㄦ牸鏁版嵁
                     DisPlay_HideColumn2();
-                    
+                    //鍔犺浇妗f鍒楄〃
+                    table.reload('mainTable2', {
+                        data: HFileList // 璋冪敤table.reload 閲嶆柊娓叉煋鏄剧ず鍔犺浇杩藉姞浜嗘暟鎹殑琛ㄦ牸
+                    });    
                 }
             })
 
@@ -253,6 +264,10 @@
             //鍔犺浇鏉$爜绫诲瀷鏁版嵁
             set_HBarCodeType();                      
 
+            var rowdata = [{
+                "HMaterID": 0, "HMaterCode": "", "HMaterNumber": "", "HMaterName": "", "HMaterModel": "", "HMaterSpec": "", "HBatchNo": "", "HUnitID": 0, "HUnitNumber": "", "HUnitName": "", "HDesignLife": 0, "HLeaveLife": 0, "HUseLife": 0, "HQtyMust": 0, "HQty": 0, "HBQty": 0, "HMinQty": 0, "HPackQty": 0, "HPrice": 0, "HMoney": 0, "HWHID": 0, "HWHCode": "", "HWHName": "", "HSPID": 0, "HSPCode": "", "HSPName": "", "HStockOrgID": sessionStorage["OrganizationID"], "HRemark": "", "HCoilNO": "", "HFurnaceNO": "", "HFactory": "",
+                "HAuxQty": 0, "HheatNO": "", "HProduceDate": Format(new Date(), "yyyy-MM-dd"), "HExpiryDate": Format(new Date(), "yyyy-MM-dd"), "HExpirationDateFlag": 0
+            }];
             //鍒濆鍖栬〃鏍�
             set_InitGrid();
             set_CountGrid();
@@ -272,12 +287,7 @@
             else {
                 layer.alert("鏈煡鎿嶄綔绫诲瀷锛�", { icon: 5 });
             }
-            //#endregion
-           
-            var rowdata = [{
-                "HMaterID": 0, "HMaterCode": "", "HMaterNumber": "", "HMaterName": "", "HMaterModel": "", "HMaterSpec": "", "HBatchNo": "", "HUnitID": 0, "HUnitNumber": "", "HUnitName": "", "HDesignLife": 0, "HLeaveLife": 0, "HUseLife": 0, "HQtyMust": 0, "HQty": 0, "HBQty": 0, "HMinQty": 0,"HPackQty":0, "HPrice": 0, "HMoney": 0, "HWHID": 0, "HWHCode": "", "HWHName": "", "HSPID": 0, "HSPCode": "", "HSPName": "", "HStockOrgID": sessionStorage["OrganizationID"], "HRemark": "", "HCoilNO": "", "HFurnaceNO": "", "HFactory": "",
-                "HAuxQty": 0, "HheatNO": "", "HProduceDate": Format(new Date(), "yyyy-MM-dd"), "HExpiryDate": Format(new Date(), "yyyy-MM-dd"), "HExpirationDateFlag": 0
-            }];
+            //#endregion                     
 
             //#region 鐐瑰嚮浜嬩欢锛屽寘鎷琽n鍜宖orm浜嬩欢
             //澶村伐鍏锋爮
@@ -444,6 +454,18 @@
                     case '5':
                         return "濮斿璁㈠崟";
                         break;
+                    case '6':
+                        return "鐢熶骇鍏ュ簱鍗�";
+                        break;
+                    case '7':
+                        return "閲囪喘鍏ュ簱鍗�";
+                        break;
+                    case '8':
+                        return "閿�鍞��璐у崟";
+                        break;
+                    case '9':
+                        return "鐢熶骇閫�鏂欏崟";
+                        break;
                 }
             }
 
@@ -455,7 +477,7 @@
                 //鑾峰彇缁勭粐ID
                 var SetHOrgID = $("#HOrgID").find("option:selected").val();
                 //椤甸潰灞�-鑷畾涔�
-                var url = '../../PublicPage/HSourceReportHtml.html?OperationType=3&linterid=' + SetHOrgID + '&HSouceBillType=' + getSupType() + '';
+                var url = '../../PublicPage/HSourceReportHtml.html?OperationType=3&HOrgID=' + SetHOrgID + '&HSouceBillType=' + getSupType() + '';
                 url = encodeURI(url);
                 //alert(url);
                 layer.open({
@@ -506,12 +528,17 @@
                                     HMaterID = result.list[0].HMaterID;
                                     HBatchNo = result.list[0].HBatchNo;
                                     if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
-                                        BatchNoArray = result.list;  //鑾峰彇鎵瑰彿锛岀敤鏉ョ粰鎵规鎸夐挳鍔熻兘涓殑鎵瑰彿璧嬪��
-
                                         for (let i = 0; i < result.list.length; i++) {
-                                            result.list[i].HMinQty = '';//鐐瑰嚮鍗曞厓鏍肩殑鏃跺�欓粯璁ゅ��0涓嶄細娓呴櫎锛屽鎴风湅浜嗕細瑙夊緱寰堟�紝鎵�浠ュ厛鐢ㄧ┖瀛楃涓插彇浠�;
+                                            result.list[i].HQty = result.list[i].HQty.toString().match(/^\d+(?:\.\d{0,6})?/)[0]  //淇濈暀灏忔暟鐐瑰悗鍏綅灏忔暟 
+                                            if (result.list[i].HMinQty != 0) {
+                                                result.list[i].HBQty = Math.ceil(result.list[i].HQty / result.list[i].HMinQty)            
+                                            }                                            
                                         }
-
+                                                                             
+                                        BatchNoArray = result.list;  //鑾峰彇鎵瑰彿锛岀敤鏉ョ粰鎵规鎸夐挳鍔熻兘涓殑鎵瑰彿璧嬪��
+                                        //for (let i = 0; i < result.list.length; i++) {
+                                        //    result.list[i].HMinQty = '';//鐐瑰嚮鍗曞厓鏍肩殑鏃跺�欓粯璁ゅ��0涓嶄細娓呴櫎锛屽鎴风湅浜嗕細瑙夊緱寰堟�紝鎵�浠ュ厛鐢ㄧ┖瀛楃涓插彇浠�;
+                                        //}
                                         table.reload('mainTable', {
                                             data: result.list // 璋冪敤table.reload 閲嶆柊娓叉煋鏄剧ず鍔犺浇杩藉姞浜嗘暟鎹殑琛ㄦ牸
                                         });
@@ -558,6 +585,7 @@
             form.on('submit(ToolCreate)', function (data) {
                 $('#ToolCreate').addClass("layui-btn-disabled").attr("disabled", true);//鐢熸垚鎸夐挳绂佺敤
                 var sSubStr = JSON.stringify(table.cache['mainTable']);
+                HMaterInfo = table.cache['mainTable'];
                 //鐗╂枡鏄庣粏淇℃伅涓嶄负绌哄垽鏂�
                 if (!AllowLoadData(sSubStr))//鏁版嵁楠岃瘉
                 {
@@ -577,8 +605,8 @@
                 //鑾峰彇閫夋嫨鐨勬潯鐮佺被鍨�
                 var HSelectBarCodeType = $("#HBarCodeType").find("option:selected").html();
                 //鑾峰彇褰撳墠鐧诲綍浜哄憳
-                //var UserName = sessionStorage["HUserName"];
-                var UserName = "Admin";
+                var UserName = sessionStorage["HUserName"];
+                //var UserName = "Admin";
                 var sMainSub = sSubStr + ';' + HOrgType + ';' + HSourceBillType + ';' + HSelectBarCodeType + ';' + CampanyName + ';' + UserName;
                 SaveBarCodeCreate(sMainSub);
             })
@@ -638,7 +666,7 @@
                         if (checkStatus.data.length === 0) {
                             return layer.msg('璇烽�夋嫨鏁版嵁');
                         }
-                        var arr = [{ HBillNo: '', HMaterNumber: checkStatus.data[0].鐗╂枡浠g爜, HMaterName: checkStatus.data[0].鐗╂枡鍚嶇О, HMaterModel: '', HAuxPropNumber: '', HAuxPropName: '', HUnitNumber: checkStatus.data[0].璁¢噺鍗曚綅浠g爜, HUnitName: checkStatus.data[0].璁¢噺鍗曚綅, HBatchNo: '', HGiveAwayFlag: '0', HQty: checkStatus.data[0].鏁伴噺, HMinQty: '0', HPackQty: '0', HBQty: '0', HDate: '', HCusNumber: '', HCusName: '', HSeOrderBillNo: '', HRemark: '' }]
+                        var arr = [{ HBillNo: '', HMaterNumber: checkStatus.data[0].鐗╂枡浠g爜, HMaterName: checkStatus.data[0].鐗╂枡鍚嶇О, HMaterModel: '', HAuxPropNumber: '', HAuxPropName: '', HUnitNumber: checkStatus.data[0].璁¢噺鍗曚綅浠g爜, HUnitName: checkStatus.data[0].璁¢噺鍗曚綅, HBatchNo: '', HGiveAwayFlag: '0', HQty: checkStatus.data[0].鏁伴噺.toString("#0.00"), HMinQty: checkStatus.data[0].鏈�灏忓寘瑁呮暟, HPackQty: '0', HBQty: '0', HDate: '', HCusNumber: '', HCusName: '', HSeOrderBillNo: '', HRemark: '' }]
                         //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                         table.reload('mainTable', {
                             data: arr // 璋冪敤table.reload 閲嶆柊娓叉煋鏄剧ず鍔犺浇杩藉姞浜嗘暟鎹殑琛ㄦ牸
@@ -793,7 +821,7 @@
             function set_InitGrid() {
                 columns = [
                     { type: 'checkbox', fixed: 'left' }
-                    , { templet: '#xuhao', title: '搴忓彿', sort: true, fixed: 'left', event: "qwe", width: 100 }
+                    , { templet: '#xuhao', title: '搴忓彿', sort: true, fixed: 'left', event: "qwe", width: 75 }
                     , { field: 'HMainID', title: '婧愬崟涓诲唴鐮�',  width: 100, hide: true }
                     , { field: 'HSubID', title: '婧愬崟瀛愬唴鐮�',  width: 100, hide: true }
                     , { field: 'HBillNo', title: '婧愬崟鍗曞彿', width: 200 }
@@ -801,34 +829,32 @@
                     , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', edit: 'text', event: 'HMaterNumber', width: 200 }
                     , { field: 'HMaterName', title: '鐗╂枡鍚嶇О',  width: 200 }
                     , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 200 }
+                    , { field: 'HBatchNo', title: '鎵瑰彿', edit: 'text', width: 100 }
+                    , { field: 'HQty', title: '鏁伴噺', edit: 'text', width: 100 }
+                    , { field: 'HMinQty', title: '鏈�灏忓寘瑁呮暟', edit: 'text', width: 100 }
+                    , { field: 'HBQty', title: '绠辨暟', width: 100 }
+                    , { field: 'HPackQty', title: '澶栫鏁�', edit: 'text', width: 100 }
+                    , { field: 'HCoilNO', title: '閽㈠嵎鎹嗗寘鍙�', edit: 'text', width: 100 }
+                    , { field: 'HFurnaceNO', title: '鐐夊彿', edit: 'text', width: 100 }
+                    , { field: 'HFactory', title: '鍘傚晢', edit: 'text', width: 100 }
+                    , { field: 'HCusID', title: '瀹㈡埛ID',  width: 100, hide: true }
+                    , { field: 'HCusNumber', title: '瀹㈡埛浠g爜', edit: 'text', event: 'HCusNumber', width: 120 }
+                    , { field: 'HCusName', title: '瀹㈡埛鍚嶇О', width: 120 }
+                    , { field: 'HSeOrderBillNo', title: '閿�鍞鍗曞彿', width: 200 }
+                    , { field: 'HRemark', title: '澶囨敞', edit: 'text', width: 100 }
+                    , { field: 'HProduceDate', title: '鐢熶骇鏃ユ湡', event: 'HProduceDate', width: 100 }
+                    , { field: 'HExpiryDate', title: '淇濊川鏈熻嚦', event: 'HExpiryDate', width: 100 }
+                    , { field: 'HheatNO', title: '鐑鐞�', edit: 'text', width: 100 }
                     , { field: 'HAuxPropID', title: '杈呭姪灞炴�D',  width: 100, hide: true }
                     , { field: 'HAuxPropNumber', title: '杈呭姪灞炴�т唬鐮�', edit: 'text', event: 'HAuxPropNumber', width: 100 }
                     , { field: 'HAuxPropName', title: '杈呭姪灞炴�у悕绉�',  width: 100 }
                     , { field: 'HUnitID', title: '璁¢噺鍗曚綅ID', width: 100, hide: true }
                     , { field: 'HUnitNumber', title: '璁¢噺鍗曚綅浠g爜', edit: 'text', event: 'HUnitNumber', width: 100 }
                     , { field: 'HUnitName', title: '璁¢噺鍗曚綅',width: 100 }
-                    , { field: 'HBatchNo', title: '鎵瑰彿', edit: 'text', width: 100 }
-
-                    , { field: 'HCoilNO', title: '閽㈠嵎鎹嗗寘鍙�', edit: 'text', width: 100 }
-                    , { field: 'HFurnaceNO', title: '鐐夊彿', edit: 'text', width: 100 }
-                    , { field: 'HFactory', title: '鍘傚晢', edit: 'text', width: 100 }
                     , { field: 'HAuxQty', title: '杈呭崟浣嶆暟閲�', edit: 'text', width: 100 }
-                    , { field: 'HheatNO', title: '鐑鐞�', edit: 'text', width: 100 }
-                    , { field: 'HProduceDate', title: '鐢熶骇鏃ユ湡', event: 'HProduceDate', width: 100 }
-                    , { field: 'HExpiryDate', title: '淇濊川鏈熻嚦', event: 'HExpiryDate', width: 100 }
                     , { field: 'HExpirationDateFlag', title: '鏄惁鍚敤淇濊川鏈�', width: 100, templet: '#switchTp3', unresize: false }
-
                     , { field: 'HGiveAwayFlag', title: '鏄惁璧犲搧', width: 100, templet: '#switchTpl', unresize: false }
-                    , { field: 'HQty', title: '鏁伴噺', edit: 'text', width: 100 }
-                    , { field: 'HMinQty', title: '鏈�灏忓寘瑁呮暟', edit: 'text', width: 100 }
-                    , { field: 'HBQty', title: '绠辨暟', width: 100 }
-                    , { field: 'HPackQty', title: '澶栫鏁�', edit: 'text', width: 100 }
                     , { field: 'HDate', title: '杩涙枡鏃ユ湡',  width: 100 }
-                    , { field: 'HCusID', title: '瀹㈡埛ID',  width: 100, hide: true }
-                    , { field: 'HCusNumber', title: '瀹㈡埛浠g爜', edit: 'text', event: 'HCusNumber', width: 120 }
-                    , { field: 'HCusName', title: '瀹㈡埛鍚嶇О', width: 120 }
-                    , { field: 'HSeOrderBillNo', title: '閿�鍞鍗曞彿', width: 200 }
-                    , { field: 'HRemark', title: '澶囨敞', edit: 'text', width: 100 }
                     , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo' }
                 ];
                 option = {
@@ -836,7 +862,7 @@
                     , elem: '#mainTable'
                     , toolbar: '#toolbarDemo'
                     , page: false
-                    , cellMinWidth: 120
+                    , cellMinWidth: 75
                     , height: 'full-325'
                     , cols: [columns]
                     , limit: 500 //姣忛〉榛樿鏄剧ず鐨勬暟閲�
@@ -1389,7 +1415,7 @@
                                 shift: 2,
                                 area: ['80%', '80%'],
                                 maxmin: true,
-                                content: ['../../Baseset/鍩虹璧勬枡/Gy_MaterialList_LSQP.html', 'yes'],
+                                content: ['../../Baseset/鍩虹璧勬枡/Gy_MaterialList.html', 'yes'],
                                 btn: ['纭畾', '鍙栨秷']
                                 , btn1: function (index, layero) {
 
@@ -1411,6 +1437,13 @@
                                         HUnitName: checkStatus.data[0].HUnitName
                                     });
 
+                                    if ($("#HBarCodeType").find("option:selected").html() == '鎵樼洏鏉$爜') {
+                                        obj.update({
+                                            HQty: 1,    //鏁伴噺
+                                            HMinQty: 1, //鏈�灏忓寘瑁呮暟閲�
+                                            HBQty: 1    //绠辨暟
+                                        });
+                                    }
                                     layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                                 }
                                 , btn2: function (index, layero) {
@@ -1570,12 +1603,14 @@
                                 table.reload('mainTable1', {
                                     data: result.list // 璋冪敤table.reload 閲嶆柊娓叉煋鏄剧ず鍔犺浇杩藉姞浜嗘暟鎹殑琛ㄦ牸
                                 });
+                                HBarInfo = result.list;
                                 //鐢熸垚鎴愬姛璺宠浆鍒版潯鐮佷俊鎭爣绛鹃〉
                                 element.tabChange('tab-TabTest', '3'); 
                                 //鍔犺浇妗f鍒楄〃
                                 table.reload('mainTable2', {
                                     data: result.data // 璋冪敤table.reload 閲嶆柊娓叉煋鏄剧ず鍔犺浇杩藉姞浜嗘暟鎹殑琛ㄦ牸
-                                });                               
+                                });
+                                HFileList = result.data; 
                             }
                             else {
                                 $('#ToolCreate').removeClass("layui-btn-disabled").attr("disabled", false);//鐢熸垚鎸夐挳鍚敤

--
Gitblit v1.9.1