From d0b97b5655a6cac1efbda08dad1d3019ed973923 Mon Sep 17 00:00:00 2001 From: Lius <Lius2225@163.com> Date: 星期三, 21 五月 2025 12:04:16 +0800 Subject: [PATCH] 设备日志批量导出 --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/WebServiceCompletedJob.java | 130 ++++++++++++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentDayScheduleServiceImpl.java | 5 lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml | 7 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentRunningSectionService.java | 7 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/EquipmentDaySummary.java | 2 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/WebServiceStartWorkJob.java | 135 ++++++++++++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java | 9 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentDayScheduleMapper.xml | 8 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/EquipmentDaySchedule.java | 11 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentDaySchedule.java | 16 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/WsEquipmentEndWork.java | 35 ++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java | 25 +++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentDayScheduleMapper.java | 2 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/CxfClientUtil.java | 1 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentWorklineMapper.java | 4 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentWorklineMapper.xml | 4 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java | 3 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentRunningSectionController.java | 8 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentDaySummary.java | 2 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentDayScheduleService.java | 3 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/WsEquipmentStartWork.java | 31 +++ 21 files changed, 434 insertions(+), 14 deletions(-) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentRunningSectionController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentRunningSectionController.java index 31ba8db..cd9422a 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentRunningSectionController.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentRunningSectionController.java @@ -4,14 +4,11 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.base.controller.JeecgController; -import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.mdc.dto.EquipmentMachingDto; import org.jeecg.modules.mdc.dto.MdcEquipmentRunningSectionDto; import org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection; -import org.jeecg.modules.mdc.entity.MdcNoplanClose; import org.jeecg.modules.mdc.service.IMdcEquipmentRunningSectionService; import org.jeecg.modules.mdc.service.IMdcEquipmentWorkLineService; import org.jeecg.modules.mdc.vo.MdcEquipmentRunningSectionVo; @@ -66,6 +63,11 @@ return equipmentRunningSectionService.exportXls(equipmentRunningSectionVo); } + @RequestMapping(value = "/batchExportLogXls") + public ModelAndView batchExportLogXls(HttpServletRequest request, MdcEquipmentRunningSectionVo equipmentRunningSectionVo) { + return equipmentRunningSectionService.batchExportXls(equipmentRunningSectionVo); + } + @ApiOperation(value = "璁惧鏃ュ織-鍘嗗彶鏌ヨ", notes = "璁惧鏃ュ織-鍘嗗彶鏌ヨ") @GetMapping("/logCharts") public Result<List<Map<String, Object>>> logCharts(MdcEquipmentRunningSectionVo equipmentRunningSectionVo){ diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentDaySchedule.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentDaySchedule.java index 301cea6..6a18f62 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentDaySchedule.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentDaySchedule.java @@ -25,7 +25,7 @@ * 涓婚敭 */ @ApiModelProperty(value = "涓婚敭") - private String medId; + private String mesId; /** * 鍗曞厓 */ @@ -87,10 +87,15 @@ @ApiModelProperty(value = "宸ュ簭鍙�") private String opreationSeqNo; /** - * 娲惧伐鏃ユ湡 + * 璁″垝寮�濮嬫椂闂� */ - @ApiModelProperty(value = "娲惧伐鏃ユ湡") - private String dispatchDate; + @ApiModelProperty(value = "璁″垝寮�濮嬫椂闂�") + private String planStartTime; + /** + * 璁″垝缁撴潫鏃堕棿 + */ + @ApiModelProperty(value = "璁″垝缁撴潫鏃堕棿") + private String planEndTime; /** * 璁惧缂栧彿 */ @@ -109,4 +114,7 @@ @TableField(exist = false) @ApiModelProperty(value = "鏄惁瀹屾垚") private String qualifiedStatus; + + @TableField(exist = false) + private String productName; } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentDaySummary.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentDaySummary.java index cd2d4fa..e1d96e0 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentDaySummary.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentDaySummary.java @@ -21,7 +21,7 @@ /** * 涓婚敭 */ - private String medId; + private String mesId; /** * 鍗曞厓 */ diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/WebServiceCompletedJob.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/WebServiceCompletedJob.java new file mode 100644 index 0000000..9729cea --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/WebServiceCompletedJob.java @@ -0,0 +1,130 @@ +package org.jeecg.modules.mdc.job; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.util.DateUtils; +import org.jeecg.common.util.RedisUtil; +import org.jeecg.modules.mdc.entity.MdcEquipment; +import org.jeecg.modules.mdc.entity.MdcEquipmentDaySchedule; +import org.jeecg.modules.mdc.service.IEquipmentWorkLineService; +import org.jeecg.modules.mdc.service.IMdcEquipmentService; +import org.jeecg.modules.mdc.util.CxfClientUtil; +import org.jeecg.modules.mdc.util.ThrowableUtil; +import org.jeecg.modules.mdc.vo.WsEquipmentEndWork; +import org.jeecg.modules.quartz.entity.QuartzJob; +import org.jeecg.modules.quartz.entity.SysQuartzLog; +import org.jeecg.modules.quartz.service.IQuartzJobService; +import org.jeecg.modules.quartz.service.ISysQuartzLogService; +import org.quartz.*; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Lazy; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * @Author: Lius + * @CreateTime: 2025-04-29 + * @Description: 瀹屽伐浠诲姟 + */ +@PersistJobDataAfterExecution +@DisallowConcurrentExecution +@Slf4j +public class WebServiceCompletedJob implements Job { + + /** + * url + */ + @Value("${webservice2.url}") + private String url; + + /** + * namespace + */ + @Value("${webservice2.namespace}") + private String namespace; + + /** + * method + */ + @Value("${webservice2.endWorkMethod}") + private String method; + + @Resource + private IQuartzJobService quartzJobService; + + @Resource + private ISysQuartzLogService sysQuartzLogService; + + @Resource + @Lazy + private RedisUtil redisUtil; + + @Resource + private IMdcEquipmentService mdcEquipmentService; + + @Resource + private IEquipmentWorkLineService equipmentWorkLineService; + + @Override + public void execute(JobExecutionContext context) throws JobExecutionException { + SysQuartzLog quartzLog = new SysQuartzLog(); + quartzLog.setCreateTime(new Date()); + List<QuartzJob> byJobClassName = this.quartzJobService.findByJobClassName(this.getClass().getName()); + if (byJobClassName != null && !byJobClassName.isEmpty()) { + quartzLog.setJobId(byJobClassName.get(0).getId()); + } + log.info("WebService涓婃姤瀹屽伐浠诲姟 WebServiceCompletedJob start! 鏃堕棿:" + DateUtils.now()); + long startTime = System.currentTimeMillis(); + try { + List<MdcEquipment> mdcEquipmentList = mdcEquipmentService.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getDriveType, "FANUC")); + if (mdcEquipmentList != null && !mdcEquipmentList.isEmpty()) { + for (MdcEquipment mdcEquipment : mdcEquipmentList) { + if (redisUtil.hasKey("work:" + mdcEquipment.getEquipmentId())) { + MdcEquipmentDaySchedule mdcEquipmentDaySchedule = (MdcEquipmentDaySchedule) redisUtil.get("work:" + mdcEquipment.getEquipmentId()); + String productName = mdcEquipmentDaySchedule.getProductName(); + Map<String, Object> dataProductName = equipmentWorkLineService.getDataProductName(mdcEquipment.getSaveTableName()); + if (dataProductName != null && !dataProductName.isEmpty()) { + if (dataProductName.containsKey("productname")) { + String proName = dataProductName.get("productname") == null ? "" : dataProductName.get("productname").toString(); + if (!productName.equals(proName)) { + //瀹屽伐 + WsEquipmentEndWork wsEquipmentEndWork = new WsEquipmentEndWork(); + wsEquipmentEndWork.setMesId(mdcEquipmentDaySchedule.getMesId()); + wsEquipmentEndWork.setWorkshop(mdcEquipmentDaySchedule.getWorkshop()); + wsEquipmentEndWork.setProcessProgress("100"); + wsEquipmentEndWork.setTaskCode(mdcEquipmentDaySchedule.getTaskCode()); + wsEquipmentEndWork.setOpreationSeqNo(mdcEquipmentDaySchedule.getOpreationSeqNo()); + wsEquipmentEndWork.setMdsItemCode(mdcEquipmentDaySchedule.getMdsItemCode()); + wsEquipmentEndWork.setEquipmentId(mdcEquipment.getEquipmentId()); + wsEquipmentEndWork.setProcessNumber(mdcEquipmentDaySchedule.getBatchNum()); + Date date = dataProductName.get("collecttime") == null ? null : (Date) dataProductName.get("collecttime"); + wsEquipmentEndWork.setEndProcessTime(date); + String s = JSONObject.toJSONString(wsEquipmentEndWork); + log.info("涓婃姤瀹屽伐鏁版嵁 ===== " + s); + String result = CxfClientUtil.invokeService(url, s, namespace, method); + log.info("涓婃姤瀹屽伐缁撴灉 ===== " + result); + if (result.contains("鎴愬姛")) { +// mdcEquipmentDaySchedule.setProductName(productName); + //寮�宸ヨ澶囧垹闄edis + redisUtil.del("work:" + mdcEquipment.getEquipmentId()); + } + } + } + } + } + } + } + quartzLog.setIsSuccess(0); + } catch (Exception e) { + quartzLog.setIsSuccess(-1); + quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e)); + } + long endTime = System.currentTimeMillis(); + quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime))); + sysQuartzLogService.save(quartzLog); + } +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/WebServiceStartWorkJob.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/WebServiceStartWorkJob.java new file mode 100644 index 0000000..400e07c --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/WebServiceStartWorkJob.java @@ -0,0 +1,135 @@ +package org.jeecg.modules.mdc.job; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.util.RedisUtil; +import org.jeecg.modules.mdc.entity.MdcEquipment; +import org.jeecg.modules.mdc.entity.MdcEquipmentDaySchedule; +import org.jeecg.modules.mdc.service.IEquipmentWorkLineService; +import org.jeecg.modules.mdc.service.IMdcEquipmentDayScheduleService; +import org.jeecg.modules.mdc.service.IMdcEquipmentService; +import org.jeecg.modules.mdc.util.CxfClientUtil; +import org.jeecg.modules.mdc.util.DateUtils; +import org.jeecg.modules.mdc.util.ThrowableUtil; +import org.jeecg.modules.mdc.vo.WsEquipmentStartWork; +import org.jeecg.modules.quartz.entity.QuartzJob; +import org.jeecg.modules.quartz.entity.SysQuartzLog; +import org.jeecg.modules.quartz.service.IQuartzJobService; +import org.jeecg.modules.quartz.service.ISysQuartzLogService; +import org.quartz.*; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Lazy; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * @Author: Lius + * @CreateTime: 2025-04-29 + * @Description: 寮�宸ヤ换鍔� + */ +@PersistJobDataAfterExecution +@DisallowConcurrentExecution +@Slf4j +public class WebServiceStartWorkJob implements Job { + + /** + * url + */ + @Value("${webservice2.url}") + private String url; + + /** + * namespace + */ + @Value("${webservice2.namespace}") + private String namespace; + + /** + * method + */ + @Value("${webservice2.startWorkMethod}") + private String method; + + @Resource + private IQuartzJobService quartzJobService; + + @Resource + private ISysQuartzLogService sysQuartzLogService; + + @Resource + private IMdcEquipmentDayScheduleService mdcEquipmentDayScheduleService; + + @Resource + private IMdcEquipmentService mdcEquipmentService; + + @Resource + @Lazy + private RedisUtil redisUtil; + + @Resource + private IEquipmentWorkLineService equipmentWorkLineService; + + @Override + public void execute(JobExecutionContext context) throws JobExecutionException { + SysQuartzLog quartzLog = new SysQuartzLog(); + quartzLog.setCreateTime(new Date()); + List<QuartzJob> byJobClassName = this.quartzJobService.findByJobClassName(this.getClass().getName()); + if (byJobClassName != null && !byJobClassName.isEmpty()) { + quartzLog.setJobId(byJobClassName.get(0).getId()); + } + log.info("WebService涓婃姤寮�宸ヤ换鍔� WebServiceStartWorkJob start! 鏃堕棿:" + DateUtils.getNow()); + long startTime = System.currentTimeMillis(); + try { + List<MdcEquipment> mdcEquipmentList = mdcEquipmentService.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getDriveType, "FANUC")); + if (mdcEquipmentList != null && !mdcEquipmentList.isEmpty()) { + for (MdcEquipment mdcEquipment : mdcEquipmentList) { + if (!redisUtil.hasKey("work:" + mdcEquipment.getEquipmentId())) { + MdcEquipmentDaySchedule mdcEquipmentDaySchedule = mdcEquipmentDayScheduleService.selectLast(mdcEquipment.getEquipmentId()); + if (mdcEquipmentDaySchedule != null) { + //鏌ヨ璁惧鍗曡〃闆朵欢鍙� + Map<String, Object> dataList = equipmentWorkLineService.getDataProductName(mdcEquipment.getSaveTableName()); + if (dataList != null) { + if (dataList.containsKey("productname")) { + String productName = dataList.get("productname") == null ? "" : dataList.get("productname").toString(); + if (productName.contains(mdcEquipmentDaySchedule.getMdsItemCode())) { + log.info("楠岃瘉鑷姩寮�宸ュ紑濮�,璁惧缂栧彿涓� ====== " + mdcEquipment.getEquipmentId()); + WsEquipmentStartWork wsEquipmentStartWork = new WsEquipmentStartWork(); + wsEquipmentStartWork.setMesId(mdcEquipmentDaySchedule.getMesId()); + wsEquipmentStartWork.setEquipmentId(mdcEquipmentDaySchedule.getEquipmentId()); + wsEquipmentStartWork.setWorkshop(mdcEquipmentDaySchedule.getWorkshop()); + wsEquipmentStartWork.setTaskCode(mdcEquipmentDaySchedule.getTaskCode()); + wsEquipmentStartWork.setOpreationSeqNo(mdcEquipmentDaySchedule.getOpreationSeqNo()); + //鑾峰彇寮�宸ユ椂闂� + Date date = dataList.get("collecttime") == null ? null : (Date) dataList.get("collecttime"); + wsEquipmentStartWork.setStartProcessTime(date); + String s = JSONObject.toJSONString(wsEquipmentStartWork); + log.info("涓婃姤寮�宸ユ暟鎹� ===== " + s); + String result = CxfClientUtil.invokeService(url, s, namespace, method); + log.info("涓婃姤寮�宸ョ粨鏋� ===== " + result); + if (result.contains("鎴愬姛")) { + mdcEquipmentDaySchedule.setProductName(productName); + //寮�宸ヨ澶囧瓨鍏edis + redisUtil.set("work:" + mdcEquipment.getEquipmentId(), mdcEquipmentDaySchedule); + } + return; + } + } + } + } + } + } + } + quartzLog.setIsSuccess(0); + } catch (Exception e) { + quartzLog.setIsSuccess(-1); + quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e)); + } + long endTime = System.currentTimeMillis(); + quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime))); + sysQuartzLogService.save(quartzLog); + } +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentWorklineMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentWorklineMapper.java index 49eef7a..5f1d20d 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentWorklineMapper.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentWorklineMapper.java @@ -48,4 +48,8 @@ @InterceptorIgnore(tenantLine = "1") Map<String, Object> getDataList(@Param("tableName") String saveTableName); + + @InterceptorIgnore(tenantLine = "1") + Map<String, Object> getDataProductName(@Param("tableName") String saveTableName); + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentDayScheduleMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentDayScheduleMapper.java index c97aa73..abd42df 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentDayScheduleMapper.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentDayScheduleMapper.java @@ -9,4 +9,6 @@ public interface MdcEquipmentDayScheduleMapper extends BaseMapper<MdcEquipmentDaySchedule> { IPage<MdcEquipmentDaySchedule> pageList(@Param("vo") MdcEquipmentDayScheduleVo mdcEquipmentDayScheduleVo, Page<MdcEquipmentDaySchedule> page); + + MdcEquipmentDaySchedule selectLast(@Param("equipmentId") String equipmentId); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentWorklineMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentWorklineMapper.xml index b356709..1b73fa7 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentWorklineMapper.xml +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentWorklineMapper.xml @@ -25,4 +25,8 @@ <select id="getDataList" resultType="java.util.Map"> select top 1 ${tableName}.* from ${tableName} order by CollectTime desc </select> + + <select id="getDataProductName" resultType="java.util.Map"> + select top 1 ${tableName}.* from ${tableName} where productname != '' order by CollectTime desc + </select> </mapper> diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentDayScheduleMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentDayScheduleMapper.xml index 60b9386..5b76e29 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentDayScheduleMapper.xml +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentDayScheduleMapper.xml @@ -16,11 +16,15 @@ ON t2.id = t3.equipment_id INNER JOIN mdc_production t4 ON t3.production_id = t4.id - WHERE TO_CHAR(t1.dispatch_date, 'YYYY-MM') = TO_CHAR(SYSDATE, 'YYYY-MM') + WHERE TO_CHAR(t1.create_time, 'YYYY-MM') = TO_CHAR(SYSDATE, 'YYYY-MM') AND t4.parent_id = #{vo.productionId} <if test="vo.proChildId != null and vo.proChildId != ''"> AND t4.id = #{vo.proChildId} </if> - ORDER BY t1.dispatch_date DESC + ORDER BY t1.create_time DESC + </select> + + <select id="selectLast" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentDaySchedule"> + SELECT TOP 1 * FROM mdc_equipment_day_schedule WHERE equipment_id = #{equipmentId} ORDER BY create_time DESC </select> </mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java index d087a46..95e9238 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java @@ -59,4 +59,7 @@ * @return */ Map<String, Object> getDataList(String saveTableName); + + Map<String, Object> getDataProductName(String saveTableName); + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentDayScheduleService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentDayScheduleService.java index f7e22f1..51c282b 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentDayScheduleService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentDayScheduleService.java @@ -7,5 +7,8 @@ import org.jeecg.modules.mdc.vo.MdcEquipmentDayScheduleVo; public interface IMdcEquipmentDayScheduleService extends IService<MdcEquipmentDaySchedule> { + IPage<MdcEquipmentDaySchedule> pageList(MdcEquipmentDayScheduleVo mdcEquipmentDayScheduleVo, Page<MdcEquipmentDaySchedule> page); + + MdcEquipmentDaySchedule selectLast(String equipmentId); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentRunningSectionService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentRunningSectionService.java index 88cde49..4f56846 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentRunningSectionService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentRunningSectionService.java @@ -94,4 +94,11 @@ */ ModelAndView exportXls(MdcEquipmentRunningSectionVo equipmentRunningSectionVo); + /** + * 鏃堕棿娈靛鍑� + * @param equipmentRunningSectionVo + * @return + */ + ModelAndView batchExportXls(MdcEquipmentRunningSectionVo equipmentRunningSectionVo); + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java index c75cd7e..7f32f3b 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java @@ -80,6 +80,15 @@ } } + @Override + public Map<String, Object> getDataProductName(String saveTableName) { + try { + return equipmentWorkLineMapper.getDataProductName(saveTableName); + } catch (Exception e) { + return null; + } + } + private List<EquipmentMachingDto> convertData(List<Map<String, Object>> list) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); List<EquipmentMachingDto> dto = new ArrayList<>(); diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentDayScheduleServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentDayScheduleServiceImpl.java index 7b91e0c..1237fb3 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentDayScheduleServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentDayScheduleServiceImpl.java @@ -47,4 +47,9 @@ } return mdcEquipmentDayScheduleIPage; } + + @Override + public MdcEquipmentDaySchedule selectLast(String equipmentId) { + return this.baseMapper.selectLast(equipmentId); + } } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java index d1ec752..77befba 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java @@ -752,6 +752,31 @@ return mv; } + @Override + public ModelAndView batchExportXls(MdcEquipmentRunningSectionVo equipmentRunningSectionVo) { + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + List<MdcEquipmentRunningSectionDto> mdcEquipmentRunningSectionDtos = new ArrayList<>(); + if (StringUtils.isNotBlank(equipmentRunningSectionVo.getStartTime()) && StringUtils.isNotBlank(equipmentRunningSectionVo.getEndTime()) ) { + Date startDate = DateUtils.toDate(equipmentRunningSectionVo.getStartTime(), DateUtils.STR_DATE); + Date endDate = DateUtils.toDate(equipmentRunningSectionVo.getEndTime(), DateUtils.STR_DATE); + List<String> datesStringList = DateUtils.getDatesStringList(startDate, endDate); + datesStringList.forEach(date -> { + equipmentRunningSectionVo.setCollectTimeStr(date); + List<MdcEquipmentRunningSectionDto> equipmentRunningSectionDtos = this.logList(equipmentRunningSectionVo); + if (equipmentRunningSectionDtos != null && !equipmentRunningSectionDtos.isEmpty()) { + mdcEquipmentRunningSectionDtos.addAll(equipmentRunningSectionDtos); + } + }); + } + // 瀵煎嚭鏂囦欢鍚嶇О + mv.addObject(NormalExcelConstants.FILE_NAME, "璁惧鏃ュ織"); + mv.addObject(NormalExcelConstants.CLASS, MdcEquipmentRunningSectionDto.class); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("璁惧鏃ュ織鍒楄〃鏁版嵁", "瀵煎嚭浜�:" + user.getRealname(), "璁惧鏃ュ織")); + mv.addObject(NormalExcelConstants.DATA_LIST, mdcEquipmentRunningSectionDtos); + return mv; + } + private Map<String, List<MdcEquipmentRunningSectionDto>> logCharts(MdcEquipmentRunningSectionVo equipmentRunningSectionVo, String date) { Map<String, List<MdcEquipmentRunningSectionDto>> map = new HashMap<>(); List<MdcEquipmentRunningSectionDto> normal = new ArrayList<>(); diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/CxfClientUtil.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/CxfClientUtil.java index cfdda96..c89efc6 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/CxfClientUtil.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/CxfClientUtil.java @@ -15,7 +15,6 @@ * 鍔ㄦ�佽皟鐢� */ public static String invokeService(String url, String data, String namespace, String method) throws Exception { - JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance(); Client client = dcf.createClient(url); QName opName = new QName(namespace, method); diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/EquipmentDaySchedule.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/EquipmentDaySchedule.java index cb471a0..2110801 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/EquipmentDaySchedule.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/EquipmentDaySchedule.java @@ -14,7 +14,7 @@ /** * 涓婚敭 */ - private String medId; + private String mesId; /** * 鍗曞厓 */ @@ -76,4 +76,13 @@ */ private String taskType; + /** + * 璁″垝寮�濮嬫椂闂� + */ + private String planStartTime; + /** + * 璁″垝缁撴潫鏃堕棿 + */ + private String planEndTime; + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/EquipmentDaySummary.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/EquipmentDaySummary.java index fac96e7..69b2fc0 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/EquipmentDaySummary.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/EquipmentDaySummary.java @@ -13,7 +13,7 @@ /** * 涓婚敭 */ - private String medId; + private String mesId; /** * 鍗曞厓 */ diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/WsEquipmentEndWork.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/WsEquipmentEndWork.java new file mode 100644 index 0000000..24ff41f --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/WsEquipmentEndWork.java @@ -0,0 +1,35 @@ +package org.jeecg.modules.mdc.vo; + +import com.alibaba.fastjson.annotation.JSONField; +import lombok.Data; + +import java.util.Date; + +/** + * @Author: Lius + * @CreateTime: 2025-05-16 + * @Description: 瀹屽伐 + */ +@Data +public class WsEquipmentEndWork { + + private String mesId; + + private String workshop; + + private String equipmentId; + + private String mdsItemCode; + + private String taskCode; + + private String opreationSeqNo; + + @JSONField(format = "yyyy-MM-dd HH:mm:ss") + private Date endProcessTime; + + private String processProgress; + + private String processNumber; + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/WsEquipmentStartWork.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/WsEquipmentStartWork.java new file mode 100644 index 0000000..da79a45 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/WsEquipmentStartWork.java @@ -0,0 +1,31 @@ +package org.jeecg.modules.mdc.vo; + +import com.alibaba.fastjson.annotation.JSONField; +import lombok.Data; + +import java.util.Date; + +/** + * @Author: Lius + * @CreateTime: 2025-05-16 + * @Description: 寮�宸� + */ +@Data +public class WsEquipmentStartWork { + + private String mesId; + + private String workshop; + + private String equipmentId; + + private String mdsItemCode; + + private String taskCode; + + private String opreationSeqNo; + + @JSONField(format = "yyyy-MM-dd HH:mm:ss") + private Date startProcessTime; + +} diff --git a/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml b/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml index d32f196..25cc4fc 100644 --- a/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml +++ b/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml @@ -83,7 +83,7 @@ type: com.alibaba.druid.pool.DruidDataSource druid: driverClassName: dm.jdbc.driver.DmDriver - url: jdbc:dm://192.168.1.118:5236/?LXZN_MDC_420&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8 + url: jdbc:dm://LOCALHOST:5236/?LXZN_MDC_420&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8 username: LXZN_MDC_420 password: 123 #redis 閰嶇疆 @@ -237,3 +237,8 @@ namespace: http://service.server.webservice.example.com statusMethod: equipmentStatus rateMethod: equipmentRate +webservice2: + url: 20.10.193.21:9308/webservice/mes/equipment/v1/mdcProcessTask2MEs.asmx?wsdl + namespace: http://service.server.webservice.example.com + startWorkMethod: equipmentStart + endWorkMethod: equipmentEnd -- Gitblit v1.9.3