| | |
| | | import { Button } from 'ant-design-vue'; |
| | | |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { getFactorySimpleList } from '#/api/mes/md/factory'; |
| | | import CrmCustomerSelect from '#/components/crm-customer-select.vue'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { |
| | | MdItemSelect, |
| | | } from '#/views/mes/md/item/components'; |
| | | import { MdVendorSelect } from '#/views/mes/md/vendor/components'; |
| | | import MdWorkshopSelect from '#/views/mes/md/workstation/components/workshop-select.vue'; |
| | | |
| | | /** 表单类型 */ |
| | | export type FormType = 'confirm' | 'create' | 'detail' | 'finish' | 'update'; |
| | |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'factoryId', |
| | | label: '工厂', |
| | | component: 'ApiSelect', |
| | | componentProps: { |
| | | allowClear: true, |
| | | api: getFactorySimpleList, |
| | | disabled: headerReadonly, |
| | | labelField: 'name', |
| | | placeholder: '请选择工厂', |
| | | valueField: 'id', |
| | | }, |
| | | help: '选择工单所属工厂(生产主体),用于按工厂筛选工单、归集领料;工厂可在「工厂」基础资料中维护。', |
| | | }, |
| | | { |
| | | fieldName: 'workshopId', |
| | | label: '车间', |
| | | component: markRaw(MdWorkshopSelect), |
| | | componentProps: { |
| | | disabled: headerReadonly, |
| | | placeholder: '请选择车间', |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['factoryId'], |
| | | componentProps: (values: { factoryId?: number }) => ({ |
| | | disabled: headerReadonly, |
| | | factoryId: values.factoryId, |
| | | }), |
| | | }, |
| | | help: '选择工厂后,此处只显示该工厂下的车间;用于派工与工位归属。', |
| | | }, |
| | | { |
| | | fieldName: 'orderSourceType', |
| | | label: '订单来源', |
| | | component: 'Select', |
| | |
| | | } |
| | | }, |
| | | }, |
| | | help: (values: { orderSourceType?: number }) => |
| | | values.orderSourceType === MesProWorkOrderSourceTypeEnum.ORDER |
| | | ? '已选客户订单:需补充来源单据编号与客户,便于追溯订单来源。' |
| | | : '用于区分订单业务归属;选「客户订单」时才需关联来源单据与客户。', |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | |
| | | show: (values) => |
| | | values.orderSourceType === MesProWorkOrderSourceTypeEnum.ORDER, |
| | | }, |
| | | help: '填写上游单据(如销售订单)的编号,用于追溯该订单的来源。', |
| | | }, |
| | | { |
| | | fieldName: 'type', |
| | |
| | | } |
| | | }, |
| | | }, |
| | | help: (values: { type?: number }) => |
| | | values.type === MesProWorkOrderTypeEnum.OUTSOURCE || |
| | | values.type === MesProWorkOrderTypeEnum.PURCHASE |
| | | ? '已选委外/采购生产:需指定供应商,委外报工与入库将按该供应商结算。' |
| | | : '自营生产按本单工序排产;选「委外加工」或「采购生产」时需额外指定供应商。', |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | |
| | | disabled: headerReadonly, |
| | | placeholder: '请选择产品', |
| | | }, |
| | | help: '选择产品后,工序将自动从其工艺路线带出并按需调整;产品需先在「工艺流程」中配置路线与投料 BOM。', |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | |
| | | show: (values) => |
| | | values.orderSourceType === MesProWorkOrderSourceTypeEnum.ORDER, |
| | | }, |
| | | help: '关联客户后,订单可在客户维度追溯并对接后续结算。', |
| | | }, |
| | | { |
| | | fieldName: 'vendorId', |
| | |
| | | values.type === MesProWorkOrderTypeEnum.OUTSOURCE || |
| | | values.type === MesProWorkOrderTypeEnum.PURCHASE, |
| | | }, |
| | | help: '委外/采购订单需指定供应商,委外报工与入库均以该供应商为准。', |
| | | }, |
| | | { |
| | | fieldName: 'batchCode', |
| | |
| | | placeholder: '请选择需求日期', |
| | | valueFormat: 'YYYY-MM-DD', |
| | | }, |
| | | help: '预计交付/完成日期,用于排产、进度跟踪与交期预警。', |
| | | rules: 'required', |
| | | }, |
| | | // { |
| | |
| | | disabled: headerReadonly, |
| | | }, |
| | | defaultValue: false, |
| | | help: '开启后,生产报工提交需经审批通过才计入产量;关闭则报工直接生效。', |
| | | rules: 'required', |
| | | }, |
| | | { |
| | |
| | | return undefined; |
| | | }, |
| | | }, |
| | | help: '选择报工提交后走的审批流程;流程需先在系统「流程管理」中部署,仅「报工审批」类流程可选。', |
| | | }, |
| | | |
| | | { |
| | |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请输入订单名称', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'factoryId', |
| | | label: '工厂', |
| | | component: 'ApiSelect', |
| | | componentProps: { |
| | | allowClear: true, |
| | | api: getFactorySimpleList, |
| | | labelField: 'name', |
| | | placeholder: '请选择工厂', |
| | | valueField: 'id', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'workshopId', |
| | | label: '车间', |
| | | component: markRaw(MdWorkshopSelect), |
| | | componentProps: { |
| | | placeholder: '请选择车间', |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['factoryId'], |
| | | componentProps: (values: { factoryId?: number }) => ({ |
| | | factoryId: values.factoryId, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | |
| | | minWidth: 150, |
| | | }, |
| | | { |
| | | field: 'factoryName', |
| | | title: '工厂', |
| | | width: 120, |
| | | }, |
| | | { |
| | | field: 'workshopName', |
| | | title: '车间', |
| | | width: 120, |
| | | }, |
| | | { |
| | | field: 'type', |
| | | title: '订单类型', |
| | | width: 100, |
| | |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'clientCode', |
| | | title: '客户编码', |
| | | width: 120, |
| | | }, |
| | | { |
| | | field: 'clientName', |
| | | title: '客户名称', |
| | | width: 120, |
| | |
| | | { |
| | | field: 'requestDate', |
| | | title: '需求日期', |
| | | width: 180, |
| | | formatter: 'formatDate', |
| | | }, |
| | | { |
| | | field: 'actualStartTime', |
| | | title: '实际开工时间', |
| | | width: 180, |
| | | formatter: 'formatDate', |
| | | }, |
| | |
| | | }, |
| | | }, |
| | | { |
| | | field: 'productionStatus', |
| | | title: '生产状态', |
| | | field: 'started', |
| | | title: '开工状态', |
| | | width: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.ORDER_PRODUCTION_STATUS }, |
| | | }, |
| | | slots: { default: 'started' }, |
| | | }, |
| | | { |
| | | field: 'processProgressList', |
| | |
| | | field: 'createTime', |
| | | title: '创建时间', |
| | | width: 180, |
| | | formatter: 'formatDateTime', |
| | | formatter: 'formatDate', |
| | | }, |
| | | { |
| | | title: '操作', |
| | |
| | | field: 'quantity', |
| | | title: '订单数量', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'clientCode', |
| | | title: '客户编码', |
| | | width: 120, |
| | | }, |
| | | { |
| | | field: 'clientName', |
| | |
| | | width: 160, |
| | | }, |
| | | { |
| | | field: 'warehouseName', |
| | | title: '报工仓库', |
| | | width: 130, |
| | | formatter: ({ cellValue, row }) => { |
| | | if (!cellValue) return '-'; |
| | | return row.areaName |
| | | ? `${cellValue}/${row.locationName ?? ''}/${row.areaName}` |
| | | : cellValue; |
| | | }, |
| | | }, |
| | | { |
| | | field: 'remark', |
| | | title: '备注', |
| | | minWidth: 120, |