add qa status online and in header

po-online-status
usama.jameel 2025-06-04 15:32:26 +05:00
parent c8bffbb24a
commit a0aa80ba8c
6 changed files with 34 additions and 26 deletions

View File

@ -32,7 +32,7 @@ public class FinishedItemDAO {
private final String SELECT_BY_TERM_FOR_PACKAGING = String.format("SELECT * FROM %s WHERE barcode LIKE :term AND is_segregated = :is_segregated AND qa_status = :qa_status AND is_packed = FALSE AND is_store = FALSE ORDER BY ID DESC", TABLE_NAME); private final String SELECT_BY_TERM_FOR_PACKAGING = String.format("SELECT * FROM %s WHERE barcode LIKE :term AND is_segregated = :is_segregated AND qa_status = :qa_status AND is_packed = FALSE AND is_store = FALSE ORDER BY ID DESC", TABLE_NAME);
private final String SELECT_BY_STITCHED_ITEM_ID = String.format("SELECT * FROM %s WHERE stitched_item_id = :stitched_item_id AND is_packed = FALSE", TABLE_NAME); private final String SELECT_BY_STITCHED_ITEM_ID = String.format("SELECT * FROM %s WHERE stitched_item_id = :stitched_item_id AND is_packed = FALSE", TABLE_NAME);
private final String SELECT_BY_STITCHED_ITEM_IDS = String.format("SELECT * FROM %s WHERE stitched_item_id IN (:stitched_item_ids)", TABLE_NAME); private final String SELECT_BY_STITCHED_ITEM_IDS = String.format("SELECT * FROM %s WHERE stitched_item_id IN (:stitched_item_ids)", TABLE_NAME);
private final String COUNT_TOTAL_FINISH_ITEM = String.format("SELECT COUNT(*) FROM %s WHERE job_card_id = :job_card_id AND is_qa = TRUE AND (is_packed IS TRUE OR is_store = TRUE) ", TABLE_NAME); private final String COUNT_TOTAL_FINISH_ITEM = String.format("SELECT COUNT(*) FROM %s WHERE job_card_id = :job_card_id AND is_qa = TRUE AND (is_segregated IS TRUE OR is_store = TRUE) ", TABLE_NAME);
private final String SELECT_BY_JOB_CARD_AND_DATE = String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id AND (:start_date IS NULL OR :end_date IS NULL OR created_at BETWEEN :start_date AND :end_date)", TABLE_NAME); private final String SELECT_BY_JOB_CARD_AND_DATE = String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id AND (:start_date IS NULL OR :end_date IS NULL OR created_at BETWEEN :start_date AND :end_date)", TABLE_NAME);
private final String SELECT_BY_DATE_QA_STATUS = String.format( "SELECT COUNT(*) FROM %s WHERE (:start_date IS NULL OR operation_date >= :start_date) AND operation_date <= :end_date AND qa_status = :qa_status AND id in (:ids) AND is_packed = FALSE AND is_qa = TRUE", TABLE_NAME ); private final String SELECT_BY_DATE_QA_STATUS = String.format( "SELECT COUNT(*) FROM %s WHERE (:start_date IS NULL OR operation_date >= :start_date) AND operation_date <= :end_date AND qa_status = :qa_status AND id in (:ids) AND is_packed = FALSE AND is_qa = TRUE", TABLE_NAME );

View File

@ -20,6 +20,7 @@ public class POsDetails {
private long totalAGradeItem; private long totalAGradeItem;
private long totalBGradeItem; private long totalBGradeItem;
private long totalCGradeItem; private long totalCGradeItem;
private boolean poStatus;
public long getPoQuantity() { public long getPoQuantity() {
return poQuantity; return poQuantity;
@ -149,6 +150,14 @@ public class POsDetails {
this.poRequiredQuantity = poRequiredQuantity; this.poRequiredQuantity = poRequiredQuantity;
} }
public boolean isPoStatus() {
return poStatus;
}
public void setPoStatus(boolean poStatus) {
this.poStatus = poStatus;
}
@Override @Override
public String toString() { public String toString() {
return "POsDetails{" + return "POsDetails{" +

View File

@ -275,9 +275,6 @@ public class ReportingService {
.map(item -> Optional.ofNullable(item.getActualProduction()).orElse(BigDecimal.ZERO)) .map(item -> Optional.ofNullable(item.getActualProduction()).orElse(BigDecimal.ZERO))
.reduce(BigDecimal.ZERO, BigDecimal::add); .reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal expectedProduction = jobCardItems.stream()
.map(item -> Optional.ofNullable(item.getExpectedProduction()).orElse(BigDecimal.ZERO))
.reduce(BigDecimal.ZERO, BigDecimal::add);
if(actualProduction.compareTo(totalProduction) == 0) { if(actualProduction.compareTo(totalProduction) == 0) {
phasePending.put("Stitching Total Time", null); phasePending.put("Stitching Total Time", null);
}else { }else {
@ -486,6 +483,7 @@ public class ReportingService {
pOsDetails.setTotalStitching(qaProgressItems); pOsDetails.setTotalStitching(qaProgressItems);
pOsDetails.setTotalEndLineQC(qaProgressItems.intValue()); pOsDetails.setTotalEndLineQC(qaProgressItems.intValue());
pOsDetails.setTotalFinishing(totalFinishItem); pOsDetails.setTotalFinishing(totalFinishItem);
pOsDetails.setPoStatus(false);
pOsDetails.setRemainingCutting(pos.getPurchaseOrderQuantityRequired() - actualProduction.intValue()); pOsDetails.setRemainingCutting(pos.getPurchaseOrderQuantityRequired() - actualProduction.intValue());
pOsDetails.setRemainingStitching(pos.getPurchaseOrderQuantityRequired() - qaProgressItems); pOsDetails.setRemainingStitching(pos.getPurchaseOrderQuantityRequired() - qaProgressItems);
@ -513,7 +511,6 @@ public class ReportingService {
List<Bundle> bundles = bundleDAO.findByCardIdAndDATE(jobCard.getId(),startDate,endDate); List<Bundle> bundles = bundleDAO.findByCardIdAndDATE(jobCard.getId(),startDate,endDate);
List<StitchingOfflineItem> stitchingOfflineItems = stitchingOfflineItemDAO.findByJobCardIdAndDate(jobCard.getId(),startDate,endDate); List<StitchingOfflineItem> stitchingOfflineItems = stitchingOfflineItemDAO.findByJobCardIdAndDate(jobCard.getId(),startDate,endDate);
List<FinishedItem> finishedItems = finishedItemDAO.calculateTotalFinishItem(jobCard.getId(),startDate,endDate); List<FinishedItem> finishedItems = finishedItemDAO.calculateTotalFinishItem(jobCard.getId(),startDate,endDate);
List<InventoryTransactionLeg> inventoryTransactionLegs = inventoryTransactionLegDAO.getTransactionByJobCardAndDatesAndTypeAndAccountID(jobCard.getId(),startDate,endDate,"IN", gradingAccounts);
//cutting days wise //cutting days wise
BigDecimal cutting = bundles.stream() BigDecimal cutting = bundles.stream()
@ -525,26 +522,21 @@ public class ReportingService {
//total qa //total qa
Integer qa = finishedItems.size(); Integer qa = finishedItems.size();
Map<String, Integer> segregateItems = inventoryTransactionLegs.stream() Map<String, Integer> segregateItems = finishedItems.stream()
.filter(leg -> inventoryAccounts.stream() .collect(Collectors.groupingBy(
.anyMatch(account -> (int) account.getId() == (leg.getAccountId()))) FinishedItem::getQaStatus,
.collect(Collectors.toMap( Collectors.collectingAndThen(
leg -> inventoryAccounts.stream() Collectors.counting(),
.filter(account -> (int) account.getId() == (leg.getAccountId())) Long::intValue
.findFirst() )
.map(InventoryAccount::getTitle)
.orElse("Unknown"),
leg -> leg.getQuantity().intValue(),
Integer::sum,
HashMap::new
)); ));
Map<String, Integer> items = getCompleteProduction(String.valueOf(jobCard.getId())); Map<String, Integer> items = getCompleteProduction(String.valueOf(jobCard.getId()));
items.put("Cutting Progress",cutting.intValue()); items.put("Cutting Progress",cutting.intValue());
items.put("Stitching Progress",stitching); items.put("Stitching Progress",stitching);
items.put("QA Progress",qa); items.put("QA Progress",qa);
items.put("A Grade",segregateItems.get("A GRADE") != null ? segregateItems.get("A GRADE") : 0); items.put("A Grade",segregateItems.get("APPROVED") != null ? segregateItems.get("APPROVED") : 0);
items.put("B Grade",segregateItems.get("B GRADE") != null ? segregateItems.get("B GRADE") : 0); items.put("B Grade / Reject",segregateItems.get("REJECT") != null ? segregateItems.get("REJECT") : 0);
items.put("C Grade",segregateItems.get("C GRADE") != null ? segregateItems.get("C GRADE") : 0);
// Define sorting order // Define sorting order
Map<String, Integer> indexMap = new HashMap<>(); Map<String, Integer> indexMap = new HashMap<>();
@ -553,9 +545,8 @@ public class ReportingService {
indexMap.put("Stitching Progress", 3); indexMap.put("Stitching Progress", 3);
indexMap.put("QA Progress", 4); indexMap.put("QA Progress", 4);
indexMap.put("Finishing Progress", 5); indexMap.put("Finishing Progress", 5);
indexMap.put("A GRADE", 6); indexMap.put("APPROVED", 6);
indexMap.put("B GRADE", 7); indexMap.put("REJECT", 7);
indexMap.put("C GRADE", 8);
// Sort items based on indexMap order // Sort items based on indexMap order
Map<String, Integer> sortedItems = items.entrySet() Map<String, Integer> sortedItems = items.entrySet()

View File

@ -193,8 +193,6 @@
</div> </div>
</div> </div>
</div> </div>
</main> </main>
</div> </div>
<script> <script>

View File

@ -46,7 +46,10 @@
</tr> </tr>
<tr> <tr>
<td class="align-middle" style="border: 1px solid black;"><i>PO Status</i></td> <td class="align-middle" style="border: 1px solid black;"><i>PO Status</i></td>
<td style="border: 1px solid black;"><span th:text="'OPEN'"></span></td> <td style="border: 1px solid black;">
<span th:if="*{poDetail.isPoStatus}" th:text="'CLOSE'"></span>
<span th:if="*{!poDetail.isPoStatus}" th:text="'OPEN'"></span>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -27,6 +27,8 @@
<th>Finishing Items Balance</th> <th>Finishing Items Balance</th>
<th>A Grade Items</th> <th>A Grade Items</th>
<th>Reject Items In Store</th> <th>Reject Items In Store</th>
<th>PO Status</th>
<th>Generate PDF</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -47,6 +49,10 @@
<td th:text="${poDetail.remainingFinishing}"></td> <td th:text="${poDetail.remainingFinishing}"></td>
<td th:text="${poDetail.totalAGradeItem}"></td> <td th:text="${poDetail.totalAGradeItem}"></td>
<td th:text="${poDetail.totalBGradeItem}"></td> <td th:text="${poDetail.totalBGradeItem}"></td>
<td>
<span class="badge font-sm badge-danger" th:if="*{poDetail.poStatus}" th:text="'CLOSE'"></span>
<span class="badge font-sm badge-ACTIVE" th:if="*{!poDetail.poStatus}" th:text="'OPEN'"></span>
</td>
<td> <td>
<form th:action="@{/po-status/generate-po-pdf}" method="get" target="_blank" <form th:action="@{/po-status/generate-po-pdf}" method="get" target="_blank"
th:id="'form-' + ${poDetail.poId}"> th:id="'form-' + ${poDetail.poId}">
@ -66,6 +72,7 @@
<input type="hidden" name="remainingFinishing" th:value="${poDetail.remainingFinishing}"/> <input type="hidden" name="remainingFinishing" th:value="${poDetail.remainingFinishing}"/>
<input type="hidden" name="totalAGradeItem" th:value="${poDetail.totalAGradeItem}"/> <input type="hidden" name="totalAGradeItem" th:value="${poDetail.totalAGradeItem}"/>
<input type="hidden" name="totalBGradeItem" th:value="${poDetail.totalBGradeItem}"/> <input type="hidden" name="totalBGradeItem" th:value="${poDetail.totalBGradeItem}"/>
<input type="hidden" name="poStatus" th:value="${poDetail.poStatus}"/>
<!-- Link styled as a button --> <!-- Link styled as a button -->
<a href="javascript:void(0);" <a href="javascript:void(0);"