|
|
|
@ -238,24 +238,34 @@ |
|
|
|
<span class="split-value">{{ splitRow ? formatQty(splitRow.qty) : 0 }}</span> |
|
|
|
</div> |
|
|
|
<div class="split-input-group"> |
|
|
|
<label class="split-label required">拆分数量:</label> |
|
|
|
<label class="split-label required">拆分放回数量:</label> |
|
|
|
<el-input |
|
|
|
v-model="splitQty" |
|
|
|
type="number" |
|
|
|
placeholder="请输入拆分数量" |
|
|
|
placeholder="请输入放回数量" |
|
|
|
class="split-input" |
|
|
|
ref="splitInput" |
|
|
|
:disabled="splitLoading" |
|
|
|
@input="onSplitReturnInput" |
|
|
|
/> |
|
|
|
<div class="split-hint" v-if="splitQty && !isValidSplitQty"> |
|
|
|
</div> |
|
|
|
<!-- 出货数量可改,改完按当前数量回写放回数量,两边之和始终等于原标签数量 - rqrq --> |
|
|
|
<div class="split-input-group"> |
|
|
|
<label class="split-label required">拆分出货数量:</label> |
|
|
|
<el-input |
|
|
|
v-model="splitShipQty" |
|
|
|
type="number" |
|
|
|
placeholder="请输入出货数量" |
|
|
|
class="split-input" |
|
|
|
:disabled="splitLoading" |
|
|
|
ref="splitInput2" |
|
|
|
@input="onSplitShipInput" |
|
|
|
/> |
|
|
|
<div class="split-hint" v-if="splitQtyFilled && !isValidSplitQty"> |
|
|
|
<i class="el-icon-warning"></i> |
|
|
|
拆分数量必须大于0且小于当前数量 |
|
|
|
两个数量都必须大于0且小于当前数量 |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="split-info-row"> |
|
|
|
<span class="split-label">拆分后原标签剩余:</span> |
|
|
|
<span class="split-value split-remain">{{ calculateRemainQty }}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
<button class="dialog-btn cancel" @click="splitDialogVisible = false" :disabled="splitLoading">取消</button> |
|
|
|
@ -439,7 +449,10 @@ export default { |
|
|
|
scanRequestLoading: false, |
|
|
|
// 手工分拣拆分弹窗状态:被分拣源盘不打开 - rqrq |
|
|
|
splitDialogVisible: false, |
|
|
|
// 放回数量:拆出的新标签数量,提交时作为 splitQty - rqrq |
|
|
|
splitQty: '', |
|
|
|
// 出货数量:留在原标签上的数量,与放回数量联动,不单独提交 - rqrq |
|
|
|
splitShipQty: '', |
|
|
|
splitLoading: false, |
|
|
|
splitRow: null |
|
|
|
} |
|
|
|
@ -486,22 +499,25 @@ export default { |
|
|
|
showSplitAction() { |
|
|
|
return this.palletScanned && !this.sortedSourceFlag |
|
|
|
}, |
|
|
|
// 拆分数量合法:大于0且小于原标签当前数量 - rqrq |
|
|
|
// 任一侧已填写才提示,避免弹窗刚打开就报数量非法 - rqrq |
|
|
|
splitQtyFilled() { |
|
|
|
return String(this.splitQty || '').trim() !== '' || String(this.splitShipQty || '').trim() !== '' |
|
|
|
}, |
|
|
|
// 放回是新标签数量,出货是原标签剩余;两边都要大于0且相加等于当前数量 - rqrq |
|
|
|
isValidSplitQty() { |
|
|
|
if (!this.splitQty || !this.splitRow) { |
|
|
|
if (!this.splitRow) { |
|
|
|
return false |
|
|
|
} |
|
|
|
const split = Number(this.splitQty) |
|
|
|
const backQty = Number(this.splitQty) |
|
|
|
const shipQty = Number(this.splitShipQty) |
|
|
|
const current = Number(this.splitRow.qty) || 0 |
|
|
|
return split > 0 && split < current |
|
|
|
}, |
|
|
|
// 拆分后原标签剩余量,非法输入时回0 - rqrq |
|
|
|
calculateRemainQty() { |
|
|
|
if (!this.splitRow || !this.splitQty) { |
|
|
|
return this.splitRow ? this.formatQty(this.splitRow.qty) : 0 |
|
|
|
if (!(backQty > 0) || !(shipQty > 0) || !(current > 0)) { |
|
|
|
return false |
|
|
|
} |
|
|
|
const remain = (Number(this.splitRow.qty) || 0) - (Number(this.splitQty) || 0) |
|
|
|
return remain > 0 ? this.formatQty(remain) : 0 |
|
|
|
if (!(backQty < current) || !(shipQty < current)) { |
|
|
|
return false |
|
|
|
} |
|
|
|
return Math.abs(backQty + shipQty - current) < 0.000001 |
|
|
|
}, |
|
|
|
// 页面接口忙碌态:任一按钮触发接口未返回时视为忙碌,统一禁用关键入口 - rqrq |
|
|
|
interfaceBusy() { |
|
|
|
@ -524,6 +540,28 @@ export default { |
|
|
|
} |
|
|
|
return parseFloat(String(num)) |
|
|
|
}, |
|
|
|
// 改放回数量时,出货数量=当前数量-放回数量;空输入则清空另一边 - rqrq |
|
|
|
onSplitReturnInput(value) { |
|
|
|
this.splitShipQty = this.calcSplitCounterpart(value) |
|
|
|
}, |
|
|
|
// 改出货数量时,放回数量=当前数量-出货数量;提交仍只传放回数量 - rqrq |
|
|
|
onSplitShipInput(value) { |
|
|
|
this.splitQty = this.calcSplitCounterpart(value) |
|
|
|
}, |
|
|
|
// 按当前标签数量扣减另一侧,小数按6位四舍五入后再去尾零 - rqrq |
|
|
|
calcSplitCounterpart(raw) { |
|
|
|
const text = raw == null ? '' : String(raw).trim() |
|
|
|
if (text === '' || text === '-' || text === '.' || text === '-.') { |
|
|
|
return '' |
|
|
|
} |
|
|
|
const num = Number(text) |
|
|
|
const current = Number(this.splitRow && this.splitRow.qty) || 0 |
|
|
|
if (!Number.isFinite(num) || !Number.isFinite(current)) { |
|
|
|
return '' |
|
|
|
} |
|
|
|
const other = Math.round((current - num) * 1000000) / 1000000 |
|
|
|
return String(this.formatQty(other)) |
|
|
|
}, |
|
|
|
// 手工分拣工作盘打开拆分弹窗;被分拣源盘不允许进入 - rqrq |
|
|
|
showSplitDialog(item) { |
|
|
|
if (!this.showSplitAction) { |
|
|
|
@ -535,10 +573,11 @@ export default { |
|
|
|
} |
|
|
|
this.splitRow = item |
|
|
|
this.splitQty = '' |
|
|
|
this.splitShipQty = '' |
|
|
|
this.splitDialogVisible = true |
|
|
|
this.$nextTick(() => { |
|
|
|
if (this.$refs.splitInput) { |
|
|
|
this.$refs.splitInput.focus() |
|
|
|
if (this.$refs.splitInput2) { |
|
|
|
this.$refs.splitInput2.focus() |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
@ -556,20 +595,12 @@ export default { |
|
|
|
this.$alert('没有可拆分的标签', '提示', { confirmButtonText: '确定' }) |
|
|
|
return |
|
|
|
} |
|
|
|
if (!this.splitQty) { |
|
|
|
this.$alert('请输入拆分数量', '提示', { confirmButtonText: '确定' }) |
|
|
|
if (!this.isValidSplitQty) { |
|
|
|
this.$alert('放回数量和出货数量都必须大于0且小于当前数量', '提示', { confirmButtonText: '确定' }) |
|
|
|
return |
|
|
|
} |
|
|
|
// 放回数量交给拆分接口作为新标签数量,出货数量留在原标签上 - rqrq |
|
|
|
const splitQty = Number(this.splitQty) |
|
|
|
const currentQty = Number(this.splitRow.qty) || 0 |
|
|
|
if (!(splitQty > 0)) { |
|
|
|
this.$alert('拆分数量必须大于0', '提示', { confirmButtonText: '确定' }) |
|
|
|
return |
|
|
|
} |
|
|
|
if (!(splitQty < currentQty)) { |
|
|
|
this.$alert('拆分数量必须小于当前数量', '提示', { confirmButtonText: '确定' }) |
|
|
|
return |
|
|
|
} |
|
|
|
const labelSite = (this.splitRow.subSite || this.site || '').trim() |
|
|
|
const partNo = this.splitRow.partNo || '' |
|
|
|
this.splitLoading = true |
|
|
|
@ -585,6 +616,7 @@ export default { |
|
|
|
this.splitDialogVisible = false |
|
|
|
this.splitRow = null |
|
|
|
this.splitQty = '' |
|
|
|
this.splitShipQty = '' |
|
|
|
this.refreshTable() |
|
|
|
// 与标签查询一致:80开头打库存成品标签,否则打BIL;原标签和新标签都打 - rqrq |
|
|
|
await this.printSplitLabels(labelSite, partNo, [result.originalUnitId, result.newUnitId]) |
|
|
|
@ -683,6 +715,7 @@ export default { |
|
|
|
this.scanRequestLoading = false |
|
|
|
this.splitDialogVisible = false |
|
|
|
this.splitQty = '' |
|
|
|
this.splitShipQty = '' |
|
|
|
this.splitLoading = false |
|
|
|
this.splitRow = null |
|
|
|
if (needFocus) { |
|
|
|
|