|
|
@@ -65,7 +65,7 @@ module.exports = app => {
|
|
|
dagl: ctx.session.sessionProject.dagl_status,
|
|
|
},
|
|
|
shenpiConst,
|
|
|
- auditType
|
|
|
+ auditType,
|
|
|
};
|
|
|
if (((ctx.stage.status === auditConst.status.uncheck || ctx.stage.status === auditConst.status.checkNo) && ctx.session.sessionUser.accountId === ctx.stage.user_id) || ctx.session.sessionUser.is_admin) {
|
|
|
// data.accountGroup = accountGroup;
|
|
|
@@ -272,7 +272,7 @@ module.exports = app => {
|
|
|
}
|
|
|
}
|
|
|
// 结算状态
|
|
|
- const settleStatus = ctx.stage.readySettle ? await ctx.service.settleBills.getAllDataByCondition({ where: { settle_id: ctx.stage.readySettle.id }}) : [];
|
|
|
+ const settleStatus = ctx.stage.readySettle ? await ctx.service.settleBills.getAllDataByCondition({ where: { settle_id: ctx.stage.readySettle.id } }) : [];
|
|
|
// 查询截止上期数据
|
|
|
const preStageData = ctx.stage.preCheckedStage ? await ctx.service.stageBillsFinal.getFinalData(ctx.tender.data, ctx.stage.preCheckedStage.order) : [];
|
|
|
const exprData = await ctx.service.expr.getAllDataByCondition({ where: { tid: ctx.stage.tid, calc_module: 'stage' } });
|
|
|
@@ -309,12 +309,12 @@ module.exports = app => {
|
|
|
}
|
|
|
}
|
|
|
// 结算状态
|
|
|
- const settleStatus = ctx.stage.readySettle ? await ctx.service.settlePos.getAllDataByCondition({ where: { settle_id: ctx.stage.readySettle.id }}) : [];
|
|
|
+ const settleStatus = ctx.stage.readySettle ? await ctx.service.settlePos.getAllDataByCondition({ where: { settle_id: ctx.stage.readySettle.id } }) : [];
|
|
|
// 查询截止上期数据
|
|
|
const preStageData = ctx.stage.preCheckedStage ? await ctx.service.stagePosFinal.getFinalData(ctx.tender.data, ctx.stage.preCheckedStage.order) : [];
|
|
|
this.ctx.helper.assignRelaData(posData, [
|
|
|
- { data: memoData, fields: this.posMemoColumn, prefix: '', relaId: 'id'},
|
|
|
- { data: extraData, fields: this.posExtraColumn, prefix: '', relaId: 'id'},
|
|
|
+ { data: memoData, fields: this.posMemoColumn, prefix: '', relaId: 'id' },
|
|
|
+ { data: extraData, fields: this.posExtraColumn, prefix: '', relaId: 'id' },
|
|
|
{ data: curStageData, fields: ['contract_qty', 'contract_expr', 'qc_qty', 'qc_minus_qty', 'postil', 'ex_stage_qty1'], prefix: '', relaId: 'pid' },
|
|
|
{ data: preStageData, fields: ['contract_qty', 'qc_qty', 'qc_minus_qty', 'ex_stage_qty1', 'used_time', 'update_time'], prefix: 'pre_', relaId: 'pid' },
|
|
|
{ data: settleStatus, fields: ['settle_status'], prefix: '', relaId: 'pid' },
|
|
|
@@ -337,16 +337,16 @@ module.exports = app => {
|
|
|
|
|
|
async _getChangeData(ctx) {
|
|
|
const change = await ctx.service.change.getAllDataByCondition({
|
|
|
- columns: [ 'cid', 'code', 'name', 'w_code' ],
|
|
|
+ columns: ['cid', 'code', 'name', 'w_code'],
|
|
|
where: { tid: ctx.tender.id, valid: 1, status: changeAudit.status.checked },
|
|
|
orders: [['code', 'asc']],
|
|
|
});
|
|
|
const changeBills = await ctx.service.changeAuditList.getAllDataByCondition({
|
|
|
- columns: [ 'id', 'cid', 'code', 'name', 'unit', 'unit_price', 'oamount2', 'checked_amount', 'checked_price', 'is_valuation', 'gcl_id', 'bwmx', 'mx_id'],
|
|
|
- where: { tid: ctx.tender.id }
|
|
|
+ columns: ['id', 'cid', 'code', 'name', 'unit', 'unit_price', 'oamount2', 'checked_amount', 'checked_price', 'is_valuation', 'gcl_id', 'bwmx', 'mx_id'],
|
|
|
+ where: { tid: ctx.tender.id },
|
|
|
});
|
|
|
const changeIndex = {};
|
|
|
- change.forEach(x => { changeIndex[x.cid] = x; x.bills = [] });
|
|
|
+ change.forEach(x => { changeIndex[x.cid] = x; x.bills = []; });
|
|
|
changeBills.forEach(cb => {
|
|
|
const c = changeIndex[cb.cid];
|
|
|
if (!c) return;
|
|
|
@@ -354,23 +354,23 @@ module.exports = app => {
|
|
|
});
|
|
|
const helper = ctx.helper;
|
|
|
change.forEach(x => {
|
|
|
- x.bills.sort((a, b) => { return helper.compareCode(a.code, b.code)});
|
|
|
+ x.bills.sort((a, b) => { return helper.compareCode(a.code, b.code); });
|
|
|
});
|
|
|
return change;
|
|
|
}
|
|
|
|
|
|
async _getReCalcChangeData(ctx) {
|
|
|
const change = await ctx.service.change.getAllDataByCondition({
|
|
|
- columns: [ 'cid', 'code', 'name', 'w_code', 'tp_decimal', 'up_decimal' ],
|
|
|
+ columns: ['cid', 'code', 'name', 'w_code', 'tp_decimal', 'up_decimal'],
|
|
|
where: { tid: ctx.tender.id, valid: 1, status: changeAudit.status.checked },
|
|
|
orders: [['code', 'asc']],
|
|
|
});
|
|
|
const changeBills = await ctx.service.changeAuditList.getAllDataByCondition({
|
|
|
- columns: [ 'id', 'cid', 'code', 'name', 'unit', 'unit_price', 'oamount2', 'checked_amount', 'checked_price', 'is_valuation', 'gcl_id', 'bwmx', 'mx_id'],
|
|
|
- where: { tid: ctx.tender.id }
|
|
|
+ columns: ['id', 'cid', 'code', 'name', 'unit', 'unit_price', 'oamount2', 'checked_amount', 'checked_price', 'is_valuation', 'gcl_id', 'bwmx', 'mx_id'],
|
|
|
+ where: { tid: ctx.tender.id },
|
|
|
});
|
|
|
const changeIndex = {};
|
|
|
- change.forEach(x => { changeIndex[x.cid] = x; x.bills = [] });
|
|
|
+ change.forEach(x => { changeIndex[x.cid] = x; x.bills = []; });
|
|
|
changeBills.forEach(cb => {
|
|
|
const c = changeIndex[cb.cid];
|
|
|
if (!c) return;
|
|
|
@@ -406,7 +406,7 @@ module.exports = app => {
|
|
|
b.tp = helper.mul(b.unit_price, b.qty, tpDecimal);
|
|
|
b.minus_tp = helper.mul(b.unit_price, b.minus_qty, tpDecimal);
|
|
|
});
|
|
|
- x.bills.sort((a, b) => { return helper.compareCode(a.code, b.code)});
|
|
|
+ x.bills.sort((a, b) => { return helper.compareCode(a.code, b.code); });
|
|
|
});
|
|
|
return change;
|
|
|
}
|
|
|
@@ -483,7 +483,7 @@ module.exports = app => {
|
|
|
responseData.data.cooperationConfirm = await ctx.service.cooperationConfirm.getValidData(ctx.tender.id, ctx.stage.id, ctx.stage.times, ctx.session.sessionUser.accountId);
|
|
|
break;
|
|
|
case 'spec':
|
|
|
- const spec = {zlj: JSON.parse(JSON.stringify(stdConst.zlj)), jrg: stdConst.jrg};
|
|
|
+ const spec = { zlj: JSON.parse(JSON.stringify(stdConst.zlj)), jrg: stdConst.jrg };
|
|
|
spec.zlj.deal_bills_tp = ctx.tender.info.deal_param.zanLiePrice;
|
|
|
responseData.data.spec = spec;
|
|
|
break;
|
|
|
@@ -502,7 +502,7 @@ module.exports = app => {
|
|
|
}
|
|
|
|
|
|
async _innerCheckChangeBillsOver(ctx, checkData) {
|
|
|
- const change = await this.ctx.service.change.getAllDataByCondition({ where: { tid: ctx.tender.id }});
|
|
|
+ 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 } });
|
|
|
@@ -565,7 +565,7 @@ module.exports = app => {
|
|
|
if (!ctx.stage.update_expr_calc_time || (ctx.stage.update_calc_time && ctx.stage.update_expr_calc_time < ctx.stage.update_calc_time)) {
|
|
|
const exprCount = await ctx.service.expr.count({ tid: ctx.stage.tid, calc_module: 'stage' });
|
|
|
if (exprCount > 0) {
|
|
|
- checkData.checkResult.error.push({ errorType: 'expr_no_calc', name: '修改数据后,未计算本期合同计量' })
|
|
|
+ checkData.checkResult.error.push({ errorType: 'expr_no_calc', name: '修改数据后,未计算本期合同计量' });
|
|
|
}
|
|
|
}
|
|
|
ctx.body = { err: 0, msg: '', data: checkData.checkResult };
|
|
|
@@ -615,9 +615,11 @@ module.exports = app => {
|
|
|
? await ctx.service.stageChange.getAuditorAllStageData(ctx.tender.id, ctx.stage.id, ctx.stage.curTimes, ctx.stage.curOrder)
|
|
|
: await ctx.service.stageChange.getLastestAllStageData(ctx.tender.id, ctx.stage.id);
|
|
|
for (const cb of checkBills) {
|
|
|
- const useChanges = stageChange.filter(sc => { return sc.lid === cb.lid && sc.pid === '-1'});
|
|
|
- const checkQcQty = cb.qc_qty || 0, checkQcMinusQty = cb.qc_minus_qty || 0;
|
|
|
- let qc_qty = 0, qc_minus_qty = 0;
|
|
|
+ const useChanges = stageChange.filter(sc => { return sc.lid === cb.lid && sc.pid === '-1'; });
|
|
|
+ const checkQcQty = cb.qc_qty || 0,
|
|
|
+ checkQcMinusQty = cb.qc_minus_qty || 0;
|
|
|
+ let qc_qty = 0,
|
|
|
+ qc_minus_qty = 0;
|
|
|
for (const uc of useChanges) {
|
|
|
if (uc.no_value) {
|
|
|
qc_minus_qty = this.ctx.helper.add(qc_minus_qty, uc.qty);
|
|
|
@@ -629,8 +631,10 @@ module.exports = app => {
|
|
|
}
|
|
|
for (const cb of checkPos) {
|
|
|
const useChanges = stageChange.filter(sc => { return sc.lid === cb.lid && sc.pid === cb.pid; });
|
|
|
- const checkQcQty = cb.qc_qty || 0, checkQcMinusQty = cb.qc_minus_qty || 0;
|
|
|
- let qc_qty = 0, qc_minus_qty = 0;
|
|
|
+ const checkQcQty = cb.qc_qty || 0,
|
|
|
+ checkQcMinusQty = cb.qc_minus_qty || 0;
|
|
|
+ let qc_qty = 0,
|
|
|
+ qc_minus_qty = 0;
|
|
|
for (const uc of useChanges) {
|
|
|
if (uc.no_value) {
|
|
|
qc_minus_qty = this.ctx.helper.add(qc_minus_qty, uc.qty);
|
|
|
@@ -1151,7 +1155,7 @@ module.exports = app => {
|
|
|
const payAtt = await ctx.service.payAtt.getStageData({ sid: ctx.stage.id });
|
|
|
// 附件不取下载地址
|
|
|
for (const dp of renderData.dealPay) {
|
|
|
- dp.attachment = payAtt.filter(x => { return x.pid === dp.pid });
|
|
|
+ dp.attachment = payAtt.filter(x => { return x.pid === dp.pid; });
|
|
|
}
|
|
|
renderData.calcBase = await ctx.service.stage.getStagePayCalcBase(ctx.stage, ctx.tender.info);
|
|
|
renderData.jsFiles = this.app.jsFiles.common.concat(this.app.jsFiles.stage.pay);
|
|
|
@@ -1324,7 +1328,7 @@ module.exports = app => {
|
|
|
const helper = this.ctx.helper;
|
|
|
data.attachments = await this.ctx.service.changeAtt.getChangeAttachment(cid);
|
|
|
data.bills = await this.ctx.service.changeAuditList.getAllDataByCondition({ where: { cid } });
|
|
|
- data.bills.sort((a, b) => { return helper.compareCode(a.code, b.code)});
|
|
|
+ data.bills.sort((a, b) => { return helper.compareCode(a.code, b.code); });
|
|
|
if (isImport) {
|
|
|
data.endUsedBills = await this.ctx.service.stageImportChange.getChangeEndUsedData(tid, cid);
|
|
|
data.curUsedBills = await this.ctx.service.stageImportChange.getChangeUsedData(sid, cid);
|
|
|
@@ -1520,6 +1524,9 @@ module.exports = app => {
|
|
|
}
|
|
|
|
|
|
await ctx.service.stageAudit.check(ctx.stage.id, data, ctx.stage.times);
|
|
|
+ // // 这里要调用签名的service,重设签名日期
|
|
|
+ // const rstMsg = await ctx.service.roleRptRel.refreshSignatureDate(ctx.tender.data.id, ctx.stage.id, 'stage', -1);
|
|
|
+ // console.log(rstMsg);
|
|
|
ctx.body = { err: 0, msg: '', data: [] };
|
|
|
} catch (err) {
|
|
|
this.log(err);
|
|
|
@@ -1691,7 +1698,7 @@ module.exports = app => {
|
|
|
for (const order of data.roles) {
|
|
|
const data = { order, bills: [], pos: [] };
|
|
|
const compareTimes = ctx.stage.status === auditConst.status.checkNo && !ctx.stage.readOnly
|
|
|
- ? ( order === 0 ? ctx.stage.curTimes : ctx.stage.curTimes - 1)
|
|
|
+ ? (order === 0 ? ctx.stage.curTimes : ctx.stage.curTimes - 1)
|
|
|
: ctx.stage.curTimes;
|
|
|
data.bills = await ctx.service.stageBills.getAuditorStageData2(ctx.tender.id, ctx.stage.id, compareTimes, order);
|
|
|
data.pos = await ctx.service.stagePos.getAuditorStageData2(ctx.tender.id, ctx.stage.id, compareTimes, order);
|
|
|
@@ -2436,7 +2443,7 @@ module.exports = app => {
|
|
|
try {
|
|
|
const ledgerData = await ctx.service.ledger.getAllDataByCondition({
|
|
|
columns: ['id', 'ledger_id', 'ledger_pid', 'level', 'order', 'full_path', 'is_leaf', 'code', 'b_code', 'name', 'unit', 'unit_price', 'node_type'],
|
|
|
- where: { tender_id: ctx.tender.id }
|
|
|
+ where: { tender_id: ctx.tender.id },
|
|
|
});
|
|
|
const extraLedgerData = await ctx.service.ledgerExtra.getData(ctx.tender.id, this.ledgerExtraColumn);
|
|
|
const dgnData = await ctx.service.stageBillsDgn.getDgnData(ctx.tender.id);
|
|
|
@@ -2451,7 +2458,7 @@ module.exports = app => {
|
|
|
|
|
|
const posData = await ctx.service.pos.getAllDataByCondition({
|
|
|
columns: ['id', 'lid', 'name', 'position', 'porder'],
|
|
|
- where: { tid: ctx.tender.id }
|
|
|
+ where: { tid: ctx.tender.id },
|
|
|
});
|
|
|
// 根据当前人,或指定对象查询数据
|
|
|
const curStagePosData = ctx.stage.readOnly
|
|
|
@@ -2481,7 +2488,7 @@ module.exports = app => {
|
|
|
'Content-Disposition': disposition,
|
|
|
});
|
|
|
ctx.body = await fs.readFileSync(filepath);
|
|
|
- } catch(err) {
|
|
|
+ } catch (err) {
|
|
|
ctx.log(err);
|
|
|
ctx.postError(err, '导出计量数据失败');
|
|
|
}
|
|
|
@@ -2490,7 +2497,8 @@ module.exports = app => {
|
|
|
async importStageData(ctx) {
|
|
|
const create_time = Date.parse(new Date()) / 1000;
|
|
|
const filepath = path.join(this.ctx.app.baseDir, 'temp', `计量数据${create_time}.cpd`);
|
|
|
- let stream, index = 0;
|
|
|
+ let stream,
|
|
|
+ index = 0;
|
|
|
try {
|
|
|
const parts = ctx.multipart({ autoFields: true });
|
|
|
stream = await parts();
|
|
|
@@ -2528,7 +2536,7 @@ module.exports = app => {
|
|
|
if (!result) {
|
|
|
throw '切换审批组失败';
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
const auditors = await ctx.service.stageAudit.getUserGroup(ctx.stage.id, ctx.stage.times);
|
|
|
ctx.body = { err: 0, msg: '', data: auditors };
|
|
|
} catch (err) {
|
|
|
@@ -2544,7 +2552,7 @@ module.exports = app => {
|
|
|
|
|
|
let result;
|
|
|
const fileInfo = path.parse(data.fileInfo.filename);
|
|
|
- switch(data.type) {
|
|
|
+ switch (data.type) {
|
|
|
case 'begin':
|
|
|
const create_time = Date.parse(new Date()) / 1000;
|
|
|
result = {
|
|
|
@@ -2563,7 +2571,7 @@ module.exports = app => {
|
|
|
filename: fileInfo.name, fileext: fileInfo.ext, filesize: data.fileInfo.filesize,
|
|
|
extra_upload,
|
|
|
};
|
|
|
- result = await ctx.service.stageAtt.save({ lid: data.lid}, fileData, ctx.session.sessionUser.accountId);
|
|
|
+ result = await ctx.service.stageAtt.save({ lid: data.lid }, fileData, ctx.session.sessionUser.accountId);
|
|
|
if (!result) {
|
|
|
throw '导入数据库保存失败';
|
|
|
}
|
|
|
@@ -2571,7 +2579,7 @@ module.exports = app => {
|
|
|
result = [result];
|
|
|
break;
|
|
|
}
|
|
|
- ctx.body = {err: 0, msg: '', data: result };
|
|
|
+ ctx.body = { err: 0, msg: '', data: result };
|
|
|
} catch (error) {
|
|
|
ctx.log(error);
|
|
|
ctx.body = this.ajaxErrorBody(error, '上传附件失败,请重试');
|