From 1c1f525000be35ac6bc3da0549d249383cd7def4 Mon Sep 17 00:00:00 2001 From: zds <2388969634@qq.com> Date: Mon, 24 Oct 2022 17:18:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pf/service/impl/AutoformulaServiceImpl.java | 16 +++++++++++++++- .../wms/pf/service/impl/FormulaServiceImpl.java | 7 +++++++ .../pf/service/impl/InitformulaServiceImpl.java | 14 ++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/service/impl/AutoformulaServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/service/impl/AutoformulaServiceImpl.java index 61e2f5bc..5bcc90e6 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/service/impl/AutoformulaServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/service/impl/AutoformulaServiceImpl.java @@ -669,7 +669,9 @@ public class AutoformulaServiceImpl implements AutoformulaService { //获取修正值 double change_qty = this.getWCChange(bomdlt_Cr3C2.getString("material_id"),bomdlt_Cr3C2.getString("pcsn")); value = value + change_qty; - + if(value<0){ + throw new BadRequestException("物料"+bomdlt_Cr3C2.getString("material_code")+" "+bomdlt_Cr3C2.getString("material_name")+"修正后含碳量不能为负数:"+value+"!"); + } //总碳 CT1 = CT1 + bom_ivt_qty*value/100.0; @@ -1905,6 +1907,9 @@ public class AutoformulaServiceImpl implements AutoformulaService { //获取修正值 double change_qty = this.getWCChange(bomdlt_Cr3C2.getString("material_id"),bomdlt_Cr3C2.getString("pcsn")); is_tan = is_tan + change_qty; + if(is_tan<0){ + throw new BadRequestException("物料"+bomdlt_Cr3C2.getString("material_code")+" "+bomdlt_Cr3C2.getString("material_name")+"修正后含碳量不能为负数:"+is_tan+"!"); + } //总碳 CT1 = CT1 + bom_ivt_qty*is_tan/100.0; //总碳化钨 @@ -1921,6 +1926,9 @@ public class AutoformulaServiceImpl implements AutoformulaService { double rf_cr3c2 = rf_dis.getDouble("rf_cr3c2"); //含碳比 double is_tan = rf_dis.getDouble("is_tan"); + if(is_tan<0){ + throw new BadRequestException("物料"+rf_dis.getString("material_code")+" "+rf_dis.getString("material_name")+"含碳量不能为负数:"+is_tan+"!"); + } //总碳 CT1 = CT1 + net_rate_qty*(rf_cr3c2/100.0)*(is_tan/100.0); //总碳化钨 @@ -3586,6 +3594,9 @@ public class AutoformulaServiceImpl implements AutoformulaService { //获取修正值 double change_qty = this.getWCChange(bomdlt_Cr3C2.getString("material_id"),bomdlt_Cr3C2.getString("pcsn")); is_tan = is_tan + change_qty; + if(is_tan<0){ + throw new BadRequestException("物料"+bomdlt_Cr3C2.getString("material_code")+" "+bomdlt_Cr3C2.getString("material_name")+"修正后含碳量不能为负数:"+is_tan+"!"); + } //总碳 CT1 = CT1 + bom_ivt_qty*is_tan/100.0; //更新含碳比 @@ -3603,6 +3614,9 @@ public class AutoformulaServiceImpl implements AutoformulaService { double rf_Cr3C2 = ivt_new.getDouble("rf_Cr3C2"); //含碳比 double is_tan = ivt_new.getDouble("is_tan"); + if(is_tan<0){ + throw new BadRequestException("物料"+ivt_new.getString("material_code")+" "+ivt_new.getString("material_name")+"含碳量不能为负数:"+is_tan+"!"); + } //总碳 CT1 = CT1 + formula_qty*is_tan/100.0*net_rate/100.0*rf_Cr3C2/100.0; } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/service/impl/FormulaServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/service/impl/FormulaServiceImpl.java index 8d25231f..83b15255 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/service/impl/FormulaServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/service/impl/FormulaServiceImpl.java @@ -224,6 +224,13 @@ public class FormulaServiceImpl implements FormulaService { if(jo.getDouble("formula_qty")<=0){ continue; } + String is_tan = jo.getString("is_tan"); + if (StrUtil.isNotEmpty(is_tan)) { + double is_tan1 = Double.parseDouble(is_tan); + if(is_tan1<0){ + throw new BadRequestException("物料"+jo.getString("material_code")+" "+jo.getString("material_name")+"含碳量不能为负数:"+is_tan1+"!"); + } + } jo.put("seq_no",(mn)+""); mn++; if("1".equals(jo.getString("is_need_manage"))){ diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/service/impl/InitformulaServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/service/impl/InitformulaServiceImpl.java index 1382a1f4..34c15096 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/service/impl/InitformulaServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/service/impl/InitformulaServiceImpl.java @@ -347,6 +347,13 @@ public class InitformulaServiceImpl implements InitformulaService { if(jo.getDouble("formula_qty")<=0){ continue; } + String is_tan = jo.getString("is_tan"); + if (StrUtil.isNotEmpty(is_tan)) { + double is_tan1 = Double.parseDouble(is_tan); + if(is_tan1<0){ + throw new BadRequestException("物料"+jo.getString("material_code")+" "+jo.getString("material_name")+"含碳量不能为负数:"+is_tan1+"!"); + } + } jo.put("formula_id",formula_id); jo.put("formuladtl_id",IdUtil.getSnowflake(1, 1).nextId()); jo.put("formula_code",formula_code); @@ -640,6 +647,13 @@ public class InitformulaServiceImpl implements InitformulaService { if(jo.getDouble("formula_qty")<=0){ continue; } + String is_tan = jo.getString("is_tan"); + if (StrUtil.isNotEmpty(is_tan)) { + double is_tan1 = Double.parseDouble(is_tan); + if(is_tan1<0){ + throw new BadRequestException("物料"+jo.getString("material_code")+" "+jo.getString("material_name")+"含碳量不能为负数:"+is_tan1+"!"); + } + } jo.put("formula_id",formula_id); jo.put("formuladtl_id",IdUtil.getSnowflake(1, 1).nextId()); jo.put("formula_code",formula_code);