|
|
@@ -1,4 +1,4 @@
|
|
|
-import { getToken, getTokenFromApi } from './auth'
|
|
|
+import { getToken, getTokenFromApi, getCurrentUserNameSync, getCurrentUserSync } from './auth'
|
|
|
import { saveTaskInfo, saveTaskPhoto, saveTaskKeyProcess, saveTaskRecord, saveTaskRecordItem, getLatestTask, removeTaskAndRecord, getList, updateData } from '@/api/work'
|
|
|
import { globalConfig } from '@/config'
|
|
|
|
|
|
@@ -25,6 +25,9 @@ export type AppTaskInfo = {
|
|
|
qcrecord ?: AppTaskRecord;
|
|
|
photolist ?: AppTaskPhoto[];
|
|
|
keyprocesslist ?: AppTaskKeyProcess[];
|
|
|
+ username ?: string;
|
|
|
+ user ?: string;
|
|
|
+ gxno ?: string;
|
|
|
}
|
|
|
|
|
|
export type AppTaskRecord = {
|
|
|
@@ -215,14 +218,14 @@ export const downloadDataFromAPI = async (gxpk : string, callback ?: () => void)
|
|
|
const infoJson = await getLatestTask(gxpk, null);
|
|
|
if (infoJson?.['data'] != null) {
|
|
|
let info = infoJson?.['data'] as UTSJSONObject ?? {} as UTSJSONObject
|
|
|
- // let ingNum = parseInt(info?.['pdid'] as string);
|
|
|
+ let ingNum = parseInt(info?.['pdid'] as string);
|
|
|
//覆盖标识位
|
|
|
let overwiteFlag = ref(false);
|
|
|
// 先检查是否有任务正在执行中
|
|
|
- // if (info != null && ingNum > 0) {
|
|
|
- // uni.showToast({ title: `当前产品号已有任务在执行中!`, icon: 'error' });
|
|
|
- // return false;
|
|
|
- // }
|
|
|
+ if (info != null && ingNum > 0) {
|
|
|
+ uni.showToast({ title: `当前产品号已有任务在执行中!`, icon: 'error' });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
// 使用Promise来处理异步流程
|
|
|
let deleteDataPromise = new Promise<boolean>((resolve) => {
|
|
|
// if (info != null && ingNum == 0) {
|
|
|
@@ -361,8 +364,8 @@ export const downloadDataFromAPI = async (gxpk : string, callback ?: () => void)
|
|
|
|
|
|
//保存检验记录
|
|
|
let recordObj = taskInfo?.['qcrecord'] as (UTSJSONObject | null);
|
|
|
- console.log('------------------------------>');
|
|
|
- console.log(recordObj);
|
|
|
+ // console.log('------------------------------>');
|
|
|
+ // console.log(recordObj);
|
|
|
if (recordObj != null) {
|
|
|
recordObj['pdid'] = lastId;
|
|
|
let recordItemList = recordObj?.['items'] as UTSJSONObject[] ?? Array<UTSJSONObject>();
|
|
|
@@ -472,7 +475,8 @@ export const uploadDataToAPI = async (gxpk : string, callback ?: () => void) : P
|
|
|
uni.showToast({ title: '未获取到数据', icon: 'error' });
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+ console.log('--------------------->')
|
|
|
+ console.log(taskInfoJson)
|
|
|
uni.showLoading({ title: `开始上传数据`});
|
|
|
let taskInfo = JSON.parse<Task>(taskInfoJson.toJSONString());
|
|
|
let canContinueFlag = true;
|
|
|
@@ -734,6 +738,9 @@ export const uploadDataToAPI = async (gxpk : string, callback ?: () => void) : P
|
|
|
|
|
|
taskInfoJson.set('photolist', Array<UTSJSONObject>())
|
|
|
taskInfoJson.set('lastupdatetime', null)
|
|
|
+ taskInfoJson.set('user', getCurrentUserNameSync())
|
|
|
+ taskInfoJson.set('username', getCurrentUserSync())
|
|
|
+
|
|
|
|
|
|
|
|
|
//1.填充关键工序数据
|