潘的第一次 commit
This commit is contained in:
201
erp-frontend-vue/src/api/masterdata/bom.ts
Normal file
201
erp-frontend-vue/src/api/masterdata/bom.ts
Normal file
@@ -0,0 +1,201 @@
|
||||
import request from '../request'
|
||||
|
||||
/** BOM 表头(md_bom) */
|
||||
export interface BomHeader {
|
||||
bomId?: number
|
||||
bomCode?: string
|
||||
bomName?: string
|
||||
version?: string
|
||||
versionDesc?: string
|
||||
status?: string
|
||||
itemId?: number
|
||||
itemCode?: string
|
||||
itemName?: string
|
||||
itemSpec?: string
|
||||
unitName?: string
|
||||
baseQty?: number
|
||||
enableFlag?: string
|
||||
bomItemId?: number
|
||||
bomItemCode?: string
|
||||
bomItemName?: string
|
||||
bomItemSpec?: string
|
||||
unitOfMeasure?: string
|
||||
itemOrProduct?: string
|
||||
quantity?: number
|
||||
lineNo?: number
|
||||
lossRate?: number
|
||||
supplyType?: string
|
||||
tenantId?: string
|
||||
remark?: string
|
||||
createBy?: string
|
||||
createTime?: string
|
||||
updateBy?: string
|
||||
updateTime?: string
|
||||
}
|
||||
|
||||
/** BOM 明细(md_product_bom) */
|
||||
export interface BomLine {
|
||||
bomId?: number // 明细行ID(现有表主键)
|
||||
bomCode?: string
|
||||
bomName?: string
|
||||
version?: string
|
||||
versionDesc?: string
|
||||
status?: string
|
||||
itemId?: number // 母件物料ID
|
||||
itemCode?: string
|
||||
itemName?: string
|
||||
itemSpec?: string
|
||||
bomItemId?: number
|
||||
bomItemCode?: string
|
||||
bomItemName?: string
|
||||
bomItemSpec?: string
|
||||
unitOfMeasure?: string
|
||||
unitName?: string
|
||||
itemOrProduct?: string
|
||||
quantity?: number
|
||||
baseQty?: number
|
||||
lineNo?: number
|
||||
lossRate?: number
|
||||
supplyType?: string
|
||||
enableFlag?: string
|
||||
tenantId?: string
|
||||
delFlag?: string
|
||||
remark?: string
|
||||
createBy?: string
|
||||
createTime?: string
|
||||
updateBy?: string
|
||||
updateTime?: string
|
||||
/** 扩展字段(后端可忽略/不落库,页面需要透传) */
|
||||
attr1?: string
|
||||
attr2?: string
|
||||
// 详情页表格里用到的前端临时字段(后端可忽略)
|
||||
planRoute?: string
|
||||
usageType?: string
|
||||
drawingNo?: string
|
||||
}
|
||||
|
||||
/** BOM 表头查询参数 */
|
||||
export interface BomHeaderQuery {
|
||||
bomCode?: string
|
||||
bomName?: string
|
||||
itemId?: number
|
||||
itemCode?: string
|
||||
itemName?: string
|
||||
itemOrProduct?: string
|
||||
itemTypeId?: number
|
||||
status?: string
|
||||
enableFlag?: string
|
||||
pageNum?: number
|
||||
pageSize?: number
|
||||
}
|
||||
|
||||
/** BOM 表头列表响应 */
|
||||
export interface BomHeaderListResponse {
|
||||
rows: BomHeader[]
|
||||
total: number
|
||||
}
|
||||
|
||||
/** BOM 明细查询参数 */
|
||||
export interface BomLineQuery {
|
||||
bomCode?: string
|
||||
itemId?: number
|
||||
bomItemCode?: string
|
||||
bomItemName?: string
|
||||
status?: string
|
||||
enableFlag?: string
|
||||
pageNum?: number
|
||||
pageSize?: number
|
||||
}
|
||||
|
||||
/** BOM 明细列表响应 */
|
||||
export interface BomLineListResponse {
|
||||
rows: BomLine[]
|
||||
total: number
|
||||
}
|
||||
|
||||
const BOM_HEADER_BASE = '/mes/md/bom'
|
||||
const BOM_LINE_BASE = '/mes/md/bom/line'
|
||||
|
||||
/** 查询BOM表头列表 */
|
||||
export function listBomHeader(query?: BomHeaderQuery): Promise<BomHeaderListResponse> {
|
||||
return request.get(`${BOM_HEADER_BASE}/list`, { params: query }).then((res: any) => ({
|
||||
rows: res.rows || [],
|
||||
total: res.total || 0
|
||||
}))
|
||||
}
|
||||
|
||||
/** 查询BOM表头详情 */
|
||||
export function getBomHeader(bomId: number): Promise<{ data: BomHeader }> {
|
||||
return request.get(`${BOM_HEADER_BASE}/${bomId}`)
|
||||
}
|
||||
|
||||
/** 新增BOM表头 */
|
||||
export function addBomHeader(data: Partial<BomHeader>): Promise<{ data: BomHeader }> {
|
||||
return request.post(BOM_HEADER_BASE, data)
|
||||
}
|
||||
|
||||
/** 修改BOM表头 */
|
||||
export function updateBomHeader(data: Partial<BomHeader>): Promise<{ data: BomHeader }> {
|
||||
return request.put(BOM_HEADER_BASE, data)
|
||||
}
|
||||
|
||||
/** 删除BOM表头 */
|
||||
export function delBomHeader(bomId: number | number[]): Promise<void> {
|
||||
const ids = Array.isArray(bomId) ? bomId.join(',') : String(bomId)
|
||||
return request.delete(`${BOM_HEADER_BASE}/${ids}`)
|
||||
}
|
||||
|
||||
/** 查询BOM明细列表 */
|
||||
export function listBomLine(query?: BomLineQuery): Promise<BomLineListResponse> {
|
||||
return request.get(`${BOM_LINE_BASE}/list`, { params: query }).then((res: any) => ({
|
||||
rows: res.rows || [],
|
||||
total: res.total || 0
|
||||
}))
|
||||
}
|
||||
|
||||
/** 查询BOM明细详情 */
|
||||
export function getBomLine(lineId: number): Promise<{ data: BomLine }> {
|
||||
return request.get(`${BOM_LINE_BASE}/${lineId}`)
|
||||
}
|
||||
|
||||
/** 新增BOM明细 */
|
||||
export function addBomLine(data: Partial<BomLine>): Promise<{ data: BomLine }> {
|
||||
return request.post(BOM_LINE_BASE, data)
|
||||
}
|
||||
|
||||
/** 修改BOM明细 */
|
||||
export function updateBomLine(data: Partial<BomLine>): Promise<{ data: BomLine }> {
|
||||
return request.put(BOM_LINE_BASE, data)
|
||||
}
|
||||
|
||||
/** 删除BOM明细 */
|
||||
export function delBomLine(lineId: number | number[]): Promise<void> {
|
||||
const ids = Array.isArray(lineId) ? lineId.join(',') : String(lineId)
|
||||
return request.delete(`${BOM_LINE_BASE}/${ids}`)
|
||||
}
|
||||
|
||||
// -----------------------------
|
||||
// 兼容旧命名(当前BOM页面仍在使用)
|
||||
// -----------------------------
|
||||
export type ProductBom = BomHeader
|
||||
export type ProductBomQuery = BomHeaderQuery
|
||||
export type ProductBomListResponse = BomHeaderListResponse
|
||||
export const listProductBom = listBomHeader
|
||||
export const getProductBom = getBomHeader
|
||||
export const addProductBom = addBomHeader
|
||||
export const updateProductBom = updateBomHeader
|
||||
export const delProductBom = delBomHeader
|
||||
|
||||
/** BOM状态选项 */
|
||||
export const bomStatusOptions = [
|
||||
{ value: 'DRAFT', label: '草稿' },
|
||||
{ value: 'APPROVED', label: '已审核' },
|
||||
{ value: 'OBSOLETE', label: '已废弃' }
|
||||
]
|
||||
|
||||
/** 供应方式选项 */
|
||||
export const supplyTypeOptions = [
|
||||
{ value: 'PURCHASE', label: '采购' },
|
||||
{ value: 'PRODUCE', label: '自制' },
|
||||
{ value: 'OUTSOURCE', label: '委外' }
|
||||
]
|
||||
70
erp-frontend-vue/src/api/masterdata/item.ts
Normal file
70
erp-frontend-vue/src/api/masterdata/item.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import request from '../request'
|
||||
|
||||
export interface MdItem {
|
||||
itemId?: number
|
||||
itemCode?: string
|
||||
itemName?: string
|
||||
specification?: string
|
||||
unitOfMeasure?: string
|
||||
unitName?: string
|
||||
itemTypeId?: number
|
||||
itemTypeName?: string
|
||||
itemOrProduct?: string
|
||||
enableFlag?: string
|
||||
safeStockFlag?: string
|
||||
minStock?: number
|
||||
maxStock?: number
|
||||
batchFlag?: string
|
||||
highValue?: string
|
||||
remark?: string
|
||||
createBy?: string
|
||||
createTime?: string
|
||||
updateBy?: string
|
||||
updateTime?: string
|
||||
}
|
||||
|
||||
export interface MdItemQuery {
|
||||
itemCode?: string
|
||||
itemName?: string
|
||||
itemTypeId?: number
|
||||
itemOrProduct?: string
|
||||
enableFlag?: string
|
||||
pageNum?: number
|
||||
pageSize?: number
|
||||
}
|
||||
|
||||
export interface MdItemListResponse {
|
||||
rows: MdItem[]
|
||||
total: number
|
||||
}
|
||||
|
||||
const BASE = '/mes/md/mditem'
|
||||
|
||||
/** 查询物料列表 */
|
||||
export function listMdItem(query?: MdItemQuery): Promise<MdItemListResponse> {
|
||||
return request.get(`${BASE}/list`, { params: query }).then((res: any) => ({
|
||||
rows: res.rows || [],
|
||||
total: res.total || 0
|
||||
}))
|
||||
}
|
||||
|
||||
/** 查询物料详细 */
|
||||
export function getMdItem(itemId: number): Promise<{ data: MdItem }> {
|
||||
return request.get(`${BASE}/${itemId}`)
|
||||
}
|
||||
|
||||
/** 新增物料 */
|
||||
export function addMdItem(data: Partial<MdItem>): Promise<{ data: MdItem }> {
|
||||
return request.post(BASE, data)
|
||||
}
|
||||
|
||||
/** 修改物料 */
|
||||
export function updateMdItem(data: Partial<MdItem>): Promise<{ data: MdItem }> {
|
||||
return request.put(BASE, data)
|
||||
}
|
||||
|
||||
/** 删除物料 */
|
||||
export function delMdItem(itemId: number | number[]): Promise<void> {
|
||||
const ids = Array.isArray(itemId) ? itemId.join(',') : String(itemId)
|
||||
return request.delete(`${BASE}/${ids}`)
|
||||
}
|
||||
79
erp-frontend-vue/src/api/masterdata/itemtype.ts
Normal file
79
erp-frontend-vue/src/api/masterdata/itemtype.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
import request from '../request'
|
||||
|
||||
export interface ItemType {
|
||||
itemTypeId?: number
|
||||
parentTypeId?: number
|
||||
itemTypeCode?: string
|
||||
itemTypeName?: string
|
||||
orderNum?: number
|
||||
enableFlag?: string
|
||||
itemOrProduct?: string
|
||||
remark?: string
|
||||
createBy?: string
|
||||
createTime?: string
|
||||
updateBy?: string
|
||||
updateTime?: string
|
||||
children?: ItemType[]
|
||||
}
|
||||
|
||||
export interface ItemTypeQuery {
|
||||
itemTypeCode?: string
|
||||
itemTypeName?: string
|
||||
enableFlag?: string
|
||||
}
|
||||
|
||||
const BASE = '/mes/md/itemtype'
|
||||
|
||||
/** 查询物料分类列表 */
|
||||
export function listItemType(query?: ItemTypeQuery): Promise<{ data: ItemType[] }> {
|
||||
return request.get(`${BASE}/list`, { params: query })
|
||||
}
|
||||
|
||||
/** 查询物料分类下拉树结构 */
|
||||
export function getItemTypeTreeselect(): Promise<{ data: any[] }> {
|
||||
return request.get(`${BASE}/treeselect`)
|
||||
}
|
||||
|
||||
/** 查询物料分类详细 */
|
||||
export function getItemType(itemTypeId: number): Promise<{ data: ItemType }> {
|
||||
return request.get(`${BASE}/${itemTypeId}`)
|
||||
}
|
||||
|
||||
/** 新增物料分类 */
|
||||
export function addItemType(data: Partial<ItemType>): Promise<void> {
|
||||
return request.post(BASE, data)
|
||||
}
|
||||
|
||||
/** 修改物料分类 */
|
||||
export function updateItemType(data: Partial<ItemType>): Promise<void> {
|
||||
return request.put(BASE, data)
|
||||
}
|
||||
|
||||
/** 删除物料分类 */
|
||||
export function delItemType(itemTypeId: number): Promise<void> {
|
||||
return request.delete(`${BASE}/${itemTypeId}`)
|
||||
}
|
||||
|
||||
/** 构建分类树 */
|
||||
export function handleTree(data: ItemType[], idField = 'itemTypeId', parentField = 'parentTypeId'): ItemType[] {
|
||||
const map = new Map<number, ItemType>()
|
||||
const result: ItemType[] = []
|
||||
|
||||
data.forEach(item => {
|
||||
map.set(item[idField as keyof ItemType] as number, { ...item, children: [] })
|
||||
})
|
||||
|
||||
data.forEach(item => {
|
||||
const current = map.get(item[idField as keyof ItemType] as number)!
|
||||
const parentId = item[parentField as keyof ItemType] as number
|
||||
if (parentId && map.has(parentId)) {
|
||||
const parent = map.get(parentId)!
|
||||
parent.children = parent.children || []
|
||||
parent.children.push(current)
|
||||
} else {
|
||||
result.push(current)
|
||||
}
|
||||
})
|
||||
|
||||
return result
|
||||
}
|
||||
65
erp-frontend-vue/src/api/masterdata/unit.ts
Normal file
65
erp-frontend-vue/src/api/masterdata/unit.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
import request from '../request'
|
||||
|
||||
export interface UnitMeasure {
|
||||
measureId?: number
|
||||
measureCode?: string
|
||||
measureName?: string
|
||||
primaryFlag?: string
|
||||
primaryId?: number
|
||||
changeRate?: number
|
||||
enableFlag?: string
|
||||
remark?: string
|
||||
createBy?: string
|
||||
createTime?: string
|
||||
updateBy?: string
|
||||
updateTime?: string
|
||||
}
|
||||
|
||||
export interface UnitMeasureQuery {
|
||||
measureCode?: string
|
||||
measureName?: string
|
||||
enableFlag?: string
|
||||
pageNum?: number
|
||||
pageSize?: number
|
||||
}
|
||||
|
||||
export interface UnitMeasureListResponse {
|
||||
rows: UnitMeasure[]
|
||||
total: number
|
||||
}
|
||||
|
||||
const BASE = '/mes/md/unitmeasure'
|
||||
|
||||
/** 查询计量单位列表 */
|
||||
export function listUnitMeasure(query?: UnitMeasureQuery): Promise<UnitMeasureListResponse> {
|
||||
return request.get(`${BASE}/list`, { params: query }).then((res: any) => ({
|
||||
rows: res.rows || [],
|
||||
total: res.total || 0
|
||||
}))
|
||||
}
|
||||
|
||||
/** 查询所有计量单位(不分页) */
|
||||
export function listAllUnitMeasure(): Promise<{ data: UnitMeasure[] }> {
|
||||
return request.get(`${BASE}/selectall`)
|
||||
}
|
||||
|
||||
/** 查询计量单位详细 */
|
||||
export function getUnitMeasure(measureId: number): Promise<{ data: UnitMeasure }> {
|
||||
return request.get(`${BASE}/${measureId}`)
|
||||
}
|
||||
|
||||
/** 新增计量单位 */
|
||||
export function addUnitMeasure(data: Partial<UnitMeasure>): Promise<void> {
|
||||
return request.post(BASE, data)
|
||||
}
|
||||
|
||||
/** 修改计量单位 */
|
||||
export function updateUnitMeasure(data: Partial<UnitMeasure>): Promise<void> {
|
||||
return request.put(BASE, data)
|
||||
}
|
||||
|
||||
/** 删除计量单位 */
|
||||
export function delUnitMeasure(measureId: number | number[]): Promise<void> {
|
||||
const ids = Array.isArray(measureId) ? measureId.join(',') : String(measureId)
|
||||
return request.delete(`${BASE}/${ids}`)
|
||||
}
|
||||
64
erp-frontend-vue/src/api/masterdata/workshop.ts
Normal file
64
erp-frontend-vue/src/api/masterdata/workshop.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
import request from '../request'
|
||||
|
||||
export interface Workshop {
|
||||
workshopId?: number
|
||||
workshopCode?: string
|
||||
workshopName?: string
|
||||
area?: string
|
||||
charge?: string
|
||||
enableFlag?: string
|
||||
remark?: string
|
||||
createBy?: string
|
||||
createTime?: string
|
||||
updateBy?: string
|
||||
updateTime?: string
|
||||
}
|
||||
|
||||
export interface WorkshopQuery {
|
||||
workshopCode?: string
|
||||
workshopName?: string
|
||||
enableFlag?: string
|
||||
pageNum?: number
|
||||
pageSize?: number
|
||||
}
|
||||
|
||||
export interface WorkshopListResponse {
|
||||
rows: Workshop[]
|
||||
total: number
|
||||
}
|
||||
|
||||
const BASE = '/mes/md/workshop'
|
||||
|
||||
/** 查询车间列表 */
|
||||
export function listWorkshop(query?: WorkshopQuery): Promise<WorkshopListResponse> {
|
||||
return request.get(`${BASE}/list`, { params: query }).then((res: any) => ({
|
||||
rows: res.rows || [],
|
||||
total: res.total || 0
|
||||
}))
|
||||
}
|
||||
|
||||
/** 查询所有车间(不分页) */
|
||||
export function listAllWorkshop(): Promise<{ data: Workshop[] }> {
|
||||
return request.get(`${BASE}/listAll`)
|
||||
}
|
||||
|
||||
/** 查询车间详细 */
|
||||
export function getWorkshop(workshopId: number): Promise<{ data: Workshop }> {
|
||||
return request.get(`${BASE}/${workshopId}`)
|
||||
}
|
||||
|
||||
/** 新增车间 */
|
||||
export function addWorkshop(data: Partial<Workshop>): Promise<void> {
|
||||
return request.post(BASE, data)
|
||||
}
|
||||
|
||||
/** 修改车间 */
|
||||
export function updateWorkshop(data: Partial<Workshop>): Promise<void> {
|
||||
return request.put(BASE, data)
|
||||
}
|
||||
|
||||
/** 删除车间 */
|
||||
export function delWorkshop(workshopId: number | number[]): Promise<void> {
|
||||
const ids = Array.isArray(workshopId) ? workshopId.join(',') : String(workshopId)
|
||||
return request.delete(`${BASE}/${ids}`)
|
||||
}
|
||||
68
erp-frontend-vue/src/api/masterdata/workstation.ts
Normal file
68
erp-frontend-vue/src/api/masterdata/workstation.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
import request from '../request'
|
||||
|
||||
export interface Workstation {
|
||||
workstationId?: number
|
||||
workstationCode?: string
|
||||
workstationName?: string
|
||||
workstationAddress?: string
|
||||
workshopId?: number
|
||||
workshopName?: string
|
||||
processId?: number
|
||||
processName?: string
|
||||
enableFlag?: string
|
||||
remark?: string
|
||||
createBy?: string
|
||||
createTime?: string
|
||||
updateBy?: string
|
||||
updateTime?: string
|
||||
}
|
||||
|
||||
export interface WorkstationQuery {
|
||||
workstationCode?: string
|
||||
workstationName?: string
|
||||
workshopId?: number
|
||||
enableFlag?: string
|
||||
pageNum?: number
|
||||
pageSize?: number
|
||||
}
|
||||
|
||||
export interface WorkstationListResponse {
|
||||
rows: Workstation[]
|
||||
total: number
|
||||
}
|
||||
|
||||
const BASE = '/mes/md/workstation'
|
||||
|
||||
/** 查询工作站列表 */
|
||||
export function listWorkstation(query?: WorkstationQuery): Promise<WorkstationListResponse> {
|
||||
return request.get(`${BASE}/list`, { params: query }).then((res: any) => ({
|
||||
rows: res.rows || [],
|
||||
total: res.total || 0
|
||||
}))
|
||||
}
|
||||
|
||||
/** 查询所有工作站(不分页) */
|
||||
export function listAllWorkstation(): Promise<{ data: Workstation[] }> {
|
||||
return request.get(`${BASE}/listAll`)
|
||||
}
|
||||
|
||||
/** 查询工作站详细 */
|
||||
export function getWorkstation(workstationId: number): Promise<{ data: Workstation }> {
|
||||
return request.get(`${BASE}/${workstationId}`)
|
||||
}
|
||||
|
||||
/** 新增工作站 */
|
||||
export function addWorkstation(data: Partial<Workstation>): Promise<void> {
|
||||
return request.post(BASE, data)
|
||||
}
|
||||
|
||||
/** 修改工作站 */
|
||||
export function updateWorkstation(data: Partial<Workstation>): Promise<void> {
|
||||
return request.put(BASE, data)
|
||||
}
|
||||
|
||||
/** 删除工作站 */
|
||||
export function delWorkstation(workstationId: number | number[]): Promise<void> {
|
||||
const ids = Array.isArray(workstationId) ? workstationId.join(',') : String(workstationId)
|
||||
return request.delete(`${BASE}/${ids}`)
|
||||
}
|
||||
Reference in New Issue
Block a user