import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import {dateFormatter, dateFormatter2} from '@/utils/formatTime' import * as ItembasicApi from '@/api/wms/itembasic' import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' import * as ProductionlineitemApi from '@/api/wms/productionlineitem' import { Productionlineitem } from '@/views/wms/basicDataManage/itemManage/productionlineitem/productionlineitem.data' import * as ProcessApi from '@/api/wms/process' import { Process } from '@/views/wms/basicDataManage/factoryModeling/process/process.data' import * as LocationApi from '@/api/wms/location' import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' import {Bom} from "@/views/wms/basicDataManage/itemManage/bom/bom.data"; import * as BomApi from "@/api/wms/bom"; import * as BalanceApi from '@/api/wms/balance' import * as ProcessproductionRequestMainApi from '@/api/wms/processproductionRequestMain' import { Balance } from '@/views/wms/inventoryManage/balance/balance.data' import { fa } from 'element-plus/es/locale' export const BalanceBom = useCrudSchemas( reactive([ { label: '物料代码', field: 'itemCode', sort: 'custom', table: { width: 150 }, isSearch: true }, { label: '批次', field: 'batch', sort: 'custom', table: { width: 150 }, isSearch: true }, { label: '包装号', field: 'packingNumber', sort: 'custom', table: { width: 150 }, isSearch: true }, { label: '包装规格', field: 'packUnit', sort: 'custom', table: { width: 150 } }, { label: '包装数量', field: 'packQty', sort: 'custom', table: { width: 150 } }, { label: '库存数量', field: 'qty', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber' } }, { label: '计量单位', field: 'uom', dictType: DICT_TYPE.UOM, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 } }, { label: '库位代码', field: 'locationCode', sort: 'custom', table: { width: 150 }, isSearch: true }, { label: '库存状态', field: 'inventoryStatus', dictType: DICT_TYPE.INVENTORY_STATUS, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 } }, { label: '库区类型', field: 'areaType', sort: 'custom', dictType: DICT_TYPE.AREA_TYPE, dictClass: 'string', isTable: true, table: { width: 150 } }, { label: '仓库代码', field: 'warehouseCode', sort: 'custom', table: { width: 150 } }, { label: '库位组代码', field: 'locationGroupCode', sort: 'custom', table: { width: 150 } }, { label: '库区代码', field: 'areaCode', sort: 'custom', table: { width: 150 } }, { label: '到货日期', field: 'arriveDate', isTable: true, formatter: dateFormatter2, detail: { dateFormat: 'YYYY-MM-DD' }, sort: 'custom', table: { width: 150 }, form: { component: 'DatePicker', componentProps: { style: { width: '100%' }, type: 'date', dateFormat: 'YYYY-MM-DD', valueFormat: 'x' } } }, { label: '生产日期', field: 'produceDate', isTable: true, formatter: dateFormatter2, detail: { dateFormat: 'YYYY-MM-DD' }, sort: 'custom', table: { width: 150 }, form: { component: 'DatePicker', componentProps: { style: { width: '100%' }, type: 'date', dateFormat: 'YYYY-MM-DD', valueFormat: 'x' } } }, { label: '失效日期', field: 'expireDate', isTable: true, formatter: dateFormatter2, detail: { dateFormat: 'YYYY-MM-DD' }, sort: 'custom', table: { width: 150 }, form: { component: 'DatePicker', componentProps: { style: { width: '100%' }, type: 'date', dateFormat: 'YYYY-MM-DD', valueFormat: 'x' } } }, ]) ) export const ProcessproductionRequestMain = useCrudSchemas(reactive([ { label: '单据号', field: 'number', sort: 'custom', table: { width: 200 }, isForm: false, isSearch: true, }, { label: '状态', field: 'status', dictType: DICT_TYPE.REQUEST_STATUS, dictClass: 'string', isSearch: true, isTable: true, isForm: false, sort: 'custom', table: { width: 150 }, form: { value: '1', componentProps: { disabled: true } } }, { label: '物料代码', field: 'itemCode', sort: 'custom', table: { width: 150 }, isSearch: true, form: { // labelMessage: '信息提示说明!!!', componentProps: { enterSearch:true, isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择物料代码', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '物料基础信息', // 查询弹窗标题 searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类 searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法 searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false }], verificationParams: [{ key: 'code', action: '==', value: '', isMainValue: false, isSearch: true, isFormModel: true, }], // 失去焦点校验参数 } } }, { label: '完工数量', field: 'completedQuantity', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 0, precision: 6 }, }, }, { label: '报废数量', field: 'scrapQuantity', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 0, precision: 6 }, }, }, { label: '是否可用', field: 'available', sort: 'custom', table: { width: 150 }, dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } } }, { label: '备注', field: 'remark', sort: 'custom', isTable:false, }, { label: '创建时间', field: 'createTime', sort: 'custom', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, isTableForm: false, isForm: false, isTable: false, isSearch: true, search: { component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD HH:mm:ss', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] }, }, }, { label: '创建者', field: 'creator', table: { width: 130 }, isForm: false, isTable: false }, { label: '最后更新时间', field: 'updateTime', sort: 'custom', isDetail: true, isForm: false, isTable: false, formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } } }, { label: '最后更新者', field: 'updater', isDetail: true, isForm: false, isTable: false, table: { width: 150 } }, { label: '删除时间', field: 'deletionTime', sort: 'custom', formatter: dateFormatter, isSearch: false, isTable:false, isForm:false, isTableForm:false, isDetail:false, search: { component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD HH:mm:ss', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] } }, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } }, }, { label: '删除者ID', field: 'deleterId', sort: 'custom', isSearch: false, isTable:false, isForm: false, isDetail:false, }, { label: '扩展属性', field: 'extraProperties', sort: 'custom', isSearch: false, isTable:false, isForm: false, }, { label: '并发乐观锁', field: 'concurrencyStamp', sort: 'custom', isSearch: false, isTable:false, isForm: false, isDetail:false, form: { component: 'InputNumber', value: 0 }, }, { label: '地点ID', field: 'siteId', sort: 'custom', isSearch: false, isForm: false, isTable:false, isDetail:false, }, { label: '操作', field: 'action', isForm: false, isDetail:false, table: { width: 230, fixed: 'right' } } ])) // 完工数量校验 const validateCompletedQuantity= (rule: any, value: any, callback: any) => { if (Number(value)>0) { callback(); } else { callback(new Error('完工数量不能为0')); } } // 报废数量校验 const validateScrapQuantity= (rule: any, value: any, callback: any) => { if (Number(value)>0) { callback(); } else { callback(new Error('完工数量不能为0')); } } // 表单校验 export const ProcessproductionRequestMainRules = reactive({ itemCode: [{ required: true, message: '物料代码不能为空', trigger: 'change' }], completedQuantity: [ { required: true, message: '完工数量不能为空', trigger: 'change' }, { validator: validateCompletedQuantity, trigger: 'change' } ], scrapQuantity: [{ required: true, message: '报废数量不能为空', trigger: 'change' }, { validator: validateScrapQuantity, trigger: 'change' } ], }) export const ProcessproductionRequestDetail = useCrudSchemas(reactive([ { label: '单据号', field: 'number', sort: 'custom', isSearch: false, isTable:false, isTableForm:false, table: { width: 150 }, isForm:false, hiddenInMain:true, }, { label: '生产线', field: 'productionLine', sort: 'custom', table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择物料代码', // 输入框占位文本 searchField: 'productionLineCode', // 查询弹窗赋值字段 searchTitle: '生产线物料关系信息', // 查询弹窗标题 searchAllSchemas: Productionlineitem.allSchemas, // 查询弹窗所需类 searchPage: ProductionlineitemApi.getProductionlineitemPage, // 查询弹窗所需分页方法 searchCondition: [{ key:'itemCode', value:'itemCode', message: '请选择物料代码!', isMainValue: true },{ key: 'available', value: 'TRUE', isMainValue: false }], verificationParams: [{ key: 'productionLine', action: '==', value: '', isMainValue: false, isSearch: true, isFormModel: true, }], // 失去焦点校验参数 } }, tableForm:{ multiple:true, disabled:true, // isInpuFocusShow: true, searchListPlaceholder: '请选择物料代码', // 输入框占位文本 searchField: 'productionLineCode', // 查询弹窗赋值字段 searchTitle: '生产线物料关系信息', // 查询弹窗标题 searchAllSchemas: Productionlineitem.allSchemas, // 查询弹窗所需类 searchPage: ProductionlineitemApi.getProductionlineitemPage, // 查询弹窗所需分页方法 searchCondition: [{ key:'itemCode', value:'itemCode', message: '请选择物料代码!', isMainValue: true },{ key: 'available', value: 'TRUE', isMainValue: false }], verificationPage: ProductionlineitemApi.getProductionLineCodelistByCodes, // 校验数去焦点输入是否正确的方法 isShowTableFormSearch: true, verificationParams: [{ key: 'productionLineCode', action: '==', value: '', isMainValue: false, isSearch: true, isFormModel: true, }], // 失去焦点校验参数 }, }, { label: '工序', field: 'processCode', sort: 'custom', table: { width: 150 }, tableForm: { enterSearch:true, isInpuFocusShow: true, searchListPlaceholder: '请选择工序代码', searchField: 'code', searchTitle: '工序信息', searchAllSchemas: Process.allSchemas, searchPage: ProcessApi.getProcessPage, searchCondition: [{ key: 'productionLineCode', value: 'productionLine', isMainValue: true },{ key: 'available', value: 'TRUE', isMainValue: false }], verificationParams: [{ key: 'code', action: '==', value: '', isMainValue: false, isSearch: true, isFormModel: true, }], // 失去焦点校验参数 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { enterSearch: true, isSearchList: true, searchListPlaceholder: '请选择工序代码', searchField: 'code', searchTitle: '工序信息', searchAllSchemas: Process.allSchemas, searchPage: ProcessApi.getProcessPage, searchCondition: [{ key: 'productionLineCode', value: 'productionLine', isMainValue: true },{ key: 'available', value: 'TRUE', isMainValue: false }], verificationParams: [{ key: 'code', action: '==', value: '', isMainValue: false, isSearch: true, isFormModel: true, }], // 失去焦点校验参数 } } }, { label: '子物料代码', field: 'componentItemCode', sort: 'custom', isSearch: false, table: { width: 150 }, tableForm:{ // enterSearch: true, isInpuFocusShow: true, searchListPlaceholder: '请选择子物料代码', searchField: 'componentItemCode', searchTitle: '库存余额物料清单信息', searchAllSchemas: BalanceBom.allSchemas, searchPage: ProcessproductionRequestMainApi.getProcessproductionChildBomPage, searchCondition: [{ key:'productItemCode', value:'itemCode', message: '请填写物料代码!', isMainValue: true },{ key: 'available', value: 'TRUE', isMainValue: false }], verificationParams: [{ key: 'componentItemCode', action: '==', value: '', isMainValue: false, isSearch: true, isFormModel: true, }], // 失去焦点校验参数 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { enterSearch: true, isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择子物料代码', searchField: 'componentItemCode', searchTitle: '库存余额物料清单信息', searchAllSchemas: BalanceBom.allSchemas, searchPage: ProcessproductionRequestMainApi.getProcessproductionChildBomPage, searchCondition: [{ key:'productItemCode', value:'itemCode', message: '请填写物料代码!', isMainValue: true },{ key: 'available', value: 'TRUE', isMainValue: false }], verificationParams: [{ key: 'componentItemCode', action: '==', value: '', isMainValue: false, isSearch: true, isFormModel: true, }], // 失去焦点校验参数 } } // tableForm: { // enterSearch: true, // isInpuFocusShow: true, // searchListPlaceholder: '请选择子物料代码版本', // 输入框占位文本 // searchField: 'componentItemCode', // 查询弹窗赋值字段 // searchTitle: '物料清单信息', // 查询弹窗标题 // searchAllSchemas: Bom.allSchemas, // 查询弹窗所需类 // searchPage: BomApi.getBomPage, // 查询弹窗所需分页方法 // searchCondition: [{ // key:'productItemCode', // value:'itemCode', // message: '请填写物料代码!', // isMainValue: true // },{ // key: 'available', // value: 'TRUE', // isMainValue: false // }], // verificationParams: [{ // key: 'componentItemCode', // action: '==', // value: '', // isMainValue: false, // isSearch: true, // isFormModel: true, // }], // 失去焦点校验参数 // }, // form: { // // labelMessage: '信息提示说明!!!', // componentProps: { // enterSearch: true, // isSearchList: true, // 开启查询弹窗 // searchListPlaceholder: '请选择Bom版本', // 输入框占位文本 // searchField: 'componentItemCode', // 查询弹窗赋值字段 // searchTitle: '物料清单信息', // 查询弹窗标题 // searchAllSchemas: Bom.allSchemas, // 查询弹窗所需类 // searchPage: BomApi.getBomPage, // 查询弹窗所需分页方法 // searchCondition: [{ // key:'productItemCode', // value:'itemCode', // message: '请填写物料代码!', // isMainValue: true // },{ // key: 'available', // value: 'TRUE', // isMainValue: false // }], // verificationParams: [{ // key: 'componentItemCode', // action: '==', // value: '', // isMainValue: false, // isSearch: true, // isFormModel: true, // }], // 失去焦点校验参数 // } // }, }, { label: '库位代码', field: 'locationCode', sort: 'custom', table: { width: 150 }, tableForm:{ disabled:true, }, form: { componentProps: { disabled:true, } } // tableForm: { // enterSearch: true, // multiple:true,//多选 // isInpuFocusShow: true, // 开启查询弹窗 // searchListPlaceholder: '请选择库位代码', // 输入框占位文本 // searchField: 'code', // 查询弹窗赋值字段 // searchTitle: '库位基础信息', // 查询弹窗标题 // searchAllSchemas: Location.allSchemas, // 查询弹窗所需类 // searchPage: LocationApi.getLocationPage, // 查询弹窗所需分页方法 // searchCondition: [{ // key: 'available', // value: 'TRUE', // isMainValue: false // }], // verificationParams: [{ // key: 'code', // action: '==', // value: '', // isMainValue: false, // isSearch: true, // isFormModel: true, // }], // 失去焦点校验参数 // }, // form: { // // labelMessage: '信息提示说明!!!', // componentProps: { // enterSearch: true, // isSearchList: true, // 开启查询弹窗 // multiple:true,//多选 // searchListPlaceholder: '请选择库位代码', // 输入框占位文本 // searchField: 'code', // 查询弹窗赋值字段 // searchTitle: '库位基础信息', // 查询弹窗标题 // searchAllSchemas: Location.allSchemas, // 查询弹窗所需类 // searchPage: LocationApi.getLocationPage, // 查询弹窗所需分页方法 // searchCondition: [{ // key: 'available', // value: 'TRUE', // isMainValue: false // }], // verificationParams: [{ // key: 'code', // action: '==', // value: '', // isMainValue: false, // isSearch: true, // isFormModel: true, // }], // 失去焦点校验参数 // } // } }, { label: '批次', field: 'batch', sort: 'custom', table: { width: 150 }, tableForm:{ disabled:true, }, form: { componentProps: { disabled:true, } } }, { label: '子物料数量', field: 'componentItemcodeQty', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 0, precision: 6 } }, tableForm: { type: 'InputNumber', min: 0, precision: 6 }, }, { label: '生效日期', field: 'effectiveDate', sort: 'custom', formatter: dateFormatter2, detail: { dateFormat: 'YYYY-MM-DD' }, table: { width: 150 }, form: { component: 'DatePicker', componentProps: { style: {width: '100%'}, type: 'date', dateFormat: 'YYYY-MM-DD', valueFormat: 'x', } }, tableForm:{ type:'FormDate', placeholder: '请选择生效日期', valueFormat: 'x', } }, { label: '是否可用', field: 'available', sort: 'custom', isTable:false, isTableForm:false, isForm:false, table: { width: 150 }, }, { label: '备注', field: 'remark', sort: 'custom', }, { label: '创建时间', field: 'createTime', sort: 'custom', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, table: { width: 180 }, 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', table: { width: 130 }, isSearch: false, isForm: false, isTable: false, isTableForm: false, }, { label: '删除时间', field: 'deletionTime', sort: 'custom', formatter: dateFormatter, isSearch: false, isTable:false, isForm: false, isTableForm: false, table: { width: 150 }, search: { component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD HH:mm:ss', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] } }, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } }, }, { label: '删除者ID', field: 'deleterId', sort: 'custom', isSearch: false, isTable:false, isForm: false, isTableForm: false, table: { width: 150 }, }, { label: '扩展属性', field: 'extraProperties', sort: 'custom', isSearch: false, isTable:false, isForm: false, isTableForm: false, }, { label: '并发乐观锁', field: 'concurrencyStamp', sort: 'custom', isSearch: false, isTable:false, isForm: false, isTableForm: false, form: { component: 'InputNumber', value: 0 }, }, { label: '地点ID', field: 'siteId', sort: 'custom', isSearch: false, isTable:false, isForm: false, isTableForm: false, }, { label: '主表ID', field: 'masterId', sort: 'custom', hiddenInMain:true, isTable:false, isTableForm:false, isForm: false, form: { component: 'InputNumber', value: 0 }, }, { label: '操作', field: 'action', isForm: false, isTable:false, isTableForm:false, hiddenInMain:true, table: { width: 150, fixed: 'right' } } ])) // 表单校验 export const ProcessproductionRequestDetailRules = reactive({ productionLine: [ { required: true, message: '请选择生产线代码', trigger: 'change' } ], // processCode: [ // { required: true, message: '请选择工序代码', trigger: 'change' } // ], locationCode: [ { required: true, message: '请选择库位代码', trigger: 'change' } ], componentItemCode:[ { required: true, message: '请选择子物料代码', trigger: 'change' } ], componentItemcodeQty:[ { required: true, message: '请输入子物料数量', trigger: 'change' } ], batch:[ { required: true, message: '请输入批次', trigger: 'change' } ], effectiveDate:[ { required: true, message: '请输入生效日期', trigger: 'change' } ], })