Browse Source

甲供材料、奖罚金、其他,提交空数据相关

MaiXinRong 5 years ago
parent
commit
fafb841fcc
3 changed files with 24 additions and 24 deletions
  1. 7 7
      app/service/stage_bonus.js
  2. 11 11
      app/service/stage_jgcl.js
  3. 6 6
      app/service/stage_other.js

+ 7 - 7
app/service/stage_bonus.js

@@ -98,13 +98,13 @@ module.exports = app => {
                 if (!od) continue;
 
                 const nd = {id: od.id};
-                if (d.name) nd.name = d.name;
-                if (d.tp) nd.tp = this.ctx.helper.round(d.tp, this.ctx.tender.info.decimal.tp);
-                if (d.code) nd.code = d.code;
-                if (d.proof) nd.proof = d.proof;
-                if (d.real_time) nd.real_time = new Date(d.real_time);
-                if (d.memo) nd.memo = d.memo;
-                if (d.order) nd.order = d.order;
+                if (d.name !== undefined) nd.name = d.name;
+                if (d.tp !== undefined) nd.tp = this.ctx.helper.round(d.tp, this.ctx.tender.info.decimal.tp);
+                if (d.code !== undefined) nd.code = d.code;
+                if (d.proof !== undefined) nd.proof = d.proof;
+                if (d.real_time !== undefined) nd.real_time = new Date(d.real_time);
+                if (d.memo !== undefined) nd.memo = d.memo;
+                if (d.order !== undefined) nd.order = d.order;
                 uDatas.push(nd);
                 console.log(nd);
             }

+ 11 - 11
app/service/stage_jgcl.js

@@ -125,27 +125,27 @@ module.exports = app => {
                 const nd = {id: od.id};
                 if (d.name) nd.name = d.name;
                 if (od.pre_used === null || od.pre_used === undefined || od.pre_used === 0) {
-                    if (d.unit) nd.unit = d.unit;
-                    nd.unit_price = d.unit_price ? this.ctx.helper.round(d.unit_price, info.decimal.up) : od.unit_price;
+                    if (d.unit !== undefined) nd.unit = d.unit;
+                    nd.unit_price = d.unit_price !== undefined ? this.ctx.helper.round(d.unit_price, info.decimal.up) : od.unit_price;
                 }
                 const precision = this.ctx.helper.findPrecision(info.precision, d.unit_price);
-                if (d.arrive_qty) {
+                if (d.arrive_qty !== undefined) {
                     nd.arrive_qty = this.ctx.helper.round(d.arrive_qty, precision.value);
                     nd.arrive_tp = this.ctx.helper.mul(nd.unit_price, nd.arrive_qty, info.decimal.tp);
-                } else if (d.unit_price) {
+                } else if (d.unit_price !== undefined) {
                     nd.arrive_tp = this.ctx.helper.mul(nd.unit_price, od.arrive_qty, info.decimal.tp);
                 }
-                if (d.deduct_qty) {
+                if (d.deduct_qty !== undefined) {
                     nd.deduct_qty = this.ctx.helper.round(d.deduct_qty, precision.value);
                     nd.deduct_tp = this.ctx.helper.mul(nd.unit_price, nd.deduct_qty, info.decimal.tp);
-                } else if (d.unit_price) {
+                } else if (d.unit_price !== undefined) {
                     nd.deduct_tp = this.ctx.helper.mul(nd.unit_price, od.deduct_qty, info.decimal.tp);
                 }
-                if (d.source) nd.source = d.source;
-                if (d.bills_code) nd.bills_code = d.bills_code;
-                if (d.check_code) nd.check_code = d.check_code;
-                if (d.memo) nd.memo = d.memo;
-                if (d.order) nd.order = d.order;
+                if (d.source !== undefined) nd.source = d.source;
+                if (d.bills_code !== undefined) nd.bills_code = d.bills_code;
+                if (d.check_code !== undefined) nd.check_code = d.check_code;
+                if (d.memo !== undefined) nd.memo = d.memo;
+                if (d.order !== undefined) nd.order = d.order;
                 uDatas.push(nd);
             }
             if (uDatas.length > 0) {

+ 6 - 6
app/service/stage_other.js

@@ -99,18 +99,18 @@ module.exports = app => {
                 if (!od) continue;
 
                 const nd = {id: od.id};
-                if (d.name) {
+                if (d.name !== undefined) {
                     if (od.pre_used) throw '往期已使用,不可修改名称';
                     nd.name = d.name;
                 }
-                if (d.order) nd.order = d.order;
-                if (d.total_price) {
+                if (d.order !== undefined) nd.order = d.order;
+                if (d.total_price !== undefined) {
                     if (od.pre_used) throw '往期已使用,不可修改金额';
                     nd.total_price = this.ctx.helper.round(d.total_price, this.ctx.tender.info.decimal.tp);
                 }
-                if (d.tp) nd.tp = this.ctx.helper.round(d.tp, this.ctx.tender.info.decimal.tp);
-                if (d.real_time) nd.real_time = new Date(d.real_time);
-                if (d.memo) nd.memo = d.memo;
+                if (d.tp !== undefined) nd.tp = this.ctx.helper.round(d.tp, this.ctx.tender.info.decimal.tp);
+                if (d.real_time !== undefined) nd.real_time = new Date(d.real_time);
+                if (d.memo !== undefined) nd.memo = d.memo;
                 uDatas.push(nd);
             }
             if (uDatas.length > 0) {