自动化立体仓库 - WCS系统
Junjie
2023-12-26 2c9689ad1f2f3d80e068117b81448abd1619835c
src/main/java/com/zy/asrs/controller/MonitorController.java
@@ -27,10 +27,7 @@
import com.zy.core.thread.NyShuttleThread;
import lombok.Data;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -367,6 +364,10 @@
                    buffer.append("超重");
                }
                if (liftProtocol.getErrorCode() > 0) {
                    buffer.append(liftProtocol.getErrCode$());
                }
                HashMap<String, Object> map = new HashMap<>();
                map.put("deviceNo", liftProtocol.getLiftNo());//设备号-提升机号
                map.put("errorMsg", buffer.toString());//异常信息
@@ -393,6 +394,29 @@
        return R.ok().add(map);
    }
    /**
     * 获取设备运行异常统计
     */
    @GetMapping("/deviceRunErrorStatistic/{type}")
    public R deviceRunErrorStatistic(@PathVariable("type") String type) {
        int time = 1;//默认1天
        if (type.equals("day")) {
            time = 1;
        } else if (type.equals("week")) {
            time = 7;
        } else if (type.equals("month")) {
            time = 30;
        }
        //获取提升机运行异常数据
        List<Map<String, Object>> liftList = basLiftOptMapper.selectRunErrorStatistic(time);
        //获取小车运行异常数据
        List<Map<String, Object>> shuttleList = basShuttleOptMapper.selectRunErrorStatistic(time);
        HashMap<String, Object> map = new HashMap<>();
        map.put("lift", liftList);
        map.put("shuttle", shuttleList);
        return R.ok().add(map);
    }