diff --git a/op-api/op-api.iml b/op-api/op-api.iml
deleted file mode 100644
index e27a22bf9..000000000
--- a/op-api/op-api.iml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/op-common/op-common-core/op-common-core.iml b/op-common/op-common-core/op-common-core.iml
deleted file mode 100644
index f89275664..000000000
--- a/op-common/op-common-core/op-common-core.iml
+++ /dev/null
@@ -1,104 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/op-common/op-common-core/pom.xml b/op-common/op-common-core/pom.xml
index 95274fd2d..4791f75b3 100644
--- a/op-common/op-common-core/pom.xml
+++ b/op-common/op-common-core/pom.xml
@@ -112,6 +112,8 @@
io.swagger
swagger-annotations
+
+
diff --git a/op-common/op-common-core/src/main/java/com/op/common/core/utils/poi/ExcelUtil.java b/op-common/op-common-core/src/main/java/com/op/common/core/utils/poi/ExcelUtil.java
index 13bfbf5d2..0af1f9eb2 100644
--- a/op-common/op-common-core/src/main/java/com/op/common/core/utils/poi/ExcelUtil.java
+++ b/op-common/op-common-core/src/main/java/com/op/common/core/utils/poi/ExcelUtil.java
@@ -1,8 +1,10 @@
package com.op.common.core.utils.poi;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.math.BigDecimal;
@@ -20,6 +22,8 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
+
+import com.alibaba.ttl.threadpool.agent.internal.javassist.Modifier;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.RegExUtils;
import org.apache.commons.lang3.reflect.FieldUtils;
@@ -49,6 +53,7 @@ import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.op.common.core.annotation.Excel;
@@ -246,7 +251,7 @@ public class ExcelUtil {
/**
* 对excel表单默认第一个索引名转换成list
- *
+ *
* @param is 输入流
* @return 转换后集合
*/
@@ -256,7 +261,7 @@ public class ExcelUtil {
/**
* 对excel表单默认第一个索引名转换成list
- *
+ *
* @param is 输入流
* @param titleNum 标题占用行数
* @return 转换后集合
@@ -267,7 +272,7 @@ public class ExcelUtil {
/**
* 对excel表单指定表格索引名转换成list
- *
+ *
* @param sheetName 表格索引名
* @param titleNum 标题占用行数
* @param is 输入流
@@ -433,7 +438,7 @@ public class ExcelUtil {
/**
* 对list数据源将其里面的数据导入到excel表单
- *
+ *
* @return 结果
*/
public void exportExcel(HttpServletResponse response) {
@@ -481,7 +486,7 @@ public class ExcelUtil {
/**
* 填充excel数据
- *
+ *
* @param index 序号
* @param row 单元格行
*/
@@ -538,7 +543,7 @@ public class ExcelUtil {
/**
* 创建表格样式
- *
+ *
* @param wb 工作薄对象
* @return 样式列表
*/
@@ -590,7 +595,7 @@ public class ExcelUtil {
/**
* 根据Excel注解创建表格头样式
- *
+ *
* @param wb 工作薄对象
* @return 自定义样式列表
*/
@@ -620,7 +625,7 @@ public class ExcelUtil {
/**
* 根据Excel注解创建表格列样式
- *
+ *
* @param wb 工作薄对象
* @return 自定义样式列表
*/
@@ -678,7 +683,7 @@ public class ExcelUtil {
/**
* 设置单元格信息
- *
+ *
* @param value 单元格值
* @param attr 注解相关
* @param cell 单元格信息
@@ -802,7 +807,7 @@ public class ExcelUtil {
/**
* 设置 POI XSSFSheet 单元格提示或选择框
- *
+ *
* @param sheet 表单
* @param textlist 下拉框显示的内容
* @param promptContent 提示内容
@@ -835,7 +840,7 @@ public class ExcelUtil {
/**
* 设置某些列的值只能输入预制的数据,显示下拉框(兼容超出一定数量的下拉框).
- *
+ *
* @param sheet 要设置的sheet.
* @param textlist 下拉框显示的内容
* @param promptContent 提示内容
@@ -911,7 +916,7 @@ public class ExcelUtil {
/**
* 反向解析值 男=0,女=1,未知=2
- *
+ *
* @param propertyValue 参数值
* @param converterExp 翻译注解
* @param separator 分隔符
@@ -1112,7 +1117,7 @@ public class ExcelUtil {
/**
* 创建工作表
- *
+ *
* @param sheetNo sheet数量
* @param index 序号
*/
@@ -1127,7 +1132,7 @@ public class ExcelUtil {
/**
* 获取单元格值
- *
+ *
* @param row 获取的行
* @param column 获取单元格列号
* @return 单元格值
@@ -1168,7 +1173,7 @@ public class ExcelUtil {
/**
* 判断是否是空行
- *
+ *
* @param row 判断的行
* @return
*/
@@ -1187,7 +1192,7 @@ public class ExcelUtil {
/**
* 格式化不同类型的日期对象
- *
+ *
* @param dateFormat 日期格式
* @param val 被格式化的日期对象
* @return 格式化后的日期字符
@@ -1239,7 +1244,7 @@ public class ExcelUtil {
/**
* 获取对象的子列表方法
- *
+ *
* @param name 名称
* @param pojoClass 类对象
* @return 子列表方法
@@ -1256,4 +1261,63 @@ public class ExcelUtil {
}
return method;
}
+
+ public static void exportToExcel(String fileName, Class> dynamicClass, Map> mapList)
+ throws IOException, ReflectiveOperationException {
+
+ Workbook workbook = new XSSFWorkbook();
+
+ // 遍历 mapList 中的每个键值对,每个键对应一个 Sheet
+ for (Map.Entry> entry : mapList.entrySet()) {
+ String sheetName = entry.getKey();
+ List> dataList = entry.getValue();
+
+ // 创建 Sheet
+ Sheet sheet = workbook.createSheet(sheetName);
+
+ // 创建 header 行
+ Row headerRow = sheet.createRow(0);
+ Method[] methods = dynamicClass.getDeclaredMethods();
+ int colNum = 0;
+ for (Method method : methods) {
+ if (method.getName().startsWith("get") && !Modifier.isStatic(method.getModifiers())) {
+ Cell cell = headerRow.createCell(colNum++);
+ cell.setCellValue(method.getName().substring(3));
+ }
+ }
+
+ // 填充数据行
+ int rowNum = 1;
+ for (Object obj : dataList) {
+ if (dynamicClass.isInstance(obj)) { // 确保 obj 是 dynamicClass 的实例
+ Row row = sheet.createRow(rowNum++);
+ colNum = 0;
+ for (Method method : methods) {
+ if (method.getName().startsWith("get") && !Modifier.isStatic(method.getModifiers())) {
+ Cell cell = row.createCell(colNum++);
+ try {
+ Object value = method.invoke(obj);
+ cell.setCellValue(value != null ? value.toString() : "");
+ } catch (IllegalAccessException | InvocationTargetException e) {
+ // 处理反射调用异常
+ e.printStackTrace();
+ }
+ }
+ }
+ } else {
+ // 处理 obj 不是 dynamicClass 实例的情况
+ System.err.println("对象 " + obj + " 不是 " + dynamicClass.getName() + " 的实例,已跳过处理。");
+ // 跳过非实例对象,不抛出异常
+ }
+ }
+ }
+
+ // 写入到文件
+ try (FileOutputStream fileOut = new FileOutputStream(fileName)) {
+ workbook.write(fileOut);
+ } finally {
+ workbook.close();
+ }
+ }
+
}
diff --git a/op-common/op-common-datascope/op-common-datascope.iml b/op-common/op-common-datascope/op-common-datascope.iml
index dab4c8afe..47270e4b9 100644
--- a/op-common/op-common-datascope/op-common-datascope.iml
+++ b/op-common/op-common-datascope/op-common-datascope.iml
@@ -11,119 +11,4 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/EquPlanController.java b/op-modules/op-device/src/main/java/com/op/device/controller/EquPlanController.java
index b6729a343..a0412e633 100644
--- a/op-modules/op-device/src/main/java/com/op/device/controller/EquPlanController.java
+++ b/op-modules/op-device/src/main/java/com/op/device/controller/EquPlanController.java
@@ -118,7 +118,7 @@ public class EquPlanController extends BaseController {
* 导出计划列表
*/
@RequiresPermissions("device:inspectionPlan:export")
- @Log(title = "计划", businessType = BusinessType.EXPORT)
+ @Log(title = "导出计划", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EquPlan equPlan) {
List list = equPlanService.selectEquPlanList(equPlan);
@@ -139,7 +139,7 @@ public class EquPlanController extends BaseController {
* 新增计划
*/
@RequiresPermissions("device:inspectionPlan:add")
- @Log(title = "计划", businessType = BusinessType.INSERT)
+ @Log(title = "新增计划", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EquPlan equPlan) {
return equPlanService.insertEquPlan(equPlan);
@@ -149,7 +149,7 @@ public class EquPlanController extends BaseController {
* 修改计划
*/
@RequiresPermissions("device:inspectionPlan:edit")
- @Log(title = "计划", businessType = BusinessType.UPDATE)
+ @Log(title = "修改计划", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EquPlan equPlan) {
return equPlanService.updateEquPlan(equPlan);
@@ -159,7 +159,7 @@ public class EquPlanController extends BaseController {
* 删除计划
*/
@RequiresPermissions("device:inspectionPlan:remove")
- @Log(title = "计划", businessType = BusinessType.DELETE)
+ @Log(title = "删除计划", businessType = BusinessType.DELETE)
@DeleteMapping("/{planIds}")
public AjaxResult remove(@PathVariable String[] planIds) {
return equPlanService.deleteEquPlanByPlanIds(planIds);
diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquPlan.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquPlan.java
index f2d4b5032..8ffb5b7b1 100644
--- a/op-modules/op-device/src/main/java/com/op/device/domain/EquPlan.java
+++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquPlan.java
@@ -205,6 +205,9 @@ public class EquPlan extends BaseEntity {
@Excel(name = "委外原因")
private String workReason;
+ //jgy 新增 生产线体编码 每天生成线体信息的时候只生成计划生产的
+ private String lineCode;
+
public String getWorkOutsourcingUnit() {
return workOutsourcingUnit;
}
@@ -581,6 +584,14 @@ public class EquPlan extends BaseEntity {
return delFlag;
}
+ public void setLineCode(String lineCode) {
+ this.lineCode = lineCode;
+ }
+
+ public String getLineCode() {
+ return lineCode;
+ }
+
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/DeviceTaskMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/DeviceTaskMapper.java
index d812d27e2..f3b252f89 100644
--- a/op-modules/op-device/src/main/java/com/op/device/mapper/DeviceTaskMapper.java
+++ b/op-modules/op-device/src/main/java/com/op/device/mapper/DeviceTaskMapper.java
@@ -1,12 +1,8 @@
package com.op.device.mapper;
-import com.op.common.core.domain.BaseFileData;
-import com.op.device.domain.EquFile;
import com.op.device.domain.EquOrder;
import com.op.device.domain.EquPlan;
import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
import java.util.List;
/**
@@ -23,4 +19,6 @@ public interface DeviceTaskMapper {
EquOrder getNewTaskOrder(EquPlan quPlan);
EquOrder getNewTaskOrder0(EquPlan plan);
+
+ List getPlanProduceLine();//计划生产产线查询
}
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 27d3c4295..1430fd296 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
@@ -1,14 +1,12 @@
package com.op.device.service.impl;
-import com.baomidou.dynamic.datasource.annotation.DS;
+import com.alibaba.fastjson.JSONArray;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
-import com.op.common.core.context.SecurityContextHolder;
import com.op.common.core.domain.R;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.web.domain.AjaxResult;
-import com.op.common.security.utils.SecurityUtils;
import com.op.device.domain.*;
import com.op.device.mapper.*;
import com.op.device.service.IDeviceTaskService;
@@ -19,18 +17,15 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.time.LocalDate;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
+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;
@@ -253,8 +248,9 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService {
EquPlan equPlan = new EquPlan();
equPlan.setPlanType("spotInspection");
List plans = deviceTaskMapper.getPlans(equPlan);
+ List producePlans = this.confirmPlanProduceLine(plans,poolName);
- for (EquPlan plan : plans) {
+ for (EquPlan plan : producePlans) {
EquOrder hasTask = deviceTaskMapper.getNewTaskOrder(plan);
if (hasTask == null || Integer.parseInt(plan.getPlanLoop()) <= hasTask.getDays() || checkHourTask(hasTask, plan)) {
//生成点检计划
@@ -560,4 +556,48 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService {
System.out.println("------>" + batchCount);
}
+ //筛选出 当天要计划生成的数据
+ private List confirmPlanProduceLine(List plans,String poolName) {
+ //查询到当天要生产的产线
+ List planProduceLine = deviceTaskMapper.getPlanProduceLine();//计划生产产线
+ List planProduceLineCode = new ArrayList<>();
+ List produceLine = new ArrayList<>();
+
+ for(String str : planProduceLine){
+ str = str.substring(1, str.length() - 1);
+ String[] subArrays = str.split("],\\[");
+ for (String subArrayStr : subArrays) {
+ subArrayStr = subArrayStr.substring(1, subArrayStr.length() - 1);
+ String[] parts = subArrayStr.split("\",\"");
+ for (int i = 1 ; i < parts.length ; i++) {
+ if(i == parts.length - 1){
+ planProduceLineCode.add(parts[i].replaceAll("\"", ""));
+ }else{
+ planProduceLineCode.add(parts[i]);
+ }
+ }
+ }
+ }
+
+ List uniqueLineCodeList = planProduceLineCode.stream().distinct().collect(Collectors.toList());
+ List returnPlanList = new ArrayList<>();
+ if(!CollectionUtils.isEmpty(uniqueLineCodeList) && !CollectionUtils.isEmpty(plans)){
+ for(String lineCode : uniqueLineCodeList){
+ for(EquPlan equPlan : plans){
+ if(!StringUtils.isBlank(equPlan.getLineCode())){
+ if(equPlan.getLineCode().equals(lineCode)){
+ returnPlanList.add(equPlan);
+ produceLine.add(lineCode);//生成产线
+ }
+ }
+ }
+ }
+ }
+
+ produceLine = produceLine.stream().distinct().collect(Collectors.toList());
+ logger.info(poolName + "工厂今日生成的产线:" + JSONArray.toJSONString(produceLine));
+ logger.info(poolName + "工厂返回生成今日生产的产线点检计划信息:" + JSONArray.toJSONString(returnPlanList));
+ return returnPlanList;
+ }
+
}
diff --git a/op-modules/op-device/src/main/resources/mapper/device/DeviceTaskMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/DeviceTaskMapper.xml
index 038211833..42687941e 100644
--- a/op-modules/op-device/src/main/resources/mapper/device/DeviceTaskMapper.xml
+++ b/op-modules/op-device/src/main/resources/mapper/device/DeviceTaskMapper.xml
@@ -25,11 +25,18 @@
ep.plan_code planCode,
epe.equipment_code equipmentCode,
epe.equipment_name equipmentName,
+ ebae.equipment_code lineCode,
epe.id planEquId
from equ_plan ep
left join equ_plan_equ epe on ep.plan_code = epe.plan_code
+ left join equ_bind_auxiliary_equipment ebae on epe.equipment_code = ebae.auxiliary_equipment_code
where ep.del_flag = '0' and epe.del_flag = '0' and ep.plan_status = '0'
- and epe.equipment_code in ( select be.equipment_code from base_equipment be where be.del_flag = '0' )
+ and epe.equipment_code in(
+ select be.equipment_code from base_equipment be
+ left join equ_bind_auxiliary_equipment ebae0 on be.equipment_code = ebae0.auxiliary_equipment_code
+ where be.del_flag = '0'
+ and ebae0.del_flag = '0'
+ )
and ep.plan_type = #{planType}
and CONVERT(varchar(10),GETDATE(), 120) >= CONVERT(varchar(10),ep.plan_loop_start, 120)
@@ -66,4 +73,11 @@
and del_flag = '0'
order by create_time desc
+
+
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 0ac9de68a..dbfe2ce4e 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
@@ -17,7 +17,15 @@ public class H5 {
private String efficiencyAcRate;
private String feedbackTime;
private String parentOrder;
+ private String reason;
+ public String getReason() {
+ return reason;
+ }
+
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
public int getPlanProduction() {
return planProduction;
diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/H5ApiMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/H5ApiMapper.java
index 2558ac214..2b476b71c 100644
--- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/H5ApiMapper.java
+++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/H5ApiMapper.java
@@ -2,7 +2,10 @@ package com.op.mes.mapper;
import com.op.mes.domain.EnergyExpend;
import com.op.mes.domain.H5;
+import org.apache.ibatis.annotations.Param;
+
+import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@@ -21,5 +24,5 @@ public interface H5ApiMapper {
*/
public List selectMesLineProsdceLists(H5 h5);
- List EnergyExpend();
+ List EnergyExpend(@Param("startDateTime") String startDateTime, @Param("endDateTime") String endDateTime);
}
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 f274db66a..35f7ed298 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
@@ -102,8 +102,9 @@ public interface MesReportWorkMapper {
@MapKey("equCodeHour")
Map getHourProductionList(MesHourReport mesHourReport);
- //烘房当日产量00:00-24:00
- List