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.
 
 
 

415 lines
9.5 KiB

import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter,dateFormatter2 } from '@/utils/formatTime'
import * as SupplierApi from '@/api/wms/supplier'
import { Supplier} from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
import * as SupplieritemApi from '@/api/wms/supplieritem'
import { Supplieritem } from '@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data'
import * as ItembasicApi from '@/api/wms/itembasic'
import {Itembasic} from "@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data";
import * as PurchaseMainApi from '@/api/wms/purchaseMain'
import * as PurchaseDetailApi from '@/api/wms/purchaseDetail'
import { PurchaseDetail, PurchaseMain } from '../purchaseMain/purchaseMain.data'
import * as DemandforecastingMainApi from '@/api/wms/demandforecastingMain'
import * as DemandforecastingDetailApi from '@/api/wms/demandforecastingDetail'
import dayjs from 'dayjs'
const { t } = useI18n() // 国际化
/**
* @returns {Array} 要货预测主表
*/
Supplieritem.allSchemas.searchSchema = Supplieritem.allSchemas.searchSchema.filter(item=>item.field!="allowOverShipment")
export const Version = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '供应商代码',
field: 'supplerCodes',
sort: 'custom',
isSearch:true,
},
{
label: '订单号',
field: 'poNumber',
sort: 'custom',
isSearch:true,
},
{
label: '订单行',
field: 'poLine',
sort: 'custom',
},
{
label: '物料代码',
field: 'itemCode',
isSearch:true,
sort: 'custom',
},
{
label: '子表版本',
field: 'detailVersion',
sort: 'custom',
}
]))
export const DemandforecastingMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '是否已读',
field: 'isRead',
sort: 'custom',
table: {
width: 150
},
},
{
label: '订单号',
field: 'poNumber',
sort: 'custom',
table: {
width: 150
},
},
{
label: '订单行',
field: 'poLine',
sort: 'custom',
table: {
width: 150
}
},
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
isSearch:true,
isTable:true,
isForm: false,
search: {
// labelMessage: '信息提示说明!!!',
componentProps: {
multiple: true,
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
searchField: 'itemCode', // 查询弹窗赋值字段
searchTitle: '物料基础信息', // 查询弹窗标题
searchAllSchemas: Supplieritem.allSchemas, // 查询弹窗所需类
searchPage: SupplieritemApi.getSupplieritemPageSCP, // 查询弹窗所需分页方法
searchCondition: [{
key: 'supplierCodes',
value: 'supplierCode',
message: '请填写供应商代码!',
isMainValue: true,
isCSV:true,//是否用逗号分隔参数
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
},
{
label: '版本号',
field: 'version',
sort: 'custom',
table: {
width: 150
},
isSearch:false,
search: {
// labelMessage: '信息提示说明!!!',
componentProps: {
multiple: true,
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择版本号', // 输入框占位文本
searchField: 'detailVersion', // 查询弹窗赋值字段
searchTitle: '版本号', // 查询弹窗标题
searchAllSchemas: Version.allSchemas, // 查询弹窗所需类
searchPage: DemandforecastingDetailApi.queryVersion, // 查询弹窗所需分页方法
searchCondition: [{
key: 'supplierCodes',
value: 'supplierCode',
message: '请填写供应商代码!',
isMainValue: true,
isCSV:true,//是否用逗号分隔参数
},{
key: 'itemCodes',
value: 'itemCode',
message: '请填写物料代码!',
isMainValue: true,
isCSV:true,//是否用逗号分隔参数
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
},
{
label: '先前累计需求',
field: 'schdPcrQty',
sort: 'custom',
table: {
width: 150
}
},
{
label: '累计收货量',
field: 'schdCumrcQty',
sort: 'custom',
table: {
width: 150
}
},
{
label: '到货日期',
field: 'dueDate',
formatter: dateFormatter,
sort: 'custom',
table: {
width: 150
},
isSearch:true,
isTable:false,
isForm: false,
search: {
value: [dayjs(), dayjs().subtract(-3,'month')],
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD',
type: 'daterange',
defaultTime: [new Date('1 '), new Date('1 ')]
}
},
}
]))
//表单校验
export const DemandforecastingMainRules = reactive({
available: [
{ required: true, message: '请选择是否可用', trigger: 'change' }
],
supplierCode: [
{ required: true, message: '请选择供应商代码', trigger: 'change' }
],
version: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
})
/**
* @returns {Array} 要货预测子表
*/
export const DemandforecastingDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'number',
sort: 'custom',
table: {
width: 180
},
isTableForm: false,
hiddenInMain:true,
form: {
componentProps: {
disbaled: true
}
}
},
{
label: '预测时间类型',
field: 'predictTimeType',
dictType: DICT_TYPE.PREDICT_TIME_TYPE,
sort: 'custom',
dictClass: 'string',
isTable: false,
table: {
width: 150
},
tableForm: {
type: 'Select'
}
},
{
label: '预测日期',
field: 'predictTime',
formatter: dateFormatter2,
detail: {
dateFormat: 'YYYY-MM-DD'
},
sort: 'custom',
table: {
width: 180
},
isTable:false,
form: {
component: 'DatePicker',
componentProps: {
style: {width: '100%'},
type: 'date',
dateFormat: 'YYYY-MM-DD',
valueFormat: 'x',
}
},
tableForm: {
type: 'FormDate',
dateFormat: 'YYYY-MM-DD',
valueFormat: 'x',
}
},
{
label: '计量单位',
field: 'uom',
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
table: {
width: 150
},
tableForm: {
type: 'Select',
disabled: true
}
},
{
label: '计划数量',
field: 'planQty',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
tableForm: {
type: 'InputNumber',
min: 1,
precision: 6
}
},
{
label: '备注',
field: 'remark',
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',
}
},
isTableForm: false,
isForm: false,
},
{
label: '创建者',
field: 'creator',
sort: 'custom',
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: '最后更新时间',
field: 'updateTime',
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',
}
},
isTableForm: false,
isForm: false,
},
{
label: '最后更新者',
field: 'updater',
sort: 'custom',
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: '操作',
hiddenInMain:true,
field: 'action',
isDetail: false,
isForm: false,
table: {
width: 150,
fixed: 'right'
},
isTableForm: false,
}
]))
//表单校验
export const DemandforecastingDetailRules = reactive({
predictTimeType: [
{ required: true, message: '请选择预测时间类型', trigger: 'change' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
predictTime: [
{ required: true, message: '请输入预测时间', trigger: 'change' }
],
planQty: [
{ required: true, message: '请输入计划数量', trigger: 'blur' }
],
uom: [
{ required: true, message: '请选择计量单位', trigger: 'change' }
],
number: [
{ required: true, message: '请输入单据号', trigger: 'blur' }
],
itemCode: [
{ required: true, message: '请选择物料代码', trigger: 'change' }
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
poLine: [{required:true, message: '请选择订单行', trigger: 'blur'}]
})