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

This commit is contained in:
徐晨晨 2021-12-29 08:53:35 +08:00
parent 59e480ad6a
commit 0a34af7c00
3 changed files with 46 additions and 11 deletions

View File

@ -58,24 +58,27 @@ public class ApmsController extends BaseController {
CommunicationLog communicationLog = new CommunicationLog();
communicationLog.setCode("APMS" + System.currentTimeMillis());
communicationLog.setLogName("WMS接收APMS推送订单信息");
communicationLog.setContent(apmsPostOrderParam.toString());
communicationLog.setType(3);
setCommonField(communicationLog);
R<String> stringR = orderInfoService.apmsPostOrder(apmsPostOrderParam);
communicationLog.setContent("param:" + apmsPostOrderParam.toString() + "\nresult:" + stringR.toString());
communicationLogServiceBiz.save(communicationLog);
return orderInfoService.apmsPostOrder(apmsPostOrderParam);
return stringR;
}
@PostMapping(value = "apmsVoidOrder")
@ApiOperation(value = "WMS接收APMS作废订单信息")
public R<String> apmsVoidOrder(@Validated @RequestBody String idenCardNum) {
public R<String> apmsVoidOrder(@Validated @RequestBody Iden idenCardNum) {
//todo 改动为json值
CommunicationLog communicationLog = new CommunicationLog();
communicationLog.setCode("APMS" + System.currentTimeMillis());
communicationLog.setLogName("WMS接收APMS作废订单信息");
communicationLog.setType(3);
communicationLog.setContent(idenCardNum);
setCommonField(communicationLog);
R<String> stringR = orderInfoService.apmsVoidOrder(idenCardNum.getIdenCardNum());
communicationLog.setContent("param:" + idenCardNum + "\nresult:" + stringR.toString());
communicationLogServiceBiz.save(communicationLog);
return orderInfoService.apmsVoidOrder(idenCardNum);
return stringR;
}
@PostMapping(value = "apmsCompleteOrder")
@ -85,11 +88,12 @@ public class ApmsController extends BaseController {
communicationLog.setCode("APMS" + System.currentTimeMillis());
communicationLog.setLogName("WMS接收APMS加工单检验结果");
communicationLog.setType(3);
communicationLog.setContent(apmsCompleteOrder.toString());
setCommonField(communicationLog);
communicationLogServiceBiz.save(communicationLog);
//APMS完成订单,返回检验结果更新结果和后续处理
return orderInfoService.apmsCompleteOrder(apmsCompleteOrder);
R<String> stringR = orderInfoService.apmsCompleteOrder(apmsCompleteOrder);
communicationLog.setContent("param:" + apmsCompleteOrder + "\nresult:" + stringR.toString());
communicationLogServiceBiz.save(communicationLog);
return stringR;
}

View File

@ -0,0 +1,18 @@
package com.mt.wms.empty.params;
import com.mt.wms.core.base.BaseParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "Apms作废生产单", description = "Apms作废生产单")
public class Iden extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "标识卡号", required = true)
private String idenCardNum;
}

View File

@ -95,6 +95,12 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
//设定来源信息为apms
orderInfo.setOrderSource(OrderSourceEnum.APMS.getValue());
orderInfo.setInterCode(IDGenerator.gen("DD", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "ORDER_CODE"));
//检查是否为重复的单号
OrderInfo one = orderInfoService.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.ORDER_NO, apmsPostOrderParam.getOrderNo()).eq(OrderInfo.IDEN_CARD_NUM, apmsPostOrderParam.getIdenCardNum()));
if (one != null)
{
return failed("操作失败,接收到重复订单信息:" + apmsPostOrderParam.getOrderNo());
}
orderInfoService.save(orderInfo);
return successful("Wms接收Apms订单成功。");
}
@ -249,22 +255,29 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
byId.setInterCode(IDGenerator.gen("DDHIS", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "ORDER_HIS_CODE"));
setCommonField(byId);
orderInfoHisService.save(byId);
return successful("成功,订单状态置为完成。");
return successful("操作成功,订单状态置为完成。");
}
@Override
public R<String> voidOrder(IdParam idParam) {
OrderInfo byId = orderInfoService.getById(idParam.getId());
Assert.notNull("未找到订单信息。", byId);
if (byId.getOrderVoid() == 0)
{
return failed("操作失败,该订单已经处于作废状态。");
}
byId.setUpdateTime(LocalDateTime.now());
byId.setOrderVoid(0);
orderInfoService.updateById(byId);
return successful("成功,订单状态置为作废。");
return successful("操作成功,订单状态置为作废。");
}
@Override
public R<String> apmsVoidOrder(String idenCardNum) {
OrderInfo byId = orderInfoService.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM, idenCardNum));
if (byId == null)
{
return failed("未找到该标识卡:" + idenCardNum + "下的订单信息!");
}
//确定是否有订单在生产
List<CurrTaskDet> taskDetailsByIdenCardNum = currTaskDetService.getTaskDetailsByIdenCardNum(idenCardNum);
if (taskDetailsByIdenCardNum.size() > 0)