白坯报表调整

master
FCD 7 days ago
parent 78923b5ee2
commit b631b84543

@ -155,4 +155,15 @@ public class QcInterfaceController {
return qcInterfaceService.getLineQcData(qcInterface);
}
/**
*
*
* @param queryDate
* @return
*/
@GetMapping("/getBpMonthNoOk")
public Map<String, List<String>> getBpMonthNoOk(String queryDate) {
return qcInterfaceService.getBpMonthNoOk(queryDate);
}
}

@ -968,16 +968,16 @@ public class QcStaticTableController extends BaseController {
@Log(title = "白坯缺陷排列报表导出", businessType = BusinessType.EXPORT)
@PostMapping("/getMonthOfDataDefectExport")
public void getMonthOfDataDefectExport(HttpServletResponse response, QcStaticTable qcStaticTable) {
List<Map<String,String>> list = qcStaticTableService.getMonthOfDataDefect(qcStaticTable);
List<Map<String,String>> list = qcStaticTableService.getMonthOfDataDefectV2(qcStaticTable);
//表格结构数据
List<String> titils = qcStaticTableService.getDaysOfMonth(qcStaticTable);
ArrayList<ExcelCol> excelCols = new ArrayList<>();
excelCols.add(new ExcelCol("不良项目", "dataType", 30));
excelCols.add(new ExcelCol("不良项目", "defect", 30));
for(int m=0;m<titils.size();m++){
excelCols.add(new ExcelCol(titils.get(m), "monthNum"+m, 30));
excelCols.add(new ExcelCol(titils.get(m), titils.get(m), 30));
}
excelCols.add(new ExcelCol("累计", "rowSum", 30));
excelCols.add(new ExcelCol("累计", "count", 30));
String sheetName = "白坯缺陷排列报表";
SXSSFWorkbook workbook = null;
@ -1017,7 +1017,7 @@ public class QcStaticTableController extends BaseController {
@Log(title = "白坯不良项目报表导出", businessType = BusinessType.EXPORT)
@PostMapping("/getDefectItemDataExport")
public void getDefectItemDataExport(HttpServletResponse response, QcStaticTable qcStaticTable) {
List<Map<String,String>> list = qcStaticTableService.getDefectItemData(qcStaticTable);
List<Map<String,String>> list = qcStaticTableService.getDefectItemDataV2(qcStaticTable);
//表格结构数据
List<String> titils = qcStaticTableService.getDefectItemTitle(qcStaticTable);
@ -1060,10 +1060,11 @@ public class QcStaticTableController extends BaseController {
@Log(title = "白坯性能报表导出", businessType = BusinessType.EXPORT)
@PostMapping("/getDefectItemDataPCExport")
public void getDefectItemDataPCExport(HttpServletResponse response, QcStaticTable qcStaticTable) {
List<Map<String,String>> list = qcStaticTableService.getDefectItemDataPC(qcStaticTable);
List<Map<String,String>> list = qcStaticTableService.getDefectItemDataPCV2(qcStaticTable);
//表格结构数据
List<String> titils = qcStaticTableService.getDefectItemTitle(qcStaticTable);
titils.add("其他");
ArrayList<ExcelCol> excelCols = new ArrayList<>();
excelCols.add(new ExcelCol("项目", "dataType", 30));
for(int m=0;m<titils.size();m++){

@ -57,4 +57,7 @@ public interface QcInterfaceMapper {
List<QcInterface> getProduceNoOkList1(QcInterface qcInterface);
List<QcInterface> getCheckProjectsPie1(QcInterface qcInterface);
@MapKey("ymd")
Map<String, QcInterface> getBpMonthNoOk(String queryDate);
}

@ -39,4 +39,6 @@ public interface IQcInterfaceService {
QcLineChartDto getLineQcData(QcInterface qcInterface);
List<QcInterface> getCheckProjectsPieLL(QcInterface qcInterface);
Map<String, List<String>> getBpMonthNoOk(String queryDate);
}

@ -495,4 +495,33 @@ public class QcInterfaceServiceImpl implements IQcInterfaceService {
}
@Override
@DS("#header.poolName")
public Map<String, List<String>> getBpMonthNoOk(String queryDate) {
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;
}
}

@ -1787,6 +1787,8 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
if (StringUtils.isNotBlank(data.getAttr2())){
count = count + Integer.parseInt(data.getAttr2());
}
}else {
map.put(data.getAttr1(), "0");
}
}
map.put("count", Integer.toString(count));
@ -1800,7 +1802,7 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
map2.put("defect","抽样数");
for (QcCheckTaskDefect data : list){
if ("合计".equals(data.getDefectSubclass())){
map1.put(data.getAttr1(),data.getAttr2());
map1.put(data.getAttr1(),StringUtils.isEmpty(data.getAttr2()) ? "0" : data.getAttr2());
map2.put(data.getAttr1(),data.getAttr3());
if (StringUtils.isNotBlank(data.getAttr2())){
count1 = count1 + Integer.parseInt(data.getAttr2());
@ -2081,6 +2083,7 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
List<Map<String, String>> dtos = new ArrayList<>();
//获取不良种类
List<String> bpDefects = qcStaticTableMapper.getBpDefects(qcStaticTable);
bpDefects.add("其他");
List<QcCheckTaskDefect> monthList = qcStaticTableMapper.getBPDefectMothPCMapV2(qcStaticTable);
qcStaticTable.setYearMonth(null);
List<QcCheckTaskDefect> totalList = qcStaticTableMapper.getBPDefectMothPCMapV2(qcStaticTable);
@ -2099,21 +2102,16 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
for (String defect : bpDefects) {
for (QcCheckTaskDefect item : list){
if (defect.equals(item.getDefectSubclass())){
if (StringUtils.isNotBlank(item.getAttr1())){
if ("rate".equals(type)){
result.put("item"+i, item.getAttr1());
}else {
if (StringUtils.isNotBlank(item.getAttr2())){
result.put("item"+i,new BigDecimal(item.getAttr1()).divide(new BigDecimal(item.getAttr2()),2,RoundingMode.HALF_UP).toString());
}else {
result.put("item"+i,"100");
}
}
if (StringUtils.isNotBlank(item.getAttr2()) && StringUtils.isNotBlank(item.getAttr3())){
BigDecimal itemNoOkRate = new BigDecimal(0);
itemNoOkRate = new BigDecimal(item.getAttr2()).divide(new BigDecimal(item.getAttr3()),4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
result.put("item"+i,itemNoOkRate.toString());
}else {
result.put("item"+i,"0");
}
break;
}else {
result.put("item"+i,"0");
}
}
i++;
@ -2197,6 +2195,7 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
//获取不良种类
List<String> bpDefects = qcStaticTableMapper.getBpDefects(qcStaticTable);
bpDefects.add("其他");
result.put("xData",bpDefects);
//当前查询月份的不良率
@ -2231,7 +2230,14 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
boolean flag = true;
for (QcCheckTaskDefect item : monthList){
if (defect.equals(item.getDefectSubclass())){
yDataLeft.add(item.getAttr1());
if (StringUtils.isNotBlank(item.getAttr2()) && StringUtils.isNotBlank(item.getAttr3())){
//不良率
BigDecimal itemNoOkRate = new BigDecimal(0);
itemNoOkRate = new BigDecimal(item.getAttr2()).divide(new BigDecimal(item.getAttr3()),4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
yDataLeft.add(itemNoOkRate.toString());
}else {
yDataLeft.add("0");
}
flag = false;
break;
}
@ -2251,7 +2257,14 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
boolean flag = true;
for (QcCheckTaskDefect item : totalList){
if (defect.equals(item.getDefectSubclass())){
yDataRight.add(item.getAttr1());
if (StringUtils.isNotBlank(item.getAttr2()) && StringUtils.isNotBlank(item.getAttr3())){
//不良率
BigDecimal itemNoOkRate = new BigDecimal(0);
itemNoOkRate = new BigDecimal(item.getAttr2()).divide(new BigDecimal(item.getAttr3()),4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
yDataRight.add(itemNoOkRate.toString());
}else {
yDataRight.add("0");
}
flag = false;
break;
}

@ -360,4 +360,20 @@
order by qctd.update_time desc
</select>
<select id="getBpMonthNoOk" parameterType="String" resultType="com.op.quality.domain.QcInterface" >
select
t.ymd,
sum(t.noOk_quality) noOkQuality
from(
select CONVERT(varchar(7),qct.income_time, 120) ymd,
qct.noOk_quality
from qc_check_task qct
where qct.order_type = 'bp'
and qct.del_flag='0'
and CONVERT(varchar(4),qct.income_time, 120) = CONVERT ( VARCHAR ( 4 ), GETDATE() , 120 )
) t
group by t.ymd
</select>
</mapper>

@ -1422,7 +1422,6 @@
LEFT JOIN qc_check_task_defect td ON qct.record_id = td.belong_to
LEFT JOIN qc_defect_type_class tc ON td.class_id = tc.id
WHERE qct.del_flag = '0'
AND tc.class_name IS NOT NULL
AND FORMAT ( qct.create_time, 'yyyy-MM' ) = #{yearMonth}
AND qct.order_type = 'bp'
GROUP BY tc.class_name, FORMAT ( qct.create_time, 'yyyy-MM-dd' )
@ -1436,7 +1435,6 @@
LEFT JOIN qc_check_task_defect td ON qct.record_id = td.belong_to
LEFT JOIN qc_defect_type_class tc ON td.class_id = tc.id
WHERE qct.del_flag = '0'
AND tc.class_name IS NOT NULL
AND FORMAT ( qct.create_time, 'yyyy-MM' ) = #{yearMonth}
AND qct.order_type = 'bp'
GROUP BY FORMAT ( qct.create_time, 'yyyy-MM-dd' )
@ -1452,7 +1450,6 @@
LEFT JOIN qc_check_task_defect td ON qct.record_id = td.belong_to
LEFT JOIN qc_defect_type_class tc ON td.class_id = tc.id
WHERE qct.del_flag = '0'
AND tc.class_name IS NOT NULL
AND qct.order_type = 'bp'
<if test="yearMonth !=null and yearMonth != ''">
AND FORMAT ( qct.create_time, 'yyyy-MM' ) = #{yearMonth}
@ -1468,15 +1465,14 @@
FROM
(
SELECT
tc.class_name defectSubclass,
SUM (CASE WHEN qct.check_status = 'N' THEN 1 ELSE 0 END) attr2,
ISNULL(tc.class_name,'其他') defectSubclass,
SUM (CASE WHEN qct.check_result = 'N' THEN 1 ELSE 0 END) attr2,
COUNT ( 0 ) attr3,
qct.income_batch_no
FROM qc_check_task qct
LEFT JOIN qc_check_task_defect td ON qct.record_id = td.belong_to
LEFT JOIN qc_defect_type_class tc ON td.class_id = tc.id
WHERE qct.del_flag = '0'
AND tc.class_name IS NOT NULL
AND qct.order_type = 'bp'
<if test="yearMonth !=null and yearMonth != ''">
AND FORMAT ( qct.create_time, 'yyyy-MM' ) = #{yearMonth}

Loading…
Cancel
Save