|
@@ -262,19 +262,24 @@ module.exports = app => {
|
|
if (!b) continue;
|
|
if (!b) continue;
|
|
const contract_tp = this.ctx.helper.mul(b.unit_price, sb.contract_qty, decimal.tp);
|
|
const contract_tp = this.ctx.helper.mul(b.unit_price, sb.contract_qty, decimal.tp);
|
|
const qc_tp = this.ctx.helper.mul(b.unit_price, sb.qc_qty, decimal.tp);
|
|
const qc_tp = this.ctx.helper.mul(b.unit_price, sb.qc_qty, decimal.tp);
|
|
|
|
+ const positive_qc_tp = this.ctx.helper.mul(b.unit_price, sb.positive_qc_qty, decimal.tp);
|
|
|
|
+ const negative_qc_tp = this.ctx.helper.mul(b.unit_price, sb.positive_qc_qty, decimal.tp);
|
|
const ex_stage_tp1 = this.ctx.helper.mul(b.unit_price, sb.ex_stage_qty1, decimal.tp);
|
|
const ex_stage_tp1 = this.ctx.helper.mul(b.unit_price, sb.ex_stage_qty1, decimal.tp);
|
|
- if (contract_tp == sb.contract_tp && qc_tp === sb.qc_tp && ex_stage_tp1 === sb.ex_stage_tp1) continue;
|
|
|
|
|
|
+ if (contract_tp == sb.contract_tp && qc_tp === sb.qc_tp && ex_stage_tp1 === sb.ex_stage_tp1
|
|
|
|
+ && positive_qc_tp === sb.positive_qc_tp && negative_qc_tp === sb.negative_qc_tp) continue;
|
|
|
|
|
|
if (sb.times === stage.times && sb.order === 0) {
|
|
if (sb.times === stage.times && sb.order === 0) {
|
|
updateStageBills.push({
|
|
updateStageBills.push({
|
|
- id: sb.id, contract_tp, qc_tp, ex_stage_tp1,
|
|
|
|
|
|
+ id: sb.id, contract_tp, qc_tp, positive_qc_tp, negative_qc_tp, ex_stage_tp1,
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
insertStageBills.push({
|
|
insertStageBills.push({
|
|
tid: stage.tid, lid: sb.lid, sid: stage.id, said: this.ctx.session.sessionUser.accountId,
|
|
tid: stage.tid, lid: sb.lid, sid: stage.id, said: this.ctx.session.sessionUser.accountId,
|
|
times: stage.times, order: 0,
|
|
times: stage.times, order: 0,
|
|
contract_qty: sb.contract_qty, contract_expr: sb.contract_expr, contract_tp,
|
|
contract_qty: sb.contract_qty, contract_expr: sb.contract_expr, contract_tp,
|
|
- qc_qty: sb.qc_qty, qc_tp,
|
|
|
|
|
|
+ qc_qty: sb.qc_qty, qc_tp, qc_minus_qty: sb.qc_minus_qty,
|
|
|
|
+ positive_qc_qty: sb.positive_qc_qty, positive_qc_tp: sb.positive_qc_tp,
|
|
|
|
+ negative_qc_qty: sb.negative_qc_qty, negative_qc_tp: sb.negative_qc_tp,
|
|
ex_stage_qty1: sb.ex_stage_qty1, ex_stage_tp1,
|
|
ex_stage_qty1: sb.ex_stage_qty1, ex_stage_tp1,
|
|
postil: sb.postil,
|
|
postil: sb.postil,
|
|
});
|
|
});
|
|
@@ -306,19 +311,23 @@ module.exports = app => {
|
|
const end_contract_tp = this.ctx.helper.mul(this.ctx.helper.div(end_contract_qty, activeQty), b.total_price, decimal.tp);
|
|
const end_contract_tp = this.ctx.helper.mul(this.ctx.helper.div(end_contract_qty, activeQty), b.total_price, decimal.tp);
|
|
const contract_tp = preSb ? this.ctx.helper.sub(end_contract_tp, preSb.contract_tp) : end_contract_tp;
|
|
const contract_tp = preSb ? this.ctx.helper.sub(end_contract_tp, preSb.contract_tp) : end_contract_tp;
|
|
const qc_tp = this.ctx.helper.mul(b.unit_price, sb.qc_qty, decimal.tp);
|
|
const qc_tp = this.ctx.helper.mul(b.unit_price, sb.qc_qty, decimal.tp);
|
|
|
|
+ const positive_qc_tp = this.ctx.helper.mul(b.unit_price, sb.positive_qc_qty, decimal.tp);
|
|
|
|
+ const negative_qc_tp = this.ctx.helper.mul(b.unit_price, sb.positive_qc_qty, decimal.tp);
|
|
const ex_stage_tp1 = this.ctx.helper.mul(b.unit_price, sb.ex_stage_qty1, decimal.tp);
|
|
const ex_stage_tp1 = this.ctx.helper.mul(b.unit_price, sb.ex_stage_qty1, decimal.tp);
|
|
if (contract_tp == sb.contract_tp && qc_tp === sb.qc_tp && ex_stage_tp1 === sb.ex_stage_tp1) continue;
|
|
if (contract_tp == sb.contract_tp && qc_tp === sb.qc_tp && ex_stage_tp1 === sb.ex_stage_tp1) continue;
|
|
|
|
|
|
if (sb.times === stage.times && sb.order === 0) {
|
|
if (sb.times === stage.times && sb.order === 0) {
|
|
updateStageBills.push({
|
|
updateStageBills.push({
|
|
- id: sb.id, contract_tp, qc_tp, ex_stage_tp1,
|
|
|
|
|
|
+ id: sb.id, contract_tp, qc_tp, ex_stage_tp1, positive_qc_tp, negative_qc_tp,
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
insertStageBills.push({
|
|
insertStageBills.push({
|
|
tid: stage.tid, lid: sb.lid, sid: stage.id, said: this.ctx.session.sessionUser.accountId,
|
|
tid: stage.tid, lid: sb.lid, sid: stage.id, said: this.ctx.session.sessionUser.accountId,
|
|
times: stage.times, order: 0,
|
|
times: stage.times, order: 0,
|
|
contract_qty: sb.contract_qty, contract_expr: sb.contract_expr, contract_tp,
|
|
contract_qty: sb.contract_qty, contract_expr: sb.contract_expr, contract_tp,
|
|
- qc_qty: sb.qc_qty, qc_tp,
|
|
|
|
|
|
+ qc_qty: sb.qc_qty, qc_tp, qc_minus_qty: sb.qc_minus_qty,
|
|
|
|
+ positive_qc_qty: sb.positive_qc_qty, positive_qc_tp: sb.positive_qc_tp,
|
|
|
|
+ negative_qc_qty: sb.negative_qc_qty, negative_qc_tp: sb.negative_qc_tp,
|
|
ex_stage_qty1: sb.ex_stage_qty1, ex_stage_tp1,
|
|
ex_stage_qty1: sb.ex_stage_qty1, ex_stage_tp1,
|
|
postil: sb.postil,
|
|
postil: sb.postil,
|
|
});
|
|
});
|