| | |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | }else{ |
| | | return null; |
| | | } |
| | | WmsOrderPlatformRequest param = new WmsOrderPlatformRequest(); |
| | | param.setData(new ArrayList<>()); |
| | | |
| | | List<PlatformWmsDetail> platformWmsDetailList = platformWmsDetailMapper.selectList(new QueryWrapper<PlatformWmsDetail>().lambda() |
| | | .eq(PlatformWmsDetail::getJobId,job.getId()) |
| | | .eq(PlatformWmsDetail::getIsdeleted,Constants.ZERO) |
| | | ); |
| | | String url = type == 0?systemDictDataBiz.queryByCode(Constants.WMS_PARAM,Constants.WMS_INBOUND_PLATFROM_URL).getCode(): |
| | | systemDictDataBiz.queryByCode(Constants.WMS_PARAM,Constants.WMS_OUTBOUND_PLATFROM_URL).getCode();; |
| | | String name = type ==0?"【WMS】入库作业单分配月台":"【WMS】出库作业的分配月台"; |
| | | // int sendSuccess = 0; |
| | | // int sendError = 0; |
| | | List<String> errorMassge = new ArrayList<>(); |
| | | List<String> successMassge = new ArrayList<>(); |
| | | WmsBaseResponse<WmsBaseDataResponse> response = null; |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(platformWmsDetailList)){ |
| | | for (PlatformWmsDetail platformWmsDetail:platformWmsDetailList) { |
| | | if(StringUtils.isNotBlank(platformWmsDetail.getIocode())){ |
| | | //只处理未发送的请求 |
| | | WmsOrderPlatformRequest param = new WmsOrderPlatformRequest(); |
| | | param.setData(new ArrayList<>()); |
| | | WmsOrderPlatformInfoRequest o = new WmsOrderPlatformInfoRequest(); |
| | | o.setCarrierBillCode(platformWmsDetail.getIocode()); |
| | | o.setRailwayNo(job.getPlatformWmsCode()); |
| | | param.getData().add(o); |
| | | response = sendHttpRequest(url,name,JSONObject.toJSONString(param),new TypeReference< WmsBaseResponse<WmsBaseDataResponse>>(){}); |
| | | if(response!=null && response.getData() !=null |
| | | && response.getData().size()>0 && StringUtils.equals(response.getData().get(0).getSuccess(),WmsBaseResponse.CODE_SUCCESS)){ |
| | | //如果成功 |
| | | successMassge.add(o.getRailwayNo()); |
| | | }else{ |
| | | //如果失败 |
| | | errorMassge.add(o.getRailwayNo()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if(successMassge.size()>0 || errorMassge.size()>0){ |
| | | PlatformJob update = new PlatformJob(); |
| | | update.setId(job.getId()); |
| | | update.setWmsSendDate(new Date()); |
| | | if(Objects.isNull(job.getWmsSendNum())){ |
| | | job.setWmsSendNum(1); |
| | | }else{ |
| | | update.setWmsSendNum(job.getWmsSendNum() + 1); |
| | | } |
| | | update.setWmsSendPlatformCode(job.getPlatformWmsCode()); |
| | | if(successMassge.size()>0 && errorMassge.size() ==0){ |
| | | //如果成功 |
| | | update.setWmsSendStatus(Constants.ONE); |
| | | }else if(successMassge.size()==0 && errorMassge.size() >1){ |
| | | //如果失败 |
| | | update.setWmsSendStatus(Constants.TWO); |
| | | } |
| | | Map<String ,Object> info= new HashMap<>(); |
| | | info.put("success", successMassge); |
| | | info.put("error", errorMassge); |
| | | update.setWmsSendInfo(JSONObject.toJSONString(info)); |
| | | platformJobMapper.updateById(update); |
| | | } |
| | | |
| | | String url = type == 0?systemDictDataBiz.queryByCode(Constants.WMS_PARAM,Constants.WMS_INBOUND_PLATFROM_URL).getCode(): |
| | | systemDictDataBiz.queryByCode(Constants.WMS_PARAM,Constants.WMS_OUTBOUND_PLATFROM_URL).getCode();; |
| | | String name = type ==0?"【WMS】入库作业单分配月台":"【WMS】出库作业的分配月台"; |
| | | WmsBaseResponse<WmsBaseDataResponse> response = sendHttpRequest(url,name,JSONObject.toJSONString(param),new TypeReference< WmsBaseResponse<WmsBaseDataResponse>>(){}); |
| | | PlatformJob update = new PlatformJob(); |
| | | update.setId(job.getId()); |
| | | update.setWmsSendDate(new Date()); |
| | | if(Objects.isNull(job.getWmsSendNum())){ |
| | | job.setWmsSendNum(1); |
| | | }else{ |
| | | update.setWmsSendNum(job.getWmsSendNum() + 1); |
| | | } |
| | | update.setWmsSendPlatformCode(job.getPlatformWmsCode()); |
| | | if(response!=null && response.getData() !=null |
| | | && response.getData().size()>0 && StringUtils.equals(response.getData().get(0).getSuccess(),WmsBaseResponse.CODE_SUCCESS)){ |
| | | //如果成功 |
| | | update.setWmsSendStatus(Constants.ONE); |
| | | update.setWmsSendInfo("通知WMS作业单分配月台成功"+response.getData().get(0).getMsgDescr()); |
| | | }else{ |
| | | //如果失败 |
| | | update.setWmsSendStatus(Constants.TWO); |
| | | update.setWmsSendInfo("通知WMS作业单分配月台失败:"+(response!=null?JSONObject.toJSONString(response):"接口调用失败")); |
| | | } |
| | | platformJobMapper.updateById(update); |
| | | return response; |
| | | |
| | | } |
| | | |
| | | private boolean notSendedCode(String iocode, List<String> doneIoCode) { |
| | | if(doneIoCode!=null){ |
| | | for(String s : doneIoCode){ |
| | | if(StringUtils.equals(iocode,s)){ |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 入库通知任务业务处理 |
| | | * @return |