快乐的昕的电脑
2025-10-23 ade347e7d681f55bd42a6bde416467bf79a8a388
components/mold.vue
@@ -252,9 +252,10 @@
                if (!this.workOrderNo) { this.$showMessage('工单号不能为空'); return; }
                if (!this.machineNo) { this.$showMessage('机台号不能为空'); return; }
                if (!this.selectedToolNo) { this.$showMessage('刀具编号不能为空'); return; }
                if (!this.useLimitInput) { this.$showMessage('使用上限不能为空'); return; }
                const useLimit = Number(this.useLimitInput);
                if (isNaN(useLimit) || useLimit <= 0) { this.$showMessage('请输入有效的使用上限'); return; }
                //上刀不强制录入使用上限
                //if (!this.useLimitInput) { this.$showMessage('使用上限不能为空'); return; }
                //const useLimit = Number(this.useLimitInput);
                //if (isNaN(useLimit) || useLimit <= 0) { this.$showMessage('请输入有效的使用上限'); return; }
                // sdjs 使用工单 currentCjNum
                const sdjs = this.workOrderCurrentCjNum != null ? Number(this.workOrderCurrentCjNum) : null;
@@ -263,7 +264,7 @@
                    workOrderNo: this.workOrderNo,
                    machineNo: this.machineNo,
                    toolNo: this.selectedToolNo,
                    type: '上刀',
                    type: '上机',
                    useLimit,
                    sdjs // 上刀计数(工单当前数采)
                };
@@ -274,13 +275,19 @@
                        data: JSON.stringify(payload),
                        headers: { 'Content-Type': 'application/json' }
                    });
                    if (res.data && res.data.outMsg) {
                        this.$showMessage(res.data.outMsg);
                    } else if (res.status === 0) {
                        this.$showMessage('上刀提交成功');
                    } else {
                        this.$showMessage(res.message || '上刀提交失败');
                    if (res.data && res.data.outSum === "0") {
                        uni.showToast({
                            title: res.data.outMsg || '',
                            icon: 'error'
                        });
                        return;
                    } else if (res.data && res.data.outMsg) {
                        uni.showToast({
                            title: res.data.outMsg,
                            icon: 'none'
                        });
                    }
                    // 后续逻辑继续执行
                    if (res.status === 0) {
                        await this.fetchFormData();
                    }
@@ -307,7 +314,7 @@
                    workOrderNo: this.workOrderNo,
                    machineNo: this.machineNo,
                    toolNo: this.selectedToolNo,
                    type: '下刀',
                    type: '下机',
                    useLimit,
                    xdjs // 下刀计数
                };
@@ -318,13 +325,19 @@
                        data: JSON.stringify(payload),
                        headers: { 'Content-Type': 'application/json' }
                    });
                    if (res.data && res.data.outMsg) {
                        this.$showMessage(res.data.outMsg);
                    } else if (res.status === 0) {
                        this.$showMessage('下刀提交成功');
                    } else {
                        this.$showMessage(res.message || '下刀提交失败');
                    if (res.data && res.data.outSum === "0") {
                        uni.showToast({
                            title: res.data.outMsg || '',
                            icon: 'error'
                        });
                        return;
                    } else if (res.data && res.data.outMsg) {
                        uni.showToast({
                            title: res.data.outMsg,
                            icon: 'none'
                        });
                    }
                    // 后续逻辑继续执行
                    if (res.status === 0) {
                        await this.fetchFormData();
                    }