k94314517
2024-10-17 3d3e5a700227697f1cd41cb475bf27b7ac52684a
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/thrid/WmsServiceImpl.java
@@ -23,8 +23,10 @@
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实现
@@ -56,6 +58,8 @@
    private SmsEmailMapper smsEmailMapper;
    @Autowired
    private EmayService emayService;
    @Autowired
    private RetentionMapper retentionMapper;
    /**
     * 入库通知任务业务处理
     * @param job 参数
@@ -98,17 +102,21 @@
             update.setWmsSendNum(job.getWmsSendNum() + 1);
         }
         update.setWmsSendPlatformCode(job.getPlatformWmsCode());
         Boolean success = false;
         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作业单分配月台成功");
             success = true;
         }else{
            //如果失败
            update.setWmsSendStatus(Constants.TWO);
            update.setWmsSendInfo("通知WMS作业单分配月台失败:"+(response!=null?JSONObject.toJSONString(response):"接口调用失败"));
         }
         platformJobMapper.updateById(update);
         this.saveInterfaceLog(url, name,JSONObject.toJSONString(param),
                success?Constants.ZERO:Constants.ONE, update.getWmsSendInfo(),Constants.ZERO);
         return response;
    }
@@ -331,12 +339,20 @@
            //如果是自有物流车
            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()