fix:分切上料排队

This commit is contained in:
zhouz
2025-08-18 09:52:22 +08:00
parent 661595c790
commit 304dfb9fc1
4 changed files with 78 additions and 32 deletions

View File

@@ -14,6 +14,7 @@ import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.LinkedHashMap;
@@ -26,7 +27,7 @@ import java.util.stream.Collectors;
@Slf4j
@Component
@RequiredArgsConstructor
public class AutoSendToZxq extends Prun{
public class AutoSendToZxq extends Prun {
private final String THIS_CLASS = AutoSendToZxq.class.getName();
@Resource
@@ -47,7 +48,7 @@ public class AutoSendToZxq extends Prun{
public void run() {
try {
this.sendDjqToZxq();
}catch (Exception ex){
} catch (Exception ex) {
log.error(ex.getMessage());
}
@@ -70,10 +71,11 @@ public class AutoSendToZxq extends Prun{
return;
}
//装箱区有空位,去待检区消费合格品子卷
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = packageinfoivtService.checkEndPointTask(
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = packageinfoivtService.selectEmpPoints(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code(""));
/* List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = packageinfoivtService.checkEndPointTask(
PackageInfoIvtEnum.POINT_STATUS.code("装箱区"),
PackageInfoIvtEnum.IVT_STATUS.code("空"),
PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货任务"), "", "");
PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货任务"), "", "");*/
if (ObjectUtils.isNotEmpty(bstIvtPackageinfoivtList)) {
Map<String, List<String>> ivtList = bstIvtPackageinfoivtList.stream()
.collect(Collectors.groupingBy(

View File

@@ -22,6 +22,7 @@ import org.nl.wms.ext.mes.service.LmsToMesService;
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
import org.nl.wms.pda.mps.service.FeedingService;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.tasks.CoolCutTask;
import org.nl.wms.sch.tasks.OutHotTask;
import org.nl.wms.st.inbill.service.CheckOutBillService;
@@ -289,15 +290,15 @@ public class FeedingServiceImpl implements FeedingService {
throw new BadRequestException("该点位上不存在母卷!");
}
if (!StrUtil.equals(cool_jo.getString("container_name"), container_name)) {
throw new BadRequestException("该点位:"+point_code+"不存在母卷:"+container_name);
throw new BadRequestException("该点位:" + point_code + "不存在母卷:" + container_name);
}
JSONObject result = new JSONObject();
result.put("message", "操作成功!");
//B1烘箱外边的冷却点
if (cool_jo.getString("product_area").equals("B1") && cool_jo.getString("point_type").equals("1")) {
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("full_point_code = '" + next_point_code + "' and product_area='"+cool_jo.getString("product_area")+"'").uniqueResult(0);
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("full_point_code = '" + next_point_code + "' and product_area='" + cool_jo.getString("product_area") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cut_jo)) {
cut_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + next_point_code + "' and product_area='"+cool_jo.getString("product_area")+"' and point_type in ('1','6')").uniqueResult(0);
cut_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + next_point_code + "' and product_area='" + cool_jo.getString("product_area") + "' and point_type in ('1','6')").uniqueResult(0);
}
if (ObjectUtil.isEmpty(cut_jo)) {
throw new BadRequestException("请扫描B1车间分切机满轴点位、分切缓存位满轴点位、生箔冷却缓存位满轴点位做为终点");
@@ -307,7 +308,7 @@ public class FeedingServiceImpl implements FeedingService {
if (StrUtil.equals("01", cut_jo.getString("empty_point_status"))) {
jo.put("point_code1", cool_jo.getString("full_point_code"));
jo.put("point_code2", cut_jo.getString("full_point_code"));
jo.put("material_code",cool_jo.getString("container_name"));
jo.put("material_code", cool_jo.getString("container_name"));
jo.put("product_area", cut_jo.getString("product_area"));
jo.put("task_type", "010302");
} else {
@@ -416,17 +417,17 @@ public class FeedingServiceImpl implements FeedingService {
//只找入箱点位
map.put("point_type", "5");
boolean status_flag = false;
JSONObject pointArr = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
if (ObjectUtil.isEmpty(pointArr)) {
map.put("point_location", cool_jo.getString("point_location").equals("0") ? "1" : "0");
pointArr = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
if (ObjectUtil.isEmpty(pointArr)) {
throw new BadRequestException("出烘箱对接位,被货物或任务占用,请检查处理或等待!!");
status_flag = true;
// throw new BadRequestException("出烘箱对接位,被货物或任务占用,请检查处理或等待!!");
}
}
task_jo.put("point_code2", pointArr.getString("point_code"));
// 2.找冷却区空货位
JSONObject cool_map = new JSONObject();
cool_map.put("flag", "2");
@@ -448,11 +449,15 @@ public class FeedingServiceImpl implements FeedingService {
task_jo.put("material_code", cool_jo.getString("container_name"));
task_jo.put("product_area", cool_jo.getString("product_area"));
task_jo.put("task_type", "010205");
OutHotTask outHotTask = new OutHotTask();
if (status_flag) {
task_jo.put("task_status", TaskStatusEnum.SURE_START.getCode());
}else {
task_jo.put("point_code2", pointArr.getString("point_code"));
}
OutHotTask outHotTask = SpringContextHolder.getBean(OutHotTask.class);
String task_id = outHotTask.createTask(task_jo);
}
}
else {
} else {
JSONObject jo = new JSONObject();
//查询该分切机对应的点位
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("full_point_code = '" + next_point_code + "'").uniqueResult(0);
@@ -594,12 +599,12 @@ public class FeedingServiceImpl implements FeedingService {
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("full_point_code = '" + point_code + "'").uniqueResult(0);
//B1支持从分切上料暂存架送回母卷
if(point_code.contains("B1_FQZC")){
if (point_code.contains("B1_FQZC")) {
cut_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + point_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cut_jo)) {
throw new BadRequestException("请输入或者扫码分切区域的满轴点位!");
}
}else{
} else {
if (ObjectUtil.isEmpty(cut_jo)) {
throw new BadRequestException("请输入或者扫码分切区域的满轴点位!");
}

View File

@@ -12,7 +12,9 @@ import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
import org.nl.wms.sch.AcsTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
@@ -168,6 +170,43 @@ public class CoolCutTask extends AbstractAcsTask {
jsonCoolIvt2.put("update_optname", currentUsername);
jsonCoolIvt2.put("update_time", DateUtil.now());
WQLObject.getWQLObject("st_ivt_coolpointivt").update(jsonCoolIvt2);
//判断是存在确定起点的该任务类型
JSONArray issue_arr = taskTab.query("task_type = '010205' AND task_status = '02' AND is_delete= '0'").getResultJSONArray(0);
JSONObject map = new JSONObject();
map.put("flag", "4");
map.put("reging_id", RegionTypeEnum.B1_HKZC.getId());
//只找入箱点位
map.put("point_type", "5");
JSONArray canuse_point = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().getResultJSONArray(0);
for (int i = 0; i < issue_arr.size(); i++) {
JSONObject issue_jo = issue_arr.getJSONObject(i);
JSONObject goal_point = WQLObject.getWQLObject("st_ivt_coolpointivt").query("point_code = '" + issue_jo.getString("point_code1") + "'").uniqueResult(0);
for (int j = 0; j < canuse_point.size(); j++) {
JSONObject canuse_point_jo = canuse_point.getJSONObject(j);
if (canuse_point_jo.getString("point_location").equals(goal_point.getString("point_location"))) {
issue_jo.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
issue_jo.put("point_code2", canuse_point_jo.getString("point_code"));
canuse_point.remove(canuse_point_jo);
taskTab.update(issue_jo);
break;
}
}
if (!issue_jo.getString("task_status").equals(TaskStatusEnum.START_AND_POINT.getCode())) {
for (int j = 0; j < canuse_point.size(); j++) {
JSONObject canuse_point_jo = canuse_point.getJSONObject(j);
if (!canuse_point_jo.getString("point_location").equals(goal_point.getString("point_location"))) {
issue_jo.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
issue_jo.put("point_code2", canuse_point_jo.getString("point_code"));
canuse_point.remove(canuse_point_jo);
taskTab.update(issue_jo);
break;
}
}
}
//下发任务
SpringContextHolder.getBean(OutHotTask.class).immediateNotifyAcs(null);
}
} else {
// 更新主表状态
JSONObject coolMst = ivtTab.query("task_id = '" + task_id + "'").uniqueResult(0);
@@ -367,10 +406,10 @@ public class CoolCutTask extends AbstractAcsTask {
JSONObject cut_jo2 = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("full_point_code = '" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cut_jo2)) {
//B1车间支持从分切上料暂存位送回母卷
if(point_code1.contains("B1_FQZC")){
if (point_code1.contains("B1_FQZC")) {
cut_jo2 = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cut_jo2)) {
throw new BadRequestException("任务点位异常st_ivt_coolpointivt表找不到满轴点位:"+point_code1);
throw new BadRequestException("任务点位异常st_ivt_coolpointivt表找不到满轴点位:" + point_code1);
}
container_name = cut_jo2.getString("container_name");
cut_jo2.put("full_point_status", "01");
@@ -381,7 +420,7 @@ public class CoolCutTask extends AbstractAcsTask {
cut_jo2.put("update_time", DateUtil.now());
WQLObject.getWQLObject("st_ivt_coolpointivt").update(cut_jo2);
}
}else{
} else {
container_name = cut_jo2.getString("container_name");
cut_jo2.put("full_point_status", "01");
cut_jo2.put("full_vehicle_code", "");
@@ -430,20 +469,20 @@ public class CoolCutTask extends AbstractAcsTask {
String point_code3 = form.getString("point_code3");
String point_code4 = form.getString("point_code4");
JSONObject task1 = isSingleTask(point_code1);
if ( ObjectUtil.isNotEmpty(task1)) {
throw new BadRequestException("点位:" + point_code1 + "存在未完成的任务:"+task1.getString("task_code"));
if (ObjectUtil.isNotEmpty(task1)) {
throw new BadRequestException("点位:" + point_code1 + "存在未完成的任务:" + task1.getString("task_code"));
}
JSONObject task2 = isSingleTask(point_code2);
if ( ObjectUtil.isNotEmpty(task2)) {
throw new BadRequestException("点位:" + point_code2 + "存在未完成的任务:"+task2.getString("task_code"));
if (ObjectUtil.isNotEmpty(task2)) {
throw new BadRequestException("点位:" + point_code2 + "存在未完成的任务:" + task2.getString("task_code"));
}
JSONObject task3 = isSingleTask(point_code3);
if ( ObjectUtil.isNotEmpty(task3)) {
throw new BadRequestException("点位:" + point_code3 +"存在未完成的任务:"+task3.getString("task_code"));
if (ObjectUtil.isNotEmpty(task3)) {
throw new BadRequestException("点位:" + point_code3 + "存在未完成的任务:" + task3.getString("task_code"));
}
JSONObject task4 = isSingleTask(point_code4);
if ( ObjectUtil.isNotEmpty(task4)) {
throw new BadRequestException("点位:" + point_code4 + "存在未完成的任务:"+task4.getString("task_code"));
if (ObjectUtil.isNotEmpty(task4)) {
throw new BadRequestException("点位:" + point_code4 + "存在未完成的任务:" + task4.getString("task_code"));
}
JSONObject json = new JSONObject();
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
@@ -503,13 +542,13 @@ public class CoolCutTask extends AbstractAcsTask {
JSONObject task3 = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code3 = '" + point_code + "' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
JSONObject task4 = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code4 = '" + point_code + "' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
if(ObjectUtil.isNotEmpty(task1)){
if (ObjectUtil.isNotEmpty(task1)) {
return task1;
}else if(ObjectUtil.isNotEmpty(task2)){
} else if (ObjectUtil.isNotEmpty(task2)) {
return task2;
}else if(ObjectUtil.isNotEmpty(task3)){
} else if (ObjectUtil.isNotEmpty(task3)) {
return task3;
}else if(ObjectUtil.isNotEmpty(task4)){
} else if (ObjectUtil.isNotEmpty(task4)) {
return task4;
}

View File

@@ -151,7 +151,7 @@ public class OutHotTask extends AbstractAcsTask {
jo.put("product_area", cut_jo.getString("product_area"));
jo.put("task_type", "010301");
}
AbstractAcsTask task = new CoolCutTask();
CoolCutTask task = SpringContextHolder.getBean(CoolCutTask.class);
task.createTask(jo);
} else {
JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);