| | |
| | | |
| | | 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; |
| | |
| | | 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())); |