feat(location): 添加托盘信息
This commit is contained in:
parent
4c93303695
commit
67785e397a
|
|
@ -552,4 +552,46 @@ public class LocationController extends BaseController {
|
|||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加托盘信息
|
||||
*
|
||||
* @param Vehicle
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/addVehicleInfo")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String addVehicleInfo(@RequestBody Vehicle vehicle) {
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
if (StringUtils.isEmpty(vehicle.getVehicleId()) || StringUtils.isEmpty(vehicle.getCurrentLocation())) {// 载具号不为空
|
||||
// 判断是不是需要往载具表里面添加数据
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("请填写托盘号或位置号");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
int i = vehicleService.addVehicle(vehicle);
|
||||
if(i <=0 ) {
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("插入失败");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.info("更新库位状态发生错误:{}", e.getMessage());
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage(e.getMessage());
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
|
||||
// 返回成功
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("更新库位状态成功");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -150,6 +150,7 @@ public class LocationUtils {
|
|||
break; // 数据库查询失败
|
||||
}
|
||||
if(!locationTasks.isEmpty()) {
|
||||
log.info("检查存在干涉库位失败,此位置有未完成的任务,任务位置{}",differentDepthLocation.getLocationId());
|
||||
canUse = false;
|
||||
break; // 有任务这个库位不行
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user