Commit 54e39f35c4274c938a32eb1ae8a5bfcdba709933

Authored by xumiao
1 parent 40af3d50

添加AGV任务编辑页面,可修改优先级和目标点位

src/main/java/com/huaheng/api/acs/controller/AgvTaskController.java
... ... @@ -31,6 +31,7 @@ import org.springframework.web.bind.annotation.*;
31 31  
32 32 import javax.annotation.Resource;
33 33 import javax.servlet.http.HttpServletRequest;
  34 +import java.util.Date;
34 35 import java.util.List;
35 36 import java.util.Map;
36 37  
... ... @@ -131,6 +132,28 @@ public class AgvTaskController extends BaseController {
131 132 return ajaxResult;
132 133 }
133 134  
  135 +
  136 + @GetMapping( "/editagv/{id}")
  137 + public String edit(@PathVariable("id") Integer id, ModelMap mmap){
  138 + AgvTask agvTask = acsService.getById(id);
  139 + mmap.put("agvTask", agvTask);
  140 + return prefix + "/editagv";
  141 + }
  142 +
  143 + @RequiresPermissions("task:taskHeader:edit")
  144 + @PostMapping("/editagv")
  145 + @ResponseBody
  146 + @Log(title = "任务-任务管理", operating = "编辑agv任务", action = BusinessType.UPDATE)
  147 + public AjaxResult edit(AgvTask agvTask) {
  148 + AgvTask agvTaskResult = acsService.getById(agvTask.getId());
  149 + if(agvTaskResult.getStatus()>=QuantityConstant.TASK_STATUS_RELEASE){
  150 + return AjaxResult.error("任务已经下发了,不允许修改");
  151 + }
  152 + agvTask.setUpdated(new Date());
  153 + return toAjax(acsService.updateById(agvTask));
  154 + }
  155 +
  156 +
134 157 @Log(title = "任务-任务管理", operating = "取消AGV任务", action = BusinessType.DELETE)
135 158 @PostMapping( "/cancelAGVTask")
136 159 @ResponseBody
... ...
src/main/java/com/huaheng/api/acs/service/AcsServiceImpl.java
... ... @@ -80,6 +80,7 @@ public class AcsServiceImpl extends ServiceImpl<AcsMapper,AgvTask> implements Ac
80 80 checkContainerAndPositionStatus(agvTask);
81 81 agvTask.setStatus(QuantityConstant.TASK_STATUS_BUILD);
82 82 agvTask.setCreatedBy(ShiroUtils.getLoginName());
  83 + agvTask.setTaskType(QuantityConstant.STATUS_TASK_CARRY);
83 84 agvTask.setCreatedTime(new Date());
84 85 agvTask.setUpdated(new Date());
85 86 agvTask.setUpdatedBy(ShiroUtils.getLoginName());
... ...
src/main/resources/templates/task/taskHeader/editagv.html 0 → 100644
  1 +<!DOCTYPE HTML>
  2 +<html lang="zh" xmlns:th="http://www.thymeleaf.org">
  3 +<meta charset="utf-8">
  4 +<head th:include="include :: header"></head>
  5 +<body class="white-bg">
  6 + <div class="wrapper wrapper-content animated fadeInRight ibox-content">
  7 + <form class="form-horizontal m" id="form-agv-edit" th:object="${agvTask}">
  8 + <input id="id" name="id" th:field="*{id}" type="hidden">
  9 + <div class="form-group">
  10 + <label class="col-sm-3 control-label">容器编码:</label>
  11 + <div class="col-sm-8">
  12 + <input id="code" name="code" th:field="*{containerCode}" class="form-control" type="text" readonly="true">
  13 + </div>
  14 + </div>
  15 + <div class="form-group">
  16 + <label class="col-sm-3 control-label">目标点位:</label>
  17 + <div class="col-sm-8">
  18 + <input id="toPort" name="toPort" th:field="*{toPort}" class="form-control" type="text">
  19 + </div>
  20 + </div>
  21 + <div class="form-group">
  22 + <label class="col-sm-3 control-label">优先级:</label>
  23 + <div class="col-sm-8">
  24 + <input id="priority" name="priority" th:field="*{priority}" class="form-control" type="text">
  25 + </div>
  26 + </div>
  27 + <div class="form-group">
  28 + <div class="form-control-static col-sm-offset-9">
  29 + <button type="submit" class="btn btn-primary">提交</button>
  30 + <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
  31 + </div>
  32 + </div>
  33 + </form>
  34 + </div>
  35 + <div th:include="include::footer"></div>
  36 + <script type="text/javascript">
  37 + var prefix = ctx + "agv"
  38 + $("#form-agv-edit").validate({
  39 + rules:{
  40 + xxxx:{
  41 + required:true,
  42 + },
  43 + },
  44 + submitHandler: function(form) {
  45 + $.ajax({
  46 + cache : true,
  47 + type : "POST",
  48 + url : prefix + "/editagv",
  49 + data : {
  50 + "id": $("input[name='id']").val(),
  51 + "containerCode": $("input[name='containerCode']").val(),
  52 + "toPort" : $("input[name='toPort']").val(),
  53 + "priority" : $("input[name='priority']").val(),
  54 + },
  55 + async : false,
  56 + error : function(request) {
  57 + $.modal.alertError("请求失败!");
  58 + },
  59 + success : function(data) {
  60 + $.operate.saveSuccess(data);
  61 + }
  62 + });
  63 + }
  64 + });
  65 + </script>
  66 +</body>
  67 +</html>
... ...