自动化立体仓库 - WMS系统
zwl
昨天 07e08c668653df7b383ef9e32a078cb681ba2e44
src/main/java/com/zy/asrs/service/impl/DigitalTwinServiceImpl.java
@@ -220,24 +220,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 +242,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 +331,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()));