ljlong_2630
4 months ago
431 changed files with 39885 additions and 15601 deletions
@ -0,0 +1,73 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
import {BasicEamWorkshopVO} from "@/api/eam/basicEamWorkshop"; |
||||
|
|
||||
|
export interface BasicEamProductionlineVO { |
||||
|
id: number |
||||
|
code: string |
||||
|
name: string |
||||
|
description: string |
||||
|
type: string |
||||
|
workshopCode: string |
||||
|
rawLocationCode: string |
||||
|
fgLocationCode: string |
||||
|
available: string |
||||
|
activeTime: Date |
||||
|
expireTime: Date |
||||
|
remark: string |
||||
|
deletionTime: Date |
||||
|
deleterId: string |
||||
|
extraProperties: string |
||||
|
concurrencyStamp: number |
||||
|
siteId: string |
||||
|
} |
||||
|
|
||||
|
// 查询生产线列表
|
||||
|
export const getBasicEamProductionlinePage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/eam/basic-eam-productionline/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/basic-eam-productionline/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询生产线详情
|
||||
|
export const getBasicEamProductionline = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/basic-eam-productionline/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增生产线
|
||||
|
export const createBasicEamProductionline = async (data: BasicEamProductionlineVO) => { |
||||
|
return await request.post({ url: `/eam/basic-eam-productionline/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改生产线
|
||||
|
export const updateBasicEamProductionline = async (data: BasicEamProductionlineVO) => { |
||||
|
return await request.put({ url: `/eam/basic-eam-productionline/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除生产线
|
||||
|
export const deleteBasicEamProductionline = async (id: number) => { |
||||
|
return await request.delete({ url: `/eam/basic-eam-productionline/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出生产线 Excel
|
||||
|
export const exportBasicEamProductionline = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
const data = {...params} |
||||
|
return await request.downloadPost({ url: `/eam/basic-eam-productionline/export-excel-senior`, data }) |
||||
|
}else{ |
||||
|
return await request.download({ url: `/eam/basic-eam-productionline/export-excel`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/eam/basic-eam-productionline/get-import-template' }) |
||||
|
} |
||||
|
|
||||
|
// 启用 / 禁用
|
||||
|
export const updateEnableCode = async (data: BasicEamProductionlineVO) => { |
||||
|
return await request.post({ url: `/eam/basic-eam-productionline/ables` , data }) |
||||
|
} |
@ -0,0 +1,69 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface BasicEamWorkshopVO { |
||||
|
id: number |
||||
|
code: string |
||||
|
name: string |
||||
|
description: string |
||||
|
type: string |
||||
|
available: string |
||||
|
activeTime: Date |
||||
|
expireTime: Date |
||||
|
remark: string |
||||
|
deletionTime: Date |
||||
|
deleterId: string |
||||
|
extraProperties: string |
||||
|
concurrencyStamp: number |
||||
|
siteId: string |
||||
|
} |
||||
|
|
||||
|
// 查询EAM车间列表
|
||||
|
export const getBasicEamWorkshopPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/eam/basic-eam-workshop/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/basic-eam-workshop/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询EAM车间详情
|
||||
|
export const getBasicEamWorkshop = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/basic-eam-workshop/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增EAM车间
|
||||
|
export const createBasicEamWorkshop = async (data: BasicEamWorkshopVO) => { |
||||
|
return await request.post({ url: `/eam/basic-eam-workshop/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改EAM车间
|
||||
|
export const updateBasicEamWorkshop = async (data: BasicEamWorkshopVO) => { |
||||
|
return await request.put({ url: `/eam/basic-eam-workshop/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除EAM车间
|
||||
|
export const deleteBasicEamWorkshop = async (id: number) => { |
||||
|
return await request.delete({ url: `/eam/basic-eam-workshop/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出EAM车间 Excel
|
||||
|
export const exportBasicEamWorkshop = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
const data = {...params} |
||||
|
return await request.downloadPost({ url: `/eam/basic-eam-workshop/export-excel-senior`, data }) |
||||
|
}else{ |
||||
|
return await request.download({ url: `/eam/basic-eam-workshop/export-excel`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/eam/basic-eam-workshop/get-import-template' }) |
||||
|
} |
||||
|
|
||||
|
// 启用 / 禁用
|
||||
|
export const updateEnableCode = async (data: BasicEamWorkshopVO) => { |
||||
|
return await request.post({ url: `/eam/basic-eam-workshop/ables` , data }) |
||||
|
} |
@ -0,0 +1,59 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface RecordDeviceChangedVO { |
||||
|
id: number |
||||
|
code: string |
||||
|
name: string |
||||
|
statusBefore: string |
||||
|
statusAfter: string |
||||
|
operator: number |
||||
|
operateTime: Date |
||||
|
departmentCode: string |
||||
|
remark: string |
||||
|
siteId: string |
||||
|
available: string |
||||
|
deletionTime: Date |
||||
|
deleterId: byte[] |
||||
|
concurrencyStamp: number |
||||
|
} |
||||
|
|
||||
|
// 查询设备变更记录列表
|
||||
|
export const getRecordDeviceChangedPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/eam/record-device-changed/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/record-device-changed/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询设备变更记录详情
|
||||
|
export const getRecordDeviceChanged = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/record-device-changed/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增设备变更记录
|
||||
|
export const createRecordDeviceChanged = async (data: RecordDeviceChangedVO) => { |
||||
|
return await request.post({ url: `/eam/record-device-changed/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改设备变更记录
|
||||
|
export const updateRecordDeviceChanged = async (data: RecordDeviceChangedVO) => { |
||||
|
return await request.put({ url: `/eam/record-device-changed/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除设备变更记录
|
||||
|
export const deleteRecordDeviceChanged = async (id: number) => { |
||||
|
return await request.delete({ url: `/eam/record-device-changed/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出设备变更记录 Excel
|
||||
|
export const exportRecordDeviceChanged = async (params) => { |
||||
|
return await request.download({ url: `/eam/record-device-changed/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/eam/record-device-changed/get-import-template' }) |
||||
|
} |
@ -0,0 +1,63 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface SparePartsApplyDetailVO { |
||||
|
id: number |
||||
|
number: string |
||||
|
masterId: number |
||||
|
sparePartsCode: string |
||||
|
isRadeIn: string |
||||
|
applyQty: number |
||||
|
currentQty: number |
||||
|
type: string |
||||
|
currentSinglePrice: number |
||||
|
equipmentCode: byte[] |
||||
|
jobNumber: byte[] |
||||
|
departmentCode: string |
||||
|
remark: string |
||||
|
siteId: string |
||||
|
available: string |
||||
|
deletionTime: Date |
||||
|
deleterId: byte[] |
||||
|
concurrencyStamp: number |
||||
|
} |
||||
|
|
||||
|
// 查询备件领用申请子列表
|
||||
|
export const getSparePartsApplyDetailPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/eam/spare-parts-apply-detail/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/spare-parts-apply-detail/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询备件领用申请子详情
|
||||
|
export const getSparePartsApplyDetail = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/spare-parts-apply-detail/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增备件领用申请子
|
||||
|
export const createSparePartsApplyDetail = async (data: SparePartsApplyDetailVO) => { |
||||
|
return await request.post({ url: `/eam/spare-parts-apply-detail/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改备件领用申请子
|
||||
|
export const updateSparePartsApplyDetail = async (data: SparePartsApplyDetailVO) => { |
||||
|
return await request.put({ url: `/eam/spare-parts-apply-detail/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除备件领用申请子
|
||||
|
export const deleteSparePartsApplyDetail = async (id: number) => { |
||||
|
return await request.delete({ url: `/eam/spare-parts-apply-detail/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出备件领用申请子 Excel
|
||||
|
export const exportSparePartsApplyDetail = async (params) => { |
||||
|
return await request.download({ url: `/eam/spare-parts-apply-detail/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/eam/spare-parts-apply-detail/get-import-template' }) |
||||
|
} |
@ -0,0 +1,87 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface SparePartsApplyMainVO { |
||||
|
id: number |
||||
|
number: string |
||||
|
description: string |
||||
|
applyDeptId: string |
||||
|
sumVal: number |
||||
|
status: string |
||||
|
applyer: string |
||||
|
approver: number |
||||
|
approveContent: string |
||||
|
approveTime: Date |
||||
|
autoExamine: string |
||||
|
autoAgree: string |
||||
|
directCreateRecord: string |
||||
|
departmentCode: string |
||||
|
remark: string |
||||
|
siteId: string |
||||
|
available: string |
||||
|
deletionTime: Date |
||||
|
deleterId: byte[] |
||||
|
concurrencyStamp: number |
||||
|
} |
||||
|
|
||||
|
// 查询备件领用申请列表
|
||||
|
export const getSparePartsApplyMainPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = { ...params } |
||||
|
return await request.post({ url: '/eam/spare-parts-apply-main/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/spare-parts-apply-main/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询备件领用申请详情
|
||||
|
export const getSparePartsApplyMain = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/spare-parts-apply-main/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增备件领用申请
|
||||
|
export const createSparePartsApplyMain = async (data: SparePartsApplyMainVO) => { |
||||
|
return await request.post({ url: `/eam/spare-parts-apply-main/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改备件领用申请
|
||||
|
export const updateSparePartsApplyMain = async (data: SparePartsApplyMainVO) => { |
||||
|
return await request.put({ url: `/eam/spare-parts-apply-main/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除备件领用申请
|
||||
|
export const deleteSparePartsApplyMain = async (id: number) => { |
||||
|
return await request.delete({ url: `/eam/spare-parts-apply-main/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出备件领用申请 Excel
|
||||
|
export const exportSparePartsApplyMain = async (params) => { |
||||
|
return await request.download({ url: `/eam/spare-parts-apply-main/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/eam/spare-parts-apply-main/get-import-template' }) |
||||
|
} |
||||
|
|
||||
|
// 撤回
|
||||
|
export const cancelSparePartsApplyMain = async (id) => { |
||||
|
return await request.get({ url: `/eam/spare-parts-apply-main/cancel?id=` + id }) |
||||
|
} |
||||
|
// 审核
|
||||
|
export const submitSparePartsApplyMain = async (id) => { |
||||
|
return await request.get({ url: `/eam/spare-parts-apply-main/submitExamine?id=` + id }) |
||||
|
} |
||||
|
// 审核驳回
|
||||
|
export const rejectSparePartsApplyMain = async (id) => { |
||||
|
return await request.get({ url: `/eam/spare-parts-apply-main/reject?id=` + id }) |
||||
|
} |
||||
|
// 审核通过
|
||||
|
export const approveSparePartsApplyMain = async (data) => { |
||||
|
return await request.post({ url: `/eam/spare-parts-apply-main/approve`, data }) |
||||
|
} |
||||
|
|
||||
|
// 完成
|
||||
|
export const finishSparePartsApplyMain = async (id) => { |
||||
|
return await request.post({ url: `/eam/spare-parts-apply-main/finish?id=` + id }) |
||||
|
} |
@ -0,0 +1,58 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface SparePartsInLocationDetailVO { |
||||
|
id: number |
||||
|
number: string |
||||
|
masterId: number |
||||
|
sparePartsCode: string |
||||
|
isRadeIn: string |
||||
|
applyQty: number |
||||
|
departmentCode: string |
||||
|
remark: string |
||||
|
siteId: string |
||||
|
available: string |
||||
|
deletionTime: Date |
||||
|
deleterId: byte[] |
||||
|
concurrencyStamp: number |
||||
|
} |
||||
|
|
||||
|
// 查询备件入库记录子列表
|
||||
|
export const getSparePartsInLocationDetailPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/eam/spare-parts-in-location-detail/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/spare-parts-in-location-detail/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询备件入库记录子详情
|
||||
|
export const getSparePartsInLocationDetail = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/spare-parts-in-location-detail/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增备件入库记录子
|
||||
|
export const createSparePartsInLocationDetail = async (data: SparePartsInLocationDetailVO) => { |
||||
|
return await request.post({ url: `/eam/spare-parts-in-location-detail/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改备件入库记录子
|
||||
|
export const updateSparePartsInLocationDetail = async (data: SparePartsInLocationDetailVO) => { |
||||
|
return await request.put({ url: `/eam/spare-parts-in-location-detail/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除备件入库记录子
|
||||
|
export const deleteSparePartsInLocationDetail = async (id: number) => { |
||||
|
return await request.delete({ url: `/eam/spare-parts-in-location-detail/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出备件入库记录子 Excel
|
||||
|
export const exportSparePartsInLocationDetail = async (params) => { |
||||
|
return await request.download({ url: `/eam/spare-parts-in-location-detail/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/eam/spare-parts-in-location-detail/get-import-template' }) |
||||
|
} |
@ -0,0 +1,91 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface SparePartsInLocationMainVO { |
||||
|
id: number |
||||
|
number: string |
||||
|
theme: string |
||||
|
status: string |
||||
|
applyer: string |
||||
|
approver: number |
||||
|
approveContent: string |
||||
|
approveTime: Date |
||||
|
autoExamine: string |
||||
|
autoAgree: string |
||||
|
directCreateRecord: string |
||||
|
areaCode: string |
||||
|
locationCode: string |
||||
|
departmentCode: string |
||||
|
remark: string |
||||
|
siteId: string |
||||
|
available: string |
||||
|
deletionTime: Date |
||||
|
deleterId: byte[] |
||||
|
concurrencyStamp: number |
||||
|
} |
||||
|
|
||||
|
// 查询备件入库记录主列表
|
||||
|
export const getSparePartsInLocationMainPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/eam/spare-parts-in-location-main/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/spare-parts-in-location-main/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询备件入库记录主详情
|
||||
|
export const getSparePartsInLocationMain = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/spare-parts-in-location-main/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增备件入库记录主
|
||||
|
export const createSparePartsInLocationMain = async (data: SparePartsInLocationMainVO) => { |
||||
|
return await request.post({ url: `/eam/spare-parts-in-location-main/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改备件入库记录主
|
||||
|
export const updateSparePartsInLocationMain = async (data: SparePartsInLocationMainVO) => { |
||||
|
return await request.put({ url: `/eam/spare-parts-in-location-main/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除备件入库记录主
|
||||
|
export const deleteSparePartsInLocationMain = async (id: number) => { |
||||
|
return await request.delete({ url: `/eam/spare-parts-in-location-main/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出备件入库记录主 Excel
|
||||
|
export const exportSparePartsInLocationMain = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
const data = {...params} |
||||
|
return await request.downloadPost({ url: `/eam/spare-parts-in-location-main/export-excel-senior`, data }) |
||||
|
}else{ |
||||
|
return await request.download({ url: `/eam/spare-parts-in-location-main/export-excel`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/eam/spare-parts-in-location-main/get-import-template' }) |
||||
|
} |
||||
|
|
||||
|
// 撤回
|
||||
|
export const cancelSparePartsInLocation = async (id) => { |
||||
|
return await request.get({ url: `/eam/spare-parts-in-location-main/cancel?id=` + id }) |
||||
|
} |
||||
|
// 审核
|
||||
|
export const submitExamineSparePartsInLocation = async (id) => { |
||||
|
return await request.get({ url: `/eam/spare-parts-in-location-main/submitExamine?id=` + id }) |
||||
|
} |
||||
|
// 审核驳回
|
||||
|
export const rejectSparePartsInLocation = async (id) => { |
||||
|
return await request.get({ url: `/eam/spare-parts-in-location-main/reject?id=` + id }) |
||||
|
} |
||||
|
// 审核通过
|
||||
|
export const approveSparePartsInLocation = async (data) => { |
||||
|
return await request.post({ url: `/eam/spare-parts-in-location-main/approve`,data }) |
||||
|
} |
||||
|
// 完成
|
||||
|
export const finishSparePartsInLocation = async (id) => { |
||||
|
return await request.post({ url: `/eam/spare-parts-in-location-main/finish?id=` + id }) |
||||
|
} |
@ -0,0 +1,58 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface SparePartsInLocationDetailRecordVO { |
||||
|
id: number |
||||
|
number: string |
||||
|
masterId: number |
||||
|
sparePartsCode: string |
||||
|
isRadeIn: string |
||||
|
applyQty: number |
||||
|
departmentCode: string |
||||
|
remark: string |
||||
|
siteId: string |
||||
|
available: string |
||||
|
deletionTime: Date |
||||
|
deleterId: byte[] |
||||
|
concurrencyStamp: number |
||||
|
} |
||||
|
|
||||
|
// 查询备件入库记录子列表
|
||||
|
export const getSparePartsInLocationRecordDetailPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/eam/spare-parts-in-location-detail-record/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/spare-parts-in-location-detail-record/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询备件入库记录子详情
|
||||
|
export const getSparePartsInLocationRecordDetail = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/spare-parts-in-location-detail-record/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增备件入库记录子
|
||||
|
export const createSparePartsInLocationRecordDetail= async (data: SparePartsInLocationDetailRecordVO) => { |
||||
|
return await request.post({ url: `/eam/spare-parts-in-location-detail-record/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改备件入库记录子
|
||||
|
export const updateSparePartsInLocationRecordDetail = async (data: SparePartsInLocationDetailRecordVO) => { |
||||
|
return await request.put({ url: `/eam/spare-parts-in-location-detail-record/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除备件入库记录子
|
||||
|
export const deleteSparePartsInLocationRecordDetail = async (id: number) => { |
||||
|
return await request.delete({ url: `/eam/spare-parts-in-location-detail-record/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出备件入库记录子 Excel
|
||||
|
export const exportSparePartsInLocationRecordDetail = async (params) => { |
||||
|
return await request.download({ url: `/eam/spare-parts-in-location-detail-record/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/eam/spare-parts-in-location-detail-record/get-import-template' }) |
||||
|
} |
@ -0,0 +1,72 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface SparePartsInLocationMainRecordVO { |
||||
|
id: number |
||||
|
number: string |
||||
|
theme: string |
||||
|
status: string |
||||
|
applyer: string |
||||
|
approver: number |
||||
|
approveContent: string |
||||
|
approveTime: Date |
||||
|
autoExamine: string |
||||
|
autoAgree: string |
||||
|
directCreateRecord: string |
||||
|
areaCode: string |
||||
|
locationCode: string |
||||
|
departmentCode: string |
||||
|
remark: string |
||||
|
siteId: string |
||||
|
available: string |
||||
|
deletionTime: Date |
||||
|
deleterId: byte[] |
||||
|
concurrencyStamp: number |
||||
|
} |
||||
|
|
||||
|
// 查询备件入库记录主列表
|
||||
|
export const getSparePartsInLocationRecordMainPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = { ...params } |
||||
|
return await request.post({ url: '/eam/spare-parts-in-location-main-record/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/spare-parts-in-location-main-record/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询备件入库记录主详情
|
||||
|
export const getSparePartsInLocationRecordMain = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/spare-parts-in-location-main-record/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增备件入库记录主
|
||||
|
export const createSparePartsInLocationRecordMain = async ( |
||||
|
data: SparePartsInLocationMainRecordVO |
||||
|
) => { |
||||
|
return await request.post({ url: `/eam/spare-parts-in-location-main-record/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改备件入库记录主
|
||||
|
export const updateSparePartsInLocationRecordMain = async ( |
||||
|
data: SparePartsInLocationMainRecordVO |
||||
|
) => { |
||||
|
return await request.put({ url: `/eam/spare-parts-in-location-main-record/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除备件入库记录主
|
||||
|
export const deleteSparePartsInLocationRecordMain= async (id: number) => { |
||||
|
return await request.delete({ url: `/eam/spare-parts-in-location-main-record/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出备件入库记录主 Excel
|
||||
|
export const exportSparePartsInLocationRecordMain = async (params) => { |
||||
|
return await request.download({ |
||||
|
url: `/eam/spare-parts-in-location-main-record/export-excel`, |
||||
|
params |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/eam/spare-parts-in-location-main-record/get-import-template' }) |
||||
|
} |
@ -0,0 +1,61 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface SparePartsOutLocationDetailVO { |
||||
|
id: number |
||||
|
number: string |
||||
|
masterId: number |
||||
|
sparePartsCode: string |
||||
|
isRadeIn: string |
||||
|
applyQty: number |
||||
|
departmentCode: string |
||||
|
remark: string |
||||
|
siteId: string |
||||
|
available: string |
||||
|
deletionTime: Date |
||||
|
deleterId: byte[] |
||||
|
concurrencyStamp: number |
||||
|
} |
||||
|
|
||||
|
// 查询备件入库记录子列表
|
||||
|
export const getSparePartsOutLocationDetailPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = { ...params } |
||||
|
return await request.post({ url: '/eam/spare-parts-out-location-detail/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/spare-parts-out-location-detail/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询备件入库记录子详情
|
||||
|
export const getSparePartsOutLocationDetail = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/spare-parts-out-location-detail/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增备件入库记录子
|
||||
|
export const createSparePartsOutLocationDetail = async (data: SparePartsOutLocationDetailVO) => { |
||||
|
return await request.post({ url: `/eam/spare-parts-out-location-detail/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改备件入库记录子
|
||||
|
export const updateSparePartsOutLocationDetail = async (data: SparePartsOutLocationDetailVO) => { |
||||
|
return await request.put({ url: `/eam/spare-parts-out-location-detail/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除备件入库记录子
|
||||
|
export const deleteSparePartsOutLocationDetail = async (id: number) => { |
||||
|
return await request.delete({ url: `/eam/spare-parts-out-location-detail/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出备件入库记录子 Excel
|
||||
|
export const exportSparePartsOutLocationDetail = async (params) => { |
||||
|
return await request.download({ |
||||
|
url: `/eam/spare-parts-out-location-detail/export-excel`, |
||||
|
params |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/eam/spare-parts-out-location-detail/get-import-template' }) |
||||
|
} |
@ -0,0 +1,81 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface SparePartsOutLocationMainVO { |
||||
|
id: number |
||||
|
number: string |
||||
|
theme: string |
||||
|
status: string |
||||
|
applyer: string |
||||
|
approver: number |
||||
|
approveContent: string |
||||
|
approveTime: Date |
||||
|
autoExamine: string |
||||
|
autoAgree: string |
||||
|
directCreateRecord: string |
||||
|
areaCode: string |
||||
|
locationCode: string |
||||
|
departmentCode: string |
||||
|
remark: string |
||||
|
siteId: string |
||||
|
available: string |
||||
|
deletionTime: Date |
||||
|
deleterId: byte[] |
||||
|
concurrencyStamp: number |
||||
|
} |
||||
|
|
||||
|
// 查询备件入库记录主列表
|
||||
|
export const getSparePartsOutLocationMainPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = { ...params } |
||||
|
return await request.post({ url: '/eam/spare-parts-out-location-main/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/spare-parts-out-location-main/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询备件入库记录主详情
|
||||
|
export const getSparePartsOutLocationMain = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/spare-parts-out-location-main/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增备件入库记录主
|
||||
|
export const createSparePartsOutLocationMain = async (data: SparePartsOutLocationMainVO) => { |
||||
|
return await request.post({ url: `/eam/spare-parts-out-location-main/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改备件入库记录主
|
||||
|
export const updateSparePartsOutLocationMain = async (data: SparePartsOutLocationMainVO) => { |
||||
|
return await request.put({ url: `/eam/spare-parts-out-location-main/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除备件入库记录主
|
||||
|
export const deleteSparePartsOutLocationMain = async (id: number) => { |
||||
|
return await request.delete({ url: `/eam/spare-parts-out-location-main/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 出库
|
||||
|
export const outSparePartsOutLocationMain = async (id) => { |
||||
|
return await request.get({ url: `/eam/spare-parts-out-location-main/out?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出备件入库记录主 Excel
|
||||
|
export const exportSparePartsOutLocationMain = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
const data = { ...params } |
||||
|
return await request.downloadPost({ |
||||
|
url: `/eam/spare-parts-out-location-main/export-excel-senior`, |
||||
|
data |
||||
|
}) |
||||
|
} else { |
||||
|
return await request.download({ |
||||
|
url: `/eam/spare-parts-out-location-main/export-excel`, |
||||
|
params |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/eam/spare-parts-out-location-main/get-import-template' }) |
||||
|
} |
@ -0,0 +1,76 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface SparePartsOutLocationRecordDetailVO { |
||||
|
id: number |
||||
|
number: string |
||||
|
theme: string |
||||
|
status: string |
||||
|
applyer: string |
||||
|
approver: number |
||||
|
approveContent: string |
||||
|
approveTime: Date |
||||
|
autoExamine: string |
||||
|
autoAgree: string |
||||
|
directCreateRecord: string |
||||
|
areaCode: string |
||||
|
locationCode: string |
||||
|
departmentCode: string |
||||
|
remark: string |
||||
|
siteId: string |
||||
|
available: string |
||||
|
deletionTime: Date |
||||
|
deleterId: byte[] |
||||
|
concurrencyStamp: number |
||||
|
} |
||||
|
|
||||
|
// 查询备件入库记录主列表
|
||||
|
export const getSparePartsOutLocationDetailRecordPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = { ...params } |
||||
|
return await request.post({ url: '/eam/spare-parts-out-location-detail-record/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/spare-parts-out-location-detail-record/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询备件入库记录主详情
|
||||
|
export const getSparePartsOutLocationDetailRecord = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/spare-parts-out-location-detail-record/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增备件入库记录主
|
||||
|
export const createSparePartsOutLocationDetailRecord = async ( |
||||
|
data: SparePartsOutLocationRecordDetailVO |
||||
|
) => { |
||||
|
return await request.post({ url: `/eam/spare-parts-out-location-detail-record/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改备件入库记录主
|
||||
|
export const updateSparePartsOutLocationDetailRecord = async ( |
||||
|
data: SparePartsOutLocationRecordDetailVO |
||||
|
) => { |
||||
|
return await request.put({ url: `/eam/spare-parts-out-location-detail-record/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除备件入库记录主
|
||||
|
export const deleteSparePartsOutLocationDetailRecord = async (id: number) => { |
||||
|
return await request.delete({ |
||||
|
url: `/eam/spare-parts-out-location-detail-record/delete?id=` + id |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 导出备件入库记录主 Excel
|
||||
|
export const exportSparePartsOutLocationDetailRecord = async (params) => { |
||||
|
return await request.download({ |
||||
|
url: `/eam/spare-parts-out-location-detail-record/export-excel`, |
||||
|
params |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ |
||||
|
url: '/eam/spare-parts-out-location-detail-record/get-import-template' |
||||
|
}) |
||||
|
} |
@ -0,0 +1,54 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
// 创建领用出库记录子
|
||||
|
export function createSparePartsOutLocationRecordDetail(data) { |
||||
|
return request({ |
||||
|
url: '/eam/spare-parts-out-location-detail-record/create', |
||||
|
method: 'post', |
||||
|
data: data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 更新领用出库记录子
|
||||
|
export function updateSparePartsOutLocationRecordDetail(data) { |
||||
|
return request({ |
||||
|
url: '/eam/spare-parts-out-location-detail-record/update', |
||||
|
method: 'put', |
||||
|
data: data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 删除领用出库记录子
|
||||
|
export function deleteSparePartsOutLocationRecordDetail(id) { |
||||
|
return request({ |
||||
|
url: '/eam/spare-parts-out-location-detail-record/delete?id=' + id, |
||||
|
method: 'delete' |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 获得领用出库记录子
|
||||
|
export function getSparePartsOutLocationRecordDetail(id) { |
||||
|
return request({ |
||||
|
url: '/eam/spare-parts-out-location-detail-record/get?id=' + id, |
||||
|
method: 'get' |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 获得领用出库记录子分页
|
||||
|
export function getSparePartsOutLocationRecordDetailPage(query) { |
||||
|
return request({ |
||||
|
url: '/eam/spare-parts-out-location-detail-record/page', |
||||
|
method: 'get', |
||||
|
params: query |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 导出领用出库记录子 Excel
|
||||
|
export function exportSparePartsOutLocationRecordDetailExcel(query) { |
||||
|
return request({ |
||||
|
url: '/eam/spare-parts-out-location-detail-record/export-excel', |
||||
|
method: 'get', |
||||
|
params: query, |
||||
|
responseType: 'blob' |
||||
|
}) |
||||
|
} |
@ -0,0 +1,71 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface SparePartsOutLocationRecordMainVO { |
||||
|
id: number |
||||
|
number: string |
||||
|
theme: string |
||||
|
applyer: string |
||||
|
approver: number |
||||
|
approveContent: string |
||||
|
approveTime: Date |
||||
|
autoExamine: string |
||||
|
autoAgree: string |
||||
|
directCreateRecord: string |
||||
|
areaCode: string |
||||
|
locationCode: string |
||||
|
departmentCode: string |
||||
|
remark: string |
||||
|
siteId: string |
||||
|
available: string |
||||
|
deletionTime: Date |
||||
|
deleterId: byte[] |
||||
|
concurrencyStamp: number |
||||
|
} |
||||
|
|
||||
|
// 查询领用出库记录主列表
|
||||
|
export const getSparePartsOutLocationRecordMainPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = { ...params } |
||||
|
return await request.post({ url: '/eam/spare-parts-out-location-main-record/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/eam/spare-parts-out-location-main-record/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询领用出库记录主详情
|
||||
|
export const getSparePartsOutLocationRecordMain = async (id: number) => { |
||||
|
return await request.get({ url: `/eam/spare-parts-out-location-main-record/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增领用出库记录主
|
||||
|
export const createSparePartsOutLocationRecordMain = async ( |
||||
|
data: SparePartsOutLocationRecordMainVO |
||||
|
) => { |
||||
|
return await request.post({ url: `/eam/spare-parts-out-location-main-record/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改领用出库记录主
|
||||
|
export const updateSparePartsOutLocationRecordMain = async ( |
||||
|
data: SparePartsOutLocationRecordMainVO |
||||
|
) => { |
||||
|
return await request.put({ url: `/eam/spare-parts-out-location-main-record/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除领用出库记录主
|
||||
|
export const deleteSparePartsOutLocationRecordMain = async (id: number) => { |
||||
|
return await request.delete({ url: `/eam/spare-parts-out-location-main-record/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出领用出库记录主 Excel
|
||||
|
export const exportSparePartsOutLocationRecordMain = async (params) => { |
||||
|
return await request.download({ |
||||
|
url: `/eam/spare-parts-out-location-main-record/export-excel`, |
||||
|
params |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/eam/spare-parts-out-location-main-record/get-import-template' }) |
||||
|
} |
@ -0,0 +1,524 @@ |
|||||
|
// 获取供应商列表
|
||||
|
import { getSupplierListByCodes, importTemplate } from '@/api/wms/supplier' |
||||
|
// 获取物料列表
|
||||
|
import { getItemListByCodes } from '@/api/wms/itembasic' |
||||
|
// 获取供应商物料列表
|
||||
|
import { getSupplierItemListByCodes } from '@/api/wms/supplieritem' |
||||
|
// 获取生产线物料
|
||||
|
import { getProductionLineCodelistByCodes } from '@/api/wms/productionlineitem' |
||||
|
// 获取包装规格
|
||||
|
import { getPackageunitListByCodes } from '@/api/wms/packageunit' |
||||
|
// 获取物料包装规格
|
||||
|
import { getItemPackageunitListByCodes } from '@/api/wms/itempackage' |
||||
|
// 获取客户物料
|
||||
|
import { getCustomerItemListByCodes } from '@/api/wms/customeritem' |
||||
|
// 获取库存余额
|
||||
|
import { getBalanceItemListByCodes } from '@/api/wms/balance' |
||||
|
import { isString } from 'min-dash' |
||||
|
const message = useMessage() // 消息弹窗
|
||||
|
const { t } = useI18n() // 国际化
|
||||
|
/** |
||||
|
* 业务组件 |
||||
|
* tableFormBlur 表格表单失去焦点时候获取焦点 |
||||
|
* FormBlur 表格失去焦点时候获取焦点 |
||||
|
*/ |
||||
|
export const tableFormBlurVer = async (headerItem, val, row, index,routeName,formRef,detailData,tableData,callback) => { |
||||
|
if ( |
||||
|
headerItem.field == 'fromPackingNumber' || |
||||
|
headerItem.field == 'packingNumber' || |
||||
|
headerItem.field == 'itemCode' || |
||||
|
headerItem.field == 'packUnit' || |
||||
|
headerItem.field == 'secondPackUnit' || |
||||
|
headerItem.field == 'fromPackUnit' || |
||||
|
headerItem.field == 'toPackUnit'|| |
||||
|
headerItem.field == 'toPackUnit'|| |
||||
|
headerItem.field == 'supplierItemCode' |
||||
|
|
||||
|
) { |
||||
|
let searchField = headerItem.field |
||||
|
let pageApi = ref() |
||||
|
let params = ref() |
||||
|
|
||||
|
if (val && isString(val)) { |
||||
|
// const obj = props.tableAllSchemas.tableFormColumns.find((item) => item.field == headerItem.field)
|
||||
|
if (val.indexOf(',') > -1) { |
||||
|
message.alert('该输入框只能输入一条数据') |
||||
|
row[headerItem.field] = '' |
||||
|
return |
||||
|
} |
||||
|
// 校验
|
||||
|
let params = ref({}) |
||||
|
let searchCondition1 = headerItem.tableForm.searchCondition //获取data.ts参数信息
|
||||
|
// 循环参数设置参数为key:value格式
|
||||
|
if (searchCondition1 && searchCondition1.length > 0) { |
||||
|
for (let i = 0; i < searchCondition1.length; i++) { |
||||
|
if (searchCondition1[i].isMainValue) { |
||||
|
params.value[searchCondition1[i].key] = formRef.formModel[ |
||||
|
searchCondition1[i].value |
||||
|
] |
||||
|
? formRef.formModel[searchCondition1[i].value] |
||||
|
: detailData |
||||
|
? detailData[searchCondition1[i].value] |
||||
|
: row |
||||
|
? row[searchCondition1[i].value] |
||||
|
: '' |
||||
|
// 是否含有空参数情况
|
||||
|
let isNull = false |
||||
|
if ( |
||||
|
params.value[searchCondition1[i].key] == '' || |
||||
|
params.value[searchCondition1[i].key] == undefined |
||||
|
) { |
||||
|
isNull = true |
||||
|
} |
||||
|
if (isNull) { |
||||
|
message.warning( |
||||
|
searchCondition1[i].message ? searchCondition1[i].message : '前置条件未选择!' |
||||
|
) |
||||
|
row[headerItem.field] = '' |
||||
|
return |
||||
|
} |
||||
|
} else { |
||||
|
// 扩展 转换为筛选条件进行查询
|
||||
|
if (searchCondition1[i].isSearch) { |
||||
|
if (searchCondition1[i].isFormModel) { |
||||
|
//用formModel中的值
|
||||
|
if (searchCondition1[i].required) { |
||||
|
if ( |
||||
|
formRef.formModel[searchCondition1[i].value] == '' || |
||||
|
formRef.formModel[searchCondition1[i].value] == undefined |
||||
|
) { |
||||
|
message.warning( |
||||
|
searchCondition1[i].message ? searchCondition1[i].message : '前置条件未选择!' |
||||
|
) |
||||
|
row[headerItem.field] = '' |
||||
|
return |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
params.value[searchCondition1[i].key] = searchCondition1[i].value |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
params.value[headerItem.field] = val?.trim() |
||||
|
// 判断改包装号是否已经添加
|
||||
|
const seen = new Set() |
||||
|
const repeatCode = new Set() |
||||
|
let arr = tableData.map((item) => item[headerItem.field]?.trim()) |
||||
|
arr.forEach((item) => { |
||||
|
if (seen.has(item)) { |
||||
|
repeatCode.add(item) |
||||
|
} else { |
||||
|
seen.add(item) |
||||
|
} |
||||
|
}) |
||||
|
const arr1 = Array.from(repeatCode) |
||||
|
if (arr1.length > 0) { |
||||
|
message.warning(`${arr1.join(',')}${t('ts.已经存在')}`) |
||||
|
row[headerItem.field] = '' |
||||
|
return |
||||
|
} |
||||
|
if ( |
||||
|
headerItem.field == 'fromPackingNumber' || |
||||
|
headerItem.field == 'packingNumber' || |
||||
|
headerItem.field == 'itemCode' |
||||
|
) { |
||||
|
// 业务
|
||||
|
// 采购退货申请,制品拆解,调拨出库,报废出库申请,合格转隔离,隔离转合格,隔离转报废,合格转报废,报废转隔离,库存移动申请,库存修改申请
|
||||
|
if ( |
||||
|
routeName == 'PurchasereturnRequestMain' || |
||||
|
routeName == 'ProductdismantleRequestMain' || |
||||
|
routeName == 'TransferissueRequestMain' || |
||||
|
routeName == 'ScrapRequestMain' || |
||||
|
routeName == 'OktoholdRequestMain' || |
||||
|
routeName == 'HoldtookRequestMain' || |
||||
|
routeName == 'HoldtoscrapRequestMain' || |
||||
|
routeName == 'OktoscrapRequestMain' || |
||||
|
routeName == 'ScraptoholdRequestMain' || |
||||
|
routeName == 'InventorymoveRequestMain' || |
||||
|
routeName == 'InventorychangeRequestMain' |
||||
|
) { |
||||
|
// //合格转隔离,隔离转合格,隔离转报废,合格转报废,报废转隔离,库存移动申请参数稍有不同
|
||||
|
// if (
|
||||
|
// routeName == 'OktoholdRequestMain' ||
|
||||
|
// routeName == 'HoldtookRequestMain' ||
|
||||
|
// routeName == 'HoldtoscrapRequestMain' ||
|
||||
|
// routeName == 'OktoscrapRequestMain' ||
|
||||
|
// routeName == 'ScraptoholdRequestMain' ||
|
||||
|
// routeName == 'InventorymoveRequestMain' ||
|
||||
|
// routeName == 'InventorychangeRequestMain'
|
||||
|
// ) {
|
||||
|
// searchField = 'packingNumber'
|
||||
|
// params.value.packingNumber = val?.trim()
|
||||
|
// }
|
||||
|
// pageApi.value = getBalanceItemListByCodes
|
||||
|
} else if ( |
||||
|
routeName == 'RepleinshRequestMain' || |
||||
|
routeName == 'IssueRequestMain' || |
||||
|
routeName == 'InventoryinitRequestMain' |
||||
|
) { |
||||
|
// 补料申请业务
|
||||
|
pageApi.value = getItemListByCodes |
||||
|
searchField = 'code' |
||||
|
params.value.codes = val?.trim() |
||||
|
} else if ( |
||||
|
routeName == 'ProductionMainAssemble' || |
||||
|
routeName == 'ProductionMainASparePart' || |
||||
|
routeName == 'ProductionMainPredictSparePart' || |
||||
|
routeName == 'ProductreceiptRequestMain' || |
||||
|
routeName == 'ProductreceiptRequestMainA' || |
||||
|
routeName == 'ProductreceiptscrapRequestMain' || |
||||
|
routeName == 'ProductscrapRequestMain' |
||||
|
) { |
||||
|
// 装配计划,裝配备件计划,预备产件计划,预生产收货申请,装配收货申请,报修收货申请,制品报废申请
|
||||
|
pageApi.value = getProductionLineCodelistByCodes |
||||
|
params.value.productionLineCode= |
||||
|
formRef.formModel.productionLine || formRef.formModel.productionLineCode || row.productionLine || row.productionLineCode, |
||||
|
params.value.itemCodes=val?.trim() |
||||
|
} |
||||
|
} else if ( |
||||
|
headerItem.field == 'packUnit' || |
||||
|
headerItem.field == 'secondPackUnit' || |
||||
|
headerItem.field == 'fromPackUnit' || |
||||
|
headerItem.field == 'toPackUnit' |
||||
|
) { |
||||
|
searchField = 'packUnit' |
||||
|
//包装规格
|
||||
|
// 预生产收货申请,装配收货申请,报修收货申请,客户退货申请,计划外入库,计划外出库,翻包申请
|
||||
|
if ( |
||||
|
routeName == 'ProductreceiptRequestMain' || |
||||
|
routeName == 'ProductreceiptRequestMainA' || |
||||
|
routeName == 'ProductreceiptscrapRequestMain' || |
||||
|
routeName == 'CustomerreturnRequestMain' || |
||||
|
routeName == 'UnplannedreceiptRequestMain' || |
||||
|
routeName == 'UnplannedissueJobMain' || |
||||
|
routeName == 'PackageoverRequestMain' |
||||
|
) { |
||||
|
params.value.itemCode= row.itemCode |
||||
|
params.value.packUnit= val?.trim() |
||||
|
pageApi.value = getItemPackageunitListByCodes |
||||
|
} |
||||
|
} else if ( |
||||
|
headerItem.field == 'supplierItemCode' |
||||
|
) { |
||||
|
// 生产退料申请,隔离退料申请
|
||||
|
if ( |
||||
|
routeName == 'ProductionreturnRequestMain' || |
||||
|
routeName == 'ProductionreturnRequestMainNo' |
||||
|
) { |
||||
|
searchField = 'supplierCode' |
||||
|
params.value.itemCodes= row.itemCode |
||||
|
params.value.supplierCode= val?.trim() |
||||
|
pageApi.value = getSupplierItemListByCodes |
||||
|
} |
||||
|
} |
||||
|
const list = ref() |
||||
|
// 调取包装接口
|
||||
|
await pageApi.value(params.value).then(async (res) => { |
||||
|
list.value = res ? res : [] |
||||
|
// 只查一条数据,多条数据查询默认显示不存在
|
||||
|
if (res.length == 1) { |
||||
|
callback(searchField,list.value) |
||||
|
} else { |
||||
|
message.alert('代码' + row[headerItem.field] + '没有找到对应数据') |
||||
|
row[headerItem.field] = '' |
||||
|
return |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
export const FormBlur = async (formField, val,routeName,formRef,detailData,formSchema,callback) => { |
||||
|
let pageApi = ref() |
||||
|
let params = ref() |
||||
|
let setV = {} |
||||
|
setV[formField] = '' |
||||
|
if (val && isString(val)) { |
||||
|
if ( |
||||
|
formField == 'supplierCode' || |
||||
|
formField == 'itemCode' || |
||||
|
formField == 'productItemCode' || |
||||
|
formField == 'componentItemCode' || |
||||
|
formField == 'packUnit' || |
||||
|
formField == 'inPackUnit' || |
||||
|
formField == 'fromPackingNumber' |
||||
|
) { |
||||
|
let searchField = 'code' |
||||
|
if (formField == 'supplierCode') { |
||||
|
params.value = val?.trim() |
||||
|
pageApi.value = getSupplierListByCodes |
||||
|
} else if ( |
||||
|
formField == 'itemCode' || |
||||
|
formField == 'productItemCode' || |
||||
|
formField == 'componentItemCode' |
||||
|
) { |
||||
|
// 销售价格单
|
||||
|
if (routeName == 'Saleprice') { |
||||
|
params.value = { |
||||
|
customerCode: formRef.formModel.customerCode, |
||||
|
itemCodes: val?.trim() |
||||
|
} |
||||
|
pageApi.value = getCustomerItemListByCodes |
||||
|
searchField = 'itemCode' |
||||
|
}else if (routeName == 'ProductscrapRequestMain') { |
||||
|
// 制品报废申请
|
||||
|
params.value = { |
||||
|
productionLineCode: |
||||
|
detailData.productionLine || detailData.productionLineCode, |
||||
|
itemCodes: val?.trim() |
||||
|
} |
||||
|
pageApi.value = getProductionLineCodelistByCodes |
||||
|
searchField = 'itemCode' |
||||
|
}else { |
||||
|
// params.value = val.trim()
|
||||
|
searchField = 'code' |
||||
|
|
||||
|
params.value={ |
||||
|
codes:val?.trim() |
||||
|
} |
||||
|
pageApi.value = getItemListByCodes |
||||
|
} |
||||
|
} else if (formField == 'packUnit') { |
||||
|
if(routeName == 'Itemwarehouse'||routeName == 'Callmaterials'){//物料仓库默认配置,叫料标签
|
||||
|
searchField = 'packUnit' |
||||
|
params.value = { |
||||
|
itemCode: formRef.formModel.itemCode, |
||||
|
packUnit: val?.trim() |
||||
|
} |
||||
|
pageApi.value = getItemPackageunitListByCodes |
||||
|
}else{ |
||||
|
params.value = val?.trim() |
||||
|
pageApi.value = getPackageunitListByCodes |
||||
|
} |
||||
|
} else if (formField == 'inPackUnit') { |
||||
|
params.value = { |
||||
|
itemCode: formRef.formModel.itemCode, |
||||
|
packUnit: val.trim() |
||||
|
} |
||||
|
pageApi.value = getItemPackageunitListByCodes |
||||
|
} |
||||
|
// else if (formField == 'fromPackingNumber') {
|
||||
|
// params.value = {
|
||||
|
// packingNumber: val?.trim()
|
||||
|
// }
|
||||
|
// pageApi.value = getBalanceItemListByCodes
|
||||
|
// }
|
||||
|
let obj = {} |
||||
|
let searchCondition1 = formSchema.find((item) => item.field == formField).componentProps |
||||
|
.searchCondition //获取data.ts参数信息
|
||||
|
// 循环参数设置参数为key:value格式
|
||||
|
if (searchCondition1 && searchCondition1.length > 0) { |
||||
|
for (let i = 0; i < searchCondition1.length; i++) { |
||||
|
if (searchCondition1[i].isMainValue) { |
||||
|
obj[searchCondition1[i].key] = formRef.formModel[searchCondition1[i].value] |
||||
|
? formRef.formModel[searchCondition1[i].value] |
||||
|
: detailData |
||||
|
? detailData[searchCondition1[i].value] |
||||
|
: '' |
||||
|
// 是否含有空参数情况
|
||||
|
let isNull = false |
||||
|
if (obj[searchCondition1[i].key] == '' || obj[searchCondition1[i].key] == undefined) { |
||||
|
isNull = true |
||||
|
} |
||||
|
if (isNull) { |
||||
|
message.warning( |
||||
|
searchCondition1[i].message ? searchCondition1[i].message : '前置条件未选择!' |
||||
|
) |
||||
|
return |
||||
|
} |
||||
|
} else { |
||||
|
// 扩展 转换为筛选条件进行查询
|
||||
|
if (searchCondition1[i].isSearch) { |
||||
|
if (searchCondition1[i].isFormModel) { |
||||
|
//用formModel中的值
|
||||
|
if (searchCondition1[i].required) { |
||||
|
if ( |
||||
|
formRef.formModel[searchCondition1[i].value] == '' || |
||||
|
formRef.formModel[searchCondition1[i].value] == undefined |
||||
|
) { |
||||
|
message.warning( |
||||
|
searchCondition1[i].message ? searchCondition1[i].message : '前置条件未选择!' |
||||
|
) |
||||
|
return |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
obj[searchCondition1[i].key] = searchCondition1[i].value |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
let obj1 = formSchema.find((item) => item.field == formField) |
||||
|
if (!obj1.componentProps.multiple && val.indexOf(',') > -1) { |
||||
|
message.alert('该输入框只能输入一条数据') |
||||
|
formRef.setValues(setV) |
||||
|
return |
||||
|
} |
||||
|
await pageApi.value(params.value).then((res) => { |
||||
|
let arr1 = val.split(',') |
||||
|
let list = ref([]) |
||||
|
list.value = res |
||||
|
if (list.value?.length == 0) { |
||||
|
message.alert('暂无数据') |
||||
|
formRef.setValues(setV) |
||||
|
return |
||||
|
} |
||||
|
if (arr1.length != list.value.length) { |
||||
|
let arr2 = list.value.map((item) => item.code) |
||||
|
let str = [ |
||||
|
...arr1.filter((item) => !arr2.includes(item)), |
||||
|
...arr2.filter((item) => !arr1.includes(item)) |
||||
|
].join(',') |
||||
|
message.alert('代码' + str + '没有找到对应数据') |
||||
|
formRef.setValues(setV) |
||||
|
return |
||||
|
} |
||||
|
// emit('searchTableSuccess', formField, searchField, list.value, formRef.value, 'form')
|
||||
|
callback(searchField,list.value) |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 根据下方输入框失去焦点校验信息
|
||||
|
export const getListByBottonInput = async (headerItem, val,row,routeName,formRef,detailData,tableData,callback) => { |
||||
|
let pageApi = ref() |
||||
|
let params = ref({}) |
||||
|
let list = ref([]) |
||||
|
let field = 'itemCode' |
||||
|
// scp采购订单
|
||||
|
if(!val)return; |
||||
|
if (routeName == 'PurchaseMain') { |
||||
|
pageApi.value = getSupplierItemListByCodes |
||||
|
params.value = { |
||||
|
supplierCode: formRef.formModel.supplierCode, |
||||
|
itemCodes: val?.trim(), |
||||
|
available: true |
||||
|
} |
||||
|
} else if (routeName == 'ProductionMain') { |
||||
|
pageApi.value = getProductionLineCodelistByCodes |
||||
|
params.value = { |
||||
|
productionLineCode: formRef.formModel.productionLine, |
||||
|
itemCodes: val?.trim() |
||||
|
} |
||||
|
} else if ( |
||||
|
routeName == 'ZZBJDeliverPlanMain' || |
||||
|
routeName == 'DeliverPlanMain' || |
||||
|
routeName == 'DeliverRequestMain' || |
||||
|
routeName == 'ZZBJDeliverRequestMain' |
||||
|
) { |
||||
|
// 自制备件发货计划,发货计划,成品发货申请,自制备件发货申请
|
||||
|
pageApi.value = getCustomerItemListByCodes |
||||
|
params.value = { |
||||
|
customerCode: formRef.formModel.customerCode, |
||||
|
itemCodes: val?.trim() |
||||
|
} |
||||
|
} |
||||
|
// else if (routeName == 'UnplannedissueRequestMain') {
|
||||
|
// // 计划外出库
|
||||
|
// pageApi.value = getBalanceItemListByCodes
|
||||
|
// params.value = {
|
||||
|
// packingNumber: val?.trim()
|
||||
|
// }
|
||||
|
// field = 'packingNumber'
|
||||
|
// }
|
||||
|
else { |
||||
|
params.value.codes = val?.trim() |
||||
|
pageApi.value = getItemListByCodes |
||||
|
} |
||||
|
let searchCondition1 = headerItem.tableForm.searchCondition //获取data.ts参数信息
|
||||
|
// 循环参数设置参数为key:value格式
|
||||
|
if (searchCondition1 && searchCondition1.length > 0) { |
||||
|
for (let i = 0; i < searchCondition1.length; i++) { |
||||
|
if (searchCondition1[i].isMainValue) { |
||||
|
params.value[searchCondition1[i].key] = formRef.formModel[ |
||||
|
searchCondition1[i].value |
||||
|
] |
||||
|
? formRef.formModel[searchCondition1[i].value] |
||||
|
: detailData |
||||
|
? detailData[searchCondition1[i].value] |
||||
|
: '' |
||||
|
// 是否含有空参数情况
|
||||
|
let isNull = false |
||||
|
if ( |
||||
|
params.value[searchCondition1[i].key] == '' || |
||||
|
params.value[searchCondition1[i].key] == undefined |
||||
|
) { |
||||
|
isNull = true |
||||
|
} |
||||
|
if (isNull) { |
||||
|
message.warning( |
||||
|
searchCondition1[i].message ? searchCondition1[i].message : '前置条件未选择!' |
||||
|
) |
||||
|
return |
||||
|
} |
||||
|
} else if (searchCondition1[i].isTableRowValue) { |
||||
|
if (searchCondition1[i].required) { |
||||
|
if (row[searchCondition1[i].value] == '' || row[searchCondition1[i].value] == undefined) { |
||||
|
message.warning( |
||||
|
searchCondition1[i].message ? searchCondition1[i].message : '前置条件未选择!' |
||||
|
) |
||||
|
return |
||||
|
} |
||||
|
} |
||||
|
row[searchCondition1[i].value] |
||||
|
//查询当前table表数据的值
|
||||
|
params.value[searchCondition1[i].key] = row[searchCondition1[i].value] |
||||
|
} else { |
||||
|
// 扩展 转换为筛选条件进行查询
|
||||
|
if (searchCondition1[i].isSearch) { |
||||
|
if (searchCondition1[i].isFormModel) { |
||||
|
//用formModel中的值
|
||||
|
if (searchCondition1[i].required) { |
||||
|
if ( |
||||
|
formRef.formModel[searchCondition1[i].value] == '' || |
||||
|
formRef.formModel[searchCondition1[i].value] == undefined |
||||
|
) { |
||||
|
message.warning( |
||||
|
searchCondition1[i].message ? searchCondition1[i].message : '前置条件未选择!' |
||||
|
) |
||||
|
return |
||||
|
} |
||||
|
} |
||||
|
}else { |
||||
|
params.value[searchCondition1[i].key] = searchCondition1[i].value |
||||
|
} |
||||
|
} else { |
||||
|
params.value[searchCondition1[i].key] = searchCondition1[i].value |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
await pageApi.value(params.value).then(async (res) => { |
||||
|
list.value = res ? res : [] |
||||
|
let arr1 = val.split(',').map(item=>item.trim()) |
||||
|
if (arr1.length != res.length) { |
||||
|
let arr2 = res.map((item) => item[field]) |
||||
|
let str = [ |
||||
|
...arr1.filter((item) => !arr2.includes(item)), |
||||
|
...arr2.filter((item) => !arr1.includes(item)) |
||||
|
].join(',') |
||||
|
message.alert('代码' + str + '没有找到对应数据') |
||||
|
return |
||||
|
} else { |
||||
|
let repeatCode = [] |
||||
|
if(tableData.length > 0){ |
||||
|
tableData.forEach((item) => { |
||||
|
const findIndex = arr1.findIndex(valItem=>valItem==item[field]) |
||||
|
if(findIndex > -1){ |
||||
|
arr1.splice(findIndex,1) |
||||
|
repeatCode.push(item.itemCode) |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
if(repeatCode.length>0){ |
||||
|
message.warning(`${t('ts.代码')}${repeatCode.join(',')}${t('ts.已经存在')}`); |
||||
|
return; |
||||
|
} |
||||
|
callback(list.value) |
||||
|
} |
||||
|
}) |
||||
|
} |
@ -0,0 +1,56 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface MstrVO { |
||||
|
id: number |
||||
|
hflccHflcd: string |
||||
|
plProdLine: string |
||||
|
plDesc: string |
||||
|
plMvarAcct: string |
||||
|
plCchgAcct: string |
||||
|
type: string |
||||
|
remark: string |
||||
|
extraProperties: string |
||||
|
concurrencyStamp: number |
||||
|
siteId: string |
||||
|
} |
||||
|
|
||||
|
// 查询产品类信息列表
|
||||
|
export const getMstrPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/wms/mstr/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/wms/mstr/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询产品类信息详情
|
||||
|
export const getMstr = async (id: number) => { |
||||
|
return await request.get({ url: `/wms/mstr/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增产品类信息
|
||||
|
export const createMstr = async (data: MstrVO) => { |
||||
|
return await request.post({ url: `/wms/mstr/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改产品类信息
|
||||
|
export const updateMstr = async (data: MstrVO) => { |
||||
|
return await request.put({ url: `/wms/mstr/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除产品类信息
|
||||
|
export const deleteMstr = async (id: number) => { |
||||
|
return await request.delete({ url: `/wms/mstr/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出产品类信息 Excel
|
||||
|
export const exportMstr = async (params) => { |
||||
|
return await request.download({ url: `/wms/mstr/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/wms/mstr/get-import-template' }) |
||||
|
} |
@ -0,0 +1,65 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface SupplierCycleVO { |
||||
|
id: number |
||||
|
supplierCode: string |
||||
|
monday: string |
||||
|
tuesday: string |
||||
|
wednesday: string |
||||
|
thursday: string |
||||
|
friday: string |
||||
|
saturday: string |
||||
|
sunday: string |
||||
|
version: string |
||||
|
remark: string |
||||
|
extraProperties: string |
||||
|
siteId: string |
||||
|
beginTime: Date |
||||
|
endTime: Date |
||||
|
available: string |
||||
|
status: string |
||||
|
concurrencyStamp: string |
||||
|
ruleUserId: number |
||||
|
departmentCode: string |
||||
|
} |
||||
|
|
||||
|
// 查询要货预测周期列表
|
||||
|
export const getSupplierCyclePage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/wms/supplier-cycle/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/wms/supplier-cycle/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询要货预测周期详情
|
||||
|
export const getSupplierCycle = async (id: number) => { |
||||
|
return await request.get({ url: `/wms/supplier-cycle/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增要货预测周期
|
||||
|
export const createSupplierCycle = async (data: SupplierCycleVO) => { |
||||
|
return await request.post({ url: `/wms/supplier-cycle/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改要货预测周期
|
||||
|
export const updateSupplierCycle = async (data: SupplierCycleVO) => { |
||||
|
return await request.put({ url: `/wms/supplier-cycle/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除要货预测周期
|
||||
|
export const deleteSupplierCycle = async (id: number) => { |
||||
|
return await request.delete({ url: `/wms/supplier-cycle/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出要货预测周期 Excel
|
||||
|
export const exportSupplierCycle = async (params) => { |
||||
|
return await request.download({ url: `/wms/supplier-cycle/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/wms/supplier-cycle/get-import-template' }) |
||||
|
} |
@ -0,0 +1,105 @@ |
|||||
|
|
||||
|
// 判断传入的值-是否为整数
|
||||
|
function isInteger(obj) { |
||||
|
return Math.floor(obj) === obj |
||||
|
} |
||||
|
|
||||
|
// 将一个浮点数转成整数,返回整数和倍数。如 3.14 >> 314,倍数是 100
|
||||
|
// @param floatNum { number } 小数
|
||||
|
// @return { object }
|
||||
|
// { times: 100, num: 314 }
|
||||
|
|
||||
|
// 用于返回整数和倍数
|
||||
|
function toInteger(floatNum) { |
||||
|
// 声明一个对象用来保存倍数和整数
|
||||
|
const ret = { times: 1, num: 0 } |
||||
|
// 第一种情况:是整数
|
||||
|
if (isInteger(floatNum)) { |
||||
|
// 把整数给 ret中的 num
|
||||
|
ret.num = floatNum |
||||
|
return ret // 最后返回 ret
|
||||
|
} |
||||
|
|
||||
|
// 第二种情况-不是整数,
|
||||
|
const strfi = floatNum + '' // 转为字符串 "0.1"
|
||||
|
const dotPos = strfi.indexOf('.') // 查询小数点
|
||||
|
const len = strfi.substr(dotPos + 1).length; // 获取小数点后的长度
|
||||
|
const times = Math.pow(10, len) // 放大多少倍
|
||||
|
const intNum = Number(floatNum.toString().replace('.', '')) // 返回 转为字符串 截取掉小数点 最后转为数字(整数)
|
||||
|
// 把获取到的倍数和整数存入对象中
|
||||
|
ret.times = times |
||||
|
ret.num = intNum |
||||
|
return ret |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// 核心方法,实现加减乘除运算,确保不丢失精度
|
||||
|
// 思路:把小数放大为整数(乘),进行算术运算,再缩小为小数(除)
|
||||
|
// @param a { number } 运算数1
|
||||
|
// @param b { number } 运算数2
|
||||
|
// @param digits { number } 精度,保留的小数点数,比如 2, 即保留为两位小数
|
||||
|
// @param op { string } 运算类型,有加减乘除(add / subtract / multiply / divide)
|
||||
|
|
||||
|
|
||||
|
|
||||
|
function operation(a, b, digits, op) { |
||||
|
// 获取倍数和整数的对象
|
||||
|
const o1 = toInteger(a) |
||||
|
const o2 = toInteger(b) |
||||
|
// 提取整数
|
||||
|
const n1 = o1.num |
||||
|
const n2 = o2.num |
||||
|
// 提取倍数
|
||||
|
const t1 = o1.times |
||||
|
const t2 = o2.times |
||||
|
|
||||
|
// 获取最大倍数
|
||||
|
const max = t1 > t2 ? t1 : t2 |
||||
|
let result = 0 //
|
||||
|
|
||||
|
switch (op) { |
||||
|
case 'add': |
||||
|
if (t1 === t2) { // 两个小数位数相同
|
||||
|
result = n1 + n2 //
|
||||
|
} else if (t1 > t2) { // o1 小数位 大于 o2
|
||||
|
result = n1 + n2 * (t1 / t2) |
||||
|
} else { // o1 小数位 小于 o2
|
||||
|
result = n1 * (t2 / t1) + n2 |
||||
|
} |
||||
|
return result / max |
||||
|
case 'subtract': |
||||
|
if (t1 === t2) { |
||||
|
result = n1 - n2 |
||||
|
} else if (t1 > t2) { |
||||
|
result = n1 - n2 * (t1 / t2) |
||||
|
} else { |
||||
|
result = n1 * (t2 / t1) - n2 |
||||
|
} |
||||
|
return result / max |
||||
|
case 'multiply': |
||||
|
result = (n1 * n2) / (t1 * t2) |
||||
|
return result |
||||
|
case 'divide': |
||||
|
result = (n1 / n2) * (t2 / t1) |
||||
|
return result |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 加减乘除的四个接口
|
||||
|
export function add(a, b, digits) { |
||||
|
return operation(a, b, digits, 'add') |
||||
|
} |
||||
|
export function subtract(a, b, digits) { |
||||
|
return operation(a, b, digits, 'subtract') |
||||
|
} |
||||
|
export function multiply(a, b, digits) { |
||||
|
return operation(a, b, digits, 'multiply') |
||||
|
} |
||||
|
export function divide(a, b, digits) { |
||||
|
return operation(a, b, digits, 'divide') |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
// console.log(floatObj.add(0.5, 0.2))
|
||||
|
// console.log(floatObj.add(0.12, 0.3))
|
File diff suppressed because it is too large
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue