|
@@ -188,6 +188,42 @@ module.exports = app => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ async updateStageCache4DelTimes(transaction, stage, times) {
|
|
|
+ const data = { id: stage.tid };
|
|
|
+ const tp = {
|
|
|
+ contract_tp: stage.contract_tp || 0, qc_tp: stage.qc_tp || 0, contract_pc_tp: stage.contract_pc_tp, qc_pc_tp: stage.qc_pc_tp, pc_tp: stage.pc_tp,
|
|
|
+ positive_qc_tp: stage.positive_qc_tp, positive_qc_pc_tp: stage.positive_qc_pc_tp, negative_qc_tp: stage.negative_qc_pc_tp, negative_qc_pc_tp: stage.negative_qc_pc_tp,
|
|
|
+ yf_tp: stage.yf_tp, sf_tp: stage.sf_tp,
|
|
|
+ pre_contract_tp: stage.pre_contract_tp, pre_qc_tp: stage.pre_qc_tp,
|
|
|
+ pre_positive_qc_tp: stage.pre_positive_qc_tp, pre_negative_qc_tp: stage.pre_positive_qc_tp,
|
|
|
+ pre_yf_tp: stage.pre_yf_tp, pre_sf_tp: stage.pre_sf_tp,
|
|
|
+ };
|
|
|
+ data.stage_flow_cur_uid = stage.user_id;
|
|
|
+ const curInfo = await this.ctx.service.projectAccount.getAccountCacheData(stage.user_id,
|
|
|
+ { order: stage.order, audit_order: 0, audit_type: auditConst.auditType.key.common, status: auditConst.stage.status.uncheck });
|
|
|
+ data.stage_flow_cur_info = JSON.stringify(curInfo);
|
|
|
+ const preAuditors = await this.ctx.service.stageAudit.getLastestAuditors(stage.id, times, auditConst.stage.status.checkNo);
|
|
|
+ const preAuditorIds = preAuditors.map(x => { return x.aid; });
|
|
|
+ data.stage_flow_pre_uid = preAuditorIds.join(',');
|
|
|
+ data.stage_flow_pre_info = preAuditors.length > 0 ? JSON.stringify(preAuditors.map(preAuditor => { return {
|
|
|
+ order: stage.order, audit_type: preAuditor.audit_type, audit_order: preAuditor.order, status: preAuditor.status, time: preAuditor.end_time,
|
|
|
+ name: preAuditor.name, company: preAuditor.company, role: preAuditor.role, mobile: preAuditor.mobile, telephone: preAuditor.telephone,
|
|
|
+ }})) : '';
|
|
|
+ const his = stage.tp_history.find(x => { return x.times === times && x.order === preAuditors[0].order; });
|
|
|
+ if (his) {
|
|
|
+ tp.contract_tp = his.contract_tp;
|
|
|
+ tp.qc_tp = his.qc_tp;
|
|
|
+ tp.positive_qc_tp = his.positive_qc_tp;
|
|
|
+ tp.negative_qc_tp = his.negative_qc_tp;
|
|
|
+ tp.yf_tp = his.yf_tp;
|
|
|
+ tp.sf_tp = his.sf_tp;
|
|
|
+ }
|
|
|
+
|
|
|
+ data.stage_flow_cur_tp = JSON.stringify(tp);
|
|
|
+ data.stage_flow_pre_tp = JSON.stringify(tp);
|
|
|
+ await transaction.update(this.tableName, data);
|
|
|
+ }
|
|
|
+
|
|
|
async updateStageCache4Start(transaction, stage, status, auditors, ledgerTp, stageTp) {
|
|
|
const orgCache = await this.getDataById(stage.tid);
|
|
|
const data = { id: stage.tid, stage_status: status };
|