From bcf0881bd5aefbd863c313c035fa8284b40f03fb Mon Sep 17 00:00:00 2001 From: 86156 <823267011@qq.com> Date: Tue, 11 Nov 2025 09:40:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=89=E7=BA=A7=E9=A1=B5=E9=9D=A2=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/hand-factory/pages/easycode/easycode.vue | 73 ++++++++++++++++--- 1 file changed, 61 insertions(+), 12 deletions(-) diff --git a/apps/hand-factory/pages/easycode/easycode.vue b/apps/hand-factory/pages/easycode/easycode.vue index e183569..94b59ca 100644 --- a/apps/hand-factory/pages/easycode/easycode.vue +++ b/apps/hand-factory/pages/easycode/easycode.vue @@ -314,16 +314,40 @@ confirmText: '确认', title: '确定要将钢卷号为:' + coilRes.data.currentCoilNo + '发货吗?', showCancel: true, - success() { - updateMaterialCoilSimple({ - ...coilRes.data, - status: 1, - }).then(_ => { + success: async () => { + try { + // 1. 更新钢卷状态为已发货 + await updateMaterialCoilSimple({ + ...coilRes.data, + status: 1, + }); + + // 2. 插入一条已完成的待操作记录 + await addPendingAction({ + coilId: coilRes.data.coilId, + currentCoilNo: coilRes.data.currentCoilNo, + actionType: 4, // 4=发货 + actionStatus: 2, // 2=已完成 + scanTime: new Date(), + scanDevice: this.getDeviceInfo(), + priority: 0, // 0=普通 + sourceType: 'scan', + warehouseId: coilRes.data.warehouseId, + processTime: new Date(), + completeTime: new Date() + }); + uni.showToast({ title: '发货成功', icon: 'none' - }) - }) + }); + } catch (error) { + console.error('发货失败:', error); + uni.showToast({ + title: error.message || '发货失败', + icon: 'none' + }); + } }, fail() { uni.showToast({ @@ -331,7 +355,8 @@ icon: 'none' }) } - }) + }); + uni.hideLoading(); } catch (err) { console.error('=== 扫码处理失败 ==='); console.error('错误信息:', err); @@ -448,14 +473,38 @@ }); }, - handleConfirm() { - updateMaterialCoilSimple(this.form).then(_ => { + async handleConfirm() { + try { + // 1. 更新钢卷信息(移库) + await updateMaterialCoilSimple(this.form); + + // 2. 插入一条已完成的待操作记录 + await addPendingAction({ + coilId: this.form.coilId, + currentCoilNo: this.form.currentCoilNo, + actionType: 5, // 5=移库 + actionStatus: 2, // 2=已完成 + scanTime: new Date(), + scanDevice: this.getDeviceInfo(), + priority: 0, // 0=普通 + sourceType: 'scan', + warehouseId: this.form.warehouseId, + processTime: new Date(), + completeTime: new Date() + }); + uni.showToast({ title: '移库成功', icon: 'none' }); - this.$refs.tranferPopup.close() - }) + this.$refs.tranferPopup.close(); + } catch (error) { + console.error('移库失败:', error); + uni.showToast({ + title: error.message || '移库失败', + icon: 'none' + }); + } }, // 获取设备信息 getDeviceInfo() {