opt:EAS同步采购单,如果单据存在并且已创建状态,则删除重新插入
This commit is contained in:
@@ -2,6 +2,7 @@ package org.nl.wms.ext_manage.purchase.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.ext_manage.service.WmsToZDWmdService;
|
||||
@@ -44,9 +45,19 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
||||
throw new BadRequestException("EAS采购单同步失败:EAS系统中未找到单据: " + billId);
|
||||
}
|
||||
|
||||
Purchasemst existing = purchasemstMapper.selectById(billId);
|
||||
Purchasemst existing = purchasemstMapper.selectOne(new LambdaQueryWrapper<Purchasemst>()
|
||||
.eq(Purchasemst::getBill_id, billId));
|
||||
if (existing != null) {
|
||||
throw new BadRequestException("EAS采购单同步失败:单据已存在: " + billId);
|
||||
if (!existing.getBill_status().equals(PurchaseBillStatus.CREATED.getCode())){
|
||||
throw new BadRequestException("EAS采购单同步失败:该单据正在执行或已完成: " + billId);
|
||||
}else {
|
||||
//单据还未执行则删除重新插入单据
|
||||
purchasedtlMapper.delete(new LambdaQueryWrapper<Purchasedtl>()
|
||||
.eq(Purchasedtl::getBill_id, existing.getBill_id()));
|
||||
purchasemstMapper.delete(new LambdaQueryWrapper<Purchasemst>()
|
||||
.eq(Purchasemst::getBill_id, existing.getBill_id()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
List<Purchasedtl> easDtlList = easQueryService.queryDtlList(billId);
|
||||
@@ -65,9 +76,6 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
||||
}
|
||||
|
||||
log.info("EAS采购入库单同步完成, billId: {}, 明细数: {}", billId, easDtlList.size());
|
||||
|
||||
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", 200);
|
||||
result.put("message", "同步成功");
|
||||
|
||||
Reference in New Issue
Block a user