fixed bugs and add job card view, update summary table,

pull/1/head
usama.jameel 2025-01-02 09:17:32 +05:00
parent 60956b36ba
commit dbbc4da853
14 changed files with 56 additions and 29 deletions

View File

@ -117,15 +117,12 @@ public class CuttingController {
@RequestParam( value = "start-date", required = false) String startDate,
@RequestParam( value = "end-date", required = false) String endDate,
@RequestParam( value = "count", required = false ) Long count,
Model model, RedirectAttributes redirectAttributes){
Model model){
LocalDate startDate1 = StringUtils.isNullOrEmpty(startDate) ? LocalDate.now().minusDays(30) : LocalDate.parse(startDate);
LocalDate endDate1 = StringUtils.isNullOrEmpty(endDate) ? LocalDate.now() : LocalDate.parse(endDate);
model.addAttribute("bundles", bundleService.getBundles( id, sku, jobCardId, masterId, type, status, startDate1.toString(), endDate1.toString() ,count ) );
model.addAttribute("types", jobCardService.getAllPieceTypes() );
if(exceptionCheck){
redirectAttributes.addFlashAttribute("error", "Please Select At least One CheckBox." );
}
if(StringUtils.isNullOrEmpty( startDate) || StringUtils.isNullOrEmpty( endDate )){
return "redirect:/cutting/bundles?id=&sku=&jc-id=&master-id=&type=&status=0&start-date="+startDate1+"&end-date="+endDate1+"&count=100";
}
@ -139,11 +136,15 @@ public class CuttingController {
@RequestParam(value = "start-date", required = false) String startDate,
@RequestParam(value = "end-date", required = false) String endDate,
@RequestParam(value = "count", required = false) Long count,
Model model ){
@RequestParam( value = "exceptionCheck", required = false, defaultValue = "false") boolean exceptionCheck,
Model model, RedirectAttributes redirectAttributes ){
if(exceptionCheck){
redirectAttributes.addFlashAttribute("error", "Please Select At least One CheckBox." );
}
LocalDate startDate1 = StringUtils.isNullOrEmpty(startDate) ? LocalDate.now().minusDays(30) : LocalDate.parse(startDate);
LocalDate endDate1 = StringUtils.isNullOrEmpty(endDate) ? LocalDate.now() : LocalDate.parse(endDate);
model.addAttribute("masterBundles", bundleService.getMasterBundles( id, jobCardId, startDate1.toString(), endDate1.toString(), count ) );
if(StringUtils.isNullOrEmpty( startDate) || StringUtils.isNullOrEmpty( endDate )){
if(StringUtils.isNullOrEmpty( startDate) || StringUtils.isNullOrEmpty( endDate ) || exceptionCheck ){
return "redirect:/cutting/master-bundles?id=&jc-id=&start-date="+startDate1+"&end-date="+endDate1+"&count=100";
}
return "/cutting/master-bundles";
@ -161,7 +162,7 @@ public class CuttingController {
public Object generateBarcode(@RequestParam( name = "ids", required = false ) Long[] ids,
@RequestParam( name = "artifactType", required = true ) String artifactType ) throws Exception {
if(ids == null){
return "redirect:/cutting/bundles?exceptionCheck=true";
return "redirect:/cutting/master-bundles?id=&jc-id=&start-date=2024-12-01&end-date=2024-12-31&count=100&exceptionCheck=true";
}
return barcodeService.generateBarcodes( Arrays.asList( ids ), artifactType );
}

View File

@ -34,8 +34,8 @@ public class ReportingController {
Model model ){
Map<String, Map<String, List<SummaryInventoryReport>>> getDataByFilteration = summaryInventoryReportService.findByFilter(itemId,sku,startDate,endDate);
LocalDate startDate1 = StringUtils.isNullOrEmpty(startDate) ? LocalDate.now().minusDays(7) : LocalDate.parse(startDate);
LocalDate endDate1 = StringUtils.isNullOrEmpty(endDate) ? LocalDate.now() : LocalDate.parse(endDate);
LocalDate startDate1 = StringUtils.isNullOrEmpty(startDate) ? LocalDate.now().minusDays(6) : LocalDate.parse(startDate);
LocalDate endDate1 = StringUtils.isNullOrEmpty(endDate) ? LocalDate.now().plusDays(1) : LocalDate.parse(endDate);
ArrayList<LocalDate> arrayList = generateDateList(startDate1,endDate1);
model.addAttribute("dateLimits", arrayList);
model.addAttribute("tableData", getDataByFilteration);

View File

@ -2,6 +2,7 @@ package com.utopiaindustries.dao.ctp;
import com.utopiaindustries.model.ctp.FinishedItem;
import com.utopiaindustries.model.ctp.JobCard;
import com.utopiaindustries.model.ctp.StitchingOfflineItem;
import com.utopiaindustries.util.KeyHolderFunctions;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
@ -21,6 +22,7 @@ public class FinishedItemDAO {
private final String TABLE_NAME = "cut_to_pack.finished_item";
private final String SELECT_QUERY = String.format( "SELECT * FROM %s WHERE id = :id", TABLE_NAME );
private final String SELECT_ALL_QUERY = String.format( "SELECT * FROM %s ORDER BY id DESC", TABLE_NAME );
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) VALUES (:id, :item_id, :sku, :barcode, :created_at, :created_by, :job_card_id, :is_qa, :stitched_item_id, :is_segregated, :qa_status) 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)", TABLE_NAME );
@ -157,4 +159,17 @@ public class FinishedItemDAO {
params.addValue("stitched_item_ids", stitchedItemIds );
return namedParameterJdbcTemplate.query( SELECT_BY_STITCHED_ITEM_IDS, params, new FinishedItemRowMapper() );
}
public List<StitchingOfflineItem> findByBarcodeAndApprovedStatus( List<StitchingOfflineItem> finishedItems ){
List<StitchingOfflineItem> items = new ArrayList<>();
for (StitchingOfflineItem item : finishedItems){
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("barcode", item.getBarcode() );
boolean check =Boolean.TRUE.equals(namedParameterJdbcTemplate.queryForObject( SELECT_QUERY_BY_BARCODE_QA_STATUS, params, Boolean.class ));
if(!check){
items.add(item);
}
}
return items;
}
}

View File

@ -1,5 +1,6 @@
package com.utopiaindustries.restcontroller;
import com.utopiaindustries.dao.ctp.FinishedItemDAO;
import com.utopiaindustries.dao.ctp.StitchingOfflineItemDAO;
import com.utopiaindustries.model.ctp.StitchingOfflineItem;
import org.springframework.web.bind.annotation.GetMapping;
@ -13,14 +14,18 @@ import java.util.List;
@RequestMapping( "/rest/stitching-offline-items" )
public class StitchingItemsRestController {
private final FinishedItemDAO finishedItemDAO;
private final StitchingOfflineItemDAO stitchingOfflineItemDAO;
public StitchingItemsRestController(StitchingOfflineItemDAO stitchingOfflineItemDAO) {
public StitchingItemsRestController(StitchingOfflineItemDAO stitchingOfflineItemDAO, FinishedItemDAO finishedItemDAO) {
this.stitchingOfflineItemDAO = stitchingOfflineItemDAO;
this.finishedItemDAO = finishedItemDAO;
}
@GetMapping( "/search" )
public List<StitchingOfflineItem> searchFinishedItems(@RequestParam( "term") String term ){
return stitchingOfflineItemDAO.findByTerm( term );
List<StitchingOfflineItem> items = stitchingOfflineItemDAO.findByTerm( term );
return finishedItemDAO.findByBarcodeAndApprovedStatus(items);
}
}

View File

@ -447,7 +447,7 @@ public class InventoryService {
.stream( )
.collect( Collectors.toMap( InventoryTransactionLeg::getParentDocumentId, Function.identity( )));
// get finished items from stitched items i f exists
// get finished items from stitched items if exists
List<Long> preCreatedFinishedItemIds = finishedItemDAO.findByStitchedItemIds( stitchedItemIds ).stream( ).
map( FinishedItem::getId ).collect( Collectors.toList( ));

View File

@ -16,7 +16,7 @@
}
},
template : `
<table class="table table-bordered bg-white col-sm-10">
<table class="table table-bordered bg-white col-sm-12">
<thead>
<tr>
<th>ID</th>

View File

@ -191,7 +191,7 @@
<input type="number" class="form-control" v-bind:name="'items[' + pIndex + '].cutPieces[' + index +'].quantity'" v-model="piece.quantity" required>
</div>
<div class="col-md-1">
<span class="bi-trash2-fill" title="Remove Piece" v-on:click="removePiece" ></span>
<span class="bi-trash2-fill btn" title="Remove Piece" v-on:click="removePiece" ></span>
</div>
</div>
`

View File

@ -15,7 +15,7 @@
}
},
template: `
<table class="table table-bordered bg-white col-sm-8">
<table class="table table-bordered bg-white col-sm-12">
<thead>
<tr>
<th>ID</th>

View File

@ -36,7 +36,7 @@
v-bind:disabled="hasDuplicates() || bundles.length === 0">
Submit
</button>
<a th:href="@{/cutting/bundles}" class="btn btn-light">Cancel</a>
<a th:href="@{/cutting/generate-master-barcode}" class="btn btn-light">Cancel</a>
</div>
</form>
<script th:inline="javascript">

View File

@ -22,7 +22,7 @@
<body>
<div class="container">
<div class="row">
<div class="col-sm-10">
<div class="col-sm-12">
<table th:if="${#lists.size(transactions) != 0 && #lists != null }" class="table table-bordered font-sm">
<thead>
<tr>

View File

@ -37,7 +37,7 @@
</div>
<div class="bg-light p-3 mb-3" v-if="jobCard.id !== undefined">
<h6>Job Card Details</h6>
<table class="table table-bordered bg-white col-sm-8">
<table class="table table-bordered bg-white col-sm-12">
<thead>
<tr>
<th>Code</th>
@ -65,7 +65,7 @@
</div>
<div>
<button class="btn btn-primary" type="submit">Receive Inventory</button>
<a th:href="@{/job-cards}" class="btn btn-light">Cancel</a>
<a th:href="@{/cutting/receive-inventory}" class="btn btn-light">Cancel</a>
</div>
</form>
<script th:inline="javascript">

View File

@ -10,15 +10,11 @@
<thead class="thead-dark">
<tr>
<th colspan="2" class="text-center">
<span th:text="'Job Card Detail'"></span>
<span th:text="${card.getCode()}"></span>
</th>
</tr>
</thead>
<tbody>
<tr>
<td width="200"><i>Code</i></td>
<td th:text="${card.getCode()}"></td>
</tr>
<tr>
<td><i>Job Order ID</i></td>
<td>
@ -60,7 +56,7 @@
<tr>
<td class="align-middle"><i>Items</i></td>
<td class="m-0 p-0">
<table class="table mb-0">
<table class="table mb-0 text-center">
<thead>
<tr>
<th>ID</th>

View File

@ -7,10 +7,6 @@
<div class="page-filters-sidebar">
<form th:action="@{${#strings.replace(#httpServletRequest.requestURI, #request.getContextPath(), '')}}">
<h5 class="mb-4">Refine Your Search</h5>
<div class="form-group">
<label>Item ID</label>
<input type="text" class="form-control" name="item-id" maxlength="100" th:value="${param['item-id']}">
</div>
<div class="form-group">
<label>SKu</label>
<input type="text" class="form-control" name="sku" maxlength="100" th:value="${param['sku']}">

View File

@ -29,11 +29,25 @@
<td th:rowspan="${#lists.size(sku)}" th:text="${sku}" class="align-middle" rowspan="3" ></td>
<td th:each="dates: ${dateLimits}" class="p-0 ">
<table th:each="data : ${tableData.get(sku)}" class="table table-striped table-bordered table-hover font-sm m-0 " >
<thead th:if="${data.getKey() == dates.toString()}">
<tr>
<th>ID</th>
<th>IN</th>
<th>OUT</th>
<th>BALANCE</th>
</tr>
</thead>
<tbody >
<tr th:each="reportSummary : ${data.getValue()}" rowspan="3" >
<td th:if="${data.getKey() == dates.toString()}" >
<span th:text="${reportSummary.getParentDocumentType()} + ' ' + ${reportSummary.getParentDocumentPieceType()}"></span>
</td>
<td th:if="${data.getKey() == dates.toString()}" class="w-25 text-center" >
<span th:text="${reportSummary.getTotalIn()}"></span>
</td>
<td th:if="${data.getKey() == dates.toString()}" class="w-25 text-center" >
<span th:text="${reportSummary.getTotalOut()}"></span>
</td>
<td th:if="${data.getKey() == dates.toString()}" class="w-25 text-center" >
<span th:text="${reportSummary.getTotalIn() - reportSummary.getTotalOut()}"></span>
</td>