| | |
| | | <script setup lang="ts"> |
| | | import {computed, onMounted, reactive, ref} from "vue"; |
| | | import {computed, onMounted, reactive, ref, watch} from "vue"; |
| | | import dayjs from "dayjs"; |
| | | import {userListNoPageByTenantId} from "@/api/system/user.js"; |
| | | import {getDeviceLedger} from "@/api/equipmentManagement/ledger.js"; |
| | |
| | | row: { |
| | | type: Object, |
| | | default: () => ({}), |
| | | } |
| | | }, |
| | | /** 工单 BOM 投入重量,回显到「投入重量」 */ |
| | | bomInputQty: { |
| | | type: Number, |
| | | default: null, |
| | | }, |
| | | }); |
| | | |
| | | const emits = defineEmits(["update:isShow", "refreshData"]); |
| | |
| | | copperFiringTime: undefined, // 烧铜进炉时间 |
| | | steelFiringTime: undefined, // 烧钢出炉时间 |
| | | weight: undefined, // 重量(kg/pos) |
| | | inputWeight: undefined, // 投入重量(KG) |
| | | copperSmeltingTemperatureProfile: undefined, // 烧铜温度曲线 |
| | | remark: undefined, // 备注 |
| | | } |
| | |
| | | }); |
| | | }; |
| | | |
| | | const resolveBomInputQty = () => { |
| | | const bom = props.bomInputQty ?? props.row?.bomInputQty; |
| | | if (bom === null || bom === undefined || bom === "") { |
| | | return null; |
| | | } |
| | | const n = Number(bom); |
| | | return Number.isFinite(n) ? n : null; |
| | | }; |
| | | |
| | | const applyBomInputWeight = () => { |
| | | const n = resolveBomInputQty(); |
| | | if (n !== null) { |
| | | formData.otherData.inputWeight = n; |
| | | } |
| | | }; |
| | | |
| | | const initData = () => { |
| | | if (!props.isEdit) { |
| | | formData.otherData = JSON.parse(props.row.otherData || '{}'); |
| | | formData.quantity = props.row.quantity; |
| | | formData.scrapQty = props.row.scrapQty; |
| | | if (formData.otherData.inputWeight === undefined || formData.otherData.inputWeight === null || formData.otherData.inputWeight === "") { |
| | | applyBomInputWeight(); |
| | | } |
| | | } else { |
| | | const row = props.row; |
| | | formData.planQuantity = row.planQuantity |
| | |
| | | formData.workOrderId = row.id |
| | | formData.reportWork = row.reportWork |
| | | formData.productMainId = row.productMainId |
| | | applyBomInputWeight(); |
| | | } |
| | | } |
| | | |
| | | watch( |
| | | () => props.isShow, |
| | | (show) => { |
| | | if (show) { |
| | | initData(); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | watch( |
| | | () => [props.bomInputQty, props.row?.bomInputQty], |
| | | () => { |
| | | if (!props.isShow) return; |
| | | if (props.isEdit) { |
| | | applyBomInputWeight(); |
| | | return; |
| | | } |
| | | if (formData.otherData.inputWeight === undefined || formData.otherData.inputWeight === null || formData.otherData.inputWeight === "") { |
| | | applyBomInputWeight(); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | const displayValue = (value: any) => { |
| | | return value === undefined || value === null || value === "" ? "-" : value; |
| | |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.steelFiringTime) }}</span> |
| | | </td> |
| | | </tr> |
| | | <tr class="report-row report-row--double"> |
| | | <td class="label" colspan="2">投入重量(KG)</td> |
| | | <td colspan="19" class="cell-field"> |
| | | <el-input-number |
| | | v-if="props.isEdit" |
| | | v-model="formData.otherData.inputWeight" |
| | | :controls="false" |
| | | style="width: 100%" |
| | | placeholder="请输入" |
| | | /> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.inputWeight) }}</span> |
| | | </td> |
| | | </tr> |
| | | <tr class="report-row report-row--triple"> |
| | | <td class="label" colspan="2">烧铜产出</td> |
| | | <td colspan="5" class="cell-field"> |
| | |
| | | <script setup lang="ts"> |
| | | import {computed, onMounted, reactive, ref} from "vue"; |
| | | import {computed, onMounted, reactive, ref, watch} from "vue"; |
| | | import {userListNoPageByTenantId} from "@/api/system/user.js"; |
| | | import {ElMessage} from "element-plus"; |
| | | import {addProductMain} from "@/api/productionManagement/workOrder.js"; |
| | |
| | | row: { |
| | | type: Object, |
| | | default: () => ({}), |
| | | } |
| | | }, |
| | | /** 工单 BOM 投入重量,回显到「投入重量」 */ |
| | | bomInputQty: { |
| | | type: Number, |
| | | default: null, |
| | | }, |
| | | }); |
| | | |
| | | const emits = defineEmits(["update:isShow", "refreshData"]); |
| | |
| | | confirmName: undefined, |
| | | }, |
| | | remark: undefined, // 备注 |
| | | inputWeight: undefined, // 投入重量(KG) |
| | | } |
| | | }) |
| | | |
| | |
| | | }); |
| | | }; |
| | | |
| | | const resolveBomInputQty = () => { |
| | | const bom = props.bomInputQty ?? props.row?.bomInputQty; |
| | | if (bom === null || bom === undefined || bom === "") { |
| | | return null; |
| | | } |
| | | const n = Number(bom); |
| | | return Number.isFinite(n) ? n : null; |
| | | }; |
| | | |
| | | const applyBomInputWeight = () => { |
| | | const n = resolveBomInputQty(); |
| | | if (n !== null) { |
| | | formData.otherData.inputWeight = n; |
| | | } |
| | | }; |
| | | |
| | | const initData = () => { |
| | | if (!props.isEdit) { |
| | | formData.otherData = JSON.parse(props.row.otherData || '{}'); |
| | | formData.quantity = props.row.quantity; |
| | | if (formData.otherData.inputWeight === undefined || formData.otherData.inputWeight === null || formData.otherData.inputWeight === "") { |
| | | applyBomInputWeight(); |
| | | } |
| | | } else { |
| | | const row = props.row; |
| | | formData.planQuantity = row.planQuantity |
| | |
| | | formData.workOrderId = row.id |
| | | formData.reportWork = row.reportWork |
| | | formData.productMainId = row.productMainId |
| | | applyBomInputWeight(); |
| | | } |
| | | } |
| | | |
| | | watch( |
| | | () => props.isShow, |
| | | (show) => { |
| | | if (show) { |
| | | initData(); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | watch( |
| | | () => [props.bomInputQty, props.row?.bomInputQty], |
| | | () => { |
| | | if (!props.isShow) return; |
| | | if (props.isEdit) { |
| | | applyBomInputWeight(); |
| | | return; |
| | | } |
| | | if (formData.otherData.inputWeight === undefined || formData.otherData.inputWeight === null || formData.otherData.inputWeight === "") { |
| | | applyBomInputWeight(); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | const displayValue = (value: any) => { |
| | | return value === undefined || value === null || value === "" ? "-" : value; |
| | |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td class="label" colspan="2" rowspan="4">造粒</td> |
| | | <td class="label" colspan="2" rowspan="5">造粒</td> |
| | | <td class="label" colspan="6"> |
| | | <span>开始时间:</span> |
| | | <el-date-picker |
| | |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td colspan="12"> |
| | | <span>投入重量(KG):</span> |
| | | <el-input-number |
| | | v-if="props.isEdit" |
| | | v-model="formData.otherData.inputWeight" |
| | | :controls="false" |
| | | style="width: 100%" |
| | | placeholder="请输入" |
| | | /> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.inputWeight) }}</span> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td class="label" colspan="6"> |
| | | <span>产出总数 :</span> |
| | | <el-input v-if="props.isEdit" v-model="formData.quantity" placeholder="请输入"> |
| | |
| | | labelWidth: { |
| | | type: Number, |
| | | default: 120 |
| | | }, |
| | | /** 本次生产数量(成型工序用于计算投入重量) */ |
| | | quantity: { |
| | | type: Number, |
| | | default: null |
| | | }, |
| | | /** 当前工序是否为「成型」 */ |
| | | isFormingProcess: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | /** 工单 BOM 投入重量,非成型工序回显到「投入重量」 */ |
| | | bomInputQty: { |
| | | type: Number, |
| | | default: null |
| | | } |
| | | }); |
| | | |
| | |
| | | deviceOptions.value = data; |
| | | }; |
| | | |
| | | const normalizeUnit = (unit) => String(unit ?? "").trim().toLowerCase(); |
| | | |
| | | const isInputWeightItem = (item) => |
| | | String(item?.parameterItem ?? "").includes("投入重量") && |
| | | normalizeUnit(item?.unit) === "kg"; |
| | | |
| | | const isBlankCoeffItem = (item) => |
| | | String(item?.parameterItem ?? "").includes("生坯系数") && |
| | | normalizeUnit(item?.unit) === "g"; |
| | | |
| | | /** 投入重量(KG) = 本次生产数量 × 生坯系数(g) / 1000 */ |
| | | const syncFormingInputWeight = () => { |
| | | if (!props.isFormingProcess) return; |
| | | const weightItem = formData.list.find(isInputWeightItem); |
| | | if (!weightItem) return; |
| | | |
| | | const qty = Number(props.quantity); |
| | | const coeffItem = formData.list.find(isBlankCoeffItem); |
| | | const coeff = coeffItem?.value === null || coeffItem?.value === undefined || coeffItem?.value === "" |
| | | ? NaN |
| | | : Number(coeffItem.value); |
| | | |
| | | if (!Number.isFinite(qty) || qty < 1 || !Number.isFinite(coeff)) { |
| | | return; |
| | | } |
| | | |
| | | weightItem.value = Number(((qty * coeff) / 1000).toFixed(4)); |
| | | }; |
| | | |
| | | /** 非成型:投入重量取工单 bomInputQty */ |
| | | const syncBomInputWeight = () => { |
| | | if (props.isFormingProcess) return; |
| | | const weightItem = formData.list.find(isInputWeightItem); |
| | | if (!weightItem) return; |
| | | const bom = props.bomInputQty; |
| | | if (bom === null || bom === undefined || Number.isNaN(Number(bom))) { |
| | | return; |
| | | } |
| | | weightItem.value = Number(bom); |
| | | }; |
| | | |
| | | const syncInputWeight = () => { |
| | | if (props.isFormingProcess) { |
| | | syncFormingInputWeight(); |
| | | } else { |
| | | syncBomInputWeight(); |
| | | } |
| | | }; |
| | | |
| | | const initData = () => { |
| | | formData.list = props.list || []; |
| | | formData.list.forEach(item => { |
| | |
| | | item.value = null; |
| | | } |
| | | }); |
| | | loadDeviceName() |
| | | loadDeviceName(); |
| | | syncInputWeight(); |
| | | }; |
| | | |
| | | const submitData = async () => { |
| | |
| | | {immediate: true, deep: true} |
| | | ); |
| | | |
| | | watch( |
| | | () => [props.quantity, props.isFormingProcess], |
| | | () => { |
| | | if (props.isFormingProcess) { |
| | | syncFormingInputWeight(); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | watch( |
| | | () => { |
| | | const coeffItem = formData.list.find(isBlankCoeffItem); |
| | | return coeffItem?.value; |
| | | }, |
| | | () => { |
| | | if (props.isFormingProcess) { |
| | | syncFormingInputWeight(); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | watch( |
| | | () => [props.bomInputQty, props.isFormingProcess], |
| | | () => { |
| | | if (!props.isFormingProcess) { |
| | | syncBomInputWeight(); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | defineExpose({ |
| | | submitData |
| | | submitData, |
| | | syncFormingInputWeight, |
| | | syncBomInputWeight, |
| | | syncInputWeight |
| | | }) |
| | | </script> |
| | | |
| | |
| | | row: { |
| | | type: Object, |
| | | default: () => ({}), |
| | | } |
| | | }, |
| | | /** 工单 BOM 投入重量,回显到「投入重量」 */ |
| | | bomInputQty: { |
| | | type: Number, |
| | | default: null, |
| | | }, |
| | | }); |
| | | |
| | | const emits = defineEmits(["update:isShow", "refreshData"]); |
| | |
| | | userId: undefined, // 作业员 |
| | | userName: undefined, // 作业员 |
| | | exceptionDealResult: undefined, // 异常处理结果 |
| | | inputWeight: undefined, // 投入重量(KG) |
| | | } |
| | | }) |
| | | |
| | |
| | | otherData.quantity = normalizeGearArray(otherData.quantity); |
| | | }; |
| | | |
| | | const resolveBomInputQty = () => { |
| | | const bom = props.bomInputQty ?? props.row?.bomInputQty; |
| | | if (bom === null || bom === undefined || bom === "") { |
| | | return null; |
| | | } |
| | | const n = Number(bom); |
| | | return Number.isFinite(n) ? n : null; |
| | | }; |
| | | |
| | | const applyBomInputWeight = () => { |
| | | const n = resolveBomInputQty(); |
| | | if (n !== null) { |
| | | formData.otherData.inputWeight = n; |
| | | } |
| | | }; |
| | | |
| | | const initData = () => { |
| | | if (!props.isEdit) { |
| | | formData.otherData = JSON.parse(props.row.otherData || '{}'); |
| | | initGearArrays(); |
| | | formData.quantity = props.row.quantity; |
| | | formData.scrapQty = props.row.scrapQty; |
| | | if (formData.otherData.inputWeight === undefined || formData.otherData.inputWeight === null || formData.otherData.inputWeight === "") { |
| | | applyBomInputWeight(); |
| | | } |
| | | } else { |
| | | const row = props.row; |
| | | formData.planQuantity = row.planQuantity |
| | |
| | | formData.productMainId = row.productMainId |
| | | initGearArrays(); |
| | | syncOutputQuantity(); |
| | | applyBomInputWeight(); |
| | | } |
| | | } |
| | | |
| | | watch( |
| | | () => props.isShow, |
| | | (show) => { |
| | | if (show) { |
| | | initData(); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | watch( |
| | | () => [props.bomInputQty, props.row?.bomInputQty], |
| | | () => { |
| | | if (!props.isShow) return; |
| | | if (props.isEdit) { |
| | | applyBomInputWeight(); |
| | | return; |
| | | } |
| | | if (formData.otherData.inputWeight === undefined || formData.otherData.inputWeight === null || formData.otherData.inputWeight === "") { |
| | | applyBomInputWeight(); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | watch( |
| | | () => formData.otherData.quantity.map((val) => val), |
| | |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td class="label" colspan="2">投入重量(KG)</td> |
| | | <td colspan="16" class="cell-field"> |
| | | <el-input-number |
| | | v-if="props.isEdit" |
| | | v-model="formData.otherData.inputWeight" |
| | | :controls="false" |
| | | style="width: 100%" |
| | | placeholder="请输入" |
| | | /> |
| | | <span v-else class="view-value">{{ displayValue(formData.otherData.inputWeight) }}</span> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td class="label" colspan="2">有无工程异常</td> |
| | | <td colspan="10"> |
| | | <div v-if="props.isEdit" style="display: flex; align-items: center; width: 100%;"> |
| | |
| | | <ProductionRecordForm |
| | | ref="productionRecordFormRef" |
| | | :list="processParamList" |
| | | :quantity="reportForm.quantity" |
| | | :is-forming-process="isFormingProcess" |
| | | :bom-input-qty="reportBomInputQty" |
| | | /> |
| | | </el-form> |
| | | <template #footer> |
| | |
| | | v-model:isShow="copperPrintingFormVisible" |
| | | :isEdit="true" |
| | | :row="currentReportRowData" |
| | | :bom-input-qty="reportBomInputQty" |
| | | @refreshData="getList" |
| | | /> |
| | | <VoltageSortingForm |
| | |
| | | v-model:isShow="voltageSortingFormVisible" |
| | | :isEdit="true" |
| | | :row="currentReportRowData" |
| | | :bom-input-qty="reportBomInputQty" |
| | | @refreshData="getList" |
| | | /> |
| | | <GranulationForm |
| | |
| | | v-model:isShow="granulationFormVisible" |
| | | :isEdit="true" |
| | | :row="currentReportRowData" |
| | | :bom-input-qty="reportBomInputQty" |
| | | @refreshData="getList" |
| | | /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref, nextTick } from "vue"; |
| | | import { onMounted, ref, nextTick, computed } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import dayjs from "dayjs"; |
| | | import { |
| | |
| | | return; |
| | | } |
| | | reportForm.quantity = num; |
| | | nextTick(() => { |
| | | productionRecordFormRef.value?.syncInputWeight?.(); |
| | | }); |
| | | }; |
| | | |
| | | // 处理报废数量 |
| | |
| | | reportForm.scrapQty = num; |
| | | }; |
| | | const currentReportRowData = ref(null); |
| | | |
| | | const isFormingProcess = computed( |
| | | () => currentReportRowData.value?.processName === "成型" |
| | | ); |
| | | |
| | | const reportBomInputQty = computed(() => { |
| | | const bom = currentReportRowData.value?.bomInputQty; |
| | | if (bom === null || bom === undefined || bom === "") { |
| | | return null; |
| | | } |
| | | const n = Number(bom); |
| | | return Number.isFinite(n) ? n : null; |
| | | }); |
| | | |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | |
| | | }); |
| | | |
| | | reportDialogVisible.value = true; |
| | | nextTick(() => { |
| | | productionRecordFormRef.value?.syncInputWeight?.(); |
| | | }); |
| | | }; |
| | | |
| | | const openWorkOrderFiles = (row) => { |