|
@@ -419,9 +419,9 @@
|
|
|
singleListTask,
|
|
singleListTask,
|
|
|
pleaseEntrustManagement,
|
|
pleaseEntrustManagement,
|
|
|
checkPleaseEntrust,
|
|
checkPleaseEntrust,
|
|
|
- checkRepeatPick,
|
|
|
|
|
- checkRepeatFeed
|
|
|
|
|
|
|
+ checkRepeatPick
|
|
|
} from '@/api/produce/index';
|
|
} from '@/api/produce/index';
|
|
|
|
|
+ import { checkFeedStatus } from '@/api/produce/feeding.js';
|
|
|
import prenatalExamination from './components/prenatalExamination/index.vue';
|
|
import prenatalExamination from './components/prenatalExamination/index.vue';
|
|
|
import { workorderPage2 } from '@/api/produce/workOrder.js';
|
|
import { workorderPage2 } from '@/api/produce/workOrder.js';
|
|
|
import {
|
|
import {
|
|
@@ -1305,6 +1305,10 @@
|
|
|
return row.workOrderId || row.mesWorkOrderId || row.id;
|
|
return row.workOrderId || row.mesWorkOrderId || row.id;
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
+ getFirstArticleTaskId(row = {}) {
|
|
|
|
|
+ return row.taskId || this.workTaskId;
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
getFirstArticleInspectionRows() {
|
|
getFirstArticleInspectionRows() {
|
|
|
const selectedIds = new Set(this.workListIds.map((id) => String(id)));
|
|
const selectedIds = new Set(this.workListIds.map((id) => String(id)));
|
|
|
const rows = this.workData?.list || [];
|
|
const rows = this.workData?.list || [];
|
|
@@ -1317,66 +1321,14 @@
|
|
|
: this.workListIds.map((id) => ({ id }));
|
|
: this.workListIds.map((id) => ({ id }));
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- hasNonZeroCheckData(data, keys) {
|
|
|
|
|
- if (Array.isArray(data)) {
|
|
|
|
|
- return data.some((item) => this.hasNonZeroCheckData(item, keys));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (data && typeof data === 'object') {
|
|
|
|
|
- const values = keys?.length
|
|
|
|
|
- ? keys.map((key) => data[key])
|
|
|
|
|
- : Object.values(data);
|
|
|
|
|
- return values.some((value) => this.hasNonZeroCheckData(value));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const num = Number(data);
|
|
|
|
|
- if (!Number.isNaN(num)) {
|
|
|
|
|
- return num !== 0;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return Boolean(data);
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
async checkFirstArticlePickFeed(row) {
|
|
async checkFirstArticlePickFeed(row) {
|
|
|
const workOrderId = this.getFirstArticleWorkOrderId(row);
|
|
const workOrderId = this.getFirstArticleWorkOrderId(row);
|
|
|
|
|
+ const taskId = this.taskObj.id;
|
|
|
if (!workOrderId) {
|
|
if (!workOrderId) {
|
|
|
- return { pickDone: false, feedDone: false };
|
|
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const [pickRes, feedRes] = await Promise.all([
|
|
|
|
|
- checkRepeatPick({ workOrderId }),
|
|
|
|
|
- checkRepeatFeed([
|
|
|
|
|
- {
|
|
|
|
|
- currentTaskDiagram: row.currentTaskDiagram,
|
|
|
|
|
- workOrderId
|
|
|
|
|
- }
|
|
|
|
|
- ])
|
|
|
|
|
- ]);
|
|
|
|
|
-
|
|
|
|
|
- return {
|
|
|
|
|
- pickDone: this.hasNonZeroCheckData(pickRes?.data),
|
|
|
|
|
- feedDone: this.hasNonZeroCheckData(feedRes?.data, [
|
|
|
|
|
- 'feedFormed',
|
|
|
|
|
- 'feedQuantity',
|
|
|
|
|
- 'allFeedQuantity'
|
|
|
|
|
- ])
|
|
|
|
|
- };
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- getFirstArticlePickFeedMsg(results) {
|
|
|
|
|
- const needPick = results.some((item) => !item.pickDone);
|
|
|
|
|
- const needFeed = results.some((item) => !item.feedDone);
|
|
|
|
|
-
|
|
|
|
|
- if (needPick && needFeed) {
|
|
|
|
|
- return '请先完成领料、投料后再进行首件两检';
|
|
|
|
|
- }
|
|
|
|
|
- if (needPick) {
|
|
|
|
|
- return '请先完成领料后再进行首件两检';
|
|
|
|
|
- }
|
|
|
|
|
- if (needFeed) {
|
|
|
|
|
- return '请先完成投料后再进行首件两检';
|
|
|
|
|
- }
|
|
|
|
|
- return '';
|
|
|
|
|
|
|
+ return checkFeedStatus({ taskId, workOrderId });
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
async refreshFirstArticlePickFeedStatus() {
|
|
async refreshFirstArticlePickFeedStatus() {
|
|
@@ -1392,14 +1344,19 @@
|
|
|
|
|
|
|
|
const rows = this.getFirstArticleInspectionRows();
|
|
const rows = this.getFirstArticleInspectionRows();
|
|
|
const checkKey = `${this.activeName}-${rows
|
|
const checkKey = `${this.activeName}-${rows
|
|
|
- .map((row) => this.getFirstArticleWorkOrderId(row))
|
|
|
|
|
|
|
+ .map(
|
|
|
|
|
+ (row) =>
|
|
|
|
|
+ `${this.getFirstArticleTaskId(
|
|
|
|
|
+ row
|
|
|
|
|
+ )}-${this.getFirstArticleWorkOrderId(row)}`
|
|
|
|
|
+ )
|
|
|
.join(',')}`;
|
|
.join(',')}`;
|
|
|
this.firstArticlePickFeedCheckKey = checkKey;
|
|
this.firstArticlePickFeedCheckKey = checkKey;
|
|
|
this.firstArticlePickFeedReady = false;
|
|
this.firstArticlePickFeedReady = false;
|
|
|
this.firstArticlePickFeedMsg = '正在检查领料、投料状态';
|
|
this.firstArticlePickFeedMsg = '正在检查领料、投料状态';
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- const results = await Promise.all(
|
|
|
|
|
|
|
+ const needPromptList = await Promise.all(
|
|
|
rows.map((row) => this.checkFirstArticlePickFeed(row))
|
|
rows.map((row) => this.checkFirstArticlePickFeed(row))
|
|
|
);
|
|
);
|
|
|
|
|
|
|
@@ -1407,15 +1364,16 @@
|
|
|
return this.firstArticlePickFeedReady;
|
|
return this.firstArticlePickFeedReady;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const msg = this.getFirstArticlePickFeedMsg(results);
|
|
|
|
|
- this.firstArticlePickFeedReady = !msg;
|
|
|
|
|
- this.firstArticlePickFeedMsg = msg;
|
|
|
|
|
|
|
+ const needPrompt = needPromptList.some(Boolean);
|
|
|
|
|
+ this.firstArticlePickFeedReady = !needPrompt;
|
|
|
|
|
+ this.firstArticlePickFeedMsg = needPrompt
|
|
|
|
|
+ ? '请先完成领料、投料后再进行首件两检'
|
|
|
|
|
+ : '';
|
|
|
return this.firstArticlePickFeedReady;
|
|
return this.firstArticlePickFeedReady;
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
if (this.firstArticlePickFeedCheckKey === checkKey) {
|
|
if (this.firstArticlePickFeedCheckKey === checkKey) {
|
|
|
this.firstArticlePickFeedReady = false;
|
|
this.firstArticlePickFeedReady = false;
|
|
|
- this.firstArticlePickFeedMsg =
|
|
|
|
|
- '领料、投料状态检查失败,请稍后重试';
|
|
|
|
|
|
|
+ this.firstArticlePickFeedMsg = '领料、投料状态检查失败,请稍后重试';
|
|
|
}
|
|
}
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -1425,8 +1383,7 @@
|
|
|
const ready = await this.refreshFirstArticlePickFeedStatus();
|
|
const ready = await this.refreshFirstArticlePickFeedStatus();
|
|
|
if (!ready) {
|
|
if (!ready) {
|
|
|
this.$message.warning(
|
|
this.$message.warning(
|
|
|
- this.firstArticlePickFeedMsg ||
|
|
|
|
|
- '请先完成领料、投料后再进行首件两检'
|
|
|
|
|
|
|
+ this.firstArticlePickFeedMsg || '请先完成领料、投料后再进行首件两检'
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
return ready;
|
|
return ready;
|