Преглед на файлове

计量台账,计量单元,复制粘贴,报错

MaiXinRong преди 2 години
родител
ревизия
945e14fdc3
променени са 1 файла, в които са добавени 6 реда и са изтрити 6 реда
  1. 6 6
      app/service/stage_pos.js

+ 6 - 6
app/service/stage_pos.js

@@ -150,15 +150,13 @@ module.exports = app => {
             let bills , precision;
             const  result = {pos: [], ledger: []};
             const datas = data instanceof Array ? data : [data], calcStageBills = [];
+
             if (datas[0].sgfh_qty !== undefined || datas[0].sjcl_qty !== undefined || datas[0].qtcl_qty !== undefined
                 || datas[0].contract_qty !== undefined || datas[0].qc_qty !== undefined || datas[0].real_qty !== undefined) {
                 bills = await this.ctx.service.ledger.getDataById(datas[0].lid);
                 precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, bills.unit);
                 result.ledger.push(bills.id);
             }
-            if (datas[0].contract_qty !== undefined || datas[0].qc_qty !== undefined || datas[0].postil !== undefined) {
-                result.stageUpdate = true;
-            }
 
             const insertPos = [], insertPosStage = [];
             for (const d of datas) {
@@ -168,7 +166,8 @@ module.exports = app => {
                     add_times: this.ctx.stage.curTimes,
                     add_user: this.ctx.session.sessionUser.accountId,
                 };
-                if (d.sgfh_qty !== undefined || d.sjcl_qty !== undefined || d.qtcl_qty !== undefined) {
+                if (d.sgfh_qty !== undefined || d.sjcl_qty !== undefined || d.qtcl_qty !== undefined ||
+                    d.sgfh_expr !== undefined || d.sjcl_expr !== undefined || d.qtcl_expr !== undefined) {
                     if (d.sgfh_qty!== undefined) p.sgfh_qty = this.round(d.sgfh_qty, precision.value);
                     if (d.sjcl_qty!== undefined) p.sjcl_qty = this.round(d.sjcl_qty, precision.value);
                     if (d.qtcl_qty!== undefined) p.qtcl_qty = this.round(d.qtcl_qty, precision.value);
@@ -181,7 +180,8 @@ module.exports = app => {
                 insertPos.push(p);
                 result.pos.push(p.id);
 
-                if (d.contract_qty!== undefined || d.qc_qty!== undefined || d.postil!== undefined) {
+                if (d.contract_qty!== undefined || d.qc_qty!== undefined || d.postil!== undefined || data.contract_expr !== undefined) {
+                    result.stageUpdate = true;
                     const ps = {
                         pid: p.id,
                         lid: d.lid,
@@ -192,7 +192,7 @@ module.exports = app => {
                         order: this.ctx.stage.curOrder,
                     };
                     if (d.contract_qty !== undefined) ps.contract_qty = this.round(d.contract_qty, precision.value);
-                    if (d.contract_expr !== undefined) p.contract_expr = d.contract_expr;
+                    if (d.contract_expr !== undefined) ps.contract_expr = d.contract_expr;
                     if (d.qc_qty!== undefined) ps.qc_qty = this.round(d.qc_qty, precision.value);
                     if (d.postil!== undefined) ps.postil = d.postil;
                     insertPosStage.push(ps);