|
@@ -216,7 +216,6 @@ module.exports = app => {
|
|
|
|
|
|
const transaction = await this.db.beginTransaction();
|
|
const transaction = await this.db.beginTransaction();
|
|
try {
|
|
try {
|
|
- await transaction.update(this.tableName, {id: audit.id, status: auditConst.status.checking, begin_time: new Date()});
|
|
|
|
// 计算原报最终数据
|
|
// 计算原报最终数据
|
|
const [yfPay, sfPay] = await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
|
|
const [yfPay, sfPay] = await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
|
|
// 复制一份下一审核人数据
|
|
// 复制一份下一审核人数据
|
|
@@ -226,12 +225,21 @@ module.exports = app => {
|
|
await this.ctx.service.stageOther.updateHistory(this.ctx.stage, transaction);
|
|
await this.ctx.service.stageOther.updateHistory(this.ctx.stage, transaction);
|
|
// 更新期数据
|
|
// 更新期数据
|
|
const tpData = await this.ctx.service.stageBills.getSumTotalPrice(this.ctx.stage);
|
|
const tpData = await this.ctx.service.stageBills.getSumTotalPrice(this.ctx.stage);
|
|
|
|
+ const tpHistory = this.ctx.stage.tp_history ? JSON.parse(this.ctx.stage.tp_history) : [];
|
|
|
|
+ tpHistory.push({
|
|
|
|
+ times: this.ctx.stage.curTimes, order: 0,
|
|
|
|
+ contract_tp: tpData.contract_tp,
|
|
|
|
+ qc_tp: tpData.qc_tp,
|
|
|
|
+ yf_tp: yfPay.tp,
|
|
|
|
+ sf_tp: sfPay.tp,
|
|
|
|
+ });
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
id: stageId, status: auditConst.status.checking,
|
|
id: stageId, status: auditConst.status.checking,
|
|
contract_tp: tpData.contract_tp,
|
|
contract_tp: tpData.contract_tp,
|
|
qc_tp: tpData.qc_tp,
|
|
qc_tp: tpData.qc_tp,
|
|
yf_tp: yfPay.tp,
|
|
yf_tp: yfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
|
|
+ tp_history: JSON.stringify(tpHistory),
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
});
|
|
});
|
|
|
|
|
|
@@ -276,6 +284,14 @@ module.exports = app => {
|
|
await transaction.update(this.tableName, {id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time});
|
|
await transaction.update(this.tableName, {id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time});
|
|
// 计算并合同支付最终数据
|
|
// 计算并合同支付最终数据
|
|
const [yfPay, sfPay] = await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
|
|
const [yfPay, sfPay] = await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
|
|
|
|
+ const tpHistory = this.ctx.stage.tp_history ? JSON.parse(this.ctx.stage.tp_history) : [];
|
|
|
|
+ tpHistory.push({
|
|
|
|
+ times: times, order: audit.order,
|
|
|
|
+ contract_tp: tpData.contract_tp,
|
|
|
|
+ qc_tp: tpData.qc_tp,
|
|
|
|
+ yf_tp: yfPay.tp,
|
|
|
|
+ sf_tp: sfPay.tp,
|
|
|
|
+ });
|
|
// 无下一审核人表示,审核结束
|
|
// 无下一审核人表示,审核结束
|
|
if (nextAudit) {
|
|
if (nextAudit) {
|
|
// 复制一份下一审核人数据
|
|
// 复制一份下一审核人数据
|
|
@@ -292,6 +308,7 @@ module.exports = app => {
|
|
qc_tp: tpData.qc_tp,
|
|
qc_tp: tpData.qc_tp,
|
|
yf_tp: yfPay.tp,
|
|
yf_tp: yfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
|
|
+ tp_history: JSON.stringify(tpHistory),
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
});
|
|
});
|
|
|
|
|
|
@@ -326,6 +343,7 @@ module.exports = app => {
|
|
qc_tp: tpData.qc_tp,
|
|
qc_tp: tpData.qc_tp,
|
|
yf_tp: yfPay.tp,
|
|
yf_tp: yfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
|
|
+ tp_history: JSON.stringify(tpHistory),
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
});
|
|
});
|
|
|
|
|
|
@@ -389,6 +407,14 @@ module.exports = app => {
|
|
try {
|
|
try {
|
|
// 计算并合同支付最终数据
|
|
// 计算并合同支付最终数据
|
|
const [yfPay, sfPay] = await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
|
|
const [yfPay, sfPay] = await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
|
|
|
|
+ const tpHistory = this.ctx.stage.tp_history ? JSON.parse(this.ctx.stage.tp_history) : [];
|
|
|
|
+ tpHistory.push({
|
|
|
|
+ times: times + 1, order: 0,
|
|
|
|
+ contract_tp: tpData.contract_tp,
|
|
|
|
+ qc_tp: tpData.qc_tp,
|
|
|
|
+ yf_tp: yfPay.tp,
|
|
|
|
+ sf_tp: sfPay.tp,
|
|
|
|
+ });
|
|
await transaction.update(this.tableName, {id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time});
|
|
await transaction.update(this.tableName, {id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time});
|
|
// 同步 期信息
|
|
// 同步 期信息
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
@@ -398,6 +424,7 @@ module.exports = app => {
|
|
times: times + 1,
|
|
times: times + 1,
|
|
yf_tp: yfPay.tp,
|
|
yf_tp: yfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
|
|
+ tp_history: JSON.stringify(tpHistory),
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
});
|
|
});
|
|
// 拷贝新一次审核流程列表
|
|
// 拷贝新一次审核流程列表
|
|
@@ -466,6 +493,14 @@ module.exports = app => {
|
|
try {
|
|
try {
|
|
// 计算并合同支付最终数据
|
|
// 计算并合同支付最终数据
|
|
const [yfPay, sfPay] = await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
|
|
const [yfPay, sfPay] = await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
|
|
|
|
+ const tpHistory = this.ctx.stage.tp_history ? JSON.parse(this.ctx.stage.tp_history) : [];
|
|
|
|
+ tpHistory.push({
|
|
|
|
+ times: times, order: audit.order,
|
|
|
|
+ contract_tp: tpData.contract_tp,
|
|
|
|
+ qc_tp: tpData.qc_tp,
|
|
|
|
+ yf_tp: yfPay.tp,
|
|
|
|
+ sf_tp: sfPay.tp,
|
|
|
|
+ });
|
|
// 同步 期信息
|
|
// 同步 期信息
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
id: stageId,
|
|
id: stageId,
|
|
@@ -474,6 +509,7 @@ module.exports = app => {
|
|
times: times,
|
|
times: times,
|
|
yf_tp: yfPay.tp,
|
|
yf_tp: yfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
|
|
+ tp_history: JSON.stringify(tpHistory),
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
});
|
|
});
|
|
await transaction.update(this.tableName, {id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time});
|
|
await transaction.update(this.tableName, {id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time});
|