|
|
@@ -1,5 +1,6 @@ |
|
|
|
package com.mt.wms.empty.controller; |
|
|
|
|
|
|
|
import cn.hutool.core.date.LocalDateTimeUtil; |
|
|
|
import cn.hutool.http.HttpResponse; |
|
|
|
import cn.hutool.http.HttpUtil; |
|
|
|
import cn.hutool.json.JSON; |
|
|
@@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
/** |
|
|
@@ -40,6 +42,7 @@ public class ApmsController extends BaseController { |
|
|
|
private CommunicationLogServiceBiz communicationLogServiceBiz; |
|
|
|
|
|
|
|
static String Token = ""; |
|
|
|
static LocalDateTime TokenExpireTime = LocalDateTime.now(); |
|
|
|
static String ApiAddress = "http://59.110.171.25:9010"; |
|
|
|
|
|
|
|
@PostMapping(value = "apmsPostOrder") |
|
|
@@ -47,8 +50,9 @@ public class ApmsController extends BaseController { |
|
|
|
public R apmsPostOrder(@Validated @RequestBody OrderParamForApms apmsPostOrderParam) { |
|
|
|
CommunicationLog communicationLog = new CommunicationLog(); |
|
|
|
communicationLog.setCode("APMS" + System.currentTimeMillis()); |
|
|
|
communicationLog.setLogName("Wms接收Apms订单"); |
|
|
|
communicationLog.setLogName("WMS接收APMS订单"); |
|
|
|
communicationLog.setContent(apmsPostOrderParam.toString()); |
|
|
|
communicationLog.setType(3); |
|
|
|
setCommonField(communicationLog); |
|
|
|
communicationLogServiceBiz.save(communicationLog); |
|
|
|
return orderInfoService.apmsPostOrder(apmsPostOrderParam); |
|
|
@@ -60,6 +64,7 @@ public class ApmsController extends BaseController { |
|
|
|
CommunicationLog communicationLog = new CommunicationLog(); |
|
|
|
communicationLog.setCode("APMS" + System.currentTimeMillis()); |
|
|
|
communicationLog.setLogName("APMS作废订单"); |
|
|
|
communicationLog.setType(3); |
|
|
|
communicationLog.setContent(idenCardNum); |
|
|
|
setCommonField(communicationLog); |
|
|
|
communicationLogServiceBiz.save(communicationLog); |
|
|
@@ -67,19 +72,21 @@ public class ApmsController extends BaseController { |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping(value = "apmsCompleteOrder") |
|
|
|
@ApiOperation(value = "APMS完成订单") |
|
|
|
@ApiOperation(value = "APMS完成订单,返回加工单检验结果") |
|
|
|
public R apmsCompleteOrder(@Validated @RequestBody ApmsCompleteOrder apmsCompleteOrder) { |
|
|
|
CommunicationLog communicationLog = new CommunicationLog(); |
|
|
|
communicationLog.setCode("APMS" + System.currentTimeMillis()); |
|
|
|
communicationLog.setLogName("APMS完成订单"); |
|
|
|
communicationLog.setLogName("APMS完成订单,返回WMS加工单检验结果"); |
|
|
|
communicationLog.setType(3); |
|
|
|
communicationLog.setContent(apmsCompleteOrder.toString()); |
|
|
|
setCommonField(communicationLog); |
|
|
|
communicationLogServiceBiz.save(communicationLog); |
|
|
|
//APMS完成订单,返回检验结果,更新结果和后续处理 |
|
|
|
return orderInfoService.apmsCompleteOrder(apmsCompleteOrder); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping(value = "createProcessSheet") |
|
|
|
@ApiOperation(value = "APMS创建生产单接口") |
|
|
|
@ApiOperation(value = "通知APMS创建生产单接口") |
|
|
|
public R createProcessSheet(@Validated @RequestBody ApmsCreateProcessSheet apmsCreateProcess) { |
|
|
|
checkToken(); |
|
|
|
HashMap<String, Object> paramMap = new HashMap<>(); |
|
|
@@ -88,8 +95,9 @@ public class ApmsController extends BaseController { |
|
|
|
.header("token", Token).form(paramMap).execute(); |
|
|
|
CommunicationLog communicationLog = new CommunicationLog(); |
|
|
|
communicationLog.setCode("APMS" + System.currentTimeMillis()); |
|
|
|
communicationLog.setLogName("APMS创建生产单"); |
|
|
|
communicationLog.setContent(paramMap.toString()); |
|
|
|
communicationLog.setLogName("WMS通知APMS创建生产单"); |
|
|
|
communicationLog.setType(2); |
|
|
|
communicationLog.setContent("param:" + paramMap + "\nresult:" + response.body()); |
|
|
|
setCommonField(communicationLog); |
|
|
|
communicationLogServiceBiz.save(communicationLog); |
|
|
|
return successful(response); |
|
|
@@ -105,15 +113,16 @@ public class ApmsController extends BaseController { |
|
|
|
.header("token", Token).form(paramMap).execute(); |
|
|
|
CommunicationLog communicationLog = new CommunicationLog(); |
|
|
|
communicationLog.setCode("APMS" + System.currentTimeMillis()); |
|
|
|
communicationLog.setLogName("通知APMS生产单开始处理"); |
|
|
|
communicationLog.setContent(paramMap.toString()); |
|
|
|
communicationLog.setLogName("WMS通知APMS生产单开始处理"); |
|
|
|
communicationLog.setType(2); |
|
|
|
communicationLog.setContent("param:" + paramMap + "\nresult:" + response.body()); |
|
|
|
setCommonField(communicationLog); |
|
|
|
communicationLogServiceBiz.save(communicationLog); |
|
|
|
return successful(response); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping(value = "endProcess") |
|
|
|
@ApiOperation(value = "通知APMS订单结束处理") |
|
|
|
@ApiOperation(value = "通知APMS生产单结束处理") |
|
|
|
public R endProcess(@Validated @RequestBody ApmsEndProcess apmsEndProcess) { |
|
|
|
checkToken(); |
|
|
|
HashMap<String, Object> paramMap = new HashMap<>(); |
|
|
@@ -122,8 +131,9 @@ public class ApmsController extends BaseController { |
|
|
|
.header("token", Token).form(paramMap).execute(); |
|
|
|
CommunicationLog communicationLog = new CommunicationLog(); |
|
|
|
communicationLog.setCode("APMS" + System.currentTimeMillis()); |
|
|
|
communicationLog.setLogName("通知APMS订单结束处理"); |
|
|
|
communicationLog.setContent(paramMap.toString()); |
|
|
|
communicationLog.setLogName("WMS通知APMS生产单结束处理"); |
|
|
|
communicationLog.setType(2); |
|
|
|
communicationLog.setContent("param:" + paramMap + "\nresult:" + response.body()); |
|
|
|
setCommonField(communicationLog); |
|
|
|
communicationLogServiceBiz.save(communicationLog); |
|
|
|
return successful(response); |
|
|
@@ -139,8 +149,9 @@ public class ApmsController extends BaseController { |
|
|
|
.header("token", Token).form(paramMap).execute(); |
|
|
|
CommunicationLog communicationLog = new CommunicationLog(); |
|
|
|
communicationLog.setCode("APMS" + System.currentTimeMillis()); |
|
|
|
communicationLog.setLogName("通知APMS完成生产单接口"); |
|
|
|
communicationLog.setContent(paramMap.toString()); |
|
|
|
communicationLog.setLogName("WMS通知APMS完成生产单"); |
|
|
|
communicationLog.setType(2); |
|
|
|
communicationLog.setContent("param:" + paramMap + "\nresult:" + response.body()); |
|
|
|
setCommonField(communicationLog); |
|
|
|
communicationLogServiceBiz.save(communicationLog); |
|
|
|
return successful(response); |
|
|
@@ -155,11 +166,14 @@ public class ApmsController extends BaseController { |
|
|
|
String result = HttpUtil.get(ApiAddress + "/platform/api/getToken", paramMap); |
|
|
|
JSON parse = JSONUtil.parse(result); |
|
|
|
Object token = parse.getByPath("token"); |
|
|
|
String expireTime = parse.getByPath("expireTime").toString(); |
|
|
|
Token = token.toString(); |
|
|
|
TokenExpireTime = LocalDateTimeUtil.parse(expireTime); |
|
|
|
CommunicationLog communicationLog = new CommunicationLog(); |
|
|
|
communicationLog.setCode("APMS" + System.currentTimeMillis()); |
|
|
|
communicationLog.setLogName("获取APMS Token"); |
|
|
|
communicationLog.setContent(paramMap.toString()); |
|
|
|
communicationLog.setLogName("WMS获取APMS Token"); |
|
|
|
communicationLog.setType(2); |
|
|
|
communicationLog.setContent("param:" + paramMap + "\nresult:" + result); |
|
|
|
setCommonField(communicationLog); |
|
|
|
communicationLogServiceBiz.save(communicationLog); |
|
|
|
return successful(result); |
|
|
@@ -173,10 +187,12 @@ public class ApmsController extends BaseController { |
|
|
|
paramMap.put("workShopCode", workShopCode); |
|
|
|
HttpResponse response = HttpUtil.createGet(ApiAddress + "/platform/api/getStoveCodeByWorkShopCode") |
|
|
|
.header("token", Token).form(paramMap).execute(); |
|
|
|
System.out.println(response.body()); |
|
|
|
CommunicationLog communicationLog = new CommunicationLog(); |
|
|
|
communicationLog.setCode("APMS" + System.currentTimeMillis()); |
|
|
|
communicationLog.setLogName("APMS通过车间编码获取炉号信息"); |
|
|
|
communicationLog.setContent(paramMap.toString()); |
|
|
|
communicationLog.setType(2); |
|
|
|
communicationLog.setContent("param:" + paramMap + "\nresult:" + response.body()); |
|
|
|
setCommonField(communicationLog); |
|
|
|
communicationLogServiceBiz.save(communicationLog); |
|
|
|
return successful(response); |
|
|
@@ -187,5 +203,9 @@ public class ApmsController extends BaseController { |
|
|
|
{ |
|
|
|
getApmsToken(); |
|
|
|
} |
|
|
|
else if (TokenExpireTime.isBefore(LocalDateTime.now())) |
|
|
|
{ |
|
|
|
getApmsToken(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |