set naming convention and add receive inventory in packaging phase
parent
cef37b40e6
commit
35102e0b3d
|
@ -32,8 +32,9 @@ public class ReportingService {
|
||||||
private final FinishedItemDAO finishedItemDAO;
|
private final FinishedItemDAO finishedItemDAO;
|
||||||
private final StitchingOfflineItemDAO stitchingOfflineItemDAO;
|
private final StitchingOfflineItemDAO stitchingOfflineItemDAO;
|
||||||
private final InventoryAccountDAO inventoryAccountDAO;
|
private final InventoryAccountDAO inventoryAccountDAO;
|
||||||
|
private final PackagingItemsDAO packagingItemsDAO;
|
||||||
|
|
||||||
public ReportingService( JobCardItemDAO jobCardItemDAO, ProcessDAO processDAO, BundleDAO bundleDAO, InventoryTransactionLegDAO inventoryTransactionLegDAO, InventoryTransactionDAO inventoryTransactionDAO, JobCardDAO jobCardDAO, CryptographyService cryptographyService, MasterBundleDAO masterBundleDAO, FinishedItemDAO finishedItemDAO, StitchingOfflineItemDAO stitchingOfflineItemDAO, InventoryAccountDAO inventoryAccountDAO) {
|
public ReportingService(JobCardItemDAO jobCardItemDAO, ProcessDAO processDAO, BundleDAO bundleDAO, InventoryTransactionLegDAO inventoryTransactionLegDAO, InventoryTransactionDAO inventoryTransactionDAO, JobCardDAO jobCardDAO, CryptographyService cryptographyService, MasterBundleDAO masterBundleDAO, FinishedItemDAO finishedItemDAO, StitchingOfflineItemDAO stitchingOfflineItemDAO, InventoryAccountDAO inventoryAccountDAO, PackagingItemsDAO packagingItemsDAO) {
|
||||||
this.jobCardItemDAO = jobCardItemDAO;
|
this.jobCardItemDAO = jobCardItemDAO;
|
||||||
this.processDAO = processDAO;
|
this.processDAO = processDAO;
|
||||||
this.bundleDAO = bundleDAO;
|
this.bundleDAO = bundleDAO;
|
||||||
|
@ -45,6 +46,7 @@ public class ReportingService {
|
||||||
this.finishedItemDAO = finishedItemDAO;
|
this.finishedItemDAO = finishedItemDAO;
|
||||||
this.stitchingOfflineItemDAO = stitchingOfflineItemDAO;
|
this.stitchingOfflineItemDAO = stitchingOfflineItemDAO;
|
||||||
this.inventoryAccountDAO = inventoryAccountDAO;
|
this.inventoryAccountDAO = inventoryAccountDAO;
|
||||||
|
this.packagingItemsDAO = packagingItemsDAO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Integer> getJobCardProgress(String jobCardID) {
|
public Map<String, Integer> getJobCardProgress(String jobCardID) {
|
||||||
|
@ -213,8 +215,14 @@ public class ReportingService {
|
||||||
HashMap<String,Integer> gradingItems = new HashMap<>();
|
HashMap<String,Integer> gradingItems = new HashMap<>();
|
||||||
List<InventoryAccount> inventoryAccounts = inventoryAccountDAO.getPackagingAccounts();
|
List<InventoryAccount> inventoryAccounts = inventoryAccountDAO.getPackagingAccounts();
|
||||||
List<FinishedItem> finishedItems = finishedItemDAO.findByJobCardId(Long.parseLong(jobCardID));
|
List<FinishedItem> finishedItems = finishedItemDAO.findByJobCardId(Long.parseLong(jobCardID));
|
||||||
|
List<PackagingItems> packagingItems = packagingItemsDAO.findByJobCardId(Long.parseLong(jobCardID));
|
||||||
|
|
||||||
List<Long> finishItemsIds = finishedItems.stream()
|
List<Long> finishItemsIds = finishedItems.stream()
|
||||||
.map(FinishedItem::getId).collect(Collectors.toList());
|
.map(FinishedItem::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<Long> packagingItemsIds = packagingItems.stream()
|
||||||
|
.map(PackagingItems::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
if (finishItemsIds.isEmpty()){
|
if (finishItemsIds.isEmpty()){
|
||||||
gradingItems.put("A GRADE",0);
|
gradingItems.put("A GRADE",0);
|
||||||
gradingItems.put("B GRADE",0);
|
gradingItems.put("B GRADE",0);
|
||||||
|
@ -222,8 +230,13 @@ public class ReportingService {
|
||||||
return gradingItems;
|
return gradingItems;
|
||||||
}else {
|
}else {
|
||||||
for (InventoryAccount inventoryAccount : inventoryAccounts){
|
for (InventoryAccount inventoryAccount : inventoryAccounts){
|
||||||
long totalGradingItems = inventoryTransactionLegDAO.CalculateTotalGradingItems(finishItemsIds,(int) inventoryAccount.getId());
|
if (inventoryAccount.getIsPackaging()){
|
||||||
gradingItems.put(inventoryAccount.getTitle(), (int) totalGradingItems);
|
long totalGradingItems = inventoryTransactionLegDAO.CalculateTotalGradingItems(packagingItemsIds,(int) inventoryAccount.getId());
|
||||||
|
gradingItems.put(inventoryAccount.getTitle(), (int) totalGradingItems);
|
||||||
|
}else {
|
||||||
|
long totalGradingItems = inventoryTransactionLegDAO.CalculateTotalGradingItems(finishItemsIds,(int) inventoryAccount.getId());
|
||||||
|
gradingItems.put(inventoryAccount.getTitle(), (int) totalGradingItems);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return gradingItems;
|
return gradingItems;
|
||||||
}
|
}
|
||||||
|
@ -371,6 +384,8 @@ public class ReportingService {
|
||||||
if (jobCardID == null) {
|
if (jobCardID == null) {
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
|
List<InventoryAccount> inventoryAccounts = inventoryAccountDAO.findByParentEntityTypeAndParentId("PROCESS",6L);
|
||||||
|
|
||||||
List<JobCardItem> jobCardItems = jobCardItemDAO.findByCardId(Long.parseLong(jobCardID));
|
List<JobCardItem> jobCardItems = jobCardItemDAO.findByCardId(Long.parseLong(jobCardID));
|
||||||
BigDecimal actualProduction = jobCardItems.stream()
|
BigDecimal actualProduction = jobCardItems.stream()
|
||||||
.map(item -> Optional.ofNullable(item.getActualProduction()).orElse(BigDecimal.ZERO))
|
.map(item -> Optional.ofNullable(item.getActualProduction()).orElse(BigDecimal.ZERO))
|
||||||
|
@ -426,7 +441,8 @@ public class ReportingService {
|
||||||
qualityList.set(index, 0);
|
qualityList.set(index, 0);
|
||||||
}
|
}
|
||||||
qualityList.set(index, qualityList.get(index) + leg.getQuantity().intValue());
|
qualityList.set(index, qualityList.get(index) + leg.getQuantity().intValue());
|
||||||
}else if ("FINISHED_ITEM".equals(leg.getParentDocumentType()) && (leg.getAccountId().equals(8) || leg.getAccountId().equals(9) || leg.getAccountId().equals(10))) {
|
}
|
||||||
|
else if ("PACKAGING".equals(leg.getParentDocumentType()) && inventoryAccounts.stream().anyMatch(e -> e.getId() == leg.getAccountId().longValue())) {
|
||||||
if (index == 0 || !dateIndexMap.containsKey(dateKey)) {
|
if (index == 0 || !dateIndexMap.containsKey(dateKey)) {
|
||||||
finishItems.set(index, 0);
|
finishItems.set(index, 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue