This commit is contained in:
2023-01-06 17:31:26 +08:00
parent a2c80240a3
commit 5c0ac90817
6 changed files with 65 additions and 10 deletions

View File

@@ -47,11 +47,59 @@ public class HandlingTaskServiceImpl implements HandlingTaskService {
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject createTask(JSONObject whereJson) {
JSONObject result = new JSONObject();
String start_point_code = whereJson.getString("start_point_code");
String next_point_code = whereJson.getString("next_point_code");
WQLObject wo = WQLObject.getWQLObject("sch_base_point");
JSONObject start_json = wo.query("point_code = '" + start_point_code + "'").uniqueResult(0);
String start_region_code = start_json.getString("region_code");
JSONObject next_json = wo.query("point_code = '" + next_point_code + "'").uniqueResult(0);
String next_region_code = next_json.getString("region_code");
if (StrUtil.equals(start_region_code, RegionTypeEnum.KLZHCQ.getCode())) {
if (!StrUtil.equals(next_region_code, RegionTypeEnum.GT1.getCode())
&& !StrUtil.equals(next_region_code, RegionTypeEnum.HNJQ.getCode())
) {
result.put("code", "0");
result.put("desc", "操作失败,不能搬运此任务!");
return result;
}
}
else if (StrUtil.equals(start_region_code, RegionTypeEnum.MLZZCQ.getCode())) {
if (!StrUtil.equals(next_region_code, RegionTypeEnum.YLJQ.getCode())
&& !StrUtil.equals(next_region_code, RegionTypeEnum.GT4.getCode())
) {
result.put("code", "0");
result.put("desc", "操作失败,不能搬运此任务!");
return result;
}
}
else if (StrUtil.equals(start_region_code, RegionTypeEnum.GT4.getCode())) {
if (!StrUtil.equals(next_region_code, RegionTypeEnum.HNJQ.getCode())
&& !StrUtil.equals(next_region_code, RegionTypeEnum.KLZHCQ.getCode())
) {
result.put("code", "0");
result.put("desc", "操作失败,不能搬运此任务!");
return result;
}
}
else if (StrUtil.equals(start_region_code, RegionTypeEnum.HNJQ.getCode())) {
if (!StrUtil.equals(next_region_code, RegionTypeEnum.GT1.getCode())
&& !StrUtil.equals(next_region_code, RegionTypeEnum.KLZHCQ.getCode())
) {
result.put("code", "0");
result.put("desc", "操作失败,不能搬运此任务!");
return result;
}
}
else {
result.put("code", "0");
result.put("desc", "操作失败,不能搬运此任务!");
return result;
}
HandlingTask taskBean = SpringContextHolder.getBean(HandlingTask.class);
taskBean.createTask(whereJson);
JSONObject result = new JSONObject();
result.put("code","1");
result.put("desc","操作成功");
result.put("code", "1");
result.put("desc", "操作成功");
return result;
}
}

View File

@@ -186,6 +186,7 @@ public class HnjCallEmpVehicleTask extends AbstractAcsTask {
@Transactional(rollbackFor = Exception.class)
public String createTask(JSONObject form) {
String workDevice = "HNJ01";
String point_code2 = form.getString("point_code2");
String create_mode = form.getString("create_mode");
String is_auto_issue = form.getString("is_auto_issue");
@@ -204,7 +205,7 @@ public class HnjCallEmpVehicleTask extends AbstractAcsTask {
if (ObjectUtil.isNotEmpty(taskObj))
throw new BadRequestException("当前点位" + point_code2 + "存在未完成的任务");
JSONObject workOrderObj = workOrderTab.query("device_code = '" + point_code2 + "' and order_status = '3' and is_delete ='0'").uniqueResult(0);
JSONObject workOrderObj = workOrderTab.query("device_code = '" + workDevice + "' and order_status = '3' and is_delete ='0'").uniqueResult(0);
if (ObjectUtil.isEmpty(workOrderObj)) throw new BadRequestException("该设备当前未生产或者已删除");
SchTaskDto dto = SchTaskDto.builder()

View File

@@ -213,6 +213,8 @@ public class YljCallMaterialTask extends AbstractAcsTask {
@Override
public String createTask(JSONObject whereJson) {
String workDevice = "HNJ01";
String point_code2 = whereJson.getString("point_code2");
String create_mode = whereJson.getString("create_mode");
String is_auto_issue = whereJson.getString("is_auto_issue");
@@ -226,7 +228,7 @@ public class YljCallMaterialTask extends AbstractAcsTask {
JSONObject taskObj = taskTab.query("is_delete='0' and point_code2 = '" + point_code2 + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(taskObj)) throw new BadRequestException("当前点位" + point_code2 + "存在未完成的任务");
JSONObject workOrderObj = workOrderTab.query("device_code = '" + point_code2 + "' and order_status = '3' and is_delete ='0'").uniqueResult(0);
JSONObject workOrderObj = workOrderTab.query("device_code = '" + workDevice + "' and order_status = '3' and is_delete ='0'").uniqueResult(0);
if (ObjectUtil.isEmpty(workOrderObj)) throw new BadRequestException("该设备当前未生产或者已删除");
SchTaskDto dto = SchTaskDto.builder()

View File

@@ -300,6 +300,7 @@ public class HandlingTask extends AbstractAcsTask {
@Override
@Transactional(rollbackFor = Exception.class)
public String createTask(JSONObject form) {
String workDevice = "HNJ01";
String start_point_code = form.getString("start_point_code");
String next_point_code = form.getString("next_point_code");
/*
@@ -339,7 +340,10 @@ public class HandlingTask extends AbstractAcsTask {
}
Long material_id = jsonObject.getLong("material_id");
if (StrUtil.equals(region_codeS, RegionTypeEnum.HNJQ.getCode()) || StrUtil.equals(region_codeS, RegionTypeEnum.YLJQ.getCode())) {
JSONObject workOrderObj = workOrderTab.query("device_code = '" + start_point_code + "' and order_status = '3' and is_delete ='0'").uniqueResult(0);
if (StrUtil.equals(region_codeS, RegionTypeEnum.YLJQ.getCode())) {
workDevice = start_point_code;
}
JSONObject workOrderObj = workOrderTab.query("device_code = '" + workDevice + "' and order_status = '3' and is_delete ='0'").uniqueResult(0);
if (ObjectUtil.isEmpty(workOrderObj)) throw new BadRequestException("该设备当前未生产或者已删除");
material_id = workOrderObj.getLong("material_id");
}

View File

@@ -340,7 +340,7 @@ public class HnjSendMaterialTask extends AbstractAcsTask {
@Override
@Transactional(rollbackFor = Exception.class)
public String createTask(JSONObject whereJson) {
String workDevice = "HNJ01";
String point_code1 = whereJson.getString("point_code1");
String create_mode = whereJson.getString("create_mode");
String is_auto_issue = whereJson.getString("is_auto_issue");
@@ -363,7 +363,7 @@ public class HnjSendMaterialTask extends AbstractAcsTask {
String device_code = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0).getString("point_code");
JSONObject workOrderObj = workOrderTab.query("device_code = '" + device_code + "' and order_status = '3' and is_delete ='0'").uniqueResult(0);
JSONObject workOrderObj = workOrderTab.query("device_code = '" + workDevice + "' and order_status = '3' and is_delete ='0'").uniqueResult(0);
if (ObjectUtil.isEmpty(workOrderObj)) throw new BadRequestException("该设备当前未生产或者已删除");
Long task_group_id = IdUtil.getLongId();

View File

@@ -346,8 +346,8 @@ public class TimingSendMaterialTask extends AbstractAcsTask {
JSONObject map = new JSONObject();
map.put("point_code1", jsonObject1.getString("point_code"));
map.put("point_code2", jsonObject2.getString("point_code"));
map.put("vehicle_code", jsonObject.getString("point_code"));
map.put("vehicle_type", jsonObject.getString("point_code"));
map.put("vehicle_code", jsonObject.getString("vehicle_code"));
map.put("vehicle_type", jsonObject.getString("vehicle_type"));
map.put("material_id", material_id);
map.put("create_mode", "1");
map.put("is_auto_issue", "1");