From bfc171016871112d31eca43f9163f5c3663c66e8 Mon Sep 17 00:00:00 2001 From: qiezi <15576055375@163.com> Date: Fri, 12 Jul 2024 17:26:45 +0800 Subject: [PATCH] roll label --- src/api/category/{categoty.js => category.js} | 1 + src/views/modules/label/printer.vue | 102 ++++++++++++------ src/views/modules/part/external.vue | 24 +++-- src/views/modules/sys/user.vue | 4 +- 4 files changed, 92 insertions(+), 39 deletions(-) rename src/api/category/{categoty.js => category.js} (64%) diff --git a/src/api/category/categoty.js b/src/api/category/category.js similarity index 64% rename from src/api/category/categoty.js rename to src/api/category/category.js index 3a1c97d..4787fb3 100644 --- a/src/api/category/categoty.js +++ b/src/api/category/category.js @@ -1,3 +1,4 @@ import {createAPI} from '../../utils/httpRequest' export const getCategoryList = (data) => createAPI('part/category/list','post', data) +export const getCategory = (data) => createAPI('part/category','post', data) diff --git a/src/views/modules/label/printer.vue b/src/views/modules/label/printer.vue index c4ca7c6..91af4f6 100644 --- a/src/views/modules/label/printer.vue +++ b/src/views/modules/label/printer.vue @@ -16,7 +16,7 @@ import {printRF_RFIDLabel} from '../../../printFormat/RF_RFID' import getLodop from '@/utils/LodopFuncs.js' import {getTableDefaultListLanguage, getTableUserListLanguage} from '../../../api/table' -import {getCategoryList} from '../../../api/category/categoty' +import {getCategory, getCategoryList} from '../../../api/category/category' import QrCode from './QrCode.vue' import {savePrintRollLabelRecord} from '../../../api/label/printRollLabelRecord' import {print_roll_label} from '../../../printFormat/roll_label' @@ -53,6 +53,7 @@ export default { }, data(){ return{ + rowSpan: 8, printerSetupList:[], currentPrinter: '', printType: 'alphaHardTag', @@ -548,8 +549,28 @@ export default { }, handlePrint(status){ this.printCurrentPart = JSON.parse(JSON.stringify(this.currentPart)) + let labelList = []; + if (status === 1){ + labelList = this.labelFormatList.filter((item)=> item.labelType === 'Roll Label') + this.printCurrentPart.rollsPerCarton = 1; + this.$set(this.printCurrentPart,'orderNo','') + }else { + labelList = this.labelFormatList.filter((item)=> item.labelType === 'Shipment Carton') + } + if (labelList.length === 0){ + this.$message.warning("There is no maintenance of print label format") + return + } + for (let label of labelList) { + if (!label.defaultPrinterName){ + this.$message.warning("The default printer name is not set") + return + } + } + this.status = status; this.$set(this.printCurrentPart,'cartonCount',1) this.$set(this.printCurrentPart,'manufacturerNo','') + this.$set(this.printCurrentPart,'totalShipQty',undefined) this.$set(this.printCurrentPart,'moldCode','') this.$set(this.printCurrentPart,'serialNumber',undefined) this.$set(this.printCurrentPart,'manufacturerTime',dayjs().format('YYYY-MM-DD HH:mm:ss')) @@ -562,6 +583,7 @@ export default { this.printCurrentPart.qtyPerCarton = this.currentPart.qtyPerCarton; this.printCurrentPart.qtyPerRoll = this.currentPart.qtyPerRoll; this.printCurrentPart.rollsPerCarton = this.currentPart.rollsPerCarton; + this.printCurrentPart.totalShipQty = this.totalShipQty(); } if (this.currentPart.manufacturerRequired === 'Y'){ // 查询所有的 manufacturer @@ -570,26 +592,44 @@ export default { if (this.currentPart.moldCodeRequired === 'Y'){ this.printCurrentPart.moldCode = this.currentPart.moldCode; } - let labelList = []; - if (status === 1){ - labelList = this.labelFormatList.filter((item)=> item.labelType === 'Roll Label') - this.printCurrentPart.rollsPerCarton = 1; - this.$set(this.printCurrentPart,'orderNo','') - }else { - labelList = this.labelFormatList.filter((item)=> item.labelType === 'Shipment Carton') - } - if (labelList.length === 0){ - this.$message.warning("There is no maintenance of print label format") - return + // 获取 category + let params = { + categoryValue: this.currentPart.category, } - for (let label of labelList) { - if (!label.defaultPrinterName){ - this.$message.warning("The default printer name is not set") - return + getCategory(params).then(({data})=>{ + if (data && data.code === 0){ + this.$set(this.printCurrentPart,'qtyPerRollLabel',data.data.qtyPerRollLabel) + this.$set(this.printCurrentPart,'cartonCountLabel',data.data.cartonCountLabel) + this.$set(this.printCurrentPart,'rollCountLabel',data.data.rollCountLabel) + this.$set(this.printCurrentPart,'showCartonQtyPerRoll',data.data.showCartonQtyPerRoll) + this.$set(this.printCurrentPart,'showCartonRollsPerCarton',data.data.showCartonRollsPerCarton) + this.$set(this.printCurrentPart,'showRollQtyPerRoll',data.data.showRollQtyPerRoll) + this.$set(this.printCurrentPart,'editQtyPerCarton',data.data.editQtyPerCarton) + this.printRules.qtyPerRoll[0].message = `Please input ${data.data.qtyPerRollLabel}` + if (this.status === 0){ + if (data.data.showCartonRollsPerCarton === 'N' && data.data.showCartonQtyPerRoll === 'N'){ + this.rowSpan = 8 + }else if (data.data.showCartonRollsPerCarton === 'N' || data.data.showCartonQtyPerRoll === 'N'){ + this.rowSpan = 6 + }else { + this.rowSpan = 5 + } + this.printRules.cartonCount[0].message = `Please input ${data.data.cartonCountLabel}` + }else { + if (data.data.showRollQtyPerRoll === 'N'){ + this.rowSpan = 12 + }else { + this.rowSpan = 8 + } + this.printRules.cartonCount[0].message = `Please input ${data.data.rollCountLabel}` + } + this.printVisible = true; + }else { + this.$message.warning(data.msg) } - } - this.status = status; - this.printVisible = true; + }).catch((error)=>{ + this.$message.error(error) + }) }, getExternalPartManufacturerList(){ let params = { @@ -988,7 +1028,7 @@ export default { - + @@ -997,15 +1037,15 @@ export default { - - + + - + - + @@ -1013,23 +1053,23 @@ export default { - + - + - + - - + + - + - + diff --git a/src/views/modules/part/external.vue b/src/views/modules/part/external.vue index 43866f3..12504df 100644 --- a/src/views/modules/part/external.vue +++ b/src/views/modules/part/external.vue @@ -15,7 +15,7 @@ import LinkedManufacturer from './manufacturer/linkedManufacturer.vue' import {getExternalPartManufacturerList} from '../../../api/part/externalPartManufacturer' import {getTableDefaultListLanguage, getTableUserListLanguage} from '../../../api/table' import {Decimal} from 'decimal.js' -import {getCategoryList} from '../../../api/category/categoty' +import {getCategoryList} from '../../../api/category/category' let part = { site:'', @@ -57,6 +57,7 @@ export default { partCategoryList:[ ], + category:{}, partRules:{ partNo: [{ required: true, message: 'Please input Part No', trigger: ['blur','change'] }], partDesc: [{ required: true, message: 'Please input Part Description', trigger: ['blur','change'] }], @@ -711,8 +712,15 @@ export default { if (this.savePart.serialNumberRequired === 'Y'){ this.savePart.qtyPerRoll = 1; this.savePart.rollsPerCarton = 1; - this.savePart.qtyPerCarton = 1; } + if (category.showCartonQtyPerRoll === 'N'){ + this.savePart.qtyPerRoll = 1; + } + if (category.showCartonRollsPerCarton === 'N'){ + this.savePart.rollsPerCarton = 1; + } + this.savePart.qtyPerCarton = this.qtyPerCarton(); + this.category = JSON.parse(JSON.stringify(category)) } }, "part.partNo"(newVal,oldVal){ @@ -1142,21 +1150,25 @@ export default { - - + + + + - + - + + + diff --git a/src/views/modules/sys/user.vue b/src/views/modules/sys/user.vue index 151f764..be0c0a3 100644 --- a/src/views/modules/sys/user.vue +++ b/src/views/modules/sys/user.vue @@ -4,7 +4,7 @@ - + @@ -562,7 +562,7 @@ export default { } }, created() { - if (this.$store.state.user.userType !== 'GlobalAdmin' && this.$store.state.user.id !== 1){ + if (this.$store.state.user.userType !== 'Global Admin' && this.$store.state.user.id !== 1){ this.dataForm.site = this.$store.state.user.site } this.getFunctionButtonList()