Browse Source

完成PDA任务管理模块

zhifei 1 year ago
parent
commit
232f386571

+ 2 - 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/ams/WcsTaskController.java

@@ -116,8 +116,7 @@ public class WcsTaskController extends BaseController {
         if (StringUtils.isNotEmpty(wcsTask.getAgvNo())) {
             agvNo = Integer.parseInt(wcsTask.getAgvNo());
         }
-        AjaxResult ajaxResult = wcsTaskService.callBack(wcsTask.getTaskNo(), 4, agvNo);
-        return AjaxResult.error(ajaxResult.getMsg());
+        return wcsTaskService.callBack(wcsTask.getTaskNo(), 4, agvNo);
     }
 
     @Log(title = "卸货任务完成", businessType = BusinessType.INSERT)
@@ -131,8 +130,7 @@ public class WcsTaskController extends BaseController {
         if (StringUtils.isNotEmpty(wcsTask.getAgvNo())) {
             agvNo = Integer.parseInt(wcsTask.getAgvNo());
         }
-        AjaxResult ajaxResult = wcsTaskService.callBack(wcsTask.getTaskNo(),2,agvNo);
-        return AjaxResult.error(ajaxResult.getMsg());
+        return wcsTaskService.callBack(wcsTask.getTaskNo(),2,agvNo);
     }
 
     @Log(title = "任务取消", businessType = BusinessType.INSERT)

+ 85 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/pda/PdawcsTaskController.java

@@ -0,0 +1,85 @@
+package com.ruoyi.web.controller.warewms.pda;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.ams.task.domain.WcsTask;
+import com.ruoyi.ams.task.domain.form.TaskDispositionForm;
+import com.ruoyi.ams.task.form.AddTaskForm;
+import com.ruoyi.ams.task.service.IWcsTaskService;
+import com.ruoyi.base.constant.Constant;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * AGV任务Controller
+ *
+ * @author andy
+ * @date 2022-03-10
+ */
+@RestController
+@RequestMapping("/app/wcsTask")
+public class PdawcsTaskController extends BaseController {
+    @Autowired
+    private IWcsTaskService wcsTaskService;
+
+
+    @GetMapping("/list")
+    public AjaxResult getlist(WcsTask wcsTask) {
+        startPage();
+        List<WcsTask> list = wcsTaskService.selectWcsTaskList(wcsTask);
+        return new AjaxResult(200,"查询成功!",list);
+    }
+
+    @Log(title = "取货任务完成", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/taskPickupComplete")
+    public AjaxResult taskPickupComplete(@RequestBody WcsTask task) {
+        int agvNo = 9999;
+        WcsTask wcsTask = wcsTaskService.selectWcsTaskByTaskNo(task.getTaskNo());
+        if (wcsTask == null) {
+            return AjaxResult.error("任务回调失败");
+        }
+        if (StringUtils.isNotEmpty(wcsTask.getAgvNo())) {
+            agvNo = Integer.parseInt(wcsTask.getAgvNo());
+        }
+        return  wcsTaskService.callBack(wcsTask.getTaskNo(), 4, agvNo);
+    }
+
+    @Log(title = "卸货任务完成", businessType = BusinessType.INSERT)
+    @PostMapping (value = "/taskComplete")
+    public AjaxResult taskComplete(@RequestBody WcsTask task) {
+        int agvNo = 9999;
+        WcsTask wcsTask = wcsTaskService.selectWcsTaskByTaskNo(task.getTaskNo());
+        if (wcsTask == null) {
+           return AjaxResult.error("任务回调失败");
+        }
+        if (StringUtils.isNotEmpty(wcsTask.getAgvNo())) {
+            agvNo = Integer.parseInt(wcsTask.getAgvNo());
+        }
+        return  wcsTaskService.callBack(wcsTask.getTaskNo(),2,agvNo);
+    }
+
+    @Log(title = "任务取消", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/taskCancel")
+    public AjaxResult taskCancel(@RequestBody WcsTask task) {
+        WcsTask wcsTask = wcsTaskService.selectWcsTaskByTaskNo(task.getTaskNo());
+        if (wcsTask == null) {
+            AjaxResult.error("任务查询不存在");
+        }
+        wcsTaskService.cancelTask(wcsTask);
+        return AjaxResult.success("任务取消指令下发成功!");
+    }
+
+}

+ 1 - 1
warewms-ams/src/main/java/com/ruoyi/ams/task/service/impl/WcsTaskServiceImpl.java

@@ -486,7 +486,7 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
         wcsTask.setState(state.longValue());
         wcsTask.setUpdateDate(new Date());
         wcsTaskService.updateWcsTask(wcsTask);
-        return AjaxResult.error("操作成功!");
+        return AjaxResult.success("操作成功!");
     }
 
     /**