chore(mobile-h5): add existing H5 app sources to the monorepo
Track the weighbridge mobile-h5 codebase (excluding node_modules, dist, and local .env) so subsequent adaptation tasks can evolve it in-repo. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
f8f9c0ceff
commit
a4b13fa2bc
91 files changed
+15791
No files matched your search
@@ -0,0 +1,45 @@
|
||||
import request from '@/utils/http'
|
||||
import { PaginationResult, BaseResult } from '@/types/axios'
|
||||
import { ArticleType, ArticleCategoryType } from './model/articleModel'
|
||||
|
||||
// 文章
|
||||
export class ArticleService {
|
||||
// 获取文章列表
|
||||
static getArticleList(params: any) {
|
||||
const { page, size, searchVal, year } = params
|
||||
return request.get<PaginationResult<ArticleType[]>>({
|
||||
url: `/api/articles/${page}/${size}?title=${searchVal}&year=${year}`
|
||||
})
|
||||
}
|
||||
|
||||
// 获取文章类型
|
||||
static getArticleTypes(params: object) {
|
||||
return request.get<BaseResult<ArticleCategoryType[]>>({
|
||||
url: '/api/articles/types',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 获取文章详情
|
||||
static getArticleDetail(id: number) {
|
||||
return request.get<BaseResult<ArticleType>>({
|
||||
url: `/api/articles/${id}`
|
||||
})
|
||||
}
|
||||
|
||||
// 新增文章
|
||||
static addArticle(params: any) {
|
||||
return request.post<BaseResult>({
|
||||
url: '/api/articles/',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
// 编辑文章
|
||||
static editArticle(id: number, params: any) {
|
||||
return request.put<BaseResult>({
|
||||
url: `/api/articles/${id}`,
|
||||
data: params
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import api from '@/utils/http'
|
||||
|
||||
// ==================== 仪表盘 API ====================
|
||||
|
||||
export interface DashboardCargoStat {
|
||||
label: string
|
||||
planned: number
|
||||
actual: number
|
||||
}
|
||||
|
||||
export interface DashboardPartnerCargoStat {
|
||||
label: string
|
||||
planned: number
|
||||
actual: number
|
||||
}
|
||||
|
||||
export const dashboardApi = {
|
||||
// 获取今日入库量按货物统计
|
||||
getInboundByCargo: async (): Promise<DashboardCargoStat[]> => {
|
||||
return api.get<DashboardCargoStat[]>({
|
||||
url: '/dashboard/inbound/by-cargo'
|
||||
})
|
||||
},
|
||||
|
||||
// 获取今日入库量按往来单位+货物统计
|
||||
getInboundByPartnerCargo: async (): Promise<DashboardPartnerCargoStat[]> => {
|
||||
return api.get<DashboardPartnerCargoStat[]>({
|
||||
url: '/dashboard/inbound/by-partner-cargo'
|
||||
})
|
||||
},
|
||||
|
||||
// 获取今日出库量按货物统计
|
||||
getOutboundByCargo: async (): Promise<DashboardCargoStat[]> => {
|
||||
return api.get<DashboardCargoStat[]>({
|
||||
url: '/dashboard/outbound/by-cargo'
|
||||
})
|
||||
},
|
||||
|
||||
// 获取今日出库量按往来单位+货物统计
|
||||
getOutboundByPartnerCargo: async (): Promise<DashboardPartnerCargoStat[]> => {
|
||||
return api.get<DashboardPartnerCargoStat[]>({
|
||||
url: '/dashboard/outbound/by-partner-cargo'
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
import api from '@/utils/http'
|
||||
import type { Plan } from './plansApi'
|
||||
import type { WeighingRecord } from './weighingApi'
|
||||
|
||||
// ==================== 出入库管理 API ====================
|
||||
|
||||
export interface InventoryRecord {
|
||||
id: number
|
||||
date: string
|
||||
partnerCompany: string
|
||||
businessType: '入库' | '出库'
|
||||
product: string
|
||||
quantity: number
|
||||
planNo?: string
|
||||
batchNo?: string
|
||||
vehicleNo: string
|
||||
status?: string
|
||||
remarks?: string
|
||||
purchasePlanId?: number
|
||||
isDeleted: number
|
||||
createdAt: string
|
||||
grossWeight?: number // 毛重(kg)- 汇总自关联地磅单
|
||||
tareWeight?: number // 皮重(kg)- 汇总自关联地磅单
|
||||
deduction?: number // 扣杂(kg)- 汇总自关联地磅单
|
||||
netWeight?: number // 净重(kg)- 汇总自关联地磅单
|
||||
grossWeightTime?: string // 毛重时间 - 来自关联地磅单
|
||||
tareWeightTime?: string // 皮重时间 - 来自关联地磅单
|
||||
hasWeighingSlip?: boolean // 是否已有关联的地磅单
|
||||
}
|
||||
|
||||
export interface InventoryCreate {
|
||||
date: string
|
||||
partnerCompany: string
|
||||
businessType: '入库' | '出库'
|
||||
product: string
|
||||
quantity: number
|
||||
planNo?: string
|
||||
batchNo?: string
|
||||
vehicleNo: string
|
||||
status?: string
|
||||
remarks?: string
|
||||
purchasePlanId?: number
|
||||
}
|
||||
|
||||
export interface InventoryUpdate {
|
||||
date?: string
|
||||
partnerCompany?: string
|
||||
businessType?: '入库' | '出库'
|
||||
product?: string
|
||||
quantity?: number
|
||||
planNo?: string
|
||||
batchNo?: string
|
||||
vehicleNo?: string
|
||||
status?: string
|
||||
remarks?: string | null
|
||||
purchasePlanId?: number
|
||||
}
|
||||
|
||||
export interface InventoryRelatedData {
|
||||
plan: Plan | null
|
||||
weighing: WeighingRecord | null
|
||||
}
|
||||
|
||||
export const inventoryApi = {
|
||||
list: async (params?: {
|
||||
q?: string
|
||||
dateFrom?: string
|
||||
dateTo?: string
|
||||
status?: string
|
||||
businessType?: '入库' | '出库'
|
||||
}): Promise<InventoryRecord[]> => {
|
||||
return api.get<InventoryRecord[]>({
|
||||
url: '/inventory',
|
||||
params,
|
||||
timeout: 60000 // 列表可能数据较多,60 秒超时避免被取消
|
||||
})
|
||||
},
|
||||
get: async (id: number): Promise<InventoryRecord> => {
|
||||
return api.get<InventoryRecord>({
|
||||
url: `/inventory/${id}`
|
||||
})
|
||||
},
|
||||
getRelated: async (id: number): Promise<InventoryRelatedData> => {
|
||||
return api.get<InventoryRelatedData>({
|
||||
url: `/inventory/${id}/related`
|
||||
})
|
||||
},
|
||||
create: async (payload: InventoryCreate): Promise<InventoryRecord> => {
|
||||
return api.post<InventoryRecord>({
|
||||
url: '/inventory',
|
||||
data: payload
|
||||
})
|
||||
},
|
||||
update: async (id: number, payload: InventoryUpdate): Promise<InventoryRecord> => {
|
||||
return api.patch<InventoryRecord>({
|
||||
url: `/inventory/${id}`,
|
||||
data: payload
|
||||
})
|
||||
},
|
||||
delete: async (id: number): Promise<void> => {
|
||||
return api.del({
|
||||
url: `/inventory/${id}`
|
||||
})
|
||||
},
|
||||
createLinkForPlan: async (purchasePlanId: number, remarks?: string): Promise<InventoryRecord> => {
|
||||
return api.post<InventoryRecord>({
|
||||
url: '/inventory/create-link-for-plan',
|
||||
data: { purchasePlanId, remarks }
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
import api from '@/utils/http'
|
||||
|
||||
// ==================== 公司(往来单位)API ====================
|
||||
|
||||
export interface Company {
|
||||
id: number
|
||||
name: string
|
||||
remarks?: string | null
|
||||
}
|
||||
|
||||
export interface CompanyCreate {
|
||||
name: string
|
||||
remarks?: string | null
|
||||
}
|
||||
|
||||
export interface CompanyUpdate {
|
||||
name?: string
|
||||
remarks?: string | null
|
||||
}
|
||||
|
||||
export const companyApi = {
|
||||
list: async (q?: string): Promise<Company[]> => {
|
||||
return api.get<Company[]>({
|
||||
url: '/master-data/companies',
|
||||
params: q ? { q } : undefined
|
||||
})
|
||||
},
|
||||
get: async (id: number): Promise<Company> => {
|
||||
return api.get<Company>({
|
||||
url: `/master-data/companies/${id}`
|
||||
})
|
||||
},
|
||||
create: async (payload: CompanyCreate): Promise<Company> => {
|
||||
return api.post<Company>({
|
||||
url: '/master-data/companies',
|
||||
data: payload
|
||||
})
|
||||
},
|
||||
update: async (id: number, payload: CompanyUpdate): Promise<Company> => {
|
||||
return api.put<Company>({
|
||||
url: `/master-data/companies/${id}`,
|
||||
data: payload
|
||||
})
|
||||
},
|
||||
delete: async (id: number): Promise<void> => {
|
||||
return api.del({
|
||||
url: `/master-data/companies/${id}`
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== 货物(产品)API ====================
|
||||
|
||||
export interface Cargo {
|
||||
id: number
|
||||
name: string
|
||||
remarks?: string | null
|
||||
}
|
||||
|
||||
export interface CargoCreate {
|
||||
name: string
|
||||
remarks?: string | null
|
||||
}
|
||||
|
||||
export interface CargoUpdate {
|
||||
name?: string
|
||||
remarks?: string | null
|
||||
}
|
||||
|
||||
export const cargoApi = {
|
||||
list: async (q?: string): Promise<Cargo[]> => {
|
||||
return api.get<Cargo[]>({
|
||||
url: '/master-data/cargos',
|
||||
params: q ? { q } : undefined
|
||||
})
|
||||
},
|
||||
get: async (id: number): Promise<Cargo> => {
|
||||
return api.get<Cargo>({
|
||||
url: `/master-data/cargos/${id}`
|
||||
})
|
||||
},
|
||||
create: async (payload: CargoCreate): Promise<Cargo> => {
|
||||
return api.post<Cargo>({
|
||||
url: '/master-data/cargos',
|
||||
data: payload
|
||||
})
|
||||
},
|
||||
update: async (id: number, payload: CargoUpdate): Promise<Cargo> => {
|
||||
return api.put<Cargo>({
|
||||
url: `/master-data/cargos/${id}`,
|
||||
data: payload
|
||||
})
|
||||
},
|
||||
delete: async (id: number): Promise<void> => {
|
||||
return api.del({
|
||||
url: `/master-data/cargos/${id}`
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== 车牌号 API ====================
|
||||
|
||||
export interface Vehicle {
|
||||
id: number
|
||||
vehicleNo: string
|
||||
remarks?: string | null
|
||||
}
|
||||
|
||||
export interface VehicleCreate {
|
||||
vehicleNo: string
|
||||
remarks?: string | null
|
||||
}
|
||||
|
||||
export interface VehicleUpdate {
|
||||
vehicleNo?: string
|
||||
remarks?: string | null
|
||||
}
|
||||
|
||||
export const vehicleApi = {
|
||||
list: async (q?: string): Promise<Vehicle[]> => {
|
||||
return api.get<Vehicle[]>({
|
||||
url: '/master-data/vehicles',
|
||||
params: q ? { q } : undefined
|
||||
})
|
||||
},
|
||||
get: async (id: number): Promise<Vehicle> => {
|
||||
return api.get<Vehicle>({
|
||||
url: `/master-data/vehicles/${id}`
|
||||
})
|
||||
},
|
||||
create: async (payload: VehicleCreate): Promise<Vehicle> => {
|
||||
return api.post<Vehicle>({
|
||||
url: '/master-data/vehicles',
|
||||
data: payload
|
||||
})
|
||||
},
|
||||
update: async (id: number, payload: VehicleUpdate): Promise<Vehicle> => {
|
||||
return api.put<Vehicle>({
|
||||
url: `/master-data/vehicles/${id}`,
|
||||
data: payload
|
||||
})
|
||||
},
|
||||
delete: async (id: number): Promise<void> => {
|
||||
return api.del({
|
||||
url: `/master-data/vehicles/${id}`
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Executable
+60
@@ -0,0 +1,60 @@
|
||||
import { MenuListType } from '@/types/menu'
|
||||
import { processRoute } from '@/utils/menu'
|
||||
import { showLoadingToast, closeToast } from 'vant'
|
||||
|
||||
// 简单的路由数据(移动端不需要复杂的路由配置)
|
||||
const simpleRoutes: any[] = [
|
||||
{
|
||||
path: '/dashboard',
|
||||
name: 'Dashboard',
|
||||
meta: { title: '工作台', icon: '', isHide: false }
|
||||
},
|
||||
{
|
||||
path: '/plans',
|
||||
name: 'Plans',
|
||||
meta: { title: '计划管理', icon: '', isHide: false }
|
||||
},
|
||||
{
|
||||
path: '/inventory',
|
||||
name: 'Inventory',
|
||||
meta: { title: '出入库管理', icon: '', isHide: false }
|
||||
},
|
||||
{
|
||||
path: '/weighing',
|
||||
name: 'Weighing',
|
||||
meta: { title: '地磅单管理', icon: '', isHide: false }
|
||||
},
|
||||
{
|
||||
path: '/master-data',
|
||||
name: 'MasterData',
|
||||
meta: { title: '基础资料', icon: '', isHide: false }
|
||||
}
|
||||
]
|
||||
|
||||
// 菜单接口
|
||||
export const menuService = {
|
||||
// 获取菜单列表,模拟网络请求
|
||||
getMenuList(
|
||||
delay: number = 300
|
||||
): Promise<{ menuList: MenuListType[]; closeLoading: () => void }> {
|
||||
// 获取到的菜单数据
|
||||
const menuList = simpleRoutes
|
||||
// 处理后的菜单数据
|
||||
const processedMenuList: MenuListType[] = menuList.map((route: any) => processRoute(route))
|
||||
|
||||
showLoadingToast({
|
||||
message: '加载中...',
|
||||
forbidClick: true,
|
||||
duration: 0
|
||||
})
|
||||
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
menuList: processedMenuList,
|
||||
closeLoading: () => closeToast()
|
||||
})
|
||||
}, delay)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
export interface ArticleType {
|
||||
id?: number
|
||||
blog_class: string
|
||||
title: string
|
||||
count?: number
|
||||
html_content: string
|
||||
create_time: string // 或者使用 Date 类型
|
||||
home_img: string
|
||||
brief: string
|
||||
type_name?: string
|
||||
}
|
||||
|
||||
export interface ArticleCategoryType {
|
||||
id: number
|
||||
name: string
|
||||
icon: string
|
||||
count: number
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
import api from '@/utils/http'
|
||||
import type { InventoryRecord } from './inventoryApi'
|
||||
import type { WeighingRecord } from './weighingApi'
|
||||
|
||||
// ==================== 计划管理 API ====================
|
||||
|
||||
export interface Plan {
|
||||
id: number
|
||||
planNo?: string
|
||||
planDate: string
|
||||
startDate?: string
|
||||
endDate?: string
|
||||
businessType: '入库' | '出库'
|
||||
product: string
|
||||
specification?: string
|
||||
plannedQuantity: number
|
||||
vehicleNo?: string
|
||||
customerName?: string
|
||||
remarks?: string
|
||||
executionStatus?: string
|
||||
executedAt?: string
|
||||
lastWeighingSlipId?: number
|
||||
executedQuantity?: number
|
||||
isDeleted: number
|
||||
createdAt: string
|
||||
/** 生成链接交三方填写时对应的出入库单 id */
|
||||
fillLinkInventoryId?: number
|
||||
}
|
||||
|
||||
export interface PlanCreate {
|
||||
planNo?: string
|
||||
planDate: string
|
||||
startDate?: string
|
||||
endDate?: string
|
||||
businessType: '入库' | '出库'
|
||||
product: string
|
||||
specification?: string
|
||||
plannedQuantity: number
|
||||
vehicleNo?: string
|
||||
customerName?: string
|
||||
remarks?: string
|
||||
executionStatus?: string
|
||||
}
|
||||
|
||||
export interface PlanUpdate {
|
||||
planNo?: string
|
||||
planDate?: string
|
||||
startDate?: string
|
||||
endDate?: string
|
||||
businessType?: '入库' | '出库'
|
||||
product?: string
|
||||
specification?: string
|
||||
plannedQuantity?: number
|
||||
vehicleNo?: string
|
||||
customerName?: string
|
||||
remarks?: string
|
||||
executionStatus?: string
|
||||
executedAt?: string
|
||||
lastWeighingSlipId?: number
|
||||
executedQuantity?: number
|
||||
}
|
||||
|
||||
export interface PlanRelatedData {
|
||||
inventories: InventoryRecord[]
|
||||
weighings: WeighingRecord[]
|
||||
}
|
||||
|
||||
export interface ThirdPartyPlanPageData {
|
||||
plan: Plan
|
||||
today_inventories: InventoryRecord[]
|
||||
/** 本月历史出入库单(不含今天),按日期倒序 */
|
||||
month_inventories: InventoryRecord[]
|
||||
}
|
||||
|
||||
export const planApi = {
|
||||
list: async (params?: {
|
||||
q?: string
|
||||
businessType?: '入库' | '出库'
|
||||
executionStatus?: string
|
||||
createdFrom?: string
|
||||
createdTo?: string
|
||||
}): Promise<Plan[]> => {
|
||||
return api.get<Plan[]>({
|
||||
url: '/plans',
|
||||
params
|
||||
})
|
||||
},
|
||||
get: async (id: number): Promise<Plan> => {
|
||||
return api.get<Plan>({
|
||||
url: `/plans/${id}`
|
||||
})
|
||||
},
|
||||
getRelated: async (id: number): Promise<PlanRelatedData> => {
|
||||
return api.get<PlanRelatedData>({
|
||||
url: `/plans/${id}/related`
|
||||
})
|
||||
},
|
||||
getThirdPartyPage: async (id: number): Promise<ThirdPartyPlanPageData> => {
|
||||
return api.get<ThirdPartyPlanPageData>({
|
||||
url: `/plans/${id}/third-party-page`
|
||||
})
|
||||
},
|
||||
create: async (payload: PlanCreate): Promise<Plan> => {
|
||||
return api.post<Plan>({
|
||||
url: '/plans',
|
||||
data: payload
|
||||
})
|
||||
},
|
||||
update: async (id: number, payload: PlanUpdate): Promise<Plan> => {
|
||||
return api.patch<Plan>({
|
||||
url: `/plans/${id}`,
|
||||
data: payload
|
||||
})
|
||||
},
|
||||
delete: async (id: number): Promise<void> => {
|
||||
return api.del({
|
||||
url: `/plans/${id}`
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
import api from '@/utils/http'
|
||||
import type { BaseResult } from '@/types/axios'
|
||||
import { ApiStatus } from '@/utils/http/status'
|
||||
|
||||
// ==================== 用户管理 API ====================
|
||||
|
||||
export interface User {
|
||||
id: number
|
||||
username: string
|
||||
role: 'admin' | 'operator'
|
||||
createdAt?: string
|
||||
}
|
||||
|
||||
export interface UserCreate {
|
||||
username: string
|
||||
password: string
|
||||
role: 'admin' | 'operator'
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export interface UserUpdate {
|
||||
username?: string
|
||||
password?: string
|
||||
role?: 'admin' | 'operator'
|
||||
remark?: string
|
||||
}
|
||||
|
||||
// 登录响应
|
||||
export interface LoginResponse {
|
||||
accessToken: string
|
||||
refreshToken?: string
|
||||
}
|
||||
|
||||
// 用户信息(用于登录后获取)
|
||||
export interface UserInfo {
|
||||
id: number
|
||||
username: string
|
||||
name?: string
|
||||
avatar?: string
|
||||
email?: string
|
||||
role?: 'admin' | 'operator'
|
||||
}
|
||||
|
||||
// 用户管理 API(CRUD)
|
||||
export const userApi = {
|
||||
list: async (): Promise<User[]> => {
|
||||
return api.get<User[]>({
|
||||
url: '/users'
|
||||
})
|
||||
},
|
||||
get: async (id: number): Promise<User> => {
|
||||
return api.get<User>({
|
||||
url: `/users/${id}`
|
||||
})
|
||||
},
|
||||
create: async (payload: UserCreate): Promise<User> => {
|
||||
return api.post<User>({
|
||||
url: '/users',
|
||||
data: payload
|
||||
})
|
||||
},
|
||||
update: async (id: number, payload: UserUpdate): Promise<User> => {
|
||||
return api.put<User>({
|
||||
url: `/users/${id}`,
|
||||
data: payload
|
||||
})
|
||||
},
|
||||
delete: async (id: number): Promise<void> => {
|
||||
return api.del({
|
||||
url: `/users/${id}`
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 用户服务(登录、获取用户信息等)
|
||||
export const UserService = {
|
||||
// 登录
|
||||
login: async (username: string, password: string): Promise<BaseResult<LoginResponse & { user?: UserInfo }>> => {
|
||||
try {
|
||||
const response = await api.post<LoginResponse & { user?: UserInfo }>({
|
||||
url: '/auth/login',
|
||||
data: {
|
||||
username,
|
||||
password
|
||||
}
|
||||
})
|
||||
|
||||
// 后端直接返回 LoginResponse,需要包装成 BaseResult 格式
|
||||
return {
|
||||
code: ApiStatus.success,
|
||||
message: '登录成功',
|
||||
data: response
|
||||
}
|
||||
} catch (error: any) {
|
||||
const errorMessage = error.response?.data?.detail || error.response?.data?.message || error.message || '登录失败'
|
||||
return {
|
||||
code: error.response?.status || 500,
|
||||
message: errorMessage,
|
||||
data: null as any
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 获取用户信息
|
||||
getUserInfo: async (): Promise<BaseResult<UserInfo>> => {
|
||||
try {
|
||||
const response = await api.get<UserInfo>({
|
||||
url: '/auth/userinfo'
|
||||
})
|
||||
|
||||
// 后端直接返回 UserInfo,需要包装成 BaseResult 格式
|
||||
return {
|
||||
code: ApiStatus.success,
|
||||
message: '获取成功',
|
||||
data: response
|
||||
}
|
||||
} catch (error: any) {
|
||||
const errorMessage = error.response?.data?.detail || error.response?.data?.message || error.message || '获取用户信息失败'
|
||||
return {
|
||||
code: error.response?.status || 500,
|
||||
message: errorMessage,
|
||||
data: null as any
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
import api from '@/utils/http'
|
||||
import type { Plan } from './plansApi'
|
||||
import type { InventoryRecord } from './inventoryApi'
|
||||
|
||||
// ==================== 地磅单管理 API ====================
|
||||
|
||||
export interface WeighingRecord {
|
||||
id: number
|
||||
vehicleNo: string
|
||||
planNo?: string
|
||||
cargoName: string
|
||||
businessType: '入库' | '出库'
|
||||
batchNo?: string
|
||||
supplier: string
|
||||
consignee: string
|
||||
grossWeight: number
|
||||
grossWeightTime: string
|
||||
tareWeight: number
|
||||
tareWeightTime: string
|
||||
deduction?: number
|
||||
netWeight: number
|
||||
plannedQuantity?: number
|
||||
executedQuantity?: number
|
||||
purchasePlanId?: number
|
||||
inboundOutboundId?: number
|
||||
weighingPoint?: string
|
||||
remarks?: string
|
||||
currentQuantity?: number
|
||||
isVoided: number
|
||||
createdAt: string
|
||||
inventoryDate?: string // 出入库单日期
|
||||
}
|
||||
|
||||
export interface WeighingCreate {
|
||||
vehicleNo: string
|
||||
planNo?: string
|
||||
cargoName: string
|
||||
businessType: '入库' | '出库'
|
||||
batchNo?: string
|
||||
supplier: string
|
||||
consignee: string
|
||||
grossWeight: number
|
||||
grossWeightTime: string
|
||||
tareWeight: number
|
||||
tareWeightTime: string
|
||||
deduction?: number
|
||||
netWeight: number
|
||||
plannedQuantity?: number
|
||||
executedQuantity?: number
|
||||
purchasePlanId?: number
|
||||
inboundOutboundId?: number
|
||||
weighingPoint?: string
|
||||
remarks?: string
|
||||
currentQuantity?: number
|
||||
}
|
||||
|
||||
export interface WeighingUpdate {
|
||||
vehicleNo?: string
|
||||
planNo?: string
|
||||
cargoName?: string
|
||||
businessType?: '入库' | '出库'
|
||||
batchNo?: string
|
||||
supplier?: string
|
||||
consignee?: string
|
||||
grossWeight?: number
|
||||
grossWeightTime?: string
|
||||
tareWeight?: number
|
||||
tareWeightTime?: string
|
||||
deduction?: number
|
||||
netWeight?: number
|
||||
plannedQuantity?: number
|
||||
executedQuantity?: number
|
||||
purchasePlanId?: number
|
||||
inboundOutboundId?: number
|
||||
weighingPoint?: string
|
||||
remarks?: string
|
||||
currentQuantity?: number
|
||||
isVoided?: number
|
||||
}
|
||||
|
||||
export interface WeighingRelatedData {
|
||||
plan: Plan | null
|
||||
inventory: InventoryRecord | null
|
||||
}
|
||||
|
||||
export const weighingApi = {
|
||||
list: async (params?: {
|
||||
dateFrom?: string
|
||||
dateTo?: string
|
||||
vehicleNo?: string
|
||||
cargoName?: string
|
||||
businessType?: '入库' | '出库'
|
||||
}): Promise<WeighingRecord[]> => {
|
||||
return api.get<WeighingRecord[]>({
|
||||
url: '/weighing',
|
||||
params
|
||||
})
|
||||
},
|
||||
get: async (id: number): Promise<WeighingRecord> => {
|
||||
return api.get<WeighingRecord>({
|
||||
url: `/weighing/${id}`
|
||||
})
|
||||
},
|
||||
getRelated: async (id: number): Promise<WeighingRelatedData> => {
|
||||
return api.get<WeighingRelatedData>({
|
||||
url: `/weighing/${id}/related`
|
||||
})
|
||||
},
|
||||
create: async (payload: WeighingCreate): Promise<WeighingRecord> => {
|
||||
return api.post<WeighingRecord>({
|
||||
url: '/weighing',
|
||||
data: payload
|
||||
})
|
||||
},
|
||||
update: async (id: number, payload: WeighingUpdate): Promise<WeighingRecord> => {
|
||||
return api.patch<WeighingRecord>({
|
||||
url: `/weighing/${id}`,
|
||||
data: payload
|
||||
})
|
||||
},
|
||||
void: async (id: number): Promise<void> => {
|
||||
return api.post({
|
||||
url: `/weighing/${id}/void`
|
||||
})
|
||||
},
|
||||
delete: async (id: number): Promise<void> => {
|
||||
return api.del({
|
||||
url: `/weighing/${id}`
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user