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 += '

以下数据存在错误,本次未写入任何记录:

' html += '
    ' displayMessages.forEach(msg => { @@ -250,7 +250,7 @@ export default { if (errorMessages.length > 0) { // 有错误信息,使用弹窗显示详细错误列表 const errorHtml = this.formatErrorMessages(errorMessages) - this.$alert(errorHtml, '导入完成(部分数据失败)', { + this.$alert(errorHtml, '导入失败(未写入任何数据)', { confirmButtonText: this.$t('warehouse.common.confirm'), dangerouslyUseHTMLString: true, customClass: 'import-error-dialog' diff --git a/src/views/modules/warehouse/labelQuery.vue b/src/views/modules/warehouse/labelQuery.vue index 44da1bd..5191b90 100644 --- a/src/views/modules/warehouse/labelQuery.vue +++ b/src/views/modules/warehouse/labelQuery.vue @@ -749,6 +749,11 @@ export default { } else { printLabelType = 'BIL标签'; } + // 列表可能跨工厂,补打必须用该行站点,不能用登录缓存站点。 + if (!row.site) { + this.$alert('行站点为空,无法打印', this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') }) + return + } const printRequest = { reportId: this.reportId, zplCode: this.zplCode, @@ -757,7 +762,7 @@ export default { dpi: this.dpi, userId: localStorage.getItem('userName'), username: localStorage.getItem('userName'), - site: localStorage.getItem('site'), + site: row.site, unitId: row.unitId, labelType:printLabelType } @@ -781,17 +786,22 @@ export default { } }, - // 删除标签 + // 删除标签1 deleteLabel(row) { this.$confirm(this.$t('warehouse.label.deleteConfirmContent', { unitId: row.unitId }), this.$t('warehouse.label.deleteConfirmTitle'), { confirmButtonText: this.$t('warehouse.label.deleteConfirmButton'), cancelButtonText: this.$t('warehouse.common.cancel'), type: 'warning' }).then(async () => { + // 删除按标签所属工厂定位,列表跨工厂时不能用登录缓存站点。 + if (!row.site) { + this.$alert('行站点为空,无法删除', this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') }) + return + } try { this.dataListLoading = true const { data } = await deleteLabel({ - site: localStorage.getItem('site'), + site: row.site, unitId: row.unitId }) if (data && data.code === 0) {