update 发泡详情、返修率、焊漏率

master
zhouhy 6 months ago
parent e97bc774e1
commit cb8b30ba75

@ -155,6 +155,18 @@ public class ProductionReportController extends BaseController {
return getDataTable(list); return getDataTable(list);
} }
/**
*
* @param hashMap
* @return
*/
@GetMapping("/boxTraceabilityDetailReportUpdate")
public TableDataInfo boxTraceabilityDetailReportUpdate(@RequestParam(required = false) Map hashMap) {
startPage();
List<BoxTraceabilityDetailReport> list = productionReportService.boxTraceabilityDetailReport(hashMap);
return getDataTable(list);
}
/** /**
* *
* @param hashMap * @param hashMap

@ -4,7 +4,10 @@ import com.aucma.common.annotation.Excel;
import com.aucma.common.core.domain.BaseEntity; import com.aucma.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Map;
/** /**
* *
@ -106,7 +109,318 @@ public class BoxTraceabilityDetailReport extends BaseEntity {
private String productLineCode; private String productLineCode;
//扫描时间
private Date SCAN_TIME;
//执行顺序
private String EXECUTION_SORT;
//产线编号
private String PRODUCT_LINE_CODE;
private String CODE1000;
private String CODE1001;
private String CODE1002;
private String CODE1004;
private String CODE1005;
private String CODE1006;
private String CODE1007;
private String CODE1008;
private String CODE1009;
private String CODE1010;
private String CODE1011;
private String CODE1012;
private String CODE1020;
private String CODE1105;
private String CODE1109;
private String CODE2001;
private String CODE2002;
private String CODE2003;
private String CODE2005;
private String CODE2006;
private String CODE2007;
private String CODE2008;
private String CODE2009;
private String CODE2010;
private String CODE2011;
private String CODE2012;
private String CODE2013;
private String CODE2014;
private String CODE2015;
private String CODE2016;
private String CODE2020;
public String getEXECUTION_SORT() {
return EXECUTION_SORT;
}
public void setEXECUTION_SORT(String EXECUTION_SORT) {
this.EXECUTION_SORT = EXECUTION_SORT;
}
public String getPRODUCT_LINE_CODE() {
return PRODUCT_LINE_CODE;
}
public void setPRODUCT_LINE_CODE(String PRODUCT_LINE_CODE) {
this.PRODUCT_LINE_CODE = PRODUCT_LINE_CODE;
}
public String getCODE1000() {
return CODE1000;
}
public void setCODE1000(String CODE1000) {
this.CODE1000 = CODE1000;
}
public String getCODE1001() {
return CODE1001;
}
public void setCODE1001(String CODE1001) {
this.CODE1001 = CODE1001;
}
public String getCODE1002() {
return CODE1002;
}
public void setCODE1002(String CODE1002) {
this.CODE1002 = CODE1002;
}
public String getCODE1004() {
return CODE1004;
}
public void setCODE1004(String CODE1004) {
this.CODE1004 = CODE1004;
}
public String getCODE1005() {
return CODE1005;
}
public void setCODE1005(String CODE1005) {
this.CODE1005 = CODE1005;
}
public String getCODE1006() {
return CODE1006;
}
public void setCODE1006(String CODE1006) {
this.CODE1006 = CODE1006;
}
public String getCODE1007() {
return CODE1007;
}
public void setCODE1007(String CODE1007) {
this.CODE1007 = CODE1007;
}
public String getCODE1008() {
return CODE1008;
}
public void setCODE1008(String CODE1008) {
this.CODE1008 = CODE1008;
}
public String getCODE1009() {
return CODE1009;
}
public void setCODE1009(String CODE1009) {
this.CODE1009 = CODE1009;
}
public String getCODE1010() {
return CODE1010;
}
public void setCODE1010(String CODE1010) {
this.CODE1010 = CODE1010;
}
public String getCODE1011() {
return CODE1011;
}
public void setCODE1011(String CODE1011) {
this.CODE1011 = CODE1011;
}
public String getCODE1012() {
return CODE1012;
}
public void setCODE1012(String CODE1012) {
this.CODE1012 = CODE1012;
}
public String getCODE1020() {
return CODE1020;
}
public void setCODE1020(String CODE1020) {
this.CODE1020 = CODE1020;
}
public String getCODE1105() {
return CODE1105;
}
public void setCODE1105(String CODE1105) {
this.CODE1105 = CODE1105;
}
public String getCODE1109() {
return CODE1109;
}
public void setCODE1109(String CODE1109) {
this.CODE1109 = CODE1109;
}
public String getCODE2001() {
return CODE2001;
}
public void setCODE2001(String CODE2001) {
this.CODE2001 = CODE2001;
}
public String getCODE2002() {
return CODE2002;
}
public void setCODE2002(String CODE2002) {
this.CODE2002 = CODE2002;
}
public String getCODE2003() {
return CODE2003;
}
public void setCODE2003(String CODE2003) {
this.CODE2003 = CODE2003;
}
public String getCODE2005() {
return CODE2005;
}
public void setCODE2005(String CODE2005) {
this.CODE2005 = CODE2005;
}
public String getCODE2006() {
return CODE2006;
}
public void setCODE2006(String CODE2006) {
this.CODE2006 = CODE2006;
}
public String getCODE2007() {
return CODE2007;
}
public void setCODE2007(String CODE2007) {
this.CODE2007 = CODE2007;
}
public String getCODE2008() {
return CODE2008;
}
public void setCODE2008(String CODE2008) {
this.CODE2008 = CODE2008;
}
public String getCODE2009() {
return CODE2009;
}
public void setCODE2009(String CODE2009) {
this.CODE2009 = CODE2009;
}
public String getCODE2010() {
return CODE2010;
}
public void setCODE2010(String CODE2010) {
this.CODE2010 = CODE2010;
}
public String getCODE2011() {
return CODE2011;
}
public void setCODE2011(String CODE2011) {
this.CODE2011 = CODE2011;
}
public String getCODE2012() {
return CODE2012;
}
public void setCODE2012(String CODE2012) {
this.CODE2012 = CODE2012;
}
public String getCODE2013() {
return CODE2013;
}
public void setCODE2013(String CODE2013) {
this.CODE2013 = CODE2013;
}
public String getCODE2014() {
return CODE2014;
}
public void setCODE2014(String CODE2014) {
this.CODE2014 = CODE2014;
}
public String getCODE2015() {
return CODE2015;
}
public void setCODE2015(String CODE2015) {
this.CODE2015 = CODE2015;
}
public String getCODE2016() {
return CODE2016;
}
public void setCODE2016(String CODE2016) {
this.CODE2016 = CODE2016;
}
public String getCODE2020() {
return CODE2020;
}
public void setCODE2020(String CODE2020) {
this.CODE2020 = CODE2020;
}
public Date getSCAN_TIME() {
return SCAN_TIME;
}
public void setSCAN_TIME(Date SCAN_TIME) {
this.SCAN_TIME = SCAN_TIME;
}
public String getORDER_CODE() { public String getORDER_CODE() {
return ORDER_CODE; return ORDER_CODE;

@ -47,6 +47,25 @@ public class RepairRateReport extends BaseEntity {
// @Excel(name = "目标返修率") // @Excel(name = "目标返修率")
@JsonProperty("TARGET") @JsonProperty("TARGET")
private String TARGET; private String TARGET;
//周数
private String WEEKNUMS;
public String getWEEKNUMS() {
return WEEKNUMS;
}
public String COLUMN_A;
public String getCOLUMN_A() {
return COLUMN_A;
}
public void setCOLUMN_A(String COLUMN_A) {
this.COLUMN_A = COLUMN_A;
}
public void setWEEKNUMS(String WEEKNUMS) {
this.WEEKNUMS = WEEKNUMS;
}
public String getINSPECTOR_TIME() { public String getINSPECTOR_TIME() {
return INSPECTOR_TIME; return INSPECTOR_TIME;

@ -1,6 +1,7 @@
package com.aucma.report.mapper; package com.aucma.report.mapper;
import com.aucma.report.domain.*; import com.aucma.report.domain.*;
import org.apache.ibatis.annotations.Param;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -116,12 +117,16 @@ public interface GeneralReportMapper {
*/ */
List<BoxTraceabilityDetailReport> boxTraceabilityDetailReport(Map hashMap); List<BoxTraceabilityDetailReport> boxTraceabilityDetailReport(Map hashMap);
List<BoxTraceabilityDetailReport> boxTraceabilityDetailReportUpdate(Map hashMap);
/** /**
* *
* @param hashMap * @param hashMap
* @return * @return
*/ */
List<RepairRateReport> repairRateReportList(Map hashMap); List<RepairRateReport> repairRateReportList(Map hashMap);
List<RepairRateReport> repairRateReportListWeek(Map hashMap);
List<RepairRateReport> repairRateReportListMONTH(Map hashMap);
/** /**
* *
@ -170,5 +175,8 @@ public interface GeneralReportMapper {
* @param hashMap * @param hashMap
* @return * @return
*/ */
//周
List<WeldLeakRateReport> weldLeakRateList(Map hashMap); List<WeldLeakRateReport> weldLeakRateList(Map hashMap);
//月
List<WeldLeakRateReport> weldLeakRateListMonth(Map hashMap);
} }

@ -8,7 +8,7 @@ import java.util.Map;
/** /**
* PDAService * PDAService
* *
* @author Yinq * @author Yinq
* @date 2023-11-21 * @date 2023-11-21
*/ */

@ -1,14 +1,17 @@
package com.aucma.report.service.impl; package com.aucma.report.service.impl;
import com.aucma.common.utils.DateUtils;
import com.aucma.report.domain.*; import com.aucma.report.domain.*;
import com.aucma.report.mapper.GeneralReportMapper; import com.aucma.report.mapper.GeneralReportMapper;
import com.aucma.report.service.IProductionReportService; import com.aucma.report.service.IProductionReportService;
import com.fasterxml.jackson.databind.ext.SqlBlobSerializer;
import org.apache.ibatis.jdbc.SQL;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap; import java.text.SimpleDateFormat;
import java.util.List; import java.util.*;
import java.util.Map; import java.util.stream.Collectors;
/** /**
* PDAService * PDAService
@ -76,7 +79,9 @@ public class ProductionReportServiceImpl implements IProductionReportService {
*/ */
@Override @Override
public List<BoxTraceabilityDetailReport> boxTraceabilityDetailReport(Map hashMap) { public List<BoxTraceabilityDetailReport> boxTraceabilityDetailReport(Map hashMap) {
return reportMapper.boxTraceabilityDetailReport(hashMap); // List<BoxTraceabilityDetailReport> boxTraceabilityDetailReports = reportMapper.boxTraceabilityDetailReport(hashMap);
List<BoxTraceabilityDetailReport> boxTraceabilityDetailReports = reportMapper.boxTraceabilityDetailReportUpdate(hashMap);
return boxTraceabilityDetailReports;
} }
/** /**

@ -1,15 +1,21 @@
package com.aucma.report.service.impl; package com.aucma.report.service.impl;
import cn.hutool.core.collection.ArrayIter;
import com.aucma.common.core.domain.R;
import com.aucma.common.utils.DateUtils;
import com.aucma.report.domain.*; import com.aucma.report.domain.*;
import com.aucma.report.mapper.GeneralReportMapper; import com.aucma.report.mapper.GeneralReportMapper;
import com.aucma.report.service.IQualityReportService; import com.aucma.report.service.IQualityReportService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.io.Serializable;
import java.util.HashMap; import java.math.BigDecimal;
import java.util.List; import java.math.RoundingMode;
import java.util.Map; import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/** /**
* PDAService * PDAService
@ -24,19 +30,21 @@ public class QualityReportServiceImpl implements IQualityReportService {
/** /**
* *
*
* @param hashMap * @param hashMap
* @return * @return
*/ */
@Override @Override
public List<QualityDefectsStatisticalAnalysis> qualityDefectsStatisticalAnalysisList(Map hashMap) { public List<QualityDefectsStatisticalAnalysis> qualityDefectsStatisticalAnalysisList(Map hashMap) {
if (hashMap.containsKey("stationCodeList")){ if (hashMap.containsKey("stationCodeList")) {
hashMap.put("stationCodeList",String.valueOf(hashMap.get("stationCodeList")).split(",")); hashMap.put("stationCodeList", String.valueOf(hashMap.get("stationCodeList")).split(","));
} }
return reportMapper.qualityDefectsStatisticalAnalysisList(hashMap); return reportMapper.qualityDefectsStatisticalAnalysisList(hashMap);
} }
/** /**
* *
*
* @param hashMap * @param hashMap
* @return * @return
*/ */
@ -47,6 +55,7 @@ public class QualityReportServiceImpl implements IQualityReportService {
/** /**
* 80 * 80
*
* @param hashMap * @param hashMap
* @return * @return
*/ */
@ -58,6 +67,7 @@ public class QualityReportServiceImpl implements IQualityReportService {
/** /**
* *
*
* @param hashMap * @param hashMap
* @return * @return
*/ */
@ -68,6 +78,7 @@ public class QualityReportServiceImpl implements IQualityReportService {
/** /**
* *
*
* @param hashMap * @param hashMap
* @return * @return
*/ */
@ -78,6 +89,7 @@ public class QualityReportServiceImpl implements IQualityReportService {
/** /**
* *
*
* @param hashMap * @param hashMap
* @return * @return
*/ */
@ -88,6 +100,7 @@ public class QualityReportServiceImpl implements IQualityReportService {
/** /**
* *
*
* @param hashMap * @param hashMap
* @return * @return
*/ */
@ -98,6 +111,7 @@ public class QualityReportServiceImpl implements IQualityReportService {
/** /**
* *
*
* @param hashMap * @param hashMap
* @return * @return
*/ */
@ -108,6 +122,7 @@ public class QualityReportServiceImpl implements IQualityReportService {
/** /**
* *
*
* @param hashMap * @param hashMap
* @return * @return
*/ */
@ -116,7 +131,7 @@ public class QualityReportServiceImpl implements IQualityReportService {
ArrayList<QualityDefectsDetail> defectsDetailArrayList = new ArrayList<>(); ArrayList<QualityDefectsDetail> defectsDetailArrayList = new ArrayList<>();
List<QualityDefectsStatisticalAnalysis> analysisList = this.qualityDefectsStatisticalAnalysisList(hashMap); List<QualityDefectsStatisticalAnalysis> analysisList = this.qualityDefectsStatisticalAnalysisList(hashMap);
for (QualityDefectsStatisticalAnalysis item : analysisList) { for (QualityDefectsStatisticalAnalysis item : analysisList) {
hashMap.put("stationCode",item.getSTATION_CODE()); hashMap.put("stationCode", item.getSTATION_CODE());
List<HashMap<String, Object>> hashMaps = this.qualityDefectsDetailList(hashMap); List<HashMap<String, Object>> hashMaps = this.qualityDefectsDetailList(hashMap);
for (HashMap<String, Object> map : hashMaps) { for (HashMap<String, Object> map : hashMaps) {
QualityDefectsDetail defectsDetail = new QualityDefectsDetail(); QualityDefectsDetail defectsDetail = new QualityDefectsDetail();
@ -139,34 +154,167 @@ public class QualityReportServiceImpl implements IQualityReportService {
/** /**
* *
*
* @param hashMap * @param hashMap
* @return * @return
*/ */
@Override @Override
public List<RepairRateReport> repairRateReportList(Map hashMap) { public List<RepairRateReport> repairRateReportList(Map hashMap) {
if (hashMap.containsKey("stationCodeList")){ if (hashMap.containsKey("stationCodeList")) {
String[] stationCodeLists = String.valueOf(hashMap.get("stationCodeList")).split(","); String[] stationCodeLists = String.valueOf(hashMap.get("stationCodeList")).split(",");
hashMap.put("stationCodeList", stationCodeLists); hashMap.put("stationCodeList", stationCodeLists);
for (String station : stationCodeLists) { for (String station : stationCodeLists) {
if (station.equals("2001") || station.equals("2006")|| station.equals("2007")){ if (station.equals("2001") || station.equals("2006") || station.equals("2007")) {
hashMap.put("leakFlag", "1"); hashMap.put("leakFlag", "1");
} }
} }
}else { } else {
String[] stationCodeLists = {"null"}; String[] stationCodeLists = {"null"};
hashMap.put("stationCodeList", stationCodeLists); hashMap.put("stationCodeList", stationCodeLists);
} }
return reportMapper.repairRateReportList(hashMap);
//日
if (hashMap.get("month").equals("1")){
List<RepairRateReport> repairRateReports = reportMapper.repairRateReportList(hashMap);
return repairRateReports;
}
//周
else if (hashMap.get("month").equals("2")){
//将时间扩充到开始时间的周一和结束时间的周末
String beginTime = getFirstDayOfWeek(String.valueOf(hashMap.get("beginBeginTime")));
String endTime = getLastDayOfWeek(String.valueOf(hashMap.get("endBeginTime")));
hashMap.put("year",endTime.substring(0,4));
hashMap.put("beginBeginTime",beginTime);
hashMap.put("endBeginTime",endTime);
List<RepairRateReport> repairRateReports = reportMapper.repairRateReportListWeek(hashMap);
List<RepairRateReport> collect = repairRateReports.stream().collect(Collectors.collectingAndThen(
Collectors.toCollection(()->new TreeSet<>(Comparator.comparing(RepairRateReport::getCOLUMN_A))),ArrayList::new
));
List<RepairRateReport> repairRateReportsSumWeek = new ArrayList<>();
for (int i = 0; i < collect.size(); i++){
for (int j=0;j<repairRateReports.size();j++){
if (collect.get(i).getCOLUMN_A()==repairRateReports.get(i).getCOLUMN_A()&&
collect.get(i).getINSPECTOR_TIME() != repairRateReports.get(i).getINSPECTOR_TIME()
)
{
collect.get(i).setQUALITY_SUM(repairRateReports.get(i).getQUALITY_SUM()+ repairRateReports.get(i).getQUALITY_SUM());
collect.get(i).setOFF_LINE_NUM(repairRateReports.get(i).getOFF_LINE_NUM()+ repairRateReports.get(i).getOFF_LINE_NUM());
collect.get(i).setREPAIR_RATE(repairRateReports.get(i).getREPAIR_RATE()+ repairRateReports.get(i).getREPAIR_RATE());
}
}
}
return collect;
}
//月
//todo 逻辑 数据库会根据每天、不合格数量、所有数量、合格率分组 拿回来根据周/月进行循环累加,然后返回给前端
else if (hashMap.get("month").equals("3")){
List<RepairRateReport> repairRateReports = new ArrayList<>();
//将时间扩充到开始时间的月初和结束时间的月末
String beginTime = String.valueOf(hashMap.get("beginBeginTime")).substring(0, 7) + "01";
String endTime = String.valueOf(hashMap.get("endBeginTime")).substring(0, 7) + "31";
hashMap.put("beginBeginTime",beginTime);
hashMap.put("endBeginTime",endTime);
if (beginTime.substring(0,4).equals(endTime.substring(0,4))){
hashMap.put("year",endTime.substring(0,4));
repairRateReports = reportMapper.repairRateReportListMONTH(hashMap);
}
else {
hashMap.put("year",beginTime.substring(0,4));
List<RepairRateReport> repairRateReports1 = reportMapper.repairRateReportListMONTH(hashMap);
hashMap.put("year",endTime.substring(0,4));
List<RepairRateReport> repairRateReports2 = reportMapper.repairRateReportListMONTH(hashMap);
repairRateReports.addAll(repairRateReports1);
repairRateReports.addAll(repairRateReports2);
}
List<RepairRateReport> collect = repairRateReports.stream().collect(Collectors.collectingAndThen(
Collectors.toCollection(()->new TreeSet<>(Comparator.comparing(RepairRateReport::getCOLUMN_A))),ArrayList::new
));
List<RepairRateReport> repairRateReportsSumWeek = new ArrayList<>();
for (int i = 0; i < collect.size(); i++){
for (int j=0;j<repairRateReports.size();j++){
if (collect.get(i).getCOLUMN_A()==repairRateReports.get(i).getCOLUMN_A()&&
collect.get(i).getINSPECTOR_TIME() != repairRateReports.get(i).getINSPECTOR_TIME()
)
{
collect.get(i).setQUALITY_SUM(repairRateReports.get(i).getQUALITY_SUM()+ repairRateReports.get(i).getQUALITY_SUM());
collect.get(i).setOFF_LINE_NUM(repairRateReports.get(i).getOFF_LINE_NUM()+ repairRateReports.get(i).getOFF_LINE_NUM());
collect.get(i).setREPAIR_RATE(repairRateReports.get(i).getREPAIR_RATE()+ repairRateReports.get(i).getREPAIR_RATE());
}
}
}
return collect;
}
else{
return reportMapper.repairRateReportList(hashMap);
}
}
/**
*
*
* @param date
*/
public String getFirstDayOfWeek(String date) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date parse = null;
try {
parse = sdf.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
Calendar c = Calendar.getInstance();
c.setTime(parse);
if (c.get(Calendar.DAY_OF_WEEK) == 1) {
c.add(Calendar.DAY_OF_MONTH, -1);
}
c.add(Calendar.DATE, c.getFirstDayOfWeek() - c.get(Calendar.DAY_OF_WEEK) + 1);
String format = sdf.format(c.getTime());
return format;
}
/**
*
* */
public String getLastDayOfWeek(String date){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date parse = null;
try {
parse = sdf.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
Calendar c = Calendar.getInstance();
c.setTime(parse);
// 如果是周日直接返回
if (c.get(Calendar.DAY_OF_WEEK) == 1) {
return sdf.format(parse);
}
//System.out.println(c.get(Calendar.DAY_OF_WEEK));
c.add(Calendar.DATE, 7 - c.get(Calendar.DAY_OF_WEEK) + 1);
String format = sdf.format(c.getTime());
return format;
} }
/** /**
* *
*
* @param hashMap * @param hashMap
* @return * @return
*/ */
@Override @Override
public List<DowngradeProportionReport> downgradeProportionReportList(Map hashMap) { public List<DowngradeProportionReport> downgradeProportionReportList(Map hashMap) {
if (!hashMap.containsKey("dateType")){ if (!hashMap.containsKey("dateType")) {
return null; return null;
} }
hashMap.put("timeSub", Integer.parseInt(String.valueOf(hashMap.get("dateType")))); hashMap.put("timeSub", Integer.parseInt(String.valueOf(hashMap.get("dateType"))));
@ -175,12 +323,13 @@ public class QualityReportServiceImpl implements IQualityReportService {
/** /**
* *
*
* @param hashMap * @param hashMap
* @return * @return
*/ */
@Override @Override
public List<AdverseRecordYearOnYearReport> adverseRecordYearOnYearList(Map hashMap) { public List<AdverseRecordYearOnYearReport> adverseRecordYearOnYearList(Map hashMap) {
if (!hashMap.containsKey("year")){ if (!hashMap.containsKey("year")) {
return null; return null;
} }
return reportMapper.adverseRecordYearOnYearList(hashMap); return reportMapper.adverseRecordYearOnYearList(hashMap);
@ -188,6 +337,7 @@ public class QualityReportServiceImpl implements IQualityReportService {
/** /**
* TOP20 * TOP20
*
* @param hashMap * @param hashMap
* @return * @return
*/ */
@ -198,12 +348,57 @@ public class QualityReportServiceImpl implements IQualityReportService {
/** /**
* *
*
* @param hashMap * @param hashMap
* @return * @return
*/ */
@Override @Override
public List<WeldLeakRateReport> weldLeakRateList(Map hashMap) { public List<WeldLeakRateReport> weldLeakRateList(Map hashMap) {
if (hashMap.get("month").toString().equals("0")) {
return reportMapper.weldLeakRateList(hashMap);
}else if (hashMap.get("month").toString().equals("1")) {
List<WeldLeakRateReport> weldLeakRateReports = reportMapper.weldLeakRateListMonth(hashMap);
return weldLeakRateReports;
}
String month = hashMap.get("month").toString();
return reportMapper.weldLeakRateList(hashMap); return reportMapper.weldLeakRateList(hashMap);
} }
//根据年份获取月份日期
public String[] getMonthBeginTime(String year) {
String[] array = new String[12];
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, Integer.parseInt(year));
cal.set(Calendar.MONTH,0);
cal.set(Calendar.DATE,1);
cal.set(Calendar.HOUR,0);
cal.set(Calendar.MINUTE,0);
cal.set(Calendar.SECOND,0);
for (int i = 0; i < 12; i++) {
array[i] = sdf.format(cal.getTime());
cal.add(Calendar.MONTH, 1);
}
return array;
}
//根据年份获取月份日期
public String[] getMonthEndTime(String year) {
String[] array = new String[12];
array[0] = year+"-"+"01-31 23:59:59";
array[1] = year+"-"+"02-29 23:59:59";
array[2] = year+"-"+"03-31 23:59:59";
array[3] = year+"-"+"04-31 23:59:59";
array[4] = year+"-"+"05-31 23:59:59";
array[5] = year+"-"+"06-31 23:59:59";
array[6] = year+"-"+"07-31 23:59:59";
array[7] = year+"-"+"08-31 23:59:59";
array[8] = year+"-"+"09-31 23:59:59";
array[9] = year+"-"+"10-31 23:59:59";
array[10] = year+"-"+"11-31 23:59:59";
array[11] = year+"-"+"12-31 23:59:59";
return array;
}
} }

@ -826,4 +826,208 @@
ORDER BY WEEK_NUMBER ORDER BY WEEK_NUMBER
</select> </select>
<select id="weldLeakRateListMonth" resultType="com.aucma.report.domain.WeldLeakRateReport" parameterType="java.util.HashMap">
SELECT WEEK_NUMBER,
WEEK_START,
WEEK_END,
NVL(COUNT(*), 0) Q_SUM,
NVL(SUM(LEAK_SUM), 0) LEAK_SUM,
TO_CHAR(ROUND(SUM(LEAK_SUM) / COUNT(*) * 100, 2), 'FM99990.00') REPAIR_RATE,
'二线' PRODUCT_LINE_NAME
FROM (
SELECT TO_NUMBER(COLUMN_A) WEEK_NUMBER,
COLUMN_B WEEK_START,
COLUMN_C WEEK_END,
BAR_CODE,
MAX(CASE WHEN QUALITY_DEFECT_NAME LIKE '%漏%' THEN 1 ELSE 0 END) LEAK_SUM
FROM (SELECT COLUMN_A, COLUMN_B, COLUMN_C
FROM TABLE (GET_YEAR_MONTH_TIME(${year}))) WEE
LEFT JOIN REPORT_QUALITY_INSPECTION RQI
ON RQI.BAR_CODE LIKE 'B%' AND
TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD HH24:MI:SS') > WEE.COLUMN_B AND
TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD HH24:MI:SS') &lt;= WEE.COLUMN_C
GROUP BY COLUMN_A, COLUMN_B, COLUMN_C, BAR_CODE
)
GROUP BY WEEK_NUMBER, WEEK_START, WEEK_END
ORDER BY WEEK_NUMBER
</select>
<select id="boxTraceabilityDetailReportUpdate" parameterType="java.util.HashMap"
resultType="com.aucma.report.domain.BoxTraceabilityDetailReport"
>
SELECT * FROM (
SELECT
DISTINCT TO_CHAR(COMPLETE_DATE, 'YYYY-MM-DD HH24:MI:SS') as SCAN_TIME,
PB.ORDER_CODE as ORDER_CODE,
BM.MATERIAL_CODE as MATERIAL_CODE,
BM.MATERIAL_NAME as MATERIAL_MODEL,
VMC.MATERIAL_BARCODE as BOX_CODE,
BE.EXECUTION_SORT AS EXECUTION_SORT,
BE.PRODUCT_LINE_NAME as SCAN_SPOT,
BE.PRODUCT_LINE_CODE as PRODUCT_LINE_CODE
FROM C##AUCMA_SCADA.MATERIAL_COMPLETION VMC
JOIN RECORD_INSTORE IE ON VMC.MATERIAL_BARCODE = IE.BARCODE_CODE
LEFT JOIN BASE_PRODUCTLINE BE ON BE.PRODUCT_LINE_CODE = VMC.STATION_NAME
LEFT JOIN C##AUCMA_SCADA.PRINT_BARCODE PB
ON PRINT_BARTYPE = 1 AND VMC.MATERIAL_BARCODE = PB.MATERIAL_BARCODE
LEFT JOIN BASE_MATERIALINFO BM ON BM.MATERIAL_CODE = PB.MATERIAL_CODE
LEFT JOIN C##AUCMA_SCADA.PRODUCT_OFFLINE PO ON PO.BOX_CODE = PB.MATERIAL_BARCODE
WHERE PB.MATERIAL_BARCODE IS NOT NULL
AND PO.BOX_CODE IS NULL
and PB.ORDER_CODE = #{orderCode}
and TO_CHAR(COMPLETE_DATE, 'YYYY-MM-DD HH24:MI:SS') BETWEEN #{beginBeginTime} AND #{endBeginTime}
order by VMC.MATERIAL_BARCODE)
PIVOT (MAX(SCAN_TIME) FOR PRODUCT_LINE_CODE IN (
'1000'as code1000,
'1001'as code1001,
'1002'as code1002,
'1004'as code1004,
'1005'as code1005,
'1006'as code1006,
'1007'as code1007,
'1008'as code1008,
'1009'as code1009,
'1010'as code1010,
'1011'as code1011,
'1012'as code1012,
'1020'as code1020,
'1105'as code1105,
'1109'as code1109,
'2001'as code2001,
'2002'as code2002,
'2003'as code2003,
'2005'as code2005,
'2006'as code2006,
'2007'as code2007,
'2008'as code2008,
'2009'as code2009,
'2010'as code2010,
'2011'as code2011,
'2012'as code2012,
'2013'as code2013,
'2014'as code2014,
'2015'as code2015,
'2016'as code2016,
'2020'as code2020
))
ORDER BY BOX_CODE
</select>
<select id="repairRateReportListWeek" resultType="com.aucma.report.domain.RepairRateReport"
parameterType="java.util.HashMap">
WITH temp_table AS (
SELECT RQI.INSPECTOR_TIME,
RQI.QUALITY_SUM,
VPO.OFF_LINE_NUM,
CASE
WHEN NVL(OFF_LINE_NUM, 0) = 0 THEN '0.00'
ELSE TO_CHAR(ROUND(QUALITY_SUM / NVL(OFF_LINE_NUM, 0) * 100, 2), 'FM99990.00') || '%' END REPAIR_RATE,
TARGET
FROM (
SELECT INSPECTOR_TIME, COUNT(*) QUALITY_SUM
FROM (
SELECT TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD') INSPECTOR_TIME, RQI.BAR_CODE
FROM REPORT_QUALITY_INSPECTION RQI
WHERE RQI.TREATMENT_MEASURE = '1'
<if test="stationCodeList != null and stationCodeList != ''">
AND RQI.STATION_CODE IN
<foreach collection="stationCodeList" item="stationCode" open="(" separator="," close=")">
#{stationCode}
</foreach>
</if>
<if test="leakFlag != null">
AND RQI.QUALITY_DEFECT_NAME LIKE '%漏%'
</if>
<if test="beginBeginTime != null and beginBeginTime != '' and endBeginTime != null and endBeginTime != ''">
AND TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD') BETWEEN #{beginBeginTime} AND #{endBeginTime}
</if>
GROUP BY TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD'), RQI.BAR_CODE
)
GROUP BY INSPECTOR_TIME
) RQI
LEFT JOIN (
SELECT PRODUCT_SCANTIME, COUNT(*) OFF_LINE_NUM
FROM (
SELECT TO_CHAR(VPO.PRODUCT_SCANTIME, 'YYYY-MM-DD') PRODUCT_SCANTIME,
VPO.BOX_CODE
FROM C##AUCMA_SCADA.PRODUCT_OFFLINE VPO
WHERE VPO.BOX_CODE IS NOT NULL
<if test="PRODUCT_LINE_CODE != null and PRODUCT_LINE_CODE != ''">
AND VPO.PRODUCT_LINE_CODE = #{PRODUCT_LINE_CODE}
</if>
GROUP BY TO_CHAR(VPO.PRODUCT_SCANTIME, 'YYYY-MM-DD'), VPO.BOX_CODE
)
GROUP BY PRODUCT_SCANTIME
) VPO
ON PRODUCT_SCANTIME = RQI.INSPECTOR_TIME
CROSS JOIN (SELECT TO_CHAR(CUSTOM_DATA) TARGET
FROM BASE_CUSTOM_DATA
WHERE CUSTOM_CODE = 'REPAIR_RATE_' || 'CX_02') TARGET
)
SELECT COLUMN_A ,INSPECTOR_TIME,QUALITY_SUM,OFF_LINE_NUM,REPAIR_RATE,TARGET
FROM TABLE (GET_YEAR_WEEK_TIME(${year})) WEE
LEFT JOIN temp_table A ON A.INSPECTOR_TIME BETWEEN WEE.COLUMN_B AND COLUMN_C
WHERE INSPECTOR_TIME IS NOT NULL
</select>
<select id="repairRateReportListMONTH" resultType="com.aucma.report.domain.RepairRateReport"
parameterType="java.util.HashMap">
WITH temp_table AS (
SELECT RQI.INSPECTOR_TIME,
RQI.QUALITY_SUM,
VPO.OFF_LINE_NUM,
CASE
WHEN NVL(OFF_LINE_NUM, 0) = 0 THEN '0.00'
ELSE TO_CHAR(ROUND(QUALITY_SUM / NVL(OFF_LINE_NUM, 0) * 100, 2), 'FM99990.00') || '%' END REPAIR_RATE,
TARGET
FROM (
SELECT INSPECTOR_TIME, COUNT(*) QUALITY_SUM
FROM (
SELECT TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD') INSPECTOR_TIME, RQI.BAR_CODE
FROM REPORT_QUALITY_INSPECTION RQI
WHERE RQI.TREATMENT_MEASURE = '1'
<if test="stationCodeList != null and stationCodeList != ''">
AND RQI.STATION_CODE IN
<foreach collection="stationCodeList" item="stationCode" open="(" separator="," close=")">
#{stationCode}
</foreach>
</if>
<if test="leakFlag != null">
AND RQI.QUALITY_DEFECT_NAME LIKE '%漏%'
</if>
<if test="beginBeginTime != null and beginBeginTime != '' and endBeginTime != null and endBeginTime != ''">
AND TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD') BETWEEN #{beginBeginTime} AND #{endBeginTime}
</if>
GROUP BY TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD'), RQI.BAR_CODE
)
GROUP BY INSPECTOR_TIME
) RQI
LEFT JOIN (
SELECT PRODUCT_SCANTIME, COUNT(*) OFF_LINE_NUM
FROM (
SELECT TO_CHAR(VPO.PRODUCT_SCANTIME, 'YYYY-MM-DD') PRODUCT_SCANTIME,
VPO.BOX_CODE
FROM C##AUCMA_SCADA.PRODUCT_OFFLINE VPO
WHERE VPO.BOX_CODE IS NOT NULL
<if test="PRODUCT_LINE_CODE != null and PRODUCT_LINE_CODE != ''">
AND VPO.PRODUCT_LINE_CODE = #{PRODUCT_LINE_CODE}
</if>
GROUP BY TO_CHAR(VPO.PRODUCT_SCANTIME, 'YYYY-MM-DD'), VPO.BOX_CODE
)
GROUP BY PRODUCT_SCANTIME
) VPO
ON PRODUCT_SCANTIME = RQI.INSPECTOR_TIME
CROSS JOIN (SELECT TO_CHAR(CUSTOM_DATA) TARGET
FROM BASE_CUSTOM_DATA
WHERE CUSTOM_CODE = 'REPAIR_RATE_' || 'CX_02') TARGET
)
SELECT COLUMN_A ,INSPECTOR_TIME,QUALITY_SUM,OFF_LINE_NUM,REPAIR_RATE,TARGET
FROM TABLE (GET_YEAR_MONTH_TIME(${year})) WEE
LEFT JOIN temp_table A ON A.INSPECTOR_TIME BETWEEN WEE.COLUMN_B AND COLUMN_C
WHERE INSPECTOR_TIME IS NOT NULL
</select>
</mapper> </mapper>

Loading…
Cancel
Save