|
@@ -282,26 +282,24 @@ module.exports = app => {
|
|
|
said: this.ctx.session.sessionUser.accountId,
|
|
said: this.ctx.session.sessionUser.accountId,
|
|
|
times: this.ctx.stage.curTimes, order: this.ctx.stage.curOrder
|
|
times: this.ctx.stage.curTimes, order: this.ctx.stage.curOrder
|
|
|
};
|
|
};
|
|
|
- if (d.contract_qty !== undefined || osp) {
|
|
|
|
|
- sp.contract_qty = d.contract_qty === undefined && osp
|
|
|
|
|
- ? osp.contract_qty
|
|
|
|
|
- : this.ctx.helper.round(d.contract_qty, precision.value);
|
|
|
|
|
|
|
+ if (d.contract_qty !== undefined) {
|
|
|
|
|
+ sp.contract_qty = this.ctx.helper.round(d.contract_qty, precision.value) || 0;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ sp.contract_qty = osp ? osp.contract_qty || 0 : 0;
|
|
|
}
|
|
}
|
|
|
if (d.contract_expr !== undefined) sp.contract_expr = d.contract_expr;
|
|
if (d.contract_expr !== undefined) sp.contract_expr = d.contract_expr;
|
|
|
- if (d.qc_qty || osp) {
|
|
|
|
|
- sp.qc_qty = d.qc_qty === undefined && osp
|
|
|
|
|
- ? osp.qc_qty
|
|
|
|
|
- : this.ctx.helper.round(d.qc_qty, precision.value);
|
|
|
|
|
- }
|
|
|
|
|
if (d.postil || osp) {
|
|
if (d.postil || osp) {
|
|
|
sp.postil = d.postil === undefined && osp ? osp.postil : d.postil;
|
|
sp.postil = d.postil === undefined && osp ? osp.postil : d.postil;
|
|
|
}
|
|
}
|
|
|
- if (d.ex_stage_qty1 || osp) {
|
|
|
|
|
- sp.ex_stage_qty1 = d.ex_stage_qty1 === undefined && osp ? osp.ex_stage_qty1 : d.ex_stage_qty1;
|
|
|
|
|
|
|
+ if (d.ex_stage_qty1 !== undefined) {
|
|
|
|
|
+ sp.ex_stage_qty1 = this.ctx.helper.round(d.ex_stage_qty1, precision.value) || 0;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ sp.ex_stage_qty1 = osp ? osp.ex_stage_qty1 || 0 : 0;
|
|
|
}
|
|
}
|
|
|
- sp.qc_minus_qty = osp ? osp.qc_minus_qty : 0;
|
|
|
|
|
- sp.positive_qc_qty = osp ? osp.positive_qc_qty : 0;
|
|
|
|
|
- sp.negative_qc_qty = osp ? osp.negative_qc_qty : 0;
|
|
|
|
|
|
|
+ sp.qc_qty = osp ? osp.qc_qty || 0 : 0;
|
|
|
|
|
+ sp.qc_minus_qty = osp ? osp.qc_minus_qty || 0 : 0;
|
|
|
|
|
+ sp.positive_qc_qty = osp ? osp.positive_qc_qty || 0 : 0;
|
|
|
|
|
+ sp.negative_qc_qty = osp ? osp.negative_qc_qty || 0 : 0;
|
|
|
insertPosStage.push(sp);
|
|
insertPosStage.push(sp);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -390,6 +388,13 @@ module.exports = app => {
|
|
|
? osp.contract_qty
|
|
? osp.contract_qty
|
|
|
: this.ctx.helper.round(d.contract_qty, b.precision.value);
|
|
: this.ctx.helper.round(d.contract_qty, b.precision.value);
|
|
|
sp.contract_expr = d.contract_expr;
|
|
sp.contract_expr = d.contract_expr;
|
|
|
|
|
+ if (osp) {
|
|
|
|
|
+ sp.qc_qty = osp.qc_qty || 0;
|
|
|
|
|
+ sp.qc_minus_qty = osp.qc_minus_qty || 0;
|
|
|
|
|
+ sp.positive_qc_qty = osp.positive_qc_qty || 0;
|
|
|
|
|
+ sp.negative_qc_qty = osp.positive_qc_qty || 0;
|
|
|
|
|
+ sp.ex_stage_qty1 = osp.ex_stage_qty1 || 0;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
insertPosStage.push(sp);
|
|
insertPosStage.push(sp);
|
|
|
}
|
|
}
|
|
@@ -422,15 +427,27 @@ module.exports = app => {
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
|
const contract_tp = await this.ctx.service.stageBills.calcContractTp(this.ctx.tender.info, this.ctx.stage, b, { contract_qty, qc_minus_qty: 0 });
|
|
const contract_tp = await this.ctx.service.stageBills.calcContractTp(this.ctx.tender.info, this.ctx.stage, b, { contract_qty, qc_minus_qty: 0 });
|
|
|
- insertBillsStage.push({
|
|
|
|
|
|
|
+ const ibs = {
|
|
|
tid: this.ctx.tender.id,
|
|
tid: this.ctx.tender.id,
|
|
|
lid: b.id,
|
|
lid: b.id,
|
|
|
sid: this.ctx.stage.id,
|
|
sid: this.ctx.stage.id,
|
|
|
times: this.ctx.stage.curTimes,
|
|
times: this.ctx.stage.curTimes,
|
|
|
order: this.ctx.stage.curOrder,
|
|
order: this.ctx.stage.curOrder,
|
|
|
said: this.ctx.session.sessionUser.accountId,
|
|
said: this.ctx.session.sessionUser.accountId,
|
|
|
- contract_qty: contract_qty, contract_tp
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ contract_qty: contract_qty, contract_tp,
|
|
|
|
|
+ };
|
|
|
|
|
+ if (stageBills) {
|
|
|
|
|
+ ibs.qc_qty = stageBills.qc_qty || 0;
|
|
|
|
|
+ ibs.qc_tp = stageBills.qc_tp || 0;
|
|
|
|
|
+ ibs.qc_minus_qty = stageBills.qc_minus_qty || 0;
|
|
|
|
|
+ ibs.positive_qc_qty = stageBills.positive_qc_qty || 0;
|
|
|
|
|
+ ibs.positive_qc_tp = stageBills.positive_qc_tp || 0;
|
|
|
|
|
+ ibs.negative_qc_qty = stageBills.negative_qc_qty || 0;
|
|
|
|
|
+ ibs.negative_qc_tp = stageBills.negative_qc_tp || 0;
|
|
|
|
|
+ ibs.ex_stage_qty1 = stageBills.ex_stage_qty1 || 0;
|
|
|
|
|
+ ibs.ex_stage_tp1 = stageBills.ex_stage_tp1 || 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ insertBillsStage.push(ibs);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|