| | |
| | | productWorkOrderPage, |
| | | addProductMain, |
| | | downProductWorkOrder, |
| | | checkWorkOrderMaterialPicked, |
| | | } from "@/api/productionManagement/workOrder.js"; |
| | | import { listMaterialPickingDetail } from "@/api/productionManagement/productionOrder.js"; |
| | | import { findProcessParamListOrder } from "@/api/productionManagement/productProcessRoute.js"; |
| | | import { getUserProfile, userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | import { getDicts } from "@/api/system/dict/data"; |
| | |
| | | openWorkOrderFiles(row); |
| | | }, |
| | | }, |
| | | // { |
| | | // name: "物料", |
| | | // clickFun: row => { |
| | | // openMaterialDialog(row); |
| | | // }, |
| | | // }, |
| | | { |
| | | name: "领料", |
| | | clickFun: row => { |
| | | openMaterialDialog(row); |
| | | }, |
| | | showHide: row => !row.endOrder, |
| | | }, |
| | | { |
| | | name: "报工", |
| | | clickFun: row => { |
| | |
| | | fileDialogVisible.value = true; |
| | | }; |
| | | |
| | | const showReportDialog = async row => { |
| | | if (row.productionOrderId) { |
| | | try { |
| | | const res = await listMaterialPickingDetail(row.productionOrderId); |
| | | const records = Array.isArray(res.data) |
| | | ? res.data |
| | | : res.data?.records || []; |
| | | if (res.code === 200 && records.length === 0) { |
| | | proxy.$modal.msgError("未领料无法报工"); |
| | | return; |
| | | } |
| | | } catch (error) { |
| | | console.error("查询领料详情失败:", error); |
| | | // 仅用于即时提示:报工权限最终由后端在报工事务内校验当前工序是否已领料 |
| | | const checkCurrentProcessPicked = async row => { |
| | | try { |
| | | const res = await checkWorkOrderMaterialPicked(row.id); |
| | | if (res.code === 200 && res.data !== true) { |
| | | proxy.$modal.msgError("当前工序未领料,无法报工"); |
| | | return false; |
| | | } |
| | | return true; |
| | | } catch (error) { |
| | | console.error("查询当前工序领料失败:", error); |
| | | proxy.$modal.msgError("查询当前工序领料失败"); |
| | | return false; |
| | | } |
| | | }; |
| | | |
| | | const showReportDialog = async row => { |
| | | const picked = await checkCurrentProcessPicked(row); |
| | | if (!picked) { |
| | | return; |
| | | } |
| | | currentReportRowData.value = row; |
| | | reportForm.planQuantity = subtractQuantity( |