浏览代码

面辅料修改物料判断逻辑

huxy 2 年之前
父节点
当前提交
4ab4fb718c

+ 21 - 21
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/service/impl/SyPackingListFabricServiceImpl.java

@@ -220,9 +220,9 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 
 
 
-			if((entity.getInventoryCcode().indexOf("03")!=-1&&!entity.getInventoryCcode().equals("0399")) ||
-					(entity.getInventoryCcode().indexOf("02")!=-1&&!entity.getInventoryCcode().equals("0299"))||
-					(entity.getInventoryCcode().indexOf("04")!=-1&&!entity.getInventoryCcode().equals("0499"))){
+			if((entity.getInventoryCcode().substring(0,2).equals("03")&&!entity.getInventoryCcode().equals("0399")) ||
+					(entity.getInventoryCcode().substring(0,2).equals("02")&&!entity.getInventoryCcode().equals("0299"))||
+					(entity.getInventoryCcode().substring(0,2).equals("04")&&!entity.getInventoryCcode().equals("0499"))){
 				if(entity.getMeter()!=null){//前端计算米数
 					entity.setActualDeclaredQuantity(entity.getMeter());//修改报关数量
 				}
@@ -569,13 +569,13 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			if(syPackingListFabricItem.getExcessQuantity().intValue()<0){
 				syPackingListFabricItem.setExcessQuantity(new BigDecimal(0));//如果超发数量为-1就写为0
 			}
-			if(syPackingListFabricItem.getVenId()!=null&&syPackingListFabricItem.getVenId().indexOf("04")>-1&&!syPackingListFabricItem.getVenId().equals("0499")){
+			if(syPackingListFabricItem.getVenId()!=null&&syPackingListFabricItem.getVenId().substring(0,2).equals("04")&&!syPackingListFabricItem.getVenId().equals("0499")){
 				//当物料分类为04开头的印厂面料时
 				SyShippingDetailsItem syShippingDetailsItem=syShippingDetailsItemMapper.selectById(syPackingListFabricItem.getSyShippingDetailsItemId());//获取出运明细子表数据
 				syPackingListFabricItem.setSupplierCodeDyeingPlant(syShippingDetailsItem.getRSupplierCode());//染厂编码
 				syPackingListFabricItem.setSupplierDyeingPlant(syShippingDetailsItem.getRSupplier());//染厂
 			}
-			/*if(syPackingListFabricItem.getVenId()!=null&&syPackingListFabricItem.getVenId().indexOf("03")>-1&&!syPackingListFabricItem.getVenId().equals("0399")){
+			/*if(syPackingListFabricItem.getVenId()!=null&&syPackingListFabricItem.getVenId().substring(0,2).equals("03")&&!syPackingListFabricItem.getVenId().equals("0399")){
 				//当物料分类为04开头的印厂面料时
 				SyShippingDetailsItem syShippingDetailsItem=syShippingDetailsItemMapper.selectById(syPackingListFabricItem.getSyShippingDetailsItemId());//获取出运明细子表数据
 				syPackingListFabricItem.setSupplierCodeDyeingPlant(syShippingDetailsItem.getRSupplierCode());//染厂编码
@@ -790,9 +790,9 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 					s1.setSupplier(item.getSupplier());
 					s1.setSupplierCode(item.getSupplierCode());
 
-					if((s1.getInventoryCcode().indexOf("03")!=-1&&!s1.getInventoryCcode().equals("0399")) ||
-							(s1.getInventoryCcode().indexOf("02")!=-1&&!s1.getInventoryCcode().equals("0299"))||
-						(s1.getInventoryCcode().indexOf("04")!=-1&&!s1.getInventoryCcode().equals("0499"))){
+					if((s1.getInventoryCcode().substring(0,2).equals("03")&&!s1.getInventoryCcode().equals("0399")) ||
+							(s1.getInventoryCcode().substring(0,2).equals("02")&&!s1.getInventoryCcode().equals("0299"))||
+							(s1.getInventoryCcode().substring(0,2).equals("04")&&!s1.getInventoryCcode().equals("0499"))){
 							if(s1.getMeter()!=null){
 								s1.setActualDeclaredQuantity(s1.getNetWeight());//净重为报关数量
 
@@ -812,14 +812,14 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 						}
 					}
 
-					if(item.getInventoryCcode()!=null&&item.getInventoryCcode().indexOf("04")>-1
+					if(item.getInventoryCcode()!=null&&item.getInventoryCcode().substring(0,2).equals("04")
 							&&!item.getInventoryCcode().equals("0499")){
 						s1.setSupplierCodeDyeingPlant(item.getRSupplierCode());//染厂编码
 						s1.setSupplierCodePrintingPlant(item.getSupplierCode());//染厂
 						s1.setSupplierCodePrintingPlant(item.getSupplierCode());//印厂编码
 						s1.setSupplierPrintingPlant(item.getSupplier());//印厂
 					}
-					if(item.getInventoryCcode()!=null&&item.getInventoryCcode().indexOf("03")>-1
+					if(item.getInventoryCcode()!=null&&item.getInventoryCcode().substring(0,2).equals("03")
 							&&!item.getInventoryCcode().equals("0399")){
 						s1.setSupplierCodeDyeingPlant(item.getSupplierCode());//染厂编码
 						s1.setSupplierDyeingPlant(item.getSupplier());//染厂
@@ -923,9 +923,9 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 					item.setFactoryUnitPrice(syShippingDetailsItem.getFactoryUnitPrice());
 					item.setSyPackingListFabricId(syPackingListFabric.getId());
 					item.setOrderNumber(syShippingDetailsItem.getOrderNumber());
-					if((syShippingDetailsItem.getInventoryCcode().indexOf("03")!=-1&&!syShippingDetailsItem.getInventoryCcode().equals("0399")) ||
-							(syShippingDetailsItem.getInventoryCcode().indexOf("02")!=-1&&!syShippingDetailsItem.getInventoryCcode().equals("0299"))||
-							(syShippingDetailsItem.getInventoryCcode().indexOf("04")!=-1&&!syShippingDetailsItem.getInventoryCcode().equals("0499"))){//当物料为面料时,实际报关数量为米数
+					if((item.getInventoryCcode().substring(0,2).equals("03")&&!item.getInventoryCcode().equals("0399")) ||
+							(item.getInventoryCcode().substring(0,2).equals("02")&&!item.getInventoryCcode().equals("0299"))||
+							(item.getInventoryCcode().substring(0,2).equals("04")&&!item.getInventoryCcode().equals("0499"))){//当物料为面料时,实际报关数量为米数
 						if(item.getMeter()!=null){
 							item.setActualDeclaredQuantity(item.getMeter());//给面辅料赋米数值
 						}else{
@@ -945,14 +945,14 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 							//throw new JeecgBootException("单位不为kg的物料请填写实际报关数量,用于计算金额");
 						}
 					}
-					if(item.getInventoryCcode()!=null&&item.getInventoryCcode().indexOf("04")>-1
+					if(item.getInventoryCcode()!=null&&item.getInventoryCcode().substring(0,2).equals("04")
 							&&!item.getInventoryCcode().equals("0499")){//印厂
 						item.setSupplierCodeDyeingPlant(syShippingDetailsItem.getRSupplierCode());//染厂编码
 						item.setSupplierDyeingPlant(syShippingDetailsItem.getRSupplier());//染厂
 						item.setSupplierPrintingPlant(syShippingDetailsItem.getSupplier());//印厂编码
 						item.setSupplierCodePrintingPlant(syShippingDetailsItem.getSupplierCode());//印厂
 					}
-					if(item.getInventoryCcode()!=null&&item.getInventoryCcode().indexOf("03")>-1
+					if(item.getInventoryCcode()!=null&&item.getInventoryCcode().substring(0,2).equals("03")
 							&&!item.getInventoryCcode().equals("0399")){//染厂
 						item.setSupplierCodeDyeingPlant(syShippingDetailsItem.getSupplierCode());//染厂编码
 						item.setSupplierDyeingPlant(syShippingDetailsItem.getSupplier());//染厂供应商
@@ -1445,7 +1445,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 					/*mapItem5.put("IORIMONEY",orderDataItem.get("iMoney"));//原币金额
 					mapItem5.put("IMONEY",orderDataItem.get("iNatMoney"));//本币金额*/
 				}
-				if(item.getInventoryCcode()!=null&&item.getInventoryCcode().indexOf("04")>-1
+				if(item.getInventoryCcode()!=null&&item.getInventoryCcode().substring(0,2).equals("04")
 						&&!item.getInventoryCcode().equals("0499")){
 					mapItem.put("CDEFINE26",item.getAfterHeavy());
 				}else{
@@ -2168,7 +2168,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 									sy1.setDeclarationName(syDeclarationElements.getDeclarationName());//获取报关品名
 								}
 							}
-							if(syShippingDetailsItem.getInventoryCcode()!=null&&syShippingDetailsItem.getInventoryCcode().indexOf("04")>-1
+							if(syShippingDetailsItem.getInventoryCcode()!=null&&syShippingDetailsItem.getInventoryCcode().substring(0,2).equals("04")
 									&&!syShippingDetailsItem.getInventoryCcode().equals("0499")){
 								//满足条件
 								sy1.setSupplierCodeDyeingPlant(syShippingDetailsItem.getRSupplierCode());//染厂编码
@@ -2176,7 +2176,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 								sy1.setSupplierCodePrintingPlant(syShippingDetailsItem.getSupplierCode());//印厂编码
 								sy1.setSupplierPrintingPlant(syShippingDetailsItem.getSupplier());//印厂
 							}
-							if(syShippingDetailsItem.getInventoryCcode()!=null&&syShippingDetailsItem.getInventoryCcode().indexOf("03")>-1
+							if(syShippingDetailsItem.getInventoryCcode()!=null&&syShippingDetailsItem.getInventoryCcode().substring(0,2).equals("03")
 									&&!syShippingDetailsItem.getInventoryCcode().equals("0399")){
 								//满足条件
 								sy1.setSupplierCodeDyeingPlant(syShippingDetailsItem.getSupplierCode());//染厂编码
@@ -2206,9 +2206,9 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 							if(sy1.getPrice()!=null&&sy1.getActualDeclaredQuantity()!=null){
 								sy1.setTotalPrice(sy1.getActualDeclaredQuantity().multiply(sy1.getPrice()));//实际报关数量*单价
 							}
-							if((sy1.getInventoryCcode().indexOf("03")!=-1&&!sy1.getInventoryCcode().equals("0399")) ||
-								(sy1.getInventoryCcode().indexOf("02")!=-1&&!sy1.getInventoryCcode().equals("0299"))||
-								(sy1.getInventoryCcode().indexOf("04")!=-1&&!sy1.getInventoryCcode().equals("0499"))){
+							if((sy1.getInventoryCcode().substring(0,2).equals("03")&&!sy1.getInventoryCcode().equals("0399")) ||
+									(sy1.getInventoryCcode().substring(0,2).equals("02")&&!sy1.getInventoryCcode().equals("0299"))||
+									(sy1.getInventoryCcode().substring(0,2).equals("04")&&!sy1.getInventoryCcode().equals("0499"))){
 								if(!sy1.getMasterMetering().equals("KG")){//单位不为KG
 									sy1.setActualDeclaredQuantity(sy1.getInventoryQuantity());
 									sy1.setMeter(sy1.getInventoryQuantity());