|
@ -1,20 +1,16 @@ |
|
|
package com.iflytop.gd.app.cmd; |
|
|
package com.iflytop.gd.app.cmd; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.json.JSONArray; |
|
|
import com.iflytop.gd.app.core.BaseCommandHandler; |
|
|
import com.iflytop.gd.app.core.BaseCommandHandler; |
|
|
import com.iflytop.gd.app.model.dto.CmdDTO; |
|
|
import com.iflytop.gd.app.model.dto.CmdDTO; |
|
|
import com.iflytop.gd.app.model.entity.Container; |
|
|
|
|
|
import com.iflytop.gd.app.service.ContainerService; |
|
|
import com.iflytop.gd.app.service.ContainerService; |
|
|
import com.iflytop.gd.app.service.DeviceCommandUtilService; |
|
|
import com.iflytop.gd.app.service.DeviceCommandUtilService; |
|
|
import com.iflytop.gd.common.annotation.CommandMapping; |
|
|
import com.iflytop.gd.common.annotation.CommandMapping; |
|
|
import com.iflytop.gd.common.enums.AcidPumpDeviceCode; |
|
|
import com.iflytop.gd.common.enums.AcidPumpDeviceCode; |
|
|
import com.iflytop.gd.hardware.drivers.TricolorLightDriver; |
|
|
|
|
|
import com.iflytop.gd.hardware.exception.HardwareException; |
|
|
|
|
|
import com.iflytop.gd.hardware.type.MId; |
|
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
|
|
import java.util.concurrent.CompletableFuture; |
|
|
import java.util.concurrent.CompletableFuture; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -31,18 +27,13 @@ public class FilledSolutionStartCommand extends BaseCommandHandler { |
|
|
@Override |
|
|
@Override |
|
|
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { |
|
|
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { |
|
|
return runAsync(() -> { |
|
|
return runAsync(() -> { |
|
|
String ids = cmdDTO.getStringParam("list"); |
|
|
|
|
|
|
|
|
|
|
|
Long[] idArray = Arrays.stream(ids.split(",")) |
|
|
|
|
|
.map(String::trim) |
|
|
|
|
|
.map(Long::valueOf) |
|
|
|
|
|
.toArray(Long[]::new); |
|
|
|
|
|
for (Long id : idArray) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONArray idJsonArray = cmdDTO.getJSONArrayParam("list"); |
|
|
|
|
|
for (int i = 0; i < idJsonArray.size(); i++) { |
|
|
|
|
|
String idStr = idJsonArray.getStr(i); |
|
|
CompletableFuture.runAsync(() -> { |
|
|
CompletableFuture.runAsync(() -> { |
|
|
try { |
|
|
try { |
|
|
AcidPumpDeviceCode acidPumpDevice = containerService.getPumpByContainerId(id); |
|
|
|
|
|
deviceCommandUtilService.acidPumpMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), acidPumpDevice, 99999);//添加溶液 |
|
|
|
|
|
|
|
|
AcidPumpDeviceCode acidPumpDevice = containerService.getPumpByContainerId(Long.parseLong(idStr)); |
|
|
|
|
|
deviceCommandUtilService.acidPumpFilledSolutionStart(cmdDTO.getCommandId(), cmdDTO.getCommand(), acidPumpDevice); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error("预充失败", e); |
|
|
log.error("预充失败", e); |
|
|
} |
|
|
} |
|
|