|
|
|
@ -80,12 +80,8 @@ |
|
|
|
|
|
|
|
<!-- 底部操作按钮 --> |
|
|
|
<div class="bottom-actions"> |
|
|
|
<el-button |
|
|
|
class="action-btn primary" |
|
|
|
style="margin-left: 10px" |
|
|
|
@click="confirmIssue" |
|
|
|
:loading="loading || summaryLoading" |
|
|
|
> |
|
|
|
<el-button class="action-btn primary" style="margin-left: 10px" @click="confirmIssue" |
|
|
|
:loading="loading || summaryLoading"> |
|
|
|
确定发料 |
|
|
|
</el-button> |
|
|
|
<!-- <button class="action-btn secondary" style="margin-left: 10px" @click="openPrintDialog"> |
|
|
|
@ -115,9 +111,7 @@ |
|
|
|
<span class="section-title-text">存在物料</span> |
|
|
|
<span class="section-sub">申请单与扫描均存在</span> |
|
|
|
</div> |
|
|
|
<span class="section-count" |
|
|
|
>共 {{ comparisonData.existing.length }} 条</span |
|
|
|
> |
|
|
|
<span class="section-count">共 {{ comparisonData.existing.length }} 条</span> |
|
|
|
</div> |
|
|
|
<div v-if="comparisonData.existing.length === 0" class="summary-empty"> |
|
|
|
暂无相关物料 |
|
|
|
@ -129,21 +123,14 @@ |
|
|
|
<div>扫描数量</div> |
|
|
|
<div>差异</div> |
|
|
|
</div> |
|
|
|
<div |
|
|
|
v-for="item in comparisonData.existing" |
|
|
|
:key="'exist-' + item.partNo" |
|
|
|
class="summary-table-row" |
|
|
|
> |
|
|
|
<div v-for="item in comparisonData.existing" :key="'exist-' + item.partNo" class="summary-table-row"> |
|
|
|
<div class="part">{{ item.partNo }}</div> |
|
|
|
<div>{{ formatQty(item.requiredQty) }}</div> |
|
|
|
<div>{{ formatQty(item.scannedQty) }}</div> |
|
|
|
<div |
|
|
|
class="badge" |
|
|
|
:class="{ |
|
|
|
<div class="badge" :class="{ |
|
|
|
success: item.difference >= 0, |
|
|
|
danger: item.difference < 0, |
|
|
|
}" |
|
|
|
> |
|
|
|
}"> |
|
|
|
{{ formatQty(item.difference) }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
@ -156,9 +143,7 @@ |
|
|
|
<span class="section-title-text">未扫物料</span> |
|
|
|
<span class="section-sub">申请单存在但未扫描</span> |
|
|
|
</div> |
|
|
|
<span class="section-count" |
|
|
|
>共 {{ comparisonData.missing.length }} 条</span |
|
|
|
> |
|
|
|
<span class="section-count">共 {{ comparisonData.missing.length }} 条</span> |
|
|
|
</div> |
|
|
|
<div class="summary-table summary-table--3"> |
|
|
|
<div class="summary-table-row summary-table-head"> |
|
|
|
@ -166,11 +151,7 @@ |
|
|
|
<div>需求数量</div> |
|
|
|
<div>状态</div> |
|
|
|
</div> |
|
|
|
<div |
|
|
|
v-for="item in comparisonData.missing" |
|
|
|
:key="'missing-' + item.partNo" |
|
|
|
class="summary-table-row" |
|
|
|
> |
|
|
|
<div v-for="item in comparisonData.missing" :key="'missing-' + item.partNo" class="summary-table-row"> |
|
|
|
<div class="part">{{ item.partNo }}</div> |
|
|
|
<div>{{ formatQty(item.requiredQty) }}</div> |
|
|
|
<div><span class="badge warn">未扫描</span></div> |
|
|
|
@ -184,9 +165,7 @@ |
|
|
|
<span class="section-title-text">多余物料</span> |
|
|
|
<span class="section-sub">扫描存在但申请单无记录</span> |
|
|
|
</div> |
|
|
|
<span class="section-count" |
|
|
|
>共 {{ comparisonData.extra.length }} 条</span |
|
|
|
> |
|
|
|
<span class="section-count">共 {{ comparisonData.extra.length }} 条</span> |
|
|
|
</div> |
|
|
|
<div class="summary-table summary-table--3"> |
|
|
|
<div class="summary-table-row summary-table-head"> |
|
|
|
@ -194,11 +173,7 @@ |
|
|
|
<div>扫描数量</div> |
|
|
|
<div>状态</div> |
|
|
|
</div> |
|
|
|
<div |
|
|
|
v-for="item in comparisonData.extra" |
|
|
|
:key="'extra-' + item.partNo" |
|
|
|
class="summary-table-row" |
|
|
|
> |
|
|
|
<div v-for="item in comparisonData.extra" :key="'extra-' + item.partNo" class="summary-table-row"> |
|
|
|
<div class="part">{{ item.partNo }}</div> |
|
|
|
<div>{{ formatQty(item.scannedQty) }}</div> |
|
|
|
<div><span class="badge info">申请单未包含</span></div> |
|
|
|
@ -208,18 +183,10 @@ |
|
|
|
</template> |
|
|
|
</div> |
|
|
|
<div class="modal-footer"> |
|
|
|
<el-button |
|
|
|
class="btn-cancel" |
|
|
|
@click="closeSummaryDialog" |
|
|
|
:disabled="loading" |
|
|
|
> |
|
|
|
<el-button class="btn-cancel" @click="closeSummaryDialog" :disabled="loading"> |
|
|
|
返回修改 |
|
|
|
</el-button> |
|
|
|
<el-button |
|
|
|
class="btn-confirm" |
|
|
|
@click="proceedIssueConfirm" |
|
|
|
:disabled="loading" |
|
|
|
> |
|
|
|
<el-button class="btn-confirm" @click="proceedIssueConfirm" :disabled="loading"> |
|
|
|
{{ loading ? '发料中...' : '确定发料' }} |
|
|
|
</el-button> |
|
|
|
</div> |
|
|
|
@ -387,6 +354,7 @@ import { |
|
|
|
getCustomerIssueNotifyHeaderOrderMaterialList, |
|
|
|
} from '@/api/customerIssue/customer-issue' |
|
|
|
import moment from 'moment' |
|
|
|
import { printLabelCommon } from '@/api/production/production-inbound.js' |
|
|
|
|
|
|
|
export default { |
|
|
|
data() { |
|
|
|
@ -487,8 +455,7 @@ export default { |
|
|
|
if (!normalizedKey) { |
|
|
|
return |
|
|
|
} |
|
|
|
const qtyValue = |
|
|
|
Number(this.pickFieldValue(item, qtyFields, 0)) || 0 |
|
|
|
const qtyValue = Number(this.pickFieldValue(item, qtyFields, 0)) || 0 |
|
|
|
if (!map[normalizedKey]) { |
|
|
|
map[normalizedKey] = { |
|
|
|
partNo: normalizedKey, |
|
|
|
@ -521,13 +488,11 @@ export default { |
|
|
|
site: localStorage.getItem('site'), |
|
|
|
batchNo: this.batchNo, |
|
|
|
} |
|
|
|
// 检查是否已经扫描过 |
|
|
|
const exists = this.labelList.find( |
|
|
|
(item) => item.unitId === labelCode |
|
|
|
) |
|
|
|
// 检查是否已经扫描过 |
|
|
|
const exists = this.labelList.find((item) => item.unitId === labelCode) |
|
|
|
if (exists) { |
|
|
|
this.$message.warning('该标签已扫描,请勿重复扫描') |
|
|
|
return |
|
|
|
this.$message.warning('该标签已扫描,请勿重复扫描') |
|
|
|
return |
|
|
|
} |
|
|
|
// 客户发料标签验证 |
|
|
|
scanCustomerIssueMaterialLabel(params) |
|
|
|
@ -540,10 +505,7 @@ export default { |
|
|
|
id: Date.now(), |
|
|
|
labelCode: labelCode, |
|
|
|
partNo: labelInfo.partNo || '', |
|
|
|
qtyToIssue: |
|
|
|
Number( |
|
|
|
labelInfo.qtyToIssue |
|
|
|
) || 0, |
|
|
|
qtyToIssue: Number(labelInfo.qtyToIssue) || 0, |
|
|
|
batchNo: labelInfo.batchNo || '', |
|
|
|
locationId: labelInfo.locationId || '', |
|
|
|
warehouseId: labelInfo.warehouseId || '', |
|
|
|
@ -567,9 +529,7 @@ export default { |
|
|
|
|
|
|
|
// 通过条码移除标签 |
|
|
|
removeLabelByCode(labelCode) { |
|
|
|
const exists = this.labelList.find( |
|
|
|
(item) => item.unitId === labelCode |
|
|
|
) |
|
|
|
const exists = this.labelList.find((item) => item.unitId === labelCode) |
|
|
|
if (!exists) { |
|
|
|
this.$message.warning('未找到该标签') |
|
|
|
return |
|
|
|
@ -731,9 +691,7 @@ export default { |
|
|
|
issueQty: this.quantity, |
|
|
|
selectedMaterials: this.labelList.map((label) => ({ |
|
|
|
labelCode: label.labelCode || label.unitId, |
|
|
|
issueQty: |
|
|
|
Number(label.qtyToIssue) || |
|
|
|
0, |
|
|
|
issueQty: Number(label.qtyToIssue) || 0, |
|
|
|
batchNo: label.batchNo, |
|
|
|
partNo: label.partNo, |
|
|
|
locationId: label.locationId, |
|
|
|
@ -748,68 +706,62 @@ export default { |
|
|
|
site: localStorage.getItem('site'), |
|
|
|
workOrderNo: this.orderNo, |
|
|
|
} |
|
|
|
await getCustomerIssueNotifyHeaderOrderMaterialList( |
|
|
|
params |
|
|
|
).then(({ data }) => { |
|
|
|
await getCustomerIssueNotifyHeaderOrderMaterialList(params).then( |
|
|
|
({ data }) => { |
|
|
|
if (!data || data.code !== 0) { |
|
|
|
throw new Error((data && data.msg) || '获取申请单物料失败') |
|
|
|
} |
|
|
|
const materials = data.data || [] |
|
|
|
const labelMap = this.aggregateMaterials( |
|
|
|
this.labelList, |
|
|
|
['partNo'], |
|
|
|
['qtyToIssue', 'quantity', 'issueQty'] |
|
|
|
) |
|
|
|
const orderMap = this.aggregateMaterials( |
|
|
|
materials, |
|
|
|
['INVENTORY_PART_NO'], |
|
|
|
[ |
|
|
|
'INVENTORY_QTY', |
|
|
|
'QTY_ASSIGNED', |
|
|
|
'QTY_PICKED', |
|
|
|
'QTY_SHIPPED' |
|
|
|
] |
|
|
|
) |
|
|
|
|
|
|
|
const existing = [] |
|
|
|
const missing = [] |
|
|
|
Object.keys(orderMap).forEach((partNo) => { |
|
|
|
console.log('Comparing partNo:', orderMap[partNo]); |
|
|
|
|
|
|
|
const requiredQty = orderMap[partNo].qty |
|
|
|
if (labelMap[partNo]) { |
|
|
|
const scannedQty = labelMap[partNo].qty |
|
|
|
existing.push({ |
|
|
|
partNo, |
|
|
|
requiredQty, |
|
|
|
scannedQty, |
|
|
|
difference: scannedQty - requiredQty, |
|
|
|
}) |
|
|
|
} else { |
|
|
|
missing.push({ |
|
|
|
partNo, |
|
|
|
requiredQty, |
|
|
|
throw new Error((data && data.msg) || '获取申请单物料失败') |
|
|
|
} |
|
|
|
const materials = data.data || [] |
|
|
|
const labelMap = this.aggregateMaterials( |
|
|
|
this.labelList, |
|
|
|
['partNo'], |
|
|
|
['qtyToIssue', 'quantity', 'issueQty'] |
|
|
|
) |
|
|
|
const orderMap = this.aggregateMaterials( |
|
|
|
materials, |
|
|
|
['INVENTORY_PART_NO'], |
|
|
|
['INVENTORY_QTY', 'QTY_ASSIGNED', 'QTY_PICKED', 'QTY_SHIPPED'] |
|
|
|
) |
|
|
|
|
|
|
|
const existing = [] |
|
|
|
const missing = [] |
|
|
|
Object.keys(orderMap).forEach((partNo) => { |
|
|
|
console.log('Comparing partNo:', orderMap[partNo]) |
|
|
|
|
|
|
|
const requiredQty = orderMap[partNo].qty |
|
|
|
if (labelMap[partNo]) { |
|
|
|
const scannedQty = labelMap[partNo].qty |
|
|
|
existing.push({ |
|
|
|
partNo, |
|
|
|
requiredQty, |
|
|
|
scannedQty, |
|
|
|
difference: scannedQty - requiredQty, |
|
|
|
}) |
|
|
|
} else { |
|
|
|
missing.push({ |
|
|
|
partNo, |
|
|
|
requiredQty, |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
const extra = [] |
|
|
|
Object.keys(labelMap).forEach((partNo) => { |
|
|
|
if (!orderMap[partNo]) { |
|
|
|
extra.push({ |
|
|
|
partNo, |
|
|
|
scannedQty: labelMap[partNo].qty, |
|
|
|
const extra = [] |
|
|
|
Object.keys(labelMap).forEach((partNo) => { |
|
|
|
if (!orderMap[partNo]) { |
|
|
|
extra.push({ |
|
|
|
partNo, |
|
|
|
scannedQty: labelMap[partNo].qty, |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
this.comparisonData = { |
|
|
|
existing, |
|
|
|
missing, |
|
|
|
extra, |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
this.comparisonData = { |
|
|
|
existing, |
|
|
|
missing, |
|
|
|
extra, |
|
|
|
} |
|
|
|
} |
|
|
|
) |
|
|
|
}, |
|
|
|
closeSummaryDialog() { |
|
|
|
if (this.loading) { |
|
|
|
@ -829,17 +781,19 @@ export default { |
|
|
|
this.$message.error('缺少发料参数,请重新确认') |
|
|
|
return |
|
|
|
} |
|
|
|
if(this.comparisonData.missing.length > 0){ |
|
|
|
if (this.comparisonData.missing.length > 0) { |
|
|
|
this.$message.warning('存在未扫描物料,无法发料,请返回修改') |
|
|
|
return |
|
|
|
} |
|
|
|
if(this.comparisonData.extra.length > 0){ |
|
|
|
if (this.comparisonData.extra.length > 0) { |
|
|
|
this.$message.warning('存在多余物料,无法发料,请返回修改') |
|
|
|
return |
|
|
|
} |
|
|
|
for (const item of this.comparisonData.existing) { |
|
|
|
if (item.difference != 0) { |
|
|
|
this.$message.warning('存在发料数量超出或少于需求数量的物料,请返回修改') |
|
|
|
this.$message.warning( |
|
|
|
'存在发料数量超出或少于需求数量的物料,请返回修改' |
|
|
|
) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
@ -850,6 +804,12 @@ export default { |
|
|
|
customerIssueConfirm(this.pendingIssueParams) |
|
|
|
.then(({ data }) => { |
|
|
|
if (data.code === 0 && data) { |
|
|
|
if (data.unitIds.length > 0) { |
|
|
|
let printLabelType = '库存成品标签' |
|
|
|
|
|
|
|
// 调用打印方法,传入unitId数组和标签类型 |
|
|
|
this.printViaServer(data.unitIds, printLabelType) |
|
|
|
} |
|
|
|
this.$message.success('客户发料成功') |
|
|
|
this.showSummaryDialog = false |
|
|
|
this.pendingIssueParams = null |
|
|
|
@ -866,6 +826,40 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
async printViaServer(unitIds, printLabelType) { |
|
|
|
if (!unitIds || unitIds.length === 0) { |
|
|
|
console.warn('没有可打印的标签') |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
this.printLoading = true |
|
|
|
|
|
|
|
try { |
|
|
|
const printRequest = { |
|
|
|
userId: localStorage.getItem('userName'), |
|
|
|
username: localStorage.getItem('userName'), |
|
|
|
site: localStorage.getItem('site'), |
|
|
|
unitIds: unitIds, |
|
|
|
labelType: printLabelType, |
|
|
|
} |
|
|
|
console.log('打印请求:', printRequest) |
|
|
|
|
|
|
|
const { data } = await printLabelCommon(printRequest) |
|
|
|
|
|
|
|
if (data.code === 200 || data.code === 0) { |
|
|
|
this.$message.success(`打印任务已发送!`) |
|
|
|
this.clearData() |
|
|
|
} else { |
|
|
|
this.$message.error(data.msg || '打印失败') |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.error('服务器打印失败:', error) |
|
|
|
this.$message.error(`打印失败: ${error.message || error}`) |
|
|
|
} finally { |
|
|
|
this.printLoading = false |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 取消发料 |
|
|
|
cancelIssue() { |
|
|
|
if (this.labelList.length > 0) { |
|
|
|
@ -954,9 +948,7 @@ export default { |
|
|
|
try { |
|
|
|
const payload = selected.map((label) => ({ |
|
|
|
labelCode: label.labelCode || label.unitId, |
|
|
|
issueQty: |
|
|
|
Number(label.qtyToIssue) || |
|
|
|
0, |
|
|
|
issueQty: Number(label.qtyToIssue) || 0, |
|
|
|
batchNo: label.batchNo, |
|
|
|
partNo: label.partNo, |
|
|
|
locationId: label.locationId, |
|
|
|
@ -1028,9 +1020,7 @@ export default { |
|
|
|
try { |
|
|
|
const payload = selected.map((label) => ({ |
|
|
|
labelCode: label.labelCode || label.unitId, |
|
|
|
issueQty: |
|
|
|
Number(label.qtyToIssue) || |
|
|
|
0, |
|
|
|
issueQty: Number(label.qtyToIssue) || 0, |
|
|
|
batchNo: label.batchNo, |
|
|
|
partNo: label.partNo, |
|
|
|
locationId: label.locationId, |
|
|
|
|