From 46cc7a29dc1f9b3dffee5cdcb9b7f9dfdac3b16d Mon Sep 17 00:00:00 2001
From: zrg <z1873@LAPTOP-EAVL132E>
Date: 星期五, 05 九月 2025 20:44:14 +0800
Subject: [PATCH] Merge branch 'Dev' of http://101.37.171.70:10101/r/~jhz/STUWMS into Dev

---
 pages/tiaomaguanli/table_son.vue |  188 +++++++++++++++++++++++++++++-----------------
 1 files changed, 118 insertions(+), 70 deletions(-)

diff --git a/pages/tiaomaguanli/table_son.vue b/pages/tiaomaguanli/table_son.vue
index 73530c1..dd9082e 100644
--- a/pages/tiaomaguanli/table_son.vue
+++ b/pages/tiaomaguanli/table_son.vue
@@ -55,14 +55,14 @@
                 <!-- <button class="btn-c" size="mini" type="default" @tap="searchLabelPrinter()">鎼滅储鎵撳嵃鏈�</button> -->
                 <!-- :disabled="codeGenComplete == false" -->
                 <button :class="codeGenComplete == false? 'btn-a': 'btn-c'" size="mini" type="default"
-                    @tap="search">鎵撳嵃</button>
+                    :disabled="codeGenComplete == false" @tap="search">鎵撳嵃</button>
             </view>
         </view>
 
         <view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
 
         <view class="list" v-for="(item,index) in listData" :key="index">
-            <uni-card :title="item.鐗╂枡浠g爜 || item.HMaterNumber" :extra="'No. ' + Number(index+1)" style="margin: 10px;">
+            <uni-card :title="item['鐗╂枡浠g爜']|| item.HMaterNumber" :extra="'No. ' + Number(index+1)" style="margin: 10px;">
                 <view class="card-detail">
                     <view class="detail">
                         <text>鐗╂枡鍚嶇О锛�</text>{{item.HMaterName || item['鐗╂枡鍚嶇О']}}
@@ -74,7 +74,7 @@
                         <text>鏁伴噺锛�</text>{{item.HQty || item['鏁伴噺']}}
                     </view>
                     <view class="detail" style="width: 100%;">
-                        <text>鏉$爜缂栧彿锛�</text>{{item.HBarCodeNo}}
+                        <text>鏉$爜缂栧彿锛�</text>{{item.HBarCodeNo || item['鏉$爜缂栧彿']}}
                     </view>
                 </view>
                 <!-- 				<view class="detail" style="text-align: right;" @tap.stop="labelPrint(item)"><text
@@ -159,12 +159,23 @@
                 baseInfo: {
                     HMainID: '',
                     HSubID: '',
-                    HBillNo: '',
+                    HSourceBillSEQ: null,
+                    HSourceBillNo: '',
                     HBillType: '',
                     HMaterID: '',
                     HMaterNumber: '',
                     HMaterName: '',
                     HMaterModel: '',
+                    HBillNo: '',
+                    "HModel": null,
+                    "HPinfan": null,
+                    "HPinfanBarCode": null,
+                    "HAuxPropID": null,
+                    "HAuxPropNumber": null,
+                    "HAuxPropName": null,
+                    HUnitID: '',
+                    "HUnitNumber": "",
+                    "HUnitName": "",
                     HQty: '',
                     HMinQty: '',
                     HSupID: '',
@@ -175,12 +186,10 @@
                     HSupID: '',
                     HSupNumber: '',
                     HSupName: '',
-                    HUnitID: '',
                     HPcsName: '',
                     HSupNameShort: '',
                     HMTONo: '',
                     HDate: '',
-                    HSourceBillNo: '',
                     HMaker: getUserInfo()["Czymc"],
                     HCoilNO: '',
                     HFurnaceNO: '',
@@ -273,7 +282,7 @@
                             this.baseInfo.HBQty = Math.ceil(this.baseInfo.HQty / this.baseInfo.HMinQty)
 
                             this.listData = data
-                            
+
                         } else {
                             uni.showToast({
                                 title: res.data.Message,
@@ -305,8 +314,8 @@
             getHMinQtyByBQty() {
                 if (this.baseInfo.HBQty && this.baseInfo.HBQty > 0) {
                     let minQty = Math.ceil(this.baseInfo.HQty / this.baseInfo.HBQty)
-                    
-                  
+
+
                     this.baseInfo.HMinQty = minQty
                     this.$forceUpdate()
                 } else {
@@ -316,7 +325,7 @@
                     })
                 }
             },
-            getList() {
+            async getList() {
                 let HBarCodeNoStrs = []
                 var sMain = []
                 // sMain = this.baseInfo
@@ -324,76 +333,85 @@
                 //鑾峰彇閫夋嫨鐨勭粍缁�
                 var HOrgType = uni.getStorageSync('Organization');
                 //鑾峰彇閫夋嫨鐨勫伐鍘備唬鐮�
-                var CampanyName = "xxx";
+                // var CampanyName = uni.getStorageSync('Organization');
+                var CampanyName = "鍏磋揪鏉$爜";
                 //鑾峰彇閫夋嫨鐨勬簮鍗曠被鍨�
                 var HSourceBillType = "鏀舵枡閫氱煡鍗�";
                 //鑾峰彇閫夋嫨鐨勬潯鐮佺被鍨�
-                var HSelectBarCodeType = "鍝佺鏉$爜";
+                var HSelectBarCodeType = "鍞竴鏉$爜";
+
+                if (uni.getStorageSync('Organization').includes('娴疯瘹')) {
+                    HSelectBarCodeType = "鍝佺鏉$爜";
+                }
                 //鑾峰彇褰撳墠鐧诲綍浜哄憳
                 var UserName = uni.getStorageSync('HUserName');
-                let listDataTemp = []
-                for (let receiveQty = this.baseInfo.HQty; receiveQty > 0; receiveQty -= this.baseInfo.HMinQty) {
-                    let baseInfoClone = JSON.parse(JSON.stringify(this.baseInfo))
-                    let barCodeNo = ''
-                    if (receiveQty - this.baseInfo.HMinQty >= 0) {
-                        listDataTemp.push(Object.assign(baseInfoClone, {
-                            HQty: this.baseInfo.HMinQty,
-                            HInterID: receiveQty + 1,
-                            HBatchNo: '',
-                            HMTONo: '',
-                        }))
-                    } else {
-                        listDataTemp.push(Object.assign(baseInfoClone, {
-                            HQty: receiveQty % this.baseInfo.HMinQty,
-                            HInterID: receiveQty + 1,
-                            HBatchNo: '',
-                            HMTONo: '',
-                        }))
-                    }
-                    barCodeNo =
-                        `${baseInfoClone.HBillNo}@${baseInfoClone.HSubID}@${baseInfoClone.HMaterNumber || ''}@${baseInfoClone.HMTONo || ''}@${baseInfoClone.HQty || 0}`
-                    listDataTemp[listDataTemp.length - 1]['HBarCodeNo'] = barCodeNo
-                    HBarCodeNoStrs.push(
-                        barCodeNo
-                    )
+                // let listDataTemp = []
+                // let i = 0
+                // let barCodeTemplate = await this.getBarCodeTemplate()
+                // for (let receiveQty = this.baseInfo.HQty; receiveQty > 0; receiveQty -= this.baseInfo.HMinQty) {
+                //     i++
+                //     let baseInfoClone = JSON.parse(JSON.stringify(this.baseInfo))
+                //     let barCodeNo = ''
+                //     if (receiveQty - this.baseInfo.HMinQty >= 0) {
+                //         listDataTemp.push(Object.assign(baseInfoClone, {
+                //             HQty: this.baseInfo.HMinQty,
+                //             HInterID: receiveQty + 1,
+                //             HBatchNo: this.baseInfo.HBatchNo,
+                //             HMTONo: this.baseInfo.HMTONo,
+                //         }))
+                //     } else {
+                //         listDataTemp.push(Object.assign(baseInfoClone, {
+                //             HQty: receiveQty % this.baseInfo.HMinQty,
+                //             HInterID: receiveQty + 1,
+                //             HBatchNo: '',
+                //             HMTONo: '',
+                //         }))
+                //     }
 
-                }
+                //     barCodeNo = CommonUtils.replaceWithFunction(barCodeTemplate.Format, (key) => {
+                //       // 鑷畾涔夊鐞嗛�昏緫
+                //       let date = new Date()
+                //       if (key === 'FlowNumber'){
+                //           // 娴佹按鍙� 璁剧疆涓嶅悓鐨勬祦姘村彿鐢熸垚閫昏緫 TODO 閫氳繃鍚庣鑾峰彇娴佹按鍙�
+                //           return `${date.getFullYear().toString()}${(date.getMonth() + 1).toString()}${date.getDate().toString()}${i.toString().padStart(3, '0')}`
+                //       } 
+                //       else {
+                //           return baseInfoClone[key]
+                //       }
 
-                this.listData = listDataTemp
-                console.log(listDataTemp)
-                HBarCodeNoStrs = JSON.stringify(HBarCodeNoStrs)
-                sMain = listDataTemp
-                let sMainStr = JSON.stringify(listDataTemp)
+                //     });     
+
+                //     listDataTemp[listDataTemp.length - 1]['HBarCodeNo'] = barCodeNo
+                //     HBarCodeNoStrs.push(
+                //         barCodeNo
+                //     )
+
+                // }
+                // console.log('listDataTemp: ',listDataTemp);
+                // this.listData = listDataTemp
+                // console.log(listDataTemp)
+                // HBarCodeNoStrs = JSON.stringify(HBarCodeNoStrs)
+                // sMain = listDataTemp
+                let sMainStr = JSON.stringify([this.baseInfo])
                 let sMainSub = `${sMainStr};${HOrgType};${HSourceBillType};${HSelectBarCodeType};${CampanyName};${UserName};${HBarCodeNoStrs};${this.baseInfo.HFactory || ''};${this
-                    .baseInfo.HCoilNO || ''}; ${this.baseInfo.HFurnaceNO || ''}` 
-                console.log('sMainSub: ',sMainSub);
+                    .baseInfo.HCoilNO || ''}; ${this.baseInfo.HFurnaceNO || ''}`
+                console.log('sMainSub: ', sMainSub);
                 uni.showLoading()
                 uni.request({
-                    url: this.serverUrl + '/Sc_BarCode/SaveBarCode_NoGenerate_Batch',
+                    url: this.serverUrl + '/Sc_BarCode/Sub_SaveBill',
                     method: 'POST',
                     data: {
                         msg: sMainSub,
-                        CampanyName: CampanyName
                     },
                     success: (res) => {
                         if (res.data.count == 1) {
-                            if(res.data.code == 2) {
-                                // 鏁版嵁宸插瓨鍦ㄧ殑鎯呭喌
-                                this.listData = Array.from(res.data.data).map(item => {
-                                      let baseInfoClone = JSON.parse(JSON.stringify(this.baseInfo))
-                                      return Object.assign(baseInfoClone, {
-                                          HQty: item['HQty'],
-                                          HBarCodeNo: item['HBarCode']
-                                      })
-                        
-                                })
-                            }else {
-                                this.codeGenComplete = true
-                                uni.showToast({
-                                    title: res.data.Message,
-                                    icon: 'none'
-                                })
-                            }
+                            this.listData = res.data.data
+                            this.codeGenComplete = true
+                            uni.showToast({
+                                title: res.data.Message,
+                                icon: 'none'
+                            })
+
                         } else {
                             uni.showToast({
                                 title: res.data.Message,
@@ -412,6 +430,36 @@
                         uni.hideLoading()
                     }
                 });
+            },
+            async getBarCodeTemplate() {
+                return new Promise((resolve, reject) => {
+                    CommonUtils.doRequest2({
+                        url: "/Sc_BarCode/Get_BarCodeGenTemplate",
+                        data: {
+                            HOrginationName: uni.getStorageSync("Organization"),
+                            HBillSubType: '1103'
+                        },
+                        resFunction: (res) => {
+                            let {
+                                data,
+                                count,
+                                Message
+                            } = res.data
+                            if (count == 1) {
+                                resolve(JSON.parse(data))
+                            } else {
+                                uni.showToast({
+                                    icon: 'none',
+                                    title: Message
+                                })
+                                reject()
+                            }
+                        },
+                        errFunction: () => {
+                            reject()
+                        }
+                    })
+                })
             },
             async checkPermission() { // 鎺堟潈
                 try {
@@ -447,6 +495,7 @@
                     let printInfoBuffer = []
                     let count = 0
                     uni.showLoading()
+                    console.log('this.listData: ', this.listData);
                     for (let listOne of this.listData) {
                         //                         let pcsInfo = this.baseInfo.HPcsName ? '(' + this.baseInfo.HPcsName + ')' : ''
                         //                         let HFurnaceNO = this.baseInfo.HFurnaceNO.split('.')
@@ -494,7 +543,7 @@
                         // T 55 0 440 370 (Spec. accepted) 
                         // FORM
                         // PRINT`)
-                        let Message = await this.getPrintTemplate(listOne.HMainID)
+                        let Message = await this.getPrintTemplate(listOne.HInterID, listOne.HItemID)
                         printContent.push(Message)
                         count++;
                         if (count == 10) {
@@ -513,17 +562,16 @@
                     })
                 }
             },
-            async getPrintTemplate(HInterID) {
+            async getPrintTemplate(HInterID,HItemID) {
                 return new Promise((resolve, reject) => {
                     CommonUtils.doRequest2({
                         url: "/Sc_BarCode/Get_BarCodePrintCode_CPCL",
                         data: {
                             HOrginationName: uni.getStorageSync("Organization"),
-                            HBillInterID: this.linterid,
-                            HBillEntryID: this.HEntryID,
                             HViewName: 'h_v_IF_POInStockBillList',
-                            HBillSubType: '1203',
-                            HInterID: HInterID
+                            HBillSubType: '1103',
+                            HInterID: HInterID,
+                            HItemID: HItemID,
                         },
                         resFunction: (res) => {
                             let {

--
Gitblit v1.9.1