From b0ec8006996430a6ca203bbba14c800f5c2a3103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=81=92=E6=9D=B0?= <2658502433@qq.com> Date: Sun, 27 Apr 2025 13:53:39 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=B8=8B=E7=BA=BF?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../op/mes/service/IWcsPrintTaskService.java | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 op-modules/op-mes/src/main/java/com/op/mes/service/IWcsPrintTaskService.java diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/IWcsPrintTaskService.java b/op-modules/op-mes/src/main/java/com/op/mes/service/IWcsPrintTaskService.java new file mode 100644 index 000000000..dcab15ff8 --- /dev/null +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/IWcsPrintTaskService.java @@ -0,0 +1,61 @@ +package com.op.mes.service; + +import java.util.List; +import com.op.mes.domain.WcsPrintTask; + +/** + * 生产箱码和托盘绑定关系Service接口 + * + * @author ruoyi + * @date 2025-04-24 + */ +public interface IWcsPrintTaskService +{ + /** + * 查询生产箱码和托盘绑定关系 + * + * @param id 生产箱码和托盘绑定关系主键 + * @return 生产箱码和托盘绑定关系 + */ + public WcsPrintTask selectWcsPrintTaskById(String id); + + /** + * 查询生产箱码和托盘绑定关系列表 + * + * @param wcsPrintTask 生产箱码和托盘绑定关系 + * @return 生产箱码和托盘绑定关系集合 + */ + public List selectWcsPrintTaskList(WcsPrintTask wcsPrintTask); + + /** + * 新增生产箱码和托盘绑定关系 + * + * @param wcsPrintTask 生产箱码和托盘绑定关系 + * @return 结果 + */ + public int insertWcsPrintTask(WcsPrintTask wcsPrintTask); + + /** + * 修改生产箱码和托盘绑定关系 + * + * @param wcsPrintTask 生产箱码和托盘绑定关系 + * @return 结果 + */ + public int updateWcsPrintTask(WcsPrintTask wcsPrintTask); + + /** + * 批量删除生产箱码和托盘绑定关系 + * + * @param ids 需要删除的生产箱码和托盘绑定关系主键集合 + * @return 结果 + */ + public int deleteWcsPrintTaskByIds(String[] ids); + + /** + * 删除生产箱码和托盘绑定关系信息 + * + * @param id 生产箱码和托盘绑定关系主键 + * @return 结果 + */ + public int deleteWcsPrintTaskById(String id); +} From 9aca5a3e4803f11938acfc3d0f615cb44af6c75a Mon Sep 17 00:00:00 2001 From: Yangwl <1726150332@qq.com> Date: Sun, 27 Apr 2025 17:08:49 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=89=8B=E6=9C=BA=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../op/mes/controller/H5ApiController.java | 14 +- .../src/main/java/com/op/mes/domain/H5.java | 16 +- .../java/com/op/mes/service/H5ApiService.java | 2 +- .../op/mes/service/impl/H5ApiServiceImpl.java | 279 ++++++++++-------- 4 files changed, 174 insertions(+), 137 deletions(-) diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/H5ApiController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/H5ApiController.java index 377a0eca7..c9c871201 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/controller/H5ApiController.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/H5ApiController.java @@ -3,7 +3,10 @@ package com.op.mes.controller; import com.op.mes.domain.EnergyExpend; import com.op.mes.domain.H5; +import com.op.mes.domain.MesDailyReport; +import com.op.mes.domain.vo.MesDailyReportVo; import com.op.mes.service.H5ApiService; +import com.op.mes.service.IMesReportWorkService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -14,6 +17,8 @@ import javax.validation.constraints.Max; import java.util.List; import java.util.Map; +import static com.op.common.core.utils.PageUtils.startPage; + /** * H5接口 * @@ -26,12 +31,13 @@ public class H5ApiController { @Autowired private H5ApiService h5ApiService; - + @Autowired + private IMesReportWorkService mesReportWorkService; @GetMapping("/dailyProductDetil") - public List
list(H5 h5) + public List list(MesDailyReportVo mesDailyReportVo) { - String workTime=h5.getFeedbackTime(); - List
list = h5ApiService.dailyProductDetil(workTime); + startPage(); + List list = mesReportWorkService.getDailyReportNew(mesDailyReportVo); return list; } //能源数据 diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/H5.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/H5.java index 4681d0e3d..18b08a018 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/domain/H5.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/H5.java @@ -1,6 +1,10 @@ package com.op.mes.domain; -public class H5 { +import com.op.common.core.web.domain.BaseEntity; + +import java.util.List; + +public class H5 extends BaseEntity { private String workOrderCode; private String lineName; private String productName; @@ -20,6 +24,16 @@ public class H5 { private String reason; private String shift; + private List
children; + + public List
getChildren() { + return children; + } + + public void setChildren(List
children) { + this.children = children; + } + public String getShift() { return shift; } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/H5ApiService.java b/op-modules/op-mes/src/main/java/com/op/mes/service/H5ApiService.java index d3301bad0..e8bbdc556 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/H5ApiService.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/H5ApiService.java @@ -6,7 +6,7 @@ import java.util.List; import java.util.Map; public interface H5ApiService { - List
dailyProductDetil(String workTime); +// List
dailyProductDetil(String workTime); List EnergyExpend(); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/H5ApiServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/H5ApiServiceImpl.java index 57beb555e..6714557ff 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/H5ApiServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/H5ApiServiceImpl.java @@ -4,11 +4,15 @@ package com.op.mes.service.impl; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.mes.domain.EnergyExpend; import com.op.mes.domain.H5; +import com.op.mes.domain.MesDailyReport; import com.op.mes.mapper.H5ApiMapper; +import com.op.mes.mapper.MesReportWorkMapper; import com.op.mes.service.H5ApiService; +import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; @@ -23,142 +27,155 @@ import java.util.stream.Collectors; public class H5ApiServiceImpl implements H5ApiService { @Autowired private H5ApiMapper h5ApiMapper; + @Autowired + private MesReportWorkMapper mesReportWorkMapper; +// @Override +// @DS("#header.poolName") +// public List dailyProductDetil(String workTime) { +// +// - @Override - @DS("#header.poolName") - public List
dailyProductDetil(String workTime) { //查询当天的生产情况 - H5 h5=new H5(); - h5.setFeedbackTime(workTime); - //报工信息 - List
h5List=h5ApiMapper.selectMesLineProdceList(h5); - //报工信息处理 - //母单报工数据 - List
filteredList = h5List.stream() - .filter(h5s -> "0".equals(h5s.getParentOrder())) - .collect(Collectors.toList()); - //子单报工数据 - List
filteredLists = h5List.stream() - .filter(h5s -> !"0".equals(h5s.getParentOrder())) - .collect(Collectors.toList()); - // 按照 workOrderCode 分组,并计算各个字段的统计值 - List
resultList = filteredList.stream() - .collect(Collectors.groupingBy( - H5::getWorkOrderCode, // 按 workOrderCode 分组 - Collectors.collectingAndThen( - Collectors.toList(), - list -> { - double averageStandardStaffing = list.stream() - .collect(Collectors.averagingDouble(H5::getStandardStaffing)); - double averageActualEmployment = list.stream() - .collect(Collectors.averagingDouble(H5::getActualEmployment)); - double totalProductionDuration = list.stream() - .collect(Collectors.summingDouble(H5::getProductionDuration)); - double totalPlanProduction = list.stream() - .collect(Collectors.summingDouble(H5::getPlanProduction)); - double totalProduction = list.stream() - .collect(Collectors.summingDouble(H5::getProduction)); - - H5 resultH5 = new H5(); - resultH5.setWorkOrderCode(list.get(0).getWorkOrderCode()); // 设置 workOrderCode - resultH5.setLineName(list.get(0).getLineName()); - resultH5.setProductName(list.get(0).getProductName()); - resultH5.setCategory(list.get(0).getCategory()); - resultH5.setSpecifications(list.get(0).getSpecifications()); - resultH5.setStandardEfficiency(list.get(0).getStandardEfficiency()); - resultH5.setActualEmployment(averageActualEmployment); - resultH5.setStandardStaffing((int) Math.round(averageStandardStaffing)); // 计算的平均值 - resultH5.setProductionDuration(totalProductionDuration); // 总和 - resultH5.setPlanProduction((int) Math.round(totalPlanProduction)); // 总和 - resultH5.setProduction((int) Math.round(totalProduction)); // 总和 - resultH5.setReason(list.get(0).getReason()); - resultH5.setShift(list.get(0).getShift()); - return resultH5; - } - ) - )) - .values() - .stream() - .collect(Collectors.toList()); - - List
resultLists = filteredLists.stream() - .collect(Collectors.groupingBy( - H5::getWorkOrderCode, // 按 workOrderCode 分组 - Collectors.collectingAndThen( - Collectors.toList(), - list -> { - double averageActualEmployment =Math.round(list.stream() - .collect(Collectors.averagingDouble(H5::getActualEmployment))); - H5 resultH5 = new H5(); - resultH5.setWorkOrderCode(list.get(0).getWorkOrderCode()); // 设置 workOrderCode - resultH5.setActualEmployment(averageActualEmployment); - resultH5.setParentOrder(list.get(0).getParentOrder()); - return resultH5; - } - ) - )) - .values() - .stream() - .collect(Collectors.toList()); - - // 将 resultLists 转换为 Map,以便快速查找 - Map parentOrderToH5Map = resultLists.stream() - .collect(Collectors.toMap( - H5::getParentOrder, - h5s -> h5s - )); - - // 更新 resultList 中的 actualEmployment - // 更新 resultList 中的 actualEmployment - resultList.forEach(h51 -> { - H5 matchingH52 = parentOrderToH5Map.get(h51.getWorkOrderCode()); - if (matchingH52 != null) { - h51.setActualEmployment(matchingH52.getActualEmployment()); - } - }); - // 更新 actualEfficiency 为百分比形式,保留一位小数 - resultList.forEach(h5a -> { - double production = h5a.getProduction(); - double productionDuration = h5a.getProductionDuration(); - double actualEmployment = h5a.getActualEmployment(); - double standardEfficiency=h5a.getStandardEfficiency(); - // 避免除以零的情况 - if (productionDuration != 0 && actualEmployment != 0) { - double actualEfficiency = production / productionDuration / actualEmployment; - actualEfficiency = Math.round(actualEfficiency * 10.0) / 10.0; - h5a.setActualEfficiency(actualEfficiency); - String efficiencyAcRate = String.format("%.1f%%", (actualEfficiency/standardEfficiency)*100); // 格式化为百分比形式 - h5a.setEfficiencyAcRate(efficiencyAcRate); // 设置百分比形式 - } else { - h5a.setEfficiencyAcRate("0.0%"); // 或者设为其他默认值 - } - }); - - resultList.stream() - .forEach(h5a -> { - double production = h5a.getProduction(); - double productionDuration = h5a.getProductionDuration(); - double actualEmployment = h5a.getActualEmployment(); - double standardEfficiency = h5a.getStandardEfficiency(); - - // Avoid division by zero - if (productionDuration != 0 && actualEmployment != 0) { - double actualEfficiency = production / productionDuration / actualEmployment; - actualEfficiency = Math.round(actualEfficiency * 10.0) / 10.0; - h5a.setActualEfficiency(actualEfficiency); - - // Format efficiency as a percentage - String efficiencyAcRate = String.format("%.1f%%", (actualEfficiency / standardEfficiency) * 100); - h5a.setEfficiencyAcRate(efficiencyAcRate); - } else { - h5a.setEfficiencyAcRate("0.0%"); - } - }); +// H5 h5=new H5(); +// h5.setFeedbackTime(workTime); - return resultList; - } + +// //报工信息 +// List
h5List=h5ApiMapper.selectMesLineProdceList(h5); +//// List
resultList = new ArrayList<>(); +//// if (h5List != null && h5List.size() >0){ +//// resultList = filterParentWithChildren(h5List); +//// } +// +// +// //报工信息处理 +// //母单报工数据 +// List
filteredList = h5List.stream() +// .filter(h5s -> "0".equals(h5s.getParentOrder())) +// .collect(Collectors.toList()); +// //子单报工数据 +// List
filteredLists = h5List.stream() +// .filter(h5s -> !"0".equals(h5s.getParentOrder())) +// .collect(Collectors.toList()); +// // 按照 workOrderCode 分组,并计算各个字段的统计值 +// List
resultList = filteredList.stream() +// .collect(Collectors.groupingBy( +// H5::getWorkOrderCode, // 按 workOrderCode 分组 +// Collectors.collectingAndThen( +// Collectors.toList(), +// list -> { +// double averageStandardStaffing = list.stream() +// .collect(Collectors.averagingDouble(H5::getStandardStaffing)); +// double averageActualEmployment = list.stream() +// .collect(Collectors.averagingDouble(H5::getActualEmployment)); +// double totalProductionDuration = list.stream() +// .collect(Collectors.summingDouble(H5::getProductionDuration)); +// double totalPlanProduction = list.stream() +// .collect(Collectors.summingDouble(H5::getPlanProduction)); +// double totalProduction = list.stream() +// .collect(Collectors.summingDouble(H5::getProduction)); +// +// H5 resultH5 = new H5(); +// resultH5.setWorkOrderCode(list.get(0).getWorkOrderCode()); // 设置 workOrderCode +// resultH5.setLineName(list.get(0).getLineName()); +// resultH5.setProductName(list.get(0).getProductName()); +// resultH5.setCategory(list.get(0).getCategory()); +// resultH5.setSpecifications(list.get(0).getSpecifications()); +// resultH5.setStandardEfficiency(list.get(0).getStandardEfficiency()); +// resultH5.setActualEmployment(averageActualEmployment); +// resultH5.setStandardStaffing((int) Math.round(averageStandardStaffing)); // 计算的平均值 +// resultH5.setProductionDuration(totalProductionDuration); // 总和 +// resultH5.setPlanProduction((int) Math.round(totalPlanProduction)); // 总和 +// resultH5.setProduction((int) Math.round(totalProduction)); // 总和 +// resultH5.setReason(list.get(0).getReason()); +// resultH5.setShift(list.get(0).getShift()); +// return resultH5; +// } +// ) +// )) +// .values() +// .stream() +// .collect(Collectors.toList()); +// +// List
resultLists = filteredLists.stream() +// .collect(Collectors.groupingBy( +// H5::getWorkOrderCode, // 按 workOrderCode 分组 +// Collectors.collectingAndThen( +// Collectors.toList(), +// list -> { +// double averageActualEmployment =Math.round(list.stream() +// .collect(Collectors.averagingDouble(H5::getActualEmployment))); +// H5 resultH5 = new H5(); +// resultH5.setWorkOrderCode(list.get(0).getWorkOrderCode()); // 设置 workOrderCode +// resultH5.setActualEmployment(averageActualEmployment); +// resultH5.setParentOrder(list.get(0).getParentOrder()); +// return resultH5; +// } +// ) +// )) +// .values() +// .stream() +// .collect(Collectors.toList()); +// +// // 将 resultLists 转换为 Map,以便快速查找 +// Map parentOrderToH5Map = resultLists.stream() +// .collect(Collectors.toMap( +// H5::getParentOrder, +// h5s -> h5s +// )); +// +// // 更新 resultList 中的 actualEmployment +// resultList.forEach(h51 -> { +// H5 matchingH52 = parentOrderToH5Map.get(h51.getWorkOrderCode()); +// if (matchingH52 != null) { +// h51.setActualEmployment(matchingH52.getActualEmployment()); +// } +// }); +// // 更新 actualEfficiency 为百分比形式,保留一位小数 +// resultList.forEach(h5a -> { +// double production = h5a.getProduction(); +// double productionDuration = h5a.getProductionDuration(); +// double actualEmployment = h5a.getActualEmployment(); +// double standardEfficiency=h5a.getStandardEfficiency(); +// // 避免除以零的情况 +// if (productionDuration != 0 && actualEmployment != 0) { +// double actualEfficiency = production / productionDuration / actualEmployment; +// actualEfficiency = Math.round(actualEfficiency * 10.0) / 10.0; +// h5a.setActualEfficiency(actualEfficiency); +// String efficiencyAcRate = String.format("%.1f%%", (actualEfficiency/standardEfficiency)*100); // 格式化为百分比形式 +// h5a.setEfficiencyAcRate(efficiencyAcRate); // 设置百分比形式 +// } else { +// h5a.setEfficiencyAcRate("0.0%"); // 或者设为其他默认值 +// } +// }); +// +// resultList.stream() +// .forEach(h5a -> { +// double production = h5a.getProduction(); +// double productionDuration = h5a.getProductionDuration(); +// double actualEmployment = h5a.getActualEmployment(); +// double standardEfficiency = h5a.getStandardEfficiency(); +// +// // Avoid division by zero +// if (productionDuration != 0 && actualEmployment != 0) { +// double actualEfficiency = production / productionDuration / actualEmployment; +// actualEfficiency = Math.round(actualEfficiency * 10.0) / 10.0; +// h5a.setActualEfficiency(actualEfficiency); +// +// // Format efficiency as a percentage +// String efficiencyAcRate = String.format("%.1f%%", (actualEfficiency / standardEfficiency) * 100); +// h5a.setEfficiencyAcRate(efficiencyAcRate); +// } else { +// h5a.setEfficiencyAcRate("0.0%"); +// } +// }); +// +// +// return resultList; +// } + @Override @DS("#header.poolName") From c1b747a6712d637662809dec1fe8185bb323a08e Mon Sep 17 00:00:00 2001 From: Yangwl <1726150332@qq.com> Date: Tue, 29 Apr 2025 16:21:09 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BA=A7=E5=93=81=E8=BD=AC=E6=8D=A2/?= =?UTF-8?q?=E5=AE=8C=E4=BA=A7=E6=B8=85=E7=BA=BF=E7=82=B9=E6=A3=80=E8=A1=A8?= =?UTF-8?q?=E7=AD=89=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/mes/MesInspectionReportMapper.xml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/MesInspectionReportMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/MesInspectionReportMapper.xml index f850f1891..5b5cb3ff2 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/MesInspectionReportMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/MesInspectionReportMapper.xml @@ -171,10 +171,10 @@ select mts.id, - MAX(pow.workorder_id) AS workorder_id, - MAX(pow.product_name) AS product_name, - MAX(pow.product_code) AS product_code + mts.product_name, + mts.product_code from mes_table_self mts - left join pro_order_workorder pow on mts.line_code = pow.workorder_name - LEFT JOIN base_shifts_t bst ON pow.shift_id = bst.Shift_Id where DATEDIFF(DAY, mts.check_date, #{checkDate}) = 0 - and DATEDIFF(DAY, pow.product_date, #{checkDate}) = 0 and mts.del_flag = '0' - and pow.del_flag = '0' - and pow.parent_order = '0' - AND mts.report_name = CONCAT(#{reportName}, bst.Shift_Desc) + AND mts.report_name = CONCAT(#{reportName}, (SELECT Shift_Desc FROM base_shifts_t WHERE Shift_Id = #{shiftId})) AND mts.report_name = #{reportName} and mts.line_code = #{lineCode} - and pow.workorder_name = #{lineCode} group by - mts.id + mts.id, + mts.product_name, + mts.product_code + + select bbi.build_name buildName, sum(rpd.expend) expend + from base_build_info bbi + left join base_type_relation btr on btr.relation_id = bbi.objid + left join base_monitor_info m on m.monitor_id = btr.monitor_id + left join report_point_dnb rpd on m.monitor_id = rpd.monitor_id + where m.monitor_id is not null + and bbi.grade = #{unitId} + + and rpd.begin_time between #{beginTime} and #{endTime} + + group by bbi.build_name + order by expend desc + + + + +