import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter,dateFormatter2 } from '@/utils/formatTime' import * as ProductionMainApi from '@/api/wms/productionMain' import { ProductionMain } from '@/views/wms/productionManage/productionplan/productionMain/productionMain.data' import * as WorkshopApi from '@/api/wms/workshop' import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data' import * as ProductionlineApi from '@/api/wms/productionline' import { Productionline } from '@/views/wms/basicDataManage/factoryModeling/productionline/productionline.data' import * as ShiftApi from '@/api/wms/shift' import { Shift } from '@/views/wms/basicDataManage/orderManage/shift/shift.data' import * as TeamApi from '@/api/wms/team' import { Team } from '@/views/wms/basicDataManage/orderManage/team/team.data' import * as ProductionlineitemApi from '@/api/wms/productionlineitem' // import { Productionlineitem } from '@/views/wms/basicDataManage/itemManage/bom/bom.data' // import * as BomApi from '@/api/wms/bom' import { Bom } from '@/views/wms/basicDataManage/itemManage/bom/bom.data' import * as WorkStationApi from '@/api/wms/workstation' import { Workstation } from '@/views/wms/basicDataManage/factoryModeling/workstation/workstation.data' import * as getPlansettingApi from '@/api/wms/plansetting/index' const { t } = useI18n() // 国际化 // 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值 const queryParams = { pageSize:10, pageNo:1, code:'PreparetoissuePlan' } const data = await getPlansettingApi.getPlansettingPage(queryParams) const plansettingData =data?.list[0]||{} /** * @returns {Array} 备料计划主表 */ export const PreparetoissueMain = useCrudSchemas(reactive([ { label: '单据号', field: 'number', sort: 'custom', table: { width: 180, fixed: 'left' }, isForm: false, isSearch: true, }, { label: '状态', field: 'status', sort: 'custom', table: { width: 150 }, dictType: DICT_TYPE.PLAN_STATUS, dictClass: 'string', isSearch: true, isForm:false, form: { value: '1', componentProps: { disabled: true } } }, { label: '车间', field: 'workshop', sort: 'custom', table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择车间代码', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '车间信息', // 查询弹窗标题 searchAllSchemas: Workshop.allSchemas, // 查询弹窗所需类 searchPage: WorkshopApi.getWorkshopPage // 查询弹窗所需分页方法 } } }, { label: '生产线', field: 'prodLine', sort: 'custom', table: { width: 150 }, form: { labelMessage: '该生产线会影响明细中的物料代码,工位', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择生产线', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '生产线信息', // 查询弹窗标题 searchAllSchemas: Productionline.allSchemas, // 查询弹窗所需类 searchPage: ProductionlineApi.getProductionlinePage // 查询弹窗所需分页方法 } } }, { label: '班组', field: 'team', sort: 'custom', table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选班组', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '班组信息', // 查询弹窗标题 searchAllSchemas: Team.allSchemas, // 查询弹窗所需类 searchPage: TeamApi.getTeamPage // 查询弹窗所需分页方法 } } }, { label: '班次', field: 'shift', sort: 'custom', table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选班次', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '班次信息', // 查询弹窗标题 searchAllSchemas: Shift.allSchemas, // 查询弹窗所需类 searchPage: ShiftApi.getShiftPage // 查询弹窗所需分页方法 } } }, { label: '计划日期', field: 'planDate', formatter: dateFormatter2, detail: { dateFormat: 'YYYY-MM-DD' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width: '100%'}, type: 'date', dateFormat: 'YYYY-MM-DD', valueFormat: 'x', } }, }, { label: '开始时间', field: 'beginTime', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, }, { label: '结束时间', field: 'endTime', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, }, { label: '生产计划单号', field: 'productionPlanNumber', sort: 'custom', table: { width: 180 }, isTable: false, form: { labelMessage: '同时影响车间 生产线 班组 班次', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择生产计划', // 输入框占位文本 searchField: 'number', // 查询弹窗赋值字段 searchTitle: '生产计划信息', // 查询弹窗标题 searchAllSchemas: ProductionMain.allSchemas, // 查询弹窗所需类 searchPage: ProductionMainApi.getProductionMainPage, // 查询弹窗所需分页方法 searchCondition: [{ key:'status', value:'6', isMainValue: false },{ key:'available', value:'TRUE', isMainValue: false }] } } }, { label: '备注', field: 'remark', sort: 'custom', table: { width: 150 }, isTable: false }, { label: '是否可用', field: 'available', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: true, isTable: false, sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } } }, { label: '业务类型', field: 'businessType', sort: 'custom', table: { width: 150 }, isTable: false, form: { value: 'Issue', componentProps: { disabled: true } }, isForm: false, }, { label: '自动提交', field: 'autoCommit', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: false, isForm:false, sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: plansettingData.autoCommit, componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE', disabled: true } } }, { label: '自动通过', field: 'autoAgree', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: false, isForm:false, sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: plansettingData.autoAgree, componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE', disabled: true } } }, { label: '自动执行', field: 'autoExecute', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: false, isForm:false, sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: plansettingData.autoExecute, componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE', disabled: true } } }, { label: '创建时间', field: 'createTime', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, isTable: false, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, isForm: false, }, { label: '创建者', field: 'creator', sort: 'custom', table: { width: 150 }, isTable: false, isForm: false, }, { label: '最后更新时间', field: 'updateTime', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, isTable: false, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, isForm: false, }, { label: '最后更新者', field: 'updater', sort: 'custom', table: { width: 150 }, isTable: false, isForm: false, }, { label: '操作', field: 'action', isDetail: false, isForm: false, table: { width: 220, fixed: 'right' }, } ])) //表单校验 export const PreparetoissueMainRules = reactive({ workshop: [ { required: true, message: '请选择车间', trigger: 'change' } ], prodLine: [ { required: true, message: '请选择生产线', trigger: 'change' } ], shift: [ { required: true, message: '请选择班次', trigger: 'change' } ], team: [ { required: true, message: '请选择班组', trigger: 'change' } ], planDate: [ { required: true, message: '请输入计划日期', trigger: 'change' } ], available: [ { required: true, message: '请选择是否可用', trigger: 'change' } ], status: [ { required: true, message: '请选择状态', trigger: 'change' } ], businessType: [ { required: true, message: '请输入业务类型', trigger: 'blur' } ], remark: [ { max: 50, message: '不得超过50个字符', trigger: 'blur' } ], }) /** * @returns {Array} 备料计划子表 */ export const PreparetoissueDetail = useCrudSchemas(reactive([ { label: '工位', field: 'workStation', sort: 'custom', table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择工位', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '工位信息', // 查询弹窗标题 searchAllSchemas: Workstation.allSchemas, // 查询弹窗所需类 searchPage: WorkStationApi.getWorkstationPage, // 查询弹窗所需分页方法 searchCondition: [{ key:'productionLineCode', value:'prodLine', message: '请填写生产线代码!', isMainValue: true },{ key:'workshopCode', value:'workshop', message: '请填写车间代码!', isMainValue: true },{ key:'available', value:'TRUE', isMainValue: false }] } }, tableForm:{ isInpuFocusShow: true, searchListPlaceholder: '请选择工位', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '工位信息', // 查询弹窗标题 searchAllSchemas: Workstation.allSchemas, // 查询弹窗所需类 searchPage: WorkStationApi.getWorkstationPage, // 查询弹窗所需分页方法 searchCondition: [{ key:'productionLineCode', value:'prodLine', message: '请填写生产线代码!', isMainValue: true },{ key:'workshopCode', value:'workshop', message: '请填写车间代码!', isMainValue: true },{ key:'available', value:'TRUE', isMainValue: false }] }, }, { label: '物料代码', field: 'itemCode', sort: 'custom', table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择物料代码', // 输入框占位文本 searchField: 'itemCode', // 查询弹窗赋值字段 searchTitle: '物料清单信息', // 查询弹窗标题 searchAllSchemas: Bom.allSchemas, // 查询弹窗所需类 searchPage: ProductionlineitemApi.getProductionlineitemPageByItemtype, // 查询弹窗所需分页方法 searchCondition: [{ key:'productionLineCode', value:'prodLine', message: '请填写生产线代码!', isMainValue: true }] } }, tableForm:{ isInpuFocusShow: true, searchListPlaceholder: '请选择物料代码', // 输入框占位文本 searchField: 'itemCode', // 查询弹窗赋值字段 searchTitle: '物料清单信息', // 查询弹窗标题 searchAllSchemas: Bom.allSchemas, // 查询弹窗所需类 searchPage: ProductionlineitemApi.getProductionlineitemPageByItemtype, // 查询弹窗所需分页方法 searchCondition: [{ key:'productionLineCode', value:'prodLine', message: '请填写生产线代码!', isMainValue: true }] }, }, { label: '计划数量', field: 'planQty', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', }, tableForm:{ type: 'InputNumber', min: 1, precision: 6 } }, { label: '计量单位', field: 'uom', dictType: DICT_TYPE.UOM, dictClass: 'string', isSearch: true, isTable: true, sort: 'custom', table: { width: 150 }, tableForm:{ type: 'Select' }, }, { label: '目标库位', field: 'toLocationCode', sort: 'custom', table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { disabled: true } }, tableForm:{ disabled: true }, }, { label: '截止时间', field: 'dueTime', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, hiddenInMain: true, tableForm: { type: 'FormDateTime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, }, { label: '单据号', field: 'number', sort: 'custom', table: { width: 180 }, hiddenInMain: true, form: { componentProps: { disabled: true } }, isTableForm: false, }, { label: '备注', field: 'remark', sort: 'custom', table: { width: 150 }, hiddenInMain: true, }, { label: '创建时间', field: 'createTime', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, hiddenInMain: true, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, isTableForm: false, isForm: false, }, { label: '创建者', field: 'creator', sort: 'custom', table: { width: 150 }, hiddenInMain: true, isTableForm: false, isForm: false, }, { label: '最后更新者', field: 'updater', sort: 'custom', table: { width: 150 }, hiddenInMain: true, isTableForm: false, isForm: false, }, { label: '最后更新时间', field: 'updateTime', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, hiddenInMain: true, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, isTableForm: false, isForm: false, }, { label: '是否可用', field: 'available', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: true, isTable: true, sort: 'custom', table: { width: 150 }, hiddenInMain: true, tableForm:{ type: 'Select', default: 'TRUE' }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } } }, { label: '操作', hiddenInMain:true, field: 'action', isDetail: false, isForm: false , table: { width: 150, fixed: 'right' }, isTableForm:false, } ])) //表单校验 export const PreparetoissueDetailRules = reactive({ available: [ { required: true, message: '请选择是否可用', trigger: 'blur' } ], uom: [ { required: true, message: '请选择计量单位', trigger: 'change' } ], planQty: [ { required: true, message: '请输入计划数量', trigger: 'blur' } ], number: [ { required: true, message: '请输入单据号', trigger: 'blur' } ], itemCode: [ { required: true, message: '请选择物料代码', trigger: 'change' } ], workStation: [ { required: true, message: '请选择工位', trigger: 'change' } ], remark: [ { max: 50, message: '不得超过50个字符', trigger: 'blur' } ], dueTime: [ { required: true, message: '请选择截止时间', trigger: 'change' } ] })