520 lines
13 KiB
TypeScript
520 lines
13 KiB
TypeScript
import request from "@/utils/http";
|
|||
|
|
|
||
|
|
/**
|
||
|
|
* produce 插件 API
|
||
|
|
*/
|
||
|
|
import BaseService from "@/api/core/base";
|
||
|
|
|
||
|
|
export interface ProduceProcessRow {
|
||
|
|
id?: string | number;
|
||
|
|
process_code: string;
|
||
|
|
process_name: string;
|
||
|
|
description?: string;
|
||
|
|
step_count?: number;
|
||
|
|
sort?: number;
|
||
|
|
status?: number;
|
||
|
|
created_date?: string;
|
||
|
|
updated_date?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface ProduceProcessStepRow {
|
||
|
|
id?: string | number;
|
||
|
|
process_id: string | number;
|
||
|
|
step_code: string;
|
||
|
|
step_name: string;
|
||
|
|
description?: string;
|
||
|
|
sort?: number;
|
||
|
|
status?: number;
|
||
|
|
prerequisite_steps?: Array<string | number> | string | null;
|
||
|
|
prerequisite_mode?: "all" | "any" | "none";
|
||
|
|
prerequisite_require_final?: number;
|
||
|
|
allow_repeat_scan?: number;
|
||
|
|
repeat_scan_statuses?: Array<string | number> | string | null;
|
||
|
|
process?: {
|
||
|
|
id?: string | number;
|
||
|
|
process_name?: string;
|
||
|
|
};
|
||
|
|
created_date?: string;
|
||
|
|
updated_date?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface ProduceStepStatusRow {
|
||
|
|
id?: string | number;
|
||
|
|
step_id: string | number;
|
||
|
|
status_code: string;
|
||
|
|
status_name: string;
|
||
|
|
is_initial?: number;
|
||
|
|
is_final?: number;
|
||
|
|
description?: string;
|
||
|
|
sort?: number;
|
||
|
|
status?: number;
|
||
|
|
step?: {
|
||
|
|
id?: string | number;
|
||
|
|
step_name?: string;
|
||
|
|
};
|
||
|
|
created_date?: string;
|
||
|
|
updated_date?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface ProduceStepRelationRow {
|
||
|
|
id?: string | number;
|
||
|
|
from_step_id: string | number;
|
||
|
|
to_step_id: string | number;
|
||
|
|
relation_type: "normal" | "exception";
|
||
|
|
flow_condition?: string | Record<string, any> | null;
|
||
|
|
priority?: number;
|
||
|
|
description?: string;
|
||
|
|
sort?: number;
|
||
|
|
status?: number;
|
||
|
|
from_step?: {
|
||
|
|
id?: string | number;
|
||
|
|
step_name?: string;
|
||
|
|
};
|
||
|
|
to_step?: {
|
||
|
|
id?: string | number;
|
||
|
|
step_name?: string;
|
||
|
|
};
|
||
|
|
created_date?: string;
|
||
|
|
updated_date?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface ProduceStatusTransitionRow {
|
||
|
|
id?: string | number;
|
||
|
|
step_id: string | number;
|
||
|
|
from_status_id: string | number;
|
||
|
|
to_status_id: string | number;
|
||
|
|
trigger_event: string;
|
||
|
|
event_config?: string | Record<string, any> | null;
|
||
|
|
auto_trigger?: number;
|
||
|
|
priority?: number;
|
||
|
|
transition_type?: "primary" | "side_effect";
|
||
|
|
side_effect_type?: string;
|
||
|
|
side_effect_config?: string | Record<string, any> | null;
|
||
|
|
description?: string;
|
||
|
|
sort?: number;
|
||
|
|
status?: number;
|
||
|
|
step?: {
|
||
|
|
id?: string | number;
|
||
|
|
step_name?: string;
|
||
|
|
};
|
||
|
|
from_status?: {
|
||
|
|
id?: string | number;
|
||
|
|
status_name?: string;
|
||
|
|
};
|
||
|
|
to_status?: {
|
||
|
|
id?: string | number;
|
||
|
|
status_name?: string;
|
||
|
|
};
|
||
|
|
created_date?: string;
|
||
|
|
updated_date?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface ProduceMaterialCategoryRow {
|
||
|
|
id?: string | number;
|
||
|
|
category_name: string;
|
||
|
|
created_date?: string;
|
||
|
|
updated_date?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface ProduceMaterialRow {
|
||
|
|
id?: string | number;
|
||
|
|
category_id: string | number;
|
||
|
|
category_name?: string;
|
||
|
|
product_code: string;
|
||
|
|
product_name: string;
|
||
|
|
created_date?: string;
|
||
|
|
updated_date?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface ProduceHardwareFaultDescriptionRow {
|
||
|
|
id?: string | number;
|
||
|
|
// ... other properties
|
||
|
|
}
|
||
|
|
|
||
|
|
export const ProduceMaterialCategoryService = {
|
||
|
|
...BaseService<ProduceMaterialCategoryRow>({
|
||
|
|
baseUrl: "/produce/material-category",
|
||
|
|
}),
|
||
|
|
};
|
||
|
|
|
||
|
|
export const ProduceMaterialService = {
|
||
|
|
...BaseService<ProduceMaterialRow>({ baseUrl: "/produce/material" }),
|
||
|
|
categoryOptions(params: Record<string, any> = {}) {
|
||
|
|
return request.get({
|
||
|
|
url: "/produce/material-category",
|
||
|
|
params: { format: "select", ...params },
|
||
|
|
});
|
||
|
|
},
|
||
|
|
importExcel(data: FormData) {
|
||
|
|
return request.post<{ created: number; updated: number }>({
|
||
|
|
url: "/produce/material/import",
|
||
|
|
data,
|
||
|
|
headers: { "Content-Type": "multipart/form-data" },
|
||
|
|
});
|
||
|
|
},
|
||
|
|
};
|
||
|
|
|
||
|
|
export const ProduceProcessService = {
|
||
|
|
...BaseService<ProduceProcessRow>({ baseUrl: "/produce/process" }),
|
||
|
|
};
|
||
|
|
|
||
|
|
export const ProduceProcessStepService = {
|
||
|
|
...BaseService<ProduceProcessStepRow>({ baseUrl: "/produce/process-step" }),
|
||
|
|
};
|
||
|
|
|
||
|
|
export const ProduceStepStatusService = {
|
||
|
|
...BaseService<ProduceStepStatusRow>({ baseUrl: "/produce/step-status" }),
|
||
|
|
};
|
||
|
|
|
||
|
|
export const ProduceStepRelationService = {
|
||
|
|
...BaseService<ProduceStepRelationRow>({ baseUrl: "/produce/step-relation" }),
|
||
|
|
};
|
||
|
|
|
||
|
|
export const ProduceStatusTransitionService = {
|
||
|
|
...BaseService<ProduceStatusTransitionRow>({
|
||
|
|
baseUrl: "/produce/status-transition",
|
||
|
|
}),
|
||
|
|
};
|
||
|
|
|
||
|
|
export interface ProduceTransitionLogRow {
|
||
|
|
id?: string | number;
|
||
|
|
work_order_id?: string | number | null;
|
||
|
|
work_order_no?: string;
|
||
|
|
step_id: string | number;
|
||
|
|
transition_id?: string | number | null;
|
||
|
|
from_status_id: string | number;
|
||
|
|
to_status_id: string | number;
|
||
|
|
trigger_event: string;
|
||
|
|
trigger_data?: Record<string, any> | string | null;
|
||
|
|
trigger_user?: string;
|
||
|
|
trigger_ip?: string;
|
||
|
|
is_auto?: number;
|
||
|
|
is_success?: number;
|
||
|
|
error_message?: string | null;
|
||
|
|
duration?: number;
|
||
|
|
remark?: string | null;
|
||
|
|
created_by?: string | number | null;
|
||
|
|
created_name?: string;
|
||
|
|
created_date?: string;
|
||
|
|
step?: {
|
||
|
|
id?: string | number;
|
||
|
|
step_name?: string;
|
||
|
|
};
|
||
|
|
transition?: {
|
||
|
|
id?: string | number;
|
||
|
|
trigger_event?: string;
|
||
|
|
};
|
||
|
|
from_status?: {
|
||
|
|
id?: string | number;
|
||
|
|
status_name?: string;
|
||
|
|
};
|
||
|
|
to_status?: {
|
||
|
|
id?: string | number;
|
||
|
|
status_name?: string;
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
export const ProduceTransitionLogService = {
|
||
|
|
...BaseService<ProduceTransitionLogRow>({
|
||
|
|
baseUrl: "/produce/transition-log",
|
||
|
|
allowedMethods: ["list", "get", "export"],
|
||
|
|
}),
|
||
|
|
};
|
||
|
|
|
||
|
|
export interface ProduceSpecificRuleRow {
|
||
|
|
id?: string | number;
|
||
|
|
rule_name: string;
|
||
|
|
rule_pattern: string;
|
||
|
|
rule_type: number;
|
||
|
|
apply_mode?: "order" | "machine" | "both";
|
||
|
|
match_field?: "order_no" | "process_order_no" | "product_code" | "user_code";
|
||
|
|
is_enabled?: number;
|
||
|
|
step_ids?: Array<string | number> | string | null;
|
||
|
|
sort?: number;
|
||
|
|
remark?: string;
|
||
|
|
created_name?: string;
|
||
|
|
created_date?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface ProduceProductRecordRow {
|
||
|
|
id?: string | number;
|
||
|
|
process_order_no: string;
|
||
|
|
product_code: string;
|
||
|
|
quantity: number;
|
||
|
|
process_id?: string | number | null;
|
||
|
|
step_id?: string | number | null;
|
||
|
|
status_id?: string | number | null;
|
||
|
|
user_code?: string;
|
||
|
|
operator?: string;
|
||
|
|
operator_id?: string | number | null;
|
||
|
|
scan_result?: number;
|
||
|
|
remark?: string | null;
|
||
|
|
process?: {
|
||
|
|
id?: string | number;
|
||
|
|
process_name?: string;
|
||
|
|
};
|
||
|
|
step?: {
|
||
|
|
id?: string | number;
|
||
|
|
step_name?: string;
|
||
|
|
};
|
||
|
|
status?: {
|
||
|
|
id?: string | number;
|
||
|
|
status_name?: string;
|
||
|
|
};
|
||
|
|
created_name?: string;
|
||
|
|
created_date?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface ProduceScanDataRow {
|
||
|
|
id?: string | number;
|
||
|
|
order_no: string;
|
||
|
|
quantity?: number;
|
||
|
|
user_code: string;
|
||
|
|
operator?: string;
|
||
|
|
operator_id?: string | number | null;
|
||
|
|
process_id: string | number;
|
||
|
|
step_id: string | number;
|
||
|
|
status_id?: string | number | null;
|
||
|
|
scan_result: number;
|
||
|
|
scan_time?: number;
|
||
|
|
scan_date?: string;
|
||
|
|
remark?: string | null;
|
||
|
|
process?: {
|
||
|
|
id?: string | number;
|
||
|
|
process_name?: string;
|
||
|
|
};
|
||
|
|
step?: {
|
||
|
|
id?: string | number;
|
||
|
|
step_name?: string;
|
||
|
|
};
|
||
|
|
status?: {
|
||
|
|
id?: string | number;
|
||
|
|
status_name?: string;
|
||
|
|
};
|
||
|
|
created_name?: string;
|
||
|
|
created_date?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export const ProduceSpecificRuleService = {
|
||
|
|
...BaseService<ProduceSpecificRuleRow>({ baseUrl: "/produce/specific-rule" }),
|
||
|
|
};
|
||
|
|
|
||
|
|
export const ProduceProductRecordService = {
|
||
|
|
...BaseService<ProduceProductRecordRow>({
|
||
|
|
baseUrl: "/produce/product-record",
|
||
|
|
}),
|
||
|
|
};
|
||
|
|
|
||
|
|
export const ProduceScanDataService = {
|
||
|
|
...BaseService<ProduceScanDataRow>({ baseUrl: "/produce/scan-data" }),
|
||
|
|
};
|
||
|
|
|
||
|
|
export interface ProduceExceptionSettingRow {
|
||
|
|
id?: string | number;
|
||
|
|
parent_id?: string | number | null;
|
||
|
|
parent_name?: string;
|
||
|
|
setting_type: "type" | "reason" | "issue";
|
||
|
|
code: string;
|
||
|
|
name: string;
|
||
|
|
sort?: number;
|
||
|
|
is_enabled?: number;
|
||
|
|
remark?: string | null;
|
||
|
|
created_name?: string;
|
||
|
|
created_date?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface ProduceExceptionRecordRow {
|
||
|
|
id?: string | number;
|
||
|
|
order_no: string;
|
||
|
|
user_code?: string | null;
|
||
|
|
reporter?: string | null;
|
||
|
|
type_id?: string | number | null;
|
||
|
|
type_code: string;
|
||
|
|
type_name: string;
|
||
|
|
reason_id?: string | number | null;
|
||
|
|
reason_code: string;
|
||
|
|
reason_name: string;
|
||
|
|
issue_id?: string | number | null;
|
||
|
|
issue_code?: string | null;
|
||
|
|
issue_name?: string | null;
|
||
|
|
images?: string[] | null;
|
||
|
|
remark?: string | null;
|
||
|
|
status?: number;
|
||
|
|
status_name?: string;
|
||
|
|
handler?: string | null;
|
||
|
|
handler_id?: string | number | null;
|
||
|
|
handled_at?: number | null;
|
||
|
|
handled_date?: string | null;
|
||
|
|
reported_at?: number | null;
|
||
|
|
reported_date?: string | null;
|
||
|
|
created_name?: string;
|
||
|
|
created_date?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export const ProduceExceptionSettingService = {
|
||
|
|
...BaseService<ProduceExceptionSettingRow>({
|
||
|
|
baseUrl: "/produce/exception-setting",
|
||
|
|
}),
|
||
|
|
};
|
||
|
|
|
||
|
|
export interface ProduceRepairSettingRow {
|
||
|
|
id?: string | number;
|
||
|
|
parent_id?: string | number | null;
|
||
|
|
parent_name?: string;
|
||
|
|
setting_type: "type" | "reason" | "issue";
|
||
|
|
code: string;
|
||
|
|
name: string;
|
||
|
|
sort?: number;
|
||
|
|
is_enabled?: number;
|
||
|
|
remark?: string | null;
|
||
|
|
created_name?: string;
|
||
|
|
created_date?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface ProduceHardwareFaultDescriptionRow {
|
||
|
|
id?: string | number;
|
||
|
|
category_id: string | number;
|
||
|
|
category_name?: string;
|
||
|
|
description: string;
|
||
|
|
use_count?: number;
|
||
|
|
is_enabled?: number;
|
||
|
|
remark?: string | null;
|
||
|
|
created_date?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface ProduceRepairRecordRow {
|
||
|
|
id?: string | number;
|
||
|
|
repair_no: string;
|
||
|
|
exception_id?: string | number | null;
|
||
|
|
exception_reason?: string | null;
|
||
|
|
exception_issue?: string | null;
|
||
|
|
exception_type_name?: string | null;
|
||
|
|
order_no?: string | null;
|
||
|
|
product_code?: string | null;
|
||
|
|
product_name?: string | null;
|
||
|
|
category_id?: string | number | null;
|
||
|
|
category_name?: string | null;
|
||
|
|
fault_description_id?: string | number | null;
|
||
|
|
fault_description_ids?: Array<string | number>;
|
||
|
|
fault_description?: string | null;
|
||
|
|
fault_descriptions?: string[];
|
||
|
|
repair_result?: string | null;
|
||
|
|
parts?: Array<Record<string, any>> | string | null;
|
||
|
|
responsible_operators?: Array<Record<string, any>> | string | null;
|
||
|
|
operator?: string | null;
|
||
|
|
repaired_at?: number | null;
|
||
|
|
repaired_date?: string | null;
|
||
|
|
remark?: string | null;
|
||
|
|
created_date?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export const ProduceRepairSettingService = {
|
||
|
|
...BaseService<ProduceRepairSettingRow>({
|
||
|
|
baseUrl: "/produce/repair-setting",
|
||
|
|
}),
|
||
|
|
};
|
||
|
|
|
||
|
|
export const ProduceHardwareFaultDescriptionService = {
|
||
|
|
...BaseService<ProduceHardwareFaultDescriptionRow>({
|
||
|
|
baseUrl: "/produce/hardware-fault-description",
|
||
|
|
}),
|
||
|
|
categoryOptions(params: Record<string, any> = {}) {
|
||
|
|
return request.get({
|
||
|
|
url: "/produce/material-category",
|
||
|
|
params: { format: "select", ...params },
|
||
|
|
});
|
||
|
|
},
|
||
|
|
importExcel(data: FormData) {
|
||
|
|
return request.post<{ created: number; updated: number }>({
|
||
|
|
url: "/produce/hardware-fault-description/import",
|
||
|
|
data,
|
||
|
|
headers: { "Content-Type": "multipart/form-data" },
|
||
|
|
});
|
||
|
|
},
|
||
|
|
};
|
||
|
|
|
||
|
|
export const ProduceRepairRecordService = {
|
||
|
|
...BaseService<ProduceRepairRecordRow>({ baseUrl: "/produce/repair-record" }),
|
||
|
|
categoryOptions(params: Record<string, any> = {}) {
|
||
|
|
return request.get({
|
||
|
|
url: "/produce/material-category",
|
||
|
|
params: { format: "select", ...params },
|
||
|
|
});
|
||
|
|
},
|
||
|
|
faultDescriptionOptions(params: Record<string, any> = {}) {
|
||
|
|
return ProduceHardwareFaultDescriptionService.list({
|
||
|
|
limit: 999,
|
||
|
|
is_enabled: 1,
|
||
|
|
...params,
|
||
|
|
});
|
||
|
|
},
|
||
|
|
};
|
||
|
|
|
||
|
|
export const ProduceExceptionRecordService = {
|
||
|
|
...BaseService<ProduceExceptionRecordRow>({
|
||
|
|
baseUrl: "/produce/exception-record",
|
||
|
|
}),
|
||
|
|
};
|
||
|
|
|
||
|
|
export const ProduceConfigApi = {
|
||
|
|
info(params: Record<string, any>) {
|
||
|
|
return request.get({ url: "/produce/config/info", params });
|
||
|
|
},
|
||
|
|
save(data: Record<string, any>) {
|
||
|
|
return request.post({ url: "/produce/config/save", data });
|
||
|
|
},
|
||
|
|
};
|
||
|
|
|
||
|
|
export default {
|
||
|
|
materialCategoryList(params = {}) {
|
||
|
|
return ProduceMaterialCategoryService.list(params as Record<string, any>);
|
||
|
|
},
|
||
|
|
materialList(params = {}) {
|
||
|
|
return ProduceMaterialService.list(params as Record<string, any>);
|
||
|
|
},
|
||
|
|
processList(params = {}) {
|
||
|
|
return ProduceProcessService.list(params as Record<string, any>);
|
||
|
|
},
|
||
|
|
processStepList(params = {}) {
|
||
|
|
return ProduceProcessStepService.list(params as Record<string, any>);
|
||
|
|
},
|
||
|
|
stepStatusList(params = {}) {
|
||
|
|
return ProduceStepStatusService.list(params as Record<string, any>);
|
||
|
|
},
|
||
|
|
stepRelationList(params = {}) {
|
||
|
|
return ProduceStepRelationService.list(params as Record<string, any>);
|
||
|
|
},
|
||
|
|
statusTransitionList(params = {}) {
|
||
|
|
return ProduceStatusTransitionService.list(params as Record<string, any>);
|
||
|
|
},
|
||
|
|
transitionLogList(params = {}) {
|
||
|
|
return ProduceTransitionLogService.list(params as Record<string, any>);
|
||
|
|
},
|
||
|
|
specificRuleList(params = {}) {
|
||
|
|
return ProduceSpecificRuleService.list(params as Record<string, any>);
|
||
|
|
},
|
||
|
|
productRecordList(params = {}) {
|
||
|
|
return ProduceProductRecordService.list(params as Record<string, any>);
|
||
|
|
},
|
||
|
|
scanDataList(params = {}) {
|
||
|
|
return ProduceScanDataService.list(params as Record<string, any>);
|
||
|
|
},
|
||
|
|
exceptionRecordList(params = {}) {
|
||
|
|
return ProduceExceptionRecordService.list(params as Record<string, any>);
|
||
|
|
},
|
||
|
|
exceptionSettingList(params = {}) {
|
||
|
|
return ProduceExceptionSettingService.list(params as Record<string, any>);
|
||
|
|
},
|
||
|
|
repairSettingList(params = {}) {
|
||
|
|
return ProduceRepairSettingService.list(params as Record<string, any>);
|
||
|
|
},
|
||
|
|
hardwareFaultDescriptionList(params = {}) {
|
||
|
|
return ProduceHardwareFaultDescriptionService.list(
|
||
|
|
params as Record<string, any>,
|
||
|
|
);
|
||
|
|
},
|
||
|
|
repairRecordList(params = {}) {
|
||
|
|
return ProduceRepairRecordService.list(params as Record<string, any>);
|
||
|
|
},
|
||
|
|
};
|