|
|
@@ -0,0 +1,256 @@
|
|
|
+import request from '@/router/axios'
|
|
|
+
|
|
|
+/**
|
|
|
+ * 库存查询参数类型定义
|
|
|
+ * @typedef {Object} InventoryQueryParams
|
|
|
+ * @property {string|number} [itemId] - 物料ID
|
|
|
+ * @property {string} [itemCode] - 物料编码
|
|
|
+ * @property {string} [itemName] - 物料名称
|
|
|
+ * @property {string} [specs] - 物料规格
|
|
|
+ * @property {string|number} [warehouseId] - 仓库ID
|
|
|
+ * @property {string} [warehouseCode] - 仓库编码
|
|
|
+ * @property {string} [warehouseName] - 仓库名称
|
|
|
+ * @property {string|number} [customerId] - 客户ID
|
|
|
+ * @property {string} [customerCode] - 客户编码
|
|
|
+ */
|
|
|
+
|
|
|
+/**
|
|
|
+ * 库存记录类型定义
|
|
|
+ * @typedef {Object} InventoryRecord
|
|
|
+ * @property {string} id - 库存记录ID
|
|
|
+ * @property {string} itemId - 物料ID
|
|
|
+ * @property {string} itemCode - 物料编码
|
|
|
+ * @property {string} itemName - 物料名称
|
|
|
+ * @property {string} specs - 物料规格
|
|
|
+ * @property {string} unit - 单位
|
|
|
+ * @property {string} warehouseId - 仓库ID
|
|
|
+ * @property {string} warehouseCode - 仓库编码
|
|
|
+ * @property {string} warehouseName - 仓库名称
|
|
|
+ * @property {string} customerId - 客户ID
|
|
|
+ * @property {string} customerCode - 客户编码
|
|
|
+ * @property {string} customerName - 客户名称
|
|
|
+ * @property {string} quantity - 库存数量
|
|
|
+ * @property {string} availableQuantity - 可用数量
|
|
|
+ * @property {string} reservedQuantity - 预留数量
|
|
|
+ * @property {string} lastUpdateTime - 最后更新时间
|
|
|
+ */
|
|
|
+
|
|
|
+/**
|
|
|
+ * 物料档案查询参数类型定义
|
|
|
+ * @typedef {Object} MaterialQueryParams
|
|
|
+ * @property {string} [itemCode] - 物料编码
|
|
|
+ * @property {string} [itemName] - 物料名称
|
|
|
+ * @property {string} [specs] - 物料规格
|
|
|
+ * @property {string} [category] - 物料分类
|
|
|
+ * @property {string} [brand] - 品牌
|
|
|
+ * @property {0|1} [status] - 状态 1-正常 0-禁用
|
|
|
+ */
|
|
|
+
|
|
|
+/**
|
|
|
+ * 物料档案记录类型定义
|
|
|
+ * @typedef {Object} MaterialRecord
|
|
|
+ * @property {string} id - 物料ID
|
|
|
+ * @property {string} createUser - 创建用户ID
|
|
|
+ * @property {string} createDept - 创建部门ID
|
|
|
+ * @property {string} createTime - 创建时间
|
|
|
+ * @property {string} updateUser - 更新用户ID
|
|
|
+ * @property {string} updateTime - 更新时间
|
|
|
+ * @property {0|1} status - 状态 1-正常 0-禁用
|
|
|
+ * @property {0|1} isDeleted - 是否删除 0-未删除 1-已删除
|
|
|
+ * @property {string} itemCode - 物料编码
|
|
|
+ * @property {string} itemName - 物料名称
|
|
|
+ * @property {string} specs - 物料规格
|
|
|
+ * @property {string} unit - 单位
|
|
|
+ * @property {string} category - 物料分类
|
|
|
+ * @property {string} brand - 品牌
|
|
|
+ * @property {string} model - 型号
|
|
|
+ * @property {string} description - 描述
|
|
|
+ * @property {string} unitPrice - 单价
|
|
|
+ * @property {string} remark - 备注
|
|
|
+ */
|
|
|
+
|
|
|
+/**
|
|
|
+ * 销售订单明细查询参数类型定义
|
|
|
+ * @typedef {Object} SalesOrderItemQueryParams
|
|
|
+ * @property {string|number} [orderId] - 订单ID
|
|
|
+ * @property {string} [orderNo] - 订单号
|
|
|
+ * @property {string|number} [itemId] - 物料ID
|
|
|
+ * @property {string} [itemCode] - 物料编码
|
|
|
+ * @property {string} [itemName] - 物料名称
|
|
|
+ * @property {string} [specs] - 物料规格
|
|
|
+ * @property {0|1|2|3} [status] - 状态 0-待确认 1-已确认 2-已发货 3-已完成
|
|
|
+ */
|
|
|
+
|
|
|
+/**
|
|
|
+ * 销售订单明细记录类型定义
|
|
|
+ * @typedef {Object} SalesOrderItemRecord
|
|
|
+ * @property {string} id - 明细ID
|
|
|
+ * @property {string} createUser - 创建用户ID
|
|
|
+ * @property {string} createDept - 创建部门ID
|
|
|
+ * @property {string} createTime - 创建时间
|
|
|
+ * @property {string} updateUser - 更新用户ID
|
|
|
+ * @property {string} updateTime - 更新时间
|
|
|
+ * @property {0|1} status - 状态 1-正常 0-禁用
|
|
|
+ * @property {0|1} isDeleted - 是否删除 0-未删除 1-已删除
|
|
|
+ * @property {string} orderId - 订单ID
|
|
|
+ * @property {string} orderNo - 订单号
|
|
|
+ * @property {string} itemId - 物料ID
|
|
|
+ * @property {string} itemCode - 物料编码
|
|
|
+ * @property {string} itemName - 物料名称
|
|
|
+ * @property {string} specs - 物料规格
|
|
|
+ * @property {string} unit - 单位
|
|
|
+ * @property {string} quantity - 订购数量
|
|
|
+ * @property {string} unitPrice - 单价
|
|
|
+ * @property {string} amount - 金额
|
|
|
+ * @property {string} deliveredQuantity - 已发货数量
|
|
|
+ * @property {string} remainingQuantity - 剩余数量
|
|
|
+ * @property {0|1|2|3} itemStatus - 明细状态
|
|
|
+ * @property {string} deliveryDate - 交货日期
|
|
|
+ * @property {string} remark - 备注
|
|
|
+ */
|
|
|
+
|
|
|
+// 引用公共类型定义
|
|
|
+/**
|
|
|
+ * @typedef {import('../types/common.js').ApiResponse} ApiResponse
|
|
|
+ * @typedef {import('../types/common.js').PageResult} PageResult
|
|
|
+ */
|
|
|
+
|
|
|
+/**
|
|
|
+ * 库存查询(分页)
|
|
|
+ * @param {number} current - 当前页码
|
|
|
+ * @param {number} size - 每页大小
|
|
|
+ * @param {InventoryQueryParams} params - 查询参数
|
|
|
+ * @returns {Promise<AxiosResponse<ApiResponse<PageResult<InventoryRecord>>>>} 分页查询结果
|
|
|
+ */
|
|
|
+export const getInventoryList = async (current, size, params) => {
|
|
|
+ return request({
|
|
|
+ url: '/api/blade-factory/api/factory/salesOrder/whqoh/list',
|
|
|
+ method: 'get',
|
|
|
+ params: {
|
|
|
+ ...params,
|
|
|
+ current,
|
|
|
+ size
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取库存详情
|
|
|
+ * @param {string|number} id - 库存记录ID
|
|
|
+ * @returns {Promise<AxiosResponse<ApiResponse<InventoryRecord>>>} 库存详情
|
|
|
+ */
|
|
|
+export const getInventoryDetail = async (id) => {
|
|
|
+ return request({
|
|
|
+ url: `/api/blade-factory/api/factory/salesOrder/whqoh/${id}`,
|
|
|
+ method: 'get'
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取完整库存列表(不分页)
|
|
|
+ * @param {InventoryQueryParams} params - 查询参数
|
|
|
+ * @returns {Promise<AxiosResponse<ApiResponse<InventoryRecord[]>>>} 库存列表
|
|
|
+ */
|
|
|
+export const getInventoryFullList = async (params) => {
|
|
|
+ return request({
|
|
|
+ url: '/api/blade-factory/api/factory/salesOrder/whqoh/fullList',
|
|
|
+ method: 'get',
|
|
|
+ params
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 物料档案查询(分页)
|
|
|
+ * @param {number} current - 当前页码
|
|
|
+ * @param {number} size - 每页大小
|
|
|
+ * @param {MaterialQueryParams} params - 查询参数
|
|
|
+ * @returns {Promise<AxiosResponse<ApiResponse<PageResult<MaterialRecord>>>>} 分页查询结果
|
|
|
+ */
|
|
|
+export const getMaterialList = async (current, size, params) => {
|
|
|
+ return request({
|
|
|
+ url: '/api/blade-factory/api/factory/salesOrder/item/list',
|
|
|
+ method: 'get',
|
|
|
+ params: {
|
|
|
+ ...params,
|
|
|
+ current,
|
|
|
+ size
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取物料档案详情
|
|
|
+ * @param {string|number} id - 物料ID
|
|
|
+ * @returns {Promise<AxiosResponse<ApiResponse<MaterialRecord>>>} 物料详情
|
|
|
+ */
|
|
|
+export const getMaterialDetail = async (id) => {
|
|
|
+ return request({
|
|
|
+ url: `/api/blade-factory/api/factory/salesOrder/item/${id}`,
|
|
|
+ method: 'get'
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取完整物料档案列表(不分页)
|
|
|
+ * @param {MaterialQueryParams} params - 查询参数
|
|
|
+ * @returns {Promise<AxiosResponse<ApiResponse<MaterialRecord[]>>>} 物料列表
|
|
|
+ */
|
|
|
+export const getMaterialFullList = async (params) => {
|
|
|
+ return request({
|
|
|
+ url: '/api/blade-factory/api/factory/salesOrder/item/fullList',
|
|
|
+ method: 'get',
|
|
|
+ params
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 添加订单明细
|
|
|
+ * @param {SalesOrderItemRecord} row - 订单明细数据
|
|
|
+ * @returns {Promise<AxiosResponse<ApiResponse<boolean>>>} 添加结果
|
|
|
+ */
|
|
|
+export const addOrderItem = async (row) => {
|
|
|
+ return request({
|
|
|
+ url: '/api/blade-factory/api/factory/salesOrder/addOrderItem',
|
|
|
+ method: 'post',
|
|
|
+ data: row
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 更新订单明细
|
|
|
+ * @param {SalesOrderItemRecord} row - 订单明细数据
|
|
|
+ * @returns {Promise<AxiosResponse<ApiResponse<boolean>>>} 更新结果
|
|
|
+ */
|
|
|
+export const updateOrderItem = async (row) => {
|
|
|
+ return request({
|
|
|
+ url: '/api/blade-factory/api/factory/salesOrder/updateOrderItem',
|
|
|
+ method: 'put',
|
|
|
+ data: row
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 更新订单
|
|
|
+ * @param {Object} row - 订单数据
|
|
|
+ * @returns {Promise<AxiosResponse<ApiResponse<boolean>>>} 更新结果
|
|
|
+ */
|
|
|
+export const updateOrder = async (row) => {
|
|
|
+ return request({
|
|
|
+ url: '/api/blade-factory/api/factory/salesOrder/updateOrder',
|
|
|
+ method: 'put',
|
|
|
+ data: row
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 添加订单
|
|
|
+ * @param {Object} row - 订单数据
|
|
|
+ * @returns {Promise<AxiosResponse<ApiResponse<boolean>>>} 添加结果
|
|
|
+ */
|
|
|
+export const addOrder = async (row) => {
|
|
|
+ return request({
|
|
|
+ url: '/api/blade-factory/api/factory/salesOrder/addOrder',
|
|
|
+ method: 'post',
|
|
|
+ data: row
|
|
|
+ })
|
|
|
+}
|