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 d94df6e..cb6d6e5 100644 Binary files a/productionboard/target/classes/com/productionboard/controller/FoamBoxController.class and b/productionboard/target/classes/com/productionboard/controller/FoamBoxController.class differ