feat(wms): 新增入库单打印功能

- 添加入库单打印页面和相关功能
- 实现物料选择、工单类型切换、采购订单和生产订单选择等功能
- 添加入库单审批功能
- 修改方案如下:
   1. 在条码生成弹窗(childrenTableInfoVisible)中,增加两个输入项:
        a. 分包数量(splitPackageCount):数字输入框,最小值1,最大值不超过剩余物料量(已分包数量不能超过入库数量)
        b. 重复打印数量(printCopies):数字输入框,最小值1,最大值例如20(根据业务需求),但仅在分包数量为1时显示。
   2. 计算属性:
        - 剩余物料量 = 入库数量 - 已分包数量
        - 最大可分包数 = 剩余物料量(注意:这里分包数量是包数,不是每包的数量。但实际业务中,分包数量不能大于剩余物料量,因为每包至少一个物料。但这里我们按整数包,且每包物料数量由总剩余量除以包数得到,所以最大包数就是剩余物料量(当每包1个时))
      然而,注意:分包数量指的是分成几包,所以最大包数不能超过剩余物料量(因为每包至少1个物料)。因此,分包数量的最大值为剩余物料量(整数)。
   3. 当分包数量变化时(handlePackageChange):
        - 如果分包数量>1,则将重复打印数量重置为1(并且隐藏重复打印输入框,通过v-if控制)
        - 如果分包数量=1,则显示重复打印输入框
   4. 提交表单(submitForm)时:
        - 验证分包数量:必须大于0,且不超过剩余物料量(即maxPackages)
        - 当分包数量=1时,验证重复打印数量必须大于0
        - 调用后端条码生成接口(generateBarcodes),传递参数包括:
             instockDetailId, splitPackageCount, printCopies
master
zangch@mesnac.com 2 weeks ago
parent b71c935af1
commit 74d6313a66

File diff suppressed because it is too large Load Diff

@ -535,11 +535,11 @@
<el-form-item label="已包数量" prop="printedNum">
<el-input v-model="childrenTableInfoForm.printedNum" placeholder="" :disabled="true"/>
</el-form-item>
<el-form-item label="分包数量" prop="printNum">
<el-input v-model="childrenTableInfoForm.printNum" placeholder="请输入分包数量" />
<el-form-item label="分包数量" prop="splitPackageCount">
<el-input-number v-model="childrenTableInfoForm.splitPackageCount" :min="1" :max="remainingQty" placeholder="请输入分包数量" />
</el-form-item>
<el-form-item label="打印数量" prop="barcodeNum">
<el-input v-model="childrenTableInfoForm.barcodeNum" placeholder="请输入打印条码数量" />
<el-form-item label="打印数量" prop="printCopies" v-if="childrenTableInfoForm.splitPackageCount === 1 || !childrenTableInfoForm.splitPackageCount">
<el-input-number v-model="childrenTableInfoForm.printCopies" :min="1" :max="20" placeholder="请输入打印条码数量" />
</el-form-item>
</el-form>
<template #footer>
@ -572,7 +572,7 @@
<script setup name="Linkage" lang="ts">
import { listInstockOrder, getInstockOrder, delInstockOrder, addInstockOrder, updateInstockOrder, approveInstockOrder } from '@/api/wms/instockOrder';
import type { InstockOrderForm } from '@/api/wms/instockOrder/types';
import {onMounted, reactive, watch} from 'vue'
import {onMounted, reactive, watch, computed} from 'vue'
import {ElMessage, ElMessageBox} from 'element-plus'
import {getBaseWarehouseList} from "@/api/wms/baseWarehouse";
import {UserVO} from "@/api/system/user/types";
@ -667,9 +667,36 @@ listUser().then(e => {
})
/** 提交按钮 */
const submitForm = async() => {
await updateInstockDetail(childrenTableInfoForm.value);
getChildrenTable({instockId: partntTableSelectCell.value.instockId});
childrenTableInfoVisible.value = false;
if (!childrenTableInfoForm.value.instockQty || !childrenTableInfoForm.value.printedNum) {
ElMessage.error('物料数据未加载完成,请重试')
return
}
const split = Number(childrenTableInfoForm.value.splitPackageCount) || 1
const copies = Number(childrenTableInfoForm.value.printCopies) || 1
const remaining = remainingQty.value
if (split > remaining) {
ElMessage.error('分包数量不能超过剩余物料量')
return
}
if (split > 1) {
if (remaining % split !== 0) {
ElMessage.error('剩余物料量无法平均分包,请调整分包数量')
return
}
// >1barcodeNum=11
childrenTableInfoForm.value.printCopies = 1
} else {
if (copies < 1) {
ElMessage.error('重复打印数量至少为1')
return
}
}
await updateInstockDetail(childrenTableInfoForm.value)
getChildrenTable({instockId: partntTableSelectCell.value.instockId})
childrenTableInfoVisible.value = false
}
let mategoryOptions = ref([]);
@ -893,6 +920,8 @@ const parentTableInfoSubmit = () =>{
//
const childrenTableUpdate = async (e) => {
childrenTableInfoForm.value = (await getInstockDetail(e.instockDetailId)).data
childrenTableInfoForm.value.splitPackageCount = 1
childrenTableInfoForm.value.printCopies = 1
childrenTableInfoVisible.value = true
}
//
@ -1072,6 +1101,12 @@ const validateQty = (row, val) => {
}
};
// computed
const remainingQty = computed(() => {
const instock = Number(childrenTableInfoForm.value.instockQty) || 0
const printed = Number(childrenTableInfoForm.value.printedNum) || 0
return Math.max(0, instock - printed) // Math.max
})
</script>
<style>

Loading…
Cancel
Save