代码更新

This commit is contained in:
2022-10-22 14:24:09 +08:00
parent d2be215e3c
commit 24c1c64c95
4 changed files with 83 additions and 63 deletions

View File

@@ -53,11 +53,11 @@ public class AcsToWmsController {
return new ResponseEntity<>(acsToWmsService.apply(whereJson), HttpStatus.OK); return new ResponseEntity<>(acsToWmsService.apply(whereJson), HttpStatus.OK);
} }
@PostMapping("/towApply") @PostMapping("/againApply")
@Log("二次申请任务") @Log("二次申请任务")
@ApiOperation("二次申请任务") @ApiOperation("二次申请任务")
@SaCheckPermission("menu:list") @SaCheckPermission("menu:list")
public ResponseEntity<Object> towApply(@RequestBody JSONObject whereJson) { public ResponseEntity<Object> towApply(@RequestBody String task_id) {
return new ResponseEntity<>(acsToWmsService.towApply(whereJson), HttpStatus.OK); return new ResponseEntity<>(acsToWmsService.againApply(task_id), HttpStatus.OK);
} }
} }

View File

@@ -51,12 +51,4 @@ public interface AcsToWmsService {
*/ */
JSONObject apply(JSONObject whereJson); JSONObject apply(JSONObject whereJson);
/**
* ACS客户端--->LMS服务端
* 二次任务申请
*
* @param whereJson 条件
* @return JSONObject
*/
JSONObject towApply(JSONObject whereJson);
} }

View File

@@ -112,8 +112,21 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return result; return result;
} }
@LokiLog(type = LokiLogType.ACS_TO_LMS)
@Override @Override
public String againApply(String task_id) { public String againApply(String task_id) {
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
try {
Class<?> clz = Class.forName(jsonTask.getString("handle_class"));
Object obj = clz.newInstance();
Method m = obj.getClass().getDeclaredMethod("againApply", JSONObject.class, String.class);
Object invoke = m.invoke(task_id);
} catch (Exception e) {
}
return null; return null;
} }
@@ -362,35 +375,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return null; return null;
} }
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject towApply(JSONObject whereJson) {
/*
* 1.入空载具
* 2.出空载具
* 3.入物料
* 4.出物料
*/
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); // 点位表
String task_id = whereJson.getString("task_id");
JSONObject jsonTask = taskTab.query("task_id ='" + task_id + "'").uniqueResult(0);
JSONObject jsonPoint2 = pointTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
if (StrUtil.equals(jsonTask.getString("acs_task_type"), "1")) {
// 根据 point_code2 的类型找对对应的列
pointTab.query("region_id = '"+jsonPoint2.getString("region_id")+
"' and block_num = '"+jsonPoint2.getString("block_num")+
"' and col_num = '"+jsonPoint2.getString("col_num")+
"' and point_status = '2' order by in_empty_seq ASC").uniqueResult(0);
}
return null;
}
@LokiLog(type = LokiLogType.ACS_TO_LMS) @LokiLog(type = LokiLogType.ACS_TO_LMS)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public JSONObject inCreateRegion(JSONObject json) { public JSONObject inCreateRegion(JSONObject json) {

View File

@@ -416,4 +416,48 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
return result; return result;
} }
@Transactional(rollbackFor = Exception.class)
public String againApply(String task_id) {
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); // 点位表
String point_code = "";
JSONObject jsonTask = taskTab.query("task_id ='" + task_id + "'").uniqueResult(0);
JSONObject jsonPoint2 = pointTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
// 根据 区域、块、列找到第一个有物料的货位
JSONObject jsonOnePoint = pointTab.query("region_id = '" + jsonPoint2.getString("region_id") +
"' and block_num = '" + jsonPoint2.getString("block_num") +
"' and col_num = '" + jsonPoint2.getString("col_num") +
"' and point_code <> '"+jsonPoint2.getString("point_code")+
"' and point_status = '2' order by in_empty_seq ASC").uniqueResult(0);
// 如果为空说明这一列其他货位为空 则入到最后一个货位
if (ObjectUtil.isEmpty(jsonOnePoint)) {
JSONObject jsonEmpPoint = pointTab.query("region_id = '" + jsonPoint2.getString("region_id") +
"' and block_num = '" + jsonPoint2.getString("block_num") +
"' and col_num = '" + jsonPoint2.getString("col_num") +
"' and point_code <> '"+jsonPoint2.getString("point_code")+
"' and point_status = '1' order by in_empty_seq DESC").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonEmpPoint)) point_code = jsonEmpPoint.getString("point_code");
} else {
// 找前一位的空位
double in_empty_seq = NumberUtil.sub(jsonOnePoint.getIntValue("in_empty_seq"), 1);
JSONObject jsonEmpPoint = pointTab.query("region_id = '" + jsonPoint2.getString("region_id") +
"' and block_num = '" + jsonPoint2.getString("block_num") +
"' and col_num = '" + jsonPoint2.getString("col_num") +
"' and point_code <> '"+jsonPoint2.getString("point_code")+
"' and in_empty_seq = '"+ in_empty_seq +
"' and point_status = '1'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonEmpPoint)) point_code = jsonEmpPoint.getString("point_code");
}
return point_code;
}
} }