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

This commit is contained in:
徐晨晨 2021-12-30 10:13:47 +08:00
parent 2ce5380397
commit aac7b8c080
2 changed files with 90 additions and 26 deletions

View File

@ -15,7 +15,7 @@ import java.time.LocalDateTime;
* </p>
*
* @author mt
* @since 2021-11-19
* @since 2021-12-29
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ -94,7 +94,31 @@ public class ApmsCheckResult extends Model<ApmsCheckResult> {
* 心部硬度检验值
*/
@TableField("heart_hardness")
private Float heartHardness;
private String heartHardness;
/**
* 备注特殊注释等
*/
@TableField("remake")
private String remake;
/**
* 硬度检验结果1
*/
@TableField("hardness_value_one")
private String hardnessValueOne;
/**
* 硬度检验结果2
*/
@TableField("hardness_value_two")
private String hardnessValueTwo;
/**
* 硬度检验结果3
*/
@TableField("hardness_value_three")
private String hardnessValueThree;
public static final String ID = "id";
@ -121,6 +145,14 @@ public class ApmsCheckResult extends Model<ApmsCheckResult> {
public static final String HEART_HARDNESS = "heart_hardness";
public static final String REMAKE = "remake";
public static final String HARDNESS_VALUE_ONE = "hardness_value_one";
public static final String HARDNESS_VALUE_TWO = "hardness_value_two";
public static final String HARDNESS_VALUE_THREE = "hardness_value_three";
@Override
protected Serializable pkVal() {
return this.id;

View File

@ -30,6 +30,7 @@ import com.mt.wms.empty.vo.CurrTaskVo;
import com.mt.wms.empty.vo.OrderInfoTaskDetVo;
import com.mt.wms.empty.vo.OrderInfoVo;
import org.apache.commons.lang.StringUtils;
import org.apache.ibatis.exceptions.TooManyResultsException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -99,10 +100,10 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
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());
return failed(1, "操作失败,接收到重复订单信息:" + apmsPostOrderParam.getOrderNo());
}
orderInfoService.save(orderInfo);
return successful("Wms接收Apms订单成功。");
return successful("Wms接收Apms订单成功。", "");
}
@Override
@ -135,7 +136,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
orderInfo.setOrderSource(OrderSourceEnum.PERSON.getValue());
orderInfo.setInterCode("PERSONAL" + System.currentTimeMillis());
orderInfoService.save(orderInfo);
return successful("人工创建订单成功。");
return successful("人工创建订单成功。", "");
}
@Override
@ -261,28 +262,33 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
@Override
public R<String> voidOrder(IdParam idParam) {
OrderInfo byId = orderInfoService.getById(idParam.getId());
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));
OrderInfo byId = null;
try
{
byId = orderInfoService.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM, idenCardNum));
}
catch (TooManyResultsException e)
{
e.printStackTrace();
return failed(4, "操作失败,数据库存在重复订单!");
}
if (byId == null)
{
return failed("未找到该标识卡:" + idenCardNum + "下的订单信息!");
return failed(3, "未找到该标识卡:" + idenCardNum + "下的订单信息!");
}
//确定是否有订单在生产
List<CurrTaskDet> taskDetailsByIdenCardNum = currTaskDetService.getTaskDetailsByIdenCardNum(idenCardNum);
if (taskDetailsByIdenCardNum.size() > 0)
{
return failed("操作失败,已经存在生产中的任务单。");
return failed(2, "操作失败,已经存在生产中的任务单。");
}
else
{
@ -292,18 +298,44 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
@Override
public R<String> apmsCompleteOrder(ApmsCompleteOrder apmsCompleteOrder) {
//通过标识卡号与生产单号进行更新检验结果
ApmsCheckResult one = new ApmsCheckResult();
one.setIdenCardNum(apmsCompleteOrder.getIdenCardNum());
one.setSheetNo(apmsCompleteOrder.getSheetNo());
one.setCreateTime(LocalDateTime.now());
one.setValid(WhetherEnum.YES.getValue());
one.setMetallography(apmsCompleteOrder.getMetallographic());
one.setHeartHardness(apmsCompleteOrder.getHeartHardness());
one.setHardness(apmsCompleteOrder.getHardness());
one.setUpdateTime(LocalDateTime.now());
apmsCheckResultServiceBiz.save(one);
//订单不应该在该地方完成额外提供一个完成接口供人工完成不通知apms
return successful("接收检验结果成功。");
ApmsCheckResult one1 = apmsCheckResultServiceBiz.getOne(new QueryWrapper<ApmsCheckResult>().eq(ApmsCheckResult.IDEN_CARD_NUM, apmsCompleteOrder.getIdenCardNum()).eq(ApmsCheckResult.SHEET_NO, apmsCompleteOrder.getSheetNo()));
if (one1 == null)
{
//通过标识卡号与生产单号进行检验结果存储
ApmsCheckResult one = new ApmsCheckResult();
one.setIdenCardNum(apmsCompleteOrder.getIdenCardNum());
one.setSheetNo(apmsCompleteOrder.getSheetNo());
one.setCreateTime(LocalDateTime.now());
one.setValid(WhetherEnum.YES.getValue());
one.setMetallography(apmsCompleteOrder.getMetallographic());
one.setHeartHardness(apmsCompleteOrder.getHeartHardness());
one.setHardnessValueOne(apmsCompleteOrder.getHardnessValueOne());
one.setHardnessValueTwo(apmsCompleteOrder.getHardnessValueTwo());
one.setHardnessValueThree(apmsCompleteOrder.getHardnessValueThree());
one.setHardness(apmsCompleteOrder.getHardness());
one.setUpdateTime(LocalDateTime.now());
one.setRemake(apmsCompleteOrder.getRemake());
apmsCheckResultServiceBiz.save(one);
//订单不应该在该地方完成额外提供一个完成接口供人工完成不通知apms
return successful("操作成功,接收检验结果完成。", "");
}
else
{
//存在检验结果更新的情况主管或其他人员可能会更改结果
one1.setIdenCardNum(apmsCompleteOrder.getIdenCardNum());
one1.setSheetNo(apmsCompleteOrder.getSheetNo());
one1.setValid(WhetherEnum.YES.getValue());
one1.setMetallography(apmsCompleteOrder.getMetallographic());
one1.setHeartHardness(apmsCompleteOrder.getHeartHardness());
one1.setHardnessValueOne(apmsCompleteOrder.getHardnessValueOne());
one1.setHardnessValueTwo(apmsCompleteOrder.getHardnessValueTwo());
one1.setHardnessValueThree(apmsCompleteOrder.getHardnessValueThree());
one1.setHardness(apmsCompleteOrder.getHardness());
one1.setUpdateTime(LocalDateTime.now());
one1.setRemake(apmsCompleteOrder.getRemake());
apmsCheckResultServiceBiz.updateById(one1);
return successful("操作成功,更新检验结果完成。", "");
}
}
}