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.
 
 
 

863 lines
18 KiB

import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
import { cloneDeep } from 'lodash-es'
import { Itembasic } from "@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data";
import * as ItembasicApi from "@/api/wms/itembasic";
import { Dock } from "@/views/wms/basicDataManage/factoryModeling/dock/dock.data";
import * as DockApi from "@/api/wms/dock";
import { Supplier } from "@/views/wms/basicDataManage/supplierManage/supplier/supplier.data";
import * as SupplierApi from "@/api/wms/supplier";
import { SupplierdeliverRecordMain, SupplierdeliverRecordDetail } from "@/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRecordMain/supplierdeliverRecordMain.data";
import * as SupplierdeliverRecordDetailApi from "@/api/wms/supplierdeliverRecordDetail";
import * as ItemPackageApi from "@/api/wms/itempackage";
import { Itempackaging } from "@/views/wms/basicDataManage/itemManage/itempackage/itempackage.data";
import { validatePositiveNumber } from "@/utils/validator";
import {
Productionlineitem
} from "@/views/wms/basicDataManage/itemManage/productionlineitem/productionlineitem.data";
import { getProductionlineitemPage } from "@/api/wms/productionlineitem";
import * as ProductionlineitemApi from "@/api/wms/productionlineitem";
import {
Supplieritem
} from "@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data";
import { getSupplieritemPage } from "@/api/wms/supplieritem";
import * as SupplieritemApi from "@/api/wms/supplieritem";
console.log(44, SupplierdeliverRecordMain.allSchemas)
console.log(44, SupplierdeliverRecordDetail.allSchemas)
// const SupplierdeliverRecordMainAllSchemas = cloneDeep(SupplierdeliverRecordMain.allSchemas)
// const SupplierdeliverRecordDetailAllSchemas = cloneDeep(SupplierdeliverRecordDetail.allSchemas)
// const allSchemas = cloneDeep(SupplierdeliverRecordDetail.allSchemas)
const allSchemas = ref(cloneDeep(SupplierdeliverRecordMain.allSchemas))
allSchemas.value.tableColumns = [
...SupplierdeliverRecordMain.allSchemas.tableColumns,
...SupplierdeliverRecordDetail.allSchemas.tableMainColumns
]
// 表单校验
export const PackageRules = reactive({
number: [required],
itemCode: [required],
itemName: [required],
})
export const Package = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '标签号',
field: 'number',
sort: 'custom',
isSearch: true,
table: {
fixed: 'left',
width: 210
},
},
{
label: '标签类型',
field: 'type',
sort: 'custom',
isSearch: false,
dictType: DICT_TYPE.LABEL_TYPE,
dictClass: 'string',
table: {
width: 180
}
},
// {
// label: '标签模板',
// field: 'template',
// sort: 'custom',
// table: {
// width: 180
// }
// },
// {
// label: '标签状态',
// field: 'status',
// sort: 'custom',
// isSearch: true,
// dictType: DICT_TYPE.LABEL_STATUS,
// dictClass: 'string',
// table: {
// width: 180
// }
// },
{
label: '关联号',
field: 'relateNumber',
sort: 'custom',
isSearch: true,
table: {
width: 210
}
},
{
label: '标签条码字符串',
field: 'barcodeString',
sort: 'custom',
table: {
width: 380,
}
},
{
label: '打印次数',
field: 'printTimes',
sort: 'custom',
form: {
component: 'InputNumber',
componentProps: {
min: 0
},
value: 0
},
table: {
width: 180
}
},
{
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',
}
},
table: {
width: 180
}
},
{
label: '最后打印人ID',
field: 'lastPrintUserId',
sort: 'custom',
table: {
width: 180
}
},
{
label: '最后打印人用户名',
field: 'lastPrintUserName',
sort: 'custom',
table: {
width: 180,
}
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
isSearch: true,
isForm: false,
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
search: {
value: 'TRUE',
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
table: {
width: 110
}
},
{
label: '创建时间',
field: 'createTime',
isForm: false,
table: {
width: 180
},
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
}
},
{
label: '创建者',
field: 'creator',
table: {
width: 130
},
isForm: false,
isTable: true
},
{
label: '最后更新时间',
field: 'updateTime',
sort: 'custom',
isDetail: true,
isForm: false,
isTable: true,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
}
},
{
label: '最后更新者',
field: 'updater',
isDetail: true,
isForm: false,
isTable: true,
table: {
width: 150
}
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
export const PackageInventory = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
isSearch: true,
table: {
width: 150,
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true,
isSearchList: true,
searchListPlaceholder: '请选择物料代码',
searchField: 'code',
searchTitle: '物料信息',
searchAllSchemas: Itembasic.allSchemas,
searchPage: ItembasicApi.getItembasicPage,
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}, {
key: 'enableBuy',
value: 'TRUE',
isMainValue: false
}],
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
}
}
},
{
label: '物料名称',
field: 'itemName',
sort: 'custom',
table: {
width: 150,
},
form: {
componentProps: {
disabled: true
}
},
},
{
label: '物料描述1',
field: 'itemDesc1',
sort: 'custom',
table: {
width: 150,
},
form: {
componentProps: {
disabled: true
}
},
},
{
label: '物料描述2',
field: 'itemDesc2',
sort: 'custom',
table: {
width: 150,
},
form: {
componentProps: {
disabled: true
}
},
},
{
label: '背番',
field: 'backNumber',
sort: 'custom',
table: {
width: 150,
},
form: {
componentProps: {
disabled: true
}
},
},
{
label: '色番',
field: 'colorCode',
sort: 'custom',
table: {
width: 150,
},
form: {
componentProps: {
disabled: true
}
},
},
{
label: '物料类型',
field: 'itemType',
sort: 'custom',
dictType: DICT_TYPE.ITEM_TYPE,
table: {
width: 150,
},
form: {
component: 'Select',
componentProps: {
disabled: true
}
},
},
{
label: '物料状态',
field: 'status',
sort: 'custom',
dictType: DICT_TYPE.ITEM_STATUS,
dictClass: 'string',
table: {
width: 120
},
form: {
component: 'Select',
componentProps: {
disabled: true
}
},
},
{
label: '受入号',
field: 'receivedNumber',
sort: 'custom',
isSearch: false,
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
},
},
{
label: '计量单位',
field: 'uom',
sort: 'custom',
dictType: DICT_TYPE.UOM,
table: {
width: 150,
},
form: {
component: 'Select',
componentProps: {
disabled: true
}
},
},
{
label: '数量',
field: 'qty',
sort: 'custom',
table: {
width: 150,
},
form: {
component: 'InputNumber',
componentProps: {
min: 0,
precision: 6
},
value: 0
},
},
{
label: '批次',
field: 'batch',
sort: 'custom',
isSearch: true,
table: {
width: 150
},
},
{
label: '包装规格',
field: 'packUnit',
sort: 'custom',
table: {
width: 150,
},
form: {
componentProps: {
enterSearch: true,
disabled: true,
isSearchList: true,
searchListPlaceholder: '请选择包装',
searchField: 'packUnit',
searchTitle: '物品包装信息',
searchAllSchemas: Itempackaging.allSchemas,
searchPage: ItemPackageApi.getItemPackagingPageByItemCode,
searchCondition: [
{
key: 'itemCode',
value: 'itemCode',
message: '请选择物料代码',
isMainValue: true
},
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
]
}
}
},
{
label: '包装数量',
field: 'packQty',
sort: 'custom',
table: {
width: 150,
},
form: {
componentProps: {
disabled: true
}
},
tableForm: {
disabled: true
}
},
{
label: '生产线区分',
field: 'productionLine',
sort: 'custom',
isSearch: false,
table: {
width: 150
},
form: {
componentProps: {
enterSearch: true,
disabled: true,
isSearchList: true,
searchListPlaceholder: '请选择生产线区分',
searchField: 'packUnit',
searchTitle: '生产线',
searchAllSchemas: Productionlineitem.allSchemas,
searchPage: ProductionlineitemApi.getProductionlineitemPage,
searchCondition: [
{
key: 'itemCode',
value: 'itemCode',
message: '请选择物料代码',
isMainValue: true
},
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
]
}
}
},
{
label: '',
field: '',
sort: 'custom',
isSearch: false,
table: {
width: 150
},
form: {
component: 'err'
}
},
{
label: '供应商代码',
field: 'supplierCode',
sort: 'custom',
table: {
width: 150,
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true,
isSearchList: true,
searchListPlaceholder: '请选择供应商代码',
searchField: 'code',
searchTitle: '供应商信息',
searchAllSchemas: Supplieritem.allSchemas,
searchPage: SupplieritemApi.getSupplieritemPage,
searchCondition: [
{
key: 'itemCode',
value: 'itemCode',
message: '请选择物料代码',
isMainValue: true
},
{
key: 'available',
value: 'TRUE',
isMainValue: false
}],
verificationParams: [{
key: 'supplierCode',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
}
}
},
{
label: '供应商名称',
field: 'supplierName',
sort: 'custom',
table: {
width: 150,
},
form: {
componentProps: {
disabled: true
}
},
},
{
label: '送货日期',
field: 'deliveryDate',
sort: 'custom',
formatter: dateFormatter2,
search: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
valueFormat: 'YYYY-MM-DD',
type: 'daterange',
disabled: false,
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'date',
dateFormat: 'YYYY-MM-DD',
valueFormat: 'x',
disabled: false
}
},
table: {
width: 180,
},
},
{
label: '便次',
field: 'stoolTime',
sort: 'custom',
table: {
width: 150,
},
},
{
label: 'ASN单号',
field: 'asnNumber',
sort: 'custom',
table: {
width: 182,
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true,
isSearchList: true,
searchListPlaceholder: '请选择发货单号',
searchField: 'asnNumber',
searchTitle: '发货信息',
searchAllSchemas: allSchemas.value,
searchPage: SupplierdeliverRecordDetailApi.getSupplierdeliverRecordDetailPage,
searchCondition: [
{
key: 'supplierCode',
value: 'supplierCode',
message: '请填写供应商代码!',
isMainValue: true
},
{
key: 'itemCode',
value: 'itemCode',
message: '请填写物料代码!',
isMainValue: true
},
{
key: 'available',
value: 'TRUE',
isMainValue: false
}],
verificationParams: [{
key: 'asnNumber',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
}
}
},
{
label: '采购订单号',
field: 'poNumber',
sort: 'custom',
isSearch: true,
table: {
width: 150,
},
form: {
componentProps: {
disabled: true
}
},
},
{
label: '订单行',
field: 'poLine',
sort: 'custom',
isSearch: true,
table: {
width: 150,
},
form: {
componentProps: {
disabled: true
}
},
},
{
label: '采购订单备注',
field: 'purchaseOrderRemarks',
sort: 'custom',
isSearch: true,
table: {
width: 150,
},
form: {
componentProps: {
disabled: true
}
},
},
{
label: '采购标包数量',
field: 'supplierQty',
sort: 'custom',
table: {
width: 150,
},
form: {
componentProps: {
disabled: true,
},
},
},
{
label: '采购计量单位',
field: 'supplierUom',
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
isTableForm: true,
form: {
componentProps: {
disabled: true
}
},
tableForm: {
disabled: true,
type: 'Select',
},
table: {
width: 150
},
},
{
label: '转换率',
field: 'convertRate',
form: {
component: 'InputNumber',
componentProps: {
disabled: true,
min: 0
}
},
hiddenInMain: true,
table: {
width: 150
},
isTableForm: false,
},
{
label: '采购数量',
field: 'purchaseQty',
sort: 'custom',
table: {
width: 150,
},
form: {
componentProps: {
disabled: true,
},
},
},
{
label: '月台',
field: 'toDockCode',
sort: 'custom',
table: {
width: 150,
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true,
isSearchList: true,
searchListPlaceholder: '请选择仓库代码',
searchField: 'code',
searchTitle: '月台',
searchAllSchemas: Dock.allSchemas,
searchPage: DockApi.getDockPage,
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}],
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
}
}
},
{
label: '默认收货库区',
field: 'defaultReceivingArea',
sort: 'custom',
isSearch: true,
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
},
},
{
label: '受入地',
field: 'receivedLocation',
sort: 'custom',
isSearch: true,
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
},
},
]))
//表单校验
export const PackageRulesInventor = reactive({
itemCode: [
{ required: true, message: '请选择物料代码', trigger: 'change' }
],
qty: [
{ required: true, message: '请输入数量', trigger: 'blur' },
{ validator: validatePositiveNumber, message: '必须是一个正数', trigger: 'change' }
],
toDockCode: [
{ required: true, message: '请选择月台代码', trigger: 'change' }
],
supplierCode: [
{ required: true, message: '请选择供应商代码', trigger: 'change' }
],
asnNumber: [
{ required: true, message: '请选择ASN单号', trigger: 'change' }
],
packUnit: [
{ required: true, message: '请选择包装规格', trigger: 'change' }
],
deliveryDate: [
{ required: true, message: '请选择送货日期', trigger: 'change' }
],
})