浏览代码

Merge branch 'master' of http://192.168.1.41:3000/maixinrong/Calculation

laiguoran 5 年之前
父节点
当前提交
bdb2d2d268
共有 3 个文件被更改,包括 4 次插入17 次删除
  1. 1 1
      app/public/js/stage_change.js
  2. 3 2
      app/public/js/stage_im.js
  3. 0 14
      app/service/valuation.js

+ 1 - 1
app/public/js/stage_change.js

@@ -36,7 +36,7 @@ class ChangeAnalysis {
         change.bills = change.detail.bills;
         change.bills = change.detail.bills;
         for (const b of change.bills) {
         for (const b of change.bills) {
             const aub = change.detail.addUsedBills.find(function (x) {
             const aub = change.detail.addUsedBills.find(function (x) {
-                return x.id = b.id;
+                return x.id === b.id;
             });
             });
             if (aub) {
             if (aub) {
                 b.used_qty = aub.used_qty;
                 b.used_qty = aub.used_qty;

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

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

+ 0 - 14
app/service/valuation.js

@@ -41,25 +41,11 @@ module.exports = app => {
             const valuation = await this.getDataById(id);
             const valuation = await this.getDataById(id);
             const billsId = this._.map(valuation.bill_id.split(','), this._.toInteger);
             const billsId = this._.map(valuation.bill_id.split(','), this._.toInteger);
             const chaptersId = this._.map(valuation.chapter_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`' +
             const sql = 'SELECT `id`, `name`' +
                 '  From ?? ' +
                 '  From ?? ' +
                 '  WHERE `id` in ( ? ) ORDER BY FIELD(`id`, ?)';
                 '  WHERE `id` in ( ? ) ORDER BY FIELD(`id`, ?)';
             const sqlParam = ['zh_std_gcl_list', billsId, billsId];
             const sqlParam = ['zh_std_gcl_list', billsId, billsId];
             const billsList = await this.db.query(sql, sqlParam);
             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`' +
             const sql2 = 'SELECT `id`, `name`' +
                 '  From ?? ' +
                 '  From ?? ' +
                 '  WHERE `id` in ( ? ) ORDER BY FIELD(`id`, ?)';
                 '  WHERE `id` in ( ? ) ORDER BY FIELD(`id`, ?)';