整合前端仓库并保留提交历史
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,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user