Quellcode durchsuchen

可视化大屏08.08

zhangxin vor 1 Jahr
Ursprung
Commit
ee4b7681ce

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

@@ -48,8 +48,8 @@ public class WcsTaskController extends BaseController {
      * 查询大屏AGV任务列表
      */
     @GetMapping("/selectLargeScreenWcsTaskList")
-    public TableDataInfo selectLargeScreenWcsTaskList() {
-        return getDataTable(wcsTaskService.selectLargeScreenWcsTaskList());
+    public TableDataInfo selectLargeScreenWcsTaskList(@RequestParam String size) {
+        return getDataTable(wcsTaskService.selectLargeScreenWcsTaskList(size));
     }
 
     /**

+ 33 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/wms/car/CarInfoController.java

@@ -0,0 +1,33 @@
+package com.ruoyi.web.controller.warewms.wms.car;
+
+import com.ruoyi.ams.agv.car.service.ICarInfoService;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.page.TableDataInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 容器管理Controller
+ * 
+ * @author ruoyi
+ * @date 2022-11-01
+ */
+@RestController
+@RequestMapping("/car/carInfo")
+public class CarInfoController extends BaseController
+{
+    @Autowired
+    private ICarInfoService carInfoService;
+
+    /**
+     * agv车辆信息
+     */
+    @GetMapping("/queryCarInfo")
+    public TableDataInfo queryCarInfo()
+    {
+        return getDataTable(carInfoService.queryCarInfo());
+    }
+
+}

+ 4 - 0
warewms-ams/src/main/java/com/ruoyi/ams/agv/car/domain/CarInfo.java

@@ -1,7 +1,9 @@
 package com.ruoyi.ams.agv.car.domain;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.ruoyi.common.core.domain.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
 /**
  * 入库单明细对象 wms_doc_asn_details
@@ -9,6 +11,7 @@ import io.swagger.annotations.ApiModelProperty;
  * @author ruoyi
  * @date 2022-11-14
  */
+@Data
 public class CarInfo extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
@@ -17,6 +20,7 @@ public class CarInfo extends BaseEntity
     private String id;
 
     @ApiModelProperty(value = "车编号")
+    @TableField(value = "carNo")
     private String carNo;
 
     @ApiModelProperty(value = "仓库编号")

+ 10 - 5
warewms-ams/src/main/java/com/ruoyi/ams/agv/car/dto/CarInfoDTO.java

@@ -4,16 +4,21 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
-import java.math.BigDecimal;
 
 @Data
 public class CarInfoDTO implements Serializable {
 
     private static final long serialVersionUID = 4857035237485972793L;
 
-    @ApiModelProperty(value = "时间")
-    private String time;
+    @ApiModelProperty(value = "车辆编号")
+    private String carNo;
 
-    @ApiModelProperty(value = "数量")
-    private BigDecimal total;
+    @ApiModelProperty(value = "电池")
+    private String battery;
+
+    @ApiModelProperty(value = "状态")
+    private String state;
+
+    @ApiModelProperty(value = "agv任务编号")
+    private String taskNo;
 }

+ 2 - 0
warewms-ams/src/main/java/com/ruoyi/ams/agv/car/mapper/CarInfoMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.ams.agv.car.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ruoyi.ams.agv.car.domain.CarInfo;
+import org.apache.ibatis.annotations.Mapper;
 
 /**
  * 入库单明细Mapper接口
@@ -9,6 +10,7 @@ import com.ruoyi.ams.agv.car.domain.CarInfo;
  * @author ruoyi
  * @date 2022-11-03
  */
+@Mapper
 public interface CarInfoMapper extends BaseMapper<CarInfo> {
 
 }

+ 5 - 0
warewms-ams/src/main/java/com/ruoyi/ams/agv/car/service/ICarInfoService.java

@@ -1,5 +1,9 @@
 package com.ruoyi.ams.agv.car.service;
 
+import com.ruoyi.ams.agv.car.dto.CarInfoDTO;
+
+import java.util.List;
+
 /**
  * 入库单Service接口
  *
@@ -8,4 +12,5 @@ package com.ruoyi.ams.agv.car.service;
  */
 public interface ICarInfoService {
 
+    List<CarInfoDTO> queryCarInfo();
 }

+ 36 - 0
warewms-ams/src/main/java/com/ruoyi/ams/agv/car/service/impl/CarInfoServiceImpl.java

@@ -1,8 +1,23 @@
 package com.ruoyi.ams.agv.car.service.impl;
 
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.comparator.CompareUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.google.common.collect.Lists;
+import com.ruoyi.ams.agv.car.domain.CarInfo;
+import com.ruoyi.ams.agv.car.dto.CarInfoDTO;
+import com.ruoyi.ams.agv.car.mapper.CarInfoMapper;
 import com.ruoyi.ams.agv.car.service.ICarInfoService;
+import com.ruoyi.ams.task.domain.WcsTask;
+import com.ruoyi.ams.task.service.IWcsTaskService;
+import com.ruoyi.base.constant.Constant;
+import com.ruoyi.common.utils.ConvertUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+import java.util.stream.Collectors;
+
 /**
  * 入库单Service业务层处理
  *
@@ -11,4 +26,25 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class CarInfoServiceImpl implements ICarInfoService {
+
+    @Autowired
+    private CarInfoMapper carInfoMapper;
+
+    @Autowired
+    private IWcsTaskService wcsTaskService;
+
+    @Override
+    public List<CarInfoDTO> queryCarInfo(){
+        List<CarInfo> carInfoList = carInfoMapper.selectList(Wrappers.<CarInfo>lambdaQuery().eq(CarInfo::getActiveFlag, "Y"));
+        if (CollectionUtil.isEmpty(carInfoList)) return Lists.newArrayList();
+        List<WcsTask> wcsTaskList = wcsTaskService.queryAgvWcsTask(carInfoList.stream().map(CarInfo::getCarNo).collect(Collectors.toList()), Constant.TASK_STS.TASK4.getValue());
+        return carInfoList.stream().map(item -> {
+            CarInfoDTO carInfoDTO = ConvertUtils.sourceToTarget(item, CarInfoDTO.class);
+            Boolean flag = wcsTaskList.stream().anyMatch(wcsTask -> CompareUtil.compare(item.getCarNo(), wcsTask.getAgvNo()) == 0);
+            carInfoDTO.setTaskNo(flag ? wcsTaskList.stream().filter(wcsTask -> CompareUtil.compare(item.getCarNo(), wcsTask.getAgvNo()) == 0).findFirst().get().getTaskNo(): null);
+            carInfoDTO.setState(flag ? Constant.AGV_STATUS.BUSY.getValue(): Constant.AGV_STATUS.FREE.getValue());
+            return carInfoDTO;
+        }).collect(Collectors.toList());
+    }
+
 }

+ 4 - 2
warewms-ams/src/main/java/com/ruoyi/ams/task/mapper/WcsTaskMapper.java

@@ -1,17 +1,19 @@
 package com.ruoyi.ams.task.mapper;
 
-import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ruoyi.ams.task.domain.WcsTask;
 import com.ruoyi.ams.task.dto.WcsTaskLocationDTO;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
  * AGV任务Mapper接口
  * 
  * @author andy
  * @date 2022-03-10
  */
-public interface WcsTaskMapper 
+public interface WcsTaskMapper extends BaseMapper<WcsTask>
 {
     /**
      * 查询AGV任务

+ 3 - 1
warewms-ams/src/main/java/com/ruoyi/ams/task/service/IWcsTaskService.java

@@ -34,7 +34,7 @@ public interface IWcsTaskService {
      * 获取大屏任务列表
      * @return
      */
-    List<LargeScreenWcsTaskDTO> selectLargeScreenWcsTaskList();
+    List<LargeScreenWcsTaskDTO> selectLargeScreenWcsTaskList(String size);
 
     /**
      * 查询待下发的任务
@@ -44,6 +44,8 @@ public interface IWcsTaskService {
      */
     List<WcsTask> selectWcsUnallocated(Long warehouseId);
 
+    List<WcsTask> queryAgvWcsTask(List<String> agvNoList, Integer state);
+
     /**
      * 查询AGV任务
      *

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

@@ -1,5 +1,7 @@
 package com.ruoyi.ams.task.service.impl;
 
+import cn.hutool.core.collection.CollectionUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.ruoyi.ams.agv.ndc.domain.AmsTask;
 import com.ruoyi.ams.agv.ndc.service.IAmsTaskService;
 import com.ruoyi.ams.box.service.IWmsBoxInfoService;
@@ -29,6 +31,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.lang.reflect.Method;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -113,9 +116,12 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
      * @return
      */
     @Override
-    public List<LargeScreenWcsTaskDTO> selectLargeScreenWcsTaskList() {
+    public List<LargeScreenWcsTaskDTO> selectLargeScreenWcsTaskList(String size) {
         List<WcsTask> wcsTaskList = wcsTaskMapper.selectWcsTaskListVO(new WcsTask());
-        List<LargeScreenWcsTaskDTO> largeScreenWcsTaskDTO = ConvertUtils.sourceToTarget(wcsTaskList, LargeScreenWcsTaskDTO.class);
+        if (CollectionUtil.isEmpty(wcsTaskList)){
+            return new ArrayList<>();
+        }
+        List<LargeScreenWcsTaskDTO> largeScreenWcsTaskDTO = ConvertUtils.sourceToTarget(wcsTaskList.subList(0, Integer.valueOf(size)), LargeScreenWcsTaskDTO.class);
         largeScreenWcsTaskDTO.forEach(item -> item.setStateRemark(Constant.TASK_STS.getRemark(Integer.valueOf(item.getState().toString()))));
         return largeScreenWcsTaskDTO;
     }
@@ -125,6 +131,10 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
         return wcsTaskMapper.selectWcsUnallocated(warehouseId);
     }
 
+    @Override
+    public List<WcsTask> queryAgvWcsTask(List<String> agvNoList, Integer state) {
+        return wcsTaskMapper.selectList(Wrappers.<WcsTask>lambdaQuery().in(WcsTask::getAgvNo, agvNoList).eq(WcsTask::getState, state));
+    }
     /**
      * 查询AGV任务
      *

+ 1 - 1
warewms-ams/src/main/resources/mapper/ams/WcsTaskMapper.xml

@@ -111,7 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectWcsTaskListVO" parameterType="WcsTask" resultMap="WcsTaskResult">
         select t.task_no, t.business_type,bf.location_no location_from,fz.zone_name area_from,bt.location_no location_to,tz.zone_name area_to,
-        t.state,t.create_date,t.task_type, t.start_time, t.end_time,t.remark
+        t.state,t.create_date,t.task_type, t.agv_no, t.start_time, t.end_time,t.remark
         from wcs_task t
         left join base_location_info bf on t.location_from = bf.id
         left join base_location_info bt on t.location_to = bt.id

+ 17 - 0
warewms-base/src/main/java/com/ruoyi/base/constant/Constant.java

@@ -630,4 +630,21 @@ public class Constant {
         }
     }
 
+    public enum AGV_STATUS {
+
+        BUSY("任务中"),
+
+        FREE("空闲中");
+
+        private String value;
+
+        AGV_STATUS(String value) {
+            this.value = value;
+        }
+
+        public String getValue() {
+            return value;
+        }
+    }
+
 }