|
@@ -17,10 +17,12 @@ import org.jeecg.modules.DestRule.service.IDestRuleService;
|
|
import org.jeecg.modules.ProdPlan.entity.DelayProduct;
|
|
import org.jeecg.modules.ProdPlan.entity.DelayProduct;
|
|
import org.jeecg.modules.ProdPlan.entity.DeliveredQuantity;
|
|
import org.jeecg.modules.ProdPlan.entity.DeliveredQuantity;
|
|
import org.jeecg.modules.ProdPlan.entity.ProdPlan;
|
|
import org.jeecg.modules.ProdPlan.entity.ProdPlan;
|
|
|
|
+import org.jeecg.modules.ProdPlan.entity.ToolRule;
|
|
import org.jeecg.modules.ProdPlan.mapper.ProdPlanMapper;
|
|
import org.jeecg.modules.ProdPlan.mapper.ProdPlanMapper;
|
|
import org.jeecg.modules.ProdPlan.service.IDelayProductService;
|
|
import org.jeecg.modules.ProdPlan.service.IDelayProductService;
|
|
import org.jeecg.modules.ProdPlan.service.IDeliveredQuantityService;
|
|
import org.jeecg.modules.ProdPlan.service.IDeliveredQuantityService;
|
|
import org.jeecg.modules.ProdPlan.service.IProdPlanService;
|
|
import org.jeecg.modules.ProdPlan.service.IProdPlanService;
|
|
|
|
+import org.jeecg.modules.ProdPlan.service.IToolRuleService;
|
|
import org.jeecg.modules.ProdPlan.util.EmailUtil;
|
|
import org.jeecg.modules.ProdPlan.util.EmailUtil;
|
|
import org.jeecg.modules.ProdPlan.vo.ReportDetailVo;
|
|
import org.jeecg.modules.ProdPlan.vo.ReportDetailVo;
|
|
import org.jeecg.modules.ReasonRule.entity.ReasonRule;
|
|
import org.jeecg.modules.ReasonRule.entity.ReasonRule;
|
|
@@ -73,6 +75,9 @@ public class ProdPlanServiceImpl extends ServiceImpl<ProdPlanMapper, ProdPlan> i
|
|
@Autowired
|
|
@Autowired
|
|
private IContactService contactService;
|
|
private IContactService contactService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IToolRuleService toolRuleService;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public List<DelayProduct> parseExcel(String filePath) {
|
|
public List<DelayProduct> parseExcel(String filePath) {
|
|
List<DelayProduct> delayProducts = new ArrayList<>();
|
|
List<DelayProduct> delayProducts = new ArrayList<>();
|
|
@@ -115,6 +120,8 @@ public class ProdPlanServiceImpl extends ServiceImpl<ProdPlanMapper, ProdPlan> i
|
|
Map<String, String> destRules = destRuleList.stream().collect(Collectors.toMap(DestRule::getDestination, DestRule::getSchedule));
|
|
Map<String, String> destRules = destRuleList.stream().collect(Collectors.toMap(DestRule::getDestination, DestRule::getSchedule));
|
|
List<ReasonRule> reasonRuleList = reasonRuleService.list();
|
|
List<ReasonRule> reasonRuleList = reasonRuleService.list();
|
|
Map<String, ReasonRule> reasonRules = reasonRuleList.stream().collect(Collectors.toMap(i-> i.getDept()+" "+i.getReason(), i->i));
|
|
Map<String, ReasonRule> reasonRules = reasonRuleList.stream().collect(Collectors.toMap(i-> i.getDept()+" "+i.getReason(), i->i));
|
|
|
|
+ List<ToolRule> toolRuleList = toolRuleService.list();
|
|
|
|
+ Map<String, String> toolRules = toolRuleList.stream().collect(Collectors.toMap(ToolRule::getOriginaltool, ToolRule::getReversedtool));
|
|
|
|
|
|
// 清洗数据,按规则匹配规定交付时间,计算超出时间,并转换延期原因
|
|
// 清洗数据,按规则匹配规定交付时间,计算超出时间,并转换延期原因
|
|
for (int i = 0; i < delayProducts.size(); i++) {
|
|
for (int i = 0; i < delayProducts.size(); i++) {
|
|
@@ -163,6 +170,10 @@ public class ProdPlanServiceImpl extends ServiceImpl<ProdPlanMapper, ProdPlan> i
|
|
delayProduct.setRemark("OTHER");
|
|
delayProduct.setRemark("OTHER");
|
|
delayProduct.setDept("OTHER");
|
|
delayProduct.setDept("OTHER");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if(toolRules.get(delayProduct.getTool())!=null){
|
|
|
|
+ delayProduct.setTool(toolRules.get(delayProduct.getTool()));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
} catch (FileNotFoundException e) {
|
|
} catch (FileNotFoundException e) {
|
|
throw new RuntimeException(e);
|
|
throw new RuntimeException(e);
|
|
@@ -424,7 +435,7 @@ public class ProdPlanServiceImpl extends ServiceImpl<ProdPlanMapper, ProdPlan> i
|
|
sheet.setPrintGridlines(false);
|
|
sheet.setPrintGridlines(false);
|
|
sheet.setDefaultRowHeightInPoints(20f);
|
|
sheet.setDefaultRowHeightInPoints(20f);
|
|
try {
|
|
try {
|
|
- insertImageToSheetAtPosition(workbook,sheet,pie,"pie",0,0,6,17);
|
|
|
|
|
|
+ insertImageToSheetAtPosition(workbook,sheet,pie,"pie",0,0,7,17);
|
|
insertImageToSheetAtPosition(workbook,sheet,barLine,"barLine",0,7,10,18);
|
|
insertImageToSheetAtPosition(workbook,sheet,barLine,"barLine",0,7,10,18);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
throw new RuntimeException(e);
|
|
throw new RuntimeException(e);
|
|
@@ -646,13 +657,37 @@ public class ProdPlanServiceImpl extends ServiceImpl<ProdPlanMapper, ProdPlan> i
|
|
|
|
|
|
@NotNull
|
|
@NotNull
|
|
private List<ReportDetailVo> getReportDetailVos(ProdPlan prodPlan, int currentWeek) {
|
|
private List<ReportDetailVo> getReportDetailVos(ProdPlan prodPlan, int currentWeek) {
|
|
|
|
+ // 查询前四后三周的延期生产
|
|
QueryWrapper<DelayProduct> delayProductQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<DelayProduct> delayProductQueryWrapper = new QueryWrapper<>();
|
|
delayProductQueryWrapper.between("pst", prodPlan.getPlanDate().minusWeeks(4), prodPlan.getPlanDate().plusWeeks(3));
|
|
delayProductQueryWrapper.between("pst", prodPlan.getPlanDate().minusWeeks(4), prodPlan.getPlanDate().plusWeeks(3));
|
|
List<DelayProduct> delayProductList = this.delayProductService.list(delayProductQueryWrapper);
|
|
List<DelayProduct> delayProductList = this.delayProductService.list(delayProductQueryWrapper);
|
|
|
|
+ Map<String, List<DelayProduct>> delayProductMap = delayProductList.stream().collect(Collectors.groupingBy(i->{
|
|
|
|
+ return String.join("|",
|
|
|
|
+ Objects.toString(i.getRegion(), ""),
|
|
|
|
+ Objects.toString(i.getModel(), ""),
|
|
|
|
+ Objects.toString(i.getWeek(), ""),
|
|
|
|
+ Objects.toString(i.getLine(), ""),
|
|
|
|
+ Objects.toString(i.getTool(), ""),
|
|
|
|
+ Objects.toString(i.getBucket(), ""),
|
|
|
|
+ Objects.toString(i.getPst(), ""),
|
|
|
|
+ Objects.toString(i.getDueDate(), ""),
|
|
|
|
+ Objects.toString(i.getDept(), ""),
|
|
|
|
+ Objects.toString(i.getRemark(), ""),
|
|
|
|
+ Objects.toString(i.getOverdueDays(), "")
|
|
|
|
+ );
|
|
|
|
+ }, Collectors.toList()));
|
|
|
|
+
|
|
List<ReportDetailVo> detailVoList = new ArrayList<>();
|
|
List<ReportDetailVo> detailVoList = new ArrayList<>();
|
|
- delayProductList.forEach(delayProduct -> {
|
|
|
|
|
|
+ delayProductMap.forEach((key,delayProducts)->{
|
|
|
|
+ DelayProduct delayProduct = delayProducts.get(0);
|
|
ReportDetailVo detailVo = new ReportDetailVo();
|
|
ReportDetailVo detailVo = new ReportDetailVo();
|
|
BeanUtils.copyProperties(delayProduct, detailVo);
|
|
BeanUtils.copyProperties(delayProduct, detailVo);
|
|
|
|
+
|
|
|
|
+ Integer totalPO = delayProducts.stream()
|
|
|
|
+ .mapToInt(i -> i.getPo() != null ? i.getPo() : 0)
|
|
|
|
+ .sum();
|
|
|
|
+ detailVo.setPo(totalPO);
|
|
|
|
+
|
|
detailVo.setPst(delayProduct.getPst().format(DateTimeFormatter.ofPattern("MM/dd")));
|
|
detailVo.setPst(delayProduct.getPst().format(DateTimeFormatter.ofPattern("MM/dd")));
|
|
detailVo.setDueDate(delayProduct.getDueDate().format(DateTimeFormatter.ofPattern("MM/dd")));
|
|
detailVo.setDueDate(delayProduct.getDueDate().format(DateTimeFormatter.ofPattern("MM/dd")));
|
|
LocalDate endDate = delayProduct.getPst();
|
|
LocalDate endDate = delayProduct.getPst();
|
|
@@ -677,6 +712,7 @@ public class ProdPlanServiceImpl extends ServiceImpl<ProdPlanMapper, ProdPlan> i
|
|
detailVoList.add(detailVo);
|
|
detailVoList.add(detailVo);
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ //不良品
|
|
QueryWrapper<DefectiveProduct> defectiveProductQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<DefectiveProduct> defectiveProductQueryWrapper = new QueryWrapper<>();
|
|
delayProductQueryWrapper.between("due_date", prodPlan.getPlanDate().minusWeeks(4), prodPlan.getPlanDate().plusWeeks(3));
|
|
delayProductQueryWrapper.between("due_date", prodPlan.getPlanDate().minusWeeks(4), prodPlan.getPlanDate().plusWeeks(3));
|
|
List<DefectiveProduct> defectiveProductList = this.defectiveProductService.list(defectiveProductQueryWrapper);
|
|
List<DefectiveProduct> defectiveProductList = this.defectiveProductService.list(defectiveProductQueryWrapper);
|