| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div class="search_form mb20"> |
| | | <div class="search-row"> |
| | | <div class="search-item"> |
| | | <span class="search_title">工单编号:</span> |
| | |
| | | </div> |
| | | <div class="search-item"> |
| | | <span class="search_title">生产订单号:</span> |
| | | <el-input v-model="searchForm.productOrderNpsNo" |
| | | <el-input v-model="searchForm.npsNo" |
| | | style="width: 240px" |
| | | placeholder="请输入" |
| | | @change="handleQuery" |
| | |
| | | <el-input v-model.number="reportForm.quantity" |
| | | type="number" |
| | | min="0" |
| | | step="1" |
| | | step="0.1" |
| | | style="width: 300px" |
| | | placeholder="请输入生产合格数量" |
| | | @input="handleQuantityInput" /> |
| | |
| | | <el-input v-model.number="reportForm.scrapQty" |
| | | type="number" |
| | | min="0" |
| | | step="1" |
| | | step="0.1" |
| | | style="width: 300px" |
| | | placeholder="请输入报废数量" |
| | | @input="handleScrapQtyInput" /> |
| | |
| | | :label="user.nickName" |
| | | :value="user.userId" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- 工时 --> |
| | | <el-form-item label="工时" |
| | | v-if="currentReportRowData?.type == 0" |
| | | prop="workHour"> |
| | | <el-input v-model.number="reportForm.workHour" |
| | | type="number" |
| | | min="0" |
| | | style="width: 280px" |
| | | placeholder="请输入工时" /><span style="margin-left:10px" |
| | | class="param-unit">h</span> |
| | | </el-form-item> |
| | | <div v-if="params.length > 0" |
| | | class="param-grid" |
| | |
| | | @refresh="getList" /> |
| | | <FileList v-if="fileDialogVisible" |
| | | v-model:visible="fileDialogVisible" |
| | | :editable="!currentWorkOrderRow?.endOrder" |
| | | :record-type="'production_operation_task'" |
| | | :record-id="currentWorkOrderId" /> |
| | | </div> |
| | |
| | | addProductMain, |
| | | downProductWorkOrder, |
| | | } 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"; |
| | | import QRCode from "qrcode"; |
| | | import { getCurrentInstance, reactive, toRefs } from "vue"; |
| | | import MaterialDialog from "./components/MaterialDialog.vue"; |
| | | const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue")); |
| | | const FileList = defineAsyncComponent(() => |
| | | import("@/components/Dialog/FileList.vue") |
| | | ); |
| | | |
| | | import useUserStore from "@/store/modules/user"; |
| | | const { proxy } = getCurrentInstance(); |
| | |
| | | dataType: "action", |
| | | fixed: "right", |
| | | operation: [ |
| | | { |
| | | /*{ |
| | | name: "流转卡", |
| | | clickFun: row => { |
| | | downloadAndPrintWorkOrder(row); |
| | | }, |
| | | }, |
| | | },*/ |
| | | { |
| | | name: "附件", |
| | | clickFun: row => { |
| | |
| | | clickFun: row => { |
| | | showReportDialog(row); |
| | | }, |
| | | showHide: row => !row.endOrder, |
| | | disabled: row => { |
| | | if (row.planQuantity <= 0) return true; |
| | | if (!row.userIds) return false; |
| | |
| | | productMainId: null, |
| | | productionOrderRoutingOperationId: "", |
| | | productionOrderId: "", |
| | | workHour: 0, |
| | | paramGroups: {}, |
| | | }); |
| | | |
| | |
| | | return; |
| | | } |
| | | const num = Number(value); |
| | | // 整数且大于等于1 |
| | | if (isNaN(num) || !Number.isInteger(num) || num < 0) { |
| | | if (isNaN(num) || num < 0) { |
| | | callback(new Error("生产合格数量必须大于等于0")); |
| | | return; |
| | | } |
| | |
| | | return; |
| | | } |
| | | const num = Number(value); |
| | | // 整数且大于等于0 |
| | | if (isNaN(num) || !Number.isInteger(num) || num < 0) { |
| | | if (isNaN(num) || num < 0) { |
| | | callback(new Error("报废数量必须大于等于0")); |
| | | return; |
| | | } |
| | |
| | | if (isNaN(num)) { |
| | | return; |
| | | } |
| | | // 如果小于1,清除 |
| | | if (num < 0) { |
| | | reportForm.quantity = null; |
| | | return; |
| | | } |
| | | // 如果是小数取整数部分 |
| | | if (!Number.isInteger(num)) { |
| | | const intValue = Math.floor(num); |
| | | // 如果取整后小于1,清除 |
| | | if (intValue < 0) { |
| | | reportForm.quantity = null; |
| | | return; |
| | | } |
| | | reportForm.quantity = intValue; |
| | | return; |
| | | } |
| | | reportForm.quantity = num; |
| | |
| | | return; |
| | | } |
| | | const num = Number(value); |
| | | // 如果是NaN,保持原值 |
| | | if (isNaN(num)) { |
| | | return; |
| | | } |
| | | // 如果是负数,清除输入 |
| | | if (num < 0) { |
| | | reportForm.scrapQty = null; |
| | | return; |
| | | } |
| | | // 如果是小数,取整数部分 |
| | | if (!Number.isInteger(num)) { |
| | | reportForm.scrapQty = Math.floor(num); |
| | | return; |
| | | } |
| | | // 有效的非负整数(包括0) |
| | | reportForm.scrapQty = num; |
| | | }; |
| | | |
| | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | workOrderNo: "", |
| | | productOrderNpsNo: "", |
| | | npsNo: "", |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | |
| | | const printTransferCard = () => { |
| | | window.print(); |
| | | }; |
| | | const currentWorkOrderRow = ref(null); |
| | | |
| | | const openWorkOrderFiles = row => { |
| | | currentWorkOrderId.value = row.id; |
| | | currentWorkOrderRow.value = row; |
| | | fileDialogVisible.value = true; |
| | | }; |
| | | |
| | | const showReportDialog = row => { |
| | | 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); |
| | | } |
| | | } |
| | | currentReportRowData.value = row; |
| | | reportForm.planQuantity = row.planQuantity; |
| | | const planQuantity = Number(row.planQuantity || 0); |
| | | const completeQuantity = Number(row.completeQuantity || 0); |
| | | const remainingQuantity = Math.max(0, planQuantity - completeQuantity); |
| | | reportForm.planQuantity = remainingQuantity; |
| | | reportForm.quantity = |
| | | row.quantity !== undefined && row.quantity !== null ? row.quantity : null; |
| | | reportForm.productProcessRouteItemId = row.productProcessRouteItemId; |
| | |
| | | reportForm.productionOrderRoutingOperationId = |
| | | row.productionOrderRoutingOperationId; |
| | | reportForm.productionOrderId = row.productionOrderId; |
| | | if (row.type == 0) { |
| | | reportForm.workHour = row.workHour || 0; |
| | | } else { |
| | | reportForm.workHour = 0; |
| | | } |
| | | nextTick(() => { |
| | | reportFormRef.value?.clearValidate(); |
| | | if (row.productionOrderRoutingOperationId && row.productionOrderId) { |
| | |
| | | productionOrderRoutingOperationId: |
| | | reportForm.productionOrderRoutingOperationId, |
| | | productionOrderId: reportForm.productionOrderId, |
| | | workHour: reportForm.workHour, |
| | | productionOperationParamList: productionOperationParamList, |
| | | }; |
| | | |