代码调整和功能优化
-优化U8C自定义项档案主键的管理,实现通过OverallConstant获取平台和店铺主键。- 在查询存货管理档案时,增加发货公司名称作为查询参数,提高查询准确性。 - 扩展queryInventoryMan方法,使其支持额外的查询参数。 - 在测试类SoSaleOutPluginInitializerToBTest中更新测试代码,适配最新的实现变化。
This commit is contained in:
parent
87e1c530fd
commit
454f634dac
|
@ -86,31 +86,37 @@ public class OverallConstant {
|
|||
devOverAll.put("u8cApiNeedStackTraceCode", "Y");
|
||||
devOverAll.put("u8cApiZdrCode", "tbadmin");//单据制单人---测试环境:tbadmin
|
||||
|
||||
devOverAll.put("u8c自定义项档案-店铺主键", "0001A110000000000EBX");
|
||||
devOverAll.put("u8c自定义项档案-平台主键", "0001A110000000000EEU");
|
||||
|
||||
//中台地址
|
||||
devOverAll.put("u8c_url", "http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface");
|
||||
}
|
||||
|
||||
private static void loadProd() {
|
||||
devOverAll.put("u8cApiUrl", "http://192.168.10.118:9099");//测试U8C
|
||||
prodOverAll.put("u8cApiUrl", "http://192.168.10.118:9099");//测试U8C
|
||||
|
||||
//主键
|
||||
devOverAll.put("u8cApiUsercodePK", "admin");
|
||||
devOverAll.put("u8cApiPasswordPK", "83f1ad3e7fa3617f1aae62ae7413c810");
|
||||
devOverAll.put("u8cApiTrantypePK", "pk");
|
||||
devOverAll.put("u8cApiSystemPK", "lz");
|
||||
devOverAll.put("u8cApiNeedStackTracePK", "N");
|
||||
devOverAll.put("u8cApiZdrPK", "TB_NEW100000000004OP");//单据制单人---测试环境:tbadmin
|
||||
prodOverAll.put("u8cApiUsercodePK", "admin");
|
||||
prodOverAll.put("u8cApiPasswordPK", "83f1ad3e7fa3617f1aae62ae7413c810");
|
||||
prodOverAll.put("u8cApiTrantypePK", "pk");
|
||||
prodOverAll.put("u8cApiSystemPK", "lz");
|
||||
prodOverAll.put("u8cApiNeedStackTracePK", "N");
|
||||
prodOverAll.put("u8cApiZdrPK", "TB_NEW100000000004OP");//单据制单人---测试环境:tbadmin
|
||||
|
||||
//编码
|
||||
devOverAll.put("u8cApiUsercodeCode", "admin1");
|
||||
devOverAll.put("u8cApiPasswordCode", "83f1ad3e7fa3617f1aae62ae7413c810");
|
||||
devOverAll.put("u8cApiTrantypeCode", "code");
|
||||
devOverAll.put("u8cApiSystemCode", "lz1");
|
||||
devOverAll.put("u8cApiNeedStackTraceCode", "N");
|
||||
devOverAll.put("u8cApiZdrCode", "tbadmin");//单据制单人---测试环境:tbadmin
|
||||
prodOverAll.put("u8cApiUsercodeCode", "admin1");
|
||||
prodOverAll.put("u8cApiPasswordCode", "83f1ad3e7fa3617f1aae62ae7413c810");
|
||||
prodOverAll.put("u8cApiTrantypeCode", "code");
|
||||
prodOverAll.put("u8cApiSystemCode", "lz1");
|
||||
prodOverAll.put("u8cApiNeedStackTraceCode", "N");
|
||||
prodOverAll.put("u8cApiZdrCode", "tbadmin");//单据制单人---测试环境:tbadmin
|
||||
|
||||
prodOverAll.put("u8c自定义项档案-店铺主键", "0001A110000000000EBX");
|
||||
prodOverAll.put("u8c自定义项档案-平台主键", "0001A110000000000EEU");
|
||||
|
||||
//中台地址
|
||||
devOverAll.put("u8c_url", "http://127.0.0.1:8081/kangarooDataCenterV3/entranceController/externalCallInterface");
|
||||
prodOverAll.put("u8c_url", "http://127.0.0.1:8081/kangarooDataCenterV3/entranceController/externalCallInterface");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -327,6 +327,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
try {
|
||||
Assert.notNull(code, "出库单单不能为空");
|
||||
String tobShop = shopTobOrToCUtil.getCommaShop("TOB");
|
||||
logger.info("TOB-OFS店铺编码:{}", tobShop);
|
||||
|
||||
List<HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>();
|
||||
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
|
||||
|
@ -738,7 +739,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
for (int j = 0; j < details.size(); j++) {
|
||||
DetailsDto detailsDto = details.get(j);
|
||||
//存货管理档案:取发货公司的存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(detailsDto, bdCalbodyEntity.getPkCorp());
|
||||
BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(detailsDto, bdCalbodyEntity.getPkCorp(), bdCorpEntity.getUnitname());
|
||||
//存货基础档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity = queryStockBasicArchives(bdInvmandocEntity.getPkInvmandoc(), deliverGoodsCorp.getPkCorp());
|
||||
//根据存货基础档案编码,查询当前存货的税率
|
||||
|
@ -916,22 +917,19 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
List<ErrorHeaderDetailsDtoDto> errorHeaderDetailsDtoDtoList = new ArrayList<>();
|
||||
if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) {
|
||||
try {
|
||||
//查询对应的OFS销售订单
|
||||
// List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> headerDetailsDtos = queryOfsOrder(headerDetailsDtoList);
|
||||
// findMatchingOfsOrder(headerDetailsDtos, headerDetailsDtoList);
|
||||
|
||||
for (int i = 0; i < headerDetailsDtoList.size(); i++) {
|
||||
HeaderDetailsDto headerDetailsDto = headerDetailsDtoList.get(i);
|
||||
HeaderDto header = headerDetailsDto.getHeader();
|
||||
List<DetailsDto> details = headerDetailsDto.getDetails();
|
||||
|
||||
try {
|
||||
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto1 = header.getHeaderDetailsDto();
|
||||
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header2 = headerDetailsDto1.getHeader();
|
||||
//如果没有O单据名称,则默认为「销售」
|
||||
if (header2.getSubOrderType() == null || "".equals(header2.getSubOrderType().trim())) {
|
||||
header2.setSubOrderType("SALES");
|
||||
}
|
||||
|
||||
//查询对应的收发类别
|
||||
BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject(header2.getSubOrderType());
|
||||
Assert.notNull(bdRdclEntity, "根据收发类别编码:{} 无法匹配到U8C收发类别");
|
||||
// Assert.notNull(header.getHeaderDetailsDto(), "OFS销售销售不能为空!");
|
||||
// com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto1 = header.getHeaderDetailsDto();
|
||||
// com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header2 = headerDetailsDto1.getHeader();
|
||||
|
||||
//根据OFS销售出库单,查询得到OFS销售订单
|
||||
SaleOrderMessageDto saleOrderMessageDto = null;
|
||||
|
@ -947,9 +945,19 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header1 = saleOrderMessageDto.getData().get(0).getHeader();
|
||||
String memberId = header1.getMemberId();
|
||||
//TODO 测试
|
||||
memberId = "hzz";
|
||||
Assert.notNull(memberId, "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!");
|
||||
Assert.state(!"".equals(memberId.trim()), "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!");
|
||||
|
||||
//如果没有O单据名称,则默认为「销售」
|
||||
if (header1.getSubOrderType() == null || "".equals(header1.getSubOrderType().trim())) {
|
||||
header1.setSubOrderType("SALES");
|
||||
}
|
||||
//查询对应的收发类别
|
||||
BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject(header1.getSubOrderType());
|
||||
Assert.notNull(bdRdclEntity, "根据收发类别编码:{} 无法匹配到U8C收发类别");
|
||||
|
||||
// 销售公司、发货公司
|
||||
// header.setCompanyCode("SHLZ");
|
||||
String companyCode = header.getCompanyCode();
|
||||
|
@ -1033,7 +1041,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
bdCubasdocEntity.setDef1(memberId);
|
||||
List<BdCubasdocEntity> bdCubasdocEntityList = iBdCubasdocDao.query(bdCubasdocEntity);
|
||||
if (bdCubasdocEntityList == null || bdCubasdocEntityList.size() == 0) {
|
||||
Assert.state(false, "根据OFS会员id{},无法查询到U8C客商基本档案", memberId);
|
||||
Assert.state(false, "根据OFS会员id:{},无法查询到U8C客商基本档案", memberId);
|
||||
}
|
||||
//TODO 测试
|
||||
// else if (bdCubasdocEntityList.size() >= 2) {
|
||||
|
@ -1053,7 +1061,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
|
||||
//查找平台
|
||||
String platformZdyId = "0001A210000000000JUD";
|
||||
// String platformZdyId = "0001A210000000000JUD";
|
||||
String platformZdyId = OverallConstant.getOverAllValue("u8c自定义项档案-平台主键");
|
||||
String sourcePlatformCode = header.getSourcePlatformCode();
|
||||
BdDefdocEntity bdDefdocEntity = new BdDefdocEntity();
|
||||
bdDefdocEntity.setPkDefdoclist(platformZdyId);
|
||||
|
@ -1068,7 +1077,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
|
||||
//查询U8C店铺档案
|
||||
String platformZdyId2 = "0001A210000000000XZX";
|
||||
String platformZdyId2 = OverallConstant.getOverAllValue("u8c自定义项档案-店铺主键");
|
||||
String ofsStoreCode = header.getStoreCode();
|
||||
BdDefdocEntity bdDefdocEntity2 = new BdDefdocEntity();
|
||||
bdDefdocEntity2.setPkDefdoclist(platformZdyId2);
|
||||
|
@ -1192,7 +1201,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
* @param detailsDto 出库单存货明细行
|
||||
* @author liuyang
|
||||
*/
|
||||
private BdInvmandocEntity queryInventoryMan(DetailsDto detailsDto, String pkCorp) throws Exception {
|
||||
private BdInvmandocEntity queryInventoryMan(DetailsDto detailsDto, String pkCorp, String corpName) throws Exception {
|
||||
Assert.notNull(detailsDto, "sonDetailsDto不能为空");
|
||||
Assert.notNull(detailsDto.getSkuCode(), "O存货商家编码不能为空");
|
||||
Assert.notNull(pkCorp, "发货公司主键不能为空");
|
||||
|
@ -1202,9 +1211,9 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
bdInvmandocEntity.setPkCorp(pkCorp);
|
||||
List<BdInvmandocEntity> bdInvmandocEntity2 = iBdInvmandocDao.queryBdInvmandocByInvcodeList(bdInvmandocEntity);
|
||||
if (bdInvmandocEntity2.size() == 0) {
|
||||
Assert.state(false, "根据O商家编码:{} U8C发货公司主键:{}没有查询到存货管理档案", detailsDto.getSkuCode(), pkCorp);
|
||||
Assert.state(false, "根据O商家编码:{} U8C发货公司主键:{} 发货公司名称:{} 没有查询到存货管理档案", detailsDto.getSkuCode(), pkCorp, corpName);
|
||||
} else if (bdInvmandocEntity2.size() >= 2) {
|
||||
Assert.state(false, "根据O商家编码:{} U8C发货公司主键:{}没有查询到存货管理档案", detailsDto.getSkuCode(), pkCorp);
|
||||
Assert.state(false, "根据O商家编码:{} U8C发货公司主键:{} 发货公司名称:{} 没有查询到存货管理档案", detailsDto.getSkuCode(), pkCorp, corpName);
|
||||
}
|
||||
return bdInvmandocEntity2.get(0);
|
||||
}
|
||||
|
@ -1578,7 +1587,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
|
||||
//查找平台
|
||||
String platformZdyId = "0001A210000000000JUD";
|
||||
// String platformZdyId = "0001A210000000000JUD";
|
||||
String platformZdyId = OverallConstant.getOverAllValue("u8c自定义项档案-平台主键");
|
||||
String sourcePlatformCode = header.getSourcePlatformCode();
|
||||
BdDefdocEntity bdDefdocEntity = new BdDefdocEntity();
|
||||
bdDefdocEntity.setPkDefdoclist(platformZdyId);
|
||||
|
@ -1593,7 +1603,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
|
||||
//查询U8C店铺档案
|
||||
String platformZdyId2 = "0001A210000000000XZX";
|
||||
// String platformZdyId2 = "0001A210000000000XZX";
|
||||
String platformZdyId2 = OverallConstant.getOverAllValue("u8c自定义项档案-店铺主键");
|
||||
String ofsStoreCode = header.getStoreCode();
|
||||
BdDefdocEntity bdDefdocEntity2 = new BdDefdocEntity();
|
||||
bdDefdocEntity2.setPkDefdoclist(platformZdyId2);
|
||||
|
@ -1754,7 +1765,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
for (int j = 0; j < details.size(); j++) {
|
||||
DetailsDto detailsDto = details.get(j);
|
||||
//存货管理档案:取发货公司的存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(detailsDto, bdCalbodyEntity.getPkCorp());
|
||||
BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(detailsDto, bdCalbodyEntity.getPkCorp(), bdCorpEntity.getUnitname());
|
||||
//存货基础档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity = queryStockBasicArchives(bdInvmandocEntity.getPkInvmandoc(), deliverGoodsCorp.getPkCorp());
|
||||
//根据存货基础档案编码,查询当前存货的税率
|
||||
|
@ -2422,4 +2433,75 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
logger.error("updateFailOrSuccessTocofsSaleoutDetailedArchiveInquiry方法现场抛出异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过OFS销售出库单,联查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 {
|
||||
List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> allHeaderDetailsDtoArrayList = new ArrayList<>();
|
||||
try {
|
||||
if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) {
|
||||
List<List<HeaderDetailsDto>> splitListByCount = SplitListByCountUtil.splitListByCount(headerDetailsDtoList, 100);
|
||||
for (int i = 0; i < splitListByCount.size(); i++) {
|
||||
List<HeaderDetailsDto> headerDetailsDtos = splitListByCount.get(i);
|
||||
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
if (headerDetailsDtos != null && headerDetailsDtos.size() > 0) {
|
||||
for (int j = 0; j < headerDetailsDtos.size(); j++) {
|
||||
HeaderDetailsDto headerDetailsDto = headerDetailsDtos.get(j);
|
||||
HeaderDto header = headerDetailsDto.getHeader();
|
||||
// List<DetailsDto> details = headerDetailsDto.getDetails();
|
||||
// stringBuffer.append("'");
|
||||
stringBuffer.append(header.getRefOrderCode());
|
||||
// stringBuffer.append("'");
|
||||
stringBuffer.append(",");
|
||||
}
|
||||
}
|
||||
String substring = stringBuffer.substring(0, stringBuffer.length());
|
||||
|
||||
List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> headerDetailsDtoArrayList = new ArrayList<>();
|
||||
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
|
||||
queryOfsSoSaleOutVo.setCode(substring);
|
||||
ofsStandardUtil.getOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoArrayList, 1L);
|
||||
allHeaderDetailsDtoArrayList.addAll(headerDetailsDtoArrayList);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("queryOfsOrder方法抛出异常", e);
|
||||
}
|
||||
return allHeaderDetailsDtoArrayList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 代码匹配销售订单
|
||||
*
|
||||
* @param ofsSaleOrder ofs销售订单集合
|
||||
* @param ofsSaleOutOrder ofs销售出库单集合
|
||||
* @author liuyang
|
||||
*/
|
||||
private void findMatchingOfsOrder(List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> ofsSaleOrder, List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> ofsSaleOutOrder) throws Exception {
|
||||
if (ofsSaleOrder != null && ofsSaleOutOrder != null && ofsSaleOrder.size() > 0 && ofsSaleOutOrder.size() > 0) {
|
||||
try {
|
||||
for (int i = 0; i < ofsSaleOutOrder.size(); i++) {
|
||||
HeaderDetailsDto headerDetailsDto = ofsSaleOutOrder.get(i);
|
||||
HeaderDto header = headerDetailsDto.getHeader();
|
||||
List<DetailsDto> details = headerDetailsDto.getDetails();
|
||||
|
||||
String targetRefOrderCode = header.getRefOrderCode();
|
||||
for (int j = 0; j < ofsSaleOrder.size(); j++) {
|
||||
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto1 = ofsSaleOrder.get(j);
|
||||
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header1 = headerDetailsDto1.getHeader();
|
||||
List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.DetailsDto> details1 = headerDetailsDto1.getDetails();
|
||||
if (header1.getCode().equals(targetRefOrderCode)) {
|
||||
header.setHeaderDetailsDto(headerDetailsDto1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("findMatchingOfsOrder方法抛出异常", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
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.IBdDefdocDao;
|
||||
import com.hzya.frame.plugin.lets.entity.BdDefdocEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -30,7 +31,7 @@ public class ShopTobOrToCUtil {
|
|||
*/
|
||||
public List<BdDefdocEntity> queryU8cShop(String memo) {
|
||||
//查询U8C店铺档案
|
||||
String platformZdyId2 = "0001A210000000000XZX";
|
||||
String platformZdyId2 = OverallConstant.getOverAllValue("u8c自定义项档案-店铺主键");
|
||||
|
||||
BdDefdocEntity bdDefdocEntity2 = new BdDefdocEntity();
|
||||
bdDefdocEntity2.setPkDefdoclist(platformZdyId2);
|
||||
|
|
|
@ -45,6 +45,6 @@ public class SoSaleOutPluginInitializerToBTest {
|
|||
|
||||
// soSaleOutPluginInitializerToB.startImplementByTranTime("2024-08-28 15:28:06", "2024-08-28 15:28:08");
|
||||
|
||||
soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024080100010887");
|
||||
soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024080100006222");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue