| | |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesProFeedbackApi } from '#/api/mes/pro/feedback'; |
| | | import type { MesProTaskApi } from '#/api/mes/pro/task'; |
| | | import type { DescriptionItemSchema } from '#/components/description'; |
| | | |
| | | import { h, markRaw } from 'vue'; |
| | | |
| | |
| | | MesAutoCodeRuleCode, |
| | | MesProTaskStatusEnum, |
| | | MesProWorkOrderStatusEnum, |
| | | } from '../../../../packages/constants/src'; |
| | | import { getDictOptions } from '../../../../packages/effects/hooks/src'; |
| | | } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | |
| | | import { Button } from 'ant-design-vue'; |
| | | |
| | |
| | | import { MdWorkstationSelect } from '#/views/mes/md/workstation/components'; |
| | | import { ProTaskSelect } from '#/views/mes/pro/task/components'; |
| | | import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; |
| | | import { DictTag } from '#/components/dict-tag'; |
| | | |
| | | /** 生产报工表单类型 */ |
| | | export type FormType = 'approve' | 'create' | 'detail' | 'submit' | 'update'; |
| | |
| | | return [ |
| | | { |
| | | fieldName: 'code', |
| | | label: '报工单号', |
| | | label: '报订单号', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请输入报工单号', |
| | | placeholder: '请输入报订单号', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | }, |
| | | { |
| | | fieldName: 'workOrderId', |
| | | label: '生产工单', |
| | | label: '生产订单', |
| | | component: markRaw(ProWorkOrderSelect), |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请选择工单', |
| | | placeholder: '请选择订单', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | return [ |
| | | { |
| | | field: 'code', |
| | | title: '报工单号', |
| | | title: '报订单号', |
| | | width: 160, |
| | | slots: { default: 'code' }, |
| | | }, |
| | |
| | | }, |
| | | { field: 'workstationName', title: '工作站', width: 120 }, |
| | | { field: 'processName', title: '工序', width: 100 }, |
| | | { field: 'workOrderCode', title: '生产工单编码', width: 160 }, |
| | | { field: 'workOrderCode', title: '生产订单编码', width: 160 }, |
| | | { field: 'itemCode', title: '产品物料编码', width: 120 }, |
| | | { field: 'itemName', title: '产品物料名称', minWidth: 140 }, |
| | | { field: 'itemSpecification', title: '规格型号', width: 120 }, |
| | |
| | | }, |
| | | { |
| | | fieldName: 'code', |
| | | label: '报工单号', |
| | | label: '报订单号', |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: isHeaderReadonly, |
| | | placeholder: '请输入报工单号', |
| | | placeholder: '请输入报订单号', |
| | | }, |
| | | rules: 'required', |
| | | suffix: () => |
| | |
| | | }, |
| | | { |
| | | fieldName: 'workOrderId', |
| | | label: '生产工单', |
| | | label: '生产订单', |
| | | component: markRaw(ProWorkOrderSelect), |
| | | componentProps: { |
| | | disabled: isHeaderReadonly, |
| | | placeholder: '请选择工单', |
| | | placeholder: '请选择订单', |
| | | status: MesProWorkOrderStatusEnum.CONFIRMED, |
| | | // 工单变更:清空任务及任务带出的产品信息、数量区域控制位 |
| | | // 订单变更:清空任务及任务带出的产品信息、数量区域控制位 |
| | | onChange: async () => { |
| | | await formApi?.setValues({ |
| | | checkFlag: true, |
| | |
| | | taskId: undefined, |
| | | unitMeasureName: undefined, |
| | | workstationId: undefined, |
| | | reportableQuantity: undefined, |
| | | }); |
| | | }, |
| | | }, |
| | |
| | | triggerFields: ['workOrderId', 'workstationId'], |
| | | componentProps: (values) => ({ |
| | | disabled: isHeaderReadonly || !values.workOrderId, |
| | | placeholder: values.workOrderId ? '请选择任务' : '请先选择工单', |
| | | placeholder: values.workOrderId ? '请选择任务' : '请先选择订单', |
| | | statuses: [MesProTaskStatusEnum.PREPARE], |
| | | workOrderId: values.workOrderId, |
| | | workstationId: values.workstationId, |
| | |
| | | routeId: task.routeId, |
| | | unitMeasureName: task.unitMeasureName, |
| | | workstationId: task.workstationId, |
| | | reportableQuantity: task.reportableQuantity, |
| | | }); |
| | | // 工艺路线工序的 checkFlag 决定数量区域展示 |
| | | if (task.routeId && task.processId) { |
| | |
| | | dependencies: { |
| | | triggerFields: ['itemCode'], |
| | | show: (values) => !!values.itemCode, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'reportableQuantity', |
| | | label: '可报工数量', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: 'w-full', |
| | | disabled: true, |
| | | precision: 2, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['taskId'], |
| | | show: (values) => !!values.taskId && ['create', 'update'].includes(formType), |
| | | }, |
| | | }, |
| | | { |
| | |
| | | format: 'YYYY-MM-DD HH:mm:ss', |
| | | placeholder: '请选择报工时间', |
| | | showTime: true, |
| | | valueFormat: 'x', |
| | | valueFormat: 'YYYY-MM-DD HH:mm:ss', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** 生产报工详情摘要 */ |
| | | export function useDetailSchema(): DescriptionItemSchema[] { |
| | | return [ |
| | | { field: 'code', label: '报订单号' }, |
| | | { |
| | | field: 'type', |
| | | label: '报工类型', |
| | | render: (val) => |
| | | h(DictTag, { type: DICT_TYPE.MES_PRO_FEEDBACK_TYPE, value: val }), |
| | | }, |
| | | { field: 'workOrderId', label: '生产订单', render: (_val, data) => data.workOrderCode }, |
| | | { field: 'taskId', label: '生产任务', render: (_val, data) => data.taskCode }, |
| | | { field: 'workstationName', label: '工作站' }, |
| | | { field: 'itemCode', label: '产品编码' }, |
| | | { field: 'itemName', label: '产品名称' }, |
| | | { field: 'unitMeasureName', label: '单位' }, |
| | | { field: 'itemSpecification', label: '规格' }, |
| | | { field: 'reportableQuantity', label: '可报工数量' }, |
| | | { field: 'feedbackQuantity', label: '报工数量' }, |
| | | { field: 'qualifiedQuantity', label: '合格品数量' }, |
| | | { field: 'unqualifiedQuantity', label: '不良品数量' }, |
| | | { field: 'laborScrapQuantity', label: '工废数量' }, |
| | | { field: 'materialScrapQuantity', label: '料废数量' }, |
| | | { field: 'otherScrapQuantity', label: '其他废品' }, |
| | | { field: 'feedbackUserNickname', label: '报工人' }, |
| | | { field: 'feedbackTime', label: '报工时间' }, |
| | | { field: 'approveUserNickname', label: '审核人' }, |
| | | { field: 'remark', label: '备注' }, |
| | | ]; |
| | | } |