规则列表接口

This commit is contained in:
杨晓东 2025-11-23 13:19:29 +08:00
parent 80901549e4
commit 64350a6f49
6 changed files with 162 additions and 111 deletions

View File

@ -46,16 +46,21 @@ public class DryEquipmentInfo extends BaseEntity
@TableField("location")
private String location;
/** 规则编码 */
@Excel(name = "规则编码")
@TableField("rule_code")
private String ruleCode;
/** 规则名称 */
@Excel(name = "规则名称")
@TableField("rule_name")
private String ruleName;
/** 状态1-运行中0-停用 */
@Excel(name = "状态")
@TableField("status")
private String status;
/** 设定规则 */
@Excel(name = "设定规则")
@TableField("set_rule")
private String setRule;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -64,8 +69,9 @@ public class DryEquipmentInfo extends BaseEntity
.append("equipmentName", getEquipmentName())
.append("equipmentType", getEquipmentType())
.append("location", getLocation())
.append("ruleCode", getRuleCode())
.append("ruleName", getRuleName())
.append("status", getStatus())
.append("setRule", getSetRule())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())

View File

@ -14,100 +14,134 @@ import com.shgx.common.core.domain.BaseEntity;
/**
* 参数阈值对象 dry_param_threshold
*
*
* @author shgx
* @date 2025-10-16
*/
@Data
@TableName("dry_param_threshold")
@ApiModel(value = "DryParamThreshold", description = "干燥参数阈值查询/提交参数")
public class DryParamThreshold extends BaseEntity
{
public class DryParamThreshold extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键ID */
@ApiModelProperty(value = "主键ID", required = false, example = "1001", hidden = true)
/**
* 主键ID
*/
@TableId(type = IdType.AUTO)
private Long id;
/** 设备编号 */
@ApiModelProperty(value = "设备编号", required = false, example = "DEVICE-2024-001")
@Excel(name = "设备编号")
@TableField("equipment_code")
private String equipmentCode;
/**
* 规则编号
*/
@Excel(name = "规则编号")
@TableField("rule_code")
private String ruleCode;
/** 物料编号 */
@ApiModelProperty(value = "物料编号", required = false, example = "MATERIAL-2025-112")
@Excel(name = "物料编号")
@TableField("material_code")
private String materialCode;
/** 物料名称 */
@ApiModelProperty(value = "物料名称", required = false, example = "注塑切片")
@Excel(name = "物料名称")
@TableField("material_name")
private String materialName;
/** 规则名称 */
@ApiModelProperty(value = "规则名称", required = false, example = "TEMP")
/**
* 规则名称
*/
@Excel(name = "规则名称")
@TableField("rule_name")
private String ruleName;
/** 参数编码TEMP、DEW */
@ApiModelProperty(value = "参数编码", required = false, example = "TEMP")
/**
* 设备编号
*/
@Excel(name = "设备编号")
@TableField("equipment_code")
private String equipmentCode;
/**
* 工单编号
*/
@Excel(name = "工单编号")
@TableField("work_order_code")
private String workOrderCode;
/**
* 产品编号
*/
@Excel(name = "产品编号")
@TableField("product_code")
private String productCode;
/**
* 物料编号
*/
@Excel(name = "物料编号")
@TableField("material_code")
private String materialCode;
/**
* 物料名称
*/
@Excel(name = "物料名称")
@TableField("material_name")
private String materialName;
/**
* 参数编码TEMPDEW
*/
@Excel(name = "参数编码")
@TableField("param_code")
private String paramCode;
/** 参数名称:温度、露点 */
@ApiModelProperty(value = "参数名称", required = false, example = "温度")
/**
* 参数名称温度露点
*/
@Excel(name = "参数名称")
@TableField("param_name")
private String paramName;
/** 单位:℃、%、℃ */
@ApiModelProperty(value = "单位", required = false, example = "")
/**
* 单位%
*/
@Excel(name = "单位")
@TableField("unit")
private String unit;
/** 最低阈值 */
@ApiModelProperty(value = "最低阈值", required = false, example = "30")
/**
* 最低阈值
*/
@Excel(name = "最低阈值")
@TableField("min_value")
private String minValue;
/** 最高阈值 */
@ApiModelProperty(value = "最高阈值", required = false, example = "70")
/**
* 最高阈值
*/
@Excel(name = "最高阈值")
@TableField("max_value")
private String maxValue;
/** 是否启用该阈值1启用0停用 */
@ApiModelProperty(value = "是否启用", required = false, example = "1")
/**
* 是否启用该阈值1启用0停用
*/
@Excel(name = "是否启用该阈值")
@TableField("is_enabled")
private String isEnabled;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("equipmentCode", getEquipmentCode())
.append("materialCode", getMaterialCode())
.append("materialName", getMaterialName())
.append("paramCode", getParamCode())
.append("paramName", getParamName())
.append("unit", getUnit())
.append("minValue", getMinValue())
.append("maxValue", getMaxValue())
.append("isEnabled", getIsEnabled())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("ruleCode", getRuleCode())
.append("ruleName", getRuleName())
.append("equipmentCode", getEquipmentCode())
.append("workOrderCode", getWorkOrderCode())
.append("productCode", getProductCode())
.append("materialCode", getMaterialCode())
.append("materialName", getMaterialName())
.append("paramCode", getParamCode())
.append("paramName", getParamName())
.append("unit", getUnit())
.append("minValue", getMinValue())
.append("maxValue", getMaxValue())
.append("isEnabled", getIsEnabled())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -2,5 +2,7 @@ package com.shgx.dryingroom.web.domain.dto;
public class ParamThresholdDTO {
public String ruleCode;
public String ruleName;
}

View File

@ -6,6 +6,7 @@ import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.shgx.common.utils.DateUtils;
import com.shgx.common.utils.SecurityUtils;
import com.shgx.dryingroom.alarm.AlarmLightService;
@ -20,14 +21,13 @@ import com.shgx.dryingroom.web.service.IDryEquipmentInfoService;
/**
* 设备信息Service业务层处理
*
*
* @author shgx
* @date 2025-10-16
*/
@Service
@DS("postgres")
public class DryEquipmentInfoServiceImpl implements IDryEquipmentInfoService
{
public class DryEquipmentInfoServiceImpl implements IDryEquipmentInfoService {
@Autowired
private DryEquipmentInfoMapper dryEquipmentInfoMapper;
@ -39,25 +39,23 @@ public class DryEquipmentInfoServiceImpl implements IDryEquipmentInfoService
/**
* 查询设备信息
*
*
* @param id 设备信息主键
* @return 设备信息
*/
@Override
public DryEquipmentInfo selectDryEquipmentInfoById(Long id)
{
public DryEquipmentInfo selectDryEquipmentInfoById(Long id) {
return dryEquipmentInfoMapper.selectById(id);
}
/**
* 查询设备信息列表
*
*
* @param dryEquipmentInfo 设备信息
* @return 设备信息
*/
@Override
public List<DryEquipmentInfo> selectDryEquipmentInfoList(DryEquipmentInfo dryEquipmentInfo)
{
public List<DryEquipmentInfo> selectDryEquipmentInfoList(DryEquipmentInfo dryEquipmentInfo) {
LambdaQueryWrapper<DryEquipmentInfo> queryWrapper = new LambdaQueryWrapper<>(dryEquipmentInfo);
return dryEquipmentInfoMapper.selectList(queryWrapper.orderByDesc(DryEquipmentInfo::getCreateTime));
@ -65,13 +63,14 @@ public class DryEquipmentInfoServiceImpl implements IDryEquipmentInfoService
/**
* 新增设备信息
*
*
* @param dryEquipmentInfo 设备信息
* @return 结果
*/
@Override
public int insertDryEquipmentInfo(DryEquipmentInfo dryEquipmentInfo)
{
public int insertDryEquipmentInfo(DryEquipmentInfo dryEquipmentInfo) {
paramMapper.update(new LambdaUpdateWrapper<DryParamThreshold>().eq(DryParamThreshold::getRuleCode, dryEquipmentInfo.getRuleCode())
.set(DryParamThreshold::getEquipmentCode, dryEquipmentInfo.getEquipmentCode()));
dryEquipmentInfo.setCreateBy(SecurityUtils.getUsername());
dryEquipmentInfo.setCreateTime(DateUtils.getNowDate());
@ -80,13 +79,14 @@ public class DryEquipmentInfoServiceImpl implements IDryEquipmentInfoService
/**
* 修改设备信息
*
*
* @param dryEquipmentInfo 设备信息
* @return 结果
*/
@Override
public int updateDryEquipmentInfo(DryEquipmentInfo dryEquipmentInfo)
{
public int updateDryEquipmentInfo(DryEquipmentInfo dryEquipmentInfo) {
paramMapper.update(new LambdaUpdateWrapper<DryParamThreshold>().eq(DryParamThreshold::getRuleCode, dryEquipmentInfo.getRuleCode())
.set(DryParamThreshold::getEquipmentCode, dryEquipmentInfo.getEquipmentCode()));
dryEquipmentInfo.setUpdateBy(SecurityUtils.getUsername());
dryEquipmentInfo.setUpdateTime(DateUtils.getNowDate());
@ -95,13 +95,12 @@ public class DryEquipmentInfoServiceImpl implements IDryEquipmentInfoService
/**
* 批量删除设备信息
*
*
* @param ids 需要删除的设备信息主键
* @return 结果
*/
@Override
public int deleteDryEquipmentInfoByIds(Long[] ids)
{
public int deleteDryEquipmentInfoByIds(Long[] ids) {
List<Long> idList = Arrays.asList(ids);
return dryEquipmentInfoMapper.deleteByIds(idList);
@ -109,18 +108,18 @@ public class DryEquipmentInfoServiceImpl implements IDryEquipmentInfoService
/**
* 删除设备信息信息
*
*
* @param id 设备信息主键
* @return 结果
*/
@Override
public int deleteDryEquipmentInfoById(Long id)
{
public int deleteDryEquipmentInfoById(Long id) {
return dryEquipmentInfoMapper.deleteById(id);
}
/**
* 关闭报警
* 关闭报警
*
* @param id
* @return
*/
@ -142,6 +141,7 @@ public class DryEquipmentInfoServiceImpl implements IDryEquipmentInfoService
/**
* 规则列表
*
* @return
*/
@Override
@ -150,7 +150,7 @@ public class DryEquipmentInfoServiceImpl implements IDryEquipmentInfoService
List<ParamThresholdDTO> result = new ArrayList<>();
for (DryParamThreshold item : list) {
ParamThresholdDTO param = new ParamThresholdDTO();
param.ruleName = item.getRuleName();
param.ruleName = item.getRuleName();
result.add(param);
}
return result;

View File

@ -3,6 +3,7 @@ package com.shgx.dryingroom.web.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.shgx.common.utils.StringUtils;
import com.shgx.common.utils.bean.BeanUtils;
import com.shgx.dryingroom.alarm.AlarmLightService;
import com.shgx.dryingroom.web.domain.DryEquipmentInfo;
@ -69,13 +70,18 @@ public class DryEquipmentScreenServiceImpl implements IDryEquipmentScreenService
// 5. 组装DTO仅提取TEMP温度参数的最新值
return equipmentList.stream()
.map(equipment -> {
String setTem = (equipment != null && StringUtils.isNotBlank(equipment.getRuleCode()))
? Optional.ofNullable(paramMapper.selectOne(
new LambdaQueryWrapper<DryParamThreshold>().eq(DryParamThreshold::getRuleCode, equipment.getRuleCode())
)).map(DryParamThreshold::getMaxValue).orElse(null)
: null;
EquipmentScreenDTO.DryingDTO dto = new EquipmentScreenDTO.DryingDTO();
String equipmentCode = equipment.getEquipmentCode();
// 基础信息赋值
dto.setEquipmentCode(equipmentCode);
dto.setEquipmentName(equipment.getEquipmentName());
dto.setStatus(equipment.getStatus());
dto.setSetTem(equipment.getSetRule());
dto.setSetTem(setTem);
dto.setEquipmentType("1");
dto.setParamList(paramMap.getOrDefault(equipmentCode, Collections.emptyList()));
@ -176,13 +182,18 @@ public class DryEquipmentScreenServiceImpl implements IDryEquipmentScreenService
// 5. 组装DrynessDTO分别提取TEMP和DEW的最新值
return equipmentList.stream()
.map(equipment -> {
String setTem = (equipment != null && StringUtils.isNotBlank(equipment.getRuleCode()))
? Optional.ofNullable(paramMapper.selectOne(
new LambdaQueryWrapper<DryParamThreshold>().eq(DryParamThreshold::getRuleCode, equipment.getRuleCode())
)).map(DryParamThreshold::getMaxValue).orElse(null)
: null;
EquipmentScreenDTO.DrynessDTO dto = new EquipmentScreenDTO.DrynessDTO();
String equipmentCode = equipment.getEquipmentCode();
// 基础信息赋值
dto.setEquipmentCode(equipmentCode);
dto.setEquipmentName(equipment.getEquipmentName());
dto.setStatus(equipment.getStatus());
dto.setSetTem(equipment.getSetRule());
dto.setSetTem(setTem);
dto.setEquipmentType("2");
// 阈值规则列表
dto.setParamList(paramMap.getOrDefault(equipmentCode, Collections.emptyList()));

View File

@ -19,13 +19,12 @@ import org.springframework.transaction.annotation.Transactional;
/**
* 模具基本信息Service业务层处理
*
*
* @author ruoyi
* @date 2025-09-25
*/
@Service
public class MoldInfoServiceImpl implements IMoldInfoService
{
public class MoldInfoServiceImpl implements IMoldInfoService {
@Autowired
private MoldInfoMapper moldInfoMapper;
@ -43,13 +42,12 @@ public class MoldInfoServiceImpl implements IMoldInfoService
/**
* 查询模具基本信息
*
*
* @param moldId 模具基本信息主键
* @return 模具基本信息
*/
@Override
public MoldInfo selectMoldInfoByMoldId(Long moldId)
{
public MoldInfo selectMoldInfoByMoldId(Long moldId) {
return moldInfoMapper.selectById(moldId);
}
@ -60,21 +58,26 @@ public class MoldInfoServiceImpl implements IMoldInfoService
* @return 模具基本信息
*/
@Override
public List<MoldInfo> selectMoldInfoList(MoldInfo moldInfo)
{
public List<MoldInfo> selectMoldInfoList(MoldInfo moldInfo) {
LambdaQueryWrapper<MoldInfo> queryWrapper = new LambdaQueryWrapper<>(moldInfo);
return moldInfoMapper.selectList(queryWrapper.orderByDesc(MoldInfo::getCreateTime));
}
/**
* 新增模具基本信息
*
*
* @param moldInfo 模具基本信息
* @return 结果
*/
@Override
public int insertMoldInfo(MoldInfo moldInfo)
{
public int insertMoldInfo(MoldInfo moldInfo) {
LambdaQueryWrapper<MoldInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(MoldInfo::getMoldCode, moldInfo.getMoldCode())
.eq(MoldInfo::getMoldName, moldInfo.getMoldName());
boolean exists = moldInfoMapper.selectOne(queryWrapper) != null;
if (exists) {
throw new RuntimeException("此模具已经在库中,请不要重复添加!");
}
moldInfo.setCreateBy(SecurityUtils.getUsername());
moldInfo.setCreateTime(DateUtils.getNowDate());
return moldInfoMapper.insert(moldInfo);
@ -82,13 +85,12 @@ public class MoldInfoServiceImpl implements IMoldInfoService
/**
* 修改模具基本信息
*
*
* @param moldInfo 模具基本信息
* @return 结果
*/
@Override
public int updateMoldInfo(MoldInfo moldInfo)
{
public int updateMoldInfo(MoldInfo moldInfo) {
moldInfo.setUpdateBy(SecurityUtils.getUsername());
moldInfo.setUpdateTime(DateUtils.getNowDate());
return moldInfoMapper.updateById(moldInfo);
@ -96,26 +98,24 @@ public class MoldInfoServiceImpl implements IMoldInfoService
/**
* 批量删除模具基本信息
*
*
* @param moldIds 需要删除的模具基本信息主键
* @return 结果
*/
@Override
public int deleteMoldInfoByMoldIds(Long[] moldIds)
{
public int deleteMoldInfoByMoldIds(Long[] moldIds) {
List<Long> idList = Arrays.asList(moldIds);
return moldInfoMapper.deleteByIds(idList);
}
/**
* 删除模具基本信息信息
*
*
* @param moldId 模具基本信息主键
* @return 结果
*/
@Override
public int deleteMoldInfoByMoldId(Long moldId)
{
public int deleteMoldInfoByMoldId(Long moldId) {
return moldInfoMapper.deleteById(moldId);
}
@ -177,7 +177,7 @@ public class MoldInfoServiceImpl implements IMoldInfoService
} else {
LambdaQueryWrapper<MoldWarehouseLocationLive> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(MoldWarehouseLocationLive::getMoldCode, query.moldCode);
MoldWarehouseLocationLive live1 = liveMapper.selectOne(wrapper);
MoldWarehouseLocationLive live1 = liveMapper.selectOne(wrapper);
MoldInventoryChangeLog changeLog = new MoldInventoryChangeLog();
changeLog.setMoldCode(query.moldCode);
changeLog.setMoldName(live1.getMoldName());
@ -188,9 +188,7 @@ public class MoldInfoServiceImpl implements IMoldInfoService
if (query.status == '1') {
changeLog.setChangeType('1');
changeLog.setToLocation(live1.getPositionCode());
}
else
{
} else {
if (query.status == '2') {
changeLog.setMachineLocation(query.machineLocation);
}
@ -231,8 +229,7 @@ public class MoldInfoServiceImpl implements IMoldInfoService
* @return 模具基本信息
*/
@Override
public List<MoldQueryDTO.OutLocationMoldDTO> selectMoldInfoByMoldCode(String moldCode)
{
public List<MoldQueryDTO.OutLocationMoldDTO> selectMoldInfoByMoldCode(String moldCode) {
MoldWarehouseLocationLive live = liveMapper.selectOne(new LambdaQueryWrapper<MoldWarehouseLocationLive>().eq(MoldWarehouseLocationLive::getMoldCode, moldCode));
MoldQueryDTO.OutLocationMoldDTO result = new MoldQueryDTO.OutLocationMoldDTO();
if (live != null) {
@ -254,6 +251,7 @@ public class MoldInfoServiceImpl implements IMoldInfoService
/**
* PDA手动输入模具名称
*
* @param moldName
* @return
*/