| 
					
				 | 
			
			
				@@ -9,6 +9,8 @@ import org.jeecg.common.api.vo.Result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.common.system.base.controller.JeecgController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.common.util.oConvertUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.report.entity.FullSetRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.jeecg.modules.report.entity.FullSetRateList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.jeecg.modules.report.entity.FullSetRateSubInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.report.service.IFullSetRateService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.report.service.impl.FullSetRateServiceImpl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -47,29 +49,46 @@ public class FullSetRateController extends JeecgController<FullSetRate, IFullSet 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Result<IPage<FullSetRate>> result = new Result<IPage<FullSetRate>>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Page<FullSetRate> page = new Page<FullSetRate>(pageNo,pageSize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         QueryWrapper<FullSetRate> queryWrapper = new QueryWrapper<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(oConvertUtils.isNotEmpty(fullSetRate.getPlanNo())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            queryWrapper.like("a.cCode",fullSetRate.getPlanNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(oConvertUtils.isNotEmpty(fullSetRate.getSubcontractOrderNo())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            queryWrapper.like("a.cCode",fullSetRate.getSubcontractOrderNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        queryWrapper.groupBy("a.MOID"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+       // if(oConvertUtils.isNotEmpty(fullSetRate.getBeginDate())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            queryWrapper.between("b.dPreDate","2022-09-21","2022-09-21");//fullSetRate.getBeginDate(),fullSetRate.getEndDate() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+       // } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        if(oConvertUtils.isNotEmpty(fullSetRate.getSection())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            queryWrapper.like("a.cCode",fullSetRate.getSection()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        //颜色 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        if(oConvertUtils.isNotEmpty(fullSetRate.getColor())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            queryWrapper.like("b.cFree1",fullSetRate.getColor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        queryWrapper.isNotNull("om.cCode"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        queryWrapper.groupBy("a.ID"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         IPage<FullSetRate> pageList = fullSetRateService.queryListInfo(page,queryWrapper); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //最晚最早出库日期集合 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //销售订单子表集合 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<String> moDeilsIDList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //累计准时出库数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BigDecimal cumulativeOnTimeDeliveryQuantity = BigDecimal.ZERO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //累计延迟出库数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BigDecimal cumulativeDelayedDeliveryQty = BigDecimal.ZERO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for(FullSetRate li:pageList.getRecords()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //查询委外订单子表与发货或日期信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            List<FullSetRate> queryMomain = fullSetRateService.queryMOMain(li.getMoID()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //查询销售订单子表预发货日期信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            QueryWrapper<FullSetRate> queryWrapper1 = new QueryWrapper<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            queryWrapper1.eq("ID",li.getID()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            queryWrapper1.between("dPreDate","2022-09-21","2022-09-21"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<FullSetRate> querySomain = fullSetRateService.querySOMain(queryWrapper1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //循环子表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            for(FullSetRate momian:queryMomain){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                moDeilsIDList.add(momian.getMODetailsID()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for(FullSetRate momian:querySomain){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                moDeilsIDList.add(momian.getISOsID()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //查询销售出库单获取累计准时出库数量,获取累计延迟出库数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              List<FullSetRate> salesIssueList = fullSetRateService.querySalesIssue(momian.getMODetailsID()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<FullSetRate> salesIssueList = fullSetRateService.querySalesIssue(momian.getISOsID()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 for(FullSetRate sa:salesIssueList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     Long saTime = sf.parse(sa.getDeliveryDate()).getTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     Long moTime = sf.parse(momian.getDeliveryDate()).getTime(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -84,12 +103,14 @@ public class FullSetRateController extends JeecgController<FullSetRate, IFullSet 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //获取委外订单数量且赋值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String subcontractOrderQuantity = fullSetRateService.queryOMMOdetilQuantity(moDeilsIDList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            li.setSubcontractOrderQuantity(subcontractOrderQuantity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //累计准时出库数量赋值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             li.setCumulativeOnTimeDeliveryQuantity(cumulativeOnTimeDeliveryQuantity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //累计延迟出库数量赋值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             li.setCumulativeDelayedDeliveryQty(cumulativeDelayedDeliveryQty); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //预计发货日期(最早)赋值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            li.setEstimatedDeliveryDate(queryMomain.get(0).getDeliveryDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //最早出库日期赋值,最晚出库日期赋值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<FullSetRate> dateTimeList = fullSetRateService.querySalesIssueDate(moDeilsIDList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             li.setEarliestIssueDate(dateTimeList.get(dateTimeList.size()-1).getDeliveryDate()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -99,6 +120,21 @@ public class FullSetRateController extends JeecgController<FullSetRate, IFullSet 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             li.setDeliveryRate(deliveryRate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            li.setSoIDsID(moDeilsIDList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //齐套率赋值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            int i = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            BigDecimal avg = BigDecimal.ZERO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            List<FullSetRateList> list = fullSetRateService.queryOMMOdetilList(moDeilsIDList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            for(FullSetRateList rate :list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                //获取最小齐套率且赋值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                List<FullSetRateSubInfo> setRate = fullSetRateService.queryOMMOmainSubInfo(rate.getMODetailsID()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                rate.setSetRate(setRate.get(0).getSetRate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                avg = avg.add(new BigDecimal(setRate.get(0).getSetRate())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                i++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            BigDecimal rate = avg.divide(new BigDecimal(i),2,BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            li.setFullSetRate(rate.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         result.setMessage("查询成功!"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -109,4 +145,50 @@ public class FullSetRateController extends JeecgController<FullSetRate, IFullSet 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 齐套率列表明细查询 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping(value = "/queryOMMOdetilList") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public Result<List<FullSetRateList>> queryOMMOdetilList(List<String> iSOsID){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Result<List<FullSetRateList>> result = new Result<List<FullSetRateList>>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<FullSetRateList> list = fullSetRateService.queryOMMOdetilList(iSOsID); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for(FullSetRateList li:list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //获取最小齐套率且赋值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<FullSetRateSubInfo> setRate = fullSetRateService.queryOMMOmainSubInfo(li.getMODetailsID()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            li.setSetRate(setRate.get(0).getSetRate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.setSuccess(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.setMessage("查询成功!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.setResult(list); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 齐套率子件查询 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param mODetailsID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping(value = "/queryOMMOmainSubInfo") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public Result<List<FullSetRateSubInfo>> queryOMMOmainSubInfo(String mODetailsID){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Result<List<FullSetRateSubInfo>> result = new Result<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<FullSetRateSubInfo> list = fullSetRateService.queryOMMOmainSubInfo(mODetailsID); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.setSuccess(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.setMessage("查询成功!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.setResult(list); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |