feat(sales): 过滤实入数量为零的销售退货单明细行

- 新增 filterReceivedQtyZero 方法,用于过滤实入数量为 0 的明细行- 在处理销售退货单时,调用该方法过滤掉无效的明细行
- 优化了代码结构,提高了数据处理的准确性
This commit is contained in:
liuy 2025-05-06 10:41:56 +08:00
parent 1633bef047
commit 919cc07177
2 changed files with 26 additions and 10 deletions

View File

@ -737,6 +737,13 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
String keyGroup = entry.getKey();
List<GoodsRertunSonDetailsDto> oldValue = entry.getValue();
//如果oldValue存在实入数量=0的明细行则过滤掉
//2025年5月6日10:12:21 和丽知闫旭妮姐沟通如果oldValue存在实入数量=0的明细行则过滤掉
filterReceivedQtyZero(oldValue);
if (oldValue == null || oldValue.size() == 0) {
continue;
}
StockinOrderSearchResponse.StockinOrder.StockinH header = oldValue.get(0).getHeader();
BdCorpEntity bdCorpEntity = oldValue.get(0).getBdCorpEntity();//表头销售公司
BdCorpEntity deliverGoodsCorp = oldValue.get(0).getDeliverGoodsCorp();//发货公司
@ -3469,10 +3476,19 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
return JSON.parseObject(resultData, ArapDjzb.class);
}
} catch (Exception e) {
e.printStackTrace();
// e.printStackTrace();
logger.error("解析返回参数失败的错误", e);
//如果解析失败记录原因但是不能影响结果的记录
}
return null;
}
/**
* 过滤掉实入数量为0的List
*
* @author liuyang
*/
private void filterReceivedQtyZero(List<GoodsRertunSonDetailsDto> goodsRertunSonDetailsDtoList) {
goodsRertunSonDetailsDtoList.removeIf(dto -> dto != null && ("0".equals(dto.getReceivedQty()) || dto.getReceivedQty() == null));
}
}

View File

@ -43,20 +43,20 @@ public class SoSaleReturnPluginInitializerToCTest {
// soSaleReturnPluginInitializerToC.startImplement(null, null);
try {
//带优惠金额场景
// String code = "LETS-RE2025030100000112";
// soSaleReturnPluginInitializerToC.startImplementByCode(code, "tran");
String code = "LETS-RE2025042100000200";
soSaleReturnPluginInitializerToC.startImplementByCode(code, "stock");
//无优惠金额场景
// String code = "LETS-RE2025031900000002";
// soSaleReturnPluginInitializerToC.startImplementByCode(code, "tran");
List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> headerDetailsDtoArrayList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setCode("LETS-SO2025040100000698");
ofsStandardUtil.getOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoArrayList, 1L);
if (headerDetailsDtoArrayList.size() > 0) {
System.out.println(headerDetailsDtoArrayList.get(0));
}
// List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> headerDetailsDtoArrayList = new ArrayList<>();
// QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
// queryOfsSoSaleOutVo.setCode("LETS-SO2025040100000698");
// ofsStandardUtil.getOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoArrayList, 1L);
// if (headerDetailsDtoArrayList.size() > 0) {
// System.out.println(headerDetailsDtoArrayList.get(0));
// }
} catch (Exception e) {
e.printStackTrace();
}