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.
 
 
 

1087 lines
24 KiB

import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter,dateFormatter2 } from '@/utils/formatTime'
import * as WorkMainApi from '@/api/wms/workMain'
import * as WorkDetailApi from '@/api/wms/workDetail'
import { WorkDetail, WorkMain } from '../workMain/workMain.data'
import * as WorkshopApi from '@/api/wms/workshop'
import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data'
import * as ProductionlineApi from '@/api/wms/productionline'
import { Productionline } from '@/views/wms/basicDataManage/factoryModeling/productionline/productionline.data'
import * as ShiftApi from '@/api/wms/shift'
import { Shift } from '@/views/wms/basicDataManage/orderManage/shift/shift.data'
import * as TeamApi from '@/api/wms/team'
import { Team } from '@/views/wms/basicDataManage/orderManage/team/team.data'
import * as ProductionlineitemApi from '@/api/wms/productionlineitem'
import { Productionlineitem } from '@/views/wms/basicDataManage/itemManage/productionlineitem/productionlineitem.data'
import * as BomApi from '@/api/wms/bom'
import { Bom } from '@/views/wms/basicDataManage/itemManage/bom/bom.data'
import * as getPlansettingApi from '@/api/wms/plansetting/index'
const { t } = useI18n() // 国际化
// 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值
const queryParams = {
pageSize:10,
pageNo:1,
code:'ProductionPlan'
}
const data = await getPlansettingApi.getPlansettingPage(queryParams)
const plansettingData =data?.list[0]||{}
/**
* @returns {Array} 生产计划主表
*/
export const ProductionMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'number',
sort: 'custom',
table: {
width: 180,
fixed: 'left'
},
isForm: false,
isSearch: true,
},
{
label: '计划类型',
field: 'planType',
dictType: DICT_TYPE.PLAN_PRODUCTION_TYPE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Select',
value: 'predict',
componentProps: {
disabled: true
}
}
},
{
label: '状态',
field: 'status',
sort: 'custom',
dictType: DICT_TYPE.PLAN_STATUS,
dictClass: 'string',
isTable: true,
isForm:false,
table: {
width: 150
},
// form: {
// value: '1',
// componentProps: {
// disabled: true
// }
// },
isSearch: true,
},
{
label: '顺序',
field: 'displayOrder',
sort: 'custom',
table: {
width: 150
},
form: {
componentProps: {
maxlength: 50
}
}
},
{
label: '车间',
field: 'workshop',
sort: 'custom',
table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true,
isSearchList: true,
searchListPlaceholder: '请选择车间',
searchField: 'code',
searchTitle: '车间信息',
searchAllSchemas: Workshop.allSchemas,
searchPage: WorkshopApi.getWorkshopPage,
searchCondition:[{
key: 'available',
value: 'TRUE',
isMainValue: false
}],
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
}
}
},
{
label: '生产线',
field: 'productionLine',
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
},{
key: 'workshopCode',
value: 'workshop',
message: '请填写车间代码!',
isMainValue: true
}],
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
}
}
},
{
label: '班组',
field: 'team',
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: 'shift',
// 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: 'detailItemCode',
// sort: 'custom',
// isSearch: true,
// table: {
// width: 150
// },
// isTable: false,
// isForm: false
// },
{
label: '计划数量',
field: 'detailPlanQty',
sort: 'custom',
table: {
width: 150
},
isTable: false,
isForm: false
},
{
label: '计划日期',
field: 'planDate',
formatter: dateFormatter2,
detail: {
dateFormat: 'YYYY-MM-DD'
},
sort: 'custom',
table: {
width: 120
},
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
sortTableDefault:1000,
form: {
component: 'DatePicker',
componentProps: {
style: {width: '100%'},
type: 'date',
dateFormat: 'YYYY-MM-DD',
valueFormat: 'x',
}
},
},
{
label: '开始时间',
field: 'beginTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
sortTableDefault:1000,
form: {
component: 'DatePicker',
componentProps: {
style: {width: '100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
},
{
label: '结束时间',
field: 'endTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
sortTableDefault:1000,
form: {
component: 'DatePicker',
componentProps: {
style: {width: '100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
},
{
label: '业务类型',
field: 'businessType',
sort: 'custom',
table: {
width: 150
},
isTable: false,
form: {
value: 'ProductReceipt',
componentProps: {
disabled: true
}
},
isForm: false,
},
// {
// label: '备注',
// field: 'remark',
// sort: 'custom',
// table: {
// width: 150
// },
// isTable: false,
// },
{
label: '是否可用',
field: 'available',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '自动提交',
field: 'autoCommit',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: false,
isForm:false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: plansettingData.autoCommit,
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
}
},
{
label: '自动通过',
field: 'autoAgree',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: false,
isForm:false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: plansettingData.autoAgree,
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
}
},
{
label: '自动执行',
field: 'autoExecute',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: false,
isForm:false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: plansettingData.autoExecute,
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
}
},
{
label: '是否创建了备料计划',
field: 'preparetoissueIsCreate',
sort: 'custom',
table: {
width: 150
},
isTable: false,
isForm: false,
},
{
label: '是否创建了收货申请',
field: 'productreceiptIsCreate',
sort: 'custom',
table: {
width: 150
},
isTable: false,
isForm: false,
},
// {
// label: '开始时间',
// field: 'beginTime',
// 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,
// },
// {
// label: '结束时间',
// field: 'endTime',
// 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,
// },
// {
// label: '订单号',
// field: 'woNumber',
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// // labelMessage: '信息提示说明!!!',
// componentProps: {
// isSearchList: true,
// searchListPlaceholder: '请选择订单号',
// searchField: 'number',
// searchTitle: '生产订单信息',
// searchAllSchemas: WorkMain.allSchemas,
// searchPage: WorkMainApi.getWorkMainPage
// }
// },
// isTable: false,
// isForm: false,
// },
// {
// label: '订单行',
// field: 'woLine',
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// // labelMessage: '信息提示说明!!!',
// componentProps: {
// isSearchList: true,
// searchListPlaceholder: '请选择订单行',
// searchField: 'lineNumber',
// searchTitle: '生产订单信息',
// searchAllSchemas: WorkDetail.allSchemas,
// searchPage: WorkDetailApi.getWorkDetailPage
// }
// },
// isTable: false,
// isForm: false,
// },
{
label: '创建者',
field: 'creator',
sort: 'custom',
table: {
width: 150
},
isTable: true,
isForm: false,
},
{
label: '创建时间',
field: 'createTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
isTable: true,
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: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
},
},
},
{
label: '最后更新者',
field: 'updater',
sort: 'custom',
table: {
width: 150
},
isTable: false,
isForm: false,
},
{
label: '最后更新时间',
field: 'updateTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
isTable: false,
form: {
component: 'DatePicker',
componentProps: {
style: {width: '100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
isForm: false,
},
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false ,
table: {
width: 260,
fixed: 'right'
},
}
]))
//表单校验
export const ProductionMainRules = reactive({
displayOrder: [
{ required: true, message: '请输入顺序', trigger: 'blur' },
// { max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
workshop: [
{ required: true, message: '请选择车间', trigger: 'change' }
],
productionLine: [
{ required: true, message: '请选择生产线', trigger: 'change' }
],
// shift: [
// { required: true, message: '请选择班次', trigger: 'change' }
// ],
// team: [
// { required: true, message: '请选择班组', trigger: 'change' }
// ],
planDate: [
{ required: true, message: '请输入计划日期', trigger: 'blur' }
],
available: [
{ required: true, message: '请选择是否可用', trigger: 'change' }
],
status: [
{ required: true, message: '请选择状态', trigger: 'change' }
],
beginTime: [
{ required: true, message: '请输入开始时间', trigger: 'blur' }
],
endTime: [
{ required: true, message: '请输入结束时间', trigger: 'blur' }
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
})
/**
* @returns {Array} 生产计划子表
*/
export const ProductionDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
isSearch: true,
table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
searchField: 'itemCode', // 查询弹窗赋值字段
searchTitle: '生产线物料关系信息', // 查询弹窗标题
searchAllSchemas: Productionlineitem.allSchemas, // 查询弹窗所需类
searchPage: ProductionlineitemApi.getProductionlineitemPage, // 查询弹窗所需分页方法
searchCondition: [{
key:'productionLineCode',
value:'productionLine',
message: '请填写生产线代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}],
}
},
tableForm:{
multiple:true,
disabled:true,
// isInpuFocusShow: true,
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
searchField: 'itemCode', // 查询弹窗赋值字段
searchTitle: '生产线物料关系信息', // 查询弹窗标题
searchAllSchemas: Productionlineitem.allSchemas, // 查询弹窗所需类
searchPage: ProductionlineitemApi.getProductionlineitemPage, // 查询弹窗所需分页方法
searchCondition: [{
key:'productionLineCode',
value:'productionLine',
message: '请填写生产线代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}],
verificationPage: ProductionlineitemApi.getProductionLineCodelistByCodes, // 校验数去焦点输入是否正确的方法
isShowTableFormSearch: true,
verificationParams: [{
key: 'itemCode',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
},
},
{
label: '物料名称',
field: 'itemName',
sort: 'custom',
table: {
width: 150
},
form:{
componentProps:{
disabled: true
}
},
tableForm:{
disabled: true
}
},
{
label: 'Bom版本',
field: 'bomVersion',
sort: 'custom',
table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择Bom版本', // 输入框占位文本
searchField: 'version', // 查询弹窗赋值字段
searchTitle: '物料清单信息', // 查询弹窗标题
searchAllSchemas: Bom.allSchemas, // 查询弹窗所需类
searchPage: BomApi.getBomPage, // 查询弹窗所需分页方法
searchCondition: [{
key:'productItemCode',
value:'itemCode',
message: '请填写物料代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
tableForm:{
isInpuFocusShow: true,
searchListPlaceholder: '请选择Bom版本', // 输入框占位文本
searchField: 'version', // 查询弹窗赋值字段
searchTitle: '物料清单信息', // 查询弹窗标题
searchAllSchemas: Bom.allSchemas, // 查询弹窗所需类
searchPage: BomApi.getBomPage, // 查询弹窗所需分页方法
searchCondition: [{
key:'productItemCode',
value:'itemCode',
message: '请填写物料代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
},
},
{
label: '计划日期',
field: 'planDate',
formatter: dateFormatter2,
detail: {
dateFormat: 'YYYY-MM-DD'
},
sort: 'custom',
table: {
width: 120
},
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
isSearch: true,
isTableForm: false,
isForm: false,
// hiddenInMain: true,
sortTableDefault:1000,
form: {
component: 'DatePicker',
componentProps: {
style: {width: '100%'},
type: 'date',
dateFormat: 'YYYY-MM-DD',
valueFormat: 'x',
}
},
},
{
label: '计划数量',
field: 'planQty',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 0,
max:9999,
// precision: 6
}
},
tableForm: {
type: 'InputNumber',
min: 0,
max:9999,
// precision: 6
},
},
{
label: '计量单位',
field: 'uom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isSearch: true,
isTable: true,
sort: 'custom',
table: {
width: 150
},
form:{
componentProps:{
disabled: true
}
},
tableForm:{
type: 'Select',
disabled: true,
dictType: DICT_TYPE.UOM,
dictClass: 'string'
}
},
{
label: '合格数量',
field: 'goodQty',
sort: 'custom',
table: {
width: 150
},
hiddenInMain: true,
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
tableForm: {
type: 'InputNumber',
min: 1,
precision: 6
},
isTableForm: false,
isForm: false
},
{
label: '不合格数量',
field: 'notGoodQty',
sort: 'custom',
table: {
width: 150
},
hiddenInMain: true,
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
tableForm: {
type: 'InputNumber',
min: 1,
precision: 6
},
isTableForm: false,
isForm: false
},
{
label: '创建者',
field: 'creator',
sort: 'custom',
table: {
width: 150
},
hiddenInMain: true,
isTableForm: false,
isForm: false,
isTable: true
},
{
label: '创建时间',
field: 'createTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
hiddenInMain: true,
form: {
component: 'DatePicker',
componentProps: {
style: {width: '100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
isTableForm: false,
isForm: false,
isTable: true,
},
{
label: '是否可用',
field: 'available',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isTable: false,
sort: 'custom',
table: {
width: 150
},
hiddenInMain: true,
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
tableForm: {
type: 'Select',
default: 'TRUE'
},
isTableForm: false,
isForm: false
},
{
label: '单据号',
field: 'number',
sort: 'custom',
table: {
width: 180
},
isTable: false,
isTableForm: false,
form: {
componentProps: {
disabled: true
}
}
},
{
label: '备注',
field: 'remark',
sort: 'custom',
table: {
width: 150
},
isTable: false,
},
{
label: '最后更新时间',
field: 'updateTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
isTable: false,
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
},
isTable: false,
isTableForm: false,
isForm: false,
},
{
label: '操作',
hiddenInMain:true,
field: 'action',
isDetail: false,
isForm: false ,
table: {
width: 150,
fixed: 'right'
},
isTableForm:false,
}
]))
//表单校验
export const ProductionDetailRules = reactive({
bomVersion: [
{ required: true, message: '请输入Bom版本', trigger: 'blur' }
],
// goodQty: [
// { required: true, message: '请输入合格数量', trigger: 'blur' }
// ],
// notGoodQty: [
// { required: true, message: '请输入不合格数量', trigger: 'blur' }
// ],
available: [
{ required: true, message: '请选择是否可用', trigger: 'change' }
],
uom: [
{ required: true, message: '请选择计量单位', trigger: 'change' }
],
planQty: [
{ required: true, message: '请输入计划数量', trigger: 'blur' }
],
itemCode: [
{ required: true, message: '请选择物料代码', trigger: 'change' }
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
})