dashbaord
parent
a1446670f5
commit
437fcc8fb2
|
@ -3,6 +3,7 @@ package com.utopiaindustries.controller;
|
|||
import com.utopiaindustries.service.DashboardService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.ui.Model;
|
||||
|
||||
|
@ -18,9 +19,9 @@ public class DashboardController {
|
|||
this.dashboardService = dashboardService;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public String getDashboard(Model model) {
|
||||
model.addAttribute("phases", dashboardService.getPhasesProgressDayWise());
|
||||
@GetMapping("/{lineNumber}")
|
||||
public String getDashboard(@PathVariable("lineNumber") int lineNumber, Model model) {
|
||||
model.addAttribute("phases", dashboardService.getPhasesProgressDayWise(lineNumber));
|
||||
model.addAttribute("date", LocalDate.now());
|
||||
model.addAttribute("day", LocalDate.now().getDayOfWeek());
|
||||
model.addAttribute("line", "Line 1" );
|
||||
|
|
|
@ -24,7 +24,7 @@ public class FinishedItemDAO {
|
|||
private final String SELECT_QUERY_BY_BARCODE_QA_STATUS = String.format("SELECT case when EXISTS ( SELECT * FROM %s WHERE barcode = :barcode AND (qa_status = 'APPROVED' OR qa_status = 'WASHED') ) then true else false End as Result", TABLE_NAME);
|
||||
private final String SELECT_QUERY_BY_JOB_CARD = String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id", TABLE_NAME);
|
||||
private final String DELETE_QUERY = String.format("DELETE FROM %s WHERE id = :id", TABLE_NAME);
|
||||
private final String INSERT_QUERY = String.format("INSERT INTO %s (id, item_id, sku, barcode, created_at, created_by, job_card_id, is_qa, stitched_item_id, is_segregated, qa_status, is_packed) VALUES (:id, :item_id, :sku, :barcode, :created_at, :created_by, :job_card_id, :is_qa, :stitched_item_id, :is_segregated, :qa_status, :is_packed) ON DUPLICATE KEY UPDATE item_id = VALUES(item_id), sku = VALUES(sku), barcode = VALUES(barcode), created_at = VALUES(created_at), created_by = VALUES(created_by), job_card_id = VALUES(job_card_id), is_qa = VALUES(is_qa), stitched_item_id = VALUES(stitched_item_id), is_segregated = VALUES(is_segregated), qa_status = VALUES(qa_status), is_packed = VALUES(is_packed)", TABLE_NAME);
|
||||
private final String INSERT_QUERY = String.format("INSERT INTO %s (id, item_id, sku, barcode, created_at, created_by, job_card_id, is_qa, stitched_item_id, is_segregated, qa_status, is_packed, operation_date) VALUES (:id, :item_id, :sku, :barcode, :created_at, :created_by, :job_card_id, :is_qa, :stitched_item_id, :is_segregated, :qa_status, :is_packed, :operation_date) ON DUPLICATE KEY UPDATE item_id = VALUES(item_id), sku = VALUES(sku), barcode = VALUES(barcode), created_at = VALUES(created_at), created_by = VALUES(created_by), job_card_id = VALUES(job_card_id), is_qa = VALUES(is_qa), stitched_item_id = VALUES(stitched_item_id), is_segregated = VALUES(is_segregated), qa_status = VALUES(qa_status), is_packed = VALUES(is_packed), operation_date = VALUES(operation_date) ", TABLE_NAME);
|
||||
private final String SELECT_BY_LIMIT = String.format("SELECT * FROM %s ORDER BY id DESC LIMIT :limit", TABLE_NAME);
|
||||
private final String SELECT_BY_IDS = String.format("SELECT * FROM %s WHERE id IN (:ids)", TABLE_NAME);
|
||||
private final String FIND_TOTAL_COUNT = String.format("SELECT COUNT(*) FROM %s where job_card_id = :job_card_id And item_id = :item_id", TABLE_NAME);
|
||||
|
@ -34,7 +34,7 @@ public class FinishedItemDAO {
|
|||
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_segregated IS 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_DATE = String.format( "SELECT * FROM %s WHERE created_at >=:start_date AND created_at <= :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", TABLE_NAME );
|
||||
|
||||
public FinishedItemDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
|
||||
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
|
||||
|
@ -54,7 +54,8 @@ public class FinishedItemDAO {
|
|||
.addValue("stitched_item_id", finishedItem.getStitchedItemId())
|
||||
.addValue("is_segregated", finishedItem.getIsSegregated())
|
||||
.addValue("qa_status", finishedItem.getQaStatus())
|
||||
.addValue("is_packed", finishedItem.isPackaging());
|
||||
.addValue("is_packed", finishedItem.isPackaging())
|
||||
.addValue("operation_date", finishedItem.getOperationDate());
|
||||
return params;
|
||||
}
|
||||
|
||||
|
@ -195,11 +196,13 @@ public class FinishedItemDAO {
|
|||
return namedParameterJdbcTemplate.query(SELECT_BY_JOB_CARD_AND_DATE, params, new FinishedItemRowMapper());
|
||||
}
|
||||
|
||||
public List<FinishedItem> findByDate(String startDate, String endDate){
|
||||
public Long findByOperationDoneDate(String startDate, String endDate, String qaStatus){
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
params.addValue( "start_date", startDate );
|
||||
params.addValue( "end_date", endDate );
|
||||
return namedParameterJdbcTemplate.query( SELECT_BY_DATE , params, new FinishedItemRowMapper() );
|
||||
params.addValue( "qa_status", qaStatus );
|
||||
Long count = namedParameterJdbcTemplate.queryForObject(SELECT_BY_DATE_QA_STATUS, params, Long.class);
|
||||
return count != null ? count : 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -16,6 +16,9 @@ public class FinishedItemRowMapper implements RowMapper<FinishedItem> {
|
|||
if ( rs.getTimestamp( "created_at" ) != null ) {
|
||||
finishedItem.setCreatedAt( rs.getTimestamp( "created_at" ).toLocalDateTime() );
|
||||
}
|
||||
if ( rs.getTimestamp( "operation_date" ) != null ) {
|
||||
finishedItem.setOperationDate( rs.getTimestamp( "operation_date" ).toLocalDateTime() );
|
||||
}
|
||||
finishedItem.setCreatedBy( rs.getString( "created_by" ) );
|
||||
finishedItem.setJobCardId( rs.getLong("job_card_id") );
|
||||
finishedItem.setIsQa( rs.getBoolean("is_qa"));
|
||||
|
|
|
@ -48,7 +48,7 @@ public class InventoryTransactionLegDAO {
|
|||
private final String COUNT_TOTAL_SEGREGATE_ITEMS = String.format("SELECT COUNT(*) FROM %s WHERE parent_document_id IN (:parent_document_id) AND account_id = :account_id", TABLE_NAME);
|
||||
private final String SELECT_FIRST_TRANSACTION_PARENT_TYPE_PARENT_ID = String.format("SELECT * FROM %s WHERE parent_document_id IN (:parent_document_id) AND parent_document_type = :parent_document_type ORDER BY transaction_leg_datetime ASC LIMIT 1", TABLE_NAME);
|
||||
private final String SELECT_GROUP_By_TRANSACTION_PARENT_TYPE_PARENT_ID = String.format("SELECT * FROM %s WHERE parent_document_id IN (:parent_document_id) AND parent_document_type = :parent_document_type GROUP BY account_id", TABLE_NAME);
|
||||
private final String SELECT_GROUP_By_TRANSACTION_ACCOUNT_IDS_DATE = String.format("SELECT * FROM %s WHERE account_id IN (:account_ids) AND (:start_date IS NULL OR :end_date IS NULL OR transaction_leg_datetime BETWEEN :start_date AND :end_date) GROUP BY parent_document_id", TABLE_NAME);
|
||||
private final String SELECT_TRANSACTIONS_REMAINING = String.format("SELECT parent_document_id as parentIds FROM %s WHERE account_id = :account_id AND parent_document_type = :parent_document_type AND type = 'IN' AND parent_document_id NOT IN (SELECT parent_document_id FROM %s WHERE account_id = :account_id AND parent_document_type = :parent_document_type AND type = 'OUT')", TABLE_NAME, TABLE_NAME);
|
||||
private final String SELECT_JOB_CARD_DATES = String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id AND (:start_date IS NULL OR :end_date IS NULL OR transaction_leg_datetime BETWEEN :start_date AND :end_date) AND type = :type ", TABLE_NAME);
|
||||
private final String SELECT_JOB_CARD_And_Date_Type_Account_Id = String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id AND (:start_date IS NULL OR :end_date IS NULL OR transaction_leg_datetime BETWEEN :start_date AND :end_date) AND type = :type AND account_id IN (:account_ids)", TABLE_NAME);
|
||||
|
||||
|
@ -220,11 +220,10 @@ public class InventoryTransactionLegDAO {
|
|||
return namedParameterJdbcTemplate.query( SELECT_JOB_CARD_And_Date_Type_Account_Id , params, new InventoryTransactionLegRowMapper() );
|
||||
}
|
||||
|
||||
public List<InventoryTransactionLeg> getTransactionByAndDatesAndAccountID(String startDate, String endDate, List<Integer> accountId){
|
||||
public List<Long> getParentIDsOFRemainingINVENTORY(String parentType, Integer accountId){
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
params.addValue("start_date", startDate );
|
||||
params.addValue("end_date", endDate );
|
||||
params.addValue("account_ids", accountId );
|
||||
return namedParameterJdbcTemplate.query( SELECT_GROUP_By_TRANSACTION_ACCOUNT_IDS_DATE , params, new InventoryTransactionLegRowMapper() );
|
||||
params.addValue("account_id", accountId );
|
||||
params.addValue("parent_document_type", parentType );
|
||||
return namedParameterJdbcTemplate.queryForList( SELECT_TRANSACTIONS_REMAINING , params, Long.class );
|
||||
}
|
||||
}
|
|
@ -33,7 +33,8 @@ public class StitchingOfflineItemDAO {
|
|||
private final String COUNT_TOTAL_QA_ITEMS= String.format("SELECT COUNT(*) FROM %s WHERE job_card_id = :job_card_id AND is_qa IS TRUE",TABLE_NAME);
|
||||
private final String SELECT_BY_TIME_AND_CARD_ID= String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id ORDER BY created_at DESC LIMIT 1;",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 = String.format( "SELECT * FROM %s WHERE qc_done_at >=:start_date AND qc_done_at <= :end_date", TABLE_NAME );
|
||||
private final String SELECT_BY_DATE_QA_STATUS = String.format( "SELECT COUNT(*) FROM %s WHERE (:start_date IS NULL OR qc_done_at >= :start_date) AND qc_done_at <= :end_date AND qa_status = :qa_status AND id IN (:ids)", TABLE_NAME );
|
||||
private final String SELECT_BY_DATE_QA_STATUS_APPROVED= String.format( "SELECT COUNT(*) FROM %s WHERE (:start_date IS NULL OR qc_done_at >= :start_date) AND qc_done_at <= :end_date AND qa_status = :qa_status", TABLE_NAME );
|
||||
|
||||
public StitchingOfflineItemDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
|
||||
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
|
||||
|
@ -173,10 +174,21 @@ public class StitchingOfflineItemDAO {
|
|||
return namedParameterJdbcTemplate.query( SELECT_BY_JOB_CARD_AND_DATE , params, new StitchingOfflineItemRowMapper() );
|
||||
}
|
||||
|
||||
public List<StitchingOfflineItem> findByQCDoneDate(String startDate, String endDate){
|
||||
public Long findByQCDoneDate(String startDate, String endDate, String qaStatus, List<Long> ids){
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
params.addValue( "start_date", startDate );
|
||||
params.addValue( "end_date", endDate );
|
||||
return namedParameterJdbcTemplate.query( SELECT_BY_DATE , params, new StitchingOfflineItemRowMapper() );
|
||||
params.addValue( "qa_status", qaStatus );
|
||||
params.addValue( "ids", ids);
|
||||
Long count = namedParameterJdbcTemplate.queryForObject(SELECT_BY_DATE_QA_STATUS, params, Long.class);
|
||||
return count != null ? count : 0;
|
||||
}
|
||||
public Long findByQCDoneDateApproved(String startDate, String endDate, String qaStatus){
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
params.addValue( "start_date", startDate );
|
||||
params.addValue( "end_date", endDate );
|
||||
params.addValue( "qa_status", qaStatus );
|
||||
Long count = namedParameterJdbcTemplate.queryForObject(SELECT_BY_DATE_QA_STATUS_APPROVED, params, Long.class);
|
||||
return count != null ? count : 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@ public class FinishedItem implements InventoryArtifact {
|
|||
private String qaStatus;
|
||||
private boolean isPackaging;
|
||||
|
||||
@DateTimeFormat( pattern = "yyyy-MM-dd HH:mm:ss" )
|
||||
private LocalDateTime operationDate;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
|
@ -163,6 +165,14 @@ public class FinishedItem implements InventoryArtifact {
|
|||
isPackaging = packaging;
|
||||
}
|
||||
|
||||
public LocalDateTime getOperationDate() {
|
||||
return operationDate;
|
||||
}
|
||||
|
||||
public void setOperationDate(LocalDateTime operationDate) {
|
||||
this.operationDate = operationDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FinishedItem{" +
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.utopiaindustries.dao.ctp.*;
|
|||
import com.utopiaindustries.model.ctp.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
@ -42,13 +43,13 @@ public class DashboardService {
|
|||
this.packagingItemsDAO = packagingItemsDAO;
|
||||
}
|
||||
|
||||
public Map<String, Float> getPhasesProgressDayWise() {
|
||||
public Map<String, Float> getPhasesProgressDayWise(int lineNo) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
String cuttingAccount = "CUTTING ACCOUNT " +1;
|
||||
String stitchingAccount = "STITCHING ACCOUNT " +1;
|
||||
String finishingAccount = "FINISHING ACCOUNT " +1;
|
||||
String packagingAccount = "A GRADE ACCOUNT " +1;
|
||||
String cuttingAccount = "CUTTING ACCOUNT " + lineNo;
|
||||
String stitchingAccount = "STITCHING ACCOUNT " + lineNo;
|
||||
String finishingAccount = "FINISHING ACCOUNT " + lineNo;
|
||||
String packagingAccount = "A GRADE ACCOUNT " + lineNo;
|
||||
|
||||
String startDate1 = LocalDateTime.now().withHour(0).withMinute(0).withSecond(1).format(formatter);
|
||||
String endDate1 = LocalDateTime.now().withHour(23).withMinute(59).withSecond(59).format(formatter);
|
||||
|
@ -58,61 +59,51 @@ public class DashboardService {
|
|||
|
||||
List<InventoryAccount> inventoryAccounts = inventoryAccountDAO.findAll();
|
||||
|
||||
List<Integer> inventoryAccountIds = inventoryAccounts.stream()
|
||||
Map<String, Integer> inventoryAccountMap = inventoryAccounts.stream()
|
||||
.filter(e -> cuttingAccount.equals(e.getTitle()) ||
|
||||
stitchingAccount.equals(e.getTitle()) ||
|
||||
finishingAccount.equals(e.getTitle()) ||
|
||||
packagingAccount.equals(e.getTitle()))
|
||||
.map(e -> (int) e.getId())
|
||||
.collect(Collectors.toList());
|
||||
.collect(Collectors.toMap(InventoryAccount::getTitle, e -> (int) e.getId()));
|
||||
|
||||
|
||||
List<InventoryTransactionLeg> inventoryTransactionLeg = inventoryTransactionLegDAO.getTransactionByAndDatesAndAccountID(startDate1, endDate1, inventoryAccountIds);
|
||||
|
||||
List<Long> stitchingItemIds = inventoryTransactionLegDAO.getParentIDsOFRemainingINVENTORY( "STITCHING_OFFLINE",inventoryAccountMap.get(stitchingAccount));
|
||||
List<Long> alterationByFinishing = inventoryTransactionLegDAO.getParentIDsOFRemainingINVENTORY( "FINISHED_ITEM",inventoryAccountMap.get(stitchingAccount));
|
||||
|
||||
List<StitchingOfflineItem> stitchingOfflineItems =stitchingOfflineItemDAO.findByQCDoneDate(startDate1, endDate1);
|
||||
Long approvedStitchingOfflineItems = 0L;
|
||||
Long qcReject = 0L;
|
||||
if (stitchingItemIds != null && !stitchingItemIds.isEmpty()){
|
||||
approvedStitchingOfflineItems = stitchingOfflineItemDAO.findByQCDoneDateApproved(startDate1, endDate1, "APPROVED");
|
||||
qcReject = stitchingOfflineItemDAO.findByQCDoneDate(null, endDate1, "REJECT",stitchingItemIds);
|
||||
}
|
||||
List<Long> finishedItem = inventoryTransactionLegDAO.getParentIDsOFRemainingINVENTORY( "FINISHED_ITEM",inventoryAccountMap.get(finishingAccount));
|
||||
|
||||
List<FinishedItem> finishedItems = finishedItemDAO.findByDate(startDate1, endDate1);
|
||||
List<PackagingItems> packagingItems = packagingItemsDAO.findByDate(startDate1, endDate1);
|
||||
List<Long> packagingItems = inventoryTransactionLegDAO.getParentIDsOFRemainingINVENTORY( "PACKAGING",inventoryAccountMap.get(packagingAccount));
|
||||
|
||||
float stitchingDefectedPiece = stitchingOfflineItems.stream()
|
||||
.filter(e -> "REJECT".equals(e.getQaStatus()))
|
||||
.count();
|
||||
Long approvedFinishedItem = 0L;
|
||||
Long alterFinishedItem = 0L;
|
||||
Long bGradeFinishedItem = 0L;
|
||||
Long rejectFinishedItem = 0L;
|
||||
Long washFinishedItem = 0L;
|
||||
if(packagingItems != null && !packagingItems.isEmpty() ){
|
||||
approvedFinishedItem = finishedItemDAO.findByOperationDoneDate(startDate1, endDate1,"APPROVED");
|
||||
bGradeFinishedItem = finishedItemDAO.findByOperationDoneDate(startDate1, endDate1,"B GRADE");
|
||||
rejectFinishedItem = finishedItemDAO.findByOperationDoneDate(startDate1, endDate1,"REJECT");
|
||||
washFinishedItem = finishedItemDAO.findByOperationDoneDate(startDate1, endDate1,"WASHED");
|
||||
|
||||
float finishedItemDefected = finishedItems.stream()
|
||||
.filter(e -> "ALTER".equals(e.getQaStatus()))
|
||||
.count();
|
||||
}
|
||||
|
||||
float finishedItem =finishedItems.stream()
|
||||
.filter(e -> "APPROVED".equals(e.getQaStatus()))
|
||||
.count();
|
||||
progress.put("Stitching",(float) approvedStitchingOfflineItems + qcReject + alterationByFinishing.size());
|
||||
progress.put("totalWips", (float) stitchingItemIds.size());
|
||||
progress.put("Alteration", (float) qcReject );
|
||||
|
||||
float finishedItemAGrade = packagingItems.size();
|
||||
progress.put("finishing", (float) approvedFinishedItem);
|
||||
progress.put("ALTER", (float) alterationByFinishing.size());
|
||||
progress.put("Reject",(float) rejectFinishedItem);
|
||||
progress.put("wash",(float) washFinishedItem);
|
||||
progress.put("packaging",(float) packagingItems.size() );
|
||||
|
||||
float finishedItemBGrade = finishedItems.stream()
|
||||
.filter(e -> "B GRADE".equals(e.getQaStatus()))
|
||||
.count();
|
||||
|
||||
float finishedItemCGrade = finishedItems.stream()
|
||||
.filter(e -> "C GRADE".equals(e.getQaStatus()))
|
||||
.count();
|
||||
|
||||
float finishDefectedPiece = finishedItemDefected + finishedItemBGrade + finishedItemCGrade;
|
||||
|
||||
progress.put("Stitching", (float) stitchingOfflineItems.size());
|
||||
progress.put("StitchingDefectPiece", stitchingDefectedPiece);
|
||||
progress.put("StitchingDefectPieceRatio", stitchingDefectedPiece / stitchingOfflineItems.size());
|
||||
|
||||
progress.put("finishing", (float) finishedItems.size());
|
||||
progress.put("finishingDefectPiece", finishDefectedPiece);
|
||||
progress.put("finishingDefectPieceRatio", finishDefectedPiece / finishedItems.size());
|
||||
|
||||
|
||||
progress.put("QA", (float) finishedItems.size());
|
||||
progress.put("Finishing", finishedItem);
|
||||
progress.put("A Grade", finishedItemAGrade);
|
||||
progress.put("B Grade", finishedItemBGrade);
|
||||
progress.put("C Grade", finishedItemCGrade);
|
||||
|
||||
return progress;
|
||||
}
|
||||
|
@ -125,7 +116,6 @@ public class DashboardService {
|
|||
String startDateWithHour = LocalDateTime.now().minusHours(1).format(formatter);
|
||||
String endDateWithHour =LocalDateTime.now().format(formatter);
|
||||
|
||||
|
||||
HashMap<String, String> details = new HashMap<>();
|
||||
List<PackagingItems> packagingItems = packagingItemsDAO.findByDate(startDate1, endDate1);
|
||||
List<PackagingItems> packagingItemsHourly = packagingItemsDAO.findByDate(startDateWithHour, endDateWithHour);
|
||||
|
@ -135,8 +125,8 @@ public class DashboardService {
|
|||
int achieved = packagingItems.size();
|
||||
|
||||
|
||||
details.put("Total Target", 1000 + " pc");
|
||||
details.put("Total Achieved", achieved + " pc");
|
||||
details.put("Shift Target", 1000 + " pc");
|
||||
details.put("Shift Achieved", achieved + " pc");
|
||||
details.put("Hourly Target", 1000/24 + " pc");
|
||||
details.put("Hourly Achieved", packagingItemsHourly.size() + " pc");
|
||||
details.put("Efficiency",(float)achieved / target * 100 + " %" );
|
||||
|
|
|
@ -528,7 +528,7 @@ public class InventoryService {
|
|||
if (lastInvTransaction != null) {
|
||||
// OUT
|
||||
long fromAccount = lastInvTransaction.getAccountId();
|
||||
createInventoryTransactionLeg(transaction, stitchingOfflineItem, fromAccount, InventoryTransactionLeg.Type.OUT.name(), InventoryArtifactType.FINISHED_ITEM.name());
|
||||
createInventoryTransactionLeg(transaction, preCreatedItem, fromAccount, InventoryTransactionLeg.Type.OUT.name(), InventoryArtifactType.FINISHED_ITEM.name());
|
||||
}
|
||||
preCreatedItem.setIsQa(true);
|
||||
finishedItemsForUlter.add(preCreatedItem);
|
||||
|
@ -536,14 +536,13 @@ public class InventoryService {
|
|||
finishedItems.add(preCreatedItem);
|
||||
}
|
||||
} else {
|
||||
|
||||
FinishedItem preCreatedItem = finishedItemDAO.findByStitchedItem(stitchingOfflineItem.getId());
|
||||
if (preCreatedItem != null) {
|
||||
preCreatedItem.setIsQa(false);
|
||||
finishedItemsForUlter.add(preCreatedItem);
|
||||
}
|
||||
}
|
||||
stitchingOfflineItem.setIsQa(true);
|
||||
stitchingOfflineItem.setIsQa(false);
|
||||
stitchingOfflineItem.setQaStatus(qaStatus);
|
||||
stitchingOfflineItem.setQcDoneAt(LocalDateTime.now());
|
||||
updatedStitchedItems.add(stitchingOfflineItem);
|
||||
|
@ -594,6 +593,7 @@ public class InventoryService {
|
|||
for (FinishedItem finishedItem : items) {
|
||||
InventoryTransactionLeg lastInvTransaction = lastFinishedItemIdInTransactionMap.getOrDefault(finishedItem.getId(), null);
|
||||
finishedItem.setIsQa(true);
|
||||
finishedItem.setOperationDate(LocalDateTime.now());
|
||||
|
||||
/*
|
||||
* item is approved and alter is selected then finished item will to stitching account
|
||||
|
@ -635,9 +635,9 @@ public class InventoryService {
|
|||
* item is not approved and C grade is selected then item remain in Finishing account because after
|
||||
* alteration item will be moved to A grade account for segregation
|
||||
* */
|
||||
if (status.equalsIgnoreCase("C GRADE")) {
|
||||
if (status.equalsIgnoreCase("REJECT")) {
|
||||
finishedItem.setIsSegregated(false);
|
||||
finishedItem.setQaStatus("C GRADE");
|
||||
finishedItem.setQaStatus("REJECT");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -136,16 +136,13 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||
}]
|
||||
});
|
||||
}
|
||||
function dashboardChart(divId, height, width, title, aHeading, aData, bHeading, bData, cHeading, cData, dHeading, dData, dates, fontSize, maxValue) {
|
||||
function dashboardChart(divId, height, width, title, aHeading, aData, bHeading, bData, cHeading, cData,dates, fontSize, maxValue) {
|
||||
if (!document.getElementById(divId)) {
|
||||
return;
|
||||
}
|
||||
Highcharts.chart(divId, {
|
||||
chart: {
|
||||
type: 'bar',
|
||||
width:700,
|
||||
height:280
|
||||
|
||||
},
|
||||
title: {
|
||||
text: title
|
||||
|
@ -184,9 +181,6 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||
}, {
|
||||
name: cHeading,
|
||||
data: cData
|
||||
}, {
|
||||
name: dHeading,
|
||||
data: dData
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
@ -335,10 +329,6 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||
const cDataString =div.getAttribute('data-quality');
|
||||
const cleanValueQuality = cDataString.replace(/[^0-9.-]+/g, '');
|
||||
const cData = [Number(cleanValueQuality)];
|
||||
const dHeading = 'Packaging';
|
||||
const dDataString = div.getAttribute('data-packaging');
|
||||
const cleanValuePackaging = dDataString.replace(/[^0-9.-]+/g, '');
|
||||
const dData = [Number(cleanValuePackaging)];
|
||||
const dates = [div.getAttribute('data-dates')];
|
||||
const divId = div.id;
|
||||
dashboardChart(
|
||||
|
@ -352,8 +342,6 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||
bData,
|
||||
cHeading,
|
||||
cData,
|
||||
dHeading,
|
||||
dData,
|
||||
dates,
|
||||
fontSize,
|
||||
maxValue
|
||||
|
|
|
@ -80,7 +80,8 @@
|
|||
<div class="container-fluid px-0">
|
||||
<header class="header shadow py-2 bg-black text-white" style="background-color: black !important;">
|
||||
<div class="container-fluid d-flex flex-wrap align-items-center justify-content-between">
|
||||
<img width="200" class="logo img-fluid" th:src="@{/img/utopia-industries-white.png}" alt="Utopia Industries">
|
||||
<img width="200" class="logo img-fluid" th:src="@{/img/utopia-industries-white.png}"
|
||||
alt="Utopia Industries">
|
||||
<div class="d-flex flex-wrap justify-content-end">
|
||||
<h1 class="px-2 fw-bold text-uppercase m-0" th:text="${{day}}"></h1>
|
||||
<h1 class="px-2 fw-bold text-uppercase m-0" th:text="${{date}}"></h1>
|
||||
|
@ -89,101 +90,101 @@
|
|||
</header>
|
||||
|
||||
<main class="container-fluid main-content">
|
||||
<div class="row page-main g-4 p-3">
|
||||
<!-- Stats Panel -->
|
||||
<div class="col-lg-6 d-flex flex-column align-items-center justify-content-start border border-black-50 stats-panel">
|
||||
<div class="w-100 text-center mb-4">
|
||||
<h1 class="fw-bold text-uppercase m-0" th:text="${{line}}"></h1>
|
||||
<div class="row page-main g-4 p-3">
|
||||
<div class="col-lg-6 ">
|
||||
<!-- Title Row -->
|
||||
<div class="mb-4 d-flex justify-content-between align-items-center">
|
||||
<h1 class="fw-bold text-uppercase m-0" th:text="${{line}}">LINE NAME</h1>
|
||||
<div class="text-end">
|
||||
<h4 class="fw-bold m-0 text-end" th:text="${detail.get('Total Machine')} + ' Machines'">0</h4>
|
||||
<h4 class="fw-bold m-0 text-end" th:text="dwawa">0</h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-4 w-100">
|
||||
<!-- Row 1 -->
|
||||
<div class="col-md-6 d-flex align-items-center justify-content-between px-4 py-3 border-right">
|
||||
<h5 class="fw-bold m-0">Total Target</h5>
|
||||
<h5 class="fw-bold m-0" th:text="${detail.get('Total Target')}"></h5>
|
||||
</div>
|
||||
<div class="col-md-6 d-flex align-items-center justify-content-between px-4 py-3">
|
||||
<h5 class="fw-bold m-0">Total Achieved</h5>
|
||||
<h5 class="fw-bold m-0" th:text="${detail.get('Total Achieved')}"></h5>
|
||||
|
||||
<div class="row g-2">
|
||||
<div class="col-lg-6 border border-black-50 p-2 d-flex flex-column align-items-center justify-content-center text-center text-white rounded " style="background-color: #516ec4;">
|
||||
|
||||
<!-- Total Target -->
|
||||
<div class="w-100 d-flex align-items-center justify-content-between px-4 py-3">
|
||||
<h4 class="fw-bold m-0 text-start">Shift Target</h4>
|
||||
<h4 class="fw-bold m-0 text-end" th:text="${detail.get('Shift Target')}">0</h4>
|
||||
</div>
|
||||
|
||||
<!-- Total Achieved -->
|
||||
<div class="w-100 d-flex align-items-center justify-content-between px-4 py-3">
|
||||
<h4 class="fw-bold m-0 text-start">Achieved</h4>
|
||||
<h4 class="fw-bold m-0 text-end" th:text="${detail.get('Shift Achieved')}">0</h4>
|
||||
</div>
|
||||
|
||||
<!-- Efficiency -->
|
||||
<div class="w-100 d-flex align-items-center justify-content-between px-4 py-3">
|
||||
<h4 class="fw-bold m-0 text-start">Efficiency</h4>
|
||||
<h4 class="fw-bold m-0 text-end" th:text="${detail.get('Efficiency')}">0%</h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Row 2 -->
|
||||
<div class="col-md-6 d-flex align-items-center justify-content-between px-4 py-3 border-right">
|
||||
<h5 class="fw-bold m-0">Hourly Target</h5>
|
||||
<h5 class="fw-bold m-0" th:text="${detail.get('Hourly Target')}"></h5>
|
||||
</div>
|
||||
<div class="col-md-6 d-flex align-items-center justify-content-between px-4 py-3">
|
||||
<h5 class="fw-bold m-0">Hourly Achieved</h5>
|
||||
<h5 class="fw-bold m-0" th:text="${detail.get('Hourly Achieved')}"></h5>
|
||||
</div>
|
||||
|
||||
<!-- Row 3 -->
|
||||
<div class="col-md-6 d-flex align-items-center justify-content-between px-4 py-3 border-right">
|
||||
<h5 class="fw-bold m-0">Efficiency</h5>
|
||||
<h5 class="fw-bold m-0" th:text="${detail.get('Efficiency')}"></h5>
|
||||
</div>
|
||||
<div class="col-md-6 d-flex align-items-center justify-content-between px-4 py-3">
|
||||
<h5 class="fw-bold m-0">Total Induction</h5>
|
||||
<h5 class="fw-bold m-0" th:text="${detail.get('Total Induction')}"></h5>
|
||||
</div>
|
||||
|
||||
<!-- Row 4 -->
|
||||
<div class="col-md-6 d-flex align-items-center justify-content-between px-4 py-3 border-right">
|
||||
<h5 class="fw-bold m-0">Total Workers</h5>
|
||||
<h5 class="fw-bold m-0" th:text="${detail.get('Total Worker')}"></h5>
|
||||
</div>
|
||||
<div class="col-md-6 d-flex align-items-center justify-content-between px-4 py-3">
|
||||
<h5 class="fw-bold m-0">Total Machines</h5>
|
||||
<h5 class="fw-bold m-0" th:text="${detail.get('Total Machine')}"></h5>
|
||||
<div class="col-lg-6 p-3 d-flex flex-column align-items-center text-center text-white rounded " style="background-color: #72788a;">
|
||||
<div class="w-100 d-flex align-items-center justify-content-between px-4 py-3">
|
||||
<h4 class="fw-bold m-0 text-start">Hourly Target</h4>
|
||||
<h4 class="fw-bold m-0 text-end" th:text="${detail.get('Hourly Target')}">0</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Card 1: Stitching -->
|
||||
<div class="col-lg-3 d-flex">
|
||||
<div class="col-lg-6 d-flex">
|
||||
<div class="card w-100 h-100">
|
||||
<div class="container-fluid d-flex p-3 align-items-center">
|
||||
<img style="width:200px" th:src="@{/img/stitchingImage.jpg}" class="card-img-top" alt="Stitching">
|
||||
<img style="width:200px" th:src="@{/img/stitchingImage.jpg}" class="card-img-top"
|
||||
alt="Stitching">
|
||||
<div class="ps-4 text-center">
|
||||
<h1 class="fw-bold text-uppercase m-0" th:text="${phases.get('Stitching')?.intValue() ?: 0}"></h1>
|
||||
<h1 class="fw-bold text-uppercase m-0"
|
||||
th:text="${(phases.get('Stitching') != null ? phases.get('Stitching').intValue() : 0) + ' Pcs'}"></h1>
|
||||
<h4 class="pt-2 fw-bold text-uppercase m-0">Stitching Offline</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body text-center d-flex justify-content-center p-4">
|
||||
<div class="px-4 border-right" style="height: 150px">
|
||||
<h2 class="card-text" th:text="${phases.get('StitchingDefectPiece')?.intValue() ?: 0}"></h2>
|
||||
<h4 class="card-title">Defected QTY</h4>
|
||||
<h2 class="card-text" th:text="${(phases.get('totalWips') != null ? phases.get('totalWips').intValue() : 0) + ' Pcs'}"></h2>
|
||||
<h4 class="card-title">WIP QTY</h4>
|
||||
</div>
|
||||
<div class="px-4" style="height: 150px">
|
||||
<h2 class="card-text" th:text="${#numbers.formatDecimal(phases.get('StitchingDefectPieceRatio') ?: 0, 1, 2)} +' %'"></h2>
|
||||
<h4 class="card-title">Defected Ratio</h4>
|
||||
<h2 class="card-text"
|
||||
th:text="${(phases.get('Alteration') != null ? phases.get('Alteration').intValue() : 0) + ' Pcs'}"></h2>
|
||||
<h4 class="card-title">Alteration</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Card 2: Quality -->
|
||||
<div class="col-lg-3 d-flex">
|
||||
<div class="card w-100 h-100">
|
||||
<div class="container-fluid d-flex align-items-center">
|
||||
<img style="width:200px;height:170px" th:src="@{/img/quality.png}" class="card-img-top" alt="Quality">
|
||||
<div class="ps-4 text-center">
|
||||
<h1 class="fw-bold text-uppercase m-0" th:text="${phases.get('Stitching')?.intValue() ?: 0}"></h1>
|
||||
<h4 class="pt-2 fw-bold text-uppercase m-0">End Line QC</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body text-center d-flex justify-content-center ">
|
||||
<div class="px-4 border-right" style="height: 150px">
|
||||
<h2 class="card-text" th:text="${phases.get('StitchingDefectPiece')?.intValue() ?: 0}"></h2>
|
||||
<h4 class="card-title">Defected QTY</h4>
|
||||
</div>
|
||||
<div class="px-4" style="height: 150px">
|
||||
<h2 class="card-text" th:text="${#numbers.formatDecimal(phases.get('StitchingDefectPieceRatio') ?: 0, 1, 2)} +' %'"></h2>
|
||||
<h4 class="card-title">Defected Ratio</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="col-lg-3 d-flex">-->
|
||||
<!-- <div class="card w-100 h-100">-->
|
||||
<!-- <div class="container-fluid d-flex align-items-center">-->
|
||||
<!-- <img style="width:200px;height:170px" th:src="@{/img/quality.png}" class="card-img-top"-->
|
||||
<!-- alt="Quality">-->
|
||||
<!-- <div class="ps-4 text-center">-->
|
||||
<!-- <h1 class="fw-bold text-uppercase m-0"-->
|
||||
<!-- th:text="${phases.get('Stitching')?.intValue() ?: 0}"></h1>-->
|
||||
<!-- <h4 class="pt-2 fw-bold text-uppercase m-0">End Line QC</h4>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="card-body text-center d-flex justify-content-center ">-->
|
||||
<!-- <div class="px-4 border-right" style="height: 150px">-->
|
||||
<!-- <h2 class="card-text" th:text="${phases.get('StitchingDefectPiece')?.intValue() ?: 0}"></h2>-->
|
||||
<!-- <h4 class="card-title">Defected QTY</h4>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="px-4" style="height: 150px">-->
|
||||
<!-- <h2 class="card-text"-->
|
||||
<!-- th:text="${#numbers.formatDecimal(phases.get('StitchingDefectPieceRatio') ?: 0, 1, 2)} +' %'"></h2>-->
|
||||
<!-- <h4 class="card-title">Defected Ratio</h4>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
|
||||
<!-- Second Row -->
|
||||
|
@ -194,11 +195,10 @@
|
|||
style="min-height: 400px;"
|
||||
th:data-title="'Days Wise Progress'"
|
||||
th:data-dates="${date}"
|
||||
th:data-achieved="${detail.get('Total Achieved')}"
|
||||
th:data-achieved="${detail.get('Shift Achieved')}"
|
||||
th:data-stitching="${phases.get('Stitching')?.intValue() ?: 0}"
|
||||
th:data-quality="${phases.get('Stitching')?.intValue() ?: 0}"
|
||||
th:data-packaging="${phases.get('A Grade')?.intValue() ?: 0}"
|
||||
th:data-totalProduction="${detail.get('Total Target')}"
|
||||
th:data-totalProduction="${detail.get('Shift Target')}"
|
||||
th:data-fontSize="22">
|
||||
</div>
|
||||
</div>
|
||||
|
@ -209,18 +209,26 @@
|
|||
<div class="container-fluid d-flex p-3 align-items-center">
|
||||
<img style="width:200px" th:src="@{/img/finishing.jfif}" class="card-img-top" alt="Finishing">
|
||||
<div class="ps-4 text-center">
|
||||
<h1 class="fw-bold text-uppercase m-0" th:text="${phases.get('finishing')?.intValue() ?: 0}"></h1>
|
||||
<h1 class="fw-bold text-uppercase m-0"
|
||||
th:text="${phases.get('finishing')?.intValue() ?: 0} + ' Pcs'"></h1>
|
||||
<h4 class="pt-2 fw-bold text-uppercase m-0">Finishing</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body text-center d-flex justify-content-center p-4">
|
||||
<div class="px-4 border-right" style="height: 150px">
|
||||
<h2 class="card-text" th:text="${phases.get('finishingDefectPiece')?.intValue() ?: 0}"></h2>
|
||||
<h4 class="card-title">Defected QTY</h4>
|
||||
<div class="card-body text-center d-flex justify-content-center">
|
||||
<div class="px-4 border-right" >
|
||||
<h2 class="card-text" th:text="${phases.get('Reject')?.intValue() ?: 0} + ' Pcs'"></h2>
|
||||
<h4 class="card-title">REJECTION</h4>
|
||||
</div>
|
||||
<div class="px-4" style="height: 150px">
|
||||
<h2 class="card-text" th:text="${#numbers.formatDecimal(phases.get('finishingDefectPieceRatio') ?: 0, 1, 2)} +' %'"></h2>
|
||||
<h4 class="card-title">Defected Ratio</h4>
|
||||
<div class="px-4" >
|
||||
<h2 class="card-text"
|
||||
th:text="${phases.get('ALTER')?.intValue() ?: 0} + ' Pcs'"></h2>
|
||||
<h4 class="card-title">ALTERATION</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body text-center d-flex justify-content-center">
|
||||
<div class="px-4">
|
||||
<h2 class="card-text" th:text="${phases.get('wash')?.intValue() ?: 0} + ' Pcs'"></h2>
|
||||
<h4 class="card-title">WASH/STAMP</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -232,23 +240,24 @@
|
|||
<div class="container-fluid d-flex p-3 align-items-center">
|
||||
<img style="width:200px" th:src="@{/img/packaging.jfif}" class="card-img-top" alt="Packaging">
|
||||
<div class="ps-4 text-center">
|
||||
<h1 class="fw-bold text-uppercase m-0" th:text="${phases.get('A Grade')?.intValue() ?: 0}"></h1>
|
||||
<h1 class="fw-bold text-uppercase m-0"
|
||||
th:text="${phases.get('packaging')?.intValue() ?: 0}"></h1>
|
||||
<h4 class="pt-2 fw-bold text-uppercase m-0">Packaging</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body text-center d-flex justify-content-center p-4">
|
||||
<div class="px-4 border-right" style="height: 150px">
|
||||
<h2 class="card-text" th:text="${phases.get('A Grade')?.intValue() ?: 0}"></h2>
|
||||
<h4 class="card-title">A GRADE</h4>
|
||||
</div>
|
||||
<div class="px-4 border-right" style="height: 150px">
|
||||
<h2 class="card-text" th:text="${phases.get('B Grade')?.intValue() ?: 0}"></h2>
|
||||
<h4 class="card-title">B GRADE</h4>
|
||||
</div>
|
||||
<div class="px-4" style="height: 150px">
|
||||
<h2 class="card-text" th:text="${phases.get('C Grade')?.intValue() ?: 0}"></h2>
|
||||
<h4 class="card-title">C GRADE</h4>
|
||||
</div>
|
||||
<!-- <div class="px-4" style="height: 150px">-->
|
||||
<!-- <h2 class="card-text" th:text="${phases.get('packaging')?.intValue() ?: 0}"></h2>-->
|
||||
<!-- <h4 class="card-title">A GRADE</h4>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="px-4 border-right" style="height: 150px">-->
|
||||
<!-- <h2 class="card-text" th:text="${phases.get('B Grade')?.intValue() ?: 0}"></h2>-->
|
||||
<!-- <h4 class="card-title">B GRADE</h4>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="px-4" style="height: 150px">-->
|
||||
<!-- <h2 class="card-text" th:text="${phases.get('C Grade')?.intValue() ?: 0}"></h2>-->
|
||||
<!-- <h4 class="card-title">C GRADE</h4>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
@click="submitWithQaStatus('B GRADE')">B GRADE
|
||||
</button>
|
||||
<button class="btn btn-danger mr-2" type="button" :disabled="hasDuplicates() || items.length === 0"
|
||||
@click="submitWithQaStatus('C GRADE')">C GRADE
|
||||
@click="submitWithQaStatus('REJECT')">REJECT
|
||||
</button>
|
||||
<button class="btn btn-success mr-2" type="button" :disabled="hasDuplicates() || items.length === 0"
|
||||
@click="submitWithQaStatus('WASHED')">WASHED
|
||||
|
|
Loading…
Reference in New Issue