同步前端功能修改
This commit is contained in:
@@ -0,0 +1,167 @@
|
||||
import request from '~/utils/request'
|
||||
|
||||
export interface ProduceOption {
|
||||
label: string
|
||||
value: string | number
|
||||
}
|
||||
|
||||
export interface ProduceRecordItem {
|
||||
id?: string | number
|
||||
order_no?: string
|
||||
process_order_no?: string
|
||||
product_code?: string
|
||||
quantity?: number
|
||||
user_code?: string
|
||||
operator?: string
|
||||
scan_result?: number
|
||||
scan_date?: string
|
||||
created_date?: string
|
||||
process?: {
|
||||
process_name?: string
|
||||
}
|
||||
step?: {
|
||||
step_name?: string
|
||||
}
|
||||
status?: {
|
||||
status_name?: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface ProduceSubmitScanDataResult {
|
||||
code: number
|
||||
msg: string
|
||||
data?: {
|
||||
id?: string | number
|
||||
}
|
||||
}
|
||||
|
||||
export interface ProduceStatistics {
|
||||
today_total: number
|
||||
success_total: number
|
||||
failed_total: number
|
||||
}
|
||||
|
||||
export interface ProduceUserStatsItem {
|
||||
user_code: string
|
||||
operator?: string
|
||||
count: number
|
||||
}
|
||||
|
||||
export interface ProduceMemberUserCheckResult {
|
||||
id: number
|
||||
username: string
|
||||
nickname: string
|
||||
}
|
||||
|
||||
export interface ProduceDataEntryStepRule {
|
||||
id?: string | number
|
||||
process_id?: string | number
|
||||
process_name?: string
|
||||
step_code?: string
|
||||
step_name?: string
|
||||
prerequisite_steps?: Array<string | number>
|
||||
prerequisite_mode?: string
|
||||
prerequisite_require_final?: number
|
||||
allow_repeat_scan?: number
|
||||
repeat_scan_statuses?: Array<string | number>
|
||||
}
|
||||
|
||||
export interface ProduceDataEntrySpecificRule {
|
||||
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'
|
||||
step_ids?: Array<string | number>
|
||||
sort?: number
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export interface ProduceDataEntryConfig {
|
||||
basic_setting: Record<string, any>
|
||||
step_rule: ProduceDataEntryStepRule | null
|
||||
specific_rules: ProduceDataEntrySpecificRule[]
|
||||
current?: {
|
||||
process_id?: string | number
|
||||
step_id?: string | number
|
||||
order_no?: string
|
||||
apply_mode?: 'order' | 'machine' | 'both'
|
||||
}
|
||||
}
|
||||
|
||||
export function getProcessOptions() {
|
||||
return request.get<ProduceOption[]>('/produce/process', { format: 'select' })
|
||||
}
|
||||
|
||||
export function getStepOptions(processId?: string | number) {
|
||||
return request.get<ProduceOption[]>('/produce/process-step', {
|
||||
format: 'select',
|
||||
...(processId ? { process_id: processId } : {}),
|
||||
})
|
||||
}
|
||||
|
||||
export function getStatusOptions(stepId?: string | number) {
|
||||
return request.get<ProduceOption[]>('/produce/step-status', {
|
||||
format: 'select',
|
||||
...(stepId ? { step_id: stepId } : {}),
|
||||
})
|
||||
}
|
||||
|
||||
export function getProduceConfig(groupCode: string) {
|
||||
return request.get<Record<string, any>>('/produce/config/info', { group_code: groupCode })
|
||||
}
|
||||
|
||||
export function getDataEntryConfig(params: Record<string, any>) {
|
||||
return request.get<ProduceDataEntryConfig>('/produce/config/data-entry', params)
|
||||
}
|
||||
|
||||
export function getRecentRecords(params: Record<string, any>) {
|
||||
return request.get<{ items: ProduceRecordItem[]; total: number }>('/produce/scan-data', {
|
||||
limit: 10,
|
||||
page: 1,
|
||||
...params,
|
||||
})
|
||||
}
|
||||
|
||||
export function getProductRecentRecords(params: Record<string, any>) {
|
||||
return request.get<{ items: ProduceRecordItem[]; total: number }>('/produce/product-record/recent', {
|
||||
limit: 10,
|
||||
page: 1,
|
||||
...params,
|
||||
})
|
||||
}
|
||||
|
||||
export function getStatistics(params: Record<string, any>) {
|
||||
return request.get<ProduceStatistics>('/produce/scan-data/statistics', params, { showErrorMessage: false })
|
||||
}
|
||||
|
||||
export function getProductStatistics(params: Record<string, any>) {
|
||||
return request.get<ProduceStatistics>('/produce/product-record/statistics', params, { showErrorMessage: false })
|
||||
}
|
||||
|
||||
export function getUserCodeStats(params: Record<string, any>) {
|
||||
return request.get<ProduceUserStatsItem[]>('/produce/scan-data/user-code-stats', params, { showErrorMessage: false })
|
||||
}
|
||||
|
||||
export function getProductUserCodeStats(params: Record<string, any>) {
|
||||
return request.get<ProduceUserStatsItem[]>('/produce/product-record/user-code-stats', params, { showErrorMessage: false })
|
||||
}
|
||||
|
||||
export function checkMemberUser(userCode: string) {
|
||||
return request.get<ProduceMemberUserCheckResult>('/produce/member-user/check', { user_code: userCode }, { showErrorMessage: false })
|
||||
}
|
||||
|
||||
export function submitScanData(data: Record<string, any>) {
|
||||
return request.post<ProduceSubmitScanDataResult>('/produce/scan-data/record', data, {
|
||||
showErrorMessage: false,
|
||||
returnFullResponse: true,
|
||||
})
|
||||
}
|
||||
|
||||
export function submitProductRecord(data: Record<string, any>) {
|
||||
return request.post<ProduceSubmitScanDataResult>('/produce/product-record/record', data, {
|
||||
showErrorMessage: false,
|
||||
returnFullResponse: true,
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
import request from '~/utils/request'
|
||||
|
||||
export interface ProduceExceptionSetting {
|
||||
id: string | number
|
||||
parent_id?: string | number | null
|
||||
setting_type: 'type' | 'reason' | 'issue' | string
|
||||
code?: string
|
||||
name: string
|
||||
sort?: number
|
||||
frequency?: number
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export interface ProduceExceptionRecord {
|
||||
id: string | number
|
||||
order_no?: string
|
||||
user_code?: string
|
||||
reporter?: string
|
||||
type_id?: string | number
|
||||
type_name?: string
|
||||
reason_id?: string | number
|
||||
reason_name?: string
|
||||
issue_id?: string | number | null
|
||||
issue_name?: string
|
||||
images?: string[]
|
||||
remark?: string
|
||||
status?: number
|
||||
status_name?: string
|
||||
reported_date?: string
|
||||
handled_date?: string
|
||||
handler?: string
|
||||
}
|
||||
|
||||
export interface ProduceRepairTask {
|
||||
id: string | number
|
||||
device_no: string
|
||||
type_name?: string
|
||||
reason_name?: string
|
||||
issue_name?: string
|
||||
reporter?: string
|
||||
user_code?: string
|
||||
reported_date?: string
|
||||
status?: number
|
||||
status_name?: string
|
||||
}
|
||||
|
||||
export interface ProduceRepairPart {
|
||||
product_code: string
|
||||
product_name?: string
|
||||
category_id?: string | number
|
||||
category_name?: string
|
||||
source?: 'new' | 'after_sales' | 'refurbished' | string
|
||||
quantity?: number
|
||||
fault_description_ids?: Array<string | number>
|
||||
}
|
||||
|
||||
export interface ProduceScanRecord {
|
||||
id: string | number
|
||||
process_name?: string
|
||||
step_name?: string
|
||||
operator?: string
|
||||
user_code?: string
|
||||
}
|
||||
|
||||
export function getExceptionSettings() {
|
||||
return request.get<ProduceExceptionSetting[]>('/produce/exception/settings', {}, { showErrorMessage: false })
|
||||
}
|
||||
|
||||
export function getExceptionStatistics(params: Record<string, any> = {}) {
|
||||
return request.get<{ pending: number; review: number; done: number }>('/produce/exception/statistics', params, { showErrorMessage: false })
|
||||
}
|
||||
|
||||
export function getRecentExceptions(params: Record<string, any> = {}) {
|
||||
return request.get<ProduceExceptionRecord[]>('/produce/exception/recent', params, { showErrorMessage: false })
|
||||
}
|
||||
|
||||
export function checkExceptionOrder(orderNo: string) {
|
||||
return request.get<Record<string, any>>('/produce/exception/order-check', { order_no: orderNo.trim() }, { showErrorMessage: false })
|
||||
}
|
||||
|
||||
export function submitExceptionRecord(data: Record<string, any>) {
|
||||
return request.post<{ code: number; msg: string; data?: { id: string | number } }>('/produce/exception/record', data, {
|
||||
showErrorMessage: false,
|
||||
returnFullResponse: true,
|
||||
})
|
||||
}
|
||||
|
||||
export function getRepairTasks(params: Record<string, any> = {}) {
|
||||
return request.get<ProduceRepairTask[]>('/produce/repair-record/tasks', params, { showErrorMessage: false })
|
||||
}
|
||||
|
||||
export function getRepairStatistics(params: Record<string, any> = {}) {
|
||||
return request.get<{ pending: number; processing: number; completed_today: number }>('/produce/repair-record/statistics', params, { showErrorMessage: false })
|
||||
}
|
||||
|
||||
export function getRepairTask(deviceNo: string) {
|
||||
return request.get<ProduceRepairTask>('/produce/exception/repair-task', { device_no: deviceNo.trim() }, { showErrorMessage: false })
|
||||
}
|
||||
|
||||
export function getScanRecords(params: Record<string, any> = {}) {
|
||||
return request.get<{ items: ProduceScanRecord[]; total: number }>('/produce/scan-data', {
|
||||
limit: 50,
|
||||
page: 1,
|
||||
...params,
|
||||
}, { showErrorMessage: false })
|
||||
}
|
||||
|
||||
export function getMaterialCategories() {
|
||||
return request.get<Array<{ id: string | number; category_name: string }>>('/produce/scanapp/material-category', {}, { showErrorMessage: false })
|
||||
}
|
||||
|
||||
export function getFaultDescriptionOptions(categoryIds: Array<string | number>) {
|
||||
return request.get<Array<{ id: string | number; category_id: string | number; description: string }>>(
|
||||
'/produce/hardware-fault-description/options',
|
||||
{ category_ids: categoryIds.join(',') },
|
||||
{ showErrorMessage: false },
|
||||
)
|
||||
}
|
||||
|
||||
export function lookupMaterial(productCode: string) {
|
||||
return request.get<{
|
||||
id: string | number
|
||||
category_id: string | number
|
||||
category_name: string
|
||||
product_code: string
|
||||
product_name: string
|
||||
}>('/produce/material/lookup', { product_code: productCode.trim() }, { showErrorMessage: false })
|
||||
}
|
||||
|
||||
export function submitRepairRecord(data: Record<string, any>) {
|
||||
return request.post<{ code: number; msg: string; data?: { id: string | number; repair_no: string } }>('/produce/repair-record/record', data, {
|
||||
showErrorMessage: false,
|
||||
returnFullResponse: true,
|
||||
})
|
||||
}
|
||||
|
||||
export async function uploadProduceImage(file: File, subDir: 'exception' | 'repair') {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
formData.append('sub_dir', subDir)
|
||||
const result = await request.upload<Record<string, any>>('/file/image', formData)
|
||||
return result?.url || result?.full_url || result?.path || ''
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import request from '~/utils/request'
|
||||
|
||||
export type ProduceQueryRecordType = 'scan' | 'product' | 'exception' | 'repair'
|
||||
|
||||
export interface ProduceQueryRecord {
|
||||
id: string
|
||||
record_type: ProduceQueryRecordType
|
||||
record_type_name: string
|
||||
order_no?: string
|
||||
product_code?: string
|
||||
process_name?: string
|
||||
step_name?: string
|
||||
status_name?: string
|
||||
result_name?: string
|
||||
operator?: string
|
||||
user_code?: string
|
||||
quantity?: number | null
|
||||
event_at?: number
|
||||
event_date?: string | null
|
||||
remark?: string
|
||||
// 异常提报和维修记录详情
|
||||
exception_reason?: string
|
||||
exception_content?: string
|
||||
material_category?: string
|
||||
fault_description?: string
|
||||
}
|
||||
|
||||
export interface ProduceQueryPage {
|
||||
items: ProduceQueryRecord[]
|
||||
total: number
|
||||
page: number
|
||||
limit: number
|
||||
}
|
||||
|
||||
export interface ProduceQueryParams {
|
||||
record_type: ProduceQueryRecordType
|
||||
order_no?: string
|
||||
keyword?: string
|
||||
user_code?: string
|
||||
status?: string | number
|
||||
scan_result?: string | number
|
||||
start_date?: string
|
||||
end_date?: string
|
||||
page?: number
|
||||
limit?: number
|
||||
}
|
||||
|
||||
export interface ProduceQueryTimeline {
|
||||
order_no: string
|
||||
total: number
|
||||
items: ProduceQueryRecord[]
|
||||
}
|
||||
|
||||
export function queryProduceRecords(params: ProduceQueryParams) {
|
||||
return request.get<ProduceQueryPage>('/produce/query/records', params, { showErrorMessage: false })
|
||||
}
|
||||
|
||||
export function queryProduceTimeline(orderNo: string) {
|
||||
return request.get<ProduceQueryTimeline>('/produce/query/timeline', { order_no: orderNo.trim() }, { showErrorMessage: false })
|
||||
}
|
||||
Reference in New Issue
Block a user