Browse Source

添加新粮情分析功能

lvzhikai 4 years ago
parent
commit
da204c8876

+ 10 - 10
src/main/java/com/chinaitop/depot/business/mapper/BusinessPlanMapper.xml

@@ -1171,17 +1171,17 @@
1171 1171
     cmz.nrhwID,<!--拟入货位-->
1172 1172
     sum(cpz.xzklhjz) as xzklhjz<!--入库数量-->
1173 1173
     FROM
1174
-    depot_shanxi.business_plan plan
1175
-    LEFT JOIN depot_shanxi.business_store_ware_detail detail ON plan.id = detail.zid
1176
-    LEFT JOIN depot_shanxi.business_contract contract ON plan.plan_number = contract.plan_number
1174
+    depot.business_plan plan
1175
+    LEFT JOIN depot.business_store_ware_detail detail ON plan.id = detail.zid
1176
+    LEFT JOIN depot.business_contract contract ON plan.plan_number = contract.plan_number
1177 1177
     LEFT JOIN (
1178 1178
         SELECT
1179 1179
         notice.shiping_count,
1180 1180
         notice.contract,
1181 1181
         notice.bill_number
1182 1182
         FROM
1183
-            depot_shanxi.business_delivery_storage_notice notice
1184
-        LEFT JOIN depot_shanxi.business_store_ware_detail detail ON notice.id = detail.zid
1183
+            depot.business_delivery_storage_notice notice
1184
+        LEFT JOIN depot.business_store_ware_detail detail ON notice.id = detail.zid
1185 1185
         <where>
1186 1186
           detail.type = 'notice'
1187 1187
           <if test="orgId != null and orgId != ''">
@@ -1221,17 +1221,17 @@
1221 1221
     ckcpz.ychwID nrhwID,
1222 1222
     sum(ckcmz.klhjz) AS xzklhjz
1223 1223
     FROM
1224
-    depot_shanxi.business_plan plan
1225
-    LEFT JOIN depot_shanxi.business_store_ware_detail detail ON plan.id = detail.zid
1226
-    LEFT JOIN depot_shanxi.business_contract contract ON plan.plan_number = contract.plan_number
1224
+    depot.business_plan plan
1225
+    LEFT JOIN depot.business_store_ware_detail detail ON plan.id = detail.zid
1226
+    LEFT JOIN depot.business_contract contract ON plan.plan_number = contract.plan_number
1227 1227
     LEFT JOIN (
1228 1228
         SELECT
1229 1229
         notice.shiping_count,
1230 1230
         notice.contract,
1231 1231
         notice.bill_number
1232 1232
         FROM
1233
-            depot_shanxi.business_delivery_storage_notice notice
1234
-        LEFT JOIN depot_shanxi.business_store_ware_detail detail ON notice.id = detail.zid
1233
+            depot.business_delivery_storage_notice notice
1234
+        LEFT JOIN depot.business_store_ware_detail detail ON notice.id = detail.zid
1235 1235
         <where>
1236 1236
           detail.type = 'notice'
1237 1237
           <if test="orgId != null and orgId != ''">

+ 6 - 58
src/main/java/com/chinaitop/depot/business/service/impl/BusinessContractServiceImpl.java

@@ -1028,33 +1028,7 @@ public class BusinessContractServiceImpl implements BusinessContractService {
1028 1028
                     	//根据主表获取仓房货位信息
1029 1029
                         List<BusinessStoreWareDetail> storeWareDetailList= businessStoreWareDetailService.getByZidAndType(businessContractV.getId(), StoreWareType.contract.getValue());
1030 1030
                         BigDecimal wcsl = new BigDecimal("0") ;
1031
-                    	BigDecimal sysl = new BigDecimal("0") ;
1032 1031
                     	List<BusinessScedule> businessSceduleSyList = new ArrayList<BusinessScedule>();
1033
-                        for (BusinessStoreWareDetail businessStoreWareDetail : storeWareDetailList) {
1034
-                        	//根据单位仓房货位品种性质 获取损益的数量
1035
-                        	Map<String, Object> map = new HashMap<String, Object>();
1036
-                        	map.put("orgId", businessContractV.getOrgId());
1037
-                        	map.put("grainKind", businessStoreWareDetail.getGrainKind());
1038
-                    		map.put("grainAttribute", businessStoreWareDetail.getGrainAttribute());
1039
-                        	if(businessStoreWareDetail.getHouseId()!=null && !businessStoreWareDetail.getHouseId().equals("0")){//粮食
1040
-                        		map.put("houseId", businessStoreWareDetail.getHouseId());
1041
-                        		map.put("warehouseId", businessStoreWareDetail.getWarehouseId());
1042
-                        	}else if(businessStoreWareDetail.getHouseId().equals("0")){//油
1043
-                        		map.put("houseId", businessStoreWareDetail.getHouseName());
1044
-                        	}
1045
-                        	//区分出库入库--损【1】就出库,益【0】就是入库
1046
-                            if ("1".equals(businessScedule.getCrkLx())) {//入库
1047
-                                map.put("lossProfit", 0);
1048
-                            }else{
1049
-                                map.put("lossProfit", 1);
1050
-                            }
1051
-                            businessSceduleSyList = businessSceduleService.getSyCount(map);
1052
-                        	
1053
-                        	if(businessSceduleSyList.size()>0){
1054
-                        		 sysl = new BigDecimal(businessSceduleSyList.get(0).getSysl());
1055
-                        	}
1056
-                        	break;
1057
-                        }
1058 1032
                         	if (businessContractV.getId().toString().equals(businessScedule.getHtId())) {
1059 1033
                                 flag = true;
1060 1034
                                 // 在出入库系统中,存在该合同对应的出入库数据,进行计算,得出完成比率.
@@ -1065,22 +1039,9 @@ public class BusinessContractServiceImpl implements BusinessContractService {
1065 1039
                                     String sumRksl = businessScedule.getSumWcsl();
1066 1040
                                     BigDecimal sumRkslD = new BigDecimal(sumRksl);
1067 1041
                                     // 出入库中的出库数量单位是公斤,合同中是吨,所以出入库数量要除以1000.
1068
-                                    //sumRkslD = sumRkslD.divide(new BigDecimal("1000"), 4, BigDecimal.ROUND_HALF_DOWN);
1069
-                                    
1070
-                                    if(businessSceduleSyList.size()>0){
1071
-                                   	 if(businessSceduleSyList.get(0).getSycode().equals("1")){ //1是减少 0是增加
1072
-                                      	  wcsl = sumRkslD.add(sysl);
1073
-                                      	  businessContractV.setRemainingAmount(sumRkslD.subtract(wcsl).add(sysl).stripTrailingZeros().toPlainString());
1074
-                                       }else if(businessSceduleSyList.get(0).getSycode().equals("0")){
1075
-                                      	 wcsl = sumRkslD.subtract(sysl);
1076
-                                      	 businessContractV.setRemainingAmount(sumRkslD.subtract(wcsl).subtract(sysl).stripTrailingZeros().toPlainString());
1077
-                                       }
1078
-                                    }else{
1079
-                                   	    wcsl = sumRkslD;
1080
-                                   	    businessContractV.setRemainingAmount(sumRkslD.subtract(wcsl).stripTrailingZeros().toPlainString());
1081
-                                    }
1082
-                                    
1083
-                                    
1042
+                                    wcsl = sumRkslD;
1043
+                                    businessContractV.setRemainingAmount(sumRkslD.subtract(wcsl).stripTrailingZeros().toPlainString());
1044
+
1084 1045
                                     // 赋值: 设置完成数量. stripTrailingZeros() 去除结尾的0
1085 1046
                                     businessContractV.setCompleteAmount(wcsl.stripTrailingZeros().toPlainString());
1086 1047
                                     
@@ -1100,22 +1061,9 @@ public class BusinessContractServiceImpl implements BusinessContractService {
1100 1061
                                     String sumCksl = businessScedule.getSumWcsl();
1101 1062
                                     BigDecimal sumCkslD = new BigDecimal(sumCksl);
1102 1063
                                     // 出入库中的出库数量单位是公斤,合同中是吨,所以出入库数量要除以1000.
1103
-                                    //sumCkslD = sumCkslD.divide(new BigDecimal("1000"), 4, BigDecimal.ROUND_HALF_DOWN);
1104
-                                    
1105
-                                    if(businessSceduleSyList.size()>0){
1106
-                                   	 if(businessSceduleSyList.get(0).getSycode().equals("1")){ //1是减少 0是增加
1107
-                                       	    wcsl = sumCkslD.add(sysl);
1108
-                                       	    businessContractV.setRemainingAmount(sumCkslD.subtract(wcsl).add(sysl).stripTrailingZeros().toPlainString());
1109
-                                         }else if(businessSceduleSyList.get(0).getSycode().equals("0")){
1110
-                                       	    wcsl = sumCkslD.subtract(sysl);
1111
-                                       	    businessContractV.setRemainingAmount(sumCkslD.subtract(wcsl).subtract(sysl).stripTrailingZeros().toPlainString());
1112
-                                         }
1113
-                                    }else{
1114
-                                   	   wcsl = sumCkslD;
1115
-                                   	   businessContractV.setRemainingAmount(sumCkslD.subtract(wcsl).stripTrailingZeros().toPlainString());
1116
-                                    }
1117
-                                    
1118
-                                    
1064
+                                   wcsl = sumCkslD;
1065
+                                   businessContractV.setRemainingAmount(sumCkslD.subtract(wcsl).stripTrailingZeros().toPlainString());
1066
+
1119 1067
                                     // 赋值:设置完成数量 . stripTrailingZeros() 去除结尾的0
1120 1068
                                     businessContractV.setCompleteAmount(wcsl.stripTrailingZeros().toPlainString());
1121 1069
                                     

+ 5 - 51
src/main/java/com/chinaitop/depot/business/service/impl/BusinessDeliveryStorageNoticeServiceImpl.java

@@ -908,32 +908,7 @@ public class BusinessDeliveryStorageNoticeServiceImpl implements BusinessDeliver
908 908
 	                    			//根据主表获取仓房货位信息
909 909
 	                                List<BusinessStoreWareDetail> storeWareDetailList= businessStoreWareDetailService.getByZidAndType(businessDeliveryStorageNoticeV.getId(), StoreWareType.notice.getValue());
910 910
 	                                BigDecimal wcsl = new BigDecimal("0") ;
911
-	                            	BigDecimal sysl = new BigDecimal("0") ;
912 911
 	                            	List<BusinessScedule> businessSceduleSyList = new ArrayList<BusinessScedule>();
913
-	                                for (BusinessStoreWareDetail businessStoreWareDetail : storeWareDetailList) {
914
-	                                	//根据单位仓房货位品种性质 获取损益的数量
915
-	                                	Map<String, Object> map = new HashMap<String, Object>();
916
-	                                	map.put("orgId", businessDeliveryStorageNoticeV.getOrgId());
917
-	                                	map.put("grainKind", businessStoreWareDetail.getGrainKind());
918
-	                            		map.put("grainAttribute", businessStoreWareDetail.getGrainAttribute());
919
-	                                	if(businessStoreWareDetail.getHouseId()!=null && !businessStoreWareDetail.getHouseId().equals("0")){//粮食
920
-	                                		map.put("houseId", businessStoreWareDetail.getHouseId());
921
-	                                		map.put("warehouseId", businessStoreWareDetail.getWarehouseId());
922
-	                                	}else if(businessStoreWareDetail.getHouseId().equals("0")){//油
923
-	                                		map.put("houseId", businessStoreWareDetail.getHouseName());
924
-	                                	}
925
-                                        //区分出库入库--损【1】就出库,益【0】就是入库
926
-                                        if ("1".equals(businessScedule.getCrkLx())) {//入库
927
-                                            map.put("lossProfit", 0);
928
-                                        }else{
929
-                                            map.put("lossProfit", 1);
930
-                                        }
931
-	                                	 businessSceduleSyList = businessSceduleService.getSyCount(map);
932
-	                                	if(businessSceduleSyList.size()>0){
933
-	                                		 sysl = new BigDecimal(businessSceduleSyList.get(0).getSysl());
934
-	                                	}
935
-	                                	break;
936
-	                                }	
937 912
 	                                	// 在出入库系统中,存在该通知单对应的出入库数据,进行计算,得出完成比率.
938 913
 		                    			String crkLx = businessScedule.getCrkLx();
939 914
 		                    			if ("1".equals(crkLx)) {
@@ -942,19 +917,9 @@ public class BusinessDeliveryStorageNoticeServiceImpl implements BusinessDeliver
942 917
 		                    				String sumRksl = businessScedule.getSumWcsl();
943 918
 		                    				BigDecimal sumRkslD = new BigDecimal(sumRksl);
944 919
 		                    				
945
-		                    				if(businessSceduleSyList.size()>0){
946
-		                                    	 if(businessSceduleSyList.get(0).getSycode().equals("1")){ //1是减少 0是增加
947
-			                                       	  wcsl = sumRkslD.add(sysl);
948
-			                                       	  businessDeliveryStorageNoticeV.setRemainingAmount(sumRkslD.subtract(wcsl).add(sysl).stripTrailingZeros().toPlainString());
949
-		                                         }else if(businessSceduleSyList.get(0).getSycode().equals("0")){
950
-			                                       	 wcsl = sumRkslD.subtract(sysl);
951
-			                                       	 businessDeliveryStorageNoticeV.setRemainingAmount(sumRkslD.subtract(wcsl).subtract(sysl).stripTrailingZeros().toPlainString());
952
-		                                         }
953
-		                                     }else{
954
-			                                    	 wcsl = sumRkslD;
955
-			                                    	 businessDeliveryStorageNoticeV.setRemainingAmount(sumRkslD.subtract(wcsl).stripTrailingZeros().toPlainString());
956
-		                                     }
957
-		                    				
920
+                                         wcsl = sumRkslD;
921
+                                         businessDeliveryStorageNoticeV.setRemainingAmount(sumRkslD.subtract(wcsl).stripTrailingZeros().toPlainString());
922
+
958 923
 		                    				// 赋值:设置完成数量. stripTrailingZeros() 去除结尾的0
959 924
 		                    				businessDeliveryStorageNoticeV.setCompleteAmount(wcsl.stripTrailingZeros().toPlainString());
960 925
 		                    				// 通知单要求数量.
@@ -973,20 +938,9 @@ public class BusinessDeliveryStorageNoticeServiceImpl implements BusinessDeliver
973 938
 		                    				String sumCksl = businessScedule.getSumWcsl();
974 939
 		                    				BigDecimal sumCkslD = new BigDecimal(sumCksl);
975 940
 		                    				
976
-		                    				if(businessSceduleSyList.size()>0){
977
-		                                    	 if(businessSceduleSyList.get(0).getSycode().equals("1")){ //1是减少 0是增加
978
-		                                        	    wcsl = sumCkslD.add(sysl);
979
-				                                       	businessDeliveryStorageNoticeV.setRemainingAmount(sumCkslD.subtract(wcsl).add(sysl).stripTrailingZeros().toPlainString());
941
+                                         wcsl = sumCkslD;
942
+                                         businessDeliveryStorageNoticeV.setRemainingAmount(sumCkslD.subtract(wcsl).stripTrailingZeros().toPlainString());
980 943
 
981
-		                                          }else if(businessSceduleSyList.get(0).getSycode().equals("0")){
982
-		                                        	    wcsl = sumCkslD.subtract(sysl);
983
-				                                       	businessDeliveryStorageNoticeV.setRemainingAmount(sumCkslD.subtract(wcsl).subtract(sysl).stripTrailingZeros().toPlainString());
984
-		                                          }
985
-		                                     }else{
986
-		                                    	 wcsl = sumCkslD;
987
-		                                    	 businessDeliveryStorageNoticeV.setRemainingAmount(sumCkslD.subtract(wcsl).stripTrailingZeros().toPlainString());
988
-		                                     }
989
-		                    				
990 944
 		                    				// 赋值:设置完成数量. stripTrailingZeros() 去除结尾的0
991 945
 		                    				businessDeliveryStorageNoticeV.setCompleteAmount(wcsl.stripTrailingZeros().toPlainString());
992 946
 		                    				

+ 9 - 67
src/main/java/com/chinaitop/depot/business/service/impl/BusinessPlanServiceImpl.java

@@ -623,37 +623,11 @@ public class BusinessPlanServiceImpl implements BusinessPlanService {
623 623
                         if (businessPlanV.getId().toString().equals(businessScedule.getJhId())) {
624 624
                             flag = true;
625 625
                             // 在出入库系统中,存在该计划对应的出入库数据,进行计算,得出完成比率.
626
-                            
627
-                           
626
+
628 627
                         	//根据主表获取仓房货位信息
629 628
                             List<BusinessStoreWareDetail> storeWareDetailList= businessStoreWareDetailService.getByZidAndType(businessPlanV.getId(), StoreWareType.plan.getValue());
630 629
                             BigDecimal wcsl = new BigDecimal("0") ;
631
-                        	BigDecimal sysl = new BigDecimal("0") ;//损益数量
632 630
                         	List<BusinessScedule> businessSceduleSyList = new ArrayList<BusinessScedule>();
633
-                            for (BusinessStoreWareDetail businessStoreWareDetail : storeWareDetailList) {
634
-                            	//根据单位仓房货位品种性质 获取损益的数量
635
-                            	Map<String, Object> map = new HashMap<String, Object>();
636
-                            	map.put("orgId", businessPlanV.getOrgId());
637
-                            	map.put("grainKind", businessStoreWareDetail.getGrainKind());
638
-                        		map.put("grainAttribute", businessStoreWareDetail.getGrainAttribute());
639
-                            	if(businessStoreWareDetail.getHouseId()!=null && !businessStoreWareDetail.getHouseId().equals("0")){//粮食
640
-                            		map.put("houseId", businessStoreWareDetail.getHouseId());
641
-                            		map.put("warehouseId", businessStoreWareDetail.getWarehouseId());
642
-                            	}else if(businessStoreWareDetail.getHouseId().equals("0")){//油
643
-                            		map.put("houseId", businessStoreWareDetail.getHouseName());
644
-                            	}
645
-                                //区分出库入库--损【1】就出库,益【0】就是入库
646
-                                if ("1".equals(businessScedule.getCrkLx())) {//入库
647
-                                    map.put("lossProfit", 0);
648
-                                }else{
649
-                                    map.put("lossProfit", 1);
650
-                                }
651
-                            	 businessSceduleSyList = businessSceduleService.getSyCount(map);
652
-                            	if(businessSceduleSyList.size()>0){
653
-                            		 sysl = new BigDecimal(businessSceduleSyList.get(0).getSysl());
654
-                            	}
655
-                            	break;
656
-                            }	
657 631
                             	 String crkLx = businessScedule.getCrkLx();
658 632
                             if (ParameterUtil.isequal("3156",businessPlanV.getExecuteType()) || ParameterUtil.isequal("7121",businessPlanV.getExecuteType())) {
659 633
                                 // 入库数量.
@@ -665,18 +639,8 @@ public class BusinessPlanServiceImpl implements BusinessPlanService {
665 639
                                 BigDecimal sumCkslD = new BigDecimal(sumCksl);
666 640
 
667 641
                                 sumRkslD.add(sumCkslD);
668
-                                if(businessSceduleSyList.size()>0){
669
-                                    if(businessSceduleSyList.get(0).getSycode().equals("1")){ //1是减少 0是增加
670
-                                        wcsl = sumRkslD.add(sysl);
671
-                                        businessPlanV.setRemainingAmount(sumRkslD.subtract(wcsl).add(sysl).stripTrailingZeros().toPlainString());
672
-                                    }else if(businessSceduleSyList.get(0).getSycode().equals("0")){
673
-                                        wcsl = sumRkslD.subtract(sysl);
674
-                                        businessPlanV.setRemainingAmount(sumRkslD.subtract(wcsl).subtract(sysl).stripTrailingZeros().toPlainString());
675
-                                    }
676
-                                }else{
677
-                                    wcsl = sumRkslD;
678
-                                    businessPlanV.setRemainingAmount(sumRkslD.subtract(wcsl).stripTrailingZeros().toPlainString());
679
-                                }
642
+                                wcsl = sumRkslD;
643
+                                businessPlanV.setRemainingAmount(sumRkslD.subtract(wcsl).stripTrailingZeros().toPlainString());
680 644
 
681 645
                                 // 赋值:设置完成数量. stripTrailingZeros() 去除结尾的0
682 646
                                 businessPlanV.setCompleteAmount(wcsl.stripTrailingZeros().toPlainString());
@@ -701,19 +665,9 @@ public class BusinessPlanServiceImpl implements BusinessPlanService {
701 665
                                      String sumRksl = businessScedule.getSumWcsl();
702 666
                                      BigDecimal sumRkslD = new BigDecimal(sumRksl);
703 667
                                      
704
-                                     if(businessSceduleSyList.size()>0){
705
-                                    	 if(businessSceduleSyList.get(0).getSycode().equals("1")){ //1是减少 0是增加
706
-                                       	  wcsl = sumRkslD.add(sysl);
707
-                                       	  businessPlanV.setRemainingAmount(sumRkslD.subtract(wcsl).add(sysl).stripTrailingZeros().toPlainString());
708
-                                        }else if(businessSceduleSyList.get(0).getSycode().equals("0")){
709
-                                       	  wcsl = sumRkslD.subtract(sysl);
710
-                                     	  businessPlanV.setRemainingAmount(sumRkslD.subtract(wcsl).subtract(sysl).stripTrailingZeros().toPlainString());
711
-                                        }
712
-                                     }else{
713
-                                    	 wcsl = sumRkslD;
714
-                                    	 businessPlanV.setRemainingAmount(sumRkslD.subtract(wcsl).stripTrailingZeros().toPlainString());
715
-                                     }
716
-                                     
668
+                                     wcsl = sumRkslD;
669
+                                     businessPlanV.setRemainingAmount(sumRkslD.subtract(wcsl).stripTrailingZeros().toPlainString());
670
+
717 671
                                      
718 672
                                      // 赋值:设置完成数量. stripTrailingZeros() 去除结尾的0
719 673
                                      businessPlanV.setCompleteAmount(wcsl.stripTrailingZeros().toPlainString());
@@ -734,21 +688,9 @@ public class BusinessPlanServiceImpl implements BusinessPlanService {
734 688
                                      String sumCksl = businessScedule.getSumWcsl();
735 689
                                      BigDecimal sumCkslD = new BigDecimal(sumCksl);
736 690
                                      
737
-                                     if(businessSceduleSyList.size()>0){
738
-                                    	 if(businessSceduleSyList.get(0).getSycode().equals("1")){ //1是减少 0是增加
739
-                                        	    wcsl = sumCkslD.add(sysl);
740
-                                        	    businessPlanV.setRemainingAmount(sumCkslD.subtract(wcsl).add(sysl).stripTrailingZeros().toPlainString());
741
-                                          }else if(businessSceduleSyList.get(0).getSycode().equals("0")){
742
-                                        	    wcsl = sumCkslD.subtract(sysl);
743
-                                        	    businessPlanV.setRemainingAmount(sumCkslD.subtract(wcsl).subtract(sysl).stripTrailingZeros().toPlainString());
744
-                                          }
745
-                                     }else{
746
-                                    	 wcsl = sumCkslD;
747
-                                    	 businessPlanV.setRemainingAmount(sumCkslD.subtract(wcsl).stripTrailingZeros().toPlainString());
748
-                                     }
749
-                                     
750
-                                     
751
-                                     
691
+                                     wcsl = sumCkslD;
692
+                                     businessPlanV.setRemainingAmount(sumCkslD.subtract(wcsl).stripTrailingZeros().toPlainString());
693
+
752 694
                                      // 赋值:设置完成数量. stripTrailingZeros() 去除结尾的0
753 695
                                      businessPlanV.setCompleteAmount(wcsl.stripTrailingZeros().toPlainString());
754 696