From 61449dbf92441b41e37c1d519e8662cca998ff6a Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 02 四月 2026 11:45:08 +0800
Subject: [PATCH] fix: 添加批号
---
src/views/inventoryManagement/stockManagement/New.vue | 35 ++++++++++-
src/views/procurementManagement/procurementLedger/index.vue | 27 +++++++++
src/views/qualityManagement/nonconformingManagement/components/formDia.vue | 26 ++++++++
src/views/productionManagement/productionOrder/New.vue | 8 +-
src/views/qualityManagement/finalInspection/components/formDia.vue | 30 ++++++++-
src/views/productionManagement/productionOrder/index.vue | 4
src/views/inventoryManagement/stockManagement/Qualified.vue | 11 +++
src/views/qualityManagement/finalInspection/index.vue | 11 +++
src/views/inventoryManagement/stockManagement/Unqualified.vue | 11 +++
src/views/productionManagement/productionOrder/Detail/index.vue | 4
src/views/qualityManagement/nonconformingManagement/index.vue | 13 +++
11 files changed, 156 insertions(+), 24 deletions(-)
diff --git a/src/views/inventoryManagement/stockManagement/New.vue b/src/views/inventoryManagement/stockManagement/New.vue
index 21a36fe..b6c74d4 100644
--- a/src/views/inventoryManagement/stockManagement/New.vue
+++ b/src/views/inventoryManagement/stockManagement/New.vue
@@ -44,6 +44,14 @@
<el-input v-model="formState.unit" disabled />
</el-form-item>
+ <el-form-item label="鎵瑰彿" prop="batchNo">
+ <el-input
+ v-model="formState.batchNo"
+ clearable
+ placeholder="鍙緭鍏ユ壒鍙凤紝鐣欑┖灏嗚嚜鍔ㄧ敓鎴�"
+ />
+ </el-form-item>
+
<el-form-item
label="搴撳瓨鏁伴噺"
prop="qualitity"
@@ -109,10 +117,22 @@
productModelName: "",
materialCode: "",
unit: "",
+ batchNo: "",
qualitity: 0,
warnNum: 0,
remark: '',
});
+
+/** 鏈~鍐欐壒鍙锋椂鐢熸垚鍞竴鎵瑰彿锛堝墠绔敓鎴愶紝鍚庣涔熷彲鍐嶈鐩栵級 */
+const generateBatchNo = () => {
+ const d = new Date();
+ const pad = (n) => String(n).padStart(2, "0");
+ const ts = `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}${pad(d.getHours())}${pad(d.getMinutes())}${pad(d.getSeconds())}`;
+ const r = Math.floor(Math.random() * 10000)
+ .toString()
+ .padStart(4, "0");
+ return `PH${ts}${r}`;
+};
const isShow = computed({
get() {
@@ -134,7 +154,12 @@
productModelId: undefined,
productName: "",
productModelName: "",
- description: '',
+ materialCode: "",
+ unit: "",
+ batchNo: "",
+ qualitity: 0,
+ warnNum: 0,
+ remark: "",
};
isShow.value = false;
};
@@ -167,8 +192,12 @@
proxy.$modal.msgError("璇烽�夋嫨瑙勬牸");
return;
}
+ const payload = { ...formState.value };
+ const bn = (payload.batchNo || "").trim();
+ payload.batchNo = bn || generateBatchNo();
+
if (props.type === 'qualified') {
- createStockInventory(formState.value).then(res => {
+ createStockInventory(payload).then(res => {
// 鍏抽棴妯℃�佹
isShow.value = false;
// 鍛婄煡鐖剁粍浠跺凡瀹屾垚
@@ -176,7 +205,7 @@
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
})
} else {
- createStockUnInventory(formState.value).then(res => {
+ createStockUnInventory(payload).then(res => {
// 鍏抽棴妯℃�佹
isShow.value = false;
// 鍛婄煡鐖剁粍浠跺凡瀹屾垚
diff --git a/src/views/inventoryManagement/stockManagement/Qualified.vue b/src/views/inventoryManagement/stockManagement/Qualified.vue
index ba40eb7..6ea8d21 100644
--- a/src/views/inventoryManagement/stockManagement/Qualified.vue
+++ b/src/views/inventoryManagement/stockManagement/Qualified.vue
@@ -2,8 +2,13 @@
<div class="app-container">
<div class="search_form">
<div>
- <span class="search_title ml10">浜у搧澶х被锛�</span>
+ <span class="search_title ml10">浜у搧鍚嶇О锛�</span>
<el-input v-model="searchForm.productName"
+ style="width: 240px"
+ placeholder="璇疯緭鍏�"
+ clearable/>
+ <span class="search_title ml10">瑙勬牸鍨嬪彿锛�</span>
+ <el-input v-model="searchForm.model"
style="width: 240px"
placeholder="璇疯緭鍏�"
clearable/>
@@ -25,6 +30,7 @@
<el-table-column align="center" label="搴忓彿" type="index" width="60" />
<el-table-column label="浜у搧澶х被" prop="productName" show-overflow-tooltip />
<el-table-column label="瑙勬牸鍨嬪彿" prop="model" show-overflow-tooltip />
+ <el-table-column label="鎵瑰彿" prop="batchNo" show-overflow-tooltip />
<el-table-column label="鏂欏彿" prop="materialCode" show-overflow-tooltip />
<el-table-column label="鍗曚綅" prop="unit" show-overflow-tooltip />
<el-table-column label="搴撳瓨鏁伴噺" prop="qualitity" show-overflow-tooltip />
@@ -70,7 +76,7 @@
<script setup>
import pagination from '@/components/PIMTable/Pagination.vue'
-import { ref, reactive, toRefs, onMounted, getCurrentInstance } from 'vue'
+import { ref, reactive, toRefs, onMounted, getCurrentInstance, defineAsyncComponent } from 'vue'
import {ElMessage, ElMessageBox} from "element-plus";
import { getStockInventoryListPage } from "@/api/inventoryManagement/stockInventory.js";
const NewStockInventory = defineAsyncComponent(() => import("@/views/inventoryManagement/stockManagement/New.vue"));
@@ -100,6 +106,7 @@
const data = reactive({
searchForm: {
productName: '',
+ model: '',
}
})
const { searchForm } = toRefs(data)
diff --git a/src/views/inventoryManagement/stockManagement/Unqualified.vue b/src/views/inventoryManagement/stockManagement/Unqualified.vue
index 97d14fb..814a0d1 100644
--- a/src/views/inventoryManagement/stockManagement/Unqualified.vue
+++ b/src/views/inventoryManagement/stockManagement/Unqualified.vue
@@ -2,8 +2,13 @@
<div class="app-container">
<div class="search_form">
<div>
- <span class="search_title ml10">浜у搧澶х被锛�</span>
+ <span class="search_title ml10">浜у搧鍚嶇О锛�</span>
<el-input v-model="searchForm.productName"
+ style="width: 240px"
+ placeholder="璇疯緭鍏�"
+ clearable/>
+ <span class="search_title ml10">瑙勬牸鍨嬪彿锛�</span>
+ <el-input v-model="searchForm.model"
style="width: 240px"
placeholder="璇疯緭鍏�"
clearable/>
@@ -22,6 +27,7 @@
<el-table-column align="center" label="搴忓彿" type="index" width="60" />
<el-table-column label="浜у搧澶х被" prop="productName" show-overflow-tooltip />
<el-table-column label="瑙勬牸鍨嬪彿" prop="model" show-overflow-tooltip />
+ <el-table-column label="鎵瑰彿" prop="batchNo" show-overflow-tooltip />
<el-table-column label="鏂欏彿" prop="materialCode" show-overflow-tooltip />
<el-table-column label="鍗曚綅" prop="unit" show-overflow-tooltip />
<el-table-column label="搴撳瓨鏁伴噺" prop="qualitity" show-overflow-tooltip />
@@ -61,7 +67,7 @@
<script setup>
import pagination from '@/components/PIMTable/Pagination.vue'
-import { ref, reactive, toRefs, onMounted, getCurrentInstance } from 'vue'
+import { ref, reactive, toRefs, onMounted, getCurrentInstance, defineAsyncComponent } from 'vue'
import { ElMessageBox } from "element-plus";
import { getStockUninventoryListPage } from "@/api/inventoryManagement/stockUninventory.js";
const NewStockInventory = defineAsyncComponent(() => import("@/views/inventoryManagement/stockManagement/New.vue"));
@@ -89,6 +95,7 @@
const data = reactive({
searchForm: {
productName: '',
+ model: '',
}
})
const { searchForm } = toRefs(data)
diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index 259f837..7042d47 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -580,6 +580,14 @@
disabled />
</el-form-item>
</el-col>
+ <el-col :span="24">
+ <el-form-item label="鎵瑰彿锛�"
+ prop="batchNo">
+ <el-input v-model="productForm.batchNo"
+ clearable
+ placeholder="閫夊~锛屽彲杈撳叆鎵瑰彿锛涚暀绌哄皢鑷姩鐢熸垚" />
+ </el-form-item>
+ </el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
@@ -966,6 +974,7 @@
productModelId: "",
specificationModel: "",
materialCode: "",
+ batchNo: "",
unit: "",
quantity: "",
taxInclusiveUnitPrice: "",
@@ -1636,10 +1645,28 @@
return newItem;
});
}
+
+ /** 涓庡簱瀛樻柊澧炰竴鑷达細鏈~鎵瑰彿鏃跺墠绔敓鎴愶紙PH + 鏃堕棿鎴� + 闅忔満鏁帮級 */
+ const generateProductBatchNo = () => {
+ const d = new Date();
+ const pad = (n) => String(n).padStart(2, "0");
+ const ts = `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}${pad(d.getHours())}${pad(d.getMinutes())}${pad(d.getSeconds())}`;
+ const r = Math.floor(Math.random() * 10000)
+ .toString()
+ .padStart(4, "0");
+ return `PH${ts}${r}`;
+ };
+
+ const ensureProductBatchNo = () => {
+ const v = (productForm.value.batchNo ?? "").toString().trim();
+ productForm.value.batchNo = v || generateProductBatchNo();
+ };
+
// 鎻愪氦浜у搧琛ㄥ崟
const submitProduct = () => {
proxy.$refs["productFormRef"].validate(valid => {
if (valid) {
+ ensureProductBatchNo();
if (operationType.value === "edit") {
submitProductEdit();
} else {
diff --git a/src/views/productionManagement/productionOrder/Detail/index.vue b/src/views/productionManagement/productionOrder/Detail/index.vue
index 60b1811..ebf227f 100644
--- a/src/views/productionManagement/productionOrder/Detail/index.vue
+++ b/src/views/productionManagement/productionOrder/Detail/index.vue
@@ -8,7 +8,7 @@
<div class="title">鍩虹淇℃伅</div>
<div class="sub">
<span class="mr12">鐢熶骇璁㈠崟鍙凤細{{ header.npsNo || "-" }}</span>
- <span class="mr12">鐢熶骇鎵瑰彿锛歿{ header.lotNo || "-" }}</span>
+ <span class="mr12">鐢熶骇鎵瑰彿锛歿{ header.batchNo || "-" }}</span>
<span class="mr12">浜у搧鍚嶇О锛歿{ header.productCategory || "-" }}</span>
<span class="mr12">瑙勬牸锛歿{ header.specificationModel || "-" }}</span>
<span class="mr12">鏂欏彿锛歿{ header.materialCode || "-" }}</span>
@@ -202,7 +202,7 @@
const header = computed(() => ({
orderId: route.query.orderId,
npsNo: route.query.npsNo,
- lotNo: route.query.lotNo,
+ batchNo: route.query.batchNo,
productCategory: route.query.productCategory,
specificationModel: route.query.specificationModel,
materialCode: route.query.materialCode,
diff --git a/src/views/productionManagement/productionOrder/New.vue b/src/views/productionManagement/productionOrder/New.vue
index f6f13f9..83682fc 100644
--- a/src/views/productionManagement/productionOrder/New.vue
+++ b/src/views/productionManagement/productionOrder/New.vue
@@ -57,9 +57,9 @@
</el-form-item>
<el-form-item
label="鐢熶骇鎵瑰彿"
- prop="lotNo"
+ prop="batchNo"
>
- <el-input v-model="formState.lotNo" placeholder="璇疯緭鍏ョ敓浜ф壒鍙�" />
+ <el-input v-model="formState.batchNo" placeholder="閫夊~锛屽彲杈撳叆鎵瑰彿锛涚暀绌哄皢鑷姩鐢熸垚" />
</el-form-item>
<el-form-item
@@ -139,7 +139,7 @@
unit: "",
priority: undefined,
quantity: 0,
- lotNo: "",
+ batchNo: "",
});
const isShow = computed({
@@ -172,7 +172,7 @@
materialCode: "",
priority: priority_type.value && priority_type.value.length > 0 ? priority_type.value[2].value : undefined,
quantity: '',
- lotNo: "",
+ batchNo: "",
};
isShow.value = false;
};
diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index 0645b4e..c123928 100644
--- a/src/views/productionManagement/productionOrder/index.vue
+++ b/src/views/productionManagement/productionOrder/index.vue
@@ -139,7 +139,7 @@
},
{
label: "鐢熶骇鎵瑰彿",
- prop: "lotNo",
+ prop: "batchNo",
width: '120px',
},
{
@@ -439,7 +439,7 @@
query: {
orderId: row.id,
npsNo: row.npsNo || "",
- lotNo: row.lotNo || "",
+ batchNo: row.batchNo || "",
productCategory: row.productCategory || "",
specificationModel: row.specificationModel || "",
materialCode: row.materialCode || "",
diff --git a/src/views/qualityManagement/finalInspection/components/formDia.vue b/src/views/qualityManagement/finalInspection/components/formDia.vue
index a6a28ae..e15f2aa 100644
--- a/src/views/qualityManagement/finalInspection/components/formDia.vue
+++ b/src/views/qualityManagement/finalInspection/components/formDia.vue
@@ -32,6 +32,15 @@
</el-form-item>
</el-col>
<el-col :span="12">
+ <el-form-item label="鐢熶骇鎵瑰彿锛�">
+ <el-input
+ :model-value="productionBatchDisplay"
+ disabled
+ placeholder="鈥�"
+ />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
<el-form-item label="鎸囨爣閫夋嫨锛�" prop="testStandardId">
<el-select
v-model="form.testStandardId"
@@ -54,8 +63,6 @@
<el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.quantity" placeholder="璇疯緭鍏�" clearable :precision="2" :disabled="quantityDisabled"/>
</el-form-item>
</el-col>
- </el-row>
- <el-row :gutter="30">
<el-col :span="12">
<el-form-item label="鏂欏彿锛�" prop="materialCode">
<el-input v-model="form.materialCode" placeholder="璇疯緭鍏�" disabled/>
@@ -77,8 +84,6 @@
<el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.qualifiedQuantity" placeholder="璇疯緭鍏�" clearable :precision="2" disabled/>
</el-form-item>
</el-col>
- </el-row>
- <el-row :gutter="30">
<el-col :span="12">
<el-form-item label="涓嶈壇鍘熷洜锛�" prop="defectiveReason">
<el-select v-model="form.defectiveReason" placeholder="璇烽�夋嫨" clearable style="width: 100%">
@@ -171,6 +176,8 @@
defectiveReason: undefined,
unit: "",
materialCode: "",
+ /** 鏉ヨ嚜鐢熶骇宸ュ崟/鍙拌处锛屼粎灞曠ず */
+ batchNo: "",
qualifiedQuantity: "",
quantity: "",
checkCompany: "",
@@ -194,6 +201,16 @@
const quantityDisabled = computed(() => {
const v = form.value || {};
return !!(v.productMainId != null || v.purchaseLedgerId != null);
+});
+
+/** 鐢熶骇鎵瑰彿灞曠ず锛堟帴鍙e彲鑳戒负 batchNo 鎴� productionBatchNo锛� */
+const productionBatchDisplay = computed(() => {
+ const f = form.value || {};
+ const v = f.batchNo ?? f.productionBatchNo;
+ if (v === null || v === undefined || String(v).trim() === "") {
+ return "";
+ }
+ return String(v);
});
const supplierList = ref([]);
const productOptions = ref([]);
@@ -278,7 +295,10 @@
// 鍏堜繚瀛� testStandardId锛岄伩鍏嶈娓呯┖
const savedTestStandardId = row.testStandardId;
// 鍏堣缃〃鍗曟暟鎹紝浣嗘殏鏃舵竻绌� testStandardId锛岀瓑閫夐」鍔犺浇瀹屾垚鍚庡啀璁剧疆
- form.value = {...row, testStandardId: ''}
+ form.value = { ...row, testStandardId: "" };
+ // 鐢熶骇鎵瑰彿锛氫笌鐢熶骇宸ュ崟瀛楁瀵归綈锛屽吋瀹瑰绉嶅悗绔瓧娈靛悕
+ form.value.batchNo =
+ row.batchNo ?? row.productionBatchNo ?? form.value.batchNo ?? "";
currentProductId.value = row.productId || 0
// 娓呯┖楠岃瘉鐘舵�侊紝閬垮厤鏁版嵁鍔犺浇杩囩▼涓殑鏍¢獙闂儊
nextTick(() => {
diff --git a/src/views/qualityManagement/finalInspection/index.vue b/src/views/qualityManagement/finalInspection/index.vue
index da31937..625429c 100644
--- a/src/views/qualityManagement/finalInspection/index.vue
+++ b/src/views/qualityManagement/finalInspection/index.vue
@@ -101,6 +101,11 @@
width: 120
},
{
+ label: "鐢熶骇鎵瑰彿",
+ prop: "batchNo",
+ width: 140
+ },
+ {
label: "妫�楠屽憳",
prop: "checkName",
},
@@ -286,7 +291,11 @@
params.entryDate = undefined
qualityInspectListPage({...params, inspectType: 2}).then(res => {
tableLoading.value = false;
- tableData.value = res.data.records
+ const records = res.data.records || [];
+ tableData.value = records.map((row) => ({
+ ...row,
+ batchNo: row.batchNo ?? row.productionBatchNo ?? "",
+ }));
page.total = res.data.total;
}).catch(err => {
tableLoading.value = false;
diff --git a/src/views/qualityManagement/nonconformingManagement/components/formDia.vue b/src/views/qualityManagement/nonconformingManagement/components/formDia.vue
index 0351f5c..eee1753 100644
--- a/src/views/qualityManagement/nonconformingManagement/components/formDia.vue
+++ b/src/views/qualityManagement/nonconformingManagement/components/formDia.vue
@@ -40,6 +40,15 @@
</el-select>
</el-form-item>
</el-col>
+ <el-col :span="12">
+ <el-form-item label="鐢熶骇鎵瑰彿锛�">
+ <el-input
+ :model-value="productionBatchDisplay"
+ disabled
+ placeholder="鈥�"
+ />
+ </el-form-item>
+ </el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
@@ -125,7 +134,7 @@
</template>
<script setup>
-import {ref, reactive, toRefs} from "vue";
+import { ref, reactive, toRefs, computed, getCurrentInstance } from "vue";
import {modelList, productTreeList} from "@/api/basicData/product.js";
import {
getQualityUnqualifiedInfo,
@@ -151,6 +160,8 @@
model: "",
unit: "",
materialCode: "",
+ /** 鏉ヨ嚜涓氬姟鏁版嵁锛屼粎灞曠ず */
+ batchNo: "",
quantity: "",
checkCompany: "",
checkResult: "",
@@ -174,6 +185,16 @@
},
});
const { form, rules } = toRefs(data);
+
+const productionBatchDisplay = computed(() => {
+ const f = form.value || {};
+ const v = f.batchNo ?? f.productionBatchNo;
+ if (v === null || v === undefined || String(v).trim() === "") {
+ return "";
+ }
+ return String(v);
+});
+
const productOptions = ref([]);
const modelOptions = ref([]);
const userList = ref([]); // 妫�楠屽憳/澶勭悊浜轰笅鎷夊垪琛�
@@ -202,6 +223,7 @@
model: '',
unit: '',
materialCode: '',
+ batchNo: '',
quantity: '',
productName: '',
};
@@ -213,6 +235,8 @@
getQualityUnqualifiedInfo(row.id).then(res => {
const { inspectState, ...rest } = (res.data || {})
form.value = { ...rest }
+ form.value.batchNo =
+ rest.batchNo ?? rest.productionBatchNo ?? form.value.batchNo ?? ""
})
}
}
diff --git a/src/views/qualityManagement/nonconformingManagement/index.vue b/src/views/qualityManagement/nonconformingManagement/index.vue
index 7adb63f..a20a47a 100644
--- a/src/views/qualityManagement/nonconformingManagement/index.vue
+++ b/src/views/qualityManagement/nonconformingManagement/index.vue
@@ -34,7 +34,7 @@
<el-button type="primary" @click="handleQuery" style="margin-left: 10px">鎼滅储</el-button>
</div>
<div>
- <el-button type="primary" @click="openForm('add')">鏂板</el-button>
+ <!-- <el-button type="primary" @click="openForm('add')">鏂板</el-button> -->
<el-button @click="handleOut">瀵煎嚭</el-button>
<el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
</div>
@@ -141,6 +141,11 @@
prop: "model",
},
{
+ label: "鐢熶骇鎵瑰彿",
+ prop: "batchNo",
+ width: 140,
+ },
+ {
label: "鏂欏彿",
prop: "materialCode",
},
@@ -237,7 +242,11 @@
params.entryDate = undefined
qualityUnqualifiedListPage(params).then(res => {
tableLoading.value = false;
- tableData.value = res.data.records
+ const records = res.data.records || [];
+ tableData.value = records.map((row) => ({
+ ...row,
+ batchNo: row.batchNo ?? row.productionBatchNo ?? "",
+ }));
page.total = res.data.total;
}).catch(err => {
tableLoading.value = false;
--
Gitblit v1.9.3