Commit 944b78d2 authored by wanghao's avatar wanghao

1 标定完成状态下 重置所有时判断 错误板子 是否被解除

parent 04c19f2a
...@@ -77,7 +77,7 @@ public class PalletDeviceBindingController extends BaseController ...@@ -77,7 +77,7 @@ public class PalletDeviceBindingController extends BaseController
*/ */
@GetMapping("/resetAll/{trayId}") @GetMapping("/resetAll/{trayId}")
public AjaxResult resetAll(@PathVariable("trayId") Long trayId) { public AjaxResult resetAll(@PathVariable("trayId") Long trayId) {
return AjaxResult.success(palletDeviceBindingService.resetAll(trayId)); return palletDeviceBindingService.resetAll(trayId);
} }
/** /**
......
...@@ -24,6 +24,9 @@ public class PalletDeviceBinding extends BaseEntity ...@@ -24,6 +24,9 @@ public class PalletDeviceBinding extends BaseEntity
@Excel(name = "托盘id") @Excel(name = "托盘id")
private Long trayId; private Long trayId;
/** 托盘编号 */
private String fTrayCode;
/** 绑定的设备编号 */ /** 绑定的设备编号 */
@Excel(name = "绑定的设备编号") @Excel(name = "绑定的设备编号")
private String deviceCode; private String deviceCode;
...@@ -52,7 +55,7 @@ public class PalletDeviceBinding extends BaseEntity ...@@ -52,7 +55,7 @@ public class PalletDeviceBinding extends BaseEntity
private Date unbindingTime; private Date unbindingTime;
/** /**
* 状态 0-预热;1-正常;3-传感器故障;4-报警;5-通讯故障;6-程序写时间失败 * 状态 0-预热;1-正常;3-传感器故障;4-报警;5-通讯故障
*/ */
private String status; private String status;
...@@ -253,6 +256,14 @@ public class PalletDeviceBinding extends BaseEntity ...@@ -253,6 +256,14 @@ public class PalletDeviceBinding extends BaseEntity
this.concentration = concentration; this.concentration = concentration;
} }
public String getfTrayCode() {
return fTrayCode;
}
public void setfTrayCode(String fTrayCode) {
this.fTrayCode = fTrayCode;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
...@@ -36,6 +36,8 @@ public interface PalletDeviceBindingMapper ...@@ -36,6 +36,8 @@ public interface PalletDeviceBindingMapper
*/ */
public List<PalletDeviceBinding> selectPalletDeviceBindingList(PalletDeviceBinding palletDeviceBinding); public List<PalletDeviceBinding> selectPalletDeviceBindingList(PalletDeviceBinding palletDeviceBinding);
public int countErrorByTrayId(Long trayId);
/** /**
* 新增托盘绑定的设备列 * 新增托盘绑定的设备列
* *
...@@ -46,6 +48,8 @@ public interface PalletDeviceBindingMapper ...@@ -46,6 +48,8 @@ public interface PalletDeviceBindingMapper
public int resetAll(Long trayId); public int resetAll(Long trayId);
public int deleteAllByTrayId(Long trayId);
public int batchInsertPalletDeviceBinding(@Param("palletDeviceBindingList") List<PalletDeviceBinding> palletDeviceBindingList); public int batchInsertPalletDeviceBinding(@Param("palletDeviceBindingList") List<PalletDeviceBinding> palletDeviceBindingList);
/** /**
......
...@@ -25,6 +25,8 @@ public interface TTrayInfoMapper ...@@ -25,6 +25,8 @@ public interface TTrayInfoMapper
public int clearStoreyCodeByStoreyCode(String storeyCode); public int clearStoreyCodeByStoreyCode(String storeyCode);
public int initStatusByTrayId(Long trayId);
/** /**
* 查询托盘信息列表 * 查询托盘信息列表
* *
......
package com.zehong.system.service; package com.zehong.system.service;
import java.util.List; import java.util.List;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.system.domain.PalletDeviceBinding; import com.zehong.system.domain.PalletDeviceBinding;
/** /**
...@@ -35,7 +37,7 @@ public interface IPalletDeviceBindingService ...@@ -35,7 +37,7 @@ public interface IPalletDeviceBindingService
*/ */
public int insertPalletDeviceBinding(PalletDeviceBinding palletDeviceBinding); public int insertPalletDeviceBinding(PalletDeviceBinding palletDeviceBinding);
public int resetAll(Long trayId); public AjaxResult resetAll(Long trayId);
public int batchInsertPalletDeviceBinding(List<PalletDeviceBinding> palletDeviceBindingList); public int batchInsertPalletDeviceBinding(List<PalletDeviceBinding> palletDeviceBindingList);
......
package com.zehong.system.service.impl; package com.zehong.system.service.impl;
import java.util.List; import java.util.List;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.system.mapper.TTrayInfoMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zehong.system.mapper.PalletDeviceBindingMapper; import com.zehong.system.mapper.PalletDeviceBindingMapper;
import com.zehong.system.domain.PalletDeviceBinding; import com.zehong.system.domain.PalletDeviceBinding;
...@@ -21,6 +24,9 @@ public class PalletDeviceBindingServiceImpl implements IPalletDeviceBindingServi ...@@ -21,6 +24,9 @@ public class PalletDeviceBindingServiceImpl implements IPalletDeviceBindingServi
@Resource @Resource
private PalletDeviceBindingMapper palletDeviceBindingMapper; private PalletDeviceBindingMapper palletDeviceBindingMapper;
@Resource
private TTrayInfoMapper tTrayInfoMapper;
/** /**
* 查询托盘绑定的设备列 * 查询托盘绑定的设备列
* *
...@@ -65,8 +71,18 @@ public class PalletDeviceBindingServiceImpl implements IPalletDeviceBindingServi ...@@ -65,8 +71,18 @@ public class PalletDeviceBindingServiceImpl implements IPalletDeviceBindingServi
* @return 结果 * @return 结果
*/ */
@Override @Override
public int resetAll(Long trayId) { public AjaxResult resetAll(Long trayId) {
return palletDeviceBindingMapper.resetAll(trayId);
int i = palletDeviceBindingMapper.countErrorByTrayId(trayId);
if (i > 0) {
return AjaxResult.error("有错误设备未解除绑定,不允许重置");
}
palletDeviceBindingMapper.deleteAllByTrayId(trayId);
tTrayInfoMapper.initStatusByTrayId(trayId);
return AjaxResult.success();
} }
/** /**
......
...@@ -172,6 +172,9 @@ public class DeviceCommunicationJob implements Job { ...@@ -172,6 +172,9 @@ public class DeviceCommunicationJob implements Job {
// 3. 更新设备状态 // 3. 更新设备状态
binding.setStatus(String.valueOf(result[1])); binding.setStatus(String.valueOf(result[1]));
// 3. 更新浓度值
binding.setConcentration(String.valueOf(result[0]));
// 4. 条件写入时间 // 4. 条件写入时间
if (result[1] == 1 || result[1] == 3 || result[1] == 4) { if (result[1] == 1 || result[1] == 3 || result[1] == 4) {
// 重用之前的master连接进行写操作 // 重用之前的master连接进行写操作
...@@ -191,6 +194,7 @@ public class DeviceCommunicationJob implements Job { ...@@ -191,6 +194,7 @@ public class DeviceCommunicationJob implements Job {
binding = palletDeviceBindingMapper.selectByTrayIdAndIndex(ip, deviceId); binding = palletDeviceBindingMapper.selectByTrayIdAndIndex(ip, deviceId);
} }
binding.setStatus("5"); binding.setStatus("5");
binding.setWriteTimeStatus("0");
palletDeviceBindingMapper.updatePalletDeviceBinding(binding); palletDeviceBindingMapper.updatePalletDeviceBinding(binding);
errorCount.incrementAndGet(); errorCount.incrementAndGet();
return false; return false;
......
...@@ -28,29 +28,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -28,29 +28,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectPalletDeviceBindingVo"> <sql id="selectPalletDeviceBindingVo">
select f_pallet_device_binding_id, f_tray_id, f_device_code, f_row, f_col, f_index,f_binding_time, select palDeviceBinding.f_pallet_device_binding_id,
f_unbinding_time, f_create_time,f_status,f_record_year,f_record_month,f_record_date,f_record_hour, palDeviceBinding.f_tray_id,
f_record_minute, f_write_time_status, f_adjustment_zero_ad, f_calibration_ad, f_concentration from t_pallet_device_binding trayInfo.f_tray_code,
palDeviceBinding.f_device_code,
palDeviceBinding.f_row,
palDeviceBinding.f_col,
palDeviceBinding.f_index,
palDeviceBinding.f_binding_time,
palDeviceBinding.f_unbinding_time,
palDeviceBinding.f_create_time,
palDeviceBinding.f_status,
palDeviceBinding.f_record_year,
palDeviceBinding.f_record_month,
palDeviceBinding.f_record_date,
palDeviceBinding.f_record_hour,
palDeviceBinding.f_record_minute,
palDeviceBinding.f_write_time_status,
palDeviceBinding.f_adjustment_zero_ad,
palDeviceBinding.f_calibration_ad,
palDeviceBinding.f_concentration
from t_pallet_device_binding palDeviceBinding
left join t_tray_info trayInfo on trayInfo.f_tray_id = palDeviceBinding.f_tray_id
</sql> </sql>
<select id="countErrorByTrayId" parameterType="Long" resultType="int">
select count(1) from t_pallet_device_binding palDeviceBinding
where palDeviceBinding.f_tray_id = #{trayId}
and (palDeviceBinding.f_status = '0' or palDeviceBinding.f_status = '5')
</select>
<select id="selectPalletDeviceBindingList" parameterType="PalletDeviceBinding" resultMap="PalletDeviceBindingResult"> <select id="selectPalletDeviceBindingList" parameterType="PalletDeviceBinding" resultMap="PalletDeviceBindingResult">
<include refid="selectPalletDeviceBindingVo"/> <include refid="selectPalletDeviceBindingVo"/>
<where> <where>
<if test="trayId != null "> and f_tray_id = #{trayId}</if> <if test="trayId != null "> and palDeviceBinding.f_tray_id = #{trayId}</if>
<if test="deviceCode != null and deviceCode != ''"> and f_device_code = #{deviceCode}</if> <if test="deviceCode != null and deviceCode != ''"> and palDeviceBinding.f_device_code = #{deviceCode}</if>
<if test="row != null "> and f_row = #{row}</if> <if test="row != null "> and palDeviceBinding.f_row = #{row}</if>
<if test="col != null "> and f_col = #{col}</if> <if test="col != null "> and palDeviceBinding.f_col = #{col}</if>
<if test="index != null "> and f_index = #{index}</if> <if test="index != null "> and palDeviceBinding.f_index = #{index}</if>
<if test="bindingTime != null "> and f_binding_time = #{bindingTime}</if> <if test="bindingTime != null "> and palDeviceBinding.f_binding_time = #{bindingTime}</if>
<if test="unbindingTime != null "> and f_unbinding_time = #{unbindingTime}</if> <if test="unbindingTime != null "> and palDeviceBinding.f_unbinding_time = #{unbindingTime}</if>
<if test="createTime != null "> and f_create_time = #{createTime}</if> <if test="createTime != null "> and palDeviceBinding.f_create_time = #{createTime}</if>
<if test="status != null "> and f_status = #{status}</if> <if test="status != null "> and palDeviceBinding.f_status = #{status}</if>
</where> </where>
</select> </select>
<select id="selectPalletDeviceBindingById" parameterType="Long" resultMap="PalletDeviceBindingResult"> <select id="selectPalletDeviceBindingById" parameterType="Long" resultMap="PalletDeviceBindingResult">
<include refid="selectPalletDeviceBindingVo"/> <include refid="selectPalletDeviceBindingVo"/>
where f_pallet_device_binding_id = #{palletDeviceBindingId} where palDeviceBinding.f_pallet_device_binding_id = #{palletDeviceBindingId}
</select> </select>
<select id="selectByTrayIdAndIndex" resultMap="PalletDeviceBindingResult"> <select id="selectByTrayIdAndIndex" resultMap="PalletDeviceBindingResult">
select f_pallet_device_binding_id, select f_pallet_device_binding_id,
...@@ -96,7 +120,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -96,7 +120,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert> </insert>
<update id="resetAll" parameterType="long"> <update id="resetAll" parameterType="long">
update t_pallet_device_binding update t_pallet_device_binding
set f_device_code = null,f_binding_time = null set f_device_code = null,
f_binding_time = null,
f_unbinding_time = null,
f_status = null,
f_record_year = null,
f_record_month = null,
f_record_date = null,
f_record_hour = null,
f_record_minute = null,
f_write_time_status = null,
f_adjustment_zero_ad = null,
f_calibration_ad = null,
f_concentration = 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">
...@@ -163,6 +199,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -163,6 +199,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id="deletePalletDeviceBindingById" parameterType="Long"> <delete id="deletePalletDeviceBindingById" parameterType="Long">
delete from t_pallet_device_binding where f_pallet_device_binding_id = #{palletDeviceBindingId} delete from t_pallet_device_binding where f_pallet_device_binding_id = #{palletDeviceBindingId}
</delete> </delete>
<delete id="deleteAllByTrayId" parameterType="Long">
delete from t_pallet_device_binding where f_tray_id = #{trayId}
</delete>
<delete id="deletePalletDeviceBindingByIds" parameterType="String"> <delete id="deletePalletDeviceBindingByIds" parameterType="String">
delete from t_pallet_device_binding where f_pallet_device_binding_id in delete from t_pallet_device_binding where f_pallet_device_binding_id in
......
...@@ -99,6 +99,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -99,6 +99,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
set f_storey_code = null set f_storey_code = null
where f_storey_code = #{fStoreyCode} where f_storey_code = #{fStoreyCode}
</update> </update>
<update id="initStatusByTrayId" parameterType="long">
update t_tray_info
set f_status = '0'
where f_tray_id = #{fTrayId}
</update>
<update id="updateTTrayInfo" parameterType="TTrayInfo"> <update id="updateTTrayInfo" parameterType="TTrayInfo">
update t_tray_info update t_tray_info
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
......
...@@ -6,19 +6,32 @@ ...@@ -6,19 +6,32 @@
<script> <script>
import {listBinding} from "@/api/palletDeviceBinding/binding"
export default { export default {
name: "RealTimeData", name: "RealTimeData",
data() { data() {
return { return {
list: null,
total: 0,
loading: true,
}; };
}, },
created() { created() {
this.getList();
}, },
computed: { computed: {
}, },
mounted() { mounted() {
}, },
methods: { methods: {
getList() {
listBinding().then(response => {
this.list = response.data;
this.total = response.total;
this.loading = false;
});
}
} }
}; };
</script> </script>
......
...@@ -89,6 +89,14 @@ ...@@ -89,6 +89,14 @@
<i class="fas fa-paper-plane"></i> <i class="fas fa-paper-plane"></i>
{{ trayStatus === '3' ? '提交修复' : '提交绑定' }} {{ trayStatus === '3' ? '提交修复' : '提交绑定' }}
</button> </button>
<!-- 一键解绑按钮 - 仅status=3时显示 -->
<button
v-if="trayStatus === '3'"
class="unbind-btn"
@click="unbindAll"
>
<i class="fas fa-unlink"></i> 一键解绑
</button>
</div> </div>
<!-- 使用说明区域 --> <!-- 使用说明区域 -->
...@@ -201,9 +209,9 @@ export default { ...@@ -201,9 +209,9 @@ export default {
trayStatusTagType() { trayStatusTagType() {
const map = { const map = {
'0': 'success', // 空闲 - 绿色 '0': 'success', // 空闲 - 绿色
'1': 'warning', // 运行中 - 黄色 '1': 'primary', // 运行中 - 黄色
'2': 'danger', // 老化完成 - 红色 '2': 'danger', // 老化完成 - 红色
'3': 'primary' // 标定完成 '3': 'warning' // 标定完成
}; };
return map[this.trayStatus] || 'info'; return map[this.trayStatus] || 'info';
}, },
...@@ -316,11 +324,12 @@ export default { ...@@ -316,11 +324,12 @@ export default {
this.$message.success(`设备 ${this.deviceInput} 修复成功!`); this.$message.success(`设备 ${this.deviceInput} 修复成功!`);
// 自动移动到下一个单元格 // 自动移动到下一个单元格
if (this.activeCell < 71) { // if (this.activeCell < 71) {
this.activeCell++; // this.activeCell++;
} else { // } else {
this.activeCell = 0; // this.activeCell = 0;
} // }
this.activeCell = deviceIndex;
} else { } else {
// 非异常设备提示 // 非异常设备提示
this.$message.warning(`设备 ${this.deviceInput} 不是异常设备或不存在`); this.$message.warning(`设备 ${this.deviceInput} 不是异常设备或不存在`);
...@@ -347,7 +356,32 @@ export default { ...@@ -347,7 +356,32 @@ export default {
const col = (index % 9) + 1; const col = (index % 9) + 1;
return `${row}-${col}`; return `${row}-${col}`;
}, },
// 一键解绑所有设备
unbindAll() {
this.$confirm('确定要解绑当前托盘下所有设备吗?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'error'
}).then(() => {
// 调用解绑接口(假设后端有对应的解绑接口,若无则需根据实际逻辑调整)
// 这里复用现有resetAll接口或替换为实际解绑接口
this.$message.success("好的,已经解绑了");
// resetAll(this.fTrayId).then(res => {
// if (res.code === 200) {
// // 解绑成功后重置设备矩阵
// this.devices = this.devices.map(d => ({ ...d, deviceCode: '', status: '0' }));
// this.abnormalCount = this.devices.length; // 重置异常计数为总设备数
// this.initialAbnormalCount = this.abnormalCount;
// this.deviceInput = '';
// this.activeCell = 0;
// this.$message.success("一键解绑成功");
// } else {
// this.$message.error("解绑失败");
// }
// })
}).catch(() => {});
},
// 绑定托盘 // 绑定托盘
bindTray: function () { bindTray: function () {
if (this.trayStatus === '0') { if (this.trayStatus === '0') {
...@@ -401,7 +435,7 @@ export default { ...@@ -401,7 +435,7 @@ export default {
}); });
this.msgSuccess("已重置"); this.msgSuccess("已重置");
} else { } else {
this.msgError("重置失败"); this.msgError(res.msg);
} }
}) })
}).catch(() => { }).catch(() => {
...@@ -854,4 +888,26 @@ body { ...@@ -854,4 +888,26 @@ body {
padding-top: 5px; padding-top: 5px;
padding-right: 15px; padding-right: 15px;
} }
/* 一键解绑按钮样式 */
.unbind-btn {
background: linear-gradient(to right, #9d4edd, #7b2cbf);
color: white;
border: none;
padding: 18px 45px;
font-size: 1.4rem;
font-weight: bold;
border-radius: 50px;
cursor: pointer;
display: flex;
align-items: center;
gap: 15px;
transition: all 0.3s;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}
.unbind-btn:hover {
transform: translateY(-5px);
box-shadow: 0 8px 20px rgba(157, 78, 221, 0.5);
}
</style> </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