|
@@ -399,6 +399,16 @@ module.exports = app => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ async _innerCheckChangeBillsOver(ctx, checkData) {
|
|
|
+ const change = await this.ctx.service.change.getAllDataByCondition({ where: { tid: ctx.tender.id }});
|
|
|
+ if (change.length > 0) {
|
|
|
+ const cid = change.map(x => { return x.cid; });
|
|
|
+ const changeBills = await this.ctx.service.changeAuditList.getAllDataByCondition({ where: { cid } });
|
|
|
+ const endStageChange = await this.ctx.service.stageChange.getFinalUsedData(ctx.tender.id, cid);
|
|
|
+ checkData.checkChangeBillsOver(change, changeBills, endStageChange, ctx.stage.id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
async check(ctx) {
|
|
|
try {
|
|
|
const helper = this.ctx.helper;
|
|
@@ -437,6 +447,9 @@ module.exports = app => {
|
|
|
}
|
|
|
}
|
|
|
if (ctx.stage.readySettle) checkData.checkSettle();
|
|
|
+ if (ctx.stage.status === auditConst.status.uncheck || ctx.stage.status === auditConst.status.checkNo) {
|
|
|
+ await this._innerCheckChangeBillsOver(ctx, checkData);
|
|
|
+ }
|
|
|
ctx.body = { err: 0, msg: '', data: checkData.checkResult };
|
|
|
} catch (err) {
|
|
|
this.log(err);
|
|
@@ -457,6 +470,13 @@ module.exports = app => {
|
|
|
return checkData.checkResult.error;
|
|
|
}
|
|
|
|
|
|
+ async _checkChangeBillsOver(ctx) {
|
|
|
+ const checkDataModel = require('../lib/ledger').checkData;
|
|
|
+ const checkData = new checkDataModel(ctx, measureType);
|
|
|
+ await this._innerCheckChangeBillsOver(ctx, checkData);
|
|
|
+ return checkData.checkResult.error;
|
|
|
+ }
|
|
|
+
|
|
|
async stageCheck(ctx) {
|
|
|
try {
|
|
|
if (!ctx.query.type) throw '参数错误';
|
|
@@ -467,6 +487,9 @@ module.exports = app => {
|
|
|
case 'minus_cb':
|
|
|
result.minus_cb = await this._checkMinusChangeBills(ctx);
|
|
|
break;
|
|
|
+ case 'change_over':
|
|
|
+ result.change_over = await this._checkChangeBillsOver(ctx);
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
ctx.body = { err: 0, msg: '', data: result };
|