fix:去除桁架任务卡控了逻辑、新增空木箱出库改为系统参数配置卡控
This commit is contained in:
@@ -180,11 +180,11 @@ public class TwoOutBoxTask extends AbstractAcsTask {
|
||||
}
|
||||
}
|
||||
|
||||
RedissonUtils.lock(c->{
|
||||
/*RedissonUtils.lock(c->{
|
||||
if (status.equals(TaskStatusEnum.FINISHED.getCode())) {
|
||||
immediateNotifyAcs(null);
|
||||
}
|
||||
},"zjInBound",20,25,this);
|
||||
},"zjInBound",20,25,this);*/
|
||||
}
|
||||
// 取消
|
||||
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||
|
||||
@@ -11,13 +11,15 @@ import org.nl.b_lms.sch.tasks.TwoOutBoxTask;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.OutBoxManageService;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.sch.AcsTaskDto;
|
||||
import org.nl.wms.sch.AcsUtil;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.*;
|
||||
|
||||
import static org.nl.wms.util.TaskUtil.getRoutePlanCode;
|
||||
|
||||
@@ -47,20 +49,74 @@ public class AutoIssueOutEmptyTask {
|
||||
* 下发给ACS时需要特殊处理
|
||||
*/
|
||||
// 判断当前有多少个正在执行中的任务
|
||||
int num = WQLObject.getWQLObject("SCH_BASE_Task").query("handle_class = '" + TASK_CLASS + "' and task_status IN ('05','06') and is_delete ='0'")
|
||||
.getResultJSONArray(0).size();
|
||||
JSONArray task_ing = WQLObject.getWQLObject("SCH_BASE_Task").query("handle_class = '" + TASK_CLASS + "' and task_status IN ('05','06') and is_delete ='0'")
|
||||
.getResultJSONArray(0);
|
||||
int num = task_ing.size();
|
||||
int empty_num = Integer.parseInt(SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("empty_num").getValue());
|
||||
// 如果缓存了4个箱子则不下发任务
|
||||
if (num >= 2) {
|
||||
if (num >= empty_num) {
|
||||
return;
|
||||
}
|
||||
|
||||
//判断当前目的点位上是否存在木箱
|
||||
JSONArray packageinfoivt = WQLObject.getWQLObject("bst_ivt_packageinfoivt").query("point_status = '5' AND ivt_status = '1'").getResultJSONArray(0);
|
||||
|
||||
HashMap<String,Integer> pointNum = new HashMap<>();
|
||||
pointNum.put("ZXQ_1_1",0);
|
||||
pointNum.put("ZXQ_2_1",0);
|
||||
for (int i = 0; i < task_ing.size(); i++) {
|
||||
JSONObject task = task_ing.getJSONObject(i);
|
||||
String pointCode2 = task.getString("point_code2");
|
||||
if (pointNum.containsKey(pointCode2)){
|
||||
int currentCount = pointNum.get(pointCode2);
|
||||
pointNum.put(pointCode2, currentCount + 1);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < packageinfoivt.size(); i++) {
|
||||
JSONObject pack = packageinfoivt.getJSONObject(i);
|
||||
String pointCode = pack.getString("point_code");
|
||||
if (pointNum.containsKey(pointCode)){
|
||||
int currentCount = pointNum.get(pointCode);
|
||||
pointNum.put(pointCode, currentCount + 1);
|
||||
}
|
||||
}
|
||||
|
||||
JSONArray arr = WQLObject.getWQLObject("SCH_BASE_Task").query("handle_class = '" + TASK_CLASS + "' and task_status = '" + TaskStatusEnum.START_AND_POINT.getCode() + "' and is_delete ='0' order by create_time").getResultJSONArray(0);
|
||||
|
||||
// 3. 将JSONArray转为List<JSONObject>(方便自定义排序)
|
||||
List<JSONObject> taskList = new ArrayList<>();
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
taskList.add(arr.getJSONObject(i));
|
||||
}
|
||||
|
||||
// 4. 按pointNum中装箱对接位的数量升序排序(数量少的排前面)
|
||||
Collections.sort(taskList, new Comparator<JSONObject>() {
|
||||
@Override
|
||||
public int compare(JSONObject taskA, JSONObject taskB) {
|
||||
// 获取两个任务的目的点
|
||||
String pointA = taskA.getString("point_code2");
|
||||
String pointB = taskB.getString("point_code2");
|
||||
|
||||
// 空值/未统计点位处理:默认给一个大数(排到最后)
|
||||
int countA = pointNum.getOrDefault(pointA, Integer.MAX_VALUE);
|
||||
int countB = pointNum.getOrDefault(pointB, Integer.MAX_VALUE);
|
||||
|
||||
// 升序排序:countA - countB → 数量少的排前面
|
||||
return Integer.compare(countA, countB);
|
||||
}
|
||||
});
|
||||
|
||||
// 5. 将排序后的List转回JSONArray(供后续下发使用)
|
||||
JSONArray sortedArr = new JSONArray();
|
||||
sortedArr.addAll(taskList);
|
||||
|
||||
for (int i = 0; i < sortedArr.size(); i++) {
|
||||
if (num >= 2) {
|
||||
break;
|
||||
}
|
||||
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
JSONObject json = sortedArr.getJSONObject(i);
|
||||
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
|
||||
JSONObject attr = attrTab.query("struct_code = '" + json.getString("point_code1") + "'").uniqueResult(0);
|
||||
|
||||
@@ -111,7 +167,7 @@ public class AutoIssueOutEmptyTask {
|
||||
resultList.add(dto);
|
||||
JSONArray list = JSONArray.parseArray(JSON.toJSONString(resultList));
|
||||
AcsUtil.notifyAcs("api/wms/task", list);
|
||||
num += 1;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -159,7 +159,8 @@ public class AutoSendVehicleToKzj extends Prun{
|
||||
Set<String> task_block = new HashSet<>();
|
||||
if (isCalling.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||
//存在正在执行的行架任务
|
||||
List<SchBaseTask> taskList = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
//不需要进行卡控桁架是否正在执行任务
|
||||
/*List<SchBaseTask> taskList = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
|
||||
.eq(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code("否"))
|
||||
.eq(SchBaseTask::getTask_type, "010909"));
|
||||
@@ -168,7 +169,7 @@ public class AutoSendVehicleToKzj extends Prun{
|
||||
BstIvtPackageinfoivt one = packageinfoivtService.getOne(new LambdaQueryWrapper<BstIvtPackageinfoivt>()
|
||||
.eq(BstIvtPackageinfoivt::getPoint_code, point_code));
|
||||
task_block.add(one.getBlock());
|
||||
});
|
||||
});*/
|
||||
/*if (ObjectUtils.isNotEmpty(taskList)) {
|
||||
log.warn("当前装箱区存在执行的行架任务"+taskList.stream().map(SchBaseTask::getTask_code).collect(Collectors.joining(",")));
|
||||
return;
|
||||
@@ -177,9 +178,10 @@ public class AutoSendVehicleToKzj extends Prun{
|
||||
//存在装箱区有空载具的点位
|
||||
List<BstIvtPackageinfoivt> zxqVehicleList = packageinfoivtService
|
||||
.selectEmpPoints(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("空载具"));
|
||||
if (ObjectUtils.isNotEmpty(task_block)){
|
||||
//不需要进行卡控桁架是否正在执行任务
|
||||
/*if (ObjectUtils.isNotEmpty(task_block)){
|
||||
zxqVehicleList = zxqVehicleList.stream().filter(zxq -> !task_block.contains(zxq.getBlock())).collect(Collectors.toList());
|
||||
}
|
||||
}*/
|
||||
List<BstIvtPackageinfoivt> djqEmpList = packageinfoivtService
|
||||
.selectEmpPoints(PackageInfoIvtEnum.POINT_STATUS.code("待检区"), PackageInfoIvtEnum.IVT_STATUS.code("空"));
|
||||
if (CollectionUtils.isEmpty(zxqVehicleList) || CollectionUtils.isEmpty(djqEmpList)) {
|
||||
|
||||
Reference in New Issue
Block a user