|
|
|
@ -761,8 +761,8 @@ export default { |
|
|
|
printLabelType = 'BIL标签'; |
|
|
|
} |
|
|
|
|
|
|
|
// 创建成功后进行打印 |
|
|
|
this.printHandlingUnits(data.unitIds, printLabelType) |
|
|
|
// 同一行拆出的多个HU共用该行站点,不能用登录缓存站点。 |
|
|
|
this.printHandlingUnits(data.unitIds, printLabelType, this.createHuForm.site) |
|
|
|
|
|
|
|
this.createHuVisible = false |
|
|
|
this.getDataList() |
|
|
|
@ -779,8 +779,8 @@ export default { |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 打印HandlingUnit标签 |
|
|
|
async printHandlingUnits (unitIds,printLabelType) { |
|
|
|
// 打印HandlingUnit标签。site 必须是创建该批HU的库存行站点。 |
|
|
|
async printHandlingUnits (unitIds, printLabelType, site) { |
|
|
|
if (!unitIds || unitIds.length === 0) { |
|
|
|
return |
|
|
|
} |
|
|
|
@ -788,7 +788,7 @@ export default { |
|
|
|
try { |
|
|
|
// 逐个打印每个HandlingUnit |
|
|
|
for (const unitId of unitIds) { |
|
|
|
await this.printViaServer(unitId,printLabelType) |
|
|
|
await this.printViaServer(unitId, printLabelType, site) |
|
|
|
} |
|
|
|
this.$message({ |
|
|
|
message: `成功打印 ${unitIds.length} 个HandlingUnit标签`, |
|
|
|
@ -799,8 +799,11 @@ export default { |
|
|
|
this.$alert('打印失败: ' + error.message, this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') }) |
|
|
|
} |
|
|
|
}, |
|
|
|
// 通过服务器打印 |
|
|
|
async printViaServer(unitId,printLabelType) { |
|
|
|
// 通过服务器打印。站点取库存行,列表可能跨工厂,登录缓存站点会打到错误工厂。 |
|
|
|
async printViaServer(unitId, printLabelType, site) { |
|
|
|
if (!site) { |
|
|
|
return Promise.reject(new Error('行站点为空,无法打印')) |
|
|
|
} |
|
|
|
try { |
|
|
|
const printRequest = { |
|
|
|
reportId: this.reportId, |
|
|
|
@ -810,7 +813,7 @@ export default { |
|
|
|
dpi: this.dpi, |
|
|
|
userId: localStorage.getItem('userName'), |
|
|
|
username: localStorage.getItem('userName'), |
|
|
|
site: localStorage.getItem('site'), |
|
|
|
site: site, |
|
|
|
unitId: unitId, |
|
|
|
labelType: printLabelType |
|
|
|
} |
|
|
|
@ -1004,7 +1007,7 @@ export default { |
|
|
|
cancelButtonText: '不打印', |
|
|
|
type: 'info' |
|
|
|
}).then(() => { |
|
|
|
this.batchPrintLabels(unitIds) |
|
|
|
this.batchPrintLabels(unitIds, items.map(item => item.site)) |
|
|
|
}).catch(() => { |
|
|
|
// 不打印,直接刷新列表 |
|
|
|
this.getDataList() |
|
|
|
@ -1022,9 +1025,9 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 批量打印标签 |
|
|
|
* 批量打印标签。sites 与 unitIds 同序,对应每条选中库存行的站点。 |
|
|
|
*/ |
|
|
|
async batchPrintLabels(unitIds) { |
|
|
|
async batchPrintLabels(unitIds, sites) { |
|
|
|
const loading = this.$loading({ |
|
|
|
lock: true, |
|
|
|
text: '正在打印标签,请稍候...', |
|
|
|
@ -1044,7 +1047,8 @@ export default { |
|
|
|
try { |
|
|
|
// 根据物料编码判断标签类型(这里简化处理,使用默认值) |
|
|
|
const printLabelType = 'BIL标签' |
|
|
|
await this.printViaServer(unitId, printLabelType) |
|
|
|
const site = sites && sites[i] |
|
|
|
await this.printViaServer(unitId, printLabelType, site) |
|
|
|
successCount++ |
|
|
|
} catch (error) { |
|
|
|
failCount++ |
|
|
|
|