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

View File

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

View File

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

View File

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