| | |
| | | import com.doumee.dao.business.*; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.service.business.WmsService; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private PlatformGroupMapper platformGroupMapper; |
| | | @Autowired |
| | | private CarsMapper carsMapper; |
| | | @Autowired |
| | | private MemberMapper memberMapper; |
| | | @Autowired |
| | | private PlatformJobMapper platformJobMapper; |
| | | @Autowired |
| | |
| | | .last("limit 1" )); |
| | | |
| | | if(job == null){ |
| | | |
| | | PlatformJob model =dealJobBizInbound(param); |
| | | job = new PlatformWmsJob(); |
| | | job.setCreateDate(new Date()); |
| | |
| | | job.setIsdeleted(Constants.ZERO); |
| | | job.setType(Constants.platformJobType.wxcxh);//默认是外协车卸货 |
| | | job.setStatus(Constants.PlatformJobStatus.WAIT_CONFIRM.getKey());//默认待确认状态 |
| | | job.setBillCode(param.getCarrierBillCode()); |
| | | job.setCarrierName(param.getCarrierName()); |
| | | job.setCarCodeFront(param.getPlateNumber()); |
| | | job.setDrivierPhone(param.getDriverPhone()); |
| | | job.setDriverName(param.getDriverName()); |
| | | //处理作业的车辆、司机、月台组关联关系,卸货 |
| | | dealCarPlatformAndDriverInfo(job,0); |
| | | platformJobMapper.insert(job); |
| | | return job; |
| | | } |
| | | |
| | | private void dealCarPlatformAndDriverInfo(PlatformJob job,int type) { |
| | | //查询车辆是否自有车,以及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("+ |
| | | .select("*,(select count(1) from platform_job b where b.plate_num='"+job.getCarCodeFront()+"' 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())); |
| | | .eq(Cars::getCode,job.getCarCodeFront())); |
| | | if(car !=null){ |
| | | //如果是自有物流车 |
| | | job.setType(Constants.platformJobType.zycxh);//自有车卸货 |
| | | job.setType(type==0?Constants.platformJobType.zycxh:Constants.platformJobType.zyczh);//自有车卸货/装货 |
| | | job.setCarCodeBack(job.getCarCodeFront());//自有车默认前后车牌一样 |
| | | if(Constants.equalsInteger(car.getInStatus(),Constants.ONE) && car.getJobNum() == 0) { |
| | | //如果车辆在园 |
| | | job.setStatus(Constants.PlatformJobStatus.WAIT_CALL.getKey());//在园无作业状态,则自动【已签到】处理 |
| | |
| | | .eq(PlatformGroup::getType,Constants.ONE) |
| | | .last("limit 1") );//查询卸货月台组编码 |
| | | job.setPlatformGroupId(group!=null?group.getId():null); |
| | | Member driver = memberMapper.selectJoinOne(Member.class,new MPJLambdaWrapper<Member>() |
| | | .selectAll(Member.class) |
| | | .selectAs(Company::getCompanyNamePath,Member::getCompanyNamePath) |
| | | .leftJoin(Company.class,Company::getId,Member::getCompanyId) |
| | | .eq(Member::getIsdeleted,Constants.ZERO) |
| | | .eq(Member::getPhone,job.getDrivierPhone()) |
| | | .last("limit 1") );//查询装货月台组编码 |
| | | if(driver!=null){ |
| | | job.setDriverId(driver.getId()); |
| | | job.setCompanyId(driver.getCompanyId()); |
| | | job.setCompanyNamePath(driver.getCompanyNamePath()); |
| | | } |
| | | |
| | | 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); |
| | | job.setBillCode(param.getCarrierBillCode()); |
| | | job.setCarrierName(param.getCarrierName()); |
| | | job.setCarCodeFront(param.getPlateNumber()); |
| | | job.setDrivierPhone(param.getDriverPhone()); |
| | | job.setDriverName(param.getDriverName()); |
| | | //处理作业的车辆、司机、月台组关联关系,装货 |
| | | dealCarPlatformAndDriverInfo(job,1); |
| | | return job; |
| | | } |
| | | /** |