|
@@ -37,16 +37,19 @@ class srCache {
|
|
|
? await this.ctx.service.stageRelaBillsFinal.getAllDataByCondition({ where: { sid: this.preRelaStage.sid, rela_tid: this.preRelaStage.rela_tid } })
|
|
|
: [];
|
|
|
this.ctx.helper.assignRelaData(ledger, [
|
|
|
- { data: curBillsData, fields: ['contract_qty', 'qc_qty', 'postil'], prefix: '', relaId: 'lid' },
|
|
|
+ { data: curBillsData, fields: ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'postil'], prefix: '', relaId: 'lid' },
|
|
|
{ data: preStageBills, fields: ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp'], prefix: 'pre_', relaId: 'lid' },
|
|
|
]);
|
|
|
for (const l of ledger) {
|
|
|
const db = this.dealBills.find(x => {
|
|
|
return x.code === l.b_code && x.name === l.name && x.unit === l.unit;
|
|
|
});
|
|
|
+ if (l.b_code === '101-1-a') console.log(l, db);
|
|
|
l.unit_price = db ? db.unit_price : 0;
|
|
|
- l.contract_tp = this.ctx.helper.mul(l.unit_price, l.contract_qty, decimal.tp);
|
|
|
- l.qc_tp = this.ctx.helper.mul(l.unit_price, l.qc_qty, decimal.tp);
|
|
|
+ if (!l.is_tp) {
|
|
|
+ l.contract_tp = this.ctx.helper.mul(l.unit_price, l.contract_qty, decimal.tp);
|
|
|
+ l.qc_tp = this.ctx.helper.mul(l.unit_price, l.qc_qty, decimal.tp);
|
|
|
+ }
|
|
|
l.gather_tp = this.ctx.helper.add(l.contract_tp, l.qc_tp);
|
|
|
l.pre_gather_tp = this.ctx.helper.add(l.pre_contract_qty, l.pre_contract_tp);
|
|
|
l.end_contract_qty = this.ctx.helper.add(l.pre_contract_qty, l.contract_qty);
|