From afecc264ee61339e678c14871758965077349efe Mon Sep 17 00:00:00 2001 From: "han\\hanst" Date: Sun, 4 Oct 2026 11:43:41 +0800 Subject: [PATCH 1/3] site --- .../modules/warehouse/ifsInventoryInit.vue | 28 +++++++++++-------- src/views/modules/warehouse/labelQuery.vue | 14 ++++++++-- 2 files changed, 28 insertions(+), 14 deletions(-) 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/labelQuery.vue b/src/views/modules/warehouse/labelQuery.vue index 44da1bd..e14e913 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 } @@ -788,10 +793,15 @@ export default { 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) { From a2fd9e3dce7d789a29bc312e6b0e427477bc0fd1 Mon Sep 17 00:00:00 2001 From: "han\\hanst" Date: Sun, 4 Oct 2026 13:40:16 +0800 Subject: [PATCH 2/3] site --- src/views/modules/warehouse/labelQuery.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/modules/warehouse/labelQuery.vue b/src/views/modules/warehouse/labelQuery.vue index e14e913..5191b90 100644 --- a/src/views/modules/warehouse/labelQuery.vue +++ b/src/views/modules/warehouse/labelQuery.vue @@ -786,7 +786,7 @@ 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'), From cdb5ac54dcffce58dbd7c5927fd822cf5074b3ca Mon Sep 17 00:00:00 2001 From: "han\\hanst" Date: Sun, 4 Oct 2026 15:22:55 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BB=BB=E4=B8=80=E8=A1=8C=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E6=88=96=E5=86=99=E5=85=A5=E5=A4=B1=E8=B4=A5=EF=BC=9A?= =?UTF-8?q?=E4=B8=80=E8=A1=8C=E9=83=BD=E4=B8=8D=E4=BF=9D=E7=95=99=EF=BC=8C?= =?UTF-8?q?=E5=B7=B2=E5=86=99=E5=85=A5=E7=9A=84=E6=95=B0=E6=8D=AE=E9=9A=8F?= =?UTF-8?q?=E4=BA=8B=E5=8A=A1=E5=9B=9E=E6=BB=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/warehouse/ifsInventory_upload_excel.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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'