- Introduced new routes and controllers for managing work instructions, including functionalities for listing, saving, and previewing work instruction numbers. - Implemented company code filtering for multi-tenancy support, ensuring that users can only access their respective work instructions. - Added a new Work Instruction page in the frontend for comprehensive management, including search and registration functionalities. These changes aim to enhance the management of work instructions, facilitating better tracking and organization within the application.
49 lines
2.0 KiB
TypeScript
49 lines
2.0 KiB
TypeScript
import { apiClient } from "@/lib/api/client";
|
|
|
|
export interface PaginatedResponse { success: boolean; data: any[]; totalCount: number; page: number; pageSize: number; }
|
|
|
|
export async function getWorkInstructionList(params?: Record<string, any>) {
|
|
const res = await apiClient.get("/work-instruction/list", { params });
|
|
return res.data as { success: boolean; data: any[] };
|
|
}
|
|
|
|
export async function previewWorkInstructionNo() {
|
|
const res = await apiClient.get("/work-instruction/preview-no");
|
|
return res.data as { success: boolean; instructionNo: string };
|
|
}
|
|
|
|
export async function saveWorkInstruction(data: any) {
|
|
const res = await apiClient.post("/work-instruction/save", data);
|
|
return res.data as { success: boolean; data?: any; message?: string };
|
|
}
|
|
|
|
export async function deleteWorkInstructions(ids: string[]) {
|
|
const res = await apiClient.post("/work-instruction/delete", { ids });
|
|
return res.data as { success: boolean; deletedCount?: number; message?: string };
|
|
}
|
|
|
|
export async function getWIItemSource(params?: Record<string, any>) {
|
|
const res = await apiClient.get("/work-instruction/source/item", { params });
|
|
return res.data as PaginatedResponse;
|
|
}
|
|
|
|
export async function getWISalesOrderSource(params?: Record<string, any>) {
|
|
const res = await apiClient.get("/work-instruction/source/sales-order", { params });
|
|
return res.data as PaginatedResponse;
|
|
}
|
|
|
|
export async function getWIProductionPlanSource(params?: Record<string, any>) {
|
|
const res = await apiClient.get("/work-instruction/source/production-plan", { params });
|
|
return res.data as PaginatedResponse;
|
|
}
|
|
|
|
export async function getEquipmentList() {
|
|
const res = await apiClient.get("/work-instruction/equipment");
|
|
return res.data as { success: boolean; data: { id: string; equipment_code: string; equipment_name: string }[] };
|
|
}
|
|
|
|
export async function getEmployeeList() {
|
|
const res = await apiClient.get("/work-instruction/employees");
|
|
return res.data as { success: boolean; data: { user_id: string; user_name: string; dept_name: string | null }[] };
|
|
}
|