|
|
|
|
@ -476,5 +476,192 @@ public class QcInterfaceServiceImpl implements IQcInterfaceService {
|
|
|
|
|
return dtoMap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, String> getProduceStaticInfoPublic(QcInterface qcInterface) {
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_1000");
|
|
|
|
|
try {
|
|
|
|
|
String nowYMD = DateUtils.getDate();
|
|
|
|
|
qcInterface.setYmd(nowYMD);
|
|
|
|
|
|
|
|
|
|
Map<String, String> dtoMap = new HashMap<>();
|
|
|
|
|
qcInterface.setYmdType("dd");
|
|
|
|
|
QcInterface hz0 = qcInterfaceMapper.getProduceHz1(qcInterface);
|
|
|
|
|
if (hz0 != null) {
|
|
|
|
|
dtoMap.put("todayPro", hz0.getQuality().replaceAll("\\..*", ""));
|
|
|
|
|
}else{
|
|
|
|
|
dtoMap.put("todayPro", "0");
|
|
|
|
|
}
|
|
|
|
|
QcInterface hz1 = qcInterfaceMapper.getProduceHz(qcInterface);
|
|
|
|
|
if (hz1 != null) {
|
|
|
|
|
dtoMap.put("todaySample", hz1.getSampleQuality().replaceAll("\\..*", ""));
|
|
|
|
|
dtoMap.put("todayNoOk", hz1.getNoOkQuality().replaceAll("\\..*", ""));
|
|
|
|
|
if(!hz1.getSampleQuality().equals("0.00")){
|
|
|
|
|
BigDecimal tOkRate = (new BigDecimal(hz1.getSampleQuality())
|
|
|
|
|
.subtract(new BigDecimal(hz1.getNoOkQuality()))
|
|
|
|
|
)
|
|
|
|
|
.multiply(new BigDecimal(100))
|
|
|
|
|
.divide(new BigDecimal(hz1.getSampleQuality()), 2, RoundingMode.HALF_UP);
|
|
|
|
|
dtoMap.put("todayOkRate", tOkRate + "%");
|
|
|
|
|
}else{
|
|
|
|
|
dtoMap.put("todayOkRate", "0%");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qcInterface.setYmdType("mm");
|
|
|
|
|
QcInterface hz20 = qcInterfaceMapper.getProduceHz1(qcInterface);
|
|
|
|
|
if (hz20 != null) {
|
|
|
|
|
dtoMap.put("monthPro", hz20.getQuality().replaceAll("\\..*", ""));
|
|
|
|
|
}else{
|
|
|
|
|
dtoMap.put("monthPro", "0");
|
|
|
|
|
}
|
|
|
|
|
QcInterface hz2 = qcInterfaceMapper.getProduceHz(qcInterface);
|
|
|
|
|
if (hz2 != null) {
|
|
|
|
|
dtoMap.put("monthNoOk", hz2.getNoOkQuality().replaceAll("\\..*", ""));
|
|
|
|
|
if(!hz2.getSampleQuality().equals("0.00")){
|
|
|
|
|
BigDecimal tOkRate2 = (new BigDecimal(hz2.getSampleQuality())
|
|
|
|
|
.subtract(new BigDecimal(hz2.getNoOkQuality()))
|
|
|
|
|
)
|
|
|
|
|
.multiply(new BigDecimal(100))
|
|
|
|
|
.divide(new BigDecimal(hz2.getSampleQuality()), 2, RoundingMode.HALF_UP);
|
|
|
|
|
dtoMap.put("monthOkRate", tOkRate2 + "%");
|
|
|
|
|
}else{
|
|
|
|
|
dtoMap.put("monthOkRate", "0%");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return dtoMap;
|
|
|
|
|
}finally {
|
|
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<QcInterface> getProduceNoOkListPublic(QcInterface qcInterface) {
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_1000");
|
|
|
|
|
try {
|
|
|
|
|
List<QcInterface> dtos = qcInterfaceMapper.getProduceNoOkList1(qcInterface);
|
|
|
|
|
return dtos;
|
|
|
|
|
}finally {
|
|
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<QcInterface> getCheckProjectsPiePublic(QcInterface qcInterface) {
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_1000");
|
|
|
|
|
try {
|
|
|
|
|
String nowYMD = DateUtils.getDate();
|
|
|
|
|
qcInterface.setYmd(nowYMD);
|
|
|
|
|
List<QcInterface> dtos = qcInterfaceMapper.getCheckProjectsPie1(qcInterface);
|
|
|
|
|
return dtos;
|
|
|
|
|
}finally {
|
|
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public QcInterface getLineDayNoOkPublic(QcInterface qcInterface) {
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_1000");
|
|
|
|
|
try {
|
|
|
|
|
QcInterface dto = new QcInterface();
|
|
|
|
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
|
|
Date now = calendar.getTime();
|
|
|
|
|
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
|
|
Date firstDayOfMonth = calendar.getTime();
|
|
|
|
|
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
String startTime = dateFormat.format(firstDayOfMonth);
|
|
|
|
|
String endTime = dateFormat.format(now);
|
|
|
|
|
|
|
|
|
|
//日期名称数组
|
|
|
|
|
List<String> xAxisDatas = getDays(startTime, endTime);
|
|
|
|
|
dto.setDayStr(xAxisDatas);//
|
|
|
|
|
//通过报工获取到真实参与生产的线体
|
|
|
|
|
List<QcProCheck> lines = qcInterfaceMapper.getLineNames(startTime.substring(0,7));
|
|
|
|
|
if (CollectionUtils.isEmpty(lines)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
String nowYMD = DateUtils.getDate();
|
|
|
|
|
qcInterface.setYmd(nowYMD);
|
|
|
|
|
qcInterface.setYmdType("yyyy");
|
|
|
|
|
Map<String, QcInterface> noOkHzs = qcInterfaceMapper.getDayNoOkHz(qcInterface);
|
|
|
|
|
if (CollectionUtils.isEmpty(noOkHzs)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
List<QcInterface> series = new ArrayList<>();
|
|
|
|
|
QcInterface serie = null;
|
|
|
|
|
for (QcProCheck line : lines) {
|
|
|
|
|
serie = new QcInterface();
|
|
|
|
|
List<String> data = new ArrayList<>();
|
|
|
|
|
serie.setMachineName(line.getMachineName());
|
|
|
|
|
for (String dayStr : xAxisDatas) {
|
|
|
|
|
QcInterface dayInfo = noOkHzs.get(line.getMachineCode() + dayStr);
|
|
|
|
|
if (dayInfo != null) {
|
|
|
|
|
data.add(dayInfo.getNoOkQuality());
|
|
|
|
|
} else {
|
|
|
|
|
data.add("0");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
serie.setData(data);
|
|
|
|
|
series.add(serie);
|
|
|
|
|
}
|
|
|
|
|
dto.setSeries(series);//
|
|
|
|
|
return dto;
|
|
|
|
|
}finally {
|
|
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map getMonthOfYearContrastPublic(QcInterface qcInterface) {
|
|
|
|
|
Map map= new HashMap();
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_1000");
|
|
|
|
|
try {
|
|
|
|
|
int currentYear = Year.now().getValue();
|
|
|
|
|
int previousYear = currentYear - 1;
|
|
|
|
|
//今年数据
|
|
|
|
|
List<Map> mapListCurrentYear = qcInterfaceMapper.NoncompliantProduct(currentYear);
|
|
|
|
|
//去年数据
|
|
|
|
|
List<Map> mapListPreviousYear= qcInterfaceMapper.NoncompliantProduct(previousYear);
|
|
|
|
|
map.put("mapListCurrentYear",mapListCurrentYear);
|
|
|
|
|
map.put("mapListPreviousYear",mapListPreviousYear);
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}finally {
|
|
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
|
|
}
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, List<String>> getBpMonthNoOkPublic(String queryDate) {
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_1000");
|
|
|
|
|
try {
|
|
|
|
|
Map<String, List<String>> dtoMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
String nowYMD = DateUtils.getDate();
|
|
|
|
|
String[] nowYMDs = nowYMD.split("-");
|
|
|
|
|
int nowMonth = Integer.parseInt(nowYMDs[1]);
|
|
|
|
|
List<String> monthNames = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
Map<String, QcInterface> noOkHzs = qcInterfaceMapper.getBpMonthNoOk(queryDate);
|
|
|
|
|
List<String> monthData = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
for (int mh = 1; mh <= nowMonth; mh++) {
|
|
|
|
|
String yyyymm = nowYMDs[0] + "-" + String.format("%02d", mh);
|
|
|
|
|
monthNames.add(yyyymm);
|
|
|
|
|
if (!CollectionUtils.isEmpty(noOkHzs)&&noOkHzs.get(yyyymm)!=null) {
|
|
|
|
|
monthData.add(noOkHzs.get(yyyymm).getNoOkQuality());
|
|
|
|
|
} else {
|
|
|
|
|
monthData.add("0");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dtoMap.put("month", monthNames);
|
|
|
|
|
dtoMap.put("monthData", monthData);
|
|
|
|
|
return dtoMap;
|
|
|
|
|
}finally {
|
|
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|