Commit 375c9135 authored by jingnan's avatar jingnan 👀

打印标签相关代码修改

parent c18a3b0d
...@@ -70,6 +70,14 @@ export default { ...@@ -70,6 +70,14 @@ export default {
value: { value: {
type: [Number, String, Object], type: [Number, String, Object],
default: () => '' default: () => ''
},
formAttrs: {
type: Object,
default: () => {}
},
scope: {
type: Object,
default: () => {}
} }
}, },
data() { data() {
...@@ -189,7 +197,8 @@ export default { ...@@ -189,7 +197,8 @@ export default {
this.$api.searchApi('ExtDxProductWorkUnit', querys).then(res => { this.$api.searchApi('ExtDxProductWorkUnit', querys).then(res => {
this.options = res.items.content.map(row => { this.options = res.items.content.map(row => {
return { return {
value: row.id, // 批量移库打印标签需要使用到code
value: this.scope && this.scope.column && this.scope.column.property === 'currExtWorkUnitId' ? `${row.id}/${row.extcode}` : row.id,
label: row.extcode label: row.extcode
} }
}) })
...@@ -214,14 +223,16 @@ export default { ...@@ -214,14 +223,16 @@ export default {
if (querys.pageNumber === 1) { if (querys.pageNumber === 1) {
options = arr.map(row => { options = arr.map(row => {
return { return {
value: row.id, // 批量移库打印标签需要使用到code
value: this.scope && this.scope.column && this.scope.column.property === 'currExtWorkUnitId' ? `${row.id}/${row.extcode}` : row.id,
label: row.extcode label: row.extcode
} }
}) })
} else { } else {
options = [...this.options, ...arr.map(row => { options = [...this.options, ...arr.map(row => {
return { return {
value: row.id, // 批量移库打印标签需要使用到code
value: this.scope && this.scope.column && this.scope.column.property === 'currExtWorkUnitId' ? `${row.id}/${row.extcode}` : row.id,
label: row.extcode label: row.extcode
} }
})] })]
......
...@@ -59,7 +59,7 @@ export default { ...@@ -59,7 +59,7 @@ export default {
return { return {
inventoryId: item.id, inventoryId: item.id,
extWorkCenterId: extWorkCenterId, extWorkCenterId: extWorkCenterId,
extWorkUnitId: item.currExtWorkUnitId, extWorkUnitId: item.currExtWorkUnitId && item.currExtWorkUnitId.split('/') && Number(item.currExtWorkUnitId.split('/')[0]),
outsideAmount: item.currOutsideAmount, outsideAmount: item.currOutsideAmount,
disposeDes: item.currDisposeDes || '' disposeDes: item.currDisposeDes || ''
} }
...@@ -69,6 +69,7 @@ export default { ...@@ -69,6 +69,7 @@ export default {
} }
const reponse = await post('InventoryRequest/moveApplication/createMoveStorage', params) const reponse = await post('InventoryRequest/moveApplication/createMoveStorage', params)
this.$utils.showMessageSuccess(reponse.items) this.$utils.showMessageSuccess(reponse.items)
this.$bus.$emit('refreshMoveWarehouse')
this.$emit('cancel') this.$emit('cancel')
}, },
cancelEvent() { cancelEvent() {
......
...@@ -93,176 +93,313 @@ export default { ...@@ -93,176 +93,313 @@ export default {
tbPrintCode(selectRows) { tbPrintCode(selectRows) {
const selection = selectRows const selection = selectRows
if (selection[0].subTypeName === 'OutStorageMatchItem') { // 打印AO标签 if (selection[0].subTypeName === 'OutStorageMatchItem') { // 打印AO标签
const ids = selection.map((item) => item.outStorageRequestId) || [] this.printAoLabel(selection)
const params = { } else if (selection[0].subTypeName === 'InventoryFlow') { // 打印流水标签
'searchItems': { this.printFlowLable(selection)
'children': [ } else if (selection[0].subTypeName === 'Inventory') { // 打印移库标签
{ this.printMoveLibraryLabel(selection)
'items': [ } else if (selection[0].subTypeName === 'JobResponseOutStorageMatch') { // 批量签审_配套出库响应打印标签
{ this.printBatchSignMatchJob(selection)
'fieldName': 'extSupportings.outStorageRequests.id', } else if (selection[0].subTypeName.includes('OutStorage')) { // 打印出库标签
'operator': 'IN', this.printOutStorageLabel(selection)
'value': ids } else { // 打印入库标签
} this.printInStorageLabel(selection)
], }
'operator': 'OR' },
} printAoLabel(selection) {
], const ids = selection.map((item) => item.outStorageRequestId) || []
'items': [], const params = {
'operator': 'AND' 'searchItems': {
}, 'children': [
'openProps': [
{ {
'name': 'extSupportings', 'items': [
'openProps': [
{ {
'name': 'outStorageRequests', 'fieldName': 'extSupportings.outStorageRequests.id',
'openProps': [ 'operator': 'IN',
{ 'value': ids
'name': 'extWorkCenter'
}
]
}
]
}
]
}
post(`ExtProcessPlan/search`, params).then((res) => {
// 获取需要打印的数据
this.config.prints = []
res.items.content.forEach((item) => {
let extWorkCenterName = ''
if (item.extSupportings && item.extSupportings[0] && item.extSupportings[0].outStorageRequests && item.extSupportings[0].outStorageRequests.length) {
const selectedItems = []
const allWorkCenterName = item.extSupportings[0].outStorageRequests.map(el => el.extWorkCenter && el.extWorkCenter.extname || '') || []
allWorkCenterName.forEach(m => {
if (!selectedItems.find(d => d.id === m.id)) {
selectedItems.push(m)
} }
}) ],
extWorkCenterName = selectedItems.join(',') 'operator': 'OR'
} else {
extWorkCenterName = ''
} }
],
this.config = Object.assign({}, this.config, { 'items': [],
visible: true 'operator': 'AND'
}) },
this.config.prints.push({ 'openProps': [
text: item.id || '', {
propertys: [ 'name': 'extSupportings',
{ label: '机型', value: item.planeType }, 'openProps': [
{ label: '架次', value: item.sorties }, {
{ label: 'AO号', value: item.serialNumber }, 'name': 'outStorageRequests',
{ label: 'AO名称', value: item.name }, 'openProps': [
{ label: '库房', value: extWorkCenterName } {
] 'name': 'extWorkCenter'
}
]
}
]
}
]
}
post(`ExtProcessPlan/search`, params).then((res) => {
// 获取需要打印的数据
this.config.prints = []
res.items.content.forEach((item) => {
let extWorkCenterName = ''
if (item.extSupportings && item.extSupportings[0] && item.extSupportings[0].outStorageRequests && item.extSupportings[0].outStorageRequests.length) {
const selectedItems = []
const allWorkCenterName = item.extSupportings[0].outStorageRequests.map(el => el.extWorkCenter && el.extWorkCenter.extname || '') || []
allWorkCenterName.forEach(m => {
if (!selectedItems.find(d => d.id === m.id)) {
selectedItems.push(m)
}
}) })
extWorkCenterName = selectedItems.join(',')
} else {
extWorkCenterName = ''
}
this.config = Object.assign({}, this.config, {
visible: true
})
this.config.prints.push({
text: item.id || '',
propertys: [
{ label: '机型', value: item.planeType },
{ label: '架次', value: item.sorties },
{ label: 'AO号', value: item.serialNumber },
{ label: 'AO名称', value: item.name },
{ label: '库房', value: extWorkCenterName }
]
}) })
this.print()
}) })
.catch((err) => console.log(err)) })
.finally(() => {}) .catch((err) => console.log(err))
} else { .finally(() => {})
if (selection[0].subTypeName === 'InStorageMatchBackItem' || selection[0].subTypeName === 'InStorageUseBackItem' || selection[0].subTypeName === 'InStorageOutBackItem') { },
if (selection.find(item => !item.inventory || !item.inventory.workunit)) return this.$utils.showMessageWarning('请选择库位后打印!') printFlowLable(selection) {
// 获取需要打印的数据
this.config.prints = []
selection.forEach((item) => {
this.$message.closeAll()
this.config = Object.assign({}, this.config, {
visible: true
})
// 出库
if (item.flowType.includes('Out')) {
this.config.prints.push({
text: item.inJobResponseId || '',
propertys: [
{ label: '编码', value: item.materialName || '' },
{ label: '名称', value: item.materialCode || '' },
{
label: '型号/牌号/件号',
value: item.modelNo || ''
},
{ label: '规格', value: item.spec || '' },
{ label: '批号', value: item.lotNo || '' },
{ label: '系列号/序列号', value: item.serialNo || '' },
{ label: '机型', value: item.airModel || '' },
{ label: '验收单号', value: item.testNo || '' },
{ label: '保证保管期', value: item.guaranteePeriod &&
item.guaranteePeriod.replace(' 00:00:00', '') || '' },
{
label: '贮存期',
value:
item.qualityPeriod &&
item.qualityPeriod.replace(' 00:00:00', '') || ''
},
{ label: '库位号', value: item.workerUnit || '' },
{ label: '出库数量', value: item.amount || '' },
{
label: '计量单位',
value: item.unit || ''
},
{ label: 'AO号', value: item.seqNo && item.seqNo.split('-P') && item.seqNo.split('-P')[0] || '' },
{ label: '备注', value: item.remark || '' }
]
})
// 入库
} else {
this.config.prints.push({
text: item.inJobResponseId || '',
propertys: [
{ label: '编码', value: item.materialName || '' },
{ label: '名称', value: item.materialCode || '' },
{
label: '型号/牌号/件号',
value: item.modelNo || ''
},
{ label: '规格', value: item.spec || '' },
{ label: '批号', value: item.lotNo || '' },
{ label: '系列号/序列号', value: item.serialNo || '' },
{ label: '机型', value: item.airModel || '' },
{ label: '验收单号', value: item.testNo || '' },
{ label: '保证保管期', value: item.guaranteePeriod || '' },
{
label: '贮存期',
value:
item.qualityPeriod &&
item.qualityPeriod.replace(' 00:00:00', '')
},
{ label: '库位号', value: item.workerUnit || '' },
{ label: '备注', value: item.remark || '' }
]
})
} }
// 获取需要打印的数据 })
this.config.prints = [] this.print()
selection.forEach((row) => { },
// 出库数据打印对应的响应信息 printMoveLibraryLabel(selection) {
if (row.subTypeName === 'JobResponseOutStorageMatch') { if (selection.find(item => (!item.currExtWorkUnitId))) return this.$utils.showMessageWarning('请选择库位后打印!')
this.config = Object.assign({}, this.config, { // 获取需要打印的数据
visible: true this.config.prints = []
}) selection.forEach((item) => {
const jobOrderData = row.inventory && row.inventory.jobResponse && row.inventory.jobResponse.jobOrder || {} this.config = Object.assign({}, this.config, {
const jobResInTest = jobOrderData && jobOrderData.inventoryJobResponses && jobOrderData.inventoryJobResponses.find(job => job.subTypeName === 'JobResponseInTest') visible: true
this.config.prints.push({ })
text: row.id, this.config.prints.push({
propertys: [ text: item.jobResponseId || '',
{ label: '编码', value: jobOrderData.extMaterial.resCode }, propertys: [
{ label: '名称', value: jobOrderData.extMaterial.resName }, { label: '编码', value: item.materialName || '' },
{ label: '型号/牌号/件号', value: jobOrderData.extMaterial.modelNo }, { label: '名称', value: item.materialCode || '' },
{ label: '规格', value: jobOrderData.extMaterial.spec }, {
{ label: '批号', value: jobOrderData.lotNo }, label: '型号/牌号/件号',
{ label: '系列/序列号', value: jobOrderData.serialNo }, value: item.modelNo || ''
{ label: '机型', value: jobOrderData.airModel }, },
{ label: '验收单号', value: row.inventory && row.inventory.testNo }, { label: '规格', value: item.spec || '' },
{ label: '保证保管期', value: jobResInTest.guaranteePeriod && jobResInTest.guaranteePeriod.replace(' 00:00:00', '') }, { label: '批号', value: item.lotNo || '' },
{ label: '贮存期', value: jobResInTest.qualityPeriod && jobResInTest.qualityPeriod.replace(' 00:00:00', '') }, { label: '系列号/序列号', value: item.serno || '' },
{ label: '库位号', value: jobOrderData.workunit || '' }, { label: '机型', value: item.aircraftType || '' },
{ label: '出库数量', value: row.allocatedAmount || '' }, { label: '验收单号', value: item.testNo || '' },
{ { label: '保证保管期', value: item.guaranteePeriod || '' },
label: '计量单位', value: jobOrderData.extMaterial.extUnit.unitName || '' }, {
{ label: '贮存期',
label: 'AO号', value:
value: row.jobOrder && row.jobOrder.extSupportingItemVO && item.qualityPeriod &&
item.qualityPeriod.replace(' 00:00:00', '')
},
{ label: '库位号', value: item.currExtWorkUnitId && item.currExtWorkUnitId.split('/') && item.currExtWorkUnitId.split('/')[1] || '' },
{ label: '备注', value: item.remark || '' }
]
})
})
this.print()
},
printBatchSignMatchJob(selection) {
this.config.prints = []
selection.forEach((row) => {
this.config = Object.assign({}, this.config, {
visible: true
})
const jobOrderData = row.inventory && row.inventory.jobResponse && row.inventory.jobResponse.jobOrder || null
if (jobOrderData) {
const jobResInTest = jobOrderData.inventoryJobResponses && jobOrderData.inventoryJobResponses.find(job => job.subTypeName === 'JobResponseInTest')
this.config.prints.push({
text: row.id,
propertys: [
{ label: '编码', value: jobOrderData.extMaterial.resCode },
{ label: '名称', value: jobOrderData.extMaterial.resName },
{ label: '型号/牌号/件号', value: jobOrderData.extMaterial.modelNo },
{ label: '规格', value: jobOrderData.extMaterial.spec },
{ label: '批号', value: jobOrderData.lotNo },
{ label: '系列/序列号', value: jobOrderData.serialNo },
{ label: '机型', value: jobOrderData.airModel },
{ label: '验收单号', value: row.inventory && row.inventory.testNo },
{ label: '保证保管期', value: jobResInTest.guaranteePeriod && jobResInTest.guaranteePeriod.replace(' 00:00:00', '') },
{ label: '贮存期', value: jobResInTest.qualityPeriod && jobResInTest.qualityPeriod.replace(' 00:00:00', '') },
{ label: '库位号', value: jobOrderData.workunit || '' },
{ label: '出库数量', value: row.allocatedAmount || '' },
{
label: '计量单位', value: jobOrderData.extMaterial.extUnit.unitName || '' },
{
label: 'AO号',
value: row.jobOrder && row.jobOrder.extSupportingItemVO &&
row.jobOrder.extSupportingItemVO.extSupporting && row.jobOrder.extSupportingItemVO.extSupporting &&
row.jobOrder.extSupportingItemVO.extSupporting.extProcessPlan && row.jobOrder.extSupportingItemVO.extSupporting.extProcessPlan &&
row.jobOrder.extSupportingItemVO.extSupporting.extProcessPlan.serialNumber row.jobOrder.extSupportingItemVO.extSupporting.extProcessPlan.serialNumber
}, },
{ // {
label: '领用依据', // label: '领用依据',
value: // value:
row.jobOrder && row.jobOrder.outStorageRequest && row.jobOrder.outStorageRequest.reqBill // row.jobOrder && row.jobOrder.outStorageRequest && row.jobOrder.outStorageRequest.reqBill
}, // },
{ {
label: '备注', label: '备注',
value: jobOrderData.remark || '' value: jobOrderData.remark || ''
} }
] ]
}) })
// }) }
} else if (row.subTypeName.includes('OutStorage')) { })
const targetJobResponses = row.inventoryJobResponses.filter(item => item.subTypeName.includes('JobResponseOutStorage')) || [] this.print()
targetJobResponses.forEach((response) => { },
this.config = Object.assign({}, this.config, { printOutStorageLabel(selection) {
visible: true this.config.prints = []
}) selection.forEach((row) => {
const responseInventory = response.inventory || {} const targetJobResponses = row.inventoryJobResponses.filter(item => item.subTypeName.includes('JobResponseOutStorage')) || []
this.config.prints.push({ targetJobResponses.forEach((response) => {
text: response.id || row.id, this.config = Object.assign({}, this.config, {
propertys: [ visible: true
{ label: '编码', value: row.extMaterial.resCode }, })
{ label: '名称', value: row.extMaterial.resName }, const responseInventory = response.inventory || {}
{ label: '型号/牌号/件号', value: row.extMaterial.modelNo }, this.config.prints.push({
{ label: '规格', value: row.extMaterial.spec }, text: response.id || row.id,
{ label: '批号', value: responseInventory.lotNo }, propertys: [
{ label: '系列号/序列号', value: responseInventory.serno }, { label: '编码', value: row.extMaterial.resCode },
{ label: '机型', value: row.airModel }, { label: '名称', value: row.extMaterial.resName },
{ label: '验收单号', value: responseInventory.testNo }, { label: '型号/牌号/件号', value: row.extMaterial.modelNo },
{ label: '库位号', value: responseInventory.workunit || '' }, { label: '规格', value: row.extMaterial.spec },
{ label: '备注', value: row.remark || '' } { label: '批号', value: responseInventory.lotNo },
] { label: '系列号/序列号', value: responseInventory.serno },
}) { label: '机型', value: row.airModel },
}) { label: '验收单号', value: responseInventory.testNo },
} else { // 入库打印标签 { label: '库位号', value: responseInventory.workunit || '' },
this.config = Object.assign({}, this.config, { { label: '备注', value: row.remark || '' }
visible: true ]
}) })
let JobResponseInStorageEntryId = ''
// 打印标签二维码扫描结果展示入库响应的id
if (row.inventoryJobResponses && row.inventoryJobResponses.length) {
const entryResponse = row.inventoryJobResponses.find(el => el.subTypeName === 'JobResponseInEntry')
entryResponse && (JobResponseInStorageEntryId = entryResponse.id)
}
this.config.prints.push({
text: JobResponseInStorageEntryId || row.id,
propertys: [
{ label: '编码', value: row.extMaterial.resCode },
{ label: '名称', value: row.extMaterial.resName },
{ label: '型号/牌号/件号', value: row.extMaterial.modelNo },
{ label: '规格', value: row.extMaterial.spec },
{ label: '批号', value: row.lotNo },
{ label: '系列号/序列号', value: row.serialNo },
{ label: '机型', value: row.airModel },
{ label: '验收单号', value: row.inventory && row.inventory.testNo || row.testNo || '' },
{ label: '库位号', value: row.inventory && row.inventory.workunit || row.extWorkUnitCode || '' },
{ label: '备注', value: row.remark || '' }
]
})
}
}) })
})
this.print()
},
printInStorageLabel(selection) {
if (selection[0].subTypeName === 'InStorageMatchBackItem' || selection[0].subTypeName === 'InStorageUseBackItem' || selection[0].subTypeName === 'InStorageOutBackItem') {
if (selection.find(item => ((!item.inventory || !item.inventory.workunit) && !item.extWorkUnitCods))) return this.$utils.showMessageWarning('请选择库位后打印!')
} }
// 获取需要打印的数据
this.config.prints = []
selection.forEach((row) => {
this.config = Object.assign({}, this.config, {
visible: true
})
let JobResponseInStorageEntryId = ''
let testResponse = {}
let entryResponse = {}
// 打印标签二维码扫描结果展示入库响应的id
if (row.inventoryJobResponses && row.inventoryJobResponses.length) {
entryResponse = row.inventoryJobResponses.find(el => el.subTypeName === 'JobResponseInEntry')
testResponse = row.inventoryJobResponses.find(el => el.subTypeName === 'JobResponseInTest') || {}
entryResponse && (JobResponseInStorageEntryId = entryResponse.id)
}
this.config.prints.push({
text: JobResponseInStorageEntryId || row.id,
propertys: [
{ label: '编码', value: row.extMaterial.resCode },
{ label: '名称', value: row.extMaterial.resName },
{ label: '型号/牌号/件号', value: row.extMaterial.modelNo },
{ label: '规格', value: row.extMaterial.spec },
{ label: '批号', value: row.lotNo },
{ label: '系列号/序列号', value: row.serialNo },
{ label: '机型', value: row.airModel },
{ label: '验收单号', value: row.inventory && row.inventory.testNo || row.testNo || '' },
{ label: '保证保管期', value: testResponse.guaranteePeriod && testResponse.guaranteePeriod.replace(' 00:00:00', '') },
{ label: '贮存期', value: testResponse.qualityPeriod && testResponse.qualityPeriod.replace(' 00:00:00', '') },
{ label: '库位号', value: row.inventory && row.inventory.workunit || row.extWorkUnitCode || '' },
{ label: '备注', value: row.remark || '' }
]
})
})
this.print() this.print()
}, },
print() { print() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment