| | |
| | | DICT_TYPE, |
| | | MesAutoCodeRuleCode, |
| | | MesProTaskStatusEnum, |
| | | MesProWorkOrderStatusEnum, |
| | | } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | import { formatDate } from '@vben/utils'; |
| | | |
| | | import { Button } from 'ant-design-vue'; |
| | | |
| | |
| | | import { getRouteProcessByRouteAndProcess } from '#/api/mes/pro/route/process'; |
| | | import { getSimpleUserList } from '#/api/system/user'; |
| | | import { loadParamDetails } from './param-state'; |
| | | |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdWorkstationSelect } from '#/views/mes/md/workstation/components'; |
| | |
| | | field: 'feedbackTime', |
| | | title: '报工时间', |
| | | width: 180, |
| | | formatter: 'formatDateTime', |
| | | formatter: 'formatDate', |
| | | }, |
| | | { field: 'approveUserNickname', title: '审核人', width: 100 }, |
| | | { |
| | |
| | | * - create / update:录入报工主体信息和数量 |
| | | * - submit / approve / detail:主体字段只读 |
| | | * |
| | | * 数量区域根据 `checkFlag` 和 `unqualifiedQuantity` 动态显示: |
| | | * - 非质检工序:报工数量 = 合格 + 不良;不良 > 0 时再展开工废/料废/其他废品 |
| | | * - 质检工序:只填报工数量(视为待检数量) |
| | | * 报工只填写"报工数量";合格品/不良品数量由质检确定,报工环节不采集。 |
| | | * 质检工序报工后进入待检验(uncheckQuantity = 报工数量),非质检工序直接完结。 |
| | | */ |
| | | export function useFormSchema( |
| | | formType: FormType, |
| | |
| | | componentProps: { |
| | | disabled: isHeaderReadonly, |
| | | placeholder: '请选择订单', |
| | | status: MesProWorkOrderStatusEnum.CONFIRMED, |
| | | // 订单变更:清空任务及任务带出的产品信息、数量区域控制位 |
| | | onChange: async () => { |
| | | await formApi?.setValues({ |
| | |
| | | class: 'w-full', |
| | | min: 0, |
| | | precision: 2, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['checkFlag'], |
| | | // 非质检工序时,报工数量 = 合格 + 不良,禁用直接编辑 |
| | | componentProps: (values) => ({ |
| | | class: 'w-full', |
| | | disabled: !values.checkFlag, |
| | | min: 0, |
| | | placeholder: '请输入报工数量', |
| | | precision: 2, |
| | | }), |
| | | placeholder: '请输入报工数量', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'qualifiedQuantity', |
| | | label: '合格品数量', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: 'w-full', |
| | | min: 0, |
| | | precision: 2, |
| | | // 合格/不良变更,自动累计为报工数量 |
| | | onChange: async () => { |
| | | const values = await formApi?.getValues(); |
| | | await formApi?.setFieldValue( |
| | | 'feedbackQuantity', |
| | | (values?.qualifiedQuantity || 0) + |
| | | (values?.unqualifiedQuantity || 0), |
| | | ); |
| | | }, |
| | | }, |
| | | defaultValue: 0, |
| | | dependencies: { |
| | | triggerFields: ['checkFlag'], |
| | | show: (values) => !values.checkFlag, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'unqualifiedQuantity', |
| | | label: '不良品数量', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: 'w-full', |
| | | min: 0, |
| | | precision: 2, |
| | | // 合格/不良变更,自动累计为报工数量 |
| | | onChange: async () => { |
| | | const values = await formApi?.getValues(); |
| | | await formApi?.setFieldValue( |
| | | 'feedbackQuantity', |
| | | (values?.qualifiedQuantity || 0) + |
| | | (values?.unqualifiedQuantity || 0), |
| | | ); |
| | | }, |
| | | }, |
| | | defaultValue: 0, |
| | | dependencies: { |
| | | triggerFields: ['checkFlag'], |
| | | show: (values) => !values.checkFlag, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'laborScrapQuantity', |
| | | label: '工废数量', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: 'w-full', |
| | | min: 0, |
| | | precision: 2, |
| | | // 废品分类变更,自动累计为不良品数量及报工数量 |
| | | onChange: async () => { |
| | | const values = await formApi?.getValues(); |
| | | const unqualified = |
| | | (values?.laborScrapQuantity || 0) + |
| | | (values?.materialScrapQuantity || 0) + |
| | | (values?.otherScrapQuantity || 0); |
| | | await formApi?.setValues({ |
| | | feedbackQuantity: (values?.qualifiedQuantity || 0) + unqualified, |
| | | unqualifiedQuantity: unqualified, |
| | | }); |
| | | }, |
| | | }, |
| | | defaultValue: 0, |
| | | dependencies: { |
| | | triggerFields: ['checkFlag', 'unqualifiedQuantity'], |
| | | show: (values) => |
| | | !values.checkFlag && (values.unqualifiedQuantity || 0) > 0, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'materialScrapQuantity', |
| | | label: '料废数量', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: 'w-full', |
| | | min: 0, |
| | | precision: 2, |
| | | // 废品分类变更,自动累计为不良品数量及报工数量 |
| | | onChange: async () => { |
| | | const values = await formApi?.getValues(); |
| | | const unqualified = |
| | | (values?.laborScrapQuantity || 0) + |
| | | (values?.materialScrapQuantity || 0) + |
| | | (values?.otherScrapQuantity || 0); |
| | | await formApi?.setValues({ |
| | | feedbackQuantity: (values?.qualifiedQuantity || 0) + unqualified, |
| | | unqualifiedQuantity: unqualified, |
| | | }); |
| | | }, |
| | | }, |
| | | defaultValue: 0, |
| | | dependencies: { |
| | | triggerFields: ['checkFlag', 'unqualifiedQuantity'], |
| | | show: (values) => |
| | | !values.checkFlag && (values.unqualifiedQuantity || 0) > 0, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'otherScrapQuantity', |
| | | label: '其他废品', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: 'w-full', |
| | | min: 0, |
| | | precision: 2, |
| | | // 废品分类变更,自动累计为不良品数量及报工数量 |
| | | onChange: async () => { |
| | | const values = await formApi?.getValues(); |
| | | const unqualified = |
| | | (values?.laborScrapQuantity || 0) + |
| | | (values?.materialScrapQuantity || 0) + |
| | | (values?.otherScrapQuantity || 0); |
| | | await formApi?.setValues({ |
| | | feedbackQuantity: (values?.qualifiedQuantity || 0) + unqualified, |
| | | unqualifiedQuantity: unqualified, |
| | | }); |
| | | }, |
| | | }, |
| | | defaultValue: 0, |
| | | dependencies: { |
| | | triggerFields: ['checkFlag', 'unqualifiedQuantity'], |
| | | show: (values) => |
| | | !values.checkFlag && (values.unqualifiedQuantity || 0) > 0, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'feedbackUserId', |
| | |
| | | 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: '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: 'materialScrapQuantity', label: '料废数量' }, |
| | | { field: 'otherScrapQuantity', label: '其他废品' }, |
| | | { field: 'feedbackUserNickname', label: '报工人' }, |
| | | { field: 'feedbackTime', label: '报工时间' }, |
| | | { |
| | | field: 'feedbackTime', |
| | | label: '报工时间', |
| | | render: (val) => formatDate(val) as string, |
| | | }, |
| | | { field: 'approveUserNickname', label: '审核人' }, |
| | | { field: 'remark', label: '备注' }, |
| | | ]; |