| | |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wcs.common.domain.enums.DictType; |
| | | import com.zy.asrs.wcs.core.entity.BasShuttle; |
| | | import com.zy.asrs.wcs.core.entity.Loc; |
| | | import com.zy.asrs.wcs.core.map.controller.param.MapDataParam; |
| | | import com.zy.asrs.wcs.core.map.controller.param.MapQueryParam; |
| | |
| | | import com.zy.asrs.wcs.core.map.controller.result.LocVo; |
| | | import com.zy.asrs.wcs.core.map.controller.result.ShuttleVo; |
| | | import com.zy.asrs.wcs.core.map.entity.MapItem; |
| | | import com.zy.asrs.wcs.core.model.enums.DeviceCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.LocStsType; |
| | | import com.zy.asrs.wcs.core.service.BasShuttleService; |
| | | import com.zy.asrs.wcs.core.service.LocService; |
| | | import com.zy.asrs.wcs.core.service.LocStsService; |
| | | import com.zy.asrs.wcs.core.utils.Utils; |
| | | import com.zy.asrs.wcs.rcs.cache.SlaveConnection; |
| | | import com.zy.asrs.wcs.rcs.entity.Device; |
| | | import com.zy.asrs.wcs.rcs.entity.DeviceType; |
| | | import com.zy.asrs.wcs.rcs.model.enums.SlaveType; |
| | | import com.zy.asrs.wcs.rcs.model.protocol.LiftProtocol; |
| | | import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol; |
| | | import com.zy.asrs.wcs.rcs.service.DeviceService; |
| | | import com.zy.asrs.wcs.rcs.service.DeviceTypeService; |
| | | import com.zy.asrs.wcs.rcs.thread.ShuttleThread; |
| | | import com.zy.asrs.wcs.system.entity.Dict; |
| | | import com.zy.asrs.wcs.system.service.DictService; |
| | | import com.zy.asrs.wcs.system.service.UserService; |
| | | import com.zy.asrs.wcs.utils.CommonUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private LocService locService; |
| | | @Autowired |
| | | private LocStsService locStsService; |
| | | @Autowired |
| | | private BasShuttleService basShuttleService; |
| | | |
| | | public String getMapFloorList(Long userId) { |
| | | String floorKey = "floor-list"; |
| | |
| | | int bay = Utils.getBay(locNo); |
| | | List<Loc> locList = locService.list(new LambdaQueryWrapper<Loc>().eq(Loc::getRow, row).eq(Loc::getBay, bay).orderByAsc(Loc::getLev)); |
| | | for (Loc loc : locList) { |
| | | locVos.add(new LocVo(loc.getLocNo(), loc.getLocStsFlag())); |
| | | LocVo locVo = new LocVo(); |
| | | locVo.setLocNo(loc.getLocNo()); |
| | | locVo.setLocSts(loc.getLocStsFlag()); |
| | | locVo.setZpallet(loc.getZpallet()); |
| | | locVo.setEnable(CommonUtils.getStatusBool(loc.getStatus())); |
| | | locVos.add(locVo); |
| | | } |
| | | return locVos; |
| | | } |
| | |
| | | public ShuttleVo getShuttleInfo(String shuttleNo) { |
| | | ShuttleVo vo = new ShuttleVo(); |
| | | vo.setShuttleNo(shuttleNo); |
| | | DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>().eq(DeviceType::getFlag, SlaveType.Shuttle.toString())); |
| | | Device device = deviceService.getOne(new LambdaQueryWrapper<Device>().eq(Device::getDeviceType, deviceType.getId()).eq(Device::getDeviceNo, shuttleNo)); |
| | | Device device = deviceService.getOne(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val()) |
| | | .eq(Device::getDeviceNo, shuttleNo) |
| | | ); |
| | | if (null == device) { |
| | | return vo; |
| | | } |
| | | ShuttleThread thread = (ShuttleThread)SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue()); |
| | | if (null == thread) { |
| | | BasShuttle basShuttle = basShuttleService.getOne(new LambdaQueryWrapper<BasShuttle>().eq(BasShuttle::getDeviceId, device.getId())); |
| | | if (null == basShuttle || Cools.isEmpty(basShuttle.getProtocol())) { |
| | | return vo; |
| | | } |
| | | ShuttleProtocol protocol = thread.getStatus(); |
| | | if (null == protocol) { |
| | | return vo; |
| | | } |
| | | ShuttleProtocol protocol = JSON.parseObject(basShuttle.getProtocol(), ShuttleProtocol.class); |
| | | // ShuttleThread thread = (ShuttleThread)SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue()); |
| | | // if (null == thread) { |
| | | // return vo; |
| | | // } |
| | | // ShuttleProtocol protocol = thread.getStatus(); |
| | | // if (null == protocol) { |
| | | // return vo; |
| | | // } |
| | | vo.setTaskNo(String.valueOf(protocol.getTaskNo())); |
| | | vo.setStatus(protocol.getProtocolStatusType().desc); |
| | | vo.setOriginLocNo(protocol.getSourceLocNo()); |
| | | vo.setDestLocNo(protocol.getLocNo()); |
| | | vo.setCurrentCode(protocol.getCurrentCode()); |
| | | vo.setCurrentLocNo(protocol.getCurrentLocNo()); |
| | | vo.setBatteryPower(protocol.getBatteryPower()); |
| | | vo.setErrorCode(protocol.getErrorCode()); |
| | | vo.setBatteryTemp(protocol.getBatteryTemp()); |
| | |
| | | vo.setHasPallet(protocol.getHasPallet()); |
| | | vo.setHasCharge(protocol.getHasCharge()); |
| | | vo.setBatteryVoltage(String.valueOf(protocol.getBatteryVoltage())); |
| | | // vo.setZpallet(); |
| | | vo.setPakMk(protocol.getPakMk()); |
| | | vo.setEnable(CommonUtils.getStatusBool(basShuttle.getStatus())); |
| | | return vo; |
| | | } |
| | | |