fix(buildpackage): 修复 TOC 红字应收单推送逻辑

- 在推送 U8C之前增加对 childrenns 列表的空检查
- 避免在没有有效数据时进行不必要的推送操作
- 优化代码结构,提高代码的可读性和性能
This commit is contained in:
liuy 2025-08-25 15:03:36 +08:00
parent d35a0f12b4
commit 82f0c73c49
3 changed files with 280 additions and 330 deletions

View File

@ -1218,6 +1218,7 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
// groupShipQty = new BigDecimal("0");
if ((filterJfbbjeIncludingTax(pushScenarioType)) && groupShipQty.compareTo(BigDecimal.ZERO) == 0) {
List<ArapDjzbVO.Childrenn> childrenns = filterZeroJfbbje(pushScenarioType);
if (childrenns != null && childrenns.size() > 0) {
// 推送U8C
List<ArapDjzbVO> arapDjzbVOList = new ArrayList<>();
ArapDjzbVO arapDjzbVO = new ArapDjzbVO();
@ -1240,6 +1241,7 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
// 记录同步状态
updateSuccessOrFail3(value, "Y", "success", djbh, vouchid, value.get(0).getStorageTimeStamp());
}
}
} catch (Exception e) {
logger.error("TOC红字应收单转换成U8C对象过程中、或者单据推送到U8C出现异常", e);
//记录失败

View File

@ -344,6 +344,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
});
if (sceneType.equals("stock")) {
getSetStock(returnGoodHeaderDetailsDataDtoList, "2");
// getSetStock(returnGoodHeaderDetailsDataDtoList, "0");
} else if (sceneType.equals("tran")) {
getSetTran(returnGoodHeaderDetailsDataDtoList, "2");
}
@ -777,10 +778,11 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
//如果oldValue存在实入数量=0的明细行则过滤掉
//2025年5月6日10:12:21 和丽知闫旭妮姐沟通如果oldValue存在实入数量=0的明细行则过滤掉
filterReceivedQtyZero(oldValue);
if (oldValue == null || oldValue.size() == 0) {
continue;
}
//2025年8月24日14:03:45 和闫旭沟通需要显示应收优惠金额等不咋此处过滤
// filterReceivedQtyZero(oldValue);
// if (oldValue == null || oldValue.size() == 0) {
// continue;
// }
StockinOrderSearchResponse.StockinOrder.StockinH header = oldValue.get(0).getHeader();
BdCorpEntity bdCorpEntity = oldValue.get(0).getBdCorpEntity();//表头销售公司
@ -995,6 +997,9 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
// continue;
// }
//判断如果实入数量全部为0则不推送u8c,部分存在0的则过滤掉
checkSaleOrderNnumber(saleorderRequestChildrenDtoList);
if (saleorderRequestChildrenDtoList.size() > 0) {
if (ProfilesActiveConstant.PUSH_SCENE_TYPE_1.equals(pushScenarioType) || ProfilesActiveConstant.PUSH_SCENE_TYPE_2.equals(pushScenarioType)) {
//推送u8c生成红字销售订单
List<SaleorderRequestDto> saleorderRequestDtoList = new ArrayList<>();
@ -1022,6 +1027,9 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
} else {
Assert.state(false, "未知的场景类型 pushScenarioType={}", pushScenarioType);
}
} else {
updateSuccessOrFail1(oldValue, "N", "不符合条件不推U8C销售订单", null, null);
}
} catch (Exception e) {
//记录失败
logger.error("TOC退货业务转换成U8C对象过程中、或者单据推送到U8C出现异常", e);
@ -1098,8 +1106,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
BdDefdocEntity platformArchives = oldValue.get(0).getPlatformArchives();//U8C平台档案
BdDefdocEntity shopArchives = oldValue.get(0).getShopArchives();//U8C店铺档案
BdRdclEntity bdRdclEntity = oldValue.get(0).getBdRdclEntity();//U8C收发类别
String newstate4 = oldValue.get(0).getNewstate4();
String def15 = oldValue.get(0).getDef15();
String newstate4 = oldValue.get(0).getNewstate4();//确认收入红
String def15 = oldValue.get(0).getDef15();//确认收入蓝
//验证是否为指定的店铺如果为true则取结存价
Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode());
@ -1107,10 +1115,11 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose, sceneType);
Assert.notNull(goodsRertunSonDetailsDto, "合并明细行失败!");
BigDecimal groupShipQty = goodsRertunSonDetailsDto.getGroupShipQty();
BigDecimal groupTotalPayAmount = goodsRertunSonDetailsDto.getGroupTotalPayAmount();
//当金额>0但数量为0时推送红字应收单
// if (groupTotalPayAmount != null && groupShipQty != null && groupTotalPayAmount.compareTo(BigDecimal.ZERO) > 0 && groupShipQty.compareTo(BigDecimal.ZERO) == 0) {
//是否推送u8c红字销售订单
boolean isPushU8CSaleOrder = false;
//推送红字应收单
try {
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlowV4();
//生成业务日期
@ -1152,9 +1161,6 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
//如果合并后的金额为0则不传到U8C
Assert.notNull(goodsRertunSonDetailsDto.getGroupTotalPayAmount(), "goodsRertunSonDetailsDto.getGroupTotalPayAmount()不能为空!");
BigDecimal groupTotalPayAmount2 = goodsRertunSonDetailsDto.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP);
// if ("0".equals(groupTotalPayAmount2.stripTrailingZeros().toPlainString())) {
// continue;
// }
//修改为生成红字应收单表体
List<ArapDjzbVO.Childrenn> childrennArrayList = new ArrayList<>();
@ -1218,15 +1224,11 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
}
}
//如果总金额不为0并且数量=0生成红字应收单
// for (int i = 0; i < childrennArrayList.size(); i++) {
// ArapDjzbVO.Childrenn childrenn = childrennArrayList.get(i);
// childrenn.setJfbbje("0");
// }
// groupShipQty = new BigDecimal("0");
if ((filterJfbbjeIncludingTax(childrennArrayList)) && groupShipQty.compareTo(BigDecimal.ZERO) == 0) {
List<ArapDjzbVO.Childrenn> childrenns = filterZeroJfbbje(childrennArrayList);
if (ProfilesActiveConstant.PUSH_SCENE_TYPE_1.equals(pushScenarioType) || ProfilesActiveConstant.PUSH_SCENE_TYPE_2.equals(pushScenarioType)) {
//如果出现情况二但是生成的是红字应收单的情况下只会有一个Y不会有两个过滤逻辑只会判断两个Y需要在这里增加!"Y".equals(newstate4)判断
if (childrenns != null && childrenns.size() > 0 && !"A".equals(newstate4)) {
//推送U8C生成红字应收单
List<ArapDjzbVO> arapDjzbVOList = new ArrayList<>();
ArapDjzbVO arapDjzbVO = new ArapDjzbVO();
@ -1247,8 +1249,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
vouchid = arapDjzb.getParentvo().getVouchid();
}
logger.info("TOC红字应收单{} 销售订单主键:{} 销售公司:{} 公司:{}", djbh, vouchid, dwbm, bdCorpEntity.getUnitname());
updateSuccessOrFail2(oldValue, "Y", "success", djbh, vouchid, oldValue.get(0).getStorageTimeStamp());
updateSuccessOrFail2(oldValue, "A", "success", djbh, vouchid, oldValue.get(0).getStorageTimeStamp());
}
} else if (ProfilesActiveConstant.PUSH_SCENE_TYPE_0.equals(pushScenarioType)) {
//不推送U8C单据暂存
String vreceiptcode = "暂存";
@ -1259,6 +1261,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
} else {
Assert.state(false, "未知的场景类型 pushScenarioType={}", pushScenarioType);
}
} else {
isPushU8CSaleOrder = true;
}
} catch (Exception e) {
logger.error("TOC退货业务转换成U8C对象过程中、或者单据推送到U8C出现异常", e);
@ -1269,12 +1273,10 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
}
updateSuccessOrFail2(oldValue, "N", message, null, null, oldValue.get(0).getStorageTimeStamp());
}
// }
//当金额大于或者等于0数量大于0推送销售订单
// if (groupShipQty != null && groupTotalPayAmount != null && groupTotalPayAmount.compareTo(BigDecimal.ZERO) >= 0 && groupShipQty.compareTo(BigDecimal.ZERO) > 0) {
//推送红蓝字销售订单
if (isPushU8CSaleOrder) {
try {
// checkArchives(oldValue.get(0));
//生成业务日期
String generateBusinessDate = createSuccessFulTradeDate(header);
@ -1320,26 +1322,6 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
saleorderRequestParentDto.setVdef8(OverallConstant.getOverAllValue("售后类型标识-TOC售后-名称"));
saleorderRequestDto.setParentvo(saleorderRequestParentDto);
//改为红字应收单表头
//组装应收单表头
// ArapDjzbVO.Parentt parentVo = new ArapDjzbVO.Parentt();
// parentVo.setDjrq(generateBusinessDate);//单据日期
// parentVo.setDwbm(bdCorpEntity.getUnitcode());//公司
// parentVo.setLrr(OverallConstant.getOverAllValue("u8cApiZdrCode"));//录入人
// parentVo.setWldx("0");//往来对象标识 固定为客户
// parentVo.setDeptid(bdDeptdocEntity.getDeptcode());//部门
// parentVo.setShr(OverallConstant.getOverAllValue("u8cApiZdrCode"));//审批人
// parentVo.setShrq(generateBusinessDate);//审核日期
// parentVo.setDjlxbm("D0");//单据类型编码
// parentVo.setXslxbm(bdBusitypeEntity.getBusicode());//业务流程
// parentVo.setFeinvstatus("0");//开票状态
// parentVo.setHbbm(bdCubasdocEntity.getCustcode());//客商主键
// parentVo.setZyx1(shopArchives.getDoccode());//店铺档案
// parentVo.setZyx2(platformArchives.getDoccode());//来源平台
// parentVo.setZyx3(bdRdclEntity.getRdcode());//收发类别
// parentVo.setZyx16("1");//单据红字标识
// parentVo.setZyx17(ProfilesActiveConstant.sourceSystem1);//来源系统
// parentVo.setZyx18(keyGroup);//汇总维度
List<SaleorderRequestChildrenDto> saleorderRequestChildrenDtoList = new ArrayList<>();
saleorderRequestDto.setChildrenvo(saleorderRequestChildrenDtoList);
@ -1350,32 +1332,6 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
BdInvbasdocEntity bdInvbasdocEntity = oldValue.get(0).getBdInvbasdocEntity();
//根据存货基础档案编码查询当前存货的税率
BdTaxitemsEntity bdTaxitemsEntity1 = oldValue.get(0).getBdTaxitemsEntity();
//查询收支项目
// BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity);
// BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity);
//合并后如果数量为0则过滤掉
// if ("0".equals(goodsRertunSonDetailsDto.getGroupShipQty().stripTrailingZeros().toPlainString())) {
// continue;
// }
// String tax = new BigDecimal(bdTaxitemsEntity1.getTaxratio()).divide(new BigDecimal(100), 20, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString();
// BigDecimal noriginalcurprice = null;//无税单价
// BigDecimal noriginalcurmny = null;//无税金额
// BigDecimal noriginalcurtaxprice = null;//含税单价
// BigDecimal noriginalcursummny = null;//价税合计
// BigDecimal noriginalcurtaxmny = null;//税额=价税合计-无税金额
// try {
// noriginalcurtaxprice = goodsRertunSonDetailsDto.getGroupTotalPayAmount().divide(goodsRertunSonDetailsDto.getGroupShipQty(), 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(goodsRertunSonDetailsDto.getGroupShipQty()).setScale(2, BigDecimal.ROUND_HALF_UP);
// noriginalcursummny = noriginalcurtaxprice.multiply(goodsRertunSonDetailsDto.getGroupShipQty()).setScale(2, BigDecimal.ROUND_HALF_UP);
// noriginalcurtaxmny = noriginalcursummny.subtract(noriginalcurmny).setScale(2, BigDecimal.ROUND_HALF_UP);
// } catch (Exception e) {
// logger.error("TOC退货-确认收入,金额计算错误", e);
// Assert.state(false, "U8C红字销售订单金额计算错误原因{}", e.getMessage());
// }
// 判断是否为赠品
Boolean isblargessflag = false;
@ -1431,25 +1387,6 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
}
saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto);
//如果合并后的金额为0则不传到U8C
// Assert.notNull(goodsRertunSonDetailsDto.getGroupTotalPayAmount(), "goodsRertunSonDetailsDto.getGroupTotalPayAmount()不能为空!");
// BigDecimal groupTotalPayAmount = goodsRertunSonDetailsDto.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP);
// if ("0".equals(groupTotalPayAmount.stripTrailingZeros().toPlainString())) {
// continue;
// }
//修改为生成红字应收单表体
// List<ArapDjzbVO.Childrenn> childrennArrayList = new ArrayList<>();
// ArapDjzbVO.Childrenn arapDjzbVOChildrenn = new ArapDjzbVO.Childrenn();
// childrennArrayList.add(arapDjzbVOChildrenn);
// arapDjzbVOChildrenn.setCinventoryid(bdInvbasdocEntity.getInvcode());//存货管理档案
// arapDjzbVOChildrenn.setJfbbje("-" + groupTotalPayAmount.stripTrailingZeros().toPlainString());//借方本币金额
// arapDjzbVOChildrenn.setJfybje("-" + groupTotalPayAmount.stripTrailingZeros().toPlainString());//借方原币金额
// arapDjzbVOChildrenn.setJfbbsj("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//借方本币税金
// arapDjzbVOChildrenn.setJfybsj("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//借方原币税金
// arapDjzbVOChildrenn.setWbfbbje("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//借方本币无税金额
// arapDjzbVOChildrenn.setJfybwsje("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//借方原币无税金额
//退货没有邮费金额已经向万万确认
//所有业务商家优惠都不传
//平台优惠
@ -1466,7 +1403,6 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
BigDecimal absAccumulatedPostage = vdef4.abs();
BigDecimal negativeValue = absAccumulatedPostage.negate();
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
// queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
}
}
//达人优惠
@ -1483,7 +1419,6 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
BigDecimal absAccumulatedPostage = vdef6.abs();
BigDecimal negativeValue = absAccumulatedPostage.negate();
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
// queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
}
}
//支付优惠
@ -1500,16 +1435,19 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
BigDecimal absAccumulatedPostage = vdef5.abs();
BigDecimal negativeValue = absAccumulatedPostage.negate();// 符号取反转为负数
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
// queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
}
}
//存货数量>0生成红字销售订单
if (groupShipQty.compareTo(BigDecimal.ZERO) > 0) {
// if (groupShipQty.compareTo(BigDecimal.ZERO) > 0) {
//2025年8月25日10:42:30 不在此处验证否则影响红字应收单推送
//判断入库时间关单时间与交易成功时间推送u8c生成蓝字销售订单,仅满足情况二的条件才生成这张蓝字销售订单
//2025年8月25日10:59:26 把实入数量=0的明细行去掉
checkSaleOrderNnumber(saleorderRequestChildrenDtoList);
boolean oneSuccess = false;
if (!"Y".equals(newstate4)) {
if (ProfilesActiveConstant.PUSH_SCENE_TYPE_1.equals(pushScenarioType) || ProfilesActiveConstant.PUSH_SCENE_TYPE_2.equals(pushScenarioType)) {
if ((ProfilesActiveConstant.PUSH_SCENE_TYPE_1.equals(pushScenarioType) || ProfilesActiveConstant.PUSH_SCENE_TYPE_2.equals(pushScenarioType)) && saleorderRequestChildrenDtoList.size() > 0) {
//推送U8C红字销售订单如果推送失败抛出异常那么就会外围的try catch捕获代码不会往下执行
List<SaleorderRequestDto> saleorderRequestDtoList = new ArrayList<>();
saleorderRequestDtoList.add(saleorderRequestDto);
@ -1527,27 +1465,6 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
logger.info("TOC红字销售订单编号{} 销售订单主键:{} 销售公司:{} 公司:{}", vreceiptcode, csaleid, pk_corp, bdCorpEntity.getUnitname());
updateSuccessOrFail2(oldValue, "Y", "success", vreceiptcode, csaleid, oldValue.get(0).getStorageTimeStamp());
oneSuccess = true;
//推送第一笔红字销售订单
// List<ArapDjzbVO> arapDjzbVOList = new ArrayList<>();
// ArapDjzbVO arapDjzbVO = new ArapDjzbVO();
// arapDjzbVO.setParentvo(parentVo);
// arapDjzbVO.setChildren(childrennArrayList);
// arapDjzbVOList.add(arapDjzbVO);
//
// Map<String, List<ArapDjzbVO>> listMap = new HashMap<>();
// listMap.put("djzbvo", arapDjzbVOList);
//
// ArapDjzb arapDjzb = sendU8cRedReceivable(JSON.toJSONString(listMap));
// String djbh = null;
// String dwbm = null;
// String vouchid = null;
// if (arapDjzb != null && arapDjzb.getParentvo() != null) {
// djbh = arapDjzb.getParentvo().getDjbh();
// dwbm = arapDjzb.getParentvo().getDwbm();
// vouchid = arapDjzb.getParentvo().getVouchid();
// }
// logger.info("TOC红字应收单{} 销售订单主键:{} 销售公司:{}", djbh, vouchid, dwbm);
} else if (ProfilesActiveConstant.PUSH_SCENE_TYPE_0.equals(pushScenarioType)) {
//不推送U8C单据暂存
String vreceiptcode = "暂存";
@ -1557,15 +1474,16 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
updateSuccessOrFail2(oldValue, newstate, newTransmitInfo, vreceiptcode, csaleid, oldValue.get(0).getStorageTimeStamp());
oneSuccess = true;
} else {
Assert.state(false, "未知的场景类型 pushScenarioType={}", pushScenarioType);
updateSuccessOrFail2(oldValue, "N", "不符合条件不推U8C红字销售订单", null, null, oldValue.get(0).getStorageTimeStamp());
}
} else {
oneSuccess = true;
}
try {
//2025年8月25日10:41:37 如果实入数量全部0蓝字销售订单则不推送存在部分数量为0则过滤
if (!"Y".equals(def15) && oneSuccess && "2".equals(oldValue.get(0).getStorageTimeStamp())) {
if (ProfilesActiveConstant.PUSH_SCENE_TYPE_1.equals(pushScenarioType) || ProfilesActiveConstant.PUSH_SCENE_TYPE_2.equals(pushScenarioType)) {
if ((ProfilesActiveConstant.PUSH_SCENE_TYPE_1.equals(pushScenarioType) || ProfilesActiveConstant.PUSH_SCENE_TYPE_2.equals(pushScenarioType)) && saleorderRequestChildrenDtoList.size() > 0) {
if ("2".equals(oldValue.get(0).getStorageTimeStamp())) {
SaleorderRequestDto saleorderRequestDto1 = transformRedSalesOrderToBlueSalesOrder(saleorderRequestDto, bdBusitypeEntity2);
@ -1595,7 +1513,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
String newTransmitInfo = "暂存";
updateSuccessOrFail3(oldValue, newstate, newTransmitInfo, vreceiptcode, csaleid, oldValue.get(0).getStorageTimeStamp());
} else {
Assert.state(false, "未知的场景类型 pushScenarioType={}", pushScenarioType);
updateSuccessOrFail3(oldValue, "N", "不符合条件不推U8C蓝字销售订单", null, null, oldValue.get(0).getStorageTimeStamp());
}
}
} catch (Exception e) {
@ -1607,7 +1525,6 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
}
updateSuccessOrFail3(oldValue, "N", message, null, null, oldValue.get(0).getStorageTimeStamp());
}
}
} catch (Exception e) {
//记录红字销售订单异常失败
logger.error("TOC退货业务转换成U8C对象过程中、或者单据推送到U8C出现异常", e);
@ -1617,7 +1534,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
}
updateSuccessOrFail2(oldValue, "N", message, null, null, oldValue.get(0).getStorageTimeStamp());
}
// }
}
}
} else {
//2024年8月6日 11:28:54此处不记录失败不认为是错误
@ -3053,6 +2970,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
public void run() {
try {
String successY = "Y";
String successA = "A";
if (sonDetailsDtoList != null && sonDetailsDtoList.size() > 0) {
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityArrayList = new ArrayList<>();
for (int i = 0; i < sonDetailsDtoList.size(); i++) {
@ -3077,7 +2995,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
tocofsReturngoodsDetailedEntity.setDef10(goodsRertunSonDetailsDto.getPayDiscounts());
tocofsReturngoodsDetailedEntity.setDef11(goodsRertunSonDetailsDto.getExpertDiscounts());
tocofsReturngoodsDetailedEntity.setDef12(goodsRertunSonDetailsDto.getMerchantDiscounts());
if (successY.equals(newstate)) {
if (successY.equals(newstate) || successA.equals(newstate)) {
tocofsReturngoodsDetailedEntity.setNewsystemnumber4(newsystemnumber);
tocofsReturngoodsDetailedEntity.setNewsystemprimary4(newsystemprimary);
}
@ -3298,9 +3216,12 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
// }
//这里不可能是1,退款业务只可能是23
if ("2".equals(stockinB.getStorageTimeStamp())) {
//如果是2同时判断两个状态为Y则过滤
newstate = no2NameMap2.get(stockinB.getId());
if ("A".equals(newstate)) {
//如果为A代表红字应收单已经推送到u8c需要过滤
isSuccess = true;
} else if ("2".equals(stockinB.getStorageTimeStamp())) {
//如果是2同时判断两个状态为Y则过滤
newstate2 = no2NameMap3.get(stockinB.getId());
if (newstate != null && !"".equals(newstate) && (succeseeY.equals(newstate) || succeseeH.equals(newstate))) {
if (newstate2 != null && !"".equals(newstate2) && (succeseeY.equals(newstate2) || succeseeH.equals(newstate2))) {
@ -3309,7 +3230,6 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
}
} else if ("3".equals(stockinB.getStorageTimeStamp())) {
//如果是3仅判断一个状态为Y
newstate = no2NameMap2.get(stockinB.getId());
if (newstate != null && !"".equals(newstate) && (succeseeY.equals(newstate) || succeseeH.equals(newstate))) {
isSuccess = true;
}
@ -4168,6 +4088,9 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails();
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto = header.getHeaderDetailsDto();
if (headerDetailsDto == null) {
Assert.state(false, "售后入库单对应的销售订单为空! 售后入库单号:{}", header.getCode());
}
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header1 = headerDetailsDto.getHeader();
String closedAt = header.getClosedAt();
@ -4379,4 +4302,29 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
return new BigDecimal(jfbbje).compareTo(BigDecimal.ZERO) != 0;
}).collect(Collectors.toList());
}
/**
* 判断实入数量如果为0则过滤掉
*
* @param saleorderRequestChildrenDtoList u8c销售订单明细行
*/
private void checkSaleOrderNnumber(List<SaleorderRequestChildrenDto> saleorderRequestChildrenDtoList) {
if (saleorderRequestChildrenDtoList == null || saleorderRequestChildrenDtoList.isEmpty()) {
return;
}
// 过滤逻辑转换为 BigDecimal 后判断是否为 0
saleorderRequestChildrenDtoList.removeIf(dto -> {
String numberStr = dto.getNnumber();
if (numberStr == null) {
return false; // 保留 null 根据业务需求调整
}
try {
BigDecimal number = new BigDecimal(numberStr);
return number.compareTo(BigDecimal.ZERO) == 0;
} catch (NumberFormatException e) {
return false;
}
});
}
}

View File

@ -74,7 +74,7 @@ public class SoSaleReturnPluginInitializerToCTest {
//满足红字应收单
// soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072200001324", "tran");
//情况一
soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072900000460", "stock");
soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072200000255", "tran");
//情况二
// soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072800000594", "tran");
//情况三