diff --git a/src/views/mes/wm/productsales/ProductSalesDetailForm.vue b/src/views/mes/wm/productsales/ProductSalesDetailForm.vue index c391598c4..73ca33388 100644 --- a/src/views/mes/wm/productsales/ProductSalesDetailForm.vue +++ b/src/views/mes/wm/productsales/ProductSalesDetailForm.vue @@ -42,6 +42,7 @@ v-model="formData.quantity" :precision="2" :min="0" + :max="quantityMax" controls-position="right" class="!w-1/1" /> @@ -56,6 +57,7 @@ diff --git a/src/views/mes/wm/productsales/ProductSalesForm.vue b/src/views/mes/wm/productsales/ProductSalesForm.vue index 5e06459a6..ea7650a52 100644 --- a/src/views/mes/wm/productsales/ProductSalesForm.vue +++ b/src/views/mes/wm/productsales/ProductSalesForm.vue @@ -30,10 +30,14 @@ /> - + - + @@ -85,9 +89,9 @@ - + @@ -106,8 +110,9 @@ - - 运输信息 + + @@ -159,6 +168,7 @@ import { AutoCodeRecordApi } from '@/api/mes/md/autocode/record' import { MesAutoCodeRuleCode } from '@/views/mes/utils/constants' import MdClientSelect from '@/views/mes/md/client/components/MdClientSelect.vue' import WmSalesNoticeSelect from '@/views/mes/wm/salesnotice/components/WmSalesNoticeSelect.vue' +import { WmSalesNoticeVO } from '@/api/mes/wm/salesnotice' import ProductSalesLineList from './ProductSalesLineList.vue' defineOptions({ name: 'ProductSalesForm' }) @@ -167,7 +177,7 @@ const message = useMessage() // 消息弹窗 const dialogVisible = ref(false) // 弹窗的是否展示 const formLoading = ref(false) // 表单的加载中 -const formType = ref('create') // 表单的类型:create / update / pick / shipping / detail +const formType = ref('create') // 表单的类型:create / update / stock / shipping / finish / detail const formData = ref({ id: undefined as number | undefined, code: undefined, @@ -178,7 +188,7 @@ const formData = ref({ salesDate: undefined, contactName: undefined, contactTelephone: undefined, - address: undefined, + contactAddress: undefined, carrier: undefined, shippingNumber: undefined, remark: undefined @@ -192,15 +202,17 @@ const formRules = reactive({ const formRef = ref() // 表单 Ref const isUpdate = computed(() => ['create', 'update'].includes(formType.value)) // 是否为编辑模式 -const isPick = computed(() => formType.value === 'pick') // 是否为拣货模式 +const isPick = computed(() => formType.value === 'stock') // 是否为拣货模式 const isShipping = computed(() => formType.value === 'shipping') // 是否为填写运单模式 -const isHeaderReadonly = computed(() => ['pick', 'shipping', 'detail'].includes(formType.value)) // 是否只读 +const isFinish = computed(() => formType.value === 'finish') // 是否为执行出库模式 +const isHeaderReadonly = computed(() => ['stock', 'shipping', 'finish', 'detail'].includes(formType.value)) // 是否只读 const dialogTitle = computed(() => { const titles = { create: '新增销售出库单', update: '编辑销售出库单', - pick: '执行拣货', + stock: '执行拣货', shipping: '填写运单', + finish: '执行出库', detail: '销售出库单详情' } return titles[formType.value] || formType.value @@ -213,6 +225,18 @@ const generateCode = async () => { ) } +/** 发货通知单选中后,自动填充 salesOrderCode、客户、收货人信息 */ +const handleNoticeChange = (notice: WmSalesNoticeVO | undefined) => { + if (!notice) { + return + } + formData.value.salesOrderCode = notice.salesOrderCode + formData.value.clientId = notice.clientId + formData.value.contactName = notice.recipientName + formData.value.contactTelephone = notice.recipientTelephone + formData.value.contactAddress = notice.recipientAddress +} + /** 打开弹窗 */ const open = async (type: string, id?: number) => { dialogVisible.value = true @@ -294,6 +318,21 @@ const handleShipping = async () => { } } +/** 执行出库 */ +const handleFinish = async () => { + try { + await message.confirm('确认执行出库?执行后将扣减库存。') + formLoading.value = true + await WmProductSalesApi.finishProductSales(formData.value.id!) + message.success('出库成功') + dialogVisible.value = false + emit('success') + } catch { + } finally { + formLoading.value = false + } +} + /** 重置表单 */ const resetForm = () => { formData.value = { @@ -306,7 +345,7 @@ const resetForm = () => { salesDate: undefined, contactName: undefined, contactTelephone: undefined, - address: undefined, + contactAddress: undefined, carrier: undefined, shippingNumber: undefined, remark: undefined diff --git a/src/views/mes/wm/productsales/index.vue b/src/views/mes/wm/productsales/index.vue index 6e97d29c0..26686a90b 100644 --- a/src/views/mes/wm/productsales/index.vue +++ b/src/views/mes/wm/productsales/index.vue @@ -89,8 +89,13 @@ - - + + + @@ -98,7 +103,7 @@ - + 编辑 - - @@ -275,16 +278,6 @@ const handleSubmit = async (id: number) => { } catch {} } -/** 执行出库 */ -const handleFinish = async (id: number) => { - try { - await message.confirm('确认执行出库?执行后将扣减库存。') - await WmProductSalesApi.finishProductSales(id) - message.success('出库成功') - await getList() - } catch {} -} - /** 取消按钮操作 */ const handleCancel = async (id: number) => { try {