Explorar el Código

安全生产、临时占地,修改限制调整

MaiXinRong hace 3 años
padre
commit
86a3b63903
Se han modificado 2 ficheros con 13 adiciones y 19 borrados
  1. 7 11
      app/service/stage_safe_prod.js
  2. 6 8
      app/service/stage_temp_land.js

+ 7 - 11
app/service/stage_safe_prod.js

@@ -125,11 +125,12 @@ module.exports = app => {
                 if (!od) continue;
 
                 const nd = {id: od.id};
-                if (d.name !== undefined) {
-                    if (od.pre_used) throw '往期已使用,不可修改名称';
-                    nd.name = d.name;
+                if (d.name !== undefined) nd.name = d.name;
+                if (d.unit !== undefined) {
+                    if (od.pre_used) throw '往期已使用,不可修改单位';
+                    nd.unit = d.unit;
                 }
-                if (d.unit !== undefined) nd.unit = d.unit;
+                if (d.unit_price !== undefined && od.pre_used) throw '往期已使用,不可修改单价';
                 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);
                 if (d.order !== undefined) nd.order = d.order;
@@ -137,7 +138,7 @@ module.exports = app => {
                     if (od.pre_used) throw '往期已使用,不可修改数量';
                     nd.quantity = this.ctx.helper.round(d.quantity, precision.value);
                     nd.total_price = this.ctx.helper.mul(nd.unit_price, nd.quantity, tpDecimal);
-                } else if(d.unit_price !== undefined) {
+                } else if(d.unit_price !== undefined && !od.pre_used) {
                     nd.total_price = this.ctx.helper.mul(nd.unit_price, od.quantity, tpDecimal);
                 }
                 if (d.qty !== undefined) {
@@ -171,12 +172,7 @@ module.exports = app => {
                 }
                 return result;
             } catch (err) {
-                if (err.stack) {
-                    throw err;
-                } else {
-                    result.err = err.toString();
-                    return result;
-                }
+                throw err;
             }
         }
 

+ 6 - 8
app/service/stage_temp_land.js

@@ -122,10 +122,13 @@ module.exports = app => {
 
                 const nd = {id: od.id};
                 if (d.name !== undefined) {
-                    if (od.pre_used) throw '往期已使用,不可修改名称';
                     nd.name = d.name;
                 }
-                if (d.unit !== undefined) nd.unit = d.unit;
+                if (d.unit !== undefined) {
+                    if (od.pre_used) throw '往期已使用,不可修改单位';
+                    nd.unit = d.unit;
+                }
+                if (d.unit_price !== undefined && od.pre_used) throw '往期已使用,不可修改单价';
                 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);
                 if (d.order !== undefined) nd.order = d.order;
@@ -160,12 +163,7 @@ module.exports = app => {
                 }
                 return result;
             } catch (err) {
-                if (err.stack) {
-                    throw err;
-                } else {
-                    result.err = err.toString();
-                    return result;
-                }
+                throw err;
             }
         }