change - 发泡箱体追溯查询差异明细报表页面与导出

master
yinq 8 months ago
parent 3d69b39c7b
commit 2ddca06f57

@ -5,6 +5,7 @@ import com.aucma.common.core.domain.AjaxResult;
import com.aucma.common.core.page.TableDataInfo;
import com.aucma.common.utils.poi.ExcelUtil;
import com.aucma.report.domain.BoxTraceabilityDetailReport;
import com.aucma.report.domain.BoxTraceabilityReport;
import com.aucma.report.service.IProductionReportService;
import org.springframework.beans.factory.annotation.Autowired;
@ -76,6 +77,18 @@ public class ProductionReportController extends BaseController {
return getDataTable(list);
}
/**
*
* @param hashMap
* @return
*/
@GetMapping("/boxTraceabilityDetailReport")
public TableDataInfo boxTraceabilityDetailReport(@RequestParam(required = false) Map hashMap) {
startPage();
List<BoxTraceabilityDetailReport> list = productionReportService.boxTraceabilityDetailReport(hashMap);
return getDataTable(list);
}
/**
*
* @param hashMap
@ -83,9 +96,25 @@ public class ProductionReportController extends BaseController {
*/
@PostMapping("/boxTraceabilityReport/export")
public void boxTraceabilityReportExport(HttpServletResponse response, @RequestParam(required = false) Map hashMap) {
hashMap.put("pageNum",null);
hashMap.put("pageSize",null);
List<BoxTraceabilityReport> list = productionReportService.boxTraceabilityReport(hashMap);
ExcelUtil<BoxTraceabilityReport> util = new ExcelUtil<>(BoxTraceabilityReport. class);
util.exportExcel(response, list, "发泡箱体追溯报表" );
}
/**
*
* @param hashMap
* @return
*/
@PostMapping("/boxTraceabilityDetailReport/export")
public void boxTraceabilityDetailReport(HttpServletResponse response, @RequestParam(required = false) Map hashMap) {
hashMap.put("pageNum",null);
hashMap.put("pageSize",null);
List<BoxTraceabilityDetailReport> list = productionReportService.boxTraceabilityDetailReport(hashMap);
ExcelUtil<BoxTraceabilityDetailReport> util = new ExcelUtil<>(BoxTraceabilityDetailReport. class);
util.exportExcel(response, list, "发泡箱体追溯差异明细报表" );
}
}

@ -0,0 +1,230 @@
package com.aucma.report.domain;
import com.aucma.common.annotation.Excel;
import com.aucma.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Date;
/**
*
*
* @author Yinq
* @date 2024-03-15
*/
public class BoxTraceabilityDetailReport extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* SAP
*/
@Excel(name = "SAP订单编号")
@JsonProperty("ORDER_CODE")
private String ORDER_CODE;
/**
*
*/
@Excel(name = "销售订单编号")
@JsonProperty("SALEORDER_CODE")
private String SALEORDER_CODE;
/**
*
*/
@Excel(name = "销售订单行号")
@JsonProperty("SALEORDER_LINENUMBER")
private String SALEORDER_LINENUMBER;
/**
*
*/
@Excel(name = "物料编号")
@JsonProperty("MATERIAL_CODE")
private String MATERIAL_CODE;
/**
*
*/
@Excel(name = "产品型号")
@JsonProperty("MATERIAL_MODEL")
private String MATERIAL_MODEL;
/**
*
*/
@Excel(name = "订单数")
@JsonProperty("ORDER_AMOUNT")
private Long ORDER_AMOUNT;
/**
* MES
*/
@Excel(name = "MES箱体码")
@JsonProperty("BOX_CODE")
private String BOX_CODE;
/**
*
*/
private Long BEFORE_NUMBER;
/**
* 线
*/
private Long SCAN_NUMBER;
/**
*
*/
private Long DIFF_NUMBER;
/**
*
*/
@Excel(name = "最后扫描点")
@JsonProperty("SCAN_SPOT")
private String SCAN_SPOT;
/**
*
*/
private Date IN_STORE_TIME;
/**
* 线
*/
private Date COMPLETE_DATE;
/**
*
*/
@Excel(name = "是否报废")
@JsonProperty("SCRAP_FLAG")
private String SCRAP_FLAG;
private String productLineCode;
public String getORDER_CODE() {
return ORDER_CODE;
}
public void setORDER_CODE(String ORDER_CODE) {
this.ORDER_CODE = ORDER_CODE;
}
public String getSALEORDER_CODE() {
return SALEORDER_CODE;
}
public void setSALEORDER_CODE(String SALEORDER_CODE) {
this.SALEORDER_CODE = SALEORDER_CODE;
}
public String getSALEORDER_LINENUMBER() {
return SALEORDER_LINENUMBER;
}
public void setSALEORDER_LINENUMBER(String SALEORDER_LINENUMBER) {
this.SALEORDER_LINENUMBER = SALEORDER_LINENUMBER;
}
public String getMATERIAL_CODE() {
return MATERIAL_CODE;
}
public void setMATERIAL_CODE(String MATERIAL_CODE) {
this.MATERIAL_CODE = MATERIAL_CODE;
}
public String getMATERIAL_MODEL() {
return MATERIAL_MODEL;
}
public void setMATERIAL_MODEL(String MATERIAL_MODEL) {
this.MATERIAL_MODEL = MATERIAL_MODEL;
}
public Long getORDER_AMOUNT() {
return ORDER_AMOUNT;
}
public void setORDER_AMOUNT(Long ORDER_AMOUNT) {
this.ORDER_AMOUNT = ORDER_AMOUNT;
}
public String getBOX_CODE() {
return BOX_CODE;
}
public void setBOX_CODE(String BOX_CODE) {
this.BOX_CODE = BOX_CODE;
}
public Long getBEFORE_NUMBER() {
return BEFORE_NUMBER;
}
public void setBEFORE_NUMBER(Long BEFORE_NUMBER) {
this.BEFORE_NUMBER = BEFORE_NUMBER;
}
public Long getSCAN_NUMBER() {
return SCAN_NUMBER;
}
public void setSCAN_NUMBER(Long SCAN_NUMBER) {
this.SCAN_NUMBER = SCAN_NUMBER;
}
public Long getDIFF_NUMBER() {
return DIFF_NUMBER;
}
public void setDIFF_NUMBER(Long DIFF_NUMBER) {
this.DIFF_NUMBER = DIFF_NUMBER;
}
public String getSCAN_SPOT() {
return SCAN_SPOT;
}
public void setSCAN_SPOT(String SCAN_SPOT) {
this.SCAN_SPOT = SCAN_SPOT;
}
public Date getIN_STORE_TIME() {
return IN_STORE_TIME;
}
public void setIN_STORE_TIME(Date IN_STORE_TIME) {
this.IN_STORE_TIME = IN_STORE_TIME;
}
public Date getCOMPLETE_DATE() {
return COMPLETE_DATE;
}
public void setCOMPLETE_DATE(Date COMPLETE_DATE) {
this.COMPLETE_DATE = COMPLETE_DATE;
}
public String getSCRAP_FLAG() {
return SCRAP_FLAG;
}
public void setSCRAP_FLAG(String SCRAP_FLAG) {
this.SCRAP_FLAG = SCRAP_FLAG;
}
public String getProductLineCode() {
return productLineCode;
}
public void setProductLineCode(String productLineCode) {
this.productLineCode = productLineCode;
}
}

@ -108,4 +108,11 @@ public interface GeneralReportMapper {
* @return
*/
List<BoxTraceabilityReport> boxTraceabilityReport(Map hashMap);
/**
*
* @param hashMap
* @return
*/
List<BoxTraceabilityDetailReport> boxTraceabilityDetailReport(Map hashMap);
}

@ -1,5 +1,6 @@
package com.aucma.report.service;
import com.aucma.report.domain.BoxTraceabilityDetailReport;
import com.aucma.report.domain.BoxTraceabilityReport;
import java.util.HashMap;
@ -49,4 +50,11 @@ public interface IProductionReportService
* @return
*/
List<BoxTraceabilityReport> boxTraceabilityReport(Map hashMap);
/**
*
* @param hashMap
* @return
*/
List<BoxTraceabilityDetailReport> boxTraceabilityDetailReport(Map hashMap);
}

@ -93,7 +93,7 @@ public class MaterialCompletionServiceImpl implements IMaterialCompletionService
/**
* 线
*
* ->
* @param inspection
*/
@Override

@ -1,6 +1,6 @@
package com.aucma.report.service.impl;
import com.aucma.report.domain.BasePdaRecord;
import com.aucma.report.domain.BoxTraceabilityDetailReport;
import com.aucma.report.domain.BoxTraceabilityReport;
import com.aucma.report.mapper.GeneralReportMapper;
import com.aucma.report.service.IProductionReportService;
@ -70,5 +70,15 @@ public class ProductionReportServiceImpl implements IProductionReportService {
return reportMapper.boxTraceabilityReport(hashMap);
}
/**
*
* @param hashMap
* @return
*/
@Override
public List<BoxTraceabilityDetailReport> boxTraceabilityDetailReport(Map hashMap) {
return reportMapper.boxTraceabilityDetailReport(hashMap);
}
}

@ -117,19 +117,20 @@
ORDER BY B2.PRODUCT_LINE_CODE, VMC.ORDER_CODE
</select>
<select id="qualityDefectsStatisticalAnalysisList" resultType="com.aucma.report.domain.QualityDefectsStatisticalAnalysis" parameterType="java.util.HashMap">
<select id="qualityDefectsStatisticalAnalysisList"
resultType="com.aucma.report.domain.QualityDefectsStatisticalAnalysis" parameterType="java.util.HashMap">
SELECT FACTORY_NAME,
PRODUCT_LINE_NAME,
STATION_CODE,
STATION_NAME,
COUNT(*) INSPECTION_NUMBER,
SUM(REWORK_NUMBER) REWORK_NUMBER,
COUNT(*) INSPECTION_NUMBER,
SUM(REWORK_NUMBER) REWORK_NUMBER,
ROUND((1 - SUM(REWORK_NUMBER) / COUNT(*)) * 100, 2) || '%' RATE
FROM (
SELECT FY.FACTORY_NAME,
BPP.PRODUCT_LINE_NAME,
BP.PRODUCT_LINE_CODE STATION_CODE,
BP.PRODUCT_LINE_NAME STATION_NAME,
BP.PRODUCT_LINE_CODE STATION_CODE,
BP.PRODUCT_LINE_NAME STATION_NAME,
RQI.BAR_CODE,
MAX(CASE WHEN RQI.TREATMENT_MEASURE = '1' THEN 1 ELSE 0 END) REWORK_NUMBER
FROM REPORT_QUALITY_INSPECTION RQI
@ -157,7 +158,8 @@
GROUP BY FACTORY_NAME, PRODUCT_LINE_NAME, STATION_CODE, STATION_NAME
ORDER BY REWORK_NUMBER
</select>
<select id="fewerMistakesReportList" resultType="com.aucma.report.domain.FewerMistakesReport" parameterType="java.util.HashMap">
<select id="fewerMistakesReportList" resultType="com.aucma.report.domain.FewerMistakesReport"
parameterType="java.util.HashMap">
SELECT FY.FACTORY_NAME,
BPP.PRODUCT_LINE_NAME,
TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD') INSPECTOR_TIME,
@ -191,14 +193,15 @@
RQI.QUALITY_DEFECT_CODE, RQI.QUALITY_DEFECT_NAME
ORDER BY DEFECT_NUMBER DESC
</select>
<select id="qualityIssuesReportList" resultType="com.aucma.report.domain.QualityIssuesReport" parameterType="java.util.HashMap">
<select id="qualityIssuesReportList" resultType="com.aucma.report.domain.QualityIssuesReport"
parameterType="java.util.HashMap">
SELECT ZSD.FACTORY_NAME,
ZSD.PRODUCT_LINE_CODE,
ZSD.PRODUCT_LINE_NAME,
ZSD.MATERIAL_MODEL,
ZSD.QUALITY_DEFECT_CODE,
ZSD.QUALITY_DEFECT_NAME,
COUNT(*) Q_SUM,
COUNT(*) Q_SUM,
TO_CHAR(ROUND(COUNT(*) / OS.OFFLINE_NUM * 100, 2), 'FM99990.00') || '%' OFFLINE_NUM
FROM (
SELECT BF.FACTORY_NAME,
@ -300,7 +303,8 @@
ORDER BY RATE
</select>
<select id="productTraceabilityReportList" resultType="com.aucma.report.domain.ProductTraceabilityReport" parameterType="java.util.HashMap">
<select id="productTraceabilityReportList" resultType="com.aucma.report.domain.ProductTraceabilityReport"
parameterType="java.util.HashMap">
SELECT PL.PRODUCT_LINE_CODE,
PL.PRODUCT_LINE_NAME,
BO.ORDER_CODE,
@ -353,30 +357,32 @@
ORDER BY PL.EXECUTION_SORT, RQI.INSPECTOR_TIME
</select>
<select id="boxTraceabilityReport" resultType="com.aucma.report.domain.BoxTraceabilityReport" parameterType="java.util.HashMap">
<select id="boxTraceabilityReport" resultType="com.aucma.report.domain.BoxTraceabilityReport"
parameterType="java.util.HashMap">
SELECT ZSD.ORDER_CODE,
ZSD.SALEORDER_CODE,
ZSD.SALEORDER_LINENUMBER,
ZSD.MATERIAL_CODE,
ZSD.MATERIAL_MODEL,
ZSD.ORDER_AMOUNT,
SUM(ZSD.BEFORE_NUMBER) BEFORE_NUMBER,
SUM(ZSD.SCAN_NUMBER) SCAN_NUMBER,
SUM(ZSD.BEFORE_NUMBER) BEFORE_NUMBER,
SUM(ZSD.SCAN_NUMBER) SCAN_NUMBER,
SUM(ZSD.BEFORE_NUMBER) - SUM(ZSD.SCAN_NUMBER) DIFF_NUMBER,
SUM(ZSD.SCRAP_NUMBER) SCRAP_NUMBER
SUM(ZSD.SCRAP_NUMBER) SCRAP_NUMBER
FROM (SELECT BO.ORDER_CODE,
BO.SALEORDER_CODE,
BO.SALEORDER_LINENUMBER,
BO.MATERIAL_CODE,
BM.MATERIAL_SPECIFICATIONS MATERIAL_MODEL,
BM.MATERIAL_SPECIFICATIONS MATERIAL_MODEL,
OM.BARCODE_CODE,
BO.ORDER_AMOUNT,
COUNT(*) BEFORE_NUMBER,
COUNT(*) BEFORE_NUMBER,
MAX(CASE WHEN OL.BOX_CODE IS NULL THEN 0 ELSE 1 END) SCAN_NUMBER,
MAX(CASE WHEN BF.BAR_CODE IS NULL THEN 0 ELSE 1 END) SCRAP_NUMBER
FROM BASE_ORDERINFO BO
JOIN BASE_MATERIALINFO BM ON BM.MATERIAL_CODE = BO.MATERIAL_CODE AND bm.DISPO IN ('100')
JOIN (SELECT BC.ORDER_CODE, IE.BARCODE_CODE
JOIN (SELECT OI.ORDER_CODE, OI.WORK_CENTER_CODE, BC.MATERIAL_CODE, IE.BARCODE_CODE, MAX(IE.IN_STORE_TIME)
IN_STORE_TIME
FROM RECORD_INSTORE IE
JOIN C##AUCMA_SCADA.PRINT_BARCODE BC ON BC.MATERIAL_BARCODE = IE.BARCODE_CODE
JOIN BASE_ORDERINFO OI ON OI.ORDER_CODE = BC.ORDER_CODE
@ -387,7 +393,8 @@
AND TO_CHAR(IE.IN_STORE_TIME, 'YYYY-MM-DD HH24:MI:SS') BETWEEN #{beginBeginTime} AND #{endBeginTime}
</if>
<if test="productOrderNo != null and productOrderNo != ''">and BC.ORDER_CODE = #{productOrderNo}</if>
GROUP BY BC.ORDER_CODE, IE.BARCODE_CODE) OM ON OM.ORDER_CODE = BO.ORDER_CODE
GROUP BY OI.ORDER_CODE, OI.WORK_CENTER_CODE, BC.MATERIAL_CODE, IE.BARCODE_CODE) OM ON OM.ORDER_CODE =
BO.ORDER_CODE
LEFT JOIN C##AUCMA_SCADA.PRODUCT_OFFLINE OL ON OL.BOX_CODE = OM.BARCODE_CODE
LEFT JOIN (SELECT BAR_CODE, SUM(SCRAP_NUMBER) SCRAP_NUMBER
FROM (SELECT QI.BAR_CODE,
@ -398,7 +405,8 @@
GROUP BY BAR_CODE) BF ON BF.BAR_CODE = OM.BARCODE_CODE
<where>
<if test="productCode != null and productCode != ''">and BO.MATERIAL_CODE = #{productCode}</if>
<if test="productModel != null and productModel != ''">and BM.MATERIAL_SPECIFICATIONS LIKE '%' || #{productModel}
<if test="productModel != null and productModel != ''">and BM.MATERIAL_SPECIFICATIONS LIKE '%' ||
#{productModel}
|| '%'
</if>
</where>
@ -409,4 +417,73 @@
ZSD.MATERIAL_MODEL, ZSD.ORDER_AMOUNT
</select>
<select id="boxTraceabilityDetailReport" resultType="com.aucma.report.domain.BoxTraceabilityDetailReport"
parameterType="java.util.HashMap">
SELECT SD.ORDER_CODE,
SD.SALEORDER_CODE,
SD.SALEORDER_LINENUMBER,
SD.MATERIAL_CODE,
SD.MATERIAL_MODEL,
SD.BARCODE_CODE BOX_CODE,
SD.ORDER_AMOUNT,
SD.BEFORE_NUMBER,
SD.SCAN_NUMBER,
CASE WHEN SD.SCRAP_NUMBER = 0 THEN '否' ELSE '是' END SCRAP_FLAG,
SD.IN_STORE_TIME,
SD.EXECUTION_SORT,
PL.PRODUCT_LINE_NAME SCAN_SPOT
FROM (SELECT BO.ORDER_CODE,
BO.SALEORDER_CODE,
BO.SALEORDER_LINENUMBER,
OM.MATERIAL_CODE,
BM.MATERIAL_SPECIFICATIONS AS MATERIAL_MODEL,
OM.BARCODE_CODE,
OM.IN_STORE_TIME,
BO.ORDER_AMOUNT,
COUNT(*) AS BEFORE_NUMBER,
MAX(CASE WHEN OL.BOX_CODE IS NULL THEN 0 ELSE 1 END) AS SCAN_NUMBER,
MAX(CASE WHEN QI.BAR_CODE IS NULL THEN 0 ELSE 1 END) AS SCRAP_NUMBER,
MAX(PL.EXECUTION_SORT) EXECUTION_SORT
FROM BASE_ORDERINFO BO
JOIN BASE_MATERIALINFO BM
ON BM.MATERIAL_CODE = BO.MATERIAL_CODE AND bm.DISPO IN ('100')
JOIN (SELECT OI.ORDER_CODE,
OI.WORK_CENTER_CODE,
BC.MATERIAL_CODE,
IE.BARCODE_CODE,
MAX(IE.IN_STORE_TIME) IN_STORE_TIME
FROM RECORD_INSTORE IE
JOIN C##AUCMA_SCADA.PRINT_BARCODE BC
ON BC.MATERIAL_BARCODE = IE.BARCODE_CODE
JOIN BASE_ORDERINFO OI ON OI.ORDER_CODE = BC.ORDER_CODE
JOIN BASE_PRODUCTLINE PL ON PL.WORK_CENTER_CODE = OI.WORK_CENTER_CODE
WHERE IE.STORE_CODE = 'PQK-001'
<if test="productLineCode != null and productLineCode != ''">AND PL.PRODUCT_LINE_CODE = #{productLineCode}</if>
<if test="beginBeginTime != null and beginBeginTime != '' and endBeginTime != null and endBeginTime != ''">
AND TO_CHAR(IE.IN_STORE_TIME, 'YYYY-MM-DD HH24:MI:SS') BETWEEN #{beginBeginTime} AND #{endBeginTime}
</if>
<if test="productOrderNo != null and productOrderNo != ''">and BC.ORDER_CODE = #{productOrderNo}</if>
<if test="orderCode != null and orderCode != ''">and BC.ORDER_CODE = #{orderCode}</if>
GROUP BY OI.ORDER_CODE, OI.WORK_CENTER_CODE, BC.MATERIAL_CODE,
IE.BARCODE_CODE) OM
ON OM.ORDER_CODE = BO.ORDER_CODE AND OM.WORK_CENTER_CODE = BO.WORK_CENTER_CODE
LEFT JOIN C##AUCMA_SCADA.PRODUCT_OFFLINE OL ON OL.BOX_CODE = OM.BARCODE_CODE
LEFT JOIN REPORT_QUALITY_INSPECTION QI
ON QI.PROCESS_RESULT = '报废重做' AND QI.BAR_CODE = OM.BARCODE_CODE
LEFT JOIN C##AUCMA_SCADA.MATERIAL_COMPLETION MC
ON MC.MATERIAL_BARCODE = OM.BARCODE_CODE
LEFT JOIN BASE_PRODUCTLINE PL ON PL.PRODUCT_LINE_CODE = MC.STATION_NAME
WHERE OL.BOX_CODE IS NULL
<if test="productCode != null and productCode != ''">and BO.MATERIAL_CODE = #{productCode}</if>
<if test="productModel != null and productModel != ''">and BM.MATERIAL_SPECIFICATIONS LIKE '%' ||
#{productModel}
|| '%'
</if>
GROUP BY BO.ORDER_CODE, BO.SALEORDER_CODE, BO.SALEORDER_LINENUMBER, OM.MATERIAL_CODE,
BM.MATERIAL_SPECIFICATIONS,
BO.ORDER_AMOUNT, OM.BARCODE_CODE, OM.IN_STORE_TIME) SD
LEFT JOIN BASE_PRODUCTLINE PL ON PL.EXECUTION_SORT = SD.EXECUTION_SORT
ORDER BY PL.EXECUTION_SORT
</select>
</mapper>

Loading…
Cancel
Save