|
@@ -255,6 +255,7 @@ module.exports = app => {
|
|
await transaction.update(this.ctx.service.tender.tableName, {
|
|
await transaction.update(this.ctx.service.tender.tableName, {
|
|
id: this.ctx.tender.id, total_price: sum.total_price, deal_tp: sum.deal_tp
|
|
id: this.ctx.tender.id, total_price: sum.total_price, deal_tp: sum.deal_tp
|
|
});
|
|
});
|
|
|
|
+ return sum;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -276,7 +277,7 @@ module.exports = app => {
|
|
|
|
|
|
const transaction = await this.db.beginTransaction();
|
|
const transaction = await this.db.beginTransaction();
|
|
try {
|
|
try {
|
|
- await this._updateTender(transaction);
|
|
|
|
|
|
+ const ledgerTp = await this._updateTender(transaction);
|
|
await transaction.update(this.tableName, {
|
|
await transaction.update(this.tableName, {
|
|
id: audit.id,
|
|
id: audit.id,
|
|
status: auditConst.status.checking,
|
|
status: auditConst.status.checking,
|
|
@@ -293,25 +294,20 @@ module.exports = app => {
|
|
await this.ctx.service.stageTempLand.updateHistory(this.ctx.stage, transaction);
|
|
await this.ctx.service.stageTempLand.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);
|
|
- this.ctx.stage.tp_history.push({
|
|
|
|
- times: this.ctx.stage.curTimes,
|
|
|
|
- order: 0,
|
|
|
|
|
|
+ const stageTp = {
|
|
contract_tp: tpData.contract_tp,
|
|
contract_tp: tpData.contract_tp,
|
|
qc_tp: tpData.qc_tp,
|
|
qc_tp: tpData.qc_tp,
|
|
positive_qc_tp: tpData.positive_qc_tp,
|
|
positive_qc_tp: tpData.positive_qc_tp,
|
|
negative_qc_tp: tpData.negative_qc_tp,
|
|
negative_qc_tp: tpData.negative_qc_tp,
|
|
yf_tp: yfPay.tp,
|
|
yf_tp: yfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
- });
|
|
|
|
|
|
+ };
|
|
|
|
+ this.ctx.stage.tp_history.push({ times: this.ctx.stage.curTimes, order: 0, ...stageTp });
|
|
|
|
+ await this.ctx.service.tenderCache.updateStageCache4Start(transaction, this.ctx.stage, auditConst.status.checking, audit, ledgerTp, stageTp);
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
id: stageId,
|
|
id: stageId,
|
|
status: auditConst.status.checking,
|
|
status: auditConst.status.checking,
|
|
- contract_tp: tpData.contract_tp,
|
|
|
|
- qc_tp: tpData.qc_tp,
|
|
|
|
- positive_qc_tp: tpData.positive_qc_tp,
|
|
|
|
- negative_qc_tp: tpData.negative_qc_tp,
|
|
|
|
- yf_tp: yfPay.tp,
|
|
|
|
- sf_tp: sfPay.tp,
|
|
|
|
|
|
+ ...stageTp,
|
|
tp_history: JSON.stringify(this.ctx.stage.tp_history),
|
|
tp_history: JSON.stringify(this.ctx.stage.tp_history),
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
});
|
|
});
|
|
@@ -374,7 +370,7 @@ module.exports = app => {
|
|
const transaction = await this.db.beginTransaction();
|
|
const transaction = await this.db.beginTransaction();
|
|
|
|
|
|
try {
|
|
try {
|
|
- await this._updateTender(transaction);
|
|
|
|
|
|
+ const ledgerTp = await this._updateTender(transaction);
|
|
// 添加推送
|
|
// 添加推送
|
|
const noticeContent = await this.getNoticeContent(pid, audit.tid, stageId, audit.aid, checkData.opinion);
|
|
const noticeContent = await this.getNoticeContent(pid, audit.tid, stageId, audit.aid, checkData.opinion);
|
|
const auditors = await this.getAuditGroupByListWithOwner(stageId, times);
|
|
const auditors = await this.getAuditGroupByListWithOwner(stageId, times);
|
|
@@ -407,16 +403,15 @@ module.exports = app => {
|
|
});
|
|
});
|
|
// 计算并合同支付最终数据
|
|
// 计算并合同支付最终数据
|
|
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);
|
|
- this.ctx.stage.tp_history.push({
|
|
|
|
- times,
|
|
|
|
- order: audit.order,
|
|
|
|
|
|
+ const stageTp = {
|
|
contract_tp: tpData.contract_tp,
|
|
contract_tp: tpData.contract_tp,
|
|
qc_tp: tpData.qc_tp,
|
|
qc_tp: tpData.qc_tp,
|
|
positive_qc_tp: tpData.positive_qc_tp,
|
|
positive_qc_tp: tpData.positive_qc_tp,
|
|
negative_qc_tp: tpData.negative_qc_tp,
|
|
negative_qc_tp: tpData.negative_qc_tp,
|
|
yf_tp: yfPay.tp,
|
|
yf_tp: yfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
- });
|
|
|
|
|
|
+ };
|
|
|
|
+ this.ctx.stage.tp_history.push({ times, order: audit.order, ...stageTp });
|
|
// 无下一审核人表示,审核结束
|
|
// 无下一审核人表示,审核结束
|
|
if (nextAudit) {
|
|
if (nextAudit) {
|
|
// 复制一份下一审核人数据
|
|
// 复制一份下一审核人数据
|
|
@@ -436,15 +431,11 @@ module.exports = app => {
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
id: stageId,
|
|
id: stageId,
|
|
status: auditConst.status.checking,
|
|
status: auditConst.status.checking,
|
|
- contract_tp: tpData.contract_tp,
|
|
|
|
- qc_tp: tpData.qc_tp,
|
|
|
|
- positive_qc_tp: tpData.positive_qc_tp,
|
|
|
|
- negative_qc_tp: tpData.negative_qc_tp,
|
|
|
|
- yf_tp: yfPay.tp,
|
|
|
|
- sf_tp: sfPay.tp,
|
|
|
|
|
|
+ ...stageTp,
|
|
tp_history: JSON.stringify(this.ctx.stage.tp_history),
|
|
tp_history: JSON.stringify(this.ctx.stage.tp_history),
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
});
|
|
});
|
|
|
|
+ await this.ctx.service.tenderCache.updateStageCache4Flow(transaction, this.ctx.stage, auditConst.status.checking, audit, nextAudit, ledgerTp, stageTp);
|
|
// 多人协同,取消下一审批人存在的锁定
|
|
// 多人协同,取消下一审批人存在的锁定
|
|
await this.ctx.service.stageAuditAss.cancelLock(this.ctx.stage, nextAudit.aid, transaction);
|
|
await this.ctx.service.stageAuditAss.cancelLock(this.ctx.stage, nextAudit.aid, transaction);
|
|
|
|
|
|
@@ -479,16 +470,12 @@ module.exports = app => {
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
id: stageId,
|
|
id: stageId,
|
|
status: checkData.checkType,
|
|
status: checkData.checkType,
|
|
- contract_tp: tpData.contract_tp,
|
|
|
|
- qc_tp: tpData.qc_tp,
|
|
|
|
- positive_qc_tp: tpData.positive_qc_tp,
|
|
|
|
- negative_qc_tp: tpData.negative_qc_tp,
|
|
|
|
- yf_tp: yfPay.tp,
|
|
|
|
- sf_tp: sfPay.tp,
|
|
|
|
|
|
+ ...stageTp,
|
|
tp_history: JSON.stringify(this.ctx.stage.tp_history),
|
|
tp_history: JSON.stringify(this.ctx.stage.tp_history),
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
his_id,
|
|
his_id,
|
|
});
|
|
});
|
|
|
|
+ await this.ctx.service.tenderCache.updateStageCache4Flow(transaction, this.ctx.stage, checkData.checkType, audit, nextAudit, ledgerTp, stageTp);
|
|
await this.ctx.service.stagePay.cacheOrder(this.ctx.stage, transaction);
|
|
await this.ctx.service.stagePay.cacheOrder(this.ctx.stage, transaction);
|
|
|
|
|
|
// 添加短信通知-审批通过提醒功能
|
|
// 添加短信通知-审批通过提醒功能
|
|
@@ -543,7 +530,7 @@ module.exports = app => {
|
|
|
|
|
|
const transaction = await this.db.beginTransaction();
|
|
const transaction = await this.db.beginTransaction();
|
|
try {
|
|
try {
|
|
- await this._updateTender(transaction);
|
|
|
|
|
|
+ const ledgerTp = await this._updateTender(transaction);
|
|
// 添加推送
|
|
// 添加推送
|
|
const noticeContent = await this.getNoticeContent(pid, audit.tid, stageId, audit.aid, checkData.opinion);
|
|
const noticeContent = await this.getNoticeContent(pid, audit.tid, stageId, audit.aid, checkData.opinion);
|
|
const defaultNoticeRecord = {
|
|
const defaultNoticeRecord = {
|
|
@@ -574,16 +561,15 @@ module.exports = app => {
|
|
|
|
|
|
// 计算并合同支付最终数据
|
|
// 计算并合同支付最终数据
|
|
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);
|
|
- this.ctx.stage.tp_history.push({
|
|
|
|
- times,
|
|
|
|
- order: audit.order,
|
|
|
|
|
|
+ const stageTp = {
|
|
contract_tp: tpData.contract_tp,
|
|
contract_tp: tpData.contract_tp,
|
|
qc_tp: tpData.qc_tp,
|
|
qc_tp: tpData.qc_tp,
|
|
positive_qc_tp: tpData.positive_qc_tp,
|
|
positive_qc_tp: tpData.positive_qc_tp,
|
|
negative_qc_tp: tpData.negative_qc_tp,
|
|
negative_qc_tp: tpData.negative_qc_tp,
|
|
yf_tp: yfPay.tp,
|
|
yf_tp: yfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
- });
|
|
|
|
|
|
+ };
|
|
|
|
+ this.ctx.stage.tp_history.push({ times, order: audit.order, ...stageTp });
|
|
await transaction.update(this.tableName, {
|
|
await transaction.update(this.tableName, {
|
|
id: audit.id,
|
|
id: audit.id,
|
|
status: checkData.checkType,
|
|
status: checkData.checkType,
|
|
@@ -594,16 +580,12 @@ module.exports = app => {
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
id: stageId,
|
|
id: stageId,
|
|
status: checkData.checkType,
|
|
status: checkData.checkType,
|
|
- contract_tp: tpData.contract_tp,
|
|
|
|
- qc_tp: tpData.qc_tp,
|
|
|
|
- positive_qc_tp: tpData.positive_qc_tp,
|
|
|
|
- negative_qc_tp: tpData.negative_qc_tp,
|
|
|
|
|
|
+ ...stageTp,
|
|
times: times + 1,
|
|
times: times + 1,
|
|
- yf_tp: yfPay.tp,
|
|
|
|
- sf_tp: sfPay.tp,
|
|
|
|
tp_history: JSON.stringify(this.ctx.stage.tp_history),
|
|
tp_history: JSON.stringify(this.ctx.stage.tp_history),
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
});
|
|
});
|
|
|
|
+ await this.ctx.service.tenderCache.updateStageCache4Flow(transaction, this.ctx.stage, checkData.checkType, { id: this.ctx.stage.user_id }, audit, ledgerTp, stageTp);
|
|
// 拷贝新一次审核流程列表
|
|
// 拷贝新一次审核流程列表
|
|
await transaction.insert(this.tableName, auditors);
|
|
await transaction.insert(this.tableName, auditors);
|
|
// 计算该审批人最终数据
|
|
// 计算该审批人最终数据
|
|
@@ -666,7 +648,7 @@ module.exports = app => {
|
|
const tpData = await this.ctx.service.stageBills.getSumTotalPrice(this.ctx.stage);
|
|
const tpData = await this.ctx.service.stageBills.getSumTotalPrice(this.ctx.stage);
|
|
const transaction = await this.db.beginTransaction();
|
|
const transaction = await this.db.beginTransaction();
|
|
try {
|
|
try {
|
|
- await this._updateTender(transaction);
|
|
|
|
|
|
+ const ledgerTp = await this._updateTender(transaction);
|
|
// 添加推送
|
|
// 添加推送
|
|
const noticeContent = await this.getNoticeContent(pid, audit.tid, stageId, audit.aid, checkData.opinion);
|
|
const noticeContent = await this.getNoticeContent(pid, audit.tid, stageId, audit.aid, checkData.opinion);
|
|
const defaultNoticeRecord = {
|
|
const defaultNoticeRecord = {
|
|
@@ -698,36 +680,31 @@ module.exports = app => {
|
|
|
|
|
|
// 计算并合同支付最终数据
|
|
// 计算并合同支付最终数据
|
|
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);
|
|
- this.ctx.stage.tp_history.push({
|
|
|
|
- times,
|
|
|
|
- order: audit.order,
|
|
|
|
|
|
+ const stageTp = {
|
|
contract_tp: tpData.contract_tp,
|
|
contract_tp: tpData.contract_tp,
|
|
qc_tp: tpData.qc_tp,
|
|
qc_tp: tpData.qc_tp,
|
|
positive_qc_tp: tpData.positive_qc_tp,
|
|
positive_qc_tp: tpData.positive_qc_tp,
|
|
negative_qc_tp: tpData.negative_qc_tp,
|
|
negative_qc_tp: tpData.negative_qc_tp,
|
|
yf_tp: yfPay.tp,
|
|
yf_tp: yfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
- });
|
|
|
|
|
|
+ };
|
|
|
|
+ this.ctx.stage.tp_history.push({ times, order: audit.order, ...stageTp });
|
|
// 同步 期信息
|
|
// 同步 期信息
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
id: stageId,
|
|
id: stageId,
|
|
- contract_tp: tpData.contract_tp,
|
|
|
|
- qc_tp: tpData.qc_tp,
|
|
|
|
- positive_qc_tp: tpData.positive_qc_tp,
|
|
|
|
- negative_qc_tp: tpData.negative_qc_tp,
|
|
|
|
times,
|
|
times,
|
|
- yf_tp: yfPay.tp,
|
|
|
|
- sf_tp: sfPay.tp,
|
|
|
|
|
|
+ ...stageTp,
|
|
tp_history: JSON.stringify(this.ctx.stage.tp_history),
|
|
tp_history: JSON.stringify(this.ctx.stage.tp_history),
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
});
|
|
});
|
|
|
|
+ await this.ctx.service.tenderCache.updateStageCache4Flow(transaction, this.ctx.stage, checkData.checkType, audit, preAuditor, ledgerTp, stageTp);
|
|
await transaction.update(this.tableName, {
|
|
await transaction.update(this.tableName, {
|
|
id: audit.id,
|
|
id: audit.id,
|
|
status: checkData.checkType,
|
|
status: checkData.checkType,
|
|
opinion: checkData.opinion,
|
|
opinion: checkData.opinion,
|
|
end_time: time,
|
|
end_time: time,
|
|
});
|
|
});
|
|
- // 顺移气候审核人流程顺序
|
|
|
|
|
|
+ // 顺移其后审核人流程顺序
|
|
this.initSqlBuilder();
|
|
this.initSqlBuilder();
|
|
this.sqlBuilder.setAndWhere('sid', { value: this.ctx.stage.id, operate: '=' });
|
|
this.sqlBuilder.setAndWhere('sid', { value: this.ctx.stage.id, operate: '=' });
|
|
this.sqlBuilder.setAndWhere('order', { value: audit.order, operate: '>' });
|
|
this.sqlBuilder.setAndWhere('order', { value: audit.order, operate: '>' });
|
|
@@ -902,14 +879,15 @@ module.exports = app => {
|
|
|
|
|
|
// 同步 期信息
|
|
// 同步 期信息
|
|
const his = this.ctx.stage.tp_history.find(x => { return x.times === times && x.order === audit.order });
|
|
const his = this.ctx.stage.tp_history.find(x => { return x.times === times && x.order === audit.order });
|
|
- this.ctx.stage.tp_history.push({
|
|
|
|
- times,
|
|
|
|
- order: audit.order + 1,
|
|
|
|
|
|
+ const stageTp = {
|
|
contract_tp: his.contract_tp,
|
|
contract_tp: his.contract_tp,
|
|
qc_tp: his.qc_tp,
|
|
qc_tp: his.qc_tp,
|
|
- yf_tp: his.yf_tp,
|
|
|
|
- sf_tp: his.sf_tp,
|
|
|
|
- });
|
|
|
|
|
|
+ positive_qc_tp: his.positive_qc_tp,
|
|
|
|
+ negative_qc_tp: his.negative_qc_tp,
|
|
|
|
+ yf_tp: his.tp,
|
|
|
|
+ sf_tp: his.tp,
|
|
|
|
+ };
|
|
|
|
+ this.ctx.stage.tp_history.push({ times, order: audit.order + 1, ...stageTp });
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
id: stageId,
|
|
id: stageId,
|
|
status: auditConst.status.checking,
|
|
status: auditConst.status.checking,
|
|
@@ -920,7 +898,8 @@ module.exports = app => {
|
|
await this.ctx.service.revisePrice.cancelPriceUsed(this.ctx.stage, transaction);
|
|
await this.ctx.service.revisePrice.cancelPriceUsed(this.ctx.stage, transaction);
|
|
// 重算所有单价变更
|
|
// 重算所有单价变更
|
|
const priceCalc = new RevisePrice(this.ctx);
|
|
const priceCalc = new RevisePrice(this.ctx);
|
|
- await priceCalc.stageCheckAgainPriceChange(this.ctx.stage, audit.order + 2, transaction);
|
|
|
|
|
|
+ const pcTp = await priceCalc.stageCheckAgainPriceChange(this.ctx.stage, audit.order + 2, transaction);
|
|
|
|
+ await this.ctx.service.tenderCache.updateStageCache4Flow(transaction, this.ctx.stage, auditConst.status.checking, audit, audit, null, stageTp, pcTp);
|
|
|
|
|
|
// 添加短信通知-需要审批提醒功能
|
|
// 添加短信通知-需要审批提醒功能
|
|
// const smsUser = await this.ctx.service.projectAccount.getDataById(audit.aid);
|
|
// const smsUser = await this.ctx.service.projectAccount.getDataById(audit.aid);
|
|
@@ -992,7 +971,7 @@ module.exports = app => {
|
|
const transaction = await this.db.beginTransaction();
|
|
const transaction = await this.db.beginTransaction();
|
|
const time = new Date();
|
|
const time = new Date();
|
|
try {
|
|
try {
|
|
- await this._updateTender(transaction);
|
|
|
|
|
|
+ const ledgerTp = await this._updateTender(transaction);
|
|
let newTimes, newOrder, newSaid, oldTimes, oldOrder, oldSaid = '';
|
|
let newTimes, newOrder, newSaid, oldTimes, oldOrder, oldSaid = '';
|
|
if (this.ctx.stage.cancancel === 1) {
|
|
if (this.ctx.stage.cancancel === 1) {
|
|
// 原报撤回,判断是否为多次,多次则为退回状态
|
|
// 原报撤回,判断是否为多次,多次则为退回状态
|
|
@@ -1008,29 +987,24 @@ module.exports = app => {
|
|
const tpData = await this.ctx.service.stageBills.getSumTotalPrice(this.ctx.stage);
|
|
const tpData = await this.ctx.service.stageBills.getSumTotalPrice(this.ctx.stage);
|
|
// 计算并合同支付最终数据
|
|
// 计算并合同支付最终数据
|
|
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);
|
|
- this.ctx.stage.tp_history.push({
|
|
|
|
- times,
|
|
|
|
- order: curAudit.order,
|
|
|
|
|
|
+ const stageTp = {
|
|
contract_tp: tpData.contract_tp,
|
|
contract_tp: tpData.contract_tp,
|
|
qc_tp: tpData.qc_tp,
|
|
qc_tp: tpData.qc_tp,
|
|
positive_qc_tp: tpData.positive_qc_tp,
|
|
positive_qc_tp: tpData.positive_qc_tp,
|
|
negative_qc_tp: tpData.negative_qc_tp,
|
|
negative_qc_tp: tpData.negative_qc_tp,
|
|
yf_tp: yfPay.tp,
|
|
yf_tp: yfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
- });
|
|
|
|
|
|
+ };
|
|
|
|
+ this.ctx.stage.tp_history.push({ times, order: curAudit.order, ...stageTp });
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
id: stageId,
|
|
id: stageId,
|
|
- contract_tp: tpData.contract_tp,
|
|
|
|
- qc_tp: tpData.qc_tp,
|
|
|
|
- positive_qc_tp: tpData.positive_qc_tp,
|
|
|
|
- negative_qc_tp: tpData.negative_qc_tp,
|
|
|
|
times,
|
|
times,
|
|
- yf_tp: yfPay.tp,
|
|
|
|
- sf_tp: sfPay.tp,
|
|
|
|
|
|
+ ...stageTp,
|
|
tp_history: JSON.stringify(this.ctx.stage.tp_history),
|
|
tp_history: JSON.stringify(this.ctx.stage.tp_history),
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
status: times === 1 ? auditConst.status.uncheck : auditConst.status.checkNo,
|
|
status: times === 1 ? auditConst.status.uncheck : auditConst.status.checkNo,
|
|
});
|
|
});
|
|
|
|
+ await this.ctx.service.tenderCache.updateStageCache4Flow(transaction, this.ctx.stage, times === 1 ? auditConst.status.uncheck : auditConst.status.checkNo, { id: this.ctx.stage.user_id }, { id: this.ctx.stage.user_id }, ledgerTp, stageTp);
|
|
// 计算该审批人最终数据
|
|
// 计算该审批人最终数据
|
|
await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
|
|
await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
|
|
// 复制一份最新数据给下一人
|
|
// 复制一份最新数据给下一人
|
|
@@ -1086,29 +1060,24 @@ module.exports = app => {
|
|
await transaction.update(this.tableName, { id: curAudit.id, order: curAudit.order + 2, begin_time: null, status: auditConst.status.uncheck });
|
|
await transaction.update(this.tableName, { id: curAudit.id, order: curAudit.order + 2, begin_time: null, status: auditConst.status.uncheck });
|
|
// 计算并合同支付最终数据
|
|
// 计算并合同支付最终数据
|
|
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);
|
|
- this.ctx.stage.tp_history.push({
|
|
|
|
- times,
|
|
|
|
- order: curAudit.order,
|
|
|
|
|
|
+ const stageTp = {
|
|
contract_tp: tpData.contract_tp,
|
|
contract_tp: tpData.contract_tp,
|
|
qc_tp: tpData.qc_tp,
|
|
qc_tp: tpData.qc_tp,
|
|
positive_qc_tp: tpData.positive_qc_tp,
|
|
positive_qc_tp: tpData.positive_qc_tp,
|
|
negative_qc_tp: tpData.negative_qc_tp,
|
|
negative_qc_tp: tpData.negative_qc_tp,
|
|
yf_tp: yfPay.tp,
|
|
yf_tp: yfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
- });
|
|
|
|
|
|
+ };
|
|
|
|
+ this.ctx.stage.tp_history.push({ times, order: curAudit.order, ...stageTp });
|
|
// 同步 期信息
|
|
// 同步 期信息
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
id: stageId,
|
|
id: stageId,
|
|
- contract_tp: tpData.contract_tp,
|
|
|
|
- qc_tp: tpData.qc_tp,
|
|
|
|
- positive_qc_tp: tpData.positive_qc_tp,
|
|
|
|
- negative_qc_tp: tpData.negative_qc_tp,
|
|
|
|
times,
|
|
times,
|
|
- yf_tp: yfPay.tp,
|
|
|
|
- sf_tp: sfPay.tp,
|
|
|
|
|
|
+ ...stageTp,
|
|
tp_history: JSON.stringify(this.ctx.stage.tp_history),
|
|
tp_history: JSON.stringify(this.ctx.stage.tp_history),
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
});
|
|
});
|
|
|
|
+ await this.ctx.service.tenderCache.updateStageCache4Flow(transaction, this.ctx.stage.status, preAudit, preAudit, ledgerTp, stageTp);
|
|
|
|
|
|
// 计算该审批人最终数据
|
|
// 计算该审批人最终数据
|
|
await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
|
|
await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
|
|
@@ -1130,13 +1099,6 @@ module.exports = app => {
|
|
if (!curAudit || curAudit.order <= 1) {
|
|
if (!curAudit || curAudit.order <= 1) {
|
|
throw '撤回用户数据错误';
|
|
throw '撤回用户数据错误';
|
|
}
|
|
}
|
|
- // // 顺移气候审核人流程顺序
|
|
|
|
- // this.initSqlBuilder();
|
|
|
|
- // this.sqlBuilder.setAndWhere('sid', { value: this.ctx.stage.id, operate: '=' });
|
|
|
|
- // this.sqlBuilder.setAndWhere('order', { value: curAudit.order, operate: '>' });
|
|
|
|
- // this.sqlBuilder.setUpdateData('order', { value: 2, selfOperate: '+' });
|
|
|
|
- // const [sql, sqlParam] = this.sqlBuilder.build(this.tableName, 'update');
|
|
|
|
- // const data = await transaction.query(sql, sqlParam);
|
|
|
|
// 添加撤回人到审批流程中
|
|
// 添加撤回人到审批流程中
|
|
const newAuditors = [];
|
|
const newAuditors = [];
|
|
newAuditors.push({
|
|
newAuditors.push({
|
|
@@ -1161,33 +1123,27 @@ module.exports = app => {
|
|
order: curAudit.order + 1,
|
|
order: curAudit.order + 1,
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- // 修改stage状态为审批中
|
|
|
|
- await transaction.update(this.ctx.service.stage.tableName, { id: this.ctx.stage.id, status: auditConst.status.checking });
|
|
|
|
// 计算并合同支付最终数据
|
|
// 计算并合同支付最终数据
|
|
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);
|
|
- this.ctx.stage.tp_history.push({
|
|
|
|
- times,
|
|
|
|
- order: curAudit.order,
|
|
|
|
|
|
+ const stageTp = {
|
|
contract_tp: tpData.contract_tp,
|
|
contract_tp: tpData.contract_tp,
|
|
qc_tp: tpData.qc_tp,
|
|
qc_tp: tpData.qc_tp,
|
|
positive_qc_tp: tpData.positive_qc_tp,
|
|
positive_qc_tp: tpData.positive_qc_tp,
|
|
negative_qc_tp: tpData.negative_qc_tp,
|
|
negative_qc_tp: tpData.negative_qc_tp,
|
|
yf_tp: yfPay.tp,
|
|
yf_tp: yfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
- });
|
|
|
|
|
|
+ };
|
|
|
|
+ this.ctx.stage.tp_history.push({ times, order: curAudit.order, ...stageTp });
|
|
// 同步 期信息
|
|
// 同步 期信息
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
id: stageId,
|
|
id: stageId,
|
|
- contract_tp: tpData.contract_tp,
|
|
|
|
- qc_tp: tpData.qc_tp,
|
|
|
|
- positive_qc_tp: tpData.positive_qc_tp,
|
|
|
|
- negative_qc_tp: tpData.negative_qc_tp,
|
|
|
|
times,
|
|
times,
|
|
- yf_tp: yfPay.tp,
|
|
|
|
- sf_tp: sfPay.tp,
|
|
|
|
|
|
+ ...stageTp,
|
|
|
|
+ status: auditConst.status.checking,
|
|
tp_history: JSON.stringify(this.ctx.stage.tp_history),
|
|
tp_history: JSON.stringify(this.ctx.stage.tp_history),
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
});
|
|
});
|
|
|
|
+ await this.ctx.service.tenderCache.updateStageCache4Flow(transaction, this.ctx.stage.status, preAudit, preAudit, ledgerTp, stageTp);
|
|
|
|
|
|
// 计算该审批人最终数据
|
|
// 计算该审批人最终数据
|
|
await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
|
|
await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
|
|
@@ -1242,29 +1198,24 @@ module.exports = app => {
|
|
const tpData = await this.ctx.service.stageBills.getSumTotalPrice(this.ctx.stage);
|
|
const tpData = await this.ctx.service.stageBills.getSumTotalPrice(this.ctx.stage);
|
|
// 计算并合同支付最终数据
|
|
// 计算并合同支付最终数据
|
|
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);
|
|
- this.ctx.stage.tp_history.push({
|
|
|
|
- times: times - 1,
|
|
|
|
- order: curAudit.order,
|
|
|
|
|
|
+ const stageTp = {
|
|
contract_tp: tpData.contract_tp,
|
|
contract_tp: tpData.contract_tp,
|
|
qc_tp: tpData.qc_tp,
|
|
qc_tp: tpData.qc_tp,
|
|
positive_qc_tp: tpData.positive_qc_tp,
|
|
positive_qc_tp: tpData.positive_qc_tp,
|
|
negative_qc_tp: tpData.negative_qc_tp,
|
|
negative_qc_tp: tpData.negative_qc_tp,
|
|
yf_tp: yfPay.tp,
|
|
yf_tp: yfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
sf_tp: sfPay.tp,
|
|
- });
|
|
|
|
|
|
+ };
|
|
|
|
+ this.ctx.stage.tp_history.push({ times: times - 1, order: curAudit.order, ...stageTp });
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
await transaction.update(this.ctx.service.stage.tableName, {
|
|
id: stageId,
|
|
id: stageId,
|
|
- contract_tp: tpData.contract_tp,
|
|
|
|
- qc_tp: tpData.qc_tp,
|
|
|
|
- positive_qc_tp: tpData.positive_qc_tp,
|
|
|
|
- negative_qc_tp: tpData.negative_qc_tp,
|
|
|
|
times: times - 1,
|
|
times: times - 1,
|
|
- yf_tp: yfPay.tp,
|
|
|
|
- sf_tp: sfPay.tp,
|
|
|
|
|
|
+ ...stageTp,
|
|
tp_history: JSON.stringify(this.ctx.stage.tp_history),
|
|
tp_history: JSON.stringify(this.ctx.stage.tp_history),
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
status: auditConst.status.checking,
|
|
status: auditConst.status.checking,
|
|
});
|
|
});
|
|
|
|
+ await this.ctx.service.tenderCache.updateStageCache4Flow(transaction, this.ctx.stage.status, curAudit, curAudit, ledgerTp, stageTp);
|
|
// 计算该审批人最终数据
|
|
// 计算该审批人最终数据
|
|
await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
|
|
await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
|
|
// 复制一份最新数据给下一人
|
|
// 复制一份最新数据给下一人
|
|
@@ -1611,7 +1562,7 @@ module.exports = app => {
|
|
order++;
|
|
order++;
|
|
}
|
|
}
|
|
|
|
|
|
- await this._updateTender(transaction);
|
|
|
|
|
|
+ const ledgerTp = await this._updateTender(transaction);
|
|
// 拷贝新一次审核流程列表
|
|
// 拷贝新一次审核流程列表
|
|
await transaction.insert(this.tableName, auditors);
|
|
await transaction.insert(this.tableName, auditors);
|
|
|
|
|