提交验箱接口代码,所有回传mes接口增加请求超时时间120s

This commit is contained in:
DESKTOP-5DIJMF9\admin
2025-02-27 10:51:00 +08:00
parent f71e2aeb64
commit e061f75623
3 changed files with 96 additions and 1 deletions

View File

@@ -140,6 +140,13 @@ public class LmsToMesController {
return new ResponseEntity<>(lmsToMesService.momBoxPackageSubmit(jo), HttpStatus.OK);
}
@PostMapping("/momBoxCheckSubmit")
@Log("LMS将验箱信息传递给MES")
@SaIgnore
public ResponseEntity<Object> momBoxCheckSubmit(@RequestBody JSONObject jo) {
return new ResponseEntity<>(lmsToMesService.BoxDataCollectionSubmit2(jo), HttpStatus.OK);
}
@PostMapping("/GetInspectionResult")
@Log("LMS获取MES称重后子卷信息")
@SaIgnore

View File

@@ -183,5 +183,7 @@ public interface LmsToMesService {
JSONObject momBoxPackageSubmit(JSONObject jo);
JSONObject BoxDataCollectionSubmit2(JSONObject jo);
JSONObject getInspectionResult(JSONObject jo);
}

View File

@@ -38,6 +38,8 @@ public class LmsToMesServiceImpl implements LmsToMesService {
private static String is_connect_mes = "1";
private static Integer time_out = 120000;
@Autowired
private IBstIvtBoxinfoService bstIvtBoxinfoService;
@@ -72,6 +74,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(param))
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("momRollFoilWeighing接口输出参数为-------------------" + result.toString());
@@ -131,6 +134,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(param))
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("momRollBakeInBound接口输出参数为-------------------" + result.toString());
@@ -194,6 +198,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(param))
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("momRollBakeOutBound接口输出参数为-------------------" + result.toString());
@@ -234,6 +239,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(param))
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("momRollSemiFGInboundComplete接口输出参数为-------------------" + result.toString());
@@ -288,6 +294,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(jo))
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("airSwellWithPaperTubeAssComplete接口输出参数为-------------------" + result.toString());
@@ -346,6 +353,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(jo))
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("airSwellWithPaperTubeAssComplete接口输出参数为-------------------" + result.toString());
@@ -396,6 +404,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(jo))
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("airSwellWithPaperTubeAssArrival接口输出参数为-------------------" + result.toString());
@@ -449,8 +458,10 @@ public class LmsToMesServiceImpl implements LmsToMesService {
String api = "CamstarApi/ChildRollFGInboundComplete";
url = url + api;
try {
String resultMsg = HttpRequest.post(url)
String resultMsg = HttpRequest
.post(url)
.body(String.valueOf(jo))
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("childRollFGInboundComplete接口输出参数为-------------------" + result.toString());
@@ -493,6 +504,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(param))
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("childRollFGOutboundComplete接口输出参数为-------------------" + result.toString());
@@ -540,6 +552,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(param))
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("LMSUnPackage接口输出参数为-------------------" + result.toString());
@@ -587,6 +600,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(param))
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("LMSPackakge接口输出参数为-------------------" + result.toString());
@@ -623,6 +637,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(param))
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("scrapAudit接口输出参数为-------------------" + result.toString());
@@ -659,6 +674,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(param))
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("proudDayData接口输出参数为-------------------" + result.toString());
@@ -700,6 +716,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(param))
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("ChildScrapUpdate接口输出参数为-------------------" + result.toString());
@@ -736,6 +753,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
try {
String resultMsg = HttpRequest.post(url)
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("sendSalesIvtMsg接口输出参数为-------------------" + result.toString());
@@ -771,6 +789,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(param))
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("sendSalesIvtMsgParam接口输出参数为-------------------" + result.toString());
@@ -825,6 +844,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
try {
/*String resultMsg = HttpRequest.post(url)
.body(String.valueOf(param))
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("momAutoTransterMoveIn接口输出参数为-------------------" + result.toString());
@@ -868,6 +888,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(param))
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("momGetPackingInfo接口输出参数为-------------------" + result.toString());
@@ -931,6 +952,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(param))
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
IpdmBiSubpackagerelationService subpackagerelationService = SpringContextHolder.getBean(IpdmBiSubpackagerelationService.class);
@@ -958,6 +980,69 @@ public class LmsToMesServiceImpl implements LmsToMesService {
return result;
}
@Override
public JSONObject BoxDataCollectionSubmit2(JSONObject param) {
log.info("BoxDataCollectionSubmit2接口输入参数为-------------------" + param.toString());
String box_no = param.getString("box_no");
String box_weight = param.getString("box_weight");
if (StrUtil.isEmpty(box_no)) {
throw new BadRequestException("木箱号不能为空!");
}
if (StrUtil.isEmpty(box_weight)) {
throw new BadRequestException("木箱毛重不能为空!");
}
JSONObject result = new JSONObject();
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL2").getValue();
String api = "CamstarApi/BoxDataCollectionSubmit2";
url = url + api;
String UserName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
String Password = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
param.put("UserName", UserName);
param.put("Password", Password);
param.put("BoxContainerName", box_no);
param.put("BoxWeight", box_weight);
JSONArray rows = new JSONArray();
JSONObject row1 = new JSONObject();
row1.put("DataPointName","保护棉是否填充");
row1.put("DataType","7");
row1.put("DataValue","true");
row1.put("DataCollectionDefId","001c61800000004f");
row1.put("DataCollectionDefName","PACKAGE");
row1.put("DataCollectionDefName","PACKAGE");
rows.add(row1);
row1.put("DataPointName","信息核对准确");
rows.add(row1);
row1.put("DataPointName","木箱是否防护");
rows.add(row1);
param.put("DataPoints", rows);
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(param))
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("BoxDataCollectionSubmit2接口输出参数为-------------------" + result.toString());
String RTYPE = result.getString("RTYPE");
if ("E".equals(RTYPE)) {
throw new BadRequestException(result.getString("RTMSG"));
}
} catch (Exception e) {
throw new BadRequestException("MES提示错误" + e.getMessage());
}
return result;
}
public JSONObject getInspectionResult(JSONObject param) {
log.info("getInspectionResult接口输出参数为-------------------" + param.toString());
@@ -988,6 +1073,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(param))
.timeout(time_out)//超时时间,毫秒
.execute().body();
result = JSONObject.parseObject(resultMsg);
IpdmBiSubpackagerelationService subpackagerelationService = SpringContextHolder.getBean(IpdmBiSubpackagerelationService.class);