| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.serializer.SerializerFeature; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.domain.param.CreateInTaskParam; |
| | | import com.zy.asrs.domain.param.CreateOutTaskParam; |
| | |
| | | while (!Thread.currentThread().isInterrupted()) { |
| | | try { |
| | | Config enableFakeConfig = configService |
| | | .selectOne(new EntityWrapper<Config>().eq("code", "enableFake")); |
| | | .getOne(new QueryWrapper<Config>().eq("code", "enableFake")); |
| | | if (enableFakeConfig != null) { |
| | | enableFake = enableFakeConfig.getValue(); |
| | | } |
| | | |
| | | Config fakeRealTaskRequestWmsConfig = configService |
| | | .selectOne(new EntityWrapper<Config>().eq("code", "fakeRealTaskRequestWms")); |
| | | .getOne(new QueryWrapper<Config>().eq("code", "fakeRealTaskRequestWms")); |
| | | if (fakeRealTaskRequestWmsConfig != null) { |
| | | fakeRealTaskRequestWms = fakeRealTaskRequestWmsConfig.getValue(); |
| | | } |
| | | |
| | | Config fakeGenerateInTaskConfig = configService |
| | | .selectOne(new EntityWrapper<Config>().eq("code", "fakeGenerateInTask")); |
| | | .getOne(new QueryWrapper<Config>().eq("code", "fakeGenerateInTask")); |
| | | if (fakeGenerateInTaskConfig != null) { |
| | | fakeGenerateInTask = fakeGenerateInTaskConfig.getValue(); |
| | | } |
| | | |
| | | Config fakeGenerateOutTaskConfig = configService |
| | | .selectOne(new EntityWrapper<Config>().eq("code", "fakeGenerateOutTask")); |
| | | .getOne(new QueryWrapper<Config>().eq("code", "fakeGenerateOutTask")); |
| | | if (fakeGenerateOutTaskConfig != null) { |
| | | fakeGenerateOutTask = fakeGenerateOutTaskConfig.getValue(); |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | List<BasDevp> basDevps = basDevpService.selectList(new EntityWrapper<>()); |
| | | List<BasDevp> basDevps = basDevpService.list(new QueryWrapper<>()); |
| | | for (BasDevp basDevp : basDevps) { |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basDevp.getDevpNo()); |
| | | if (stationThread == null) { |
| | |
| | | return; |
| | | } |
| | | |
| | | List<BasDevp> basDevps = basDevpService.selectList(new EntityWrapper<>()); |
| | | List<BasDevp> basDevps = basDevpService.list(new QueryWrapper<>()); |
| | | for (BasDevp basDevp : basDevps) { |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basDevp.getDevpNo()); |
| | | if (stationThread == null) { |
| | |
| | | |
| | | // 检测任务是否生成 |
| | | List<WrkMast> wrkMasts = wrkMastService |
| | | .selectList(new EntityWrapper<WrkMast>().eq("barcode", stationProtocol.getBarcode())); |
| | | .list(new QueryWrapper<WrkMast>().eq("barcode", stationProtocol.getBarcode())); |
| | | if (!wrkMasts.isEmpty()) { |
| | | continue; |
| | | } |
| | | |
| | | List<LocMast> locMastList = locMastService |
| | | .selectList(new EntityWrapper<LocMast>().eq("loc_sts", String.valueOf(LocStsType.O))); |
| | | .list(new QueryWrapper<LocMast>().eq("loc_sts", String.valueOf(LocStsType.O))); |
| | | if (locMastList.isEmpty()) { |
| | | continue; |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | List<BasDevp> basDevps = basDevpService.selectList(new EntityWrapper<>()); |
| | | List<BasDevp> basDevps = basDevpService.list(new QueryWrapper<>()); |
| | | for (BasDevp basDevp : basDevps) { |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basDevp.getDevpNo()); |
| | | if (stationThread == null) { |
| | |
| | | && !stationProtocol.isLoading() |
| | | && stationProtocol.getTaskNo() == 0) { |
| | | List<LocMast> locMastList = locMastService |
| | | .selectList(new EntityWrapper<LocMast>().eq("loc_sts", String.valueOf(LocStsType.F))); |
| | | .list(new QueryWrapper<LocMast>().eq("loc_sts", String.valueOf(LocStsType.F))); |
| | | if (locMastList.isEmpty()) { |
| | | continue; |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | List<BasDevp> basDevps = basDevpService.selectList(new EntityWrapper<>()); |
| | | List<BasDevp> basDevps = basDevpService.list(new QueryWrapper<>()); |
| | | for (BasDevp basDevp : basDevps) { |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basDevp.getDevpNo()); |
| | | if (stationThread == null) { |
| | |
| | | |
| | | // 检测任务是否生成 |
| | | List<WrkMast> wrkMasts = wrkMastService |
| | | .selectList(new EntityWrapper<WrkMast>() |
| | | .list(new QueryWrapper<WrkMast>() |
| | | .eq("barcode", stationProtocol.getBarcode())); |
| | | if (!wrkMasts.isEmpty()) { |
| | | continue; |
| | |
| | | // 1. 首先查询是否有已完成的异步响应 |
| | | String response = wmsOperateUtils.queryAsyncInTaskResponse(barcode, stationIdVal); |
| | | |
| | | if (response != null) { |
| | | if (!Cools.isEmpty(response)) { |
| | | // 2. 有响应结果,处理响应 |
| | | if (response.equals("FAILED") || response.startsWith("ERROR:")) { |
| | | // 请求失败,重新发起异步请求 |
| | |
| | | |
| | | // 计算所有站点停留时间 |
| | | public synchronized void calcAllStationStayTime() { |
| | | List<BasDevp> basDevps = basDevpService.selectList(new EntityWrapper<>()); |
| | | List<BasDevp> basDevps = basDevpService.list(new QueryWrapper<>()); |
| | | for (BasDevp basDevp : basDevps) { |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basDevp.getDevpNo()); |
| | | if (stationThread == null) { |
| | |
| | | |
| | | // 检测出库站点停留是否超时 |
| | | public synchronized void checkOutStationStayTimeOut() { |
| | | List<BasDevp> basDevps = basDevpService.selectList(new EntityWrapper<>()); |
| | | List<BasDevp> basDevps = basDevpService.list(new QueryWrapper<>()); |
| | | for (BasDevp basDevp : basDevps) { |
| | | List<StationObjModel> outStationList = basDevp.getOutStationList$(); |
| | | if (outStationList.isEmpty()) { |
| | |
| | | |
| | | // 检测入库站点堆垛机是否取走货物 |
| | | public synchronized void checkInStationCrnTake() { |
| | | List<BasCrnp> basCrnps = basCrnpService.selectList(new EntityWrapper<>()); |
| | | List<BasCrnp> basCrnps = basCrnpService.list(new QueryWrapper<>()); |
| | | for (BasCrnp basCrnp : basCrnps) { |
| | | List<StationObjModel> inStationList = basCrnp.getInStationList$(); |
| | | if (inStationList.isEmpty()) { |
| | |
| | | checkInStationListCrnTake(inStationList); |
| | | } |
| | | |
| | | List<BasDualCrnp> basDualCrnps = basDualCrnpService.selectList(new EntityWrapper<>()); |
| | | List<BasDualCrnp> basDualCrnps = basDualCrnpService.list(new QueryWrapper<>()); |
| | | for (BasDualCrnp basDualCrnp : basDualCrnps) { |
| | | List<StationObjModel> inStationList = basDualCrnp.getInStationList$(); |
| | | if (inStationList.isEmpty()) { |
| | |
| | | |
| | | // 堆垛机任务执行完成 |
| | | public synchronized void crnIoExecuteFinish() { |
| | | List<BasCrnp> basCrnps = basCrnpService.selectList(new EntityWrapper<>()); |
| | | List<BasCrnp> basCrnps = basCrnpService.list(new QueryWrapper<>()); |
| | | for (BasCrnp basCrnp : basCrnps) { |
| | | CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, basCrnp.getCrnNo()); |
| | | if (crnThread == null) { |