gaoluyang
6 小时以前 cb9cd49627b65a4c0e137e08063271a8cefe1826
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
import type { PageParam, PageResult } from '@vben/request';
 
import { requestClient } from '#/api/request';
 
export namespace MesWmMaterialStockApi {
  /** MES 库存台账 */
  export interface MaterialStock {
    id?: number; // 编号
    itemTypeId?: number; // 物料分类编号
    itemId?: number; // 物料编号
    itemCode?: string; // 物料编码
    itemName?: string; // 物料名称
    specification?: string; // 规格型号
    unitMeasureName?: string; // 计量单位名称
    batchId?: number; // 批次编号
    batchCode?: string; // 批次号
    warehouseId?: number; // 仓库编号
    warehouseCode?: string; // 仓库编码
    warehouseName?: string; // 仓库名称
    locationId?: number; // 库区编号
    locationName?: string; // 库区名称
    areaId?: number; // 库位编号
    areaName?: string; // 库位名称
    vendorId?: number; // 供应商编号
    vendorName?: string; // 供应商名称
    quantity?: number; // 在库数量
    frozenQuantity?: number; // 冻结数量
    reservedQuantity?: number; // 占用量
    inTransitQuantity?: number; // 在途量
    availableQuantity?: number; // 可用量
    receiptTime?: string; // 入库日期
    frozen?: boolean; // 是否冻结
    createTime?: Date; // 创建时间
  }
}
 
/** 查询库存台账分页 */
export function getMaterialStockPage(params: PageParam) {
  return requestClient.get<PageResult<MesWmMaterialStockApi.MaterialStock>>(
    '/mes/wm/material-stock/page',
    { params },
  );
}
 
/** 查询库存台账详情 */
export function getMaterialStock(id: number) {
  return requestClient.get<MesWmMaterialStockApi.MaterialStock>(
    `/mes/wm/material-stock/get?id=${id}`,
  );
}
 
/** 更新库存冻结状态 */
export function updateMaterialStockFrozen(data: {
  frozen: boolean;
  id: number;
}) {
  return requestClient.put('/mes/wm/material-stock/update-frozen', data);
}
 
/** 导出库存台账 */
export function exportMaterialStock(params: any) {
  return requestClient.download('/mes/wm/material-stock/export-excel', {
    params,
  });
}
 
/** 库存调整(自定义出入库)- 入库 */
export interface MaterialStockAdjustInParams {
  itemId: number; // 物料ID
  warehouseId: number; // 仓库ID
  locationId: number; // 库区ID
  areaId: number; // 库位ID
  batchId?: number; // 批次ID(选择已有批次时传入)
  batchCode?: string; // 批次号(新建批次时传入)
  produceDate?: string; // 生产日期(新建批次时传入)
  expireDate?: string; // 有效期(新建批次时传入)
  receiptDate?: string; // 入库日期
  vendorId?: number; // 供应商ID
  purchaseOrderCode?: string; // 采购订单号
  lotNumber?: string; // 生产批号
  qualityStatus?: string; // 质量状态
  quantity: number; // 入库数量(必须大于0)
  reason?: string; // 入库原因
}
 
/** 库存调整(自定义出入库)- 出库 */
export interface MaterialStockAdjustOutParams {
  itemId: number; // 物料ID
  warehouseId: number; // 仓库ID
  locationId: number; // 库区ID
  areaId: number; // 库位ID
  batchId?: number; // 批次ID
  batchCode?: string; // 批次号
  vendorId?: number; // 供应商ID
  quantity: number; // 出库数量(必须大于0)
  reason?: string; // 出库原因
}
 
/** 自定义入库 */
export function adjustMaterialStockIn(data: MaterialStockAdjustInParams) {
  return requestClient.post<number>('/mes/wm/material-stock/adjust-in', data);
}
 
/** 自定义出库 */
export function adjustMaterialStockOut(data: MaterialStockAdjustOutParams) {
  return requestClient.post<number>('/mes/wm/material-stock/adjust-out', data);
}
 
/** 库存移库 */
export interface MaterialStockMoveParams {
  materialStockId: number; // 库存记录ID
  toWarehouseId: number; // 目标仓库ID
  toLocationId: number; // 目标库区ID
  toAreaId: number; // 目标库位ID
  quantity: number; // 移库数量
  remark?: string; // 备注
}
 
/** 库存移库 */
export function moveMaterialStock(data: MaterialStockMoveParams) {
  return requestClient.post<boolean>('/mes/wm/material-stock/move', data);
}
 
/** 库存调整(正数=入库,负数=出库)- 旧接口,保留兼容 */
export interface MaterialStockAdjustParams {
  itemId: number; // 物料ID
  warehouseId: number; // 仓库ID
  locationId: number; // 库区ID
  areaId: number; // 库位ID
  batchId?: number; // 批次ID
  batchCode?: string; // 批次号
  vendorId?: number; // 供应商ID
  quantity: number; // 调整数量(正数=入库,负数=出库)
  reason?: string; // 调整原因
}
 
/** 库存调整(正数=入库,负数=出库) - 旧接口,保留兼容 */
export function adjustMaterialStock(data: MaterialStockAdjustParams) {
  return requestClient.post<number>('/mes/wm/material-stock/adjust', data);
}