package com.whyc.service;
|
|
import com.google.gson.reflect.TypeToken;
|
import com.whyc.dto.Response;
|
import com.whyc.dto.WmsMaterialDto;
|
import com.whyc.util.HttpUtil;
|
import com.whyc.util.JsonUtil;
|
import org.springframework.stereotype.Service;
|
|
import java.util.List;
|
|
@Service
|
public class FireRobotService {
|
|
|
/**
|
*
|
* @param command
|
* @return
|
*/
|
public Response control(String command) {
|
String httpUrl = "http://192.168.10.45:8085"+"/ControlInterfaceHandler?command="+command;
|
Response response = HttpUtil.doPost(httpUrl, (String) null);
|
//对结果进行处理
|
if(response.getCode() == 1){ //请求成功,data有正常数据
|
String dataStr = (String) response.getData();
|
//参数示例
|
//执行成功返回:
|
//开门成功!
|
//关门成功!
|
//七氟丙烷打开成功!
|
//七氟丙烷关闭成功成功!
|
//指令执行失败,请重新发送!
|
if(dataStr.contains("成功")){
|
response.set(1,true,dataStr);
|
}else{
|
response.set(1,false,dataStr);
|
}
|
}else{
|
response.set(1,false);
|
}
|
return response;
|
}
|
|
public Response specifyTask(String interval, Integer progress, Integer direction) {
|
String httpUrl = "http://192.168.10.45:8085"+"/SpecifyTask?interval="+interval+"&progress="+progress+"&direction="+direction;
|
Response response = HttpUtil.doPost(httpUrl, (String) null);
|
//对结果进行处理
|
if(response.getCode() == 1){ //请求成功,data有正常数据
|
String dataStr = (String) response.getData();
|
//任务已设置: interval=0-1, progress=88%, direction=左
|
response.setMsg(dataStr);
|
response.setData(null);
|
}
|
return response;
|
}
|
}
|