自动化立体仓库 - WMS系统
zwl
6 天以前 632bde0f32999a2b319b706e23d90bc1b5dd8cc2
src/main/java/com/zy/asrs/service/impl/DigitalTwinServiceImpl.java
@@ -51,8 +51,10 @@
        List<Double> dbOverview = digitalTwinMapper.overview(areaId);
        if (dbOverview != null && !dbOverview.isEmpty()){
            int total = (int)Math.round(dbOverview.get(0));
            total = Math.min(total, 40000);
            DtOverviewVo dtOverviewVo = DtOverviewVo.builder()
                .totalLoc((int)Math.round(dbOverview.get(0)))
                    .totalLoc(total)
                    .useLoc((int)Math.round(dbOverview.get(1)))
                    .remainingStock((int)Math.round(dbOverview.get(2)))
                    .todayWarehousing((int)Math.round(dbOverview.get(3)))
@@ -189,7 +191,7 @@
        return dtInAndOutBoundVos;
    }
    /**
     * 近期近期呆滞品信息,默认超过30天为呆滞品
     * 近期近期呆滞品信息,默认超过14天为呆滞品
     *
     * @param areaId
     * @param overDayNum
@@ -200,7 +202,7 @@
     */
    public List<DtDetainMatVo> recentDetainMat(String areaId, Integer overDayNum, Integer pageIndex, Integer pageSize, String condition) {
        overDayNum = overDayNum == null ? 30 : overDayNum;
        overDayNum = overDayNum == null ? 14 : overDayNum;
        pageIndex = pageIndex == null ? 1 : pageIndex;
        pageSize = pageSize == null ? 1000000 : pageSize;
@@ -220,24 +222,14 @@
    /**
     * 查询库存和库位详细信息
     *
     * @param areaId
     * @param arr
     * @return
     */
    public List<DtLocDetailVo> warehouseDetail(String areaId) {
        List<LocMast> locMastList = locMastService.selectList(new EntityWrapper<>());
        return locMastList.stream()
                .map(loc -> {
                    DtLocDetailVo vo = new DtLocDetailVo();
                    BeanUtils.copyProperties(loc, vo);
                    vo.setLocMast(loc);
                    LocDetl query = new LocDetl();
                    query.setLocNo(loc.getLocNo());
                    LocDetl locDetl = locDetlMapper.selectOne(query);
                    vo.setLocDetl(locDetl);
                    return vo;
                })
                .collect(Collectors.toList());
    public List<LocMast> warehouseDetail(Integer[] arr) {
        if (arr == null || arr.length == 0) {
            return locMastService.selectList(new EntityWrapper<>());
        }
        return locMastService.selectList(new EntityWrapper<LocMast>().in("row1", Arrays.asList(arr)));
    }
    /**
@@ -252,33 +244,53 @@
        List<DtLocVo> locVos = new ArrayList<>();
        if (startDate == null || endDate == null || startDate.isEmpty() || endDate.isEmpty()){
        Date startTime;
        Date endTime;
        if (startDate == null || endDate == null || startDate.isEmpty() || endDate.isEmpty()) {
            Date now = new Date();
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(now);
            calendar.add(Calendar.DAY_OF_MONTH, -7);
            Date start = calendar.getTime();
            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
            endDate = sdf.format(now);
            startDate = sdf.format(start);
        }
        List<LocCount> locCounts;
        if (areaId != null && !areaId.isEmpty()) {
            locCounts = locCountMapper.getByAreaAndDate(areaId, Integer.parseInt(startDate), Integer.parseInt(endDate));
            startTime = calendar.getTime();
            endTime = now;
        } else {
            locCounts = locCountMapper.getByDate(Integer.parseInt(startDate), Integer.parseInt(endDate));
            SimpleDateFormat sdf;
            try {
                if (startDate.length() == 8 && endDate.length() == 8) {
                    sdf = new SimpleDateFormat("yyyyMMdd");
                    startTime = sdf.parse(startDate);
                    endTime = sdf.parse(endDate);
                } else {
                    sdf = new SimpleDateFormat("yyyy-MM-dd");
                    startTime = sdf.parse(startDate);
                    endTime = sdf.parse(endDate);
                }
            } catch (ParseException e) {
                Date now = new Date();
                Calendar calendar = Calendar.getInstance();
                calendar.setTime(now);
                calendar.add(Calendar.DAY_OF_MONTH, -7);
                startTime = calendar.getTime();
                endTime = now;
            }
        }
        int totalLoc = locMastMapper.selectCount(new EntityWrapper<LocMast>().ne("loc_sts", "Z"));
        int usedLoc = locMastMapper.selectCount(new EntityWrapper<LocMast>().in("loc_sts", Arrays.asList("F", "P", "Q", "R", "S", "X")));
        int idleNum = totalLoc - usedLoc;
        for (LocCount locCount : locCounts) {
            String date = locCount.getDate().toString();
            String locDate = date.substring(0, 4) + "-" + date.substring(4, 6) + "-" + date.substring(6, 8);
        SimpleDateFormat outSdf = new SimpleDateFormat("yyyy-MM-dd");
        Calendar cursor = Calendar.getInstance();
        cursor.setTime(startTime);
        Calendar endCursor = Calendar.getInstance();
        endCursor.setTime(endTime);
        while (!cursor.after(endCursor)) {
            DtLocVo dtLocVo = DtLocVo.builder()
                    .locDate(locDate)
                    .idleNum(locCount.getRemainNum())
                    .locDate(outSdf.format(cursor.getTime()))
                    .idleNum(idleNum)
                    .build();
            locVos.add(dtLocVo);
            cursor.add(Calendar.DAY_OF_MONTH, 1);
        }
        return locVos;
@@ -321,12 +333,20 @@
            vo.setCrnNo(crnp.getCrnNo());
            Integer wrkNo = crnp.getWrkNo();
            vo.setTaskNo(wrkNo == null ? null : String.valueOf(wrkNo));
            String locNo = !Cools.isEmpty(crnp.getToLocno()) ? crnp.getToLocno() : crnp.getFrmLocno();
            if (!Cools.isEmpty(locNo)) {
                LocMast locMast = locMastService.selectById(locNo);
                if (locMast != null) {
                    vo.setBay1(locMast.getBay1());
                    vo.setLev1(locMast.getLev1());
            vo.setBay1(crnp.getBay());
            vo.setLev1(crnp.getLevel());
            if (vo.getBay1() == null || vo.getLev1() == null) {
                String locNo = !Cools.isEmpty(crnp.getToLocno()) ? crnp.getToLocno() : crnp.getFrmLocno();
                if (!Cools.isEmpty(locNo)) {
                    LocMast locMast = locMastService.selectById(locNo);
                    if (locMast != null) {
                        if (vo.getBay1() == null) {
                            vo.setBay1(locMast.getBay1());
                        }
                        if (vo.getLev1() == null) {
                            vo.setLev1(locMast.getLev1());
                        }
                    }
                }
            }
            vo.setVerticalSpeed(parseInteger(crnp.getCtlHp()));
@@ -427,6 +447,34 @@
        return result;
    }
    @Override
    public List<Map<String, Object>> getLocalDetalByLocNo(String locNo) {
        if (locNo == null || locNo.trim().isEmpty()) {
            return Collections.emptyList();
        }
        List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
                .eq("loc_no", locNo.trim())
                .orderBy("appe_time", true));
        List<Map<String, Object>> result = new ArrayList<>();
        for (LocDetl locDetl : locDetls) {
            Map<String, Object> item = new LinkedHashMap<>();
            item.put("locNo", locDetl.getLocNo());
            item.put("zpallet", locDetl.getZpallet());
            item.put("matnr", locDetl.getMatnr());
            item.put("maktx", locDetl.getMaktx());
            item.put("specs", locDetl.getSpecs());
            item.put("batch", locDetl.getBatch());
            item.put("anfme", locDetl.getAnfme());
            item.put("orderNo", locDetl.getOrderNo());
            item.put("frozen", locDetl.getFrozen());
            result.add(item);
        }
        return result;
    }
    public Map<String, Object> getLocInfo() {
        List<LocMast> LocMasts = locMastMapper.selectList(new EntityWrapper<>());
        Map<String, Object> result = new HashMap<>();