From 4e71868a76da8c9a7fe68dff486af0fa5bb16f3e Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Fri, 13 Dec 2024 16:58:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81=E4=B8=BB=E9=94=AE=E8=B7=9F?= =?UTF-8?q?=E8=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/MesReportWorksController.java | 41 +++- .../com/op/mes/domain/MesProductTrace.java | 222 ++++++++++++++++++ .../op/mes/domain/MesProductTraceBCExp.java | 111 +++++++++ .../op/mes/domain/MesProductTraceCPExp.java | 171 ++++++++++++++ .../op/mes/mapper/MesReportWorkMapper.java | 8 + .../mes/service/IMesReportWorksService.java | 3 + .../impl/MesReportWorksServiceImpl.java | 65 +++++ .../mapper/mes/MesReportWorkMapper.xml | 105 +++++++++ .../controller/QcStaticTableController.java | 2 +- 9 files changed, 726 insertions(+), 2 deletions(-) create mode 100644 op-modules/op-mes/src/main/java/com/op/mes/domain/MesProductTrace.java create mode 100644 op-modules/op-mes/src/main/java/com/op/mes/domain/MesProductTraceBCExp.java create mode 100644 op-modules/op-mes/src/main/java/com/op/mes/domain/MesProductTraceCPExp.java diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/MesReportWorksController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/MesReportWorksController.java index 48844694..c789aff9 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/controller/MesReportWorksController.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/MesReportWorksController.java @@ -1,17 +1,22 @@ package com.op.mes.controller; import com.op.common.core.domain.R; +import com.op.common.core.utils.bean.BeanUtils; +import com.op.common.core.utils.poi.ExcelUtil; import com.op.common.core.web.controller.BaseController; import com.op.common.core.web.page.TableDataInfo; import com.op.common.security.annotation.RequiresPermissions; -import com.op.mes.domain.MesReportWork; +import com.op.mes.domain.*; import com.op.mes.service.IMesReportWorksService; +import com.op.common.core.utils.bean.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; import java.util.List; import static com.op.common.core.utils.PageUtils.startPage; @@ -41,4 +46,38 @@ public class MesReportWorksController extends BaseController { public R mesProTask() { return mesReportWorksService.mesProTask(); } + + /**产品主键跟踪**/ + @GetMapping("/getProductTrace") + public TableDataInfo getProductTrace(MesProductTrace dto) { + startPage(); + List list = mesReportWorksService.getProductTrace(dto); + return getDataTable(list); + } + @PostMapping("/getProductTraceExport") + public void processFinishExport(HttpServletResponse response, MesProductTrace qo) { + List list0 = mesReportWorksService.getProductTrace(qo); + if("cp".equals(qo.getProdType())){ + List list = new ArrayList<>(); + MesProductTraceCPExp cpdto = null; + for(MesProductTrace dto0:list0){ + cpdto = new MesProductTraceCPExp(); + BeanUtils.copyProperties(dto0,cpdto); + list.add(cpdto); + } + ExcelUtil util = new ExcelUtil(MesProductTraceCPExp.class); + util.exportExcel(response, list, "产品主键跟踪"); + }else{ + List list = new ArrayList<>(); + MesProductTraceBCExp cpdto = null; + for(MesProductTrace dto0:list0){ + cpdto = new MesProductTraceBCExp(); + BeanUtils.copyProperties(dto0,cpdto); + list.add(cpdto); + } + ExcelUtil util = new ExcelUtil(MesProductTraceBCExp.class); + util.exportExcel(response, list, "产品主键跟踪"); + } + + } } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/MesProductTrace.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/MesProductTrace.java new file mode 100644 index 00000000..bd0c06ea --- /dev/null +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/MesProductTrace.java @@ -0,0 +1,222 @@ +package com.op.mes.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.op.common.core.annotation.Excel; +import com.op.common.core.web.domain.BaseEntity; + +import java.util.Date; + +/** + * + * @author Open Platform + * @date 2024-12-12 + */ +public class MesProductTrace extends BaseEntity { + private static final long serialVersionUID = 1L; + @Excel(name = "产品编码") + private String productCode; + @Excel(name = "产品中文名称") + private String productDescZh; + @Excel(name = "产品英文名称") + private String productDescEn; + @Excel(name = "最大批次数量") + private String batchMax; + @Excel(name = "卡板装载量") + private String palletNum; + @Excel(name = "箱码规格") + private String spec; + @Excel(name = "品类") + private String productGroupName; + @Excel(name = "子母工单比例") + private String unity; + @Excel(name = "检验标准") + private String standarNo; + @Excel(name = "箱型") + private String boxType; + @Excel(name = "垛型") + private String packType; + + private String cpkType; + @Excel(name = "CPK品类") + private String cpkTypeName; + @Excel(name = "检验周期") + private String warehouseCycle; + @Excel(name = "产线") + private String lineNames; + @Excel(name = "区位") + private String waNames; + private String waCode; + @Excel(name = "上载到MES时间") + private String onLineTimes; + private String ymArrayStart; + private String ymArrayEnd; + private String prodType; + + public String getYmArrayStart() { + return ymArrayStart; + } + + public void setYmArrayStart(String ymArrayStart) { + this.ymArrayStart = ymArrayStart; + } + + public String getYmArrayEnd() { + return ymArrayEnd; + } + + public void setYmArrayEnd(String ymArrayEnd) { + this.ymArrayEnd = ymArrayEnd; + } + + public String getWaNames() { + return waNames; + } + + public void setWaNames(String waNames) { + this.waNames = waNames; + } + + public String getLineNames() { + return lineNames; + } + + public void setLineNames(String lineNames) { + this.lineNames = lineNames; + } + + public String getWaCode() { + return waCode; + } + + public void setWaCode(String waCode) { + this.waCode = waCode; + } + + public String getOnLineTimes() { + return onLineTimes; + } + + public void setOnLineTimes(String onLineTimes) { + this.onLineTimes = onLineTimes; + } + + public String getProdType() { + return prodType; + } + + public void setProdType(String prodType) { + this.prodType = prodType; + } + + public String getWarehouseCycle() { + return warehouseCycle; + } + + public void setWarehouseCycle(String warehouseCycle) { + this.warehouseCycle = warehouseCycle; + } + + public String getProductCode() { + return productCode; + } + + public void setProductCode(String productCode) { + this.productCode = productCode; + } + + public String getProductDescZh() { + return productDescZh; + } + + public void setProductDescZh(String productDescZh) { + this.productDescZh = productDescZh; + } + + public String getProductDescEn() { + return productDescEn; + } + + public void setProductDescEn(String productDescEn) { + this.productDescEn = productDescEn; + } + + public String getBatchMax() { + return batchMax; + } + + public void setBatchMax(String batchMax) { + this.batchMax = batchMax; + } + + public String getPalletNum() { + return palletNum; + } + + public void setPalletNum(String palletNum) { + this.palletNum = palletNum.replace(".00",""); + } + + public String getSpec() { + return spec; + } + + public void setSpec(String spec) { + this.spec = spec.replace(".0000",""); + } + + public String getProductGroupName() { + return productGroupName; + } + + public void setProductGroupName(String productGroupName) { + this.productGroupName = productGroupName; + } + + public String getUnity() { + return unity; + } + + public void setUnity(String unity) { + this.unity = unity; + } + + public String getStandarNo() { + return standarNo; + } + + public void setStandarNo(String standarNo) { + this.standarNo = standarNo; + } + + public String getBoxType() { + return boxType; + } + + public void setBoxType(String boxType) { + this.boxType = boxType; + } + + public String getPackType() { + return packType; + } + + public void setPackType(String packType) { + this.packType = packType; + } + + public String getCpkType() { + return cpkType; + } + + public void setCpkType(String cpkType) { + this.cpkType = cpkType; + } + + public String getCpkTypeName() { + return cpkTypeName; + } + + public void setCpkTypeName(String cpkTypeName) { + this.cpkTypeName = cpkTypeName; + } +} diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/MesProductTraceBCExp.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/MesProductTraceBCExp.java new file mode 100644 index 00000000..a17d3a07 --- /dev/null +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/MesProductTraceBCExp.java @@ -0,0 +1,111 @@ +package com.op.mes.domain; + +import com.op.common.core.annotation.Excel; +import com.op.common.core.web.domain.BaseEntity; + +/** + * + * @author Open Platform + * @date 2024-12-12 + */ +public class MesProductTraceBCExp extends BaseEntity { + private static final long serialVersionUID = 1L; + @Excel(name = "产品编码") + private String productCode; + @Excel(name = "产品中文名称") + private String productDescZh; + @Excel(name = "卡板装载量") + private String palletNum; + private String spec; + @Excel(name = "品类") + private String productGroupName; + @Excel(name = "检验标准") + private String standarNo; + @Excel(name = "检验周期") + private String warehouseCycle; + @Excel(name = "区位") + private String waNames; + private String waCode; + @Excel(name = "上载到MES时间") + private String onLineTimes; + + public String getProductCode() { + return productCode; + } + + public void setProductCode(String productCode) { + this.productCode = productCode; + } + + public String getProductDescZh() { + return productDescZh; + } + + public void setProductDescZh(String productDescZh) { + this.productDescZh = productDescZh; + } + + public String getPalletNum() { + return palletNum; + } + + public void setPalletNum(String palletNum) { + this.palletNum = palletNum; + } + + public String getSpec() { + return spec; + } + + public void setSpec(String spec) { + this.spec = spec; + } + + public String getProductGroupName() { + return productGroupName; + } + + public void setProductGroupName(String productGroupName) { + this.productGroupName = productGroupName; + } + + public String getStandarNo() { + return standarNo; + } + + public void setStandarNo(String standarNo) { + this.standarNo = standarNo; + } + + public String getWarehouseCycle() { + return warehouseCycle; + } + + public void setWarehouseCycle(String warehouseCycle) { + this.warehouseCycle = warehouseCycle; + } + + public String getWaNames() { + return waNames; + } + + public void setWaNames(String waNames) { + this.waNames = waNames; + } + + public String getWaCode() { + return waCode; + } + + public void setWaCode(String waCode) { + this.waCode = waCode; + } + + public String getOnLineTimes() { + return onLineTimes; + } + + public void setOnLineTimes(String onLineTimes) { + this.onLineTimes = onLineTimes; + } +} diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/MesProductTraceCPExp.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/MesProductTraceCPExp.java new file mode 100644 index 00000000..bfa41f68 --- /dev/null +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/MesProductTraceCPExp.java @@ -0,0 +1,171 @@ +package com.op.mes.domain; + +import com.op.common.core.annotation.Excel; +import com.op.common.core.web.domain.BaseEntity; + +/** + * + * @author Open Platform + * @date 2024-12-12 + */ +public class MesProductTraceCPExp extends BaseEntity { + private static final long serialVersionUID = 1L; + @Excel(name = "产品编码") + private String productCode; + @Excel(name = "产品中文名称") + private String productDescZh; + @Excel(name = "产品英文名称") + private String productDescEn; + @Excel(name = "最大批次数量") + private String batchMax; + @Excel(name = "卡板装载量") + private String palletNum; + @Excel(name = "箱码规格") + private String spec; + @Excel(name = "品类") + private String productGroupName; + @Excel(name = "子母工单比例") + private String unity; + @Excel(name = "检验标准") + private String standarNo; + @Excel(name = "箱型") + private String boxType; + @Excel(name = "垛型") + private String packType; + + private String cpkType; + @Excel(name = "CPK品类") + private String cpkTypeName; + + @Excel(name = "产线") + private String lineNames; + + @Excel(name = "上载到MES时间") + private String onLineTimes; + + + + + public String getLineNames() { + return lineNames; + } + + public void setLineNames(String lineNames) { + this.lineNames = lineNames; + } + + + + public String getOnLineTimes() { + return onLineTimes; + } + + public void setOnLineTimes(String onLineTimes) { + this.onLineTimes = onLineTimes; + } + + + public String getProductCode() { + return productCode; + } + + public void setProductCode(String productCode) { + this.productCode = productCode; + } + + public String getProductDescZh() { + return productDescZh; + } + + public void setProductDescZh(String productDescZh) { + this.productDescZh = productDescZh; + } + + public String getProductDescEn() { + return productDescEn; + } + + public void setProductDescEn(String productDescEn) { + this.productDescEn = productDescEn; + } + + public String getBatchMax() { + return batchMax; + } + + public void setBatchMax(String batchMax) { + this.batchMax = batchMax; + } + + public String getPalletNum() { + return palletNum; + } + + public void setPalletNum(String palletNum) { + this.palletNum = palletNum.replace(".00",""); + } + + public String getSpec() { + return spec; + } + + public void setSpec(String spec) { + this.spec = spec.replace(".0000",""); + } + + public String getProductGroupName() { + return productGroupName; + } + + public void setProductGroupName(String productGroupName) { + this.productGroupName = productGroupName; + } + + public String getUnity() { + return unity; + } + + public void setUnity(String unity) { + this.unity = unity; + } + + public String getStandarNo() { + return standarNo; + } + + public void setStandarNo(String standarNo) { + this.standarNo = standarNo; + } + + public String getBoxType() { + return boxType; + } + + public void setBoxType(String boxType) { + this.boxType = boxType; + } + + public String getPackType() { + return packType; + } + + public void setPackType(String packType) { + this.packType = packType; + } + + public String getCpkType() { + return cpkType; + } + + public void setCpkType(String cpkType) { + this.cpkType = cpkType; + } + + public String getCpkTypeName() { + return cpkTypeName; + } + + public void setCpkTypeName(String cpkTypeName) { + this.cpkTypeName = cpkTypeName; + } +} diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkMapper.java index c74f0cf7..dd97e237 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkMapper.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkMapper.java @@ -206,4 +206,12 @@ public interface MesReportWorkMapper { List> getPlanNumber(String shiftId); List getUnionRemark(String workorderCode); + + List getProductTraceCP(MesProductTrace dto); + + List getProductTraceBC(MesProductTrace dto); + + List getWorkList(MesProductTrace qo); + + List getWaList(MesProductTrace qo); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/IMesReportWorksService.java b/op-modules/op-mes/src/main/java/com/op/mes/service/IMesReportWorksService.java index 942509ef..32f98d6e 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/IMesReportWorksService.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/IMesReportWorksService.java @@ -1,6 +1,7 @@ package com.op.mes.service; import com.op.common.core.domain.R; +import com.op.mes.domain.MesProductTrace; import com.op.mes.domain.MesReportWork; import java.util.List; @@ -10,4 +11,6 @@ public interface IMesReportWorksService { List getReportWorksList(MesReportWork mesReportWork); R mesProTask(); + + List getProductTrace(MesProductTrace dto); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorksServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorksServiceImpl.java index a2a860a7..ef803cc6 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorksServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorksServiceImpl.java @@ -9,6 +9,7 @@ import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.StringUtils; import com.op.common.core.utils.bean.BeanUtils; import com.op.common.core.web.domain.AjaxResult; +import com.op.mes.domain.MesProductTrace; import com.op.mes.domain.MesReportWork; import com.op.mes.domain.ProOrderWorkorder; import com.op.mes.mapper.MesReportWorkMapper; @@ -33,6 +34,7 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Collectors; import static com.op.common.core.web.domain.AjaxResult.error; import static com.op.common.core.web.domain.AjaxResult.success; @@ -82,6 +84,69 @@ public class MesReportWorksServiceImpl implements IMesReportWorksService { } return R.ok(); } + + @Override + @DS("#header.poolName") + public List getProductTrace(MesProductTrace qo) { + List dtos = null; + if("cp".equals(qo.getProdType())){ + dtos = mesReportWorkMapper.getProductTraceCP(qo); + //产线//上载mes时间 + for(MesProductTrace dto:dtos){ + qo.setProductCode(dto.getProductCode()); + List lines = mesReportWorkMapper.getWorkList(qo); + List rlineArray = lines.stream() + .map(ProOrderWorkorder::getWorkorderName) + .collect(Collectors.toSet()) // 去重 + .stream() + .collect(Collectors.toList()); + Collections.sort(rlineArray); + dto.setLineNames(String.join(";", rlineArray)); + + List rdate = lines.stream() + .map(ProOrderWorkorder::getProductDateStart) + .collect(Collectors.toSet()) // 去重 + .stream() + .collect(Collectors.toList()); // 连接成字符串 + Collections.sort(rdate); + Collections.reverse(rdate); + if(rdate.size()>7){ + dto.setOnLineTimes(String.join(";", rdate.subList(0,7))); + }else{ + dto.setOnLineTimes(String.join(";", rdate)); + } + + } + }else{ + dtos = mesReportWorkMapper.getProductTraceBC(qo); + //区位//上载mes时间 + for(MesProductTrace dto:dtos){ + qo.setProductCode(dto.getProductCode()); + List was = mesReportWorkMapper.getWaList(qo); + List rwaArray = was.stream() + .map(ProOrderWorkorder::getWorkorderName) + .collect(Collectors.toSet()) // 去重 + .stream() + .collect(Collectors.toList()); // 连接成字符串 + Collections.sort(rwaArray); + dto.setWaNames(String.join(";", rwaArray)); + + List rdate = was.stream() + .map(ProOrderWorkorder::getProductDateStart) + .collect(Collectors.toSet()) // 去重 + .stream() + .collect(Collectors.toList()); // 连接成字符串 + Collections.sort(rdate); + Collections.reverse(rdate); + if(rdate.size()>7){ + dto.setOnLineTimes(String.join(";", rdate.subList(0,7))); + }else{ + dto.setOnLineTimes(String.join(";", rdate)); + } + } + } + return dtos; + } public void setMesProInfoFunc(String poolName){ DynamicDataSourceContextHolder.push(poolName);// 这是数据源的key //工厂名称 diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml index 5b8ffb94..5b2c2793 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml @@ -1086,6 +1086,111 @@ WHERE + + + + insert into mes_report_work 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 e20eefc4..707bd226 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 @@ -777,7 +777,7 @@ public class QcStaticTableController extends BaseController { excelCols.add(new ExcelCol("线体名称", "equipmentName", 30)); excelCols.add(new ExcelCol("产品编码", "materialCode", 30)); excelCols.add(new ExcelCol("产品名称", "materialName", 30)); - excelCols.add(new ExcelCol("CPK品类", "packTypeName", 30)); + excelCols.add(new ExcelCol("CPK品类", "cpkTypeName", 30)); excelCols.add(new ExcelCol("工单编码", "workorderCode", 30)); excelCols.add(new ExcelCol("批次", "batchNo", 30)); excelCols.add(new ExcelCol("订单编码", "workorderCodeSap", 30));