添加章源钨业接口 1.获取重量 2.获取滚筒线信息
This commit is contained in:
parent
817539c75e
commit
52700959b0
|
@ -2,15 +2,13 @@ package com.wcs.back.controller;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.wcs.back.domain.WcsResult;
|
import com.wcs.back.domain.WcsResult;
|
||||||
|
import com.wcs.back.domain.WcsResult2;
|
||||||
import com.wcs.back.service.IWcsService;
|
import com.wcs.back.service.IWcsService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
@ -78,4 +76,24 @@ public class WcsController {
|
||||||
return wcsResult;
|
return wcsResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 称重
|
||||||
|
*/
|
||||||
|
@ApiOperation("称重")
|
||||||
|
@GetMapping("/GetWeight")
|
||||||
|
public WcsResult2 GetWeight(String rollerID) throws JsonProcessingException {
|
||||||
|
WcsResult2 wcsResult = wcsService.GetWeight(rollerID);
|
||||||
|
return wcsResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取滚筒线信息
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取滚筒线信息")
|
||||||
|
@GetMapping("/GetRollerInfo")
|
||||||
|
public WcsResult2 GetRollerInfo() throws JsonProcessingException {
|
||||||
|
WcsResult2 wcsResult = wcsService.GetRollerInfo();
|
||||||
|
return wcsResult;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.wcs.back.domain;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 滚筒线信息Vo
|
||||||
|
*
|
||||||
|
* @author zf
|
||||||
|
* @date 2024/2/4
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class RollerInfoVo implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 滚筒线编号 */
|
||||||
|
@ApiModelProperty("滚筒线编号")
|
||||||
|
private String rollerID;
|
||||||
|
|
||||||
|
/** 是否在线 */
|
||||||
|
@ApiModelProperty("是否在线")
|
||||||
|
private boolean connectState;
|
||||||
|
|
||||||
|
/** 模式【0:手动、1:自动】 */
|
||||||
|
@ApiModelProperty("模式【0:手动、1:自动】")
|
||||||
|
private int mode;
|
||||||
|
|
||||||
|
/** 出入库状态【0:其他、1:出库中、2:入库中】 */
|
||||||
|
@ApiModelProperty("出入库状态【0:其他、1:出库中、2:入库中】")
|
||||||
|
private int inOutStatus;
|
||||||
|
|
||||||
|
/** 传送带上剩余桶数量 */
|
||||||
|
@ApiModelProperty("传送带上剩余桶数量")
|
||||||
|
private int number;
|
||||||
|
|
||||||
|
/** 急停状态【0:急停、1:正常】 */
|
||||||
|
@ApiModelProperty("急停状态【0:急停、1:正常】")
|
||||||
|
private int eStopStatus;
|
||||||
|
|
||||||
|
/** 故障状态【0:故障、1:正常】 */
|
||||||
|
@ApiModelProperty("故障状态【0:故障、1:正常】")
|
||||||
|
private int faultStatus;
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.wcs.back.domain;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wcs返回信息
|
||||||
|
*
|
||||||
|
* @author 中xue
|
||||||
|
*/
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class WcsResult2 {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 信息编码,0:失败,1:成功,其他信息可自定义
|
||||||
|
*/
|
||||||
|
@JsonProperty("code")
|
||||||
|
private Integer code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* true:成功,false:失败
|
||||||
|
*/
|
||||||
|
@JsonProperty("state")
|
||||||
|
private Boolean state;
|
||||||
|
/**
|
||||||
|
* 反馈信息说明
|
||||||
|
*/
|
||||||
|
@JsonProperty("message")
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据
|
||||||
|
*/
|
||||||
|
@JsonProperty("dataInfo")
|
||||||
|
private Object dataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回成功消息
|
||||||
|
*
|
||||||
|
* @return 成功消息
|
||||||
|
*/
|
||||||
|
public static JSONObject success()
|
||||||
|
{
|
||||||
|
String result = "{\"message\":\"成功\",\"code\":1\"}";
|
||||||
|
return JSONObject.parseObject(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回错误消息
|
||||||
|
*
|
||||||
|
* @return 失败消息
|
||||||
|
*/
|
||||||
|
public static JSONObject error()
|
||||||
|
{
|
||||||
|
String result = "{\"message\":\"失败\",\"code\":0\"}";
|
||||||
|
return JSONObject.parseObject(result);
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package com.wcs.back.service;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.wcs.back.domain.WcsResult;
|
import com.wcs.back.domain.WcsResult;
|
||||||
|
import com.wcs.back.domain.WcsResult2;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
@ -50,4 +51,18 @@ public interface IWcsService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
WcsResult Directives(String json, HttpServletRequest request) throws JsonProcessingException;
|
WcsResult Directives(String json, HttpServletRequest request) throws JsonProcessingException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取重量
|
||||||
|
* @param rollerID
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
WcsResult2 GetWeight(String rollerID);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取滚筒线信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
WcsResult2 GetRollerInfo();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
@ -315,6 +316,49 @@ public class WcsServiceImpl implements IWcsService {
|
||||||
return wcsResult;
|
return wcsResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取重量
|
||||||
|
*
|
||||||
|
* @param rollerID
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WcsResult2 GetWeight(String rollerID) {
|
||||||
|
WcsResult2 wcsResult2 = new WcsResult2();
|
||||||
|
wcsResult2.setCode(1);
|
||||||
|
wcsResult2.setState(true);
|
||||||
|
wcsResult2.setMessage("");
|
||||||
|
wcsResult2.setDataInfo(100);
|
||||||
|
|
||||||
|
return wcsResult2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取滚筒线信息
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WcsResult2 GetRollerInfo() {
|
||||||
|
WcsResult2 wcsResult2 = new WcsResult2();
|
||||||
|
wcsResult2.setCode(1);
|
||||||
|
wcsResult2.setState(true);
|
||||||
|
wcsResult2.setMessage("");
|
||||||
|
List<RollerInfoVo> rollerInfoVos = new ArrayList<>();
|
||||||
|
RollerInfoVo rollerInfoVo = new RollerInfoVo();
|
||||||
|
rollerInfoVo.setRollerID("1");
|
||||||
|
rollerInfoVo.setConnectState(true);
|
||||||
|
rollerInfoVo.setMode(1);
|
||||||
|
rollerInfoVo.setInOutStatus(2);
|
||||||
|
rollerInfoVo.setNumber(0);
|
||||||
|
rollerInfoVo.setEStopStatus(1);
|
||||||
|
rollerInfoVo.setFaultStatus(1);
|
||||||
|
rollerInfoVos.add(rollerInfoVo);
|
||||||
|
wcsResult2.setDataInfo(rollerInfoVos);
|
||||||
|
|
||||||
|
return wcsResult2;
|
||||||
|
}
|
||||||
|
|
||||||
// 发送 HTTP POST 请求
|
// 发送 HTTP POST 请求
|
||||||
private <T> WcsResult sendHttpPost(T taskCallBack, String url) {
|
private <T> WcsResult sendHttpPost(T taskCallBack, String url) {
|
||||||
String jsonString = JSON.toJSONString(taskCallBack);
|
String jsonString = JSON.toJSONString(taskCallBack);
|
||||||
|
|
Loading…
Reference in New Issue