feat(agv): 接口
1. 生产工单与投料关系下发
This commit is contained in:
parent
92393dc26a
commit
45d05cd163
@ -10,4 +10,6 @@ public class IntegrationSrv {
|
||||
public static final String FQ_OUT_INVENTORY = "FQ_OUT_INVENTORY";
|
||||
|
||||
public static final String ERP_MATERIEL_GET = "ERP_MATERIEL_GET";
|
||||
|
||||
public static final String AGV_OUT_SO_ITEM_STOCK_BIN = "AGV_OUT_SO_ITEM_STOCK_BIN";
|
||||
}
|
||||
|
||||
@ -33,6 +33,8 @@ public class Msg {
|
||||
public static final String FQ_INT = "fq_int";
|
||||
|
||||
public static final String FQ_OUT = "fq_out";
|
||||
|
||||
public static final String AGV_INT = "agv_int";
|
||||
|
||||
public static final String MESSAGE_CONTENT = "MESSAGE_CONTENT";
|
||||
|
||||
|
||||
@ -17,6 +17,13 @@ public interface RemoteInvokeService {
|
||||
@PostMapping("/{service}/invoke")
|
||||
InvokeResponse invokeByService(@PathVariable(value = "service", required = false) String service,
|
||||
@RequestBody InvokeRequest request);
|
||||
|
||||
@PostMapping("/invoke-request")
|
||||
InvokeResponse invokeRequest(@RequestBody InvokeRequest request);
|
||||
|
||||
@PostMapping("/{service}/invoke-request")
|
||||
InvokeResponse invokeRequestByService(@PathVariable(value = "service", required = false) String service,
|
||||
@RequestBody InvokeRequest request);
|
||||
|
||||
@PostMapping("/requestErpPort")
|
||||
JSONObject requestErpPort(@RequestBody JSONObject jsonObject);
|
||||
|
||||
@ -28,8 +28,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.UUID;
|
||||
|
||||
@RestController
|
||||
@ -73,6 +71,13 @@ public class InvokeController {
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@PostMapping(value = {"/invoke-request", "/{service}/invoke-request"})
|
||||
public InvokeResponse invokeRequest(@PathVariable(value = "service", required = false) String service,@RequestBody InvokeRequest request) {
|
||||
|
||||
InvokeResponse invokeResponse = invoke.execute(service, request);
|
||||
return invokeResponse;
|
||||
}
|
||||
|
||||
/*
|
||||
OA 呼叫地址
|
||||
|
||||
@ -0,0 +1,48 @@
|
||||
package com.foreverwin.iep.integration.handler.def.agv;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.foreverwin.iep.common.model.http.HttpRequest;
|
||||
import com.foreverwin.iep.common.model.http.HttpResponse;
|
||||
import com.foreverwin.iep.common.utils.HttpUtils;
|
||||
import com.foreverwin.iep.integration.constant.Msg;
|
||||
import com.foreverwin.iep.integration.domain.InvokeRequest;
|
||||
import com.foreverwin.iep.integration.domain.InvokeResponse;
|
||||
import com.foreverwin.iep.integration.service.HandlerService;
|
||||
import com.foreverwin.iep.integration.utils.Local;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Service("AGV_OUT_SO_ITEM_STOCK_BIN")
|
||||
public class AgvOutSoItemStockBin implements HandlerService {
|
||||
|
||||
@Override
|
||||
public InvokeResponse call(InvokeRequest invokeRequest) {
|
||||
HttpRequest httpRequest = new HttpRequest();
|
||||
httpRequest.setUrl("www.baidu.com");
|
||||
httpRequest.setRequest(invokeRequest.getMessageContent());
|
||||
InvokeResponse invokeResponse = new InvokeResponse();
|
||||
invokeResponse.setTransSid(invokeRequest.getTransSid());
|
||||
invokeResponse.setTransTime(Local.now());
|
||||
if(StrUtil.isBlank(httpRequest.getUrl())){
|
||||
return getDefaultInvoke().fail(invokeRequest.getTransSid(), "未获取到url配置,请先在字典中配置调用AGV的URL");
|
||||
}
|
||||
try {
|
||||
HttpResponse httpResponse = HttpUtils.doPost(httpRequest);
|
||||
invokeResponse.setResult("0");
|
||||
invokeResponse.setMessageContent(Msg.SUCCESS);
|
||||
if (httpResponse.getStatusCode() != 200) {
|
||||
invokeResponse.setResult("1");
|
||||
invokeResponse.setMessageContent(httpResponse.getResponse());
|
||||
}
|
||||
return invokeResponse;
|
||||
} catch (Exception e) {
|
||||
return getDefaultInvoke().fail(invokeRequest.getTransSid(), StrUtil.isBlank(e.getMessage()) ? e.toString() : e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String validation(InvokeRequest invokeRequest) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user