Sfoglia il codice sorgente

no message

production
[email protected] 6 giorni fa
parent
commit
93472687bd
3 ha cambiato i file con 93 aggiunte e 1 eliminazioni
  1. +57
    -0
      src/app/api/do/actions.tsx
  2. +34
    -0
      src/app/api/do/replenishmentTypes.ts
  3. +2
    -1
      src/components/DoSearch/batchReleaseReplenishmentHtml.ts

+ 57
- 0
src/app/api/do/actions.tsx Vedi File

@@ -11,6 +11,12 @@ import { GridRowId, GridRowSelectionModel } from "@mui/x-data-grid";
import { GET } from "../auth/[...nextauth]/route";
import { stringify } from "querystring";
import { convertObjToURLSearchParams } from "@/app/utils/commonUtil";
import type {
DoReplenishmentRecord,
SubmitDoReplenishmentLineRequest,
} from "./replenishmentTypes";

export type { DoReplenishmentRecord, SubmitDoReplenishmentLineRequest };
export interface CreateConsoDoInput {
ids: GridRowSelectionModel;
}
@@ -27,6 +33,10 @@ export interface DoDetail {
status: string;
/** 加單 DO */
isExtra?: boolean;
/** 揀貨員名稱(delivery_order_pick_order.handlerName) */
handlerName?: string | null;
/** 來源 DO 車線 */
truckLaneCode?: string | null;
deliveryOrderLines: DoDetailLine[];
}

@@ -34,6 +44,8 @@ export interface DoDetailLine {
id: number;
itemNo: string;
qty: number;
/** Sum of stock_out_line qty for linked pick order line; falls back to qty. */
actualShippedQty?: number;
price: number;
status: string;
itemName?: string;
@@ -56,6 +68,7 @@ export interface DoSearchAll {
shopName: string;
shopAddress?: string;
isExtra?: boolean;
truckLanceCode?: string | null;
}
export interface DoSearchLiteResponse {
records: DoSearchAll[];
@@ -672,3 +685,47 @@ export async function fetchAllDoSearch(

return data.records;
}

export async function submitDoReplenishment(
lines: SubmitDoReplenishmentLineRequest[],
): Promise<DoReplenishmentRecord[]> {
return serverFetchJson<DoReplenishmentRecord[]>(`${BASE_API_URL}/do/replenishment`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ lines }),
});
}

export async function fetchDoReplenishmentList(params: {
deliveryDate?: string;
status?: string;
}): Promise<DoReplenishmentRecord[]> {
const query = convertObjToURLSearchParams({
deliveryDate: params.deliveryDate || undefined,
status: params.status && params.status !== "all" ? params.status : undefined,
});
const url = query
? `${BASE_API_URL}/do/replenishment?${query}`
: `${BASE_API_URL}/do/replenishment`;
return serverFetchJson<DoReplenishmentRecord[]>(url, {
method: "GET",
headers: { "Content-Type": "application/json" },
});
}

export async function fetchDoReplenishmentForBatchRelease(params: {
truckLaneCode?: string;
shopName?: string;
}): Promise<DoReplenishmentRecord[]> {
const query = convertObjToURLSearchParams({
truckLaneCode: params.truckLaneCode?.trim() || undefined,
shopName: params.shopName?.trim() || undefined,
});
return serverFetchJson<DoReplenishmentRecord[]>(
`${BASE_API_URL}/do/replenishment/for-batch-release?${query}`,
{
method: "GET",
headers: { "Content-Type": "application/json" },
},
);
}

+ 34
- 0
src/app/api/do/replenishmentTypes.ts Vedi File

@@ -0,0 +1,34 @@
export interface SubmitDoReplenishmentLineRequest {
deliveryDate: string;
sourceDoId: number;
sourceDoLineId: number;
replenishQty: number;
truckLaneCode?: string;
reason?: string;
}

export interface DoReplenishmentRecord {
id: number;
code: string;
deliveryDate: string;
sourceDoId: number;
sourceDoCode?: string;
sourceDoLineId: number;
itemId: number;
itemNo?: string;
itemName?: string;
originalQty?: number;
replenishQty: number;
shortUom?: string;
shopCode?: string;
shopName?: string;
truckLaneCode?: string;
targetDoId?: number;
targetDoCode?: string;
targetDoEstimatedArrivalDate?: string;
pickOrderLineId?: number;
deliveryOrderPickOrderId?: number;
status: string;
reason?: string;
created?: string;
}

+ 2
- 1
src/components/DoSearch/batchReleaseReplenishmentHtml.ts Vedi File

@@ -1,4 +1,5 @@
import { DoReplenishmentRecord, DoSearchAll } from "@/app/api/do/actions";
import type { DoSearchAll } from "@/app/api/do/actions";
import type { DoReplenishmentRecord } from "@/app/api/do/replenishmentTypes";
import { NAVIGATION_CONTENT_WIDTH } from "@/config/uiConfig";
import { TFunction } from "i18next";



Caricamento…
Annulla
Salva