commit message:```

优化销售订单匹配与异常处理

在销售订单匹配流程中,启用更有效的订单查询逻辑,并对异常情况进行增强处理。移除不必要的注释,并清理可能导致主键长度异常的代码。此外,引入新的时间参数验证步骤,以确保处理时间范围的有效性。
```
This commit is contained in:
liuy 2024-09-13 10:55:08 +08:00
parent 0b3e56af0a
commit a321983610
8 changed files with 541 additions and 168 deletions

View File

@ -805,8 +805,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
// saleorderRequestChildrenDto.setNoriginalcurtaxnetprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税净价 // saleorderRequestChildrenDto.setNoriginalcurtaxnetprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税净价
saleorderRequestChildrenDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价 saleorderRequestChildrenDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价
saleorderRequestChildrenDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率 saleorderRequestChildrenDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率
//TODO 2024年8月30日 10:52:55 抛出异常pk_defxxx长度不够的问题已经提交给总部 //2024年8月30日 10:52:55 抛出异常pk_defxxx长度不够的问题已经提交给总部
// saleorderRequestChildrenDto.setVdef19(header.getCode());//原单单号 saleorderRequestChildrenDto.setVdef19(header.getCode());//原单单号
saleorderRequestChildrenDto.setVdef20(detailsDto.getId());//原单明细主键 saleorderRequestChildrenDto.setVdef20(detailsDto.getId());//原单明细主键
saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto); saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto);
} }
@ -2445,40 +2445,40 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
* *
* @param headerDetailsDtoList OFS销售出库单 * @param headerDetailsDtoList OFS销售出库单
*/ */
private List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> queryOfsOrder(List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList) throws Exception { // private List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> queryOfsOrder(List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList) throws Exception {
List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> allHeaderDetailsDtoArrayList = new ArrayList<>(); // List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> allHeaderDetailsDtoArrayList = new ArrayList<>();
try { // try {
if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { // if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) {
List<List<HeaderDetailsDto>> splitListByCount = SplitListByCountUtil.splitListByCount(headerDetailsDtoList, 100); // List<List<HeaderDetailsDto>> splitListByCount = SplitListByCountUtil.splitListByCount(headerDetailsDtoList, 100);
for (int i = 0; i < splitListByCount.size(); i++) { // for (int i = 0; i < splitListByCount.size(); i++) {
List<HeaderDetailsDto> headerDetailsDtos = splitListByCount.get(i); // List<HeaderDetailsDto> headerDetailsDtos = splitListByCount.get(i);
//
StringBuffer stringBuffer = new StringBuffer(); // StringBuffer stringBuffer = new StringBuffer();
if (headerDetailsDtos != null && headerDetailsDtos.size() > 0) { // if (headerDetailsDtos != null && headerDetailsDtos.size() > 0) {
for (int j = 0; j < headerDetailsDtos.size(); j++) { // for (int j = 0; j < headerDetailsDtos.size(); j++) {
HeaderDetailsDto headerDetailsDto = headerDetailsDtos.get(j); // HeaderDetailsDto headerDetailsDto = headerDetailsDtos.get(j);
HeaderDto header = headerDetailsDto.getHeader(); // HeaderDto header = headerDetailsDto.getHeader();
// List<DetailsDto> details = headerDetailsDto.getDetails(); //// List<DetailsDto> details = headerDetailsDto.getDetails();
// stringBuffer.append("'"); //// stringBuffer.append("'");
stringBuffer.append(header.getRefOrderCode()); // stringBuffer.append(header.getRefOrderCode());
// stringBuffer.append("'"); //// stringBuffer.append("'");
stringBuffer.append(","); // stringBuffer.append(",");
} // }
} // }
String substring = stringBuffer.substring(0, stringBuffer.length()); // String substring = stringBuffer.substring(0, stringBuffer.length());
//
List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> headerDetailsDtoArrayList = new ArrayList<>(); // List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> headerDetailsDtoArrayList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); // QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setCode(substring); // queryOfsSoSaleOutVo.setCode(substring);
ofsStandardUtil.getOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoArrayList, 1L); // ofsStandardUtil.getOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoArrayList, 1L);
allHeaderDetailsDtoArrayList.addAll(headerDetailsDtoArrayList); // allHeaderDetailsDtoArrayList.addAll(headerDetailsDtoArrayList);
} // }
} // }
} catch (Exception e) { // } catch (Exception e) {
logger.error("queryOfsOrder方法抛出异常", e); // logger.error("queryOfsOrder方法抛出异常", e);
} // }
return allHeaderDetailsDtoArrayList; // return allHeaderDetailsDtoArrayList;
} // }
/** /**
* 代码匹配销售订单 * 代码匹配销售订单

View File

@ -272,6 +272,9 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
@Override @Override
public void run() { public void run() {
try { try {
Assert.notNull(startTime, "startTime不能为空");
Assert.notNull(endTime, "end不能为空");
//生成一个时间范围 //生成一个时间范围
// StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); // StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
//2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性 //2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性

View File

@ -17,6 +17,7 @@ import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsDetailedEntity;
import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsEntity; import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsEntity;
import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutDetailedEntity; import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutDetailedEntity;
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
import com.hzya.frame.plugin.lets.resultvo.CacheTocMapVoV2;
import com.hzya.frame.plugin.lets.resultvo.CalculateDateVo; import com.hzya.frame.plugin.lets.resultvo.CalculateDateVo;
import com.hzya.frame.plugin.lets.u8cdto.*; import com.hzya.frame.plugin.lets.u8cdto.*;
import com.hzya.frame.plugin.lets.util.*; import com.hzya.frame.plugin.lets.util.*;
@ -29,6 +30,7 @@ import com.hzya.frame.ttxofs.dto.returngoodordersearch.RerturnGoodsOrderSearchDe
import com.hzya.frame.ttxofs.dto.returngoodordersearch.RerturnGoodsOrderSearchHeader; import com.hzya.frame.ttxofs.dto.returngoodordersearch.RerturnGoodsOrderSearchHeader;
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse; import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
import com.hzya.frame.ttxofs.service.OfsUnifiedService; import com.hzya.frame.ttxofs.service.OfsUnifiedService;
import com.hzya.frame.u8c.ax.entity.Ass;
import com.hzya.frame.web.entity.JsonResultEntity; import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -118,26 +120,30 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
private RdclUtil rdclUtil; private RdclUtil rdclUtil;
/** /**
* 按指定时间拉取 * 根据指定时间范围拉群
* *
* @author liuyang * @author liuyang
*/ */
public void startImplement(String dateStr, String summaryOrderNumber) { public void startImplementStockByTime(String startTime, String endTime) {
String threadNameStr = StrUtil.format("OFS销售出库(TOC)同步U8C销售订单 同步日期:{} 汇总维度:{}", dateStr, summaryOrderNumber); long startMillis = System.currentTimeMillis();
logger.info(threadNameStr); String threadNameStrStart = StrUtil.format("开始-OFS销售出库(TOC)同步U8C销售订单 开始时间:{} 结束时间:{}", startTime, endTime);
logger.info(threadNameStrStart);
Thread thread = new Thread(new Runnable() { Thread thread = new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
LOCK.lock(); LOCK.lock();
try { try {
Assert.notNull(startTime, "开始时间不能为空");
Assert.notNull(endTime, "结束时间不能为空");
String tocShop = shopTobOrToCUtil.getCommaShop("TOC"); String tocShop = shopTobOrToCUtil.getCommaShop("TOC");
CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr); // CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr);
List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setCreated_start(calculateDateVo.getStart_time()); queryOfsSoSaleOutVo.setCreated_start(startTime);
queryOfsSoSaleOutVo.setCreated_end(calculateDateVo.getEnd_time()); queryOfsSoSaleOutVo.setCreated_end(endTime);
queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
//2024年8月22日 14:02:13 已经和O确认这个字段取消传递 //2024年8月22日 14:02:13 已经和O确认这个字段取消传递
@ -149,38 +155,43 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
queryOfsSoSaleOutVo.setInternalInstructionType("RETURN"); queryOfsSoSaleOutVo.setInternalInstructionType("RETURN");
// queryOfsSoSaleOutVo.setCode("LETS-RE2024071600000001"); // queryOfsSoSaleOutVo.setCode("LETS-RE2024071600000001");
ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search");
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); logger.info("TOC退货数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size());
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
getSet(returnGoodHeaderDetailsDataDtoArrayList); getSetStock(returnGoodHeaderDetailsDataDtoArrayList);
} else { } else {
logger.info("没有查询到任何数据!不需要同步"); logger.info("没有查询到任何数据!不需要同步");
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("startImplement方法抛出异常", e); logger.error("startImplement方法抛出异常", e);
} finally { } finally {
try { // try {
tocReturnBasicArchivesCacheUtil.clearCache(); // tocReturnBasicArchivesCacheUtil.clearCache();
} catch (Exception e) { // } catch (Exception e) {
logger.info("清理档案缓存失败", e); // logger.info("清理档案缓存失败", e);
} // }
LOCK.unlock(); LOCK.unlock();
} }
} }
}, threadNameStr); }, threadNameStrStart);
thread.start(); thread.start();
try { try {
thread.join(); thread.join();
} catch (Exception e) { } catch (Exception e) {
logger.error("thread.join()异常", e); logger.error("thread.join()异常", e);
} }
long endMillis = System.currentTimeMillis();
String threadNameStrEnd = StrUtil.format("结束-OFS销售出库(TOC)同步U8C销售订单 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis));
logger.info(threadNameStrEnd);
} }
/** /**
* 按指定时间拉取 * 按指定时间拉取
* *
* @param code 编码
* @param sceneType 场景类型
* @author liuyang * @author liuyang
*/ */
public void startImplement(String code) { public void startImplementByCode(String code, String sceneType) {
String threadNameStr = StrUtil.format("OFS销售出库(TOC)同步U8C销售订单 同步单据号:{}", code); String threadNameStr = StrUtil.format("OFS销售出库(TOC)同步U8C销售订单 同步单据号:{}", code);
logger.info(threadNameStr); logger.info(threadNameStr);
@ -204,18 +215,18 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoList, 1L, "ofs.receipt.search"); ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoList, 1L, "ofs.receipt.search");
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoList.size()); logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoList.size());
if (returnGoodHeaderDetailsDataDtoList.size() > 0) { if (returnGoodHeaderDetailsDataDtoList.size() > 0) {
getSet(returnGoodHeaderDetailsDataDtoList); getSetStock(returnGoodHeaderDetailsDataDtoList);
} else { } else {
logger.info("没有查询到任何数据!不需要同步"); logger.info("没有查询到任何数据!不需要同步");
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("startImplement方法抛出异常", e); logger.error("startImplement方法抛出异常", e);
} finally { } finally {
try { // try {
tocReturnBasicArchivesCacheUtil.clearCache(); // tocReturnBasicArchivesCacheUtil.clearCache();
} catch (Exception e) { // } catch (Exception e) {
logger.info("清理档案缓存失败", e); // logger.info("清理档案缓存失败", e);
} // }
LOCK.unlock(); LOCK.unlock();
} }
} }
@ -228,18 +239,87 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
} }
} }
/**
* 库存同步按指定时间拉取
*
* @author liuyang
*/
public void startImplementByTradeTime(String startTime, String endTime) {
long startMillis = System.currentTimeMillis();
String threadNameStrStart = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{}", startTime, endTime);
logger.info(threadNameStrStart);
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
Assert.notNull(startTime, "startTime不能为空");
Assert.notNull(endTime, "endTime不能为空");
//生成一个时间范围
// StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
//2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性
String tocShop = shopTobOrToCUtil.getCommaShop("TOC");
List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setRefundedAt_start(startTime);
queryOfsSoSaleOutVo.setRefundedAt_end(endTime);
queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tocShop);
queryOfsSoSaleOutVo.setInternalInstructionType("RETURN");
queryOfsSoSaleOutVo.setRefundStatus("900");
// queryOfsSoSaleOutVo.setCode("LETS-RE2024081900000001");
ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search");
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size());
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
getSetTran(returnGoodHeaderDetailsDataDtoArrayList);
} else {
logger.info("没有查询到任何数据!不需要同步");
}
} catch (Exception e) {
logger.error("startImplement方法抛出异常", e);
}
}
}, threadNameStrStart);
thread.start();
try {
thread.join();
} catch (Exception e) {
logger.error("thread.join()异常", e);
}
long endMillis = System.currentTimeMillis();
String threadNameStrEnd = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis));
logger.info(threadNameStrEnd);
}
/** /**
* 预备执行逻辑 * 预备执行逻辑
* *
* @author liuyang * @author liuyang
*/ */
private void getSet(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) throws Exception { private void getSetStock(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) throws Exception {
//保存到mysql //保存到mysql
batchInsert(returnGoodHeaderDetailsDataDtoArrayList); batchInsert(returnGoodHeaderDetailsDataDtoArrayList);
//过滤成功的数据 //过滤成功的数据
List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = filterData(returnGoodHeaderDetailsDataDtoArrayList); List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = filterDataStock(returnGoodHeaderDetailsDataDtoArrayList);
//执行推送主逻辑 //执行推送主逻辑
implement(stockinOrderList); implementStock(stockinOrderList);
}
/**
* 预备执行逻辑
*
* @author liuyang
*/
private void getSetTran(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) throws Exception {
//保存到mysql
batchInsert(returnGoodHeaderDetailsDataDtoArrayList);
//过滤成功的数据
List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = filterDataStock(returnGoodHeaderDetailsDataDtoArrayList);
//执行推送主逻辑
implementTran(stockinOrderList);
} }
/** /**
@ -247,7 +327,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
* *
* @author liuyang * @author liuyang
*/ */
private List<StockinOrderSearchResponse.StockinOrder> filterData(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) { private List<StockinOrderSearchResponse.StockinOrder> filterDataStock(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) {
List<StockinOrderSearchResponse.StockinOrder> headerDetailsDtoList1 = new ArrayList<>(); List<StockinOrderSearchResponse.StockinOrder> headerDetailsDtoList1 = new ArrayList<>();
if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
//TODO 出库单明细主键需要O返回目前没有已经提需求 //TODO 出库单明细主键需要O返回目前没有已经提需求
@ -360,17 +440,17 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
// } // }
/** /**
* 代码同步逻辑 * 库存同步代码同步逻辑
* *
* @param returnGoodHeaderDetailsDataDtoList1 查询得到的O售后入库单对象 * @param returnGoodHeaderDetailsDataDtoList1 查询得到的O售后入库单对象
* @author liuyang * @author liuyang
*/ */
private void implement(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList1) throws Exception { private void implementStock(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList1) throws Exception {
logger.info("TOC退货业务{}行需要进行数据转换", returnGoodHeaderDetailsDataDtoList1.size()); logger.info("TOC退货业务{}行需要进行数据转换", returnGoodHeaderDetailsDataDtoList1.size());
if (returnGoodHeaderDetailsDataDtoList1 != null && returnGoodHeaderDetailsDataDtoList1.size() > 0) { if (returnGoodHeaderDetailsDataDtoList1 != null && returnGoodHeaderDetailsDataDtoList1.size() > 0) {
try { try {
// 查询基本档案 // 查询基本档案
List<GoodsRertunSonDetailsDto> goodsRertunSonDetailsDtos = queryBasicArchives(returnGoodHeaderDetailsDataDtoList1); List<GoodsRertunSonDetailsDto> goodsRertunSonDetailsDtos = queryBasicArchivesStock(returnGoodHeaderDetailsDataDtoList1);
// 分组汇总 // 分组汇总
Map<String, List<GoodsRertunSonDetailsDto>> summaryDimensionMap = groupSummary(goodsRertunSonDetailsDtos); Map<String, List<GoodsRertunSonDetailsDto>> summaryDimensionMap = groupSummary(goodsRertunSonDetailsDtos);
// 查询U8C业务流程 // 查询U8C业务流程
@ -401,7 +481,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
BdRdclEntity bdRdclEntity = oldValue.get(0).getBdRdclEntity();//U8C收发类别 BdRdclEntity bdRdclEntity = oldValue.get(0).getBdRdclEntity();//U8C收发类别
try { try {
checkArchives(oldValue.get(0)); // checkArchives(oldValue.get(0));
//生成业务日期 //生成业务日期
String generateBusinessDate = createGenerateBusinessDate(header); String generateBusinessDate = createGenerateBusinessDate(header);
@ -446,11 +526,173 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
//把汇总好的出库单明细行合并成一行 //把汇总好的出库单明细行合并成一行
GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = groupMergeDetailedRows(oldValue); GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = groupMergeDetailedRows(oldValue);
//存货管理档案取发货公司的存货管理档案 //存货管理档案取发货公司的存货管理档案
BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(goodsRertunSonDetailsDto, bdCalbodyEntity.getPkCorp()); BdInvmandocEntity bdInvmandocEntity = oldValue.get(0).getBdInvmandocEntity();
//存货基础档案 //存货基础档案
BdInvbasdocEntity bdInvbasdocEntity = queryStockBasicArchives(bdInvmandocEntity.getPkInvmandoc(), deliverGoodsCorp.getPkCorp()); BdInvbasdocEntity bdInvbasdocEntity = oldValue.get(0).getBdInvbasdocEntity();
//根据存货基础档案编码查询当前存货的税率 //根据存货基础档案编码查询当前存货的税率
BdTaxitemsEntity bdTaxitemsEntity1 = queryBdTaxitems(bdInvbasdocEntity.getInvcode()); BdTaxitemsEntity bdTaxitemsEntity1 = oldValue.get(0).getBdTaxitemsEntity();
String tax = "0." + new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString();
BigDecimal noriginalcurprice = null;//无税单价
BigDecimal noriginalcurmny = null;//无税金额
BigDecimal noriginalcurtaxprice = null;//含税单价
BigDecimal noriginalcursummny = null;//价税合计
BigDecimal noriginalcurtaxmny = null;//税额=价税合计-无税金额
try {
noriginalcurtaxprice = goodsRertunSonDetailsDto.getGroupTotalPayAmount().divide(goodsRertunSonDetailsDto.getGroupShipQty(), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
noriginalcurprice = noriginalcurtaxprice.divide(new BigDecimal(1).add(new BigDecimal(tax)), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
noriginalcurmny = noriginalcurprice.multiply(goodsRertunSonDetailsDto.getGroupShipQty()).setScale(2, BigDecimal.ROUND_HALF_UP);
noriginalcursummny = noriginalcurtaxprice.multiply(goodsRertunSonDetailsDto.getGroupShipQty()).setScale(2, BigDecimal.ROUND_HALF_UP);
noriginalcurtaxmny = noriginalcursummny.subtract(noriginalcurmny).setScale(2, BigDecimal.ROUND_HALF_UP);
} catch (Exception e) {
logger.error("TOC金额计算错误", e);
Assert.state(false, "U8C红字销售订单金额计算错误原因{}", e.getMessage());
}
//判断是否为赠品
Boolean isblargessflag = false;
if (noriginalcursummny.longValue() == 0) {
isblargessflag = true;
}
SaleorderRequestChildrenDto saleorderRequestChildrenDto = new SaleorderRequestChildrenDto();
saleorderRequestChildrenDto.setBlargessflag(isblargessflag);//是否赠品
saleorderRequestChildrenDto.setCadvisecalbodyid(bdCalbodyEntity.getPkCalbody());//发货库存组织
saleorderRequestChildrenDto.setCbodywarehouseid(bdStordocEntity.getPkStordoc());//发货仓库
saleorderRequestChildrenDto.setCconsigncorpid(deliverGoodsCorp.getPkCorp());//发货公司
saleorderRequestChildrenDto.setCcurrencytypeid("00010000000000000001");//币种
saleorderRequestChildrenDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());//存货id
saleorderRequestChildrenDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//收货单位
saleorderRequestChildrenDto.setDconsigndate(generateBusinessDate);//计划发货日期
saleorderRequestChildrenDto.setDdeliverdate(generateBusinessDate);// 要求收货日期
saleorderRequestChildrenDto.setNexchangeotobrate("1.00000000");//折本汇率
saleorderRequestChildrenDto.setNitemdiscountrate("100.000000");//单品折扣
saleorderRequestChildrenDto.setNnumber("-" + goodsRertunSonDetailsDto.getGroupShipQty().stripTrailingZeros().toPlainString());//数量
saleorderRequestChildrenDto.setNoriginalcurdiscountmny("0");//折扣额
saleorderRequestChildrenDto.setNoriginalcurmny("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//无税金额
// saleorderRequestChildrenDto.setNoriginalcurnetprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税净价
// saleorderRequestChildrenDto.setNoriginalcurprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税单价
saleorderRequestChildrenDto.setNoriginalcursummny("-" + noriginalcursummny.stripTrailingZeros().toPlainString());//价税合计
saleorderRequestChildrenDto.setNoriginalcurtaxmny("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//税额
saleorderRequestChildrenDto.setNoriginalcurtaxnetprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税净价
saleorderRequestChildrenDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价
saleorderRequestChildrenDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率
saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto);
//销售订单单据推送到u8c
List<SaleorderRequestDto> saleorderRequestDtoList = new ArrayList<>();
saleorderRequestDtoList.add(saleorderRequestDto);
Map<String, List<SaleorderRequestDto>> stringStringMap = new HashMap<>();
stringStringMap.put("saleorder", saleorderRequestDtoList);
SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCOrder(JSON.toJSONString(stringStringMap));
logger.info("TOC销售订单编号{} 销售公司:{}", soSaleResultRootDto.getParentvo().getVreceiptcode(), soSaleResultRootDto.getParentvo().getPk_corp());
//记录成功
} catch (Exception e) {
logger.error("TOC退货业务转换成U8C对象过程中、或者单据推送到U8C出现异常", e);
//记录失败
}
}
} else {
//2024年8月6日 11:28:54此处不记录失败不认为是错误
logger.info("summaryDimensionMap变量或者bdBusitypeEntity变量为空因此主要的推送逻辑不会被执行");
}
} catch (Exception e) {
logger.error("外层转换逻辑抛出异常", e);
// 记录失败
}
}
}
/**
* 到账成功代码同步逻辑
*
* @param returnGoodHeaderDetailsDataDtoList1 查询得到的O售后入库单对象
* @author liuyang
*/
private void implementTran(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList1) throws Exception {
logger.info("TOC退货业务{}行需要进行数据转换", returnGoodHeaderDetailsDataDtoList1.size());
if (returnGoodHeaderDetailsDataDtoList1 != null && returnGoodHeaderDetailsDataDtoList1.size() > 0) {
try {
// 查询基本档案
List<GoodsRertunSonDetailsDto> goodsRertunSonDetailsDtos = queryBasicArchivesStock(returnGoodHeaderDetailsDataDtoList1);
// 分组汇总
Map<String, List<GoodsRertunSonDetailsDto>> summaryDimensionMap = groupSummary(goodsRertunSonDetailsDtos);
// 查询U8C业务流程
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlowV2();
if (bdBusitypeEntity != null && summaryDimensionMap != null) {
Iterator<Map.Entry<String, List<GoodsRertunSonDetailsDto>>> iterator = summaryDimensionMap.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, List<GoodsRertunSonDetailsDto>> entry = iterator.next();
String keyGroup = entry.getKey();
List<GoodsRertunSonDetailsDto> oldValue = entry.getValue();
StockinOrderSearchResponse.StockinOrder.StockinH header = oldValue.get(0).getHeader();
BdCorpEntity bdCorpEntity = oldValue.get(0).getBdCorpEntity();//表头销售公司
BdCorpEntity deliverGoodsCorp = oldValue.get(0).getDeliverGoodsCorp();//发货公司
BdCalbodyEntity bdCalbodyEntity = oldValue.get(0).getBdCalbodyEntity();//发货仓库组织
BdStordocEntity bdStordocEntity = oldValue.get(0).getBdStordocEntity();//发货仓库
BdCalbodyEntity bdCalbodyEntity1 = oldValue.get(0).getBdCalbodyEntity1();//收货库存组织
BdStordocEntity bdStordocEntity1 = oldValue.get(0).getBdStordocEntity1();//收货仓库
BdSalestruEntity bdSalestruEntity = oldValue.get(0).getBdSalestruEntity();//销售组织
BdDeptdocEntity bdDeptdocEntity = oldValue.get(0).getBdDeptdocEntity();//业务部门
BdCumandocEntity bdCumandocEntity = oldValue.get(0).getBdCumandocEntity();//客商管理档案
BdCubasdocEntity bdCubasdocEntity = oldValue.get(0).getBdCubasdocEntity();//客商基本档案
BdDefdocEntity platformArchives = oldValue.get(0).getPlatformArchives();//U8C平台档案
BdDefdocEntity shopArchives = oldValue.get(0).getShopArchives();//U8C店铺档案
BdRdclEntity bdRdclEntity = oldValue.get(0).getBdRdclEntity();//U8C收发类别
try {
// checkArchives(oldValue.get(0));
//生成业务日期
String generateBusinessDate = createGenerateBusinessDate(header);
SaleorderRequestDto saleorderRequestDto = new SaleorderRequestDto();
SaleorderRequestParentDto saleorderRequestParentDto = new SaleorderRequestParentDto();
saleorderRequestParentDto.setDbilldate(generateBusinessDate);//单据日期
saleorderRequestParentDto.setBretinvflag("Y");//退货标记
saleorderRequestParentDto.setCbiztype(bdBusitypeEntity.getPkBusitype());//业务流程
saleorderRequestParentDto.setCcalbodyid(bdCalbodyEntity.getPkCalbody());//库存组织
saleorderRequestParentDto.setCcustomerid(bdCumandocEntity.getPkCumandoc());//客户=开票单位=收货单位=表体收货单位=收货单位
saleorderRequestParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//部门
saleorderRequestParentDto.setCemployeeid(null);//业务员
saleorderRequestParentDto.setCoperatorid(OverallConstant.getOverAllValue("u8cApiZdrPK"));//制单人
saleorderRequestParentDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//开票单位
saleorderRequestParentDto.setCreceiptcustomerid(bdCumandocEntity.getPkCumandoc());//收货单位
saleorderRequestParentDto.setCsalecorpid(bdSalestruEntity.getCsalestruid());//销售组织
saleorderRequestParentDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//仓库
saleorderRequestParentDto.setDapprovedate(generateBusinessDate);//审核日期
saleorderRequestParentDto.setNdiscountrate("100.000000");//整单折扣
saleorderRequestParentDto.setPk_corp(bdCorpEntity.getPkCorp());//公司id
//汇总单号=汇总维度
saleorderRequestParentDto.setVdef18(keyGroup);
//平台
saleorderRequestParentDto.setPk_defdoc2(platformArchives.getPkDefdoc());
saleorderRequestParentDto.setVdef2(platformArchives.getDocname());
saleorderRequestParentDto.setVdef17(ProfilesActiveConstant.sourceSystem1);//来源系统
//收发类别
saleorderRequestParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl());
saleorderRequestParentDto.setVdef3(bdRdclEntity.getRdname());
//2024年8月8日 17:17:58 店铺档案自定义项1先不传后续维护好之后再传!
//店铺
saleorderRequestParentDto.setPk_defdoc1(shopArchives.getPkDefdoc());
saleorderRequestParentDto.setVdef1(shopArchives.getDocname());
saleorderRequestDto.setParentvo(saleorderRequestParentDto);
List<SaleorderRequestChildrenDto> saleorderRequestChildrenDtoList = new ArrayList<>();
saleorderRequestDto.setChildrenvo(saleorderRequestChildrenDtoList);
//把汇总好的出库单明细行合并成一行
GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = groupMergeDetailedRows(oldValue);
//存货管理档案取发货公司的存货管理档案
BdInvmandocEntity bdInvmandocEntity = oldValue.get(0).getBdInvmandocEntity();
//存货基础档案
BdInvbasdocEntity bdInvbasdocEntity = oldValue.get(0).getBdInvbasdocEntity();
//根据存货基础档案编码查询当前存货的税率
BdTaxitemsEntity bdTaxitemsEntity1 = oldValue.get(0).getBdTaxitemsEntity();
String tax = "0." + new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString(); String tax = "0." + new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString();
BigDecimal noriginalcurprice = null;//无税单价 BigDecimal noriginalcurprice = null;//无税单价
@ -555,13 +797,13 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
* @param returnGoodHeaderDetailsDataDtoList1 OFS售后入库单对象 * @param returnGoodHeaderDetailsDataDtoList1 OFS售后入库单对象
* @author liuyang * @author liuyang
*/ */
private List<GoodsRertunSonDetailsDto> queryBasicArchives(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList1) { private List<GoodsRertunSonDetailsDto> queryBasicArchivesStock(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList1) {
List<GoodsRertunSonDetailsDto> sonDetailsDtoList = new ArrayList<>(); List<GoodsRertunSonDetailsDto> sonDetailsDtoList = new ArrayList<>();
if (returnGoodHeaderDetailsDataDtoList1 != null && returnGoodHeaderDetailsDataDtoList1.size() > 0) { if (returnGoodHeaderDetailsDataDtoList1 != null && returnGoodHeaderDetailsDataDtoList1.size() > 0) {
try { try {
//初始化档案缓存 //初始化档案缓存
tocReturnBasicArchivesCacheUtil.initCache(); CacheTocMapVoV2 cacheTocMapVoV2 = tocReturnBasicArchivesCacheUtil.initCache();
//查询OFS售后入库单对应的售后订单 //查询OFS售后入库单对应的售后订单
List<RerturnGoodsOrderSearchData> rerturnGoodsOrderSearchData = queryBatchAfterSalesOrder(returnGoodHeaderDetailsDataDtoList1); List<RerturnGoodsOrderSearchData> rerturnGoodsOrderSearchData = queryBatchAfterSalesOrder(returnGoodHeaderDetailsDataDtoList1);
findAfterSalesOrder(rerturnGoodsOrderSearchData, returnGoodHeaderDetailsDataDtoList1); findAfterSalesOrder(rerturnGoodsOrderSearchData, returnGoodHeaderDetailsDataDtoList1);
@ -587,17 +829,17 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
if (header1.getSubOrderType() == null || "".equals(header1.getSubOrderType())) { if (header1.getSubOrderType() == null || "".equals(header1.getSubOrderType())) {
header1.setSubOrderType("SALES"); header1.setSubOrderType("SALES");
} }
BdRdclEntity bdRdclEntity = TocReturnBasicArchivesCacheUtil.stringBdRdclEntityHashMap.get(header1.getSubOrderType()); BdRdclEntity bdRdclEntity = cacheTocMapVoV2.getStringBdRdclEntityMap().get(header1.getSubOrderType());
Assert.notNull(bdRdclEntity, "根据业务类型({})没有匹配到U8C业务类型", header1.getSubOrderType()); Assert.notNull(bdRdclEntity, "根据业务类型({})没有匹配到U8C业务类型", header1.getSubOrderType());
//表头公司通过名称匹配U8C公司 //表头公司通过名称匹配U8C公司
// String corpName = "上海丽知品牌管理有限公司"; // String corpName = "上海丽知品牌管理有限公司";
Assert.notNull(header.getCompanyCode(), "O货主编码不能为空"); Assert.notNull(header.getCompanyCode(), "O货主编码不能为空");
BdCorpEntity bdCorpEntity = TocReturnBasicArchivesCacheUtil.stringBdCorpEntityMap.get(header.getCompanyCode()); BdCorpEntity bdCorpEntity = cacheTocMapVoV2.getStringBdCorpEntityMap().get(header.getCompanyCode());
Assert.notNull(bdCorpEntity, "根据O公司编码(货主编码)({})没有匹配到U8C公司档案", header.getCompanyCode()); Assert.notNull(bdCorpEntity, "根据O公司编码(货主编码)({})没有匹配到U8C公司档案", header.getCompanyCode());
//发货库存组织 //发货库存组织
BdCalbodyEntity bdCalbodyEntity = TocReturnBasicArchivesCacheUtil.stringBdCalbodyEntityMap.get(bdCorpEntity.getPkCorp()); BdCalbodyEntity bdCalbodyEntity = cacheTocMapVoV2.getStringBdCalbodyEntityMap().get(bdCorpEntity.getPkCorp());
Assert.notNull(bdCalbodyEntity, "根据公司主键没有查询到发货库存组织 公司主键:{}", bdCorpEntity.getPkCorp()); Assert.notNull(bdCalbodyEntity, "根据公司主键没有查询到发货库存组织 公司主键:{}", bdCorpEntity.getPkCorp());
//发货公司暂时把O表头公司作为发货公司正常情况下需要把O库存地点对于的公司作为发货公司 //发货公司暂时把O表头公司作为发货公司正常情况下需要把O库存地点对于的公司作为发货公司
@ -606,7 +848,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
//2024年8月5日 15:06:38 仓库O与U两边仓库编码是一致的和妮姐确认过了 //2024年8月5日 15:06:38 仓库O与U两边仓库编码是一致的和妮姐确认过了
String facilityCode = header.getFacilityCode(); String facilityCode = header.getFacilityCode();
Assert.notNull(facilityCode, "O仓库编码不能为空"); Assert.notNull(facilityCode, "O仓库编码不能为空");
BdStordocEntity bdStordocEntity = TocReturnBasicArchivesCacheUtil.stringBdStordocEntityMap.get(facilityCode + bdCalbodyEntity.getPkCalbody()); BdStordocEntity bdStordocEntity = cacheTocMapVoV2.getStringBdStordocEntityMap().get(facilityCode + bdCalbodyEntity.getPkCalbody());
Assert.notNull(bdStordocEntity, "没有匹配到发货仓库 发货库存组织主键:{} O库存地点编码{}", facilityCode, bdCalbodyEntity.getPkCalbody()); Assert.notNull(bdStordocEntity, "没有匹配到发货仓库 发货库存组织主键:{} O库存地点编码{}", facilityCode, bdCalbodyEntity.getPkCalbody());
//2024年8月5日 15:25:07 收货库存组织收货仓库默认和发货库存组织发货仓库一致已经和佳妮确认 //2024年8月5日 15:25:07 收货库存组织收货仓库默认和发货库存组织发货仓库一致已经和佳妮确认
@ -614,41 +856,54 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
//收货仓库通过收货库存组织+仓库编码确定收货仓库 //收货仓库通过收货库存组织+仓库编码确定收货仓库
//销售组织2024年8月5日 15:33:40 和妮姐确认销售组织和表头公司作为一对一的关系 //销售组织2024年8月5日 15:33:40 和妮姐确认销售组织和表头公司作为一对一的关系
BdSalestruEntity bdSalestruEntity = TocReturnBasicArchivesCacheUtil.stringBdSalestruEntityMap.get(bdCorpEntity.getUnitname()); BdSalestruEntity bdSalestruEntity = cacheTocMapVoV2.getStringBdSalestruEntityMap().get(bdCorpEntity.getUnitname());
Assert.notNull(bdSalestruEntity, "无匹配到销售组织 表头公司名称:{}", bdCorpEntity.getUnitname()); Assert.notNull(bdSalestruEntity, "无匹配到销售组织 表头公司名称:{}", bdCorpEntity.getUnitname());
//业务部门暂定的部门名称其他2024年8月5日 15:39:42 已经和妮姐确认 //业务部门暂定的部门名称其他2024年8月5日 15:39:42 已经和妮姐确认
BdDeptdocEntity bdDeptdocEntity = TocReturnBasicArchivesCacheUtil.stringBdDeptdocEntityMap.get(bdCorpEntity.getPkCorp()); BdDeptdocEntity bdDeptdocEntity = cacheTocMapVoV2.getStringBdDeptdocEntityMap().get(bdCorpEntity.getPkCorp());
Assert.notNull(bdDeptdocEntity, "无法匹配到业务部门 部门名称:其他 对应公司名称:{}", bdCorpEntity.getPkCorp()); Assert.notNull(bdDeptdocEntity, "无法匹配到业务部门 部门名称:其他 对应公司名称:{}", bdCorpEntity.getPkCorp());
//客商基本档案 //客商基本档案
//TODO 2024年8月8日 12:05:10 O店铺的业务编码=U8C客商自定义项1O没有店铺信息查询接口因此无法通过出库单的店铺编码查询到O店铺档案对应的业务编码接口上线之后需要补充这一部分逻辑 //2024年8月8日 12:05:10 O店铺的业务编码=U8C客商自定义项1O没有店铺信息查询接口因此无法通过出库单的店铺编码查询到O店铺档案对应的业务编码接口上线之后需要补充这一部分逻辑
String custName = "天猫intoyou旗舰店-自营"; // String custName = "天猫intoyou旗舰店-自营";
BdCubasdocEntity bdCubasdocEntity = TocReturnBasicArchivesCacheUtil.stringBdCubasdocEntityHashMap.get(custName); String storeCode = header.getStoreCode();
Assert.notNull(bdCubasdocEntity, "无法匹配到客户档案 客商名称:{}", custName); Assert.notNull(storeCode, "O店铺编码不能为空没有办法完成业务逻辑");
Assert.state(!"".equals(storeCode.trim()), "O店铺编码不能为空没有办法完成业务逻辑");
BdCubasdocEntity bdCubasdocEntity = cacheTocMapVoV2.getStringBdCubasdocEntityMap().get(storeCode);
Assert.notNull(bdCubasdocEntity, "无法匹配到客户档案 客商名称:{}", storeCode);
//客商管理档案2024年8月5日 15:41:54 TOC店铺名称查询U8C客商档案已经和妮姐确认 //客商管理档案2024年8月5日 15:41:54 TOC店铺名称查询U8C客商档案已经和妮姐确认
//2024年8月5日 15:49:49 先根据O店铺编码得到店铺档案信息取到名称通过U8C接口查询出来 //2024年8月5日 15:49:49 先根据O店铺编码得到店铺档案信息取到名称通过U8C接口查询出来
//目前O店铺信息查询接口还没有等待开发所以我这里先写所一个名字 //目前O店铺信息查询接口还没有等待开发所以我这里先写所一个名字
BdCumandocEntity bdCumandocEntity = TocReturnBasicArchivesCacheUtil.stringBdCumandocEntityMap.get(bdCubasdocEntity.getPkCubasdoc() + bdCorpEntity.getPkCorp()); BdCumandocEntity bdCumandocEntity = cacheTocMapVoV2.getStringBdCumandocEntityMap().get(bdCubasdocEntity.getPkCubasdoc() + bdCorpEntity.getPkCorp());
Assert.notNull(bdCumandocEntity, "无法匹配到客商档案 店铺名称:{}", "天猫intoyou旗舰店-自营"); Assert.notNull(bdCumandocEntity, "无法匹配到客商档案 店铺名称:{}", "天猫intoyou旗舰店-自营");
//查找平台 //查找平台
String sourcePlatformCode = header.getSourcePlatformCode(); String sourcePlatformCode = header.getSourcePlatformCode();
Assert.notNull(sourcePlatformCode, "O平台编码不能为空"); Assert.notNull(sourcePlatformCode, "O平台编码不能为空");
BdDefdocEntity bdDefdocEntity = TocReturnBasicArchivesCacheUtil.stringBdDefdocEntityHashMap.get(sourcePlatformCode); BdDefdocEntity bdDefdocEntity = cacheTocMapVoV2.getStringBdDefdocEntityMap().get(sourcePlatformCode);
Assert.notNull(bdDefdocEntity, "根据O平台编码({})无法匹配到U8C平台档案", header.getSourcePlatformCode()); Assert.notNull(bdDefdocEntity, "根据O平台编码({})无法匹配到U8C平台档案", header.getSourcePlatformCode());
//查找店铺 //查找店铺
String storeCode = header.getStoreCode(); // String storeCode2 = header.getStoreCode();
Assert.notNull(storeCode, "O店铺编码不能为空"); // Assert.notNull(storeCode2, "O店铺编码不能为空");
BdDefdocEntity bdDefdocEntity1 = TocReturnBasicArchivesCacheUtil.shopDefdocEntityHashMap.get(storeCode); BdDefdocEntity bdDefdocEntity1 = cacheTocMapVoV2.getStringBdDefdocEntityMap1().get(storeCode);
Assert.notNull(bdDefdocEntity1, "根据O店铺编码({})无法匹配到U8C店铺档案", storeCode); Assert.notNull(bdDefdocEntity1, "根据O店铺编码({})无法匹配到U8C店铺档案", storeCode);
//字段拷贝 //字段拷贝
for (int j = 0; j < details.size(); j++) { for (int j = 0; j < details.size(); j++) {
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j); StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j);
//存货管理档案是发货公司的存货档案
BdInvmandocEntity bdInvmandocEntity = cacheTocMapVoV2.getStringBdInvmandocEntityMap().get(stockinB.getSkuCode() + bdCorpEntity.getPkCorp());
Assert.notNull(bdInvmandocEntity, "无法匹配到存货管理档案 货品sku{} 公司:{}", stockinB.getSkuCode(), bdCorpEntity.getPkCorp());
//存货基本档案
BdInvbasdocEntity bdInvbasdocEntity = cacheTocMapVoV2.getStringBdInvbasdocEntityMap().get(bdInvmandocEntity.getPkInvmandoc() + bdCorpEntity.getPkCorp());
Assert.notNull(bdInvbasdocEntity, "无法匹配到存货基本档案 存货管理主键:{} 公司:{}", bdInvmandocEntity.getPkInvmandoc(), bdCorpEntity.getPkCorp());
//存货税率
BdTaxitemsEntity bdTaxitemsEntity = cacheTocMapVoV2.getStringBdTaxitemsEntityMap().get(bdInvmandocEntity.getInvcode());
Assert.notNull(bdTaxitemsEntity, "无法匹配到存货税率 存货编码:{}", bdInvmandocEntity.getInvcode());
//2024年8月6日 10:16:22 通过O出库单的表头查询得出U8C档案放在表体的原因是方便分组汇总 //2024年8月6日 10:16:22 通过O出库单的表头查询得出U8C档案放在表体的原因是方便分组汇总
//下一个步骤的分组汇总是通过表体明细完成的 //下一个步骤的分组汇总是通过表体明细完成的
GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = new GoodsRertunSonDetailsDto(); GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = new GoodsRertunSonDetailsDto();
@ -666,6 +921,9 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
goodsRertunSonDetailsDto.setPlatformArchives(bdDefdocEntity); goodsRertunSonDetailsDto.setPlatformArchives(bdDefdocEntity);
goodsRertunSonDetailsDto.setBdRdclEntity(bdRdclEntity); goodsRertunSonDetailsDto.setBdRdclEntity(bdRdclEntity);
goodsRertunSonDetailsDto.setShopArchives(bdDefdocEntity1); goodsRertunSonDetailsDto.setShopArchives(bdDefdocEntity1);
goodsRertunSonDetailsDto.setBdInvmandocEntity(bdInvmandocEntity);
goodsRertunSonDetailsDto.setBdInvbasdocEntity(bdInvbasdocEntity);
goodsRertunSonDetailsDto.setBdTaxitemsEntity(bdTaxitemsEntity);
BeanUtil.copyPropertiesV2(stockinB, goodsRertunSonDetailsDto); BeanUtil.copyPropertiesV2(stockinB, goodsRertunSonDetailsDto);
sonDetailsDtoList.add(goodsRertunSonDetailsDto); sonDetailsDtoList.add(goodsRertunSonDetailsDto);
@ -820,6 +1078,20 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
return bdBusitypeEntity; return bdBusitypeEntity;
} }
/**
* 2024年8月6日 10:59:03 查询U8C业务流程
*
* @author liuyang
*/
private BdBusitypeEntity u8cOperationFlowV2() throws Exception {
//查询业务流程
//2024年8月6日 11:33:07 具体的业务流程名称还需要实施提供
String processName = "TOC售后完成";
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName);
Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName);
return bdBusitypeEntity;
}
/** /**
* 检查参数是否为空 * 检查参数是否为空
* 2024年8月6日 11:40:19 保险的做法最好还是验证一下 * 2024年8月6日 11:40:19 保险的做法最好还是验证一下
@ -846,15 +1118,15 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
* @param goodsRertunSonDetailsDto 出库单存货明细行 * @param goodsRertunSonDetailsDto 出库单存货明细行
* @author liuyang * @author liuyang
*/ */
private BdInvmandocEntity queryInventoryMan(GoodsRertunSonDetailsDto goodsRertunSonDetailsDto, String pkCorp) { // private BdInvmandocEntity queryInventoryMan(GoodsRertunSonDetailsDto goodsRertunSonDetailsDto, String pkCorp) {
Assert.notNull(goodsRertunSonDetailsDto, "sonDetailsDto不能为空"); // Assert.notNull(goodsRertunSonDetailsDto, "sonDetailsDto不能为空");
Assert.notNull(goodsRertunSonDetailsDto.getSkuCode(), "O存货商家编码不能为空"); // Assert.notNull(goodsRertunSonDetailsDto.getSkuCode(), "O存货商家编码不能为空");
Assert.notNull(pkCorp, "发货公司主键不能为空"); // Assert.notNull(pkCorp, "发货公司主键不能为空");
//
BdInvmandocEntity bdInvmandocEntity = TocReturnBasicArchivesCacheUtil.stringBdInvmandocEntityMap.get(goodsRertunSonDetailsDto.getSkuCode() + pkCorp); // BdInvmandocEntity bdInvmandocEntity = TocReturnBasicArchivesCacheUtil.stringBdInvmandocEntityMap.get(goodsRertunSonDetailsDto.getSkuCode() + pkCorp);
Assert.notNull(bdInvmandocEntity, "无法匹配到存货管理档案 存货商家编码:{} 存货发货公司:{}", goodsRertunSonDetailsDto.getSkuCode(), pkCorp); // Assert.notNull(bdInvmandocEntity, "无法匹配到存货管理档案 存货商家编码:{} 存货发货公司:{}", goodsRertunSonDetailsDto.getSkuCode(), pkCorp);
return bdInvmandocEntity; // return bdInvmandocEntity;
} // }
/** /**
* 合并明细行 * 合并明细行
@ -902,13 +1174,13 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
* *
* @author liuyang * @author liuyang
*/ */
private BdInvbasdocEntity queryStockBasicArchives(String pkInvmandoc, String pkCorp) { // private BdInvbasdocEntity queryStockBasicArchives(String pkInvmandoc, String pkCorp) {
Assert.notNull(pkInvmandoc, "存货管理档案不能为空"); // Assert.notNull(pkInvmandoc, "存货管理档案不能为空");
Assert.notNull(pkCorp, "公司档案不能为空"); // Assert.notNull(pkCorp, "公司档案不能为空");
BdInvbasdocEntity bdInvbasdocEntity = TocReturnBasicArchivesCacheUtil.stringBdInvbasdocEntityHashMap.get(pkInvmandoc + pkCorp); // BdInvbasdocEntity bdInvbasdocEntity = TocReturnBasicArchivesCacheUtil.stringBdInvbasdocEntityHashMap.get(pkInvmandoc + pkCorp);
Assert.notNull(bdInvbasdocEntity, "根据公司主键:{} 和存货管理档案主键:{} 没有查询到存货基本档案", pkCorp, pkInvmandoc); // Assert.notNull(bdInvbasdocEntity, "根据公司主键:{} 和存货管理档案主键:{} 没有查询到存货基本档案", pkCorp, pkInvmandoc);
return bdInvbasdocEntity; // return bdInvbasdocEntity;
} // }
/** /**
* 2024年8月7日 14:58:34 * 2024年8月7日 14:58:34
@ -916,12 +1188,12 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
* *
* @author liuyang * @author liuyang
*/ */
private BdTaxitemsEntity queryBdTaxitems(String invcode) { // private BdTaxitemsEntity queryBdTaxitems(String invcode) {
Assert.notNull(invcode, "存货编码不能为空"); // Assert.notNull(invcode, "存货编码不能为空");
BdTaxitemsEntity bdTaxitemsEntity = TocReturnBasicArchivesCacheUtil.stringBdTaxitemsEntityHashMap.get(invcode); // BdTaxitemsEntity bdTaxitemsEntity = TocReturnBasicArchivesCacheUtil.stringBdTaxitemsEntityHashMap.get(invcode);
Assert.notNull(bdTaxitemsEntity, "根据存货编码({}),无法匹配到税率!", invcode); // Assert.notNull(bdTaxitemsEntity, "根据存货编码({}),无法匹配到税率!", invcode);
return bdTaxitemsEntity; // return bdTaxitemsEntity;
} // }
/** /**
* 2024年8月8日 10:54:48 * 2024年8月8日 10:54:48

View File

@ -0,0 +1,31 @@
package com.hzya.frame.plugin.lets.resultvo;
import com.hzya.frame.plugin.lets.entity.*;
import lombok.Data;
import java.util.Map;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.resultvo
* @ProjectkangarooDataCenterV3
* @nameCacheMapVo
* @Date2024/9/4 13:35
* @FilenameCacheMapVo
*/
@Data
public class CacheTocMapVoV2 {
private Map<String, BdCorpEntity> stringBdCorpEntityMap;
private Map<String, BdStordocEntity> stringBdStordocEntityMap;
private Map<String, BdCalbodyEntity> stringBdCalbodyEntityMap;
private Map<String, BdSalestruEntity> stringBdSalestruEntityMap;
private Map<String, BdDeptdocEntity> stringBdDeptdocEntityMap;
private Map<String, BdCubasdocEntity> stringBdCubasdocEntityMap;
private Map<String, BdCumandocEntity> stringBdCumandocEntityMap;
private Map<String, BdInvmandocEntity> stringBdInvmandocEntityMap;
private Map<String, BdInvbasdocEntity> stringBdInvbasdocEntityMap;
private Map<String, BdTaxitemsEntity> stringBdTaxitemsEntityMap;
private Map<String, BdDefdocEntity> stringBdDefdocEntityMap;//平台
private Map<String, BdDefdocEntity> stringBdDefdocEntityMap1;//店铺
private Map<String, BdRdclEntity> stringBdRdclEntityMap;
}

View File

@ -104,4 +104,19 @@ public class GoodsRertunSonDetailsDto extends StockinOrderSearchResponse.Stockin
* OFS收发类别 * OFS收发类别
*/ */
private BdRdclEntity bdRdclEntity; private BdRdclEntity bdRdclEntity;
/**
* 存货管理档案
*/
private BdInvmandocEntity bdInvmandocEntity;
/**
* 存货基本档案
*/
private BdInvbasdocEntity bdInvbasdocEntity;
/**
* 存货税率
*/
private BdTaxitemsEntity bdTaxitemsEntity;
} }

View File

@ -2,6 +2,7 @@ package com.hzya.frame.plugin.lets.util;
import com.hzya.frame.plugin.lets.dao.*; import com.hzya.frame.plugin.lets.dao.*;
import com.hzya.frame.plugin.lets.entity.*; import com.hzya.frame.plugin.lets.entity.*;
import com.hzya.frame.plugin.lets.resultvo.CacheTocMapVoV2;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -58,13 +59,14 @@ public class TocReturnBasicArchivesCacheUtil {
@Autowired @Autowired
private IBdRdclDao iBdRdclDao; private IBdRdclDao iBdRdclDao;
// public static Map<String, BdCorpEntity> stringBdCorpEntityMap = new HashMap<>();
/** /**
* 初始化公司档案-表头公司 * 初始化公司档案-表头公司
* 2024年7月31日 11:16:23 * 2024年7月31日 11:16:23
*/ */
public static Map<String, BdCorpEntity> stringBdCorpEntityMap = new HashMap<>(); private Map<String, BdCorpEntity> initShop() throws Exception {
Map<String, BdCorpEntity> stringBdCorpEntityMap = new HashMap<>();
private void initShop() throws Exception {
BdCorpEntity bdCorpEntity = new BdCorpEntity(); BdCorpEntity bdCorpEntity = new BdCorpEntity();
bdCorpEntity.setDr(0); bdCorpEntity.setDr(0);
bdCorpEntity.setDataSourceCode("lets_u8c"); bdCorpEntity.setDataSourceCode("lets_u8c");
@ -75,16 +77,18 @@ public class TocReturnBasicArchivesCacheUtil {
stringBdCorpEntityMap.put(bdCorpEntity1.getUnitcode(), bdCorpEntity1); stringBdCorpEntityMap.put(bdCorpEntity1.getUnitcode(), bdCorpEntity1);
} }
} }
return stringBdCorpEntityMap;
} }
// public static Map<String, BdStordocEntity> stringBdStordocEntityMap = new HashMap<>();
/** /**
* 初始化发货仓库 * 初始化发货仓库
* 2024年7月31日 11:16:27 * 2024年7月31日 11:16:27
* 202403011513仓库根据仓库编码+库存组织编码去查询之前是仓库编码+公司主键和李佳妮确认好了 * 202403011513仓库根据仓库编码+库存组织编码去查询之前是仓库编码+公司主键和李佳妮确认好了
*/ */
public static Map<String, BdStordocEntity> stringBdStordocEntityMap = new HashMap<>(); private Map<String, BdStordocEntity> initBdStordoc() throws Exception {
Map<String, BdStordocEntity> stringBdStordocEntityMap = new HashMap<>();
private void initBdStordoc() throws Exception {
BdStordocEntity bdStordocEntity = new BdStordocEntity(); BdStordocEntity bdStordocEntity = new BdStordocEntity();
bdStordocEntity.setDr(0L); bdStordocEntity.setDr(0L);
bdStordocEntity.setDataSourceCode("lets_u8c"); bdStordocEntity.setDataSourceCode("lets_u8c");
@ -95,14 +99,15 @@ public class TocReturnBasicArchivesCacheUtil {
stringBdStordocEntityMap.put(bdStordocEntity1.getStorcode() + bdStordocEntity1.getPkCalbody(), bdStordocEntity1); stringBdStordocEntityMap.put(bdStordocEntity1.getStorcode() + bdStordocEntity1.getPkCalbody(), bdStordocEntity1);
} }
} }
return stringBdStordocEntityMap;
} }
/** /**
* 2024年7月31日 11:09:12 查询发货库存组织 * 2024年7月31日 11:09:12 查询发货库存组织
*/ */
public static Map<String, BdCalbodyEntity> stringBdCalbodyEntityMap = new HashMap<>(); // public static Map<String, BdCalbodyEntity> stringBdCalbodyEntityMap = new HashMap<>();
private Map<String, BdCalbodyEntity> initBdCalbody() throws Exception {
private void initBdCalbody() throws Exception { Map<String, BdCalbodyEntity> stringBdCalbodyEntityMap = new HashMap<>();
BdCalbodyEntity bdCalbodyEntity = new BdCalbodyEntity(); BdCalbodyEntity bdCalbodyEntity = new BdCalbodyEntity();
bdCalbodyEntity.setDr(0); bdCalbodyEntity.setDr(0);
bdCalbodyEntity.setDataSourceCode("lets_u8c"); bdCalbodyEntity.setDataSourceCode("lets_u8c");
@ -113,14 +118,15 @@ public class TocReturnBasicArchivesCacheUtil {
stringBdCalbodyEntityMap.put(bdCalbodyEntity1.getPkCorp(), bdCalbodyEntity1); stringBdCalbodyEntityMap.put(bdCalbodyEntity1.getPkCorp(), bdCalbodyEntity1);
} }
} }
return stringBdCalbodyEntityMap;
} }
/** /**
* 初始化销售组织 * 初始化销售组织
*/ */
public static Map<String, BdSalestruEntity> stringBdSalestruEntityMap = new HashMap<>(); // public static Map<String, BdSalestruEntity> stringBdSalestruEntityMap = new HashMap<>();
private Map<String, BdSalestruEntity> initBdSalestru() throws Exception {
private void initBdSalestru() throws Exception { Map<String, BdSalestruEntity> stringBdSalestruEntityMap = new HashMap<>();
BdSalestruEntity bdSalestruEntity = new BdSalestruEntity(); BdSalestruEntity bdSalestruEntity = new BdSalestruEntity();
bdSalestruEntity.setDr(0); bdSalestruEntity.setDr(0);
bdSalestruEntity.setDataSourceCode("lets_u8c"); bdSalestruEntity.setDataSourceCode("lets_u8c");
@ -131,6 +137,7 @@ public class TocReturnBasicArchivesCacheUtil {
stringBdSalestruEntityMap.put(bdSalestruEntity1.getVsalestruname(), bdSalestruEntity1); stringBdSalestruEntityMap.put(bdSalestruEntity1.getVsalestruname(), bdSalestruEntity1);
} }
} }
return stringBdSalestruEntityMap;
} }
/** /**
@ -138,9 +145,10 @@ public class TocReturnBasicArchivesCacheUtil {
* *
* @author liuyang * @author liuyang
*/ */
public static Map<String, BdDeptdocEntity> stringBdDeptdocEntityMap = new HashMap<>(); // public static Map<String, BdDeptdocEntity> stringBdDeptdocEntityMap = new HashMap<>();
private Map<String, BdDeptdocEntity> initDept() {
Map<String, BdDeptdocEntity> stringBdDeptdocEntityMap = new HashMap<>();
private void initDept() {
BdDeptdocEntity bdDeptdocEntity = new BdDeptdocEntity(); BdDeptdocEntity bdDeptdocEntity = new BdDeptdocEntity();
bdDeptdocEntity.setDataSourceCode("lets_u8c"); bdDeptdocEntity.setDataSourceCode("lets_u8c");
bdDeptdocEntity.setDr(0); bdDeptdocEntity.setDr(0);
@ -152,6 +160,7 @@ public class TocReturnBasicArchivesCacheUtil {
stringBdDeptdocEntityMap.put(bdDeptdocEntity1.getPkCorp(), bdDeptdocEntity1); stringBdDeptdocEntityMap.put(bdDeptdocEntity1.getPkCorp(), bdDeptdocEntity1);
} }
} }
return stringBdDeptdocEntityMap;
} }
/** /**
@ -159,9 +168,10 @@ public class TocReturnBasicArchivesCacheUtil {
* *
* @author liuyang * @author liuyang
*/ */
public static Map<String, BdCubasdocEntity> stringBdCubasdocEntityHashMap = new HashMap<>(); // public static Map<String, BdCubasdocEntity> stringBdCubasdocEntityHashMap = new HashMap<>();
private Map<String, BdCubasdocEntity> initBdCubasdoc() {
Map<String, BdCubasdocEntity> stringBdCubasdocEntityHashMap = new HashMap<>();
private void initBdCubasdoc() {
BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity(); BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity();
bdCubasdocEntity.setDataSourceCode("lets_u8c"); bdCubasdocEntity.setDataSourceCode("lets_u8c");
bdCubasdocEntity.setDr(0L); bdCubasdocEntity.setDr(0L);
@ -172,6 +182,7 @@ public class TocReturnBasicArchivesCacheUtil {
stringBdCubasdocEntityHashMap.put(bdCubasdocEntity1.getCustname(), bdCubasdocEntity1); stringBdCubasdocEntityHashMap.put(bdCubasdocEntity1.getCustname(), bdCubasdocEntity1);
} }
} }
return stringBdCubasdocEntityHashMap;
} }
/** /**
@ -179,9 +190,10 @@ public class TocReturnBasicArchivesCacheUtil {
* *
* @author liuyang * @author liuyang
*/ */
public static Map<String, BdCumandocEntity> stringBdCumandocEntityMap = new HashMap<>(); // public static Map<String, BdCumandocEntity> stringBdCumandocEntityMap = new HashMap<>();
private Map<String, BdCumandocEntity> initBdCumandoc() {
Map<String, BdCumandocEntity> stringBdCumandocEntityMap = new HashMap<>();
private void initBdCumandoc() {
BdCumandocEntity bdCumandocEntity1 = new BdCumandocEntity(); BdCumandocEntity bdCumandocEntity1 = new BdCumandocEntity();
bdCumandocEntity1.setDataSourceCode("lets_u8c"); bdCumandocEntity1.setDataSourceCode("lets_u8c");
bdCumandocEntity1.setDr(0L); bdCumandocEntity1.setDr(0L);
@ -193,14 +205,16 @@ public class TocReturnBasicArchivesCacheUtil {
stringBdCumandocEntityMap.put(bdCumandocEntity.getPkCubasdoc() + bdCumandocEntity.getPkCorp(), bdCumandocEntity); stringBdCumandocEntityMap.put(bdCumandocEntity.getPkCubasdoc() + bdCumandocEntity.getPkCorp(), bdCumandocEntity);
} }
} }
return stringBdCumandocEntityMap;
} }
/** /**
* 初始化存货管理档案 * 初始化存货管理档案
*/ */
public static Map<String, BdInvmandocEntity> stringBdInvmandocEntityMap = new HashMap<>(); // public static Map<String, BdInvmandocEntity> stringBdInvmandocEntityMap = new HashMap<>();
private Map<String, BdInvmandocEntity> initInventoryFile() throws Exception {
Map<String, BdInvmandocEntity> stringBdInvmandocEntityMap = new HashMap<>();
private void initInventoryFile() throws Exception {
BdInvmandocEntity bdInvmandocEntity = new BdInvmandocEntity(); BdInvmandocEntity bdInvmandocEntity = new BdInvmandocEntity();
// bdInvmandocEntity.setInvcode(copyRowDetailsListVo.getSpec_no()); // bdInvmandocEntity.setInvcode(copyRowDetailsListVo.getSpec_no());
// bdInvmandocEntity.setPkCorp(shippingCompanyBdCorpEntity.getPkCorp()); // bdInvmandocEntity.setPkCorp(shippingCompanyBdCorpEntity.getPkCorp());
@ -212,15 +226,17 @@ public class TocReturnBasicArchivesCacheUtil {
stringBdInvmandocEntityMap.put(bdInvmandocEntity1.getInvcode() + bdInvmandocEntity1.getPkCorp(), bdInvmandocEntity1); stringBdInvmandocEntityMap.put(bdInvmandocEntity1.getInvcode() + bdInvmandocEntity1.getPkCorp(), bdInvmandocEntity1);
} }
} }
return stringBdInvmandocEntityMap;
} }
/** /**
* 初始化存货基本档案 * 初始化存货基本档案
* 2024年8月7日 10:57:55 * 2024年8月7日 10:57:55
*/ */
public static Map<String, BdInvbasdocEntity> stringBdInvbasdocEntityHashMap = new HashMap<>(); // public static Map<String, BdInvbasdocEntity> stringBdInvbasdocEntityHashMap = new HashMap<>();
private Map<String, BdInvbasdocEntity> initBasicInventoryFile() throws Exception {
Map<String, BdInvbasdocEntity> stringBdInvbasdocEntityHashMap = new HashMap<>();
private void initBasicInventoryFile() throws Exception {
BdInvbasdocEntity bdInvbasdocEntity = new BdInvbasdocEntity(); BdInvbasdocEntity bdInvbasdocEntity = new BdInvbasdocEntity();
// bdInvbasdocEntity.setPk_invmandoc(bdInvmandocEntity1.getPkInvmandoc()); // bdInvbasdocEntity.setPk_invmandoc(bdInvmandocEntity1.getPkInvmandoc());
// bdInvbasdocEntity.setPk_corp(shippingCompanyBdCorpEntity.getPkCorp()); // bdInvbasdocEntity.setPk_corp(shippingCompanyBdCorpEntity.getPkCorp());
@ -231,6 +247,7 @@ public class TocReturnBasicArchivesCacheUtil {
stringBdInvbasdocEntityHashMap.put(bdInvbasdocEntity1.getPk_invmandoc() + bdInvbasdocEntity1.getPk_corp_man(), bdInvbasdocEntity1); stringBdInvbasdocEntityHashMap.put(bdInvbasdocEntity1.getPk_invmandoc() + bdInvbasdocEntity1.getPk_corp_man(), bdInvbasdocEntity1);
} }
} }
return stringBdInvbasdocEntityHashMap;
} }
/** /**
@ -239,9 +256,10 @@ public class TocReturnBasicArchivesCacheUtil {
* *
* @author liuyang * @author liuyang
*/ */
public static Map<String, BdTaxitemsEntity> stringBdTaxitemsEntityHashMap = new HashMap<>(); // public static Map<String, BdTaxitemsEntity> stringBdTaxitemsEntityHashMap = new HashMap<>();
private Map<String, BdTaxitemsEntity> initBdTaxitemsEntity() throws Exception {
Map<String, BdTaxitemsEntity> stringBdTaxitemsEntityHashMap = new HashMap<>();
private void initBdTaxitemsEntity() throws Exception {
BdTaxitemsEntity bdTaxitemsEntity = new BdTaxitemsEntity(); BdTaxitemsEntity bdTaxitemsEntity = new BdTaxitemsEntity();
List<BdTaxitemsEntity> bdTaxitemsEntityList = iBdTaxitemsDao.queryBdInvbasdocByInvcodeV2(bdTaxitemsEntity); List<BdTaxitemsEntity> bdTaxitemsEntityList = iBdTaxitemsDao.queryBdInvbasdocByInvcodeV2(bdTaxitemsEntity);
if (bdTaxitemsEntityList != null && bdTaxitemsEntityList.size() > 0) { if (bdTaxitemsEntityList != null && bdTaxitemsEntityList.size() > 0) {
@ -250,6 +268,7 @@ public class TocReturnBasicArchivesCacheUtil {
stringBdTaxitemsEntityHashMap.put(bdTaxitemsEntity1.getInvcode(), bdTaxitemsEntity1); stringBdTaxitemsEntityHashMap.put(bdTaxitemsEntity1.getInvcode(), bdTaxitemsEntity1);
} }
} }
return stringBdTaxitemsEntityHashMap;
} }
/** /**
@ -257,9 +276,10 @@ public class TocReturnBasicArchivesCacheUtil {
* *
* @author liuyang * @author liuyang
*/ */
public static Map<String, BdDefdocEntity> stringBdDefdocEntityHashMap = new HashMap<>(); // public static Map<String, BdDefdocEntity> stringBdDefdocEntityHashMap = new HashMap<>();
private Map<String, BdDefdocEntity> initSourcePlatform() {
Map<String, BdDefdocEntity> stringBdDefdocEntityHashMap = new HashMap<>();
private void initSourcePlatform() {
BdDefdocEntity bdDefdocEntity = new BdDefdocEntity(); BdDefdocEntity bdDefdocEntity = new BdDefdocEntity();
bdDefdocEntity.setPkDefdoclist("0001A210000000000JUD"); bdDefdocEntity.setPkDefdoclist("0001A210000000000JUD");
bdDefdocEntity.setDr(0); bdDefdocEntity.setDr(0);
@ -271,14 +291,16 @@ public class TocReturnBasicArchivesCacheUtil {
stringBdDefdocEntityHashMap.put(bdDefdocEntity1.getDoccode(), bdDefdocEntity1); stringBdDefdocEntityHashMap.put(bdDefdocEntity1.getDoccode(), bdDefdocEntity1);
} }
} }
return stringBdDefdocEntityHashMap;
} }
/** /**
* 2024年8月14日 15:17:48 缓存U8C店铺自定义档案逻辑 * 2024年8月14日 15:17:48 缓存U8C店铺自定义档案逻辑
*/ */
public static Map<String, BdDefdocEntity> shopDefdocEntityHashMap = new HashMap<>(); // public static Map<String, BdDefdocEntity> shopDefdocEntityHashMap = new HashMap<>();
private Map<String, BdDefdocEntity> initShopDiy() {
Map<String, BdDefdocEntity> shopDefdocEntityHashMap = new HashMap<>();
private void initShopDiy() {
BdDefdocEntity bdDefdocEntity = new BdDefdocEntity(); BdDefdocEntity bdDefdocEntity = new BdDefdocEntity();
bdDefdocEntity.setPkDefdoclist("0001A210000000000XZX"); bdDefdocEntity.setPkDefdoclist("0001A210000000000XZX");
bdDefdocEntity.setDr(0); bdDefdocEntity.setDr(0);
@ -290,14 +312,17 @@ public class TocReturnBasicArchivesCacheUtil {
shopDefdocEntityHashMap.put(bdDefdocEntity1.getDoccode(), bdDefdocEntity1); shopDefdocEntityHashMap.put(bdDefdocEntity1.getDoccode(), bdDefdocEntity1);
} }
} }
return shopDefdocEntityHashMap;
} }
public static Map<String, BdRdclEntity> stringBdRdclEntityHashMap = new HashMap<>(); // public static Map<String, BdRdclEntity> stringBdRdclEntityHashMap = new HashMap<>();
/** /**
* 初始化收发类别 * 初始化收发类别
*/ */
private Map<String, BdRdclEntity> initBdRdcl() { private Map<String, BdRdclEntity> initBdRdcl() {
Map<String, BdRdclEntity> stringBdRdclEntityHashMap = new HashMap<>();
BdRdclEntity bdRdclEntity = new BdRdclEntity(); BdRdclEntity bdRdclEntity = new BdRdclEntity();
bdRdclEntity.setDr(0); bdRdclEntity.setDr(0);
bdRdclEntity.setDataSourceCode("lets_u8c"); bdRdclEntity.setDataSourceCode("lets_u8c");
@ -316,42 +341,57 @@ public class TocReturnBasicArchivesCacheUtil {
* *
* @author liuyang * @author liuyang
*/ */
public void clearCache() throws Exception { // public void clearCache() throws Exception {
stringBdCorpEntityMap.clear(); // stringBdCorpEntityMap.clear();
stringBdStordocEntityMap.clear(); // stringBdStordocEntityMap.clear();
stringBdCalbodyEntityMap.clear(); // stringBdCalbodyEntityMap.clear();
stringBdSalestruEntityMap.clear(); // stringBdSalestruEntityMap.clear();
stringBdDeptdocEntityMap.clear(); // stringBdDeptdocEntityMap.clear();
stringBdCumandocEntityMap.clear(); // stringBdCumandocEntityMap.clear();
stringBdInvmandocEntityMap.clear(); // stringBdInvmandocEntityMap.clear();
stringBdInvbasdocEntityHashMap.clear(); // stringBdInvbasdocEntityHashMap.clear();
stringBdTaxitemsEntityHashMap.clear(); // stringBdTaxitemsEntityHashMap.clear();
stringBdCubasdocEntityHashMap.clear(); // stringBdCubasdocEntityHashMap.clear();
stringBdDefdocEntityHashMap.clear(); // stringBdDefdocEntityHashMap.clear();
shopDefdocEntityHashMap.clear(); // shopDefdocEntityHashMap.clear();
stringBdRdclEntityHashMap.clear(); // stringBdRdclEntityHashMap.clear();
} // }
/** /**
* 初始化缓存 * 初始化缓存
* *
* @author liuyang * @author liuyang
*/ */
public void initCache() throws Exception { public CacheTocMapVoV2 initCache() throws Exception {
clearCache(); // clearCache();
Map<String, BdCorpEntity> stringBdCorpEntityMap = initShop();
Map<String, BdStordocEntity> stringBdStordocEntityMap = initBdStordoc();
Map<String, BdCalbodyEntity> stringBdCalbodyEntityMap = initBdCalbody();
Map<String, BdSalestruEntity> stringBdSalestruEntityMap = initBdSalestru();
Map<String, BdDeptdocEntity> stringBdDeptdocEntityMap = initDept();
Map<String, BdCubasdocEntity> stringBdCubasdocEntityMap = initBdCubasdoc();
Map<String, BdCumandocEntity> stringBdCumandocEntityMap = initBdCumandoc();
Map<String, BdInvmandocEntity> stringBdInvmandocEntityMap = initInventoryFile();
Map<String, BdInvbasdocEntity> stringBdInvbasdocEntityMap = initBasicInventoryFile();
Map<String, BdTaxitemsEntity> stringBdTaxitemsEntityMap = initBdTaxitemsEntity();
Map<String, BdDefdocEntity> stringBdDefdocEntityMap = initSourcePlatform();
Map<String, BdDefdocEntity> stringBdDefdocEntityMap1 = initShopDiy();
Map<String, BdRdclEntity> stringBdRdclEntityMap = initBdRdcl();
initShop(); CacheTocMapVoV2 cacheTocMapVoV2 = new CacheTocMapVoV2();
initBdStordoc(); cacheTocMapVoV2.setStringBdCorpEntityMap(stringBdCorpEntityMap);
initBdCalbody(); cacheTocMapVoV2.setStringBdStordocEntityMap(stringBdStordocEntityMap);
initBdSalestru(); cacheTocMapVoV2.setStringBdCalbodyEntityMap(stringBdCalbodyEntityMap);
initDept(); cacheTocMapVoV2.setStringBdSalestruEntityMap(stringBdSalestruEntityMap);
initBdCumandoc(); cacheTocMapVoV2.setStringBdDeptdocEntityMap(stringBdDeptdocEntityMap);
initInventoryFile(); cacheTocMapVoV2.setStringBdCubasdocEntityMap(stringBdCubasdocEntityMap);
initBasicInventoryFile(); cacheTocMapVoV2.setStringBdCumandocEntityMap(stringBdCumandocEntityMap);
initBdTaxitemsEntity(); cacheTocMapVoV2.setStringBdInvmandocEntityMap(stringBdInvmandocEntityMap);
initBdCubasdoc(); cacheTocMapVoV2.setStringBdInvbasdocEntityMap(stringBdInvbasdocEntityMap);
initSourcePlatform(); cacheTocMapVoV2.setStringBdTaxitemsEntityMap(stringBdTaxitemsEntityMap);
initShopDiy(); cacheTocMapVoV2.setStringBdDefdocEntityMap(stringBdDefdocEntityMap);
initBdRdcl(); cacheTocMapVoV2.setStringBdDefdocEntityMap1(stringBdDefdocEntityMap1);
cacheTocMapVoV2.setStringBdRdclEntityMap(stringBdRdclEntityMap);
return cacheTocMapVoV2;
} }
} }

View File

@ -59,5 +59,11 @@ public class SoSaleOutPluginInitializerToBTest {
// } catch (Exception e) { // } catch (Exception e) {
// e.printStackTrace(); // e.printStackTrace();
// } // }
try{
soSaleOutPluginInitializerToB.startImplementByTranTime("2024-09-12 14:04:00","2024-09-12 14:12:00");
}catch (Exception e){
e.printStackTrace();
}
} }
} }

View File

@ -24,6 +24,12 @@ public class SoSaleReturnPluginInitializerToCTest {
@Test @Test
public void startImplement() { public void startImplement() {
soSaleReturnPluginInitializerToC.startImplement(null, null); // soSaleReturnPluginInitializerToC.startImplement(null, null);
try {
String code = "LETS-RE2022080200000036";
soSaleReturnPluginInitializerToC.startImplementByCode(code, null);
} catch (Exception e) {
e.printStackTrace();
}
} }
} }