|
|
|
@ -80,12 +80,22 @@ |
|
|
|
|
|
|
|
<div class="dialog-body"> |
|
|
|
<div class="split-input-section"> |
|
|
|
<el-input v-model="splitQuantity" placeholder="请输入拆分数量" type="number" class="split-input inlineNumber numInput"/> |
|
|
|
<div class="split-input-row"> |
|
|
|
<span class="split-label">拆分张数</span> |
|
|
|
<el-input v-model="splitCount" placeholder="请输入拆分张数" type="number" class="split-input inlineNumber numInput"/> |
|
|
|
</div> |
|
|
|
<div class="split-input-row"> |
|
|
|
<span class="split-label">每张数量</span> |
|
|
|
<el-input v-model="splitQuantity" placeholder="请输入每张数量" type="number" class="split-input inlineNumber numInput"/> |
|
|
|
</div> |
|
|
|
<div class="split-info-row" v-if="splitCount > 0 && splitQuantity > 0"> |
|
|
|
<span class="split-info-text">拆分后:原标签剩余 {{ calculateRemainingQty }} 个,新增 {{ splitCount }} 张标签,每张 {{ splitQuantity }} 个</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="dialog-footer"> |
|
|
|
<button class="btn-split" @click="confirmSplit" :disabled="!splitQuantity || splitQuantity <= 0"> |
|
|
|
<button class="btn-split" @click="confirmSplit" :disabled="!canSplit"> |
|
|
|
拆分 |
|
|
|
</button> |
|
|
|
<button class="btn-cancel" @click="closeSplitDialog"> |
|
|
|
@ -141,7 +151,8 @@ export default { |
|
|
|
currentLabel: {}, |
|
|
|
splitDialogVisible: false, |
|
|
|
mergeDialogVisible: false, |
|
|
|
splitQuantity: '', |
|
|
|
splitCount: '', // 拆分张数 |
|
|
|
splitQuantity: '', // 每张数量 |
|
|
|
mergeTargetCode: '', |
|
|
|
mergeTargetLabel: {} |
|
|
|
}; |
|
|
|
@ -187,25 +198,34 @@ export default { |
|
|
|
return; |
|
|
|
} |
|
|
|
this.splitDialogVisible = true; |
|
|
|
this.splitCount = ''; |
|
|
|
this.splitQuantity = ''; |
|
|
|
}, |
|
|
|
|
|
|
|
// 关闭拆分对话框 |
|
|
|
closeSplitDialog() { |
|
|
|
this.splitDialogVisible = false; |
|
|
|
this.splitCount = ''; |
|
|
|
this.splitQuantity = ''; |
|
|
|
}, |
|
|
|
|
|
|
|
// 确认拆分 |
|
|
|
confirmSplit() { |
|
|
|
const splitCnt = parseInt(this.splitCount); |
|
|
|
const splitQty = parseFloat(this.splitQuantity); |
|
|
|
const currentQty = parseFloat(this.currentLabel.qtyOnHand); |
|
|
|
const totalSplitQty = splitCnt * splitQty; |
|
|
|
|
|
|
|
if (!splitCnt || splitCnt <= 0) { |
|
|
|
this.$message.warning('请输入有效的拆分张数'); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!splitQty || splitQty <= 0) { |
|
|
|
this.$message.warning('请输入有效的拆分数量'); |
|
|
|
this.$message.warning('请输入有效的每张数量'); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (splitQty >= currentQty) { |
|
|
|
this.$message.warning('拆分数量必须小于当前数量'); |
|
|
|
if (totalSplitQty >= currentQty) { |
|
|
|
this.$message.warning('拆分总数量必须小于当前数量'); |
|
|
|
return; |
|
|
|
} |
|
|
|
const params = { |
|
|
|
@ -218,7 +238,8 @@ export default { |
|
|
|
batchNo: this.currentLabel.batchNo, |
|
|
|
locationId: this.currentLabel.locationId, |
|
|
|
originalQuantity: currentQty, |
|
|
|
splitQuantity: splitQty, |
|
|
|
splitCount: splitCnt, // 拆分张数 |
|
|
|
splitQuantity: splitQty, // 每张数量 |
|
|
|
labelTypeTb: this.currentLabel.labelTypeTb, |
|
|
|
labelType: this.currentLabel.labelType, |
|
|
|
freezeFlag: this.currentLabel.freezeFlag, |
|
|
|
@ -233,7 +254,8 @@ export default { |
|
|
|
}; |
|
|
|
splitLabel(params).then(async ({ data }) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.$message.success(`拆分成功!新标签: ${data.data.newLabelCode}`); |
|
|
|
const newLabelCodes = data.data.newLabelCodes || [data.data.newLabelCode]; |
|
|
|
this.$message.success(`拆分成功!新标签: ${newLabelCodes.join(', ')}`); |
|
|
|
this.closeSplitDialog(); |
|
|
|
|
|
|
|
// 自动打印标签(拆分打印两张:原标签和新标签) |
|
|
|
@ -477,6 +499,25 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
computed: { |
|
|
|
// 计算拆分后剩余数量 |
|
|
|
calculateRemainingQty() { |
|
|
|
const currentQty = parseFloat(this.currentLabel.qtyOnHand) || 0; |
|
|
|
const splitCnt = parseInt(this.splitCount) || 0; |
|
|
|
const splitQty = parseFloat(this.splitQuantity) || 0; |
|
|
|
const totalSplitQty = splitCnt * splitQty; |
|
|
|
return currentQty - totalSplitQty; |
|
|
|
}, |
|
|
|
// 判断是否可以拆分 |
|
|
|
canSplit() { |
|
|
|
const splitCnt = parseInt(this.splitCount) || 0; |
|
|
|
const splitQty = parseFloat(this.splitQuantity) || 0; |
|
|
|
const currentQty = parseFloat(this.currentLabel.qtyOnHand) || 0; |
|
|
|
const totalSplitQty = splitCnt * splitQty; |
|
|
|
return splitCnt > 0 && splitQty > 0 && totalSplitQty < currentQty; |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
mounted() { |
|
|
|
// 聚焦扫描框 |
|
|
|
this.$nextTick(() => { |
|
|
|
@ -669,6 +710,31 @@ export default { |
|
|
|
margin-bottom: 20px; |
|
|
|
} |
|
|
|
|
|
|
|
.split-input-row { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
margin-bottom: 12px; |
|
|
|
} |
|
|
|
|
|
|
|
.split-label { |
|
|
|
width: 80px; |
|
|
|
font-size: 14px; |
|
|
|
color: #333; |
|
|
|
flex-shrink: 0; |
|
|
|
} |
|
|
|
|
|
|
|
.split-info-row { |
|
|
|
margin-top: 8px; |
|
|
|
padding: 8px 12px; |
|
|
|
background: #f5f5f5; |
|
|
|
border-radius: 4px; |
|
|
|
} |
|
|
|
|
|
|
|
.split-info-text { |
|
|
|
font-size: 13px; |
|
|
|
color: #666; |
|
|
|
} |
|
|
|
|
|
|
|
.split-input, |
|
|
|
.merge-input { |
|
|
|
width: 100%; |
|
|
|
|