Commit 6cf1eae8 authored by wanghao's avatar wanghao

1 上料指令开始执行后,就把 层的状态更新为运行,如果不更改状态的话,再扫码上料就还会用原来的层上料。

parent 01e592a1
......@@ -30,6 +30,8 @@ public interface TStoreyInfoMapper
public void unbindByCode(TStoreyInfo tStoreyInfo);
public void updateStatusByCode(TStoreyInfo tStoreyInfo);
// 新增方法:查询离机械臂最近的空闲层
public TStoreyInfo selectNearestFreeStorey();
/**
......
......@@ -125,8 +125,8 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
robotArmCommandMapper.updateRobotArmCommand(command);
// 如果是下料,则 先断电再去下料
String storeyCode = command.getStoreyCode();
if("UNLOAD".equals(commandType)) {
String storeyCode = command.getStoreyCode();
if(StringUtils.isNotBlank(storeyCode)) {
String[] split = storeyCode.split("-");
......@@ -146,6 +146,12 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
throw new RuntimeException(e);
}
}
// 如果是下料,则 先把 t_story_info 设置为 运行中,占上位置,避免此时 再上料 是使用重复位置
} else {
TStoreyInfo tStoreyInfo = new TStoreyInfo();
tStoreyInfo.setfStoreyCode(command.getStoreyCode());
tStoreyInfo.setfStatus("1");
storeyInfoMapper.updateStatusByCode(tStoreyInfo);
}
// 通过WebSocket广播更新
......
......@@ -213,6 +213,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
where f_storey_code = #{fStoreyCode}
</update>
<update id="updateStatusByCode" parameterType="TStoreyInfo">
update t_storey_info
<trim prefix="SET" suffixOverrides=",">
<if test="fStatus != null">f_status = #{fStatus},</if>
<if test="fUpdateTime != null">f_update_time = #{fUpdateTime},</if>
</trim>
where f_storey_code = #{fStoreyCode}
</update>
<delete id="deleteTStoreyInfoById" parameterType="Long">
delete from t_storey_info where f_storey_id = #{fStoreyId}
</delete>
......
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