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.

1129 lines
26 KiB

12 months ago
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
12 months ago
import * as SupplierApi from '@/api/wms/supplier'
import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
import * as PurchaseMainApi from '@/api/wms/purchaseMain'
import * as PurchaseDetailApi from '@/api/wms/purchaseDetail'
import { PurchaseDetail, PurchaseMain } from '../purchaseMain/purchaseMain.data'
import { getPurchaseDetailPagePoNumber } from '@/api/wms/purchaseDetail'
8 months ago
import * as ItembasicApi from '@/api/wms/itembasic'
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data'
import { validatePositiveNumber0, validateInteger } from "@/utils/validator";
12 months ago
const { t } = useI18n() // 国际化
/**
* @returns {Array}
*/
export const PurchasePlanMain = useCrudSchemas(
reactive<CrudSchema[]>([
{
3 months ago
label: '单据号',
field: 'number',
sort: 'custom',
isForm: false,
table: {
width: 180,
fixed: 'left'
},
sortTableDefault: 1,
sortSearchDefault: 4,
isSearch: true
},
{
label: '状态',
field: 'status',
sort: 'custom',
dictType: DICT_TYPE.PURCHASE_PLAN_STATUS,
dictClass: 'string',
isTable: true,
isForm: false,
isSearch: true,
table: {
width: 150
},
sortTableDefault: 2,
sortSearchDefault: 6,
search: {
value: [],
componentProps: {
multiple: true
}
},
form: {
value: '1',
componentProps: {
disabled: true
}
}
},
{
label: '供应商代码',
field: 'supplierCode',
sort: 'custom',
table: {
width: 150
},
isSearch: true,
sortTableDefault: 3,
sortSearchDefault: 1,
form: {
labelMessage: '影响明细中物料代码,需在供应商物料中维护',
componentProps: {
isEnter: true,
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择供应商代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '供应商信息', // 查询弹窗标题
searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类
searchPage: SupplierApi.getSupplierPageSCP, // 查询弹窗所需分页方法
searchCondition: [
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
],
verificationParams: [
{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: 'true',
isFormModel: true
}
] // 失去焦点校验参数
}
},
search: {
componentProps: {
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择供应商代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '供应商信息', // 查询弹窗标题
searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类
searchPage: SupplierApi.getSupplierPageSCP, // 查询弹窗所需分页方法
searchCondition: [
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
]
}
}
},
{
label: '供应商名称',
field: 'supplierName',
table: {
width: 150
},
sortTableDefault: 4,
sortSearchDefault: 1,
isTable: true,
isForm: false
},
{
3 months ago
label: '订单号',
field: 'poNumber',
sort: 'custom',
isSearch:true,
sortSearchDefault: 11,
3 months ago
sortTableDefault: 6,
//formatter: dateFormatter2,
table: {
width: 150
},
3 months ago
isTable: true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
3 months ago
disabled: true,
enterSearch: true,
dialogWidth: '1085px', //搜索出来弹窗的宽度
isSearchList: true,
searchListPlaceholder: '请选择采购订单',
searchField: 'number',
searchTitle: '采购订单信息',
searchAllSchemas: PurchaseMain.allSchemas,
searchPage: PurchaseMainApi.getPurchaseMainPage,
searchCondition: [
{
key: 'type',
value: 'SCHEDULE',
isMainValue: false
},
{
key: 'available',
value: 'TRUE',
isMainValue: false
},
{
key: 'supplierCode',
value: 'supplierCode',
message: '请填写供应商代码!',
isMainValue: true
},
{
key: 'status',
value: 2,
isMainValue: false
}
],
verificationParams: [
{
key: 'number',
action: '==',
value: '',
isMainValue: false,
isSearch: 'true',
isFormModel: true
}
] // 失去焦点校验参数
}
8 months ago
}
},
{
label: '送达日期',
3 months ago
sortTableDefault:5,
field: 'deliveryDate',
3 months ago
sort: 'custom',
isDetail: true,
isTable: true,
isForm: true,
isTableForm: false,
isSearch: true,
sortSearchDefault: 3,
formatter: dateFormatter2,
3 months ago
search: {
component: 'DatePicker',
componentProps: {
3 months ago
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 '), new Date('1 ')]
}
},
form: {
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD',
valueFormat: 'x',
defaultTime: [new Date('1 '), new Date('1 ')]
}
},
3 months ago
table: {
width: 150
},
detail: {
3 months ago
dateFormat:'YYYY-MM-DD'
8 months ago
}
},
{
label: '采购订单类型',
field: 'type',
sort: 'custom',
3 months ago
sortTableDefault: 7,
dictType: DICT_TYPE.PURCHASE_ORDER_TYPE,
dictClass: 'string',
3 months ago
isTable: false,
isForm: true,
table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
disabled: true
}
}
},
{
label: '收货人',
field: 'contacts',
isTable: false,
table: {
width: 150
},
3 months ago
sortTableDefault: 8,
form: {
componentProps: {
disabled: false
}
8 months ago
}
},
{
label: '联系电话',
field: 'phone',
isTable: false,
table: {
width: 150
},
3 months ago
sortTableDefault: 9,
form: {
componentProps: {
disabled: false
}
8 months ago
}
},
{
label: '时间窗口',
field: 'timeWindow',
table: {
width: 150
},
isTable: false,
isForm: false,
},
{
3 months ago
label: '仓库代码',
field: 'warehouseCode',
sort: 'custom',
table: {
width: 150
},
isTable: false,
isForm: false,
3 months ago
},
{
label: '月台代码',
field: 'dockCode',
sort: 'custom',
table: {
width: 150
},
isForm: false,
isTable: false,
},
{
3 months ago
label: '业务类型',
field: 'businessType',
sort: 'custom',
table: {
width: 150
},
isForm: false,
3 months ago
isTable: false,
form: {
3 months ago
value: 'PurchaseReceipt',
componentProps: {
3 months ago
disabled: true
}
},
},
{
3 months ago
label: '班次',
field: 'shift',
sort: 'custom',
3 months ago
isTable: false,
isForm: false,
table: {
width: 150
},
3 months ago
},
{
label: 'SPARC订单号',
field: 'orderCode',
sort: 'custom',
isForm: false,
isTable: true,
3 months ago
table: {
width: 180,
},
sortSearchDefault: 4,
isSearch: true
},
{
3 months ago
label: '便次',
field: 'deliNo',
sort: 'custom',
3 months ago
sortTableDefault: 13,
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 1,
},
}
3 months ago
},
3 months ago
{
label: '预测版本',
field: 'activeVersion',
isTable: false,
isForm: false,
3 months ago
sortTableDefault: 13,
table: {
width: 150
},
},
{
3 months ago
label: '来源',
field: 'source',
sort: 'custom',
dictType: DICT_TYPE.PURCHASE_PLAN_SOURCE,
dictClass: 'string',
isTable: false,
isForm: false,
sortTableDefault: 13,
table: {
width: 150
},
},
{
label: '开始时间',
field: 'beginTime',
sort: 'custom',
table: {
width: 150
},
3 months ago
isTable: false,
isForm: false,
3 months ago
isDetail: false,
form: {
component: 'TimePicker',
componentProps: {
format: 'HH:mm'
}
}
},
{
label: '结束时间',
field: 'endTime',
sort: 'custom',
table: {
width: 150
},
isTable: false,
3 months ago
isForm: false,
isDetail: false,
form: {
3 months ago
component: 'TimePicker',
componentProps: {
3 months ago
format: 'HH:mm'
}
12 months ago
}
},
3 months ago
// {
// label: '自动发布',
// field: 'autoPublish',
// 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: 'autoAccept',
// 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: 'available',
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string',
// isTable: true,
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// component: 'Switch',
// value: 'TRUE',
// componentProps: {
// inactiveValue: 'FALSE',
// activeValue: 'TRUE',
// disabled: true
// }
// },
// isSearch: true,
// },
{
label: '创建者',
field: 'creator',
sort: 'custom',
isForm: false,
3 months ago
isTable: true,
sortTableDefault: 1000,
table: {
width: 150
12 months ago
}
},
{
label: '创建时间',
field: 'createTime',
isTable: true,
3 months ago
sortTableDefault: 1000,
isForm: false,
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'
}
},
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')]
}
12 months ago
}
},
3 months ago
// {
// label: '最后更新者',
// field: 'updater',
// sort: 'custom',
// isForm: false,
// isTable: false,
// table: {
// width: 150
// }
// },
// {
// label: '最后更新时间',
// field: 'updateTime',
// isTable: false,
// isForm: false,
// 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'
// }
// }
// },
{
3 months ago
label: '备注',
field: 'remark',
sort: 'custom',
table: {
width: 150
3 months ago
},
isTable: false,
isForm: false,
isDetail: false
},
{
3 months ago
label: '操作',
field: 'action',
isDetail: false,
isForm: false,
table: {
width: 250,
fixed: 'right'
12 months ago
}
}
])
)
12 months ago
//表单校验
export const PurchasePlanMainRules = reactive({
available: [{ required: true, message: '请选择是否可用', trigger: 'change' }],
supplierCode: [{ required: true, message: '请选择供应商代码', trigger: 'change' }],
poNumber: [{ required: true, message: '请选择采购订单号', trigger: 'change' }],
deliveryDate: [{ required: true, message: '请选择送达时间', trigger: 'change' }],
status: [{ required: true, message: '请选择状态', trigger: 'change' }],
number: [{ required: true, message: '请输入单据号', trigger: 'blur' }],
businessType: [{ required: true, message: '请输入业务类型', trigger: 'blur' }],
remark: [{ max: 50, message: '不得超过50个字符', trigger: 'blur' }],
deliNo: [
{ required: true, message: '请输入便次', trigger: 'blur' },
{ validator: validateInteger, message: '请输入正确的正整数', trigger: ['change', 'blur'] },
],
12 months ago
})
/**
* @returns {Array}
*/
export const PurchasePlanDetail = useCrudSchemas(
reactive<CrudSchema[]>([
3 months ago
// {
// label: '要货计划单号',
// field: 'number',
// sort: 'custom',
// isTableForm: false,
// hiddenInMain: true,
// table: {
// width: 180
// },
// form: {
// componentProps: {
// disabled: true
// }
// }
// },
// {
// label: '采购订单号',
// field: 'poNumber',
// isSearch: true,
// isTable: true,
// sortTableDefault: 11,
// sortSearchDefault: 11,
// isForm: false,
// isTableForm: false,
// table: {
// width: 150
// },
// search: {
// // labelMessage: '信息提示说明!!!',
// componentProps: {
// dialogWidth: '1085px', //搜索出来弹窗的宽度
// isSearchList: true,
// enterSearch: true,
// searchListPlaceholder: '请选择采购订单',
// searchField: 'number',
// searchTitle: '采购订单信息',
// searchAllSchemas: PurchaseMain.allSchemas,
// searchPage: PurchaseMainApi.getPurchaseMainPage,
// searchCondition: [
// {
// key: 'available',
// value: 'TRUE',
// isMainValue: false
// },
// {
// key: 'supplierCode',
// value: 'supplierCode',
// message: '请填写供应商代码!',
// isMainValue: true
// },
// {
// key: 'status',
// value: 2,
// isMainValue: false
// }
// ]
// }
// }
// },
{
label: '订单行',
field: 'poLine',
sort: 'custom',
table: {
width: 150
},
sortTableDefault: 16,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
disabled: true,
isSearchList: false,
searchListPlaceholder: '请选择订单行',
searchField: 'lineNumber',
searchTitle: '采购订单信息',
searchAllSchemas: PurchaseDetail.allSchemas,
searchPage: PurchaseDetailApi.getPurchaseDetailPagePoNumber,
searchCondition: [
{
key: 'number',
value: 'poNumber',
message: '请填写订单号!',
isMainValue: true
},
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
]
}
},
tableForm: {
multiple: true,
8 months ago
disabled: true,
isInpuFocusShow: false,
12 months ago
searchListPlaceholder: '请选择订单行',
searchField: 'lineNumber',
8 months ago
searchTitle: '采购订单信息',
12 months ago
searchAllSchemas: PurchaseDetail.allSchemas,
searchPage: PurchaseDetailApi.getPurchaseDetailPagePoNumber,
searchCondition: [
{
key: 'number',
value: 'poNumber',
message: '请填写订单号!',
isMainValue: true
},
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
]
12 months ago
}
},
{
label: '品番',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
sortSearchDefault: 5,
sortTableDefault: 17,
isSearch: true,
form: {
componentProps: {
disabled: true
}
},
tableForm: {
12 months ago
disabled: true
},
search: {
// labelMessage: '信息提示说明!!!',
componentProps: {
multiple: true,
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '物料基础信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
searchCondition: [
{
key: 'supplierCode',
value: 'supplierCode',
message: '请填写供应商代码!',
isMainValue: true
},
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
]
}
12 months ago
}
},
3 months ago
{
label: '品名',
field: 'itemName',
table: {
width: 150
},
sortTableDefault: 18,
3 months ago
isTableForm: false,
isForm: false,
isTable: true,
3 months ago
isDetail:false
},
{
label: '物料状态',
field: 'itemStatus',
sort: 'custom',
dictType: DICT_TYPE.ITEM_STATUS,
dictClass: 'string',
isTable: true,
sortSearchDefault: 10,
sortTableDefault: 19,
3 months ago
hiddenInMain: true,
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
},
tableForm: {
type: 'Select',
disabled: true
}
},
{
label: '默认收货库区',
field: 'defaultAreaCode',
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
},
tableForm: {
disabled: true
},
isTableForm: true,
isForm: true,
isTable: true,
hiddenInMain: true,
sortTableDefault: 1000,
},
{
3 months ago
label: '受入号',
field: 'receivedNumber',
sort: 'custom',
sortSearchDefault: 7,
sortTableDefault: 20,
table: {
width: 150
},
3 months ago
isTableForm: true,
hiddenInMain: true,
isForm: true,
form: {
componentProps: {
disabled: true
}
},
tableForm: {
3 months ago
type: 'Select',
disabled: true
3 months ago
}
},
{
label: '订单数量',
field: 'orderQty',
sort: 'custom',
sortSearchDefault: 8,
sortTableDefault:23,
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
},
tableForm: {
disabled: true
}
},
{
3 months ago
label: '计划采购数量',
field: 'planQty',
sort: 'custom',
sortSearchDefault: 9,
sortTableDefault: 21,
table: {
width: 150
},
3 months ago
tableForm: {
type: 'InputNumber',
precision: 6
},
form: {
3 months ago
component: 'InputNumber',
componentProps: {
3 months ago
min: 0,
precision: 6
}
3 months ago
}
},
{
label: '采购标包数量',
field: 'purchaseStdQty',
sort: 'custom',
sortSearchDefault: 8,
sortTableDefault:24,
isForm: false,
isSearch: false,
isTableForm: true,
table: {
width: 150
},
tableForm: {
disabled:true
}
},
{
label: '计划采购计量单位',
field: 'uom',
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: false,
isTableForm: false,
sortSearchDefault: 10,
sortTableDefault:22,
hiddenInMain: true,
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
},
tableForm: {
type: 'Select',
12 months ago
disabled: true
}
},
3 months ago
{
label: '采购计量单位',
field: 'purchaseStdUom',
dictType: DICT_TYPE.UOM,
sort: 'custom',
sortSearchDefault: 9,
sortTableDefault:25,
3 months ago
isForm: false,
isSearch: false,
isTableForm: true,
table: {
width: 150
},
tableForm: {
disabled: true
}
3 months ago
},
{
label: '转换率',
field: 'convertRate',
3 months ago
sort: 'custom',
sortSearchDefault: 9,
sortTableDefault: 26,
3 months ago
isForm: false,
isSearch: false,
table: {
width: 150
},
tableForm: {
disabled: true
}
},
{
label: '已发采购数量',
field: 'shippedQty',
sort: 'custom',
table: {
width: 150
},
isTableForm: false,
isForm: false,
isTable: true,
3 months ago
hiddenInMain: true,
},
{
label: '已收采购数量',
3 months ago
field: 'receivedQty',
sort: 'custom',
table: {
width: 150
},
3 months ago
isTableForm: false,
isForm: false,
isTable: true,
8 months ago
},
3 months ago
// {需求作废
// label: '受入地',
// field: 'receivedLocation',
// sort: 'custom',
// table: {
// width: 150
// },
// isTableForm: false,
// isForm: false,
// isTable: true,
// hiddenInMain: true,
// },
{
3 months ago
label: '库区描述',
field: 'areaDescription',
table: {
3 months ago
width: 150
},
form: {
componentProps: {
3 months ago
disabled: true
}
3 months ago
},
tableForm: {
disabled: true
},
isTableForm: false,
3 months ago
isForm: true,
isTable: false,
hiddenInMain: true,
},
3 months ago
// {
// label: '在途数量',
// field: 'notReceiveQty',
// sort: 'custom',
// table: {
// width: 150
// },
// isTableForm: false,
// sortTableDefault: 7,
// isForm: false,
// isTable: true,
// },
// {
// label: '是否可用',
// field: 'available',
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string',
// isTable: true,
// isTableForm: false,
// isForm: false,
// hiddenInMain: true,
// sort: 'custom',
// table: {
// width: 150
// },
// tableForm: {
// type: 'Select',
// inactiveValue: 'FALSE',
// disabled: true
// },
// form: {
// component: 'Switch',
// value: 'TRUE',
// componentProps: {
// inactiveValue: 'FALSE',
// activeValue: 'TRUE'
// }
// }
// },
// {
// label: '最后更新者',
// field: 'updater',
// sort: 'custom',
// isTableForm: false,
// hiddenInMain: true,
// table: {
// width: 150
// },
// isForm: false
// },
// {
// label: '最后更新时间',
// field: 'updateTime',
// sort: 'custom',
// isTableForm: false,
// hiddenInMain: true,
// formatter: dateFormatter,
// detail: {
// dateFormat: 'YYYY-MM-DD HH:mm:ss'
// },
// table: {
// width: 180
// },
// isForm: false,
// form: {
// component: 'DatePicker',
// componentProps: {
// style: { width: '100%' },
// type: 'datetime',
// dateFormat: 'YYYY-MM-DD HH:mm:ss',
// valueFormat: 'x'
// }
// }
// },
// {
// label: '备注',
// field: 'remark',
// sort: 'custom',
// hiddenInMain: true,
// isTableForm: false,
// table: {
// width: 150
// }
// },
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false,
hiddenInMain: true,
table: {
width: 150,
fixed: 'right'
},
isTableForm: false
12 months ago
}
])
)
const validatePlanQty = (rule, value, callback) => {
console.log('validatePlanQty', value)
const numReg = /^[\d]+$/
if (numReg.test(value) && value >= 0) {
callback()
} else {
callback(new Error('计划数量不能小于0'))
}
}
12 months ago
//表单校验
export const PurchasePlanDetailRules = reactive({
// available: [
// { required: true, message: '请选择是否可用', trigger: 'change' }
// ],
shippedQty: [{ required: true, message: '请输入已发货数量', trigger: 'blur' }],
uom: [{ required: true, message: '请选择计量单位', trigger: 'change' }],
12 months ago
planQty: [
{ required: true, message: '请输入计划数量', trigger: 'blur' },
{ validator: validatePositiveNumber0, message: '计划数量不能小于0', trigger: ['blur','change'] }
12 months ago
],
remark: [{ max: 50, message: '不得超过50个字符', trigger: 'blur' }]
12 months ago
})