import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter, dateFormatter2 } from '@/utils/formatTime' import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' import * as ItembasicApi from '@/api/wms/itembasic' import { Productionline } from '@/views/wms/basicDataManage/factoryModeling/productionline/productionline.data' import * as ProductionlineApi from '@/api/wms/productionline' import { Shift } from '@/views/wms/basicDataManage/orderManage/shift/shift.data' import * as ShiftApi from '@/api/wms/shift' import { Team } from '@/views/wms/basicDataManage/orderManage/team/team.data' import * as TeamApi from '@/api/wms/team' import * as ItempackagingApi from '@/api/wms/itempackage' import { Itempackaging } from '@/views/wms/basicDataManage/itemManage/itempackage/itempackage.data' // 表单校验 export const PackageRules = reactive({ number: [required], itemCode: [required], itemName: [required] }) export const Package = useCrudSchemas( reactive([ { label: '标签号', field: 'number', sort: 'custom', isSearch: true, table: { fixed: 'left', width: 210 } }, { label: '标签类型', field: 'type', sort: 'custom', isSearch: false, dictType: DICT_TYPE.LABEL_TYPE, dictClass: 'string', table: { width: 180 } }, { label: '标签模板', field: 'template', sort: 'custom', isTable: false, table: { width: 180 } }, { label: '标签状态', field: 'status', sort: 'custom', isTable: false, isSearch: true, dictType: DICT_TYPE.LABEL_STATUS, dictClass: 'string', table: { width: 180 } }, { label: '关联号', field: 'relateNumber', sort: 'custom', isSearch: true, table: { width: 210 } }, { label: '标签条码字符串', field: 'barcodeString', sort: 'custom', table: { width: 380 } }, // { // label: '打印次数', // field: 'printTimes', // sort: 'custom', // form: { // component: 'InputNumber', // componentProps: { // min: 0 // }, // value: 0 // }, // table: { // width: 180 // } // }, // { // label: '最后打印时间', // field: 'lastPrintTime', // sort: 'custom', // formatter: dateFormatter, // form: { // component: 'DatePicker', // componentProps: { // style: {width:'100%'}, // type: 'datetime', // dateFormat: 'YYYY-MM-DD HH:mm:ss', // valueFormat: 'x', // } // }, // table: { // width: 180 // } // }, // { // label: '最后打印人ID', // field: 'lastPrintUserId', // sort: 'custom', // table: { // width: 180 // } // }, // { // label: '最后打印人用户名', // field: 'lastPrintUserName', // sort: 'custom', // table: { // width: 180, // } // }, { label: '是否可用', field: 'available', sort: 'custom', isSearch: true, isForm: false, dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 search: { value: 'TRUE' }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, table: { width: 110 } }, { label: '创建时间', field: 'createTime', isForm: false, table: { width: 180 }, formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, form: { component: 'DatePicker', componentProps: { style: { width: '100%' }, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x' } } }, { label: '创建者', field: 'creator', table: { width: 130 }, isForm: false, isTable: true }, { label: '最后更新时间', field: 'updateTime', sort: 'custom', isDetail: true, isForm: false, isTable: true, 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: true, table: { width: 150 } }, { label: '操作', field: 'action', isForm: false, table: { width: 150, fixed: 'right' } } ]) ) export const PackageInventory = useCrudSchemas( reactive([ { label: '品番', field: 'itemCode', sort: 'custom', isSearch: true, table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { enterSearch: true, isSearchList: true, searchListPlaceholder: '请选择品番', searchField: 'code', searchTitle: '物料信息', searchAllSchemas: Itembasic.allSchemas, searchPage: ItembasicApi.getItembasicPage, searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false }, { key: 'enableMake', value: 'TRUE', isMainValue: false } ], verificationParams: [ { key: 'code', action: '==', value: '', isMainValue: false, isSearch: true, isFormModel: true } ] // 失去焦点校验参数 } } }, { label: '品名', field: 'itemName', sort: 'custom', table: { width: 150 }, isForm: false }, { label: '背番', field: 'itemDesc1', sort: 'custom', table: { width: 150 }, isForm: false }, { label: '物料描述', field: 'itemDesc2', sort: 'custom', table: { width: 150 }, isForm: false }, { label: '批次', field: 'batch', sort: 'custom', isSearch: true, table: { width: 150 } }, // { // label: '替代批次', // field: 'altBatch', // sort: 'custom', // table: { // width: 150, // }, // }, { label: '生产日期', field: 'produceDate', sort: 'custom', formatter: dateFormatter2, search: { component: 'DatePicker', componentProps: { style: { width: '100%' }, valueFormat: 'YYYY-MM-DD', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] } }, form: { component: 'DatePicker', componentProps: { style: { width: '100%' }, type: 'date', dateFormat: 'YYYY-MM-DD', valueFormat: 'x' } }, table: { width: 180 } }, { label: '有效期(日)', field: 'validityDays', sort: 'custom', form: { component: 'InputNumber', componentProps: { min: 0, precision: 0, disabled: true }, value: 0 }, table: { width: 150 } }, { label: '失效日期', field: 'expireDate', sort: 'custom', formatter: dateFormatter, search: { component: 'DatePicker', componentProps: { style: { width: '100%' }, valueFormat: 'YYYY-MM-DD HH:mm:ss', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')], disabled: true } }, form: { component: 'DatePicker', componentProps: { style: { width: '100%' }, type: 'date', dateFormat: 'YYYY-MM-DD', valueFormat: 'x', disabled: true } }, table: { width: 180 } }, { label: '计量单位', field: 'uom', sort: 'custom', dictType: DICT_TYPE.UOM, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 form: { component: 'Select' }, table: { width: 150 } }, { label: '数量', field: 'qty', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 0, precision: 6 }, value: 0 } }, { label: '替代计量单位', field: 'altUom', sort: 'custom', dictType: DICT_TYPE.UOM, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 form: { component: 'Select' }, table: { width: 150 } }, { label: '替代数量', field: 'altQty', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 0, precision: 6 }, value: 0 } }, { label: '转换率', field: 'convertRate', sort: 'custom', table: { width: 150 } }, { label: '包装规格', field: 'packUnit', sort: 'custom', isSearch: false, table: { width: 120 }, isTable: false, isTableForm: false, isForm: true, tableForm: { enterSearch: true, isInpuFocusShow: true, isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择包装规格', // 输入框占位文本 searchField: 'packUnit', // 查询弹窗赋值字段 searchTitle: '物料包装信息', // 查询弹窗标题 searchAllSchemas: Itempackaging.allSchemas, // 查询弹窗所需类 searchPage: ItempackagingApi.getItempackagingPage, // 查询弹窗所需分页方法 searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false }, { key: 'itemCode', value: 'itemCode', message: '请先选择品番!', isMainValue: true } ], verificationParams: [ { key: 'packUnit', action: '==', value: '', isMainValue: false, isSearch: true, isFormModel: true } ] // 失去焦点校验参数 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择包装规格', // 输入框占位文本 searchField: 'packUnit', // 查询弹窗赋值字段 searchTitle: '物料包装信息', // 查询弹窗标题 searchAllSchemas: Itempackaging.allSchemas, // 查询弹窗所需类 searchPage: ItempackagingApi.getItempackagingPage, // 查询弹窗所需分页方法 searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false }, { key: 'itemCode', value: 'itemCode', message: '请先选择品番!', // 当前置条件为空时 弹出信息提示 isMainValue: true } ], verificationParams: [ { key: 'packUnit', action: '==', value: '', isMainValue: false, isSearch: true, isFormModel: true } ] // 失去焦点校验参数 } } }, { label: '包装数量', field: 'packQty', sort: 'custom', table: { width: 150 } }, // { // label: '生产订单号', // field: 'woNumber', // sort: 'custom', // table: { // width: 150, // }, // form: { // // labelMessage: '信息提示说明!!!', // componentProps: { // isSearchList: true, // searchListPlaceholder: '请选择品番', // searchField: 'code', // searchTitle: '物料信息', // searchAllSchemas: Itembasic.allSchemas, // searchPage: ItembasicApi.getItembasicPage, // searchCondition: [{ // key: 'available', // value: 'TRUE', // isMainValue: false // }] // } // } // }, // { // label: '生产订单行', // field: 'woLine', // sort: 'custom', // table: { // width: 150, // }, // }, { label: '生产线代码', field: 'productionLineCodePackage', sort: 'custom', table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { enterSearch: true, isSearchList: true, searchListPlaceholder: '请选择生产线代码', searchField: 'code', searchTitle: '生产线信息', searchAllSchemas: Productionline.allSchemas, searchPage: ProductionlineApi.getProductionlinePage, searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false } ], verificationParams: [ { key: 'code', action: '==', value: '', isMainValue: false, isSearch: true, isFormModel: true } ] // 失去焦点校验参数 } } }, { label: '班组代码', field: 'teamCode', sort: 'custom', table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { enterSearch: true, isSearchList: true, searchListPlaceholder: '请选择生产线代码', searchField: 'code', searchTitle: '生产线信息', searchAllSchemas: Team.allSchemas, searchPage: TeamApi.getTeamPage, searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false } ], verificationParams: [ { key: 'code', action: '==', value: '', isMainValue: false, isSearch: true, isFormModel: true } ] // 失去焦点校验参数 } } }, { label: '班次代码', field: 'shiftCode', sort: 'custom', table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { enterSearch: true, isSearchList: true, searchListPlaceholder: '请选择生产线代码', searchField: 'code', searchTitle: '生产线信息', searchAllSchemas: Shift.allSchemas, searchPage: ShiftApi.getShiftPage, searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false } ], verificationParams: [ { key: 'code', action: '==', value: '', isMainValue: false, isSearch: true, isFormModel: true } ] // 失去焦点校验参数 } } }, { label: '操作', field: 'action', isForm: false, table: { width: 150, fixed: 'right' } } ]) ) //表单校验 export const PackageRulesInventor = reactive({ itemCode: [{ required: true, message: '请选择品番', trigger: 'change' }], batch: [{ required: true, message: '请输入批次', trigger: 'blur' }], produceDate: [{ required: true, message: '请选择生产日期', trigger: 'change' }], validityDays: [{ required: true, message: '请输入有效期(日)', trigger: 'blur' }], expireDate: [{ required: true, message: '请选择失效日期', trigger: 'change' }], uom: [{ required: true, message: '请选择计量单位', trigger: 'change' }], qty: [{ required: true, message: '请输入数量', trigger: 'blur' }], woNumber: [{ required: true, message: '请选择生产订单号', trigger: 'change' }], woLine: [{ required: true, message: '请选择生产订单行', trigger: 'change' }], productionLineCodePackage: [{ required: true, message: '请选择生产线代码', trigger: 'change' }], packUnit: [ { required: true, message: '请选择包装规格', trigger: ['change','blur'] } ], packQty: [ { required: true, message: '请输入包装数量', trigger: ['change','blur'] } ], })