| | |
| | | import { useDateFormat } from '@vueuse/core' |
| | | import TaskControlModal from '@/views/dashboard/components/TaskControlModal.vue' |
| | | import { CircleCloseFilled } from '@element-plus/icons-vue' |
| | | import { apiReportWork, finishTask } from '@/api' |
| | | import { apiReportWork, procedureUpdate } from '@/api' |
| | | import { ElMessage } from 'element-plus' |
| | | import ReportProductionModal from '@/views/dashboard/components/ReportProductionModal.vue' |
| | | import { usePLCStore } from '@/stores/plc' |
| | |
| | | return true |
| | | } |
| | | } |
| | | finishTask({ id: task!.value.Procedure.ID }).then( |
| | | procedureUpdate({ |
| | | isFinish: true, |
| | | isProcessing: false, |
| | | workOrderProcedureID: Number(task!.value.Procedure.ID) |
| | | }).then( |
| | | (res) => { |
| | | ElMessage({ |
| | | message: '操作成功!', |
| | |
| | | }) |
| | | return true |
| | | } |
| | | // 从开始生产到报工的点击时间不能小于1分钟 |
| | | if (task?.value && task.value?.Procedure?.realStartTime) { |
| | | let realStartTime = task.value?.Procedure?.realStartTime |
| | | if (realStartTime) { |
| | | realStartTime = realStartTime * 1000 |
| | | let time = Date.now() |
| | | let differ = Math.abs(time - realStartTime) / 1000 |
| | | if (differ < 60) { |
| | | ElMessage({ |
| | | message: '工序制造时间太短,请检查!', |
| | | type: 'warning' |
| | | }) |
| | | return true |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (workers.value[0].workerId) { |
| | | showReportModal.value = true |
| | | } |
| | |
| | | // 有人员才可以报工 |
| | | if (workers.value[0].workerId) { |
| | | apiReportWork({ |
| | | procedureId: task.value?.Procedure.ID, |
| | | workOrderProcedureID: Number(task.value?.Procedure.ID), |
| | | reportAmount: amount, |
| | | workerID: workers.value[0].workerId |
| | | workerID: workers.value[0].workerId, |
| | | workerName: workers.value[0].workerName |
| | | }) |
| | | .then((res) => { |
| | | if (res.code === 200) { |