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,9 +500,19 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
.build(); .build();
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
TaskDto dto = taskserver.findByBarcodeFromCache(barcode);
if (ObjectUtil.isNotEmpty(dto)) {
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 {
HttpResponse httpResponse = acsToWmsService.applyTwo(param); HttpResponse httpResponse = acsToWmsService.applyTwo(param);
JSONObject jsonObject = null; JSONObject jsonObject = null;
if(ObjectUtil.isNotEmpty(httpResponse)){ if (ObjectUtil.isNotEmpty(httpResponse)) {
String body = httpResponse.body(); String body = httpResponse.body();
jsonObject = JSONObject.parseObject(body); jsonObject = JSONObject.parseObject(body);
} }
@@ -531,6 +541,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
luceneExecuteLogService.deviceExecuteLog(logDto2); luceneExecuteLogService.deviceExecuteLog(logDto2);
message = "申请退货入库报错,返回参数:" + jsonObject; message = "申请退货入库报错,返回参数:" + jsonObject;
} }
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -618,7 +629,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
HttpResponse httpResponse = acsToWmsService.applyTwo(param); HttpResponse httpResponse = acsToWmsService.applyTwo(param);
JSONObject jsonObject = null; JSONObject jsonObject = null;
if(ObjectUtil.isNotEmpty(httpResponse)){ if (ObjectUtil.isNotEmpty(httpResponse)) {
String body = httpResponse.body(); String body = httpResponse.body();
jsonObject = JSONObject.parseObject(body); jsonObject = JSONObject.parseObject(body);
} }
@@ -687,7 +698,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
HttpResponse httpResponse = acsToWmsService.applyTwo(param); HttpResponse httpResponse = acsToWmsService.applyTwo(param);
JSONObject jsonObject = null; JSONObject jsonObject = null;
if(ObjectUtil.isNotEmpty(httpResponse)){ if (ObjectUtil.isNotEmpty(httpResponse)) {
String body = httpResponse.body(); String body = httpResponse.body();
jsonObject = JSONObject.parseObject(body); jsonObject = JSONObject.parseObject(body);
} }

View File

@@ -199,6 +199,8 @@ public interface TaskService extends CommonService<Task> {
*/ */
TaskDto findByCode(String code); 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); 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 @Override
public List<TaskDto> queryTaskByDeviceCode(String device_code) { public List<TaskDto> queryTaskByDeviceCode(String device_code) {
return Optional return Optional