干燥机配套车间生产管理系统/云平台服务端
bsw215583320
2024-04-16 3ee30263eb9bb5f7bf1228ea45ce5d498fb3cdef
设备类型增加效率和均耗绑定
已添加1个文件
已修改3个文件
152 ■■■■■ 文件已修改
jeecg-module-dry/jeecg-module-dry-api/src/main/java/org/jeecg/modules/dry/entity/DryEqpType.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jeecg-module-dry/jeecg-module-dry-api/src/main/java/org/jeecg/modules/dry/vo/DryEquipmentVo.java 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/service/impl/DryRealTimeDataServiceImpl.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jeecg-module-dry/jeecg-module-dry-api/src/main/java/org/jeecg/modules/dry/entity/DryEqpType.java
@@ -44,6 +44,15 @@
    @Excel(name = "name", width = 15)
    @ApiModelProperty(value = "name")
    private String name;
    @Excel(name = "干燥效率", width = 15)
    @ApiModelProperty(value = "干燥效率")
    private String dryEfficiency;
    @Excel(name = "蒸汽均耗", width = 15)
    @ApiModelProperty(value = "蒸汽均耗")
    private String steamConsumption;
    @Excel(name = "电能均耗", width = 15)
    @ApiModelProperty(value = "电能均耗")
    private String powerConsumption;
    /**创建人*/
    @ApiModelProperty(value = "创建人")
    private String createBy;
jeecg-module-dry/jeecg-module-dry-api/src/main/java/org/jeecg/modules/dry/vo/DryEquipmentVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,94 @@
package org.jeecg.modules.dry.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
 * @Description: å¹²ç‡¥æœº
 * @Author: jeecg-boot
 * @Date:   2023-03-08
 * @Version: V1.0
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ToString
public class DryEquipmentVo implements Serializable {
    /**id*/
    @ApiModelProperty(value = "id")
    private String id;
    /**设备编号*/
    @Excel(name = "设备编号", width = 15)
    @ApiModelProperty(value = "设备编号")
    private String code;
    /**设备名称*/
    @Excel(name = "设备名称", width = 15)
    @ApiModelProperty(value = "设备名称")
    private String name;
    /**设备类型*/
    @Excel(name = "设备类型", width = 15, dictTable = "dry_eqp_type", dicText = "name", dicCode = "id")
    @Dict(dictTable = "dry_eqp_type", dicText = "name", dicCode = "id")
    @ApiModelProperty(value = "设备类型")
    private String type;
    /**设备描述*/
    @Excel(name = "设备描述", width = 15)
    @ApiModelProperty(value = "设备描述")
    private String remark;
    /**车间id*/
    @Excel(name = "车间id", width = 15, dictTable = "dry_shop", dicText = "name", dicCode = "id")
    @Dict(dictTable = "dry_shop", dicText = "name", dicCode = "id")
    @ApiModelProperty(value = "车间id")
    private String shopId;
    /**启用状态*/
    @Excel(name = "启用状态", width = 15)
    @ApiModelProperty(value = "启用状态")
    private String enable;
    /**创建人*/
    @ApiModelProperty(value = "创建人")
    private String createBy;
    /**创建日期*/
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @ApiModelProperty(value = "创建日期")
    private Date createTime;
    /**更新人*/
    @ApiModelProperty(value = "更新人")
    private String updateBy;
    /**更新日期*/
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @ApiModelProperty(value = "更新日期")
    private Date updateTime;
    /**租户id*/
    @Excel(name = "租户id", width = 15)
    @ApiModelProperty(value = "租户id")
    private Integer tenantId;
    /**设备IP*/
    @Excel(name = "设备IP", width = 15)
    @ApiModelProperty(value = "设备IP")
    private String ip;
    @Excel(name = "干燥效率", width = 15)
    @ApiModelProperty(value = "干燥效率")
    private String dryEfficiency;
    @Excel(name = "蒸汽均耗", width = 15)
    @ApiModelProperty(value = "蒸汽均耗")
    private String steamConsumption;
    @Excel(name = "电能均耗", width = 15)
    @ApiModelProperty(value = "电能均耗")
    private String powerConsumption;
}
jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java
@@ -1,5 +1,6 @@
package org.jeecg.modules.dry.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -9,6 +10,8 @@
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.bean.BeanUtil;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.config.TenantContext;
import org.jeecg.common.system.query.QueryGenerator;
@@ -16,6 +19,7 @@
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
import org.jeecg.modules.dry.common.CacheConstants;
import org.jeecg.modules.dry.entity.DryEqpType;
import org.jeecg.modules.dry.entity.DryEquipment;
import org.jeecg.modules.dry.service.IDryEqpTypeService;
import org.jeecg.modules.dry.service.IDryEquipmentService;
@@ -25,6 +29,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.dry.vo.DryEquipmentVo;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
@@ -92,7 +97,7 @@
     @ApiOperation(value="查询所有干燥机", notes="查询所有干燥机")
     @GetMapping(value = "/listAll")
    public Result<List<DryEquipment>> queryAllEquipment(DryEquipment dryEquipment, HttpServletRequest req) {
    public Result<List<DryEquipmentVo>> queryAllEquipment(DryEquipment dryEquipment, HttpServletRequest req) {
        //------------------------------------------------------------------------------------------------
        //是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
        if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
@@ -103,10 +108,17 @@
        queryWrapper.orderByAsc("code");
        List<DryEquipment> eqps = dryEquipmentService.list(queryWrapper);
        List<DryEquipmentVo> equipmentVos = new ArrayList<>();
        eqps.stream().forEach(item -> {
            item.setType(dryEqpTypeService.getById(item.getType()).getName());
            DryEquipmentVo dryEquipmentVo = BeanUtil.toBean(item, DryEquipmentVo.class);
            DryEqpType dryEqpType = dryEqpTypeService.getById(item.getType());
            dryEquipmentVo.setType(dryEqpType.getName());
            dryEquipmentVo.setDryEfficiency(dryEqpType.getDryEfficiency());
            dryEquipmentVo.setSteamConsumption(dryEqpType.getSteamConsumption());
            dryEquipmentVo.setPowerConsumption(dryEqpType.getPowerConsumption());
            equipmentVos.add(dryEquipmentVo);
        });
        return Result.OK(eqps);
        return Result.OK(equipmentVos);
    }
@@ -186,13 +198,18 @@
    //@AutoLog(value = "干燥机-通过id查询")
    @ApiOperation(value="干燥机-通过id查询", notes="干燥机-通过id查询")
    @GetMapping(value = "/queryById")
    public Result<DryEquipment> queryById(@RequestParam(name="id",required=true) String id) {
    public Result<DryEquipmentVo> queryById(@RequestParam(name="id",required=true) String id) {
        DryEquipment dryEquipment = dryEquipmentService.getById(id);
        dryEquipment.setType(dryEqpTypeService.getById(dryEquipment.getType()).getName());
        DryEquipmentVo dryEquipmentVo = BeanUtil.toBean(dryEquipment, DryEquipmentVo.class);
        DryEqpType dryEqpType = dryEqpTypeService.getById(dryEquipment.getType());
        dryEquipmentVo.setType(dryEqpType.getName());
        dryEquipmentVo.setDryEfficiency(dryEqpType.getDryEfficiency());
        dryEquipmentVo.setSteamConsumption(dryEqpType.getSteamConsumption());
        dryEquipmentVo.setPowerConsumption(dryEqpType.getPowerConsumption());
        if(dryEquipment==null) {
            return Result.error("未找到对应数据");
        }
        return Result.OK(dryEquipment);
        return Result.OK(dryEquipmentVo);
    }
    /**
jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/service/impl/DryRealTimeDataServiceImpl.java
@@ -100,6 +100,7 @@
        // 2 æ›´æ–°å·¥å•实时数据
        // 2.1 å°†å·¥å•中的数据替换为最新数据
        realTimeDataVo.setOrderId(orderVo.getId());
        orderVo.setInitial(realTimeDataVo.getMoisture1());
        orderVo.setDryTime(realTimeDataVo.getTime3());
        orderVo.setDelay(realTimeDataVo.getDelay());
@@ -186,7 +187,7 @@
        orderVo.getBellowsTemp().put(realTimeDataVo.getTime3(), realTimeDataVo.getTemp2());
        // 2.3 æ›´æ–°åˆ°redis缓存
        redisUtil.hset(CacheConstants.RedisKeyEnum.WORK_ORDER.getCode(),
                realTimeDataVo.getTenantid()+"_"+realTimeDataVo.getMachineid(),orderVo, 600000);
                realTimeDataVo.getTenantid()+"_"+realTimeDataVo.getMachineid(),orderVo, 60*60);
        return Result.ok();
    }
@@ -219,6 +220,7 @@
            }
        // 3 æ•°æ®åº“没有则新增一条数据
        } else {
            orderVo = saveNewOrder(realTimeDataVo);
        }
        return orderVo;
@@ -288,7 +290,7 @@
     */
    private void saveOrderTrendVo(DryOrderTrendVo trendVo, DryOrderVo orderVo) {
        //判断 å®žæ—¶å«æ°´çއ æˆ– å®žæ—¶é‡é‡æœ‰æ²¡æœ‰å˜åŒ–,有变化则更新
        if(orderVo.getTrendVo() == null
        if(orderVo.getTrendVo() == null && trendVo != null && trendVo.getWeight() > 0
                || trendVo.getWeight() < orderVo.getTrendVo().getWeight()
                ) {
            DryOrder byId = dryOrderService.getById(orderVo.getId());
@@ -318,8 +320,9 @@
        LambdaQueryWrapper<DryEquipment> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(DryEquipment::getTenantId, realTimeDataVo.getTenantid());
         queryWrapper.eq(DryEquipment::getTenantId, realTimeDataVo.getTenantid());
        queryWrapper.eq(DryEquipment::getEnable, "Y");
        queryWrapper.orderByAsc(DryEquipment::getCode);
        List<DryEquipment> dryEquipments = equipmentService.list(queryWrapper);
        List<String> list = new ArrayList<>();
@@ -332,17 +335,20 @@
                if (dryEquipments != null && dryEquipments.size() > 0) {
                    dryEquipments.stream().forEach(item -> {
                        DryOrderVo order = (DryOrderVo) redisUtil.hget(CacheConstants.RedisKeyEnum.WORK_ORDER.getCode(), realTimeDataVo.getTenantid() + "_" + item.getCode());
                        list.add(item.getName().substring(0, item.getName().indexOf('#')+1));
                        if (order != null) {
                            double v = order.getOriginWeight() - order.getYield();
                            list.add(item.getName().substring(0, item.getName().indexOf('#')+1));
                            if (v > 0 && order.getDryTime()>0) {
                            DryOrderTrendVo dryOrderTrendVo = order.getDetailList().get(order.getDetailList().size() - 1);
                            double v = order.getOriginWeight() - dryOrderTrendVo.getWeight();
                            if (v > 0 && dryOrderTrendVo.getTotalTime()>0) {
                                DecimalFormat df = new DecimalFormat("#.00");
                                dList.add(Double.valueOf(df.format(v / order.getDryTime() * 60)));
                                dList.add(Double.valueOf(df.format(v / dryOrderTrendVo.getTotalTime() * 60)));
                            } else {
                                dList.add(50d);
                            }
                        }
                        dList.add(0d);
                    });
                }
                if (orderVo != null) {