Commit 844dc1cc authored by wanghao's avatar wanghao

1 待下料 下料功能实现。

parent 9afc5cb7
...@@ -63,6 +63,14 @@ public class RobotArmCommandController extends BaseController ...@@ -63,6 +63,14 @@ public class RobotArmCommandController extends BaseController
return AjaxResult.success(robotArmCommandService.selectRobotArmCommandById(robotArmCommandId)); return AjaxResult.success(robotArmCommandService.selectRobotArmCommandById(robotArmCommandId));
} }
/**
* 新增空白机械臂指令
*/
@PostMapping("/insertBlankingRobotArmCommand")
public AjaxResult insertBlankingRobotArmCommand(@RequestBody RobotArmCommand robotArmCommand) {
return toAjax(robotArmCommandService.insertBlankingRobotArmCommand(robotArmCommand));
}
/** /**
* 新增机械臂指令 * 新增机械臂指令
*/ */
......
...@@ -22,6 +22,8 @@ public interface RobotArmCommandMapper ...@@ -22,6 +22,8 @@ public interface RobotArmCommandMapper
public RobotArmCommand findExecutingCommand(String trayCode, String storeyCode); public RobotArmCommand findExecutingCommand(String trayCode, String storeyCode);
public RobotArmCommand findExecutingCommandByType(String trayCode,String storeyCode,String type);
public RobotArmCommand selectLatestPendingTray(); public RobotArmCommand selectLatestPendingTray();
public RobotArmCommand findByTrayAndStatus(@Param("trayCode") String trayCode, @Param("status") String status); public RobotArmCommand findByTrayAndStatus(@Param("trayCode") String trayCode, @Param("status") String status);
......
...@@ -29,6 +29,8 @@ public interface IRobotArmCommandService ...@@ -29,6 +29,8 @@ public interface IRobotArmCommandService
public List<RobotArmCommand> findByType(String type); public List<RobotArmCommand> findByType(String type);
public int insertBlankingRobotArmCommand(RobotArmCommand robotArmCommand);
/** /**
* 新增机械臂指令 * 新增机械臂指令
* *
......
...@@ -240,6 +240,30 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService ...@@ -240,6 +240,30 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
return robotArmCommandMapper.findByType( type); return robotArmCommandMapper.findByType( type);
} }
/**
* 批量新增空闲指令
*
* @param robotArmCommand r
* @return r
*/
@Override
public int insertBlankingRobotArmCommand(RobotArmCommand robotArmCommand) {
if(robotArmCommand.getTrayCode() == null || robotArmCommand.getStoreyCode() == null) {
throw new RuntimeException("托盘和层不能为空");
}
// type 1 是 待下料的
RobotArmCommand executingCommandByType = robotArmCommandMapper.findExecutingCommandByType(robotArmCommand.getTrayCode(), robotArmCommand.getStoreyCode(), "1");
if(executingCommandByType != null) {
throw new RuntimeException("当前托盘正在执行指令");
}
robotArmCommand.setCreateTime(DateUtils.getNowDate());
return robotArmCommandMapper.insertRobotArmCommand(robotArmCommand);
}
/** /**
* 新增机械臂指令 * 新增机械臂指令
* *
......
...@@ -49,6 +49,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -49,6 +49,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND f_status = '1' <!-- 状态为执行中 --> AND f_status = '1' <!-- 状态为执行中 -->
LIMIT 1 LIMIT 1
</select> </select>
<select id="findExecutingCommandByType" resultMap="RobotArmCommandResult">
<include refid="selectRobotArmCommandVo"/>
WHERE f_tray_code = #{trayCode}
AND f_storey_code = #{storeyCode}
AND f_type = #{type}
AND f_status = '1' <!-- 状态为执行中 -->
LIMIT 1
</select>
<!-- 查找最近扫码但未处理的托盘 --> <!-- 查找最近扫码但未处理的托盘 -->
<select id="selectLatestPendingTray" resultMap="RobotArmCommandResult"> <select id="selectLatestPendingTray" resultMap="RobotArmCommandResult">
<include refid="selectRobotArmCommandVo"/> <include refid="selectRobotArmCommandVo"/>
......
...@@ -26,6 +26,16 @@ export function addCommand(data) { ...@@ -26,6 +26,16 @@ export function addCommand(data) {
}) })
} }
// 新增机械臂指令
export function insertBlankingRobotArmCommand(data) {
return request({
url: '/robotArm/command/insertBlankingRobotArmCommand',
method: 'post',
data: data
})
}
// 执行上电操作 // 执行上电操作
export function powerOnCommand(commandId) { export function powerOnCommand(commandId) {
return request({ return request({
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<!-- 操作按钮区域 --> <!-- 操作按钮区域 -->
<div class="tray-actions"> <div class="tray-actions">
<button class="btn-action btn-load" @click="loadTray"> <button class="btn-action btn-load" @click="loadTray" v-if="trayInfo.status === '1'">
<i class="icon-load"></i>下料 <i class="icon-load"></i>下料
</button> </button>
</div> </div>
...@@ -98,6 +98,7 @@ ...@@ -98,6 +98,7 @@
<script> <script>
import { queryByDepartmentId } from "@/api/storey/storey"; import { queryByDepartmentId } from "@/api/storey/storey";
import { testPowerOutage } from "@/api/testScheduledTasks/testTasks"; import { testPowerOutage } from "@/api/testScheduledTasks/testTasks";
import { insertBlankingRobotArmCommand } from "@/api/robotArm/robotArmCommand";
export default { export default {
name: "AgingLayer", name: "AgingLayer",
props: { props: {
...@@ -242,6 +243,21 @@ export default { ...@@ -242,6 +243,21 @@ export default {
// 操作按钮方法 // 操作按钮方法
loadTray() { loadTray() {
this.$message.success("下料操作已执行"); this.$message.success("下料操作已执行");
const robotArmCommand = {
trayCode: this.trayInfo.fTrayCode,
storeyCode: this.trayInfo.storeyCode,
type: '1'
};
insertBlankingRobotArmCommand(robotArmCommand).then(res => {
if(res.code === 200) {
this.msgSuccess("添加成功");
this.showAddDialog = false;
} else {
this.msgSuccess("添加失败");
}
})
}, },
powerOn() { powerOn() {
......
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