|  |  |  | 
|---|
|  |  |  | import com.doumee.biz.system.SystemDictDataBiz; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.core.utils.HttpsUtil; | 
|---|
|  |  |  | import com.doumee.core.utils.SmsConstants; | 
|---|
|  |  |  | 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.core.wms.model.response.WmsInventoryDataResponse; | 
|---|
|  |  |  | import com.doumee.dao.business.*; | 
|---|
|  |  |  | import com.doumee.dao.business.model.*; | 
|---|
|  |  |  | import com.doumee.service.business.impl.SmsEmailServiceImpl; | 
|---|
|  |  |  | import com.doumee.service.business.third.EmayService; | 
|---|
|  |  |  | import com.doumee.service.business.third.WmsService; | 
|---|
|  |  |  | import com.github.yulichang.wrapper.MPJLambdaWrapper; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import org.springframework.util.CollectionUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | import java.util.stream.Collectors; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * WMS平台对接Service实现 | 
|---|
|  |  |  | 
|---|
|  |  |  | private SystemDictDataBiz systemDictDataBiz; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private WmsInterfaceLogMapper wmsInterfaceLogMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SmsConfigMapper smsConfigMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SmsEmailMapper smsEmailMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private EmayService emayService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private RetentionMapper retentionMapper; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 入库通知任务业务处理 | 
|---|
|  |  |  | * @param job 参数 | 
|---|
|  |  |  | 
|---|
|  |  |  | 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】出库作业的分配月台"; | 
|---|
|  |  |  | 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()); | 
|---|
|  |  |  | update.setWmsSendNum(job.getWmsSendNum() + 1); | 
|---|
|  |  |  | 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)){ | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public WmsBaseResponse<WmsInventoryDataResponse> getInventoryList(){ | 
|---|
|  |  |  | String url =  systemDictDataBiz.queryByCode(Constants.WSM_PARAM,Constants.WMS_GET_INVENTORYLIST_URL).getCode() ; | 
|---|
|  |  |  | String url =  systemDictDataBiz.queryByCode(Constants.WMS_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 | 
|---|
|  |  |  | 
|---|
|  |  |  | return returnSuccessReuslt(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void startEndNoticeToDriver(List<PlatformJob> jobList) { | 
|---|
|  |  |  | for(PlatformJob job : jobList){ | 
|---|
|  |  |  | //-----TODO-----------任康,发送司机公众号和短信通知 | 
|---|
|  |  |  | //-----TODO-----------任康,发送司机公众号和 | 
|---|
|  |  |  | //短信通知 | 
|---|
|  |  |  | if(Constants.equalsInteger(job.getStatus(),Constants.PlatformJobStatus.WAIT_CONFIRM.getKey())){ | 
|---|
|  |  |  | SmsEmailServiceImpl.sendPlatformJobSms(systemDictDataBiz, | 
|---|
|  |  |  | emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,job.getId(), | 
|---|
|  |  |  | SmsConstants.platformJobContent.platformJobNewJob,null,null | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | //如果是自有物流车 | 
|---|
|  |  |  | job.setType(type==0?Constants.platformJobType.zycxh:Constants.platformJobType.zyczh);//自有车卸货/装货 | 
|---|
|  |  |  | job.setCarCodeBack(job.getCarCodeFront());//自有车默认前后车牌一样 | 
|---|
|  |  |  | if(Constants.equalsInteger(car.getInStatus(),Constants.ONE) && car.getJobNum() == 0) { | 
|---|
|  |  |  | if(retentionMapper.selectCount(new QueryWrapper<Retention>().lambda().eq(Retention::getType,Constants.THREE) | 
|---|
|  |  |  | .eq(Retention::getCarNo,car.getCode()))>Constants.ZERO && car.getJobNum() == 0){ | 
|---|
|  |  |  | //如果车辆在园 | 
|---|
|  |  |  | job.setStatus(Constants.PlatformJobStatus.WAIT_CALL.getKey());//在园无作业状态,则自动【已签到】处理 | 
|---|
|  |  |  | job.setArriveDate(new Date()); | 
|---|
|  |  |  | job.setSingType(Constants.TWO); | 
|---|
|  |  |  | job.setSignDate(new Date()); | 
|---|
|  |  |  | List<PlatformJob> signList = platformJobMapper.selectList(new QueryWrapper<PlatformJob>(). | 
|---|
|  |  |  | lambda().apply(" DATE(SIGN_DATE) = DATE(NOW()) and sign_date is not null  ") | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(CollectionUtils.isEmpty(signList)){ | 
|---|
|  |  |  | job.setSignNum(Constants.ONE); | 
|---|
|  |  |  | } else{ | 
|---|
|  |  |  | int maxNumber = Collections.max(signList.stream().map(i->i.getSignNum()).collect(Collectors.toList())); | 
|---|
|  |  |  | job.setSignNum(maxNumber + Constants.ONE); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | PlatformGroup group = platformGroupMapper.selectOne(new QueryWrapper<PlatformGroup>().lambda() | 
|---|