fix(buildpackage): 修复 TOC 红字应收单推送逻辑
- 在推送 U8C之前增加对 childrenns 列表的空检查 - 避免在没有有效数据时进行不必要的推送操作 - 优化代码结构,提高代码的可读性和性能
This commit is contained in:
parent
d35a0f12b4
commit
82f0c73c49
|
@ -1218,6 +1218,7 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
|
||||||
// groupShipQty = new BigDecimal("0");
|
// groupShipQty = new BigDecimal("0");
|
||||||
if ((filterJfbbjeIncludingTax(pushScenarioType)) && groupShipQty.compareTo(BigDecimal.ZERO) == 0) {
|
if ((filterJfbbjeIncludingTax(pushScenarioType)) && groupShipQty.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
List<ArapDjzbVO.Childrenn> childrenns = filterZeroJfbbje(pushScenarioType);
|
List<ArapDjzbVO.Childrenn> childrenns = filterZeroJfbbje(pushScenarioType);
|
||||||
|
if (childrenns != null && childrenns.size() > 0) {
|
||||||
// 推送U8C
|
// 推送U8C
|
||||||
List<ArapDjzbVO> arapDjzbVOList = new ArrayList<>();
|
List<ArapDjzbVO> arapDjzbVOList = new ArrayList<>();
|
||||||
ArapDjzbVO arapDjzbVO = new ArapDjzbVO();
|
ArapDjzbVO arapDjzbVO = new ArapDjzbVO();
|
||||||
|
@ -1240,6 +1241,7 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
|
||||||
// 记录同步状态
|
// 记录同步状态
|
||||||
updateSuccessOrFail3(value, "Y", "success", djbh, vouchid, value.get(0).getStorageTimeStamp());
|
updateSuccessOrFail3(value, "Y", "success", djbh, vouchid, value.get(0).getStorageTimeStamp());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("TOC红字应收单转换成U8C对象过程中、或者单据推送到U8C出现异常!", e);
|
logger.error("TOC红字应收单转换成U8C对象过程中、或者单据推送到U8C出现异常!", e);
|
||||||
//记录失败
|
//记录失败
|
||||||
|
|
|
@ -344,6 +344,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
});
|
});
|
||||||
if (sceneType.equals("stock")) {
|
if (sceneType.equals("stock")) {
|
||||||
getSetStock(returnGoodHeaderDetailsDataDtoList, "2");
|
getSetStock(returnGoodHeaderDetailsDataDtoList, "2");
|
||||||
|
// getSetStock(returnGoodHeaderDetailsDataDtoList, "0");
|
||||||
} else if (sceneType.equals("tran")) {
|
} else if (sceneType.equals("tran")) {
|
||||||
getSetTran(returnGoodHeaderDetailsDataDtoList, "2");
|
getSetTran(returnGoodHeaderDetailsDataDtoList, "2");
|
||||||
}
|
}
|
||||||
|
@ -777,10 +778,11 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
|
|
||||||
//如果oldValue存在实入数量=0的明细行则过滤掉
|
//如果oldValue存在实入数量=0的明细行则过滤掉
|
||||||
//2025年5月6日10:12:21 和丽知闫旭、妮姐沟通,如果oldValue存在实入数量=0的明细行则过滤掉
|
//2025年5月6日10:12:21 和丽知闫旭、妮姐沟通,如果oldValue存在实入数量=0的明细行则过滤掉
|
||||||
filterReceivedQtyZero(oldValue);
|
//2025年8月24日14:03:45 和闫旭沟通,需要显示应收,优惠金额等,不咋此处过滤
|
||||||
if (oldValue == null || oldValue.size() == 0) {
|
// filterReceivedQtyZero(oldValue);
|
||||||
continue;
|
// if (oldValue == null || oldValue.size() == 0) {
|
||||||
}
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
StockinOrderSearchResponse.StockinOrder.StockinH header = oldValue.get(0).getHeader();
|
StockinOrderSearchResponse.StockinOrder.StockinH header = oldValue.get(0).getHeader();
|
||||||
BdCorpEntity bdCorpEntity = oldValue.get(0).getBdCorpEntity();//表头销售公司
|
BdCorpEntity bdCorpEntity = oldValue.get(0).getBdCorpEntity();//表头销售公司
|
||||||
|
@ -995,6 +997,9 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
// continue;
|
// 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)) {
|
if (ProfilesActiveConstant.PUSH_SCENE_TYPE_1.equals(pushScenarioType) || ProfilesActiveConstant.PUSH_SCENE_TYPE_2.equals(pushScenarioType)) {
|
||||||
//推送u8c生成红字销售订单
|
//推送u8c生成红字销售订单
|
||||||
List<SaleorderRequestDto> saleorderRequestDtoList = new ArrayList<>();
|
List<SaleorderRequestDto> saleorderRequestDtoList = new ArrayList<>();
|
||||||
|
@ -1022,6 +1027,9 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
} else {
|
} else {
|
||||||
Assert.state(false, "未知的场景类型 pushScenarioType={}", pushScenarioType);
|
Assert.state(false, "未知的场景类型 pushScenarioType={}", pushScenarioType);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
updateSuccessOrFail1(oldValue, "N", "不符合条件,不推U8C销售订单", null, null);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//记录失败
|
//记录失败
|
||||||
logger.error("TOC退货业务转换成U8C对象过程中、或者单据推送到U8C出现异常!", e);
|
logger.error("TOC退货业务转换成U8C对象过程中、或者单据推送到U8C出现异常!", e);
|
||||||
|
@ -1098,8 +1106,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
BdDefdocEntity platformArchives = oldValue.get(0).getPlatformArchives();//U8C平台档案
|
BdDefdocEntity platformArchives = oldValue.get(0).getPlatformArchives();//U8C平台档案
|
||||||
BdDefdocEntity shopArchives = oldValue.get(0).getShopArchives();//U8C店铺档案
|
BdDefdocEntity shopArchives = oldValue.get(0).getShopArchives();//U8C店铺档案
|
||||||
BdRdclEntity bdRdclEntity = oldValue.get(0).getBdRdclEntity();//U8C收发类别
|
BdRdclEntity bdRdclEntity = oldValue.get(0).getBdRdclEntity();//U8C收发类别
|
||||||
String newstate4 = oldValue.get(0).getNewstate4();
|
String newstate4 = oldValue.get(0).getNewstate4();//确认收入红
|
||||||
String def15 = oldValue.get(0).getDef15();
|
String def15 = oldValue.get(0).getDef15();//确认收入蓝
|
||||||
|
|
||||||
//验证是否为指定的店铺,如果为true,则取结存价
|
//验证是否为指定的店铺,如果为true,则取结存价
|
||||||
Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode());
|
Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode());
|
||||||
|
@ -1107,10 +1115,11 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose, sceneType);
|
GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose, sceneType);
|
||||||
Assert.notNull(goodsRertunSonDetailsDto, "合并明细行失败!");
|
Assert.notNull(goodsRertunSonDetailsDto, "合并明细行失败!");
|
||||||
BigDecimal groupShipQty = goodsRertunSonDetailsDto.getGroupShipQty();
|
BigDecimal groupShipQty = goodsRertunSonDetailsDto.getGroupShipQty();
|
||||||
BigDecimal groupTotalPayAmount = goodsRertunSonDetailsDto.getGroupTotalPayAmount();
|
|
||||||
|
|
||||||
//当金额>0,但数量为0时,推送红字应收单
|
//是否推送u8c红字销售订单
|
||||||
// if (groupTotalPayAmount != null && groupShipQty != null && groupTotalPayAmount.compareTo(BigDecimal.ZERO) > 0 && groupShipQty.compareTo(BigDecimal.ZERO) == 0) {
|
boolean isPushU8CSaleOrder = false;
|
||||||
|
|
||||||
|
//推送红字应收单
|
||||||
try {
|
try {
|
||||||
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlowV4();
|
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlowV4();
|
||||||
//生成业务日期
|
//生成业务日期
|
||||||
|
@ -1152,9 +1161,6 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
//如果合并后的金额为0,则不传到U8C
|
//如果合并后的金额为0,则不传到U8C
|
||||||
Assert.notNull(goodsRertunSonDetailsDto.getGroupTotalPayAmount(), "goodsRertunSonDetailsDto.getGroupTotalPayAmount()不能为空!");
|
Assert.notNull(goodsRertunSonDetailsDto.getGroupTotalPayAmount(), "goodsRertunSonDetailsDto.getGroupTotalPayAmount()不能为空!");
|
||||||
BigDecimal groupTotalPayAmount2 = goodsRertunSonDetailsDto.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP);
|
BigDecimal groupTotalPayAmount2 = goodsRertunSonDetailsDto.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
// if ("0".equals(groupTotalPayAmount2.stripTrailingZeros().toPlainString())) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
|
|
||||||
//修改为生成红字应收单表体
|
//修改为生成红字应收单表体
|
||||||
List<ArapDjzbVO.Childrenn> childrennArrayList = new ArrayList<>();
|
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) {
|
if ((filterJfbbjeIncludingTax(childrennArrayList)) && groupShipQty.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
List<ArapDjzbVO.Childrenn> childrenns = filterZeroJfbbje(childrennArrayList);
|
List<ArapDjzbVO.Childrenn> childrenns = filterZeroJfbbje(childrennArrayList);
|
||||||
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)) {
|
||||||
|
//如果出现情况二,但是生成的是红字应收单的情况下,只会有一个Y,不会有两个,过滤逻辑只会判断两个Y,需要在这里增加!"Y".equals(newstate4)判断
|
||||||
|
if (childrenns != null && childrenns.size() > 0 && !"A".equals(newstate4)) {
|
||||||
//推送U8C生成红字应收单
|
//推送U8C生成红字应收单
|
||||||
List<ArapDjzbVO> arapDjzbVOList = new ArrayList<>();
|
List<ArapDjzbVO> arapDjzbVOList = new ArrayList<>();
|
||||||
ArapDjzbVO arapDjzbVO = new ArapDjzbVO();
|
ArapDjzbVO arapDjzbVO = new ArapDjzbVO();
|
||||||
|
@ -1247,8 +1249,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
vouchid = arapDjzb.getParentvo().getVouchid();
|
vouchid = arapDjzb.getParentvo().getVouchid();
|
||||||
}
|
}
|
||||||
logger.info("TOC红字应收单:{} 销售订单主键:{} 销售公司:{} 公司:{}", djbh, vouchid, dwbm, bdCorpEntity.getUnitname());
|
logger.info("TOC红字应收单:{} 销售订单主键:{} 销售公司:{} 公司:{}", djbh, vouchid, dwbm, bdCorpEntity.getUnitname());
|
||||||
|
updateSuccessOrFail2(oldValue, "A", "success", djbh, vouchid, oldValue.get(0).getStorageTimeStamp());
|
||||||
updateSuccessOrFail2(oldValue, "Y", "success", djbh, vouchid, oldValue.get(0).getStorageTimeStamp());
|
}
|
||||||
} else if (ProfilesActiveConstant.PUSH_SCENE_TYPE_0.equals(pushScenarioType)) {
|
} else if (ProfilesActiveConstant.PUSH_SCENE_TYPE_0.equals(pushScenarioType)) {
|
||||||
//不推送U8C,单据暂存
|
//不推送U8C,单据暂存
|
||||||
String vreceiptcode = "暂存";
|
String vreceiptcode = "暂存";
|
||||||
|
@ -1259,6 +1261,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
} else {
|
} else {
|
||||||
Assert.state(false, "未知的场景类型 pushScenarioType={}", pushScenarioType);
|
Assert.state(false, "未知的场景类型 pushScenarioType={}", pushScenarioType);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
isPushU8CSaleOrder = true;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("TOC退货业务转换成U8C对象过程中、或者单据推送到U8C出现异常!", 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());
|
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 {
|
try {
|
||||||
// checkArchives(oldValue.get(0));
|
|
||||||
//生成业务日期
|
//生成业务日期
|
||||||
String generateBusinessDate = createSuccessFulTradeDate(header);
|
String generateBusinessDate = createSuccessFulTradeDate(header);
|
||||||
|
|
||||||
|
@ -1320,26 +1322,6 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
saleorderRequestParentDto.setVdef8(OverallConstant.getOverAllValue("售后类型标识-TOC售后-名称"));
|
saleorderRequestParentDto.setVdef8(OverallConstant.getOverAllValue("售后类型标识-TOC售后-名称"));
|
||||||
|
|
||||||
saleorderRequestDto.setParentvo(saleorderRequestParentDto);
|
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<>();
|
List<SaleorderRequestChildrenDto> saleorderRequestChildrenDtoList = new ArrayList<>();
|
||||||
saleorderRequestDto.setChildrenvo(saleorderRequestChildrenDtoList);
|
saleorderRequestDto.setChildrenvo(saleorderRequestChildrenDtoList);
|
||||||
|
@ -1350,32 +1332,6 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
BdInvbasdocEntity bdInvbasdocEntity = oldValue.get(0).getBdInvbasdocEntity();
|
BdInvbasdocEntity bdInvbasdocEntity = oldValue.get(0).getBdInvbasdocEntity();
|
||||||
//根据存货基础档案编码,查询当前存货的税率
|
//根据存货基础档案编码,查询当前存货的税率
|
||||||
BdTaxitemsEntity bdTaxitemsEntity1 = oldValue.get(0).getBdTaxitemsEntity();
|
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;
|
Boolean isblargessflag = false;
|
||||||
|
@ -1431,25 +1387,6 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
}
|
}
|
||||||
saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto);
|
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 absAccumulatedPostage = vdef4.abs();
|
||||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||||
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
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 absAccumulatedPostage = vdef6.abs();
|
||||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||||
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
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 absAccumulatedPostage = vdef5.abs();
|
||||||
BigDecimal negativeValue = absAccumulatedPostage.negate();// 符号取反(转为负数)
|
BigDecimal negativeValue = absAccumulatedPostage.negate();// 符号取反(转为负数)
|
||||||
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
||||||
// queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//存货数量>0生成红字销售订单
|
//存货数量>0生成红字销售订单
|
||||||
if (groupShipQty.compareTo(BigDecimal.ZERO) > 0) {
|
// if (groupShipQty.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
//2025年8月25日10:42:30 不在此处验证,否则影响红字应收单推送
|
||||||
//判断入库时间(关单时间)与交易成功时间,推送u8c生成蓝字销售订单,仅满足情况二的条件才生成这张蓝字销售订单
|
//判断入库时间(关单时间)与交易成功时间,推送u8c生成蓝字销售订单,仅满足情况二的条件才生成这张蓝字销售订单
|
||||||
|
//2025年8月25日10:59:26 把实入数量=0的明细行去掉
|
||||||
|
checkSaleOrderNnumber(saleorderRequestChildrenDtoList);
|
||||||
|
|
||||||
boolean oneSuccess = false;
|
boolean oneSuccess = false;
|
||||||
if (!"Y".equals(newstate4)) {
|
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捕获,代码不会往下执行
|
//推送U8C红字销售订单,如果推送失败,抛出异常,那么就会外围的try catch捕获,代码不会往下执行
|
||||||
List<SaleorderRequestDto> saleorderRequestDtoList = new ArrayList<>();
|
List<SaleorderRequestDto> saleorderRequestDtoList = new ArrayList<>();
|
||||||
saleorderRequestDtoList.add(saleorderRequestDto);
|
saleorderRequestDtoList.add(saleorderRequestDto);
|
||||||
|
@ -1527,27 +1465,6 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
logger.info("TOC红字销售订单编号:{} 销售订单主键:{} 销售公司:{} 公司:{}", vreceiptcode, csaleid, pk_corp, bdCorpEntity.getUnitname());
|
logger.info("TOC红字销售订单编号:{} 销售订单主键:{} 销售公司:{} 公司:{}", vreceiptcode, csaleid, pk_corp, bdCorpEntity.getUnitname());
|
||||||
updateSuccessOrFail2(oldValue, "Y", "success", vreceiptcode, csaleid, oldValue.get(0).getStorageTimeStamp());
|
updateSuccessOrFail2(oldValue, "Y", "success", vreceiptcode, csaleid, oldValue.get(0).getStorageTimeStamp());
|
||||||
oneSuccess = true;
|
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)) {
|
} else if (ProfilesActiveConstant.PUSH_SCENE_TYPE_0.equals(pushScenarioType)) {
|
||||||
//不推送U8C,单据暂存
|
//不推送U8C,单据暂存
|
||||||
String vreceiptcode = "暂存";
|
String vreceiptcode = "暂存";
|
||||||
|
@ -1557,15 +1474,16 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
updateSuccessOrFail2(oldValue, newstate, newTransmitInfo, vreceiptcode, csaleid, oldValue.get(0).getStorageTimeStamp());
|
updateSuccessOrFail2(oldValue, newstate, newTransmitInfo, vreceiptcode, csaleid, oldValue.get(0).getStorageTimeStamp());
|
||||||
oneSuccess = true;
|
oneSuccess = true;
|
||||||
} else {
|
} else {
|
||||||
Assert.state(false, "未知的场景类型 pushScenarioType={}", pushScenarioType);
|
updateSuccessOrFail2(oldValue, "N", "不符合条件,不推U8C红字销售订单", null, null, oldValue.get(0).getStorageTimeStamp());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
oneSuccess = true;
|
oneSuccess = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
//2025年8月25日10:41:37 如果实入数量全部0,蓝字销售订单则不推送,存在部分数量为0,则过滤
|
||||||
if (!"Y".equals(def15) && oneSuccess && "2".equals(oldValue.get(0).getStorageTimeStamp())) {
|
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())) {
|
if ("2".equals(oldValue.get(0).getStorageTimeStamp())) {
|
||||||
SaleorderRequestDto saleorderRequestDto1 = transformRedSalesOrderToBlueSalesOrder(saleorderRequestDto, bdBusitypeEntity2);
|
SaleorderRequestDto saleorderRequestDto1 = transformRedSalesOrderToBlueSalesOrder(saleorderRequestDto, bdBusitypeEntity2);
|
||||||
|
|
||||||
|
@ -1595,7 +1513,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
String newTransmitInfo = "暂存";
|
String newTransmitInfo = "暂存";
|
||||||
updateSuccessOrFail3(oldValue, newstate, newTransmitInfo, vreceiptcode, csaleid, oldValue.get(0).getStorageTimeStamp());
|
updateSuccessOrFail3(oldValue, newstate, newTransmitInfo, vreceiptcode, csaleid, oldValue.get(0).getStorageTimeStamp());
|
||||||
} else {
|
} else {
|
||||||
Assert.state(false, "未知的场景类型 pushScenarioType={}", pushScenarioType);
|
updateSuccessOrFail3(oldValue, "N", "不符合条件,不推U8C蓝字销售订单", null, null, oldValue.get(0).getStorageTimeStamp());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1607,7 +1525,6 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
}
|
}
|
||||||
updateSuccessOrFail3(oldValue, "N", message, null, null, oldValue.get(0).getStorageTimeStamp());
|
updateSuccessOrFail3(oldValue, "N", message, null, null, oldValue.get(0).getStorageTimeStamp());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//记录红字销售订单异常失败
|
//记录红字销售订单异常失败
|
||||||
logger.error("TOC退货业务转换成U8C对象过程中、或者单据推送到U8C出现异常!", 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());
|
updateSuccessOrFail2(oldValue, "N", message, null, null, oldValue.get(0).getStorageTimeStamp());
|
||||||
}
|
}
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//2024年8月6日 11:28:54此处不记录失败,不认为是错误
|
//2024年8月6日 11:28:54此处不记录失败,不认为是错误
|
||||||
|
@ -3053,6 +2970,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
String successY = "Y";
|
String successY = "Y";
|
||||||
|
String successA = "A";
|
||||||
if (sonDetailsDtoList != null && sonDetailsDtoList.size() > 0) {
|
if (sonDetailsDtoList != null && sonDetailsDtoList.size() > 0) {
|
||||||
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityArrayList = new ArrayList<>();
|
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntityArrayList = new ArrayList<>();
|
||||||
for (int i = 0; i < sonDetailsDtoList.size(); i++) {
|
for (int i = 0; i < sonDetailsDtoList.size(); i++) {
|
||||||
|
@ -3077,7 +2995,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
tocofsReturngoodsDetailedEntity.setDef10(goodsRertunSonDetailsDto.getPayDiscounts());
|
tocofsReturngoodsDetailedEntity.setDef10(goodsRertunSonDetailsDto.getPayDiscounts());
|
||||||
tocofsReturngoodsDetailedEntity.setDef11(goodsRertunSonDetailsDto.getExpertDiscounts());
|
tocofsReturngoodsDetailedEntity.setDef11(goodsRertunSonDetailsDto.getExpertDiscounts());
|
||||||
tocofsReturngoodsDetailedEntity.setDef12(goodsRertunSonDetailsDto.getMerchantDiscounts());
|
tocofsReturngoodsDetailedEntity.setDef12(goodsRertunSonDetailsDto.getMerchantDiscounts());
|
||||||
if (successY.equals(newstate)) {
|
if (successY.equals(newstate) || successA.equals(newstate)) {
|
||||||
tocofsReturngoodsDetailedEntity.setNewsystemnumber4(newsystemnumber);
|
tocofsReturngoodsDetailedEntity.setNewsystemnumber4(newsystemnumber);
|
||||||
tocofsReturngoodsDetailedEntity.setNewsystemprimary4(newsystemprimary);
|
tocofsReturngoodsDetailedEntity.setNewsystemprimary4(newsystemprimary);
|
||||||
}
|
}
|
||||||
|
@ -3298,9 +3216,12 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//这里不可能是1,退款业务只可能是2、3
|
//这里不可能是1,退款业务只可能是2、3
|
||||||
if ("2".equals(stockinB.getStorageTimeStamp())) {
|
|
||||||
//如果是2同时判断两个状态为Y,则过滤
|
|
||||||
newstate = no2NameMap2.get(stockinB.getId());
|
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());
|
newstate2 = no2NameMap3.get(stockinB.getId());
|
||||||
if (newstate != null && !"".equals(newstate) && (succeseeY.equals(newstate) || succeseeH.equals(newstate))) {
|
if (newstate != null && !"".equals(newstate) && (succeseeY.equals(newstate) || succeseeH.equals(newstate))) {
|
||||||
if (newstate2 != null && !"".equals(newstate2) && (succeseeY.equals(newstate2) || succeseeH.equals(newstate2))) {
|
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())) {
|
} else if ("3".equals(stockinB.getStorageTimeStamp())) {
|
||||||
//如果是3仅判断一个状态为Y
|
//如果是3仅判断一个状态为Y
|
||||||
newstate = no2NameMap2.get(stockinB.getId());
|
|
||||||
if (newstate != null && !"".equals(newstate) && (succeseeY.equals(newstate) || succeseeH.equals(newstate))) {
|
if (newstate != null && !"".equals(newstate) && (succeseeY.equals(newstate) || succeseeH.equals(newstate))) {
|
||||||
isSuccess = true;
|
isSuccess = true;
|
||||||
}
|
}
|
||||||
|
@ -4168,6 +4088,9 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
|
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
|
||||||
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails();
|
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails();
|
||||||
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto = header.getHeaderDetailsDto();
|
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();
|
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header1 = headerDetailsDto.getHeader();
|
||||||
|
|
||||||
String closedAt = header.getClosedAt();
|
String closedAt = header.getClosedAt();
|
||||||
|
@ -4379,4 +4302,29 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
return new BigDecimal(jfbbje).compareTo(BigDecimal.ZERO) != 0;
|
return new BigDecimal(jfbbje).compareTo(BigDecimal.ZERO) != 0;
|
||||||
}).collect(Collectors.toList());
|
}).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;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -74,7 +74,7 @@ public class SoSaleReturnPluginInitializerToCTest {
|
||||||
//满足红字应收单
|
//满足红字应收单
|
||||||
// soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072200001324", "tran");
|
// soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072200001324", "tran");
|
||||||
//情况一
|
//情况一
|
||||||
soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072900000460", "stock");
|
soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072200000255", "tran");
|
||||||
//情况二
|
//情况二
|
||||||
// soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072800000594", "tran");
|
// soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072800000594", "tran");
|
||||||
//情况三
|
//情况三
|
||||||
|
|
Loading…
Reference in New Issue