From fd1bfb88c2f7c9d43dd717b6cff950e3e19ea0ee Mon Sep 17 00:00:00 2001 From: chenshuichuan <1154693969@qq.com> Date: Sun, 16 Jun 2024 10:49:52 +0800 Subject: [PATCH] fix item need and purchase order --- .../in/components/PurchaseInItemForm.vue | 10 ++-- src/views/erp/purchase/in/index.vue | 6 +-- .../erp/purchase/order/PurchaseOrderForm.vue | 9 +++- .../components/PurchaseOrderItemForm.vue | 53 +++++++++++++++---- src/views/erp/stock/record/index.vue | 16 ++++++ src/views/erp/stock/stock/index.vue | 32 +++++------ src/views/mes/bom/ItemNeedIndex.vue | 18 +++++-- .../mes/tasksummary/components/TaskPlan.vue | 4 +- 8 files changed, 108 insertions(+), 40 deletions(-) diff --git a/src/views/erp/purchase/in/components/PurchaseInItemForm.vue b/src/views/erp/purchase/in/components/PurchaseInItemForm.vue index 64377bc7..68bc7d19 100644 --- a/src/views/erp/purchase/in/components/PurchaseInItemForm.vue +++ b/src/views/erp/purchase/in/components/PurchaseInItemForm.vue @@ -260,13 +260,13 @@ const handleAdd = () => { productId: undefined, productUnitName: undefined, // 产品单位 productBarCode: undefined, // 产品条码 - productPrice: undefined, + productPrice: 0, stockCount: undefined, count: 1, - totalProductPrice: undefined, - taxPercent: undefined, - taxPrice: undefined, - totalPrice: undefined, + totalProductPrice: 0, + taxPercent: 0, + taxPrice: 0, + totalPrice: 0, remark: undefined } formData.value.push(row) diff --git a/src/views/erp/purchase/in/index.vue b/src/views/erp/purchase/in/index.vue index c0764346..1a8ee5e1 100644 --- a/src/views/erp/purchase/in/index.vue +++ b/src/views/erp/purchase/in/index.vue @@ -131,10 +131,10 @@ - + @@ -235,7 +235,7 @@ - + diff --git a/src/views/erp/purchase/order/PurchaseOrderForm.vue b/src/views/erp/purchase/order/PurchaseOrderForm.vue index a7a6eecd..b2cf8d45 100644 --- a/src/views/erp/purchase/order/PurchaseOrderForm.vue +++ b/src/views/erp/purchase/order/PurchaseOrderForm.vue @@ -141,6 +141,7 @@ import { SupplierApi, SupplierVO } from '@/api/erp/purchase/supplier' import { erpPriceInputFormatter, erpPriceMultiply } from '@/utils' import * as UserApi from '@/api/system/user' import { AccountApi, AccountVO } from '@/api/erp/finance/account' +import {ItemRequisitionAndStockVO} from "@/api/mes/task"; /** ERP 销售订单表单 */ defineOptions({ name: 'PurchaseOrderForm' }) @@ -167,7 +168,6 @@ const formData = ref({ no: undefined // 订单单号,后端返回 }) const formRules = reactive({ - supplierId: [{ required: true, message: '供应商不能为空', trigger: 'blur' }], orderTime: [{ required: true, message: '订单时间不能为空', trigger: 'blur' }] }) const disabled = computed(() => formType.value === 'detail') @@ -197,7 +197,7 @@ watch( ) /** 打开弹窗 */ -const open = async (type: string, id?: number) => { +const open = async (type: string, id?: number, itemList?: ItemRequisitionAndStockVO[]) => { dialogVisible.value = true dialogTitle.value = t('action.' + type) formType.value = type @@ -221,6 +221,11 @@ const open = async (type: string, id?: number) => { if (defaultAccount) { formData.value.accountId = defaultAccount.id } + + //物料申购会传过来列表 + if(itemList){ + itemFormRef.value.handleItemListAdd(itemList) + } } defineExpose({ open }) // 提供 open 方法,用于打开弹窗 diff --git a/src/views/erp/purchase/order/components/PurchaseOrderItemForm.vue b/src/views/erp/purchase/order/components/PurchaseOrderItemForm.vue index 94bd0e45..16c715ba 100644 --- a/src/views/erp/purchase/order/components/PurchaseOrderItemForm.vue +++ b/src/views/erp/purchase/order/components/PurchaseOrderItemForm.vue @@ -57,7 +57,7 @@ @@ -70,7 +70,7 @@ @@ -144,6 +144,7 @@ import { erpPriceMultiply, getSumValue } from '@/utils' +import {ItemRequisitionAndStockVO} from "@/api/mes/task"; const props = defineProps<{ items: undefined @@ -176,6 +177,9 @@ watch( } // 循环处理 val.forEach((item) => { + if(item.productPrice == null) item.productPrice = 0.0 + if(item.taxPercent == null) item.taxPercent = 0.0 + item.totalProductPrice = erpPriceMultiply(item.productPrice, item.count) item.taxPrice = erpPriceMultiply(item.totalProductPrice, item.taxPercent / 100.0) if (item.totalProductPrice != null) { @@ -216,13 +220,13 @@ const handleAdd = () => { productId: undefined, productUnitName: undefined, // 产品单位 productBarCode: undefined, // 产品条码 - productPrice: undefined, + productPrice: 0, stockCount: undefined, count: 1, - totalProductPrice: undefined, - taxPercent: undefined, - taxPrice: undefined, - totalPrice: undefined, + totalProductPrice: 0, + taxPercent: 0, + taxPrice: 0, + totalPrice: 0, remark: undefined } formData.value.push(row) @@ -258,14 +262,45 @@ const setStockCount = async (row: any) => { const validate = () => { return formRef.value.validate() } -defineExpose({ validate }) + + +/** 物料申购会调用 */ +const handleItemListAdd = async (itemList: ItemRequisitionAndStockVO[]) => { + + for (let i = 0; i < itemList.length; i++) { + const row = { + id: undefined, + productId: itemList[i].itemId, + productUnitName: undefined, // 产品单位 + productBarCode: undefined, // 产品条码 + productPrice: 0.0, + stockCount: undefined, + count: itemList[i].number, + totalProductPrice: 0.0, + taxPercent: 0.0, + taxPrice: 0.0, + totalPrice: 0, + remark: undefined + } + formData.value.push(row) + } + /** 处理产品变更 */ + if(!productList.value || productList.value.length==0) + productList.value = await ProductApi.getOrderSimpleList() + for (let i = 0; i < formData.value.length; i++) { + onChangeProduct(formData.value[i].productId, formData.value[i]) + } +} +defineExpose({ validate, handleItemListAdd }) /** 初始化 */ onMounted(async () => { - productList.value = await ProductApi.getOrderSimpleList() + if(!productList.value || productList.value.length==0) + productList.value = await ProductApi.getOrderSimpleList() // 默认添加一个 if (formData.value.length === 0) { handleAdd() } }) + diff --git a/src/views/erp/stock/record/index.vue b/src/views/erp/stock/record/index.vue index 9617339d..a7cc177c 100644 --- a/src/views/erp/stock/record/index.vue +++ b/src/views/erp/stock/record/index.vue @@ -103,6 +103,15 @@ + + + + + + + + + @@ -167,6 +176,7 @@ const queryParams = reactive({ pageNo: 1, pageSize: 10, productId: undefined, + categoryId: undefined, warehouseId: undefined, bizType: undefined, bizNo: undefined, @@ -246,4 +256,10 @@ onMounted(async () => { productList.value = await ProductApi.getProductSimpleList() warehouseList.value = await WarehouseApi.getWarehouseSimpleList() }) + +/** tab 切换 */ +const handleTabClick = (tab: TabsPaneContext) => { + queryParams.categoryId = tab.paneName + handleQuery() +} diff --git a/src/views/erp/stock/stock/index.vue b/src/views/erp/stock/stock/index.vue index d4ddb8b1..c4740708 100644 --- a/src/views/erp/stock/stock/index.vue +++ b/src/views/erp/stock/stock/index.vue @@ -26,22 +26,7 @@ /> - - - - - + + + + + + + + + + @@ -202,4 +196,10 @@ onMounted(async () => { warehouseList.value = await WarehouseApi.getWarehouseSimpleList() categoryList.value = await ProductCategoryApi.getProductCategorySimpleList() }) + +/** tab 切换 */ +const handleTabClick = (tab: TabsPaneContext) => { + queryParams.categoryId = tab.paneName + handleQuery() +} diff --git a/src/views/mes/bom/ItemNeedIndex.vue b/src/views/mes/bom/ItemNeedIndex.vue index c05ed050..e1d401f6 100644 --- a/src/views/mes/bom/ItemNeedIndex.vue +++ b/src/views/mes/bom/ItemNeedIndex.vue @@ -9,15 +9,18 @@ + + diff --git a/src/views/mes/tasksummary/components/TaskPlan.vue b/src/views/mes/tasksummary/components/TaskPlan.vue index af7de7a6..b58771e0 100644 --- a/src/views/mes/tasksummary/components/TaskPlan.vue +++ b/src/views/mes/tasksummary/components/TaskPlan.vue @@ -31,12 +31,12 @@ - +