From 9c9da57bcf5002bc9f5915d4d349609aec0849ea Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Tue, 21 Nov 2023 17:46:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A8=E9=87=8F=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QcCheckTaskIncomeController.java | 11 ++-- .../controller/QcStaticTableController.java | 51 ++++++++------- .../op/quality/domain/QcCheckTaskDetail.java | 9 +++ .../com/op/quality/domain/QcStaticTable.java | 64 +++++++++++++++++++ .../mapper/QcCheckUnqualifiedMapper.java | 3 + .../quality/mapper/QcStaticTableMapper.java | 2 + .../service/IQcCheckTaskIncomeService.java | 7 +- .../service/IQcStaticTableService.java | 1 + .../impl/QcCheckTaskIncomeServiceImpl.java | 6 ++ .../impl/QcStaticTableServiceImpl.java | 18 ++++++ .../quality/QcCheckTaskDetailMapper.xml | 1 + .../quality/QcCheckTaskProduceMapper.xml | 2 +- .../quality/QcCheckUnqualifiedMapper.xml | 8 ++- .../mapper/quality/QcStaticTableMapper.xml | 10 +++ 14 files changed, 161 insertions(+), 32 deletions(-) diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskIncomeController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskIncomeController.java index f6e87520..361dcc58 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskIncomeController.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckTaskIncomeController.java @@ -7,9 +7,7 @@ import javax.servlet.http.HttpServletResponse; import com.op.common.core.utils.DateUtils; import com.op.common.security.utils.SecurityUtils; -import com.op.quality.domain.QcBomComponent; -import com.op.quality.domain.QcCheckTaskDetail; -import com.op.quality.domain.QcSupplier; +import com.op.quality.domain.*; import com.op.system.api.domain.SysRole; import com.op.system.api.domain.SysUser; import org.apache.commons.lang.StringUtils; @@ -25,7 +23,6 @@ import org.springframework.web.bind.annotation.RestController; import com.op.common.log.annotation.Log; import com.op.common.log.enums.BusinessType; import com.op.common.security.annotation.RequiresPermissions; -import com.op.quality.domain.QcCheckTaskIncome; import com.op.quality.service.IQcCheckTaskIncomeService; import com.op.common.core.web.controller.BaseController; import com.op.common.core.web.domain.AjaxResult; @@ -219,4 +216,10 @@ public class QcCheckTaskIncomeController extends BaseController { return toAjax(qcCheckTaskIncomeService.commitCheckResult(qcCheckTaskIncome)); } + /**不良类型**/ + @PutMapping("/getDefectList") + public List getDefectList(@RequestBody QcDefectType qcDefectType) { + return qcCheckTaskIncomeService.getDefectList(qcDefectType); + } + } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcStaticTableController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcStaticTableController.java index d9d480d1..521a8992 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcStaticTableController.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcStaticTableController.java @@ -9,6 +9,7 @@ import java.util.*; import javax.servlet.http.HttpServletResponse; import com.op.common.core.utils.DateUtils; +import com.op.system.api.domain.quality.ChartDTO; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -75,7 +76,7 @@ public class QcStaticTableController extends BaseController { */ @RequiresPermissions("quality:gcTableProduce:list") @GetMapping("/getProduceChartData") - public QcStaticTable getProduceList(QcStaticTable qcStaticTable) { + public QcStaticTable getProduceChartData(QcStaticTable qcStaticTable) { QcStaticTable resultdto = new QcStaticTable(); //默认时间范围T 00:00:00~T+1 00:00:00 if(StringUtils.isEmpty(qcStaticTable.getYmArrayStart())){ @@ -88,18 +89,22 @@ public class QcStaticTableController extends BaseController { //xAxis; if(qcStaticTable.getYmArrayStart().equals(qcStaticTable.getYmArrayEnd())){ /**月内每日**/ - List days = this.getXNames(qcStaticTable.getYmArrayStart(),qcStaticTable.getYmArrayEnd(),"ymd"); + List days = this.getXNames(qcStaticTable.getYmArrayStart()+"-01", + qcStaticTable.getYmArrayEnd()+"-01","ymd"); resultdto.setxAxis(days); }else{ /**年内各月**/ List months = this.getXNames(qcStaticTable.getYmArrayStart(),qcStaticTable.getYmArrayEnd(),"ym"); resultdto.setxAxis(months); } + //series;//legend.data + List seriesdtos= qcStaticTableService.getProduceChartData(qcStaticTable); + ChartDTO chartDTO = new ChartDTO(); + for(QcStaticTable seriesdto:seriesdtos){ + chartDTO.setName(seriesdto.getMaterialName()); + chartDTO.setType("line"); + } - List seriesdto= qcStaticTableService.selectQcStaticTableList(qcStaticTable); - //legend.data - - //series; resultdto.setSeries(null); return resultdto; @@ -110,30 +115,32 @@ public class QcStaticTableController extends BaseController { List days = new ArrayList(); DateFormat dateFormat = null; try { + Calendar tempStart = null; + Calendar tempEnd = null; if("ymd".equals(type)){ dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + Date start = dateFormat.parse(startMonth);//开始 + Date end = dateFormat.parse(endMonth);//结束 + + tempStart = Calendar.getInstance(); + tempStart.setTime(start); + + tempEnd = Calendar.getInstance(); + tempEnd.setTime(end); + tempEnd.add(Calendar.MONTH, 1); }else{ dateFormat = new SimpleDateFormat("yyyy-MM"); - } + Date start = dateFormat.parse(startMonth);//开始 + Date end = dateFormat.parse(endMonth);//结束 - Date start = dateFormat.parse(startMonth);//开始 - Date end = dateFormat.parse(endMonth);//结束 + tempStart = Calendar.getInstance(); + tempStart.setTime(start); - String endTimeStr1 = endMonth; - String[] endTime2 = endTimeStr1.split(" "); - String endTime3 = endTime2[1].split(":")[1]; - if(Integer.parseInt(endTime3)!=0){ - Calendar calendar = Calendar.getInstance(); - calendar.setTime(end); - calendar.add(Calendar.MONTH, 1); - end = calendar.getTime(); + tempEnd = Calendar.getInstance(); + tempEnd.setTime(end); + tempEnd.add(Calendar.MONTH, 1); } - Calendar tempStart = Calendar.getInstance(); - tempStart.setTime(start); - - Calendar tempEnd = Calendar.getInstance(); - tempEnd.setTime(end); while (tempStart.before(tempEnd)) { days.add(dateFormat.format(tempStart.getTime())); if("ymd".equals(type)) { diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDetail.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDetail.java index 0eccb020..72b8ac8d 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDetail.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDetail.java @@ -94,6 +94,15 @@ public class QcCheckTaskDetail extends BaseEntity { private Integer sampleNum; private List actualValues; private String typeProjectId; + private String defectCode; + + public String getDefectCode() { + return defectCode; + } + + public void setDefectCode(String defectCode) { + this.defectCode = defectCode; + } public String getTypeProjectId() { return typeProjectId; diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcStaticTable.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcStaticTable.java index caabd47f..c337a9e5 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcStaticTable.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcStaticTable.java @@ -4,6 +4,7 @@ import com.op.common.core.annotation.Excel; import com.op.common.core.web.domain.BaseEntity; import com.op.system.api.domain.quality.ChartDTO; +import java.math.BigDecimal; import java.util.List; /** @@ -42,6 +43,69 @@ public class QcStaticTable extends BaseEntity { private List legendData; private List xAxis; private List series; + private String materialCode; + private String materialName; + private String sampleQuality; + private BigDecimal aNoOkquality; + private BigDecimal bNoOkquality; + private BigDecimal cNoOkquality; + private BigDecimal defectRate;//不良率 + + public BigDecimal getDefectRate() { + return defectRate; + } + + public void setDefectRate(BigDecimal defectRate) { + this.defectRate = defectRate; + } + + public String getMaterialCode() { + return materialCode; + } + + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + + public String getMaterialName() { + return materialName; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public String getSampleQuality() { + return sampleQuality; + } + + public void setSampleQuality(String sampleQuality) { + this.sampleQuality = sampleQuality; + } + + public BigDecimal getaNoOkquality() { + return aNoOkquality; + } + + public void setaNoOkquality(BigDecimal aNoOkquality) { + this.aNoOkquality = aNoOkquality; + } + + public BigDecimal getbNoOkquality() { + return bNoOkquality; + } + + public void setbNoOkquality(BigDecimal bNoOkquality) { + this.bNoOkquality = bNoOkquality; + } + + public BigDecimal getcNoOkquality() { + return cNoOkquality; + } + + public void setcNoOkquality(BigDecimal cNoOkquality) { + this.cNoOkquality = cNoOkquality; + } public String getYmArrayStart() { return ymArrayStart; diff --git a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckUnqualifiedMapper.java b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckUnqualifiedMapper.java index 21de6735..09a48349 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckUnqualifiedMapper.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckUnqualifiedMapper.java @@ -3,6 +3,7 @@ package com.op.quality.mapper; import java.util.List; import com.op.quality.domain.QcCheckUnqualified; +import com.op.quality.domain.QcDefectType; import org.apache.ibatis.annotations.Mapper; /** @@ -60,4 +61,6 @@ public interface QcCheckUnqualifiedMapper { * @return 结果 */ public int deleteQcCheckUnqualifiedByIds(String[] ids); + + public List getDefectList(QcDefectType qcDefectType); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcStaticTableMapper.java b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcStaticTableMapper.java index da364cc4..070dee5f 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcStaticTableMapper.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcStaticTableMapper.java @@ -30,4 +30,6 @@ public interface QcStaticTableMapper { @MapKey("supplierCode") public Map selectNumMap(@Param("qc")QcStaticTable qcStaticTable, @Param("codes")List tabledtos); + + List getProduceChartData(QcStaticTable qcStaticTable); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckTaskIncomeService.java b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckTaskIncomeService.java index 56d51a20..72cb2094 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckTaskIncomeService.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckTaskIncomeService.java @@ -2,10 +2,7 @@ package com.op.quality.service; import java.util.List; -import com.op.quality.domain.QcBomComponent; -import com.op.quality.domain.QcCheckTaskDetail; -import com.op.quality.domain.QcCheckTaskIncome; -import com.op.quality.domain.QcSupplier; +import com.op.quality.domain.*; import com.op.system.api.domain.SysUser; /** @@ -78,4 +75,6 @@ public interface IQcCheckTaskIncomeService { int commitActualValue(QcCheckTaskDetail qcCheckTaskDetail); int commitCheckResult(QcCheckTaskIncome qcCheckTaskIncome); + + List getDefectList(QcDefectType qcDefectType); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/IQcStaticTableService.java b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcStaticTableService.java index 96465603..54c247c4 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/IQcStaticTableService.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcStaticTableService.java @@ -19,4 +19,5 @@ public interface IQcStaticTableService { */ public List selectQcStaticTableList(QcStaticTable qcStaticTable); + public List getProduceChartData(QcStaticTable qcStaticTable); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java index 4bff7385..e0cd35b5 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java @@ -279,4 +279,10 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { return n ; } + @Override + @DS("#header.poolName") + public List getDefectList(QcDefectType qcDefectType) { + return qcCheckUnqualifiedMapper.getDefectList(qcDefectType); + } + } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcStaticTableServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcStaticTableServiceImpl.java index cd5db056..3a43465a 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcStaticTableServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcStaticTableServiceImpl.java @@ -104,4 +104,22 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService { return tabledtos; } + /** + * 不良率 = (A类*1+B类*0.65+C类*0.35)/抽样总数 + * @param qcStaticTable + * @return + */ + @Override + @DS("#header.poolName") + public List getProduceChartData(QcStaticTable qcStaticTable) { + List dtos = qcStaticTableMapper.getProduceChartData(qcStaticTable); + for(QcStaticTable dto:dtos){ + BigDecimal defectRate = (dto.getaNoOkquality().add(dto.getbNoOkquality()).multiply(new BigDecimal("0.65")) + .add(dto.getcNoOkquality()).multiply(new BigDecimal(0.35))) + .divide(new BigDecimal(dto.getSampleQuality())); + dto.setDefectRate(defectRate); + } + return dtos; + } + } diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskDetailMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskDetailMapper.xml index d218245c..9b3b4783 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskDetailMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskDetailMapper.xml @@ -166,6 +166,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_time = #{updateTime}, factory_code = #{factoryCode}, del_flag = #{delFlag}, + defect_code = #{defectCode}, where record_id = #{recordId} diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskProduceMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskProduceMapper.xml index 4add79d1..7ff9ec49 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskProduceMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskProduceMapper.xml @@ -55,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" qct.check_man_code, qct.check_man_name,qct.check_time, qct.check_result, qct.status, qct.create_by,qct.create_time, qct.update_by, qct.update_time, qct.check_type,qct.sample_quality,qct.noOk_quality, - qct.aNoOkquality,qct.bNoOkquality,qct.cNoOkquality + qct.aNoOkquality,qct.bNoOkquality,qct.cNoOkquality, q.type_code from qc_check_task qct left join qc_check_type q on q.id = qct.check_type diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckUnqualifiedMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckUnqualifiedMapper.xml index ff946001..193c42aa 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckUnqualifiedMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckUnqualifiedMapper.xml @@ -67,8 +67,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join qc_check_type qtn on qtn.id = qct.check_type where qcu.id = #{id} + - + insert into qc_check_unqualified id, diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcStaticTableMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcStaticTableMapper.xml index d1622890..f51290eb 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcStaticTableMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcStaticTableMapper.xml @@ -56,5 +56,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" group by qct.supplier_code,qct.supplier_name +