fix: 修改文件名大小写
This commit is contained in:
parent
40e7383554
commit
c2b10a8c40
|
@ -971,9 +971,9 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
|
|||
}
|
||||
|
||||
//合并后如果数量为0,则过滤掉
|
||||
if ("0".equals(passiveStorageSonDetailsDto.getGroupShipQty().stripTrailingZeros().toPlainString())) {
|
||||
continue;
|
||||
}
|
||||
// if ("0".equals(passiveStorageSonDetailsDto.getGroupShipQty().stripTrailingZeros().toPlainString())) {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
//推送u8c
|
||||
List<SaleorderRequestDto> saleorderRequestDtoList = new ArrayList<>();
|
||||
|
@ -1080,136 +1080,149 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
|
|||
BigDecimal groupShipQty = passiveStorageSonDetailsDto2.getGroupShipQty();
|
||||
|
||||
//当金额>0,但数量为0时,推送红字应收单
|
||||
if (groupTotalPayAmount1 != null && groupShipQty != null && groupTotalPayAmount1.compareTo(BigDecimal.ZERO) > 0 && groupShipQty.compareTo(BigDecimal.ZERO) == 0) {
|
||||
try {
|
||||
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlowV4();
|
||||
// if (groupTotalPayAmount1 != null && groupShipQty != null && groupTotalPayAmount1.compareTo(BigDecimal.ZERO) > 0 && groupShipQty.compareTo(BigDecimal.ZERO) == 0) {
|
||||
try {
|
||||
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlowV4();
|
||||
// 生成业务日期
|
||||
String generateBusinessDate = value.get(0).getTargetBusinessDate().substring(0, 10);
|
||||
String generateBusinessDate = value.get(0).getTargetBusinessDate().substring(0, 10);
|
||||
|
||||
// 组装应收单表头
|
||||
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());
|
||||
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.setDef1(shopArchives.getDocname());
|
||||
//来源平台
|
||||
parentVo.setZyx2(platformArchives.getDoccode());
|
||||
//来源平台
|
||||
parentVo.setZyx2(platformArchives.getDoccode());
|
||||
// parentVo.setDef2(platformArchives.getDocname());
|
||||
//收发类别
|
||||
parentVo.setZyx3(bdRdclEntity.getRdcode());
|
||||
//收发类别
|
||||
parentVo.setZyx3(bdRdclEntity.getRdcode());
|
||||
// parentVo.setDef3(bdRdclEntity.getRdname());
|
||||
|
||||
parentVo.setZyx8(OverallConstant.getOverAllValue("售后类型标识-TOC无源件-编码"));
|
||||
//单据红字标识
|
||||
parentVo.setZyx16("1");
|
||||
parentVo.setZyx8(OverallConstant.getOverAllValue("售后类型标识-TOC无源件-编码"));
|
||||
//单据红字标识
|
||||
parentVo.setZyx16("1");
|
||||
// parentVo.setDef16(OverallConstant.getOverAllValue("u8c自定义项档案-单据红字标识-Y名称"));
|
||||
// parentVo.setZyx19();//自定义项19 OFS单号不传,因为是汇总的
|
||||
parentVo.setZyx17(ProfilesActiveConstant.sourceSystem1);//来源系统
|
||||
parentVo.setZyx18(key);
|
||||
parentVo.setZyx17(ProfilesActiveConstant.sourceSystem1);//来源系统
|
||||
parentVo.setZyx18(key);
|
||||
|
||||
// 存货管理档案:取发货公司的存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity = value.get(0).getBdInvmandocEntity();
|
||||
BdInvmandocEntity bdInvmandocEntity = value.get(0).getBdInvmandocEntity();
|
||||
// 存货基础档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity = value.get(0).getBdInvbasdocEntity();
|
||||
BdInvbasdocEntity bdInvbasdocEntity = value.get(0).getBdInvbasdocEntity();
|
||||
// 根据存货基础档案编码,查询当前存货的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity1 = value.get(0).getBdTaxitemsEntity();
|
||||
BdTaxitemsEntity bdTaxitemsEntity1 = value.get(0).getBdTaxitemsEntity();
|
||||
|
||||
// 如果合并后的金额为0,则不传到U8C
|
||||
Assert.notNull(passiveStorageSonDetailsDto2.getGroupTotalPayAmount(), "passiveStorageSonDetailsDto.getGroupTotalPayAmount()不能为空!");
|
||||
BigDecimal groupTotalPayAmount = passiveStorageSonDetailsDto2.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
if ("0".equals(groupTotalPayAmount.stripTrailingZeros().toPlainString())) {
|
||||
continue;
|
||||
}
|
||||
Assert.notNull(passiveStorageSonDetailsDto2.getGroupTotalPayAmount(), "passiveStorageSonDetailsDto.getGroupTotalPayAmount()不能为空!");
|
||||
BigDecimal groupTotalPayAmount = passiveStorageSonDetailsDto2.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
// if ("0".equals(groupTotalPayAmount.stripTrailingZeros().toPlainString())) {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
String tax = null;//税率
|
||||
BigDecimal noriginalcurmny = null;//无税金额
|
||||
BigDecimal noriginalcurtaxmny = null;//税额
|
||||
try {
|
||||
tax = new BigDecimal(bdTaxitemsEntity1.getTaxratio()).divide(new BigDecimal(100), 20, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString();
|
||||
noriginalcurmny = groupTotalPayAmount.divide(new BigDecimal(1).add(new BigDecimal(tax)), 20, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
noriginalcurtaxmny = groupTotalPayAmount.subtract(noriginalcurmny).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
} catch (Exception e) {
|
||||
logger.error("金额计算失败", e);
|
||||
Assert.state(false, "金额计算失败 跑出异常:{}", e.getMessage());
|
||||
}
|
||||
String tax = null;//税率
|
||||
BigDecimal noriginalcurmny = null;//无税金额
|
||||
BigDecimal noriginalcurtaxmny = null;//税额
|
||||
try {
|
||||
tax = new BigDecimal(bdTaxitemsEntity1.getTaxratio()).divide(new BigDecimal(100), 20, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString();
|
||||
noriginalcurmny = groupTotalPayAmount.divide(new BigDecimal(1).add(new BigDecimal(tax)), 20, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
noriginalcurtaxmny = groupTotalPayAmount.subtract(noriginalcurmny).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
} catch (Exception e) {
|
||||
logger.error("金额计算失败", e);
|
||||
Assert.state(false, "金额计算失败 跑出异常:{}", e.getMessage());
|
||||
}
|
||||
|
||||
// 组装应收单表体
|
||||
List<ArapDjzbVO.Childrenn> pushScenarioType = new ArrayList<>();
|
||||
ArapDjzbVO.Childrenn arapDjzbVOChildrenn = new ArapDjzbVO.Childrenn();
|
||||
pushScenarioType.add(arapDjzbVOChildrenn);
|
||||
arapDjzbVOChildrenn.setCinventoryid(bdInvbasdocEntity.getInvcode());//存货管理档案
|
||||
List<ArapDjzbVO.Childrenn> pushScenarioType = new ArrayList<>();
|
||||
ArapDjzbVO.Childrenn arapDjzbVOChildrenn = new ArapDjzbVO.Childrenn();
|
||||
pushScenarioType.add(arapDjzbVOChildrenn);
|
||||
arapDjzbVOChildrenn.setCinventoryid(bdInvbasdocEntity.getInvcode());//存货管理档案
|
||||
if (groupTotalPayAmount.compareTo(BigDecimal.ZERO) == 0) {
|
||||
arapDjzbVOChildrenn.setJfbbje("0");//借方本币金额
|
||||
arapDjzbVOChildrenn.setJfybje("0");//借方原币金额
|
||||
} else {
|
||||
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());//借方原币无税金额
|
||||
}
|
||||
// arapDjzbVOChildrenn.setJfbbsj("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//借方本币税金
|
||||
// arapDjzbVOChildrenn.setJfybsj("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//借方原币税金
|
||||
// arapDjzbVOChildrenn.setWbfbbje("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//借方本币无税金额
|
||||
// arapDjzbVOChildrenn.setJfybwsje("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//借方原币无税金额
|
||||
|
||||
//退货没有邮费金额,已经向万万确认
|
||||
//平台优惠
|
||||
if (passiveStorageSonDetailsDto2.getVdef4() != null) {
|
||||
BigDecimal vdef4 = passiveStorageSonDetailsDto2.getVdef4();
|
||||
if (vdef4.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY01");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY01");
|
||||
//补充:平台优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef4.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||
queryAdditionUtil.additionalV2(pushScenarioType, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||
}
|
||||
//退货没有邮费金额,已经向万万确认
|
||||
//平台优惠
|
||||
if (passiveStorageSonDetailsDto2.getVdef4() != null) {
|
||||
BigDecimal vdef4 = passiveStorageSonDetailsDto2.getVdef4();
|
||||
if (vdef4.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY01");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY01");
|
||||
//补充:平台优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef4.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||
queryAdditionUtil.additionalV2(pushScenarioType, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||
}
|
||||
//达人优惠
|
||||
if (passiveStorageSonDetailsDto2.getVdef6() != null) {
|
||||
BigDecimal vdef6 = passiveStorageSonDetailsDto2.getVdef6();
|
||||
if (vdef6.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY02");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY02");
|
||||
//补充:达人优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef6.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||
queryAdditionUtil.additionalV2(pushScenarioType, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||
}
|
||||
}
|
||||
//达人优惠
|
||||
if (passiveStorageSonDetailsDto2.getVdef6() != null) {
|
||||
BigDecimal vdef6 = passiveStorageSonDetailsDto2.getVdef6();
|
||||
if (vdef6.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY02");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY02");
|
||||
//补充:达人优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef6.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||
queryAdditionUtil.additionalV2(pushScenarioType, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||
}
|
||||
}
|
||||
// 支付优惠
|
||||
if (passiveStorageSonDetailsDto2.getVdef5() != null) {
|
||||
BigDecimal vdef5 = passiveStorageSonDetailsDto2.getVdef5();
|
||||
if (vdef5.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY04");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY04");
|
||||
//补充:支付优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef5.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||
queryAdditionUtil.additionalV2(pushScenarioType, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||
}
|
||||
if (passiveStorageSonDetailsDto2.getVdef5() != null) {
|
||||
BigDecimal vdef5 = passiveStorageSonDetailsDto2.getVdef5();
|
||||
if (vdef5.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY04");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY04");
|
||||
//补充:支付优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef5.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||
queryAdditionUtil.additionalV2(pushScenarioType, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||
}
|
||||
}
|
||||
|
||||
// 推送U8C
|
||||
//如果实推总金额>0、单数量等于0
|
||||
// for (int i = 0; i < pushScenarioType.size(); i++) {
|
||||
// ArapDjzbVO.Childrenn childrenn = pushScenarioType.get(i);
|
||||
// childrenn.setJfbbje("1");
|
||||
// }
|
||||
// groupShipQty = new BigDecimal("0");
|
||||
if ((filterJfbbjeIncludingTax(pushScenarioType)) && groupShipQty.compareTo(BigDecimal.ZERO) == 0) {
|
||||
List<ArapDjzbVO.Childrenn> childrenns = filterZeroJfbbje(pushScenarioType);
|
||||
// 推送U8C
|
||||
List<ArapDjzbVO> arapDjzbVOList = new ArrayList<>();
|
||||
ArapDjzbVO arapDjzbVO = new ArapDjzbVO();
|
||||
arapDjzbVO.setParentvo(parentVo);
|
||||
arapDjzbVO.setChildren(pushScenarioType);
|
||||
arapDjzbVO.setChildren(childrenns);
|
||||
arapDjzbVOList.add(arapDjzbVO);
|
||||
|
||||
Map<String, List<ArapDjzbVO>> listMap = new HashMap<>();
|
||||
|
@ -1226,80 +1239,81 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
|
|||
logger.info("TOC红字应收单:{} 应收单主键:{} 销售公司:{}", djbh, vouchid, dwbm);
|
||||
// 记录同步状态
|
||||
updateSuccessOrFail3(value, "Y", "success", djbh, vouchid, value.get(0).getStorageTimeStamp());
|
||||
} catch (Exception e) {
|
||||
logger.error("TOC红字应收单转换成U8C对象过程中、或者单据推送到U8C出现异常!", e);
|
||||
//记录失败
|
||||
String message = e.getMessage();
|
||||
if (message == null) {
|
||||
message = "未知错误";
|
||||
}
|
||||
updateSuccessOrFail3(value, "N", message, null, null, value.get(0).getStorageTimeStamp());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("TOC红字应收单转换成U8C对象过程中、或者单据推送到U8C出现异常!", e);
|
||||
//记录失败
|
||||
String message = e.getMessage();
|
||||
if (message == null) {
|
||||
message = "未知错误";
|
||||
}
|
||||
updateSuccessOrFail3(value, "N", message, null, null, value.get(0).getStorageTimeStamp());
|
||||
}
|
||||
// }
|
||||
|
||||
//当金额大于或者等于0,数量大于0推送销售订单
|
||||
if (groupTotalPayAmount1 != null && groupShipQty != null && groupTotalPayAmount1.compareTo(BigDecimal.ZERO) >= 0 && groupShipQty.compareTo(BigDecimal.ZERO) > 0) {
|
||||
try {
|
||||
String generateBusinessDate = value.get(0).getTargetBusinessDate().substring(0, 10);
|
||||
// if (groupTotalPayAmount1 != null && groupShipQty != null && groupTotalPayAmount1.compareTo(BigDecimal.ZERO) >= 0 && groupShipQty.compareTo(BigDecimal.ZERO) > 0) {
|
||||
try {
|
||||
String generateBusinessDate = value.get(0).getTargetBusinessDate().substring(0, 10);
|
||||
|
||||
SaleorderRequestDto saleorderRequestDto = new SaleorderRequestDto();
|
||||
SaleorderRequestParentDto saleorderRequestParentDto = new SaleorderRequestParentDto();
|
||||
saleorderRequestParentDto.setDbilldate(generateBusinessDate);//单据日期
|
||||
saleorderRequestParentDto.setBretinvflag("Y");//退货标记
|
||||
saleorderRequestParentDto.setCbiztype(bdBusitypeEntity1.getPkBusitype());//业务流程
|
||||
saleorderRequestParentDto.setCcalbodyid(bdCalbodyEntity.getPkCalbody());//库存组织
|
||||
saleorderRequestParentDto.setCcustomerid(bdCumandocEntity.getPkCumandoc());//客户=开票单位=收货单位=表体收货单位=收货单位
|
||||
saleorderRequestParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//部门
|
||||
saleorderRequestParentDto.setCemployeeid(null);//业务员
|
||||
saleorderRequestParentDto.setCoperatorid(OverallConstant.getOverAllValue("u8cApiZdrPK"));//制单人
|
||||
saleorderRequestParentDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//开票单位
|
||||
saleorderRequestParentDto.setCreceiptcustomerid(bdCumandocEntity.getPkCumandoc());//收货单位
|
||||
saleorderRequestParentDto.setCsalecorpid(bdSalestruEntity.getCsalestruid());//销售组织
|
||||
saleorderRequestParentDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//仓库
|
||||
saleorderRequestParentDto.setDapprovedate(generateBusinessDate);//审核日期
|
||||
saleorderRequestParentDto.setNdiscountrate("100.000000");//整单折扣
|
||||
saleorderRequestParentDto.setPk_corp(bdCorpEntity.getPkCorp());//公司id
|
||||
//汇总单号=汇总维度
|
||||
saleorderRequestParentDto.setVdef18(key);
|
||||
//平台
|
||||
saleorderRequestParentDto.setPk_defdoc2(platformArchives.getPkDefdoc());
|
||||
saleorderRequestParentDto.setVdef2(platformArchives.getDocname());
|
||||
saleorderRequestParentDto.setVdef17(ProfilesActiveConstant.sourceSystem1);//来源系统
|
||||
SaleorderRequestDto saleorderRequestDto = new SaleorderRequestDto();
|
||||
SaleorderRequestParentDto saleorderRequestParentDto = new SaleorderRequestParentDto();
|
||||
saleorderRequestParentDto.setDbilldate(generateBusinessDate);//单据日期
|
||||
saleorderRequestParentDto.setBretinvflag("Y");//退货标记
|
||||
saleorderRequestParentDto.setCbiztype(bdBusitypeEntity1.getPkBusitype());//业务流程
|
||||
saleorderRequestParentDto.setCcalbodyid(bdCalbodyEntity.getPkCalbody());//库存组织
|
||||
saleorderRequestParentDto.setCcustomerid(bdCumandocEntity.getPkCumandoc());//客户=开票单位=收货单位=表体收货单位=收货单位
|
||||
saleorderRequestParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//部门
|
||||
saleorderRequestParentDto.setCemployeeid(null);//业务员
|
||||
saleorderRequestParentDto.setCoperatorid(OverallConstant.getOverAllValue("u8cApiZdrPK"));//制单人
|
||||
saleorderRequestParentDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//开票单位
|
||||
saleorderRequestParentDto.setCreceiptcustomerid(bdCumandocEntity.getPkCumandoc());//收货单位
|
||||
saleorderRequestParentDto.setCsalecorpid(bdSalestruEntity.getCsalestruid());//销售组织
|
||||
saleorderRequestParentDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//仓库
|
||||
saleorderRequestParentDto.setDapprovedate(generateBusinessDate);//审核日期
|
||||
saleorderRequestParentDto.setNdiscountrate("100.000000");//整单折扣
|
||||
saleorderRequestParentDto.setPk_corp(bdCorpEntity.getPkCorp());//公司id
|
||||
//汇总单号=汇总维度
|
||||
saleorderRequestParentDto.setVdef18(key);
|
||||
//平台
|
||||
saleorderRequestParentDto.setPk_defdoc2(platformArchives.getPkDefdoc());
|
||||
saleorderRequestParentDto.setVdef2(platformArchives.getDocname());
|
||||
saleorderRequestParentDto.setVdef17(ProfilesActiveConstant.sourceSystem1);//来源系统
|
||||
|
||||
//收发类别
|
||||
saleorderRequestParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl());
|
||||
saleorderRequestParentDto.setVdef3(bdRdclEntity.getRdname());
|
||||
//收发类别
|
||||
saleorderRequestParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl());
|
||||
saleorderRequestParentDto.setVdef3(bdRdclEntity.getRdname());
|
||||
|
||||
//2024年8月8日 17:17:58 店铺档案自定义项1,先不传,后续维护好之后再传!
|
||||
//店铺
|
||||
saleorderRequestParentDto.setPk_defdoc1(shopArchives.getPkDefdoc());
|
||||
saleorderRequestParentDto.setVdef1(shopArchives.getDocname());
|
||||
//2024年8月8日 17:17:58 店铺档案自定义项1,先不传,后续维护好之后再传!
|
||||
//店铺
|
||||
saleorderRequestParentDto.setPk_defdoc1(shopArchives.getPkDefdoc());
|
||||
saleorderRequestParentDto.setVdef1(shopArchives.getDocname());
|
||||
|
||||
//单据红字标识
|
||||
saleorderRequestParentDto.setPk_defdoc16(OverallConstant.getOverAllValue("u8c自定义项档案-单据红字标识-Y主键"));
|
||||
saleorderRequestParentDto.setVdef16(OverallConstant.getOverAllValue("u8c自定义项档案-单据红字标识-Y名称"));
|
||||
//单据红字标识
|
||||
saleorderRequestParentDto.setPk_defdoc16(OverallConstant.getOverAllValue("u8c自定义项档案-单据红字标识-Y主键"));
|
||||
saleorderRequestParentDto.setVdef16(OverallConstant.getOverAllValue("u8c自定义项档案-单据红字标识-Y名称"));
|
||||
|
||||
//售后类型标识
|
||||
saleorderRequestParentDto.setPk_defdoc8(OverallConstant.getOverAllValue("售后类型标识-TOC无源件-主键"));
|
||||
saleorderRequestParentDto.setVdef8(OverallConstant.getOverAllValue("售后类型标识-TOC无源件-名称"));
|
||||
//售后类型标识
|
||||
saleorderRequestParentDto.setPk_defdoc8(OverallConstant.getOverAllValue("售后类型标识-TOC无源件-主键"));
|
||||
saleorderRequestParentDto.setVdef8(OverallConstant.getOverAllValue("售后类型标识-TOC无源件-名称"));
|
||||
|
||||
saleorderRequestDto.setParentvo(saleorderRequestParentDto);
|
||||
saleorderRequestDto.setParentvo(saleorderRequestParentDto);
|
||||
|
||||
List<SaleorderRequestChildrenDto> saleorderRequestChildrenDtoList = new ArrayList<>();
|
||||
saleorderRequestDto.setChildrenvo(saleorderRequestChildrenDtoList);
|
||||
List<SaleorderRequestChildrenDto> saleorderRequestChildrenDtoList = new ArrayList<>();
|
||||
saleorderRequestDto.setChildrenvo(saleorderRequestChildrenDtoList);
|
||||
|
||||
//验证是否为指定的店铺,如果为true,则取结存价
|
||||
//验证是否为指定的店铺,如果为true,则取结存价
|
||||
// Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode());
|
||||
//把汇总好的出库单明细行合并成一行
|
||||
//把汇总好的出库单明细行合并成一行
|
||||
// PassiveStorageSonDetailsDto2 passiveStorageSonDetailsDto2 = groupMergeDetailedRows2(value, isCheckShopChoose);
|
||||
|
||||
//存货管理档案:取发货公司的存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity = value.get(0).getBdInvmandocEntity();
|
||||
//存货基础档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity = value.get(0).getBdInvbasdocEntity();
|
||||
//根据存货基础档案编码,查询当前存货的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity1 = value.get(0).getBdTaxitemsEntity();
|
||||
//查询收支项目
|
||||
//存货管理档案:取发货公司的存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity = value.get(0).getBdInvmandocEntity();
|
||||
//存货基础档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity = value.get(0).getBdInvbasdocEntity();
|
||||
//根据存货基础档案编码,查询当前存货的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity1 = value.get(0).getBdTaxitemsEntity();
|
||||
//查询收支项目
|
||||
// BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity);
|
||||
// BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity);
|
||||
|
||||
|
@ -1322,125 +1336,127 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
|
|||
// }
|
||||
|
||||
// 判断是否为赠品
|
||||
Boolean isblargessflag = false;
|
||||
if ("0".equals(passiveStorageSonDetailsDto2.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString())) {
|
||||
isblargessflag = true;
|
||||
}
|
||||
Boolean isblargessflag = false;
|
||||
if ("0".equals(passiveStorageSonDetailsDto2.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString())) {
|
||||
isblargessflag = true;
|
||||
}
|
||||
|
||||
//合并后如果数量为0,则过滤掉
|
||||
if ("0".equals(passiveStorageSonDetailsDto2.getGroupShipQty().stripTrailingZeros().toPlainString())) {
|
||||
continue;
|
||||
}
|
||||
//合并后如果数量为0,则过滤掉
|
||||
// if ("0".equals(passiveStorageSonDetailsDto2.getGroupShipQty().stripTrailingZeros().toPlainString())) {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
SaleorderRequestChildrenDto saleorderRequestChildrenDto = new SaleorderRequestChildrenDto();
|
||||
saleorderRequestChildrenDto.setBlargessflag(isblargessflag);//是否赠品
|
||||
saleorderRequestChildrenDto.setCadvisecalbodyid(bdCalbodyEntity.getPkCalbody());//发货库存组织
|
||||
saleorderRequestChildrenDto.setCbodywarehouseid(bdStordocEntity.getPkStordoc());//发货仓库
|
||||
saleorderRequestChildrenDto.setCconsigncorpid(deliverGoodsCorp.getPkCorp());//发货公司
|
||||
saleorderRequestChildrenDto.setCcurrencytypeid("00010000000000000001");//币种
|
||||
saleorderRequestChildrenDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());//存货id
|
||||
saleorderRequestChildrenDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//收货单位
|
||||
saleorderRequestChildrenDto.setDconsigndate(generateBusinessDate);//计划发货日期
|
||||
saleorderRequestChildrenDto.setDdeliverdate(generateBusinessDate);// 要求收货日期
|
||||
saleorderRequestChildrenDto.setNexchangeotobrate("1.00000000");//折本汇率
|
||||
saleorderRequestChildrenDto.setNitemdiscountrate("100.000000");//单品折扣
|
||||
saleorderRequestChildrenDto.setNnumber("-" + passiveStorageSonDetailsDto2.getGroupShipQty().stripTrailingZeros().toPlainString());//数量
|
||||
saleorderRequestChildrenDto.setNoriginalcurdiscountmny("0");//折扣额
|
||||
SaleorderRequestChildrenDto saleorderRequestChildrenDto = new SaleorderRequestChildrenDto();
|
||||
saleorderRequestChildrenDto.setBlargessflag(isblargessflag);//是否赠品
|
||||
saleorderRequestChildrenDto.setCadvisecalbodyid(bdCalbodyEntity.getPkCalbody());//发货库存组织
|
||||
saleorderRequestChildrenDto.setCbodywarehouseid(bdStordocEntity.getPkStordoc());//发货仓库
|
||||
saleorderRequestChildrenDto.setCconsigncorpid(deliverGoodsCorp.getPkCorp());//发货公司
|
||||
saleorderRequestChildrenDto.setCcurrencytypeid("00010000000000000001");//币种
|
||||
saleorderRequestChildrenDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());//存货id
|
||||
saleorderRequestChildrenDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//收货单位
|
||||
saleorderRequestChildrenDto.setDconsigndate(generateBusinessDate);//计划发货日期
|
||||
saleorderRequestChildrenDto.setDdeliverdate(generateBusinessDate);// 要求收货日期
|
||||
saleorderRequestChildrenDto.setNexchangeotobrate("1.00000000");//折本汇率
|
||||
saleorderRequestChildrenDto.setNitemdiscountrate("100.000000");//单品折扣
|
||||
saleorderRequestChildrenDto.setNnumber("-" + passiveStorageSonDetailsDto2.getGroupShipQty().stripTrailingZeros().toPlainString());//数量
|
||||
saleorderRequestChildrenDto.setNoriginalcurdiscountmny("0");//折扣额
|
||||
// saleorderRequestChildrenDto.setNoriginalcurmny("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//无税金额
|
||||
// saleorderRequestChildrenDto.setNoriginalcurnetprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税净价
|
||||
// saleorderRequestChildrenDto.setNoriginalcurprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税单价
|
||||
// saleorderRequestChildrenDto.setNoriginalcursummny("-" + noriginalcursummny.stripTrailingZeros().toPlainString());//价税合计
|
||||
if (isblargessflag) {
|
||||
saleorderRequestChildrenDto.setNoriginalcursummny("0");
|
||||
} else {
|
||||
saleorderRequestChildrenDto.setNoriginalcursummny("-" + passiveStorageSonDetailsDto2.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString());//价税合计
|
||||
}
|
||||
if (isblargessflag) {
|
||||
saleorderRequestChildrenDto.setNoriginalcursummny("0");
|
||||
} else {
|
||||
saleorderRequestChildrenDto.setNoriginalcursummny("-" + passiveStorageSonDetailsDto2.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString());//价税合计
|
||||
}
|
||||
// saleorderRequestChildrenDto.setNoriginalcurtaxmny("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//税额
|
||||
// saleorderRequestChildrenDto.setNoriginalcurtaxnetprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税净价
|
||||
// saleorderRequestChildrenDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价
|
||||
// saleorderRequestChildrenDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率
|
||||
// saleorderRequestChildrenDto.setVdef2(bdCostsubjEntity.getCostname());//收支项目
|
||||
// saleorderRequestChildrenDto.setPk_defdoc2(bdCostsubjEntity.getPkCostsubj());
|
||||
//如果优惠金额为0,则传0
|
||||
if (!"0".equals(passiveStorageSonDetailsDto2.getVdef4().stripTrailingZeros().toPlainString())) {
|
||||
saleorderRequestChildrenDto.setVdef4("-" + passiveStorageSonDetailsDto2.getVdef4().stripTrailingZeros().toPlainString());
|
||||
} else {
|
||||
saleorderRequestChildrenDto.setVdef4("0");
|
||||
}
|
||||
if (!"0".equals(passiveStorageSonDetailsDto2.getVdef5().stripTrailingZeros().toPlainString())) {
|
||||
saleorderRequestChildrenDto.setVdef5("-" + passiveStorageSonDetailsDto2.getVdef5().stripTrailingZeros().toPlainString());
|
||||
} else {
|
||||
saleorderRequestChildrenDto.setVdef5("0");
|
||||
}
|
||||
if (!"0".equals(passiveStorageSonDetailsDto2.getVdef6().stripTrailingZeros().toPlainString())) {
|
||||
saleorderRequestChildrenDto.setVdef6("-" + passiveStorageSonDetailsDto2.getVdef6().stripTrailingZeros().toPlainString());
|
||||
} else {
|
||||
saleorderRequestChildrenDto.setVdef6("0");
|
||||
}
|
||||
if (!"0".equals(passiveStorageSonDetailsDto2.getVdef7().stripTrailingZeros().toPlainString())) {
|
||||
saleorderRequestChildrenDto.setVdef7("-" + passiveStorageSonDetailsDto2.getVdef7().stripTrailingZeros().toPlainString());
|
||||
} else {
|
||||
saleorderRequestChildrenDto.setVdef7("0");
|
||||
}
|
||||
saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto);
|
||||
//如果优惠金额为0,则传0
|
||||
if (!"0".equals(passiveStorageSonDetailsDto2.getVdef4().stripTrailingZeros().toPlainString())) {
|
||||
saleorderRequestChildrenDto.setVdef4("-" + passiveStorageSonDetailsDto2.getVdef4().stripTrailingZeros().toPlainString());
|
||||
} else {
|
||||
saleorderRequestChildrenDto.setVdef4("0");
|
||||
}
|
||||
if (!"0".equals(passiveStorageSonDetailsDto2.getVdef5().stripTrailingZeros().toPlainString())) {
|
||||
saleorderRequestChildrenDto.setVdef5("-" + passiveStorageSonDetailsDto2.getVdef5().stripTrailingZeros().toPlainString());
|
||||
} else {
|
||||
saleorderRequestChildrenDto.setVdef5("0");
|
||||
}
|
||||
if (!"0".equals(passiveStorageSonDetailsDto2.getVdef6().stripTrailingZeros().toPlainString())) {
|
||||
saleorderRequestChildrenDto.setVdef6("-" + passiveStorageSonDetailsDto2.getVdef6().stripTrailingZeros().toPlainString());
|
||||
} else {
|
||||
saleorderRequestChildrenDto.setVdef6("0");
|
||||
}
|
||||
if (!"0".equals(passiveStorageSonDetailsDto2.getVdef7().stripTrailingZeros().toPlainString())) {
|
||||
saleorderRequestChildrenDto.setVdef7("-" + passiveStorageSonDetailsDto2.getVdef7().stripTrailingZeros().toPlainString());
|
||||
} else {
|
||||
saleorderRequestChildrenDto.setVdef7("0");
|
||||
}
|
||||
saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto);
|
||||
|
||||
//如果合并后的金额为0,则不传到U8C
|
||||
Assert.notNull(passiveStorageSonDetailsDto2.getGroupTotalPayAmount(), "goodsRertunSonDetailsDto.getGroupTotalPayAmount()不能为空!");
|
||||
//如果合并后的金额为0,则不传到U8C
|
||||
Assert.notNull(passiveStorageSonDetailsDto2.getGroupTotalPayAmount(), "goodsRertunSonDetailsDto.getGroupTotalPayAmount()不能为空!");
|
||||
// BigDecimal groupTotalPayAmount = passiveStorageSonDetailsDto2.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
// if ("0".equals(groupTotalPayAmount.stripTrailingZeros().toPlainString())) {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
//退货没有邮费金额,已经向万万确认
|
||||
//平台优惠
|
||||
if (passiveStorageSonDetailsDto2.getVdef4() != null) {
|
||||
BigDecimal vdef4 = passiveStorageSonDetailsDto2.getVdef4();
|
||||
if (vdef4.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY01");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY01");
|
||||
//补充:平台优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef4.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
||||
}
|
||||
//退货没有邮费金额,已经向万万确认
|
||||
//平台优惠
|
||||
if (passiveStorageSonDetailsDto2.getVdef4() != null) {
|
||||
BigDecimal vdef4 = passiveStorageSonDetailsDto2.getVdef4();
|
||||
if (vdef4.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY01");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY01");
|
||||
//补充:平台优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef4.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
||||
}
|
||||
//达人优惠
|
||||
if (passiveStorageSonDetailsDto2.getVdef6() != null) {
|
||||
BigDecimal vdef6 = passiveStorageSonDetailsDto2.getVdef6();
|
||||
if (vdef6.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY02");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY02");
|
||||
//补充:达人优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef6.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
||||
}
|
||||
}
|
||||
//达人优惠
|
||||
if (passiveStorageSonDetailsDto2.getVdef6() != null) {
|
||||
BigDecimal vdef6 = passiveStorageSonDetailsDto2.getVdef6();
|
||||
if (vdef6.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY02");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY02");
|
||||
//补充:达人优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef6.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
||||
}
|
||||
//支付优惠
|
||||
if (passiveStorageSonDetailsDto2.getVdef5() != null) {
|
||||
BigDecimal vdef5 = passiveStorageSonDetailsDto2.getVdef5();
|
||||
if (vdef5.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY04");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY04");
|
||||
//补充:支付优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef5.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();// 符号取反(转为负数)
|
||||
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
||||
}
|
||||
}
|
||||
//支付优惠
|
||||
if (passiveStorageSonDetailsDto2.getVdef5() != null) {
|
||||
BigDecimal vdef5 = passiveStorageSonDetailsDto2.getVdef5();
|
||||
if (vdef5.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY04");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY04");
|
||||
//补充:支付优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef5.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();// 符号取反(转为负数)
|
||||
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
||||
}
|
||||
}
|
||||
|
||||
//数量大于0,推送销售订单
|
||||
if (groupShipQty.compareTo(BigDecimal.ZERO) > 0) {
|
||||
boolean oneSuccess = false;
|
||||
if (!"Y".equals(newState)) {
|
||||
//推送U8C红字销售订单,如果推送失败,抛出异常,那么就会外围的try catch捕获,代码不会往下执行
|
||||
|
@ -1496,16 +1512,17 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
|
|||
}
|
||||
updateSuccessOrFail4(value, "N", message, null, null, value.get(0).getStorageTimeStamp());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//记录红字销售订单异常失败
|
||||
logger.error("TOC退货业务转换成U8C对象过程中、或者单据推送到U8C出现异常!", e);
|
||||
String message = e.getMessage();
|
||||
if (message == null) {
|
||||
message = "未知错误";
|
||||
}
|
||||
updateSuccessOrFail3(value, "N", message, null, null, value.get(0).getStorageTimeStamp());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//记录红字销售订单异常失败
|
||||
logger.error("TOC退货业务转换成U8C对象过程中、或者单据推送到U8C出现异常!", e);
|
||||
String message = e.getMessage();
|
||||
if (message == null) {
|
||||
message = "未知错误";
|
||||
}
|
||||
updateSuccessOrFail3(value, "N", message, null, null, value.get(0).getStorageTimeStamp());
|
||||
}
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
//2024年8月6日 11:28:54此处不记录失败,不认为是错误
|
||||
|
@ -5002,4 +5019,48 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
|
|||
throw new Exception("子线程执行失败: " + childException.getMessage(), childException);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断红字应收单
|
||||
*/
|
||||
private boolean filterJfbbjeIncludingTax(List<ArapDjzbVO.Childrenn> childrennArrayList) {
|
||||
// 处理空列表或null:视为"全部为0",返回false
|
||||
if (childrennArrayList == null || childrennArrayList.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
for (ArapDjzbVO.Childrenn dto : childrennArrayList) {
|
||||
String jfbbje = dto.getJfbbje();
|
||||
if (jfbbje == null || jfbbje.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
BigDecimal amount = new BigDecimal(jfbbje);
|
||||
if (amount.compareTo(BigDecimal.ZERO) != 0) {
|
||||
// 发现非0值,立即返回true
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤掉集合中jfbbje为0的元素
|
||||
*
|
||||
* @return 过滤后的新集合(不包含jfbbje=0的元素)
|
||||
*/
|
||||
private List<ArapDjzbVO.Childrenn> filterZeroJfbbje(List<ArapDjzbVO.Childrenn> childrennArrayList) {
|
||||
// 处理空输入
|
||||
if (childrennArrayList == null || childrennArrayList.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 使用Stream API过滤0值
|
||||
return childrennArrayList.stream().filter(dto -> {
|
||||
String jfbbje = dto.getJfbbje();
|
||||
if (jfbbje == null || jfbbje.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
return new BigDecimal(jfbbje).compareTo(BigDecimal.ZERO) != 0;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
|
@ -888,9 +888,9 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
}
|
||||
|
||||
//合并后如果数量为0,则过滤掉
|
||||
if ("0".equals(goodsRertunSonDetailsDto.getGroupShipQty().stripTrailingZeros().toPlainString())) {
|
||||
continue;
|
||||
}
|
||||
// if ("0".equals(goodsRertunSonDetailsDto.getGroupShipQty().stripTrailingZeros().toPlainString())) {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
SaleorderRequestChildrenDto saleorderRequestChildrenDto = new SaleorderRequestChildrenDto();
|
||||
saleorderRequestChildrenDto.setBlargessflag(isblargessflag);//是否赠品
|
||||
|
@ -989,6 +989,12 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
}
|
||||
}
|
||||
|
||||
//如果所有明细行价税合计都为0,则过滤
|
||||
//2025年8月22日09:33:03 生成销售订单如果总金额为0(但存在数量)不需要过滤,已经和闫旭沟通
|
||||
// if (!filterTotalAmountIncludingTax(saleorderRequestChildrenDtoList)) {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
if (ProfilesActiveConstant.PUSH_SCENE_TYPE_1.equals(pushScenarioType) || ProfilesActiveConstant.PUSH_SCENE_TYPE_2.equals(pushScenarioType)) {
|
||||
//推送u8c生成红字销售订单
|
||||
List<SaleorderRequestDto> saleorderRequestDtoList = new ArrayList<>();
|
||||
|
@ -1104,120 +1110,128 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
BigDecimal groupTotalPayAmount = goodsRertunSonDetailsDto.getGroupTotalPayAmount();
|
||||
|
||||
//当金额>0,但数量为0时,推送红字应收单
|
||||
if (groupTotalPayAmount != null && groupShipQty != null && groupTotalPayAmount.compareTo(BigDecimal.ZERO) > 0 && groupShipQty.compareTo(BigDecimal.ZERO) == 0) {
|
||||
try {
|
||||
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlowV4();
|
||||
//生成业务日期
|
||||
String generateBusinessDate = createSuccessFulTradeDate(header);
|
||||
// if (groupTotalPayAmount != null && groupShipQty != null && groupTotalPayAmount.compareTo(BigDecimal.ZERO) > 0 && groupShipQty.compareTo(BigDecimal.ZERO) == 0) {
|
||||
try {
|
||||
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlowV4();
|
||||
//生成业务日期
|
||||
String generateBusinessDate = createSuccessFulTradeDate(header);
|
||||
|
||||
//红字应收单表头
|
||||
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.setZyx8(OverallConstant.getOverAllValue("售后类型标识-TOC售后-编码"));
|
||||
parentVo.setZyx16("1");//单据红字标识
|
||||
parentVo.setZyx17(ProfilesActiveConstant.sourceSystem1);//来源系统
|
||||
parentVo.setZyx18(keyGroup);//汇总维度
|
||||
//红字应收单表头
|
||||
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.setZyx8(OverallConstant.getOverAllValue("售后类型标识-TOC售后-编码"));
|
||||
parentVo.setZyx16("1");//单据红字标识
|
||||
parentVo.setZyx17(ProfilesActiveConstant.sourceSystem1);//来源系统
|
||||
parentVo.setZyx18(keyGroup);//汇总维度
|
||||
|
||||
//验证是否为指定的店铺,如果为true,则取结存价
|
||||
//验证是否为指定的店铺,如果为true,则取结存价
|
||||
// Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode());
|
||||
//把汇总好的出库单明细行合并成一行
|
||||
//把汇总好的出库单明细行合并成一行
|
||||
// GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose, sceneType);
|
||||
|
||||
//存货管理档案:取发货公司的存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity = oldValue.get(0).getBdInvmandocEntity();
|
||||
//存货基础档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity = oldValue.get(0).getBdInvbasdocEntity();
|
||||
//根据存货基础档案编码,查询当前存货的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity1 = oldValue.get(0).getBdTaxitemsEntity();
|
||||
//存货管理档案:取发货公司的存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity = oldValue.get(0).getBdInvmandocEntity();
|
||||
//存货基础档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity = oldValue.get(0).getBdInvbasdocEntity();
|
||||
//根据存货基础档案编码,查询当前存货的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity1 = oldValue.get(0).getBdTaxitemsEntity();
|
||||
|
||||
//如果合并后的金额为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;
|
||||
}
|
||||
//如果合并后的金额为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<>();
|
||||
ArapDjzbVO.Childrenn arapDjzbVOChildrenn = new ArapDjzbVO.Childrenn();
|
||||
childrennArrayList.add(arapDjzbVOChildrenn);
|
||||
arapDjzbVOChildrenn.setCinventoryid(bdInvbasdocEntity.getInvcode());//存货管理档案
|
||||
arapDjzbVOChildrenn.setJfbbje("-" + groupTotalPayAmount2.stripTrailingZeros().toPlainString());//借方本币金额
|
||||
arapDjzbVOChildrenn.setJfybje("-" + groupTotalPayAmount2.stripTrailingZeros().toPlainString());//借方原币金额
|
||||
//修改为生成红字应收单表体
|
||||
List<ArapDjzbVO.Childrenn> childrennArrayList = new ArrayList<>();
|
||||
ArapDjzbVO.Childrenn arapDjzbVOChildrenn = new ArapDjzbVO.Childrenn();
|
||||
childrennArrayList.add(arapDjzbVOChildrenn);
|
||||
arapDjzbVOChildrenn.setCinventoryid(bdInvbasdocEntity.getInvcode());//存货管理档案
|
||||
arapDjzbVOChildrenn.setJfbbje("-" + groupTotalPayAmount2.stripTrailingZeros().toPlainString());//借方本币金额
|
||||
arapDjzbVOChildrenn.setJfybje("-" + groupTotalPayAmount2.stripTrailingZeros().toPlainString());//借方原币金额
|
||||
// arapDjzbVOChildrenn.setJfbbsj("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//借方本币税金
|
||||
// arapDjzbVOChildrenn.setJfybsj("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//借方原币税金
|
||||
// arapDjzbVOChildrenn.setWbfbbje("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//借方本币无税金额
|
||||
// arapDjzbVOChildrenn.setJfybwsje("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//借方原币无税金额
|
||||
|
||||
//退货没有邮费金额,已经向万万确认
|
||||
//平台优惠
|
||||
if (goodsRertunSonDetailsDto.getVdef4() != null) {
|
||||
BigDecimal vdef4 = goodsRertunSonDetailsDto.getVdef4();
|
||||
if (vdef4.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY01");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY01");
|
||||
//补充:平台优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef4.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||
queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||
}
|
||||
//退货没有邮费金额,已经向万万确认
|
||||
//平台优惠
|
||||
if (goodsRertunSonDetailsDto.getVdef4() != null) {
|
||||
BigDecimal vdef4 = goodsRertunSonDetailsDto.getVdef4();
|
||||
if (vdef4.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY01");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY01");
|
||||
//补充:平台优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef4.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||
queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||
}
|
||||
//达人优惠
|
||||
if (goodsRertunSonDetailsDto.getVdef6() != null) {
|
||||
BigDecimal vdef6 = goodsRertunSonDetailsDto.getVdef6();
|
||||
if (vdef6.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY02");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY02");
|
||||
//补充:达人优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef6.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||
queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||
}
|
||||
}
|
||||
//达人优惠
|
||||
if (goodsRertunSonDetailsDto.getVdef6() != null) {
|
||||
BigDecimal vdef6 = goodsRertunSonDetailsDto.getVdef6();
|
||||
if (vdef6.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY02");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY02");
|
||||
//补充:达人优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef6.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||
queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||
}
|
||||
//支付优惠
|
||||
if (goodsRertunSonDetailsDto.getVdef5() != null) {
|
||||
BigDecimal vdef5 = goodsRertunSonDetailsDto.getVdef5();
|
||||
if (vdef5.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY04");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY04");
|
||||
//补充:支付优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef5.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||
queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||
}
|
||||
}
|
||||
//支付优惠
|
||||
if (goodsRertunSonDetailsDto.getVdef5() != null) {
|
||||
BigDecimal vdef5 = goodsRertunSonDetailsDto.getVdef5();
|
||||
if (vdef5.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY04");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY04");
|
||||
//补充:支付优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef5.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||
queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||
}
|
||||
}
|
||||
|
||||
//如果总金额不为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)) {
|
||||
//推送U8C生成红字应收单
|
||||
List<ArapDjzbVO> arapDjzbVOList = new ArrayList<>();
|
||||
ArapDjzbVO arapDjzbVO = new ArapDjzbVO();
|
||||
arapDjzbVO.setParentvo(parentVo);
|
||||
arapDjzbVO.setChildren(childrennArrayList);
|
||||
arapDjzbVO.setChildren(childrenns);
|
||||
arapDjzbVOList.add(arapDjzbVO);
|
||||
|
||||
Map<String, List<ArapDjzbVO>> listMap = new HashMap<>();
|
||||
|
@ -1245,68 +1259,69 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
} else {
|
||||
Assert.state(false, "未知的场景类型 pushScenarioType={}", pushScenarioType);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("TOC退货业务转换成U8C对象过程中、或者单据推送到U8C出现异常!", e);
|
||||
//记录失败
|
||||
String message = e.getMessage();
|
||||
if (message == null) {
|
||||
message = "未知错误";
|
||||
}
|
||||
updateSuccessOrFail2(oldValue, "N", message, null, null, oldValue.get(0).getStorageTimeStamp());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("TOC退货业务转换成U8C对象过程中、或者单据推送到U8C出现异常!", e);
|
||||
//记录失败
|
||||
String message = e.getMessage();
|
||||
if (message == null) {
|
||||
message = "未知错误";
|
||||
}
|
||||
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) {
|
||||
try {
|
||||
// if (groupShipQty != null && groupTotalPayAmount != null && groupTotalPayAmount.compareTo(BigDecimal.ZERO) >= 0 && groupShipQty.compareTo(BigDecimal.ZERO) > 0) {
|
||||
try {
|
||||
// checkArchives(oldValue.get(0));
|
||||
//生成业务日期
|
||||
String generateBusinessDate = createSuccessFulTradeDate(header);
|
||||
//生成业务日期
|
||||
String generateBusinessDate = createSuccessFulTradeDate(header);
|
||||
|
||||
SaleorderRequestDto saleorderRequestDto = new SaleorderRequestDto();
|
||||
SaleorderRequestParentDto saleorderRequestParentDto = new SaleorderRequestParentDto();
|
||||
saleorderRequestParentDto.setDbilldate(generateBusinessDate);//单据日期
|
||||
saleorderRequestParentDto.setBretinvflag("Y");//退货标记
|
||||
saleorderRequestParentDto.setCbiztype(bdBusitypeEntity1.getPkBusitype());//业务流程
|
||||
saleorderRequestParentDto.setCcalbodyid(bdCalbodyEntity.getPkCalbody());//库存组织
|
||||
saleorderRequestParentDto.setCcustomerid(bdCumandocEntity.getPkCumandoc());//客户=开票单位=收货单位=表体收货单位=收货单位
|
||||
saleorderRequestParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//部门
|
||||
saleorderRequestParentDto.setCemployeeid(null);//业务员
|
||||
saleorderRequestParentDto.setCoperatorid(OverallConstant.getOverAllValue("u8cApiZdrPK"));//制单人
|
||||
saleorderRequestParentDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//开票单位
|
||||
saleorderRequestParentDto.setCreceiptcustomerid(bdCumandocEntity.getPkCumandoc());//收货单位
|
||||
saleorderRequestParentDto.setCsalecorpid(bdSalestruEntity.getCsalestruid());//销售组织
|
||||
saleorderRequestParentDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//仓库
|
||||
saleorderRequestParentDto.setDapprovedate(generateBusinessDate);//审核日期
|
||||
saleorderRequestParentDto.setNdiscountrate("100.000000");//整单折扣
|
||||
saleorderRequestParentDto.setPk_corp(bdCorpEntity.getPkCorp());//公司id
|
||||
//汇总单号=汇总维度
|
||||
saleorderRequestParentDto.setVdef18(keyGroup);
|
||||
//平台
|
||||
saleorderRequestParentDto.setPk_defdoc2(platformArchives.getPkDefdoc());
|
||||
saleorderRequestParentDto.setVdef2(platformArchives.getDocname());
|
||||
saleorderRequestParentDto.setVdef17(ProfilesActiveConstant.sourceSystem1);//来源系统
|
||||
SaleorderRequestDto saleorderRequestDto = new SaleorderRequestDto();
|
||||
SaleorderRequestParentDto saleorderRequestParentDto = new SaleorderRequestParentDto();
|
||||
saleorderRequestParentDto.setDbilldate(generateBusinessDate);//单据日期
|
||||
saleorderRequestParentDto.setBretinvflag("Y");//退货标记
|
||||
saleorderRequestParentDto.setCbiztype(bdBusitypeEntity1.getPkBusitype());//业务流程
|
||||
saleorderRequestParentDto.setCcalbodyid(bdCalbodyEntity.getPkCalbody());//库存组织
|
||||
saleorderRequestParentDto.setCcustomerid(bdCumandocEntity.getPkCumandoc());//客户=开票单位=收货单位=表体收货单位=收货单位
|
||||
saleorderRequestParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//部门
|
||||
saleorderRequestParentDto.setCemployeeid(null);//业务员
|
||||
saleorderRequestParentDto.setCoperatorid(OverallConstant.getOverAllValue("u8cApiZdrPK"));//制单人
|
||||
saleorderRequestParentDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//开票单位
|
||||
saleorderRequestParentDto.setCreceiptcustomerid(bdCumandocEntity.getPkCumandoc());//收货单位
|
||||
saleorderRequestParentDto.setCsalecorpid(bdSalestruEntity.getCsalestruid());//销售组织
|
||||
saleorderRequestParentDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//仓库
|
||||
saleorderRequestParentDto.setDapprovedate(generateBusinessDate);//审核日期
|
||||
saleorderRequestParentDto.setNdiscountrate("100.000000");//整单折扣
|
||||
saleorderRequestParentDto.setPk_corp(bdCorpEntity.getPkCorp());//公司id
|
||||
//汇总单号=汇总维度
|
||||
saleorderRequestParentDto.setVdef18(keyGroup);
|
||||
//平台
|
||||
saleorderRequestParentDto.setPk_defdoc2(platformArchives.getPkDefdoc());
|
||||
saleorderRequestParentDto.setVdef2(platformArchives.getDocname());
|
||||
saleorderRequestParentDto.setVdef17(ProfilesActiveConstant.sourceSystem1);//来源系统
|
||||
|
||||
//收发类别
|
||||
saleorderRequestParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl());
|
||||
saleorderRequestParentDto.setVdef3(bdRdclEntity.getRdname());
|
||||
//收发类别
|
||||
saleorderRequestParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl());
|
||||
saleorderRequestParentDto.setVdef3(bdRdclEntity.getRdname());
|
||||
|
||||
//2024年8月8日 17:17:58 店铺档案自定义项1,先不传,后续维护好之后再传!
|
||||
//店铺
|
||||
saleorderRequestParentDto.setPk_defdoc1(shopArchives.getPkDefdoc());
|
||||
saleorderRequestParentDto.setVdef1(shopArchives.getDocname());
|
||||
//2024年8月8日 17:17:58 店铺档案自定义项1,先不传,后续维护好之后再传!
|
||||
//店铺
|
||||
saleorderRequestParentDto.setPk_defdoc1(shopArchives.getPkDefdoc());
|
||||
saleorderRequestParentDto.setVdef1(shopArchives.getDocname());
|
||||
|
||||
//单据红字标识
|
||||
saleorderRequestParentDto.setPk_defdoc16(OverallConstant.getOverAllValue("u8c自定义项档案-单据红字标识-Y主键"));
|
||||
saleorderRequestParentDto.setVdef16(OverallConstant.getOverAllValue("u8c自定义项档案-单据红字标识-Y名称"));
|
||||
//单据红字标识
|
||||
saleorderRequestParentDto.setPk_defdoc16(OverallConstant.getOverAllValue("u8c自定义项档案-单据红字标识-Y主键"));
|
||||
saleorderRequestParentDto.setVdef16(OverallConstant.getOverAllValue("u8c自定义项档案-单据红字标识-Y名称"));
|
||||
|
||||
//售后类型标识
|
||||
saleorderRequestParentDto.setPk_defdoc8(OverallConstant.getOverAllValue("售后类型标识-TOC售后-主键"));
|
||||
saleorderRequestParentDto.setVdef8(OverallConstant.getOverAllValue("售后类型标识-TOC售后-名称"));
|
||||
//售后类型标识
|
||||
saleorderRequestParentDto.setPk_defdoc8(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());//公司
|
||||
|
@ -1326,23 +1341,23 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
// parentVo.setZyx17(ProfilesActiveConstant.sourceSystem1);//来源系统
|
||||
// parentVo.setZyx18(keyGroup);//汇总维度
|
||||
|
||||
List<SaleorderRequestChildrenDto> saleorderRequestChildrenDtoList = new ArrayList<>();
|
||||
saleorderRequestDto.setChildrenvo(saleorderRequestChildrenDtoList);
|
||||
List<SaleorderRequestChildrenDto> saleorderRequestChildrenDtoList = new ArrayList<>();
|
||||
saleorderRequestDto.setChildrenvo(saleorderRequestChildrenDtoList);
|
||||
|
||||
//存货管理档案:取发货公司的存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity = oldValue.get(0).getBdInvmandocEntity();
|
||||
//存货基础档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity = oldValue.get(0).getBdInvbasdocEntity();
|
||||
//根据存货基础档案编码,查询当前存货的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity1 = oldValue.get(0).getBdTaxitemsEntity();
|
||||
//查询收支项目
|
||||
//存货管理档案:取发货公司的存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity = oldValue.get(0).getBdInvmandocEntity();
|
||||
//存货基础档案
|
||||
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;
|
||||
}
|
||||
//合并后如果数量为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();
|
||||
|
||||
|
@ -1363,67 +1378,67 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
// }
|
||||
|
||||
// 判断是否为赠品
|
||||
Boolean isblargessflag = false;
|
||||
if ("0".equals(goodsRertunSonDetailsDto.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString())) {
|
||||
isblargessflag = true;
|
||||
}
|
||||
Boolean isblargessflag = false;
|
||||
if ("0".equals(goodsRertunSonDetailsDto.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString())) {
|
||||
isblargessflag = true;
|
||||
}
|
||||
|
||||
SaleorderRequestChildrenDto saleorderRequestChildrenDto = new SaleorderRequestChildrenDto();
|
||||
saleorderRequestChildrenDto.setBlargessflag(isblargessflag);//是否赠品
|
||||
saleorderRequestChildrenDto.setCadvisecalbodyid(bdCalbodyEntity.getPkCalbody());//发货库存组织
|
||||
saleorderRequestChildrenDto.setCbodywarehouseid(bdStordocEntity.getPkStordoc());//发货仓库
|
||||
saleorderRequestChildrenDto.setCconsigncorpid(deliverGoodsCorp.getPkCorp());//发货公司
|
||||
saleorderRequestChildrenDto.setCcurrencytypeid("00010000000000000001");//币种
|
||||
saleorderRequestChildrenDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());//存货id
|
||||
saleorderRequestChildrenDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//收货单位
|
||||
saleorderRequestChildrenDto.setDconsigndate(generateBusinessDate);//计划发货日期
|
||||
saleorderRequestChildrenDto.setDdeliverdate(generateBusinessDate);// 要求收货日期
|
||||
saleorderRequestChildrenDto.setNexchangeotobrate("1.00000000");//折本汇率
|
||||
saleorderRequestChildrenDto.setNitemdiscountrate("100.000000");//单品折扣
|
||||
saleorderRequestChildrenDto.setNnumber("-" + goodsRertunSonDetailsDto.getGroupShipQty().stripTrailingZeros().toPlainString());//数量
|
||||
saleorderRequestChildrenDto.setNoriginalcurdiscountmny("0");//折扣额
|
||||
SaleorderRequestChildrenDto saleorderRequestChildrenDto = new SaleorderRequestChildrenDto();
|
||||
saleorderRequestChildrenDto.setBlargessflag(isblargessflag);//是否赠品
|
||||
saleorderRequestChildrenDto.setCadvisecalbodyid(bdCalbodyEntity.getPkCalbody());//发货库存组织
|
||||
saleorderRequestChildrenDto.setCbodywarehouseid(bdStordocEntity.getPkStordoc());//发货仓库
|
||||
saleorderRequestChildrenDto.setCconsigncorpid(deliverGoodsCorp.getPkCorp());//发货公司
|
||||
saleorderRequestChildrenDto.setCcurrencytypeid("00010000000000000001");//币种
|
||||
saleorderRequestChildrenDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());//存货id
|
||||
saleorderRequestChildrenDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//收货单位
|
||||
saleorderRequestChildrenDto.setDconsigndate(generateBusinessDate);//计划发货日期
|
||||
saleorderRequestChildrenDto.setDdeliverdate(generateBusinessDate);// 要求收货日期
|
||||
saleorderRequestChildrenDto.setNexchangeotobrate("1.00000000");//折本汇率
|
||||
saleorderRequestChildrenDto.setNitemdiscountrate("100.000000");//单品折扣
|
||||
saleorderRequestChildrenDto.setNnumber("-" + goodsRertunSonDetailsDto.getGroupShipQty().stripTrailingZeros().toPlainString());//数量
|
||||
saleorderRequestChildrenDto.setNoriginalcurdiscountmny("0");//折扣额
|
||||
// saleorderRequestChildrenDto.setNoriginalcurmny("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//无税金额
|
||||
// saleorderRequestChildrenDto.setNoriginalcurnetprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税净价
|
||||
// saleorderRequestChildrenDto.setNoriginalcurprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税单价
|
||||
// saleorderRequestChildrenDto.setNoriginalcursummny("-" + noriginalcursummny.stripTrailingZeros().toPlainString());//价税合计
|
||||
saleorderRequestChildrenDto.setNoriginalcursummny("-" + goodsRertunSonDetailsDto.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString());//价税合计 新逻辑
|
||||
saleorderRequestChildrenDto.setNoriginalcursummny("-" + goodsRertunSonDetailsDto.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString());//价税合计 新逻辑
|
||||
// saleorderRequestChildrenDto.setNoriginalcurtaxmny("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//税额
|
||||
// saleorderRequestChildrenDto.setNoriginalcurtaxnetprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税净价
|
||||
// saleorderRequestChildrenDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价
|
||||
// saleorderRequestChildrenDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率
|
||||
// saleorderRequestChildrenDto.setVdef2(bdCostsubjEntity.getCostname());//收支项目
|
||||
// saleorderRequestChildrenDto.setPk_defdoc2(bdCostsubjEntity.getPkCostsubj());
|
||||
//如果优惠金额为0,则传0
|
||||
if (!"0".equals(goodsRertunSonDetailsDto.getVdef4().stripTrailingZeros().toPlainString())) {
|
||||
saleorderRequestChildrenDto.setVdef4("-" + goodsRertunSonDetailsDto.getVdef4().stripTrailingZeros().toPlainString());
|
||||
} else {
|
||||
saleorderRequestChildrenDto.setVdef4("0");
|
||||
}
|
||||
if (!"0".equals(goodsRertunSonDetailsDto.getVdef5().stripTrailingZeros().toPlainString())) {
|
||||
saleorderRequestChildrenDto.setVdef5("-" + goodsRertunSonDetailsDto.getVdef5().stripTrailingZeros().toPlainString());
|
||||
} else {
|
||||
saleorderRequestChildrenDto.setVdef5("0");
|
||||
}
|
||||
if (!"0".equals(goodsRertunSonDetailsDto.getVdef6().stripTrailingZeros().toPlainString())) {
|
||||
saleorderRequestChildrenDto.setVdef6("-" + goodsRertunSonDetailsDto.getVdef6().stripTrailingZeros().toPlainString());
|
||||
} else {
|
||||
saleorderRequestChildrenDto.setVdef6("0");
|
||||
}
|
||||
if (!"0".equals(goodsRertunSonDetailsDto.getVdef7().stripTrailingZeros().toPlainString())) {
|
||||
saleorderRequestChildrenDto.setVdef7("-" + goodsRertunSonDetailsDto.getVdef7().stripTrailingZeros().toPlainString());
|
||||
} else {
|
||||
saleorderRequestChildrenDto.setVdef7("0");
|
||||
}
|
||||
saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto);
|
||||
//如果优惠金额为0,则传0
|
||||
if (!"0".equals(goodsRertunSonDetailsDto.getVdef4().stripTrailingZeros().toPlainString())) {
|
||||
saleorderRequestChildrenDto.setVdef4("-" + goodsRertunSonDetailsDto.getVdef4().stripTrailingZeros().toPlainString());
|
||||
} else {
|
||||
saleorderRequestChildrenDto.setVdef4("0");
|
||||
}
|
||||
if (!"0".equals(goodsRertunSonDetailsDto.getVdef5().stripTrailingZeros().toPlainString())) {
|
||||
saleorderRequestChildrenDto.setVdef5("-" + goodsRertunSonDetailsDto.getVdef5().stripTrailingZeros().toPlainString());
|
||||
} else {
|
||||
saleorderRequestChildrenDto.setVdef5("0");
|
||||
}
|
||||
if (!"0".equals(goodsRertunSonDetailsDto.getVdef6().stripTrailingZeros().toPlainString())) {
|
||||
saleorderRequestChildrenDto.setVdef6("-" + goodsRertunSonDetailsDto.getVdef6().stripTrailingZeros().toPlainString());
|
||||
} else {
|
||||
saleorderRequestChildrenDto.setVdef6("0");
|
||||
}
|
||||
if (!"0".equals(goodsRertunSonDetailsDto.getVdef7().stripTrailingZeros().toPlainString())) {
|
||||
saleorderRequestChildrenDto.setVdef7("-" + goodsRertunSonDetailsDto.getVdef7().stripTrailingZeros().toPlainString());
|
||||
} else {
|
||||
saleorderRequestChildrenDto.setVdef7("0");
|
||||
}
|
||||
saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto);
|
||||
|
||||
//如果合并后的金额为0,则不传到U8C
|
||||
//如果合并后的金额为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);
|
||||
|
@ -1435,60 +1450,63 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
// arapDjzbVOChildrenn.setWbfbbje("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//借方本币无税金额
|
||||
// arapDjzbVOChildrenn.setJfybwsje("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//借方原币无税金额
|
||||
|
||||
//退货没有邮费金额,已经向万万确认
|
||||
//所有业务商家优惠都不传
|
||||
//平台优惠
|
||||
if (goodsRertunSonDetailsDto.getVdef4() != null) {
|
||||
BigDecimal vdef4 = goodsRertunSonDetailsDto.getVdef4();
|
||||
if (vdef4.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY01");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY01");
|
||||
//补充:平台优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef4.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
||||
//退货没有邮费金额,已经向万万确认
|
||||
//所有业务商家优惠都不传
|
||||
//平台优惠
|
||||
if (goodsRertunSonDetailsDto.getVdef4() != null) {
|
||||
BigDecimal vdef4 = goodsRertunSonDetailsDto.getVdef4();
|
||||
if (vdef4.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY01");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY01");
|
||||
//补充:平台优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef4.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
||||
// queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||
}
|
||||
}
|
||||
//达人优惠
|
||||
if (goodsRertunSonDetailsDto.getVdef6() != null) {
|
||||
BigDecimal vdef6 = goodsRertunSonDetailsDto.getVdef6();
|
||||
if (vdef6.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY02");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY02");
|
||||
//补充:达人优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef6.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
||||
}
|
||||
//达人优惠
|
||||
if (goodsRertunSonDetailsDto.getVdef6() != null) {
|
||||
BigDecimal vdef6 = goodsRertunSonDetailsDto.getVdef6();
|
||||
if (vdef6.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY02");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY02");
|
||||
//补充:达人优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef6.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();
|
||||
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
||||
// queryAdditionUtil.additionalV3(childrennArrayList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, bdTaxitemsEntity);
|
||||
}
|
||||
}
|
||||
//支付优惠
|
||||
if (goodsRertunSonDetailsDto.getVdef5() != null) {
|
||||
BigDecimal vdef5 = goodsRertunSonDetailsDto.getVdef5();
|
||||
if (vdef5.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY04");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY04");
|
||||
//补充:支付优惠-存货
|
||||
BigDecimal absAccumulatedPostage = vdef5.abs();
|
||||
BigDecimal negativeValue = absAccumulatedPostage.negate();// 符号取反(转为负数)
|
||||
queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
|
||||
}
|
||||
//支付优惠
|
||||
if (goodsRertunSonDetailsDto.getVdef5() != null) {
|
||||
BigDecimal vdef5 = goodsRertunSonDetailsDto.getVdef5();
|
||||
if (vdef5.compareTo(BigDecimal.ZERO) > 0) {
|
||||
//发货运费-存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity1 = mapBdInvbasdocEntity.get("FY04");
|
||||
//存货管理档案
|
||||
BdInvmandocEntity bdInvmandocEntity1 = stringBdInvmandocEntityMap.get(bdInvbasdocEntity1.getInvcode() + deliverGoodsCorp.getPkCorp());
|
||||
//存货对应的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY04");
|
||||
//补充:支付优惠-存货
|
||||
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) {
|
||||
//判断入库时间(关单时间)与交易成功时间,推送u8c生成蓝字销售订单,仅满足情况二的条件才生成这张蓝字销售订单
|
||||
boolean oneSuccess = false;
|
||||
if (!"Y".equals(newstate4)) {
|
||||
if (ProfilesActiveConstant.PUSH_SCENE_TYPE_1.equals(pushScenarioType) || ProfilesActiveConstant.PUSH_SCENE_TYPE_2.equals(pushScenarioType)) {
|
||||
|
@ -1545,7 +1563,6 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
oneSuccess = true;
|
||||
}
|
||||
|
||||
//判断入库时间(关单时间)与交易成功时间,推送u8c生成蓝字销售订单,仅满足情况二的条件才生成这张蓝字销售订单
|
||||
try {
|
||||
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)) {
|
||||
|
@ -1590,16 +1607,17 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
}
|
||||
updateSuccessOrFail3(oldValue, "N", message, null, null, oldValue.get(0).getStorageTimeStamp());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//记录红字销售订单异常失败
|
||||
logger.error("TOC退货业务转换成U8C对象过程中、或者单据推送到U8C出现异常!", e);
|
||||
String message = e.getMessage();
|
||||
if (message == null) {
|
||||
message = "未知错误";
|
||||
}
|
||||
updateSuccessOrFail2(oldValue, "N", message, null, null, oldValue.get(0).getStorageTimeStamp());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//记录红字销售订单异常失败
|
||||
logger.error("TOC退货业务转换成U8C对象过程中、或者单据推送到U8C出现异常!", e);
|
||||
String message = e.getMessage();
|
||||
if (message == null) {
|
||||
message = "未知错误";
|
||||
}
|
||||
updateSuccessOrFail2(oldValue, "N", message, null, null, oldValue.get(0).getStorageTimeStamp());
|
||||
}
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
//2024年8月6日 11:28:54此处不记录失败,不认为是错误
|
||||
|
@ -4275,4 +4293,88 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
throw new Exception("子线程执行失败: " + childException.getMessage(), childException);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果所有明细行价税合计都为0,则过滤
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
// private boolean filterTotalAmountIncludingTax(List<SaleorderRequestChildrenDto> saleorderRequestChildrenDtoList) {
|
||||
// if (saleorderRequestChildrenDtoList != null && saleorderRequestChildrenDtoList.size() > 0) {
|
||||
// for (int i = 0; i < saleorderRequestChildrenDtoList.size(); i++) {
|
||||
// SaleorderRequestChildrenDto saleorderRequestChildrenDto = saleorderRequestChildrenDtoList.get(i);
|
||||
// String noriginalcursummny = saleorderRequestChildrenDto.getNoriginalcursummny();
|
||||
// BigDecimal noriginalcursummnyBigDecimal = new BigDecimal(noriginalcursummny);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 判断销售订单
|
||||
*/
|
||||
private boolean filterTotalAmountIncludingTax(List<SaleorderRequestChildrenDto> saleorderRequestChildrenDtoList) {
|
||||
// 处理空列表或null:视为"全部为0",返回false
|
||||
if (saleorderRequestChildrenDtoList == null || saleorderRequestChildrenDtoList.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
for (SaleorderRequestChildrenDto dto : saleorderRequestChildrenDtoList) {
|
||||
String amountStr = dto.getNoriginalcursummny();
|
||||
if (amountStr == null || amountStr.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
BigDecimal amount = new BigDecimal(amountStr);
|
||||
if (amount.compareTo(BigDecimal.ZERO) != 0) {
|
||||
// 发现非0值,立即返回true
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断红字应收单
|
||||
*/
|
||||
private boolean filterJfbbjeIncludingTax(List<ArapDjzbVO.Childrenn> childrennArrayList) {
|
||||
// 处理空列表或null:视为"全部为0",返回false
|
||||
if (childrennArrayList == null || childrennArrayList.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
for (ArapDjzbVO.Childrenn dto : childrennArrayList) {
|
||||
String jfbbje = dto.getJfbbje();
|
||||
if (jfbbje == null || jfbbje.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
BigDecimal amount = new BigDecimal(jfbbje);
|
||||
if (amount.compareTo(BigDecimal.ZERO) != 0) {
|
||||
// 发现非0值,立即返回true
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤掉集合中jfbbje为0的元素
|
||||
*
|
||||
* @return 过滤后的新集合(不包含jfbbje=0的元素)
|
||||
*/
|
||||
private List<ArapDjzbVO.Childrenn> filterZeroJfbbje(List<ArapDjzbVO.Childrenn> childrennArrayList) {
|
||||
// 处理空输入
|
||||
if (childrennArrayList == null || childrennArrayList.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 使用Stream API过滤0值
|
||||
return childrennArrayList.stream().filter(dto -> {
|
||||
String jfbbje = dto.getJfbbje();
|
||||
if (jfbbje == null || jfbbje.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
return new BigDecimal(jfbbje).compareTo(BigDecimal.ZERO) != 0;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
|
@ -35,12 +35,12 @@ public class PassiveWarehouseReceiptToCTest {
|
|||
//情况一
|
||||
// passiveWarehouseReceiptToC.startImplementByCode("RH20250722000231", "stock");
|
||||
//情况二
|
||||
// passiveWarehouseReceiptToC.startImplementByCode("RH20250731000423", "tran");
|
||||
passiveWarehouseReceiptToC.startImplementByCode("RH20250731000423", "tran");
|
||||
//情况三
|
||||
// passiveWarehouseReceiptToC.startImplementByCode("RH20250731000613", "tran");
|
||||
// passiveWarehouseReceiptToC.startImplementByCode("RH20250723000754", "tran");
|
||||
|
||||
passiveWarehouseReceiptToC.startImplementByCode("RH20250731000017", "stock");
|
||||
// passiveWarehouseReceiptToC.startImplementByCode("RH20250731000017", "stock");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -69,14 +69,14 @@ public class SoSaleReturnPluginInitializerToCTest {
|
|||
try {
|
||||
// soSaleReturnPluginInitializerToC.startImplementByTradeTime("2025-04-28 00:00:00", "2025-04-28 23:59:59", "0");
|
||||
|
||||
soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072900002315", "stock");
|
||||
// soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072900002315", "stock");
|
||||
|
||||
//满足红字应收单
|
||||
// soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072200001324", "tran");
|
||||
//情况一
|
||||
// soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072900000460", "stock");
|
||||
//情况二
|
||||
// soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072800000594", "tran");
|
||||
soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072800000594", "tran");
|
||||
//情况三
|
||||
// soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025080200002257", "tran");
|
||||
|
||||
|
|
Loading…
Reference in New Issue