From a8e998ae4591fb97b0fc7a605226424316ae5742 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期四, 25 十二月 2025 16:44:38 +0800
Subject: [PATCH] 没有调机时间转跳到上下刀界面
---
components/mold.vue | 98 +++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 94 insertions(+), 4 deletions(-)
diff --git a/components/mold.vue b/components/mold.vue
index ff12f7e..55e215b 100644
--- a/components/mold.vue
+++ b/components/mold.vue
@@ -832,16 +832,16 @@
}
const staffNo = this.tiaojiStaffNo.split(':')[0];
- const totalQty = okQty + badQty; // 璇曚骇鎬绘暟 = 鑹搧鏁� + 涓嶈壇鍝佹暟
+ const currentCjNum = this.order?.currentCjNum || 0;
// 璋冪敤鎶ヨ瘯浜ф暟鎺ュ彛(浣跨敤鎶ュ伐鐣岄潰鐨勬帴鍙�)
const payload = {
orderNo: this.workOrderNo,
orderId: this.orderId, // 闇�瑕佷粠宸ュ崟鏁版嵁涓幏鍙�
- bf: totalQty, // 璇曚骇鎬绘暟
+ bf: badQty, // bf浼犻�掍笉鑹搧鏁�
staffNo: staffNo,
- initCjNum: this.order?.initCjNum || 0,
- currentCjNum: this.order?.currentCjNum || 0,
+ initCjNum: currentCjNum - badQty - okQty, // initCjNum = currentCjNum - bf - 鑹搧鏁�
+ currentCjNum: currentCjNum,
type: 'tiaoji', // 鏍囪瘑涓鸿皟鏈烘姤宸�
tiaojiOkQty: okQty, // 鏂板:鑹搧鏁�
tiaojiBadQty: badQty // 鏂板:涓嶈壇鍝佹暟
@@ -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