refactor(lets): 重构获取结存价和采购价逻辑- 修改了 IaPeriodaccountEntity 和 PoOrderBEntity 的相关字段类型
- 优化了 getFloorPrice 方法的实现,支持从 map 中获取结存价和采购价 - 新增了 initAllBalancePricePurchasePrice 方法初始化结存价和采购价 - 调整了 SoSaleOutPluginInitializerToC 中的逻辑,支持新的结存价和采购价获取方式- 修复了一些潜在的空指针异常问题
This commit is contained in:
parent
29e1467c96
commit
429c160501
|
@ -137,7 +137,7 @@ public class OverallConstant {
|
|||
prodOverAll.put("u8c自定义项档案-单据红字标识-N名称", "N");
|
||||
|
||||
//中台地址
|
||||
prodOverAll.put("u8c_url", "http://127.0.0.1:8081/kangarooDataCenterV3/entranceController/externalCallInterface");
|
||||
devOverAll.put("u8c_url", "http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface");
|
||||
// prodOverAll.put("u8c_url", "http://ufidahz.com.cn:9067/kangarooDataCenterV3/entranceController/externalCallInterface");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.hzya.frame.plugin.lets.dao.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.hzya.frame.plugin.lets.entity.IaPeriodaccountEntity;
|
||||
import com.hzya.frame.plugin.lets.dao.IIaPeriodaccountDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
@ -14,6 +15,7 @@ import java.util.List;
|
|||
* @since 2024-10-17 10:06:10
|
||||
*/
|
||||
public class IaPeriodaccountDaoImpl extends MybatisGenericDao<IaPeriodaccountEntity, String> implements IIaPeriodaccountDao {
|
||||
@DS("lets_u8c")
|
||||
@Override
|
||||
public List<IaPeriodaccountEntity> queryBalancePrice(IaPeriodaccountEntity iaPeriodaccountEntity) throws Exception {
|
||||
return query("com.hzya.frame.plugin.lets.dao.impl.IaPeriodaccountDaoImpl.queryBalancePrice", iaPeriodaccountEntity);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.hzya.frame.plugin.lets.dao.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
import com.hzya.frame.plugin.lets.dao.IPoOrderBDao;
|
||||
import com.hzya.frame.plugin.lets.entity.PoOrderBEntity;
|
||||
|
@ -14,6 +15,7 @@ import java.util.List;
|
|||
*/
|
||||
//@Repository("PoOrderBDaoImpl")
|
||||
public class PoOrderBDaoImpl extends MybatisGenericDao<PoOrderBEntity, String> implements IPoOrderBDao {
|
||||
@DS("lets_u8c")
|
||||
@Override
|
||||
public List<PoOrderBEntity> queryPurchaseUnitPriceByInvcodes(PoOrderBEntity poOrderBEntity) throws Exception {
|
||||
return query("com.hzya.frame.plugin.lets.dao.impl.PoOrderBDaoImpl.queryPurchaseUnitPriceByInvcodes", poOrderBEntity);
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.hzya.frame.plugin.lets.entity;
|
|||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* (IaPeriodaccount)实体类
|
||||
*
|
||||
|
@ -31,8 +33,8 @@ public class IaPeriodaccountEntity extends BaseEntity {
|
|||
private String dr;
|
||||
private String fpricemodeflag;
|
||||
private String nabassistnum;
|
||||
private String nabmny;
|
||||
private String nabnum;
|
||||
private BigDecimal nabmny;
|
||||
private BigDecimal nabnum;
|
||||
private String nabplanedmny;
|
||||
private String nabvarymny;
|
||||
private String ndrawsummny;
|
||||
|
@ -61,12 +63,11 @@ public class IaPeriodaccountEntity extends BaseEntity {
|
|||
private String vfree9;
|
||||
private String vproducebatch;
|
||||
|
||||
|
||||
|
||||
//查询结存价依赖的参数
|
||||
private String pk_invmandoc;
|
||||
private String pk_corp;
|
||||
private String unitname;
|
||||
private String invcode;
|
||||
private String invcodes;
|
||||
private String pkInvmandocs;
|
||||
}
|
|
@ -23,8 +23,8 @@
|
|||
<result property="dr" column="DR" jdbcType="VARCHAR"/>
|
||||
<result property="fpricemodeflag" column="FPRICEMODEFLAG" jdbcType="VARCHAR"/>
|
||||
<result property="nabassistnum" column="NABASSISTNUM" jdbcType="VARCHAR"/>
|
||||
<result property="nabmny" column="NABMNY" jdbcType="VARCHAR"/>
|
||||
<result property="nabnum" column="NABNUM" jdbcType="VARCHAR"/>
|
||||
<result property="nabmny" column="NABMNY" jdbcType="NUMBER"/>
|
||||
<result property="nabnum" column="NABNUM" jdbcType="NUMBER"/>
|
||||
<result property="nabplanedmny" column="NABPLANEDMNY" jdbcType="VARCHAR"/>
|
||||
<result property="nabvarymny" column="NABVARYMNY" jdbcType="VARCHAR"/>
|
||||
<result property="ndrawsummny" column="NDRAWSUMMNY" jdbcType="VARCHAR"/>
|
||||
|
@ -663,14 +663,21 @@ update IA_PERIODACCOUNT set sts= 'N' ,modify_time = #{modify_time},modify_user_
|
|||
bc.unitname,
|
||||
bi.invcode
|
||||
FROM
|
||||
( SELECT ip.*, ROW_NUMBER() OVER (PARTITION BY cinventoryid ORDER BY caccountyear, caccountmonth DESC) AS row_number FROM ia_periodaccount ip) t
|
||||
(SELECT ip.*, ROW_NUMBER() OVER (PARTITION BY cinventoryid ORDER BY caccountyear, caccountmonth DESC) AS row_number FROM ia_periodaccount ip
|
||||
where 1=1
|
||||
<if test="pkInvmandocs!=null and pkInvmandocs!=''">
|
||||
and ip.cinventoryid in (${pkInvmandocs})
|
||||
</if>
|
||||
) t
|
||||
LEFT JOIN bd_invmandoc b ON b.pk_invmandoc = t.cinventoryid
|
||||
LEFT JOIN bd_corp bc ON bc.pk_corp = b.pk_corp
|
||||
LEFT JOIN bd_invbasdoc bi ON bi.pk_invbasdoc = b.pk_invbasdoc
|
||||
WHERE
|
||||
t.row_number = 1
|
||||
and bi.invcode in (
|
||||
${invcodes}
|
||||
)
|
||||
<if test="invcodes!=null and invcodes!=''">
|
||||
and bi.invcode in (
|
||||
${invcodes}
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
|
@ -154,4 +154,5 @@ public class PoOrderBEntity extends BaseEntity {
|
|||
private String pk_corp;
|
||||
private String unitname;
|
||||
private String invcode;
|
||||
private String cmangids;
|
||||
}
|
|
@ -1831,7 +1831,12 @@
|
|||
bc.unitname,
|
||||
bi.invcode
|
||||
FROM
|
||||
( SELECT pob.*, ROW_NUMBER ( ) OVER ( PARTITION BY CMANGID ORDER BY ts DESC ) AS row_number FROM po_order_b pob ) t
|
||||
( SELECT pob.*, ROW_NUMBER ( ) OVER ( PARTITION BY CMANGID ORDER BY ts DESC ) AS row_number FROM po_order_b pob
|
||||
where 1=1
|
||||
<if test="cmangids!=null and cmangids!=''">
|
||||
and pob.CMANGID in (${cmangids})
|
||||
</if>
|
||||
) t
|
||||
LEFT JOIN bd_invmandoc b ON b.pk_invmandoc = t.cmangid
|
||||
LEFT JOIN bd_corp bc ON bc.pk_corp = b.pk_corp
|
||||
LEFT JOIN bd_invbasdoc bi ON bi.pk_invbasdoc = b.pk_invbasdoc
|
||||
|
|
|
@ -753,6 +753,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
|
||||
//验证是否为指定的店铺,如果为true,则取结存价
|
||||
Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode());
|
||||
//测试
|
||||
// isCheckShopChoose = true;
|
||||
|
||||
//把汇总好的出库单明细行合并成一行
|
||||
for (int j = 0; j < details.size(); j++) {
|
||||
|
@ -779,7 +781,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
BigDecimal noriginalcurtaxmny = null;//税额
|
||||
try {
|
||||
//综合判断对应的目标金额
|
||||
String totalPayAmount = getFloorPrice(isCheckShopChoose, bdInvbasdocEntity, header, detailsDto);
|
||||
String totalPayAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, detailsDto);
|
||||
noriginalcurtaxprice = new BigDecimal(totalPayAmount).divide(new BigDecimal(detailsDto.getShipQty()), 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(new BigDecimal(detailsDto.getShipQty())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
|
@ -969,9 +971,13 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
// com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header2 = headerDetailsDto1.getHeader();
|
||||
|
||||
//根据OFS销售出库单,查询得到OFS销售订单
|
||||
String refOrderCode = details.get(0).getRefOrderCode();
|
||||
if (refOrderCode == null || "".equals(refOrderCode.trim())) {
|
||||
Assert.state(false, "O销售出库单明细行对应的refOrderCode不能为null或者''");
|
||||
}
|
||||
SaleOrderMessageDto saleOrderMessageDto = null;
|
||||
try {
|
||||
saleOrderMessageDto = afterSalesOrderUtil.getOfsOrder(header.getRefOrderCode());
|
||||
saleOrderMessageDto = afterSalesOrderUtil.getOfsOrder(refOrderCode);
|
||||
} catch (Exception e) {
|
||||
logger.error("查询销售订单错误,失败原因:{}", e.getMessage());
|
||||
Assert.state(false, "查询销售订单错误,失败原因:{}", e.getMessage());
|
||||
|
@ -990,8 +996,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
// com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header1 = saleOrderMessageDto.getData().get(0).getHeader();
|
||||
String memberId = header2.getMemberId();
|
||||
//测试
|
||||
// memberId = "hzz";
|
||||
//TODO 测试
|
||||
memberId = "9387";
|
||||
Assert.notNull(memberId, "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!");
|
||||
Assert.state(!"".equals(memberId.trim()), "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!");
|
||||
|
||||
|
@ -1004,7 +1010,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
Assert.notNull(bdRdclEntity, "根据收发类别编码:{} 无法匹配到U8C收发类别");
|
||||
|
||||
// 销售公司、发货公司
|
||||
// header.setCompanyCode("SHLZ");
|
||||
//TODO 测试
|
||||
header.setCompanyCode("SHLZ");
|
||||
String companyCode = header.getCompanyCode();
|
||||
Assert.notNull(companyCode, "O表头公司不能为空");
|
||||
BdCorpEntity bdCorpEntity = new BdCorpEntity();
|
||||
|
@ -1040,9 +1047,9 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
bdStordocEntity.setStorcode(facilityCode);
|
||||
List<BdStordocEntity> bdStordocEntityList = iBdStordocDao.query(bdStordocEntity);
|
||||
if (bdStordocEntityList.size() == 0) {
|
||||
Assert.state(false, "根据O仓库编码+U8C发货库存组织主键,无法匹配到U8C仓库 仓库编码:{} 组织机构主键:{} 公司名称:{}", facilityCode, bdCalbodyEntities.get(0).getPkCalbody(), bdCorpEntityList.get(0).getUnitname());
|
||||
Assert.state(false, "根据O仓库编码+U8C发货库存组织主键,无法匹配到U8C仓库 仓库编码:{} 组织机构主键:{} 发货库存组织名称:{}", facilityCode, bdCalbodyEntities.get(0).getPkCalbody(), bdCalbodyEntities.get(0).getBodyname());
|
||||
} else if (bdStordocEntityList.size() >= 2) {
|
||||
Assert.state(false, "根据O仓库编码+U8C发货库存组织主键,匹配到U8C仓库多个 仓库编码:{} 组织机构主键:{} 公司名称:{}", facilityCode, bdCalbodyEntities.get(0).getPkCalbody(), bdCorpEntityList.get(0).getUnitname());
|
||||
Assert.state(false, "根据O仓库编码+U8C发货库存组织主键,匹配到U8C仓库多个 仓库编码:{} 组织机构主键:{} 发货库存组织名称:{}", facilityCode, bdCalbodyEntities.get(0).getPkCalbody(), bdCalbodyEntities.get(0).getBodyname());
|
||||
}
|
||||
|
||||
//销售组织
|
||||
|
@ -1462,9 +1469,13 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
|
||||
try {
|
||||
//根据OFS销售出库单,查询得到OFS销售订单
|
||||
String refOrderCode = details.get(0).getRefOrderCode();
|
||||
if (refOrderCode == null || "".equals(refOrderCode.trim())) {
|
||||
Assert.state(false, "O销售出库单明细行对应的refOrderCode不能为null或者''");
|
||||
}
|
||||
SaleOrderMessageDto saleOrderMessageDto = null;
|
||||
try {
|
||||
saleOrderMessageDto = afterSalesOrderUtil.getOfsOrder(header.getRefOrderCode());
|
||||
saleOrderMessageDto = afterSalesOrderUtil.getOfsOrder(refOrderCode);
|
||||
} catch (Exception e) {
|
||||
logger.error("查询销售订单错误,失败原因:{}", e.getMessage());
|
||||
Assert.state(false, "查询销售订单错误,失败原因:{}", e.getMessage());
|
||||
|
@ -1482,8 +1493,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header1 = saleOrderMessageDto.getData().get(0).getHeader();
|
||||
String memberId = header1.getMemberId();
|
||||
// 测试
|
||||
// memberId = "hzz";
|
||||
// TODO 测试
|
||||
memberId = "9387";
|
||||
Assert.notNull(memberId, "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!");
|
||||
Assert.state(!"".equals(memberId.trim()), "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!");
|
||||
|
||||
|
@ -1876,7 +1887,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
BigDecimal noriginalcurtaxprice = null;
|
||||
try {
|
||||
//综合判断对应的目标金额
|
||||
String totalPayAmount = getFloorPrice(isCheckShopChoose, bdInvbasdocEntity, header, detailsDto);
|
||||
String totalPayAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, detailsDto);
|
||||
noriginalcurtaxprice = new BigDecimal(totalPayAmount).divide(new BigDecimal(detailsDto.getShipQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
|
||||
} catch (Exception e) {
|
||||
logger.error("含税单价金额计算失败!", e);
|
||||
|
@ -2615,32 +2626,32 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
* 获取结存金额或者采购金额
|
||||
*
|
||||
* @param isCheckShopChoose true取OFS实付金额、false取结存金额或者采购价
|
||||
* @param bdInvbasdocEntity 存货基本档案
|
||||
* @param bdInvmandocEntity 存货基本档案
|
||||
* @param header 对应的销售出库单表头
|
||||
* @param detailsDto 对应的销售出库单明细行对象
|
||||
* @author liuyang
|
||||
*/
|
||||
private String getFloorPrice(Boolean isCheckShopChoose, BdInvbasdocEntity bdInvbasdocEntity, HeaderDto header, DetailsDto detailsDto) throws Exception {
|
||||
private String getFloorPrice(Boolean isCheckShopChoose, BdInvmandocEntity bdInvmandocEntity, HeaderDto header, DetailsDto detailsDto) throws Exception {
|
||||
Assert.notNull(isCheckShopChoose, "isCheckShopChoose不能为空");
|
||||
Assert.notNull(bdInvbasdocEntity, "bdInvbasdocEntity不能为空");
|
||||
Assert.notNull(bdInvmandocEntity, "bdInvmandocEntity不能为空");
|
||||
Assert.notNull(header, "header不能为空");
|
||||
Assert.notNull(detailsDto, "detailsDto不能为空");
|
||||
|
||||
String totalPayAmount = null;
|
||||
if (isCheckShopChoose) {
|
||||
//取结存价
|
||||
List<BdInvbasdocEntity> bdInvbasdocEntityList = new ArrayList<>();
|
||||
bdInvbasdocEntityList.add(bdInvbasdocEntity);
|
||||
List<IaPeriodaccountEntity> iaPeriodaccountEntityList = balanceUnitPriceUtil.queryBalanceUnitPrice(bdInvbasdocEntityList);
|
||||
List<BdInvmandocEntity> bdInvmandocEntityArrayList = new ArrayList<>();
|
||||
bdInvmandocEntityArrayList.add(bdInvmandocEntity);
|
||||
List<IaPeriodaccountEntity> iaPeriodaccountEntityList = balanceUnitPriceUtil.queryBalanceUnitPrice(bdInvmandocEntityArrayList);
|
||||
if (iaPeriodaccountEntityList != null && iaPeriodaccountEntityList.size() > 0) {
|
||||
//结存金额
|
||||
logger.info("店铺:{} 取O结存价", header.getStoreCode());
|
||||
IaPeriodaccountEntity iaPeriodaccountEntity = iaPeriodaccountEntityList.get(0);
|
||||
String nabmny = iaPeriodaccountEntity.getNabmny();
|
||||
if (nabmny == null || "".equals(nabmny)) {
|
||||
nabmny = "0";
|
||||
BigDecimal nabmnyBigDecimal = iaPeriodaccountEntity.getNabmny();
|
||||
if (nabmnyBigDecimal == null) {
|
||||
nabmnyBigDecimal = new BigDecimal("0");
|
||||
}
|
||||
BigDecimal nabmnyBigDecimal = new BigDecimal(nabmny);
|
||||
// BigDecimal nabmnyBigDecimal = new BigDecimal(nabmny);
|
||||
if (!"0".equals(nabmnyBigDecimal.stripTrailingZeros().toPlainString())) {
|
||||
totalPayAmount = nabmnyBigDecimal.stripTrailingZeros().toPlainString();
|
||||
} else {
|
||||
|
@ -2649,7 +2660,9 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
} else {
|
||||
//取采购价
|
||||
List<PoOrderBEntity> poOrderBEntityList = balanceUnitPriceUtil.queryPurchaseUnitPriceByInvcodes(bdInvbasdocEntityList);
|
||||
List<BdInvmandocEntity> bdInvmandocEntityArrayList1 = new ArrayList<>();
|
||||
bdInvmandocEntityArrayList1.add(bdInvmandocEntity);
|
||||
List<PoOrderBEntity> poOrderBEntityList = balanceUnitPriceUtil.queryPurchaseUnitPriceByInvcodes(bdInvmandocEntityArrayList1);
|
||||
if (poOrderBEntityList != null && poOrderBEntityList.size() > 0) {
|
||||
logger.info("店铺:{} 取O采购价", header.getStoreCode());
|
||||
String norgtaxprice = poOrderBEntityList.get(0).getNorgtaxprice();
|
||||
|
@ -2664,7 +2677,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
totalPayAmount = multiply.stripTrailingZeros().toPlainString();
|
||||
}
|
||||
} else {
|
||||
Assert.state(false, "店铺:{} 存货:{} 既没有结存价、也没有采购价!", header.getStoreCode(), bdInvbasdocEntity.getInvcode());
|
||||
Assert.state(false, "店铺:{} 存货管理档案主键:{} 既没有结存价、也没有采购价!", header.getStoreCode(), bdInvmandocEntity.getPkInvmandoc());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -177,6 +177,9 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
@Autowired
|
||||
private QueryBdBusitypeUtil queryBdBusitypeUtil;
|
||||
|
||||
@Autowired
|
||||
private BalanceUnitPriceUtil balanceUnitPriceUtil;
|
||||
|
||||
private static final String NOTHING = "无";
|
||||
|
||||
private static final String ADD = "(*)";
|
||||
|
@ -746,6 +749,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow();
|
||||
// 查询销售收发类别
|
||||
// BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("202");
|
||||
//初始化所有存货管理档案对应的结存价+采购价
|
||||
List<Map> mapList = initAllBalancePricePurchasePrice();
|
||||
|
||||
if (bdBusitypeEntity != null && summaryDimensionMap != null) {
|
||||
Iterator<Map.Entry<String, List<SonDetailsDto>>> iterator = summaryDimensionMap.entrySet().iterator();
|
||||
|
@ -817,8 +822,11 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
List<SaleorderRequestChildrenDto> saleorderRequestChildrenDtoList = new ArrayList<>();
|
||||
saleorderRequestDto.setChildrenvo(saleorderRequestChildrenDtoList);
|
||||
|
||||
//验证是否为指定的店铺,如果为true,则取结存价
|
||||
Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode());
|
||||
|
||||
//把汇总好的出库单明细行合并成一行
|
||||
SonDetailsDto sonDetailsDto = groupMergeDetailedRows(oldValue);
|
||||
SonDetailsDto sonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose, mapList);
|
||||
|
||||
//存货管理档案:取发货公司的存货管理档案
|
||||
// BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(sonDetailsDto, bdCalbodyEntity.getPkCorp());
|
||||
|
@ -1442,18 +1450,33 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
* @param sonDetailsDtoList 销售出库单明细行集合
|
||||
* @author liuyang
|
||||
*/
|
||||
private SonDetailsDto groupMergeDetailedRows(List<SonDetailsDto> sonDetailsDtoList) throws Exception {
|
||||
private SonDetailsDto groupMergeDetailedRows(List<SonDetailsDto> sonDetailsDtoList, Boolean isCheckShopChoose, List<Map> mapList) throws Exception {
|
||||
Assert.notNull(sonDetailsDtoList, "sonDetailsDtoList不能为空");
|
||||
Assert.notNull(isCheckShopChoose, "isCheckShopChoose不能为空");
|
||||
Assert.notNull(mapList, "mapLists不能为空");
|
||||
|
||||
if (sonDetailsDtoList != null && sonDetailsDtoList.size() > 0) {
|
||||
BigDecimal groupTotalPayAmount = new BigDecimal("0");
|
||||
BigDecimal groupShipQty = new BigDecimal("0");
|
||||
|
||||
for (int i = 0; i < sonDetailsDtoList.size(); i++) {
|
||||
SonDetailsDto sonDetailsDto = sonDetailsDtoList.get(i);
|
||||
HeaderDto header = sonDetailsDto.getHeader();
|
||||
BdInvmandocEntity bdInvmandocEntity = sonDetailsDto.getBdInvmandocEntity();
|
||||
//实付金额/实发数量
|
||||
//OFS销售订单实付金额:totalPayAmount
|
||||
//OFS销售出库单实付金额:totalPayAmount
|
||||
//是一样的字段,目前暂时取销售出库单对应的totalPayAmount
|
||||
Assert.notNull(sonDetailsDto.getTotalPayAmount(), "实付金额不能为空 明细行对象:{}", JSON.toJSONString(sonDetailsDto));
|
||||
String totalPayAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, sonDetailsDto, mapList);
|
||||
if (totalPayAmount == null) {
|
||||
//取O实付金额
|
||||
totalPayAmount = sonDetailsDto.getTotalPayAmount();
|
||||
} else {
|
||||
//取结存单价、或者采购单价
|
||||
BigDecimal totalPayAmountBigDecimal = new BigDecimal(totalPayAmount);
|
||||
totalPayAmount = totalPayAmountBigDecimal.multiply(new BigDecimal(sonDetailsDto.getShipQty())).setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString();
|
||||
}
|
||||
Assert.notNull(totalPayAmount, "实付金额不能为空 明细行对象:{}", JSON.toJSONString(sonDetailsDto));
|
||||
Assert.notNull(sonDetailsDto.getShipQty(), "实发数量不能为空 明细行对象:{}", JSON.toJSONString(sonDetailsDto));
|
||||
BigDecimal totalPayAmountBigDecimal = new BigDecimal(sonDetailsDto.getTotalPayAmount());
|
||||
BigDecimal shipQtyBigDecimal = new BigDecimal(sonDetailsDto.getShipQty());
|
||||
|
@ -1611,6 +1634,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
BdBusitypeEntity bdBusitypeEntity2 = u8cOperationFlowV3();
|
||||
//查询销售收发类别
|
||||
// BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("202");
|
||||
//初始化所有存货管理档案对应的结存价+采购价
|
||||
List<Map> mapList = initAllBalancePricePurchasePrice();
|
||||
|
||||
if (bdBusitypeEntity != null && summaryDimensionMap != null) {
|
||||
Iterator<Map.Entry<String, List<SonDetailsDto>>> iterator = summaryDimensionMap.entrySet().iterator();
|
||||
|
@ -1633,7 +1658,9 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
BdDefdocEntity shopArchives = oldValue.get(0).getShopArchives();//U8C店铺档案
|
||||
String newState2 = oldValue.get(0).getNewState2();//交易成功-红 是否成功
|
||||
String newState3 = oldValue.get(0).getNewState3();//交易成功-蓝 是否成功
|
||||
SonDetailsDto sonDetailsDto = groupMergeDetailedRows(oldValue);//把汇总好的出库单明细行合并成一行
|
||||
//验证是否为指定的店铺,如果为true,则取结存价
|
||||
Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode());
|
||||
SonDetailsDto sonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose, mapList);//把汇总好的出库单明细行合并成一行
|
||||
// BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(sonDetailsDto, bdCalbodyEntity.getPkCorp());
|
||||
BdInvmandocEntity bdInvmandocEntity = sonDetailsDto.getBdInvmandocEntity();//存货管理档案:取发货公司的存货管理档案
|
||||
// BdInvbasdocEntity bdInvbasdocEntity = queryStockBasicArchives(bdInvmandocEntity.getPkInvmandoc(), deliverGoodsCorp.getPkCorp());
|
||||
|
@ -2533,4 +2560,102 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
Assert.state(false, "根据OFS销售出库单明细行,无法查找OFS销售订单明细行 来源明细行主键:{} 来源明细行编码:{}", sonDetailsDto.getRefOrderDetailId(), sonDetailsDto.getRefOrderCode());
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化结存价、采购价
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
// private void initBalanceAndPurchase() {
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取结存金额或者采购金额
|
||||
*
|
||||
* @param isCheckShopChoose true取OFS实付金额、false取结存金额或者采购价
|
||||
* @param bdInvmandocEntity 存货基本档案
|
||||
* @param header 对应的销售出库单表头
|
||||
* @param sonDetailsDto 对应的销售出库单明细行对象
|
||||
* @param mapList 0结存价1采购价
|
||||
* @author liuyang
|
||||
*/
|
||||
private String getFloorPrice(Boolean isCheckShopChoose, BdInvmandocEntity bdInvmandocEntity, HeaderDto header, SonDetailsDto sonDetailsDto, List<Map> mapList) throws Exception {
|
||||
Assert.notNull(isCheckShopChoose, "isCheckShopChoose不能为空");
|
||||
Assert.notNull(bdInvmandocEntity, "bdInvmandocEntity不能为空");
|
||||
Assert.notNull(header, "header不能为空");
|
||||
Assert.notNull(sonDetailsDto, "detailsDto不能为空");
|
||||
Assert.notNull(mapList, "mapList不能为空");
|
||||
|
||||
String totalPayAmount = null;
|
||||
if (isCheckShopChoose) {
|
||||
IaPeriodaccountEntity iaPeriodaccountEntity1 = null;
|
||||
if (mapList != null && mapList.size() > 0) {
|
||||
Map<String, IaPeriodaccountEntity> stringIaPeriodaccountEntityMap = (Map<String, IaPeriodaccountEntity>) mapList.get(0);
|
||||
iaPeriodaccountEntity1 = stringIaPeriodaccountEntityMap.get(bdInvmandocEntity.getPkInvmandoc());
|
||||
}
|
||||
if (iaPeriodaccountEntity1 != null) {
|
||||
logger.info("店铺:{} 取O结存价", header.getStoreCode());
|
||||
|
||||
//结存金额
|
||||
BigDecimal nabmnyBigDecimal = iaPeriodaccountEntity1.getNabmny();
|
||||
if (nabmnyBigDecimal == null) {
|
||||
nabmnyBigDecimal = new BigDecimal("0");
|
||||
}
|
||||
// BigDecimal nabmnyBigDecimal = new BigDecimal(nabmny);
|
||||
|
||||
//结存数量
|
||||
BigDecimal nabnumBigDecimal = iaPeriodaccountEntity1.getNabnum();
|
||||
if (nabnumBigDecimal == null) {
|
||||
nabnumBigDecimal = new BigDecimal("0");
|
||||
}
|
||||
// BigDecimal nabnumBigDecimal = new BigDecimal(nabnum);
|
||||
|
||||
if (!"0".equals(nabmnyBigDecimal.stripTrailingZeros().toPlainString()) && !"0".equals(nabnumBigDecimal.stripTrailingZeros().toPlainString())) {
|
||||
//得到结存单价
|
||||
BigDecimal bigDecimal = nabmnyBigDecimal.divide(nabnumBigDecimal, 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
|
||||
totalPayAmount = bigDecimal.stripTrailingZeros().toPlainString();
|
||||
} else {
|
||||
//如果结存金额为或者数量为0,则设置为0
|
||||
totalPayAmount = "0";
|
||||
}
|
||||
} else {
|
||||
//取采购价
|
||||
logger.info("店铺:{} 取O采购价", header.getStoreCode());
|
||||
PoOrderBEntity poOrderBEntity = null;
|
||||
if (mapList != null && mapList.size() > 0) {
|
||||
Map<String, PoOrderBEntity> poOrderBEntityList = (Map<String, PoOrderBEntity>) mapList.get(1);
|
||||
if (poOrderBEntityList != null && poOrderBEntityList.size() > 0) {
|
||||
poOrderBEntity = poOrderBEntityList.get(bdInvmandocEntity.getPkInvmandoc());
|
||||
}
|
||||
}
|
||||
if (poOrderBEntity != null) {
|
||||
String norgtaxprice = poOrderBEntity.getNorgtaxprice();
|
||||
if ("0".equals(new BigDecimal(norgtaxprice).stripTrailingZeros().toPlainString())) {
|
||||
//如果采购单价都为0,那么金额也为0
|
||||
totalPayAmount = "0";
|
||||
} else {
|
||||
totalPayAmount = norgtaxprice;
|
||||
}
|
||||
} else {
|
||||
Assert.state(false, "店铺:{} 存货管理档案主键:{} 既没有结存价、也没有采购价!", header.getStoreCode(), bdInvmandocEntity.getPkInvmandoc());
|
||||
}
|
||||
}
|
||||
}
|
||||
return totalPayAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化所有存货管理档案对应的结存价、采购价
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
private List<Map> initAllBalancePricePurchasePrice() throws Exception {
|
||||
List<Map> mapList = new ArrayList<>();
|
||||
Map<String, IaPeriodaccountEntity> stringIaPeriodaccountEntityMap = balanceUnitPriceUtil.initBalancePrice();
|
||||
Map<String, PoOrderBEntity> stringPoOrderBEntityMap = balanceUnitPriceUtil.initPurchasePrice();
|
||||
mapList.add(stringIaPeriodaccountEntityMap);
|
||||
mapList.add(stringPoOrderBEntityMap);
|
||||
return mapList;
|
||||
}
|
||||
}
|
|
@ -779,7 +779,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
Assert.notNull(stockinB.getReceivedQty(), "实收数量不能为空 明细行对象:{}", JSON.toJSONString(stockinB));
|
||||
|
||||
//确定好实退金额,可能为O的实退金额,也可能是结存价和采购价
|
||||
String totalAmount = getFloorPrice(isCheckShopChoose, bdInvbasdocEntity, header, afterSalesOrder);
|
||||
String totalAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, afterSalesOrder);
|
||||
|
||||
noriginalcurtaxprice = new BigDecimal(totalAmount).divide(new BigDecimal(stockinB.getReceivedQty()), 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);
|
||||
|
@ -2482,32 +2482,32 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
* Boolean isCheckShopChoose
|
||||
*
|
||||
* @param isCheckShopChoose true取OFS实付金额、false取结存金额或者采购价
|
||||
* @param bdInvbasdocEntity 存货基础档案
|
||||
* @param bdInvmandocEntity 存货管理档案
|
||||
* @param header OFS收入入库单表头
|
||||
* @param afterSalesOrder OFS售后订单明细行
|
||||
* @author liuyang
|
||||
*/
|
||||
private String getFloorPrice(Boolean isCheckShopChoose, BdInvbasdocEntity bdInvbasdocEntity, StockinOrderSearchResponse.StockinOrder.StockinH header, RerturnGoodsOrderSearchDetails afterSalesOrder) throws Exception {
|
||||
private String getFloorPrice(Boolean isCheckShopChoose, BdInvmandocEntity bdInvmandocEntity, StockinOrderSearchResponse.StockinOrder.StockinH header, RerturnGoodsOrderSearchDetails afterSalesOrder) throws Exception {
|
||||
Assert.notNull(isCheckShopChoose, "isCheckShopChoose不能为空");
|
||||
Assert.notNull(bdInvbasdocEntity, "bdInvbasdocEntity不能为空");
|
||||
Assert.notNull(bdInvmandocEntity, "bdInvmandocEntity不能为空");
|
||||
Assert.notNull(header, "header不能为空");
|
||||
Assert.notNull(afterSalesOrder, "afterSalesOrder不能为空");
|
||||
|
||||
String totalPayAmount = null;
|
||||
if (isCheckShopChoose) {
|
||||
//取结存
|
||||
List<BdInvbasdocEntity> bdInvbasdocEntityList = new ArrayList<>();
|
||||
bdInvbasdocEntityList.add(bdInvbasdocEntity);
|
||||
List<IaPeriodaccountEntity> iaPeriodaccountEntityList = balanceUnitPriceUtil.queryBalanceUnitPrice(bdInvbasdocEntityList);
|
||||
List<BdInvmandocEntity> bdInvmandocEntityArrayList = new ArrayList<>();
|
||||
bdInvmandocEntityArrayList.add(bdInvmandocEntity);
|
||||
List<IaPeriodaccountEntity> iaPeriodaccountEntityList = balanceUnitPriceUtil.queryBalanceUnitPrice(bdInvmandocEntityArrayList);
|
||||
if (iaPeriodaccountEntityList != null && iaPeriodaccountEntityList.size() > 0) {
|
||||
//结存金额
|
||||
logger.info("店铺:{} 取O结存价", header.getStoreCode());
|
||||
IaPeriodaccountEntity iaPeriodaccountEntity = iaPeriodaccountEntityList.get(0);
|
||||
String nabmny = iaPeriodaccountEntity.getNabmny();
|
||||
if (nabmny == null || "".equals(nabmny)) {
|
||||
nabmny = "0";
|
||||
BigDecimal nabmnyBigDecimal = iaPeriodaccountEntity.getNabmny();
|
||||
if (nabmnyBigDecimal == null) {
|
||||
nabmnyBigDecimal = new BigDecimal("0");
|
||||
}
|
||||
BigDecimal nabmnyBigDecimal = new BigDecimal(nabmny);
|
||||
// BigDecimal nabmnyBigDecimal = new BigDecimal(nabmny);
|
||||
if (!"0".equals(nabmnyBigDecimal.stripTrailingZeros().toPlainString())) {
|
||||
totalPayAmount = nabmnyBigDecimal.stripTrailingZeros().toPlainString();
|
||||
} else {
|
||||
|
@ -2516,7 +2516,9 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
} else {
|
||||
//取采购价
|
||||
List<PoOrderBEntity> poOrderBEntityList = balanceUnitPriceUtil.queryPurchaseUnitPriceByInvcodes(bdInvbasdocEntityList);
|
||||
List<BdInvmandocEntity> bdInvmandocEntityArrayList1 = new ArrayList<>();
|
||||
bdInvmandocEntityArrayList1.add(bdInvmandocEntity);
|
||||
List<PoOrderBEntity> poOrderBEntityList = balanceUnitPriceUtil.queryPurchaseUnitPriceByInvcodes(bdInvmandocEntityArrayList1);
|
||||
if (poOrderBEntityList != null && poOrderBEntityList.size() > 0) {
|
||||
logger.info("店铺:{} 取O采购价", header.getStoreCode());
|
||||
String norgtaxprice = poOrderBEntityList.get(0).getNorgtaxprice();
|
||||
|
@ -2531,7 +2533,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
totalPayAmount = multiply.stripTrailingZeros().toPlainString();
|
||||
}
|
||||
} else {
|
||||
Assert.state(false, "店铺:{} 存货:{} 既没有结存价、也没有采购价!", header.getStoreCode(), bdInvbasdocEntity.getInvcode());
|
||||
Assert.state(false, "店铺:{} 存货管理档案主键:{} 既没有结存价、也没有采购价!", header.getStoreCode(), bdInvmandocEntity.getPkInvmandoc());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -3,17 +3,14 @@ package com.hzya.frame.plugin.lets.util;
|
|||
import cn.hutool.core.lang.Assert;
|
||||
import com.hzya.frame.plugin.lets.dao.IIaPeriodaccountDao;
|
||||
import com.hzya.frame.plugin.lets.dao.IPoOrderBDao;
|
||||
import com.hzya.frame.plugin.lets.entity.BdInvbasdocEntity;
|
||||
import com.hzya.frame.plugin.lets.entity.BdInvmandocEntity;
|
||||
import com.hzya.frame.plugin.lets.entity.IaPeriodaccountEntity;
|
||||
import com.hzya.frame.plugin.lets.entity.PoOrderBEntity;
|
||||
import com.hzya.frame.split.SplitListByCountUtil;
|
||||
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.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -64,21 +61,28 @@ public class BalanceUnitPriceUtil {
|
|||
* 查询存货的结存金额、数量等信息
|
||||
* 需要手动计算一遍,用金额/数量,可能会有负结存的情况,我取绝对值
|
||||
*
|
||||
* @param bdInvmandocEntity 存货管理档案集合
|
||||
* @author liuyang
|
||||
*/
|
||||
public List<IaPeriodaccountEntity> queryBalanceUnitPrice(List<BdInvbasdocEntity> bdInvbasdocEntityList) throws Exception {
|
||||
List<IaPeriodaccountEntity> iaPeriodaccountEntityList = new ArrayList<>();
|
||||
if (bdInvbasdocEntityList != null && bdInvbasdocEntityList.size() > 0) {
|
||||
List<List<BdInvbasdocEntity>> splitListByCount = SplitListByCountUtil.splitListByCount(bdInvbasdocEntityList, 100);
|
||||
for (int i = 0; i < splitListByCount.size(); i++) {
|
||||
List<BdInvbasdocEntity> bdInvbasdocEntities = splitListByCount.get(i);
|
||||
public List<IaPeriodaccountEntity> queryBalanceUnitPrice(List<BdInvmandocEntity> bdInvmandocEntity) throws Exception {
|
||||
// Assert.notNull(pkCorp, "对应的公司主键不能为空!");
|
||||
|
||||
String invcodes = bdInvbasdocEntities.stream().map(bdInvbasdoc -> "'" + bdInvbasdoc.getInvcode() + "'").collect(Collectors.joining(","));
|
||||
IaPeriodaccountEntity iaPeriodaccountEntity = new IaPeriodaccountEntity();
|
||||
iaPeriodaccountEntity.setDataSourceCode("lets_u8c");
|
||||
iaPeriodaccountEntity.setInvcodes(invcodes);
|
||||
List<IaPeriodaccountEntity> iaPeriodaccountEntityList1 = iIaPeriodaccountDao.queryBalancePrice(iaPeriodaccountEntity);
|
||||
iaPeriodaccountEntityList.addAll(iaPeriodaccountEntityList1);
|
||||
List<IaPeriodaccountEntity> iaPeriodaccountEntityList = new ArrayList<>();
|
||||
if (bdInvmandocEntity != null && bdInvmandocEntity.size() > 0) {
|
||||
List<List<BdInvmandocEntity>> lists = SplitListByCountUtil.splitListByCount(bdInvmandocEntity, 600);
|
||||
for (int i = 0; i < lists.size(); i++) {
|
||||
List<BdInvmandocEntity> bdInvmandocEntities = lists.get(i);
|
||||
|
||||
String pkInvmandocs = bdInvmandocEntities.stream().map(bdInvbasdoc -> "'" + bdInvbasdoc.getPkInvmandoc() + "'").collect(Collectors.joining(","));
|
||||
if (pkInvmandocs != null && pkInvmandocs.length() > 0) {
|
||||
IaPeriodaccountEntity iaPeriodaccountEntity = new IaPeriodaccountEntity();
|
||||
iaPeriodaccountEntity.setDataSourceCode("lets_u8c");
|
||||
// iaPeriodaccountEntity.setInvcodes(invcodes);
|
||||
iaPeriodaccountEntity.setPkInvmandocs(pkInvmandocs);
|
||||
// iaPeriodaccountEntity.setPk_corp(pkCorp);
|
||||
List<IaPeriodaccountEntity> iaPeriodaccountEntityList1 = iIaPeriodaccountDao.queryBalancePrice(iaPeriodaccountEntity);
|
||||
iaPeriodaccountEntityList.addAll(iaPeriodaccountEntityList1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return iaPeriodaccountEntityList;
|
||||
|
@ -87,23 +91,68 @@ public class BalanceUnitPriceUtil {
|
|||
/**
|
||||
* 查询存货对应的采购单价
|
||||
*
|
||||
* @param bdInvmandocEntity 存货管理档案
|
||||
* @author liuyang
|
||||
*/
|
||||
public List<PoOrderBEntity> queryPurchaseUnitPriceByInvcodes(List<BdInvbasdocEntity> bdInvbasdocEntityList) throws Exception {
|
||||
List<PoOrderBEntity> poOrderBEntityList = new ArrayList<>();
|
||||
if (bdInvbasdocEntityList != null && bdInvbasdocEntityList.size() > 0) {
|
||||
List<List<BdInvbasdocEntity>> splitListByCount = SplitListByCountUtil.splitListByCount(bdInvbasdocEntityList, 100);
|
||||
for (int i = 0; i < splitListByCount.size(); i++) {
|
||||
List<BdInvbasdocEntity> bdInvbasdocEntities = splitListByCount.get(i);
|
||||
String invcodes = bdInvbasdocEntities.stream().map(bdInvbasdoc -> "'" + bdInvbasdoc.getInvcode() + "'").collect(Collectors.joining(","));
|
||||
public List<PoOrderBEntity> queryPurchaseUnitPriceByInvcodes(List<BdInvmandocEntity> bdInvmandocEntity) throws Exception {
|
||||
// Assert.notNull(pkCorp, "对应的公司主键不能为空!");
|
||||
|
||||
PoOrderBEntity poOrderBEntity = new PoOrderBEntity();
|
||||
poOrderBEntity.setInvcodes(invcodes);
|
||||
poOrderBEntity.setDataSourceCode("lets_u8c");
|
||||
List<PoOrderBEntity> poOrderBEntityList1 = iPoOrderBDao.queryPurchaseUnitPriceByInvcodes(poOrderBEntity);
|
||||
poOrderBEntityList.addAll(poOrderBEntityList1);
|
||||
List<PoOrderBEntity> poOrderBEntityList = new ArrayList<>();
|
||||
if (bdInvmandocEntity != null && bdInvmandocEntity.size() > 0) {
|
||||
List<List<BdInvmandocEntity>> lists = SplitListByCountUtil.splitListByCount(bdInvmandocEntity, 600);
|
||||
for (int i = 0; i < lists.size(); i++) {
|
||||
List<BdInvmandocEntity> bdInvmandocEntities = lists.get(i);
|
||||
|
||||
String cmangids = bdInvmandocEntities.stream().map(bdInvmandocEntity1 -> "'" + bdInvmandocEntity1.getPkInvmandoc() + "'").collect(Collectors.joining(","));
|
||||
if (cmangids != null && cmangids.length() > 0) {
|
||||
PoOrderBEntity poOrderBEntity = new PoOrderBEntity();
|
||||
// poOrderBEntity.setInvcodes(invcodes);
|
||||
poOrderBEntity.setDataSourceCode("lets_u8c");
|
||||
poOrderBEntity.setCmangids(cmangids);
|
||||
// poOrderBEntity.setPk_corp(pkCorp);
|
||||
List<PoOrderBEntity> poOrderBEntityList1 = iPoOrderBDao.queryPurchaseUnitPriceByInvcodes(poOrderBEntity);
|
||||
poOrderBEntityList.addAll(poOrderBEntityList1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return poOrderBEntityList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化「结存价」,每条存货最新的结存价
|
||||
* <p>
|
||||
* key=存货管理档案
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
public Map<String, IaPeriodaccountEntity> initBalancePrice() throws Exception {
|
||||
Map<String, IaPeriodaccountEntity> stringIaPeriodaccountEntityMap = new HashMap<>();
|
||||
//查询所有存货最新的结存价
|
||||
IaPeriodaccountEntity iaPeriodaccountEntity = new IaPeriodaccountEntity();
|
||||
iaPeriodaccountEntity.setDataSourceCode("lets_u8c");
|
||||
List<IaPeriodaccountEntity> iaPeriodaccountEntityList1 = iIaPeriodaccountDao.queryBalancePrice(iaPeriodaccountEntity);
|
||||
if (iaPeriodaccountEntityList1 != null && iaPeriodaccountEntityList1.size() > 0) {
|
||||
//转换为Map
|
||||
stringIaPeriodaccountEntityMap = iaPeriodaccountEntityList1.stream().filter(entity -> Objects.nonNull(entity.getCinventoryid())).collect(Collectors.toMap(IaPeriodaccountEntity::getCinventoryid, entity -> entity));
|
||||
}
|
||||
return stringIaPeriodaccountEntityMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化「采购价」,每条存货最新的采购价
|
||||
* key=存货管理档案
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
public Map<String, PoOrderBEntity> initPurchasePrice() throws Exception {
|
||||
Map<String, PoOrderBEntity> stringPoOrderBEntityHashMap = new HashMap<>();
|
||||
PoOrderBEntity poOrderBEntity = new PoOrderBEntity();
|
||||
poOrderBEntity.setDataSourceCode("lets_u8c");
|
||||
List<PoOrderBEntity> poOrderBEntityList1 = iPoOrderBDao.queryPurchaseUnitPriceByInvcodes(poOrderBEntity);
|
||||
if (poOrderBEntityList1 != null && poOrderBEntityList1.size() > 0) {
|
||||
//转换为Map
|
||||
stringPoOrderBEntityHashMap = poOrderBEntityList1.stream().filter(entity -> Objects.nonNull(entity.getCmangid())).collect(Collectors.toMap(PoOrderBEntity::getCmangid, entity -> entity));
|
||||
}
|
||||
return stringPoOrderBEntityHashMap;
|
||||
}
|
||||
}
|
|
@ -79,7 +79,8 @@ public class SoSaleOutPluginInitializerToBTest {
|
|||
// soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024101700000270");
|
||||
|
||||
try {
|
||||
soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024101800000739", "stock");
|
||||
soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024101800025544", "stock");
|
||||
// soSaleOutPluginInitializerToB.startImplementByTranTime("2024-10-18 14:49:58", "2024-10-18 14:49:59");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue