Browse Source

期计量,计量台账,部位明细,更新数据相关

MaiXinRong 5 years ago
parent
commit
b0641edcc9
1 changed files with 13 additions and 7 deletions
  1. 13 7
      app/service/stage_pos.js

+ 13 - 7
app/service/stage_pos.js

@@ -275,13 +275,19 @@ module.exports = app => {
                                 said: this.ctx.session.sessionUser.accountId,
                                 times: this.ctx.stage.curTimes, order: this.ctx.stage.curOrder
                             };
-                            sp.contract_qty = d.contract_qty === undefined && osp
-                                ? osp.contract_qty
-                                : this.ctx.helper.round(d.contract_qty, precision.value);
-                            sp.qc_qty = d.qc_qty === undefined && osp
-                                ? osp.qc_qty
-                                : this.ctx.helper.round(d.qc_qty, precision.value);
-                            sp.postil = d.postil === undefined && osp ? osp.postil : d.postil;
+                            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.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) {
+                                sp.postil = d.postil === undefined && osp ? osp.postil : d.postil;
+                            }
                             await transaction.insert(this.tableName, sp);
                         }
                     }