freight-web/src/services/receive.ts

129 lines
3.2 KiB
TypeScript
Raw Normal View History

2024-03-04 07:10:11 +00:00
// 存放路径: src/services/home.ts
import type { Result } from '@/types/global'
import { http } from "@/utils/http";
type PageParams = {
pageNumber: number,
pageSize: number,
pricingUserId?: string, // 定价人
userId?: string, // 供应商id
productId?: string, // 产品id
repairFlag?: boolean, // 是否为补单,true 是未补单false是补单
scaleStatus?: number, // 磅单状态:0待定价1待过皮2待审核3已审核待支付4已支付
}
interface ReceiveOrderPage<T> {
total: number,
list: T,
pageNum: number,
pageSize: number
}
type ReceiveOrder = {
id: number,
deviceId: number, // 设备id
deviceName: string, // 设备名称
userId: number, // 用户id
cardId: number, //库存卡id
cardNumber: number, // 库存卡号
userName: string, // 用户名称:关联用户表得到
productId: number, // 品类id
productName: string, // 品类名称:关联品类表得到
imagesId: string,
imageUrls: string,
carNumber: string, // 车牌号
receiptNumber: string, // 收货单号
grossWeight: number, // 毛重
tare: number, // 皮重
grossTime: string, // 过毛日期
tareTime: string, // 过皮日期
netWeight: string, // 净重(净重=净重*1-扣点)-扣杂)
buttonType: string, // 扣杂状态0扣杂1扣点
points: string, // 扣点
buckleMiscellaneous: string, //扣杂
price: string, // 单价
balanceTotalPrice: string, //结算总价
totalPrice: string, //实际总价
weighingMethod: string, //称重方式0有皮重 1零皮重
multiCategory: string, // 多品类0单品类 1多品类
}
// 收库单分页查询
export const getOrderPage = (data: PageParams) => {
return http<ReceiveOrderPage<ReceiveOrder>>({
method: "GET",
url: "/api/orderIn/getOrderPage",
data,
});
};
// 获取收货单集合
export const getList = () => {
return http<Result>({
method: "GET",
url: "/api/orderIn/getList"
});
};
//根据id获取收货单详情
export const getDetailById = (data: {id: number}) => {
return http<Result>({
method: "GET",
url: "/api/orderIn/getOne",
data
});
};
// 新增收货单
export const addOrderIn = (data: any) => {
return http<Result>({
method: "POST",
url: "/api/orderIn/addOrderIn",
data,
});
};
// 批量修改收货单
export const updateOrderIn = (data: any) => {
return http<Result>({
method: "POST",
url: "/api/orderIn/updateOrderIn",
data,
});
};
// 用于过皮和零皮重
export const getTare = (data: any) => {
return http<Result>({
method: "POST",
url: "/api/orderIn/getTare",
data,
});
};
// 用于单个或批量作废收货单
export const deleteOrder = (data: any) => {
return http<Result>({
method: "POST",
url: "/api/orderIn/delete",
data,
});
};
// 统计首页的本月总收获以及总支出
// 收货类型
type ReceiveSummary = {
totalReceipt: number, // 本月总出货
totalExpenditure: number, // 本月总收入
toBePriced: number, // 待收货
toBeTare: number, // 待过皮重
audit: number, // 付款审核
toBePaid: number, // 待支付
}
export const countOrderByMonth = () => {
return http<ReceiveSummary>({
method: "GET",
url: "/api/orderIn/countOrderByMonth"
});
};