Browse Source

中间计量,中间计量明细数据问题

MaiXinRong 5 years ago
parent
commit
6d539c06db
2 changed files with 3 additions and 16 deletions
  1. 3 2
      app/public/js/stage_im.js
  2. 0 14
      app/service/valuation.js

+ 3 - 2
app/public/js/stage_im.js

@@ -166,7 +166,8 @@ const stageIm = (function () {
             return im.lid === d.lid &&
                 (!im.code || im.code === d.code) &&
                 (!im.name || im.name === d.name) &&
-                (!im.unit || im.unit === d.unit);
+                (!im.unit || im.unit === d.unit) &&
+                checkZero(ZhCalc.sub(im.unit_price, d.unit_price));
         });
         if (cd) {
             _.assignInWith(im, cd, function (oV, sV, key) {
@@ -256,7 +257,7 @@ const stageIm = (function () {
             if (!p.b_code || p.b_code === '') { continue }
             if (!p.gather_qty || p.gather_qty === 0 ) { continue; }
             let im = nodeImData.find(function (d) {
-                return d.code === p.b_code && p.name === d.name && p.unit === d.unit && checkZero(p.unit_price - d.unit_price);
+                return d.code === p.b_code && p.name === d.name && p.unit === d.unit && checkZero(ZhCalc.sub(p.unit_price, d.unit_price));
             });
             if (!im) {
                 const peg = getPegNode(node);

+ 0 - 14
app/service/valuation.js

@@ -41,25 +41,11 @@ module.exports = app => {
             const valuation = await this.getDataById(id);
             const billsId = this._.map(valuation.bill_id.split(','), this._.toInteger);
             const chaptersId = this._.map(valuation.chapter_id.split(','), this._.toInteger);
-            // const billsList = await this.db.select('zh_std_gcl_list', {
-            //     where: {id: billsId},
-            //     columns: ['id', 'name'],
-            // });
-            // billsList.sort(function (a, b) {
-            //     return billsId.indexOf(a.id) - billsList.indexOf(b.id);
-            // });
             const sql = 'SELECT `id`, `name`' +
                 '  From ?? ' +
                 '  WHERE `id` in ( ? ) ORDER BY FIELD(`id`, ?)';
             const sqlParam = ['zh_std_gcl_list', billsId, billsId];
             const billsList = await this.db.query(sql, sqlParam);
-            // const chapterList = await this.db.select('zh_std_xmj_list', {
-            //     where: {id: chaptersId},
-            //     columns: ['id', 'name'],
-            // });
-            // chapterList.sort(function (a, b) {
-            //     return chaptersId.indexOf(a.id) - chapterList.indexOf(b.id);
-            // });
             const sql2 = 'SELECT `id`, `name`' +
                 '  From ?? ' +
                 '  WHERE `id` in ( ? ) ORDER BY FIELD(`id`, ?)';