diff --git a/src/api/wms/purchaseMainWms/index.ts b/src/api/wms/purchaseMainWms/index.ts new file mode 100644 index 000000000..1d82d82c7 --- /dev/null +++ b/src/api/wms/purchaseMainWms/index.ts @@ -0,0 +1,86 @@ +import request from '@/config/axios' + +export interface PurchaseMainVO { + supplierCode: string + number: string + type: string + status: string + orderDate: Date + dueDate: Date + version: string + taxRate: number + contactName: string + contactPhone: string + contactEmail: string + isConsignment: string + businessType: string + remark: string + createTime: Date + creator: string + updateTime: Date + updater: string + currentStage: number + available: string +} + +// 查询采购订单主列表 +export const getPurchaseMainPage = async (params) => { + if (params.isSearch) { + delete params.isSearch + const data = {...params} + return await request.post({ url: '/wms/purchase-main/seniorWMS', data }) + } else { + return await request.get({ url: `/wms/purchase-main/pageWMS`, params }) + } +} + +// 查询采购订单主详情 +export const getPurchaseMain = async (id: number) => { + return await request.get({ url: `/wms/purchase-main/get?id=` + id }) +} + +// 新增采购订单主 +export const createPurchaseMain = async (data: PurchaseMainVO) => { + return await request.post({ url: `/wms/purchase-main/create`, data }) +} + +// 修改采购订单主 +export const updatePurchaseMain = async (data: PurchaseMainVO) => { + return await request.put({ url: `/wms/purchase-main/update`, data }) +} + +// 删除采购订单主 +export const deletePurchaseMain = async (id: number) => { + return await request.delete({ url: `/wms/purchase-main/delete?id=` + id }) +} + +// 关闭采购订单主 +export const closePurchaseMain = async (id: number) => { + return await request.post({ url: `/wms/purchase-main/close?id=` + id }) +} +// 打开采购订单主 +export const openPurchaseMain = async (id: number) => { + return await request.post({ url: `/wms/purchase-main/open?id=` + id }) +} +// 发布采购订单主 +export const publishPurchaseMain = async (id: number) => { + return await request.post({ url: `/wms/purchase-main/publish?id=` + id }) +} +// 下架采购订单主 +export const witPurchaseMain = async (id: number) => { + return await request.post({ url: `/wms/purchase-main/wit?id=` + id }) +} +// 导出采购订单主 Excel +export const exportPurchaseMain = async (params) => { + if (params.isSearch) { + const data = {...params} + return await request.downloadPost({ url: `/wms/purchase-main/export-excel-senior`, data }) + } else { + return await request.download({ url: `/wms/purchase-main/export-excel`, params }) + } +} + +// 下载用户导入模板 +export const importTemplate = () => { + return request.download({ url: '/wms/purchase-main/get-import-template' }) +} diff --git a/src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMainWms/index.vue b/src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMainWms/index.vue new file mode 100644 index 000000000..bad192360 --- /dev/null +++ b/src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMainWms/index.vue @@ -0,0 +1,611 @@ + + + diff --git a/src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMainWms/purchaseMain.data.ts b/src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMainWms/purchaseMain.data.ts new file mode 100644 index 000000000..4192ee0ff --- /dev/null +++ b/src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMainWms/purchaseMain.data.ts @@ -0,0 +1,969 @@ +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 { validateHanset, validateEmail } from '@/utils/validator' +const { t } = useI18n() // 国际化 + +/** + * @returns {Array} 采购订单主表 + */ +export const PurchaseMain = useCrudSchemas(reactive([ + { + label: '单据号', + field: 'number', + sort: 'custom', + isSearch: true, + isForm: false, + table: { + width: 180, + fixed: 'left' + }, + }, + { + label: '供应商代码', + field: 'supplierCode', + sort: 'custom', + isSearch: true, + table: { + width: 150 + }, + form: { + labelMessage: '影响明细中物料代码,需在供应商物料中维护', + componentProps: { + 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 + }], // 失去焦点校验参数 + } + } + }, + { + label: '订单类型', + field: 'type', + dictType: DICT_TYPE.PURCHASE_ORDER_TYPE, + dictClass: 'string', + isTable: true, + isSearch: true, + sort: 'custom', + table: { + width: 150 + }, + }, + { + label: '物料类型', + field: 'type', + dictType: DICT_TYPE.ITEM_TYPE, + dictClass: 'string', + isTable: false, + isForm: false, + isSearch: true, + sort: 'custom', + }, + { + label: '状态', + field: 'status', + dictType: DICT_TYPE.PURCHASE_ORDER_STATUS, + dictClass: 'string', + isTable: true, + isForm:false, + isSearch: true, + sortSearchDefault:1000, + sort: 'custom', + table: { + width: 150 + }, + form: { + value: '1', + componentProps: { + disabled: true + } + } + }, + { + label: '订单日期', + field: 'orderDate', + isTable: true, + formatter: dateFormatter2, + detail: { + dateFormat: 'YYYY-MM-DD' + }, + sort: 'custom', + table: { + width: 180 + }, + form: { + component: 'DatePicker', + componentProps: { + style: {width: '100%'}, + type: 'date', + dateFormat: 'YYYY-MM-DD', + valueFormat: 'x', + }, + value: new Date().getTime() + }, + }, + { + label: '截止日期', + field: 'dueDate', + isTable: false, + isForm: false, + formatter: dateFormatter2, + detail:{ + dateFormat: 'YYYY-MM-DD' + }, + sort: 'custom', + table: { + width: 180 + }, + form: { + component: 'DatePicker', + componentProps: { + style: {width: '100%'}, + type: 'date', + dateFormat: 'YYYY-MM-DD', + valueFormat: 'x', + } + }, + }, + { + label: '税率', + field: 'taxRate', + sort: 'custom', + table: { + width: 150 + }, + form: { + component: 'InputNumber', + componentProps: { + style: {width:'100%'}, + min: 0, + max: 1, + precision: 6, + } + } + }, + { + label: '版本', + field: 'version', + sort: 'custom', + isTable:false, + table: { + width: 150 + }, + }, + { + label: '当前阶段', + field: 'currentStage', + sort: 'custom', + table: { + width: 150 + }, + form: { + component: 'InputNumber', + componentProps: { + style: {width:'100%'}, + min: 0 + } + }, + isTableForm: false, + isForm: false, + isTable:false, + }, + { + label: '是否寄存订单', + field: 'isConsignment', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', + isTable: false, + sort: 'custom', + table: { + width: 150 + }, + isForm:false, + form: { + component: 'Switch', + value: 'TRUE', + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE' + } + }, + }, + { + label: '是否可用', + field: 'available', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', + isTable: false, + sort: 'custom', + table: { + width: 150 + }, + isForm:false, + form: { + component: 'Switch', + value: 'TRUE', + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE', + disabled: true + } + }, + }, + { + label: '联系人姓名', + field: 'contactName', + sort: 'custom', + isTable:false, + table: { + width: 150 + }, + }, + { + label: '联系人电话', + field: 'contactPhone', + sort: 'custom', + isTable:false, + table: { + width: 150 + }, + }, + { + label: '联系人电子邮件', + field: 'contactEmail', + sort: 'custom', + isTable:false, + table: { + width: 150 + }, + }, + + { + label: '业务类型', + field: 'businessType', + sort: 'custom', + table: { + width: 150 + }, + isForm: false, + isTable: false, + form: { + value: 'PurchaseReceipt', + componentProps: { + disabled: true + } + } + }, + { + label: '创建者', + field: 'creator', + sort: 'custom', + isForm: false, + isTable:false, + table: { + width: 150 + }, + }, + { + label: '创建时间', + field: 'createTime', + isTable:true, + formatter: dateFormatter, + detail: { + dateFormat: 'YYYY-MM-DD HH:mm:ss' + }, + sort: 'custom', + isForm: false, + 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')] + } + }, + }, + { + label: '最后更新者', + field: 'updater', + sort: 'custom', + isForm: false, + isTable:false, + table: { + width: 150 + }, + }, + { + label: '最后更新时间', + field: 'updateTime', + isTable: false, + formatter: dateFormatter, + detail: { + dateFormat: 'YYYY-MM-DD HH:mm:ss' + }, + sort: 'custom', + isForm: false, + table: { + width: 180 + }, + form: { + component: 'DatePicker', + componentProps: { + style: {width:'100%'}, + type: 'datetime', + dateFormat: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + } + }, + }, + { + label: '备注', + field: 'remark', + isTable: false, + table: { + width: 150 + }, + }, + { + label: '操作', + field: 'action', + isDetail: false, + isForm: false, + table: { + width: 200, + fixed: 'right' + } + } +])) + +//表单校验 +export const PurchaseMainRules = reactive({ + supplierCode: [ + { required: true, message: '请输入供应商代码', trigger: 'change' } + ], + type: [ + { required: true, message: '请选择订单类型', trigger: 'change' } + ], + status: [ + { required: true, message: '请选择状态', trigger: 'change' } + ], + orderDate: [ + { required: true, message: '请输入订单日期', trigger: 'change' } + ], + taxRate: [ + { required: true, message: '请输入税率', trigger: 'blur' } + ], + version: [ + { max: 50, message: '不得超过50个字符', trigger: 'blur' } + ], + contactName: [ + { max: 50, message: '不得超过50个字符', trigger: 'blur' } + ], + contactPhone: [ + { max: 50, message: '不得超过50个字符', trigger: 'blur' }, + { validator:validateHanset, message: '请输入正确的手机号', trigger: 'blur'} + ], + contactEmail: [ + { max: 50, message: '不得超过50个字符', trigger: 'blur' }, + { validator:validateEmail, message: '请输入正确的邮箱格式', trigger: 'blur'} + ], + remark: [ + { max: 50, message: '不得超过50个字符', trigger: 'blur' } + ], + available: [ + { required: true, message: '请选择是否可用', trigger: 'change' } + ], +}) + +/** + * @returns {Array} 采购订单子表 + */ +export const PurchaseDetail = useCrudSchemas(reactive([ + { + label: '单据号', + field: 'number', + isTableForm: false, + hiddenInMain:true, + table: { + width: 180 + }, + form: { + componentProps: { + disabled: true + } + } + }, + { + label: '行号', + field: 'lineNumber', + table: { + width: 150 + }, + tableForm:{ + disabled:true, + isSearchList: true, // 开启查询弹窗 + } + }, + { + label: '物料代码', + field: 'itemCode', + isSearch: true, + table: { + width: 150 + }, + tableForm:{ + disabled:true, + multiple:true,//多选 + isInpuFocusShow: true, + searchListPlaceholder: '请选择供应商物料', + searchField: 'itemCode', + searchTitle: '供应商物料信息', + searchAllSchemas: Supplieritem.allSchemas, + searchPage: SupplieritemApi.selectItembasicTypeToSupplieritem, + searchCondition: [{ + key:'supplierCode', + value:'supplierCode', + message: '请填写供应商代码!', + isMainValue: true + },{ + key: 'available', + value: 'TRUE', + isMainValue: false + }], + verificationPage: SupplieritemApi.getSupplierItemListByCodes, // tableForm下方输入框校验失去焦点之后是否正确的方法 + isShowTableFormSearch: true, //tableForm下方是否出现输入框 + isRepeat: true,//tableForm下方输入框是否可以重复添加该条数据 + // 失去焦点校验参数 + verificationParams: [{ + key: 'itemCode', + action: '==', + value: '', + isMainValue: false, + isSearch: 'true', + isFormModel: true, + }] + }, + form: { + // labelMessage: '信息提示说明!!!', + componentProps: { + isSearchList: true, + searchListPlaceholder: '请选择供应商物料', + searchField: 'itemCode', + searchTitle: '供应商物料信息', + searchAllSchemas: Supplieritem.allSchemas, + searchPage: SupplieritemApi.selectItembasicTypeToSupplieritem, + searchCondition: [{ + key:'supplierCode', + value:'supplierCode', + message: '请填写供应商代码!', + isMainValue: true + },{ + key: 'available', + value: 'TRUE', + isMainValue: false + }], + // 失去焦点校验参数 + verificationParams: [{ + key: 'code', + action: '==', + value: '', + isMainValue: false, + isSearch: 'true', + isFormModel: true, + }] + } + } + }, + { + label: '计量单位', + field: 'uom', + 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: 'orderQty', + table: { + width: 150 + }, + form: { + component: 'InputNumber', + componentProps: { + disabled:false, + min: 1, + precision: 6 + } + }, + tableForm: { + disabled:false, + hidden:false, + type: 'InputNumber', + min: 1, + precision: 6 + }, + }, + // { + // label: 'ERP库位', + // field: 'erpLocationCode', + // dictType : DICT_TYPE.ERP_LOCATION, + // dictClass: 'string', + // table: { + // width: 150 + // }, + // hiddenInMain:true, + // isTableForm: false, + // isForm: false, + // }, + { + label: '项目代码', + field: 'projectCode', + table: { + width: 150 + }, + hiddenInMain:true, + isTableForm: false, + isForm: false, + }, + { + label: '包装数量', + field: 'packQty', + hiddenInMain:true, + table: { + width: 150 + }, + form: { + component: 'InputNumber', + componentProps: { + min: 1, + precision: 6 + } + }, + isTableForm: false, + isForm: false, + }, + { + label: '包装规格', + hiddenInMain:true, + field: 'packUnit', + // dictType: DICT_TYPE.PACK_UNIT, + // dictClass: 'string', + isTable: true, + table: { + width: 150 + }, + isTableForm: false, + isForm: false, + }, + { + label: '供应商计量数量', + field: 'supplierQty', + hiddenInMain:true, + table: { + width: 150 + }, + form: { + component: 'InputNumber', + componentProps: { + min: 1, + precision: 6 + } + }, + isTableForm: false, + isForm: false, + }, + { + label: '供应商计量单位', + field: 'supplierUom', + dictType: DICT_TYPE.UOM, + dictClass: 'string', + isTable: true, + hiddenInMain:true, + table: { + width: 150 + }, + isTableForm: false, + isForm: false, + }, + { + label: '转换率', + field: 'convertRate', + form: { + component: 'InputNumber', + componentProps: { + min: 0 + } + }, + hiddenInMain:true, + table: { + width: 150 + }, + isTableForm: false, + isForm: false, + }, + // { + // label: t('ts.已计划数量'), + // field: 'plannedQty', + // table: { + // width: 150 + // }, + // hiddenInMain:true, + // form: { + // component: 'InputNumber', + // componentProps: { + // min: 1, + // precision: 6 + // }, + // value: 1 + // }, + // isTableForm: false, + // isForm: false, + // }, + { + label: t('ts.已发货数量'), + field: 'shippedQty', + table: { + width: 150 + }, + hiddenInMain:true, + form: { + component: 'InputNumber', + componentProps: { + min: 1, + precision: 6 + }, + value: 1 + }, + isTableForm: false, + isForm: false, + }, + { + label: t('ts.已收货数量'), + field: 'receivedQty', + table: { + width: 150 + }, + hiddenInMain:true, + form: { + component: 'InputNumber', + value: 0, + componentProps: { + min: 1, + precision: 6 + } + }, + isTableForm: false, + isForm: false + }, + { + label: t('ts.已退货数量'), + field: 'returnedQty', + table: { + width: 150 + }, + hiddenInMain:true, + form: { + component: 'InputNumber', + value: 0, + componentProps: { + min: 1, + precision: 6 + } + }, + isTableForm: false, + isForm: false + }, + { + label: t('ts.已上架数量'), + field: 'putawayQty', + table: { + width: 150 + }, + hiddenInMain:true, + form: { + component: 'InputNumber', + value: 1, + componentProps: { + min: 1, + precision: 6 + } + }, + isTableForm: false, + isForm: false + }, + { + label: t('ts.单价'), + field: 'singlePrice', + table: { + width: 150 + }, + hiddenInMain:true, + form: { + component: 'InputNumber', + componentProps: { + min: 1, + precision: 6 + } + }, + isTableForm: false, + isForm: false + }, + { + label: '金额', + field: 'amount', + table: { + width: 150 + }, + hiddenInMain:true, + form: { + component: 'InputNumber', + componentProps: { + min: 1, + precision: 6 + } + }, + isTableForm: false, + isForm: false + }, + { + label: '是否可用', + field: 'available', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', + isTable: true, + table: { + width: 150 + }, + hiddenInMain:true, + tableForm:{ + type:'Select', + default: 'TRUE', + inactiveValue: 'FALSE', + activeValue: 'TRUE' + }, + form: { + component: 'Switch', + value: 'TRUE', + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE' + } + } + }, + { + label: '超收百分比', + field: 'overReceivingPercent', + table: { + width: 150 + }, + hiddenInMain:true, + form: { + component: 'InputNumber', + componentProps: { + min: 0 + } + }, + isTable:false, + isTableForm:false, + tableForm: { + type: 'InputNumber', + min: 0 + } + }, + { + label: '创建者', + field: 'creator', + isTableForm: false, + table: { + width: 150 + }, + hiddenInMain:true, + isForm: false, + }, + { + label: '创建时间', + field: 'createTime', + isTable: true, + isTableForm: false, + formatter: dateFormatter, + detail: { + dateFormat: 'YYYY-MM-DD HH:mm:ss' + }, + table: { + width: 180 + }, + hiddenInMain:true, + isForm: false, + form: { + component: 'DatePicker', + componentProps: { + style: {width:'100%'}, + type: 'datetime', + dateFormat: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + } + } + }, + { + label: '最后更新者', + field: 'updater', + isTableForm: false, + table: { + width: 150 + }, + hiddenInMain:true, + isForm: false, + // form: { + // component: 'DatePicker', + // componentProps: { + // style: {width:'100%'}, + // type: 'datetime', + // dateFormat: 'YYYY-MM-DD HH:mm:ss', + // valueFormat: 'x', + // } + // } + }, + { + label: '最后更新时间', + field: 'updateTime', + isTableForm: false, + isTable: true, + hiddenInMain:true, + formatter: dateFormatter, + detail: { + dateFormat: 'YYYY-MM-DD HH:mm:ss' + }, + table: { + width: 150 + }, + isForm: false, + form: { + component: 'DatePicker', + componentProps: { + style: {width:'100%'}, + type: 'datetime', + dateFormat: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + } + } + }, + { + label: '备注', + hiddenInMain:true, + field: 'remark', + table: { + width: 150 + }, + }, + { + label: '操作', + hiddenInMain:true, + field: 'action', + isDetail: false, + isForm: false , + table: { + width: 150, + fixed: 'right' + }, + isTableForm:false, + } +])) + +//表单校验 +export const PurchaseDetailRules = reactive({ + lineNumber: [ + { required: true, message: '请输入行号', trigger: 'blur' }, + // { max: 50, message: '不得超过50个字符', trigger: 'blur' } + ], + packQty: [ + { required: true, message: '请输入包装数量', trigger: 'blur' } + ], + packUnit: [ + { required: true, message: '请选择包装规格', trigger: 'change' } + ], + convertRate: [ + { required: true, message: '请输入转换率', trigger: 'blur' } + ], + taxRate: [ + { required: true, message: '请输入税率', trigger: 'blur' } + ], + shippedQty: [ + { required: true, message: '请输入已发货数量', trigger: 'blur' } + ], + receivedQty: [ + { required: true, message: '请输入已收货数量', trigger: 'blur' } + ], + returnedQty: [ + { required: true, message: '请输入已退货数量', trigger: 'blur' } + ], + putawayQty: [ + { required: true, message: '请输入已上架数量', trigger: 'blur' } + ], + overReceivingPercent: [ + { required: true, message: '请输入超收百分比', trigger: 'blur' } + ], + orderQty: [ + { required: true, message: '请输入订单数量', trigger: 'blur' } + ], + // uom: [ + // { required: true, message: '请选择计量单位', trigger: 'change' } + // ], + available: [ + { required: true, message: '请选择是否可用', trigger: 'change' } + ], + nuumber: [ + { required: true, message: '请输入单据号', trigger: 'blur' } + ], + itemCode: [ + { required: true, message: '请选择物料代码', trigger: 'change' } + ], + remark: [ + { max: 50, message: '不得超过50个字符', trigger: 'blur' } + ], +})