| | |
| | | return str; |
| | | }, |
| | | |
| | | // 刀具绑定判断钩子 |
| | | hasBindedCutter() { |
| | | const currentOrder = this.isShowTableData[0]; |
| | | return ( |
| | | currentOrder && |
| | | ( |
| | | (currentOrder.outToolId && currentOrder.outToolId.toString().trim() !== '') || |
| | | (currentOrder.outToolCode && currentOrder.outToolCode.trim() !== '') || |
| | | (currentOrder.outToolName && currentOrder.outToolName.trim() !== '') |
| | | ) |
| | | // 判断单条记录是否绑定刀具 |
| | | isCutterBound(row) { |
| | | if (!row) return false; |
| | | const idBound = typeof row.outToolId === 'number' ? row.outToolId > 0 : ( |
| | | row.outToolId && row.outToolId.toString().trim() !== '' |
| | | ); |
| | | const codeBound = !!(row.outToolCode && row.outToolCode.toString().trim() !== ''); |
| | | const nameBound = !!(row.outToolName && row.outToolName.toString().trim() !== ''); |
| | | return idBound || codeBound || nameBound; |
| | | }, |
| | | |
| | | // 旧的钩子替换为调用 isCutterBound(只看第一条或根据需要遍历) |
| | | hasBindedCutter() { |
| | | // 当前只允许一条正在操作的工单,取第一条 |
| | | return this.isCutterBound(this.isShowTableData[0]); |
| | | }, |
| | | |
| | | cancel() { |
| | | if (!this.machineNo) { |
| | | return; |
| | | } |
| | | |
| | | // 使用钩子判断 |
| | | if (!this.machineNo) return; |
| | | // 后端数据判断 |
| | | if (this.hasBindedCutter()) { |
| | | uni.showToast({ |
| | | title: '当前工单已绑定刀具,不能清空重选', |
| | |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | let editDate = this.formatDate(new Date()); |
| | | const editDate = this.formatDate(new Date()); |
| | | this.selectedIndexs = []; |
| | | |
| | | this.$post({ |
| | | url: "/MesOrderSelect/Remove", |
| | | data: { |
| | | machineNo: this.machineNo, |
| | | editDate: editDate |
| | | }, |
| | | data: { machineNo: this.machineNo, editDate } |
| | | }).then(res => { |
| | | if (res.data.tbBillList > 0) { |
| | | this.isShowTableData = []; |
| | |
| | | getWomdaaIsShow() { |
| | | this.$post({ |
| | | url: "/Womdaa/GetWomdaasByShow", |
| | | data: { |
| | | machineNo: this.machineNo, |
| | | } |
| | | data: { machineNo: this.machineNo } |
| | | }).then(res => { |
| | | this.isShowTableData = res.data.tbBillList; |
| | | |
| | | if (this.isShowTableData.length == 1) { |
| | | const list = res.data.tbBillList || []; |
| | | // 统一映射并输出调试日志 |
| | | this.isShowTableData = list.map(r => { |
| | | return { |
| | | ...r, |
| | | // 兼容大小写或下划线命名(若不存在则使用原值或空) |
| | | outToolId: r.outToolId ?? r.out_tool_id ?? r.outToolID ?? r.toolId ?? 0, |
| | | outToolCode: r.outToolCode ?? r.out_tool_code ?? r.toolCode ?? '', |
| | | outToolName: r.outToolName ?? r.out_tool_name ?? r.toolName ?? '' |
| | | }; |
| | | }); |
| | | if (this.isShowTableData.length > 0) { |
| | | console.log("GetWomdaasByShow 第一条记录:", this.isShowTableData[0]); |
| | | } |
| | | if (this.isShowTableData.length === 1) { |
| | | uni.setStorageSync('daa001', this.isShowTableData[0].daa001); |
| | | uni.setStorageSync('id', this.isShowTableData[0].id); |
| | | //this.toDetail(this.isShowTableData[0]); |
| | | } |
| | | }); |
| | | }, |