Commit 375c9135 authored by jingnan's avatar jingnan 👀

打印标签相关代码修改

parent c18a3b0d
......@@ -70,6 +70,14 @@ export default {
value: {
type: [Number, String, Object],
default: () => ''
},
formAttrs: {
type: Object,
default: () => {}
},
scope: {
type: Object,
default: () => {}
}
},
data() {
......@@ -189,7 +197,8 @@ export default {
this.$api.searchApi('ExtDxProductWorkUnit', querys).then(res => {
this.options = res.items.content.map(row => {
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
}
})
......@@ -214,14 +223,16 @@ export default {
if (querys.pageNumber === 1) {
options = arr.map(row => {
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
}
})
} else {
options = [...this.options, ...arr.map(row => {
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
}
})]
......
......@@ -59,7 +59,7 @@ export default {
return {
inventoryId: item.id,
extWorkCenterId: extWorkCenterId,
extWorkUnitId: item.currExtWorkUnitId,
extWorkUnitId: item.currExtWorkUnitId && item.currExtWorkUnitId.split('/') && Number(item.currExtWorkUnitId.split('/')[0]),
outsideAmount: item.currOutsideAmount,
disposeDes: item.currDisposeDes || ''
}
......@@ -69,6 +69,7 @@ export default {
}
const reponse = await post('InventoryRequest/moveApplication/createMoveStorage', params)
this.$utils.showMessageSuccess(reponse.items)
this.$bus.$emit('refreshMoveWarehouse')
this.$emit('cancel')
},
cancelEvent() {
......
......@@ -93,176 +93,313 @@ export default {
tbPrintCode(selectRows) {
const selection = selectRows
if (selection[0].subTypeName === 'OutStorageMatchItem') { // 打印AO标签
const ids = selection.map((item) => item.outStorageRequestId) || []
const params = {
'searchItems': {
'children': [
{
'items': [
{
'fieldName': 'extSupportings.outStorageRequests.id',
'operator': 'IN',
'value': ids
}
],
'operator': 'OR'
}
],
'items': [],
'operator': 'AND'
},
'openProps': [
this.printAoLabel(selection)
} else if (selection[0].subTypeName === 'InventoryFlow') { // 打印流水标签
this.printFlowLable(selection)
} else if (selection[0].subTypeName === 'Inventory') { // 打印移库标签
this.printMoveLibraryLabel(selection)
} else if (selection[0].subTypeName === 'JobResponseOutStorageMatch') { // 批量签审_配套出库响应打印标签
this.printBatchSignMatchJob(selection)
} else if (selection[0].subTypeName.includes('OutStorage')) { // 打印出库标签
this.printOutStorageLabel(selection)
} else { // 打印入库标签
this.printInStorageLabel(selection)
}
},
printAoLabel(selection) {
const ids = selection.map((item) => item.outStorageRequestId) || []
const params = {
'searchItems': {
'children': [
{
'name': 'extSupportings',
'openProps': [
'items': [
{
'name': 'outStorageRequests',
'openProps': [
{
'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)
'fieldName': 'extSupportings.outStorageRequests.id',
'operator': 'IN',
'value': ids
}
})
extWorkCenterName = selectedItems.join(',')
} else {
extWorkCenterName = ''
],
'operator': 'OR'
}
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 }
]
],
'items': [],
'operator': 'AND'
},
'openProps': [
{
'name': 'extSupportings',
'openProps': [
{
'name': 'outStorageRequests',
'openProps': [
{
'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(() => {})
} else {
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('请选择库位后打印!')
})
.catch((err) => console.log(err))
.finally(() => {})
},
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 = []
selection.forEach((row) => {
// 出库数据打印对应的响应信息
if (row.subTypeName === 'JobResponseOutStorageMatch') {
this.config = Object.assign({}, this.config, {
visible: true
})
const jobOrderData = row.inventory && row.inventory.jobResponse && row.inventory.jobResponse.jobOrder || {}
const jobResInTest = jobOrderData && 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 &&
})
this.print()
},
printMoveLibraryLabel(selection) {
if (selection.find(item => (!item.currExtWorkUnitId))) return this.$utils.showMessageWarning('请选择库位后打印!')
// 获取需要打印的数据
this.config.prints = []
selection.forEach((item) => {
this.config = Object.assign({}, this.config, {
visible: true
})
this.config.prints.push({
text: item.jobResponseId || '',
propertys: [
{ label: '编码', value: item.materialName || '' },
{ label: '名称', value: item.materialCode || '' },
{
label: '型号/牌号/件号',
value: item.modelNo || ''
},
{ label: '规格', value: item.spec || '' },
{ label: '批号', value: item.lotNo || '' },
{ label: '系列号/序列号', value: item.serno || '' },
{ label: '机型', value: item.aircraftType || '' },
{ label: '验收单号', value: item.testNo || '' },
{ label: '保证保管期', value: item.guaranteePeriod || '' },
{
label: '贮存期',
value:
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.extProcessPlan &&
row.jobOrder.extSupportingItemVO.extSupporting.extProcessPlan.serialNumber
},
{
label: '领用依据',
value:
row.jobOrder && row.jobOrder.outStorageRequest && row.jobOrder.outStorageRequest.reqBill
},
{
label: '备注',
value: jobOrderData.remark || ''
}
]
})
// })
} else if (row.subTypeName.includes('OutStorage')) {
const targetJobResponses = row.inventoryJobResponses.filter(item => item.subTypeName.includes('JobResponseOutStorage')) || []
targetJobResponses.forEach((response) => {
this.config = Object.assign({}, this.config, {
visible: true
})
const responseInventory = response.inventory || {}
this.config.prints.push({
text: response.id || 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: responseInventory.lotNo },
{ label: '系列号/序列号', value: responseInventory.serno },
{ label: '机型', value: row.airModel },
{ label: '验收单号', value: responseInventory.testNo },
{ label: '库位号', value: responseInventory.workunit || '' },
{ label: '备注', value: row.remark || '' }
]
})
})
} else { // 入库打印标签
this.config = Object.assign({}, this.config, {
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 || '' }
]
})
}
},
// {
// label: '领用依据',
// value:
// row.jobOrder && row.jobOrder.outStorageRequest && row.jobOrder.outStorageRequest.reqBill
// },
{
label: '备注',
value: jobOrderData.remark || ''
}
]
})
}
})
this.print()
},
printOutStorageLabel(selection) {
this.config.prints = []
selection.forEach((row) => {
const targetJobResponses = row.inventoryJobResponses.filter(item => item.subTypeName.includes('JobResponseOutStorage')) || []
targetJobResponses.forEach((response) => {
this.config = Object.assign({}, this.config, {
visible: true
})
const responseInventory = response.inventory || {}
this.config.prints.push({
text: response.id || 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: responseInventory.lotNo },
{ label: '系列号/序列号', value: responseInventory.serno },
{ label: '机型', value: row.airModel },
{ label: '验收单号', value: responseInventory.testNo },
{ label: '库位号', value: responseInventory.workunit || '' },
{ 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()
},
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