| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | |
| | | |
| | | import com.zy.asrs.entity.dto.TvDataDto; |
| | | import com.zy.asrs.entity.dto.TvLocDataDto; |
| | | import com.zy.asrs.entity.dto.WcsCrnDto; |
| | | import com.zy.asrs.entity.dto.WcsStationDto; |
| | | import com.zy.asrs.enums.RedisKeyType; |
| | | import com.zy.asrs.service.BasStationTvService; |
| | | import com.zy.asrs.service.TvDeviceService; |
| | | import com.zy.asrs.utils.CrnUtils; |
| | | import com.zy.asrs.utils.StationUtils; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.utils.RedisUtil; |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | |
| | | private BasStationTvService basStationTvService; |
| | | @Autowired |
| | | private StationUtils stationUtils; |
| | | @Autowired |
| | | private CrnUtils crnUtils; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | @Autowired |
| | |
| | | public R getLedInfos(HttpServletRequest request) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | String remoteAddr = request.getRemoteAddr(); |
| | | TvDevice tvDevice = tvDeviceService.selectOne( |
| | | new EntityWrapper<TvDevice>().eq("ip", remoteAddr)); |
| | | TvDevice tvDevice = tvDeviceService.getOne( |
| | | new QueryWrapper<TvDevice>().eq("ip", remoteAddr)); |
| | | if (tvDevice == null) { |
| | | return R.error("未找到IP对应的电视机设备: " + remoteAddr); |
| | | } |
| | | map.put("deviceName", tvDevice.getName()); |
| | | |
| | | List<BasStationTv> relations = basStationTvService |
| | | .selectList(new EntityWrapper<BasStationTv>().eq("tv_id", tvDevice.getId())); |
| | | .list(new QueryWrapper<BasStationTv>().eq("tv_id", tvDevice.getId())); |
| | | if (relations == null || relations.isEmpty()) { |
| | | map.put("data", new ArrayList<>()); |
| | | return R.ok().add(map); |
| | |
| | | continue; |
| | | } |
| | | |
| | | if(Cools.isEmpty(wcsStationDto.getTaskNo())){ |
| | | if(Cools.isEmpty(wcsStationDto.getTaskNo())||wcsStationDto.getTaskNo().equals("0")) { |
| | | continue; |
| | | } |
| | | |
| | | if (Cools.isEmpty(wcsStationDto.getWrkDetls())) { |
| | | continue; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | String remoteAddr = request.getRemoteAddr(); |
| | | TvDevice tvDevice = tvDeviceService.selectOne( |
| | | new EntityWrapper<TvDevice>().eq("ip", remoteAddr)); |
| | | TvDevice tvDevice = tvDeviceService.getOne( |
| | | new QueryWrapper<TvDevice>().eq("ip", remoteAddr)); |
| | | if (tvDevice != null) { |
| | | List<BasStationTv> relations = basStationTvService |
| | | .selectList(new EntityWrapper<BasStationTv>().eq("tv_id", tvDevice.getId())); |
| | | .list(new QueryWrapper<BasStationTv>().eq("tv_id", tvDevice.getId())); |
| | | if (relations != null && !relations.isEmpty()) { |
| | | for (BasStationTv relation : relations) { |
| | | WcsStationDto wcsStationDto = stationUtils.stationMap.get(relation.getStationId()); |
| | |
| | | errors.add(deviceError); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<WcsCrnDto> crnList = new ArrayList<>(crnUtils.crnMap.values()); |
| | | crnList.sort(Comparator.comparing(WcsCrnDto::getCrnNo, Comparator.nullsLast(Integer::compareTo))); |
| | | for (WcsCrnDto wcsCrnDto : crnList) { |
| | | if (wcsCrnDto == null || wcsCrnDto.getCrnNo() == null) { |
| | | continue; |
| | | } |
| | | if (wcsCrnDto.getOnline() == null || wcsCrnDto.getOnline() != 1) { |
| | | errors.add("堆垛机#" + wcsCrnDto.getCrnNo() + "离线"); |
| | | continue; |
| | | } |
| | | if (wcsCrnDto.getAlarm() != null && wcsCrnDto.getAlarm() != 0) { |
| | | errors.add("堆垛机#" + wcsCrnDto.getCrnNo() + "报警,报警码:" + wcsCrnDto.getAlarm()); |
| | | } |
| | | if (wcsCrnDto.getMode() == null || wcsCrnDto.getMode() != 3) { |
| | | String modeDesc = Cools.isEmpty(wcsCrnDto.getModeDesc()) ? "未知" : wcsCrnDto.getModeDesc(); |
| | | errors.add("堆垛机#" + wcsCrnDto.getCrnNo() + "非自动模式,当前模式:" + modeDesc); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | @GetMapping("/announcement") |
| | | public R top5(){ |
| | | EntityWrapper<Announcement> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Announcement> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("status", 1); |
| | | wrapper.orderBy("create_time", false); |
| | | wrapper.orderBy(true, false, "create_time"); |
| | | wrapper.last("limit 5"); |
| | | return R.ok(announcementService.selectList(wrapper)); |
| | | return R.ok(announcementService.list(wrapper)); |
| | | } |
| | | |
| | | /** |