Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | 1x 2x 1x 1x 1x 1x 1x 1x 1x 2x 1x 1x 1x 1x 1x 2x 1x 1x | import { http } from "@/utils/http";
import type { BaseResponse } from "./base";
// ============ 类型定义 ============
/** 提货明细项 */
export type DeliveryDetail = {
id: string;
outboundNumber: string; // 出库单号
deliveryOrderNumber: string; // 提货委托单号
blNumber: string; // 提单号
licensePlate: string; // 车牌号
driverName: string; // 司机姓名
driverPhone: string; // 司机电话
commodity: string; // 商品品类
commodityCode: string; // 商品编码
batchNumber: string; // 批次号
quantity: number; // 出库数量
unit: string; // 单位
unitPrice: number; // 单价
totalAmount: number; // 总金额
outboundDate: string; // 出库日期
outboundTime: string; // 出库时间
warehouse: string; // 仓库
location: string; // 库位
operator: string; // 操作员
outboundStatus: "pending" | "in_progress" | "completed" | "cancelled"; // 出库状态
receiptStatus: "pending" | "partial" | "completed" | "discrepancy"; // 收货状态
receivedQuantity: number; // 已收货数量
receiptDate: string; // 收货日期
receiver: string; // 收货人
remark?: string; // 备注
createTime: string; // 创建时间
updateTime: string; // 更新时间
};
/** 出库单表单数据 */
export type OutboundOrderFormData = {
deliveryOrderNumber: string; // 提货委托单号
blNumber: string; // 提单号
licensePlate: string; // 车牌号
driverName: string; // 司机姓名
driverPhone: string; // 司机电话
items: OutboundItem[]; // 出库明细项
outboundDate: string; // 出库日期
warehouse: string; // 仓库
operator: string; // 操作员
remark?: string; // 备注
};
/** 出库明细项 */
export type OutboundItem = {
commodity: string; // 商品品类
commodityCode?: string; // 商品编码
batchNumber?: string; // 批次号
quantity: number; // 数量
unit: string; // 单位
unitPrice: number; // 单价
location?: string; // 库位
remark?: string; // 备注
};
/** 收货确认表单数据 */
export type ReceiptConfirmFormData = {
receiptDate: string; // 收货日期
receivedQuantity: number; // 实收数量
receiver: string; // 收货人
discrepancyReason?: string; // 差异原因
remark?: string; // 备注
};
/** 收货历史记录 */
export type ReceiptHistory = {
id: string;
deliveryDetailId: string;
receiptDate: string;
receivedQuantity: number;
receiver: string;
remark?: string;
createTime: string;
};
/** API基础响应 */
/** 提货明细列表响应 */
export type DeliveryDetailsResponse = BaseResponse<{
items: DeliveryDetail[];
total: number;
page: number;
pageSize: number;
}>;
/** 提货明细详情响应 */
export type DeliveryDetailResponse = BaseResponse<DeliveryDetail>;
/** 创建出库单响应 */
export type CreateOutboundOrderResponse = BaseResponse<{
items: DeliveryDetail[];
count: number;
}>;
/** 更新出库单响应 */
export type UpdateOutboundOrderResponse = BaseResponse<DeliveryDetail>;
/** 收货确认响应 */
export type ConfirmReceiptResponse = BaseResponse<{
deliveryDetail: DeliveryDetail;
receiptRecord: ReceiptHistory;
}>;
/** 收货历史响应 */
export type ReceiptHistoryResponse = BaseResponse<ReceiptHistory[]>;
/** 下载模板响应 */
export type DownloadTemplateResponse = BaseResponse<{
fileName: string;
url: string;
}>;
/** 导出数据响应 */
export type ExportDataResponse = BaseResponse<{
fileName: string;
url: string;
}>;
/** 打印提货单响应 */
export type PrintDeliveryOrderResponse = BaseResponse<{
fileName: string;
url: string;
}>;
// ============ API函数 ============
/** 获取提货明细列表 */
export const getDeliveryDetails = (params?: {
page?: number;
pageSize?: number;
outboundNumber?: string;
deliveryOrderNumber?: string;
blNumber?: string;
licensePlate?: string;
commodity?: string;
outboundStatus?: string;
receiptStatus?: string;
startDate?: string;
endDate?: string;
}) => {
return http.request<DeliveryDetailsResponse>(
"get",
"/api/delivery-details/list",
{ params }
);
};
/** 获取提货明细详情 */
export const getDeliveryDetail = (id: string) => {
return http.request<DeliveryDetailResponse>(
"get",
`/api/delivery-details/detail/${id}`
);
};
/** 新增出库单 */
export const createOutboundOrder = (data: OutboundOrderFormData) => {
return http.request<CreateOutboundOrderResponse>(
"post",
"/api/delivery-details/create",
{ data }
);
};
/** 更新出库单 */
export const updateOutboundOrder = (
id: string,
data: Partial<OutboundOrderFormData>
) => {
return http.request<UpdateOutboundOrderResponse>(
"put",
`/api/delivery-details/update/${id}`,
{ data }
);
};
/** 收货确认 */
export const confirmReceipt = (id: string, data: ReceiptConfirmFormData) => {
return http.request<ConfirmReceiptResponse>(
"put",
`/api/delivery-details/confirm-receipt/${id}`,
{ data }
);
};
/** 获取收货历史记录 */
export const getReceiptHistory = (id: string) => {
return http.request<ReceiptHistoryResponse>(
"get",
`/api/delivery-details/receipt-history/${id}`
);
};
/** 下载出库单模板 */
export const getOutboundOrderTemplate = () => {
return http.request<DownloadTemplateResponse>(
"get",
"/api/delivery-details/template/download"
);
};
/** 导出提货明细 */
export const exportDeliveryDetails = (params?: {
outboundNumber?: string;
deliveryOrderNumber?: string;
blNumber?: string;
licensePlate?: string;
commodity?: string;
outboundStatus?: string;
receiptStatus?: string;
startDate?: string;
endDate?: string;
}) => {
return http.request<ExportDataResponse>("get", "/api/delivery-details/export", {
params
});
};
/** 打印提货单 */
export const printDeliveryOrder = (id: string) => {
return http.request<PrintDeliveryOrderResponse>(
"get",
`/api/delivery-details/print/${id}`
);
};
|