| | |
| | | package com.doumee.service.business.impl.wms; |
| | | |
| | | import com.doumee.core.wms.model.request.WmsActionNoticeRequest; |
| | | import com.doumee.core.wms.model.request.WmsInboundNoticeRequest; |
| | | import com.doumee.core.wms.model.request.WmsOutboundNoticeRequest; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.TypeReference; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.HttpsUtil; |
| | | import com.doumee.core.wms.model.request.*; |
| | | import com.doumee.core.wms.model.response.WmsBaseDataResponse; |
| | | import com.doumee.core.wms.model.response.WmsBaseResponse; |
| | | import com.doumee.dao.business.PlatformWmsDetailMapper; |
| | | import com.doumee.dao.business.PlatformWmsJobMapper; |
| | | import com.doumee.dao.business.model.PlatformWmsJob; |
| | | import com.doumee.core.wms.model.response.WmsInventoryDataResponse; |
| | | import com.doumee.dao.business.*; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.service.business.WmsService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * WMS平台对接Service实现 |
| | |
| | | * @date 2023/11/30 15:33 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class WmsServiceImpl implements WmsService { |
| | | @Autowired |
| | | private PlatformWmsJobMapper platformWmsJobMapper; |
| | | @Autowired |
| | | private PlatformGroupMapper platformGroupMapper; |
| | | @Autowired |
| | | private CarsMapper carsMapper; |
| | | @Autowired |
| | | private PlatformJobMapper platformJobMapper; |
| | | @Autowired |
| | | private PlatformWmsDetailMapper platformWmsDetailMapper; |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | @Autowired |
| | | private WmsInterfaceLogMapper wmsInterfaceLogMapper; |
| | | |
| | | /** |
| | | * 入库通知任务业务处理 |
| | | * @param job 参数 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public WmsBaseResponse<WmsBaseDataResponse> orderPlatformBind(PlatformJob job) { |
| | | if(StringUtils.isBlank(job.getBillCode()) || StringUtils.isBlank(job.getPlatformWmsCode())){ |
| | | |
| | | return null; |
| | | } |
| | | int type = 0; |
| | | if(Constants.equalsInteger(job.getType(),Constants.ONE) |
| | | || Constants.equalsInteger(job.getType(),Constants.THREE)){ |
| | | //如果是装货(出库) |
| | | type =1 ; |
| | | }else if(Constants.equalsInteger(job.getType(),Constants.ZERO) |
| | | || Constants.equalsInteger(job.getType(),Constants.TWO)){ |
| | | //如果是装货(出库) |
| | | type =0 ; |
| | | }else{ |
| | | return null; |
| | | } |
| | | WmsOrderPlatformRequest param = new WmsOrderPlatformRequest(); |
| | | param.setData(new ArrayList<>()); |
| | | WmsOrderPlatformInfoRequest o = new WmsOrderPlatformInfoRequest(); |
| | | o.setCarrierBillCode(job.getBillCode()); |
| | | o.setRailwayNo(job.getPlatformWmsCode()); |
| | | param.getData().add(o); |
| | | String url = type == 0?systemDictDataBiz.queryByCode(Constants.WSM_PARAM,Constants.WMS_INBOUND_PLATFROM_URL).getCode():systemDictDataBiz.queryByCode(Constants.WSM_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()); |
| | | 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作业单分配月台成功"); |
| | | }else{ |
| | | //如果失败 |
| | | update.setWmsSendStatus(Constants.TWO); |
| | | update.setWmsSendInfo("通知WMS作业单分配月台失败:"+(response!=null?JSONObject.toJSONString(response):"接口调用失败")); |
| | | } |
| | | platformJobMapper.updateById(update); |
| | | return response; |
| | | |
| | | } |
| | | /** |
| | | * 入库通知任务业务处理 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public WmsBaseResponse<WmsInventoryDataResponse> getInventoryList(){ |
| | | String url = systemDictDataBiz.queryByCode(Constants.WSM_PARAM,Constants.WMS_GET_INVENTORYLIST_URL).getCode() ; |
| | | String name = "【WMS】库存查询" ; |
| | | WmsBaseResponse<WmsInventoryDataResponse> response = sendHttpRequest(url,name,JSONObject.toJSONString(new JSONObject()),new TypeReference< WmsBaseResponse<WmsInventoryDataResponse>>(){}); |
| | | if(response!=null |
| | | && response.getData() !=null |
| | | && response.getData().size()>0 |
| | | && StringUtils.equals(response.getData().get(0).getSuccess(),WmsBaseResponse.CODE_SUCCESS)){ |
| | | //如果请求成功 |
| | | |
| | | }else{ |
| | | //如果失败 |
| | | if(response ==null){ |
| | | response = new WmsBaseResponse(); |
| | | response.setData(new ArrayList<>()); |
| | | } |
| | | if(response.getData() == null){ |
| | | response.setData(new ArrayList<>()); |
| | | } |
| | | } |
| | | return response; |
| | | |
| | | } |
| | | @Override |
| | | public void saveInterfaceLog(String url,String name,String param,Integer success,String respone,int type){ |
| | | if(wmsInterfaceLogMapper ==null){ |
| | | return; |
| | | } |
| | | WmsInterfaceLog log = new WmsInterfaceLog(); |
| | | log.setCreateDate(new Date()); |
| | | log.setUrl(url); |
| | | log.setEditDate(log.getCreateDate()); |
| | | log.setPlat(Constants.ZERO); |
| | | log.setName(name); |
| | | log.setIsdeleted(Constants.ZERO); |
| | | log.setRequest(param); |
| | | log.setType(type); |
| | | log.setSuccess(success); |
| | | log.setRepose(respone); |
| | | wmsInterfaceLogMapper.insert(log); |
| | | } |
| | | |
| | | /** |
| | | * 发起wms接口请求 |
| | | * @param url |
| | | * @param name |
| | | * @param param |
| | | * @param typeReference |
| | | * @return |
| | | * @param <T> |
| | | */ |
| | | public <T> WmsBaseResponse<T> sendHttpRequest(String url, String name, String param,TypeReference<WmsBaseResponse<T>> typeReference){ |
| | | log.info("【"+name+"】================开始===="+ JSONObject.toJSONString(param)); |
| | | if ( StringUtils.isNotBlank(url)) { |
| | | String res = null; |
| | | int success = 0; |
| | | try { |
| | | Map<String,String> headers = new HashMap<>(); |
| | | res = HttpsUtil.postJson(url,param); |
| | | WmsBaseResponse result = JSONObject.parseObject(res, typeReference.getType()); |
| | | logResult(result,name); |
| | | if(result!=null && result.getData() !=null ){ |
| | | |
| | | }else{ |
| | | success =1; |
| | | } |
| | | return result; |
| | | }catch (Exception e){ |
| | | success = 1; |
| | | log.error("【"+name+"】================失败===="+ JSONObject.toJSONString(param)); |
| | | }finally { |
| | | saveInterfaceLog(url,name,param,success,res,Constants.ZERO); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | private static void logResult(WmsBaseResponse<WmsBaseDataResponse> res,String name) { |
| | | if(StringUtils.equals(res.getData().get(0).getSuccess(), WmsBaseResponse.CODE_SUCCESS)){ |
| | | log.info("【WMS接口:"+name+"】================成功====\n"+res); |
| | | }else{ |
| | | log.error("【WMS接口:"+name+"】================失败====:\n"+ res); |
| | | } |
| | | } |
| | | /** |
| | | * 入库通知任务业务处理 |
| | | * @param list 参数 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public WmsBaseResponse inboundNotice(List<WmsInboundNoticeRequest> list) { |
| | | //TODO-------------------处理入库通知业务-------------------- |
| | | if(list ==null || list.size() ==0){ |
| | | return returnFailReuslt("请求参数不正确,参数不能为空"); |
| | | } |
| | | WmsBaseResponse response = new WmsBaseResponse(); |
| | | response.setData(new ArrayList<>()); |
| | | @Transactional |
| | | public WmsBaseResponse<WmsBaseDataResponse> inboundNotice(WmsBaseRequest<WmsInboundNoticeRequest> list) { |
| | | try{ |
| | | if(list ==null || list.getData()==null|| list.getData().size() ==0){ |
| | | return returnFailReuslt("请求参数不正确,参数不能为空"); |
| | | } |
| | | List<PlatformJob> jobList = new ArrayList<>(); |
| | | List<PlatformWmsDetail> details = new ArrayList<>(); |
| | | List<String> iocodeList = new ArrayList<>(); |
| | | for(WmsInboundNoticeRequest param : list.getData()){ |
| | | if(StringUtils.isBlank(param.getIoCode()) || |
| | | StringUtils.isBlank(param.getCarrierBillCode())|| |
| | | StringUtils.isBlank(param.getPlateNumber())|| |
| | | StringUtils.isBlank(param.getDriverPhone())){ |
| | | return returnFailReuslt("请求参数不正确,参数不合法!"); |
| | | } |
| | | //根据承运单号查询任务信息 |
| | | PlatformWmsJob job = platformWmsJobMapper.selectOne(new QueryWrapper<PlatformWmsJob>().lambda() |
| | | .eq(PlatformWmsJob::getCarryBillCode,param.getCarrierBillCode()) |
| | | .eq(PlatformWmsJob::getIsdeleted, Constants.ZERO) |
| | | .last("limit 1" )); |
| | | |
| | | return response; |
| | | if(job == null){ |
| | | |
| | | PlatformJob model =dealJobBizInbound(param); |
| | | job = new PlatformWmsJob(); |
| | | job.setCreateDate(new Date()); |
| | | job.setIsdeleted(Constants.ZERO); |
| | | job.setIsNew(Constants.ONE); |
| | | job.setCarryBillCode(param.getCarrierBillCode()); |
| | | job.setIocode(param.getIoCode()); |
| | | job.setCarrierName(param.getCarrierName()); |
| | | job.setPlateNumber(param.getPlateNumber()); |
| | | job.setType(Constants.ONE); |
| | | job.setIoCreatedate(param.getCreateDate()); |
| | | job.setJobId(model.getId()); |
| | | job.setDriverPhone(param.getDriverPhone()); |
| | | platformWmsJobMapper.insert(job); |
| | | jobList.add(model); |
| | | } |
| | | if(param.getDetails()!=null && param.getDetails().size()>0){ |
| | | for(WmsInboundDetailRequest d :param.getDetails()){ |
| | | PlatformWmsDetail entity = new PlatformWmsDetail(); |
| | | entity.setCreateDate(new Date()); |
| | | entity.setIsdeleted(Constants.ZERO); |
| | | entity.setIocode(d.getIoCode()); |
| | | entity.setJobId(job.getJobId()); |
| | | entity.setWmsJobId(job.getId()); |
| | | entity.setIoQty(d.getIoQty()); |
| | | entity.setStatus(Constants.ZERO); |
| | | entity.setRate(d.getRate()); |
| | | entity.setMaterialName(d.getMaterialName()); |
| | | entity.setInRepertotyCode(d.getInRepertotyCode()); |
| | | iocodeList.add(d.getIoCode()); |
| | | details.add(entity); |
| | | } |
| | | if(job.getIsNew() != 1&& iocodeList.size()>0){ |
| | | //先清理同一个承运单号下重复推送的iocode数据,以最后一次推送为主 |
| | | platformWmsDetailMapper.update(null,new UpdateWrapper<PlatformWmsDetail>().lambda() |
| | | .set(PlatformWmsDetail::getIsdeleted,Constants.ONE) |
| | | .eq(PlatformWmsDetail::getIsdeleted,Constants.ZERO) |
| | | .eq(PlatformWmsDetail::getWmsJobId,job.getId()) |
| | | .in(PlatformWmsDetail::getIocode,iocodeList) |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | if(details.size()>0){ |
| | | platformWmsDetailMapper.insert(details); |
| | | } |
| | | if(jobList.size()>0){ |
| | | startEndNoticeToDriver(jobList); |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("【WMS】处理入库取消通知业务===============业务处理异常"+e.getMessage()); |
| | | return returnFailReuslt("业务处理异常"); |
| | | } |
| | | return returnSuccessReuslt(null); |
| | | } |
| | | |
| | | private void startEndNoticeToDriver(List<PlatformJob> jobList) { |
| | | for(PlatformJob job : jobList){ |
| | | //-----TODO-----------任康,发送司机公众号和短信通知 |
| | | } |
| | | } |
| | | |
| | | |
| | | private PlatformJob dealJobBizInbound(WmsInboundNoticeRequest param) { |
| | | PlatformJob job = new PlatformJob(); |
| | | job.setCreateDate(new Date()); |
| | | job.setIsdeleted(Constants.ZERO); |
| | | job.setType(Constants.platformJobType.wxcxh);//默认是外协车卸货 |
| | | job.setStatus(Constants.PlatformJobStatus.WAIT_CONFIRM.getKey());//默认待确认状态 |
| | | //查询车辆是否自有车,以及jobNum表示但求作业数量(非已离园的作业数) |
| | | Cars car = carsMapper.selectOne(new QueryWrapper<Cars>() |
| | | .select("*,(select count(1) from platform_job b where b.plate_num='"+param.getPlateNumber()+"' and b.status in("+ |
| | | Constants.PlatformJobStatus.LEAVED.getKey()+")) as jobNum") |
| | | .lambda() |
| | | .eq(Cars::getIsdeleted,Constants.ZERO) |
| | | .eq(Cars::getType,Constants.ONE) |
| | | .eq(Cars::getCode,param.getPlateNumber())); |
| | | if(car !=null){ |
| | | //如果是自有物流车 |
| | | job.setType(Constants.platformJobType.zycxh);//自有车卸货 |
| | | if(Constants.equalsInteger(car.getInStatus(),Constants.ONE) && car.getJobNum() == 0) { |
| | | //如果车辆在园 |
| | | job.setStatus(Constants.PlatformJobStatus.WAIT_CALL.getKey());//在园无作业状态,则自动【已签到】处理 |
| | | } |
| | | } |
| | | PlatformGroup group = platformGroupMapper.selectOne(new QueryWrapper<PlatformGroup>().lambda() |
| | | .eq(PlatformGroup::getIsdeleted,Constants.ZERO) |
| | | .eq(PlatformGroup::getType,Constants.ONE) |
| | | .last("limit 1") );//查询卸货月台组编码 |
| | | job.setPlatformGroupId(group!=null?group.getId():null); |
| | | platformJobMapper.insert(job); |
| | | return job; |
| | | } |
| | | private PlatformJob dealJobBizOutbound(WmsOutboundNoticeRequest param) { |
| | | PlatformJob job = new PlatformJob(); |
| | | job.setCreateDate(new Date()); |
| | | job.setIsdeleted(Constants.ZERO); |
| | | job.setType(Constants.platformJobType.wxczh);//默认是外协车装好 |
| | | job.setStatus(Constants.PlatformJobStatus.WAIT_CONFIRM.getKey());//默认待确认状态 |
| | | //查询车辆是否自有车,以及jobNum表示但求作业数量(非已离园的作业数) |
| | | Cars car = carsMapper.selectOne(new QueryWrapper<Cars>() |
| | | .select("*,(select count(1) from platform_job b where b.plate_num='"+param.getPlateNumber()+"' and b.status in("+ |
| | | Constants.PlatformJobStatus.LEAVED.getKey()+")) as jobNum") |
| | | .lambda() |
| | | .eq(Cars::getIsdeleted,Constants.ZERO) |
| | | .eq(Cars::getType,Constants.ONE) |
| | | .eq(Cars::getCode,param.getPlateNumber())); |
| | | if(car !=null){ |
| | | //如果是自有物流车 |
| | | job.setType(Constants.platformJobType.zyczh);//自有车装货 |
| | | if(Constants.equalsInteger(car.getInStatus(),Constants.ONE) && car.getJobNum() == 0) { |
| | | //如果车辆在园 |
| | | job.setStatus(Constants.PlatformJobStatus.WAIT_CALL.getKey());//在园无作业状态,则自动【已签到】处理 |
| | | } |
| | | } |
| | | PlatformGroup group = platformGroupMapper.selectOne(new QueryWrapper<PlatformGroup>().lambda() |
| | | .eq(PlatformGroup::getIsdeleted,Constants.ZERO) |
| | | .eq(PlatformGroup::getType,Constants.ZERO) |
| | | .last("limit 1") );//查询装货月台组编码 |
| | | job.setPlatformGroupId(group!=null?group.getId():null); |
| | | platformJobMapper.insert(job); |
| | | return job; |
| | | } |
| | | /** |
| | | * 出库通知任务业务处理 |
| | | * @param list 参数 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public WmsBaseResponse outboundNotice(List<WmsOutboundNoticeRequest> list) { |
| | | //TODO-------------------处理出库通知业务-------------------- |
| | | if(list ==null || list.size() ==0){ |
| | | return returnFailReuslt("请求参数不正确,参数不能为空"); |
| | | public WmsBaseResponse outboundNotice(WmsBaseRequest<WmsOutboundNoticeRequest> list) { |
| | | |
| | | try{ |
| | | if(list ==null ||list.getData()==null || list.getData().size() ==0){ |
| | | return returnFailReuslt("请求参数不正确,参数不能为空"); |
| | | } |
| | | List<PlatformJob> jobList = new ArrayList<>(); |
| | | List<PlatformWmsDetail> details = new ArrayList<>(); |
| | | List<String> iocodeList = new ArrayList<>(); |
| | | for(WmsOutboundNoticeRequest param : list.getData()){ |
| | | if(StringUtils.isBlank(param.getIoCode()) || |
| | | StringUtils.isBlank(param.getCarrierBillCode())|| |
| | | StringUtils.isBlank(param.getPlateNumber())|| |
| | | StringUtils.isBlank(param.getDriverPhone())){ |
| | | return returnFailReuslt("请求参数不正确,参数不合法!"); |
| | | } |
| | | //根据承运单号查询任务信息 |
| | | PlatformWmsJob job = platformWmsJobMapper.selectOne(new QueryWrapper<PlatformWmsJob>().lambda() |
| | | .eq(PlatformWmsJob::getCarryBillCode,param.getCarrierBillCode()) |
| | | .eq(PlatformWmsJob::getIsdeleted, Constants.ZERO) |
| | | .last("limit 1" )); |
| | | |
| | | if(job == null){ |
| | | PlatformJob model =dealJobBizOutbound(param); |
| | | job = new PlatformWmsJob(); |
| | | job.setCreateDate(new Date()); |
| | | job.setIsdeleted(Constants.ZERO); |
| | | job.setIsNew(Constants.ONE); |
| | | job.setCarryBillCode(param.getCarrierBillCode()); |
| | | job.setIocode(param.getIoCode()); |
| | | job.setCarrierName(param.getCarrierName()); |
| | | job.setPlateNumber(param.getPlateNumber()); |
| | | job.setType(Constants.ONE); |
| | | job.setIoCreatedate(param.getCreateDate()); |
| | | job.setJobId(job.getId()); |
| | | job.setDriverPhone(param.getDriverPhone()); |
| | | platformWmsJobMapper.insert(job); |
| | | jobList.add(model); |
| | | } |
| | | if(param.getDetails()!=null && param.getDetails().size()>0){ |
| | | for(WmsOutboundDetailRequest d :param.getDetails()){ |
| | | PlatformWmsDetail entity = new PlatformWmsDetail(); |
| | | entity.setCreateDate(new Date()); |
| | | entity.setIsdeleted(Constants.ZERO); |
| | | entity.setIocode(d.getIoCode()); |
| | | entity.setJobId(job.getJobId()); |
| | | entity.setWmsJobId(job.getId()); |
| | | entity.setIoQty(d.getIoQty()); |
| | | entity.setWmsJobId(job.getId()); |
| | | entity.setStatus(Constants.ZERO); |
| | | entity.setRate(d.getRate()); |
| | | entity.setMaterialName(d.getMaterialName()); |
| | | iocodeList.add(d.getIoCode()); |
| | | details.add(entity); |
| | | } |
| | | if(job.getIsNew() != 1 && iocodeList.size()>0){ |
| | | //先清理同一个承运单号下重复推送的iocode数据,以最后一次推送为主 |
| | | platformWmsDetailMapper.update(null,new UpdateWrapper<PlatformWmsDetail>().lambda() |
| | | .set(PlatformWmsDetail::getIsdeleted,Constants.ONE) |
| | | .eq(PlatformWmsDetail::getIsdeleted,Constants.ZERO) |
| | | .eq(PlatformWmsDetail::getWmsJobId,job.getId()) |
| | | .in(PlatformWmsDetail::getIocode,iocodeList) |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | if(details.size()>0){ |
| | | platformWmsDetailMapper.insert(details); |
| | | } |
| | | if(jobList.size()>0){ |
| | | startEndNoticeToDriver(jobList); |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("【WMS】处理入库取消通知业务===============业务处理异常"+e.getMessage()); |
| | | return returnFailReuslt("业务处理异常"); |
| | | } |
| | | return null; |
| | | return returnSuccessReuslt(null); |
| | | } |
| | | /** |
| | | * 入库取消通知任务业务处理 |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public WmsBaseResponse cancelInbound(List<WmsActionNoticeRequest> list) { |
| | | //TODO-------------------处理入库取消通知业务-------------------- |
| | | if(list ==null || list.size() ==0){ |
| | | return returnFailReuslt("请求参数不正确,参数不能为空"); |
| | | public WmsBaseResponse cancelInbound(WmsBaseRequest<WmsActionNoticeRequest> list) { |
| | | //-----------------处理入库取消通知业务-------------------- |
| | | try { |
| | | if(list ==null||list.getData()==null || list.getData().size() ==0 || list.getData().get(0).getIoCode() == null){ |
| | | return returnFailReuslt("请求参数不正确,参数不能为空"); |
| | | } |
| | | List<String> iocodeList = new ArrayList<>(); |
| | | for(WmsActionNoticeRequest param :list.getData()){ |
| | | if(StringUtils.isNotBlank(param.getIoCode())){ |
| | | iocodeList.add(param.getIoCode()); |
| | | } |
| | | } |
| | | if(iocodeList.size() ==0 ){ |
| | | return returnFailReuslt("请求参数iocode不正确,参数不能为空"); |
| | | } |
| | | //取消全部数据状态为 【已取消】 |
| | | platformWmsDetailMapper.update(null,new UpdateWrapper<PlatformWmsDetail>().lambda() |
| | | .set(PlatformWmsDetail::getStatus,Constants.TWO) |
| | | .in(PlatformWmsDetail::getIocode,iocodeList) |
| | | .eq(PlatformWmsDetail::getIsdeleted, Constants.ZERO)); |
| | | }catch (Exception e){ |
| | | log.error("【WMS】处理入库取消通知业务===============业务处理异常"+e.getMessage()); |
| | | return returnFailReuslt("业务处理异常"); |
| | | } |
| | | |
| | | |
| | | return returnSuccessReuslt(null); |
| | | } |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public WmsBaseResponse cancelOutbound(List<WmsActionNoticeRequest> list) { |
| | | //TODO-------------------处理出库取消通知业务-------------------- |
| | | if(list ==null || list.size() ==0){ |
| | | return returnFailReuslt("请求参数不正确,参数不能为空"); |
| | | public WmsBaseResponse cancelOutbound(WmsBaseRequest<WmsActionNoticeRequest> list) { |
| | | try { |
| | | if(list ==null||list.getData()==null || list.getData().size() ==0 ){ |
| | | return returnFailReuslt("请求参数不正确,参数不能为空"); |
| | | } |
| | | List<String> iocodeList = new ArrayList<>(); |
| | | for(WmsActionNoticeRequest param :list.getData()){ |
| | | if(StringUtils.isNotBlank(param.getIoCode())){ |
| | | iocodeList.add(param.getIoCode()); |
| | | } |
| | | } |
| | | if(iocodeList.size() ==0 ){ |
| | | return returnFailReuslt("请求参数iocode不正确,参数不能为空"); |
| | | } |
| | | //取消全部数据状态为 【已取消】 |
| | | platformWmsDetailMapper.update(null,new UpdateWrapper<PlatformWmsDetail>().lambda() |
| | | .set(PlatformWmsDetail::getStatus,Constants.TWO) |
| | | .in(PlatformWmsDetail::getIocode,iocodeList) |
| | | .eq(PlatformWmsDetail::getIsdeleted, Constants.ZERO)); |
| | | }catch (Exception e){ |
| | | log.error("【WMS】出库取消通知任务业务处理===============业务处理异常"+e.getMessage()); |
| | | return returnFailReuslt("业务处理异常"); |
| | | } |
| | | |
| | | return returnSuccessReuslt(null); |
| | | } |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public WmsBaseResponse doneTask(List<WmsActionNoticeRequest> list) { |
| | | //TODO-------------------处理出入库作业完成通知业务-------------------- |
| | | if(list ==null || list.size() ==0){ |
| | | return returnFailReuslt("请求参数不正确,参数不能为空"); |
| | | public WmsBaseResponse doneTask(WmsBaseRequest<WmsActionNoticeRequest> list) { |
| | | try { |
| | | if(list ==null||list.getData()==null || list.getData().size() ==0){ |
| | | return returnFailReuslt("请求参数不正确,参数不能为空"); |
| | | } |
| | | List<String> iocodeList = new ArrayList<>(); |
| | | for(WmsActionNoticeRequest param :list.getData()){ |
| | | if(StringUtils.isNotBlank(param.getIoCode())){ |
| | | iocodeList.add(param.getIoCode()); |
| | | } |
| | | } |
| | | if(iocodeList.size() ==0 ){ |
| | | return returnFailReuslt("请求参数iocode不正确,参数不能为空"); |
| | | } |
| | | //取消全部数据状态为 【已完成】 |
| | | platformWmsDetailMapper.update(null,new UpdateWrapper<PlatformWmsDetail>().lambda() |
| | | .set(PlatformWmsDetail::getStatus,Constants.ONE) |
| | | .in(PlatformWmsDetail::getIocode,iocodeList) |
| | | .eq(PlatformWmsDetail::getIsdeleted, Constants.ZERO)); |
| | | }catch (Exception e){ |
| | | log.error("【WMS】作业完成通知任务业务处理===============业务处理异常"+e.getMessage()); |
| | | return returnFailReuslt("业务处理异常"); |
| | | } |
| | | |
| | | return returnSuccessReuslt(null); |
| | | } |
| | | |
| | |
| | | |
| | | private WmsBaseResponse returnFailReuslt(String msg) { |
| | | WmsBaseResponse response = new WmsBaseResponse(); |
| | | response.setCode(-1); |
| | | response.setData(new ArrayList<>()); |
| | | WmsBaseDataResponse rData = new WmsBaseDataResponse(); |
| | | rData.setMsgDescr(msg); |
| | |
| | | * @return |
| | | */ |
| | | |
| | | |
| | | private WmsBaseResponse returnSuccessReuslt(String msg) { |
| | | WmsBaseResponse response = new WmsBaseResponse(); |
| | | response.setCode(1); |
| | | response.setData(new ArrayList<>()); |
| | | WmsBaseDataResponse rData = new WmsBaseDataResponse(); |
| | | rData.setMsgDescr(StringUtils.defaultString(msg,"操作成功")); |