|
|
|
|
@ -282,24 +282,71 @@ public class BaseBarcodesOutServiceImpl extends ServiceImpl<BaseBarcodesOutMappe |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public Result<Boolean> handOutboundInfoTask(String vin,String status){ |
|
|
|
|
// 添加手动下发任务的开始任务 并且从该任务起定时生成任务
|
|
|
|
|
if("start".equals(status)){ |
|
|
|
|
Object endVin = redisTemplate.opsForValue().get(RedisConstant.endTaskVin); |
|
|
|
|
if(ObjectUtils.isEmpty(endVin)){ |
|
|
|
|
return Result.err().msg("请先设定停止的VIN码"); |
|
|
|
|
} |
|
|
|
|
if (ObjectUtils.isEmpty(redisTemplate.opsForValue().get(RedisConstant.startTaskVin))) { |
|
|
|
|
redisTemplate.opsForValue().set(RedisConstant.startTaskVin,vin); |
|
|
|
|
BaseBarcodesOutQueryBo baseBarcodesOutQueryBo = new BaseBarcodesOutQueryBo(); |
|
|
|
|
baseBarcodesOutQueryBo.setVin(vin); |
|
|
|
|
BaseBarcodesOut baseBarcodesOut = iBaseBarcodesOutService.getOne(new LambdaQueryWrapper<BaseBarcodesOut>().eq(BaseBarcodesOut::getVin,vin)); |
|
|
|
|
|
|
|
|
|
BaseBarcodesOut startBarcodesOut = iBaseBarcodesOutService.getOne(new LambdaQueryWrapper<BaseBarcodesOut>().eq(BaseBarcodesOut::getVin,vin)); |
|
|
|
|
String startBumperType = startBarcodesOut.getBumperType(); |
|
|
|
|
String startDerive = startBarcodesOut.getDerive(); |
|
|
|
|
String startColor = startBarcodesOut.getColor(); |
|
|
|
|
String startVehicleCode = startBarcodesOut.getVehicleCode(); |
|
|
|
|
|
|
|
|
|
BaseBarcodesOut endBarcodesOut = iBaseBarcodesOutService.getOne(new LambdaQueryWrapper<BaseBarcodesOut>().eq(BaseBarcodesOut::getVin,endVin.toString())); |
|
|
|
|
String endBumperType = endBarcodesOut.getBumperType(); |
|
|
|
|
String endDerive = endBarcodesOut.getDerive(); |
|
|
|
|
String endColor = endBarcodesOut.getColor(); |
|
|
|
|
String endVehicleCode = endBarcodesOut.getVehicleCode(); |
|
|
|
|
//根据过点时间获取要出库的vin,并判断车型是否一样
|
|
|
|
|
if (!endBumperType.equals(startBumperType)&& !endDerive.equals(startDerive) && !endColor.equals(startColor) && !endVehicleCode.equals(startVehicleCode)){ |
|
|
|
|
return Result.err().msg("设定的开始VIN码与停止的VIN码车型-派生-颜色-车型一致:"+"开始VIN:"+startBumperType+"-"+startDerive+"-"+startColor+"-"+startVehicleCode |
|
|
|
|
+" 停止VIN:"+endBumperType+"-"+endDerive+"-"+endColor+"-"+endVehicleCode); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
String temp = sdf.format(baseBarcodesOut.getTraverseDate()); |
|
|
|
|
this.baseBarcodesOutMapper.updateBeforeBytraverseDate(temp); |
|
|
|
|
LambdaQueryWrapper<BaseBarcodesOut> outWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
List<BaseBarcodesOut> baseBarcodesOutList = iBaseBarcodesOutService.list(outWrapper |
|
|
|
|
.and((wrapper) ->{ |
|
|
|
|
wrapper.le(BaseBarcodesOut::getTraverseDate, endBarcodesOut.getTraverseDate()).ge(BaseBarcodesOut::getTraverseDate,startBarcodesOut.getTraverseDate()); |
|
|
|
|
}) |
|
|
|
|
.eq(BaseBarcodesOut::getBumperType, endBarcodesOut.getBumperType()) |
|
|
|
|
.eq(BaseBarcodesOut::getDerive, endBarcodesOut.getDerive()) |
|
|
|
|
.eq(BaseBarcodesOut::getColor, endBarcodesOut.getColor()) |
|
|
|
|
.eq(BaseBarcodesOut::getVehicleCode, endBarcodesOut.getVehicleCode()) |
|
|
|
|
.eq(BaseBarcodesOut::getOutStatus, "0") |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
for (BaseBarcodesOut barcodesOut : baseBarcodesOutList) { |
|
|
|
|
//手动已下发
|
|
|
|
|
barcodesOut.setOutStatus("4"); |
|
|
|
|
} |
|
|
|
|
boolean b = this.updateBatchById(baseBarcodesOutList); |
|
|
|
|
if (b){ |
|
|
|
|
return Result.ok().msg("共出库保险杠:"+baseBarcodesOutList.size()+"套"); |
|
|
|
|
}else { |
|
|
|
|
return Result.ok().msg("手动下发任务失败"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// this.baseBarcodesOutMapper.updateBeforeBytraverseDate(temp);
|
|
|
|
|
//TODO 出库一个任务的时候启用。其余情况都注释掉
|
|
|
|
|
// redisTemplate.opsForValue().set(RedisConstant.endTaskVin,vin);
|
|
|
|
|
}else{ |
|
|
|
|
return Result.err().msg("上次设定的出库未完成出库,不可下发任务"); |
|
|
|
|
} |
|
|
|
|
}else if("end".equals(status)){ |
|
|
|
|
redisTemplate.opsForValue().set(RedisConstant.endTaskVin,vin); |
|
|
|
|
return Result.ok().msg("设置停止VIN成功"); |
|
|
|
|
}else { |
|
|
|
|
return Result.err().msg("无匹配的类型"); |
|
|
|
|
} |
|
|
|
|
return Result.ok(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 手动下发出库任务 -暂停 |
|
|
|
|
|