优化apms对接时发现的问题。

This commit is contained in:
徐晨晨 2022-01-05 08:36:13 +08:00
parent aac7b8c080
commit 962d47b308
4 changed files with 56 additions and 16 deletions

View File

@ -103,7 +103,7 @@ public class ApmsController extends BaseController {
* @return 删除结果 * @return 删除结果
*/ */
@PostMapping(value = "deleteBySheetNo") @PostMapping(value = "deleteBySheetNo")
@ApiOperation(value = "通知APMS删除生产单", hidden = true) @ApiOperation(value = "通知APMS删除生产单", hidden = false)
public R<ApmsEndProcessVo> deleteBySheetNo(@Validated @RequestBody String sheetNo) { public R<ApmsEndProcessVo> deleteBySheetNo(@Validated @RequestBody String sheetNo) {
checkToken(); checkToken();
HashMap<String, Object> paramMap = new HashMap<>(); HashMap<String, Object> paramMap = new HashMap<>();
@ -121,12 +121,13 @@ public class ApmsController extends BaseController {
} }
@PostMapping(value = "createProcessSheet") @PostMapping(value = "createProcessSheet")
@ApiOperation(value = "通知APMS创建生产单接口", hidden = true) @ApiOperation(value = "通知APMS创建生产单接口", hidden = false)
public R<ApmsCreateProcessSheetVo> createProcessSheet(@Validated @RequestBody ApmsCreateProcessSheet apmsCreateProcess) { public R<ApmsCreateProcessSheetVo> createProcessSheet(@Validated @RequestBody ApmsCreateProcessSheet apmsCreateProcess) {
checkToken(); checkToken();
String paramJson = JSONUtil.toJsonStr(apmsCreateProcess); String paramJson = JSONUtil.toJsonStr(apmsCreateProcess);
HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/createProcessSheet") HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/createProcessSheet")
.header("token", Token).body(paramJson, ContentType.JSON.toString()).execute(); .header("token", Token).body(paramJson, ContentType.JSON.toString()).execute();
int status = response.getStatus();
CommunicationLog communicationLog = new CommunicationLog(); CommunicationLog communicationLog = new CommunicationLog();
communicationLog.setCode("APMS" + System.currentTimeMillis()); communicationLog.setCode("APMS" + System.currentTimeMillis());
communicationLog.setLogName("WMS通知APMS创建生产单"); communicationLog.setLogName("WMS通知APMS创建生产单");
@ -134,16 +135,24 @@ public class ApmsController extends BaseController {
communicationLog.setContent("param:" + paramJson + "\nresult:" + response.body()); communicationLog.setContent("param:" + paramJson + "\nresult:" + response.body());
setCommonField(communicationLog); setCommonField(communicationLog);
communicationLogServiceBiz.save(communicationLog); communicationLogServiceBiz.save(communicationLog);
if (status == 200)
{
return successful(JSONUtil.toBean(response.body(), ApmsCreateProcessSheetVo.class)); return successful(JSONUtil.toBean(response.body(), ApmsCreateProcessSheetVo.class));
} }
else
{
return failed(status, response.body());
}
}
@PostMapping(value = "startProcess") @PostMapping(value = "startProcess")
@ApiOperation(value = "通知APMS生产单开始处理", hidden = true) @ApiOperation(value = "通知APMS生产单开始处理", hidden = false)
public R<ApmsStartProcess> startProcess(@Validated @RequestBody ApmsStartProcess apmsStartProcess) { public R<ApmsStartProcess> startProcess(@Validated @RequestBody ApmsStartProcess apmsStartProcess) {
checkToken(); checkToken();
String paramJson = JSONUtil.toJsonStr(apmsStartProcess); String paramJson = JSONUtil.toJsonStr(apmsStartProcess);
HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/startProcess") HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/startProcess")
.header("token", Token).body(paramJson, ContentType.JSON.toString()).execute(); .header("token", Token).body(paramJson, ContentType.JSON.toString()).execute();
int status = response.getStatus();
CommunicationLog communicationLog = new CommunicationLog(); CommunicationLog communicationLog = new CommunicationLog();
communicationLog.setCode("APMS" + System.currentTimeMillis()); communicationLog.setCode("APMS" + System.currentTimeMillis());
communicationLog.setLogName("WMS通知APMS生产单开始处理"); communicationLog.setLogName("WMS通知APMS生产单开始处理");
@ -151,16 +160,24 @@ public class ApmsController extends BaseController {
communicationLog.setContent("param:" + paramJson + "\nresult:" + response.body()); communicationLog.setContent("param:" + paramJson + "\nresult:" + response.body());
setCommonField(communicationLog); setCommonField(communicationLog);
communicationLogServiceBiz.save(communicationLog); communicationLogServiceBiz.save(communicationLog);
if (status == 200)
{
return successful(JSONUtil.toBean(response.body(), ApmsStartProcess.class)); return successful(JSONUtil.toBean(response.body(), ApmsStartProcess.class));
} }
else
{
return failed(status, response.body());
}
}
@PostMapping(value = "endProcess") @PostMapping(value = "endProcess")
@ApiOperation(value = "通知APMS生产单结束处理", hidden = true) @ApiOperation(value = "通知APMS生产单结束处理", hidden = false)
public R<ApmsEndProcessVo> endProcess(@Validated @RequestBody ApmsEndProcess apmsEndProcess) { public R<ApmsEndProcessVo> endProcess(@Validated @RequestBody ApmsEndProcess apmsEndProcess) {
checkToken(); checkToken();
String paramJson = JSONUtil.toJsonStr(apmsEndProcess); String paramJson = JSONUtil.toJsonStr(apmsEndProcess);
HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/endProcess") HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/endProcess")
.header("token", Token).body(paramJson, ContentType.JSON.toString()).execute(); .header("token", Token).body(paramJson, ContentType.JSON.toString()).execute();
int status = response.getStatus();
CommunicationLog communicationLog = new CommunicationLog(); CommunicationLog communicationLog = new CommunicationLog();
communicationLog.setCode("APMS" + System.currentTimeMillis()); communicationLog.setCode("APMS" + System.currentTimeMillis());
communicationLog.setLogName("WMS通知APMS生产单结束处理"); communicationLog.setLogName("WMS通知APMS生产单结束处理");
@ -168,16 +185,24 @@ public class ApmsController extends BaseController {
communicationLog.setContent("param:" + paramJson + "\nresult:" + response.body()); communicationLog.setContent("param:" + paramJson + "\nresult:" + response.body());
setCommonField(communicationLog); setCommonField(communicationLog);
communicationLogServiceBiz.save(communicationLog); communicationLogServiceBiz.save(communicationLog);
if (status == 200)
{
return successful(JSONUtil.toBean(response.body(), ApmsEndProcessVo.class)); return successful(JSONUtil.toBean(response.body(), ApmsEndProcessVo.class));
} }
else
{
return failed(status, response.body());
}
}
@PostMapping(value = "finishProcessSheet") @PostMapping(value = "finishProcessSheet")
@ApiOperation(value = "通知APMS完成生产单接口", hidden = true) @ApiOperation(value = "通知APMS完成生产单接口", hidden = false)
public R<ApmsFinishProcessSheetVo> finishProcessSheet(@Validated @RequestBody ApmsFinishProcessSheet apmsFinishProcessSheet) { public R<ApmsFinishProcessSheetVo> finishProcessSheet(@Validated @RequestBody ApmsFinishProcessSheet apmsFinishProcessSheet) {
checkToken(); checkToken();
String paramJson = JSONUtil.toJsonStr(apmsFinishProcessSheet); String paramJson = JSONUtil.toJsonStr(apmsFinishProcessSheet);
HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/finishProcessSheet") HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/finishProcessSheet")
.header("token", Token).body(paramJson, ContentType.JSON.toString()).execute(); .header("token", Token).body(paramJson, ContentType.JSON.toString()).execute();
int status = response.getStatus();
CommunicationLog communicationLog = new CommunicationLog(); CommunicationLog communicationLog = new CommunicationLog();
communicationLog.setCode("APMS" + System.currentTimeMillis()); communicationLog.setCode("APMS" + System.currentTimeMillis());
communicationLog.setLogName("WMS通知APMS完成生产单"); communicationLog.setLogName("WMS通知APMS完成生产单");
@ -185,8 +210,15 @@ public class ApmsController extends BaseController {
communicationLog.setContent("param:" + paramJson + "\nresult:" + response.body()); communicationLog.setContent("param:" + paramJson + "\nresult:" + response.body());
setCommonField(communicationLog); setCommonField(communicationLog);
communicationLogServiceBiz.save(communicationLog); communicationLogServiceBiz.save(communicationLog);
if (status == 200)
{
return successful(JSONUtil.toBean(response.body(), ApmsFinishProcessSheetVo.class)); return successful(JSONUtil.toBean(response.body(), ApmsFinishProcessSheetVo.class));
} }
else
{
return failed(status, response.body());
}
}
@PostMapping(value = "getApmsToken") @PostMapping(value = "getApmsToken")
@ApiOperation(value = "获取APMS Token", hidden = true) @ApiOperation(value = "获取APMS Token", hidden = true)
@ -211,13 +243,14 @@ public class ApmsController extends BaseController {
} }
@PostMapping(value = "getStoveCodeByWorkShopCode") @PostMapping(value = "getStoveCodeByWorkShopCode")
@ApiOperation(value = "WMS通过APMS使用车间编码获取炉号信息", hidden = true) @ApiOperation(value = "WMS通过APMS使用车间编码获取炉号信息", hidden = false)
public R<ApmsStoveVo> getStoveCodeByWorkShopCode(String workShopCode) { public R<ApmsStoveVo> getStoveCodeByWorkShopCode(String workShopCode) {
checkToken(); checkToken();
HashMap<String, Object> paramMap = new HashMap<>(); HashMap<String, Object> paramMap = new HashMap<>();
paramMap.put("workShopCode", workShopCode); paramMap.put("workShopCode", workShopCode);
HttpResponse response = HttpUtil.createGet(ApiAddress + "/platform/api/getStoveCodeByWorkShopCode") HttpResponse response = HttpUtil.createGet(ApiAddress + "/platform/api/getStoveCodeByWorkShopCode")
.header("token", Token).form(paramMap).execute(); .header("token", Token).form(paramMap).execute();
int status = response.getStatus();
CommunicationLog communicationLog = new CommunicationLog(); CommunicationLog communicationLog = new CommunicationLog();
communicationLog.setCode("APMS" + System.currentTimeMillis()); communicationLog.setCode("APMS" + System.currentTimeMillis());
communicationLog.setLogName("WMS通过APMS使用车间编码获取炉号信息"); communicationLog.setLogName("WMS通过APMS使用车间编码获取炉号信息");
@ -225,8 +258,15 @@ public class ApmsController extends BaseController {
communicationLog.setContent("param:" + paramMap + "\nresult:" + response.body()); communicationLog.setContent("param:" + paramMap + "\nresult:" + response.body());
setCommonField(communicationLog); setCommonField(communicationLog);
communicationLogServiceBiz.save(communicationLog); communicationLogServiceBiz.save(communicationLog);
if (status == 200)
{
return successful(JSONUtil.toBean(response.body(), ApmsStoveVo.class)); return successful(JSONUtil.toBean(response.body(), ApmsStoveVo.class));
} }
else
{
return failed(status, response.body());
}
}
private void checkToken() { private void checkToken() {
if (Token.isEmpty()) if (Token.isEmpty())

View File

@ -27,10 +27,10 @@ public class ApmsFinishProcessSheet extends BaseParam {
@ApiModelProperty(value = "完成加工人:为APMS账号", required = true) @ApiModelProperty(value = "完成加工人:为APMS账号", required = true)
private String endUser; private String endUser;
@ApiModelProperty(value = "配炉号", required = true)
private String stoveCode;
@ApiModelProperty(value = "备注", required = false) @ApiModelProperty(value = "备注", required = false)
private String remark; private String remark;
@ApiModelProperty(value = "生产单号", required = false)
private String sheetNo;
} }

View File

@ -29,6 +29,6 @@ public class ApmsStartProcess extends BaseParam {
private String stoveCode; private String stoveCode;
@ApiModelProperty(value = "工艺号", required = false) @ApiModelProperty(value = "工艺号", required = false)
private String techCode; private String techName;
} }

View File

@ -10,7 +10,7 @@ import lombok.experimental.Accessors;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Accessors(chain = true) @Accessors(chain = true)
@ApiModel(value = "Apms生产单详细", description = "Apms生产单详细") @ApiModel(value = "Apms生产单结束详细", description = "Apms生产单结束详细")
public class FinishItem extends BaseParam { public class FinishItem extends BaseParam {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "标识卡号", required = true) @ApiModelProperty(value = "标识卡号", required = true)