diff --git a/src/views/modules/warehouse/ifsInventoryInit.vue b/src/views/modules/warehouse/ifsInventoryInit.vue index b793ef3..e71b064 100644 --- a/src/views/modules/warehouse/ifsInventoryInit.vue +++ b/src/views/modules/warehouse/ifsInventoryInit.vue @@ -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++ diff --git a/src/views/modules/warehouse/ifsInventory_upload_excel.vue b/src/views/modules/warehouse/ifsInventory_upload_excel.vue index f44b8e9..7963193 100644 --- a/src/views/modules/warehouse/ifsInventory_upload_excel.vue +++ b/src/views/modules/warehouse/ifsInventory_upload_excel.vue @@ -155,7 +155,7 @@ export default { const hasMore = errorMessages.length > 20 let html = '
以下数据导入失败:
' + html += '以下数据存在错误,本次未写入任何记录:
' html += '