fix:B1母卷上料优化

This commit is contained in:
zhouz
2024-07-13 23:48:21 +08:00
parent 2e67662a87
commit 67d1f7a5e4
9 changed files with 302 additions and 157 deletions

View File

@@ -118,7 +118,7 @@ public class BakingServiceImpl implements BakingService {
*/
JSONObject jsonPointZc = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
JSONObject cool_jo = coolIvtTab.query("full_point_code = '" + point_code1 + "' AND point_type = '3'").uniqueResult(0);
JSONObject cool_jo = coolIvtTab.query("point_code = '" + point_code1 + "' AND point_type = '3'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonPointZc) || ObjectUtil.isNotEmpty(cool_jo)) {
if (ObjectUtil.isEmpty(jsonPointZc)) {
jsonPointZc = cool_jo;
@@ -149,9 +149,29 @@ public class BakingServiceImpl implements BakingService {
}
}
if (ObjectUtil.isEmpty(jsonHotIvt)) {
//如果属于B1的烘箱变更位置再查询
if (ObjectUtil.isNotEmpty(cool_jo) && cool_jo.getString("product_area").equals("B1")) {
jsonMap.put("point_location", jsonPointZc.getString("point_location").equals("0") ? "1" : "0");
hot_rows = WQL.getWO("PDA_BAKING_01").addParamMap(jsonMap).process().getResultJSONArray(0);
for (int i = 0; i < hot_rows.size(); i++) {
JSONObject hot_row = hot_rows.getJSONObject(i);
String point_code = hot_row.getString("point_code");
String point_temperature = (String) redisUtils.hget(point_code, "temperature");
if (!ObjectUtil.isEmpty(point_temperature)) {
if (point_temperature.equals(temperature)) {
jsonHotIvt = hot_row;
break;
}
}
}
if (ObjectUtil.isEmpty(jsonHotIvt)) {
throw new BadRequestException("烘烤区没有合适温度的空位!");
}
} else {
throw new BadRequestException("烘烤区没有合适温度的空位!");
}
}
// 2.创建暂存位 --> 烘烤区任务
JSONObject param = new JSONObject();
param.put("type", "2"); // 1- 冷却区入烘箱 2- 暂存位入烘箱

View File

@@ -233,7 +233,7 @@ public class FeedingServiceImpl implements FeedingService {
JSONObject cool_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + point_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cool_jo)) {
cool_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + point_code + "'").uniqueResult(0);
cool_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("point_code = '" + point_code + "'").uniqueResult(0);
}
if (ObjectUtil.isEmpty(cool_jo)) {
@@ -269,7 +269,7 @@ public class FeedingServiceImpl implements FeedingService {
JSONObject cool_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + point_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cool_jo)) {
cool_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + point_code + "'").uniqueResult(0);
cool_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("point_code = '" + point_code + "'").uniqueResult(0);
}
if (ObjectUtil.isEmpty(cool_jo)) {
throw new BadRequestException("请输入或者扫描冷却区满轴位的点位做为起点!");
@@ -287,7 +287,47 @@ public class FeedingServiceImpl implements FeedingService {
}
if (cool_jo.getString("product_area").equals("B1")) {
if (ObjectUtil.isNotEmpty(cool_jo) && cool_jo.getString("point_type").equals("4")) {
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("full_point_code = '" + next_point_code + "'").uniqueResult(0);
//起点为分切缓存位,终点为分切机
JSONObject jo = new JSONObject();
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("product_area", cut_jo.getString("product_area"));
jo.put("task_type", "010302");
} else {
jo.put("point_code1", cool_jo.getString("full_point_code"));
jo.put("point_code2", cut_jo.getString("full_point_code"));
jo.put("point_code3", cut_jo.getString("empty_point_code"));
// 2.找冷却区空货位
JSONObject map = new JSONObject();
map.put("flag", "2");
map.put("product_area", cut_jo.getString("product_area"));
map.put("point_location", "0");
JSONObject jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
// 如果为空
if (ObjectUtil.isEmpty(jsonCooIvt)) {
map.put("point_location", "1");
jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
}
if (ObjectUtil.isEmpty(jsonCooIvt)) {
throw new BadRequestException("冷却区空位不足");
}
jo.put("point_code4", jsonCooIvt.getString("empty_point_code"));
jo.put("material_code", cool_jo.getString("container_name"));
jo.put("product_area", cut_jo.getString("product_area"));
jo.put("task_type", "010301");
}
AbstractAcsTask task = new CoolCutTask();
task.createTask(jo);
} else {
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("full_point_code = '" + next_point_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cut_jo) && ObjectUtil.isEmpty(cool_jo)) {
throw new BadRequestException("目的点不存在!");
}
JSONObject task_jo = new JSONObject();
task_jo.put("point_code1", cool_jo.getString("point_code"));
String reging_id = "";
@@ -322,19 +362,24 @@ public class FeedingServiceImpl implements FeedingService {
map.put("point_type", "5");
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("没有无货且没有任务的点位类型为出箱的烘箱对接位!");
}
}
task_jo.put("point_code2", pointArr.getString("point_code"));
//将分切机的点位作为目的点桁架任务完成时自动创建AGV任务
task_jo.put("point_code3", next_point_code);
task_jo.put("vehicle_code", cool_jo.getString("container_name"));
task_jo.put("product_area", cut_jo.getString("product_area"));
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();
String task_id = outHotTask.createTask(task_jo);
}
} else {
JSONObject jo = new JSONObject();
//查询该分切机对应的点位

View File

@@ -215,8 +215,13 @@ public class RawFoilServiceImpl implements RawFoilService {
cache_map.put("point_location", jsonSb.getString("point_location"));
//只找入箱点位
cache_map.put("point_type", "4");
cache_map.put("mater_flag", "1");
JSONObject point_code2_jo = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(cache_map).process().uniqueResult(0);
if (ObjectUtil.isEmpty(point_code2_jo)) {
cache_map.put("point_location", jsonSb.getString("point_location").equals("0") ? "1" : "0");
point_code2_jo = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(cache_map).process().uniqueResult(0);
}
if (ObjectUtil.isEmpty(point_code2_jo)) {
throw new BadRequestException("未查询到可用的点位类型为入箱的烘箱对接位!");
}

View File

@@ -82,6 +82,9 @@
OPTION 输入.point_type = "5"
IFNULL(po.material_code,'') = ''
ENDOPTION
OPTION 输入.mater_flag = "1"
IFNULL(po.material_code,'') = ''
ENDOPTION
UNION
SELECT
task.task_id,
@@ -137,6 +140,9 @@
OPTION 输入.point_type = "5"
IFNULL(po.material_code,'') = ''
ENDOPTION
OPTION 输入.mater_flag = "1"
IFNULL(po.material_code,'') = ''
ENDOPTION
) c
GROUP BY
c.point_code

View File

@@ -129,7 +129,7 @@
FROM
sch_base_task
WHERE
( point_code1 = empty_point_code OR point_code2 = empty_point_code )
( point_code1 = empty_point_code OR point_code2 = empty_point_code OR point_code2 = point_code )
AND task_status < '07'
AND is_delete = '0'
)

View File

@@ -114,17 +114,50 @@ public class CoolCutTask extends AbstractAcsTask {
if ("B1".equals(product_area)) {
//更新起点烘箱对接位
JSONObject dj_jo = WQLObject.getWQLObject("sch_base_point").query("point_code ='" + point_code1 + "'").uniqueResult(0);
JSONObject cool_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code ='" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(dj_jo)) {
dj_jo.put("point_status", "1");
dj_jo.put("material_code", "");
WQLObject.getWQLObject("sch_base_point").update(dj_jo);
}
if (ObjectUtil.isNotEmpty(cool_jo)) {
cool_jo.put("full_point_status", "01");
cool_jo.put("container_name", "");
cool_jo.put("workorder_id", "");
cool_jo.put("update_optid", currentUserId);
cool_jo.put("update_optname", currentUsername);
cool_jo.put("update_time", DateUtil.now());
WQLObject.getWQLObject("st_ivt_coolpointivt").update(cool_jo);
}
JSONObject full_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code ='" + point_code2 + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(full_jo)) {
full_jo.put("full_point_status", "02");
full_jo.put("container_name", jsonTask.getString("material_code"));
full_jo.put("update_optid", currentUserId);
full_jo.put("update_optname", currentUsername);
full_jo.put("update_time", DateUtil.now());
WQLObject.getWQLObject("st_ivt_coolpointivt").update(full_jo);
}
//更新满轴终点的空轴对接位
JSONObject cut_jo = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("empty_point_code = '" + point_code3 + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cut_jo)) {
cut_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("empty_point_code = '" + point_code3 + "'").uniqueResult(0);
cut_jo.put("empty_point_status", "01");
cut_jo.put("empty_vehicle_code", "");
cut_jo.put("update_optid", currentUserId);
cut_jo.put("update_optname", currentUsername);
cut_jo.put("update_time", DateUtil.now());
WQLObject.getWQLObject("st_ivt_coolpointivt").update(cut_jo);
} else {
cut_jo.put("empty_point_status", "02");
cut_jo.put("empty_vehicle_code", "SJG");
cut_jo.put("update_optid", currentUserId);
cut_jo.put("update_optname", currentUsername);
cut_jo.put("update_time", DateUtil.now());
WQLObject.getWQLObject("ST_IVT_CutPointIvt").update(cut_jo);
}
//更新空轴点位
JSONObject jsonCoolIvt2 = WQLObject.getWQLObject("st_ivt_coolpointivt").query("empty_point_code = '" + point_code4 + "'").uniqueResult(0);
jsonCoolIvt2.put("empty_point_status", "02");
@@ -207,20 +240,38 @@ public class CoolCutTask extends AbstractAcsTask {
if ("B1".equals(product_area)) {
//更新起点烘箱对接位
JSONObject dj_jo = WQLObject.getWQLObject("sch_base_point").query("point_code ='" + point_code1 + "'").uniqueResult(0);
JSONObject cool_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code ='" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(dj_jo)) {
dj_jo.put("point_status", "1");
dj_jo.put("material_code", "");
WQLObject.getWQLObject("sch_base_point").update(dj_jo);
}
if (ObjectUtil.isNotEmpty(cool_jo)) {
cool_jo.put("full_point_status", "01");
cool_jo.put("container_name", "");
cool_jo.put("workorder_id", "");
cool_jo.put("update_optid", currentUserId);
cool_jo.put("update_optname", currentUsername);
cool_jo.put("update_time", DateUtil.now());
WQLObject.getWQLObject("st_ivt_coolpointivt").update(cool_jo);
}
//更新满轴终点的空轴对接位
JSONObject cut_jo = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("full_point_code = '" + point_code2 + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cut_jo)) {
cut_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + point_code2 + "'").uniqueResult(0);
cut_jo.put("full_point_status", "02");
cut_jo.put("container_name", jsonTask.getString("material_code"));
WQLObject.getWQLObject("st_ivt_coolpointivt").update(cut_jo);
} else {
cut_jo.put("empty_point_status", "02");
cut_jo.put("empty_vehicle_code", "SJG");
cut_jo.put("update_optid", currentUserId);
cut_jo.put("update_optname", currentUsername);
cut_jo.put("update_time", DateUtil.now());
WQLObject.getWQLObject("ST_IVT_CutPointIvt").update(cut_jo);
} else {
}
} else {
// 更新主表状态
JSONObject coolMst = ivtTab.query("task_id = '" + task_id + "'").uniqueResult(0);
coolMst.put("bill_status", "50");
@@ -266,6 +317,8 @@ public class CoolCutTask extends AbstractAcsTask {
}
}
}
if ("010303".equals(jsonTask.getString("task_type"))) {
//更新分切区空轴库存
JSONObject cut_jo2 = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("empty_point_code = '" + point_code1 + "'").uniqueResult(0);
@@ -379,6 +432,7 @@ public class CoolCutTask extends AbstractAcsTask {
json.put("vehicle_code", form.getString("vehicle_code"));
json.put("vehicle_code2", form.getString("vehicle_code2"));
json.put("product_area", form.getString("product_area"));
json.put("material_code", form.getString("material_code"));
json.put("handle_class", THIS_CLASS);
json.put("create_id", currentUserId);
json.put("create_name", currentUsername);

View File

@@ -103,12 +103,27 @@ public class OutHotTask extends AbstractAcsTask {
if (jsonTask.getString("task_type").equals("010205")) {
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("full_point_code = '" + jsonTask.getString("point_code3") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cut_jo)) {
cut_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + jsonTask.getString("point_code3") + "'").uniqueResult(0);
}
//清空起点库存
JSONObject cool_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
cool_jo.put("container_name", "");
cool_jo.put("full_point_status", "01");
WQLObject.getWQLObject("st_ivt_coolpointivt").update(cool_jo);
//更新终点库存
JSONObject jsonPoint2 = pointTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
jsonPoint2.put("point_status", "2");
jsonPoint2.put("material_code", jsonTask.getString("material_code"));
pointTab.update(jsonPoint2);
//创建AGV任务
JSONObject jo = new JSONObject();
if (StrUtil.equals("01", cut_jo.getString("empty_point_status"))) {
jo.put("point_code1", jsonTask.getString("point_code2"));
jo.put("point_code2", cut_jo.getString("full_point_code"));
jo.put("vehicle_code", jsonTask.getString("material_code"));
jo.put("material_code", jsonTask.getString("material_code"));
jo.put("product_area", cut_jo.getString("product_area"));
jo.put("task_type", "010302");
} else {
@@ -131,7 +146,7 @@ public class OutHotTask extends AbstractAcsTask {
throw new BadRequestException("冷却区空位不足");
}
jo.put("point_code4", jsonCooIvt.getString("empty_point_code"));
jo.put("vehicle_code", jsonTask.getString("container_name"));
jo.put("material_code", jsonTask.getString("material_code"));
jo.put("product_area", cut_jo.getString("product_area"));
jo.put("task_type", "010301");
}