From 827657c43d606120a825f8c6fe283c120c4cd1bd Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Thu, 4 Jan 2024 15:44:37 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=B7=A1=E6=A3=80=E4=B8=8D=E8=89=AF?= =?UTF-8?q?=E5=88=86=E6=9E=90=E5=9B=BE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/domain/quality/ChartSeriesDTO.java | 18 ++++ .../controller/QcStaticTableController.java | 13 +++ .../quality/domain/QcCheckReportIncome.java | 9 ++ .../op/quality/domain/QcCheckTaskProduce.java | 9 ++ .../com/op/quality/domain/QcStaticTable.java | 20 ++++ .../quality/mapper/QcStaticTableMapper.java | 6 ++ .../service/IQcStaticTableService.java | 3 + .../impl/QcCheckTaskIncomeServiceImpl.java | 44 ++++----- .../impl/QcStaticTableServiceImpl.java | 99 ++++++++++++++++++- .../quality/QcCheckReportIncomeMapper.xml | 4 +- .../quality/QcCheckTaskProduceMapper.xml | 4 +- .../quality/QcCheckTypeProjectMapper.xml | 4 +- .../mapper/quality/QcStaticTableMapper.xml | 58 ++++++++--- 13 files changed, 248 insertions(+), 43 deletions(-) diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/domain/quality/ChartSeriesDTO.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/quality/ChartSeriesDTO.java index 24e016d7..2751d6c1 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/domain/quality/ChartSeriesDTO.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/quality/ChartSeriesDTO.java @@ -12,6 +12,24 @@ public class ChartSeriesDTO { private List yAxisData; private List series; + private List legendData; + private List xAxisData; + + public List getxAxisData() { + return xAxisData; + } + + public void setxAxisData(List xAxisData) { + this.xAxisData = xAxisData; + } + + public List getLegendData() { + return legendData; + } + + public void setLegendData(List legendData) { + this.legendData = legendData; + } public List getyAxisData() { return yAxisData; 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 bc828858..3f3f190c 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 @@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletResponse; import com.op.common.core.utils.DateUtils; import com.op.system.api.domain.quality.ChartDTO; +import com.op.system.api.domain.quality.ChartSeriesDTO; import com.op.system.api.domain.quality.FactoryDto; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -251,4 +252,16 @@ public class QcStaticTableController extends BaseController { List list = qcStaticTableService.getXJCheckTableDetail(qcStaticTable); return list; } + /**巡检小时不良**/ + @GetMapping("/getXJChartData") + public ChartSeriesDTO getXJChartData(QcStaticTable qcStaticTable) { + if(StringUtils.isEmpty(qcStaticTable.getYmdms())){ + LocalDate date = LocalDate.now(); + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + String ymStr = dtf.format(date); + qcStaticTable.setYmdms(ymStr);//end + } + ChartSeriesDTO dto = qcStaticTableService.getXJChartData(qcStaticTable); + return dto; + } } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckReportIncome.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckReportIncome.java index 6bf0ff3f..759f4db9 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckReportIncome.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckReportIncome.java @@ -124,6 +124,15 @@ public class QcCheckReportIncome extends BaseEntity { private String checkTimeEnd; private String typeCode;//大类 private String checkType;//小类 + private String checkName; + + public String getCheckName() { + return checkName; + } + + public void setCheckName(String checkName) { + this.checkName = checkName; + } public BigDecimal getSampleQuality() { return sampleQuality; diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskProduce.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskProduce.java index 47445f58..6db2aca5 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskProduce.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskProduce.java @@ -144,6 +144,15 @@ public class QcCheckTaskProduce extends BaseEntity { @Excel(name = "C类不合格数量") private BigDecimal cNoOkquality; + private String checkName; + + public String getCheckName() { + return checkName; + } + + public void setCheckName(String checkName) { + this.checkName = checkName; + } public String getOrderType() { return orderType; 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 e3e30f7d..66155a45 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.fasterxml.jackson.annotation.JsonFormat; import com.op.common.core.annotation.Excel; import com.op.common.core.web.domain.BaseEntity; import com.op.system.api.domain.quality.ChartDTO; +import com.op.system.api.domain.quality.ChartSeriesDTO; import java.math.BigDecimal; import java.util.Date; @@ -83,6 +84,24 @@ public class QcStaticTable extends BaseEntity { private String column180190; private String column190200; private String column200210; + private String startDateStr; + private String endDateStr; + + public String getStartDateStr() { + return startDateStr; + } + + public void setStartDateStr(String startDateStr) { + this.startDateStr = startDateStr; + } + + public String getEndDateStr() { + return endDateStr; + } + + public void setEndDateStr(String endDateStr) { + this.endDateStr = endDateStr; + } public String getColumn080090() { return column080090; @@ -531,4 +550,5 @@ public class QcStaticTable extends BaseEntity { public void setSupplierName(String supplierName) { this.supplierName = supplierName; } + } 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 c2f7555e..d6dea4e3 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 @@ -45,4 +45,10 @@ public interface QcStaticTableMapper { List getXJProjects(QcStaticTable qcStaticTable); @MapKey("ymdms") Map getProjectDetail(QcStaticTable qcStaticTable); + + List getBatchnos(String orderNo); + + List getLegendData(QcStaticTable qcStaticTable); + @MapKey("ymdms") + Map getXJMapData(QcStaticTable qcStaticTable); } 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 a2e6ab7f..e769347c 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 @@ -4,6 +4,7 @@ import java.util.List; import java.util.Map; import com.op.quality.domain.QcStaticTable; +import com.op.system.api.domain.quality.ChartSeriesDTO; import com.op.system.api.domain.quality.FactoryDto; /** @@ -33,4 +34,6 @@ public interface IQcStaticTableService { List getXJCheckTableList(QcStaticTable qcStaticTable); List getXJCheckTableDetail(QcStaticTable qcStaticTable); + + ChartSeriesDTO getXJChartData(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 bca08e49..2562bccc 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 @@ -389,7 +389,7 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { //发起来料检验OA流程 Map paramMap = new HashMap<>(); - paramMap.put("user",qcCheckTaskIncome.getUpdateBy());//提交人工号 + paramMap.put("user","019047");//提交人工号qcCheckTaskIncome.getUpdateBy() paramMap.put("requestLevel",0);//流程紧急度 paramMap.put("requestName","ZL0010-来料检验不合格审批流程(定单:"+qcCheckTaskIncome.getOrderNo()+")");//流程名称 paramMap.put("workflowld","26258");//该流程对应的唯- workFlowld @@ -397,10 +397,10 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { StringBuffer mainObject = new StringBuffer(); mainObject.append("{"); mainObject.append("\"CQ\":"+1);//厂区 - mainObject.append("\"LLLB\":"+0);//来料类别【0、1】 - mainObject.append("\"MATNR\""+"\"000000010101003200\"");//物料编码 + mainObject.append(",\"LLLB\":"+0);//来料类别【0、1】 + mainObject.append(",\"MATNR\":"+"\"000000010101003200\"");//物料编码 //mainObject.append("\"MAKTX\""+MATNR);//物料名称 - mainObject.append("{"); + mainObject.append("}"); paramMap.put("mainObject",mainObject.toString()); logger.info("流程Id 26258:"+ JSONObject.toJSONString(paramMap)); AjaxResult oaR = remoteOpenService.OAInspection(paramMap); @@ -549,24 +549,24 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { n = qcCheckUnqualifiedMapper.insertQcCheckUnqualified(unqualified); logger.info("qc_check_unqualified:"+n); - //发起来料检验OA流程 - Map paramMap = new HashMap<>(); - paramMap.put("user",updateBy);//提交人工号 - paramMap.put("requestLevel",0);//流程紧急度 - paramMap.put("requestName","ZL0010-来料检验不合格审批流程(定单:"+qcCheckTaskIncome.getOrderNo()+")");//流程名称 - paramMap.put("workflowld","26258");//该流程对应的唯- workFlowld - - StringBuffer mainObject = new StringBuffer(); - mainObject.append("{"); - mainObject.append("\"CQ\":"+1);//厂区 - mainObject.append("\"LLLB\":"+0);//来料类别【0、1】 - mainObject.append("\"MATNR\""+"\"000000010101003200\"");//物料编码 - //mainObject.append("\"MAKTX\""+MATNR);//物料名称 - mainObject.append("{"); - paramMap.put("mainObject",mainObject.toString()); - - AjaxResult oaR = remoteOpenService.OAInspection(paramMap); - logger.info("流程Id 26258:"+ JSONObject.toJSONString(oaR)); +// //发起来料检验OA流程 +// Map paramMap = new HashMap<>(); +// paramMap.put("user",updateBy);//提交人工号 +// paramMap.put("requestLevel",0);//流程紧急度 +// paramMap.put("requestName","ZL0010-来料检验不合格审批流程(定单:"+qcCheckTaskIncome.getOrderNo()+")");//流程名称 +// paramMap.put("workflowld","26258");//该流程对应的唯- workFlowld +// +// StringBuffer mainObject = new StringBuffer(); +// mainObject.append("{"); +// mainObject.append("\"CQ\":"+1);//厂区 +// mainObject.append("\"LLLB\":"+0);//来料类别【0、1】 +// mainObject.append("\"MATNR\""+"\"000000010101003200\"");//物料编码 +// //mainObject.append("\"MAKTX\""+MATNR);//物料名称 +// mainObject.append("{"); +// paramMap.put("mainObject",mainObject.toString()); +// +// AjaxResult oaR = remoteOpenService.OAInspection(paramMap); +// logger.info("流程Id 26258:"+ JSONObject.toJSONString(oaR)); } return n ; 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 4c77a4bc..d7071724 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 @@ -1,11 +1,20 @@ package com.op.quality.service.impl; import java.math.BigDecimal; -import java.util.List; -import java.util.Map; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; import com.baomidou.dynamic.datasource.annotation.DS; +import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.StringUtils; +import com.op.quality.domain.QcCheckTaskIncome; +import com.op.system.api.domain.quality.ChartDTO; +import com.op.system.api.domain.quality.ChartSeriesDTO; import com.op.system.api.domain.quality.FactoryDto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -141,6 +150,14 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService { @DS("#header.poolName") public List getXJCheckTableList(QcStaticTable qcStaticTable) { List tabledtos = qcStaticTableMapper.getXJCheckTableList(qcStaticTable); + for(QcStaticTable tabledto:tabledtos){ + List batchnos = qcStaticTableMapper.getBatchnos(tabledto.getOrderNo()); + String ordernoStr = ""; + for(String batchno:batchnos){ + ordernoStr += batchno+";"; + }; + tabledto.setIncomeBatchNo(ordernoStr); + } return tabledtos; } @@ -253,5 +270,83 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService { project.setColumn200210("-"); } } + /**巡检小时不良**/ + @Override + @DS("#header.poolName") + public ChartSeriesDTO getXJChartData(QcStaticTable qcStaticTable) { + ChartSeriesDTO seriesDTO = new ChartSeriesDTO(); + //获取当天参与生产的车间 + List legends = qcStaticTableMapper.getLegendData(qcStaticTable); + List legendData = new ArrayList<>(); + if(!CollectionUtils.isEmpty(legends)){ + legendData=legends.stream().map(QcStaticTable::getSupplierName).collect(Collectors.toList()); + }else{ + return null; + } + seriesDTO.setLegendData(legendData); + //横轴时间 + qcStaticTable.setStartDateStr(qcStaticTable.getYmdms()+" 08:00:00"); + qcStaticTable.setEndDateStr(qcStaticTable.getYmdms()+" 08:00:00"); + List xAxisData = this.getHourProductionTitle(qcStaticTable); + seriesDTO.setxAxisData(xAxisData); + //数据 + Map dataMap = qcStaticTableMapper.getXJMapData(qcStaticTable); + List series = new ArrayList<>(); + ChartDTO serie = null; + for(QcStaticTable legend:legends){ + serie= new ChartDTO(); + serie.setName(legend.getSupplierName()); + List data = new ArrayList<>(); + for(String houreName:xAxisData){ + String key = legend.getSupplierCode()+houreName.replace("时",""); + QcStaticTable qt = dataMap.get(key); + if(qt!=null&&StringUtils.isNotBlank(qt.getSampleQuality())){ + BigDecimal noOkRate = new BigDecimal(qt.getNoOkNums()) + .multiply(new BigDecimal(100)) + .divide(new BigDecimal(qt.getSampleQuality()),2,BigDecimal.ROUND_HALF_UP); + data.add(noOkRate.doubleValue()); + }else{ + data.add(0.00); + } + serie.setData(data); + } + serie.setData(data); + series.add(serie); + } + seriesDTO.setSeries(series); + + return seriesDTO; + } + + private List getHourProductionTitle(QcStaticTable qcStaticTable) { + + // 返回的日期集合 + List dayHours = new ArrayList(); + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH"); + try { + + Date start = dateFormat.parse(qcStaticTable.getStartDateStr());//开始 + + Date end = dateFormat.parse(qcStaticTable.getEndDateStr());//结束 + Calendar calendar = Calendar.getInstance(); + calendar.setTime(end); + calendar.add(Calendar.HOUR_OF_DAY, 14); + end = calendar.getTime(); + + Calendar tempStart = Calendar.getInstance(); + tempStart.setTime(start); + + Calendar tempEnd = Calendar.getInstance(); + tempEnd.setTime(end); + while (tempStart.before(tempEnd)) { + dayHours.add(dateFormat.format(tempStart.getTime()).split(" ")[1]+"时"); + tempStart.add(Calendar.HOUR_OF_DAY, 1); + } + } catch (ParseException e) { + e.printStackTrace(); + } + + return dayHours; + } } diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml index dcdc372f..a7dd6cec 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml @@ -34,6 +34,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -49,7 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" qct.supplier_code, qct.supplier_name, qct.income_time, qct.check_loc, qct.check_status, qct.check_man_code, qct.check_man_name,qct.check_time, qct.check_result, qct.status,qct.sample_quality, qct.create_by,qct.create_time, qct.update_by, qct.update_time,qct.check_type, - q.type_code + q.type_code,q.check_name 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/QcCheckTaskProduceMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskProduceMapper.xml index 1ad7a320..7bf0cd55 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 @@ -36,6 +36,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -56,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 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, - q.type_code + q.type_code,q.check_name 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/QcCheckTypeProjectMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTypeProjectMapper.xml index 672a754e..6563430f 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTypeProjectMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTypeProjectMapper.xml @@ -63,9 +63,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ctp.sample_num, ctp.sort FROM qc_check_type_project ctp - LEFT JOIN qc_check_project cp ON ctp.project_id = cp.id AND cp.del_flag = '0' + LEFT JOIN qc_check_project cp ON ctp.project_id = cp.id - AND ctp.del_flag = '0' + AND ctp.del_flag = '0' AND cp.del_flag = '0' and ctp.project_id = #{projectId} and ctp.type_id = #{typeId} and ctp.standard_value like concat('%', #{standardValue}, '%') 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 739fe134..faa8169c 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 @@ -132,26 +132,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + From 3a9aa84d562503b9b8571b0230a23fb83d945835 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Thu, 4 Jan 2024 15:46:45 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=B7=A1=E6=A3=80=E4=B8=8D=E8=89=AF?= =?UTF-8?q?=E5=88=86=E6=9E=90=E5=9B=BE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/op/quality/controller/QcStaticTableController.java | 2 ++ 1 file changed, 2 insertions(+) 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 3f3f190c..17aaa5bf 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 @@ -253,6 +253,8 @@ public class QcStaticTableController extends BaseController { return list; } /**巡检小时不良**/ + + @RequiresPermissions("quality:qcTableXJAnalysis:list") @GetMapping("/getXJChartData") public ChartSeriesDTO getXJChartData(QcStaticTable qcStaticTable) { if(StringUtils.isEmpty(qcStaticTable.getYmdms())){ From 096e30657db3d7e994f09e6ab740cad408f7420c Mon Sep 17 00:00:00 2001 From: shaoyong Date: Thu, 4 Jan 2024 17:05:42 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=A6=96=E6=A3=80=E6=8A=A5=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QcCheckReportFirstController.java | 185 ++++++++++++++++ .../QcCheckReportIncomeController.java | 1 - .../QcCheckReportProduceController.java | 1 - .../QcCheckReportProductController.java | 1 - .../service/IQcCheckReportFirstService.java | 78 +++++++ .../impl/QcCheckReportFirstServiceImpl.java | 207 ++++++++++++++++++ .../quality/QcCheckReportIncomeMapper.xml | 1 + 7 files changed, 471 insertions(+), 3 deletions(-) create mode 100644 op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportFirstController.java create mode 100644 op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckReportFirstService.java create mode 100644 op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckReportFirstServiceImpl.java diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportFirstController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportFirstController.java new file mode 100644 index 00000000..be633136 --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportFirstController.java @@ -0,0 +1,185 @@ +package com.op.quality.controller; + +import com.op.common.core.utils.DateUtils; +import com.op.common.core.utils.poi.ExcelUtil; +import com.op.common.core.web.controller.BaseController; +import com.op.common.core.web.domain.AjaxResult; +import com.op.common.core.web.page.TableDataInfo; +import com.op.common.log.annotation.Log; +import com.op.common.log.enums.BusinessType; +import com.op.common.security.annotation.RequiresPermissions; +import com.op.common.security.utils.SecurityUtils; +import com.op.quality.domain.QcBomComponent; +import com.op.quality.domain.QcCheckReportIncome; +import com.op.quality.domain.QcCheckTaskDetail; +import com.op.quality.domain.QcSupplier; +import com.op.quality.service.IQcCheckReportFirstService; +import com.op.system.api.domain.SysUser; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * 来料检验Controller + * + * @author Open Platform + * @date 2023-10-19 + */ +@RestController +@RequestMapping("/qcFirstReport") +public class QcCheckReportFirstController extends BaseController { + @Autowired + private IQcCheckReportFirstService qcCheckReportFirstService; + + /** + * 查询来料检验列表 + */ + @RequiresPermissions("quality:firstReport:list") + @GetMapping("/list") + public TableDataInfo list(QcCheckReportIncome qcCheckReportIncome) { + + //默认时间范围T 00:00:00~T+1 00:00:00 + if(StringUtils.isEmpty(qcCheckReportIncome.getCheckTimeStart())){ + qcCheckReportIncome.setCheckTimeStart(DateUtils.getDate()+" 00:00:00");//start + LocalDate date = LocalDate.now(); + LocalDate dateEnd = date.plusDays(1); + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + String dateEndStr = dtf.format(dateEnd)+" 23:59:59"; + qcCheckReportIncome.setCheckTimeEnd(dateEndStr);//end + } + +// if(StringUtils.isEmpty(qcCheckReportIncome.getCheckTimeStart())){ +// qcCheckReportIncome.setCheckTimeStart(qcCheckReportIncome.getIncomeTimeStart());//start +// qcCheckReportIncome.setCheckTimeEnd(qcCheckReportIncome.getIncomeTimeStart());//end +// } + + startPage(); + List list = qcCheckReportFirstService.selectQcCheckReportIncomeList(qcCheckReportIncome); + return getDataTable(list); + } + + /** + * 导出来料检验列表 + */ + @RequiresPermissions("quality:firstReport:export") + @Log(title = "来料检验", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, QcCheckReportIncome qcCheckReportIncome) { + + //默认时间范围T 00:00:00~T+1 00:00:00 + if(StringUtils.isEmpty(qcCheckReportIncome.getIncomeTimeStart())){ + qcCheckReportIncome.setIncomeTimeStart(DateUtils.getDate()+" 00:00:00");//start + LocalDate date = LocalDate.now(); + LocalDate dateEnd = date.plusDays(1); + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + String dateEndStr = dtf.format(dateEnd)+" 00:00:00"; + qcCheckReportIncome.setIncomeTimeEnd(dateEndStr);//end + } + +// if(StringUtils.isEmpty(qcCheckReportIncome.getCheckTimeStart())){ +// qcCheckReportIncome.setCheckTimeStart(qcCheckReportIncome.getIncomeTimeStart());//start +// qcCheckReportIncome.setCheckTimeEnd(qcCheckReportIncome.getIncomeTimeStart());//end +// } + + List list = qcCheckReportFirstService.selectQcCheckReportIncomeList(qcCheckReportIncome); + ExcelUtil util = new ExcelUtil(QcCheckReportIncome.class); + util.exportExcel(response, list, "来料检验数据"); + } + + /** + * 获取来料检验详细信息 + */ + @RequiresPermissions("quality:firstReport:query") + @GetMapping(value = "/{recordId}") + public AjaxResult getInfo(@PathVariable("recordId") String recordId) { + return success(qcCheckReportFirstService.selectQcCheckReportIncomeByRecordId(recordId)); + } + + /** + * 新增来料检验 + */ + @RequiresPermissions("quality:firstReport:add") + @Log(title = "来料检验", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody QcCheckReportIncome qcCheckReportIncome) { + int r = qcCheckReportFirstService.insertQcCheckReportIncome(qcCheckReportIncome); + if(r>0){ + return toAjax(r); + } + return error("添加失败:请检查物料的关联检测项"); + } + + /** + * 修改来料检验 + */ + @RequiresPermissions("quality:firstReport:edit") + @Log(title = "来料检验", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody QcCheckReportIncome qcCheckReportIncome) { + return toAjax(qcCheckReportFirstService.updateQcCheckReportIncome(qcCheckReportIncome)); + } + + /** + * 删除来料检验 + */ + @RequiresPermissions("quality:firstReport:remove") + @Log(title = "来料检验", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public AjaxResult remove(@PathVariable String[] recordIds) { + return toAjax(qcCheckReportFirstService.deleteQcCheckReportIncomeByRecordIds(recordIds)); + } + + /** + * 查询BOM物料管理列表 + */ + @GetMapping("/getQcListBom") + public TableDataInfo getQcListBom(QcBomComponent bomComponent) { + startPage(); + List list = qcCheckReportFirstService.getQcListBom(bomComponent); + return getDataTable(list); + } + /** + * 查询供应商列表 + */ + @GetMapping("/getQcListSupplier") + public TableDataInfo getQcListSupplier(QcSupplier qcSupplier) { + startPage(); + List list = qcCheckReportFirstService.getQcListSupplier(qcSupplier); + return getDataTable(list); + } + /** + * 查询人员列表 + */ + @GetMapping("/getQcListUser") + public TableDataInfo getQcListUser(SysUser sysUser) { + startPage(); + List list = qcCheckReportFirstService.getQcListUser(sysUser); + return getDataTable(list); + } + + /** + * 状态修改 + */ + @PutMapping("/changeIncomeStatus") + public AjaxResult changeIncomeStatus(@RequestBody QcCheckReportIncome qcCheckReportIncome) { + qcCheckReportIncome.setUpdateBy(SecurityUtils.getUsername()); + qcCheckReportIncome.setUpdateTime(DateUtils.getNowDate()); + return toAjax(qcCheckReportFirstService.updateIncomeStatus(qcCheckReportIncome)); + } + + /** + * 检验项目弹窗列表 + * @param + * @return + */ + @GetMapping("/getCkeckProjectList") + public TableDataInfo getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail) { + List list = qcCheckReportFirstService.getCkeckProjectList(qcCheckTaskDetail); + return getDataTable(list); + } +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportIncomeController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportIncomeController.java index b9a1d728..99683444 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportIncomeController.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportIncomeController.java @@ -176,7 +176,6 @@ public class QcCheckReportIncomeController extends BaseController { */ @GetMapping("/getCkeckProjectList") public TableDataInfo getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail) { - startPage(); List list = qcCheckReportIncomeService.getCkeckProjectList(qcCheckTaskDetail); return getDataTable(list); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportProduceController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportProduceController.java index da833bb8..1cd85fcf 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportProduceController.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportProduceController.java @@ -174,7 +174,6 @@ public class QcCheckReportProduceController extends BaseController { */ @GetMapping("/getCkeckProjectList") public TableDataInfo getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail) { - startPage(); List list = qcCheckReportProduceService.getCkeckProjectList(qcCheckTaskDetail); return getDataTable(list); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportProductController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportProductController.java index 37021e76..d7a55bbb 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportProductController.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcCheckReportProductController.java @@ -179,7 +179,6 @@ public class QcCheckReportProductController extends BaseController { */ @GetMapping("/getCkeckProjectList") public TableDataInfo getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail) { - startPage(); List list = qcCheckReportProductService.getCkeckProjectList(qcCheckTaskDetail); return getDataTable(list); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckReportFirstService.java b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckReportFirstService.java new file mode 100644 index 00000000..8b0de07c --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcCheckReportFirstService.java @@ -0,0 +1,78 @@ +package com.op.quality.service; + +import com.op.quality.domain.QcBomComponent; +import com.op.quality.domain.QcCheckReportIncome; +import com.op.quality.domain.QcCheckTaskDetail; +import com.op.quality.domain.QcSupplier; +import com.op.system.api.domain.SysUser; + +import java.util.List; + +/** + * 来料报告Service接口 + * + * @author Open Platform + * @date 2023-10-19 + */ +public interface IQcCheckReportFirstService { + /** + * 查询来料报告 + * + * @param recordId 来料报告主键 + * @return 来料检验 + */ + public QcCheckReportIncome selectQcCheckReportIncomeByRecordId(String recordId); + + /** + * 查询来料报告列表 + * + * @param qcCheckReportIncome 来料报告 + * @return 来料检验集合 + */ + public List selectQcCheckReportIncomeList(QcCheckReportIncome qcCheckReportIncome); + + /** + * 新增来料报告 + * + * @param qcCheckReportIncome 来料报告 + * @return 结果 + */ + public int insertQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome); + + /** + * 修改来料报告 + * + * @param qcCheckReportIncome 来料报告 + * @return 结果 + */ + public int updateQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome); + + /** + * 批量删除来料报告 + * + * @param recordIds 需要删除的来料报告主键集合 + * @return 结果 + */ + public int deleteQcCheckReportIncomeByRecordIds(String[] recordIds); + + /** + * 删除来料报告信息 + * + * @param recordId 来料报告主键 + * @return 结果 + */ + public int deleteQcCheckReportIncomeByRecordId(String recordId); + + public List getQcListBom(QcBomComponent bomComponent); + + public List getQcListSupplier(QcSupplier qcSupplier); + + public List getQcListUser(SysUser sysUser); + + int updateIncomeStatus(QcCheckReportIncome qcCheckReportIncome); + + List getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail); + + public List getPrintData(QcCheckReportIncome qcCheckReportIncome); + +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckReportFirstServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckReportFirstServiceImpl.java new file mode 100644 index 00000000..1e243b33 --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckReportFirstServiceImpl.java @@ -0,0 +1,207 @@ +package com.op.quality.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.op.common.core.utils.DateUtils; +import com.op.common.core.utils.uuid.IdUtils; +import com.op.common.security.utils.SecurityUtils; +import com.op.quality.domain.*; +import com.op.quality.mapper.QcCheckReportIncomeMapper; +import com.op.quality.mapper.QcCheckTaskDetailMapper; +import com.op.quality.mapper.QcCheckTypeProjectMapper; +import com.op.quality.mapper.QcMaterialGroupDetailMapper; +import com.op.quality.service.IQcCheckReportFirstService; +import com.op.quality.service.IQcCheckReportIncomeService; +import com.op.system.api.domain.SysUser; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.List; + +/** + * 来料检验Service业务层处理 + * + * @author Open Platform + * @date 2023-10-19 + */ +@Service +public class QcCheckReportFirstServiceImpl implements IQcCheckReportFirstService { + @Autowired + private QcCheckReportIncomeMapper qcCheckReportIncomeMapper; + + @Autowired + private QcCheckTypeProjectMapper qcCheckTypeProjectMapper; + + @Autowired + private QcMaterialGroupDetailMapper qcMaterialGroupDetailMapper; + + @Autowired + private QcCheckTaskDetailMapper qcCheckTaskDetailMapper; + + /** + * 查询来料检验 + * + * @param recordId 来料检验主键 + * @return 来料检验 + */ + @Override + @DS("#header.poolName") + public QcCheckReportIncome selectQcCheckReportIncomeByRecordId(String recordId) { + return qcCheckReportIncomeMapper.selectQcCheckReportIncomeByRecordId(recordId); + } + + /** + * 查询来料检验列表 + * + * @param qcCheckReportIncome 来料检验 + * @return 来料检验 + */ + @Override + @DS("#header.poolName") + public List selectQcCheckReportIncomeList(QcCheckReportIncome qcCheckReportIncome) { + qcCheckReportIncome.setDelFlag("0"); + qcCheckReportIncome.setTypeCode("produce"); + qcCheckReportIncome.setCheckType("checkTypeSC"); + return qcCheckReportIncomeMapper.selectQcCheckReportIncomeList(qcCheckReportIncome); + } + + /** + * 新增来料检验 + * + * @param qcCheckReportIncome 来料检验 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int insertQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome) { + + String bpDD = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate()); + int liushuiNum = qcCheckReportIncomeMapper.getTodayMaxNum(qcCheckReportIncome); + String liushuiStr = String.format("%04d", liushuiNum); + + String createBy = SecurityUtils.getUsername(); + Date nowDate= DateUtils.getNowDate(); + //获取当前所选工厂 + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + String factoryCode = request.getHeader(key.substring(8)).replace("ds_",""); + + qcCheckReportIncome.setCheckNo(bpDD+liushuiStr); + + /**qc_check_task_income**/ + String beLongId = IdUtils.fastSimpleUUID(); + qcCheckReportIncome.setRecordId(beLongId); + qcCheckReportIncome.setFactoryCode(factoryCode); + qcCheckReportIncome.setCreateTime(nowDate); + qcCheckReportIncomeMapper.insertQcCheckReportIncome(qcCheckReportIncome); + + /**取检测项**/ + QcCheckTypeProject qctp= new QcCheckTypeProject(); + qctp.setTypeId(qcCheckReportIncome.getCheckType());//生产过程检验 + qctp.setMaterialCode(qcCheckReportIncome.getMaterialCode());//特性 + /**qc_check_type_project**/ + List items = qcCheckTypeProjectMapper.getTPByTypeMaterial(qctp); + if(CollectionUtils.isEmpty(items)){ + /**qc_material_group_detail**/ + QcMaterialGroupDetail group = qcMaterialGroupDetailMapper.getGroupByMaterial(qcCheckReportIncome.getMaterialCode()); + if(group == null){ + return 0;//没有找到检测项目 + } + qctp.setGroupId(group.getGroupId());//共性 + items = qcCheckTypeProjectMapper.getTPByTypeGroup(qctp); + } + + /**qc_check_task_detail**/ + if(CollectionUtils.isEmpty(items)){ + return 0;//没有找到检测项目 + } + + for(QcCheckTaskDetail item:items){ + item.setRecordId(IdUtils.fastSimpleUUID()); + item.setBelongTo(beLongId); + item.setCreateTime(nowDate); + item.setCreateBy(createBy); + item.setFactoryCode(factoryCode); + item.setStatus("N"); + } + return qcCheckTaskDetailMapper.addBatch(items); + } + + /** + * 修改来料检验 + * + * @param qcCheckReportIncome 来料检验 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int updateQcCheckReportIncome(QcCheckReportIncome qcCheckReportIncome) { + qcCheckReportIncome.setUpdateTime(DateUtils.getNowDate()); + return qcCheckReportIncomeMapper.updateQcCheckReportIncome(qcCheckReportIncome); + } + + /** + * 批量删除来料检验 + * + * @param recordIds 需要删除的来料检验主键 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int deleteQcCheckReportIncomeByRecordIds(String[] recordIds) { + return qcCheckReportIncomeMapper.deleteQcCheckReportIncomeByRecordIds(recordIds); + } + + /** + * 删除来料检验信息 + * + * @param recordId 来料检验主键 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int deleteQcCheckReportIncomeByRecordId(String recordId) { + return qcCheckReportIncomeMapper.deleteQcCheckReportIncomeByRecordId(recordId); + } + + @Override + @DS("#header.poolName") + public List getQcListBom(QcBomComponent bomComponent) { + return qcCheckReportIncomeMapper.getQcListBom(bomComponent); + } + + @Override + @DS("#header.poolName") + public List getQcListSupplier(QcSupplier qcSupplier) { + return qcCheckReportIncomeMapper.getQcListSupplier(qcSupplier); + } + + @Override + @DS("master") + public List getQcListUser(SysUser sysUser) { + return qcCheckReportIncomeMapper.getQcListUser(sysUser); + } + + @Override + @DS("#header.poolName") + public int updateIncomeStatus(QcCheckReportIncome qcCheckReportIncome) { + return qcCheckReportIncomeMapper.updateQcCheckReportIncome(qcCheckReportIncome); + } + + @Override + @DS("#header.poolName") + public List getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail) { + return qcCheckReportIncomeMapper.getCkeckProjectList(qcCheckTaskDetail); + } + + @Override + @DS("#header.poolName") + public List getPrintData(QcCheckReportIncome qcCheckReportIncome) { + return null; + } + +} diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml index a7dd6cec..4b7f9f48 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml @@ -74,6 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and CONVERT(varchar(30),qct.check_time, 120) >= #{checkTimeStart} and #{checkTimeEnd} > CONVERT(varchar(30),qct.check_time, 120) and q.type_code = #{typeCode} + and qct.check_type = #{checkType}