From 664bba7725ee0dcdcb29bb218a81f78f3f7aefc4 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期五, 24 四月 2026 14:09:28 +0800
Subject: [PATCH] 修改
---
src/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue | 517 ++++++++++++++++++++++++----------------------
src/api/productionManagement/processRouteItem.js | 8
src/api/productionManagement/processRoute.js | 4
src/views/productionManagement/processRoute/processRouteItem/index.vue | 74 ++++--
src/views/productionManagement/productionOrder/index.vue | 18
src/components/ProcessParamListDialog.vue | 8
src/views/productionPlan/productionPlan/index.vue | 10
src/api/productionManagement/productProcessRoute.js | 20
8 files changed, 359 insertions(+), 300 deletions(-)
diff --git a/src/api/productionManagement/processRoute.js b/src/api/productionManagement/processRoute.js
index c07c6d3..a0cb6c8 100644
--- a/src/api/productionManagement/processRoute.js
+++ b/src/api/productionManagement/processRoute.js
@@ -12,7 +12,7 @@
export function add(data) {
return request({
- url: "/technologyRouting",
+ url: "/technologyRouting/addTechRoute",
method: "post",
data: data,
});
@@ -34,7 +34,7 @@
export function update(data) {
return request({
- url: "/technologyRouting",
+ url: "/technologyRouting/editTechRoute",
method: "put",
data: data,
});
diff --git a/src/api/productionManagement/processRouteItem.js b/src/api/productionManagement/processRouteItem.js
index 4c4bf53..0a9dc66 100644
--- a/src/api/productionManagement/processRouteItem.js
+++ b/src/api/productionManagement/processRouteItem.js
@@ -82,3 +82,11 @@
data: data,
});
}
+// 鎸夊伐鑹鸿矾绾垮伐搴忓悓姝ュ伐搴忓弬鏁�-鐢熶骇璁㈠崟
+export function syncProcessParamItemOrder(data) {
+ return request({
+ url: "/productionOrderRoutingOperationParam/sync",
+ method: "post",
+ data: data,
+ });
+}
diff --git a/src/api/productionManagement/productProcessRoute.js b/src/api/productionManagement/productProcessRoute.js
index 9d13c61..d75c239 100644
--- a/src/api/productionManagement/productProcessRoute.js
+++ b/src/api/productionManagement/productProcessRoute.js
@@ -4,7 +4,7 @@
// 鍒楄〃鏌ヨ
export function findProductProcessRouteItemList(query) {
return request({
- url: "/productProcessRoute/list",
+ url: "/productionOrderRouting/list",
method: "get",
params: query,
});
@@ -12,7 +12,7 @@
export function addOrUpdateProductProcessRouteItem(data) {
return request({
- url: "/productProcessRoute/updateRouteItem",
+ url: "/productionOrderRouting/updateRouteItem",
method: "post",
data: data,
});
@@ -21,7 +21,7 @@
// 鐢熶骇璁㈠崟涓嬶細鏂板宸ヨ壓璺嚎椤圭洰
export function addRouteItem(data) {
return request({
- url: "/productProcessRoute/addRouteItem",
+ url: "/productionOrderRouting/addRouteItem",
method: "post",
data,
});
@@ -30,7 +30,7 @@
// 鑾峰彇鐢熶骇璁㈠崟鍏宠仈鐨勫伐鑹鸿矾绾夸富淇℃伅
export function listMain(orderId) {
return request({
- url: "/productProcessRoute/listMain",
+ url: "/productionOrderRouting/listMain",
method: "get",
params: { orderId },
});
@@ -39,7 +39,7 @@
// 鍒犻櫎宸ヨ壓璺嚎椤圭洰锛堣矾鐢卞悗鎷兼帴 id锛�
export function deleteRouteItem(id) {
return request({
- url: `/productProcessRoute/deleteRouteItem/${id}`,
+ url: `/productionOrderRouting/deleteRouteItem/${id}`,
method: "delete",
});
}
@@ -47,7 +47,7 @@
// 鐢熶骇璁㈠崟涓嬶細鎺掑簭宸ヨ壓璺嚎椤圭洰
export function sortRouteItem(data) {
return request({
- url: "/productProcessRoute/sortRouteItem",
+ url: "/productionOrderRouting/sortRouteItem",
method: "post",
data,
});
@@ -55,7 +55,7 @@
// 鑾峰彇宸ュ簭鍙傛暟鍒楄〃-鐢熶骇璁㈠崟
export function findProcessParamListOrder(query) {
return request({
- url: `/productionOrderRouteItemParam/list`,
+ url: `/productionOrderRoutingOperationParam/list`,
method: "get",
params: query,
});
@@ -63,7 +63,7 @@
// 宸ヨ壓璺嚎鍙傛暟鏂板-鐢熶骇璁㈠崟
export function addProcessRouteItemParamOrder(data) {
return request({
- url: "/productionOrderRouteItemParam/add",
+ url: "/productionOrderRoutingOperationParam",
method: "post",
data: data,
});
@@ -71,7 +71,7 @@
// 宸ヨ壓璺嚎鍙傛暟淇敼-鐢熶骇璁㈠崟
export function editProcessRouteItemParamOrder(data) {
return request({
- url: "/productionOrderRouteItemParam/update",
+ url: "/productionOrderRoutingOperationParam",
method: "put",
data: data,
});
@@ -79,7 +79,7 @@
// 宸ヨ壓璺嚎鍙傛暟鍒犻櫎-鐢熶骇璁㈠崟
export function delProcessRouteItemParamOrder(id) {
return request({
- url: `/productionOrderRouteItemParam/delete/${id}`,
+ url: `/productionOrderRoutingOperationParam/${id}`,
method: "delete",
});
}
diff --git a/src/components/ProcessParamListDialog.vue b/src/components/ProcessParamListDialog.vue
index dffb7b5..49b1c66 100644
--- a/src/components/ProcessParamListDialog.vue
+++ b/src/components/ProcessParamListDialog.vue
@@ -374,10 +374,8 @@
// 璋冪敤API鏂板鍙傛暟
if (props.pageType === "order") {
addProcessRouteItemParamOrder({
- orderId: Number(props.orderId),
- // processId: props.process.id,
- routeItemId: props.process.id,
- // routeItemId: Number(props.routeId),
+ productionOrderId: Number(props.orderId),
+ technologyRoutingOperationParamId: props.process.id,
paramId: selectedParam.value.id,
standardValue: selectedParam.value.standardValue || "",
isRequired: selectedParam.value.isRequired || 0,
@@ -428,8 +426,6 @@
if (props.pageType === "order") {
editProcessRouteItemParamOrder({
id: editParamForm.value.id,
- // routeItemId: props.process.id,
- // paramId: editParamForm.value.paramId,
standardValue: editParamForm.value.standardValue || "",
isRequired: editParamForm.value.isRequired || 0,
})
diff --git a/src/views/productionManagement/processRoute/processRouteItem/index.vue b/src/views/productionManagement/processRoute/processRouteItem/index.vue
index 42fd4b2..b78caad 100644
--- a/src/views/productionManagement/processRoute/processRouteItem/index.vue
+++ b/src/views/productionManagement/processRoute/processRouteItem/index.vue
@@ -232,7 +232,7 @@
style="width: 100%">
<el-table-column type="expand">
<template #default>
- <el-form ref="form"
+ <el-form ref="bomFormRef"
:model="bomDataValue">
<el-table :data="bomDataValue.dataList"
row-key="tempId"
@@ -356,7 +356,7 @@
prop="model" />
</el-table>
<ProductSelectDialog v-if="bomDataValue.showProductDialog"
- v-model:model-value="bomDataValue.showProductDialog"
+ v-model="bomDataValue.showProductDialog"
:single="true"
@confirm="handleBomProduct" />
<!-- 鏂板/缂栬緫寮圭獥 -->
@@ -385,8 +385,8 @@
prop="productModelId">
<el-button type="primary"
@click="showProductSelectDialog = true">
- {{ form.productName && form.model
- ? `${form.productName} - ${form.model}`
+ {{ form.productName
+ ? (form.model ? `${form.productName} - ${form.model}` : form.productName)
: '閫夋嫨浜у搧' }}
</el-button>
</el-form-item>
@@ -401,13 +401,13 @@
prop="isQuality">
<el-switch v-model="form.isQuality"
:active-value="true"
- inactive-value="false" />
+ :inactive-value="false" />
</el-form-item>
<el-form-item label="鏄惁鐢熶骇"
prop="isProduction">
<el-switch v-model="form.isProduction"
:active-value="true"
- inactive-value="false" />
+ :inactive-value="false" />
</el-form-item>
</el-form>
<template #footer>
@@ -454,7 +454,10 @@
batchDeleteProcessRouteItem,
getProcessParamList,
} from "@/api/productionManagement/processRouteItem.js";
- import { syncProcessParamItem } from "@/api/productionManagement/processRouteItem.js";
+ import {
+ syncProcessParamItem,
+ syncProcessParamItemOrder,
+ } from "@/api/productionManagement/processRouteItem.js";
import {
findProductProcessRouteItemList,
deleteRouteItem,
@@ -469,6 +472,7 @@
queryList,
addBomDetail,
} from "@/api/productionManagement/productStructure.js";
+
import { useRoute } from "vue-router";
import { ElMessageBox, ElMessage } from "element-plus";
import Sortable from "sortablejs";
@@ -485,6 +489,7 @@
const dialogVisible = ref(false);
const operationType = ref("add"); // add | edit
const formRef = ref(null);
+ const bomFormRef = ref(null);
const submitLoading = ref(false);
const cardsContainer = ref(null);
const tableRef = ref(null);
@@ -542,17 +547,31 @@
type: "warning",
})
.then(() => {
- syncProcessParamItem({
- replaceExisting: true,
- technologyRoutingOperationId: currentProcess.value.id,
- }).then(res => {
- if (res.code === 200) {
- ElMessage.success("鍚屾鎴愬姛");
- refreshParamList();
- } else {
- ElMessage.error(res.msg || "鍚屾澶辫触");
- }
- });
+ if (pageType.value === "order") {
+ syncProcessParamItemOrder({
+ replaceExisting: true,
+ technologyRoutingOperationId: currentProcess.value.id,
+ }).then(res => {
+ if (res.code === 200) {
+ ElMessage.success("鍚屾鎴愬姛");
+ refreshParamList();
+ } else {
+ ElMessage.error(res.msg || "鍚屾澶辫触");
+ }
+ });
+ } else {
+ syncProcessParamItem({
+ replaceExisting: true,
+ technologyRoutingOperationId: currentProcess.value.id,
+ }).then(res => {
+ if (res.code === 200) {
+ ElMessage.success("鍚屾鎴愬姛");
+ refreshParamList();
+ } else {
+ ElMessage.error(res.msg || "鍚屾澶辫触");
+ }
+ });
+ }
})
.catch(() => {});
};
@@ -670,15 +689,20 @@
// 浜у搧閫夋嫨
const handleProductSelect = products => {
+ console.log(products, "===products===");
if (products && products.length > 0) {
const product = products[0];
- form.value.productModelId = product.id;
- form.value.productName = product.productName;
- form.value.model = product.model;
- form.value.unit = product.unit || "";
+ console.log(product, "product");
+ form.value = {
+ ...form.value,
+ productModelId: product.id,
+ productName: product.productName,
+ model: product.model,
+ unit: product.unit || "",
+ };
showProductSelectDialog.value = false;
// 瑙﹀彂琛ㄥ崟楠岃瘉
- formRef.value?.validateField("productModelId");
+ // formRef.value?.validateField("productModelId");
}
};
@@ -773,6 +797,8 @@
productName: "",
model: "",
unit: "",
+ isQuality: false,
+ isProduction: false,
};
formRef.value?.resetFields();
};
@@ -788,7 +814,7 @@
currentProcess.value = row;
const query = {
technologyRoutingOperationId: row.id,
- orderId: orderId.value,
+ productionOrderId: orderId.value,
};
const apiPromise =
diff --git a/src/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue b/src/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue
index 9e1a852..6b040d6 100644
--- a/src/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue
+++ b/src/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue
@@ -1,298 +1,327 @@
<template>
<div>
- <el-dialog v-model="dialogVisible" title="棰嗘枡鍙拌处" width="1200px" @close="handleClose">
+ <el-dialog v-model="dialogVisible"
+ title="棰嗘枡鍙拌处"
+ width="1200px"
+ @close="handleClose">
<div class="material-toolbar">
- <el-button type="primary" @click="handleAddMaterialRow">鏂板</el-button>
+ <el-button type="primary"
+ @click="handleAddMaterialRow">鏂板</el-button>
</div>
- <el-table v-loading="materialTableLoading" :data="materialTableData" border row-key="tempId">
- <el-table-column label="宸ュ簭鍚嶇О" min-width="180">
+ <el-table v-loading="materialTableLoading"
+ :data="materialTableData"
+ border
+ row-key="tempId">
+ <el-table-column label="宸ュ簭鍚嶇О"
+ min-width="180">
<template #default="{ row }">
<span v-if="row.bom === true">{{ row.processName || "-" }}</span>
- <el-select
- v-else
- v-model="row.processName"
- placeholder="璇烽�夋嫨宸ュ簭"
- clearable
- filterable
- style="width: 100%;"
- @change="val => handleProcessNameChange(row, val)"
- >
- <el-option v-for="item in processOptions" :key="item.id" :label="item.name" :value="item.name" />
+ <el-select v-else
+ v-model="row.processName"
+ placeholder="璇烽�夋嫨宸ュ簭"
+ clearable
+ filterable
+ style="width: 100%;"
+ @change="val => handleProcessNameChange(row, val)">
+ <el-option v-for="item in processOptions"
+ :key="item.id"
+ :label="item.name"
+ :value="item.name" />
</el-select>
</template>
</el-table-column>
- <el-table-column label="鍘熸枡鍚嶇О" min-width="160">
+ <el-table-column label="鍘熸枡鍚嶇О"
+ min-width="160">
<template #default="{ row }">
<span v-if="row.bom === true">{{ row.materialName || "-" }}</span>
- <el-button v-else type="primary" link @click="openMaterialProductSelect(row)">
+ <el-button v-else
+ type="primary"
+ link
+ @click="openMaterialProductSelect(row)">
{{ row.materialName || "閫夋嫨鍘熸枡" }}
</el-button>
</template>
</el-table-column>
- <el-table-column label="鍘熸枡鍨嬪彿" min-width="180">
+ <el-table-column label="鍘熸枡鍨嬪彿"
+ min-width="180">
<template #default="{ row }">
{{ row.materialModel || "-" }}
</template>
</el-table-column>
- <el-table-column label="闇�姹傛暟閲�" min-width="120">
+ <el-table-column label="闇�姹傛暟閲�"
+ min-width="120">
<template #default="{ row }">
<span v-if="row.bom === true">{{ row.requiredQty ?? "-" }}</span>
- <el-input-number
- v-else
- v-model="row.requiredQty"
- :min="0"
- :precision="3"
- :step="1"
- controls-position="right"
- style="width: 100%;"
- @change="val => handleRequiredQtyChange(row, val)"
- />
+ <el-input-number v-else
+ v-model="row.requiredQty"
+ :min="0"
+ :precision="3"
+ :step="1"
+ controls-position="right"
+ style="width: 100%;"
+ @change="val => handleRequiredQtyChange(row, val)" />
</template>
</el-table-column>
- <el-table-column label="璁¢噺鍗曚綅" width="120">
+ <el-table-column label="璁¢噺鍗曚綅"
+ width="120">
<template #default="{ row }">
{{ row.unit || "-" }}
</template>
</el-table-column>
- <el-table-column label="棰嗙敤鏁伴噺" min-width="120">
+ <el-table-column label="棰嗙敤鏁伴噺"
+ min-width="120">
<template #default="{ row }">
- <el-input-number
- v-model="row.pickQty"
- :min="0"
- :precision="3"
- :step="1"
- controls-position="right"
- style="width: 100%;"
- />
+ <el-input-number v-model="row.pickQty"
+ :min="0"
+ :precision="3"
+ :step="1"
+ controls-position="right"
+ style="width: 100%;" />
</template>
</el-table-column>
- <el-table-column label="鎿嶄綔" width="90" fixed="right">
+ <el-table-column label="鎿嶄綔"
+ width="90"
+ fixed="right">
<template #default="{ $index, row }">
- <el-button v-if="row.bom !== true" type="danger" link @click="handleDeleteMaterialRow($index)">鍒犻櫎</el-button>
+ <el-button v-if="row.bom !== true"
+ type="danger"
+ link
+ @click="handleDeleteMaterialRow($index)">鍒犻櫎</el-button>
</template>
</el-table-column>
</el-table>
<template #footer>
<span class="dialog-footer">
- <el-button type="primary" :loading="materialSaving" @click="handleMaterialSave">淇濆瓨</el-button>
+ <el-button type="primary"
+ :loading="materialSaving"
+ @click="handleMaterialSave">淇濆瓨</el-button>
<el-button @click="dialogVisible = false">鍙栨秷</el-button>
</span>
</template>
</el-dialog>
-
- <ProductSelectDialog
- v-model="materialProductDialogVisible"
- @confirm="handleMaterialProductConfirm"
- single
- request-url="/stockInventory/rawMaterials"
- />
+ <ProductSelectDialog v-model="materialProductDialogVisible"
+ @confirm="handleMaterialProductConfirm"
+ single />
+ <!-- request-url="/stockInventory/rawMaterials" -->
</div>
</template>
<script setup>
-import { computed, ref, watch } from "vue";
-import { ElMessage } from "element-plus";
-import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
-import { findProductProcessRouteItemList } from "@/api/productionManagement/productProcessRoute.js";
-import {
- listMaterialPickingDetail,
- listMaterialPickingLedger,
- saveMaterialPickingLedger,
-} from "@/api/productionManagement/productionOrder.js";
+ import { computed, ref, watch } from "vue";
+ import { ElMessage } from "element-plus";
+ import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
+ import { findProductProcessRouteItemList } from "@/api/productionManagement/productProcessRoute.js";
+ import {
+ listMaterialPickingDetail,
+ listMaterialPickingLedger,
+ saveMaterialPickingLedger,
+ } from "@/api/productionManagement/productionOrder.js";
-const props = defineProps({
- modelValue: { type: Boolean, default: false },
- orderRow: { type: Object, default: null },
-});
-const emit = defineEmits(["update:modelValue", "saved"]);
-
-const dialogVisible = computed({
- get: () => props.modelValue,
- set: val => emit("update:modelValue", val),
-});
-
-const materialProductDialogVisible = ref(false);
-const materialTableLoading = ref(false);
-const materialSaving = ref(false);
-const materialTableData = ref([]);
-const processOptions = ref([]);
-const currentMaterialSelectRowIndex = ref(-1);
-let materialTempId = 0;
-
-const createMaterialRow = (row = {}) => ({
- tempId: row.id || `temp_${++materialTempId}`,
- id: row.id,
- processId: row.processId,
- productProcessId: row.productProcessId || row.processId,
- processName: row.processName || "",
- bom: row.bom === true,
- materialModelId: row.materialModelId,
- materialName: row.materialName || "",
- materialModel: row.materialModel || "",
- requiredQty: Number(row.requiredQty ?? 0),
- unit: row.unit || "",
- pickQty: Number(row.pickQty ?? row.requiredQty ?? 0),
-});
-
-const getProcessOptions = async () => {
- if (!props.orderRow?.id) return;
- const res = await findProductProcessRouteItemList({ orderId: props.orderRow.id });
- const routeList = Array.isArray(res?.data) ? res.data : res?.data?.records || [];
- const processMap = new Map();
- routeList.forEach(item => {
- const processId = item.processId;
- const processName = item.processName;
- if (!processId || !processName) return;
- const key = `${processId}_${processName}`;
- if (!processMap.has(key)) {
- processMap.set(key, {
- id: processId,
- name: processName,
- });
- }
+ const props = defineProps({
+ modelValue: { type: Boolean, default: false },
+ orderRow: { type: Object, default: null },
});
- processOptions.value = Array.from(processMap.values());
-};
+ const emit = defineEmits(["update:modelValue", "saved"]);
-const loadMaterialData = async () => {
- if (!props.orderRow?.id) return;
- materialTableLoading.value = true;
- materialTableData.value = [];
- await getProcessOptions();
- try {
- const detailRes = await listMaterialPickingDetail({ orderId: props.orderRow.id });
- const detailList = Array.isArray(detailRes?.data)
- ? detailRes.data
- : detailRes?.data?.records || [];
- if (detailList.length > 0) {
- materialTableData.value = detailList.map(item => createMaterialRow(item));
+ const dialogVisible = computed({
+ get: () => props.modelValue,
+ set: val => emit("update:modelValue", val),
+ });
+
+ const materialProductDialogVisible = ref(false);
+ const materialTableLoading = ref(false);
+ const materialSaving = ref(false);
+ const materialTableData = ref([]);
+ const processOptions = ref([]);
+ const currentMaterialSelectRowIndex = ref(-1);
+ let materialTempId = 0;
+
+ const createMaterialRow = (row = {}) => ({
+ tempId: row.id || `temp_${++materialTempId}`,
+ id: row.id,
+ processId: row.processId,
+ productProcessId: row.productProcessId || row.processId,
+ processName: row.processName || "",
+ bom: row.bom === true,
+ materialModelId: row.materialModelId,
+ materialName: row.materialName || "",
+ materialModel: row.materialModel || "",
+ requiredQty: Number(row.requiredQty ?? 0),
+ unit: row.unit || "",
+ pickQty: Number(row.pickQty ?? row.requiredQty ?? 0),
+ });
+
+ const getProcessOptions = async () => {
+ if (!props.orderRow?.id) return;
+ const res = await findProductProcessRouteItemList({
+ orderId: props.orderRow.id,
+ });
+ const routeList = Array.isArray(res?.data)
+ ? res.data
+ : res?.data?.records || [];
+ const processMap = new Map();
+ routeList.forEach(item => {
+ const processId = item.processId;
+ const processName = item.processName;
+ if (!processId || !processName) return;
+ const key = `${processId}_${processName}`;
+ if (!processMap.has(key)) {
+ processMap.set(key, {
+ id: processId,
+ name: processName,
+ });
+ }
+ });
+ processOptions.value = Array.from(processMap.values());
+ };
+
+ const loadMaterialData = async () => {
+ if (!props.orderRow?.id) return;
+ materialTableLoading.value = true;
+ materialTableData.value = [];
+ await getProcessOptions();
+ try {
+ const detailRes = await listMaterialPickingDetail({
+ orderId: props.orderRow.id,
+ });
+ const detailList = Array.isArray(detailRes?.data)
+ ? detailRes.data
+ : detailRes?.data?.records || [];
+ if (detailList.length > 0) {
+ materialTableData.value = detailList.map(item => createMaterialRow(item));
+ return;
+ }
+ const ledgerRes = await listMaterialPickingLedger({
+ orderId: props.orderRow.id,
+ });
+ const ledgerList = Array.isArray(ledgerRes?.data)
+ ? ledgerRes.data
+ : ledgerRes?.data?.records || [];
+ materialTableData.value = ledgerList.map(item => createMaterialRow(item));
+ } finally {
+ materialTableLoading.value = false;
+ }
+ };
+
+ watch(
+ () => dialogVisible.value,
+ visible => {
+ if (visible) {
+ loadMaterialData();
+ }
+ }
+ );
+
+ const handleClose = () => {
+ materialTableData.value = [];
+ currentMaterialSelectRowIndex.value = -1;
+ };
+
+ const handleAddMaterialRow = () => {
+ materialTableData.value.push(createMaterialRow());
+ };
+
+ const handleDeleteMaterialRow = index => {
+ materialTableData.value.splice(index, 1);
+ };
+
+ const handleProcessNameChange = (row, processName) => {
+ const process = processOptions.value.find(item => item.name === processName);
+ row.productProcessId = process?.id;
+ };
+
+ const handleRequiredQtyChange = (row, val) => {
+ const required = Number(val ?? 0);
+ row.requiredQty = required;
+ if (!row.pickQty || Number(row.pickQty) === 0) {
+ row.pickQty = required;
+ }
+ };
+
+ const openMaterialProductSelect = row => {
+ currentMaterialSelectRowIndex.value = materialTableData.value.findIndex(
+ item => item.tempId === row.tempId
+ );
+ materialProductDialogVisible.value = true;
+ };
+
+ const handleMaterialProductConfirm = products => {
+ if (!products || products.length === 0) return;
+ const index = currentMaterialSelectRowIndex.value;
+ if (index < 0 || !materialTableData.value[index]) return;
+ const product = products[0];
+ const row = materialTableData.value[index];
+ row.materialModelId =
+ product.materialModelId || product.modelId || product.id;
+ row.materialName =
+ product.materialName || product.productName || product.name || "";
+ row.materialModel = product.materialModel || product.model || "";
+ row.unit = product.unit || product.measureUnit || "";
+ currentMaterialSelectRowIndex.value = -1;
+ materialProductDialogVisible.value = false;
+ };
+
+ const validateMaterialRows = () => {
+ if (materialTableData.value.length === 0) {
+ return { valid: false, message: "璇峰厛鏂板棰嗘枡鏁版嵁" };
+ }
+ const invalidNewRow = materialTableData.value.find(
+ item => item.bom !== true && (!item.processName || !item.materialName)
+ );
+ if (invalidNewRow) {
+ return { valid: false, message: "鏂板琛岀殑宸ュ簭鍚嶇О鍜屽師鏂欏悕绉颁负蹇呭~椤�" };
+ }
+ const invalidRow = materialTableData.value.find(
+ item =>
+ !item.processName ||
+ !item.materialName ||
+ item.requiredQty === null ||
+ item.requiredQty === undefined ||
+ item.pickQty === null ||
+ item.pickQty === undefined
+ );
+ if (invalidRow) {
+ return { valid: false, message: "璇峰畬鍠勫伐搴忋�佸師鏂欏拰鏁伴噺鍚庡啀淇濆瓨" };
+ }
+ return { valid: true, message: "" };
+ };
+
+ const handleMaterialSave = async () => {
+ if (!props.orderRow?.id) return;
+ const validateResult = validateMaterialRows();
+ if (!validateResult.valid) {
+ ElMessage.warning(validateResult.message);
return;
}
- const ledgerRes = await listMaterialPickingLedger({ orderId: props.orderRow.id });
- const ledgerList = Array.isArray(ledgerRes?.data)
- ? ledgerRes.data
- : ledgerRes?.data?.records || [];
- materialTableData.value = ledgerList.map(item => createMaterialRow(item));
- } finally {
- materialTableLoading.value = false;
- }
-};
-
-watch(
- () => dialogVisible.value,
- visible => {
- if (visible) {
- loadMaterialData();
+ materialSaving.value = true;
+ try {
+ await saveMaterialPickingLedger({
+ orderId: props.orderRow.id,
+ items: materialTableData.value.map(item => ({
+ id: item.id,
+ processId: item.processName,
+ productProcessId: item.productProcessId,
+ processName: item.processName,
+ bom: item.bom === true,
+ materialModelId: item.materialModelId,
+ materialName: item.materialName,
+ materialModel: item.materialModel,
+ requiredQty: item.requiredQty,
+ unit: item.unit,
+ pickQty: item.pickQty,
+ })),
+ });
+ emit("saved");
+ dialogVisible.value = false;
+ } finally {
+ materialSaving.value = false;
}
- }
-);
-
-const handleClose = () => {
- materialTableData.value = [];
- currentMaterialSelectRowIndex.value = -1;
-};
-
-const handleAddMaterialRow = () => {
- materialTableData.value.push(createMaterialRow());
-};
-
-const handleDeleteMaterialRow = index => {
- materialTableData.value.splice(index, 1);
-};
-
-const handleProcessNameChange = (row, processName) => {
- const process = processOptions.value.find(item => item.name === processName);
- row.productProcessId = process?.id;
-};
-
-const handleRequiredQtyChange = (row, val) => {
- const required = Number(val ?? 0);
- row.requiredQty = required;
- if (!row.pickQty || Number(row.pickQty) === 0) {
- row.pickQty = required;
- }
-};
-
-const openMaterialProductSelect = row => {
- currentMaterialSelectRowIndex.value = materialTableData.value.findIndex(item => item.tempId === row.tempId);
- materialProductDialogVisible.value = true;
-};
-
-const handleMaterialProductConfirm = products => {
- if (!products || products.length === 0) return;
- const index = currentMaterialSelectRowIndex.value;
- if (index < 0 || !materialTableData.value[index]) return;
- const product = products[0];
- const row = materialTableData.value[index];
- row.materialModelId = product.materialModelId || product.modelId || product.id;
- row.materialName = product.materialName || product.productName || product.name || "";
- row.materialModel = product.materialModel || product.model || "";
- row.unit = product.unit || product.measureUnit || "";
- currentMaterialSelectRowIndex.value = -1;
- materialProductDialogVisible.value = false;
-};
-
-const validateMaterialRows = () => {
- if (materialTableData.value.length === 0) {
- return { valid: false, message: "璇峰厛鏂板棰嗘枡鏁版嵁" };
- }
- const invalidNewRow = materialTableData.value.find(
- item => item.bom !== true && (!item.processName || !item.materialName)
- );
- if (invalidNewRow) {
- return { valid: false, message: "鏂板琛岀殑宸ュ簭鍚嶇О鍜屽師鏂欏悕绉颁负蹇呭~椤�" };
- }
- const invalidRow = materialTableData.value.find(
- item =>
- !item.processName ||
- !item.materialName ||
- item.requiredQty === null ||
- item.requiredQty === undefined ||
- item.pickQty === null ||
- item.pickQty === undefined
- );
- if (invalidRow) {
- return { valid: false, message: "璇峰畬鍠勫伐搴忋�佸師鏂欏拰鏁伴噺鍚庡啀淇濆瓨" };
- }
- return { valid: true, message: "" };
-};
-
-const handleMaterialSave = async () => {
- if (!props.orderRow?.id) return;
- const validateResult = validateMaterialRows();
- if (!validateResult.valid) {
- ElMessage.warning(validateResult.message);
- return;
- }
- materialSaving.value = true;
- try {
- await saveMaterialPickingLedger({
- orderId: props.orderRow.id,
- items: materialTableData.value.map(item => ({
- id: item.id,
- processId: item.processName,
- productProcessId: item.productProcessId,
- processName: item.processName,
- bom: item.bom === true,
- materialModelId: item.materialModelId,
- materialName: item.materialName,
- materialModel: item.materialModel,
- requiredQty: item.requiredQty,
- unit: item.unit,
- pickQty: item.pickQty,
- })),
- });
- emit("saved");
- dialogVisible.value = false;
- } finally {
- materialSaving.value = false;
- }
-};
+ };
</script>
<style scoped lang="scss">
-.material-toolbar {
- margin-bottom: 12px;
- text-align: right;
-}
+ .material-toolbar {
+ margin-bottom: 12px;
+ text-align: right;
+ }
</style>
diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index a67130c..670290c 100644
--- a/src/views/productionManagement/productionOrder/index.vue
+++ b/src/views/productionManagement/productionOrder/index.vue
@@ -28,7 +28,7 @@
@change="handleQuery" />
</el-form-item>
<el-form-item label="浜у搧鍚嶇О:">
- <el-input v-model="searchForm.productCategory"
+ <el-input v-model="searchForm.productName"
placeholder="璇疯緭鍏�"
clearable
prefix-icon="Search"
@@ -36,7 +36,7 @@
@change="handleQuery" />
</el-form-item>
<el-form-item label="瑙勬牸:">
- <el-input v-model="searchForm.specificationModel"
+ <el-input v-model="searchForm.model"
placeholder="璇疯緭鍏�"
clearable
prefix-icon="Search"
@@ -269,8 +269,8 @@
customerName: "",
salesContractNo: "",
projectName: "",
- productCategory: "",
- specificationModel: "",
+ productName: "",
+ model: "",
},
});
const { searchForm } = toRefs(data);
@@ -429,9 +429,9 @@
id: data.id,
bomId: data.bomId,
processRouteCode: data.processRouteCode || "",
- productName: data.productName || "",
- model: data.model || "",
- bomNo: data.bomNo || "",
+ productName: row.productName || "",
+ model: row.model || "",
+ bomNo: row.bomNo || "",
description: data.description || "",
orderId,
type: "order",
@@ -449,8 +449,8 @@
query: {
id: row.id,
bomNo: row.bomNo || "",
- productName: row.productCategory || "",
- productModelName: row.specificationModel || "",
+ productName: row.productName || "",
+ productModelName: row.model || "",
orderId: row.id,
type: "order",
},
diff --git a/src/views/productionPlan/productionPlan/index.vue b/src/views/productionPlan/productionPlan/index.vue
index 9768093..289ecaf 100644
--- a/src/views/productionPlan/productionPlan/index.vue
+++ b/src/views/productionPlan/productionPlan/index.vue
@@ -343,7 +343,7 @@
},
{
label: "宸蹭笅鍙戞暟閲�",
- prop: "assignedQuantity",
+ prop: "quantityIssued",
width: "120px",
className: "spec-cell",
// formatData: (cell, row) => (cell ? `${cell}${row.unit || "鏂�"}` : 0),
@@ -618,9 +618,9 @@
};
}
summary[category].totalAssignedQuantity += Number(
- (
- Number(row.qtyRequired || 0) - Number(row.assignedQuantity || 0)
- ).toFixed(4)
+ (Number(row.qtyRequired || 0) - Number(row.quantityIssued || 0)).toFixed(
+ 4
+ )
);
});
@@ -668,7 +668,7 @@
// 鍒ゆ柇琛屾槸鍚﹀彲閫夋嫨
const isSelectable = row => {
// 璁$畻鍓╀綑鏁伴噺
- const remainingQty = (row.qtyRequired || 0) - (row.assignedQuantity || 0);
+ const remainingQty = (row.qtyRequired || 0) - (row.quantityIssued || 0);
// 濡傛灉鍓╀綑鏁伴噺灏忎簬绛変簬0锛岀姝㈤�夋嫨
if (remainingQty <= 0) {
return false;
--
Gitblit v1.9.3