| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.BasCrnp; |
| | | import com.zy.asrs.entity.BasDualCrnp; |
| | | import com.zy.asrs.entity.HttpRequestLog; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.BasCrnpService; |
| | | import com.zy.asrs.service.BasDualCrnpService; |
| | | import com.zy.asrs.service.HttpRequestLogService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.entity.FindCrnNoResult; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.core.News; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.system.entity.Config; |
| | | import com.zy.system.service.ConfigService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private CommonService commonService; |
| | | @Autowired |
| | | private BasCrnpService basCrnpService; |
| | | @Autowired |
| | | private BasDualCrnpService basDualCrnpService; |
| | | |
| | | //申请入库任务 |
| | | public synchronized String applyInTask(String barcode, Integer sourceStaNo, Integer locType1) { |
| | |
| | | requestParam.put("barcode", barcode); |
| | | requestParam.put("sourceStaNo", sourceStaNo); |
| | | requestParam.put("locType1", locType1); |
| | | requestParam.put("row", Utils.getInTaskEnableRow()); |
| | | requestParam.put("row", Utils.getInTaskEnableRow(sourceStaNo)); |
| | | |
| | | response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | |
| | | } |
| | | |
| | | //申请任务重新分配库位 |
| | | public synchronized String applyReassignTaskLocNo(Integer taskNo) { |
| | | public synchronized String applyReassignTaskLocNo(Integer taskNo, Integer stationId) { |
| | | String wmsUrl = null; |
| | | Config wmsSystemUriConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "wmsSystemUri")); |
| | | if (wmsSystemUriConfig != null) { |
| | |
| | | wmsSystemReassignInTaskUrl = wmsSystemReassignInTaskUrlConfig.getValue(); |
| | | } |
| | | |
| | | if(wmsSystemReassignInTaskUrl == null){ |
| | | if (wmsSystemReassignInTaskUrl == null) { |
| | | News.error("未配置WMS任务重新分配入库库位接口地址,配置文件Code编码:wmsSystemReassignInTaskUrl"); |
| | | return null; |
| | | } |
| | |
| | | String response = null; |
| | | int result = 0; |
| | | try { |
| | | List<Integer> excludeCrnList = new ArrayList<>(); |
| | | List<Integer> excludeDualCrnList = new ArrayList<>(); |
| | | if (!Cools.isEmpty(wrkMast.getCrnNo())) { |
| | | excludeCrnList.add(wrkMast.getCrnNo()); |
| | | } |
| | | if (!Cools.isEmpty(wrkMast.getDualCrnNo())) { |
| | | excludeDualCrnList.add(wrkMast.getDualCrnNo()); |
| | | } |
| | | |
| | | requestParam.put("taskNo", wrkMast.getWmsWrkNo()); |
| | | requestParam.put("row", Utils.getInTaskEnableRow(new ArrayList<>(wrkMast.getCrnNo()), false)); |
| | | requestParam.put("row", Utils.getInTaskEnableRow(stationId, excludeCrnList, excludeDualCrnList, false)); |
| | | |
| | | response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | |
| | | if (jsonObject.getInteger("code") == 200) { |
| | | result = 1; |
| | | News.info("请求申请任务重新分配入库接口成功!!!url:{};request:{};response:{}", wmsUrl + wmsSystemReassignInTaskUrl, JSON.toJSONString(requestParam), response); |
| | | }else { |
| | | } else { |
| | | News.info("请求申请任务重新分配入库接口失败,接口返回Code异常!!!url:{};request:{};response:{}", wmsUrl + wmsSystemReassignInTaskUrl, JSON.toJSONString(requestParam), response); |
| | | } |
| | | }else { |
| | | } else { |
| | | News.info("请求申请任务重新分配入库接口失败,接口未响应!!!url:{};request:{};response:{}", wmsUrl + wmsSystemReassignInTaskUrl, JSON.toJSONString(requestParam), response); |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | return null; |
| | | } |
| | | |
| | | Integer crnNo = commonService.findCrnNoByLocNo(locNo); |
| | | if (crnNo == null) { |
| | | FindCrnNoResult findCrnNoResult = commonService.findCrnNoByLocNo(locNo); |
| | | if (findCrnNoResult == null) { |
| | | return null; |
| | | } |
| | | BasCrnp basCrnp = basCrnpService.selectOne(new EntityWrapper<BasCrnp>().eq("crn_no", crnNo)); |
| | | if (basCrnp == null) { |
| | | return null; |
| | | } |
| | | |
| | | Integer crnNo = findCrnNoResult.getCrnNo(); |
| | | List<Integer> crnRows = new ArrayList<>(); |
| | | List<List<Integer>> rowList = basCrnp.getControlRows$(); |
| | | for (List<Integer> list : rowList) { |
| | | crnRows.addAll(list); |
| | | |
| | | if (findCrnNoResult.getCrnType().equals(SlaveType.Crn)) { |
| | | BasCrnp basCrnp = basCrnpService.selectOne(new EntityWrapper<BasCrnp>().eq("crn_no", crnNo)); |
| | | if (basCrnp == null) { |
| | | return null; |
| | | } |
| | | List<List<Integer>> rowList = basCrnp.getControlRows$(); |
| | | for (List<Integer> list : rowList) { |
| | | crnRows.addAll(list); |
| | | } |
| | | } else if (findCrnNoResult.getCrnType().equals(SlaveType.DualCrn)) { |
| | | BasDualCrnp basDualCrnp = basDualCrnpService.selectOne(new EntityWrapper<BasDualCrnp>().eq("crn_no", crnNo)); |
| | | if (basDualCrnp == null) { |
| | | return null; |
| | | } |
| | | List<List<Integer>> rowList = basDualCrnp.getControlRows$(); |
| | | for (List<Integer> list : rowList) { |
| | | crnRows.addAll(list); |
| | | } |
| | | }else { |
| | | throw new CoolException("未知设备类型"); |
| | | } |
| | | |
| | | HashMap<String, Object> requestParam = new HashMap<>(); |