Browse Source

结束分拣拆分标签打印

master
常熟吴彦祖 4 weeks ago
parent
commit
86ae84a9bc
  1. 2
      .gitignore
  2. 39
      src/views/modules/haianAutoWarehouse/haianPalletSorting.vue

2
.gitignore

@ -19,3 +19,5 @@ node_modules/
# 本地行尾规范配置仅用于开发机,不参与版本提交 - rqrq # 本地行尾规范配置仅用于开发机,不参与版本提交 - rqrq
.gitattributes .gitattributes
.gitnexus .gitnexus
CLAUDE.md
AGENTS.md

39
src/views/modules/haianAutoWarehouse/haianPalletSorting.vue

@ -377,6 +377,7 @@ import {
getSortingList, getSortingList,
splitLabel splitLabel
} from '../../../api/haianAutoWarehouse/palletPacking' } from '../../../api/haianAutoWarehouse/palletPacking'
import { printLabelCommon } from '@/api/production/production-inbound.js'
export default { export default {
mixins: [palletDetailState], mixins: [palletDetailState],
@ -542,6 +543,7 @@ export default {
}) })
}, },
// 保存拆分:复用老 /pda/label/split;site 用标签 subSite,避免 54 大site 查不到 54A 标签 - rqrq // 保存拆分:复用老 /pda/label/split;site 用标签 subSite,避免 54 大site 查不到 54A 标签 - rqrq
// 拆分成功后按标签查询同一套逻辑打印原标签和新标签,其它分拣流程不变 - rqrq
confirmSplit() { confirmSplit() {
if (!this.ensureSite() || this.splitLoading) { if (!this.ensureSite() || this.splitLoading) {
return return
@ -569,19 +571,23 @@ export default {
return return
} }
const labelSite = (this.splitRow.subSite || this.site || '').trim() const labelSite = (this.splitRow.subSite || this.site || '').trim()
const partNo = this.splitRow.partNo || ''
this.splitLoading = true this.splitLoading = true
splitLabel({ splitLabel({
site: labelSite, site: labelSite,
unitId: this.splitRow.serialNo, unitId: this.splitRow.serialNo,
splitQty: splitQty, splitQty: splitQty,
operatorName: localStorage.getItem('userName') || '' operatorName: localStorage.getItem('userName') || ''
}).then(({ data }) => {
}).then(async ({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
const result = data.data || {}
this.$message.success('拆分成功') this.$message.success('拆分成功')
this.splitDialogVisible = false this.splitDialogVisible = false
this.splitRow = null this.splitRow = null
this.splitQty = '' this.splitQty = ''
this.refreshTable() this.refreshTable()
// 与标签查询一致:80开头打库存成品标签,否则打BIL;原标签和新标签都打 - rqrq
await this.printSplitLabels(labelSite, partNo, [result.originalUnitId, result.newUnitId])
} else { } else {
this.$alert((data && data.msg) || '拆分失败', '错误', { confirmButtonText: '确定' }) this.$alert((data && data.msg) || '拆分失败', '错误', { confirmButtonText: '确定' })
} }
@ -591,6 +597,37 @@ export default {
this.splitLoading = false 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() { handleBack() {
if (this.interfaceBusy) { if (this.interfaceBusy) {
return return

Loading…
Cancel
Save