| | |
| | | </BigButton> |
| | | <template v-if="task?.Procedure.Status === 2 || task?.Procedure.Status === 3"> |
| | | <BigButton class="btn" bg-color="#ff9933" :disabled="task?.Procedure.Status === 3">打印</BigButton> |
| | | <BigButton class="btn" bg-color="#00cc33" :disabled="task?.Procedure.Status === 3" @click="openReportModal"> |
| | | <BigButton |
| | | v-if="task?.ShowCheck" |
| | | class="btn" |
| | | bg-color="#00cc33" |
| | | :disabled="task?.Procedure.Status === 3" |
| | | @click="openQualityModal" |
| | | >质检</BigButton |
| | | > |
| | | <BigButton |
| | | class="btn" |
| | | :bg-color="task?.ShowCheck ? '#0066ff' : '#00cc33'" |
| | | :disabled="task?.Procedure.Status === 3" |
| | | @click="openReportModal" |
| | | > |
| | | 报工 |
| | | </BigButton> |
| | | <el-popconfirm |
| | |
| | | <TaskControlModal v-model="showTaskControlModal" :task="task" @produce-start="onProduceStart"></TaskControlModal> |
| | | <ReportProductionModal |
| | | v-model="showReportModal" |
| | | :model-title="modelTitle" |
| | | :amount="plcInfo?.finishNumber ?? 0" |
| | | @close="showReportModal = false" |
| | | @submit="onReportProduction" |
| | | ></ReportProductionModal> |
| | | <ReportProductionModal1 |
| | | v-model="showReportModal1" |
| | | :model-title="modelTitle" |
| | | :amount="plcInfo?.finishNumber ?? 0" |
| | | :pass-amount="passAmount" |
| | | :rework-amount="reworkAmount" |
| | | :scrapped-amount="scrappedAmount" |
| | | @close="showReportModal1 = false" |
| | | @submit="onReportCheck" |
| | | ></ReportProductionModal1> |
| | | </template> |
| | | <script setup lang="ts"> |
| | | import type { Task, Worker } from '@/api/task' |
| | |
| | | import { useDateFormat } from '@vueuse/core' |
| | | import TaskControlModal from '@/views/dashboard/components/TaskControlModal.vue' |
| | | import { CircleCloseFilled } from '@element-plus/icons-vue' |
| | | import { apiReportWork, procedureUpdate } from '@/api' |
| | | import { apiReportWork, procedureUpdate, bulletinReport, bulletinQualityInspection, getQualityInspection } from '@/api' |
| | | import { ElMessage } from 'element-plus' |
| | | import ReportProductionModal from '@/views/dashboard/components/ReportProductionModal.vue' |
| | | import ReportProductionModal1 from '@/views/dashboard/components/ReportProductionModal1.vue' |
| | | import { usePLCStore } from '@/stores/plc' |
| | | import { storeToRefs } from 'pinia' |
| | | import { log } from 'console' |
| | | import { isDoStatement } from 'typescript' |
| | | |
| | | const props = defineProps<{ |
| | | task?: Task |
| | |
| | | }>() |
| | | |
| | | const showTaskControlModal = ref(false) |
| | | const modelTitle = ref('') |
| | | const passAmount = ref(0) |
| | | const reworkAmount = ref(0) |
| | | const scrappedAmount = ref(0) |
| | | |
| | | /** |
| | | * 开始生产 |
| | |
| | | const { plcInfo } = storeToRefs(plcStore) |
| | | // 报工 |
| | | const showReportModal = ref(false) |
| | | // 报工 |
| | | const showReportModal1 = ref(false) |
| | | const reprotIds = ref([]) |
| | | function openReportModal() { |
| | | // 有人员才可以报工 |
| | | if (!workers.value || workers.value.length == 0) { |
| | |
| | | } |
| | | |
| | | if (workers.value[0].workerId) { |
| | | modelTitle.value = '生产报工' |
| | | if (task?.value?.ShowCheck) { |
| | | getQualityInspection({ |
| | | procedureId: task.value?.Procedure.ID, |
| | | workerId: workers.value[0].workerId |
| | | }).then((res) => { |
| | | console.log(res, '999999') |
| | | passAmount.value = res.data.passAmount |
| | | reworkAmount.value = res.data.reworkAmount |
| | | scrappedAmount.value = res.data.scrappedAmount |
| | | reprotIds.value = res.data.ids |
| | | showReportModal1.value = true |
| | | }) |
| | | } else { |
| | | showReportModal.value = true |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 质检 |
| | | function openQualityModal() { |
| | | // 有人员才可以报工 |
| | | if (!workers.value || workers.value.length == 0) { |
| | | ElMessage({ |
| | | message: '没有人员信息不允许质检!', |
| | | type: 'error', |
| | | duration: 3000 |
| | | }) |
| | | return true |
| | | } |
| | | if (workers.value[0].workerId) { |
| | | modelTitle.value = '提交质检' |
| | | showReportModal.value = true |
| | | } |
| | | } |
| | |
| | | } |
| | | // 有人员才可以报工 |
| | | if (workers.value[0].workerId) { |
| | | apiReportWork({ |
| | | let requestUrl = task?.value.ShowCheck ? bulletinQualityInspection : apiReportWork |
| | | let tipStr = task?.value.ShowCheck ? '质检' : '报工' |
| | | requestUrl({ |
| | | workOrderProcedureID: Number(task.value?.Procedure.ID), |
| | | reportAmount: amount, |
| | | workerID: workers.value[0].workerId, |
| | |
| | | .then((res) => { |
| | | if (res.code === 200) { |
| | | ElMessage({ |
| | | message: `${tipStr}成功`, |
| | | type: 'success', |
| | | duration: 2000 |
| | | }) |
| | | showReportModal.value = false |
| | | } else { |
| | | ElMessage({ |
| | | message: `${tipStr}失败`, |
| | | type: 'error', |
| | | duration: 3000 |
| | | }) |
| | | } |
| | | }) |
| | | .catch((err) => { |
| | | console.error(err) |
| | | }) |
| | | } |
| | | } |
| | | /** |
| | | * 质检后的上报加工数 |
| | | * @param amount 加工数 |
| | | */ |
| | | function onReportCheck(amount: number) { |
| | | if (!task?.value) { |
| | | return |
| | | } |
| | | // 有人员才可以报工 |
| | | if (workers.value[0].workerId) { |
| | | bulletinReport({ |
| | | workOrderProcedureID: Number(task.value?.Procedure.ID), |
| | | reportAmount: amount, |
| | | workerID: workers.value[0].workerId, |
| | | workerName: workers.value[0].workerName, |
| | | ids: reprotIds |
| | | }) |
| | | .then((res) => { |
| | | if (res.code === 200) { |
| | | ElMessage({ |
| | | message: '报工成功', |
| | | type: 'success', |
| | | duration: 2000 |