From 1c23dc22cc3350d4989522282e6b3e1c5e64436f Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期四, 25 十二月 2025 10:48:46 +0800
Subject: [PATCH] 调试
---
components/mold.vue | 90 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 90 insertions(+), 0 deletions(-)
diff --git a/components/mold.vue b/components/mold.vue
index 569f1d4..55e215b 100644
--- a/components/mold.vue
+++ b/components/mold.vue
@@ -867,6 +867,9 @@
// 鍒锋柊鏁版嵁
await this.fetchFormData();
await this.fetchDefaultToolFromWorkOrder();
+
+ // 鏂板锛氳嚜鍔ㄥ鐞嗚皟鏈洪�佹鐣岄潰鐨勬寜閽�昏緫
+ await this.autoHandleMachineInspection();
} catch (err) {
console.error('璋冩満鎶ュ伐閿欒:', err);
this.$showMessage('璋冩満鎶ュ伐澶辫触锛岃妫�鏌ョ綉缁�');
@@ -875,6 +878,93 @@
}
},
+ // 鏂板锛氳嚜鍔ㄥ鐞嗚皟鏈洪�佹鐣岄潰鐨勬寜閽�昏緫
+ async autoHandleMachineInspection() {
+ try {
+ // 1. 浣跨敤 FindByOrderNo 鑾峰彇璋冩満閫佹鐣岄潰鐨勪笁涓椂闂�
+ const statusRes = await this.$post({
+ url: '/MesOrderSta/FindByOrderNo',
+ data: {
+ orderId: this.orderId,
+ orderNo: this.workOrderNo
+ }
+ });
+
+ if (!statusRes || !statusRes.data || !statusRes.data.tbBillList) {
+ console.error('鑾峰彇宸ュ崟鐘舵�佸け璐�');
+ this.$showMessage('鑾峰彇宸ュ崟鐘舵�佸け璐�');
+ return;
+ }
+
+ const statusForm = statusRes.data.tbBillList;
+ const maStartTime = statusForm.maStartTime;
+ const maShoutTime = statusForm.maShoutTime;
+ const maEndTime = statusForm.maEndTime;
+
+ // 2. 鍑嗗闇�瑕佹洿鏂扮殑鏃堕棿鏁版嵁
+ let needSave = false;
+ let updateData = {
+ id: statusForm.id,
+ orderId: this.orderId,
+ machineNo: this.machineNo,
+ flag: -1
+ };
+
+ // 璁板綍鍝簺鎿嶄綔琚墽琛屼簡
+ let actions = [];
+
+ // 3. 浠庝笂鍒颁笅鏍规嵁鏄剧ず妗嗛噷鏄惁鏈夋椂闂翠緷娆¤缃�
+ // 濡傛灉璋冩満寮�濮嬫椂闂翠负绌猴紝璁剧疆璋冩満寮�濮嬫椂闂�
+ if (!maStartTime) {
+ updateData.maStartTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
+ updateData.flag = -1; // 璋冩満寮�濮嬬殑flag=-1
+ needSave = true;
+ actions.push('璋冩満寮�濮�');
+ } else {
+ updateData.maStartTime = maStartTime;
+ }
+
+ // 濡傛灉閫佹鍛煎彨鏃堕棿涓虹┖锛岃缃�佹鍛煎彨鏃堕棿
+ if (!maShoutTime) {
+ updateData.maShoutTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
+ updateData.flag = 1; // 棣栨閫佹鍛煎彨鐨刦lag=1
+ needSave = true;
+ actions.push('閫佹鍛煎彨');
+ } else {
+ updateData.maShoutTime = maShoutTime;
+ }
+
+ // 璋冩満瀹屾垚鏃堕棿淇濇寔涓嶅彉
+ updateData.maEndTime = maEndTime || '';
+
+ // 4. 濡傛灉鏈夐渶瑕佹洿鏂扮殑鏃堕棿锛岃皟鐢ㄤ繚瀛樻帴鍙�
+ if (needSave) {
+ const saveRes = await this.$post({
+ url: '/MesOrderSta/ChangeMachineTime',
+ data: updateData
+ });
+
+ if (saveRes && saveRes.data && saveRes.data.tbBillList) {
+ const successMsg = actions.join('銆�') + '鎴愬姛';
+ this.$showMessage(successMsg);
+ console.log('璋冩満閫佹鐣岄潰鏃堕棿鑷姩鏇存柊鎴愬姛:', actions);
+ } else {
+ const failMsg = actions.join('銆�') + '澶辫触';
+ this.$showMessage(failMsg);
+ console.error('璋冩満閫佹鐣岄潰鏃堕棿鑷姩鏇存柊澶辫触');
+ }
+ } else {
+ // 鎵�鏈夋椂闂撮兘宸插瓨鍦紝鏃犻渶鏇存柊
+ this.$showMessage('璋冩満寮�濮嬪拰閫佹鍛煎彨宸插畬鎴�');
+ console.log('璋冩満寮�濮嬪拰閫佹鍛煎彨鏃堕棿宸插瓨鍦紝鏃犻渶鏇存柊');
+ }
+ } catch (err) {
+ console.error('鑷姩澶勭悊璋冩満閫佹鐣岄潰澶辫触:', err);
+ this.$showMessage('鑷姩澶勭悊璋冩満閫佹澶辫触');
+ // 涓嶄腑鏂富娴佺▼锛屽彧璁板綍閿欒
+ }
+ },
+
// 鏂板锛氳幏鍙栬皟鏈哄笀鍌呭垪琛�
async fetchTiaojiStaff() {
try {
--
Gitblit v1.9.3