海康回调
This commit is contained in:
parent
220575f390
commit
18ccf9022f
|
@ -0,0 +1,40 @@
|
|||
package com.wcs.back.controller;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.wcs.back.domain.HkResult;
|
||||
import com.wcs.back.service.IWcsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
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;
|
||||
|
||||
/**
|
||||
* wcs回调Controller
|
||||
*
|
||||
* @author zf
|
||||
* @date 2022-11-11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/rcms")
|
||||
@Api(value = "wcs回调控制器", tags = {"wcs回调管理"})
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
public class HkController {
|
||||
|
||||
private final IWcsService wcsService;
|
||||
|
||||
/**
|
||||
* 海康任务下发
|
||||
*/
|
||||
@ApiOperation("海康任务下发")
|
||||
@PostMapping("/services/rest/hikRpcService/genAgvSchedulingTask")
|
||||
public HkResult genAgvSchedulingTask(@RequestBody String json, HttpServletRequest request) throws JsonProcessingException {
|
||||
HkResult hkResult = wcsService.genAgvSchedulingTask(json, request);
|
||||
return hkResult;
|
||||
}
|
||||
}
|
|
@ -69,7 +69,7 @@ public class WcsController {
|
|||
/**
|
||||
* 指令下发
|
||||
*/
|
||||
@ApiOperation("滚筒任务下发")
|
||||
@ApiOperation("指令下发")
|
||||
@PostMapping("/Directives")
|
||||
public WcsResult Directives(@RequestBody String json, HttpServletRequest request) throws JsonProcessingException {
|
||||
WcsResult wcsResult = wcsService.Directives(json, request);
|
||||
|
@ -95,5 +95,4 @@ public class WcsController {
|
|||
WcsResult2 wcsResult = wcsService.GetRollerInfo();
|
||||
return wcsResult;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package com.wcs.back.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 海康响应
|
||||
*
|
||||
* @author zf
|
||||
* @date 2024/2/29
|
||||
*/
|
||||
@Data
|
||||
public class HkResult implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 返回码::0-成功 */
|
||||
@ApiModelProperty("返回码::0-成功 ")
|
||||
private String code;
|
||||
|
||||
/** 返回消息 */
|
||||
@ApiModelProperty("返回消息")
|
||||
private String message;
|
||||
|
||||
/** 请求编号 */
|
||||
@ApiModelProperty("请求编号")
|
||||
private String reqCode;
|
||||
|
||||
/** 自定义返回(返回任务单号) */
|
||||
@ApiModelProperty("自定义返回(返回任务单号)")
|
||||
private String data;
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.wcs.back.service;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.wcs.back.domain.HkResult;
|
||||
import com.wcs.back.domain.WcsResult;
|
||||
import com.wcs.back.domain.WcsResult2;
|
||||
|
||||
|
@ -65,4 +66,11 @@ public interface IWcsService {
|
|||
*/
|
||||
WcsResult2 GetRollerInfo();
|
||||
|
||||
/**
|
||||
* 海康任务创建
|
||||
* @param json
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
HkResult genAgvSchedulingTask(String json, HttpServletRequest request);
|
||||
}
|
||||
|
|
|
@ -359,6 +359,23 @@ public class WcsServiceImpl implements IWcsService {
|
|||
return wcsResult2;
|
||||
}
|
||||
|
||||
/**
|
||||
* 海康任务创建
|
||||
*
|
||||
* @param json
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public HkResult genAgvSchedulingTask(String json, HttpServletRequest request) {
|
||||
HkResult hkResult = new HkResult();
|
||||
hkResult.setCode("0");
|
||||
hkResult.setMessage("成功");
|
||||
hkResult.setReqCode("0");
|
||||
hkResult.setData("F01169C808C317111G");
|
||||
return hkResult;
|
||||
}
|
||||
|
||||
// 发送 HTTP POST 请求
|
||||
private <T> WcsResult sendHttpPost(T taskCallBack, String url) {
|
||||
String jsonString = JSON.toJSONString(taskCallBack);
|
||||
|
|
Loading…
Reference in New Issue