diff --git a/src/main/java/com/gaotao/modules/rollNoReview/data/SFDCRollsOutData.java b/src/main/java/com/gaotao/modules/rollNoReview/data/SFDCRollsOutData.java index b6ac6f2..5bb1c0a 100644 --- a/src/main/java/com/gaotao/modules/rollNoReview/data/SFDCRollsOutData.java +++ b/src/main/java/com/gaotao/modules/rollNoReview/data/SFDCRollsOutData.java @@ -3,6 +3,7 @@ package com.gaotao.modules.rollNoReview.data; import com.fasterxml.jackson.annotation.JsonFormat; import org.springframework.format.annotation.DateTimeFormat; +import java.math.BigDecimal; import java.sql.Timestamp; import java.util.Date; @@ -62,6 +63,60 @@ public class SFDCRollsOutData { private String partNo; private String partDesc; private String spec; + private Integer goodQty; + private Integer surfaceLossQty; + private Integer poorPerformanceQty; + private Integer defectQty; + private Integer totalQty; + private BigDecimal yieldRate; + + public Integer getGoodQty() { + return goodQty; + } + + public void setGoodQty(Integer goodQty) { + this.goodQty = goodQty; + } + + public Integer getSurfaceLossQty() { + return surfaceLossQty; + } + + public void setSurfaceLossQty(Integer surfaceLossQty) { + this.surfaceLossQty = surfaceLossQty; + } + + public Integer getPoorPerformanceQty() { + return poorPerformanceQty; + } + + public void setPoorPerformanceQty(Integer poorPerformanceQty) { + this.poorPerformanceQty = poorPerformanceQty; + } + + public Integer getDefectQty() { + return defectQty; + } + + public void setDefectQty(Integer defectQty) { + this.defectQty = defectQty; + } + + public Integer getTotalQty() { + return totalQty; + } + + public void setTotalQty(Integer totalQty) { + this.totalQty = totalQty; + } + + public BigDecimal getYieldRate() { + return yieldRate; + } + + public void setYieldRate(BigDecimal yieldRate) { + this.yieldRate = yieldRate; + } public String getPartNo() { return partNo; diff --git a/src/main/resources/mapper/shopOrder/ProductionReportMapper.xml b/src/main/resources/mapper/shopOrder/ProductionReportMapper.xml index 67458e1..b59a197 100644 --- a/src/main/resources/mapper/shopOrder/ProductionReportMapper.xml +++ b/src/main/resources/mapper/shopOrder/ProductionReportMapper.xml @@ -266,10 +266,33 @@ B.HistType, a.partNo, p.PartDescription AS partDesc, - p.Spec AS spec + p.Spec AS spec , + a.partNo, + p.PartDescription, + p.Spec, + ISNULL(R.good_qty, 0) as goodQty, + ISNULL(R.surface_loss_qty, 0) as surfaceLossQty, + ISNULL(R.poor_performance_qty, 0) as poorPerformanceQty, + ISNULL(R.defect_qty, 0) as defectQty, + ISNULL(R.total_qty, 0) as totalQty, + round(isnull(yieldRate, 100), 2) as yieldRate FROM SFDC_Rolls A LEFT JOIN SFDC_MaterialHist B ON A.Site = B.SITE AND A.OrderNo = B.OrderNo AND A.RollNo = B.StartFromRollNo left join part p on a.site = p.site and a.partNo = p.partNo + LEFT JOIN ( + select + site, + order_no, + roll_no, + seq_no, + SUM(good_qty) as good_qty, + SUM(surface_loss_qty) as surface_loss_qty, + SUM(poor_performance_qty) as poor_performance_qty, + SUM(defect_qty) as defect_qty, + SUM(total_qty) as total_qty, + CASE WHEN SUM(total_qty) = 0 THEN NULL ELSE 100.0 * SUM(good_qty) / SUM(total_qty) END AS yieldRate + from ProductionReport + GROUP BY Site,order_no,roll_no,seq_no) R on r.Site = a.site and r.roll_no = a.RollNo a.CreatedDate >= #{createdDate2}