|
@@ -226,8 +226,12 @@ module.exports = app => {
|
|
|
await this.doCheckStage(stage, force);
|
|
|
if (!stage.readOnly && stage.check_calc) {
|
|
|
const tpData = await this.ctx.service.stageBills.getSumTotalPrice(stage);
|
|
|
+ const pcSum = await this.ctx.service.stageBillsPc.getSumTotalPrice(stage);
|
|
|
stage.contract_tp = tpData.contract_tp;
|
|
|
stage.qc_tp = tpData.qc_tp;
|
|
|
+ stage.contract_pc_tp = pcSum.contract_pc_tp;
|
|
|
+ stage.qc_pc_tp = pcSum.qc_pc_tp;
|
|
|
+ stage.pc_tp = pcSum.pc_tp;
|
|
|
stage.tp =this.ctx.helper.add(stage.contract_tp, stage.qc_tp);
|
|
|
const tp = await this.ctx.service.stagePay.getSpecialTotalPrice(stage);
|
|
|
stage.yf_tp = tp.yf;
|
|
@@ -236,6 +240,7 @@ module.exports = app => {
|
|
|
await this.update({
|
|
|
check_calc: false,
|
|
|
contract_tp: stage.contract_tp, qc_tp: stage.qc_tp,
|
|
|
+ contract_pc_tp: stage.contract_pc_tp || 0, qc_pc_tp: stage.qc_pc_tp || 0, pc_tp: stage.pc_tp || 0,
|
|
|
yf_tp: stage.yf_tp, sf_tp: stage.sf_tp,
|
|
|
}, { id: stage.id });
|
|
|
} else if (stage.tp_history) {
|
|
@@ -263,7 +268,7 @@ module.exports = app => {
|
|
|
orders: [['order', 'desc']],
|
|
|
});
|
|
|
for (const s of stages) {
|
|
|
- s.tp = this.ctx.helper.add(s.contract_tp, s.qc_tp);
|
|
|
+ s.tp = this.ctx.helper.sum([s.contract_tp, s.qc_tp, s.pc_tp]);
|
|
|
s.pre_tp = this.ctx.helper.add(s.pre_contract_tp, s.pre_qc_tp);
|
|
|
s.end_tp = this.ctx.helper.add(s.pre_tp, s.tp);
|
|
|
s.tp_history = s.tp_history ? JSON.parse(s.tp_history) : [];
|
|
@@ -336,8 +341,8 @@ module.exports = app => {
|
|
|
newStage.im_pre = preStage.im_pre;
|
|
|
newStage.im_gather = preStage.im_gather;
|
|
|
newStage.im_gather_node = preStage.im_gather_node;
|
|
|
- newStage.pre_contract_tp = this.ctx.helper.add(preStage.pre_contract_tp, preStage.contract_tp);
|
|
|
- newStage.pre_qc_tp = this.ctx.helper.add(preStage.pre_qc_tp, preStage.qc_tp);
|
|
|
+ newStage.pre_contract_tp = this.ctx.helper.sum([preStage.pre_contract_tp, preStage.contract_tp, preStage.contract_pc_tp]);
|
|
|
+ newStage.pre_qc_tp = this.ctx.helper.sum([preStage.pre_qc_tp, preStage.qc_tp, preStage.qc_pc_tp]);
|
|
|
newStage.pre_yf_tp = this.ctx.helper.add(preStage.pre_yf_tp, preStage.yf_tp);
|
|
|
if (preStage.order === 1 || preStage.pre_sf_tp) {
|
|
|
newStage.pre_sf_tp = this.ctx.helper.add(preStage.pre_sf_tp, preStage.sf_tp);
|