潘的第一次 commit
This commit is contained in:
142
erp-frontend-vue/src/api/mbom.ts
Normal file
142
erp-frontend-vue/src/api/mbom.ts
Normal file
@@ -0,0 +1,142 @@
|
||||
import request from './request'
|
||||
|
||||
export interface Mbom {
|
||||
mbomId: number
|
||||
mbomCode: string
|
||||
mbomDate: string
|
||||
status: string
|
||||
businessType: string
|
||||
issueStatus?: string
|
||||
planId: number
|
||||
planCode: string
|
||||
salesOrderId?: number
|
||||
salesOrderCode?: string
|
||||
deliveryDate?: string
|
||||
itemId: number
|
||||
itemCode: string
|
||||
itemName: string
|
||||
unitName?: string
|
||||
supplyType?: string
|
||||
quantity: number
|
||||
workshopId?: number
|
||||
workshopName?: string
|
||||
issueDate?: string
|
||||
approverName?: string
|
||||
approveDate?: string
|
||||
remark?: string
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
/** 物料清单明细行 */
|
||||
export interface MbomLine {
|
||||
lineId: number
|
||||
mbomId: number
|
||||
mbomCode?: string
|
||||
lineNo?: number
|
||||
bomLevel?: number
|
||||
itemId: number
|
||||
itemCode: string
|
||||
itemName: string
|
||||
specification?: string
|
||||
unitName?: string
|
||||
baseQty?: number
|
||||
quantity: number
|
||||
lossRate?: number
|
||||
supplyType?: string
|
||||
pickType?: string
|
||||
remark?: string
|
||||
}
|
||||
|
||||
/** 物料清单详情(表头 + 明细行) */
|
||||
export interface MbomDetail extends Mbom {
|
||||
lines?: MbomLine[]
|
||||
}
|
||||
|
||||
export interface MbomQuery {
|
||||
salesOrderCode?: string
|
||||
mbomCode?: string
|
||||
itemCode?: string
|
||||
itemName?: string
|
||||
beginDate?: string
|
||||
endDate?: string
|
||||
status?: string
|
||||
supplyType?: string
|
||||
pageNum?: number
|
||||
pageSize?: number
|
||||
}
|
||||
|
||||
export interface MbomListResponse {
|
||||
rows: Mbom[]
|
||||
total: number
|
||||
}
|
||||
|
||||
// 获取物料清单列表
|
||||
export function getMbomList(params: MbomQuery): Promise<MbomListResponse> {
|
||||
return request.get('/erp/mp/mbom/list', { params }).then((res: any) => {
|
||||
return {
|
||||
rows: res.rows || [],
|
||||
total: res.total || 0
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 获取物料清单详情(含明细行)
|
||||
export function getMbomDetail(mbomId: number): Promise<MbomDetail> {
|
||||
return request.get(`/erp/mp/mbom/${mbomId}`).then((res: any) => {
|
||||
const data = res.data ?? res
|
||||
return data as MbomDetail
|
||||
})
|
||||
}
|
||||
|
||||
// 获取物料清单明细列表
|
||||
export function getMbomLines(mbomId: number): Promise<MbomLine[]> {
|
||||
return request.get(`/erp/mp/mbomline/mbom/${mbomId}`).then((res: any) => {
|
||||
const rows = res.rows ?? res.data ?? []
|
||||
return rows as MbomLine[]
|
||||
})
|
||||
}
|
||||
|
||||
// 更新物料清单明细行
|
||||
export function updateMbomLine(data: Partial<MbomLine>): Promise<void> {
|
||||
return request.put('/erp/mp/mbomline', data)
|
||||
}
|
||||
|
||||
// 新增物料清单
|
||||
export function createMbom(data: Partial<Mbom>): Promise<void> {
|
||||
return request.post('/erp/mp/mbom', data)
|
||||
}
|
||||
|
||||
// 更新物料清单
|
||||
export function updateMbom(data: Partial<Mbom>): Promise<void> {
|
||||
return request.put('/erp/mp/mbom', data)
|
||||
}
|
||||
|
||||
// 删除物料清单
|
||||
export function deleteMbom(mbomIds: string): Promise<void> {
|
||||
return request.delete(`/erp/mp/mbom/${mbomIds}`)
|
||||
}
|
||||
|
||||
// 审核物料清单
|
||||
export function approveMbom(mbomId: number): Promise<void> {
|
||||
return request.put(`/erp/mp/mbom/approve/${mbomId}`)
|
||||
}
|
||||
|
||||
// 反审核物料清单
|
||||
export function unapproveMbom(mbomId: number): Promise<void> {
|
||||
return request.put(`/erp/mp/mbom/unapprove/${mbomId}`)
|
||||
}
|
||||
|
||||
// 下发车间
|
||||
export function issueToWorkshop(mbomId: number, workshopId: number, workshopName: string): Promise<void> {
|
||||
return request.put(`/erp/mp/mbom/issue/${mbomId}/${workshopId}/${workshopName}`)
|
||||
}
|
||||
|
||||
// 撤销下发车间
|
||||
export function revokeIssue(mbomId: number): Promise<void> {
|
||||
return request.put(`/erp/mp/mbom/revoke-issue/${mbomId}`)
|
||||
}
|
||||
|
||||
// BOM运算(从生产计划)
|
||||
export function calcBom(planId: number): Promise<void> {
|
||||
return request.put(`/erp/mp/plan/bom-calculate/${planId}`)
|
||||
}
|
||||
Reference in New Issue
Block a user