diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdCubasdocEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdCubasdocEntity.xml
index c5c502bb..1f413919 100644
--- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdCubasdocEntity.xml
+++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdCubasdocEntity.xml
@@ -232,6 +232,10 @@
and ts >= #{modifytime_start_time}
and ts <= #{modifytime_end_time}
+
+
+ and custcode in (${custcodes})
+
order by sorts asc
order by ${sort} ${order}
diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdTaxitemsEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdTaxitemsEntity.xml
index a9f53b6c..2c50dc57 100644
--- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdTaxitemsEntity.xml
+++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdTaxitemsEntity.xml
@@ -207,7 +207,7 @@
and bd_invbasdoc.invcode = #{invcode}
- and bd_invbasdoc.invcode in ${invcodes}
+ and bd_invbasdoc.invcode in (${invcodes})
diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.xml
index b3ce7554..17e7a583 100644
--- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.xml
+++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.xml
@@ -882,7 +882,7 @@
insert into tocofs_returngoods_detailed(id,newPushDate3,newTransmitInfo3,newState3,newSystemNumber3,newSystemPrimary3)
values
- (#{entity.id},#{entity.newpushdate3},#{entity.newtransmitinfo3},#{entity.newstate3},#{entity.newsystemnumber3},#{entity.newSystemPrimary3})
+ (#{entity.id},#{entity.newpushdate3},#{entity.newtransmitinfo3},#{entity.newstate3},#{entity.newsystemnumber3},#{entity.newsystemprimary3})
on duplicate key update
id = values(id),
diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java
index 5ee97c2d..a1f25ab0 100644
--- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java
+++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java
@@ -962,12 +962,12 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
if (returnGoodHeaderDetailsDataDtoList1 != null && returnGoodHeaderDetailsDataDtoList1.size() > 0) {
try {
//初始化档案缓存
- CacheTocMapVoV2 cacheTocMapVoV2 = tocReturnBasicArchivesCacheUtil.initCache();
+ CacheTocMapVoV2 cacheTocMapVoV2 = tocReturnBasicArchivesCacheUtil.initCache(returnGoodHeaderDetailsDataDtoList1);
//查询OFS售后入库单对应的售后订单
List rerturnGoodsOrderSearchData = queryBatchAfterSalesOrder(returnGoodHeaderDetailsDataDtoList1);
findAfterSalesOrder(rerturnGoodsOrderSearchData, returnGoodHeaderDetailsDataDtoList1);
//查询OFS售后订单对应的OFS销售订单
- List headerDetailsDtos = queryBatchOfsOrder(rerturnGoodsOrderSearchData);
+ List headerDetailsDtos = queryBatchOfsOrder(returnGoodHeaderDetailsDataDtoList1);
findOfsOrder(headerDetailsDtos, returnGoodHeaderDetailsDataDtoList1);
for (int i = 0; i < returnGoodHeaderDetailsDataDtoList1.size(); i++) {
@@ -994,6 +994,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
//表头公司:通过名称匹配U8C公司
// String corpName = "上海丽知品牌管理有限公司";
+ //TODO 测试SHOF
+ header.setCompanyCode("SHOF");
Assert.notNull(header.getCompanyCode(), "O货主编码不能为空");
BdCorpEntity bdCorpEntity = cacheTocMapVoV2.getStringBdCorpEntityMap().get(header.getCompanyCode());
Assert.notNull(bdCorpEntity, "根据O公司编码(货主编码)({})没有匹配到U8C公司档案", header.getCompanyCode());
@@ -1058,8 +1060,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
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());
+ BdInvbasdocEntity bdInvbasdocEntity = cacheTocMapVoV2.getStringBdInvbasdocEntityMap().get(stockinB.getSkuCode());
+ Assert.notNull(bdInvbasdocEntity, "无法匹配到存货基本档案 存货编码:{}", stockinB.getSkuCode());
//存货税率
BdTaxitemsEntity bdTaxitemsEntity = cacheTocMapVoV2.getStringBdTaxitemsEntityMap().get(bdInvmandocEntity.getInvcode());
Assert.notNull(bdTaxitemsEntity, "无法匹配到存货税率 存货编码:{}", bdInvmandocEntity.getInvcode());
@@ -1557,7 +1559,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
RerturnGoodsOrderSearchData rerturnGoodsOrderSearchData = rerturnGoodsOrderSearchDataList.get(j);
RerturnGoodsOrderSearchHeader header1 = rerturnGoodsOrderSearchData.getHeader();
List details1 = rerturnGoodsOrderSearchData.getDetails();
- if (header.getId().equals(header1.getRefOrderId())) {
+ if (header.getRefOrderId().equals(header1.getId())) {
header.setRerturnGoodsOrderSearchData(rerturnGoodsOrderSearchData);
}
}
@@ -1599,25 +1601,31 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
/**
* 通过售后订单,匹配OFS销售订单
*
+ * @param returnGoodHeaderDetailsDataDtoList1 OFS售后入库单集合
* @author liuyang
*/
- private List queryBatchOfsOrder(List rerturnGoodsOrderSearchData) throws Exception {
+ private List queryBatchOfsOrder(List returnGoodHeaderDetailsDataDtoList1) throws Exception {
List headerDetailsDtoArrayList = new ArrayList<>();
- if (rerturnGoodsOrderSearchData != null && rerturnGoodsOrderSearchData.size() > 0) {
+ if (returnGoodHeaderDetailsDataDtoList1 != null && returnGoodHeaderDetailsDataDtoList1.size() > 0) {
try {
//每50个作为一批,拆分
- List> lists = SplitListByCountUtil.splitListByCount(rerturnGoodsOrderSearchData, 50);
- for (int i = 0; i < lists.size(); i++) {
- List rerturnGoodsOrderSearchData1 = lists.get(i);
- StringBuffer codes = new StringBuffer();
- for (int j = 0; j < rerturnGoodsOrderSearchData.size(); j++) {
- RerturnGoodsOrderSearchData rerturnGoodsOrderSearchData2 = rerturnGoodsOrderSearchData.get(j);
- RerturnGoodsOrderSearchHeader header = rerturnGoodsOrderSearchData2.getHeader();
- List details = rerturnGoodsOrderSearchData2.getDetails();
+ List> splitListByCount = SplitListByCountUtil.splitListByCount(returnGoodHeaderDetailsDataDtoList1, 50);
+ for (int i = 0; i < splitListByCount.size(); i++) {
+ List stockinOrderList = splitListByCount.get(i);
- codes.append(header.getCode());
- codes.append(",");
+ StringBuffer codes = new StringBuffer();
+ for (int j = 0; j < stockinOrderList.size(); j++) {
+ StockinOrderSearchResponse.StockinOrder stockinOrder = stockinOrderList.get(j);
+ StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
+ List details = stockinOrder.getDetails();
+ RerturnGoodsOrderSearchData rerturnGoodsOrderSearchData1 = header.getRerturnGoodsOrderSearchData();//OFS售后订单
+ if (rerturnGoodsOrderSearchData1 != null) {
+ RerturnGoodsOrderSearchHeader header1 = rerturnGoodsOrderSearchData1.getHeader();
+ List details1 = rerturnGoodsOrderSearchData1.getDetails();
+ codes.append(header1.getRefOrderCode());
+ codes.append(",");
+ }
}
String codesStr = codes.substring(0, codes.length() - 1);
diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/TocOrderBasicArchivesCacheUtil.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/TocOrderBasicArchivesCacheUtil.java
index 507a9e3f..c46194cc 100644
--- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/TocOrderBasicArchivesCacheUtil.java
+++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/TocOrderBasicArchivesCacheUtil.java
@@ -1,5 +1,6 @@
package com.hzya.frame.plugin.lets.util;
+import cn.hutool.core.lang.Assert;
import com.hzya.frame.plugin.lets.constant.OverallConstant;
import com.hzya.frame.plugin.lets.dao.*;
import com.hzya.frame.plugin.lets.entity.*;
@@ -508,9 +509,12 @@ public class TocOrderBasicArchivesCacheUtil {
/**
* 初始化缓存
*
+ * @param headerDetailsDtoList OFS销售出库单对象
* @author liuyang
*/
public CacheTocMapVo initCache(List headerDetailsDtoList) throws Exception {
+ Assert.notNull(headerDetailsDtoList, "headerDetailsDtoList不能为空!");
+
// clearCache();
List detailsDtos = initOfsDetailsDto(headerDetailsDtoList);
List headerDtoList = initOFsHeadDto(headerDetailsDtoList);
diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/TocReturnBasicArchivesCacheUtil.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/TocReturnBasicArchivesCacheUtil.java
index 2987f6b2..20fa0535 100644
--- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/TocReturnBasicArchivesCacheUtil.java
+++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/TocReturnBasicArchivesCacheUtil.java
@@ -1,14 +1,22 @@
package com.hzya.frame.plugin.lets.util;
+import cn.hutool.core.lang.Assert;
+import com.hzya.frame.plugin.lets.constant.OverallConstant;
import com.hzya.frame.plugin.lets.dao.*;
import com.hzya.frame.plugin.lets.entity.*;
import com.hzya.frame.plugin.lets.resultvo.CacheTocMapVoV2;
+import com.hzya.frame.split.SplitListByCountUtil;
+import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto;
+import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto;
+import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
/**
* 档案类缓存,TOC销售订单转换
@@ -169,20 +177,45 @@ public class TocReturnBasicArchivesCacheUtil {
* @author liuyang
*/
// public static Map stringBdCubasdocEntityHashMap = new HashMap<>();
- private Map initBdCubasdoc() {
- Map stringBdCubasdocEntityHashMap = new HashMap<>();
+// private Map initBdCubasdoc() {
+// Map stringBdCubasdocEntityHashMap = new HashMap<>();
+//
+// BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity();
+// bdCubasdocEntity.setDataSourceCode("lets_u8c");
+// bdCubasdocEntity.setDr(0L);
+// List bdCumandocEntityList = iBdCubasdocDao.query(bdCubasdocEntity);
+// if (bdCumandocEntityList != null && bdCumandocEntityList.size() > 0) {
+// for (int i = 0; i < bdCumandocEntityList.size(); i++) {
+// BdCubasdocEntity bdCubasdocEntity1 = bdCumandocEntityList.get(i);
+// stringBdCubasdocEntityHashMap.put(bdCubasdocEntity1.getCustname(), bdCubasdocEntity1);
+// }
+// }
+// return stringBdCubasdocEntityHashMap;
+// }
+ private Map initBdCubasdocV2(List headerDtoList) {
+ Map stringBdCubasdocEntityMap = new HashMap<>();
+ List allBdCumandocEntityList = new ArrayList<>();
+ if (headerDtoList != null && headerDtoList.size() > 0) {
+ List> lists = SplitListByCountUtil.splitListByCount(headerDtoList, 500);
+ for (int i = 0; i < lists.size(); i++) {
+ List stockinHList = lists.get(i);
+ String codesStr = stockinHList.stream().map(StockinOrderSearchResponse.StockinOrder.StockinH::getStoreCode).map(id -> "'" + id + "'").collect(Collectors.joining(","));
- BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity();
- bdCubasdocEntity.setDataSourceCode("lets_u8c");
- bdCubasdocEntity.setDr(0L);
- List bdCumandocEntityList = iBdCubasdocDao.query(bdCubasdocEntity);
- if (bdCumandocEntityList != null && bdCumandocEntityList.size() > 0) {
- for (int i = 0; i < bdCumandocEntityList.size(); i++) {
- BdCubasdocEntity bdCubasdocEntity1 = bdCumandocEntityList.get(i);
- stringBdCubasdocEntityHashMap.put(bdCubasdocEntity1.getCustname(), bdCubasdocEntity1);
+ BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity();
+ bdCubasdocEntity.setDataSourceCode("lets_u8c");
+ bdCubasdocEntity.setDr(0L);
+ bdCubasdocEntity.setCustcodes(codesStr);
+ List bdCumandocEntityList = iBdCubasdocDao.query(bdCubasdocEntity);
+ allBdCumandocEntityList.addAll(bdCumandocEntityList);
}
}
- return stringBdCubasdocEntityHashMap;
+ if (allBdCumandocEntityList.size() > 0) {
+ for (int i = 0; i < allBdCumandocEntityList.size(); i++) {
+ BdCubasdocEntity bdCubasdocEntity = allBdCumandocEntityList.get(i);
+ stringBdCubasdocEntityMap.put(bdCubasdocEntity.getCustcode(), bdCubasdocEntity);
+ }
+ }
+ return stringBdCubasdocEntityMap;
}
/**
@@ -191,17 +224,49 @@ public class TocReturnBasicArchivesCacheUtil {
* @author liuyang
*/
// public static Map stringBdCumandocEntityMap = new HashMap<>();
- private Map initBdCumandoc() {
- Map stringBdCumandocEntityMap = new HashMap<>();
+// private Map initBdCumandoc() {
+// Map stringBdCumandocEntityMap = new HashMap<>();
+//
+// BdCumandocEntity bdCumandocEntity1 = new BdCumandocEntity();
+// bdCumandocEntity1.setDataSourceCode("lets_u8c");
+// bdCumandocEntity1.setDr(0L);
+//// bdCumandocEntity1.setCustflags(ProfilesActiveConstant.CUSTOMER);//客商:2客户
+// List bdCumandocEntityList = iBdCumandocDao.query(bdCumandocEntity1);
+// if (bdCumandocEntityList != null && bdCumandocEntityList.size() > 0) {
+// for (int i = 0; i < bdCumandocEntityList.size(); i++) {
+// BdCumandocEntity bdCumandocEntity = bdCumandocEntityList.get(i);
+// stringBdCumandocEntityMap.put(bdCumandocEntity.getPkCubasdoc() + bdCumandocEntity.getPkCorp(), bdCumandocEntity);
+// }
+// }
+// return stringBdCumandocEntityMap;
+// }
- BdCumandocEntity bdCumandocEntity1 = new BdCumandocEntity();
- bdCumandocEntity1.setDataSourceCode("lets_u8c");
- bdCumandocEntity1.setDr(0L);
-// bdCumandocEntity1.setCustflags(ProfilesActiveConstant.CUSTOMER);//客商:2客户
- List bdCumandocEntityList = iBdCumandocDao.query(bdCumandocEntity1);
- if (bdCumandocEntityList != null && bdCumandocEntityList.size() > 0) {
- for (int i = 0; i < bdCumandocEntityList.size(); i++) {
- BdCumandocEntity bdCumandocEntity = bdCumandocEntityList.get(i);
+ /**
+ * 查询客商管理档案
+ *
+ * @author liuyang
+ */
+ private Map initBdCumandocV2(List headerDtoList) throws Exception {
+ Map stringBdCumandocEntityMap = new HashMap<>();
+ List allBdCumandocEntityList = new ArrayList<>();
+
+ if (headerDtoList != null && headerDtoList.size() > 0) {
+ List> lists = SplitListByCountUtil.splitListByCount(headerDtoList, 500);
+ for (int i = 0; i < lists.size(); i++) {
+ List stockinHList = lists.get(i);
+ String codesStr = stockinHList.stream().map(StockinOrderSearchResponse.StockinOrder.StockinH::getStoreCode).map(id -> "'" + id + "'").collect(Collectors.joining(","));
+
+ BdCumandocEntity bdCumandocEntity = new BdCumandocEntity();
+ bdCumandocEntity.setDataSourceCode("lets_u8c");
+ bdCumandocEntity.setDr(0L);
+ bdCumandocEntity.setCustcodes(codesStr);
+ List bdCumandocEntityList = iBdCumandocDao.query(bdCumandocEntity);
+ allBdCumandocEntityList.addAll(bdCumandocEntityList);
+ }
+ }
+ if (allBdCumandocEntityList.size() > 0) {
+ for (int i = 0; i < allBdCumandocEntityList.size(); i++) {
+ BdCumandocEntity bdCumandocEntity = allBdCumandocEntityList.get(i);
stringBdCumandocEntityMap.put(bdCumandocEntity.getPkCubasdoc() + bdCumandocEntity.getPkCorp(), bdCumandocEntity);
}
}
@@ -212,18 +277,42 @@ public class TocReturnBasicArchivesCacheUtil {
* 初始化存货管理档案
*/
// public static Map stringBdInvmandocEntityMap = new HashMap<>();
- private Map initInventoryFile() throws Exception {
+// private Map initInventoryFile() throws Exception {
+// Map stringBdInvmandocEntityMap = new HashMap<>();
+//
+// BdInvmandocEntity bdInvmandocEntity = new BdInvmandocEntity();
+//// bdInvmandocEntity.setInvcode(copyRowDetailsListVo.getSpec_no());
+//// bdInvmandocEntity.setPkCorp(shippingCompanyBdCorpEntity.getPkCorp());
+// List bdInvmandocEntity2 = iBdInvmandocDao.queryBdInvmandocByInvcodeList(bdInvmandocEntity);
+// if (bdInvmandocEntity2 != null && bdInvmandocEntity2.size() > 0) {
+// for (int i = 0; i < bdInvmandocEntity2.size(); i++) {
+// BdInvmandocEntity bdInvmandocEntity1 = bdInvmandocEntity2.get(i);
+// //2024年8月6日 14:27:45 通过存货编码+公司缓存
+// stringBdInvmandocEntityMap.put(bdInvmandocEntity1.getInvcode() + bdInvmandocEntity1.getPkCorp(), bdInvmandocEntity1);
+// }
+// }
+// return stringBdInvmandocEntityMap;
+// }
+ public Map initInventoryFileV2(List detailsDtos) throws Exception {
+ List allBdInvmandocEntity = new ArrayList<>();
Map stringBdInvmandocEntityMap = new HashMap<>();
- BdInvmandocEntity bdInvmandocEntity = new BdInvmandocEntity();
-// bdInvmandocEntity.setInvcode(copyRowDetailsListVo.getSpec_no());
-// bdInvmandocEntity.setPkCorp(shippingCompanyBdCorpEntity.getPkCorp());
- List bdInvmandocEntity2 = iBdInvmandocDao.queryBdInvmandocByInvcodeList(bdInvmandocEntity);
- if (bdInvmandocEntity2 != null && bdInvmandocEntity2.size() > 0) {
- for (int i = 0; i < bdInvmandocEntity2.size(); i++) {
- BdInvmandocEntity bdInvmandocEntity1 = bdInvmandocEntity2.get(i);
- //2024年8月6日 14:27:45 通过存货编码+公司缓存
- stringBdInvmandocEntityMap.put(bdInvmandocEntity1.getInvcode() + bdInvmandocEntity1.getPkCorp(), bdInvmandocEntity1);
+ if (detailsDtos != null && detailsDtos.size() > 0) {
+ List> lists = SplitListByCountUtil.splitListByCount(detailsDtos, 500);
+ for (int i = 0; i < lists.size(); i++) {
+ List stockinBList = lists.get(i);
+ String idsStr = stockinBList.stream().map(StockinOrderSearchResponse.StockinOrder.StockinB::getSkuCode).map(id -> "'" + id + "'").collect(Collectors.joining(","));
+
+ BdInvmandocEntity bdInvmandocEntity = new BdInvmandocEntity();
+ bdInvmandocEntity.setInvcodes(idsStr);
+ List bdInvmandocEntity2 = iBdInvmandocDao.queryBdInvmandocByInvcodeList(bdInvmandocEntity);
+ allBdInvmandocEntity.addAll(bdInvmandocEntity2);
+ }
+ }
+ if (allBdInvmandocEntity.size() > 0) {
+ for (int i = 0; i < allBdInvmandocEntity.size(); i++) {
+ BdInvmandocEntity bdInvmandocEntity = allBdInvmandocEntity.get(i);
+ stringBdInvmandocEntityMap.put(bdInvmandocEntity.getInvcode() + bdInvmandocEntity.getPkCorp(), bdInvmandocEntity);
}
}
return stringBdInvmandocEntityMap;
@@ -234,20 +323,47 @@ public class TocReturnBasicArchivesCacheUtil {
* 2024年8月7日 10:57:55
*/
// public static Map stringBdInvbasdocEntityHashMap = new HashMap<>();
- private Map initBasicInventoryFile() throws Exception {
- Map stringBdInvbasdocEntityHashMap = new HashMap<>();
+// private Map initBasicInventoryFile() throws Exception {
+// Map stringBdInvbasdocEntityHashMap = new HashMap<>();
+//
+// BdInvbasdocEntity bdInvbasdocEntity = new BdInvbasdocEntity();
+//// bdInvbasdocEntity.setPk_invmandoc(bdInvmandocEntity1.getPkInvmandoc());
+//// bdInvbasdocEntity.setPk_corp(shippingCompanyBdCorpEntity.getPkCorp());
+// List bdInvbasdocEntity2 = iBdInvbasdocDao.queryBdInvbasdocByPkInvmandocV2(bdInvbasdocEntity);
+// if (bdInvbasdocEntity2 != null && bdInvbasdocEntity2.size() > 0) {
+// for (int i = 0; i < bdInvbasdocEntity2.size(); i++) {
+// BdInvbasdocEntity bdInvbasdocEntity1 = bdInvbasdocEntity2.get(i);
+// stringBdInvbasdocEntityHashMap.put(bdInvbasdocEntity1.getPk_invmandoc() + bdInvbasdocEntity1.getPk_corp_man(), bdInvbasdocEntity1);
+// }
+// }
+// return stringBdInvbasdocEntityHashMap;
+// }
- BdInvbasdocEntity bdInvbasdocEntity = new BdInvbasdocEntity();
-// bdInvbasdocEntity.setPk_invmandoc(bdInvmandocEntity1.getPkInvmandoc());
-// bdInvbasdocEntity.setPk_corp(shippingCompanyBdCorpEntity.getPkCorp());
- List bdInvbasdocEntity2 = iBdInvbasdocDao.queryBdInvbasdocByPkInvmandocV2(bdInvbasdocEntity);
- if (bdInvbasdocEntity2 != null && bdInvbasdocEntity2.size() > 0) {
- for (int i = 0; i < bdInvbasdocEntity2.size(); i++) {
- BdInvbasdocEntity bdInvbasdocEntity1 = bdInvbasdocEntity2.get(i);
- stringBdInvbasdocEntityHashMap.put(bdInvbasdocEntity1.getPk_invmandoc() + bdInvbasdocEntity1.getPk_corp_man(), bdInvbasdocEntity1);
+ /**
+ * 根据O存货商家编码初始化存货基本档案
+ *
+ * @author liuyang
+ */
+ private Map initBasicInventoryFileV2(List detailsDtoList) throws Exception {
+ List allBdInvbasdocEntityList = new ArrayList<>();
+ if (detailsDtoList != null && detailsDtoList.size() > 0) {
+ List> lists = SplitListByCountUtil.splitListByCount(detailsDtoList, 500);
+ for (int i = 0; i < lists.size(); i++) {
+ List stockinBList = lists.get(i);
+ String idsStr = stockinBList.stream().map(StockinOrderSearchResponse.StockinOrder.StockinB::getSkuCode).map(id -> "'" + id + "'").collect(Collectors.joining(","));
+
+ BdInvbasdocEntity bdInvbasdocEntity = new BdInvbasdocEntity();
+ bdInvbasdocEntity.setInvcodes(idsStr);
+ List bdInvbasdocEntities = iBdInvbasdocDao.queryBdInvbasdocByPkInvmandocV3(bdInvbasdocEntity);
+ allBdInvbasdocEntityList.addAll(bdInvbasdocEntities);
}
}
- return stringBdInvbasdocEntityHashMap;
+ Map stringBdInvbasdocEntityMap = new HashMap<>();
+ for (int i = 0; i < allBdInvbasdocEntityList.size(); i++) {
+ BdInvbasdocEntity bdInvbasdocEntity = allBdInvbasdocEntityList.get(i);
+ stringBdInvbasdocEntityMap.put(bdInvbasdocEntity.getInvcode(), bdInvbasdocEntity);
+ }
+ return stringBdInvbasdocEntityMap;
}
/**
@@ -257,18 +373,41 @@ public class TocReturnBasicArchivesCacheUtil {
* @author liuyang
*/
// public static Map stringBdTaxitemsEntityHashMap = new HashMap<>();
- private Map initBdTaxitemsEntity() throws Exception {
- Map stringBdTaxitemsEntityHashMap = new HashMap<>();
+// private Map initBdTaxitemsEntity() throws Exception {
+// Map stringBdTaxitemsEntityHashMap = new HashMap<>();
+//
+// BdTaxitemsEntity bdTaxitemsEntity = new BdTaxitemsEntity();
+// List bdTaxitemsEntityList = iBdTaxitemsDao.queryBdInvbasdocByInvcodeV2(bdTaxitemsEntity);
+// if (bdTaxitemsEntityList != null && bdTaxitemsEntityList.size() > 0) {
+// for (int i = 0; i < bdTaxitemsEntityList.size(); i++) {
+// BdTaxitemsEntity bdTaxitemsEntity1 = bdTaxitemsEntityList.get(i);
+// stringBdTaxitemsEntityHashMap.put(bdTaxitemsEntity1.getInvcode(), bdTaxitemsEntity1);
+// }
+// }
+// return stringBdTaxitemsEntityHashMap;
+// }
+ private Map initBdTaxitemsEntityV2(List detailsDtos) throws Exception {
+ List allBdTaxitemsEntityList = new ArrayList<>();
+ Map stringBdTaxitemsEntityMap = new HashMap<>();
+ if (detailsDtos != null && detailsDtos.size() > 0) {
+ List> lists = SplitListByCountUtil.splitListByCount(detailsDtos, 500);
+ for (int i = 0; i < lists.size(); i++) {
+ List stockinBList = lists.get(i);
+ String codesStr = stockinBList.stream().map(StockinOrderSearchResponse.StockinOrder.StockinB::getSkuCode).map(id -> "'" + id + "'").collect(Collectors.joining(","));
- BdTaxitemsEntity bdTaxitemsEntity = new BdTaxitemsEntity();
- List bdTaxitemsEntityList = iBdTaxitemsDao.queryBdInvbasdocByInvcodeV2(bdTaxitemsEntity);
- if (bdTaxitemsEntityList != null && bdTaxitemsEntityList.size() > 0) {
- for (int i = 0; i < bdTaxitemsEntityList.size(); i++) {
- BdTaxitemsEntity bdTaxitemsEntity1 = bdTaxitemsEntityList.get(i);
- stringBdTaxitemsEntityHashMap.put(bdTaxitemsEntity1.getInvcode(), bdTaxitemsEntity1);
+ BdTaxitemsEntity bdTaxitemsEntity = new BdTaxitemsEntity();
+ bdTaxitemsEntity.setInvcodes(codesStr);
+ List bdTaxitemsEntityList = iBdTaxitemsDao.queryBdInvbasdocByInvcodeV2(bdTaxitemsEntity);
+ allBdTaxitemsEntityList.addAll(bdTaxitemsEntityList);
}
}
- return stringBdTaxitemsEntityHashMap;
+ if (allBdTaxitemsEntityList.size() > 0) {
+ for (int i = 0; i < allBdTaxitemsEntityList.size(); i++) {
+ BdTaxitemsEntity bdTaxitemsEntity = allBdTaxitemsEntityList.get(i);
+ stringBdTaxitemsEntityMap.put(bdTaxitemsEntity.getInvcode(), bdTaxitemsEntity);
+ }
+ }
+ return stringBdTaxitemsEntityMap;
}
/**
@@ -280,8 +419,10 @@ public class TocReturnBasicArchivesCacheUtil {
private Map initSourcePlatform() {
Map stringBdDefdocEntityHashMap = new HashMap<>();
+ String platformZdyId2 = OverallConstant.getOverAllValue("u8c自定义项档案-平台主键");
BdDefdocEntity bdDefdocEntity = new BdDefdocEntity();
- bdDefdocEntity.setPkDefdoclist("0001A210000000000JUD");
+// bdDefdocEntity.setPkDefdoclist("0001A210000000000JUD");
+ bdDefdocEntity.setPkDefdoclist(platformZdyId2);
bdDefdocEntity.setDr(0);
bdDefdocEntity.setDataSourceCode("lets_u8c");
List bdDefdocEntityList = iBdDefdocDao.query(bdDefdocEntity);
@@ -301,8 +442,10 @@ public class TocReturnBasicArchivesCacheUtil {
private Map initShopDiy() {
Map shopDefdocEntityHashMap = new HashMap<>();
+ String platformZdyId2 = OverallConstant.getOverAllValue("u8c自定义项档案-店铺主键");
BdDefdocEntity bdDefdocEntity = new BdDefdocEntity();
- bdDefdocEntity.setPkDefdoclist("0001A210000000000XZX");
+// bdDefdocEntity.setPkDefdoclist("0001A210000000000XZX");
+ bdDefdocEntity.setPkDefdoclist(platformZdyId2);
bdDefdocEntity.setDr(0);
bdDefdocEntity.setDataSourceCode("lets_u8c");
List bdDefdocEntityList = iBdDefdocDao.query(bdDefdocEntity);
@@ -360,20 +503,26 @@ public class TocReturnBasicArchivesCacheUtil {
/**
* 初始化缓存
*
+ * @param returnGoodHeaderDetailsDataDtoList OFS售后入库单
* @author liuyang
*/
- public CacheTocMapVoV2 initCache() throws Exception {
+ public CacheTocMapVoV2 initCache(List returnGoodHeaderDetailsDataDtoList) throws Exception {
+ Assert.notNull(returnGoodHeaderDetailsDataDtoList, "returnGoodHeaderDetailsDataDtoList不能为空!");
+
+ List stockinBList = initOfsDetailsDto(returnGoodHeaderDetailsDataDtoList);
+ List stockinHList = initOFsHeadDto(returnGoodHeaderDetailsDataDtoList);
+
// clearCache();
Map stringBdCorpEntityMap = initShop();
Map stringBdStordocEntityMap = initBdStordoc();
Map stringBdCalbodyEntityMap = initBdCalbody();
Map stringBdSalestruEntityMap = initBdSalestru();
Map stringBdDeptdocEntityMap = initDept();
- Map stringBdCubasdocEntityMap = initBdCubasdoc();
- Map stringBdCumandocEntityMap = initBdCumandoc();
- Map stringBdInvmandocEntityMap = initInventoryFile();
- Map stringBdInvbasdocEntityMap = initBasicInventoryFile();
- Map stringBdTaxitemsEntityMap = initBdTaxitemsEntity();
+ Map stringBdCubasdocEntityMap = initBdCubasdocV2(stockinHList);
+ Map stringBdCumandocEntityMap = initBdCumandocV2(stockinHList);
+ Map stringBdInvmandocEntityMap = initInventoryFileV2(stockinBList);
+ Map stringBdInvbasdocEntityMap = initBasicInventoryFileV2(stockinBList);
+ Map stringBdTaxitemsEntityMap = initBdTaxitemsEntityV2(stockinBList);
Map stringBdDefdocEntityMap = initSourcePlatform();
Map stringBdDefdocEntityMap1 = initShopDiy();
Map stringBdRdclEntityMap = initBdRdcl();
@@ -394,4 +543,44 @@ public class TocReturnBasicArchivesCacheUtil {
cacheTocMapVoV2.setStringBdRdclEntityMap(stringBdRdclEntityMap);
return cacheTocMapVoV2;
}
+
+ /**
+ * 整理出明细集合
+ *
+ * @author liuyang
+ */
+ private List initOfsDetailsDto(List returnGoodHeaderDetailsDataDtoLis) {
+ List stockinBList = new ArrayList<>();
+
+ if (returnGoodHeaderDetailsDataDtoLis != null && returnGoodHeaderDetailsDataDtoLis.size() > 0) {
+ for (int i = 0; i < returnGoodHeaderDetailsDataDtoLis.size(); i++) {
+ StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoLis.get(i);
+ StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
+ List details = stockinOrder.getDetails();
+
+ stockinBList.addAll(details);
+ }
+ }
+ return stockinBList;
+ }
+
+ /**
+ * 整理出表头集合
+ *
+ * @author liuyang
+ */
+ private List initOFsHeadDto(List returnGoodHeaderDetailsDataDtoLis) throws Exception {
+ List stockinHList = new ArrayList<>();
+
+ if (returnGoodHeaderDetailsDataDtoLis != null && returnGoodHeaderDetailsDataDtoLis.size() > 0) {
+ for (int i = 0; i < returnGoodHeaderDetailsDataDtoLis.size(); i++) {
+ StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoLis.get(i);
+ List details = stockinOrder.getDetails();
+ StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
+ stockinHList.add(header);
+ }
+ }
+
+ return stockinHList;
+ }
}
\ No newline at end of file
diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToCTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToCTest.java
index 98313087..2a500cad 100644
--- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToCTest.java
+++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToCTest.java
@@ -26,8 +26,8 @@ public class SoSaleReturnPluginInitializerToCTest {
public void startImplement() {
// soSaleReturnPluginInitializerToC.startImplement(null, null);
try {
- String code = "LETS-RE2022080200000036";
- soSaleReturnPluginInitializerToC.startImplementByCode(code, null);
+ String code = "LETS-RE2024091400000001";
+ soSaleReturnPluginInitializerToC.startImplementByCode(code, "tran");
} catch (Exception e) {
e.printStackTrace();
}