rev:优化退货入库申请任务逻辑

This commit is contained in:
2024-09-09 10:55:17 +08:00
parent b98f4ea401
commit 9de3416685
3 changed files with 47 additions and 25 deletions

View File

@@ -500,20 +500,8 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
HttpResponse httpResponse = acsToWmsService.applyTwo(param);
JSONObject jsonObject = null;
if(ObjectUtil.isNotEmpty(httpResponse)){
String body = httpResponse.body();
jsonObject = JSONObject.parseObject(body);
}
message = "申请退货入库,返回参数:" + jsonObject;
if (ObjectUtil.isNotNull(jsonObject) && jsonObject.getInteger("status") == 200) {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请退货入库,参数,接口返回:" + jsonObject)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
TaskDto dto = taskserver.findByBarcodeFromCache(barcode);
if (ObjectUtil.isNotEmpty(dto)) {
List list1 = new ArrayList();
Map map = new HashMap();
map.put("code", "to_command");
@@ -522,14 +510,37 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
this.writing(list1);
this.requireSucess = true;
} else {
this.iserror = true;
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请退货入库,返回参数:" + jsonObject)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
message = "申请退货入库报错,返回参数:" + jsonObject;
HttpResponse httpResponse = acsToWmsService.applyTwo(param);
JSONObject jsonObject = null;
if (ObjectUtil.isNotEmpty(httpResponse)) {
String body = httpResponse.body();
jsonObject = JSONObject.parseObject(body);
}
message = "申请退货入库,返回参数:" + jsonObject;
if (ObjectUtil.isNotNull(jsonObject) && jsonObject.getInteger("status") == 200) {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请退货入库,参数,接口返回:" + jsonObject)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
List list1 = new ArrayList();
Map map = new HashMap();
map.put("code", "to_command");
map.put("value", mode);
list1.add(map);
this.writing(list1);
this.requireSucess = true;
} else {
this.iserror = true;
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请退货入库,返回参数:" + jsonObject)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
message = "申请退货入库报错,返回参数:" + jsonObject;
}
}
} catch (Exception e) {
e.printStackTrace();
@@ -618,7 +629,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
luceneExecuteLogService.deviceExecuteLog(logDto);
HttpResponse httpResponse = acsToWmsService.applyTwo(param);
JSONObject jsonObject = null;
if(ObjectUtil.isNotEmpty(httpResponse)){
if (ObjectUtil.isNotEmpty(httpResponse)) {
String body = httpResponse.body();
jsonObject = JSONObject.parseObject(body);
}
@@ -687,12 +698,12 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
luceneExecuteLogService.deviceExecuteLog(logDto);
HttpResponse httpResponse = acsToWmsService.applyTwo(param);
JSONObject jsonObject = null;
if(ObjectUtil.isNotEmpty(httpResponse)){
if (ObjectUtil.isNotEmpty(httpResponse)) {
String body = httpResponse.body();
jsonObject = JSONObject.parseObject(body);
}
message = "木箱、子卷入库申请入库任务,返回参数:" + jsonObject;
if (ObjectUtil.isNotNull(jsonObject) && jsonObject.getInteger("status") == 200) {
if (ObjectUtil.isNotNull(jsonObject) && jsonObject.getInteger("status") == 200) {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("木箱、子卷入库申请入库任务,参数,接口返回:" + jsonObject)

View File

@@ -199,6 +199,8 @@ public interface TaskService extends CommonService<Task> {
*/
TaskDto findByCode(String code);
TaskDto findByBarcodeFromCache(String barcode);
/**
* 根据设备号查询未执行的任务
*

View File

@@ -430,6 +430,15 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
return ConvertUtil.convert(task, TaskDto.class);
}
@Override
public TaskDto findByBarcodeFromCache(String barcode) {
Task task = new LambdaQueryChainWrapper<>(taskMapper)
.eq(Task::getVehicle_code, barcode)
.eq(Task::getTask_status,TaskStatusEnum.READY.getIndex())
.one();
return ConvertUtil.convert(task, TaskDto.class);
}
@Override
public List<TaskDto> queryTaskByDeviceCode(String device_code) {
return Optional