fix:查询木箱高度报错

This commit is contained in:
zhangzq
2025-01-12 18:11:09 +08:00
parent 4f85f5bb00
commit baf1dc6cb1
27 changed files with 105 additions and 74 deletions

View File

@@ -149,7 +149,7 @@ public class PdmBiSubpackagerelationController {
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }
@@ -182,7 +182,7 @@ public class PdmBiSubpackagerelationController {
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -152,7 +152,7 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
result.put("message", "二次分配点位正在分配中,已锁住!"); result.put("message", "二次分配点位正在分配中,已锁住!");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }
@@ -1064,6 +1064,12 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
// "ZXQ_135" : "ZXQ_136"; // "ZXQ_135" : "ZXQ_136";
JSONObject task = new JSONObject(); JSONObject task = new JSONObject();
task.put("point_code1", of.get(pointCode)); task.put("point_code1", of.get(pointCode));
int count = taskService.count(new QueryWrapper<SchBaseTask>()
.eq("is_delete", "0")
.lt("task_status", TaskStatusEnum.FINISHED.getCode()));
if (count>0){
throw new BadRequestException("当前人工管制点已经存在任务,请勿重复下发");
}
autoSendVehicleToDjq.getPointCode(task,PackageInfoIvtEnum.TASK_TYPE.code("补空(装箱区->待检区)")); autoSendVehicleToDjq.getPointCode(task,PackageInfoIvtEnum.TASK_TYPE.code("补空(装箱区->待检区)"));
dtoList = bstIvtPackageinfoivtMapper.selectList(new LambdaQueryWrapper<BstIvtPackageinfoivt>().eq(BstIvtPackageinfoivt::getPoint_code, whereJson.getString("pointCode").equals("1") ? "ZXQ_135" : "ZXQ_136")); dtoList = bstIvtPackageinfoivtMapper.selectList(new LambdaQueryWrapper<BstIvtPackageinfoivt>().eq(BstIvtPackageinfoivt::getPoint_code, whereJson.getString("pointCode").equals("1") ? "ZXQ_135" : "ZXQ_136"));

View File

@@ -103,7 +103,7 @@ public class AutoExecuteShiftingTask {
log.info("执行不满足条件的移库任务正在创建被锁住。"); log.info("执行不满足条件的移库任务正在创建被锁住。");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -138,7 +138,7 @@ public class AutoExecuteWaitTask extends Prun{
log.info("放满与取空桁架任务正在创建被锁住。"); log.info("放满与取空桁架任务正在创建被锁住。");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -93,7 +93,7 @@ public class AutoSendDjqToGzq extends Prun{
log.info("待检区->管制区任务正在创建被锁住。"); log.info("待检区->管制区任务正在创建被锁住。");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -114,7 +114,7 @@ public class AutoSendGzqToDjq extends Prun{
log.info("管制区->待检区任务正在创建被锁住。"); log.info("管制区->待检区任务正在创建被锁住。");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -150,7 +150,7 @@ public class AutoSendMzToDjq {
log.info("满轴->待检区agv自动搬运任务正在创建被锁住。"); log.info("满轴->待检区agv自动搬运任务正在创建被锁住。");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -87,7 +87,7 @@ public class AutoSendToZxq extends Prun{
log.info("满轴->待检区agv自动搬运任务正在创建被锁住。"); log.info("满轴->待检区agv自动搬运任务正在创建被锁住。");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -103,7 +103,7 @@ public class AutoSendVehicleToDjq extends Prun{
log.info("装箱区->待检区或管制区补空载具任务正在创建被锁住。"); log.info("装箱区->待检区或管制区补空载具任务正在创建被锁住。");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -108,7 +108,7 @@ public class AutoSendVehicleToKzj {
log.info("待检区或管制区->空载具缓存位补空任务正在创建被锁住。"); log.info("待检区或管制区->空载具缓存位补空任务正在创建被锁住。");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -1073,7 +1073,7 @@ public class SlitterServiceImpl implements SlitterService {
throw new BadRequestException("系统繁忙,稍后在试!!"); throw new BadRequestException("系统繁忙,稍后在试!!");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }
@@ -1603,7 +1603,7 @@ public class SlitterServiceImpl implements SlitterService {
throw new BadRequestException("系统繁忙,稍后在试!"); throw new BadRequestException("系统繁忙,稍后在试!");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -429,7 +429,7 @@ public class StIvtIostorinvServiceImpl extends ServiceImpl<StIvtIostorinvMapper,
throw new BadRequestException("有入库单据正在分配中,请稍后在试"); throw new BadRequestException("有入库单据正在分配中,请稍后在试");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.b_lms.sch.point.dao.SchBasePoint; import org.nl.b_lms.sch.point.dao.SchBasePoint;
import org.nl.b_lms.sch.point.service.IschBasePointService; import org.nl.b_lms.sch.point.service.IschBasePointService;
import org.nl.b_lms.sch.task.dao.SchBaseTask; import org.nl.b_lms.sch.task.dao.SchBaseTask;
@@ -38,10 +39,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -54,6 +52,7 @@ import java.util.stream.Collectors;
*/ */
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j
public class InBoxManageServiceImpl implements InBoxManageService { public class InBoxManageServiceImpl implements InBoxManageService {
/** /**
@@ -96,24 +95,27 @@ public class InBoxManageServiceImpl implements InBoxManageService {
* 1.找木箱区的一个仓位 * 1.找木箱区的一个仓位
* 2.插入木箱对象载具表 * 2.插入木箱对象载具表
*/ */
// 点位表
WQLObject schBasePointService = WQLObject.getWQLObject("sch_base_point");
// 仓位表 // 仓位表
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr"); WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
String box_arr = whereJson.getString("box_no"); String boxNo = whereJson.getString("box_no");
int count = ischBaseTaskService.count(new QueryWrapper<SchBaseTask>() int count = ischBaseTaskService.count(new QueryWrapper<SchBaseTask>()
.eq("point_code1", whereJson.getString("device_code")) .eq("point_code1", whereJson.getString("device_code"))
.eq("vehicle_code", whereJson.getString("box_no")) .eq("vehicle_code", boxNo)
.eq("task_type", "010702") .eq("task_type", "010702")
.eq("is_delete", "0") .eq("is_delete", "0")
.lt("task_status", TaskStatusEnum.FINISHED.getCode())); .lt("task_status", TaskStatusEnum.FINISHED.getCode()));
if (count>0){ if (count>0){
return; throw new BadRequestException("当前木箱入库任务已存在"+ boxNo);
}
//查询仓库是否存在相同木箱
JSONArray stIvtStructattr = WQLObject.getWQLObject("st_ivt_structattr").query("storagevehicle_code = '" + boxNo + "'").getResultJSONArray(0);
if (stIvtStructattr!=null && stIvtStructattr.size()>0){
throw new BadRequestException("当前木箱已经存在库中"+stIvtStructattr.getJSONObject(0).getString("struct_code"));
} }
// 查询木箱信息 // 查询木箱信息
BstIvtBoxinfo boxDao = iBstIvtBoxinfoService.getOne( BstIvtBoxinfo boxDao = iBstIvtBoxinfoService.getOne(
new QueryWrapper<BstIvtBoxinfo>().lambda() new QueryWrapper<BstIvtBoxinfo>().lambda()
.eq(BstIvtBoxinfo::getBox_no, whereJson.getString("box_no")) .eq(BstIvtBoxinfo::getBox_no, boxNo)
); );
/* /*
* 找一个木箱区的一个仓位,生成任务并下发 * 找一个木箱区的一个仓位,生成任务并下发
@@ -166,7 +168,7 @@ public class InBoxManageServiceImpl implements InBoxManageService {
jsonTaskParam.put("task_type", "010702"); jsonTaskParam.put("task_type", "010702");
jsonTaskParam.put("start_device_code", whereJson.getString("device_code")); jsonTaskParam.put("start_device_code", whereJson.getString("device_code"));
jsonTaskParam.put("next_device_code", jsonAttr.getString("struct_code")); jsonTaskParam.put("next_device_code", jsonAttr.getString("struct_code"));
jsonTaskParam.put("vehicle_code", whereJson.getString("box_no")); jsonTaskParam.put("vehicle_code", boxNo);
jsonTaskParam.put("vehicle_code2", whereJson.getString("vehicle_code")); jsonTaskParam.put("vehicle_code2", whereJson.getString("vehicle_code"));
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("containerType", boxDao.getVehicle_type()); param.put("containerType", boxDao.getVehicle_type());
@@ -198,7 +200,13 @@ public class InBoxManageServiceImpl implements InBoxManageService {
if (layer != split.length) { if (layer != split.length) {
throw new BadRequestException("扫描的木箱个数和选择的木箱层数不一致!"); throw new BadRequestException("扫描的木箱个数和选择的木箱层数不一致!");
} }
Set<String> collect = Arrays.stream(split).collect(Collectors.toSet());
if (collect.size()!=split.length){
throw new BadRequestException("扫描的木箱条码不能相同");
}
if (split.length>3){
throw new BadRequestException("堆叠木箱最大不能超过3层");
}
// 校验是否有相同木箱号 // 校验是否有相同木箱号
List<String> strings = Arrays.asList(split); List<String> strings = Arrays.asList(split);
int size = (int) strings.stream() int size = (int) strings.stream()
@@ -207,6 +215,13 @@ public class InBoxManageServiceImpl implements InBoxManageService {
if (size != split.length) { if (size != split.length) {
throw new BadRequestException("木箱号有相同,请重新扫码!"); throw new BadRequestException("木箱号有相同,请重新扫码!");
} }
//查询仓库是否存在相同木箱
for (String boxSn : split) {
JSONArray stIvtStructattr = WQLObject.getWQLObject("st_ivt_structattr").query("storagevehicle_code = '" + boxSn + "'").getResultJSONArray(0);
if (stIvtStructattr!=null && stIvtStructattr.size()>0){
throw new BadRequestException("当前木箱已经存在库中"+stIvtStructattr.getJSONObject(0).getString("struct_code"));
}
}
for (int i = 0; i < split.length; i++) { for (int i = 0; i < split.length; i++) {
String boxNO = split[i]; String boxNO = split[i];
@@ -234,9 +249,8 @@ public class InBoxManageServiceImpl implements InBoxManageService {
throw new BadRequestException("请扫码相同规格的木箱进行堆叠入库!"); throw new BadRequestException("请扫码相同规格的木箱进行堆叠入库!");
} }
} }
} }
//如果小木箱入库时没有小托盘时候是否考虑叫大托盘
// 查询木箱信息 // 查询木箱信息
BstIvtBoxinfo boxDao = iBstIvtBoxinfoService.getOne( BstIvtBoxinfo boxDao = iBstIvtBoxinfoService.getOne(
new QueryWrapper<BstIvtBoxinfo>().lambda() new QueryWrapper<BstIvtBoxinfo>().lambda()

View File

@@ -33,7 +33,7 @@ public class CodeUtil {
throw new BadRequestException("系统繁忙,稍后在试!"); throw new BadRequestException("系统繁忙,稍后在试!");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -17,7 +17,7 @@ import org.springframework.stereotype.Component;
import java.util.List; import java.util.List;
//@Component @Component
@RequiredArgsConstructor @RequiredArgsConstructor
@Order(100) @Order(100)
public class JobRunner implements ApplicationRunner { public class JobRunner implements ApplicationRunner {

View File

@@ -944,7 +944,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} }
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }
@@ -1917,7 +1917,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
result.put("message", "二楼到一楼成品子卷到达一楼输送线任务正在创建被锁住。"); result.put("message", "二楼到一楼成品子卷到达一楼输送线任务正在创建被锁住。");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }
@@ -2160,7 +2160,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return result; return result;
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }
@@ -2240,7 +2240,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return result; return result;
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }
@@ -2349,7 +2349,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return result; return result;
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }
@@ -2403,7 +2403,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
throw new BadRequestException("系统繁忙,请稍后再试!"); throw new BadRequestException("系统繁忙,请稍后再试!");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }
@@ -2427,7 +2427,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
throw new BadRequestException("系统繁忙,请稍后再试!"); throw new BadRequestException("系统繁忙,请稍后再试!");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }
@@ -2458,31 +2458,41 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return param; return param;
} }
public static void main(String[] args) {
String material_barcode = "123123-1";
String split = material_barcode.split("-")[0];
System.out.println(split);
}
@Override @Override
public JSONObject getBoxInfo(JSONObject param) { public JSONObject getBoxInfo(JSONObject param) {
String material_barcode = param.getString("material_barcode"); String material_barcode = param.getString("material_barcode");
String vehicle_code = param.getString("vehicle_code"); if (StringUtils.isEmpty(material_barcode)){
//干燥剂模板 throw new BadRequestException("material_barcode参数不能为空");
String desiccantTemplate = "6";
//是否开盖
String isUncap = "1";
JSONObject vehicle_info = WQLObject.getWQLObject("md_pb_storagevehicleext").query("storagevehicle_code = '" + material_barcode + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(vehicle_info)) {
vehicle_info = WQLObject.getWQLObject("md_pb_storagevehicleext").query("storagevehicle_code = '" + vehicle_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(vehicle_info)){
throw new BadRequestException("未查询到载具号【" + vehicle_code + "】对应的载具信息!");
}
} }
material_barcode = vehicle_info.getString("pcsn"); String isUncap = "1";
// 查询木箱信息 String boxOr子卷 = material_barcode.split("-")[0];
BstIvtBoxinfo boxDao = iBstIvtBoxinfoService.getOne( BstIvtBoxinfo boxNo;
new QueryWrapper<BstIvtBoxinfo>().lambda() String desiccantTemplate = null;
.eq(BstIvtBoxinfo::getBox_no, material_barcode) if (boxOr子卷.contains("MX")){
); BstIvtBoxinfo boxDao = iBstIvtBoxinfoService.getOne(
new QueryWrapper<BstIvtBoxinfo>().lambda()
//获取包装关系 .eq(BstIvtBoxinfo::getBox_no, boxOr子卷)
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + material_barcode + "'").uniqueResult(0); );
if (ObjectUtil.isNotEmpty(sub_jo)) { if (boxDao==null){
throw new BadRequestException("当前木箱码在木箱表不存在"+boxOr子卷);
}
boxNo=boxDao;
}else {
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation")
.query("container_name = '" + boxOr子卷 + "' order by create_time desc").uniqueResult(0);
if (sub_jo==null || StringUtils.isEmpty(sub_jo.getString("package_box_sn"))){
throw new BadRequestException("当前子卷不存在子卷包装关系"+boxOr子卷);
}
BstIvtBoxinfo boxDao = iBstIvtBoxinfoService.getOne(
new QueryWrapper<BstIvtBoxinfo>().lambda()
.eq(BstIvtBoxinfo::getBox_no, sub_jo.getString("package_box_sn"))
);
boxNo=boxDao;
String material_type = sub_jo.getString("material_type"); String material_type = sub_jo.getString("material_type");
if (material_type.equals("FG1")) { if (material_type.equals("FG1")) {
desiccantTemplate = "6"; desiccantTemplate = "6";
@@ -2491,11 +2501,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
desiccantTemplate = "4"; desiccantTemplate = "4";
} }
} }
//根据木箱高度,判断入库仓位的高度 //根据木箱高度,判断入库仓位的高度
String height = ""; String height = "";
String heightLevel1 = iSysParamService.findByCode("height_level_1").getValue(); String heightLevel1 = iSysParamService.findByCode("height_level_1").getValue();
String heightLevel2 = iSysParamService.findByCode("height_level_2").getValue(); String heightLevel2 = iSysParamService.findByCode("height_level_2").getValue();
String box_high = boxDao.getBox_high(); String box_high = boxNo.getBox_high();
if (Integer.parseInt(box_high) <= Integer.parseInt(heightLevel1)) { if (Integer.parseInt(box_high) <= Integer.parseInt(heightLevel1)) {
height = "1"; height = "1";
} else if (Integer.parseInt(box_high) > Integer.parseInt(heightLevel1) && Integer.parseInt(box_high) <= Integer.parseInt(heightLevel2)) { } else if (Integer.parseInt(box_high) > Integer.parseInt(heightLevel1) && Integer.parseInt(box_high) <= Integer.parseInt(heightLevel2)) {
@@ -2504,9 +2515,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
height = "3"; height = "3";
} }
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("boxLength", boxDao.getBox_length()); jsonObject.put("boxLength", boxNo.getBox_length());
jsonObject.put("boxWidth", boxDao.getBox_width()); jsonObject.put("boxWidth", boxNo.getBox_width());
jsonObject.put("boxHigh", boxDao.getBox_high()); jsonObject.put("boxHigh", boxNo.getBox_high());
jsonObject.put("desiccantTemplate", desiccantTemplate); jsonObject.put("desiccantTemplate", desiccantTemplate);
jsonObject.put("isUncap", isUncap); jsonObject.put("isUncap", isUncap);
jsonObject.put("heightLevel", height); jsonObject.put("heightLevel", height);

View File

@@ -492,7 +492,7 @@ public class ProductInstorServiceImpl implements ProductInstorService {
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -67,7 +67,7 @@ public class AutoCallEmptyVehicle {
} }
} }
}finally { }finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -46,7 +46,7 @@ public class AutoQueryBillInfo {
System.out.println("AutoQueryBillInfo" + DateUtil.now() + "被锁住!!!!"); System.out.println("AutoQueryBillInfo" + DateUtil.now() + "被锁住!!!!");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -93,7 +93,7 @@ public class AutoQueryStructattrNum {
iSysNoticeService.saveBatch(daoList); iSysNoticeService.saveBatch(daoList);
} }
}finally { }finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -123,7 +123,7 @@ public class AutoSaveIvtExcel {
System.out.println("AutoQueryBillInfo" + DateUtil.now() + "被锁住!!!!"); System.out.println("AutoQueryBillInfo" + DateUtil.now() + "被锁住!!!!");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -118,7 +118,7 @@ public class AutoSaveIvtExcelTwo {
System.out.println("AutoQueryBillInfo" + DateUtil.now() + "被锁住!!!!"); System.out.println("AutoQueryBillInfo" + DateUtil.now() + "被锁住!!!!");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -42,7 +42,7 @@ public class AutoSendFeiShu {
this.sendInfo(resend_rows); this.sendInfo(resend_rows);
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -169,7 +169,7 @@ public class AutoSendIvtExcel {
System.out.println("AutoQueryBillInfo" + DateUtil.now() + "被锁住!!!!"); System.out.println("AutoQueryBillInfo" + DateUtil.now() + "被锁住!!!!");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -91,7 +91,7 @@ public class AutoSendSalesIvt {
System.out.println("AutoSendSalesIvt" + DateUtil.now() + "被锁住!!!!"); System.out.println("AutoSendSalesIvt" + DateUtil.now() + "被锁住!!!!");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -122,7 +122,7 @@ public class TaskServiceImpl implements TaskService {
public void operation(Map<String, Object> map) { public void operation(Map<String, Object> map) {
String task_id = MapUtil.getStr(map, "task_id"); String task_id = MapUtil.getStr(map, "task_id");
RLock lock = redissonClient.getLock(task_id); RLock lock = redissonClient.getLock(task_id);
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS); boolean tryLock = lock.tryLock(0,20, TimeUnit.SECONDS);
try { try {
if (tryLock) { if (tryLock) {
String method_name = MapUtil.getStr(map, "method_name"); String method_name = MapUtil.getStr(map, "method_name");
@@ -188,7 +188,7 @@ public class TaskServiceImpl implements TaskService {
throw new BadRequestException("任务标识为:" + task_id + "的任务正在操作中!"); throw new BadRequestException("任务标识为:" + task_id + "的任务正在操作中!");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }

View File

@@ -782,7 +782,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
throw new BadRequestException("其他入库单当前正在分配货位,请等待几秒再进行操作!"); throw new BadRequestException("其他入库单当前正在分配货位,请等待几秒再进行操作!");
} }
} finally { } finally {
if (tryLock) { if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }