提交公司档案对照的代码逻辑,涉及TOB、TOC对应的业务

This commit is contained in:
liuy 2024-10-29 17:16:34 +08:00
parent ed21d4ce9d
commit b6d160cfc6
10 changed files with 71 additions and 34 deletions

View File

@ -999,8 +999,6 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
}
// com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header1 = saleOrderMessageDto.getData().get(0).getHeader();
String memberId = header2.getMemberId();
// 测试
// memberId = "9387";
Assert.notNull(memberId, "TOB销售订单(OFS)表头会员id不能为空否则无法匹配U8C客商档案");
Assert.state(!"".equals(memberId.trim()), "TOB销售订单(OFS)表头会员id不能为空否则无法匹配U8C客商档案");
@ -1013,8 +1011,6 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
Assert.notNull(bdRdclEntity, "根据收发类别编码:{} 无法匹配到U8C收发类别");
// 销售公司发货公司
// 测试
// header.setCompanyCode("SHLZ");
String companyCode = header.getCompanyCode();
Assert.notNull(companyCode, "O表头公司不能为空");
String replaceCompanyCode = queryU8CEntityUtil.queryBdDefDocByPkDefDocList(companyCode.trim());
@ -1502,7 +1498,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
}
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header1 = saleOrderMessageDto.getData().get(0).getHeader();
String memberId = header1.getMemberId();
// 测试
//测试
// memberId = "9387";
Assert.notNull(memberId, "TOB销售订单(OFS)表头会员id不能为空否则无法匹配U8C客商档案");
Assert.state(!"".equals(memberId.trim()), "TOB销售订单(OFS)表头会员id不能为空否则无法匹配U8C客商档案");
@ -1753,7 +1749,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
orderOutTobHeaderDto.setHeader(header);
orderOutTobHeaderDto.setDetails(details);
BeanUtil.copyPropertiesV2(header, orderOutTobHeaderDto);
orderOutTobHeaderDtoArrayList.add(orderOutTobHeaderDto);
//成功进入下一个环节

View File

@ -1216,6 +1216,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
ofsOrderSaleAmountAllocationUtil.batchTocSalesAmountAllocation(headerDetailsDtos);
//计算OFS销售订单邮费分摊
ofsOrderSalePostageFeeAllocationUtil.batchTocSalesPostageFeeAllocation(headerDetailsDtos);
//初始化公司档案对照关系
Map<String, String> comparisonCompanyArchives = queryU8CEntityUtil.queryBdDefDocByPkDefDocAll();
for (int i = 0; i < headerDetailsDtoList.size(); i++) {
HeaderDetailsDto headerDetailsDto = headerDetailsDtoList.get(i);
@ -1240,9 +1242,14 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
//表头公司通过名称匹配U8C公司
// String corpName = "上海丽知品牌管理有限公司";
String companyCode = header.getCompanyCode();
//测试
// companyCode = "SHLZ";
Assert.notNull(companyCode, "O出库单表头货主不能为空");
//查找是否替换公司
String targetCorp = comparisonCompanyArchives.get(companyCode);
if (targetCorp != null) {
companyCode = targetCorp;
}
BdCorpEntity bdCorpEntity = cacheTocMapVo.getStringBdCorpEntityMap().get(companyCode.trim());
Assert.notNull(bdCorpEntity, "根据公司编码({})没有匹配到U8C公司档案(公司编码=O货主)", companyCode);

View File

@ -353,7 +353,6 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L);
//测试
queryOfsSoSaleOutVo.setStoreCode(tobShop);
queryOfsSoSaleOutVo.setCode(code);
queryOfsSoSaleOutVo.setInternalInstructionType("RETURN");
@ -1257,7 +1256,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
} else if (icGeneralHEntityList.size() >= 2) {
Assert.state(false, "根据U8C销售订单表头id:{},查询到{}个销售出库单", soSaleEntityList.get(soSaleEntityList.size() - 1).getCsaleid(), icGeneralHEntityList.size());
}
//查询U8C销售订单对应的销售出库单表体
IcGeneralBEntity icGeneralBEntity = new IcGeneralBEntity();
icGeneralBEntity.setCsourcebillhid(soSaleEntityList.get(soSaleEntityList.size() - 1).getCsaleid());

View File

@ -1111,6 +1111,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
findOfsOrder(headerDetailsDtos, returnGoodHeaderDetailsDataDtoList1);
//计算OFS销售订单优惠金额分摊到明细行
ofsOrderAfterSalesAmountAllocationUtil.batchTocSalesAmountAllocation(rerturnGoodsOrderSearchData);
//初始化公司档案对照关系
Map<String, String> comparisonCompanyArchives = queryU8CEntityUtil.queryBdDefDocByPkDefDocAll();
for (int i = 0; i < returnGoodHeaderDetailsDataDtoList1.size(); i++) {
StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoList1.get(i);
@ -1135,12 +1137,14 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
BdRdclEntity bdRdclEntity = cacheTocMapVoV2.getStringBdRdclEntityMap().get(header1.getSubOrderType().trim());
Assert.notNull(bdRdclEntity, "根据业务类型({})没有匹配到U8C业务类型", header1.getSubOrderType().trim());
//表头公司通过名称匹配U8C公司
// String corpName = "上海丽知品牌管理有限公司";
//测试SHOF
// header.setCompanyCode("SHOF");
Assert.notNull(header.getCompanyCode(), "O货主编码不能为空");
BdCorpEntity bdCorpEntity = cacheTocMapVoV2.getStringBdCorpEntityMap().get(header.getCompanyCode().trim());
String companyCode = header.getCompanyCode();
Assert.notNull(companyCode, "O货主编码不能为空");
//查找是否替换公司
String targetCorp = comparisonCompanyArchives.get(companyCode);
if (targetCorp != null) {
companyCode = targetCorp;
}
BdCorpEntity bdCorpEntity = cacheTocMapVoV2.getStringBdCorpEntityMap().get(companyCode.trim());
Assert.notNull(bdCorpEntity, "根据O公司编码(货主编码)({})没有匹配到U8C公司档案", header.getCompanyCode());
//发货库存组织

View File

@ -8,7 +8,9 @@ import com.hzya.frame.plugin.lets.entity.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -329,5 +331,31 @@ public class QueryU8CEntityUtil {
// }
// return corpCode;
}
//key为原公司编码value为现公司编码
public Map<String, String> queryBdDefDocByPkDefDocAll() {
Map<String, String> stringStringHashMap = new HashMap<>();
BdDefdocEntity bdDefdocEntity = new BdDefdocEntity();
bdDefdocEntity.setPkDefdoclist(OverallConstant.getOverAllValue("u8c自定义项档案-公司对照"));
bdDefdocEntity.setDr(0);
bdDefdocEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
List<BdDefdocEntity> bdDefdocEntityList = iBdDefdocDao.query(bdDefdocEntity);
if (bdDefdocEntityList != null && bdDefdocEntityList.size() > 1) {
for (int i = 0; i < bdDefdocEntityList.size(); i++) {
BdDefdocEntity bdDefdocEntity1 = bdDefdocEntityList.get(i);
String doccode = bdDefdocEntity1.getDoccode();
String memo = bdDefdocEntity1.getMemo();
if (doccode != null && doccode.length() > 0 && memo != null && memo.length() > 0) {
String[] split = memo.split(",");
if (split.length > 0) {
stringStringHashMap.put(doccode.trim(), split[0]);
}
}
}
}
return stringStringHashMap;
}
////////////////////////////////////////////////////////////////////////////////////////公司自定义档案查询
}

View File

@ -79,8 +79,8 @@ public class SoSaleOutPluginInitializerToBTest {
// soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024101700000270");
try {
// soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024101800025544", "stock");
soSaleOutPluginInitializerToB.startImplementByStockTime("2024-10-23 16:09:59", "2024-10-23 16:10:01");
soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024101800025544", "tran");
// soSaleOutPluginInitializerToB.startImplementByStockTime("2024-10-23 16:09:59", "2024-10-23 16:10:01");
// String aaa = "LETS-SH2024102300043720";
// soSaleOutPluginInitializerToB.startImplementByCode(aaa, "stock");

View File

@ -109,10 +109,10 @@ class SoSaleOutPluginInitializerToCTest {
// String aaa = "LETS-SH2024101900022025";
// soSaleOutPluginInitializerToC.startImplementStockByCode(aaa, "tran");
// String aaa = "LETS-SH2024102200217857";
// soSaleOutPluginInitializerToC.startImplementStockByCode(aaa, "tran");
String aaa = "LETS-SH2024102200217857";
soSaleOutPluginInitializerToC.startImplementStockByCode(aaa, "stock");
soSaleOutPluginInitializerToC.startImplementTranByTime("2024-10-26 18:20:09","2024-10-26 18:20:09");
// soSaleOutPluginInitializerToC.startImplementTranByTime("2024-10-26 18:20:09","2024-10-26 18:20:09");
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -35,10 +35,9 @@ public class SoSaleReturnPluginInitializerToBTest {
//测试TOB退货-确认收入
// soSaleReturnPluginInitializerToB.startImplementByTradeTime("2024-08-30 15:54:41", "2024-08-30 15:54:43");
soSaleReturnPluginInitializerToB.startImplementByCode("LETS-RE2024102500000029", "tran");
// soSaleReturnPluginInitializerToB.startImplementByCode("LETS-RE2024091400000001", "tran");
soSaleReturnPluginInitializerToB.startImplementByStockTime("2024-09-24 16:52:49", "2024-09-24 16:52:52");
// soSaleReturnPluginInitializerToB.startImplementByStockTime("2024-09-24 16:52:49", "2024-09-24 16:52:52");
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -29,12 +29,12 @@ public class SoSaleReturnPluginInitializerToCTest {
@Test
public void startImplement() {
// soSaleReturnPluginInitializerToC.startImplement(null, null);
// try {
// String code = "LETS-RE2024091400000001";
// soSaleReturnPluginInitializerToC.startImplementByCode(code, "stock");
// } catch (Exception e) {
// e.printStackTrace();
// }
try {
String code = "LETS-RE2024092400000148";
soSaleReturnPluginInitializerToC.startImplementByCode(code, "stock");
} catch (Exception e) {
e.printStackTrace();
}
// List<StartAndEndVo> startAndEndVos = soSaleReturnPluginInitializerToC.calculateCalculateEntireDayPeriod(null);
// soSaleReturnPluginInitializerToC.startImplementStockByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time());
@ -43,8 +43,8 @@ public class SoSaleReturnPluginInitializerToCTest {
try {
// soSaleReturnPluginInitializerToC.startImplementStockByTime("2024-10-21 00:00:00", "2024-10-21 23:59:59");
JSONObject jsonObject = new JSONObject();
soSaleReturnPluginInitializerToC.executeBusiness(jsonObject);
// JSONObject jsonObject = new JSONObject();
// soSaleReturnPluginInitializerToC.executeBusiness(jsonObject);
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -14,6 +14,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.*;
@ -58,7 +59,10 @@ public class QueryU8CEntityUtilTest {
@Test
public void queryBdCostsubj() {
String s = queryU8CEntityUtil.queryBdDefDocByPkDefDocList("KS");
System.out.println(s);
// String s = queryU8CEntityUtil.queryBdDefDocByPkDefDocList("KS");
// System.out.println(s);
Map<String, String> stringStringMap = queryU8CEntityUtil.queryBdDefDocByPkDefDocAll();
System.out.println(JSON.toJSONString(stringStringMap));
}
}