|
|
|
@ -377,6 +377,7 @@ import { |
|
|
|
getSortingList, |
|
|
|
splitLabel |
|
|
|
} from '../../../api/haianAutoWarehouse/palletPacking' |
|
|
|
import { printLabelCommon } from '@/api/production/production-inbound.js' |
|
|
|
|
|
|
|
export default { |
|
|
|
mixins: [palletDetailState], |
|
|
|
@ -542,6 +543,7 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 保存拆分:复用老 /pda/label/split;site 用标签 subSite,避免 54 大site 查不到 54A 标签 - rqrq |
|
|
|
// 拆分成功后按标签查询同一套逻辑打印原标签和新标签,其它分拣流程不变 - rqrq |
|
|
|
confirmSplit() { |
|
|
|
if (!this.ensureSite() || this.splitLoading) { |
|
|
|
return |
|
|
|
@ -569,19 +571,23 @@ export default { |
|
|
|
return |
|
|
|
} |
|
|
|
const labelSite = (this.splitRow.subSite || this.site || '').trim() |
|
|
|
const partNo = this.splitRow.partNo || '' |
|
|
|
this.splitLoading = true |
|
|
|
splitLabel({ |
|
|
|
site: labelSite, |
|
|
|
unitId: this.splitRow.serialNo, |
|
|
|
splitQty: splitQty, |
|
|
|
operatorName: localStorage.getItem('userName') || '' |
|
|
|
}).then(({ data }) => { |
|
|
|
}).then(async ({ data }) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
const result = data.data || {} |
|
|
|
this.$message.success('拆分成功') |
|
|
|
this.splitDialogVisible = false |
|
|
|
this.splitRow = null |
|
|
|
this.splitQty = '' |
|
|
|
this.refreshTable() |
|
|
|
// 与标签查询一致:80开头打库存成品标签,否则打BIL;原标签和新标签都打 - rqrq |
|
|
|
await this.printSplitLabels(labelSite, partNo, [result.originalUnitId, result.newUnitId]) |
|
|
|
} else { |
|
|
|
this.$alert((data && data.msg) || '拆分失败', '错误', { confirmButtonText: '确定' }) |
|
|
|
} |
|
|
|
@ -591,6 +597,37 @@ export default { |
|
|
|
this.splitLoading = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 拆分后打印:口径对齐标签查询 printViaServer,必须带标签小site,不能用登录大site - rqrq |
|
|
|
*/ |
|
|
|
async printSplitLabels(labelSite, partNo, unitIds) { |
|
|
|
const printUnitIds = (unitIds || []).filter(id => !!id) |
|
|
|
if (printUnitIds.length === 0) { |
|
|
|
this.$message.error('拆分成功但缺少标签号,无法打印') |
|
|
|
return |
|
|
|
} |
|
|
|
if (!labelSite) { |
|
|
|
this.$message.error('标签缺少工厂编码,无法打印') |
|
|
|
return |
|
|
|
} |
|
|
|
const printLabelType = partNo && String(partNo).startsWith('80') ? '库存成品标签' : 'BIL标签' |
|
|
|
try { |
|
|
|
const { data } = await printLabelCommon({ |
|
|
|
userId: localStorage.getItem('userName'), |
|
|
|
username: localStorage.getItem('userName'), |
|
|
|
site: labelSite, |
|
|
|
unitIds: printUnitIds, |
|
|
|
labelType: printLabelType |
|
|
|
}) |
|
|
|
if (data && (data.code === 200 || data.code === 0)) { |
|
|
|
this.$message.success('打印任务已发送!') |
|
|
|
} else { |
|
|
|
this.$message.error((data && data.msg) || '打印失败') |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
this.$message.error('打印失败: ' + ((error && error.message) || error)) |
|
|
|
} |
|
|
|
}, |
|
|
|
handleBack() { |
|
|
|
if (this.interfaceBusy) { |
|
|
|
return |
|
|
|
|