import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } 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"; // 表单校验 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' } }, { label: '标签类型', field: 'type', sort: 'custom', isSearch: true, dictType: DICT_TYPE.LABEL_TYPE, dictClass: 'string' }, { label: '标签模板', field: 'template', sort: 'custom', }, { label: '标签状态', field: 'status', sort: 'custom', isSearch: true, dictType: DICT_TYPE.LABEL_STATUS, dictClass: 'string' }, { label: '关联号', field: 'relateNumber', sort: 'custom', }, { label: '标签条码字符串', field: 'barcodeString', sort: 'custom', table: { width: 180, } }, { label: '打印次数', field: 'printTimes', sort: 'custom', form: { component: 'InputNumber', componentProps: { min: 0 }, value: 0 }, }, { 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', } }, }, { label: '最后打印人ID', field: 'lastPrintUserId', sort: 'custom' }, { label: '最后打印人用户名', field: 'lastPrintUserName', sort: 'custom', table: { width: 180, } }, { 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: { isSearchList: true, searchListPlaceholder: '请选择物料代码', searchField: 'code', searchTitle: '物料信息', searchAllSchemas: Itembasic.allSchemas, searchPage: ItembasicApi.getItembasicPage, searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false }] } } }, { label: '物料名称', field: 'itemName', sort: 'custom', table: { width: 150, }, isForm:false }, { label: '物料描述1', field: 'itemDesc1', sort: 'custom', table: { width: 150, }, isForm:false }, { label: '物料描述2', 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: 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: { type: 'datetime', valueFormat: 'x', disabled: true } }, 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: { type: 'datetime', 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: 'packQty', sort: 'custom', table: { width: 150, }, form: { componentProps:{ disabled: true } }, tableForm: { disabled: true } }, { label: '包装规格', field: 'packUnit', sort: 'custom', dictType: DICT_TYPE.PACK_UNIT, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 table: { width: 150, }, form: { component: 'Select', componentProps:{ disabled: true } }, tableForm: { disabled: true } }, // { // 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: { isSearchList: true, searchListPlaceholder: '请选择生产线代码', searchField: 'code', searchTitle: '生产线信息', searchAllSchemas: Productionline.allSchemas, searchPage: ProductionlineApi.getProductionlinePage, searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false }] } } }, { label: '班组代码', field: 'teamCode', sort: 'custom', table: { width: 150, }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, searchListPlaceholder: '请选择生产线代码', searchField: 'code', searchTitle: '生产线信息', searchAllSchemas: Team.allSchemas, searchPage: TeamApi.getTeamPage, searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false }] } } }, { label: '班次代码', field: 'shiftCode', sort: 'custom', table: { width: 150, }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, searchListPlaceholder: '请选择生产线代码', searchField: 'code', searchTitle: '生产线信息', searchAllSchemas: Shift.allSchemas, searchPage: ShiftApi.getShiftPage, searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false }] } } }, { 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' } ], })