add:增加单据锁及一件设置并发锁

This commit is contained in:
zhangzq
2025-06-30 21:53:56 +08:00
parent 67d5dca6fd
commit 2ff9549ce5
6 changed files with 36 additions and 11 deletions

View File

@@ -179,7 +179,7 @@ public class TwoOutBoxTask extends AbstractAcsTask {
if (status.equals(TaskStatusEnum.FINISHED.getCode())) {
immediateNotifyAcs(null);
}
},"zjInBound",20,this);
},"zjInBound",20,25,this);
}
// 取消
if (status.equals(IOSEnum.IS_NOTANDYES.code(""))) {

View File

@@ -217,7 +217,7 @@ public class TwoOutTask extends AbstractAcsTask {
}
}
}
}, "cratergv", 30, this);
}, "cratergv", 30,35, this);
}
}

View File

@@ -19,7 +19,7 @@ public class AutoRgvSendTask extends Prun {
RedissonUtils.lock(c -> {
log.info("start_sendTaskAcs task......");
twoOutHeapTask.sendTaskAcs(null,true);
},"resendrgv", 30, this);
},"resendrgv", 30,35, this);
}catch (Exception ex){
log.error(ex.getMessage());
}

View File

@@ -51,11 +51,11 @@ public class RedissonUtils {
* @param param
*/
@SneakyThrows
public static void lock(Consumer process, String key, int secend, Object param){
public static void lock(Consumer process, String key, int wait,int least, Object param){
RedissonClient redissonClient = SpringContextHolder.getBean(RedissonClient.class);
RLock lock = redissonClient.getLock(key);
boolean isLock;
isLock = lock.tryLock(secend,secend+5,TimeUnit.SECONDS);
isLock = lock.tryLock(wait,least,TimeUnit.SECONDS);
try {
if (isLock){
process.accept(param);

View File

@@ -11,6 +11,7 @@ import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.impl.*;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.InBussManageService;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.LashManageService;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.OutBoxManageService;
import org.nl.common.utils.RedissonUtils;
import org.nl.modules.logging.annotation.Log;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.st.inbill.service.CheckOutBillService;
@@ -210,11 +211,13 @@ public class CheckOutBillController {
@Log("一键设置")
public ResponseEntity<Object> allSetPoint(@RequestBody JSONObject whereJson) {
if (whereJson.getString("stor_id").equals(IOSEnum.STOR_ID.code("二期"))) {
iStIvtIostorinvOutService.allSetPoint2(whereJson);
} else {
checkOutBillService.allSetPointByNoTran(whereJson);
}
RedissonUtils.lock(c->{
if (whereJson.getString("stor_id").equals(IOSEnum.STOR_ID.code("二期"))) {
iStIvtIostorinvOutService.allSetPoint2(whereJson);
} else {
checkOutBillService.allSetPointByNoTran(whereJson);
}
},"出库一键设置",1,120,null);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}

View File

@@ -3254,6 +3254,16 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
//口口回口回口口口1
//口口回回口口口口2
Map<String, List<StructAllsetDto>> collect = structSet.stream().distinct().collect(Collectors.groupingBy(struct -> struct.getRow_num()+"_"+struct.getBlock_num()));
//批量校验单据锁定
for (String orderBy : collect.keySet()) {
List<StructAllsetDto> needStructs = collect.get(orderBy);
//从左到右排序
needStructs.sort(Comparator.comparingInt(a -> Integer.valueOf(a.getOut_order_seq())));
StructAllsetDto left = needStructs.get(0);
StructAllsetDto right = needStructs.get(needStructs.size() - 1);
//确认左/右出库并根据出库顺序获取货位集合
锁单判断(needStructs, left, right, whereJson.getString("iostorinv_id"));
}
for (String orderBy : collect.keySet()) {
List<StructAllsetDto> needStructs = collect.get(orderBy);
//从左到右排序
@@ -3297,6 +3307,17 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
}
};
}
private void 锁单判断(List<StructAllsetDto> structs, StructAllsetDto left, StructAllsetDto right,String invId) {
HashMap param = MapOf.of("invId",invId,"flag", "51", "sect_id",left.getSect_id(),"block_num", left.getBlock_num(), "row_num", left.getRow_num());
JSONArray allLock = WQL.getWO("ST_OUTIVT04").addParamMap(param).process().getResultJSONArray(0);
List<JSONObject> hasLock = this.isNumList(allLock);
if (!ObjectUtil.isEmpty(hasLock)){
String error = hasLock.stream()
.map(a -> "仓位" + a.getString("struct_code") + "锁定单据" + a.getString("inv_code"))
.collect(Collectors.joining(","));
throw new BadRequestException(error + "被锁定且未下发任务,无法生成任务!");
}
};
private List<JSONObject> 左右出库确认(List<StructAllsetDto> structs, StructAllsetDto left, StructAllsetDto right,String invId) {
/**
@@ -3365,6 +3386,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
if (StringUtils.equals(placementType,"01")){
//确认那边少出哪边-
//查询当前排最大order
//口回口口回口*口口
HashMap maxParam = MapOf.of("flag", "52", "sect_id",left.getSect_id(),"block_num", left.getBlock_num(), "row_num", left.getRow_num());
JSONObject result = WQL.getWO("ST_OUTIVT04").addParamMap(maxParam).process().uniqueResult(0);
Integer maxSeq = result.getInteger("maxseq");
@@ -3377,7 +3399,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
}
}
//option确认了左边出库还是右边出库03右边02左边
String orderBy = "order by out_order_seq "+(option.equals("02")?"asc":"desc");
String orderBy = "order by out_order_seq "+(option.equals("03")?"asc":"desc");
HashMap structParam = MapOf.of("flag", "53", "order_by",orderBy,"sect_id",left.getSect_id(),"block_num", left.getBlock_num(), "row_num", left.getRow_num());
return WQL.getWO("ST_OUTIVT04").addParamMap(structParam).process().getResultJSONArray(0).toJavaList(JSONObject.class);
}