Commit b1ff2498 authored by wanghao's avatar wanghao

1 老化时间间隔配置功能实现

2 接收标定历史记录功能实现
3 不要 零点AD  零点AD状态  校准AD  校准AD状态  改成 标定浓度值和标定状态。
4 标定状态 只有是4(报警)的时候,才是正常的数据,其他的都是异常数据。
parent 4ff4411a
CREATE TABLE `t_process_calibration_result_history` (
`f_id` BIGINT ( 20 ) NOT NULL AUTO_INCREMENT COMMENT 'id',
`f_create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`f_message` LONGTEXT DEFAULT NULL COMMENT '内容',
PRIMARY KEY ( `f_id` ) USING BTREE
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 ROW_FORMAT = DYNAMIC COMMENT = '标定结果数据接收历史记录';
\ No newline at end of file
package com.zehong.web.controller.equipment;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.ProcessCalibrationResultHistory;
import com.zehong.system.service.IProcessCalibrationResultHistoryService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 标定结果数据接收历史记录Controller
*
* @author zehong
* @date 2025-12-01
*/
@RestController
@RequestMapping("/calibrationResult/history")
public class ProcessCalibrationResultHistoryController extends BaseController
{
@Resource
private IProcessCalibrationResultHistoryService processCalibrationResultHistoryService;
/**
* 查询标定结果数据接收历史记录列表
*/
@GetMapping("/list")
public TableDataInfo list(ProcessCalibrationResultHistory processCalibrationResultHistory)
{
startPage();
List<ProcessCalibrationResultHistory> list = processCalibrationResultHistoryService.selectProcessCalibrationResultHistoryList(processCalibrationResultHistory);
return getDataTable(list);
}
/**
* 导出标定结果数据接收历史记录列表
*/
@GetMapping("/export")
public AjaxResult export(ProcessCalibrationResultHistory processCalibrationResultHistory)
{
List<ProcessCalibrationResultHistory> list = processCalibrationResultHistoryService.selectProcessCalibrationResultHistoryList(processCalibrationResultHistory);
ExcelUtil<ProcessCalibrationResultHistory> util = new ExcelUtil<ProcessCalibrationResultHistory>(ProcessCalibrationResultHistory.class);
return util.exportExcel(list, "标定结果数据接收历史记录数据");
}
/**
* 获取标定结果数据接收历史记录详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(processCalibrationResultHistoryService.selectProcessCalibrationResultHistoryById(id));
}
/**
* 新增标定结果数据接收历史记录
*/
@PostMapping
public AjaxResult add(@RequestBody ProcessCalibrationResultHistory processCalibrationResultHistory)
{
return toAjax(processCalibrationResultHistoryService.insertProcessCalibrationResultHistory(processCalibrationResultHistory));
}
/**
* 修改标定结果数据接收历史记录
*/
@PutMapping
public AjaxResult edit(@RequestBody ProcessCalibrationResultHistory processCalibrationResultHistory)
{
return toAjax(processCalibrationResultHistoryService.updateProcessCalibrationResultHistory(processCalibrationResultHistory));
}
/**
* 删除标定结果数据接收历史记录
*/
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(processCalibrationResultHistoryService.deleteProcessCalibrationResultHistoryByIds(ids));
}
}
package com.zehong.web.controller.system; package com.zehong.web.controller.system;
import java.util.List;
import com.zehong.system.netty.handler.NettyUdpServerHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log; import com.zehong.common.annotation.Log;
import com.zehong.common.annotation.RepeatSubmit; import com.zehong.common.annotation.RepeatSubmit;
import com.zehong.common.constant.RoboticArmConstans;
import com.zehong.common.constant.UserConstants; import com.zehong.common.constant.UserConstants;
import com.zehong.common.core.controller.BaseController; import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult; import com.zehong.common.core.domain.AjaxResult;
...@@ -25,6 +12,12 @@ import com.zehong.common.utils.SecurityUtils; ...@@ -25,6 +12,12 @@ import com.zehong.common.utils.SecurityUtils;
import com.zehong.common.utils.poi.ExcelUtil; import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.SysConfig; import com.zehong.system.domain.SysConfig;
import com.zehong.system.service.ISysConfigService; import com.zehong.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* 参数配置 信息操作处理 * 参数配置 信息操作处理
...@@ -84,9 +77,26 @@ public class SysConfigController extends BaseController ...@@ -84,9 +77,26 @@ public class SysConfigController extends BaseController
*/ */
@GetMapping(value = "/getUploadMesAddress") @GetMapping(value = "/getUploadMesAddress")
public AjaxResult getUploadMesAddress() { public AjaxResult getUploadMesAddress() {
return AjaxResult.success(configService.directSelectConfigByKey(NettyUdpServerHandler.UPLOAD_MES_ADDRESS)); return AjaxResult.success(configService.directSelectConfigByKey(RoboticArmConstans.UPLOAD_MES_ADDRESS));
} }
/**
* 获取老化阶段时间
*/
@GetMapping(value = "/getAgingStageTime")
public AjaxResult getAgingStageTime() {
return AjaxResult.success(configService.selectAgingStageTime());
}
/**
* 修改老化阶段时间
*/
@PostMapping(value = "/updateAgingStageTime")
public AjaxResult updateAgingStageTime(@RequestBody List<SysConfig> sysConfigs) {
return toAjax(configService.updateAgingStageTime(sysConfigs));
}
/** /**
* 修改上传mes地址 * 修改上传mes地址
*/ */
......
package com.zehong.common.constant;
/**
* @author lenovo
* @date 2025/12/1
* @description 机械臂常亮类
*/
public class RoboticArmConstans {
// 上传MES地址的key
public static final String UPLOAD_MES_ADDRESS = "uploadMesAddress";
/**
* 老化流程第一阶段执行时间(单位:分钟)
*/
public static final String AGING_STAGE1_TIME = "agingStage1Time";
/**
* 老化流程第二阶段执行时间(单位:分钟)
*/
public static final String AGING_STAGE2_TIME = "agingStage2Time";
/**
* 老化流程第三阶段执行时间(单位:分钟)
*/
public static final String AGING_STAGE3_TIME = "agingStage3Time";
}
package com.zehong.system.domain;
import java.math.BigDecimal;
/**
* @author lenovo
* @date 2025/12/1
* @description 设备数据内部类
*/
public class DeviceData {
/** 顺序号 */
private Integer sequenceNumber;
/** 标定状态 */
private String calibrationStatus;
/** 标定浓度值 */
private BigDecimal calibrationValue;
public Integer getSequenceNumber() {
return sequenceNumber;
}
public void setSequenceNumber(Integer sequenceNumber) {
this.sequenceNumber = sequenceNumber;
}
public String getCalibrationStatus() {
return calibrationStatus;
}
public void setCalibrationStatus(String calibrationStatus) {
this.calibrationStatus = calibrationStatus;
}
public BigDecimal getCalibrationValue() {
return calibrationValue;
}
public void setCalibrationValue(BigDecimal calibrationValue) {
this.calibrationValue = calibrationValue;
}
}
...@@ -2,6 +2,8 @@ package com.zehong.system.domain; ...@@ -2,6 +2,8 @@ package com.zehong.system.domain;
import com.zehong.common.core.domain.BaseEntity; import com.zehong.common.core.domain.BaseEntity;
import java.math.BigDecimal;
/** /**
* @author lenovo * @author lenovo
* @date 2025/11/22 * @date 2025/11/22
...@@ -47,6 +49,16 @@ public class MesDeviceDomain extends BaseEntity { ...@@ -47,6 +49,16 @@ public class MesDeviceDomain extends BaseEntity {
* 实时状态 0-异常;1-正常 * 实时状态 0-异常;1-正常
*/ */
private String realTimeStatus; private String realTimeStatus;
/**
* 标定浓度值
*/
private BigDecimal calibrationConcentration;
/**
* 标定状态 4-正常,其他都是异常
* 0-预热;1-正常;3-传感器故障;4-报警;5-通讯故障; 只有是4的时候显示正常,其他的都是异常
*/
private String calibrationConcentrationStatus;
public String getMotherboardCode() { public String getMotherboardCode() {
return motherboardCode; return motherboardCode;
...@@ -111,4 +123,20 @@ public class MesDeviceDomain extends BaseEntity { ...@@ -111,4 +123,20 @@ public class MesDeviceDomain extends BaseEntity {
public void setRealTimeStatus(String realTimeStatus) { public void setRealTimeStatus(String realTimeStatus) {
this.realTimeStatus = realTimeStatus; this.realTimeStatus = realTimeStatus;
} }
public BigDecimal getCalibrationConcentration() {
return calibrationConcentration;
}
public void setCalibrationConcentration(BigDecimal calibrationConcentration) {
this.calibrationConcentration = calibrationConcentration;
}
public String getCalibrationConcentrationStatus() {
return calibrationConcentrationStatus;
}
public void setCalibrationConcentrationStatus(String calibrationConcentrationStatus) {
this.calibrationConcentrationStatus = calibrationConcentrationStatus;
}
} }
package com.zehong.system.domain; package com.zehong.system.domain;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
...@@ -135,6 +136,16 @@ public class PalletDeviceBinding extends BaseEntity ...@@ -135,6 +136,16 @@ public class PalletDeviceBinding extends BaseEntity
*/ */
private String realTimeStatus; private String realTimeStatus;
/**
* 标定浓度值
*/
private BigDecimal calibrationConcentration;
/**
* 标定状态 4-正常,其他都是异常
* 0-预热;1-正常;3-传感器故障;4-报警;5-通讯故障; 只有是4的时候显示正常,其他的都是异常
*/
private String calibrationConcentrationStatus;
public String getStatus() { public String getStatus() {
return status; return status;
} }
...@@ -343,6 +354,22 @@ public class PalletDeviceBinding extends BaseEntity ...@@ -343,6 +354,22 @@ public class PalletDeviceBinding extends BaseEntity
this.calibrationAdStatus = calibrationAdStatus; this.calibrationAdStatus = calibrationAdStatus;
} }
public BigDecimal getCalibrationConcentration() {
return calibrationConcentration;
}
public void setCalibrationConcentration(BigDecimal calibrationConcentration) {
this.calibrationConcentration = calibrationConcentration;
}
public String getCalibrationConcentrationStatus() {
return calibrationConcentrationStatus;
}
public void setCalibrationConcentrationStatus(String calibrationConcentrationStatus) {
this.calibrationConcentrationStatus = calibrationConcentrationStatus;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
package com.zehong.system.domain; package com.zehong.system.domain;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
...@@ -117,6 +118,16 @@ public class PalletDeviceUploadHistory extends BaseEntity ...@@ -117,6 +118,16 @@ public class PalletDeviceUploadHistory extends BaseEntity
@Excel(name = "实时AD状态;0-异常;1-正常") @Excel(name = "实时AD状态;0-异常;1-正常")
private String realTimeAdStatus; private String realTimeAdStatus;
/**
* 传感器校准浓度
*/
private BigDecimal calibrationConcentration;
/**
* 传感器校准状态 4-正常,其他都是异常
* 0-预热;1-正常;3-传感器故障;4-报警;5-通讯故障; 只有是4的时候显示正常,其他的都是异常
*/
private String calibrationConcentrationStatus;
public void setId(Long id) public void setId(Long id)
{ {
this.id = id; this.id = id;
...@@ -342,6 +353,22 @@ public class PalletDeviceUploadHistory extends BaseEntity ...@@ -342,6 +353,22 @@ public class PalletDeviceUploadHistory extends BaseEntity
this.trayCode = trayCode; this.trayCode = trayCode;
} }
public BigDecimal getCalibrationConcentration() {
return calibrationConcentration;
}
public void setCalibrationConcentration(BigDecimal calibrationConcentration) {
this.calibrationConcentration = calibrationConcentration;
}
public String getCalibrationConcentrationStatus() {
return calibrationConcentrationStatus;
}
public void setCalibrationConcentrationStatus(String calibrationConcentrationStatus) {
this.calibrationConcentrationStatus = calibrationConcentrationStatus;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
package com.zehong.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 标定结果数据接收历史记录对象 t_process_calibration_result_history
*
* @author zehong
* @date 2025-12-01
*/
public class ProcessCalibrationResultHistory extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 内容 */
@Excel(name = "内容")
private String message;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setMessage(String message)
{
this.message = message;
}
public String getMessage()
{
return message;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("createTime", getCreateTime())
.append("message", getMessage())
.toString();
}
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.ProcessCalibrationResultHistory;
/**
* 标定结果数据接收历史记录Mapper接口
*
* @author zehong
* @date 2025-12-01
*/
public interface ProcessCalibrationResultHistoryMapper
{
/**
* 查询标定结果数据接收历史记录
*
* @param id 标定结果数据接收历史记录ID
* @return 标定结果数据接收历史记录
*/
public ProcessCalibrationResultHistory selectProcessCalibrationResultHistoryById(Long id);
/**
* 查询标定结果数据接收历史记录列表
*
* @param processCalibrationResultHistory 标定结果数据接收历史记录
* @return 标定结果数据接收历史记录集合
*/
public List<ProcessCalibrationResultHistory> selectProcessCalibrationResultHistoryList(ProcessCalibrationResultHistory processCalibrationResultHistory);
/**
* 新增标定结果数据接收历史记录
*
* @param processCalibrationResultHistory 标定结果数据接收历史记录
* @return 结果
*/
public int insertProcessCalibrationResultHistory(ProcessCalibrationResultHistory processCalibrationResultHistory);
/**
* 修改标定结果数据接收历史记录
*
* @param processCalibrationResultHistory 标定结果数据接收历史记录
* @return 结果
*/
public int updateProcessCalibrationResultHistory(ProcessCalibrationResultHistory processCalibrationResultHistory);
/**
* 删除标定结果数据接收历史记录
*
* @param id 标定结果数据接收历史记录ID
* @return 结果
*/
public int deleteProcessCalibrationResultHistoryById(Long id);
/**
* 批量删除标定结果数据接收历史记录
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteProcessCalibrationResultHistoryByIds(Long[] ids);
}
...@@ -18,6 +18,8 @@ public interface SysConfigMapper ...@@ -18,6 +18,8 @@ public interface SysConfigMapper
*/ */
public SysConfig selectConfig(SysConfig config); public SysConfig selectConfig(SysConfig config);
public List<SysConfig> selectAgingStageTime();
/** /**
* 查询参数配置列表 * 查询参数配置列表
* *
......
package com.zehong.system.netty.event;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zehong.common.constant.RoboticArmConstans;
import com.zehong.common.utils.StringUtils;
import com.zehong.common.utils.http.HttpUtils;
import com.zehong.system.domain.*;
import com.zehong.system.service.IPalletDeviceBindingService;
import com.zehong.system.service.IPalletDeviceUploadHistoryService;
import com.zehong.system.service.IProcessCalibrationResultHistoryService;
import com.zehong.system.service.ISysConfigService;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* @author lenovo
* @date 2025/12/1
* @description 处理标定结果event
*/
@Component
public class CalibrationResultEventHandler {
private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(CalibrationResultEventHandler.class);
@Resource
private IPalletDeviceUploadHistoryService palletDeviceUploadHistoryService;
// 格式: /@A1_1/0/0.0/ 或 /@A2_1/0/0.0/ 或 /@A3_1/0/0.0/
private static final Pattern DEVICE_PATTERN = Pattern.compile("/@(A[1-4])_(\\d+)/([^/]+)/([^/]+)");
@Resource
private IPalletDeviceBindingService palletDeviceBindingService;
@Resource
private ISysConfigService sysConfigService;
@Resource
private IProcessCalibrationResultHistoryService processCalibrationResultHistoryService;
/**
* check是否启动 ,没启动就启动下 开始老化
*
* @param event event
*/
@Async("threadPoolTaskExecutor")
@EventListener(ProcessCalibrationResultsEvent.class)
public void handleProcessCalibrationResultsEventCommand(ProcessCalibrationResultsEvent event) {
String message = event.getMessage();
log.info("处理标定结果: {}", message);
// 先存历史记录
ProcessCalibrationResultHistory processCalibrationResultHistory = new ProcessCalibrationResultHistory();
processCalibrationResultHistory.setMessage(message);
processCalibrationResultHistoryService.insertProcessCalibrationResultHistory(processCalibrationResultHistory);
// 例如:更新校准状态、保存校准数据、通知前端等
// 1 根据信息拿到点位信息 假如说1L是传过来的
List<PalletDeviceBinding> palletDeviceBindings = initAdAndStatus(message);
// 2 解析数据上传MES 返回如果失败则记录失败,等下次有时间再上传
initMesDataAndUpload(palletDeviceBindings);
}
/**
* 初始化MES数据并上传
*/
private void initMesDataAndUpload(List<PalletDeviceBinding> palletDeviceBindings) {
if(palletDeviceBindings.isEmpty()) {
log.info("initMesDataAndUpload:没有数据需要处理");
return;
}
List<MesDeviceDomain> mesDeviceDomains = new ArrayList<>();
for (PalletDeviceBinding palletDeviceBinding : palletDeviceBindings) {
MesDeviceDomain mesDeviceDomain = new MesDeviceDomain();
// 主板码
mesDeviceDomain.setMotherboardCode(palletDeviceBinding.getDeviceCode());
// 标定浓度值
mesDeviceDomain.setCalibrationConcentration(palletDeviceBinding.getCalibrationConcentration());
// 标定状态
mesDeviceDomain.setCalibrationConcentrationStatus(palletDeviceBinding.getCalibrationConcentrationStatus());
// 浓度
mesDeviceDomain.setConcentration(palletDeviceBinding.getConcentration());
// 实时AD
mesDeviceDomain.setRealTimeAd(palletDeviceBinding.getRealTimeAd());
// 实时状态
mesDeviceDomain.setRealTimeStatus(palletDeviceBinding.getRealTimeStatus());
mesDeviceDomains.add(mesDeviceDomain);
}
String mesUploadAddress = sysConfigService.directSelectConfigByKey(RoboticArmConstans.UPLOAD_MES_ADDRESS);
if(StringUtils.isNotBlank(mesUploadAddress)) {
try{
String result = HttpUtils.sendPost(mesUploadAddress, JSON.toJSONString(mesDeviceDomains));
if(StringUtils.isNotBlank(result)) {
JSONObject jsonObject = JSON.parseObject(result);
if(jsonObject.getInteger("code") != 200) {
String data = jsonObject.getString("data");
if(StringUtils.isNotBlank(data)) {
processPalletDeviceUploadHistory(palletDeviceBindings,data);
}
}
} else {
directProcessPaalletDeviceUploadHistory(palletDeviceBindings);
}
}catch (Exception e){
directProcessPaalletDeviceUploadHistory(palletDeviceBindings);
}
} else {
directProcessPaalletDeviceUploadHistory(palletDeviceBindings);
}
}
/**
* 根据托盘码查询托盘绑定的设备列
*/
private List<PalletDeviceBinding> initAdAndStatus(String message) {
String trayCode = parseTrayCode(message);
if (StringUtils.isBlank(trayCode)) {
log.error("无法从消息中解析出托盘号: {}", message);
return new ArrayList<>();
}
List<PalletDeviceBinding> palletDeviceBindings = palletDeviceBindingService.listByTrayCode(trayCode);
if (palletDeviceBindings.isEmpty()) {
log.warn("未找到托盘号 {} 绑定的设备", trayCode);
return new ArrayList<>();
}
// 根据message 处理 标定浓度值 标定状态
List<DeviceData> deviceDataList = parseDeviceData(message);
if (deviceDataList.isEmpty()) {
log.warn("消息中未包含有效的设备数据: {}", message);
return palletDeviceBindings;
}
// 阶段四:根据顺序号更新设备
updateDevicesBySequence(palletDeviceBindings, deviceDataList);
// 批量更新
palletDeviceBindingService.batchUpdateAdAndStatus(palletDeviceBindings);
return palletDeviceBindings;
}
/**
* 阶段一:解析托盘号
* 消息格式: @00012346/@A1_1/0/0.0/@A1_2/0/0.0/@A1_3/0/0.0/
*/
private String parseTrayCode(String message) {
if (StringUtils.isBlank(message) || !message.startsWith("@")) {
return null;
}
try {
// 提取 @ 后面的内容,直到第一个 /
int endIndex = message.indexOf("/");
if (endIndex == -1) {
// 如果没有斜杠,整个消息就是托盘号(去掉@)
return message.substring(1);
}
// 提取托盘号(去掉开头的@)
return message.substring(1, endIndex);
} catch (Exception e) {
log.error("解析托盘号失败: {}", message, e);
return null;
}
}
/**
* 阶段二和阶段三:解析设备数据
*/
private List<DeviceData> parseDeviceData(String message) {
List<DeviceData> deviceDataList = new ArrayList<>();
if (StringUtils.isBlank(message)) {
return deviceDataList;
}
try {
// 使用正则表达式匹配所有设备数据
Matcher deviceMatcher = DEVICE_PATTERN.matcher(message);
while (deviceMatcher.find()) {
try {
String sequenceStr = deviceMatcher.group(1); // 顺序号
String statusStr = deviceMatcher.group(2); // 标定状态
String valueStr = deviceMatcher.group(3); // 标定值
// 解析数据
Integer sequenceNumber = parseInt(sequenceStr);
BigDecimal calibrationValue = parseBigDecimal(valueStr);
if (sequenceNumber != null) {
DeviceData deviceData = new DeviceData();
deviceData.setSequenceNumber(sequenceNumber);
deviceData.setCalibrationStatus(statusStr);
deviceData.setCalibrationValue(calibrationValue);
deviceDataList.add(deviceData);
log.debug("解析到设备数据: 顺序号={}, 状态={}, 值={}",
sequenceNumber, statusStr, calibrationValue);
}
} catch (Exception e) {
log.warn("解析设备数据失败,跳过此设备: {}", deviceMatcher.group(), e);
}
}
} catch (Exception e) {
log.error("解析设备数据列表失败: {}", message, e);
}
return deviceDataList;
}
/**
* 工具方法:解析整数
*/
private Integer parseInt(String str) {
if (StringUtils.isBlank(str)) {
return null;
}
try {
return Integer.parseInt(str.trim());
} catch (NumberFormatException e) {
log.warn("解析整数失败: {}", str, e);
return null;
}
}
/**
* 工具方法:解析BigDecimal
*/
private BigDecimal parseBigDecimal(String str) {
if (StringUtils.isBlank(str)) {
return null;
}
try {
return new BigDecimal(str.trim());
} catch (NumberFormatException e) {
log.warn("解析BigDecimal失败: {}", str, e);
return null;
}
}
/**
* 阶段四:根据顺序号更新设备
*/
private void updateDevicesBySequence(List<PalletDeviceBinding> bindings, List<DeviceData> deviceDataList) {
if (bindings == null || deviceDataList == null || deviceDataList.isEmpty()) {
return;
}
// 将设备数据转为以顺序号为key的Map
Map<Integer, DeviceData> deviceDataMap = new HashMap<>();
for (DeviceData data : deviceDataList) {
if (data.getSequenceNumber() != null) {
deviceDataMap.put(data.getSequenceNumber(), data);
}
}
// 更新设备绑定列表
for (PalletDeviceBinding binding : bindings) {
Integer sequenceNumber = binding.getNumber(); // 假设顺序号字段为number
if (sequenceNumber != null && deviceDataMap.containsKey(sequenceNumber)) {
DeviceData deviceData = deviceDataMap.get(sequenceNumber);
// 更新标定浓度值
if (deviceData.getCalibrationValue() != null) {
binding.setCalibrationConcentration(deviceData.getCalibrationValue());
}
// 更新标定状态
if (deviceData.getCalibrationStatus() != null) {
binding.setCalibrationConcentrationStatus(deviceData.getCalibrationStatus());
}
// 可以添加其他字段的更新,比如更新时间等
binding.setUpdateTime(new Date());
log.debug("更新设备绑定: 顺序号={}, 托盘号={}, 状态={}, 值={}",
sequenceNumber, binding.getfTrayCode(),
deviceData.getCalibrationStatus(),
deviceData.getCalibrationValue());
} else {
log.debug("未找到顺序号 {} 对应的设备数据", sequenceNumber);
}
}
}
/**
* 处理托盘设备上传历史数据
*/
private void processPalletDeviceUploadHistory(List<PalletDeviceBinding> palletDeviceBindings,String data){
JSONObject jsonObject = JSON.parseObject(data);
if (!jsonObject.containsKey("failedCodes")) {
return;
}
JSONArray failedCodes = jsonObject.getJSONArray("failedCodes");
if (failedCodes == null || failedCodes.isEmpty()) {
return;
}
// 使用Set提高查找效率
Set<String> failedCodeSet = failedCodes.stream()
.map(Object::toString)
.collect(Collectors.toSet());
List<PalletDeviceUploadHistory> palletDeviceUploadHistories = palletDeviceBindings.stream()
.filter(binding -> failedCodeSet.contains(binding.getDeviceCode()))
.map(this::convertToUploadHistory)
.collect(Collectors.toList());
if (!palletDeviceUploadHistories.isEmpty()) {
palletDeviceUploadHistoryService.batchInsert(palletDeviceUploadHistories);
}
}
/**
* 直接处理托盘设备上传历史数据
*/
private void directProcessPaalletDeviceUploadHistory(List<PalletDeviceBinding> palletDeviceBindings) {
List<PalletDeviceUploadHistory> collect = palletDeviceBindings.stream().map(this::convertToUploadHistory).collect(Collectors.toList());
palletDeviceUploadHistoryService.batchInsert(collect);
}
/**
* 转换对象
*/
private PalletDeviceUploadHistory convertToUploadHistory(PalletDeviceBinding binding) {
PalletDeviceUploadHistory history = new PalletDeviceUploadHistory();
// 基础信息字段
history.setTrayId(binding.getTrayId());
history.setDeviceCode(binding.getDeviceCode());
history.setRow(binding.getRow());
history.setCol(binding.getCol());
history.setIndex(binding.getIndex());
history.setNumber(binding.getNumber());
history.setBindingTime(binding.getBindingTime());
history.setUnbindingTime(binding.getUnbindingTime());
// 状态字段
history.setStatus(binding.getStatus());
// 时间记录字段
history.setRecordYear(binding.getRecordYear());
history.setRecordMonth(binding.getRecordMonth());
history.setRecordDate(binding.getRecordDate());
history.setRecordHour(binding.getRecordHour());
history.setRecordMinute(binding.getRecordMinute());
// 写入状态字段
history.setWriteTimeStatus(binding.getWriteTimeStatus());
history.setRunTimeStatus(binding.getRunTimeStatus());
// 调零相关字段
history.setAdjustmentZeroAd(binding.getAdjustmentZeroAd());
history.setZeroStatus(binding.getZeroStatus());
// 标定相关字段 - 注意字段名称不同
history.setCalibrationAd(binding.getCalibrationAd());
history.setCalibrationStatus(binding.getCalibrationAdStatus()); // 注意:这里字段名不同
// 浓度字段
history.setConcentration(binding.getConcentration());
// 实时AD相关字段
history.setRealTimeAd(binding.getRealTimeAd());
history.setRealTimeAdStatus(binding.getRealTimeStatus()); // 注意:这里字段名不同
// 托盘编号字段 - 注意字段名称不同
history.setTrayCode(binding.getfTrayCode()); // 注意:这里字段名不同
// 创建时间和更新时间(如果需要)
history.setCreateTime(binding.getCreateTime());
history.setUpdateTime(binding.getUpdateTime());
// 标定浓度字段 - 注意字段名称不同
history.setCalibrationConcentration(binding.getCalibrationConcentration());
history.setCalibrationConcentrationStatus(binding.getCalibrationConcentrationStatus());
return history;
}
}
package com.zehong.system.netty.event;
import org.springframework.context.ApplicationEvent;
/**
* @author lenovo
* @date 2025/12/1
* @description 处理标定结果event
*/
public class ProcessCalibrationResultsEvent extends ApplicationEvent {
private final String message;
public ProcessCalibrationResultsEvent(Object source,String message) {
super(source);
this.message = message;
}
public String getMessage() {
return message;
}
}
package com.zehong.system.netty.handler; package com.zehong.system.netty.handler;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zehong.common.utils.StringUtils;
import com.zehong.common.utils.bean.BeanUtils;
import com.zehong.common.utils.http.HttpUtils;
import com.zehong.system.domain.MesDeviceDomain;
import com.zehong.system.domain.PalletDeviceBinding;
import com.zehong.system.domain.PalletDeviceUploadHistory;
import com.zehong.system.domain.RobotArmCommand; import com.zehong.system.domain.RobotArmCommand;
import com.zehong.system.service.IPalletDeviceBindingService; import com.zehong.system.netty.event.ProcessCalibrationResultsEvent;
import com.zehong.system.service.IPalletDeviceUploadHistoryService;
import com.zehong.system.service.IRobotArmCommandService; import com.zehong.system.service.IRobotArmCommandService;
import com.zehong.system.service.ISysConfigService;
import com.zehong.system.service.websocket.RobotArmWebSocketHandler; import com.zehong.system.service.websocket.RobotArmWebSocketHandler;
import com.zehong.system.udp.RobotArmMessageParser; import com.zehong.system.udp.RobotArmMessageParser;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
...@@ -25,19 +14,19 @@ import io.netty.handler.timeout.IdleState; ...@@ -25,19 +14,19 @@ import io.netty.handler.timeout.IdleState;
import io.netty.handler.timeout.IdleStateEvent; import io.netty.handler.timeout.IdleStateEvent;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.net.SocketAddress; import java.io.*;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import java.io.*;
import java.util.stream.Collectors;
/** /**
* @author lenovo * @author lenovo
* @date 2025/7/31 * @date 2025/7/31
...@@ -51,9 +40,6 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP ...@@ -51,9 +40,6 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
// 日志文件保存目录 // 日志文件保存目录
// 写法1:使用双反斜杠 // 写法1:使用双反斜杠
private static final String LOG_DIR = "D:\\BaiduNetdiskDownload\\udp_message_logs\\"; private static final String LOG_DIR = "D:\\BaiduNetdiskDownload\\udp_message_logs\\";
// 上传MES地址的key
public static final String UPLOAD_MES_ADDRESS = "uploadMesAddress";
// 日期格式器,用于生成文件名和日志时间 // 日期格式器,用于生成文件名和日志时间
private static final SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("yyyyMMdd"); private static final SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("yyyyMMdd");
private static final SimpleDateFormat TIME_FORMATTER = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private static final SimpleDateFormat TIME_FORMATTER = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
...@@ -71,15 +57,8 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP ...@@ -71,15 +57,8 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
@Resource @Resource
private IRobotArmCommandService robotArmCommandService; private IRobotArmCommandService robotArmCommandService;
@Resource
private IPalletDeviceBindingService palletDeviceBindingService;
@Resource @Resource
private ISysConfigService sysConfigService; private ApplicationEventPublisher eventPublisher; // 新增事件发布器
@Resource
private IPalletDeviceUploadHistoryService palletDeviceUploadHistoryService;
/** /**
* 接收UDP消息 * 接收UDP消息
...@@ -121,7 +100,7 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP ...@@ -121,7 +100,7 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
// 记录最后活动时间 // 记录最后活动时间
lastActivityTime = System.currentTimeMillis(); lastActivityTime = System.currentTimeMillis();
// 判断消息类型并进行相应处理 // 判断消息类型并进行相应处理
if (correctMessage.startsWith("calibration")) { if (correctMessage.startsWith("@")) {
// 处理校准消息 // 处理校准消息
handleCalibrationMessage(ctx, packet, correctMessage); handleCalibrationMessage(ctx, packet, correctMessage);
} else { } else {
...@@ -186,9 +165,6 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP ...@@ -186,9 +165,6 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
private void handleCalibrationMessage(ChannelHandlerContext ctx, DatagramPacket packet, String message) { private void handleCalibrationMessage(ChannelHandlerContext ctx, DatagramPacket packet, String message) {
log.info("收到校准消息: {}", message); log.info("收到校准消息: {}", message);
// 示例:解析校准数据
// String calibrationData = message.substring("calibration".length()).trim();
// 示例:回复校准确认 // 示例:回复校准确认
String response = "校准消息已接收"; String response = "校准消息已接收";
byte[] responseBytes = response.getBytes(StandardCharsets.UTF_8); byte[] responseBytes = response.getBytes(StandardCharsets.UTF_8);
...@@ -196,157 +172,8 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP ...@@ -196,157 +172,8 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
io.netty.buffer.Unpooled.copiedBuffer(responseBytes), io.netty.buffer.Unpooled.copiedBuffer(responseBytes),
packet.sender())); packet.sender()));
// 例如:更新校准状态、保存校准数据、通知前端等 // 发布事件后一步处理
// 1 根据信息拿到点位信息 假如说1L是传过来的 eventPublisher.publishEvent(new ProcessCalibrationResultsEvent(this,message));
List<PalletDeviceBinding> palletDeviceBindings = initAdAndStatus(message);
// 2 解析数据上传MES 返回如果失败则记录失败,等下次有时间再上传
initMesDataAndUpload(palletDeviceBindings);
}
/**
* 初始化MES数据并上传
*/
private void initMesDataAndUpload(List<PalletDeviceBinding> palletDeviceBindings) {
List<MesDeviceDomain> mesDeviceDomains = new ArrayList<>();
for (PalletDeviceBinding palletDeviceBinding : palletDeviceBindings) {
MesDeviceDomain mesDeviceDomain = new MesDeviceDomain();
// 主板码
mesDeviceDomain.setMotherboardCode(palletDeviceBinding.getDeviceCode());
// 零点AD
mesDeviceDomain.setZeroAdValue(palletDeviceBinding.getAdjustmentZeroAd());
// 零点AD状态
mesDeviceDomain.setZeroStatus(palletDeviceBinding.getZeroStatus());
// 标定AD
mesDeviceDomain.setCalibratedAdValue(palletDeviceBinding.getCalibrationAd());
// 标定AD状态
mesDeviceDomain.setCalibrationStatus(palletDeviceBinding.getCalibrationAdStatus());
// 浓度
mesDeviceDomain.setConcentration(palletDeviceBinding.getConcentration());
// 实时AD
mesDeviceDomain.setRealTimeAd(palletDeviceBinding.getRealTimeAd());
// 实时状态
mesDeviceDomain.setRealTimeStatus(palletDeviceBinding.getRealTimeStatus());
mesDeviceDomains.add(mesDeviceDomain);
}
String mesUploadAddress = sysConfigService.directSelectConfigByKey(UPLOAD_MES_ADDRESS);
if(StringUtils.isNotBlank(mesUploadAddress)) {
String result = HttpUtils.sendPost(mesUploadAddress, JSON.toJSONString(mesDeviceDomains));
if(StringUtils.isBlank(result)) {
}
JSONObject jsonObject = JSON.parseObject(result);
if(jsonObject.getInteger("code") != 200) {
String data = jsonObject.getString("data");
if(StringUtils.isNotBlank(data)) {
processPalletDeviceUploadHistory(palletDeviceBindings,data);
}
}
}
}
/**
* 处理托盘设备上传历史数据
*/
private void processPalletDeviceUploadHistory(List<PalletDeviceBinding> palletDeviceBindings,String data){
JSONObject jsonObject = JSON.parseObject(data);
if (!jsonObject.containsKey("failedCodes")) {
return;
}
JSONArray failedCodes = jsonObject.getJSONArray("failedCodes");
if (failedCodes == null || failedCodes.isEmpty()) {
return;
}
// 使用Set提高查找效率
Set<String> failedCodeSet = failedCodes.stream()
.map(Object::toString)
.collect(Collectors.toSet());
List<PalletDeviceUploadHistory> palletDeviceUploadHistories = palletDeviceBindings.stream()
.filter(binding -> failedCodeSet.contains(binding.getDeviceCode()))
.map(this::convertToUploadHistory)
.collect(Collectors.toList());
if (!palletDeviceUploadHistories.isEmpty()) {
palletDeviceUploadHistoryService.batchInsert(palletDeviceUploadHistories);
}
}
/**
* 转换对象
*/
private PalletDeviceUploadHistory convertToUploadHistory(PalletDeviceBinding binding) {
PalletDeviceUploadHistory history = new PalletDeviceUploadHistory();
// 基础信息字段
history.setTrayId(binding.getTrayId());
history.setDeviceCode(binding.getDeviceCode());
history.setRow(binding.getRow());
history.setCol(binding.getCol());
history.setIndex(binding.getIndex());
history.setNumber(binding.getNumber());
history.setBindingTime(binding.getBindingTime());
history.setUnbindingTime(binding.getUnbindingTime());
// 状态字段
history.setStatus(binding.getStatus());
// 时间记录字段
history.setRecordYear(binding.getRecordYear());
history.setRecordMonth(binding.getRecordMonth());
history.setRecordDate(binding.getRecordDate());
history.setRecordHour(binding.getRecordHour());
history.setRecordMinute(binding.getRecordMinute());
// 写入状态字段
history.setWriteTimeStatus(binding.getWriteTimeStatus());
history.setRunTimeStatus(binding.getRunTimeStatus());
// 调零相关字段
history.setAdjustmentZeroAd(binding.getAdjustmentZeroAd());
history.setZeroStatus(binding.getZeroStatus());
// 标定相关字段 - 注意字段名称不同
history.setCalibrationAd(binding.getCalibrationAd());
history.setCalibrationStatus(binding.getCalibrationAdStatus()); // 注意:这里字段名不同
// 浓度字段
history.setConcentration(binding.getConcentration());
// 实时AD相关字段
history.setRealTimeAd(binding.getRealTimeAd());
history.setRealTimeAdStatus(binding.getRealTimeStatus()); // 注意:这里字段名不同
// 托盘编号字段 - 注意字段名称不同
history.setTrayCode(binding.getfTrayCode()); // 注意:这里字段名不同
// 创建时间和更新时间(如果需要)
history.setCreateTime(binding.getCreateTime());
history.setUpdateTime(binding.getUpdateTime());
return history;
}
/**
* 根据托盘码查询托盘绑定的设备列
*/
private List<PalletDeviceBinding> initAdAndStatus(String message) {
List<PalletDeviceBinding> palletDeviceBindings = palletDeviceBindingService.listByTrayCode("1L");
// 根据message 处理 零点AD 零点AD状态 标定AD 标定AD状态
// 批量更新
palletDeviceBindingService.batchUpdateAdAndStatus(palletDeviceBindings);
return palletDeviceBindings;
} }
/** /**
......
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.ProcessCalibrationResultHistory;
/**
* 标定结果数据接收历史记录Service接口
*
* @author zehong
* @date 2025-12-01
*/
public interface IProcessCalibrationResultHistoryService
{
/**
* 查询标定结果数据接收历史记录
*
* @param id 标定结果数据接收历史记录ID
* @return 标定结果数据接收历史记录
*/
public ProcessCalibrationResultHistory selectProcessCalibrationResultHistoryById(Long id);
/**
* 查询标定结果数据接收历史记录列表
*
* @param processCalibrationResultHistory 标定结果数据接收历史记录
* @return 标定结果数据接收历史记录集合
*/
public List<ProcessCalibrationResultHistory> selectProcessCalibrationResultHistoryList(ProcessCalibrationResultHistory processCalibrationResultHistory);
/**
* 新增标定结果数据接收历史记录
*
* @param processCalibrationResultHistory 标定结果数据接收历史记录
* @return 结果
*/
public int insertProcessCalibrationResultHistory(ProcessCalibrationResultHistory processCalibrationResultHistory);
/**
* 修改标定结果数据接收历史记录
*
* @param processCalibrationResultHistory 标定结果数据接收历史记录
* @return 结果
*/
public int updateProcessCalibrationResultHistory(ProcessCalibrationResultHistory processCalibrationResultHistory);
/**
* 批量删除标定结果数据接收历史记录
*
* @param ids 需要删除的标定结果数据接收历史记录ID
* @return 结果
*/
public int deleteProcessCalibrationResultHistoryByIds(Long[] ids);
/**
* 删除标定结果数据接收历史记录信息
*
* @param id 标定结果数据接收历史记录ID
* @return 结果
*/
public int deleteProcessCalibrationResultHistoryById(Long id);
}
package com.zehong.system.service; package com.zehong.system.service;
import java.util.List; import java.util.List;
import java.util.Map;
import com.zehong.system.domain.SysConfig; import com.zehong.system.domain.SysConfig;
/** /**
...@@ -28,6 +30,10 @@ public interface ISysConfigService ...@@ -28,6 +30,10 @@ public interface ISysConfigService
public String directSelectConfigByKey(String configKey); public String directSelectConfigByKey(String configKey);
public List<SysConfig> selectAgingStageTime();
public int updateAgingStageTime(List<SysConfig> sysConfigs);
/** /**
* 查询参数配置列表 * 查询参数配置列表
* *
......
...@@ -3,6 +3,7 @@ package com.zehong.system.service.impl; ...@@ -3,6 +3,7 @@ package com.zehong.system.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.zehong.common.constant.RoboticArmConstans;
import com.zehong.common.core.domain.AjaxResult; import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.StringUtils; import com.zehong.common.utils.StringUtils;
...@@ -157,10 +158,8 @@ public class PalletDeviceUploadHistoryServiceImpl implements IPalletDeviceUpload ...@@ -157,10 +158,8 @@ public class PalletDeviceUploadHistoryServiceImpl implements IPalletDeviceUpload
for (PalletDeviceUploadHistory palletDeviceBinding : palletDeviceUploadHistoryList) { for (PalletDeviceUploadHistory palletDeviceBinding : palletDeviceUploadHistoryList) {
MesDeviceDomain mesDeviceDomain = new MesDeviceDomain(); MesDeviceDomain mesDeviceDomain = new MesDeviceDomain();
if(StringUtils.isBlank(palletDeviceBinding.getDeviceCode()) if(StringUtils.isBlank(palletDeviceBinding.getDeviceCode())
|| StringUtils.isBlank(palletDeviceBinding.getAdjustmentZeroAd()) || palletDeviceBinding.getCalibrationConcentration()!= null
|| StringUtils.isBlank(palletDeviceBinding.getZeroStatus()) || StringUtils.isBlank(palletDeviceBinding.getCalibrationConcentrationStatus())
|| StringUtils.isBlank(palletDeviceBinding.getCalibrationAd())
|| StringUtils.isBlank(palletDeviceBinding.getCalibrationStatus())
|| StringUtils.isBlank(palletDeviceBinding.getConcentration()) || StringUtils.isBlank(palletDeviceBinding.getConcentration())
|| palletDeviceBinding.getRealTimeAd() == null || palletDeviceBinding.getRealTimeAd() == null
|| StringUtils.isBlank(palletDeviceBinding.getRealTimeAdStatus())) { || StringUtils.isBlank(palletDeviceBinding.getRealTimeAdStatus())) {
...@@ -168,14 +167,10 @@ public class PalletDeviceUploadHistoryServiceImpl implements IPalletDeviceUpload ...@@ -168,14 +167,10 @@ public class PalletDeviceUploadHistoryServiceImpl implements IPalletDeviceUpload
} }
// 主板码 // 主板码
mesDeviceDomain.setMotherboardCode(palletDeviceBinding.getDeviceCode()); mesDeviceDomain.setMotherboardCode(palletDeviceBinding.getDeviceCode());
// 零点AD // 标定浓度值
mesDeviceDomain.setZeroAdValue(palletDeviceBinding.getAdjustmentZeroAd()); mesDeviceDomain.setCalibrationConcentration(palletDeviceBinding.getCalibrationConcentration());
// 零点AD状态 // 标定浓度结果
mesDeviceDomain.setZeroStatus(palletDeviceBinding.getZeroStatus()); mesDeviceDomain.setCalibrationConcentrationStatus(palletDeviceBinding.getCalibrationConcentrationStatus());
// 标定AD
mesDeviceDomain.setCalibratedAdValue(palletDeviceBinding.getCalibrationAd());
// 标定AD状态
mesDeviceDomain.setCalibrationStatus(palletDeviceBinding.getCalibrationStatus());
// 浓度 // 浓度
mesDeviceDomain.setConcentration(palletDeviceBinding.getConcentration()); mesDeviceDomain.setConcentration(palletDeviceBinding.getConcentration());
// 实时AD // 实时AD
...@@ -185,7 +180,7 @@ public class PalletDeviceUploadHistoryServiceImpl implements IPalletDeviceUpload ...@@ -185,7 +180,7 @@ public class PalletDeviceUploadHistoryServiceImpl implements IPalletDeviceUpload
mesDeviceDomains.add(mesDeviceDomain); mesDeviceDomains.add(mesDeviceDomain);
} }
String mesUploadAddress = sysConfigService.directSelectConfigByKey(NettyUdpServerHandler.UPLOAD_MES_ADDRESS); String mesUploadAddress = sysConfigService.directSelectConfigByKey(RoboticArmConstans.UPLOAD_MES_ADDRESS);
if (StringUtils.isBlank(mesUploadAddress)) { if (StringUtils.isBlank(mesUploadAddress)) {
throw new RuntimeException("MES上传地址未配置"); throw new RuntimeException("MES上传地址未配置");
} }
......
package com.zehong.system.service.impl;
import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.ProcessCalibrationResultHistory;
import com.zehong.system.mapper.ProcessCalibrationResultHistoryMapper;
import com.zehong.system.service.IProcessCalibrationResultHistoryService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 标定结果数据接收历史记录Service业务层处理
*
* @author zehong
* @date 2025-12-01
*/
@Service
public class ProcessCalibrationResultHistoryServiceImpl implements IProcessCalibrationResultHistoryService
{
@Resource
private ProcessCalibrationResultHistoryMapper processCalibrationResultHistoryMapper;
/**
* 查询标定结果数据接收历史记录
*
* @param id 标定结果数据接收历史记录ID
* @return 标定结果数据接收历史记录
*/
@Override
public ProcessCalibrationResultHistory selectProcessCalibrationResultHistoryById(Long id)
{
return processCalibrationResultHistoryMapper.selectProcessCalibrationResultHistoryById(id);
}
/**
* 查询标定结果数据接收历史记录列表
*
* @param processCalibrationResultHistory 标定结果数据接收历史记录
* @return 标定结果数据接收历史记录
*/
@Override
public List<ProcessCalibrationResultHistory> selectProcessCalibrationResultHistoryList(ProcessCalibrationResultHistory processCalibrationResultHistory)
{
return processCalibrationResultHistoryMapper.selectProcessCalibrationResultHistoryList(processCalibrationResultHistory);
}
/**
* 新增标定结果数据接收历史记录
*
* @param processCalibrationResultHistory 标定结果数据接收历史记录
* @return 结果
*/
@Override
public int insertProcessCalibrationResultHistory(ProcessCalibrationResultHistory processCalibrationResultHistory)
{
processCalibrationResultHistory.setCreateTime(DateUtils.getNowDate());
return processCalibrationResultHistoryMapper.insertProcessCalibrationResultHistory(processCalibrationResultHistory);
}
/**
* 修改标定结果数据接收历史记录
*
* @param processCalibrationResultHistory 标定结果数据接收历史记录
* @return 结果
*/
@Override
public int updateProcessCalibrationResultHistory(ProcessCalibrationResultHistory processCalibrationResultHistory)
{
return processCalibrationResultHistoryMapper.updateProcessCalibrationResultHistory(processCalibrationResultHistory);
}
/**
* 批量删除标定结果数据接收历史记录
*
* @param ids 需要删除的标定结果数据接收历史记录ID
* @return 结果
*/
@Override
public int deleteProcessCalibrationResultHistoryByIds(Long[] ids)
{
return processCalibrationResultHistoryMapper.deleteProcessCalibrationResultHistoryByIds(ids);
}
/**
* 删除标定结果数据接收历史记录信息
*
* @param id 标定结果数据接收历史记录ID
* @return 结果
*/
@Override
public int deleteProcessCalibrationResultHistoryById(Long id)
{
return processCalibrationResultHistoryMapper.deleteProcessCalibrationResultHistoryById(id);
}
}
package com.zehong.system.service.impl; package com.zehong.system.service.impl;
import java.util.Collection; import java.util.*;
import java.util.List;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.annotation.Resource; import javax.annotation.Resource;
import com.zehong.common.constant.RoboticArmConstans;
import com.zehong.system.netty.handler.NettyUdpServerHandler; import com.zehong.system.netty.handler.NettyUdpServerHandler;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zehong.common.annotation.DataSource; import com.zehong.common.annotation.DataSource;
...@@ -102,6 +102,38 @@ public class SysConfigServiceImpl implements ISysConfigService ...@@ -102,6 +102,38 @@ public class SysConfigServiceImpl implements ISysConfigService
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
/**
* 查询 agingStage1Time agingStage2Time agingStage3Time
*
* @return r
*/
@Override
public List<SysConfig> selectAgingStageTime() {
List<SysConfig> sysConfigs = configMapper.selectAgingStageTime();
if(sysConfigs != null && sysConfigs.size() > 0) {
return sysConfigs;
}
return new ArrayList<>();
}
/**
* 更新 agingStage1Time agingStage2Time agingStage3Time
*
* @param sysConfigs s
* @return r
*/
@Override
public int updateAgingStageTime(List<SysConfig> sysConfigs) {
for(SysConfig sysConfig : sysConfigs) {
configMapper.directUpdateConfigByKey(sysConfig);
}
return 1;
}
/** /**
* 查询参数配置列表 * 查询参数配置列表
* *
...@@ -155,7 +187,7 @@ public class SysConfigServiceImpl implements ISysConfigService ...@@ -155,7 +187,7 @@ public class SysConfigServiceImpl implements ISysConfigService
*/ */
@Override @Override
public int updateUploadMesAddress(SysConfig sysConfig) { public int updateUploadMesAddress(SysConfig sysConfig) {
sysConfig.setConfigKey(NettyUdpServerHandler.UPLOAD_MES_ADDRESS); sysConfig.setConfigKey(RoboticArmConstans.UPLOAD_MES_ADDRESS);
return configMapper.directUpdateConfigByKey(sysConfig); return configMapper.directUpdateConfigByKey(sysConfig);
} }
......
package com.zehong.system.task; package com.zehong.system.task;
import com.zehong.common.constant.RoboticArmConstans;
import com.zehong.quartz.config.QuartzTaskMonitor; import com.zehong.quartz.config.QuartzTaskMonitor;
import com.zehong.system.service.ISysConfigService;
import com.zehong.system.task.DeviceCommJob.DeviceComm501Device1Job; import com.zehong.system.task.DeviceCommJob.DeviceComm501Device1Job;
import com.zehong.system.task.DeviceCommJob.DeviceComm501Device2Job; import com.zehong.system.task.DeviceCommJob.DeviceComm501Device2Job;
import com.zehong.system.task.DeviceCommJob.DeviceComm501Device3Job; import com.zehong.system.task.DeviceCommJob.DeviceComm501Device3Job;
...@@ -36,6 +38,9 @@ public class DeviceTaskScheduler { ...@@ -36,6 +38,9 @@ public class DeviceTaskScheduler {
public static final String JOB_GROUP = "DEVICE_TASKS"; public static final String JOB_GROUP = "DEVICE_TASKS";
// 触发器组名(统一固定,与原有逻辑保持一致) // 触发器组名(统一固定,与原有逻辑保持一致)
public static final String TRIGGER_GROUP = "DEVICE_TRIGGERS"; public static final String TRIGGER_GROUP = "DEVICE_TRIGGERS";
@Resource
private ISysConfigService sysConfigService;
// 新增:注入监控器 // 新增:注入监控器
@Autowired @Autowired
private QuartzTaskMonitor quartzTaskMonitor; private QuartzTaskMonitor quartzTaskMonitor;
...@@ -239,7 +244,16 @@ public class DeviceTaskScheduler { ...@@ -239,7 +244,16 @@ public class DeviceTaskScheduler {
.storeDurably(false) .storeDurably(false)
.build(); .build();
Date executeTime = Date.from(Instant.now().plus(5, ChronoUnit.MINUTES)); String s = sysConfigService.directSelectConfigByKey(RoboticArmConstans.AGING_STAGE1_TIME);
int delayMin = 0;
if(s != null) {
delayMin = Integer.parseInt(s);
}
if(delayMin == 0) {
delayMin = 5;
}
Date executeTime = Date.from(Instant.now().plus(delayMin, ChronoUnit.MINUTES));
// 关键修复:使用StartAt而不是StartNow // 关键修复:使用StartAt而不是StartNow
SimpleTrigger trigger = TriggerBuilder.newTrigger() SimpleTrigger trigger = TriggerBuilder.newTrigger()
.withIdentity(triggerKey) .withIdentity(triggerKey)
...@@ -286,7 +300,16 @@ public class DeviceTaskScheduler { ...@@ -286,7 +300,16 @@ public class DeviceTaskScheduler {
.storeDurably(false) .storeDurably(false)
.build(); .build();
Date executeTime = Date.from(Instant.now().plus(10, ChronoUnit.MINUTES)); String s = sysConfigService.directSelectConfigByKey(RoboticArmConstans.AGING_STAGE2_TIME);
int delayMin = 0;
if(s != null) {
delayMin = Integer.parseInt(s);
}
if(delayMin == 0) {
delayMin = 10;
}
Date executeTime = Date.from(Instant.now().plus(delayMin, ChronoUnit.MINUTES));
// 关键修复:使用StartAt而不是StartNow // 关键修复:使用StartAt而不是StartNow
SimpleTrigger trigger = TriggerBuilder.newTrigger() SimpleTrigger trigger = TriggerBuilder.newTrigger()
.withIdentity(triggerKey) .withIdentity(triggerKey)
...@@ -320,7 +343,15 @@ public class DeviceTaskScheduler { ...@@ -320,7 +343,15 @@ public class DeviceTaskScheduler {
.requestRecovery(true) .requestRecovery(true)
.build(); .build();
Date executeTime = Date.from(Instant.now().plus(15, ChronoUnit.MINUTES)); String s = sysConfigService.directSelectConfigByKey(RoboticArmConstans.AGING_STAGE3_TIME);
int delayMin = 0;
if(s != null) {
delayMin = Integer.parseInt(s);
}
if(delayMin == 0) {
delayMin = 15;
}
Date executeTime = Date.from(Instant.now().plus(delayMin, ChronoUnit.MINUTES));
SimpleTrigger trigger = TriggerBuilder.newTrigger() SimpleTrigger trigger = TriggerBuilder.newTrigger()
.withIdentity(triggerKey) .withIdentity(triggerKey)
.forJob(jobKey) .forJob(jobKey)
......
...@@ -33,6 +33,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -33,6 +33,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="realTimeAd" column="f_real_time_ad" /> <result property="realTimeAd" column="f_real_time_ad" />
<result property="realTimeStatus" column="f_real_time_ad_status" /> <result property="realTimeStatus" column="f_real_time_ad_status" />
<result property="calibrationConcentration" column="f_calibration_concentration" />
<result property="calibrationConcentrationStatus" column="f_calibration_concentration_status" />
</resultMap> </resultMap>
<sql id="selectPalletDeviceBindingVo"> <sql id="selectPalletDeviceBindingVo">
...@@ -61,7 +64,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -61,7 +64,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
palDeviceBinding.f_concentration, palDeviceBinding.f_concentration,
palDeviceBinding.f_run_time_status, palDeviceBinding.f_run_time_status,
palDeviceBinding.f_real_time_ad, palDeviceBinding.f_real_time_ad,
palDeviceBinding.f_real_time_ad_status palDeviceBinding.f_real_time_ad_status,
palDeviceBinding.f_calibration_concentration,
palDeviceBinding.f_calibration_concentration_status
from t_pallet_device_binding palDeviceBinding from t_pallet_device_binding palDeviceBinding
left join t_tray_info trayInfo on trayInfo.f_tray_id = palDeviceBinding.f_tray_id left join t_tray_info trayInfo on trayInfo.f_tray_id = palDeviceBinding.f_tray_id
</sql> </sql>
...@@ -136,7 +141,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -136,7 +141,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
f_concentration, f_concentration,
f_run_time_status, f_run_time_status,
f_real_time_ad, f_real_time_ad,
f_real_time_ad_status f_real_time_ad_status,
f_calibration_concentration,
f_calibration_concentration_status
from t_pallet_device_binding palDeviceBinding where palDeviceBinding.f_tray_id = ( from t_pallet_device_binding palDeviceBinding where palDeviceBinding.f_tray_id = (
SELECT SELECT
trayInfo.f_tray_id trayInfo.f_tray_id
...@@ -179,7 +186,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -179,7 +186,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
f_calibration_status = null, f_calibration_status = null,
f_run_time_status = null, f_run_time_status = null,
f_real_time_ad = null, f_real_time_ad = null,
f_real_time_ad_status = null f_real_time_ad_status = null,
f_calibration_concentration = null,
f_calibration_concentration_status = null
where f_tray_id = #{trayId} where f_tray_id = #{trayId}
</update> </update>
<insert id="insertPalletDeviceBinding" parameterType="PalletDeviceBinding" useGeneratedKeys="true" keyProperty="palletDeviceBindingId"> <insert id="insertPalletDeviceBinding" parameterType="PalletDeviceBinding" useGeneratedKeys="true" keyProperty="palletDeviceBindingId">
...@@ -227,7 +236,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -227,7 +236,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
f_concentration = null, f_concentration = null,
f_run_time_status = null, f_run_time_status = null,
f_real_time_ad = null, f_real_time_ad = null,
f_real_time_ad_status = null f_real_time_ad_status = null,
f_calibration_concentration = null,
f_calibration_concentration_status = null
where f_pallet_device_binding_id = #{palletDeviceBindingId} where f_pallet_device_binding_id = #{palletDeviceBindingId}
</update> </update>
<update id="updatePalletDeviceBinding" parameterType="PalletDeviceBinding"> <update id="updatePalletDeviceBinding" parameterType="PalletDeviceBinding">
...@@ -259,6 +270,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -259,6 +270,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="runTimeStatus != null">f_run_time_status = #{runTimeStatus},</if> <if test="runTimeStatus != null">f_run_time_status = #{runTimeStatus},</if>
<if test="realTimeAd != null">f_real_time_ad = #{realTimeAd},</if> <if test="realTimeAd != null">f_real_time_ad = #{realTimeAd},</if>
<if test="realTimeStatus != null">f_real_time_ad_status = #{realTimeStatus},</if> <if test="realTimeStatus != null">f_real_time_ad_status = #{realTimeStatus},</if>
<if test="calibrationConcentration != null">f_calibration_concentration = #{calibrationConcentration},</if>
<if test="calibrationConcentrationStatus != null">f_calibration_concentration_status = #{calibrationConcentrationStatus},</if>
</trim> </trim>
where f_pallet_device_binding_id = #{palletDeviceBindingId} where f_pallet_device_binding_id = #{palletDeviceBindingId}
</update> </update>
...@@ -303,7 +317,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -303,7 +317,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
f_concentration = null, f_concentration = null,
f_run_time_status = null, f_run_time_status = null,
f_real_time_ad = null, f_real_time_ad = null,
f_real_time_ad_status = null f_real_time_ad_status = null,
f_calibration_concentration = null,
f_calibration_concentration_status = null
<if test="item.deviceCode != null">f_device_code = #{item.deviceCode},</if> <if test="item.deviceCode != null">f_device_code = #{item.deviceCode},</if>
</trim> </trim>
WHERE f_pallet_device_binding_id = #{item.palletDeviceBindingId} WHERE f_pallet_device_binding_id = #{item.palletDeviceBindingId}
...@@ -327,7 +343,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -327,7 +343,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
f_concentration = null, f_concentration = null,
f_run_time_status = null, f_run_time_status = null,
f_real_time_ad = null, f_real_time_ad = null,
f_real_time_ad_status = null f_real_time_ad_status = null,
f_calibration_concentration = null,
f_calibration_concentration_status = null
where f_tray_id = #{trayId} where f_tray_id = #{trayId}
</update> </update>
......
...@@ -30,6 +30,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -30,6 +30,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="runTimeStatus" column="f_run_time_status" /> <result property="runTimeStatus" column="f_run_time_status" />
<result property="realTimeAd" column="f_real_time_ad" /> <result property="realTimeAd" column="f_real_time_ad" />
<result property="realTimeAdStatus" column="f_real_time_ad_status" /> <result property="realTimeAdStatus" column="f_real_time_ad_status" />
<result property="calibrationConcentration" column="f_calibration_concentration" />
<result property="calibrationConcentrationStatus" column="f_calibration_concentration_status" />
</resultMap> </resultMap>
<sql id="selectPalletDeviceUploadHistoryVo"> <sql id="selectPalletDeviceUploadHistoryVo">
...@@ -58,7 +61,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -58,7 +61,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
palDeviceBinding.f_concentration, palDeviceBinding.f_concentration,
palDeviceBinding.f_run_time_status, palDeviceBinding.f_run_time_status,
palDeviceBinding.f_real_time_ad, palDeviceBinding.f_real_time_ad,
palDeviceBinding.f_real_time_ad_status palDeviceBinding.f_real_time_ad_status,
palDeviceBinding.f_calibration_concentration,
palDeviceBinding.f_calibration_concentration_status
from t_pallet_device_upload_history palDeviceBinding from t_pallet_device_upload_history palDeviceBinding
left join t_tray_info trayInfo on trayInfo.f_tray_id = palDeviceBinding.f_tray_id left join t_tray_info trayInfo on trayInfo.f_tray_id = palDeviceBinding.f_tray_id
</sql> </sql>
...@@ -103,6 +108,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -103,6 +108,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="list[0].runTimeStatus != null">f_run_time_status,</if> <if test="list[0].runTimeStatus != null">f_run_time_status,</if>
<if test="list[0].realTimeAd != null">f_real_time_ad,</if> <if test="list[0].realTimeAd != null">f_real_time_ad,</if>
<if test="list[0].realTimeAdStatus != null">f_real_time_ad_status,</if> <if test="list[0].realTimeAdStatus != null">f_real_time_ad_status,</if>
<if test="list[0].calibrationConcentration != null">f_calibration_concentration,</if>
<if test="list[0].calibrationConcentrationStatus != null">f_calibration_concentration_status,</if>
</if> </if>
</trim> </trim>
values values
...@@ -132,6 +139,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -132,6 +139,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="item.runTimeStatus != null">#{item.runTimeStatus},</if> <if test="item.runTimeStatus != null">#{item.runTimeStatus},</if>
<if test="item.realTimeAd != null">#{item.realTimeAd},</if> <if test="item.realTimeAd != null">#{item.realTimeAd},</if>
<if test="item.realTimeAdStatus != null">#{item.realTimeAdStatus},</if> <if test="item.realTimeAdStatus != null">#{item.realTimeAdStatus},</if>
<if test="item.calibrationConcentration != null">#{item.calibrationConcentration},</if>
<if test="item.calibrationConcentrationStatus != null">#{item.calibrationConcentrationStatus},</if>
</trim> </trim>
</foreach> </foreach>
</insert> </insert>
...@@ -162,6 +171,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -162,6 +171,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="runTimeStatus != null">f_run_time_status,</if> <if test="runTimeStatus != null">f_run_time_status,</if>
<if test="realTimeAd != null">f_real_time_ad,</if> <if test="realTimeAd != null">f_real_time_ad,</if>
<if test="realTimeAdStatus != null">f_real_time_ad_status,</if> <if test="realTimeAdStatus != null">f_real_time_ad_status,</if>
<if test="calibrationConcentration != null">#{calibrationConcentration},</if>
<if test="calibrationConcentrationStatus != null">#{calibrationConcentrationStatus},</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="trayId != null">#{trayId},</if> <if test="trayId != null">#{trayId},</if>
...@@ -188,6 +199,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -188,6 +199,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="runTimeStatus != null">#{runTimeStatus},</if> <if test="runTimeStatus != null">#{runTimeStatus},</if>
<if test="realTimeAd != null">#{realTimeAd},</if> <if test="realTimeAd != null">#{realTimeAd},</if>
<if test="realTimeAdStatus != null">#{realTimeAdStatus},</if> <if test="realTimeAdStatus != null">#{realTimeAdStatus},</if>
<if test="calibrationConcentration != null">#{calibrationConcentration},</if>
<if test="calibrationConcentrationStatus != null">#{calibrationConcentrationStatus},</if>
</trim> </trim>
</insert> </insert>
...@@ -218,6 +231,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -218,6 +231,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="runTimeStatus != null">f_run_time_status = #{runTimeStatus},</if> <if test="runTimeStatus != null">f_run_time_status = #{runTimeStatus},</if>
<if test="realTimeAd != null">f_real_time_ad = #{realTimeAd},</if> <if test="realTimeAd != null">f_real_time_ad = #{realTimeAd},</if>
<if test="realTimeAdStatus != null">f_real_time_ad_status = #{realTimeAdStatus},</if> <if test="realTimeAdStatus != null">f_real_time_ad_status = #{realTimeAdStatus},</if>
<if test="calibrationConcentration != null">f_calibration_concentration = #{calibrationConcentration},</if>
<if test="calibrationConcentrationStatus != null">f_calibration_concentration_status = #{calibrationConcentrationStatus},</if>
</trim> </trim>
where f_id = #{id} where f_id = #{id}
</update> </update>
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.ProcessCalibrationResultHistoryMapper">
<resultMap type="ProcessCalibrationResultHistory" id="ProcessCalibrationResultHistoryResult">
<result property="id" column="f_id" />
<result property="createTime" column="f_create_time" />
<result property="message" column="f_message" />
</resultMap>
<sql id="selectProcessCalibrationResultHistoryVo">
select f_id, f_create_time, f_message from t_process_calibration_result_history
</sql>
<select id="selectProcessCalibrationResultHistoryList" parameterType="ProcessCalibrationResultHistory" resultMap="ProcessCalibrationResultHistoryResult">
<include refid="selectProcessCalibrationResultHistoryVo"/>
<where>
<if test="message != null and message != ''"> and f_message like concat ('%', #{message}, '%')</if>
</where>
</select>
<select id="selectProcessCalibrationResultHistoryById" parameterType="Long" resultMap="ProcessCalibrationResultHistoryResult">
<include refid="selectProcessCalibrationResultHistoryVo"/>
where f_id = #{id}
</select>
<insert id="insertProcessCalibrationResultHistory" parameterType="ProcessCalibrationResultHistory" useGeneratedKeys="true" keyProperty="id">
insert into t_process_calibration_result_history
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createTime != null">f_create_time,</if>
<if test="message != null">f_message,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="createTime != null">#{createTime},</if>
<if test="message != null">#{message},</if>
</trim>
</insert>
<update id="updateProcessCalibrationResultHistory" parameterType="ProcessCalibrationResultHistory">
update t_process_calibration_result_history
<trim prefix="SET" suffixOverrides=",">
<if test="createTime != null">f_create_time = #{createTime},</if>
<if test="message != null">f_message = #{message},</if>
</trim>
where f_id = #{id}
</update>
<delete id="deleteProcessCalibrationResultHistoryById" parameterType="Long">
delete from t_process_calibration_result_history where f_id = #{id}
</delete>
<delete id="deleteProcessCalibrationResultHistoryByIds" parameterType="String">
delete from t_process_calibration_result_history where f_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
...@@ -37,6 +37,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -37,6 +37,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectConfigVo"/> <include refid="selectConfigVo"/>
<include refid="sqlwhereSearch"/> <include refid="sqlwhereSearch"/>
</select> </select>
<select id="selectAgingStageTime" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
where config_key in ('agingStage1Time','agingStage2Time','agingStage3Time')
</select>
<select id="selectConfigList" parameterType="SysConfig" resultMap="SysConfigResult"> <select id="selectConfigList" parameterType="SysConfig" resultMap="SysConfigResult">
<include refid="selectConfigVo"/> <include refid="selectConfigVo"/>
......
import request from '@/utils/request'
// 查询标定结果数据接收历史记录列表
export function listHistory(query) {
return request({
url: '/calibrationResult/history/list',
method: 'get',
params: query
})
}
// 查询标定结果数据接收历史记录详细
export function getHistory(id) {
return request({
url: '/calibrationResult/history/' + id,
method: 'get'
})
}
// 新增标定结果数据接收历史记录
export function addHistory(data) {
return request({
url: '/calibrationResult/history',
method: 'post',
data: data
})
}
// 修改标定结果数据接收历史记录
export function updateHistory(data) {
return request({
url: '/calibrationResult/history',
method: 'put',
data: data
})
}
// 删除标定结果数据接收历史记录
export function delHistory(id) {
return request({
url: '/calibrationResult/history/' + id,
method: 'delete'
})
}
// 导出标定结果数据接收历史记录
export function exportHistory(query) {
return request({
url: '/calibrationResult/history/export',
method: 'get',
params: query
})
}
...@@ -31,6 +31,22 @@ export function getUploadMesAddress() { ...@@ -31,6 +31,22 @@ export function getUploadMesAddress() {
method: 'get' method: 'get'
}) })
} }
export function getAgingStageTime() {
return request({
url: '/system/config/getAgingStageTime',
method: 'get'
})
}
export function updateAgingStageTime(data) {
return request({
url: '/system/config/updateAgingStageTime',
method: 'post',
data: data
})
}
export function updateUploadMesAddress(data) { export function updateUploadMesAddress(data) {
return request({ return request({
url: '/system/config/updateUploadMesAddress/', url: '/system/config/updateUploadMesAddress/',
......
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="标定结果" prop="message">
<el-input v-model="queryParams.message" placeholder="请输入结果内容进行模糊搜索" clearable size="small" @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="historyList" @selection-change="handleSelectionChange">
<el-table-column label="接收时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleUpdate(scope.row)"
>详情</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改标定结果数据接收历史记录对话框 -->
<el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="内容" prop="message">
<el-input v-model="form.message" type="textarea" rows="20" disabled/>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
import { listHistory, getHistory, delHistory, addHistory, updateHistory, exportHistory } from "@/api/calibrationResult/calibrationResultHistory";
export default {
name: "History",
components: {
},
data() {
return {
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 标定结果数据接收历史记录表格数据
historyList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
createTime: null,
message: null
},
// 表单参数
form: {},
// 表单校验
rules: {
createTime: [
{ required: true, message: "创建时间不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询标定结果数据接收历史记录列表 */
getList() {
this.loading = true;
listHistory(this.queryParams).then(response => {
this.historyList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
createTime: null,
message: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加标定结果数据接收历史记录";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getHistory(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "标定结果数据接收历史记录详情";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateHistory(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addHistory(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除标定结果数据接收历史记录编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delHistory(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有标定结果数据接收历史记录数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportHistory(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
}
}
};
</script>
...@@ -100,20 +100,28 @@ ...@@ -100,20 +100,28 @@
<el-tag type="success" v-if="scope.row.realTimeAdStatus === '1'">正常</el-tag> <el-tag type="success" v-if="scope.row.realTimeAdStatus === '1'">正常</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="调零AD" align="center" prop="adjustmentZeroAd" /> <el-table-column label="标定浓度值" align="center" width="150" prop="calibrationConcentration"></el-table-column>
<el-table-column label="调零状态" align="center" prop="zeroStatus" > <el-table-column label="标定状态" align="center" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag type="info" v-if="scope.row.zeroStatus === '0'">异常</el-tag> <el-tag type="success" v-if="scope.row.calibrationConcentrationStatus !== null && scope.row.calibrationConcentrationStatus === '4'">正常</el-tag>
<el-tag type="success" v-if="scope.row.zeroStatus === '1'">正常</el-tag> <el-tag type="info" v-if="scope.row.calibrationConcentrationStatus !== null && scope.row.calibrationConcentrationStatus !== '4' ">异常</el-tag>
</template>
</el-table-column>
<el-table-column label="标定AD" align="center" prop="calibrationAd" />
<el-table-column label="标定状态" align="center" prop="calibrationStatus" >
<template slot-scope="scope">
<el-tag type="info" v-if="scope.row.calibrationStatus === '0'">异常</el-tag>
<el-tag type="success" v-if="scope.row.calibrationStatus === '1'">正常</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="调零AD" align="center" prop="adjustmentZeroAd" />-->
<!-- <el-table-column label="调零状态" align="center" prop="zeroStatus" >-->
<!-- <template slot-scope="scope">-->
<!-- <el-tag type="info" v-if="scope.row.zeroStatus === '0'">异常</el-tag>-->
<!-- <el-tag type="success" v-if="scope.row.zeroStatus === '1'">正常</el-tag>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="标定AD" align="center" prop="calibrationAd" />-->
<!-- <el-table-column label="标定状态" align="center" prop="calibrationStatus" >-->
<!-- <template slot-scope="scope">-->
<!-- <el-tag type="info" v-if="scope.row.calibrationStatus === '0'">异常</el-tag>-->
<!-- <el-tag type="success" v-if="scope.row.calibrationStatus === '1'">正常</el-tag>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="设置-年" align="center" prop="recordYear" /> <el-table-column label="设置-年" align="center" prop="recordYear" />
<el-table-column label="设置-月" align="center" prop="recordMonth" /> <el-table-column label="设置-月" align="center" prop="recordMonth" />
<el-table-column label="设置-日" align="center" prop="recordDate" /> <el-table-column label="设置-日" align="center" prop="recordDate" />
...@@ -314,6 +322,22 @@ export default { ...@@ -314,6 +322,22 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
// 获取标定状态文本
getCalibrationText(status) {
if (status === '4') {
return '正常'
} else if (status) {
return '异常'
}
},
// 获取标定状态的el-tag类型
getCalibrationTagType(status) {
if (status === '4') {
return 'success' // 正常 - 绿色
} else if (status) {
return 'info' // 异常 - 红色
}
},
/** 查询未上传成功的历史数据列列表 */ /** 查询未上传成功的历史数据列列表 */
getList() { getList() {
this.loading = true; this.loading = true;
......
...@@ -117,28 +117,28 @@ ...@@ -117,28 +117,28 @@
<span v-else class="write-unknown">-</span> <span v-else class="write-unknown">-</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="零点AD" align="center" width="150"> <!-- <el-table-column label="零点AD" align="center" width="150">-->
<!-- <template slot-scope="scope">-->
<!-- <div class="device-code">{{ scope.row.adjustmentZeroAd || '-' }}</div>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="零点AD状态" align="center" width="150">-->
<!-- <template slot-scope="scope">-->
<!-- <span v-if="scope.row.zeroStatus === '1'" class="write-success">正常</span>-->
<!-- <span v-else-if="scope.row.zeroStatus === '0'" class="write-failed">异常</span>-->
<!-- <span v-else class="write-unknown">-</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="标定浓度值" align="center" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="device-code">{{ scope.row.adjustmentZeroAd || '-' }}</div> <div class="device-code">{{ scope.row.calibrationConcentration || '-' }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="零点AD状态" align="center" width="150"> <el-table-column label="标定状态" align="center" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.zeroStatus === '1'" class="write-success">正常</span> <span :class="getCalibrationClass(scope.row.calibrationConcentrationStatus)">
<span v-else-if="scope.row.zeroStatus === '0'" class="write-failed">异常</span> {{ getCalibrationText(scope.row.calibrationConcentrationStatus) }}
<span v-else class="write-unknown">-</span> </span>
</template>
</el-table-column>
<el-table-column label="校准AD" align="center" width="120">
<template slot-scope="scope">
<div class="device-code">{{ scope.row.calibrationAd || '-' }}</div>
</template>
</el-table-column>
<el-table-column label="校准AD状态" align="center" width="120">
<template slot-scope="scope">
<span v-if="scope.row.calibrationAdStatus === '1'" class="write-success">正常</span>
<span v-else-if="scope.row.calibrationAdStatus === '0'" class="write-failed">异常</span>
<span v-else class="write-unknown">-</span>
</template> </template>
</el-table-column> </el-table-column>
...@@ -237,6 +237,27 @@ export default { ...@@ -237,6 +237,27 @@ export default {
} }
}, },
methods: { methods: {
// 获取标定状态文本
getCalibrationText(status) {
if (status === '4') {
return '正常'
} else if (status) {
return '异常'
} else {
return '-'
}
},
// 获取标定状态样式类
getCalibrationClass(status) {
if (status === '4') {
return 'write-success'
} else if (status) {
return 'write-failed'
} else {
return 'write-unknown'
}
},
/** 获取数据列表 */ /** 获取数据列表 */
getList() { getList() {
this.loading = true; this.loading = true;
......
<template>
<div class="app-container">
<el-form
ref="formRef"
:model="form"
:rules="rules"
label-width="300px"
class="config-form"
>
<!-- 提示信息 -->
<el-alert
title="提示"
type="info"
:closable="false"
style="margin-bottom: 20px;"
>
<div>71小时是4260分钟,72小时是4320分钟</div>
</el-alert>
<!-- 第一阶段 -->
<el-form-item
label="老化流程第一阶段执行时间(单位:分钟)"
prop="agingStage1Time"
>
<el-input-number
v-model="form.agingStage1Time"
:min="5"
:max="4260"
placeholder="请输入第一阶段执行时间"
controls-position="right"
style="width: 300px;"
@change="validateStage1"
/>
<div class="form-tips">必须大于等于5分钟</div>
</el-form-item>
<!-- 第二阶段 -->
<el-form-item
label="老化流程第二阶段执行时间(单位:分钟)"
prop="agingStage2Time"
>
<el-input-number
v-model="form.agingStage2Time"
:min="Math.max(10, form.agingStage1Time + 5)"
:max="4260"
placeholder="请输入第二阶段执行时间"
controls-position="right"
style="width: 300px;"
@change="validateStage2"
/>
<div class="form-tips">必须大于等于第一阶段时间5分钟及以上,最大4260分钟</div>
</el-form-item>
<!-- 第三阶段 -->
<el-form-item
label="老化流程第三阶段执行时间(单位:分钟)"
prop="agingStage3Time"
>
<el-input-number
v-model="form.agingStage3Time"
:min="Math.max(15, form.agingStage2Time + 5)"
:max="4320"
placeholder="请输入第三阶段执行时间"
controls-position="right"
style="width: 300px;"
@change="validateStage3"
/>
<div class="form-tips">必须大于等于第二阶段时间5分钟及以上,最大4320分钟</div>
</el-form-item>
<!-- 操作按钮 -->
<el-form-item>
<el-button
type="primary"
:loading="loading"
@click="submitForm"
>
保存
</el-button>
<el-button @click="resetForm">
重置
</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { getAgingStageTime, updateAgingStageTime } from "@/api/system/config";
export default {
name: "AgingConfig",
data() {
// 第一阶段验证规则
const validateStage1 = (rule, value, callback) => {
if (value === null || value === undefined || value === '') {
callback(new Error("第一阶段时间不能为空"));
} else if (value < 5) {
callback(new Error("第一阶段时间必须大于等于5分钟"));
} else if (value > 4260) {
callback(new Error("第一阶段时间不能超过4260分钟"));
} else {
callback();
}
};
// 第二阶段验证规则
const validateStage2 = (rule, value, callback) => {
if (value === null || value === undefined || value === '') {
callback(new Error("第二阶段时间不能为空"));
} else if (value < this.form.agingStage1Time + 5) {
callback(new Error("第二阶段时间必须大于等于第一阶段时间5分钟及以上"));
} else if (value > 4260) {
callback(new Error("第二阶段时间不能超过4260分钟"));
} else {
callback();
}
};
// 第三阶段验证规则
const validateStage3 = (rule, value, callback) => {
if (value === null || value === undefined || value === '') {
callback(new Error("第三阶段时间不能为空"));
} else if (value < this.form.agingStage2Time + 5) {
callback(new Error("第三阶段时间必须大于等于第二阶段时间5分钟及以上"));
} else if (value > 4320) {
callback(new Error("第三阶段时间不能超过4320分钟"));
} else {
callback();
}
};
return {
// 表单数据
form: {
agingStage1Time: null,
agingStage2Time: null,
agingStage3Time: null,
},
// 验证规则
rules: {
agingStage1Time: [
{ required: true, validator: validateStage1, trigger: ["blur", "change"] }
],
agingStage2Time: [
{ required: true, validator: validateStage2, trigger: ["blur", "change"] }
],
agingStage3Time: [
{ required: true, validator: validateStage3, trigger: ["blur", "change"] }
],
},
// 加载状态
loading: false,
// 配置键名
configKeys: {
stage1: "agingStage1Time",
stage2: "agingStage2Time",
stage3: "agingStage3Time",
},
};
},
created() {
this.getConfigData();
},
methods: {
// 获取配置数据
async getConfigData() {
try {
this.loading = true;
const response = await getAgingStageTime();
if (response.code === 200 && response.data) {
// 假设返回的数据格式为数组,包含三个配置项
const configs = response.data;
configs.forEach(item => {
switch (item.configKey) {
case this.configKeys.stage1:
this.form.agingStage1Time = parseInt(item.configValue) || 5;
break;
case this.configKeys.stage2:
this.form.agingStage2Time = parseInt(item.configValue) || 10;
break;
case this.configKeys.stage3:
this.form.agingStage3Time = parseInt(item.configValue) || 15;
break;
}
});
}
} catch (error) {
console.error("获取配置失败:", error);
this.$message.error("获取配置失败");
} finally {
this.loading = false;
}
},
// 提交表单
submitForm() {
this.$refs.formRef.validate(async (valid) => {
if (valid) {
try {
this.loading = true;
// 构建请求数据
const requestData = [
{
configKey: this.configKeys.stage1,
configValue: this.form.agingStage1Time.toString(),
},
{
configKey: this.configKeys.stage2,
configValue: this.form.agingStage2Time.toString(),
},
{
configKey: this.configKeys.stage3,
configValue: this.form.agingStage3Time.toString(),
},
];
const response = await updateAgingStageTime(requestData);
if (response.code === 200) {
this.$message.success("保存成功");
// 可以重新加载数据,也可以不清除表单状态
// this.getConfigData();
} else {
this.$message.error(response.msg || "保存失败");
}
} catch (error) {
console.error("保存失败:", error);
this.$message.error("保存失败");
} finally {
this.loading = false;
}
} else {
this.$message.warning("请检查表单填写是否正确");
return false;
}
});
},
// 重置表单
resetForm() {
this.getConfigData(); // 重置为服务器数据
},
// 第一阶段变化时触发验证
validateStage1() {
// 重新验证第二阶段和第三阶段
this.$refs.formRef.validateField("agingStage2Time");
this.$refs.formRef.validateField("agingStage3Time");
},
// 第二阶段变化时触发验证
validateStage2() {
// 重新验证第三阶段
this.$refs.formRef.validateField("agingStage3Time");
},
// 第三阶段变化时触发验证
validateStage3() {
// 不需要重新验证其他阶段
},
// 计算第二阶段的最小值
getStage2Min() {
return Math.max(10, (this.form.agingStage1Time || 5) + 5);
},
// 计算第三阶段的最小值
getStage3Min() {
return Math.max(15, (this.form.agingStage2Time || 10) + 5);
}
},
watch: {
'form.agingStage1Time': {
handler(newVal) {
// 当第一阶段变化时,确保第二阶段不小于第一阶段+5
if (newVal !== null && this.form.agingStage2Time !== null) {
const minStage2 = newVal + 5;
if (this.form.agingStage2Time < minStage2) {
this.form.agingStage2Time = minStage2;
}
}
},
immediate: true
},
'form.agingStage2Time': {
handler(newVal) {
// 当第二阶段变化时,确保第三阶段不小于第二阶段+5
if (newVal !== null && this.form.agingStage3Time !== null) {
const minStage3 = newVal + 5;
if (this.form.agingStage3Time < minStage3) {
this.form.agingStage3Time = minStage3;
}
}
},
immediate: true
}
}
};
</script>
<style scoped>
.app-container {
padding: 20px;
}
.config-form {
max-width: 800px;
margin: 0 auto;
padding: 30px;
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
.form-tips {
font-size: 12px;
color: #909399;
margin-top: 5px;
}
.el-input-number {
width: 100%;
}
::v-deep .el-form-item__label {
font-weight: bold;
color: #606266;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment