Commit a56e727cd6c0c70de8e539cd55dab6ce06b116a8
1 parent
62fc8d6d
fix:修复库存物料汇总页面,库存总数计算错误问题,计算时没加库区条件
Showing
2 changed files
with
14 additions
and
18 deletions
src/main/java/com/huaheng/mobile/invenory/MobileInventoryController.java
@@ -66,7 +66,6 @@ public class MobileInventoryController { | @@ -66,7 +66,6 @@ public class MobileInventoryController { | ||
66 | private TransferTaskService transferTaskService; | 66 | private TransferTaskService transferTaskService; |
67 | @Resource | 67 | @Resource |
68 | private WorkTaskService workTaskService; | 68 | private WorkTaskService workTaskService; |
69 | - | ||
70 | @Resource | 69 | @Resource |
71 | private LocationService locationService; | 70 | private LocationService locationService; |
72 | @Resource | 71 | @Resource |
src/main/java/com/huaheng/pc/inventory/InventoryMaterialSummary/service/InventoryMaterialSummaryServiceImpl.java
@@ -11,15 +11,15 @@ import java.util.stream.Collectors; | @@ -11,15 +11,15 @@ import java.util.stream.Collectors; | ||
11 | 11 | ||
12 | 12 | ||
13 | @Service | 13 | @Service |
14 | -public class InventoryMaterialSummaryServiceImpl extends ServiceImpl<InventoryMaterialSummaryMapper, InventoryMaterialSummary> implements InventoryMaterialSummaryService{ | 14 | +public class InventoryMaterialSummaryServiceImpl extends ServiceImpl<InventoryMaterialSummaryMapper, InventoryMaterialSummary> implements InventoryMaterialSummaryService { |
15 | 15 | ||
16 | 16 | ||
17 | /** | 17 | /** |
18 | * 根据物料码去重及累加数量 | 18 | * 根据物料码去重及累加数量 |
19 | - * */ | 19 | + */ |
20 | @Override | 20 | @Override |
21 | public List<InventoryMaterialSummary> inventoryMaterialSummarySelect(List<InventoryMaterialSummary> inventoryMaterialSummaryList) { | 21 | public List<InventoryMaterialSummary> inventoryMaterialSummarySelect(List<InventoryMaterialSummary> inventoryMaterialSummaryList) { |
22 | - if(inventoryMaterialSummaryList.size() < 1){ | 22 | + if (inventoryMaterialSummaryList.size() < 1) { |
23 | return inventoryMaterialSummaryList; | 23 | return inventoryMaterialSummaryList; |
24 | } | 24 | } |
25 | /*以物料为条件把同物料数量全部相加,去重再展示*/ | 25 | /*以物料为条件把同物料数量全部相加,去重再展示*/ |
@@ -43,19 +43,17 @@ public class InventoryMaterialSummaryServiceImpl extends ServiceImpl<InventoryMa | @@ -43,19 +43,17 @@ public class InventoryMaterialSummaryServiceImpl extends ServiceImpl<InventoryMa | ||
43 | * 多条件去重 | 43 | * 多条件去重 |
44 | * 合并数量 | 44 | * 合并数量 |
45 | * 多条件去重及累加数量,货主,物料码 | 45 | * 多条件去重及累加数量,货主,物料码 |
46 | - * */ | 46 | + */ |
47 | @Override | 47 | @Override |
48 | - public List<InventoryMaterialSummary> duplicateRemoval(List<InventoryMaterialSummary> inventoryMaterialSummaryList){ | ||
49 | - if(inventoryMaterialSummaryList.size() < 1){ | 48 | + public List<InventoryMaterialSummary> duplicateRemoval(List<InventoryMaterialSummary> inventoryMaterialSummaryList) { |
49 | + if (inventoryMaterialSummaryList.size() < 1) { | ||
50 | return inventoryMaterialSummaryList; | 50 | return inventoryMaterialSummaryList; |
51 | } | 51 | } |
52 | //先找货主和物料码相同的物料SKU相加得总数 | 52 | //先找货主和物料码相同的物料SKU相加得总数 |
53 | - for(InventoryMaterialSummary o:inventoryMaterialSummaryList){ | 53 | + for (InventoryMaterialSummary o : inventoryMaterialSummaryList) { |
54 | BigDecimal numQty = BigDecimal.ZERO; | 54 | BigDecimal numQty = BigDecimal.ZERO; |
55 | - for (InventoryMaterialSummary t:inventoryMaterialSummaryList){ | ||
56 | - if(o.getCompanyCode().equals(t.getCompanyCode()) && | ||
57 | - o.getMaterialCode().equals(t.getMaterialCode())){ | ||
58 | - | 55 | + for (InventoryMaterialSummary t : inventoryMaterialSummaryList) { |
56 | + if (o.getCompanyCode().equals(t.getCompanyCode()) && o.getMaterialCode().equals(t.getMaterialCode()) && o.getZoneCode().equals(t.getZoneCode())) { | ||
59 | numQty = numQty.add(t.getQty()); | 57 | numQty = numQty.add(t.getQty()); |
60 | o.setQty(numQty); | 58 | o.setQty(numQty); |
61 | } | 59 | } |
@@ -65,16 +63,15 @@ public class InventoryMaterialSummaryServiceImpl extends ServiceImpl<InventoryMa | @@ -65,16 +63,15 @@ public class InventoryMaterialSummaryServiceImpl extends ServiceImpl<InventoryMa | ||
65 | //多条件去重 | 63 | //多条件去重 |
66 | List<InventoryMaterialSummary> materialSummaryList = new ArrayList<>(); | 64 | List<InventoryMaterialSummary> materialSummaryList = new ArrayList<>(); |
67 | inventoryMaterialSummaryList.stream().collect(Collectors.collectingAndThen( | 65 | inventoryMaterialSummaryList.stream().collect(Collectors.collectingAndThen( |
68 | - Collectors.toCollection(() -> new TreeSet<>( | ||
69 | - Comparator.comparing( | ||
70 | - inventoryMaterialSummary -> | ||
71 | - inventoryMaterialSummary.getCompanyCode() + ";" + inventoryMaterialSummary.getMaterialCode() + ";" + inventoryMaterialSummary.getZoneCode()))), | ||
72 | - ArrayList::new)) | 66 | + Collectors.toCollection(() -> new TreeSet<>( |
67 | + Comparator.comparing( | ||
68 | + inventoryMaterialSummary -> | ||
69 | + inventoryMaterialSummary.getCompanyCode() + ";" + inventoryMaterialSummary.getMaterialCode() + ";" + inventoryMaterialSummary.getZoneCode()))), | ||
70 | + ArrayList::new)) | ||
73 | .forEach(list -> materialSummaryList.add(list)); | 71 | .forEach(list -> materialSummaryList.add(list)); |
74 | 72 | ||
75 | return materialSummaryList; | 73 | return materialSummaryList; |
76 | } | 74 | } |
77 | 75 | ||
78 | 76 | ||
79 | - | ||
80 | } | 77 | } |