Procházet zdrojové kódy

暂存计量相关

MaiXinRong před 2 roky
rodič
revize
4591dc281a
1 změnil soubory, kde provedl 5 přidání a 8 odebrání
  1. 5 8
      app/service/stage_stash.js

+ 5 - 8
app/service/stage_stash.js

@@ -239,7 +239,11 @@ module.exports = app => {
                 const b = bills.find(x => { return x.id === d.lid });
                 if (!b) continue;
 
-                const nbs = { tid: stage.tid, sid: stage.id, said, lid: b.id, times: 1, order: 0 };
+                const nbs = {
+                    tid: stage.tid, sid: stage.id, said, lid: b.id, times: 1, order: 0,
+                    contract_qty: 0, qc_qty: 0, qc_minus_qty: 0, positive_qc_qty: 0, negative_qc_qty: 0,
+                    contract_tp: 0, qc_tp: 0, positive_qc_tp: 0, negative_qc_tp: 0
+                };
                 if (d.pos) {
                     for (const bp of d.pos) {
                         const p = pos.find(x => { return x.id === bp.pid});
@@ -283,17 +287,10 @@ module.exports = app => {
                     nbs.negative_qc_tp = this.ctx.helper.mul(nbs.negative_qc_qty, b.unit_price, decimal.tp);
                 } else {
                     if (b.is_tp) {
-                        nbs.contract_qty = 0;
                         nbs.contract_tp = this.ctx.helper.round(d.contract_tp, decimal.tp);
-                        nbs.qc_qty = 0;
-                        nbs.qc_tp = 0;
                     } else {
                         nbs.contract_qty = this.ctx.helper.round(d.contract_qty, decimal.qty);
                         nbs.contract_tp = this.ctx.helper.mul(nbs.contract_qty, b.unit_price, decimal.tp);
-                        nbs.qc_qty = 0;
-                        nbs.qc_minus_qty = 0;
-                        nbs.positive_qc_qty = 0;
-                        nbs.negative_qc_qty = 0;
                         if (d.change) {
                             for (const c of d.change) {
                                 if (!c.qty) continue;