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