You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

960 lines
19 KiB

import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
import * as SupplieritemApi from '@/api/wms/supplieritem'
import { Supplieritem } from '@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data'
import * as ProductionlineitemApi from '@/api/wms/productionlineitem'
import { Productionlineitem } from '@/views/wms/basicDataManage/itemManage/productionlineitem/productionlineitem.data'
import { validatePositiveNumber } from "@/utils/validator";
/**
* @returns {Array} 库存余额
*/
export const Balance = useCrudSchemas(
reactive<CrudSchema[]>([
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
isSearch: true
},
{
label: '物料名称',
field: 'itemName',
sort: 'custom',
table: {
width: 150
},
isSearch: true
},
{
label: '物料描述1',
field: 'itemDesc1',
sort: 'custom',
table: {
width: 150
},
hiddenSearchHigh: true,// 高级筛选中隐藏
isSearch: true
},
{
label: '物料描述2',
field: 'itemDesc2',
sort: 'custom',
table: {
width: 150
},
hiddenSearchHigh: true,// 高级筛选中隐藏
isSearch: true
},
{
label: '物料类型',
field: 'itemType',
sort: 'custom',
dictType: DICT_TYPE.ITEM_TYPE,
dictClass: 'string',
isSearch: true,
table: {
width: 100
}
},
{
label: '批次',
field: 'batch',
sort: 'custom',
table: {
width: 150
},
isSearch: true
},
{
label: '供应商批次',
field: 'altBatch',
sort: 'custom',
table: {
width: 150
},
isSearch: false
},
{
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: 'containerNumber',
// sort: 'custom',
// table: {
// width: 150
// },
// isTable:false
// },
{
label: '库存数量',
field: 'qty',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber'
}
},
{
label: '创建者',
field: 'creator',
sort: 'custom',
table: {
width: 150
},
isForm: false
},
{
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: 'ERP库位代码',
// field: 'erpLocationCode',
// dictType: DICT_TYPE.ERP_LOCATION,
// dictClass: 'string',
// isTable: false,
// sort: 'custom',
// table: {
// width: 150
// },
// },
// {
// label: '替代批次',
// field: 'altBatch',
// sort: 'custom',
// table: {
// width: 150
// },
// isTable: false,
// },
{
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'
}
}
},
{
label: '货主代码',
field: 'ownerCode',
sort: 'custom',
table: {
width: 150
},
isTable: false
},
{
label: '锁定数量',
field: 'lockedQty',
sort: 'custom',
table: {
width: 150
},
isTable: false,
form: {
component: 'InputNumber'
}
},
// {
// label: '可用数量',
// field: 'usableQty',
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// component: 'InputNumber',
// }
// },
// {
// label: '单价',
// field: 'singlePrice',
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// component: 'InputNumber',
// }
// },
// {
// label: '金额',
// field: 'amount',
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// component: 'InputNumber',
// }
// },
// {
// label: '入库时间',
// field: 'putInTime',
// isTable: true,
// formatter: dateFormatter,
// detail: {
// dateFormat: 'YYYY-MM-DD HH:mm:ss'
// },
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// component: 'DatePicker',
// componentProps: {
// type: 'datetime',
// }
// }
// },
{
label: '是否冻结',
field: 'frozen',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
// {
// label: '冻结原因',
// field: 'frozenReason',
// dictType: DICT_TYPE.FROZEN_REASON,
// dictClass: 'string',
// isTable: true,
// sort: 'custom',
// table: {
// width: 150
// },
// },
// {
// label: '重量',
// field: 'weight',
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// component: 'InputNumber',
// }
// },
// {
// label: '面积',
// field: 'area',
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// component: 'InputNumber',
// }
// },
// {
// label: '体积',
// field: 'volume',
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// component: 'InputNumber',
// }
// },
{
label: '最后事务号',
field: 'lastTransNumber',
sort: 'custom',
table: {
width: 150
}
},
{
label: '创建时间',
field: 'createTime',
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'
}
},
isForm: false,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'datetimerange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
}
},
{
label: '最后更新时间',
field: 'updateTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x'
}
},
isForm: false,
isTable: true
},
{
label: '最后更新者',
field: 'updater',
sort: 'custom',
table: {
width: 150
},
isForm: false,
isTable: true
},
// TODO: 临时添加 方便操作
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false,
table: {
width: 200,
fixed: 'right'
}
}
])
)
/**
* @returns {Array} 库存余额弹窗
*/
export const BalancePopWindow = useCrudSchemas(
reactive<CrudSchema[]>([
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
isSearch: true
},
{
label: '物料名称',
field: 'itemName',
sort: 'custom',
table: {
width: 150
},
isSearch: true
},
{
label: '物料描述1',
field: 'itemDesc1',
sort: 'custom',
table: {
width: 150
},
hiddenSearchHigh: true,// 高级筛选中隐藏
isSearch: true
},
{
label: '物料描述2',
field: 'itemDesc2',
sort: 'custom',
table: {
width: 150
},
hiddenSearchHigh: true,// 高级筛选中隐藏
isSearch: true
},
{
label: '物料类型',
field: 'itemType',
sort: 'custom',
dictType: DICT_TYPE.ITEM_TYPE,
dictClass: 'string',
isSearch: true,
table: {
width: 100
}
},
{
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: 'batch',
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: 'locationCode',
sort: 'custom',
table: {
width: 150
},
isSearch: true
},
{
label: '包装规格',
field: 'packUnit',
sort: 'custom',
table: {
width: 150
}
},
{
label: '包装数量',
field: 'packQty',
sort: 'custom',
table: {
width: 150
}
},
// TODO: 临时添加 方便操作
// {
// label: '操作',
// field: 'action',
// isDetail: false,
// isForm: false,
// table: {
// width: 200,
// fixed: 'right'
// }
// }
])
)
export const TransactionTab = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isTable: true,
isForm: true,
isDetail:true,
},
{
label: '创建时间',
field: 'createTime',
isTable: true,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 150
},
form: {
component: 'DatePicker',
componentProps: {
style: {width: '100%'},
type: 'date',
dateFormat: 'YYYY-MM-DD',
valueFormat: 'x',
}
},
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: 'businessType',
sort: 'custom',
table: {
width: 150
},
},
{
label: '事务类型',
field: 'transactionType',
sort: 'custom',
table: {
width: 150
},
},
{
label: '库存动作',
field: 'inventoryAction',
dictType: DICT_TYPE.INVENTORY_ACTION,
dictClass: 'string',
isTable: true,
isSearch: true,
sort: 'custom',
table: {
width: 150
},
},
{
label: '业务记录号',
field: 'recordNumber',
sort: 'custom',
isTable: true,
isSearch: true,
table: {
width: 180
},
},
{
label: '包装号',
field: 'packingNumber',
sort: 'custom',
table: {
width: 150
},
isSearch: true,
},
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
isSearch: true,
},
{
label: '批次',
field: 'batch',
sort: 'custom',
table: {
width: 150
},
isSearch: true,
},
{
label: '替代批次',
field: 'altBatch',
sort: 'custom',
table: {
width: 150
},
isSearch: true,
},
{
label: '库位代码',
field: 'locationCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '库存状态',
field: 'inventoryStatus',
dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
isTable: true,
isSearch: true,
sort: 'custom',
table: {
width: 150
},
},
{
label: '数量',
field: 'qty',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
}
},
{
label: '事务号',
field: 'number',
sort: 'custom',
table: {
width: 180
},
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: true
}
]))
// 表单校验
export const BalanceRules = reactive({
packingNumber: [
{ required: true, message: '请选择包装号', trigger: 'change' }
],
// containerNumber: [
// { required: true, message: '请选择器具号', trigger: 'change' }
// ],
itemCode: [
{ required: true, message: '请选择物料代码', trigger: 'change' }
],
batch: [
{ required: true, message: '请输入批次', trigger: 'blur' }
],
arriveDate: [
{ required: true, message: '请选择到货日期', trigger: 'change' }
],
produceDate: [
{ required: true, message: '请选择生产日期', trigger: 'change' }
],
})
// 表单校验
export const BalancePackageRules = reactive({
batch: [
{ required: true, message: '请输入批次', trigger: 'blur' }
],
printQty: [
{ required: true, message: '请输入打印数量', trigger: ['change', 'blur'] },
{ validator: validatePositiveNumber, message: '必须是一个正数', trigger: ['change','blur'] }
],
supplierItemCode: [
{ required: true, message: '请输入标签供应商代码', trigger: 'blur' }
],
productionLineCodePackage: [
{ required: true, message: '请输入标签生产线代码', trigger: 'blur' }
],
})
export const BalancePackage = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
isSearch: true,
table: {
},
tableForm: {
disabled: true
}
},
{
label: '批次',
field: 'batch',
sort: 'custom',
isSearch: true,
tableForm: {
type: 'FormDate',
format: 'YYYYMMDD',
valueFormat: 'YYYYMMDD',
}
},
{
label: '打印数量',
field: 'printQty',
sort: 'custom',
table: {
},
tableForm: {
type: 'InputNumber',
precision: 6,
min: 0
}
},
{
label: '包装规格',
field: 'packUnit',
sort: 'custom',
tableForm: {
disabled: true
}
},
{
label: '标包数量',
field: 'packQty',
sort: 'custom',
tableForm: {
disabled: true
}
},
{
label: '计量单位',
field: 'uom',
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
form: {
component: 'Select'
},
table: {
},
tableForm: {
type: 'Select',
disabled: true
}
},
{
label: '标签生产线代码',
field: 'productionLineCodePackage',
sort: 'custom',
table: {
width: 150
},
tableForm: {
enterSearch: true,
isInpuFocusShow: true,
searchListPlaceholder: '请选择生产线代码', // 输入框占位文本
searchField: 'productionLineCode', // 查询弹窗赋值字段
searchTitle: '生产线物料关系信息', // 查询弹窗标题
searchAllSchemas: Productionlineitem.allSchemas, // 查询弹窗所需类
searchPage: ProductionlineitemApi.getProductionlineitemPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'itemCode',
value: 'itemCode',
isMainValue: true
}]
}
},
{
label: '标签供应商代码',
field: 'supplierItemCode',
sort: 'custom',
table: {
width: 150
},
tableForm: {
enterSearch: true,
isInpuFocusShow: true,
searchListPlaceholder: '请选择供应商代码', // 输入框占位文本
searchField: 'supplierCode', // 查询弹窗赋值字段
searchTitle: '供应商信息', // 查询弹窗标题
searchAllSchemas: Supplieritem.allSchemas, // 查询弹窗所需类
searchPage: SupplieritemApi.getSupplieritemPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'itemCode',
value: 'itemCode',
message: '请填写物料代码!',
isMainValue: true
}]
}
},
]))