From 2b16e9e96df621c30411bb81e774895a67b5ea02 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Mon, 20 Nov 2023 09:47:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A8=E9=87=8F=E6=8A=A5=E8=A1=A8=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DeviceTaskServiceImpl.java | 2 +- .../QcCheckReportIncomeController.java | 6 +- .../QcCheckReportProduceController.java | 6 +- .../QcCheckReportProductController.java | 6 +- .../controller/QcStaticTableController.java | 17 ++ .../com/op/quality/domain/QcStaticTable.java | 186 +++++++++++------- .../quality/mapper/QcStaticTableMapper.java | 10 +- .../impl/QcStaticTableServiceImpl.java | 75 ++++++- .../mapper/quality/QcStaticTableMapper.xml | 52 ++++- 9 files changed, 270 insertions(+), 90 deletions(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java index 796cfe9d..cad366f0 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java @@ -244,7 +244,7 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService { private int createOrderPlan(EquPlan plan){ Date nowtime = DateUtils.getNowDate(); - String createBy = SecurityUtils.getUsername(); + String createBy = "job"; int sce = 0; /**equ_plan->equ_order********************************************************************/ EquOrder order = new EquOrder(); 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 712a0780..80182e83 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 @@ -44,13 +44,13 @@ public class QcCheckReportIncomeController extends BaseController { public TableDataInfo list(QcCheckReportIncome qcCheckReportIncome) { //默认时间范围T 00:00:00~T+1 00:00:00 - if(StringUtils.isEmpty(qcCheckReportIncome.getIncomeTimeStart())){ - qcCheckReportIncome.setIncomeTimeStart(DateUtils.getDate()+" 00:00:00");//start + 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)+" 00:00:00"; - qcCheckReportIncome.setIncomeTimeEnd(dateEndStr);//end + qcCheckReportIncome.setCheckTimeEnd(dateEndStr);//end } // if(StringUtils.isEmpty(qcCheckReportIncome.getCheckTimeStart())){ 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 3bc6bd59..da833bb8 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 @@ -44,13 +44,13 @@ public class QcCheckReportProduceController extends BaseController { public TableDataInfo list(QcCheckReportIncome qcCheckReportIncome) { //默认时间范围T 00:00:00~T+1 00:00:00 - if(StringUtils.isEmpty(qcCheckReportIncome.getIncomeTimeStart())){ - qcCheckReportIncome.setIncomeTimeStart(DateUtils.getDate()+" 00:00:00");//start + 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)+" 00:00:00"; - qcCheckReportIncome.setIncomeTimeEnd(dateEndStr);//end + qcCheckReportIncome.setCheckTimeEnd(dateEndStr);//end } startPage(); 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 2c097d62..37021e76 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 @@ -44,13 +44,13 @@ public class QcCheckReportProductController extends BaseController { public TableDataInfo list(QcCheckReportIncome qcCheckReportIncome) { //默认时间范围T 00:00:00~T+1 00:00:00 - if(StringUtils.isEmpty(qcCheckReportIncome.getIncomeTimeStart())){ - qcCheckReportIncome.setIncomeTimeStart(DateUtils.getDate()+" 00:00:00");//start + 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)+" 00:00:00"; - qcCheckReportIncome.setIncomeTimeEnd(dateEndStr);//end + qcCheckReportIncome.setCheckTimeEnd(dateEndStr);//end } // if(StringUtils.isEmpty(qcCheckReportIncome.getCheckTimeStart())){ 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 d5edb2a2..71b5a8b1 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 @@ -1,7 +1,13 @@ package com.op.quality.controller; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.Arrays; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.op.common.core.utils.DateUtils; +import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -39,6 +45,17 @@ public class QcStaticTableController extends BaseController { @RequiresPermissions("quality:qcTableIncome:list") @GetMapping("/getIncomeTableList") public TableDataInfo getIncomeTableList(QcStaticTable qcStaticTable) { + if(StringUtils.isNotBlank(qcStaticTable.getSupplierCode())){ + List codes = Arrays.asList(qcStaticTable.getSupplierCode().split(",")); + qcStaticTable.setSupplierCodes(codes); + } + //默认时间范围T 00:00:00~T+1 00:00:00 + if(StringUtils.isEmpty(qcStaticTable.getYearMonth())){ + LocalDate date = LocalDate.now(); + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM"); + String ymStr = dtf.format(date); + qcStaticTable.setYearMonth(ymStr);//end + } startPage(); List list = qcStaticTableService.selectQcStaticTableList(qcStaticTable); return getDataTable(list); 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 742f7b0b..8fd2e8a3 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 @@ -1,123 +1,159 @@ package com.op.quality.domain; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; import com.op.common.core.annotation.Excel; import com.op.common.core.web.domain.BaseEntity; +import java.util.List; + /** * 质量系统报对象 qc_static_table - * + * * @author Open Platform * @date 2023-11-08 */ public class QcStaticTable extends BaseEntity { private static final long serialVersionUID = 1L; - /** ID */ - private String id; + private String supplierId; + + @Excel(name = "供应商编号") + private String supplierCode; + + @Excel(name = "供应商名称") + private String supplierName; + + private List supplierCodes; + + private String yearMonth; + + private int batchs; + private int okBatchs; + private int noOkBatchs; + private int nums; + private int okNums; + private int noOkNums; + private String typeCode; + private String checkResult; + private String noOkBatchRate; + private String noOkNumRate; + + public String getNoOkNumRate() { + return noOkNumRate; + } + + public void setNoOkNumRate(String noOkNumRate) { + this.noOkNumRate = noOkNumRate; + } + + public String getNoOkBatchRate() { + return noOkBatchRate; + } + + public void setNoOkBatchRate(String noOkBatchRate) { + this.noOkBatchRate = noOkBatchRate; + } + + public int getOkBatchs() { + return okBatchs; + } + + public void setOkBatchs(int okBatchs) { + this.okBatchs = okBatchs; + } - /** 文件名称 */ - @Excel(name = "文件名称") - private String fileName; + public int getNoOkBatchs() { + return noOkBatchs; + } - /** 文件地址 */ - @Excel(name = "文件地址") - private String fileAddress; + public void setNoOkBatchs(int noOkBatchs) { + this.noOkBatchs = noOkBatchs; + } - /** 版本号 */ - @Excel(name = "版本号") - private String version; + public int getNums() { + return nums; + } - /** 备用1 */ - @Excel(name = "备用1") - private String attr1; + public void setNums(int nums) { + this.nums = nums; + } - /** 备用2 */ - @Excel(name = "备用2") - private String attr2; + public int getOkNums() { + return okNums; + } - /** 备用3 */ - @Excel(name = "备用3") - private String attr3; + public void setOkNums(int okNums) { + this.okNums = okNums; + } - /** 备用4 */ - @Excel(name = "备用4") - private String attr4; + public int getNoOkNums() { + return noOkNums; + } - public void setId(String id) { - this.id = id; + public void setNoOkNums(int noOkNums) { + this.noOkNums = noOkNums; } - public String getId() { - return id; + public String getCheckResult() { + return checkResult; } - public void setFileName(String fileName) { - this.fileName = fileName; + + public void setCheckResult(String checkResult) { + this.checkResult = checkResult; } - public String getFileName() { - return fileName; + public String getTypeCode() { + return typeCode; } - public void setFileAddress(String fileAddress) { - this.fileAddress = fileAddress; + + public void setTypeCode(String typeCode) { + this.typeCode = typeCode; } - public String getFileAddress() { - return fileAddress; + public int getBatchs() { + return batchs; } - public void setVersion(String version) { - this.version = version; + + public void setBatchs(int batchs) { + this.batchs = batchs; } - public String getVersion() { - return version; + public String getYearMonth() { + return yearMonth; } - public void setAttr1(String attr1) { - this.attr1 = attr1; + + public void setYearMonth(String yearMonth) { + this.yearMonth = yearMonth; } - public String getAttr1() { - return attr1; + public List getSupplierCodes() { + return supplierCodes; } - public void setAttr2(String attr2) { - this.attr2 = attr2; + + public void setSupplierCodes(List supplierCodes) { + this.supplierCodes = supplierCodes; } - public String getAttr2() { - return attr2; + public String getSupplierId() { + return supplierId; } - public void setAttr3(String attr3) { - this.attr3 = attr3; + + public void setSupplierId(String supplierId) { + this.supplierId = supplierId; } - public String getAttr3() { - return attr3; + public String getSupplierCode() { + return supplierCode; } - public void setAttr4(String attr4) { - this.attr4 = attr4; + + public void setSupplierCode(String supplierCode) { + this.supplierCode = supplierCode; } - public String getAttr4() { - return attr4; + public String getSupplierName() { + return supplierName; } - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("fileName", getFileName()) - .append("fileAddress", getFileAddress()) - .append("version", getVersion()) - .append("attr1", getAttr1()) - .append("attr2", getAttr2()) - .append("attr3", getAttr3()) - .append("attr4", getAttr4()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("remark", getRemark()) - .toString(); + 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 29c1483d..da364cc4 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 @@ -1,9 +1,12 @@ package com.op.quality.mapper; import java.util.List; +import java.util.Map; import com.op.quality.domain.QcStaticTable; +import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 质量系统报Mapper接口 @@ -21,5 +24,10 @@ public interface QcStaticTableMapper { * @return 质量系统报集合 */ public List selectQcStaticTableList(QcStaticTable qcStaticTable); - + @MapKey("supplierCode") + public Map selectPcMap(@Param("qc")QcStaticTable qcStaticTable, + @Param("codes")List tabledtos); + @MapKey("supplierCode") + public Map selectNumMap(@Param("qc")QcStaticTable qcStaticTable, + @Param("codes")List tabledtos); } 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 b9621b4d..cd5db056 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,6 +1,8 @@ package com.op.quality.service.impl; +import java.math.BigDecimal; import java.util.List; +import java.util.Map; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.utils.DateUtils; @@ -9,6 +11,7 @@ import org.springframework.stereotype.Service; import com.op.quality.mapper.QcStaticTableMapper; import com.op.quality.domain.QcStaticTable; import com.op.quality.service.IQcStaticTableService; +import org.springframework.util.CollectionUtils; /** * 质量系统报Service业务层处理 @@ -29,8 +32,76 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService { */ @Override @DS("#header.poolName") - public List selectQcStaticTableList(QcStaticTable qcStaticTable) { - return qcStaticTableMapper.selectQcStaticTableList(qcStaticTable); + public List selectQcStaticTableList(QcStaticTable qcStaticTable) { + qcStaticTable.setTypeCode("material"); + /**base_supplier**供应商**/ + List tabledtos = qcStaticTableMapper.selectQcStaticTableList(qcStaticTable); + if(CollectionUtils.isEmpty(tabledtos)){ + return null; + } + /**qc_check_task**总批数**/ + Map pcMap = qcStaticTableMapper.selectPcMap(qcStaticTable,tabledtos); + if(pcMap==null){ + return null; + } + /**qc_check_task**不合格批次数**/ + qcStaticTable.setCheckResult("N"); + Map noOkPcMap = qcStaticTableMapper.selectPcMap(qcStaticTable,tabledtos); + /**qc_check_task**不合格数量**/ + qcStaticTable.setCheckResult("N"); + Map noOkNumMap = qcStaticTableMapper.selectNumMap(qcStaticTable,tabledtos); + + for(QcStaticTable tabledto:tabledtos){ + QcStaticTable pcdto = pcMap.get(tabledto.getSupplierCode()); + QcStaticTable numdto = noOkPcMap.get(tabledto.getSupplierCode()); + QcStaticTable noOkNumdto = noOkNumMap.get(tabledto.getSupplierCode()); + if(pcdto!=null){ + //总批次 + tabledto.setBatchs(pcdto.getBatchs()); + //总数量 + tabledto.setNums(pcdto.getNums()); + }else{ + tabledto.setBatchs(0); + tabledto.setNums(0); + } + if(numdto!=null){ + //不合格批次 + tabledto.setNoOkBatchs(numdto.getBatchs()); + }else{ + tabledto.setNoOkBatchs(0); + } + //合格批次 + int okBatchs = tabledto.getBatchs()-tabledto.getNoOkBatchs(); + tabledto.setOkBatchs(okBatchs); + //批次合格率 + if(tabledto.getBatchs() != 0){ + BigDecimal noOkBatchRate = new BigDecimal(tabledto.getNoOkBatchs()).multiply(new BigDecimal("100.00")) + .divide(new BigDecimal(tabledto.getBatchs())) + .setScale(2,BigDecimal.ROUND_HALF_UP); + tabledto.setNoOkBatchRate(noOkBatchRate.toString()+"%"); + }else{ + tabledto.setNoOkBatchRate("0.00%"); + } + //不合格数量 + if(noOkNumdto!=null){ + tabledto.setNoOkNums(noOkNumdto.getNoOkNums()); + }else{ + tabledto.setNoOkNums(0); + } + //合格数量 + tabledto.setOkNums(tabledto.getNums()-tabledto.getNoOkNums()); + //数量不良率 + if(tabledto.getNums() != 0){ + BigDecimal noOkNumRate = new BigDecimal(tabledto.getNoOkNums()).multiply(new BigDecimal("100.00")) + .divide(new BigDecimal(tabledto.getNums())) + .setScale(2,BigDecimal.ROUND_HALF_UP); + tabledto.setNoOkNumRate(noOkNumRate.toString()+"%"); + }else{ + tabledto.setNoOkNumRate("0.00%"); + } + } + + return tabledtos; } } 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 7d51383b..d1622890 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 @@ -5,8 +5,56 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + SELECT + bs.supplier_id supplierId, + bs.supplier_code supplierCode, + bs.zh_desc supplierName + from base_supplier bs + where bs.del_flag = '0' and bs.active_flag = '1' + + and bs.supplier_code in + + #{supplierCode} + + + + +