Commit 9d7953d8 authored by wanghao's avatar wanghao

1 接收标定数据后只更新实时数据,一键解绑后 去 记录 历史数据 和 上传MES调整,上传失败后记录失败记录。可再次上传。

2 解绑完成时 形成  历史数据 和 上传MES失败记录 两份数据及界面展示 调整。
3 老化过程中 读取设备数据,如果没读到数据 记录 通信异常。
parent 315e3959
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.PalletDeviceUploadFailure;
import com.zehong.system.service.IPalletDeviceUploadFailureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 上传失败历史记录Controller
*
* @author zehong
* @date 2026-01-16
*/
@RestController
@RequestMapping("/palletDevice/binding/failure")
public class PalletDeviceUploadFailureController extends BaseController
{
@Autowired
private IPalletDeviceUploadFailureService palletDeviceUploadFailureService;
/**
* 查询上传失败历史记录列表
*/
@GetMapping("/list")
public TableDataInfo list(PalletDeviceUploadFailure palletDeviceUploadFailure)
{
startPage();
List<PalletDeviceUploadFailure> list = palletDeviceUploadFailureService.selectPalletDeviceUploadFailureList(palletDeviceUploadFailure);
return getDataTable(list);
}
/**
* 重新上传
*/
@GetMapping("/handleReUpload")
public AjaxResult handleReUpload(){
return palletDeviceUploadFailureService.handleReUpload();
}
/**
* 导出上传失败历史记录列表
*/
@GetMapping("/export")
public AjaxResult export(PalletDeviceUploadFailure palletDeviceUploadFailure)
{
List<PalletDeviceUploadFailure> list = palletDeviceUploadFailureService.selectPalletDeviceUploadFailureList(palletDeviceUploadFailure);
ExcelUtil<PalletDeviceUploadFailure> util = new ExcelUtil<PalletDeviceUploadFailure>(PalletDeviceUploadFailure.class);
return util.exportExcel(list, "上传失败历史记录数据");
}
/**
* 获取上传失败历史记录详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(palletDeviceUploadFailureService.selectPalletDeviceUploadFailureById(id));
}
/**
* 新增上传失败历史记录
*/
@PostMapping
public AjaxResult add(@RequestBody PalletDeviceUploadFailure palletDeviceUploadFailure)
{
return toAjax(palletDeviceUploadFailureService.insertPalletDeviceUploadFailure(palletDeviceUploadFailure));
}
/**
* 修改上传失败历史记录
*/
@PutMapping
public AjaxResult edit(@RequestBody PalletDeviceUploadFailure palletDeviceUploadFailure)
{
return toAjax(palletDeviceUploadFailureService.updatePalletDeviceUploadFailure(palletDeviceUploadFailure));
}
/**
* 删除上传失败历史记录
*/
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(palletDeviceUploadFailureService.deletePalletDeviceUploadFailureByIds(ids));
}
}
...@@ -64,14 +64,6 @@ public class PalletDeviceUploadHistoryController extends BaseController ...@@ -64,14 +64,6 @@ public class PalletDeviceUploadHistoryController extends BaseController
return toAjax(palletDeviceUploadHistoryService.insertPalletDeviceUploadHistory(palletDeviceUploadHistory)); return toAjax(palletDeviceUploadHistoryService.insertPalletDeviceUploadHistory(palletDeviceUploadHistory));
} }
/**
* 重新上传
*/
@GetMapping("/handleReUpload")
public AjaxResult handleReUpload(){
return palletDeviceUploadHistoryService.handleReUpload();
}
/** /**
* 修改未上传成功的历史数据列 * 修改未上传成功的历史数据列
*/ */
......
...@@ -33,7 +33,7 @@ public class PalletDeviceBinding extends BaseEntity ...@@ -33,7 +33,7 @@ public class PalletDeviceBinding extends BaseEntity
private String storeyCode; private String storeyCode;
/** 绑定的设备编号 */ /** 绑定的设备编号 */
@Excel(name = "绑定的设备编号") @Excel(name = "绑定的设备编号")
private String deviceCode; private String motherboardCode;
/** 行 */ /** 行 */
@Excel(name = "行") @Excel(name = "行")
...@@ -64,9 +64,9 @@ public class PalletDeviceBinding extends BaseEntity ...@@ -64,9 +64,9 @@ public class PalletDeviceBinding extends BaseEntity
private Date unbindingTime; private Date unbindingTime;
/** /**
* 状态 0-预热;1-正常;3-传感器故障;4-报警;5-通讯故障 * 状态 0-预热;1-正常;3-传感器故障;4-报警;5-通讯故障;-9999 通讯异常
*/ */
private String status; private String deviceStatus;
/** /**
* modbus 通信设置时间 年 * modbus 通信设置时间 年
...@@ -180,12 +180,24 @@ public class PalletDeviceBinding extends BaseEntity ...@@ -180,12 +180,24 @@ public class PalletDeviceBinding extends BaseEntity
*/ */
private Integer networkStatus; private Integer networkStatus;
public String getStatus() { /**
return status; * 解绑状态 (0:否, 1:是)
*/
private String calibrationUnbindStatus;
/**
* 第一个解绑的设备编号
* 这个字段就是为了区分第一个解绑的设备编号标志,如果是的话,则 需要存 历史,上传MES,生成 标检 质检 等。
* 1 是 0 不是
*/
private String firstUnboundDeviceFlag;
public String getDeviceStatus() {
return deviceStatus;
} }
public void setStatus(String status) { public void setDeviceStatus(String deviceStatus) {
this.status = status; this.deviceStatus = deviceStatus;
} }
public void setPalletDeviceBindingId(Long palletDeviceBindingId) public void setPalletDeviceBindingId(Long palletDeviceBindingId)
...@@ -206,15 +218,15 @@ public class PalletDeviceBinding extends BaseEntity ...@@ -206,15 +218,15 @@ public class PalletDeviceBinding extends BaseEntity
{ {
return trayId; return trayId;
} }
public void setDeviceCode(String deviceCode)
{ public String getMotherboardCode() {
this.deviceCode = deviceCode; return motherboardCode;
} }
public String getDeviceCode() public void setMotherboardCode(String motherboardCode) {
{ this.motherboardCode = motherboardCode;
return deviceCode;
} }
public void setRow(Integer row) public void setRow(Integer row)
{ {
this.row = row; this.row = row;
...@@ -460,6 +472,22 @@ public class PalletDeviceBinding extends BaseEntity ...@@ -460,6 +472,22 @@ public class PalletDeviceBinding extends BaseEntity
this.storeyCode = storeyCode; this.storeyCode = storeyCode;
} }
public String getFirstUnboundDeviceFlag() {
return firstUnboundDeviceFlag;
}
public void setFirstUnboundDeviceFlag(String firstUnboundDeviceFlag) {
this.firstUnboundDeviceFlag = firstUnboundDeviceFlag;
}
public String getCalibrationUnbindStatus() {
return calibrationUnbindStatus;
}
public void setCalibrationUnbindStatus(String calibrationUnbindStatus) {
this.calibrationUnbindStatus = calibrationUnbindStatus;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
...@@ -467,14 +495,14 @@ public class PalletDeviceBinding extends BaseEntity ...@@ -467,14 +495,14 @@ public class PalletDeviceBinding extends BaseEntity
.append("trayId", getTrayId()) .append("trayId", getTrayId())
.append("storeyCode", getStoreyCode()) .append("storeyCode", getStoreyCode())
.append("fTrayCode", getfTrayCode()) .append("fTrayCode", getfTrayCode())
.append("deviceCode", getDeviceCode()) .append("motherboardCode", getMotherboardCode())
.append("row", getRow()) .append("row", getRow())
.append("col", getCol()) .append("col", getCol())
.append("index", getIndex()) .append("index", getIndex())
.append("number", getNumber()) .append("number", getNumber())
.append("bindingTime", getBindingTime()) .append("bindingTime", getBindingTime())
.append("unbindingTime", getUnbindingTime()) .append("unbindingTime", getUnbindingTime())
.append("status", getStatus()) .append("deviceStatus", getDeviceStatus())
.append("recordYear", getRecordYear()) .append("recordYear", getRecordYear())
.append("recordMonth", getRecordMonth()) .append("recordMonth", getRecordMonth())
.append("recordDate", getRecordDate()) .append("recordDate", getRecordDate())
...@@ -501,6 +529,7 @@ public class PalletDeviceBinding extends BaseEntity ...@@ -501,6 +529,7 @@ public class PalletDeviceBinding extends BaseEntity
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("calibrationUnbindStatus", getCalibrationUnbindStatus())
.toString(); .toString();
} }
} }
...@@ -33,7 +33,7 @@ public class PalletDeviceUploadHistory extends BaseEntity ...@@ -33,7 +33,7 @@ public class PalletDeviceUploadHistory extends BaseEntity
/** 绑定的设备编号 */ /** 绑定的设备编号 */
@Excel(name = "设备编号") @Excel(name = "设备编号")
private String deviceCode; private String motherboardCode;
/** 行 */ /** 行 */
@Excel(name = "行") @Excel(name = "行")
...@@ -58,12 +58,11 @@ public class PalletDeviceUploadHistory extends BaseEntity ...@@ -58,12 +58,11 @@ public class PalletDeviceUploadHistory extends BaseEntity
/** 解绑时间 */ /** 解绑时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "解绑时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date unbindingTime; private Date unbindingTime;
/** 0-预热;1-正常;3-传感器故障;4-报警;5-通讯故障 */ /** 0-预热;1-正常;3-传感器故障;4-报警;5-通讯故障 ;-9999-通讯异常*/
@Excel(name = "状态") @Excel(name = "状态")
private String status; private String deviceStatus;
/** 设置-年 */ /** 设置-年 */
@Excel(name = "设置-年") @Excel(name = "设置-年")
...@@ -103,7 +102,7 @@ public class PalletDeviceUploadHistory extends BaseEntity ...@@ -103,7 +102,7 @@ public class PalletDeviceUploadHistory extends BaseEntity
/** 合格;不合格 */ /** 合格;不合格 */
@Excel(name = "标定状态0-不合格;1-合格") @Excel(name = "标定状态0-不合格;1-合格")
private String calibrationStatus; private String calibrationAdStatus;
/** 浓度值 */ /** 浓度值 */
@Excel(name = "浓度值") @Excel(name = "浓度值")
...@@ -119,7 +118,7 @@ public class PalletDeviceUploadHistory extends BaseEntity ...@@ -119,7 +118,7 @@ public class PalletDeviceUploadHistory extends BaseEntity
/** 实时AD状态;0-异常;1-正常 */ /** 实时AD状态;0-异常;1-正常 */
@Excel(name = "实时AD状态;0-异常;1-正常 ") @Excel(name = "实时AD状态;0-异常;1-正常 ")
private String realTimeAdStatus; private String realTimeStatus;
/** /**
* 传感器校准浓度 * 传感器校准浓度
...@@ -187,14 +186,13 @@ public class PalletDeviceUploadHistory extends BaseEntity ...@@ -187,14 +186,13 @@ public class PalletDeviceUploadHistory extends BaseEntity
{ {
return trayId; return trayId;
} }
public void setDeviceCode(String deviceCode)
{ public String getMotherboardCode() {
this.deviceCode = deviceCode; return motherboardCode;
} }
public String getDeviceCode() public void setMotherboardCode(String motherboardCode) {
{ this.motherboardCode = motherboardCode;
return deviceCode;
} }
public void setRow(Integer row) public void setRow(Integer row)
{ {
...@@ -250,15 +248,15 @@ public class PalletDeviceUploadHistory extends BaseEntity ...@@ -250,15 +248,15 @@ public class PalletDeviceUploadHistory extends BaseEntity
{ {
return unbindingTime; return unbindingTime;
} }
public void setStatus(String status)
{ public String getDeviceStatus() {
this.status = status; return deviceStatus;
} }
public String getStatus() public void setDeviceStatus(String deviceStatus) {
{ this.deviceStatus = deviceStatus;
return status;
} }
public void setRecordYear(String recordYear) public void setRecordYear(String recordYear)
{ {
this.recordYear = recordYear; this.recordYear = recordYear;
...@@ -340,15 +338,15 @@ public class PalletDeviceUploadHistory extends BaseEntity ...@@ -340,15 +338,15 @@ public class PalletDeviceUploadHistory extends BaseEntity
{ {
return calibrationAd; return calibrationAd;
} }
public void setCalibrationStatus(String calibrationStatus)
{ public String getCalibrationAdStatus() {
this.calibrationStatus = calibrationStatus; return calibrationAdStatus;
} }
public String getCalibrationStatus() public void setCalibrationAdStatus(String calibrationAdStatus) {
{ this.calibrationAdStatus = calibrationAdStatus;
return calibrationStatus;
} }
public void setConcentration(String concentration) public void setConcentration(String concentration)
{ {
this.concentration = concentration; this.concentration = concentration;
...@@ -376,14 +374,13 @@ public class PalletDeviceUploadHistory extends BaseEntity ...@@ -376,14 +374,13 @@ public class PalletDeviceUploadHistory extends BaseEntity
{ {
return realTimeAd; return realTimeAd;
} }
public void setRealTimeAdStatus(String realTimeAdStatus)
{ public String getRealTimeStatus() {
this.realTimeAdStatus = realTimeAdStatus; return realTimeStatus;
} }
public String getRealTimeAdStatus() public void setRealTimeStatus(String realTimeStatus) {
{ this.realTimeStatus = realTimeStatus;
return realTimeAdStatus;
} }
public String getTrayCode() { public String getTrayCode() {
...@@ -473,14 +470,14 @@ public class PalletDeviceUploadHistory extends BaseEntity ...@@ -473,14 +470,14 @@ public class PalletDeviceUploadHistory extends BaseEntity
", trayId=" + trayId + ", trayId=" + trayId +
", storeyCode=" + storeyCode + ", storeyCode=" + storeyCode +
", trayCode='" + trayCode + '\'' + ", trayCode='" + trayCode + '\'' +
", deviceCode='" + deviceCode + '\'' + ", motherboardCode='" + motherboardCode + '\'' +
", row=" + row + ", row=" + row +
", col=" + col + ", col=" + col +
", index=" + index + ", index=" + index +
", number=" + number + ", number=" + number +
", bindingTime=" + bindingTime + ", bindingTime=" + bindingTime +
", unbindingTime=" + unbindingTime + ", unbindingTime=" + unbindingTime +
", status='" + status + '\'' + ", deviceStatus='" + deviceStatus + '\'' +
", recordYear='" + recordYear + '\'' + ", recordYear='" + recordYear + '\'' +
", recordMonth='" + recordMonth + '\'' + ", recordMonth='" + recordMonth + '\'' +
", recordDate='" + recordDate + '\'' + ", recordDate='" + recordDate + '\'' +
...@@ -490,11 +487,11 @@ public class PalletDeviceUploadHistory extends BaseEntity ...@@ -490,11 +487,11 @@ public class PalletDeviceUploadHistory extends BaseEntity
", adjustmentZeroAd='" + adjustmentZeroAd + '\'' + ", adjustmentZeroAd='" + adjustmentZeroAd + '\'' +
", zeroStatus='" + zeroStatus + '\'' + ", zeroStatus='" + zeroStatus + '\'' +
", calibrationAd='" + calibrationAd + '\'' + ", calibrationAd='" + calibrationAd + '\'' +
", calibrationStatus='" + calibrationStatus + '\'' + ", calibrationAdStatus='" + calibrationAdStatus + '\'' +
", concentration='" + concentration + '\'' + ", concentration='" + concentration + '\'' +
", runTimeStatus='" + runTimeStatus + '\'' + ", runTimeStatus='" + runTimeStatus + '\'' +
", realTimeAd=" + realTimeAd + ", realTimeAd=" + realTimeAd +
", realTimeAdStatus='" + realTimeAdStatus + '\'' + ", realTimeStatus='" + realTimeStatus + '\'' +
", calibrationConcentration=" + calibrationConcentration + ", calibrationConcentration=" + calibrationConcentration +
", calibrationConcentrationStatus='" + calibrationConcentrationStatus + '\'' + ", calibrationConcentrationStatus='" + calibrationConcentrationStatus + '\'' +
", writeSelfCheckStatus=" + writeSelfCheckStatus + ", writeSelfCheckStatus=" + writeSelfCheckStatus +
......
...@@ -48,6 +48,8 @@ public interface PalletDeviceBindingMapper ...@@ -48,6 +48,8 @@ public interface PalletDeviceBindingMapper
public int countDeviceByTrayId(Long trayId); public int countDeviceByTrayId(Long trayId);
public List<PalletDeviceBinding> listByTrayId(Long trayId);
/** /**
* 新增托盘绑定的设备列 * 新增托盘绑定的设备列
* *
...@@ -72,6 +74,8 @@ public interface PalletDeviceBindingMapper ...@@ -72,6 +74,8 @@ public interface PalletDeviceBindingMapper
public int unbindDevice(Long palletDeviceBindingId); public int unbindDevice(Long palletDeviceBindingId);
public int unbindDeviceByCalibrationUnbindStatus(Long palletDeviceBindingId);
public int resetAll(Long trayId); public int resetAll(Long trayId);
public int batchUpdateDeviceCode(@Param("palletDeviceBindingList") List<PalletDeviceBinding> palletDeviceBindingList); public int batchUpdateDeviceCode(@Param("palletDeviceBindingList") List<PalletDeviceBinding> palletDeviceBindingList);
......
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.PalletDeviceBinding;
import com.zehong.system.domain.PalletDeviceUploadFailure;
import com.zehong.system.domain.PalletDeviceUploadHistory;
/**
* 上传失败历史记录Mapper接口
*
* @author zehong
* @date 2026-01-16
*/
public interface PalletDeviceUploadFailureMapper
{
/**
* 查询上传失败历史记录
*
* @param id 上传失败历史记录ID
* @return 上传失败历史记录
*/
public PalletDeviceUploadFailure selectPalletDeviceUploadFailureById(Long id);
public int batchInsert(List<PalletDeviceUploadFailure> list);
public int batchInsertRealTimeData(List<PalletDeviceBinding> list);
/**
* 查询上传失败历史记录列表
*
* @param palletDeviceUploadFailure 上传失败历史记录
* @return 上传失败历史记录集合
*/
public List<PalletDeviceUploadFailure> selectPalletDeviceUploadFailureList(PalletDeviceUploadFailure palletDeviceUploadFailure);
/**
* 新增上传失败历史记录
*
* @param palletDeviceUploadFailure 上传失败历史记录
* @return 结果
*/
public int insertPalletDeviceUploadFailure(PalletDeviceUploadFailure palletDeviceUploadFailure);
/**
* 修改上传失败历史记录
*
* @param palletDeviceUploadFailure 上传失败历史记录
* @return 结果
*/
public int updatePalletDeviceUploadFailure(PalletDeviceUploadFailure palletDeviceUploadFailure);
/**
* 删除上传失败历史记录
*
* @param id 上传失败历史记录ID
* @return 结果
*/
public int deletePalletDeviceUploadFailureById(Long id);
/**
* 批量删除上传失败历史记录
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deletePalletDeviceUploadFailureByIds(Long[] ids);
}
package com.zehong.system.mapper; package com.zehong.system.mapper;
import java.util.List; import java.util.List;
import com.zehong.system.domain.PalletDeviceBinding;
import com.zehong.system.domain.PalletDeviceUploadHistory; import com.zehong.system.domain.PalletDeviceUploadHistory;
/** /**
...@@ -37,6 +39,8 @@ public interface PalletDeviceUploadHistoryMapper ...@@ -37,6 +39,8 @@ public interface PalletDeviceUploadHistoryMapper
public int batchInsert(List<PalletDeviceUploadHistory> list); public int batchInsert(List<PalletDeviceUploadHistory> list);
public int batchInsertRealTimeData(List<PalletDeviceBinding> list);
/** /**
* 修改未上传成功的历史数据列 * 修改未上传成功的历史数据列
* *
......
...@@ -127,7 +127,7 @@ public class ModbusResultHandler implements Consumer<DeviceStatusReaderDto> { ...@@ -127,7 +127,7 @@ public class ModbusResultHandler implements Consumer<DeviceStatusReaderDto> {
// 4. 校验数据长度并处理 // 4. 校验数据长度并处理
if (data.length >= 2) { if (data.length >= 2) {
// 更新设备状态 // 更新设备状态
palletDeviceBinding.setStatus(String.valueOf(data[1])); palletDeviceBinding.setDeviceStatus(String.valueOf(data[1]));
// 校验状态是否允许写时间 // 校验状态是否允许写时间
if (data[1] == 1 || data[1] == 3 || data[1] == 4) { if (data[1] == 1 || data[1] == 3 || data[1] == 4) {
...@@ -143,16 +143,16 @@ public class ModbusResultHandler implements Consumer<DeviceStatusReaderDto> { ...@@ -143,16 +143,16 @@ public class ModbusResultHandler implements Consumer<DeviceStatusReaderDto> {
} catch (ModbusInitException e) { } catch (ModbusInitException e) {
log.error("Modbus初始化异常:ip={}, port={}", ip, port, e); log.error("Modbus初始化异常:ip={}, port={}", ip, port, e);
palletDeviceBinding.setStatus("5"); palletDeviceBinding.setDeviceStatus("5");
recordAlarm(palletDeviceBinding, "Modbus初始化失败:" + e.getMessage()); recordAlarm(palletDeviceBinding, "Modbus初始化失败:" + e.getMessage());
} catch (ModbusTransportException e) { } catch (ModbusTransportException e) {
log.error("Modbus传输异常:ip={}, port={}, deviceId={}", ip, port, deviceId, e); log.error("Modbus传输异常:ip={}, port={}, deviceId={}", ip, port, deviceId, e);
palletDeviceBinding.setStatus("5"); palletDeviceBinding.setDeviceStatus("5");
recordAlarm(palletDeviceBinding, "Modbus写时间失败:" + e.getMessage()); recordAlarm(palletDeviceBinding, "Modbus写时间失败:" + e.getMessage());
} catch (Exception e) { } catch (Exception e) {
// 捕获其他异常(如NPE、数据溢出) // 捕获其他异常(如NPE、数据溢出)
log.error("处理Modbus数据异常:ip={}, port={}, deviceId={}", ip, port, deviceId, e); log.error("处理Modbus数据异常:ip={}, port={}, deviceId={}", ip, port, deviceId, e);
palletDeviceBinding.setStatus("5"); palletDeviceBinding.setDeviceStatus("5");
recordAlarm(palletDeviceBinding, "数据处理异常:" + e.getMessage()); recordAlarm(palletDeviceBinding, "数据处理异常:" + e.getMessage());
} finally { } finally {
// 关键:关闭Modbus连接,避免资源泄漏 // 关键:关闭Modbus连接,避免资源泄漏
...@@ -258,7 +258,7 @@ public class ModbusResultHandler implements Consumer<DeviceStatusReaderDto> { ...@@ -258,7 +258,7 @@ public class ModbusResultHandler implements Consumer<DeviceStatusReaderDto> {
* 统一告警记录(修复字段错误,确保写入成功) * 统一告警记录(修复字段错误,确保写入成功)
*/ */
private void recordAlarm(PalletDeviceBinding binding, String alarmMsg) { private void recordAlarm(PalletDeviceBinding binding, String alarmMsg) {
String equipmentCode = binding != null ? binding.getDeviceCode() : "unknown"; String equipmentCode = binding != null ? binding.getMotherboardCode() : "unknown";
recordAlarm(binding, equipmentCode, alarmMsg); recordAlarm(binding, equipmentCode, alarmMsg);
} }
......
...@@ -74,90 +74,11 @@ public class CalibrationResultEventHandler { ...@@ -74,90 +74,11 @@ public class CalibrationResultEventHandler {
processCalibrationResultHistoryService.insertProcessCalibrationResultHistory(processCalibrationResultHistory); processCalibrationResultHistoryService.insertProcessCalibrationResultHistory(processCalibrationResultHistory);
// 例如:更新校准状态、保存校准数据、通知前端等 // 例如:更新校准状态、保存校准数据、通知前端等
// 1 根据信息拿到点位信息 假如说1L是传过来的 // 1 根据信息拿到点位信息 假如说1L是传过来的
List<PalletDeviceBinding> palletDeviceBindings = initAdAndStatus(message); initAdAndStatus(message);
// 2 解析数据上传MES 返回如果失败则记录失败,等下次有时间再上传 // 2 解析数据上传MES 返回如果失败则记录失败,等下次有时间再上传
initMesDataAndUpload(palletDeviceBindings); // 20260116 调整 接收标定结果后 不存历史,解绑的时候才去处理。
} //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();
// 如果设备编号为空 则不处理改设备
if(StringUtils.isBlank(palletDeviceBinding.getDeviceCode())) continue;
// 主板码
mesDeviceDomain.setMotherboardCode(palletDeviceBinding.getDeviceCode());
// 浓度
mesDeviceDomain.setConcentration(palletDeviceBinding.getConcentration());
// 设备状态
mesDeviceDomain.setDeviceStatus(palletDeviceBinding.getStatus());
// 实时AD
mesDeviceDomain.setRealTimeAd(palletDeviceBinding.getRealTimeAd());
// 实时状态
mesDeviceDomain.setRealTimeStatus(palletDeviceBinding.getRealTimeStatus());
// 写时间状态
mesDeviceDomain.setWriteTimeStatus(palletDeviceBinding.getWriteTimeStatus());
// 运行时间状态
mesDeviceDomain.setRunTimeStatus(palletDeviceBinding.getRunTimeStatus());
// 标定浓度值
mesDeviceDomain.setCalibrationConcentration(palletDeviceBinding.getCalibrationConcentration());
// 标定状态
mesDeviceDomain.setCalibrationConcentrationStatus(palletDeviceBinding.getCalibrationConcentrationStatus());
mesDeviceDomain.setRecordYear(palletDeviceBinding.getRecordYear());
mesDeviceDomain.setRecordMonth(palletDeviceBinding.getRecordMonth());
mesDeviceDomain.setRecordDate(palletDeviceBinding.getRecordDate());
mesDeviceDomain.setRecordHour(palletDeviceBinding.getRecordHour());
mesDeviceDomain.setRecordMinute(palletDeviceBinding.getRecordMinute());
// 写入自检状态 继电器状态 脉冲状态 模块状态 SIM状态 网络状态
mesDeviceDomain.setWriteSelfCheckStatus(palletDeviceBinding.getWriteSelfCheckStatus());
mesDeviceDomain.setRelayStatus(palletDeviceBinding.getRelayStatus());
mesDeviceDomain.setPulseStatus(palletDeviceBinding.getPulseStatus());
mesDeviceDomain.setModuleStatus(palletDeviceBinding.getModuleStatus());
mesDeviceDomain.setSimCardStatus(palletDeviceBinding.getSimCardStatus());
mesDeviceDomain.setNetworkStatus(palletDeviceBinding.getNetworkStatus());
mesDeviceDomains.add(mesDeviceDomain);
}
String mesUploadAddress = sysConfigService.directSelectConfigByKey(RoboticArmConstans.UPLOAD_MES_ADDRESS);
if(StringUtils.isNotBlank(mesUploadAddress)) {
try{
String result = HttpUtils.sendPost(mesUploadAddress, JSON.toJSONString(mesDeviceDomains));
UploadMesResultHistory uploadMesResultHistory = new UploadMesResultHistory();
uploadMesResultHistory.setMessage(result);
uploadMesResultHistoryService.insertUploadMesResultHistory(uploadMesResultHistory);
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);
// }
// }
// 20251210 领导说 先 保存所有历史数据
directProcessPaalletDeviceUploadHistory(palletDeviceBindings);
} else {
directProcessPaalletDeviceUploadHistory(palletDeviceBindings);
}
}catch (Exception e){
directProcessPaalletDeviceUploadHistory(palletDeviceBindings);
}
} else {
directProcessPaalletDeviceUploadHistory(palletDeviceBindings);
}
} }
/** /**
...@@ -353,113 +274,6 @@ public class CalibrationResultEventHandler { ...@@ -353,113 +274,6 @@ public class CalibrationResultEventHandler {
} }
} }
/**
* 处理托盘设备上传历史数据
*/
private void processPalletDeviceUploadHistory(List<PalletDeviceBinding> palletDeviceBindings,String data){
JSONObject jsonObject = JSON.parseObject(data);
if (!jsonObject.containsKey("failedCodes")) {
return;
} else {
log.info("上传失败;没有返回正确数据");
}
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.setStoreyCode(binding.getStoreyCode());
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());
// 写入自检状态 继电器状态 脉冲状态 模组状态 SIM卡状态 网络状态
history.setWriteSelfCheckStatus(binding.getWriteSelfCheckStatus());
history.setRelayStatus(binding.getRelayStatus());
history.setPulseStatus(binding.getPulseStatus());
history.setModuleStatus(binding.getModuleStatus());
history.setSimCardStatus(binding.getSimCardStatus());
history.setNetworkStatus(binding.getNetworkStatus());
return history;
}
/** /**
* 设备数据内部类(如果需要存储设备类型,可以扩展此类) * 设备数据内部类(如果需要存储设备类型,可以扩展此类)
*/ */
......
package com.zehong.system.service;
import java.util.List;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.system.domain.PalletDeviceBinding;
import com.zehong.system.domain.PalletDeviceUploadFailure;
import com.zehong.system.domain.PalletDeviceUploadHistory;
/**
* 上传失败历史记录Service接口
*
* @author zehong
* @date 2026-01-16
*/
public interface IPalletDeviceUploadFailureService
{
/**
* 查询上传失败历史记录
*
* @param id 上传失败历史记录ID
* @return 上传失败历史记录
*/
public PalletDeviceUploadFailure selectPalletDeviceUploadFailureById(Long id);
public AjaxResult handleReUpload();
/**
* 查询上传失败历史记录列表
*
* @param palletDeviceUploadFailure 上传失败历史记录
* @return 上传失败历史记录集合
*/
public List<PalletDeviceUploadFailure> selectPalletDeviceUploadFailureList(PalletDeviceUploadFailure palletDeviceUploadFailure);
/**
* 新增上传失败历史记录
*
* @param palletDeviceUploadFailure 上传失败历史记录
* @return 结果
*/
public int insertPalletDeviceUploadFailure(PalletDeviceUploadFailure palletDeviceUploadFailure);
public int batchInsert(List<PalletDeviceUploadFailure> palletDeviceUploadFailures);
public int batchInsertRealTimeData(List<PalletDeviceBinding> palletDeviceBindings);
/**
* 修改上传失败历史记录
*
* @param palletDeviceUploadFailure 上传失败历史记录
* @return 结果
*/
public int updatePalletDeviceUploadFailure(PalletDeviceUploadFailure palletDeviceUploadFailure);
/**
* 批量删除上传失败历史记录
*
* @param ids 需要删除的上传失败历史记录ID
* @return 结果
*/
public int deletePalletDeviceUploadFailureByIds(Long[] ids);
/**
* 删除上传失败历史记录信息
*
* @param id 上传失败历史记录ID
* @return 结果
*/
public int deletePalletDeviceUploadFailureById(Long id);
}
...@@ -3,6 +3,7 @@ package com.zehong.system.service; ...@@ -3,6 +3,7 @@ package com.zehong.system.service;
import java.util.List; import java.util.List;
import com.zehong.common.core.domain.AjaxResult; import com.zehong.common.core.domain.AjaxResult;
import com.zehong.system.domain.PalletDeviceBinding;
import com.zehong.system.domain.PalletDeviceUploadHistory; import com.zehong.system.domain.PalletDeviceUploadHistory;
/** /**
...@@ -31,6 +32,8 @@ public interface IPalletDeviceUploadHistoryService ...@@ -31,6 +32,8 @@ public interface IPalletDeviceUploadHistoryService
public int batchInsert(List<PalletDeviceUploadHistory> palletDeviceUploadHistoryList); public int batchInsert(List<PalletDeviceUploadHistory> palletDeviceUploadHistoryList);
public int batchInsertRealTimeData(List<PalletDeviceBinding> palletDeviceBindings);
/** /**
* 新增未上传成功的历史数据列 * 新增未上传成功的历史数据列
* *
...@@ -39,8 +42,6 @@ public interface IPalletDeviceUploadHistoryService ...@@ -39,8 +42,6 @@ public interface IPalletDeviceUploadHistoryService
*/ */
public int insertPalletDeviceUploadHistory(PalletDeviceUploadHistory palletDeviceUploadHistory); public int insertPalletDeviceUploadHistory(PalletDeviceUploadHistory palletDeviceUploadHistory);
public AjaxResult handleReUpload();
/** /**
* 修改未上传成功的历史数据列 * 修改未上传成功的历史数据列
* *
......
...@@ -588,6 +588,9 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService ...@@ -588,6 +588,9 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService
throw new RuntimeException(e); throw new RuntimeException(e);
} }
tStoreyInfo.setfStatus("0");
tStoreyInfoMapper.updateStatusByCode(tStoreyInfo);
return AjaxResult.success(); return AjaxResult.success();
} }
......
...@@ -153,7 +153,7 @@ public class AgingStageOneProcessJob implements Job { ...@@ -153,7 +153,7 @@ public class AgingStageOneProcessJob implements Job {
int[] result = Modbus4jUtils.readDeviceWithRetry(ip, port, deviceId); int[] result = Modbus4jUtils.readDeviceWithRetry(ip, port, deviceId);
// 3. 更新设备状态 // 3. 更新设备状态
binding.setStatus(String.valueOf(result[1])); binding.setDeviceStatus(String.valueOf(result[1]));
// 4. 更新浓度值 // 4. 更新浓度值
binding.setConcentration(String.valueOf(result[0])); binding.setConcentration(String.valueOf(result[0]));
...@@ -194,8 +194,7 @@ public class AgingStageOneProcessJob implements Job { ...@@ -194,8 +194,7 @@ public class AgingStageOneProcessJob implements Job {
} catch (Exception e) { } catch (Exception e) {
log.info("设备{}处理异常: ip={}, port={}", deviceId, ip, port, e); log.info("设备{}处理异常: ip={}, port={}", deviceId, ip, port, e);
binding.setStatus("5"); binding.setDeviceStatus("-9999");
binding.setWriteTimeStatus("0");
palletDeviceBindingMapper.updatePalletDeviceBinding(binding); palletDeviceBindingMapper.updatePalletDeviceBinding(binding);
errorCount.incrementAndGet(); errorCount.incrementAndGet();
return false; return false;
...@@ -322,7 +321,7 @@ public class AgingStageOneProcessJob implements Job { ...@@ -322,7 +321,7 @@ public class AgingStageOneProcessJob implements Job {
* 统一告警记录(修复字段错误,确保写入成功) * 统一告警记录(修复字段错误,确保写入成功)
*/ */
private void recordAlarmByBinding(PalletDeviceBinding binding, String alarmMsg) { private void recordAlarmByBinding(PalletDeviceBinding binding, String alarmMsg) {
String equipmentCode = binding != null ? binding.getDeviceCode() : "unknown"; String equipmentCode = binding != null ? binding.getMotherboardCode() : "unknown";
recordAlarmByBingding(equipmentCode, alarmMsg); recordAlarmByBingding(equipmentCode, alarmMsg);
} }
......
...@@ -166,7 +166,7 @@ public class AgingStageThreeProcessJob implements Job { ...@@ -166,7 +166,7 @@ public class AgingStageThreeProcessJob implements Job {
int[] result = Modbus4jUtils.readDeviceWithRetry(ip, port, deviceId); int[] result = Modbus4jUtils.readDeviceWithRetry(ip, port, deviceId);
// 3. 更新设备状态 // 3. 更新设备状态
binding.setStatus(String.valueOf(result[1])); binding.setDeviceStatus(String.valueOf(result[1]));
// 3. 更新浓度值 // 3. 更新浓度值
binding.setConcentration(String.valueOf(result[0])); binding.setConcentration(String.valueOf(result[0]));
...@@ -205,7 +205,7 @@ public class AgingStageThreeProcessJob implements Job { ...@@ -205,7 +205,7 @@ public class AgingStageThreeProcessJob implements Job {
binding.setNetworkStatus(1); binding.setNetworkStatus(1);
} }
if("5".equals(binding.getStatus())) { if("5".equals(binding.getDeviceStatus())) {
binding.setWriteTimeStatus("0"); binding.setWriteTimeStatus("0");
} }
...@@ -217,7 +217,7 @@ public class AgingStageThreeProcessJob implements Job { ...@@ -217,7 +217,7 @@ public class AgingStageThreeProcessJob implements Job {
} catch (Exception e) { } catch (Exception e) {
log.error("设备{}处理异常: ip={}, port={}", deviceId, ip, port, e); log.error("设备{}处理异常: ip={}, port={}", deviceId, ip, port, e);
binding.setStatus("5"); binding.setDeviceStatus("-9999");
binding.setWriteTimeStatus("0"); binding.setWriteTimeStatus("0");
binding.setRunTimeStatus("0"); binding.setRunTimeStatus("0");
palletDeviceBindingMapper.updatePalletDeviceBinding(binding); palletDeviceBindingMapper.updatePalletDeviceBinding(binding);
...@@ -436,7 +436,7 @@ public class AgingStageThreeProcessJob implements Job { ...@@ -436,7 +436,7 @@ public class AgingStageThreeProcessJob implements Job {
* 统一告警记录(修复字段错误,确保写入成功) * 统一告警记录(修复字段错误,确保写入成功)
*/ */
private void recordAlarmByBinding(PalletDeviceBinding binding, String alarmMsg) { private void recordAlarmByBinding(PalletDeviceBinding binding, String alarmMsg) {
String equipmentCode = binding != null ? binding.getDeviceCode() : "unknown"; String equipmentCode = binding != null ? binding.getMotherboardCode() : "unknown";
recordAlarmByBingding(equipmentCode, alarmMsg); recordAlarmByBingding(equipmentCode, alarmMsg);
} }
......
...@@ -232,7 +232,7 @@ public class AgingStageTwoProcessJob implements Job { ...@@ -232,7 +232,7 @@ public class AgingStageTwoProcessJob implements Job {
} catch (Exception e) { } catch (Exception e) {
log.info("设备{}处理异常: ip={}, port={}", deviceId, ip, port, e); log.info("设备{}处理异常: ip={}, port={}", deviceId, ip, port, e);
binding.setStatus("5"); binding.setDeviceStatus("-9999");
palletDeviceBindingMapper.updatePalletDeviceBinding(binding); palletDeviceBindingMapper.updatePalletDeviceBinding(binding);
errorCount.incrementAndGet(); errorCount.incrementAndGet();
return false; return false;
......
...@@ -403,7 +403,7 @@ public abstract class BaseDeviceCommJob implements Job { ...@@ -403,7 +403,7 @@ public abstract class BaseDeviceCommJob implements Job {
try { try {
palletDeviceBinding = palletDeviceBindingMapper.selectByTrayIdAndIndex(ip, deviceId); palletDeviceBinding = palletDeviceBindingMapper.selectByTrayIdAndIndex(ip, deviceId);
if(palletDeviceBinding != null) { if(palletDeviceBinding != null) {
palletDeviceBinding.setStatus("4"); palletDeviceBinding.setDeviceStatus("4");
} }
} catch (Exception e) { } catch (Exception e) {
log.info("查询PalletDeviceBinding异常:ip={}, deviceId={}", ip, deviceId, e); log.info("查询PalletDeviceBinding异常:ip={}, deviceId={}", ip, deviceId, e);
......
...@@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
trayInfo.f_binding_time, trayInfo.f_binding_time,
trayInfo.f_unbinding_time, trayInfo.f_unbinding_time,
trayInfo.f_create_time, trayInfo.f_create_time,
( SELECT count( 1 ) FROM t_pallet_device_binding WHERE f_tray_id = trayInfo.f_tray_id AND ( f_device_code != '' ) AND f_unbinding_time IS NULL ) AS boardCount , ( SELECT count( 1 ) FROM t_pallet_device_binding WHERE f_tray_id = trayInfo.f_tray_id AND ( f_motherboard_code != '' ) AND f_unbinding_time IS NULL ) AS boardCount ,
storeyInfo.f_aging_start_time, storeyInfo.f_aging_start_time,
storeyInfo.f_estimated_end_time storeyInfo.f_estimated_end_time
FROM FROM
......
import request from '@/utils/request'
// 查询上传失败历史记录列表
export function listFailure(query) {
return request({
url: '/palletDevice/binding/failure/list',
method: 'get',
params: query
})
}
// 查询上传失败历史记录详细
export function getFailure(id) {
return request({
url: '/palletDevice/binding/failure/' + id,
method: 'get'
})
}
// 新增上传失败历史记录
export function addFailure(data) {
return request({
url: '/palletDevice/binding/failure',
method: 'post',
data: data
})
}
// 修改上传失败历史记录
export function updateFailure(data) {
return request({
url: '/palletDevice/binding/failure',
method: 'put',
data: data
})
}
// 删除上传失败历史记录
export function delFailure(id) {
return request({
url: '/palletDevice/binding/failure/' + id,
method: 'delete'
})
}
// 导出上传失败历史记录
export function exportFailure(query) {
return request({
url: '/palletDevice/binding/failure/export',
method: 'get',
params: query
})
}
export function reUpload() {
return request({
url: '/palletDevice/binding/failure/handleReUpload',
method: 'get'
})
}
...@@ -51,10 +51,3 @@ export function exportHistory(query) { ...@@ -51,10 +51,3 @@ export function exportHistory(query) {
params: query params: query
}) })
} }
export function reUpload() {
return request({
url: '/palletDevice/binding/history/handleReUpload',
method: 'get'
})
}
This diff is collapsed.
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="设备编号" prop="deviceCode"> <el-form-item label="设备编号" prop="motherboardCode">
<el-input <el-input
v-model="queryParams.deviceCode" v-model="queryParams.motherboardCode"
placeholder="请输入绑定的设备编号" placeholder="请输入绑定的设备编号"
clearable clearable
size="small" size="small"
...@@ -26,15 +26,6 @@ ...@@ -26,15 +26,6 @@
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
...@@ -45,23 +36,13 @@ ...@@ -45,23 +36,13 @@
@click="handleExport" @click="handleExport"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-upload"
size="mini"
:loading="exportLoading"
@click="handleReUpload"
>重新上传</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="historyList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="historyList" @selection-change="handleSelectionChange">
<el-table-column label="托盘编号" align="center" prop="trayCode" /> <el-table-column label="托盘编号" align="center" prop="trayCode" />
<el-table-column label="绑定层编号" align="center" prop="storeyCode" width="100px" /> <el-table-column label="绑定层编号" align="center" prop="storeyCode" width="100px" />
<el-table-column label="设备编号" align="center" prop="deviceCode" /> <el-table-column label="设备编号" align="center" prop="motherboardCode" />
<el-table-column label="行" align="center" prop="row" /> <el-table-column label="行" align="center" prop="row" />
<el-table-column label="列" align="center" prop="col" /> <el-table-column label="列" align="center" prop="col" />
<el-table-column label="第几个" align="center" prop="index" /> <el-table-column label="第几个" align="center" prop="index" />
...@@ -71,18 +52,14 @@ ...@@ -71,18 +52,14 @@
<span>{{ parseTime(scope.row.bindingTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> <span>{{ parseTime(scope.row.bindingTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="解绑时间" align="center" prop="unbindingTime" width="180"> <el-table-column label="状态" align="center" prop="deviceStatus" >
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.unbindingTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> <el-tag type="info" v-if="scope.row.deviceStatus === '0'">预热</el-tag>
</template> <el-tag type="success" v-if="scope.row.deviceStatus === '1'">正常</el-tag>
</el-table-column> <el-tag type="warning" v-if="scope.row.deviceStatus === '3'">传感器故障</el-tag>
<el-table-column label="状态" align="center" prop="status" > <el-tag type="danger" v-if="scope.row.deviceStatus === '4'">报警</el-tag>
<template slot-scope="scope"> <el-tag type="danger" v-if="scope.row.deviceStatus === '5'">通讯故障</el-tag>
<el-tag type="info" v-if="scope.row.status === '0'">预热</el-tag> <el-tag type="danger" v-if="scope.row.deviceStatus === '-9999'">通讯异常</el-tag>
<el-tag type="success" v-if="scope.row.status === '1'">正常</el-tag>
<el-tag type="warning" v-if="scope.row.status === '3'">传感器故障</el-tag>
<el-tag type="danger" v-if="scope.row.status === '4'">报警</el-tag>
<el-tag type="danger" v-if="scope.row.status === '5'">通讯故障</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="写时间状态" align="center" prop="writeTimeStatus" width="100px" > <el-table-column label="写时间状态" align="center" prop="writeTimeStatus" width="100px" >
...@@ -99,10 +76,10 @@ ...@@ -99,10 +76,10 @@
</el-table-column> </el-table-column>
<el-table-column label="浓度值" align="center" prop="concentration" /> <el-table-column label="浓度值" align="center" prop="concentration" />
<el-table-column label="实时AD值" align="center" prop="realTimeAd" /> <el-table-column label="实时AD值" align="center" prop="realTimeAd" />
<el-table-column label="实时AD状态" align="center" prop="realTimeAdStatus" width="110px" > <el-table-column label="实时AD状态" align="center" prop="realTimeStatus" width="110px" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag type="info" v-if="scope.row.realTimeAdStatus === '0'">异常</el-tag> <el-tag type="info" v-if="scope.row.realTimeStatus === '0'">异常</el-tag>
<el-tag type="success" v-if="scope.row.realTimeAdStatus === '1'">正常</el-tag> <el-tag type="success" v-if="scope.row.realTimeStatus === '1'">正常</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="标定浓度值" align="center" width="150" prop="calibrationConcentration"></el-table-column> <el-table-column label="标定浓度值" align="center" width="150" prop="calibrationConcentration"></el-table-column>
...@@ -194,8 +171,8 @@ ...@@ -194,8 +171,8 @@
<el-form-item label="托盘id" prop="trayId"> <el-form-item label="托盘id" prop="trayId">
<el-input v-model="form.trayId" placeholder="请输入托盘id" /> <el-input v-model="form.trayId" placeholder="请输入托盘id" />
</el-form-item> </el-form-item>
<el-form-item label="绑定的设备编号" prop="deviceCode"> <el-form-item label="绑定的设备编号" prop="motherboardCode">
<el-input v-model="form.deviceCode" placeholder="请输入绑定的设备编号" /> <el-input v-model="form.motherboardCode" placeholder="请输入绑定的设备编号" />
</el-form-item> </el-form-item>
<el-form-item label="行" prop="row"> <el-form-item label="行" prop="row">
<el-input v-model="form.row" placeholder="请输入行" /> <el-input v-model="form.row" placeholder="请输入行" />
...@@ -226,7 +203,7 @@ ...@@ -226,7 +203,7 @@
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="0-预热;1-正常;3-传感器故障;4-报警;5-通讯故障"> <el-form-item label="0-预热;1-正常;3-传感器故障;4-报警;5-通讯故障">
<el-radio-group v-model="form.status"> <el-radio-group v-model="form.deviceStatus">
<el-radio label="1">请选择字典生成</el-radio> <el-radio label="1">请选择字典生成</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
...@@ -278,7 +255,7 @@ ...@@ -278,7 +255,7 @@
<el-input v-model="form.realTimeAd" placeholder="请输入实时AD值" /> <el-input v-model="form.realTimeAd" placeholder="请输入实时AD值" />
</el-form-item> </el-form-item>
<el-form-item label="实时AD状态;0-异常;1-正常"> <el-form-item label="实时AD状态;0-异常;1-正常">
<el-radio-group v-model="form.realTimeAdStatus"> <el-radio-group v-model="form.realTimeStatus">
<el-radio label="1">请选择字典生成</el-radio> <el-radio label="1">请选择字典生成</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
...@@ -292,7 +269,7 @@ ...@@ -292,7 +269,7 @@
</template> </template>
<script> <script>
import { listHistory, getHistory, delHistory, addHistory, updateHistory, exportHistory ,reUpload} from "@/api/palletDeviceBinding/palletDeviceUploadHistory"; import { listHistory, getHistory, delHistory, addHistory, updateHistory, exportHistory} from "@/api/palletDeviceBinding/palletDeviceUploadHistory";
export default { export default {
name: "History", name: "History",
...@@ -325,7 +302,7 @@ export default { ...@@ -325,7 +302,7 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
trayId: null, trayId: null,
deviceCode: null, motherboardCode: null,
trayCode: null, trayCode: null,
row: null, row: null,
col: null, col: null,
...@@ -334,7 +311,7 @@ export default { ...@@ -334,7 +311,7 @@ export default {
bindingTime: null, bindingTime: null,
unbindingTime: null, unbindingTime: null,
createTime: null, createTime: null,
status: null, deviceStatus: null,
recordYear: null, recordYear: null,
recordMonth: null, recordMonth: null,
recordDate: null, recordDate: null,
...@@ -348,7 +325,7 @@ export default { ...@@ -348,7 +325,7 @@ export default {
concentration: null, concentration: null,
runTimeStatus: null, runTimeStatus: null,
realTimeAd: null, realTimeAd: null,
realTimeAdStatus: null realTimeStatus: null
}, },
// 表单参数 // 表单参数
form: {}, form: {},
...@@ -365,18 +342,18 @@ export default { ...@@ -365,18 +342,18 @@ export default {
}, },
methods: { methods: {
// 获取标定状态文本 // 获取标定状态文本
getCalibrationText(status) { getCalibrationText(deviceStatus) {
if (status === '4') { if (deviceStatus === '4') {
return '正常' return '正常'
} else if (status) { } else if (deviceStatus) {
return '异常' return '异常'
} }
}, },
// 获取标定状态的el-tag类型 // 获取标定状态的el-tag类型
getCalibrationTagType(status) { getCalibrationTagType(deviceStatus) {
if (status === '4') { if (deviceStatus === '4') {
return 'success' // 正常 - 绿色 return 'success' // 正常 - 绿色
} else if (status) { } else if (deviceStatus) {
return 'info' // 异常 - 红色 return 'info' // 异常 - 红色
} }
}, },
...@@ -399,7 +376,7 @@ export default { ...@@ -399,7 +376,7 @@ export default {
this.form = { this.form = {
id: null, id: null,
trayId: null, trayId: null,
deviceCode: null, motherboardCode: null,
row: null, row: null,
col: null, col: null,
index: null, index: null,
...@@ -407,7 +384,7 @@ export default { ...@@ -407,7 +384,7 @@ export default {
bindingTime: null, bindingTime: null,
unbindingTime: null, unbindingTime: null,
createTime: null, createTime: null,
status: "0", deviceStatus: "0",
recordYear: null, recordYear: null,
recordMonth: null, recordMonth: null,
recordDate: null, recordDate: null,
...@@ -421,7 +398,7 @@ export default { ...@@ -421,7 +398,7 @@ export default {
concentration: null, concentration: null,
runTimeStatus: "0", runTimeStatus: "0",
realTimeAd: null, realTimeAd: null,
realTimeAdStatus: "0" realTimeStatus: "0"
}; };
this.resetForm("form"); this.resetForm("form");
}, },
...@@ -491,23 +468,6 @@ export default { ...@@ -491,23 +468,6 @@ export default {
this.msgSuccess("删除成功"); this.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {});
}, },
handleReUpload() {
this.$confirm('是否确认重新上传当前时间下设备编号不为空的所有数据?', '提示-成功后数据直接删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
reUpload().then(response => {
// 确保 response 有正确的结构
if (response && response.code === 200) {
// 处理部分失败或完全失败的情况
this.handleUploadResult(response);
}
this.getList(); // 重新加载数据
})
}).catch(() => {
});
},
// 单独处理上传结果的方法 // 单独处理上传结果的方法
handleUploadResult(response) { handleUploadResult(response) {
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</el-input> </el-input>
<el-input <el-input
class="search-input" class="search-input"
v-model="queryParams.deviceCode" v-model="queryParams.motherboardCode"
placeholder="请输入设备编号" placeholder="请输入设备编号"
clearable clearable
> >
...@@ -63,9 +63,9 @@ ...@@ -63,9 +63,9 @@
<div class="tray-id">{{ scope.row.storeyCode }}</div> <div class="tray-id">{{ scope.row.storeyCode }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="设备编号" prop="deviceCode" align="center" width="150" fixed="left"> <el-table-column label="设备编号" prop="motherboardCode" align="center" width="150" fixed="left">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="device-code">{{ scope.row.deviceCode }}</div> <div class="device-code">{{ scope.row.motherboardCode }}</div>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="行" prop="row" align="center" width="80" />--> <!-- <el-table-column label="行" prop="row" align="center" width="80" />-->
...@@ -83,11 +83,14 @@ ...@@ -83,11 +83,14 @@
<el-table-column label="状态" align="center" width="120"> <el-table-column label="状态" align="center" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag <el-tag
:type="statusTagType(scope.row.status)" :type="statusTagType(scope.row.deviceStatus)"
size="mini" size="mini"
class="status-tag" class="status-tag"
:class="{
'custom-critical-tag': scope.row.deviceStatus === '-9999'
}"
> >
{{ statusLabel(scope.row.status) }} {{ statusLabel(scope.row.deviceStatus) }}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
...@@ -122,18 +125,6 @@ ...@@ -122,18 +125,6 @@
<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">-->
<!-- <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"> <el-table-column label="标定浓度值" align="center" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="device-code">{{ scope.row.calibrationConcentration != null ? scope.row.calibrationConcentration : '-' }}</div> <div class="device-code">{{ scope.row.calibrationConcentration != null ? scope.row.calibrationConcentration : '-' }}</div>
...@@ -252,8 +243,8 @@ export default { ...@@ -252,8 +243,8 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
fTrayCode: "", fTrayCode: "",
deviceCode: "", motherboardCode: "",
status: "", deviceStatus: "",
bindingTime: "" bindingTime: ""
} }
}; };
...@@ -286,10 +277,10 @@ export default { ...@@ -286,10 +277,10 @@ export default {
}, },
methods: { methods: {
// 获取标定状态文本 // 获取标定状态文本
getCalibrationText(status) { getCalibrationText(deviceStatus) {
if (status === '4') { if (deviceStatus === '4') {
return '正常' return '正常'
} else if (status) { } else if (deviceStatus) {
return '异常' return '异常'
} else { } else {
return '-' return '-'
...@@ -297,10 +288,10 @@ export default { ...@@ -297,10 +288,10 @@ export default {
}, },
// 获取标定状态样式类 // 获取标定状态样式类
getCalibrationClass(status) { getCalibrationClass(deviceStatus) {
if (status === '4') { if (deviceStatus === '4') {
return 'write-success' return 'write-success'
} else if (status) { } else if (deviceStatus) {
return 'write-failed' return 'write-failed'
} else { } else {
return 'write-unknown' return 'write-unknown'
...@@ -320,8 +311,8 @@ export default { ...@@ -320,8 +311,8 @@ export default {
}, },
/** 状态标签类型映射 */ /** 状态标签类型映射 */
statusTagType(status) { statusTagType(deviceStatus) {
switch (status) { switch (deviceStatus) {
case "0": case "0":
return "info"; // 预热-信息蓝 return "info"; // 预热-信息蓝
case "1": case "1":
...@@ -331,22 +322,25 @@ export default { ...@@ -331,22 +322,25 @@ export default {
case "4": case "4":
return "danger"; // 报警-危险红 return "danger"; // 报警-危险红
case "5": case "5":
return ""; // 通讯故障-使用自定义灰色 return "error"; // 通讯故障-使用自定义灰色
case "-9999":
return "critical"; // 通讯异常-使用自定义灰色
default: default:
return ""; return "";
} }
}, },
/** 状态中文映射 */ /** 状态中文映射 */
statusLabel(status) { statusLabel(deviceStatus) {
const statusMap = { const statusMap = {
"0": "预热", "0": "预热",
"1": "正常", "1": "正常",
"3": "传感器故障", "3": "传感器故障",
"4": "报警", "4": "报警",
"5": "通讯故障" "5": "通讯故障",
"-9999": "通讯异常"
}; };
return statusMap[status] || "-"; return statusMap[deviceStatus] || "-";
}, },
/** 格式化通信时间(年-月-日 时:分) */ /** 格式化通信时间(年-月-日 时:分) */
...@@ -375,8 +369,8 @@ export default { ...@@ -375,8 +369,8 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
fTrayCode: "", fTrayCode: "",
deviceCode: "", motherboardCode: "",
status: "", deviceStatus: "",
bindingTime: "" bindingTime: ""
}; };
this.getList(); this.getList();
...@@ -398,6 +392,20 @@ export default { ...@@ -398,6 +392,20 @@ export default {
</script> </script>
<style scoped> <style scoped>
/* 通讯异常(危急 - 比危险红更强烈) */
.custom-critical-tag {
background: linear-gradient(135deg, #ff0000 0%, #990000 100%) !important;
border-color: #ff3838 !important;
color: white !important;
font-weight: bold !important;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3) !important;
box-shadow: 0 0 8px rgba(255, 56, 56, 0.5) !important;
animation: critical-pulse 1.5s infinite alternate !important;
position: relative !important;
z-index: 1 !important;
}
/* 主容器样式 */ /* 主容器样式 */
.tray-container { .tray-container {
width: 100%; width: 100%;
......
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
class="device-cell" class="device-cell"
:class="{ :class="{
'active': activeCell === index, 'active': activeCell === index,
'empty': !device.deviceCode, 'empty': !device.motherboardCode,
'error': isDeviceError(device), 'error': isDeviceError(device),
'duplicate': device.isDuplicate 'duplicate': device.isDuplicate
}" }"
...@@ -84,7 +84,10 @@ ...@@ -84,7 +84,10 @@
:ref="`deviceCell_${index}`" :ref="`deviceCell_${index}`"
> >
<div class="device-id"> <div class="device-id">
{{ device.deviceCode || '+' }} <div class="device-id">
{{ (device.motherboardCode && device.calibrationUnbindStatus === '0') ? device.motherboardCode : '+' }}
<!-- 其他图标保持不变 -->
</div>
<!-- 添加错误状态图标 --> <!-- 添加错误状态图标 -->
<i v-if="isDeviceError(device)" class="error-icon fas fa-exclamation-circle"></i> <i v-if="isDeviceError(device)" class="error-icon fas fa-exclamation-circle"></i>
<!-- 添加重复状态图标 --> <!-- 添加重复状态图标 -->
...@@ -243,7 +246,7 @@ export default { ...@@ -243,7 +246,7 @@ export default {
return { return {
index: i + 1, index: i + 1,
number: number, number: number,
deviceCode: '', motherboardCode: '',
row: row, row: row,
col: col, col: col,
isDuplicate: false // 添加重复标记属性 isDuplicate: false // 添加重复标记属性
...@@ -271,7 +274,7 @@ export default { ...@@ -271,7 +274,7 @@ export default {
}, },
// 计算已填充的设备数量 // 计算已填充的设备数量
filledCount() { filledCount() {
return this.devices.filter(d => d.deviceCode).length; return this.devices.filter(d => d.motherboardCode).length;
}, },
// 计算绑定按钮是否禁用 // 计算绑定按钮是否禁用
...@@ -352,26 +355,20 @@ export default { ...@@ -352,26 +355,20 @@ export default {
} }
}, },
// 在 methods 中添加一个专门判断设备是否异常的方法
isDeviceError(device) { isDeviceError(device) {
if (!device.deviceCode) return false; // 如果设备已解绑,则不视为错误
if (!device.motherboardCode || device.calibrationUnbindStatus === '1') return false;
// 只有在标定完成状态下才进行详细状态检查 // 原有的异常判断逻辑保持不变
if (this.trayStatus === '3') { return device.deviceStatus === '0' ||
// 标定完成状态下的完整异常检查 device.deviceStatus === '5' ||
return device.status === '0' || device.deviceStatus === '-9999' ||
device.status === '5' ||
(device.realTimeStatus != null && device.realTimeStatus === '0') || (device.realTimeStatus != null && device.realTimeStatus === '0') ||
(device.calibrationConcentrationStatus != null && device.calibrationConcentrationStatus !== '4') || (device.calibrationConcentrationStatus != null && device.calibrationConcentrationStatus !== '4') ||
(device.writeTimeStatus != null && device.writeTimeStatus === '0') || (device.writeTimeStatus != null && device.writeTimeStatus === '0') ||
(device.runTimeStatus != null && device.runTimeStatus === '0') || (device.runTimeStatus != null && device.runTimeStatus === '0') ||
device.relayStatus === 0 || device.pulseStatus === 0 || device.relayStatus === 0 || device.pulseStatus === 0 ||
device.moduleStatus === 0 || device.simCardStatus === 0 || device.networkStatus === 0; device.moduleStatus === 0 || device.simCardStatus === 0 || device.networkStatus === 0;
} else {
// 非标定完成状态(0,4,1,2等),只检查设备状态是否为 0 或 5
// 其他状态字段在绑定阶段可能为 null,不应该视为错误
return device.status === '0' || device.status === '5';
}
}, },
getAllBindingData(trayId) { getAllBindingData(trayId) {
...@@ -393,9 +390,9 @@ export default { ...@@ -393,9 +390,9 @@ export default {
this.checkDuplicateDevices(); this.checkDuplicateDevices();
const firstDeviceCodeEmptyItem = this.devices.find(item => const firstDeviceCodeEmptyItem = this.devices.find(item =>
item.deviceCode === null || item.motherboardCode === null ||
item.deviceCode === undefined || item.motherboardCode === undefined ||
(typeof item.deviceCode === 'string' && item.deviceCode.trim() === '') (typeof item.motherboardCode === 'string' && item.motherboardCode.trim() === '')
); );
if(firstDeviceCodeEmptyItem !== undefined) { if(firstDeviceCodeEmptyItem !== undefined) {
...@@ -437,9 +434,10 @@ export default { ...@@ -437,9 +434,10 @@ export default {
trayId: this.fTrayId, trayId: this.fTrayId,
index: i + 1, index: i + 1,
number: number, number: number,
deviceCode: '', motherboardCode: '',
row: row, row: row,
col: col, col: col,
calibrationUnbindStatus: '0', // 默认未解绑
isDuplicate: false // 添加重复标记属性 isDuplicate: false // 添加重复标记属性
} }
}) })
...@@ -476,7 +474,7 @@ export default { ...@@ -476,7 +474,7 @@ export default {
if (this.trayStatus === '3') { if (this.trayStatus === '3') {
// 检查扫描的设备是否存在 // 检查扫描的设备是否存在
const deviceIndex = this.devices.findIndex( const deviceIndex = this.devices.findIndex(
d => d.deviceCode === this.deviceInput d => d.motherboardCode === this.deviceInput
); );
if (deviceIndex !== -1) { if (deviceIndex !== -1) {
...@@ -501,7 +499,7 @@ export default { ...@@ -501,7 +499,7 @@ export default {
// 检查设备号是否已存在(排除当前单元格自身) // 检查设备号是否已存在(排除当前单元格自身)
const existingIndex = this.devices.findIndex( const existingIndex = this.devices.findIndex(
(d, idx) => idx !== this.activeCell && d.deviceCode === trimmedInput (d, idx) => idx !== this.activeCell && d.motherboardCode === trimmedInput
); );
if (existingIndex !== -1) { if (existingIndex !== -1) {
...@@ -520,7 +518,8 @@ export default { ...@@ -520,7 +518,8 @@ export default {
} }
// 如果没有重复,则正常添加设备 // 如果没有重复,则正常添加设备
this.devices[this.activeCell].deviceCode = trimmedInput; this.devices[this.activeCell].motherboardCode = trimmedInput;
this.devices[this.activeCell].calibrationUnbindStatus = '0';
// 添加后重新检查重复状态 // 添加后重新检查重复状态
this.checkDuplicateDevices(); this.checkDuplicateDevices();
...@@ -543,15 +542,15 @@ export default { ...@@ -543,15 +542,15 @@ export default {
// 统计每个设备码出现的次数 // 统计每个设备码出现的次数
this.devices.forEach(device => { this.devices.forEach(device => {
if (device.deviceCode && device.deviceCode.trim()) { if (device.motherboardCode && device.motherboardCode.trim()) {
deviceCodeMap[device.deviceCode] = (deviceCodeMap[device.deviceCode] || 0) + 1; deviceCodeMap[device.motherboardCode] = (deviceCodeMap[device.motherboardCode] || 0) + 1;
} }
}); });
// 标记重复的设备 // 标记重复的设备
this.devices.forEach(device => { this.devices.forEach(device => {
if (device.deviceCode && device.deviceCode.trim()) { if (device.motherboardCode && device.motherboardCode.trim()) {
device.isDuplicate = deviceCodeMap[device.deviceCode] > 1; device.isDuplicate = deviceCodeMap[device.motherboardCode] > 1;
} else { } else {
device.isDuplicate = false; device.isDuplicate = false;
} }
...@@ -589,15 +588,17 @@ export default { ...@@ -589,15 +588,17 @@ export default {
// 调用解绑方法,传递设备信息和palletDeviceBindingId // 调用解绑方法,传递设备信息和palletDeviceBindingId
let palletDeviceBinding = { let palletDeviceBinding = {
deviceCode: device.deviceCode, motherboardCode: device.motherboardCode,
palletDeviceBindingId: device.palletDeviceBindingId palletDeviceBindingId: device.palletDeviceBindingId,
calibrationUnbindStatus: '1' // 标记为解绑
} }
unbindSingleDevice(palletDeviceBinding).then(res => { unbindSingleDevice(palletDeviceBinding).then(res => {
if (res.code === 200) { if (res.code === 200) {
// 解绑成功后的处理 // 解绑成功后的处理
const wasErrorDevice = this.isDeviceError(this.devices[deviceIndex]); const wasErrorDevice = this.isDeviceError(this.devices[deviceIndex]);
this.devices[deviceIndex].deviceCode = ''; this.devices[deviceIndex].motherboardCode = '';
this.devices[deviceIndex].calibrationUnbindStatus = '1'; // 标记为已解绑
// 清除重复标记 // 清除重复标记
this.devices[deviceIndex].isDuplicate = false; this.devices[deviceIndex].isDuplicate = false;
...@@ -615,7 +616,7 @@ export default { ...@@ -615,7 +616,7 @@ export default {
} }
} }
this.$message.success(`设备 ${device.deviceCode} 解绑成功`); this.$message.success(`设备 ${device.motherboardCode} 解绑成功`);
} else { } else {
this.$message.error("解绑失败"); this.$message.error("解绑失败");
} }
...@@ -641,8 +642,8 @@ export default { ...@@ -641,8 +642,8 @@ export default {
// 解绑成功后重置设备矩阵 // 解绑成功后重置设备矩阵
this.devices = this.devices.map(d => ({ this.devices = this.devices.map(d => ({
...d, ...d,
deviceCode: '', motherboardCode: '',
status: '1', deviceStatus: '1',
isDuplicate: false isDuplicate: false
})); }));
this.abnormalCount = this.devices.length; // 重置异常计数为总设备数 this.abnormalCount = this.devices.length; // 重置异常计数为总设备数
...@@ -706,7 +707,7 @@ export default { ...@@ -706,7 +707,7 @@ export default {
// 重置时也清除重复标记 // 重置时也清除重复标记
this.devices = this.devices.map(d => ({ this.devices = this.devices.map(d => ({
...d, ...d,
deviceCode: '', motherboardCode: '',
isDuplicate: false isDuplicate: false
})); }));
this.activeCell = 0; this.activeCell = 0;
......
...@@ -432,7 +432,7 @@ export default { ...@@ -432,7 +432,7 @@ export default {
return clearTasks(row); return clearTasks(row);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.msgSuccess("重新老化开始"); this.msgSuccess("清空任务完成");
}).catch(() => {}); }).catch(() => {});
}, },
/** 重新老化 */ /** 重新老化 */
......
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