From 7a1a4c630f7aceea5c92f3db56273283e3eadfbd Mon Sep 17 00:00:00 2001
From: liuy <37787198+LiuyCodes@users.noreply.github.com>
Date: Thu, 14 Nov 2024 18:27:05 +0800
Subject: [PATCH] =?UTF-8?q?feat(sales):=20=E6=96=B0=E5=A2=9E=E7=9B=AE?=
=?UTF-8?q?=E6=A0=87=E5=BA=94=E6=94=B6=E5=AD=97=E6=AE=B5=E5=B9=B6=E4=BC=98?=
=?UTF-8?q?=E5=8C=96=E9=94=80=E5=94=AE=E5=87=BA=E5=BA=93=E5=A4=84=E7=90=86?=
=?UTF-8?q?=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 在 TocofsSaleoutDetailedEntity 和 DetailsDto 中新增目标应收字段
- 优化销售出库插件初始化器中的金额计算逻辑
- 调整批量插入/更新操作的批次大小- 在测试类中更新相关测试用例
---
.../entity/TocofsSaleoutDetailedEntity.xml | 16 +++---
.../sales/SoSaleOutPluginInitializerToB.java | 50 +++++++++++++------
.../SoSaleOutPluginInitializerToBTest.java | 6 +--
.../lets/dto/TobofsSaleoutDetailedDto.java | 5 ++
.../entity/TocofsSaleoutDetailedEntity.xml | 2 +
.../dto/ofssaleorderoutsearch/DetailsDto.java | 4 ++
6 files changed, 58 insertions(+), 25 deletions(-)
diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.xml
index 075673e3..ecc9a204 100644
--- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.xml
+++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.xml
@@ -1009,7 +1009,7 @@
- insert into tocofs_saleout_detailed(id,newPushDate,newTransmitInfo,newState,newSystemNumber,newSystemPrimary)
+ insert into tocofs_saleout_detailed(id,newPushDate,newTransmitInfo,newState,newSystemNumber,newSystemPrimary,def7)
values
(
@@ -1018,7 +1018,8 @@
#{entity.newtransmitinfo},
#{entity.newstate},
#{entity.newsystemnumber},
- #{entity.newsystemprimary}
+ #{entity.newsystemprimary},
+ #{entity.def7}
)
on duplicate key update
@@ -1027,7 +1028,8 @@
newTransmitInfo = values(newTransmitInfo),
newState = values(newState),
newSystemNumber = values(newSystemNumber),
- newSystemPrimary = values(newSystemPrimary)
+ newSystemPrimary = values(newSystemPrimary),
+ def7 = values(def7)
@@ -1051,7 +1053,7 @@
- insert into tocofs_saleout_detailed(id,def5,def6,newState4,newSystemNumber4,newSystemPrimary4)
+ insert into tocofs_saleout_detailed(id,def5,def6,newState4,newSystemNumber4,newSystemPrimary4,def7)
values
(
@@ -1060,7 +1062,8 @@
#{entity.def6},
#{entity.newstate4},
#{entity.newsystemnumber4},
- #{entity.newsystemprimary4}
+ #{entity.newsystemprimary4},
+ #{entity.def7}
)
on duplicate key update
@@ -1069,7 +1072,8 @@
def6 = values(def6),
newState4 = values(newState4),
newSystemNumber4 = values(newSystemNumber4),
- newSystemPrimary4 = values(newSystemPrimary4)
+ newSystemPrimary4 = values(newSystemPrimary4),
+ def7 = values(def7)
diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java
index 7455fb7b..d7b94546 100644
--- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java
+++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java
@@ -787,8 +787,10 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
BigDecimal noriginalcursummny = null;//价税合计
BigDecimal noriginalcurtaxmny = null;//税额
try {
- //综合判断对应的目标金额
+ //判断目标金额:O实收、结存价、采购价
String totalPayAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, detailsDto);
+ detailsDto.setTargetAccountsReceivable(totalPayAmount);
+
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);
@@ -1908,6 +1910,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
try {
//综合判断对应的目标金额
String totalPayAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, detailsDto);
+ detailsDto.setTargetAccountsReceivable(totalPayAmount);
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);
@@ -2355,6 +2358,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
tocofsSaleoutDetailedEntity.setNewpushdate(getNewDateStr());
tocofsSaleoutDetailedEntity.setNewtransmitinfo(finalNewTransmitInfo);
tocofsSaleoutDetailedEntity.setNewstate(newstate);
+ tocofsSaleoutDetailedEntity.setDef7(detailsDto.getTargetAccountsReceivable());
if (successY.equals(newstate)) {
//只有成功才填充下游系统主键和编码
tocofsSaleoutDetailedEntity.setNewsystemnumber(newsystemnumber);
@@ -2365,7 +2369,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
//以50行为一个批次,推送到Mysql
if (tocofsSaleoutDetailedEntityList.size() > 0) {
- List> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsSaleoutDetailedEntityList, 50);
+ List> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsSaleoutDetailedEntityList, 100);
for (int i = 0; i < splitListByCount.size(); i++) {
List tocofsSaleoutDetailedEntityList1 = splitListByCount.get(i);
iTocofsSaleoutDetailedDao.entityInsertOrUpdateBatchStock6(tocofsSaleoutDetailedEntityList1);
@@ -2411,6 +2415,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
tocofsSaleoutDetailedEntity.setDef5(getNewDateStr());
tocofsSaleoutDetailedEntity.setDef6(finalNewTransmitInfo);
tocofsSaleoutDetailedEntity.setNewstate4(newstate);
+ tocofsSaleoutDetailedEntity.setDef7(detailsDto.getTargetAccountsReceivable());
if (successY.equals(newstate)) {
//只有成功才填充下游系统主键和编码
tocofsSaleoutDetailedEntity.setNewsystemnumber4(newsystemnumber);
@@ -2421,7 +2426,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
//以50行为一个批次,推送到Mysql
if (tocofsSaleoutDetailedEntityList.size() > 0) {
- List> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsSaleoutDetailedEntityList, 50);
+ List> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsSaleoutDetailedEntityList, 100);
for (int i = 0; i < splitListByCount.size(); i++) {
List tocofsSaleoutDetailedEntityList1 = splitListByCount.get(i);
iTocofsSaleoutDetailedDao.entityInsertOrUpdateBatchStock8(tocofsSaleoutDetailedEntityList1);
@@ -2493,7 +2498,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
//以50行为一个批次更新状态
if (tocofsSaleoutDetailedEntityList.size() > 0) {
- List> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsSaleoutDetailedEntityList, 50);
+ List> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsSaleoutDetailedEntityList, 100);
for (int i = 0; i < splitListByCount.size(); i++) {
List tocofsSaleoutDetailedEntityList1 = splitListByCount.get(i);
iTocofsSaleoutDetailedDao.entityInsertOrUpdateBatchStock1(tocofsSaleoutDetailedEntityList1);
@@ -2555,7 +2560,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
//以50行为一个批次更新状态
if (tocofsSaleoutDetailedEntityList.size() > 0) {
- List> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsSaleoutDetailedEntityList, 50);
+ List> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsSaleoutDetailedEntityList, 100);
for (int i = 0; i < splitListByCount.size(); i++) {
List tocofsSaleoutDetailedEntityList1 = splitListByCount.get(i);
iTocofsSaleoutDetailedDao.entityInsertOrUpdateBatchStock7(tocofsSaleoutDetailedEntityList1);
@@ -2661,25 +2666,38 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
Assert.notNull(header, "header不能为空");
Assert.notNull(detailsDto, "detailsDto不能为空");
+ //这里只能是金额
String totalPayAmount = null;
if (isCheckShopChoose) {
//取结存价
+ //结存金额=U结存金额/U结存数量*O明细行实出数量
List bdInvmandocEntityArrayList = new ArrayList<>();
bdInvmandocEntityArrayList.add(bdInvmandocEntity);
List 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 = new BigDecimal(nabmny);
- if (!"0".equals(nabmnyBigDecimal.stripTrailingZeros().toPlainString())) {
- totalPayAmount = nabmnyBigDecimal.stripTrailingZeros().toPlainString();
+
+ //结存数量
+ String nabnum = iaPeriodaccountEntity.getNabnum();
+ if (nabnum == null || "".equals(nabnum)) {
+ nabnum = "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);
+ BigDecimal totalPayAmountBigDecimal = bigDecimal.multiply(new BigDecimal(detailsDto.getShipQty())).setScale(2, BigDecimal.ROUND_HALF_UP);
+ totalPayAmount = totalPayAmountBigDecimal.stripTrailingZeros().toPlainString();
} else {
- //如果结存金额为0,则设置为0
+ //如果结存金额为或者数量为0,则设置为0
totalPayAmount = "0";
}
} else {
@@ -2690,15 +2708,15 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
if (poOrderBEntityList != null && poOrderBEntityList.size() > 0) {
logger.info("店铺:{} 取O采购价", header.getStoreCode());
String norgtaxprice = poOrderBEntityList.get(0).getNorgtaxprice();
- String nordernum = poOrderBEntityList.get(0).getNordernum();
- if ("0".equals(new BigDecimal(norgtaxprice).stripTrailingZeros().toPlainString()) || "0".equals(new BigDecimal(nordernum).stripTrailingZeros().toPlainString())) {
+// String nordernum = poOrderBEntityList.get(0).getNordernum();
+ if (!"0".equals(new BigDecimal(norgtaxprice).stripTrailingZeros().toPlainString())) {
+// BigDecimal norgtaxpriceBigDecimal = new BigDecimal(norgtaxprice);
+// BigDecimal nordernumBigDecimal = new BigDecimal(nordernum);
+ BigDecimal totalPayAmountBigDecimal = new BigDecimal(norgtaxprice).multiply(new BigDecimal(detailsDto.getShipQty())).setScale(2, BigDecimal.ROUND_HALF_UP);
+ totalPayAmount = totalPayAmountBigDecimal.stripTrailingZeros().toPlainString();
+ } else {
//如果采购单价都为0,那么金额也为0
totalPayAmount = "0";
- } else {
- BigDecimal norgtaxpriceBigDecimal = new BigDecimal(norgtaxprice);
- BigDecimal nordernumBigDecimal = new BigDecimal(nordernum);
- BigDecimal multiply = norgtaxpriceBigDecimal.multiply(nordernumBigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP);
- totalPayAmount = multiply.stripTrailingZeros().toPlainString();
}
} else {
Assert.state(false, "店铺:{} 存货管理档案主键:{} 既没有结存价、也没有采购价!", header.getStoreCode(), bdInvmandocEntity.getPkInvmandoc());
diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToBTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToBTest.java
index 684f6f70..b9f108d7 100644
--- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToBTest.java
+++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToBTest.java
@@ -83,8 +83,8 @@ public class SoSaleOutPluginInitializerToBTest {
// soSaleOutPluginInitializerToB.startImplementByStockTime("2024-10-23 16:09:59", "2024-10-23 16:10:01");
-// String aaa = "LETS-SH2024103100016169";
-// soSaleOutPluginInitializerToB.startImplementByCode(aaa, "stock");
+ String aaa = "LETS-SH2024102100023018";
+ soSaleOutPluginInitializerToB.startImplementByCode(aaa, "tran");
// soSaleOutPluginInitializerToB.startImplementByTranTime("2024-10-28 00:00:00", "2024-10-28 23:59:59");
// soSaleOutPluginInitializerToB.startImplementByStockTime("2024-10-31 14:48:41", "2024-10-31 14:48:41");
@@ -95,7 +95,7 @@ public class SoSaleOutPluginInitializerToBTest {
// soSaleOutPluginInitializerToB.startImplementByStockTime("2024-11-08 19:18:02", "2024-11-08 19:18:02");
- soSaleOutPluginInitializerToB.startImplementByTranTime("2000-11-08 19:18:02", "2000-11-08 19:18:02");
+// soSaleOutPluginInitializerToB.startImplementByTranTime("2000-11-08 19:18:02", "2000-11-08 19:18:02");
} catch (Exception e) {
e.printStackTrace();
}
diff --git a/service/src/main/java/com/hzya/frame/report/lets/dto/TobofsSaleoutDetailedDto.java b/service/src/main/java/com/hzya/frame/report/lets/dto/TobofsSaleoutDetailedDto.java
index ac3695ef..f06dcbf0 100644
--- a/service/src/main/java/com/hzya/frame/report/lets/dto/TobofsSaleoutDetailedDto.java
+++ b/service/src/main/java/com/hzya/frame/report/lets/dto/TobofsSaleoutDetailedDto.java
@@ -85,4 +85,9 @@ public class TobofsSaleoutDetailedDto {
@ExcelProperty(value = "交易-U8C主键")
private String newsystemprimary4;
//TOB交易红 结束
+
+ //应收 开始
+ @ExcelProperty(value = "计算应收")
+ private String def7;
+ //应收 结束
}
\ No newline at end of file
diff --git a/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsSaleoutDetailedEntity.xml b/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsSaleoutDetailedEntity.xml
index 1f3cf702..2eca4ace 100644
--- a/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsSaleoutDetailedEntity.xml
+++ b/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsSaleoutDetailedEntity.xml
@@ -473,6 +473,8 @@
+
+
diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/DetailsDto.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/DetailsDto.java
index 2c83c6f5..27e35435 100755
--- a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/DetailsDto.java
+++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/DetailsDto.java
@@ -57,4 +57,8 @@ public class DetailsDto {
* OFS销售订单
*/
private com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto;
+ /**
+ * 目标应收
+ */
+ private String targetAccountsReceivable;
}
\ No newline at end of file