| | |
| | | icon-color="red" |
| | | :hide-after="0" |
| | | :teleported="false" |
| | | title="请确认是否已完成此生产任务?" |
| | | :title="Number(processingPercent) < 100 ? '进度未完成,是否提前完成任务?' : '请确认是否已完成此生产任务?'" |
| | | placement="top" |
| | | @confirm="finishTaskProduce" |
| | | > |
| | |
| | | </template> |
| | | <script setup lang="ts"> |
| | | import type { Task, Worker } from '@/api/task' |
| | | import { ref, toRefs } from 'vue' |
| | | import { ref, toRefs, computed } from 'vue' |
| | | import BigButton from '@/views/dashboard/components/BigButton.vue' |
| | | import { useDateFormat } from '@vueuse/core' |
| | | import TaskControlModal from '@/views/dashboard/components/TaskControlModal.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 |
| | |
| | | isProcessing: false, |
| | | workOrderProcedureID: Number(task!.value.Procedure.ID) |
| | | }).then( |
| | | (res) => { |
| | | (res: any) => { |
| | | ElMessage({ |
| | | message: '操作成功!', |
| | | type: 'success' |
| | |
| | | // 报工 |
| | | const showReportModal1 = ref(false) |
| | | const reprotIds = ref([]) |
| | | const passCount = ref(0) |
| | | function openReportModal() { |
| | | // 有人员才可以报工 |
| | | if (!workers.value || workers.value.length == 0) { |
| | |
| | | modelTitle.value = '生产报工' |
| | | if (task?.value?.ShowCheck) { |
| | | getQualityInspection({ |
| | | procedureId: task.value?.Procedure.ID, |
| | | workerId: workers.value[0].workerId |
| | | }).then((res) => { |
| | | procedureId: task.value?.Procedure?.procedure.procedureId, |
| | | workOrderId: task.value?.Order.workOrderId |
| | | }).then((res: any) => { |
| | | console.log(res, '999999') |
| | | passAmount.value = res.data.passAmount |
| | | passCount.value = res.data.passAmount |
| | | reworkAmount.value = res.data.reworkAmount |
| | | scrappedAmount.value = res.data.scrappedAmount |
| | | reprotIds.value = res.data.ids |
| | | reprotIds.value = res.data.ids || [] |
| | | showReportModal1.value = true |
| | | }) |
| | | } else { |
| | |
| | | workerID: workers.value[0].workerId, |
| | | workerName: workers.value[0].workerName |
| | | }) |
| | | .then((res) => { |
| | | .then((res: any) => { |
| | | if (res.code === 200) { |
| | | ElMessage({ |
| | | message: `${tipStr}成功`, |
| | |
| | | if (workers.value[0].workerId) { |
| | | bulletinReport({ |
| | | workOrderProcedureID: Number(task.value?.Procedure.ID), |
| | | reportAmount: amount, |
| | | reportAmount: passCount.value, |
| | | workerID: workers.value[0].workerId, |
| | | workerName: workers.value[0].workerName, |
| | | ids: reprotIds |
| | | ids: reprotIds.value |
| | | }) |
| | | .then((res) => { |
| | | .then((res: any) => { |
| | | if (res.code === 200) { |
| | | ElMessage({ |
| | | message: '报工成功', |
| | | type: 'success', |
| | | duration: 2000 |
| | | }) |
| | | showReportModal.value = false |
| | | showReportModal1.value = false |
| | | } else { |
| | | ElMessage({ |
| | | message: '报工失败', |
| | |
| | | }) |
| | | } |
| | | } |
| | | export interface Statistics { |
| | | totalNumber: number |
| | | finishNumber: number |
| | | } |
| | | /** |
| | | * 计算生产进度 |
| | | * @param statistics |
| | | * @return 进度,0~100 |
| | | */ |
| | | function calculateProgress(statistics: Statistics): number { |
| | | if (!statistics) { |
| | | return 0 |
| | | } |
| | | |
| | | if (statistics.finishNumber === 0) { |
| | | return 0 |
| | | } |
| | | if (statistics.finishNumber === statistics.totalNumber) { |
| | | return 100 |
| | | } |
| | | |
| | | const result = Math.floor((statistics.finishNumber / statistics.totalNumber) * 100) |
| | | return result > 100 ? 100 : result |
| | | } |
| | | const processingPercent = computed(() => { |
| | | // if (task?.value?.Procedure?.Status === 1) { |
| | | // return 0 |
| | | // } |
| | | |
| | | if (task?.value?.Procedure?.Status === 3) { |
| | | return 100 |
| | | } |
| | | // if (task?.value?.Procedure?.Status === 2 || task?.value?.Procedure?.Status === 1) { |
| | | // return calculateProgress(plcStore.plcInfo as Statistics) |
| | | // } |
| | | |
| | | return calculateProgress(plcStore.plcInfo as Statistics) |
| | | }) |
| | | </script> |
| | | <style scoped lang="scss"> |
| | | $title-text-color: #9599af; |