From 193ec95b34e271ae1205b41831963a918e64eb28 Mon Sep 17 00:00:00 2001 From: wenjy Date: Fri, 10 Jun 2022 14:34:49 +0800 Subject: [PATCH] =?UTF-8?q?add=20-=20=E5=8F=91=E6=B3=A1=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FoamBoxController.java | 12 +++ .../FoamBoxDevice/FoamBoxLineRunStatus.java | 31 +++++++ .../FoamBoxMachineRunStatus.java | 33 ++++++++ .../mapper/FoamBoxLineRunStatusMapper.java | 13 +++ .../mapper/FoamBoxMachineRunStatusMapper.java | 14 ++++ .../service/IFoamBoxDeviceInfoService.java | 19 +++++ .../impl/FoamBoxDeviceInfoServiceImpl.java | 79 ++++++++++++++++++ .../controller/FoamBoxController.class | Bin 4443 -> 4868 bytes 8 files changed, 201 insertions(+) create mode 100644 productionboard/src/main/java/com/productionboard/entity/FoamBoxDevice/FoamBoxLineRunStatus.java create mode 100644 productionboard/src/main/java/com/productionboard/entity/FoamBoxDevice/FoamBoxMachineRunStatus.java create mode 100644 productionboard/src/main/java/com/productionboard/mapper/FoamBoxLineRunStatusMapper.java create mode 100644 productionboard/src/main/java/com/productionboard/mapper/FoamBoxMachineRunStatusMapper.java create mode 100644 productionboard/src/main/java/com/productionboard/service/IFoamBoxDeviceInfoService.java create mode 100644 productionboard/src/main/java/com/productionboard/service/impl/FoamBoxDeviceInfoServiceImpl.java diff --git a/productionboard/src/main/java/com/productionboard/controller/FoamBoxController.java b/productionboard/src/main/java/com/productionboard/controller/FoamBoxController.java index d213b93..3c654c9 100644 --- a/productionboard/src/main/java/com/productionboard/controller/FoamBoxController.java +++ b/productionboard/src/main/java/com/productionboard/controller/FoamBoxController.java @@ -5,6 +5,7 @@ import com.productionboard.entity.MesProduction.MesHourProdutionStatistics; import com.productionboard.entity.MesProduction.MesMaterialProductionStatistics; import com.productionboard.entity.MesProduction.MesMaterialStoreStatistics; import com.productionboard.entity.MesProduction.MesTeamStatistics; +import com.productionboard.service.IFoamBoxDeviceInfoService; import com.productionboard.service.IMesProductionDataService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -29,6 +30,9 @@ public class FoamBoxController { @Autowired private IMesProductionDataService iMesProductionDataService; + @Autowired + private IFoamBoxDeviceInfoService ifamBoxDeviceInfoService; + private String prefix = "foamBox/index"; /** @@ -71,6 +75,14 @@ public class FoamBoxController { return JSONArray.toJSONString(new MesTeamStatistics()); } + @GetMapping("/getRunStatusJson") + @ResponseBody + public String getRunStatusJson(String ids){ + String runStatus = ifamBoxDeviceInfoService.getRunStatus(ids); + + return runStatus; + } + /** * 通过工位号获取MES小时产量 * @author WenJY diff --git a/productionboard/src/main/java/com/productionboard/entity/FoamBoxDevice/FoamBoxLineRunStatus.java b/productionboard/src/main/java/com/productionboard/entity/FoamBoxDevice/FoamBoxLineRunStatus.java new file mode 100644 index 0000000..08cb066 --- /dev/null +++ b/productionboard/src/main/java/com/productionboard/entity/FoamBoxDevice/FoamBoxLineRunStatus.java @@ -0,0 +1,31 @@ +package com.productionboard.entity.FoamBoxDevice; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author WenJY + * @date 2022年06月10日 14:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("SCADA_FPX_DEVICEINFO_1") +public class FoamBoxLineRunStatus implements Serializable { + + @TableField("DEVICEID") + private String deviceId; + + @TableField("DEVICESTATUS") + private String deviceStatus; + + @TableField("COLLECTTIME") + private Date collectTime; + +} diff --git a/productionboard/src/main/java/com/productionboard/entity/FoamBoxDevice/FoamBoxMachineRunStatus.java b/productionboard/src/main/java/com/productionboard/entity/FoamBoxDevice/FoamBoxMachineRunStatus.java new file mode 100644 index 0000000..d685d2e --- /dev/null +++ b/productionboard/src/main/java/com/productionboard/entity/FoamBoxDevice/FoamBoxMachineRunStatus.java @@ -0,0 +1,33 @@ +package com.productionboard.entity.FoamBoxDevice; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author WenJY + * @date 2022年06月10日 14:16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("SCADA_FPJ_DEVICEINFO_1") +public class FoamBoxMachineRunStatus implements Serializable { + + @TableField("DEVICEID") + private String deviceId; + + @TableField("DEVICESTATUS1") + private String deviceStatus1; + + @TableField("DEVICESTATUS2") + private String deviceStatus2; + + @TableField("COLLECTTIME") + private Date collectTime; +} diff --git a/productionboard/src/main/java/com/productionboard/mapper/FoamBoxLineRunStatusMapper.java b/productionboard/src/main/java/com/productionboard/mapper/FoamBoxLineRunStatusMapper.java new file mode 100644 index 0000000..d3301ef --- /dev/null +++ b/productionboard/src/main/java/com/productionboard/mapper/FoamBoxLineRunStatusMapper.java @@ -0,0 +1,13 @@ +package com.productionboard.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.productionboard.entity.FoamBoxDevice.FoamBoxLineRunStatus; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author WenJY + * @date 2022年06月10日 14:15 + */ +@Mapper +public interface FoamBoxLineRunStatusMapper extends BaseMapper { +} diff --git a/productionboard/src/main/java/com/productionboard/mapper/FoamBoxMachineRunStatusMapper.java b/productionboard/src/main/java/com/productionboard/mapper/FoamBoxMachineRunStatusMapper.java new file mode 100644 index 0000000..8af64ab --- /dev/null +++ b/productionboard/src/main/java/com/productionboard/mapper/FoamBoxMachineRunStatusMapper.java @@ -0,0 +1,14 @@ +package com.productionboard.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.productionboard.entity.FoamBoxDevice.FoamBoxLineRunStatus; +import com.productionboard.entity.FoamBoxDevice.FoamBoxMachineRunStatus; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author WenJY + * @date 2022年06月10日 14:15 + */ +@Mapper +public interface FoamBoxMachineRunStatusMapper extends BaseMapper { +} diff --git a/productionboard/src/main/java/com/productionboard/service/IFoamBoxDeviceInfoService.java b/productionboard/src/main/java/com/productionboard/service/IFoamBoxDeviceInfoService.java new file mode 100644 index 0000000..22eef07 --- /dev/null +++ b/productionboard/src/main/java/com/productionboard/service/IFoamBoxDeviceInfoService.java @@ -0,0 +1,19 @@ +package com.productionboard.service; + +import java.util.List; + +/** + * @author WenJY + * @date 2022年06月10日 14:17 + */ +public interface IFoamBoxDeviceInfoService { + + /** + * 获取发泡线、发泡机运行参数 + * @author WenJY + * @date 2022-06-10 14:18 + * @param ids 0-南线;1-北线 + * @return java.lang.String + */ + String getRunStatus(String ids); +} diff --git a/productionboard/src/main/java/com/productionboard/service/impl/FoamBoxDeviceInfoServiceImpl.java b/productionboard/src/main/java/com/productionboard/service/impl/FoamBoxDeviceInfoServiceImpl.java new file mode 100644 index 0000000..8fda95d --- /dev/null +++ b/productionboard/src/main/java/com/productionboard/service/impl/FoamBoxDeviceInfoServiceImpl.java @@ -0,0 +1,79 @@ +package com.productionboard.service.impl; + +import com.alibaba.fastjson.JSONArray; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.productionboard.entity.FoamBoxDevice.FoamBoxLineRunStatus; +import com.productionboard.entity.FoamBoxDevice.FoamBoxMachineRunStatus; +import com.productionboard.mapper.FoamBoxLineRunStatusMapper; +import com.productionboard.mapper.FoamBoxMachineRunStatusMapper; +import com.productionboard.service.IFoamBoxDeviceInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author WenJY + * @date 2022年06月10日 14:21 + */ +@Service +public class FoamBoxDeviceInfoServiceImpl implements IFoamBoxDeviceInfoService { + + @Autowired private FoamBoxLineRunStatusMapper foamBoxLineRunStatusMapper; + + @Autowired private FoamBoxMachineRunStatusMapper foamBoxMachineRunStatusMapper; + + /** + * 获取发泡线、发泡机运行参数 + * @author WenJY + * @date 2022-06-10 14:34 + * @param ids + * @return java.lang.String + */ + @Override + public String getRunStatus(String ids) { + + String[] result = new String[6]; + + List foamBoxLineRunStatuses = foamBoxLineRunStatusMapper.selectList(null); + QueryWrapper wrapper = new QueryWrapper<>(); + + switch (ids) { + case "0": + wrapper.eq("DEVICEID", "HF202009858"); + break; + case "1": + wrapper.eq("DEVICEID", "HF202009857"); + break; + } + + List foamBoxMachineRunStatuses = foamBoxMachineRunStatusMapper.selectList(wrapper); + + try{ + if(foamBoxLineRunStatuses.size() > 0){ + for (int i = 0; i < foamBoxLineRunStatuses.size();i++){ + result[i] = foamBoxLineRunStatuses.get(i).getDeviceStatus(); + } + }else{ + for (int i = 0; i < 4;i++){ + result[i] = "1"; + } + } + + if(foamBoxMachineRunStatuses.size() > 0 && foamBoxMachineRunStatuses.get(0) != null){ + result[4] = foamBoxMachineRunStatuses.get(0).getDeviceStatus1(); + result[5] = foamBoxMachineRunStatuses.get(0).getDeviceStatus2(); + }else{ + result[4] = "1"; + result[5] = "1"; + } + }catch (Exception e){ + for (int i = 0; i < 5;i++){ + result[i] = "1"; + } + } + + return JSONArray.toJSONString(result); + } +} diff --git a/productionboard/target/classes/com/productionboard/controller/FoamBoxController.class b/productionboard/target/classes/com/productionboard/controller/FoamBoxController.class index d94df6e83446f5ee85a78a0c3bcfee2459cf7b79..cb6d6e5b178f2df2af96e896dfc2e3cf2283f6bd 100644 GIT binary patch delta 1623 zcmb7@OH&hB7>3`|A$HU0Mu?&TQPDwQj2ckzj?4gF(4ayb9Ynzh0UI^JBp_ZJXT0kM zd*RO6xN~C_S~Jd6`2+k1Q?v4asO5V)O$bmdX3>34f0y$;-}{~ZZ{z)1`_s3-KLTjN za~&1v)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