fixed transactions And job card view #2

Merged
saif.haq merged 3 commits from ctp-working into main 2025-01-10 13:09:42 +00:00
10 changed files with 118 additions and 71 deletions

View File

@ -3,6 +3,7 @@ package com.utopiaindustries.controller;
import com.utopiaindustries.auth.AdminRole;
import com.utopiaindustries.model.ctp.InventoryAccount;
import com.utopiaindustries.service.InventoryAccountService;
import com.utopiaindustries.util.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
@ -20,8 +21,17 @@ public class InventoryAccountController {
}
@GetMapping
public String showInventoryAccounts( Model model ){
model.addAttribute( "accounts", inventoryAccountService.findInventoryAccounts() );
public String showInventoryAccounts( @RequestParam( value = "id", required = false ) String id,
@RequestParam( value = "title", required = false) String title,
@RequestParam( value = "active", required = false ) String active,
@RequestParam( value = "created-by", required = false ) String createdBy,
@RequestParam( value = "start-date", required = false ) String startDate,
@RequestParam( value = "end-date", required = false ) String endDate,
@RequestParam( value = "site-id", required = false ) String siteId,
@RequestParam( value = "count", required = false ) Long count,
Model model ){
model.addAttribute( "accounts", inventoryAccountService.findInventoryAccountsByFilter(id, title, active, createdBy, startDate, endDate, siteId, count) );
return "inventory-account-list";
}

View File

@ -54,15 +54,25 @@ public class InventoryAccountQueryBuilder {
.and()
.columnEqualToOrLessThan("created_at", endDate1)
.and()
.columnEquals("location_site_id", siteId)
.and()
.columnEquals("parent_entity_type", parentEntityType )
.and()
.columnEquals("parent_entity_id", parentEntityId )
.and()
.columnEquals("is_packaging", isPackaging );
.columnEquals("location_site_id", siteId);
if (!accountIds.isEmpty()) {
if (isPackaging != null){
qb.and()
.columnEquals("is_packaging", isPackaging );
}
if (parentEntityId != null && !parentEntityId.equals("")){
qb.and()
.columnEquals("parent_entity_id", parentEntityId );
}
if (parentEntityType != null && !parentEntityType.equals("")){
qb.and()
.columnEquals("parent_entity_type", parentEntityType );
}
if ( accountIds != null && !accountIds.isEmpty()) {
qb.and()
.columnIn("id", accountIds.toArray( new Long[0] ));
}

View File

@ -78,6 +78,36 @@ public class InventoryAccountService {
return accounts;
}
public List<InventoryAccount> findInventoryAccountsByFilter(String id, String title, String active, String createdBy, String startDate, String endDate,
String siteId, Long count){
List<InventoryAccount> accounts;
if( StringUtils.isAnyNotNullOrEmpty( id,title, active, createdBy, startDate, endDate, siteId ) ){
String query = InventoryAccountQueryBuilder.buildQuery(
id,
title,
active,
createdBy,
startDate,
endDate,
siteId,
count,
null,
"",
"",
null
);
System.out.println( query );
accounts = inventoryAccountDAO.findByQuery( query );
} else {
accounts = inventoryAccountDAO.findAll();
}
for( InventoryAccount account : accounts ){
account.setLocationTitle( locationSiteDAO.find( account.getLocationSiteId() ).getTitle() );
}
return accounts;
}
public InventoryAccount createNewAccount(){
// get login user
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();

View File

@ -308,6 +308,7 @@ public class InventoryService {
if(item.getTotalProduction() == null){
item.setTotalProduction(BigDecimal.ZERO);
}
item.setJobCardId(jobCard.getId());
// select which has inventory
if ( item.getProduction( ).compareTo( BigDecimal.ZERO ) != 0 ) {
// production is completed out bundles
@ -362,7 +363,7 @@ public class InventoryService {
stitchingOfflineItem.setCreatedBy( authentication.getName( ));
stitchingOfflineItem.setItemId( jobCardItem.getItemId( ));
stitchingOfflineItem.setSku( jobCardItem.getSku( ));
stitchingOfflineItem.setJobCardId( jobCardItem.getId( ));
stitchingOfflineItem.setJobCardId( jobCardItem.getJobCardId( ));
stitchingOfflineItem.setIsQa( false );
long id = stitchingOfflineItemDAO.save( stitchingOfflineItem);
stitchingOfflineItem.setId( id);

View File

@ -53,6 +53,9 @@ if ( typeof Vue !== 'undefined' ) {
},
clearTextOnSelect: {
default: false
},
inputMode:{
default: 'text'
}
},
data: function() {
@ -212,6 +215,7 @@ if ( typeof Vue !== 'undefined' ) {
v-bind:required="required"
v-bind:disabled="disabled"
v-bind:readonly="readOnly"
v-bind:inputmode="inputMode"
v-bind:class="{ 'is-invalid': ( showInputErrorOnZeroId && ( entityId === 0 || entityId == null ) ) }"
autocomplete="off">
<!-- autocomplete list -->
@ -3398,6 +3402,9 @@ if ( typeof Vue !== 'undefined' ) {
},
filter : {
default : true
},
inputMode: {
default : 'none'
}
}
})
@ -3434,6 +3441,9 @@ if ( typeof Vue !== 'undefined' ) {
},
received : {
default : false
},
inputMode: {
default : 'none'
}
}
})
@ -3467,6 +3477,9 @@ if ( typeof Vue !== 'undefined' ) {
codeFieldName : {
default : 'code'
},
inputMode: {
default : 'none'
}
}
});
@ -3503,6 +3516,9 @@ if ( typeof Vue !== 'undefined' ) {
},
isSegregated : {
default : false
},
inputMode: {
default : 'none'
}
}
})
@ -3535,6 +3551,9 @@ if ( typeof Vue !== 'undefined' ) {
},
codeFieldName : {
default : 'bundleCode'
},
inputMode: {
default : 'none'
}
}
})

View File

@ -7,72 +7,49 @@
<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>ID</label>
<input type="text" class="form-control" name="id" maxlength="100" th:value="${param['id']}">
</div>
<div class="form-group">
<label>Title</label>
<input type="text" class="form-control" name="item-title" maxlength="100" th:value="${param['item-title']}">
<input type="text" class="form-control" name="title" maxlength="100"
th:value="${param['title']}">
</div>
<div class="form-group">
<label>Sku</label>
<input type="text" class="form-control" name="item-sku" maxlength="100" th:value="${param['item-sku']}">
</div>
<div class="form-group">
<label>Item Unit</label>
<select class="form-control" name="item-unit" th:value="${param['item-unit']}">
<option value="">Please Select</option>
<option th:each="itemUnit: ${itemUnits}"
th:value="${itemUnit.id}"
th:text="${itemUnit.title}"
th:selected="${#strings.equals(param['item-unit'], #strings.toString(itemUnit.id))}"></option>
<label>Active</label>
<select name="active" class="form-control" >
<option value="">Please select</option>
<option value="1" th:selected="${#strings.equals(param['active'], #strings.toString(1))}">Active</option>
<option value="0" th:selected="${#strings.equals(param['active'], #strings.toString(0))}">In-Active</option>
</select>
</div>
<div class="form-group" th:if="${isShown}">
<label>Item Status</label>
<select class="form-control" name="item-request-approval-status" data-s2 multiple>
<option value="ALL" th:selected="${param['item-request-approval-status'] == null || #strings.equals('ALL', param['item-request-approval-status'])}">ALL</option>
<option th:each="status: ${T(com.utopiaindustries.uind.model.inventory.ItemRequestApprovalStatus).values()}"
th:value="${status}"
th:text="${status}"
th:selected="${param['item-request-approval-status'] == null ? false : #lists.contains(param['item-request-approval-status'], #strings.toString(status))}"></option>
</select>
</div>
<div data-item-type-category-container>
<div class="form-group">
<label>Type</label>
<select name="item-type-id" class="form-control" data-item-type>
<option data-empty-option value="">Please select</option>
</select>
</div>
<div class="form-group">
<label>Category</label>
<select name="item-category-id" class="form-control" data-item-category id = "item-category-select">
<option data-empty-option value="">Please select</option>
</select>
</div>
</div>
<!-- th:if="${isRequest}"-->
<div class="form-group">
<label>From Date</label>
<input type="date" class="form-control" name="from-date" >
<label>Created By</label>
<input type="text" class="form-control" name="created-by" maxlength="50" th:value="${param['created-by']}">
</div>
<div class="form-group">
<label>To Date</label>
<input type="date" class="form-control" name="to-date" >
<label>Created Start Date</label>
<input type="date" class="form-control" name="start-date" th:value="${param['start-date']}">
</div>
<div class="form-group">
<label>Status</label>
<select name="item-status" class="form-control">
<option value="">All</option>
<option value="1" th:selected="${#strings.equals(param['item-status'], #strings.toString(1))}">Active</option>
<option value="0" th:selected="${#strings.equals(param['item-status'], #strings.toString(0))}">Inactive</option>
</select>
<label>Created End Date</label>
<input type="date" class="form-control" name="end-date" th:value="${param['end-date']}">
</div>
<div class="form-group" data-vue-app th:with="id=${param['site-id']},title=${param['site-title']}">
<location-site-search th:attr="id=${id},title=${title}"
v-bind:id-field-name="'site-id'"
v-bind:title-field-name="'site-title'"
></location-site-search>
</div>
<!-- number of items -->
<div class="form-group">
<label>Number of Items</label>
<input type="number" class="form-control" name="item-count" th:value="(${param['item-count']} != null) ? ${param['item-count']} : 100">
<label>Count</label>
<input type="number" class="form-control" name="count" th:value="${param['count'] ?: 100}" min="0" step="1" />
</div>
<input type="submit" class="btn btn-secondary btn-block" value="Search">
<a th:href="@{${#strings.replace(#httpServletRequest.requestURI, #request.getContextPath(), '')}}" class="btn btn-secondary btn-block">Reset</a>
<a th:href="@{${#strings.replace(#httpServletRequest.requestURI, #request.getContextPath(), '')}}"
class="btn btn-secondary btn-block">Reset</a>
</form>
</div>
</aside>

View File

@ -45,7 +45,7 @@
<td th:text="*{title}"></td>
<td th:text="*{parentEntityType}"></td>
<td>
<span class="badge badge-ACTIVE" th:if="*{active}">ACTIVE</span>
<span class="badge badge-ACTIVE " th:if="*{active}">ACTIVE</span>
<span class="badge badge-danger" th:unless="*{active}" >INACTIVE</span>
</td>
<td th:text="*{createdBy}"></td>

View File

@ -36,7 +36,7 @@
<td th:text="*{id}"></td>
<td th:text="*{title}"></td>
<td th:text="*{parentEntityType}"></td>
<td th:text="*{active}" th:classappend="*{ active } ? 'badge badge-APPROVED' : 'badge badge-warning'"></td>
<td > <i th:text="*{ active.equals(true) ? 'Active' : 'In-Active' }" class="font-sm" th:classappend="*{ active } ? 'badge badge-APPROVED' : 'badge badge-danger'"></i></td>
<td th:text="*{createdBy}"></td>
<td ctp:formatdatetime="*{createdAt}"></td>
<td th:text="*{locationTitle}"></td>

View File

@ -37,11 +37,11 @@
<td><a class="text-reset" th:href="@{'/job-cards/view/' + *{id}}" th:text="*{code}"></a></td>
<td th:text="*{jobOrderId}"></td>
<td>
<span class="badge" th:classappend="'badge-' + *{status}" th:if="*{status}" th:text="*{status}"></span>
<span class="badge font-sm" th:classappend="'badge-' + *{status}" th:if="*{status}" th:text="*{status}"></span>
<span th:unless="*{status}">-</span>
</td>
<td>
<span class="badge" th:classappend="'badge-' + *{inventoryStatus}" th:if="*{inventoryStatus}" th:text="*{inventoryStatus}"></span>
<span class="badge font-sm" th:classappend="'badge-' + *{inventoryStatus}" th:if="*{inventoryStatus}" th:text="*{inventoryStatus}"></span>
<span th:unless="*{inventoryStatus}">-</span>
</td>
<td th:text="*{customer}"></td>

View File

@ -119,8 +119,8 @@
<td th:text="${cardStitchingItem.getSku()}"></td>
<td th:text="${cardStitchingItem.getBarcode()}"></td>
<td>
<span th:if="${cardStitchingItem.getQaStatus() == 'APPROVED'}" th:text="${cardStitchingItem.getQaStatus()}" class="badge badge-APPROVED"></span>
<span th:if="${cardStitchingItem.getQaStatus() == 'REJECT'}" th:text="${cardStitchingItem.getQaStatus()}" class="badge badge-warning"></span>
<span th:if="${cardStitchingItem.getQaStatus() == 'APPROVED'}" th:text="${cardStitchingItem.getQaStatus()}" class="badge badge-APPROVED font-sm"></span>
<span th:if="${cardStitchingItem.getQaStatus() == 'REJECT'}" th:text="${cardStitchingItem.getQaStatus()}" class="badge badge-warning font-sm"></span>
</td>
<td th:text="${cardStitchingItem.getQaRemarks()}"></td>
<td ctp:formatdatetime="${cardStitchingItem.getCreatedAt()}"></td>
@ -153,9 +153,9 @@
<td th:text="${cardfinishItem.getSku()}"></td>
<td th:text="${cardfinishItem.getBarcode()}"></td>
<td>
<span th:if="${cardfinishItem.getQaStatus() == 'APPROVED'}" th:text="${cardfinishItem.getQaStatus()}" class="badge badge-APPROVED"></span>
<span th:if="${cardfinishItem.getQaStatus() == 'WASHED'}" th:text="${cardfinishItem.getQaStatus()}" class="badge badge-danger"></span>
<span th:if="${cardfinishItem.getQaStatus() == 'ALTER'}" th:text="${cardfinishItem.getQaStatus()}" class="badge badge-warning"></span>
<span th:if="${cardfinishItem.getQaStatus() == 'APPROVED'}" th:text="${cardfinishItem.getQaStatus()}" class="badge badge-APPROVED font-sm"></span>
<span th:if="${cardfinishItem.getQaStatus() == 'WASHED'}" th:text="${cardfinishItem.getQaStatus()}" class="badge badge-danger font-sm"></span>
<span th:if="${cardfinishItem.getQaStatus() == 'ALTER'}" th:text="${cardfinishItem.getQaStatus()}" class="badge badge-warning font-sm"></span>
</td>
<td ctp:formatdatetime="${cardfinishItem.getCreatedAt()}"></td>
<td th:text="${cardfinishItem.getCreatedBy()}"></td>