fix:子卷质检加锁,绑定托盘时校验该托盘是否有被绑定过

This commit is contained in:
zhouz
2025-09-17 09:57:24 +08:00
parent 35a8e863fe
commit 4cade7b1ea
2 changed files with 171 additions and 154 deletions

View File

@@ -981,7 +981,12 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@SneakyThrows
public JSONObject update(JSONObject whereJson) { public JSONObject update(JSONObject whereJson) {
RLock lock = redissonClient.getLock("updatePackageInfo------"+whereJson.getString("container_name"));
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
try {
if (tryLock) {
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
if (StringUtils.isBlank(whereJson.getString("ivt_status"))) { if (StringUtils.isBlank(whereJson.getString("ivt_status"))) {
throw new BadRequestException("子卷检验结果为空"); throw new BadRequestException("子卷检验结果为空");
@@ -1146,6 +1151,14 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
result.put("status", org.springframework.http.HttpStatus.OK.value()); result.put("status", org.springframework.http.HttpStatus.OK.value());
result.put("message", "检验成功!"); result.put("message", "检验成功!");
return result; return result;
} else {
throw new BadRequestException("当前子卷【" + whereJson.getString("container_name") + "】正在质检中请稍后再试!");
}
} finally {
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock();
}
}
} }
/** /**

View File

@@ -132,6 +132,10 @@ public class InBoxManageServiceImpl implements InBoxManageService {
if (StrUtil.isEmpty(qty) || Double.parseDouble(qty) <= 0){ if (StrUtil.isEmpty(qty) || Double.parseDouble(qty) <= 0){
throw new BadRequestException("托盘【"+whereJson.getString("vehicle_code")+"】在系统的重量有误,请在载具维护页面中维护托盘实际重量!"); throw new BadRequestException("托盘【"+whereJson.getString("vehicle_code")+"】在系统的重量有误,请在载具维护页面中维护托盘实际重量!");
} }
String pcsn = vehicle_ext.getString("pcsn");
if (ObjectUtil.isNotEmpty(pcsn)){
throw new BadRequestException("托盘【"+whereJson.getString("vehicle_code")+"】已经绑定了木箱【"+pcsn+"】,请进行核实!");
}
} }
//查询仓库是否存在相同木箱 //查询仓库是否存在相同木箱