Compare commits
No commits in common. "main" and "add-qa-report-dashboard" have entirely different histories.
main
...
add-qa-rep
|
@ -83,6 +83,7 @@ public class FinishingController {
|
||||||
|
|
||||||
@GetMapping( "segregate-inventory" )
|
@GetMapping( "segregate-inventory" )
|
||||||
public String segregateFinishedItems( Model model ){
|
public String segregateFinishedItems( Model model ){
|
||||||
|
model.addAttribute("accounts", inventoryAccountService.findInventoryAccountsForFinishedItems() );
|
||||||
model.addAttribute("wrapper", new FinishedItemWrapper() );
|
model.addAttribute("wrapper", new FinishedItemWrapper() );
|
||||||
return "/finishing/segregate-inventory";
|
return "/finishing/segregate-inventory";
|
||||||
}
|
}
|
||||||
|
@ -93,7 +94,7 @@ public class FinishingController {
|
||||||
RedirectAttributes redirectAttributes,
|
RedirectAttributes redirectAttributes,
|
||||||
Model model ){
|
Model model ){
|
||||||
try {
|
try {
|
||||||
inventoryService.segregateFinishedItems(wrapper, wrapper.getQaStatus());
|
inventoryService.segregateFinishedItems( wrapper );
|
||||||
redirectAttributes.addFlashAttribute("success", "Items Successfully saved !" );
|
redirectAttributes.addFlashAttribute("success", "Items Successfully saved !" );
|
||||||
} catch ( Exception e ){
|
} catch ( Exception e ){
|
||||||
redirectAttributes.addFlashAttribute("error", e.getMessage() );
|
redirectAttributes.addFlashAttribute("error", e.getMessage() );
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class QualityControlController {
|
||||||
public String postFinishedItemsAfterQc( @ModelAttribute StitchedItemWrapper wrapper,
|
public String postFinishedItemsAfterQc( @ModelAttribute StitchedItemWrapper wrapper,
|
||||||
RedirectAttributes redirectAttributes ){
|
RedirectAttributes redirectAttributes ){
|
||||||
try {
|
try {
|
||||||
inventoryService.createFinishedItemsAgainstStitchedItems(wrapper, wrapper.getQaStatus());
|
inventoryService.createFinishedItemsAgainstStitchedItems( wrapper );
|
||||||
redirectAttributes.addFlashAttribute("success", " Finished Items Are Generated Against Stitched Items" );
|
redirectAttributes.addFlashAttribute("success", " Finished Items Are Generated Against Stitched Items" );
|
||||||
}catch ( Exception ex ){
|
}catch ( Exception ex ){
|
||||||
redirectAttributes.addFlashAttribute("error", ex.getMessage() );
|
redirectAttributes.addFlashAttribute("error", ex.getMessage() );
|
||||||
|
|
|
@ -29,9 +29,9 @@ public class FinishedItemDAO {
|
||||||
private final String SELECT_BY_LIMIT = String.format("SELECT * FROM %s ORDER BY id DESC LIMIT :limit", 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 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 );
|
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 );
|
||||||
private final String SELECT_BY_TERM = String.format("SELECT * FROM %s WHERE barcode LIKE :term AND is_qa = :is_qa AND is_packed = FALSE ORDER BY ID DESC", TABLE_NAME);
|
private final String SELECT_BY_TERM = String.format( "SELECT * FROM %s WHERE barcode LIKE :term AND is_segregated = :is_segregated 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 = 'APPROVED' AND is_packed = 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 = 'APPROVED' AND is_packed = 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", 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_segregated IS 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_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_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 );
|
||||||
|
@ -115,10 +115,10 @@ public class FinishedItemDAO {
|
||||||
return namedParameterJdbcTemplate.query( SELECT_BY_IDS , params, new FinishedItemRowMapper() );
|
return namedParameterJdbcTemplate.query( SELECT_BY_IDS , params, new FinishedItemRowMapper() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FinishedItem> findByTerm(String term, boolean isQa) {
|
public List<FinishedItem> findByTerm( String term , boolean isSegregated ){
|
||||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||||
params.addValue("term", "%" + term + "%" );
|
params.addValue("term", "%" + term + "%" );
|
||||||
params.addValue("is_qa", isQa);
|
params.addValue("is_segregated", isSegregated );
|
||||||
return namedParameterJdbcTemplate.query( SELECT_BY_TERM , params, new FinishedItemRowMapper() );
|
return namedParameterJdbcTemplate.query( SELECT_BY_TERM , params, new FinishedItemRowMapper() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,6 @@ import java.util.List;
|
||||||
|
|
||||||
public class FinishedItemWrapper {
|
public class FinishedItemWrapper {
|
||||||
|
|
||||||
private String qaStatus;
|
|
||||||
|
|
||||||
private List<FinishedItem> items;
|
private List<FinishedItem> items;
|
||||||
|
|
||||||
public List<FinishedItem> getItems() {
|
public List<FinishedItem> getItems() {
|
||||||
|
@ -16,14 +14,6 @@ public class FinishedItemWrapper {
|
||||||
this.items = items;
|
this.items = items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getQaStatus() {
|
|
||||||
return qaStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQaStatus(String qaStatus) {
|
|
||||||
this.qaStatus = qaStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "FinishedItemWrapper{" +
|
return "FinishedItemWrapper{" +
|
||||||
|
|
|
@ -1,20 +1,12 @@
|
||||||
package com.utopiaindustries.model.ctp;
|
package com.utopiaindustries.model.ctp;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class StitchedItemWrapper {
|
public class StitchedItemWrapper {
|
||||||
|
|
||||||
private String qaStatus;
|
|
||||||
private List<StitchingOfflineItem> items;
|
private List<StitchingOfflineItem> items;
|
||||||
private Long finishedAccountId;
|
private Long finishedAccountId;
|
||||||
|
|
||||||
public String getQaStatus() {
|
|
||||||
return qaStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQaStatus(String qaStatus) {
|
|
||||||
this.qaStatus = qaStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<StitchingOfflineItem> getItems() {
|
public List<StitchingOfflineItem> getItems() {
|
||||||
return items;
|
return items;
|
||||||
|
|
|
@ -22,9 +22,8 @@ public class FinishedItemRestController {
|
||||||
@GetMapping( "/search" )
|
@GetMapping( "/search" )
|
||||||
public List<FinishedItem> searchFinishedItems(@RequestParam( "term") String term,
|
public List<FinishedItem> searchFinishedItems(@RequestParam( "term") String term,
|
||||||
@RequestParam( "is-segregated") boolean isSegregated ){
|
@RequestParam( "is-segregated") boolean isSegregated ){
|
||||||
return finishedItemDAO.findByTerm(term, true);
|
return finishedItemDAO.findByTerm( term, isSegregated );
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping( "/search-packaging" )
|
@GetMapping( "/search-packaging" )
|
||||||
public List<FinishedItem> searchFinishedItemsForPackaging(@RequestParam( "term") String term,
|
public List<FinishedItem> searchFinishedItemsForPackaging(@RequestParam( "term") String term,
|
||||||
@RequestParam( "is-segregated") boolean isSegregated ){
|
@RequestParam( "is-segregated") boolean isSegregated ){
|
||||||
|
|
|
@ -464,14 +464,13 @@ public class InventoryService {
|
||||||
* generate finished items against stitched items
|
* generate finished items against stitched items
|
||||||
* */
|
* */
|
||||||
@Transactional( rollbackFor = Exception.class)
|
@Transactional( rollbackFor = Exception.class)
|
||||||
public void createFinishedItemsAgainstStitchedItems(StitchedItemWrapper wrapper, String qaStatus) {
|
public void createFinishedItemsAgainstStitchedItems( StitchedItemWrapper wrapper ) {
|
||||||
if ( wrapper.getItems( ) != null && wrapper.getFinishedAccountId( ) != 0) {
|
if ( wrapper.getItems( ) != null && wrapper.getFinishedAccountId( ) != 0) {
|
||||||
Authentication authentication = SecurityContextHolder.getContext( ).getAuthentication( );
|
Authentication authentication = SecurityContextHolder.getContext( ).getAuthentication( );
|
||||||
|
|
||||||
List<StitchingOfflineItem> stitchingOfflineItems = wrapper.getItems( );
|
List<StitchingOfflineItem> stitchingOfflineItems = wrapper.getItems( );
|
||||||
List<StitchingOfflineItem> updatedStitchedItems = new ArrayList<>( );
|
List<StitchingOfflineItem> updatedStitchedItems = new ArrayList<>( );
|
||||||
List<FinishedItem> finishedItems = new ArrayList<>( );
|
List<FinishedItem> finishedItems = new ArrayList<>( );
|
||||||
List<FinishedItem> finishedItemsForUlter = new ArrayList<>();
|
|
||||||
|
|
||||||
List<Long> stitchedItemIds = stitchingOfflineItems.stream( )
|
List<Long> stitchedItemIds = stitchingOfflineItems.stream( )
|
||||||
.map( StitchingOfflineItem::getId)
|
.map( StitchingOfflineItem::getId)
|
||||||
|
@ -496,7 +495,7 @@ public class InventoryService {
|
||||||
|
|
||||||
// generate FI for SI
|
// generate FI for SI
|
||||||
for ( StitchingOfflineItem stitchingOfflineItem : stitchingOfflineItems) {
|
for ( StitchingOfflineItem stitchingOfflineItem : stitchingOfflineItems) {
|
||||||
if (qaStatus.equalsIgnoreCase("APPROVED")) {
|
if ( stitchingOfflineItem.getQaStatus( ).equalsIgnoreCase( "APPROVED" )) {
|
||||||
// check finished item is already created
|
// check finished item is already created
|
||||||
FinishedItem preCreatedItem = finishedItemDAO.findByStitchedItem( stitchingOfflineItem.getId( ));
|
FinishedItem preCreatedItem = finishedItemDAO.findByStitchedItem( stitchingOfflineItem.getId( ));
|
||||||
if ( preCreatedItem == null) {
|
if ( preCreatedItem == null) {
|
||||||
|
@ -508,7 +507,7 @@ public class InventoryService {
|
||||||
finishedItem.setCreatedAt( LocalDateTime.now( ));
|
finishedItem.setCreatedAt( LocalDateTime.now( ));
|
||||||
finishedItem.setStitchedItemId( stitchingOfflineItem.getId( ));
|
finishedItem.setStitchedItemId( stitchingOfflineItem.getId( ));
|
||||||
finishedItem.setJobCardId( stitchingOfflineItem.getJobCardId( ));
|
finishedItem.setJobCardId( stitchingOfflineItem.getJobCardId( ));
|
||||||
finishedItem.setIsQa(true);
|
finishedItem.setIsQa( false);
|
||||||
finishedItem.setId( finishedItemDAO.save( finishedItem));
|
finishedItem.setId( finishedItemDAO.save( finishedItem));
|
||||||
finishedItems.add( finishedItem);
|
finishedItems.add( finishedItem);
|
||||||
InventoryTransactionLeg lastInvTransaction = lastStitchedIdInTransactionMap.getOrDefault( stitchingOfflineItem.getId( ), null);
|
InventoryTransactionLeg lastInvTransaction = lastStitchedIdInTransactionMap.getOrDefault( stitchingOfflineItem.getId( ), null);
|
||||||
|
@ -519,8 +518,6 @@ public class InventoryService {
|
||||||
}
|
}
|
||||||
// update stitched item
|
// update stitched item
|
||||||
stitchingOfflineItem.setIsQa( true);
|
stitchingOfflineItem.setIsQa( true);
|
||||||
stitchingOfflineItem.setQaStatus(qaStatus);
|
|
||||||
updatedStitchedItems.add(stitchingOfflineItem);
|
|
||||||
// if FI is already created
|
// if FI is already created
|
||||||
} else {
|
} else {
|
||||||
// create OUT from stitching account Finished Item
|
// create OUT from stitching account Finished Item
|
||||||
|
@ -530,27 +527,17 @@ public class InventoryService {
|
||||||
long fromAccount = lastInvTransaction.getAccountId( );
|
long fromAccount = lastInvTransaction.getAccountId( );
|
||||||
createInventoryTransactionLeg( transaction, stitchingOfflineItem, fromAccount, InventoryTransactionLeg.Type.OUT.name( ), InventoryArtifactType.FINISHED_ITEM.name( ));
|
createInventoryTransactionLeg( transaction, stitchingOfflineItem, fromAccount, InventoryTransactionLeg.Type.OUT.name( ), InventoryArtifactType.FINISHED_ITEM.name( ));
|
||||||
}
|
}
|
||||||
preCreatedItem.setIsQa(true);
|
|
||||||
finishedItemsForUlter.add(preCreatedItem);
|
|
||||||
// create IN in finishing Account Finished Item
|
// create IN in finishing Account Finished Item
|
||||||
finishedItems.add( preCreatedItem );
|
finishedItems.add( preCreatedItem );
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
FinishedItem preCreatedItem = finishedItemDAO.findByStitchedItem(stitchingOfflineItem.getId());
|
|
||||||
preCreatedItem.setIsQa(false);
|
|
||||||
finishedItemsForUlter.add(preCreatedItem);
|
|
||||||
}
|
}
|
||||||
stitchingOfflineItem.setIsQa(true);
|
|
||||||
stitchingOfflineItem.setQaStatus(qaStatus);
|
|
||||||
updatedStitchedItems.add(stitchingOfflineItem);
|
|
||||||
}
|
}
|
||||||
for ( FinishedItem finishedItem : finishedItems) {
|
for ( FinishedItem finishedItem : finishedItems) {
|
||||||
// IN
|
// IN
|
||||||
createInventoryTransactionLeg( transaction, finishedItem, wrapper.getFinishedAccountId( ), InventoryTransactionLeg.Type.IN.name( ), InventoryArtifactType.FINISHED_ITEM.name( ));
|
createInventoryTransactionLeg( transaction, finishedItem, wrapper.getFinishedAccountId( ), InventoryTransactionLeg.Type.IN.name( ), InventoryArtifactType.FINISHED_ITEM.name( ));
|
||||||
}
|
}
|
||||||
// save updated stitched items
|
// save updated stitched items
|
||||||
finishedItemDAO.saveAll(finishedItemsForUlter);
|
stitchingOfflineItemDAO.saveAll( wrapper.getItems( ));
|
||||||
stitchingOfflineItemDAO.saveAll(updatedStitchedItems);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,7 +546,7 @@ public class InventoryService {
|
||||||
* segregate finish items
|
* segregate finish items
|
||||||
* */
|
* */
|
||||||
@Transactional( rollbackFor = Exception.class, propagation = Propagation.NESTED )
|
@Transactional( rollbackFor = Exception.class, propagation = Propagation.NESTED )
|
||||||
public void segregateFinishedItems(FinishedItemWrapper wrapper, String status) {
|
public void segregateFinishedItems( FinishedItemWrapper wrapper) {
|
||||||
if ( wrapper != null && wrapper.getItems( ) != null) {
|
if ( wrapper != null && wrapper.getItems( ) != null) {
|
||||||
|
|
||||||
List<FinishedItem> items = wrapper.getItems( );
|
List<FinishedItem> items = wrapper.getItems( );
|
||||||
|
@ -586,15 +573,19 @@ public class InventoryService {
|
||||||
// create transaction
|
// create transaction
|
||||||
InventoryTransaction transaction = createInventoryTransaction( "Against Segregation of Finished Items");
|
InventoryTransaction transaction = createInventoryTransaction( "Against Segregation of Finished Items");
|
||||||
|
|
||||||
|
|
||||||
// create IN and OUT for all approved items
|
// create IN and OUT for all approved items
|
||||||
for ( FinishedItem finishedItem : items) {
|
for ( FinishedItem finishedItem : items) {
|
||||||
InventoryTransactionLeg lastInvTransaction = lastFinishedItemIdInTransactionMap.getOrDefault( finishedItem.getId( ), null);
|
InventoryTransactionLeg lastInvTransaction = lastFinishedItemIdInTransactionMap.getOrDefault( finishedItem.getId( ), null);
|
||||||
finishedItem.setIsQa( true);
|
finishedItem.setIsQa( true);
|
||||||
|
/*
|
||||||
|
* item is not approved and washed is selected then item remain in Finishing account
|
||||||
|
* */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* item is approved and alter is selected then finished item will to stitching account
|
* item is approved and alter is selected then finished item will to stitching account
|
||||||
* */
|
* */
|
||||||
if (status.equalsIgnoreCase("ALTER")) {
|
if ( finishedItem.getQaStatus( ).equalsIgnoreCase( "ALTER")) {
|
||||||
// create OUT and IN transactions for FI
|
// create OUT and IN transactions for FI
|
||||||
if ( lastInvTransaction != null) {
|
if ( lastInvTransaction != null) {
|
||||||
// OUT
|
// OUT
|
||||||
|
@ -604,43 +595,14 @@ public class InventoryService {
|
||||||
// get the stitching account id
|
// get the stitching account id
|
||||||
long stitchedItemId = finishedItem.getStitchedItemId( );
|
long stitchedItemId = finishedItem.getStitchedItemId( );
|
||||||
InventoryTransactionLeg lastOutTransaction = lastStitchedItemOutTransactionMap.getOrDefault( stitchedItemId, null);
|
InventoryTransactionLeg lastOutTransaction = lastStitchedItemOutTransactionMap.getOrDefault( stitchedItemId, null);
|
||||||
createInventoryTransactionLeg(transaction, finishedItem, lastOutTransaction.getAccountId(), InventoryTransactionLeg.Type.IN.name(), InventoryArtifactType.STITCHING_OFFLINE.name());
|
createInventoryTransactionLeg( transaction, finishedItem, lastOutTransaction.getAccountId( ), InventoryTransactionLeg.Type.IN.name( ), InventoryArtifactType.FINISHED_ITEM.name( ));
|
||||||
finishedItem.setQaStatus("ALTER");
|
|
||||||
finishedItem.setIsSegregated(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* item is not approved and washed is selected then item remain in Finishing account
|
|
||||||
* */
|
|
||||||
if (status.equalsIgnoreCase("WASHED")) {
|
|
||||||
finishedItem.setIsSegregated(false);
|
|
||||||
finishedItem.setQaStatus("WASHED");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* item is not approved and B 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("B GRADE")) {
|
|
||||||
finishedItem.setIsSegregated(false);
|
|
||||||
finishedItem.setQaStatus("B GRADE");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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")) {
|
|
||||||
finishedItem.setIsSegregated(false);
|
|
||||||
finishedItem.setQaStatus("C GRADE");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* item is approved and grade is selected then fI is move to grade account
|
* item is approved and grade is selected then fI is move to grade account
|
||||||
*/
|
*/
|
||||||
if (status.equalsIgnoreCase("APPROVED")) {
|
if ( finishedItem.getQaStatus( ).equalsIgnoreCase( "APPROVED") && finishedItem.getAccountId( ) != 0) {
|
||||||
finishedItem.setQaStatus("APPROVED");
|
|
||||||
finishedItem.setIsSegregated( true);
|
finishedItem.setIsSegregated( true);
|
||||||
}
|
}
|
||||||
updatedItems.add( finishedItem);
|
updatedItems.add( finishedItem);
|
||||||
|
@ -706,6 +668,7 @@ public class InventoryService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* find item summary by account
|
* find item summary by account
|
||||||
* */
|
* */
|
||||||
|
|
|
@ -213,27 +213,31 @@ public class ReportingService {
|
||||||
return new HashMap<>();
|
return new HashMap<>();
|
||||||
}else {
|
}else {
|
||||||
HashMap<String,Integer> gradingItems = new HashMap<>();
|
HashMap<String,Integer> gradingItems = new HashMap<>();
|
||||||
|
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<FinishedItem> bGradeFinishItemsIds= finishedItems.stream()
|
List<Long> finishItemsIds = finishedItems.stream()
|
||||||
.filter(item -> "B GRADE".equals(item.getQaStatus())).collect(Collectors.toList());
|
.map(FinishedItem::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
List<FinishedItem> cGradeFinishItemsIds= finishedItems.stream()
|
List<Long> packagingItemsIds = packagingItems.stream()
|
||||||
.filter(item -> "C GRADE".equals(item.getQaStatus())).collect(Collectors.toList());
|
.map(PackagingItems::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
List<FinishedItem> aGradeFinishItemsIds= finishedItems.stream()
|
if (finishItemsIds.isEmpty()){
|
||||||
.filter(item -> "APPROVED".equals(item.getQaStatus())).collect(Collectors.toList());
|
|
||||||
|
|
||||||
|
|
||||||
if (finishedItems.isEmpty()){
|
|
||||||
gradingItems.put("A GRADE",0);
|
gradingItems.put("A GRADE",0);
|
||||||
gradingItems.put("B GRADE",0);
|
gradingItems.put("B GRADE",0);
|
||||||
gradingItems.put("C GRADE",0);
|
gradingItems.put("C GRADE",0);
|
||||||
return gradingItems;
|
return gradingItems;
|
||||||
}else {
|
}else {
|
||||||
gradingItems.put("B GRADE",bGradeFinishItemsIds.size());
|
for (InventoryAccount inventoryAccount : inventoryAccounts){
|
||||||
gradingItems.put("C GRADE",cGradeFinishItemsIds.size());
|
if (inventoryAccount.getIsPackaging()){
|
||||||
gradingItems.put("A GRADE",aGradeFinishItemsIds.size());
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -382,6 +386,11 @@ public class ReportingService {
|
||||||
}
|
}
|
||||||
List<InventoryAccount> inventoryAccounts = inventoryAccountDAO.findByParentEntityTypeAndParentId("PROCESS",6L);
|
List<InventoryAccount> inventoryAccounts = inventoryAccountDAO.findByParentEntityTypeAndParentId("PROCESS",6L);
|
||||||
|
|
||||||
|
List<JobCardItem> jobCardItems = jobCardItemDAO.findByCardId(Long.parseLong(jobCardID));
|
||||||
|
BigDecimal actualProduction = jobCardItems.stream()
|
||||||
|
.map(item -> Optional.ofNullable(item.getActualProduction()).orElse(BigDecimal.ZERO))
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
|
||||||
LocalDateTime startDate = jobCardDAO.find(Long.parseLong(jobCardID)).getCreatedAt();
|
LocalDateTime startDate = jobCardDAO.find(Long.parseLong(jobCardID)).getCreatedAt();
|
||||||
HashMap<String, List<?>> barChartData = new HashMap<>();
|
HashMap<String, List<?>> barChartData = new HashMap<>();
|
||||||
|
|
||||||
|
@ -428,9 +437,15 @@ public class ReportingService {
|
||||||
stitchingList.set(index, stitchingList.get(index) + leg.getQuantity().intValue());
|
stitchingList.set(index, stitchingList.get(index) + leg.getQuantity().intValue());
|
||||||
}
|
}
|
||||||
else if ("FINISHED_ITEM".equals(leg.getParentDocumentType()) && (leg.getAccountId().equals(7) || leg.getAccountId().equals(12))) {
|
else if ("FINISHED_ITEM".equals(leg.getParentDocumentType()) && (leg.getAccountId().equals(7) || leg.getAccountId().equals(12))) {
|
||||||
|
if (index == 0 || !dateIndexMap.containsKey(dateKey)) {
|
||||||
|
qualityList.set(index, 0);
|
||||||
|
}
|
||||||
qualityList.set(index, qualityList.get(index) + leg.getQuantity().intValue());
|
qualityList.set(index, qualityList.get(index) + leg.getQuantity().intValue());
|
||||||
}
|
}
|
||||||
else if ("PACKAGING".equals(leg.getParentDocumentType()) && inventoryAccounts.stream().anyMatch(e -> e.getId() == leg.getAccountId().longValue())) {
|
else if ("PACKAGING".equals(leg.getParentDocumentType()) && inventoryAccounts.stream().anyMatch(e -> e.getId() == leg.getAccountId().longValue())) {
|
||||||
|
if (index == 0 || !dateIndexMap.containsKey(dateKey)) {
|
||||||
|
finishItems.set(index, 0);
|
||||||
|
}
|
||||||
finishItems.set(index, finishItems.get(index) + leg.getQuantity().intValue());
|
finishItems.set(index, finishItems.get(index) + leg.getQuantity().intValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
( async function(){
|
( async function(){
|
||||||
|
|
||||||
Vue.prototype.$accounts = window.ctp.accounts;
|
Vue.prototype.$accounts = window.ctp.accounts;
|
||||||
|
|
||||||
Vue.component('finished-item-table',{
|
Vue.component('finished-item-table',{
|
||||||
|
@ -26,22 +27,23 @@
|
||||||
<th>Job Card ID</th>
|
<th>Job Card ID</th>
|
||||||
<th>Barcode</th>
|
<th>Barcode</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
|
<th>Account</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="(item,index) in items">
|
<tr v-for="(item,index) in items">
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" v-bind:name="'items[' + index + '].id'" v-bind:value="item.id">
|
<input hidden="hidden" v-bind:name="'items[' + index + '].id'" v-bind:value="item.id">
|
||||||
<input type="hidden" v-bind:name="'items[' + index + '].itemId'" v-bind:value="item.itemId">
|
<input hidden="hidden" v-bind:name="'items[' + index + '].itemId'" v-bind:value="item.itemId">
|
||||||
<input type="hidden" v-bind:name="'items[' + index + '].sku'" v-bind:value="item.sku">
|
<input hidden="hidden" v-bind:name="'items[' + index + '].sku'" v-bind:value="item.sku">
|
||||||
<input type="hidden" v-bind:name="'items[' + index + '].createdBy'" v-bind:value="item.createdBy">
|
<input hidden="hidden" v-bind:name="'items[' + index + '].createdBy'" v-bind:value="item.createdBy">
|
||||||
<input type="hidden" v-bind:name="'items[' + index + '].createdAt'" v-bind:value="getFormattedDateTime(item.createdAt)">
|
<input hidden="hidden" v-bind:name="'items[' + index + '].createdAt'" v-bind:value="getFormattedDateTime(item.createdAt)">
|
||||||
<input type="hidden" v-bind:name="'items[' + index + '].jobCardId'" v-bind:value="item.jobCardId">
|
<input hidden="hidden" v-bind:name="'items[' + index + '].jobCardId'" v-bind:value="item.jobCardId">
|
||||||
<input type="hidden" v-bind:name="'items[' + index + '].barcode'" v-bind:value="item.barcode">
|
<input hidden="hidden" v-bind:name="'items[' + index + '].barcode'" v-bind:value="item.barcode" >
|
||||||
<input type="hidden" v-bind:name="'items[' + index + '].isQa'" v-bind:value="item.isQa">
|
<input hidden="hidden" v-bind:name="'items[' + index + '].isQa'" v-bind:value="item.isQa">
|
||||||
<input type="hidden" v-bind:name="'items[' + index + '].stitchedItemId'" v-bind:value="item.stitchedItemId">
|
<input hidden="hidden" v-bind:name="'items[' + index + '].stitchedItemId'" v-bind:value="item.stitchedItemId">
|
||||||
<input type="hidden" v-bind:name="'items[' + index + '].isSegregated'" v-bind:value="item.isSegregated">
|
<input hidden="hidden" v-bind:name="'items[' + index + '].isSegregated'" v-bind:value="item.isSegregated">
|
||||||
<span> {{item.id}} </span>
|
<span> {{item.id}} </span>
|
||||||
</td>
|
</td>
|
||||||
<td> {{item.itemId}} </td>
|
<td> {{item.itemId}} </td>
|
||||||
|
@ -51,26 +53,40 @@
|
||||||
<td> {{item.jobCardId}}</td>
|
<td> {{item.jobCardId}}</td>
|
||||||
<td> {{item.barcode}} </td>
|
<td> {{item.barcode}} </td>
|
||||||
<td>
|
<td>
|
||||||
<span v-if="!item.qaStatus" class="badge badge-danger">NOT PERFORMED</span>
|
<select class="w-100" required v-bind:name="'items[' + index + '].qaStatus'" v-model="item.qaStatus">
|
||||||
<span v-else-if="item.qaStatus === 'APPROVED'" class="font-lg badge badge-success">{{ item.qaStatus }}</span>
|
<option value="WASHED">WASHED</option>
|
||||||
<span v-else-if="item.qaStatus === 'ALTER' || item.qaStatus === 'B GRADE' || item.qaStatus === 'C GRADE' " class="font-lg badge badge-danger">{{ item.qaStatus }}</span>
|
<option value="ALTER">ALTER</option>
|
||||||
<span v-else-if="item.qaStatus === 'WASHED'" class="font-lg badge badge-APPROVED">{{ item.qaStatus }}</span>
|
<option value="APPROVED">APPROVED</option>
|
||||||
|
</select><br>
|
||||||
|
<!-- <textarea class="w-100 mt-1" rows="2" v-model="item.qaRemarks" -->
|
||||||
|
<!-- v-if="item.accountId === '0'" -->
|
||||||
|
<!-- v-bind:name="'items[' + index + '].qaRemarks'"></textarea> -->
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="button" class="btn btn-light" v-on:click="removeItem(index)">
|
<select class="w-100" required v-bind:name="'items[' + index + '].accountId'"
|
||||||
|
v-model="item.accountId"
|
||||||
|
v-bind:disabled="item.qaStatus !== 'APPROVED'"
|
||||||
|
v-bind:required="item.qaStatus === 'APPROVED'">
|
||||||
|
<option v-for="(option,index) in $accounts"
|
||||||
|
v-bind:value="option.id">{{option.title}}</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button type="button" title="Remove" class="btn btn-light text-left" v-on:click="removeItem(index)">
|
||||||
<i class="bi bi-trash"></i>
|
<i class="bi bi-trash"></i>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
`
|
`,
|
||||||
});
|
|
||||||
|
})
|
||||||
|
|
||||||
let app = new Vue({
|
let app = new Vue({
|
||||||
el : '#finishedApp',
|
el : '#finishedApp',
|
||||||
data : {
|
data : {
|
||||||
items: [],
|
items : []
|
||||||
QaStatus: 'APPROVED'
|
|
||||||
},
|
},
|
||||||
methods : {
|
methods : {
|
||||||
onItemSelect: function (id, item) {
|
onItemSelect: function (id, item) {
|
||||||
|
@ -84,15 +100,10 @@
|
||||||
const uniqueIds = new Set(ids);
|
const uniqueIds = new Set(ids);
|
||||||
return ids.length !== uniqueIds.size;
|
return ids.length !== uniqueIds.size;
|
||||||
},
|
},
|
||||||
submitWithQaStatus: function (status) {
|
|
||||||
this.QaStatus = status;
|
|
||||||
this.$nextTick(() => {
|
|
||||||
document.getElementById('finishedApp').submit();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
mounted : function () {
|
mounted : function () {
|
||||||
console.log(this.$accounts);
|
console.log( this.$accounts )
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
})(jQuery);
|
|
||||||
|
})(jQuery)
|
|
@ -53,13 +53,7 @@
|
||||||
<td> {{ getFormattedDateTime( item.createdAt) }} </td>
|
<td> {{ getFormattedDateTime( item.createdAt) }} </td>
|
||||||
<td> {{item.jobCardId}}</td>
|
<td> {{item.jobCardId}}</td>
|
||||||
<td> {{item.barcode}} </td>
|
<td> {{item.barcode}} </td>
|
||||||
<td >
|
<td > {{item.qaStatus}} </td>
|
||||||
<span v-if="!item.qaStatus" class="badge badge-danger">NOT PERFORMED</span>
|
|
||||||
<span v-else-if="item.qaStatus === 'APPROVED'" class="font-lg badge badge-success">{{ item.qaStatus }}</span>
|
|
||||||
<span v-else-if="item.qaStatus === 'ALTER' || item.qaStatus === 'B GRADE'" class="font-lg badge badge-danger">{{ item.qaStatus }}</span>
|
|
||||||
<span v-else-if="item.qaStatus === 'WASHED'" class="font-lg badge badge-APPROVED">{{ item.qaStatus }}</span>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
<td>
|
<td>
|
||||||
<button type="button" title="Remove" class="btn btn-light text-left" v-on:click="removeItem(index)">
|
<button type="button" title="Remove" class="btn btn-light text-left" v-on:click="removeItem(index)">
|
||||||
<i class="bi bi-trash"></i>
|
<i class="bi bi-trash"></i>
|
||||||
|
|
|
@ -50,9 +50,11 @@
|
||||||
<td> {{item.jobCardId}}</td>
|
<td> {{item.jobCardId}}</td>
|
||||||
<td> {{item.barcode}} </td>
|
<td> {{item.barcode}} </td>
|
||||||
<td>
|
<td>
|
||||||
<span v-if="!item.qaStatus" class="badge badge-danger">NOT PERFORMED</span>
|
<select class="w-100" required v-bind:name="'items[' + index + '].qaStatus'" v-model="item.qaStatus">
|
||||||
<span v-else-if="item.qaStatus === 'APPROVED'" class="font-lg badge badge-success">{{ item.qaStatus }}</span>
|
<option value="APPROVED">APPROVED</option>
|
||||||
<span v-else-if="item.qaStatus === 'REJECT'" class="font-lg badge badge-danger">{{ item.qaStatus }}</span>
|
<option value="REJECT">REJECT</option>
|
||||||
|
</select><br>
|
||||||
|
<textarea class="w-100 mt-1" rows="2" v-model="item.remarks" v-if="item.qaStatus === 'REJECT'" v-bind:name="'items[' + index + '].qaRemarks'"></textarea>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="button" title="Remove" class="btn btn-light text-left" v-on:click="removeItem(index)">
|
<button type="button" title="Remove" class="btn btn-light text-left" v-on:click="removeItem(index)">
|
||||||
|
@ -70,7 +72,6 @@
|
||||||
el: '#qcForm',
|
el: '#qcForm',
|
||||||
data: {
|
data: {
|
||||||
items: [],
|
items: [],
|
||||||
QaStatus: 'APPROVED'
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onItemSelect: function (id, item) {
|
onItemSelect: function (id, item) {
|
||||||
|
@ -85,12 +86,6 @@
|
||||||
const uniqueIds = new Set(ids);
|
const uniqueIds = new Set(ids);
|
||||||
return ids.length !== uniqueIds.size;
|
return ids.length !== uniqueIds.size;
|
||||||
},
|
},
|
||||||
submitWithQaStatus: function (status) {
|
|
||||||
this.QaStatus = status;
|
|
||||||
this.$nextTick(() => {
|
|
||||||
document.getElementById('qcForm').submit();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,7 @@
|
||||||
<!-- th:text="${account.title}"></option>-->
|
<!-- th:text="${account.title}"></option>-->
|
||||||
<!-- </select>-->
|
<!-- </select>-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" name="qaStatus" v-model="QaStatus">
|
|
||||||
</div>
|
</div>
|
||||||
<div class="bg-light p-3 mb-3">
|
<div class="bg-light p-3 mb-3">
|
||||||
<h6 class="mb-3">Finished Items</h6>
|
<h6 class="mb-3">Finished Items</h6>
|
||||||
|
@ -40,21 +38,7 @@
|
||||||
></finished-item-table>
|
></finished-item-table>
|
||||||
</div>
|
</div>
|
||||||
<div class="alert alert-danger" v-if="hasDuplicates()" >Duplicate Item Selected</div>
|
<div class="alert alert-danger" v-if="hasDuplicates()" >Duplicate Item Selected</div>
|
||||||
<button class="btn btn-primary mr-2" type="button" :disabled="hasDuplicates() || items.length === 0"
|
<button class="btn btn-primary" type="submit" v-bind:disabled="hasDuplicates()">Submit</button>
|
||||||
@click="submitWithQaStatus('APPROVED')">APPROVED
|
|
||||||
</button>
|
|
||||||
<button class="btn btn-danger mr-2" type="button" :disabled="hasDuplicates() || items.length === 0"
|
|
||||||
@click="submitWithQaStatus('ALTER')">ALTER
|
|
||||||
</button>
|
|
||||||
<button class="btn btn-danger mr-2" type="button" :disabled="hasDuplicates() || items.length === 0"
|
|
||||||
@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
|
|
||||||
</button>
|
|
||||||
<button class="btn btn-success mr-2" type="button" :disabled="hasDuplicates() || items.length === 0"
|
|
||||||
@click="submitWithQaStatus('WASHED')">WASHED
|
|
||||||
</button>
|
|
||||||
<a th:href="@{/finishing/finished-items}" class="btn btn-light">Cancel</a>
|
<a th:href="@{/finishing/finished-items}" class="btn btn-light">Cancel</a>
|
||||||
</form>
|
</form>
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
v-on:finished-item-select="onItemSelect">
|
v-on:finished-item-select="onItemSelect">
|
||||||
</search-item>
|
</search-item>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" name="qaStatus" v-model="QaStatus">
|
|
||||||
<div class="col-sm-3 form-group">
|
<div class="col-sm-3 form-group">
|
||||||
<label>Finishing Account</label>
|
<label>Finishing Account</label>
|
||||||
<select class="form-control" name="account-id" th:field="*{finishedAccountId}" required>
|
<select class="form-control" name="account-id" th:field="*{finishedAccountId}" required>
|
||||||
|
@ -41,12 +40,7 @@
|
||||||
</stitched-item-table>
|
</stitched-item-table>
|
||||||
</div>
|
</div>
|
||||||
<div class="alert alert-danger" v-if="hasDuplicates()">Duplicate Item Selected</div>
|
<div class="alert alert-danger" v-if="hasDuplicates()">Duplicate Item Selected</div>
|
||||||
<button class="btn btn-primary mr-2" type="button" :disabled="hasDuplicates() || items.length === 0"
|
<button class="btn btn-primary" type="submit" v-bind:disabled="hasDuplicates()">Submit</button>
|
||||||
@click="submitWithQaStatus('APPROVED')">APPROVED
|
|
||||||
</button>
|
|
||||||
<button class="btn btn-danger mr-2" type="button" :disabled="hasDuplicates() || items.length === 0"
|
|
||||||
@click="submitWithQaStatus('REJECT')">REJECT
|
|
||||||
</button>
|
|
||||||
<a th:href="@{/quality-control/qc-finished-items}" class="btn btn-light">Cancel</a>
|
<a th:href="@{/quality-control/qc-finished-items}" class="btn btn-light">Cancel</a>
|
||||||
</form>
|
</form>
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
|
|
Loading…
Reference in New Issue