fixed bugs and add accounts active and in-active, Fixed username field

pull/1/head
usama.jameel 2025-01-06 11:10:42 +05:00
parent dbbc4da853
commit d8777f63b0
36 changed files with 125 additions and 171 deletions

View File

@ -109,7 +109,6 @@ public class CuttingController {
@GetMapping( "/bundles" )
public String showBundles( @RequestParam( value = "id", required = false ) String id,
@RequestParam( value = "sku", required = false) String sku,
@RequestParam( value = "exceptionCheck", required = false, defaultValue = "false") boolean exceptionCheck,
@RequestParam( value = "jc-id", required = false) String jobCardId,
@RequestParam( value = "master-id" , required = false ) String masterId,
@RequestParam( value = "type", required = false) String type,
@ -121,32 +120,25 @@ public class CuttingController {
LocalDate startDate1 = StringUtils.isNullOrEmpty(startDate) ? LocalDate.now().minusDays(30) : LocalDate.parse(startDate);
LocalDate endDate1 = StringUtils.isNullOrEmpty(endDate) ? LocalDate.now() : LocalDate.parse(endDate);
model.addAttribute("startDate", startDate1);
model.addAttribute("endDate", endDate1);
model.addAttribute("bundles", bundleService.getBundles( id, sku, jobCardId, masterId, type, status, startDate1.toString(), endDate1.toString() ,count ) );
model.addAttribute("types", jobCardService.getAllPieceTypes() );
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";
}
return "/cutting/bundles";
}
@GetMapping( "/master-bundles")
public String showMasterBundles( @RequestParam(value = "id" , required = false) String id,
@RequestParam(value = "jc-id", required = false ) String jobCardId,
@RequestParam(value = "start-date", required = false) String startDate,
@RequestParam(value = "end-date", required = false) String endDate,
@RequestParam(value = "count", required = false) Long count,
@RequestParam( value = "exceptionCheck", required = false, defaultValue = "false") boolean exceptionCheck,
Model model, RedirectAttributes redirectAttributes ){
if(exceptionCheck){
redirectAttributes.addFlashAttribute("error", "Please Select At least One CheckBox." );
}
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("startDate", startDate1);
model.addAttribute("endDate", endDate1);
model.addAttribute("masterBundles", bundleService.getMasterBundles( id, jobCardId, startDate1.toString(), endDate1.toString(), count ) );
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";
}
@ -157,12 +149,22 @@ public class CuttingController {
return "/cutting/child-bundles";
}
@PostMapping( "/generate-barcodes" )
public Object generateBarcode(@RequestParam( name = "ids", required = false ) Long[] ids,
@RequestParam( name = "artifactType", required = true ) String artifactType ) throws Exception {
@PostMapping( "/generate-bundle-barcodes" )
public Object generateBundleBarcode(@RequestParam( name = "ids", required = false ) Long[] ids,
@RequestParam( name = "artifactType", required = true ) String artifactType , RedirectAttributes redirectAttributes) throws Exception {
if(ids == null){
return "redirect:/cutting/master-bundles?id=&jc-id=&start-date=2024-12-01&end-date=2024-12-31&count=100&exceptionCheck=true";
redirectAttributes.addFlashAttribute("error", "Please Select At least One CheckBox." );
return "redirect:/cutting/bundles";
}
return barcodeService.generateBarcodes( Arrays.asList( ids ), artifactType );
}
@PostMapping( "/generate-master-barcodes" )
public Object generateMasterBarcode(@RequestParam( name = "ids", required = false ) Long[] ids,
@RequestParam( name = "artifactType", required = true ) String artifactType, RedirectAttributes redirectAttributes ) throws Exception {
if(ids == null){
redirectAttributes.addFlashAttribute("error", "Please Select At least One CheckBox." );
return "redirect:/cutting/master-bundles";
}
return barcodeService.generateBarcodes( Arrays.asList( ids ), artifactType );
}

View File

@ -50,13 +50,14 @@ public class FinishingController {
@RequestParam( value = "job-card-id", required = false ) String jobCardId,
@RequestParam( value = "count", required = false ) Long count,
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("startDate", startDate1);
model.addAttribute("endDate", endDate1);
List<FinishedItem> itemList = bundleService.getFinishedItem( id, itemId, sku, startDate1.toString(), endDate1.toString(), jobCardId ,count );
model.addAttribute("items", itemList ) ;
if(StringUtils.isNullOrEmpty( startDate) || StringUtils.isNullOrEmpty( endDate )){
return "redirect:/finishing/finished-items?id=&item-id=&sku=&job-card-id=&start-date="+startDate1+"&end-date="+endDate1+"&count=100";
}
return "finishing/finished-item-list";
}
@ -72,14 +73,11 @@ public class FinishingController {
@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,
@RequestParam( value = "count", required = false, defaultValue = "100") Long count,
Model model ) {
// 5 for Finishing
model.addAttribute("accounts", inventoryAccountService.getInventoryAccounts( id, title, active, createdBy, startDate, endDate, siteId, count, "PROCESS", "5" , false ));
model.addAttribute("locations", locationService.findAll() );
if(count == null){
return "redirect:/finishing/inventory-accounts?id=&title=&active=&created-by=&start-date=&end-date=&site-id=&site-title=&count=100";
}
return "/finishing/inventory-accounts";
}

View File

@ -50,17 +50,17 @@ public class JobCardController {
@RequestParam( value = "created-end-date", required = false ) String createdEndDate,
@RequestParam( value = "limit" , required = false) Long limit,
Model model ){
List<JobCard> cards = jobCardService.getCards(code, status, inventoryStatus, customer, lotNumber, purchaseOrderId, locationSiteId,createdStartDate, createdEndDate, limit );
LocalDate startDate = StringUtils.isNullOrEmpty(createdStartDate) ? LocalDate.now().minusDays(30) : LocalDate.parse(createdStartDate);
LocalDate endDate = StringUtils.isNullOrEmpty(createdEndDate) ? LocalDate.now() : LocalDate.parse(createdEndDate);
String code1 = StringUtils.isNullOrEmpty(code) ? "" : code;
model.addAttribute("startDate", startDate);
model.addAttribute("endDate", endDate);
List<JobCard> cards = jobCardService.getCards(code1, status, inventoryStatus, customer, lotNumber, purchaseOrderId, locationSiteId,startDate.toString(), endDate.toString(), limit );
model.addAttribute("cards", cards );
model.addAttribute("statuses", JobCard.Status.values() );
model.addAttribute("invStatuses", JobCard.InventoryStatus.values() );
model.addAttribute("locations", locationService.findAll() );
LocalDate startDate = StringUtils.isNullOrEmpty(createdStartDate) ? LocalDate.now().minusDays(30) : LocalDate.parse(createdStartDate);
LocalDate endDate = StringUtils.isNullOrEmpty(createdEndDate) ? LocalDate.now() : LocalDate.parse(createdEndDate);
if(StringUtils.isNullOrEmpty( createdStartDate) || StringUtils.isNullOrEmpty( createdEndDate )){
return "redirect:/job-cards/?code=&status=&inventory-status=&customer=&lot-number=&purchase-order-id=&purchase-order-code=&purchaseOrderTitle=&site-id=&site-title=&created-start-date="+startDate+"&created-end-date="+endDate+"&limit=100";
}
return "job-card-list";
}
@ -88,7 +88,6 @@ public class JobCardController {
public String saveJobCard( @ModelAttribute JobCard jobCard,
RedirectAttributes redirectAttributes,
Model model ){
try {
jobCard.setStatus( JobCard.Status.DRAFT.name() );
jobCard.setInventoryStatus( JobCard.InventoryStatus.NOT_RECEIVED_YET.name() );
@ -154,7 +153,7 @@ public class JobCardController {
return "redirect:/job-cards";
}
@GetMapping( value = "/job-card-detail/{id}" )
@GetMapping( value = "/view/{id}" )
public String showJobCardDetail( @PathVariable("id") long id,
Model model ){
List<JobCardItem> jobCardItems = jobCardService.findJobCardItemByJobCardId(id);

View File

@ -42,11 +42,11 @@ public class PackagingController {
@RequestParam( value = "site-id", required = false ) String siteId,
@RequestParam( value = "count", required = false ) Long count,
Model model ){
model.addAttribute("accounts", inventoryAccountService.getInventoryAccounts( id, title, active, createdBy, startDate, endDate, siteId, count , null, null,true ) );
model.addAttribute("locations", locationService.findAll() );
if(count == null){
if(StringUtils.isNullOrEmpty( active )){
return "redirect:/packaging/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("locations", locationService.findAll() );
return "/packaging/inventory-accounts";
}
}

View File

@ -64,15 +64,14 @@ public class QualityControlController {
@RequestParam( value = "start-date", required = false) String startDate,
@RequestParam( value = "end-date", required = false ) String endDate,
@RequestParam( value = "job-card-id", required = false ) String jobCardId,
@RequestParam( value = "count", required = false ) Long count,
@RequestParam( value = "count", required = false, defaultValue = "100") Long count,
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("startDate", startDate1);
model.addAttribute("endDate", endDate1);
List<FinishedItem> itemList = bundleService.getFinishedItem( id, itemId, sku, startDate1.toString(), endDate1.toString(), jobCardId ,count );
model.addAttribute("items", itemList ) ;
if(StringUtils.isNullOrEmpty( startDate) || StringUtils.isNullOrEmpty( endDate )){
return "redirect:/quality-control/qc-finished-items?id=&item-id=&sku=&job-card-id=&start-date="+startDate1+"&end-date="+endDate1+"&count=100";
}
return "/quality-control/qc-items-list";
}

View File

@ -27,21 +27,16 @@ public class ReportingController {
}
@GetMapping( "/summary")
public String showMasterBundles(@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 ){
public String showMasterBundles(@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 ){
Map<String, Map<String, List<SummaryInventoryReport>>> getDataByFilteration = summaryInventoryReportService.findByFilter(itemId,sku,startDate,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);
model.addAttribute("startDate", startDate1);
model.addAttribute("endDate", endDate1);
Map<String, Map<String, List<SummaryInventoryReport>>> getDataByFilteration = summaryInventoryReportService.findByFilter(itemId,sku,startDate,endDate);
ArrayList<LocalDate> arrayList = generateDateList(startDate1,endDate1);
model.addAttribute("dateLimits", arrayList);
model.addAttribute("tableData", getDataByFilteration);
if(StringUtils.isNullOrEmpty( startDate) || StringUtils.isNullOrEmpty( endDate )){
return "redirect:/reporting/summary?item-id=&sku=&start-date="+startDate1.toString()+"&end-date="+endDate1;
}
return "/reporting/inventory-summary";
}

View File

@ -95,24 +95,15 @@ public class StitchingController {
@RequestParam( value = "start-date", required = false) String startDate,
@RequestParam( value = "end-date", required = false ) String endDate,
@RequestParam( value = "job-card-id", required = false ) String jobCardId,
@RequestParam( value = "count", required = false ) Long count,
@RequestParam( value = "count", required = false, defaultValue = "100") Long count,
Model model
,RedirectAttributes redirect){
LocalDate startDate1 = StringUtils.isNullOrEmpty(startDate) ? LocalDate.now().minusDays(30) : LocalDate.parse(startDate);
LocalDate endDate1 = StringUtils.isNullOrEmpty(endDate) ? LocalDate.now() : LocalDate.parse(endDate);
List<StitchingOfflineItem> itemList = bundleService.getStitchedOfflineItems( id, itemId, sku, startDate, endDate, jobCardId ,count );
model.addAttribute("items", itemList ) ;
if(model.getAttribute("message") != null){
if(model.getAttribute("message").equals("Finished Item Created Successfully") ){
redirect.addFlashAttribute("success", model.getAttribute("message"));
}else {
redirect.addFlashAttribute("error", model.getAttribute("message"));
}
}
if(StringUtils.isNullOrEmpty( startDate) || StringUtils.isNullOrEmpty( endDate )){
return "redirect:/stitching/stitching-offline-items?id=&item-id=&sku=&job-card-id=&start-date="+startDate1+"&end-date="+endDate1+"&count=100";
}
model.addAttribute("startDate", startDate1);
model.addAttribute("endDate", endDate1);
return "/stitching/stitched-offline-items";
}
@ -129,10 +120,10 @@ public class StitchingController {
Model model ){
try {
inventoryService.createStitchingOfflineItemsFromJobCard( jobCard );
redirectAttributes.addFlashAttribute("message", "Finished Item Created Successfully");
redirectAttributes.addFlashAttribute("success", "Finished Item Created Successfully");
} catch ( Exception exception ){
exception.printStackTrace();
redirectAttributes.addFlashAttribute( "message", exception.getMessage() );
redirectAttributes.addFlashAttribute( "error", exception.getMessage() );
}
return "redirect:/stitching/stitching-offline-items";
}
@ -141,10 +132,9 @@ public class StitchingController {
public Object generateBarcode(@RequestParam( name = "ids" ,required = false) Long[] ids,
@RequestParam( name = "artifactType" ) String artifactType, RedirectAttributes redirectAttributes ) throws Exception {
if (ids == null){
redirectAttributes.addFlashAttribute( "message", "Select At least One CheckBox" );
redirectAttributes.addFlashAttribute( "error", "Select At least One CheckBox" );
return "redirect:/stitching/stitching-offline-items";
}else {
return barcodeService.generateBarcodes( Arrays.asList( ids ), artifactType );
}
return barcodeService.generateBarcodes( Arrays.asList( ids ), artifactType );
}
}

View File

@ -33,7 +33,7 @@ public class UserController {
model.addAttribute("user", userService.createEmptyUser() );
model.addAttribute("accounts", inventoryAccountService.findInventoryAccounts() );
model.addAttribute("roles", Roles.values() );
model.addAttribute("isNew", true );
model.addAttribute("isNew", false );
return "_user-fragment";
}
@ -42,6 +42,7 @@ public class UserController {
model.addAttribute("user", userService.getUser( username ) );
model.addAttribute("accounts", inventoryAccountService.findInventoryAccounts() );
model.addAttribute("roles", Roles.values() );
model.addAttribute("isNew", true );
return "_user-fragment";
}
@ -50,12 +51,12 @@ public class UserController {
@ModelAttribute User user ,
RedirectAttributes redirectAttributes ){
try {
userService.saveUser( user );
userService.saveUser( user, true );
redirectAttributes.addFlashAttribute("success", "User Successfully Saved!" );
} catch ( Exception e ){
redirectAttributes.addFlashAttribute("error", e.getMessage() );
}
return "redirect:/users";
return "redirect:/users/new";
}
@PostMapping( "/edit/{username}" )
@ -63,7 +64,7 @@ public class UserController {
@ModelAttribute User user,
RedirectAttributes redirectAttributes ){
try {
userService.saveUser( user );
userService.saveUser( user, false );
redirectAttributes.addFlashAttribute("success", "User Successfully Edited!" );
} catch ( Exception e ){
redirectAttributes.addFlashAttribute("error", e.getMessage() );

View File

@ -82,13 +82,10 @@ public class AuthorityDAO {
// save all
public int[] saveAll( List<Authority> authorities ) {
List<MapSqlParameterSource> batchArgs = new ArrayList<>();
if (authorities == null){
return namedParameterJdbcTemplate.batchUpdate( INSERT_QUERY, batchArgs.toArray(new MapSqlParameterSource[0]) );
}
for ( Authority authority: authorities ) {
MapSqlParameterSource params = prepareInsertQueryParams( authority );
batchArgs.add( params );
}
return namedParameterJdbcTemplate.batchUpdate( INSERT_QUERY, batchArgs.toArray(new MapSqlParameterSource[authorities.size()]) );
return namedParameterJdbcTemplate.batchUpdate( INSERT_QUERY, batchArgs.toArray(new MapSqlParameterSource[authorities.size()]) );
}
}

View File

@ -1,25 +0,0 @@
package com.utopiaindustries.dao.ctp;
import com.utopiaindustries.model.ctp.FinishedItem;
import org.springframework.jdbc.core.RowMapper;
import java.sql.ResultSet;
import java.sql.SQLException;
public class FinishOfflineItemRowMapper implements RowMapper<FinishedItem> {
public FinishedItem mapRow(ResultSet rs, int rowNum ) throws SQLException {
FinishedItem finishedItem = new FinishedItem();
finishedItem.setId( rs.getLong( "id" ) );
finishedItem.setItemId( rs.getLong( "item_id" ) );
finishedItem.setSku( rs.getString( "sku" ) );
finishedItem.setBarcode( rs.getString( "barcode" ) );
if ( rs.getTimestamp( "created_at" ) != null ) {
finishedItem.setCreatedAt( rs.getTimestamp( "created_at" ).toLocalDateTime() );
}
finishedItem.setCreatedBy( rs.getString( "created_by" ) );
finishedItem.setJobCardId( rs.getLong("job_card_id") );
finishedItem.setIsQa( rs.getBoolean("is_qa"));
finishedItem.setQaStatus( rs.getString("qa_status" ) );
return finishedItem;
}
}

View File

@ -104,10 +104,6 @@ public class FinishedItemDAO {
return namedParameterJdbcTemplate.query( query, new FinishedItemRowMapper() );
}
public List<FinishedItem> findFinishOfflineItemByQuery(String query ){
return namedParameterJdbcTemplate.query( query, new FinishedItemRowMapper() );
}
public List<FinishedItem> findByIds(List<Long> ids ){
if( ids == null || ids.isEmpty() ) return new ArrayList<>();
MapSqlParameterSource params = new MapSqlParameterSource();
@ -139,7 +135,7 @@ public class FinishedItemDAO {
}
public HashMap<Long, Long> findTotalCount(List<Long> itemIds, long jobCardId) {
public HashMap<Long, Long> findTotalFinishedItems(List<Long> itemIds, long jobCardId) {
HashMap<Long, Long> totalCounts = new HashMap<>();
MapSqlParameterSource params = new MapSqlParameterSource();
for (long id : itemIds) {
@ -160,9 +156,9 @@ public class FinishedItemDAO {
return namedParameterJdbcTemplate.query( SELECT_BY_STITCHED_ITEM_IDS, params, new FinishedItemRowMapper() );
}
public List<StitchingOfflineItem> findByBarcodeAndApprovedStatus( List<StitchingOfflineItem> finishedItems ){
public List<StitchingOfflineItem> findByBarcodeAndApprovedStatus( List<StitchingOfflineItem> stitchingOfflineItems ){
List<StitchingOfflineItem> items = new ArrayList<>();
for (StitchingOfflineItem item : finishedItems){
for (StitchingOfflineItem item : stitchingOfflineItems){
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 ));

View File

@ -22,11 +22,11 @@ public class InventoryAccountDAO {
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, title, parent_entity_type, parent_entity_id, active, created_by, created_at, location_site_id, notes, is_packaging) VALUES (:id, :title, :parent_entity_type, :parent_entity_id, :active, :created_by, :created_at, :location_site_id, :notes, :is_packaging) ON DUPLICATE KEY UPDATE title = VALUES(title), parent_entity_type = VALUES(parent_entity_type), parent_entity_id = VALUES(parent_entity_id), active = VALUES(active), created_by = VALUES(created_by), created_at = VALUES(created_at), location_site_id = VALUES(location_site_id), notes = VALUES(notes), is_packaging = VALUES(is_packaging)", 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_AND_PARENT_ID = String.format( "SELECT * FROM %s WHERE id IN (:ids) AND parent_entity_id = :parent_entity_id", TABLE_NAME );
private final String SELECT_BY_IDS_AND_PARENT_IDS = String.format( "SELECT * FROM %s WHERE id IN (:ids) AND parent_entity_id IN (:parent_entity_ids)", TABLE_NAME );
private final String SELECT_BY_IDS_AND_PARENT_ID = String.format( "SELECT * FROM %s WHERE active = TRUE AND id IN (:ids) AND parent_entity_id = :parent_entity_id", TABLE_NAME );
private final String SELECT_BY_IDS_AND_PARENT_IDS = String.format( "SELECT * FROM %s WHERE active = TRUE AND id IN (:ids) AND parent_entity_id IN (:parent_entity_ids)", TABLE_NAME );
private final String SELECT_BY_IDS_AND_PARENT_ENTITY_TYPE_AND_PARENT_ID_AND_COUNT = String.format( "SELECT * FROM %s WHERE id IN (:ids) AND parent_entity_id = :parent_entity_id AND parent_entity_type = :parent_entity_type LIMIT :limit", TABLE_NAME );
private final String SELECT_BY_IDS_PACKAGING_AND_COUNT = String.format( "SELECT * FROM %s WHERE id IN (:ids) AND is_packaging = :is_packaging LIMIT :limit", TABLE_NAME );
private final String SELECT_BY_PARENT_TYPE_AND_PARENT_ID = String.format( "SELECT * FROM %s WHERE parent_entity_type = :parent_entity_type AND parent_entity_id = :parent_entity_id" , TABLE_NAME );
private final String SELECT_BY_PARENT_TYPE_AND_PARENT_ID = String.format( "SELECT * FROM %s WHERE active = TRUE AND parent_entity_type = :parent_entity_type AND parent_entity_id = :parent_entity_id" , TABLE_NAME );
public InventoryAccountDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;

View File

@ -125,7 +125,7 @@ public class StitchingOfflineItemDAO {
return namedParameterJdbcTemplate.query( SELECT_BY_MASTER_ID , params, new StitchingOfflineItemRowMapper() );
}
public HashMap<Long, Long> findTotalCount(List<Long> itemIds, long jobCardId) {
public HashMap<Long, Long> findTotalStitchingOfflineItems(List<Long> itemIds, long jobCardId) {
HashMap<Long, Long> totalCounts = new HashMap<>();
MapSqlParameterSource params = new MapSqlParameterSource();
for (long id : itemIds) {

View File

@ -43,7 +43,7 @@ public class InventoryAccountQueryBuilder {
.setColumns("*")
.where()
.columnLikeTitle("title", title)
.or()
.and()
.columnEquals("id", id)
.and()
.columnEquals("active", active)

View File

@ -26,30 +26,30 @@ public class JobCardQueryBuilder {
}
}
return ( new QueryBuilder() )
.setTable( "cut_to_pack.job_card" )
.setColumns( "*" )
return (new QueryBuilder())
.setTable("cut_to_pack.job_card")
.setColumns("*")
.where()
.columnEquals("created_by",createdBy)
.columnEquals("created_by", createdBy)
.and()
.columnLike( "code" , "%" + code +"%" )
.columnLike("code", "%" + code + "%")
.and()
.columnEquals( "status", status )
.columnEquals("status", status)
.and()
.columnEquals( "inventory_status", inventoryStatus )
.columnEquals("inventory_status", inventoryStatus)
.and()
.columnEquals( "customer", customer )
.columnEquals("customer", customer)
.and()
.columnEquals( "lot_number", lotNumber )
.columnEquals("lot_number", lotNumber)
.and()
.columnEquals( "purchase_order_id", purchaseOrderId )
.columnEquals("purchase_order_id", purchaseOrderId)
.and()
.columnEquals( "location_site_id", locationSiteId )
.columnEquals("location_site_id", locationSiteId)
.and()
.columnEqualToOrGreaterThan("created_at" , startDate1 )
.columnEqualToOrGreaterThan("created_at", startDate1)
.and()
.columnEqualToOrLessThan( "created_at", endDate1 )
.limit( count.intValue() )
.columnEqualToOrLessThan("created_at", endDate1)
.limit(count.intValue())
.build();
}
}

View File

@ -98,6 +98,7 @@ public class InventoryAccountService {
}
public List<Process> getAllProcess(){
return processDAO.findAll();
}

View File

@ -55,7 +55,7 @@ public class InventoryArtifactService {
/*
* get finished Items By Job Card ID
* */
public FinishedItem findFinishedItemByJobCardId( long id ){
public FinishedItem findByJobCardId( long id ){
FinishedItem finishedItem = finishedItemDAO.find( id );
finishedItem.setJobCard( jobCardDAO.find( finishedItem.getJobCardId() ) );
return finishedItem;

View File

@ -81,17 +81,18 @@ public class JobCardService {
Long limit) {
List<JobCard> jobCards = new ArrayList<>();
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
String createdBy = authentication.getName();
if( limit == null ){
limit = 100L;
}
if( StringUtils.isAnyNotNullOrEmpty( code, status, inventoryStatus, customer, lotNumber, purchaseOrderId, locationSiteId, createdStartDate, createdEndDate ) ){
String query = JobCardQueryBuilder.buildQuery(code, authentication.getName(), status, inventoryStatus, customer, lotNumber, purchaseOrderId, locationSiteId, createdStartDate, createdEndDate, limit );
System.out.println( query );
for (GrantedAuthority role : authentication.getAuthorities()){
if (role.toString().equals("ROLE_ADMIN")){
return jobCards = jobCardDAO.findByAllWithLimit(limit);
createdBy = "";
}
}
String query = JobCardQueryBuilder.buildQuery(code, createdBy, status, inventoryStatus, customer, lotNumber, purchaseOrderId, locationSiteId, createdStartDate, createdEndDate, limit );
System.out.println( query );
jobCards = jobCardDAO.findByQuery( query );
}else {
jobCards = jobCardDAO.findByUserAndLimit( authentication.getName(), limit );
@ -283,11 +284,11 @@ public class JobCardService {
return stitchingOfflineItemDAO.findByJobCardId( jobCardId );
}
public HashMap<Long, Long> totalStitchingItem(List<Long> itemIds, long jobCardId ){
return stitchingOfflineItemDAO.findTotalCount( itemIds, jobCardId );
public Map<Long, Long> totalStitchingItem(List<Long> itemIds, long jobCardId ){
return stitchingOfflineItemDAO.findTotalStitchingOfflineItems( itemIds, jobCardId );
}
public HashMap<Long, Long> totalFinishItem(List<Long> itemIds, long jobCardId ){
return finishedItemDAO.findTotalCount( itemIds, jobCardId );
public Map<Long, Long> totalFinishItem(List<Long> itemIds, long jobCardId ){
return finishedItemDAO.findTotalFinishedItems( itemIds, jobCardId );
}
}

View File

@ -44,19 +44,19 @@ public class SummaryInventoryReportService {
}
List<SummaryInventoryReport> summaries = summaryInventoryReportDao.findByFilter(itemId1, sku1, startDate1, endDate1);
Map<String, Map<String, List<SummaryInventoryReport>>> tableData = new HashMap<>();
Map<String, Map<String, List<SummaryInventoryReport>>> skuMapDateMap = new HashMap<>();
if(summaries == null) {
tableData = null;
skuMapDateMap = null;
}else {
for (SummaryInventoryReport summary : summaries) {
tableData
skuMapDateMap
.computeIfAbsent(summary.getSku(), k -> new HashMap<>()) // SKU as key
.computeIfAbsent(summary.getDate(), d -> new ArrayList<>()) // Date as key
.add(summary);
}
}
return tableData;
return skuMapDateMap;
}
}

View File

@ -64,7 +64,10 @@ public class UserService {
* save user
* */
@Transactional
public void saveUser( User user ){
public void saveUser( User user, boolean checkNewOrEdit ){
if(userDAO.findByUsername(user.getUsername()) != null && checkNewOrEdit ){
throw new RuntimeException("username already exists");
}
// save user
createUser( user );
// remove previous
@ -89,15 +92,13 @@ public class UserService {
List<Authority> newRoles = user.getAuthorities();
if(newRoles != null) {
newRoles.forEach(authority -> authority.setUsername(user.getUsername()));
authorityDAO.saveAll( newRoles );
}
List<UserInventoryAccount> newInventoryAccounts = user.getInventoryAccounts();
if( newInventoryAccounts != null ){
newInventoryAccounts.forEach(account -> account.setUsername( user.getUsername() ));
userInventoryAccountDAO.saveAll( newInventoryAccounts );
}
// save
authorityDAO.saveAll( newRoles );
}
private void deletePreviousRolesAndAccounts( User user ){

View File

@ -53,16 +53,16 @@
</div>
<div class="form-group">
<label>From Date</label>
<input type="date" class="form-control" name="created-start-date" th:value="${param['created-start-date']}" >
<input type="date" class="form-control" name="created-start-date" th:value="${param['created-start-date'] ?: startDate }" >
</div>
<div class="form-group">
<label>To Date</label>
<input type="date" class="form-control" name="created-end-date" th:value="${param['created-end-date']}" >
<input type="date" class="form-control" name="created-end-date" th:value="${param['created-end-date'] ?: endDate}" >
</div>
<div class="form-group">
<label>Count</label>
<input type="number" class="form-control" name="limit"
th:value="(${param['limit']} != null) ? ${param['limit']} : 100">
th:value="${param['limits'] ?: 100}">
</div>
<input type="submit" class="btn btn-secondary btn-block" value="Search">
<a th:href="@{${#strings.replace(#httpServletRequest.requestURI, #request.getContextPath(), '')}}"

View File

@ -22,11 +22,11 @@
<div class="form-row">
<div class="col-sm-3 form-group">
<label>Username</label>
<input class="form-control" th:field="*{username}" requried>
<input class="form-control" th:readonly="${isNew}" th:field="*{username}" requried>
</div>
<div class="col-sm-3 form-group">
<label>Password</label>
<input class="form-control" th:field="*{newPassword}" th:required="${isNew != null && isNew}">
<input class="form-control" th:field="*{newPassword}" th:readonly="${isNew}" required>
</div>
<div class="col-sm-3 form-group">
<label for="enable">Enabled</label>

View File

@ -46,15 +46,15 @@
</div>
<div class="form-group">
<label>Start Date</label>
<input type="date" class="form-control" name="start-date" th:value="${param['start-date']}">
<input type="date" class="form-control" name="start-date" th:value="${param['start-date'] ?: startDate}">
</div>
<div class="form-group">
<label>End Date</label>
<input type="date" class="form-control" name="end-date" th:value="${param['end-date']}">
<input type="date" class="form-control" name="end-date" th:value="${param['end-date'] ?: endDate}">
</div>
<div class="form-group">
<label>Count</label>
<input type="number" class="form-control" name="count" maxlength="100" min="0" th:value="${param['count']}">
<input type="number" class="form-control" name="count" maxlength="100" min="0" th:value="${param['count'] ?: 100}">
</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>

View File

@ -44,9 +44,9 @@
</div>
<div class="form-group">
<label>Count</label>
<input type="number" class="form-control" name="count" maxlength="100" th:value="${param['count']}" min="0" step="1" />
<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>

View File

@ -28,16 +28,16 @@
<div class="form-group">
<div class="form-group">
<label>Start Date</label>
<input type="date" class="form-control" name="start-date" th:value="${param['start-date']}">
<input type="date" class="form-control" name="start-date" th:value="${param['start-date'] ?: startDate}">
</div>
<div class="form-group">
<label>End Date</label>
<input type="date" class="form-control" name="end-date" th:value="${param['end-date']}">
<input type="date" class="form-control" name="end-date" th:value="${param['end-date'] ?: endDate}">
</div>
<div class="form-group">
<label>Count</label>
<input type="number" class="form-control" name="count" min="0" maxlength="100"
th:value="${param['count']}">
th:value="${param['count'] ?: 100}">
</div>
<input type="submit" class="btn btn-secondary btn-block" value="Search">
<a th:href="@{${#strings.replace(#httpServletRequest.requestURI, #request.getContextPath(), '')}}"

View File

@ -16,7 +16,7 @@
<h3>Bundles</h3>
</div>
<div th:replace="_fragments :: table-loading-skeleton"></div>
<form th:action="@{/cutting/generate-barcodes}" method="post">
<form th:action="@{/cutting/generate-bundle-barcodes}" method="post">
<input hidden="hidden" name="artifactType" value="Bundle">
<table class="table table-striped" data-table data-order="[[ 0, &quot;asc&quot; ]]">
<thead>

View File

@ -16,7 +16,7 @@
<h3>Master Bundles</h3>
</div>
<div th:replace="_fragments :: table-loading-skeleton"></div>
<form th:action="@{/cutting/generate-barcodes}" method="post">
<form th:action="@{/cutting/generate-master-barcodes}" method="post">
<input hidden="hidden" name="artifactType" value="MasterBundle">
<table class="table table-striped table-bordered" data-bundle-table
data-order="[[ 0, &quot;asc&quot; ]]">

View File

@ -12,7 +12,6 @@
</div>
<form th:action="'/ctp/finishing/segregate-inventory'" method="post" id="finishedApp">
<div class="bg-light p-3 mb-3">
<h6 class="mb-3">Search Finished Item</h6>
<div class="form-row">
<div class="col-sm-3 form-group">
<finished-item-search

View File

@ -17,7 +17,7 @@
<a th:href="@{/inventory-accounts/new}" class="btn btn-primary">Add New</a>
</div>
<div th:replace="_fragments :: table-loading-skeleton"></div>
<table th:if="${#lists.size(accounts) != 0 && #lists != null }" class="table table-striped table-bordered" data-table data-order="[[ 0, &quot;asc&quot; ]]">
<table th:if="${#lists != null && #lists.size(accounts) != 0 }" class="table table-striped table-bordered" data-table data-order="[[ 0, &quot;asc&quot; ]]">
<thead>
<tr>
<th>ID</th>
@ -36,7 +36,7 @@
<td th:text="*{id}"></td>
<td th:text="*{title}"></td>
<td th:text="*{parentEntityType}"></td>
<td th:text="*{active}"></td>
<td th:text="*{active}" th:classappend="*{ active } ? 'badge badge-APPROVED' : 'badge badge-warning'"></td>
<td th:text="*{createdBy}"></td>
<td ctp:formatdatetime="*{createdAt}"></td>
<td th:text="*{locationTitle}"></td>

View File

@ -16,7 +16,7 @@
<a th:href="@{/job-cards/new}" class="btn btn-primary">Add New</a>
</div>
<div th:replace="_fragments :: table-loading-skeleton"></div>
<table th:if="${#lists.size(cards) != 0 && #lists != null }" class="table table-striped font-sm" data-table data-order="[[ 0, &quot;asc&quot; ]]">
<table th:if="${ #lists != null && #lists.size(cards) != 0 }" class="table table-striped font-sm" data-table data-order="[[ 0, &quot;asc&quot; ]]">
<thead>
<tr>
<th>Code</th>
@ -34,7 +34,7 @@
</thead>
<tbody>
<tr th:each="card : ${cards}" th:object="${card}">
<td><a class="text-reset" th:href="@{'job-card-detail/' + *{getId()}}" th:text="*{code}"></a></td>
<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>

View File

@ -13,11 +13,11 @@
</div>
<div class="form-group">
<label>Start Date</label>
<input type="date" class="form-control" name="start-date" th:value="${param['start-date']}">
<input type="date" class="form-control" name="start-date" th:value="${param['start-date'] ?: startDate}">
</div>
<div class="form-group">
<label>End Date</label>
<input type="date" class="form-control" name="end-date" th:value="${param['end-date']}">
<input type="date" class="form-control" name="end-date" th:value="${param['end-date'] ?: endDate}">
</div>
<input type="submit" class="btn btn-secondary btn-block" value="Search">

View File

@ -11,7 +11,7 @@
<aside class="col-sm-2" th:replace="/reporting/inventory-summary-sidebar :: sidebar"></aside>
<div class="col-sm">
<h3 >Summary</h3>
<h3>Summary</h3>
<table th:if="${tableData != null}" class=" table table-striped table-bordered table-hover font-sm " data-table data-order="[[ 0, &quot;asc&quot; ]]">
<thead>

View File

@ -25,15 +25,15 @@
</div>
<div class="form-group">
<label>Start Date</label>
<input type="date" class="form-control" name="start-date" th:value="${param['start-date']}">
<input type="date" class="form-control" name="start-date" th:value="${param['start-date'] ?: startDate}">
</div>
<div class="form-group">
<label>End Date</label>
<input type="date" class="form-control" name="end-date" th:value="${param['end-date']}">
<input type="date" class="form-control" name="end-date" th:value="${param['end-date'] ?: endDate}">
</div>
<div class="form-group">
<label>Count</label>
<input type="number" class="form-control" name="count" maxlength="100" min="0" th:value="${param['count']}">
<input type="number" class="form-control" name="count" maxlength="100" min="0" th:value="${param['count'] ?: 100}">
</div>
<input type="submit" class="btn btn-secondary btn-block" value="Search">

View File

@ -19,7 +19,7 @@
<div th:replace="_fragments :: table-loading-skeleton"></div>
<form th:action="@{/stitching/generate-barcodes}" method="post">
<input hidden="hidden" name="artifactType" value="FinishedItem">
<table th:if="${#lists.size(items) != 0 && #lists != null }" class="table table-striped table-bordered" data-table
<table th:if="${ #lists != null && #lists.size(items) != 0 }" class="table table-striped table-bordered" data-table
data-order="[[ 0, &quot;asc&quot; ]]">
<thead>
<tr>

View File

@ -98,7 +98,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="@{/stitching/stitching-offline-items}" class="btn btn-light">Cancel</a>
</div>
</form>
<script th:inline="javascript">

View File

@ -17,7 +17,7 @@
<a th:href="@{/users/new}" class="btn btn-primary">Add New</a>
</div>
<div th:replace="_fragments :: table-loading-skeleton"></div>
<table th:if="${#lists.size(users) != 0 && #lists != null }" class="table table-striped table-bordered" data-table data-order="[[ 0, &quot;asc&quot; ]]">
<table th:if="${ #lists != null && #lists.size(users) != 0 }" class="table table-striped table-bordered" data-table data-order="[[ 0, &quot;asc&quot; ]]">
<thead>
<tr>
<th>User</th>