add select account in store and packaging screen

add-store
usama.jameel 2025-05-29 11:51:12 +05:00
parent e8b107ac72
commit eb82cbd5b2
15 changed files with 97 additions and 62 deletions

View File

@ -35,22 +35,22 @@ public class DataSourceConfiguration {
/* COSMOS */
@Bean(name = "dataSourceCosmos")
@ConfigurationProperties(prefix = "spring.cosmosdatasource")
public DataSource cosmosDataSource() {
return DataSourceBuilder.create().build();
}
@Bean(name = "jdbcTemplateCosmos")
public JdbcTemplate cosmosJdbcTemplate( @Qualifier( "dataSourceCosmos" ) DataSource ds ) {
return new JdbcTemplate( ds );
}
@Bean(name = "namedParameterJdbcTemplateCosmos")
public NamedParameterJdbcTemplate cosmosNamedParameterJdbcTemplate( @Qualifier( "dataSourceCosmos" ) DataSource ds ) {
return new NamedParameterJdbcTemplate( ds );
}
// @Bean(name = "dataSourceCosmos")
// @ConfigurationProperties(prefix = "spring.cosmosdatasource")
// public DataSource cosmosDataSource() {
// return DataSourceBuilder.create().build();
// }
//
//
// @Bean(name = "jdbcTemplateCosmos")
// public JdbcTemplate cosmosJdbcTemplate( @Qualifier( "dataSourceCosmos" ) DataSource ds ) {
// return new JdbcTemplate( ds );
// }
//
// @Bean(name = "namedParameterJdbcTemplateCosmos")
// public NamedParameterJdbcTemplate cosmosNamedParameterJdbcTemplate( @Qualifier( "dataSourceCosmos" ) DataSource ds ) {
// return new NamedParameterJdbcTemplate( ds );
// }
/* LOCAL */
@ -73,6 +73,4 @@ public class DataSourceConfiguration {
public NamedParameterJdbcTemplate localNamedParameterJdbcTemplate( @Qualifier( "dataSourceLocal" ) DataSource ds ) {
return new NamedParameterJdbcTemplate( ds );
}
}

View File

@ -35,6 +35,7 @@ public class PackagingController {
@GetMapping("/receive-inventory")
public String packagingItemReceive( Model model ){
model.addAttribute("accounts", inventoryAccountService.findInventoryAccounts(6L));
model.addAttribute("wrapper", new FinishedItemWrapper() );
return "/packaging/receive-inventory-form";
}

View File

@ -34,6 +34,11 @@ public class ReportingController {
this.inventoryAccountService = inventoryAccountService;
}
@GetMapping
public String homePage( Model model ){
return "redirect:/reporting/po-report";
}
@GetMapping( "/summary")
public String summary(@RequestParam(value = "item-id", required = false ) String itemId, @RequestParam(value = "sku" , required = false) String sku, @RequestParam(value = "start-date", required = false) String startDate, @RequestParam(value = "end-date", required = false) String endDate, Model model ){

View File

@ -33,6 +33,7 @@ public class StoreController {
@GetMapping("/receive-inventory")
public String packagingItemReceive( Model model ){
model.addAttribute("accounts", inventoryAccountService.findInventoryAccounts(9L));
model.addAttribute("wrapper", new FinishedItemWrapper() );
return "/store/receive-inventory-form";
}
@ -43,7 +44,6 @@ public class StoreController {
RedirectAttributes redirectAttributes,
Model model ){
try {
System.out.println(wrapper);
storeService.createStoreItems( wrapper );
redirectAttributes.addFlashAttribute("success", "Items Successfully received !" );
} catch ( Exception e ){
@ -65,7 +65,7 @@ public class StoreController {
if(StringUtils.isNullOrEmpty( active )){
return "redirect:/store/inventory-accounts?id=&title=&active=1&created-by=&start-date=&end-date=&site-id=&site-title=&count=100";
}
model.addAttribute("accounts", inventoryAccountService.getInventoryAccounts( id, title, active, createdBy, startDate, endDate, siteId, count , null, null,true ) );
model.addAttribute("accounts", inventoryAccountService.findInventoryAccounts(9L));
model.addAttribute("locations", locationService.findAll() );
return "/store/inventory-accounts";
}

View File

@ -5,7 +5,7 @@ import java.util.List;
public class FinishedItemWrapper {
private String qaStatus;
private long accountId;
private Long accountId;
private List<FinishedItem> items;
@ -25,11 +25,11 @@ public class FinishedItemWrapper {
this.qaStatus = qaStatus;
}
public long getAccountId() {
public Long getAccountId() {
return accountId;
}
public void setAccountId(long accountId) {
public void setAccountId(Long accountId) {
this.accountId = accountId;
}

View File

@ -80,10 +80,10 @@ public class DashboardService {
approvedStitchingOfflineItems = stitchingOfflineItemDAO.findByQCOperationDateAndApproved(startDate1, endDate1, "APPROVED");
qcReject = stitchingOfflineItemDAO.findByQCOperationDateAndIds(startDate1, endDate1, "REJECT", stitchingItemIds);
remaininfQcAlterPieces = stitchingOfflineItemDAO.findByQCOperationDateAndIds(null, forPreviousDate, "REJECT", stitchingItemIds);
approvedStitchingOfflineItemsThenReject = stitchingOfflineItemDAO.findByQCOperationDateAndIds(startDate1, endDate1, "REJECT", stitchingOutIds);
}
if(stitchingOutIds != null && !stitchingOutIds.isEmpty()) {
approvedStitchingOfflineItemsThenReject = stitchingOfflineItemDAO.findByQCOperationDateAndIds(startDate1, endDate1, "REJECT", stitchingOutIds);
}
//set finishing related details
Long alterationPieceFinish = 0L;
Long rejectFinishedItem = 0L;
@ -127,7 +127,7 @@ public class DashboardService {
progress.put("totalWips", (float) stitchingItemIds.size() - qcReject);
progress.put("Alteration", (float) qcReject + approvedStitchingOfflineItemsThenReject);
progress.put("finishing", (float) approved + operationNotPerformed);
progress.put("finishing", (float) approved );
progress.put("ALTER", (float) alterationPieceFinish);
progress.put("Reject", (float) rejectFinishedItem);
progress.put("wash", (float) washFinishedItem);

View File

@ -614,6 +614,7 @@ public class InventoryService {
createInventoryTransactionLeg(transaction, finishedItem, lastOutTransaction.getAccountId(), InventoryTransactionLeg.Type.IN.name(), InventoryArtifactType.FINISHED_ITEM.name());
finishedItem.setQaStatus("ALTER");
finishedItem.setIsSegregated(false);
finishedItem.setIsQa(false);
}
}
@ -661,7 +662,7 @@ public class InventoryService {
* Packaging items
* */
@Transactional(rollbackFor = Exception.class, propagation = Propagation.NESTED)
public void createPackagingItemAndTransaction(FinishedItemWrapper wrapper) {
public void createPackagingItemAndTransaction(FinishedItemWrapper wrapper, long accountId) {
if (wrapper != null && wrapper.getItems() != null) {
List<FinishedItem> items = wrapper.getItems();
@ -693,9 +694,10 @@ public class InventoryService {
if (lastInvTransaction != null) {
// OUT
long fromAccount = lastInvTransaction.getAccountId();
packagingItems1.setAccountId(fromAccount);
createInventoryTransactionLeg(transaction, finishedItem, fromAccount, InventoryTransactionLeg.Type.OUT.name(), InventoryArtifactType.FINISHED_ITEM.name());
// IN
createInventoryTransactionLeg(transaction, packagingItems1, 8, InventoryTransactionLeg.Type.IN.name(), InventoryArtifactType.PACKAGING.name());
createInventoryTransactionLeg(transaction, packagingItems1, accountId, InventoryTransactionLeg.Type.IN.name(), InventoryArtifactType.PACKAGING.name());
}
finishedItem.setIsSegregated(true);
finishedItem.setPackaging(true);
@ -744,6 +746,7 @@ public class InventoryService {
if (lastInvTransaction != null) {
// OUT
long fromAccount = lastInvTransaction.getAccountId();
storeItem.setAccountId(fromAccount);
createInventoryTransactionLeg(transaction, finishedItem, fromAccount, InventoryTransactionLeg.Type.OUT.name(), InventoryArtifactType.FINISHED_ITEM.name());
// IN
createInventoryTransactionLeg(transaction, storeItem, toAccount, InventoryTransactionLeg.Type.IN.name(), InventoryArtifactType.STORED_ITEM.name());

View File

@ -16,7 +16,7 @@ public class PackagingService {
}
public void createPackagingItem(FinishedItemWrapper wrapper){
inventoryService.createPackagingItemAndTransaction(wrapper);
inventoryService.createPackagingItemAndTransaction(wrapper, wrapper.getAccountId());
}
}

View File

@ -1,8 +1,8 @@
spring:
uinddatasource:
jdbcUrl: jdbc:mysql://192.168.90.147:3306
username: utopia
password: Utopia01
jdbcUrl: jdbc:mysql://utopia-industries-rr.c5qech8o9lgg.us-east-1.rds.amazonaws.com:3306/inventory
username: cut-to-pack
password: mAzFAivImnTqKJx4KNJ0
driverClassName: com.mysql.cj.jdbc.Driver
logbackUrl: jdbc:mysql://192.168.90.147:3306/uind_logs?serverTimezone=Asia/Karachi
hikari:
@ -19,7 +19,7 @@ spring:
pool-name: UINDCosmosPool
leak-detection-threshold: 2000
localdatasource:
jdbcUrl: jdbc:mysql://192.168.90.147:3306/cut_to_pack
jdbcUrl: jdbc:mysql://localhost:3306/cut_to_pack
username: utopia
password: Utopia01
driverClassName: com.mysql.cj.jdbc.Driver

View File

@ -9,7 +9,7 @@ spring:
minimum-idle: 5
idle-timeout: 30000 # 30 seconds
max-lifetime: 1800000 # 30 minutes
connection-timeout: 30000 # 30 seconds
connection-timeout: 60000 # 30 seconds
leak-detection-threshold: 10000
cosmosdatasource:
jdbcUrl: jdbc:mysql://192.168.90.147:3307

View File

@ -79,7 +79,7 @@
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/store') ? 'active' : ''}">Store</a>
</li>
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_REPORTING', 'ROLE_ADMIN')">
<a th:href="@{/reporting/summary}" class="nav-link"
<a th:href="@{/reporting/}" class="nav-link"
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/reporting') ? 'active' : ''}">Reporting</a>
</li>
@ -141,6 +141,17 @@
</li>
</ul>
</nav>
<!-- second level purchase order-->
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/purchase-order')}">
<ul class="navbar-nav">
<li class="nav-item"
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/purchase-order') ? 'active' : ''}">
<a th:href="@{/purchase-order/}" class="nav-link">PO's</a>
</li>
</ul>
</nav>
<!-- second level cutting -->
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/cutting')}">
@ -258,6 +269,21 @@
</li>
</ul>
</nav>
<!-- second level store -->
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/store')}">
<ul class="navbar-nav">
<li class="nav-item"
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/store/receive-inventory') ? 'active' : ''}">
<a th:href="@{/store/receive-inventory}" class="nav-link">Receive Inventory</a>
</li>
<li class="nav-item"
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/store/inventory-accounts') ? 'active' : ''}">
<a th:href="@{/store/inventory-accounts}" class="nav-link">Inventory Accounts</a>
</li>
</ul>
</nav>
</div>
</header>
<!-- table loading skeleton -->

View File

@ -7,10 +7,11 @@
<header class="row page-header" th:replace="_fragments :: page-header"></header>
<main class="row page-main">
<div class="col-sm">
<div th:replace="_notices :: page-notices"></div>
<div class="mb-4 d-flex justify-content-between">
<h3>Receive Finished Items</h3>
<h3>Receive Packing Items</h3>
</div>
<form th:action="'/ctp/packaging/packaging-items'" method="post" id="packagingApp">
<form th:action="'/ctp/packaging/packaging-items'" method="post" id="packagingApp" th:object="${wrapper}">
<div class="bg-light p-3 mb-3">
<div class="form-row">
<div class="col-sm-3 form-group">
@ -21,13 +22,13 @@
</search-item>
</div>
<div class="col-sm-3 form-group">
<!-- <label>Packaging Account</label>-->
<!-- <select class="form-control" name="account-id" th:field="*{finishedAccountId}" required>-->
<!-- <option value="">PLease select</option>-->
<!-- <option th:each="account : ${accounts}"-->
<!-- th:value="${account.id}"-->
<!-- th:text="${account.title}"></option>-->
<!-- </select>-->
<label>Packaging Account</label>
<select class="form-control" name="account-id" th:field="*{accountId}" required>
<option value="">PLease select</option>
<option th:each="account : ${accounts}"
th:value="${account.id}"
th:text="${account.title}"></option>
</select>
</div>
</div>
</div>

View File

@ -13,7 +13,7 @@
<div class="col-sm">
<div th:replace="_notices :: page-notices"></div>
<div class="mb-4 d-flex justify-content-between">
<h3>Job Cards</h3>
<h3>All PO's</h3>
<a th:href="@{/purchase-order/new}" class="btn btn-primary">Add New</a>
</div>
<div th:replace="_fragments :: table-loading-skeleton"></div>
@ -55,7 +55,7 @@
</tbody>
</table>
<!-- Show message if purchaseOrder is null or empty -->
<h4 th:if="${purchaseOrder == null or purchaseOrder.isEmpty()}">No cards found.</h4>
<h4 th:if="${purchaseOrder == null or purchaseOrder.isEmpty()}">No POs found.</h4>
</div>
</main>
</div>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml"
xmlns:uind="http://www.w3.org/1999/xhtml" xmlns:ctp="http://www.w3.org/1999/xhtml">
<head th:replace="_fragments :: head('Packaging Inventory Accounts')"></head>
<head th:replace="_fragments :: head('Store Inventory Accounts')"></head>
<body>
<div class="container-fluid">
<header class="row page-header" th:replace="_fragments :: page-header"></header>
@ -13,7 +13,7 @@
<div class="col-sm">
<div th:replace="_notices :: page-notices"></div>
<div class="mb-4 d-flex justify-content-between">
<h3>Packaging Inventory Accounts</h3>
<h3>Store Inventory Accounts</h3>
</div>
<div th:replace="_fragments :: table-loading-skeleton"></div>
<table class="table table-striped" data-account-table data-order="[[ 0, &quot;asc&quot; ]]">

View File

@ -1,33 +1,34 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml"
xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head th:replace="_fragments :: head('Packaging Receive Inventory')"></head>
<head th:replace="_fragments :: head('Store Receive Inventory')"></head>
<body>
<div class="container-fluid">
<header class="row page-header" th:replace="_fragments :: page-header"></header>
<main class="row page-main">
<div class="col-sm">
<div th:replace="_notices :: page-notices"></div>
<div class="mb-4 d-flex justify-content-between">
<h3>Receive Finished Items</h3>
<h3>Receive Rejected Items</h3>
</div>
<form th:action="'/ctp/store/store-items'" method="post" id="packagingApp">
<form th:action="'/ctp/store/store-items'" method="post" id="packagingApp" th:object="${wrapper}">
<div class="bg-light p-3 mb-3">
<div class="form-row">
<input type="hidden" th:name="'accountId'" th:value="9"/>
<div class="col-sm-3 form-group">
<search-item
:is-segregated="false"
url="/ctp/rest/finished-items/search-store"
v-on:finished-item-select="onItemSelect">
</search-item>
<!-- <label>Packaging Account</label>-->
<!-- <select class="form-control" name="account-id" th:field="*{finishedAccountId}" required>-->
<!-- <option value="">PLease select</option>-->
<!-- <option th:each="account : ${accounts}"-->
<!-- th:value="${account.id}"-->
<!-- th:text="${account.title}"></option>-->
<!-- </select>-->
</div>
<div class="col-sm-3 form-group">
<label>Store Account</label>
<select class="form-control" name="accountId" th:field="*{accountId}" required>
<option value="">PLease select</option>
<option th:each="account : ${accounts}"
th:value="${account.id}"
th:text="${account.title}"></option>
</select>
</div>
</div>
</div>
@ -38,7 +39,7 @@
v-on:remove-item="removeItem"
></finish-item-table>
</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" type="submit" v-bind:disabled="hasDuplicates()">Submit</button>
<a th:href="@{/packaging/receive-inventory}" class="btn btn-light">Cancel</a>
</form>