ctp-working #1

Merged
saif.haq merged 8 commits from ctp-working into main 2025-01-06 07:04:54 +00:00
64 changed files with 1147 additions and 145 deletions

View File

@ -21,5 +21,10 @@
<option name="name" value="In project repo" />
<option name="url" value="file:///D:\Projects\uind-cut-to-pack\cut-to-pack/libs" />
</remote-repository>
<remote-repository>
<option name="id" value="in-project" />
<option name="name" value="In project repo" />
<option name="url" value="file:///D:\Project\cut-to-pack-service/libs" />
</remote-repository>
</component>
</project>

View File

@ -0,0 +1,14 @@
package com.utopiaindustries.auth;
import org.springframework.security.access.prepost.PreAuthorize;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
@PreAuthorize( "hasAnyRole('ROLE_REPORTING','ROLE_ADMIN')")
public @interface ReportingRole {
}

View File

@ -4,13 +4,13 @@ import com.utopiaindustries.auth.CuttingRole;
import com.utopiaindustries.dao.ctp.BundleWrapper;
import com.utopiaindustries.model.ctp.JobCardWrapper;
import com.utopiaindustries.service.*;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.ResponseEntity;
import com.utopiaindustries.util.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import java.time.LocalDate;
import java.util.Arrays;
@Controller
@ -61,6 +61,9 @@ public class CuttingController {
@RequestParam( value = "site-id", required = false ) String siteId,
@RequestParam( value = "count", required = false ) Long count,
Model model ){
if(StringUtils.isNullOrEmpty( active )){
return "redirect:/cutting/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 , "PROCESS", "1", false) );
model.addAttribute("locations", locationService.findAll() );
return "/cutting/inventory-accounts";
@ -73,7 +76,7 @@ public class CuttingController {
@ModelAttribute JobCardWrapper wrapper ){
try {
inventoryService.receiveJobCardInventory( jobCardId, wrapper );
redirectAttributes.addFlashAttribute("success", "Inventory Success Received" );
redirectAttributes.addFlashAttribute("success", "Inventory Successfully Received by Job Card ID: " +jobCardId );
} catch ( Exception ex ){
redirectAttributes.addFlashAttribute("error", ex.getMessage() );
}
@ -112,21 +115,29 @@ 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 ){
model.addAttribute("bundles", bundleService.getBundles( id, sku, jobCardId, masterId, type, status, startDate, endDate ,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);
model.addAttribute("bundles", bundleService.getBundles( id, sku, jobCardId, masterId, type, status, startDate1.toString(), endDate1.toString() ,count ) );
model.addAttribute("types", jobCardService.getAllPieceTypes() );
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,
Model model ){
model.addAttribute("masterBundles", bundleService.getMasterBundles( id, jobCardId, startDate, endDate, 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);
model.addAttribute("masterBundles", bundleService.getMasterBundles( id, jobCardId, startDate1.toString(), endDate1.toString(), count ) );
return "/cutting/master-bundles";
}
@ -137,11 +148,23 @@ public class CuttingController {
return "/cutting/child-bundles";
}
@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){
redirectAttributes.addFlashAttribute("error", "Please Select At least One CheckBox." );
return "redirect:/cutting/bundles";
}
return barcodeService.generateBarcodes( Arrays.asList( ids ), artifactType );
}
@PostMapping( "/generate-barcodes" )
public ResponseEntity<InputStreamResource> generateBarcode(@RequestParam( name = "ids", required = true ) Long[] ids,
@RequestParam( name = "artifactType", required = true ) String artifactType ) throws Exception {
@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

@ -8,11 +8,13 @@ import com.utopiaindustries.service.BundleService;
import com.utopiaindustries.service.InventoryAccountService;
import com.utopiaindustries.service.InventoryService;
import com.utopiaindustries.service.LocationService;
import com.utopiaindustries.util.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import java.time.LocalDate;
import java.util.List;
@Controller
@ -48,8 +50,14 @@ public class FinishingController {
@RequestParam( value = "job-card-id", required = false ) String jobCardId,
@RequestParam( value = "count", required = false ) Long count,
Model model ){
List<FinishedItem> itemList = bundleService.getFinishedItem( id, itemId, sku, startDate, endDate, jobCardId ,count );
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 ) ;
return "finishing/finished-item-list";
}
@ -65,7 +73,7 @@ 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 ));

View File

@ -46,7 +46,7 @@ public class InventoryAccountController {
RedirectAttributes redirectAttributes ){
try {
inventoryAccountService.saveAccount( inventoryAccount );
redirectAttributes.addFlashAttribute("success", "Inventory Account Successfully Added" );
redirectAttributes.addFlashAttribute("success", inventoryAccount.getTitle() + " Successfully Added" );
} catch ( Exception e ){
redirectAttributes.addFlashAttribute("error", e.getMessage() );
}
@ -59,7 +59,7 @@ public class InventoryAccountController {
RedirectAttributes redirectAttributes ){
try {
inventoryAccountService.saveAccount( inventoryAccount );
redirectAttributes.addFlashAttribute("success", "Inventory Account Successfully Added" );
redirectAttributes.addFlashAttribute("success", inventoryAccount.getTitle() + " Successfully update" );
} catch ( Exception e ){
redirectAttributes.addFlashAttribute("error", e.getMessage() );
}

View File

@ -1,16 +1,22 @@
package com.utopiaindustries.controller;
import com.utopiaindustries.auth.JobCardRole;
import com.utopiaindustries.dao.ctp.JobCardDAO;
import com.utopiaindustries.model.ctp.JobCard;
import com.utopiaindustries.model.ctp.JobCardItem;
import com.utopiaindustries.service.InventoryAccountService;
import com.utopiaindustries.service.JobCardService;
import com.utopiaindustries.service.LocationService;
import com.utopiaindustries.util.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Controller
@JobCardRole
@ -20,30 +26,37 @@ public class JobCardController {
private final JobCardService jobCardService;
private final LocationService locationService;
private final InventoryAccountService inventoryAccountService;
private final JobCardDAO jobCardDAO;
public JobCardController(JobCardService jobCardService, LocationService locationService, InventoryAccountService inventoryAccountService){
public JobCardController(JobCardService jobCardService, LocationService locationService, InventoryAccountService inventoryAccountService, JobCardDAO jobCardDAO){
this.jobCardService = jobCardService;
this.locationService = locationService;
this.inventoryAccountService = inventoryAccountService;
this.jobCardDAO = jobCardDAO;
}
/**
* get all job cards
* */
@GetMapping
public String showJobCardList( @RequestParam( value = "id", required = false ) String id,
@RequestParam( value = "code", required = false ) String code,
public String showJobCardList( @RequestParam( value = "code", required = false ) String code,
@RequestParam( value = "status", required = false ) String status,
@RequestParam( value = "inventory-status" , required = false) String inventoryStatus,
@RequestParam( value = "customer" ,required = false ) String customer,
@RequestParam( value = "lot-number", required = false ) String lotNumber,
@RequestParam( value = "purchase-order-id", required = false ) String purchaseOrderId,
@RequestParam( value = "location-site-id", required = false ) String locationSiteId,
@RequestParam( value = "site-id", required = false ) String locationSiteId,
@RequestParam( value = "created-start-date", required = false ) String createdStartDate,
@RequestParam( value = "created-end-date", required = false ) String createdEndDate,
@RequestParam( value = "limit" , required = false) Long limit,
Model model ){
List<JobCard> cards = jobCardService.getCards( id, 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() );
@ -75,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() );
@ -131,7 +143,6 @@ public class JobCardController {
@PathVariable long id,
RedirectAttributes redirectAttributes,
Model model ){
try {
jobCard.setStatus(JobCard.Status.POSTED.name() );
jobCardService.save( jobCard );
@ -141,4 +152,33 @@ public class JobCardController {
}
return "redirect:/job-cards";
}
@GetMapping( value = "/view/{id}" )
public String showJobCardDetail( @PathVariable("id") long id,
usama.jameel marked this conversation as resolved

job-card/view/{id}

job-card/view/{id}
Model model ){
List<JobCardItem> jobCardItems = jobCardService.findJobCardItemByJobCardId(id);
List<Long> jobCardItemIds = jobCardItems.stream()
.map(JobCardItem::getItemId)
.collect(Collectors.toList());
List<Long> itemIds = jobCardItems.stream()
.map(JobCardItem::getId)
.collect(Collectors.toList());
model.addAttribute( "card", jobCardService.findByID(id));
model.addAttribute("jobCardItems", jobCardItems);
model.addAttribute("cutPiece",jobCardService.findCutPieceByJobCardItemIds(itemIds));
model.addAttribute("finishItem",jobCardService.findFinishItemByJobCardId(id));
model.addAttribute("stitchingItem",jobCardService.findStitchItemByJobCardId(id));
model.addAttribute("totalFinishItem",jobCardService.totalFinishItem(jobCardItemIds, id));
model.addAttribute("totalStitchingItem",jobCardService.totalStitchingItem(jobCardItemIds, id));
return "job-card-view";
}
private ArrayList<LocalDate> generateDateList(LocalDate start, LocalDate end) {
ArrayList<LocalDate> localDates = new ArrayList<>();
while (start.isBefore(end)) {
localDates.add(start);
start = start.plusDays(1);
}
return localDates;
}
}

View File

@ -3,12 +3,15 @@ package com.utopiaindustries.controller;
import com.utopiaindustries.auth.PackagingRole;
import com.utopiaindustries.service.InventoryAccountService;
import com.utopiaindustries.service.LocationService;
import com.utopiaindustries.util.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.time.LocalDate;
@Controller
@PackagingRole
@RequestMapping("/packaging" )
@ -39,10 +42,11 @@ public class PackagingController {
@RequestParam( value = "site-id", required = false ) String siteId,
@RequestParam( value = "count", required = false ) Long count,
Model model ){
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";
}
usama.jameel marked this conversation as resolved

remove check

remove check
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

@ -7,11 +7,13 @@ import com.utopiaindustries.service.BundleService;
import com.utopiaindustries.service.InventoryAccountService;
import com.utopiaindustries.service.InventoryService;
import com.utopiaindustries.service.LocationService;
import com.utopiaindustries.util.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import java.time.LocalDate;
import java.util.List;
@Controller
@ -62,9 +64,13 @@ 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 ){
List<FinishedItem> itemList = bundleService.getFinishedItem( id, itemId, sku, startDate, endDate, jobCardId ,count );
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 );
usama.jameel marked this conversation as resolved

move check up

move check up
model.addAttribute("items", itemList ) ;
return "/quality-control/qc-items-list";
}

View File

@ -0,0 +1,51 @@
package com.utopiaindustries.controller;
import com.utopiaindustries.auth.CuttingRole;
import com.utopiaindustries.auth.ReportingRole;
import com.utopiaindustries.model.ctp.SummaryInventoryReport;
import com.utopiaindustries.service.SummaryInventoryReportService;
import com.utopiaindustries.util.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Controller
@ReportingRole
@RequestMapping( "/reporting" )
public class ReportingController {
private final SummaryInventoryReportService summaryInventoryReportService;
public ReportingController(SummaryInventoryReportService summaryInventoryReportService2) {
this.summaryInventoryReportService = summaryInventoryReportService2;
}
@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 ){
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);
return "/reporting/inventory-summary";
}
usama.jameel marked this conversation as resolved

move check up before db call

move check up before db call
private ArrayList<LocalDate> generateDateList(LocalDate start, LocalDate end) {
ArrayList<LocalDate> localDates = new ArrayList<>();
while (start.isBefore(end)) {
localDates.add(start);
start = start.plusDays(1);
}
return localDates;
}
}

View File

@ -4,13 +4,13 @@ import com.utopiaindustries.auth.StitchingRole;
import com.utopiaindustries.model.ctp.JobCard;
import com.utopiaindustries.model.ctp.StitchingOfflineItem;
import com.utopiaindustries.service.*;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.ResponseEntity;
import com.utopiaindustries.util.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;
@ -75,8 +75,13 @@ public class StitchingController {
@RequestParam( value = "count", required = false ) Long count,
Model model ) {
// 2 for stitching
model.addAttribute("accounts", inventoryAccountService.getInventoryAccounts(id, title, active, createdBy, startDate, endDate, siteId, count, "PROCESS", "2", false));
model.addAttribute("locations", locationService.findAll() );
if(count == null){
return "redirect:/stitching/inventory-accounts?id=&title=&active=1&created-by=&start-date=&end-date=&site-id=&site-title=&count=100";
}
return "/stitching/inventory-accounts";
}
@ -90,10 +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,
Model model ){
@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 ) ;
model.addAttribute("startDate", startDate1);
model.addAttribute("endDate", endDate1);
return "/stitching/stitched-offline-items";
}
@ -119,9 +129,12 @@ public class StitchingController {
}
@PostMapping( "/generate-barcodes" )
public ResponseEntity<InputStreamResource> generateBarcode(@RequestParam( name = "ids" ) Long[] ids,
@RequestParam( name = "artifactType" ) String artifactType ) throws Exception {
public Object generateBarcode(@RequestParam( name = "ids" ,required = false) Long[] ids,
@RequestParam( name = "artifactType" ) String artifactType, RedirectAttributes redirectAttributes ) throws Exception {
if (ids == null){
redirectAttributes.addFlashAttribute( "error", "Select At least One CheckBox" );
return "redirect:/stitching/stitching-offline-items";
}
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

@ -88,5 +88,4 @@ public class AuthorityDAO {
}
return namedParameterJdbcTemplate.batchUpdate( INSERT_QUERY, batchArgs.toArray(new MapSqlParameterSource[authorities.size()]) );
}
}

View File

@ -21,6 +21,7 @@ public class CutPieceDAO {
private final String SELECT_ALL_QUERY = String.format( "SELECT * FROM %s ORDER BY id DESC", TABLE_NAME );
private final String DELETE_QUERY = String.format( "DELETE FROM %s WHERE id = :id", TABLE_NAME );
private final String SELECT_BY_ITEM_IDS = String.format( "SELECT * FROM %s WHERE job_card_item_id IN (:item_ids)", TABLE_NAME );
private final String SELECT_BY_ITEM_IDS_AND_GROUP_BY = String.format( "SELECT id,job_card_item_id,type,SUM(quantity) AS quantity FROM %s WHERE job_card_item_id IN (:item_ids) GROUP BY job_card_item_id, type", TABLE_NAME );
private final String INSERT_QUERY = String.format( "INSERT INTO %s (id, job_card_item_id, type, quantity) VALUES (:id, :job_card_item_id, :type, :quantity) ON DUPLICATE KEY UPDATE job_card_item_id = VALUES(job_card_item_id), type = VALUES(type), quantity = VALUES(quantity)", TABLE_NAME );
private final String DELETE_BY_ITEM_ID = String.format( "DELETE FROM %s WHERE job_card_item_id = :job_card_item_id", TABLE_NAME );
@ -86,6 +87,14 @@ public class CutPieceDAO {
return namedParameterJdbcTemplate.query(SELECT_BY_ITEM_IDS, params, new CutPieceRowMapper() );
}
public List<CutPiece> findByJobCardItemIdsWithGroupByType( List<Long> itemIds ){
if( itemIds == null || itemIds.isEmpty() )
return new ArrayList<>();
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("item_ids", itemIds );
return namedParameterJdbcTemplate.query(SELECT_BY_ITEM_IDS_AND_GROUP_BY, params, new CutPieceRowMapper() );
}
public boolean deleteByItemId( long jobCardItemId ){
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("job_card_item_id", jobCardItemId );

View File

@ -1,6 +1,8 @@
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;
@ -9,6 +11,7 @@ import org.springframework.jdbc.support.KeyHolder;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@Repository
@ -19,10 +22,13 @@ 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 );
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_segregated = :is_segregated 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", 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 );
@ -112,6 +118,12 @@ public class FinishedItemDAO {
return namedParameterJdbcTemplate.query( SELECT_BY_TERM , params, new FinishedItemRowMapper() );
}
// find By job card Id
public List<FinishedItem> findByJobCardId(long jobCardId ) {
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue( "job_card_id", jobCardId );
return namedParameterJdbcTemplate.query(SELECT_QUERY_BY_JOB_CARD, params, new FinishedItemRowMapper() );
}
public FinishedItem findByStitchedItem( long stitchedItemId ){
MapSqlParameterSource params = new MapSqlParameterSource();
@ -123,10 +135,37 @@ public class FinishedItemDAO {
}
public HashMap<Long, Long> findTotalFinishedItems(List<Long> itemIds, long jobCardId) {
HashMap<Long, Long> totalCounts = new HashMap<>();
MapSqlParameterSource params = new MapSqlParameterSource();
for (long id : itemIds) {
params.addValue("job_card_id", jobCardId);
usama.jameel marked this conversation as resolved

rename function

rename function
params.addValue("item_id", id);
Long total = namedParameterJdbcTemplate.queryForObject(FIND_TOTAL_COUNT, params, Long.class);
if (total != null) {
totalCounts.put(id, total);
}
}
return totalCounts;
}
public List<FinishedItem> findByStitchedItemIds( List<Long> stitchedItemIds ){
if( stitchedItemIds == null || stitchedItemIds.isEmpty() ) return new ArrayList<>();
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("stitched_item_ids", stitchedItemIds );
return namedParameterJdbcTemplate.query( SELECT_BY_STITCHED_ITEM_IDS, params, new FinishedItemRowMapper() );
}
public List<StitchingOfflineItem> findByBarcodeAndApprovedStatus( List<StitchingOfflineItem> stitchingOfflineItems ){
List<StitchingOfflineItem> items = new ArrayList<>();
for (StitchingOfflineItem item : stitchingOfflineItems){
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("barcode", item.getBarcode() );
usama.jameel marked this conversation as resolved

rename function params

rename function params
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

@ -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

@ -21,6 +21,7 @@ public class JobCardDAO {
private final String TABLE_NAME = "cut_to_pack.job_card";
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_ALL_QUERY_WITH_LIMIT = String.format( "SELECT * FROM %s ORDER BY id DESC limit :limit", 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, code, job_order_id, created_at, created_by, status, inventory_status, customer, lot_number, purchase_order_id, location_site_id, description) VALUES (:id, :code, :job_order_id, :created_at, :created_by, :status, :inventory_status, :customer, :lot_number, :purchase_order_id, :location_site_id, :description) ON DUPLICATE KEY UPDATE code = VALUES(code), job_order_id = VALUES(job_order_id), created_at = VALUES(created_at), created_by = VALUES(created_by), status = VALUES(status), inventory_status = VALUES(inventory_status), customer = VALUES(customer), lot_number = VALUES(lot_number), purchase_order_id = VALUES(purchase_order_id), location_site_id = VALUES(location_site_id), description = VALUES(description)", TABLE_NAME );
private final String SELECT_BY_LIKE_CODE_AND_INV_STATUS_AND_STATUS = String.format( "SELECT * FROM %s WHERE code like :code AND status = :status AND inventory_status = :inventory_status", TABLE_NAME );
@ -56,6 +57,7 @@ public class JobCardDAO {
.orElse( new JobCard() );
}
// find all
public List<JobCard> findAll() {
return namedParameterJdbcTemplate.query( SELECT_ALL_QUERY, new JobCardRowMapper() );
@ -110,4 +112,10 @@ public class JobCardDAO {
public List<JobCard> findByQuery( String query ){
return namedParameterJdbcTemplate.query( query, new JobCardRowMapper() );
}
public List<JobCard> findByAllWithLimit(Long limit){
usama.jameel marked this conversation as resolved

findByLimit()

findByLimit()
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("limit", limit.intValue());
return namedParameterJdbcTemplate.query( SELECT_ALL_QUERY_WITH_LIMIT, params, new JobCardRowMapper() );
}
}

View File

@ -9,6 +9,7 @@ import org.springframework.jdbc.support.KeyHolder;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@Repository
@ -19,9 +20,11 @@ public class StitchingOfflineItemDAO {
private final String TABLE_NAME = "cut_to_pack.stitching_offline_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_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, qa_remarks, qa_status) VALUES (:id, :item_id, :sku, :barcode, :created_at, :created_by, :job_card_id, :is_qa, :qa_remarks, :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), qa_remarks = VALUES(qa_remarks), qa_status = VALUES(qa_status)", TABLE_NAME );
private final String SELECT_BY_LIMIT = String.format("SELECT * FROM %s ORDER BY id DESC LIMIT :limit", 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_IDS = String.format( "SELECT * FROM %s WHERE id IN (:ids)", TABLE_NAME );
private final String SELECT_BY_TERM = String.format( "SELECT * FROM %s WHERE barcode LIKE :term ORDER BY ID DESC", TABLE_NAME );
private final String SELECT_BY_MASTER_ID = String.format( "SELECT * FROM %s WHERE job_card_id = :job_card_id", TABLE_NAME );
@ -103,6 +106,12 @@ public class StitchingOfflineItemDAO {
return namedParameterJdbcTemplate.query( SELECT_BY_IDS , params, new StitchingOfflineItemRowMapper() );
}
public List<StitchingOfflineItem> findByJobCardId(long jobCardId){
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue( "job_card_id", jobCardId );
return namedParameterJdbcTemplate.query( SELECT_QUERY_BY_JOB_CARD , params, new StitchingOfflineItemRowMapper() );
}
public List<StitchingOfflineItem> findByTerm( String term ){
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("term", "%" + term + "%" );
@ -115,4 +124,20 @@ public class StitchingOfflineItemDAO {
params.addValue("job_card_id", masterId );
return namedParameterJdbcTemplate.query( SELECT_BY_MASTER_ID , params, new StitchingOfflineItemRowMapper() );
}
public HashMap<Long, Long> findTotalStitchingOfflineItems(List<Long> itemIds, long jobCardId) {
HashMap<Long, Long> totalCounts = new HashMap<>();
MapSqlParameterSource params = new MapSqlParameterSource();
for (long id : itemIds) {
params.addValue("job_card_id", jobCardId);
params.addValue("item_id", id);
Long total = namedParameterJdbcTemplate.queryForObject(FIND_TOTAL_COUNT, params, Long.class);
if (total != null) {
totalCounts.put(id, total);
}
}
return totalCounts;
}
}

View File

@ -0,0 +1,45 @@
package com.utopiaindustries.dao.ctp;
import com.utopiaindustries.model.ctp.SummaryInventoryReport;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class SummaryInventoryReportDao {
private final NamedParameterJdbcTemplate namedParameterJdbcTemplate;
private final String TABLE_NAME = "cut_to_pack.inventory_transaction_leg ";
String SELECT_QUERY = "SELECT item_id, account_id, parent_document_id, DATE(transaction_leg_datetime) AS transaction_date, "
+ "sku, parent_document_type, parent_document_piece_type, "
+ "SUM(CASE WHEN type = 'IN' THEN 1 ELSE 0 END) AS total_in, "
+ "SUM(CASE WHEN type = 'OUT' THEN 1 ELSE 0 END) AS total_out "
+ "FROM " + TABLE_NAME + " "
+ "WHERE "
+ "(:sku IS NULL OR sku = :sku) "
+ "AND (:item_id IS NULL OR item_id = :item_id) "
+ "OR (:start_date IS NULL OR :end_date IS NULL OR transaction_leg_datetime BETWEEN :start_date AND :end_date) "
+ "GROUP BY DATE(transaction_leg_datetime), sku, parent_document_type, parent_document_piece_type "
+ "ORDER BY transaction_date, sku;";
public SummaryInventoryReportDao(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
}
//find by filter for reporting
public List<SummaryInventoryReport> findByFilter(Integer itemId, String sku, String startDate, String endDate) {
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("sku", sku);
params.addValue("item_id", itemId);
params.addValue("start_date", startDate);
params.addValue("end_date", endDate);
// Query the database and map the result
List<SummaryInventoryReport> results = namedParameterJdbcTemplate.query(SELECT_QUERY, params, new SummaryInventoryReportRowMapper());
return results.isEmpty() ? null : results;
}
}

View File

@ -0,0 +1,23 @@
package com.utopiaindustries.dao.ctp;
import com.utopiaindustries.model.ctp.SummaryInventoryReport;
import org.springframework.jdbc.core.RowMapper;
import java.sql.ResultSet;
import java.sql.SQLException;
public class SummaryInventoryReportRowMapper implements RowMapper<SummaryInventoryReport> {
public SummaryInventoryReport mapRow(ResultSet rs, int rowNum) throws SQLException {
SummaryInventoryReport summaryInventoryReport = new SummaryInventoryReport();
summaryInventoryReport.setItemId(rs.getInt("item_id"));
summaryInventoryReport.setSku(rs.getString("sku"));
summaryInventoryReport.setParentDocumentId(rs.getString("parent_document_id"));
summaryInventoryReport.setAccountId(rs.getString("account_id"));
summaryInventoryReport.setDate(rs.getString("transaction_date"));
summaryInventoryReport.setTotalIn(rs.getLong("total_in"));
summaryInventoryReport.setTotalOut(rs.getLong("total_out"));
summaryInventoryReport.setParentDocumentType(rs.getString("parent_document_type"));
summaryInventoryReport.setParentDocumentPieceType(rs.getString("parent_document_piece_type"));
return summaryInventoryReport;
}
}

View File

@ -8,5 +8,6 @@ public enum Roles {
ROLE_STITCHING,
ROLE_QUALITY_CONTROL,
ROLE_FINISHING,
ROLE_PACKAGING
ROLE_PACKAGING,
ROLE_REPORTING
}

View File

@ -0,0 +1,94 @@
package com.utopiaindustries.model.ctp;
public class SummaryInventoryReport {
private int id;
private int itemId;
private String sku;
private String Date;
private long totalIn;
private long totalOut;
private String parentDocumentType;
private String parentDocumentId;
private String accountId;
private String parentDocumentPieceType;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getItemId() {
return itemId;
}
public void setItemId(int itemId) {
this.itemId = itemId;
}
public String getSku() {
return sku;
}
public void setSku(String sku) {
this.sku = sku;
}
public long getTotalIn() {
return totalIn;
}
public void setTotalIn(long totalIn) {
this.totalIn = totalIn;
}
public String getDate() {
return Date;
}
public void setDate(String date) {
Date = date;
}
public long getTotalOut() {
return totalOut;
}
public void setTotalOut(long totalOut) {
this.totalOut = totalOut;
}
public String getParentDocumentType() {
return parentDocumentType;
}
public void setParentDocumentType(String parentDocumentType) {
this.parentDocumentType = parentDocumentType;
}
public String getParentDocumentPieceType() {
return parentDocumentPieceType;
}
public void setParentDocumentPieceType(String parentDocumentPieceType) {
this.parentDocumentPieceType = parentDocumentPieceType;
}
public String getParentDocumentId() {
return parentDocumentId;
}
public void setParentDocumentId(String parentDocumentId) {
this.parentDocumentId = parentDocumentId;
}
public String getAccountId() {
return accountId;
}
public void setAccountId(String accountId) {
this.accountId = accountId;
}
}

View File

@ -42,10 +42,10 @@ public class InventoryAccountQueryBuilder {
.setTable("cut_to_pack.inventory_account")
.setColumns("*")
.where()
.columnEquals("id", id)
.and()
.columnLikeTitle("title", title)
.and()
.columnEquals("id", id)
.and()
.columnEquals("active", active)
.and()
.columnLike("created_by", createdBy)

View File

@ -8,7 +8,7 @@ import java.time.LocalDate;
public class JobCardQueryBuilder {
public static String buildQuery( String id, String code, String createdBy, String status, String inventoryStatus, String customer, String lotNumber, String purchaseOrderId, String locationSiteId, String startDate, String endDate, Long count ){
public static String buildQuery(String code, String createdBy, String status, String inventoryStatus, String customer, String lotNumber, String purchaseOrderId, String locationSiteId, String startDate, String endDate, Long count ){
// format date
String formattedDate;
String formattedEndDate;
@ -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( "id", id )
.columnEquals("created_by", createdBy)
.and()
.columnEquals( "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

@ -0,0 +1,49 @@
package com.utopiaindustries.querybuilder.ctp;
import com.utopiaindustries.querybuilder.QueryBuilder;
import com.utopiaindustries.util.CTPDateTimeFormat;
import com.utopiaindustries.util.StringUtils;
import java.time.LocalDate;
public class StichedOfflineItemQueryBuilder {
public static String buildQuery(String id, String itemId, String sku, String createdStartDate, String createdEndDate, String jobCardId, Long count) {
// format date
String formattedDate;
String formattedEndDate;
String startDate1 = "";
String endDate1 = "";
if (!StringUtils.isNullOrEmpty( createdStartDate)) {
formattedDate = CTPDateTimeFormat.getMySQLFormattedDateString(createdStartDate, CTPDateTimeFormat.HTML5_DATE_INPUT_FORMAT);
formattedEndDate = CTPDateTimeFormat.getMySQLFormattedDateString(createdEndDate, CTPDateTimeFormat.HTML5_DATE_INPUT_FORMAT);
startDate1 = String.format("'%s 00:00:01'", formattedDate);
if (!StringUtils.isNullOrEmpty(createdEndDate)) {
endDate1 = String.format("'%s 23:59:59'", formattedEndDate);
} else {
endDate1 = String.format("'%s 23:59:59'", LocalDate.now());
}
}
return ( new QueryBuilder() )
.setTable("cut_to_pack.stitching_offline_item")
.setColumns("*")
.where()
.columnEquals("id", id)
.and()
.columnEquals("sku", sku)
.and()
.columnEquals("item_id", itemId )
.and()
.columnEquals("job_card_id", jobCardId )
.and()
.columnEqualToOrGreaterThan("created_at", startDate1)
.and()
.columnEqualToOrLessThan("created_at", endDate1 )
.orderBy("id","DESC")
.limit(count)
.build();
}
}

View File

@ -0,0 +1,72 @@
package com.utopiaindustries.querybuilder.ctp;
import com.utopiaindustries.querybuilder.QueryBuilder;
import com.utopiaindustries.util.CTPDateTimeFormat;
import com.utopiaindustries.util.StringUtils;
import java.time.LocalDate;
import java.util.List;
public class SummaryInventoryReportQueryBuilder {
private final static String TABLE_NAME = " cut_to_pack.inventory_transaction_leg ";
public static String buildQuery(String itemId,
String sku,
String startDate,
String endDate) {
// format date
String formattedDate;
String formattedEndDate;
String startDate1 = "";
String endDate1 = "";
String itemId1 = "";
String sku1 = "";
if (!StringUtils.isNullOrEmpty(startDate)) {
formattedDate = CTPDateTimeFormat.getMySQLFormattedDateString(startDate, CTPDateTimeFormat.HTML5_DATE_INPUT_FORMAT);
formattedEndDate = CTPDateTimeFormat.getMySQLFormattedDateString(endDate, CTPDateTimeFormat.HTML5_DATE_INPUT_FORMAT);
startDate1 = String.format("'%s 00:00:01'", formattedDate);
if (!StringUtils.isNullOrEmpty(endDate)) {
endDate1 = String.format("'%s 23:59:59'", formattedEndDate);
} else {
endDate1 = String.format("'%s 23:59:59'", LocalDate.now());
}
}
if (!StringUtils.isNullOrEmpty(itemId)) {
itemId1 = itemId;
}
if (!StringUtils.isNullOrEmpty(sku)) {
sku1 = sku;
}
QueryBuilder qb = new QueryBuilder()
.setTable(TABLE_NAME)
.setColumns("item_id, DATE(transaction_leg_datetime) AS transaction_date, sku, parent_document_type, parent_document_piece_type, "
+ "SUM(CASE WHEN type = 'IN' THEN 1 ELSE 0 END) AS total_in, "
+ "SUM(CASE WHEN type = 'OUT' THEN 1 ELSE 0 END) AS total_out")
.where()
.bracketOpen()
.bracketOpen()
.columnEquals("sku", sku1)
.or()
.columnIsNull("sku")
.bracketClose()
.or()
.bracketOpen()
.columnEquals("item_id",itemId)
.or()
.columnIsNull("item_id")
.bracketClose()
.bracketClose()
.and()
.columnBetween("transaction_leg_date",startDate,endDate)
.groupBy("DATE(transaction_leg_datetime), sku, parent_document_type, parent_document_piece_type")
.orderBy("transaction_date,", "sku");
return qb.build();
}
}

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

@ -8,6 +8,7 @@ import com.utopiaindustries.model.ctp.StitchingOfflineItem;
import com.utopiaindustries.querybuilder.ctp.BundleQueryBuilder;
import com.utopiaindustries.querybuilder.ctp.FinishedItemQueryBuilder;
import com.utopiaindustries.querybuilder.ctp.MasterBundleQueryBuilder;
import com.utopiaindustries.querybuilder.ctp.StichedOfflineItemQueryBuilder;
import com.utopiaindustries.util.NumberUtils;
import com.utopiaindustries.util.StringUtils;
import org.springframework.security.core.Authentication;
@ -99,7 +100,7 @@ public class BundleService {
count = 100L;
}
if( StringUtils.isAnyNotNullOrEmpty(id, itemId, sku, createdStartDate, createdEndDate, jobCardId ) ){
String query = FinishedItemQueryBuilder.buildQuery( id, itemId, sku, createdStartDate, createdEndDate, jobCardId , count );
String query = StichedOfflineItemQueryBuilder.buildQuery( id, itemId, sku, createdStartDate, createdEndDate, jobCardId , count );
System.out.println( query );
stitchingOfflineItems = stitchingOfflineItemDAO.findByQuery( query );
} else {

View File

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

View File

@ -51,4 +51,13 @@ public class InventoryArtifactService {
finishedItem.setJobCard( jobCardDAO.find( finishedItem.getJobCardId() ) );
return finishedItem;
}
/*
* get finished Items By Job Card ID
* */
public FinishedItem findByJobCardId( long id ){
FinishedItem finishedItem = finishedItemDAO.find( id );
usama.jameel marked this conversation as resolved

findByJobcardId

findByJobcardId
finishedItem.setJobCard( jobCardDAO.find( finishedItem.getJobCardId() ) );
return finishedItem;
}
}

View File

@ -61,7 +61,7 @@ public class InventoryService {
if ( jobCardId == 0 || jobCardWrapper.getItems( ) == null || jobCardWrapper.getItems( ).isEmpty( ) ) {
throw new RuntimeException( " JobCard can`t be empty");
}
JobCard jobCard = jobCardDAO.find( jobCardId );
JobCard jobCard = jobCardDAO.find( jobCardId );
// get job cad items
List<JobCardItemWrapper> jobCardItemWrappers = jobCardWrapper.getItems( );
List<Long> jobCardItemWrapperIds = jobCardItemWrappers.stream( )
@ -155,6 +155,8 @@ public class InventoryService {
if ( transactionType.equalsIgnoreCase( InventoryTransactionLeg.Type.IN.name( ))) {
initialBalance = initialBalance.add( inventoryTransactionLeg.getQuantity( ));
}else if(transactionType.equalsIgnoreCase( InventoryTransactionLeg.Type.OUT.name( )) && inventoryTransactionLeg.getQuantity().equals(BigDecimal.ZERO)){
initialBalance = BigDecimal.ZERO;
} else {
initialBalance = initialBalance.subtract( inventoryTransactionLeg.getQuantity( ));
}
@ -297,11 +299,15 @@ public class InventoryService {
public void createStitchingOfflineItemsFromJobCard( JobCard jobCard) {
List<JobCardItem> jobCardItems = jobCard.getItems( );
List<JobCardItem> updatedItems = new ArrayList<>( );
// validate items
validateItems( jobCardItems);
// check whether all bundles are received against finish goods
checkAllBundleAreReceived( jobCard.getId( ), jobCardItems);
for ( JobCardItem item : jobCardItems) {
if(item.getTotalProduction() == null){
item.setTotalProduction(BigDecimal.ZERO);
}
// select which has inventory
if ( item.getProduction( ).compareTo( BigDecimal.ZERO ) != 0 ) {
// production is completed out bundles
@ -441,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

@ -9,12 +9,14 @@ import com.utopiaindustries.model.uind.Item;
import com.utopiaindustries.querybuilder.ctp.JobCardQueryBuilder;
import com.utopiaindustries.util.StringUtils;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
@ -31,8 +33,10 @@ public class JobCardService {
private final LocationSiteDAO locationSiteDAO;
private final PurchaseOrderDAO purchaseOrderDAO;
private final UserInventoryAccountDAO userInventoryAccountDAO;
private final FinishedItemDAO finishedItemDAO;
private final StitchingOfflineItemDAO stitchingOfflineItemDAO;
public JobCardService(JobCardDAO jobCardDAO, CutPieceTypeDAO cutPieceTypeDAO, JobCardItemDAO jobCardItemDAO, CutPieceDAO cutPieceDAO, ItemDAO itemDAO, LocationSiteDAO locationSiteDAO, PurchaseOrderDAO purchaseOrderDAO, UserInventoryAccountDAO userInventoryAccountDAO) {
public JobCardService(JobCardDAO jobCardDAO, CutPieceTypeDAO cutPieceTypeDAO, JobCardItemDAO jobCardItemDAO, CutPieceDAO cutPieceDAO, ItemDAO itemDAO, LocationSiteDAO locationSiteDAO, PurchaseOrderDAO purchaseOrderDAO, UserInventoryAccountDAO userInventoryAccountDAO, FinishedItemDAO finishedItemDAO, StitchingOfflineItemDAO stitchingOfflineItemDAO) {
this.jobCardDAO = jobCardDAO;
this.cutPieceTypeDAO = cutPieceTypeDAO;
this.jobCardItemDAO = jobCardItemDAO;
@ -41,6 +45,8 @@ public class JobCardService {
this.locationSiteDAO = locationSiteDAO;
this.purchaseOrderDAO = purchaseOrderDAO;
this.userInventoryAccountDAO = userInventoryAccountDAO;
this.finishedItemDAO = finishedItemDAO;
this.stitchingOfflineItemDAO = stitchingOfflineItemDAO;
}
/*
@ -63,8 +69,7 @@ public class JobCardService {
/*
* get cards
* */
public List<JobCard> getCards( String id,
String code,
public List<JobCard> getCards( String code,
String status,
String inventoryStatus,
String customer,
@ -76,14 +81,20 @@ 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( id, code, status, inventoryStatus, customer, lotNumber, purchaseOrderId, locationSiteId, createdStartDate, createdEndDate ) ){
String query = JobCardQueryBuilder.buildQuery( id, code, authentication.getName(), status, inventoryStatus, customer, lotNumber, purchaseOrderId, locationSiteId, createdStartDate, createdEndDate, limit );
if( StringUtils.isAnyNotNullOrEmpty( code, status, inventoryStatus, customer, lotNumber, purchaseOrderId, locationSiteId, createdStartDate, createdEndDate ) ){
for (GrantedAuthority role : authentication.getAuthorities()){
if (role.toString().equals("ROLE_ADMIN")){
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 {
}else {
jobCards = jobCardDAO.findByUserAndLimit( authentication.getName(), limit );
}
return jobCards;
@ -115,6 +126,7 @@ public class JobCardService {
@Transactional( rollbackFor = Exception.class )
public void save(JobCard jobCard) {
if (jobCard != null && jobCard.getItems() != null) {
jobCard.setInventoryStatus(String.valueOf(JobCard.InventoryStatus.NOT_RECEIVED_YET));
long jobCardId = jobCardDAO.save( jobCard );
jobCard.setId( jobCardId );
generateCode( jobCard );
@ -192,9 +204,6 @@ public class JobCardService {
return jobCard;
}
/*
* find card recursively
* */
@ -255,5 +264,31 @@ public class JobCardService {
public List<JobCardItem> getJobCardItems( long jobCardId ){
return jobCardItemDAO.findByCardId( jobCardId );
}
public JobCard findByID( long jobCardId ){
return jobCardDAO.find( jobCardId );
}
public List<JobCardItem> findJobCardItemByJobCardId( long jobCardId ){
return jobCardItemDAO.findByCardId(jobCardId);
}
public List<CutPiece> findCutPieceByJobCardItemIds( List<Long> itemIds ){
return cutPieceDAO.findByJobCardItemIdsWithGroupByType(itemIds);
}
public List<FinishedItem> findFinishItemByJobCardId( long jobCardId ){
return finishedItemDAO.findByJobCardId( jobCardId );
}
public List<StitchingOfflineItem> findStitchItemByJobCardId( long jobCardId ){
return stitchingOfflineItemDAO.findByJobCardId( jobCardId );
}
usama.jameel marked this conversation as resolved

Map

Map
public Map<Long, Long> totalStitchingItem(List<Long> itemIds, long jobCardId ){
return stitchingOfflineItemDAO.findTotalStitchingOfflineItems( itemIds, jobCardId );
}
public Map<Long, Long> totalFinishItem(List<Long> itemIds, long jobCardId ){
return finishedItemDAO.findTotalFinishedItems( itemIds, jobCardId );
}
}

View File

@ -0,0 +1,62 @@
package com.utopiaindustries.service;
import com.utopiaindustries.dao.ctp.SummaryInventoryReportDao;
import com.utopiaindustries.model.ctp.SummaryInventoryReport;
import com.utopiaindustries.util.CTPDateTimeFormat;
import com.utopiaindustries.util.StringUtils;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.*;
@Service
public class SummaryInventoryReportService {
private final SummaryInventoryReportDao summaryInventoryReportDao;
public SummaryInventoryReportService(SummaryInventoryReportDao summaryInventoryReportDao) {
this.summaryInventoryReportDao = summaryInventoryReportDao;
}
public Map<String, Map<String, List<SummaryInventoryReport>>> findByFilter(String itemId, String sku, String startDate, String endDate){
String formattedDate;
String formattedEndDate;
String startDate1 = null;
String endDate1 = null;
Integer itemId1 = null;
String sku1 = null;
if (!StringUtils.isNullOrEmpty(startDate)) {
formattedDate = CTPDateTimeFormat.getMySQLFormattedDateString(startDate, CTPDateTimeFormat.HTML5_DATE_INPUT_FORMAT);
formattedEndDate = CTPDateTimeFormat.getMySQLFormattedDateString(endDate, CTPDateTimeFormat.HTML5_DATE_INPUT_FORMAT);
startDate1 = String.format("'%s 00:00:01'", formattedDate);
if (!StringUtils.isNullOrEmpty(endDate)) {
endDate1 = String.format("'%s 00:00:01'", formattedEndDate);
} else {
endDate1 = String.format("'%s 23:59:59'", LocalDate.now());
}
}
if (!StringUtils.isNullOrEmpty(itemId)) {
itemId1 = Integer.valueOf(itemId);
}
if (!StringUtils.isNullOrEmpty(sku)) {
sku1 = sku;
}
List<SummaryInventoryReport> summaries = summaryInventoryReportDao.findByFilter(itemId1, sku1, startDate1, endDate1);
Map<String, Map<String, List<SummaryInventoryReport>>> skuMapDateMap = new HashMap<>();
if(summaries == null) {
skuMapDateMap = null;
}else {
for (SummaryInventoryReport summary : summaries) {
skuMapDateMap
.computeIfAbsent(summary.getSku(), k -> new HashMap<>()) // SKU as key
.computeIfAbsent(summary.getDate(), d -> new ArrayList<>()) // Date as key
.add(summary);
}
}
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
@ -87,15 +90,15 @@ public class UserService {
private void saveUserRolesAndAccounts( User user ){
List<Authority> newRoles = user.getAuthorities();
newRoles.forEach(authority -> authority.setUsername( user.getUsername() ));
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

@ -0,0 +1,64 @@
(function( $ ) {
let $btnPreviousWeek = $( '[data-prev-week]' ),
$btnNextWeek = $( '[data-next-week]' ),
$btnResyncWeek = $( '[data-sync-this-week]' ),
$inputDateOfWeek = $( '[data-date-of-week]' );
let currentURL = new URL( window.location.href.split('#')[0] );
$( function () {
console.log( currentURL.href );
});
$inputDateOfWeek.on( 'change', function () {
let $this = $(this);
currentURL.searchParams.delete('date-of-week');
currentURL.searchParams.append( 'date-of-week' , $this.val());
window.location.href = currentURL.href;
} );
$btnPreviousWeek.on( 'click', function () {
let date = new Date( Date.parse( $inputDateOfWeek.val() ) );
let prevWeekDate = new Date( date.setDate( date.getDate() - 7 ) );
let prevWeekDateString = window.uind.utils.getFormattedDateAsISO8601( prevWeekDate );
currentURL.searchParams.delete('date-of-week');
currentURL.searchParams.append( 'date-of-week' , prevWeekDateString );
window.location.href = currentURL.href;
} );
$btnNextWeek.on( 'click', function () {
let date = new Date( Date.parse( $inputDateOfWeek.val() ) );
let nextWeekDate = new Date( date.setDate( date.getDate() + 7 ) );
let nextWeekDateString = window.uind.utils.getFormattedDateAsISO8601( nextWeekDate );
currentURL.searchParams.delete('date-of-week');
currentURL.searchParams.append( 'date-of-week' , nextWeekDateString );
window.location.href = currentURL.href;
} );
$btnResyncWeek.on( 'click', function () {
let date = new Date( Date.parse( $inputDateOfWeek.val() ) );
console.log( date.getDate() );
console.log( date.getDay() );
let startDate = new Date( date.setDate( date.getDate() - date.getDay() + 1 ) );
console.log( startDate );
let endDate = new Date( date.setDate( startDate.getDate() + 6 ) );
console.log( endDate );
let startDateString = window.uind.utils.getFormattedDateAsISO8601( startDate );
let endDateString = window.uind.utils.getFormattedDateAsISO8601( endDate );
currentURL.searchParams.delete('date-of-week');
console.log( ( currentURL.href + '/sync?from-date=' + startDateString + '&to-date=' + endDateString ).replace( '//sync', '/sync' ) );
window.location.href = ( currentURL.href + '/sync?from-date=' + startDateString + '&to-date=' + endDateString ).replace( '//sync', '/sync' );
} );
}( jQuery ));

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

@ -15,7 +15,7 @@
<td width="400">
<input hidden="hidden" v-bind:name="'items[' + index + '].jobCardId'" v-bind:value="item.jobCardId" >
<input hidden="hidden" v-bind:name="'items[' + index + '].jobCardItemId'" v-bind:value="item.id" >
<item-search
<item-search
v-bind:id-field-name="'items[' + index + '].itemId'"
v-bind:id="item.itemId"
v-bind:title="item.title"
@ -37,10 +37,10 @@
<span class="form-control" readonly>{{item.expectedProduction}}</span>
</td>
<td width="200">
<input class="form-control" type="number" v-bind:name="'items[' + index + '].actualProduction'" v-bind:max="item.expectedProduction" required>
<input class="form-control" min="0" type="number" v-bind:name="'items[' + index + '].actualProduction'" v-bind:max="item.expectedProduction" required>
</td>
<td>
<span class="form-control" >{{ populateCuttingAccount() }}</span>
{{ populateCuttingAccount() }}
</td>
</tr>
`
@ -60,15 +60,15 @@
<input hidden="hidden" v-bind:name="'items[' + pIndex + '].pieces[' + index + '].id'" v-bind:value="piece.id">
<input hidden="hidden" v-bind:name="'items[' + pIndex + '].pieces[' + index + '].jobCardItemId'" v-bind:value="piece.jobCardItemId">
<input hidden="hidden" v-bind:name="'items[' + pIndex + '].pieces[' + index + '].type'" v-bind:value="piece.type">
<div class="col-md-5">
<select class="form-control" v-bind:name="'pieces[' + index +'].type'" v-model="piece.type" disabled>
<div class="col-md-5">
<select style="width: 150px;" class="form-control" v-bind:name="'pieces[' + index +'].type'" v-model="piece.type" disabled>
<option value="">Please Select</option>
<option v-for="(type,index) in $types"
<option v-for="(type,index) in $types"
v-bind:selected="type.title === piece.type"
v-bind:value="type.title">{{type.title}}</option>
</select>
</div>
<div class="col-md-5">
<div class="col-md-6" style="padding-left: 40px;">
<input class="form-control" type="number" v-bind:name="'items[' + pIndex + '].pieces[' + index +'].quantity'" v-model="piece.quantity" required/>
</div>
</div>
@ -81,7 +81,7 @@
},
template : `
<table class="table table-bordered bg-white col-sm-12">
<table class="table table-bordered bg-white w-100">
<thead>
<tr>
<th>Item</th>
@ -89,11 +89,12 @@
<th>Cut Pieces</th>
<th>Expected Production</th>
<th>Actual Production</th>
<th>Account</th>
<th style="width: 312px" >Account</th>
</tr>
</tr>
</thead>
<tbody>
<item-rows v-for="(item,index) in jobCard.items"
<item-rows v-for="(item,index) in jobCard.items"
v-bind:key="index"
v-bind:index="index"
v-bind:item="item">

View File

@ -53,6 +53,12 @@
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/packaging') ? 'active' : ''}">Packaging</a>
</li>
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_REPORTING', 'ROLE_ADMIN')">
<a th:href="@{/reporting/summary}" class="nav-link"
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/reporting') ? 'active' : ''}">Reporting</a>
</li>
<li class="nav-item dropdown" sec:authorize="hasRole('ROLE_ADMIN')">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">Admin</a>
<div class="dropdown-menu">

View File

@ -22,7 +22,7 @@
<div class="form-row">
<div class="col-sm-3 form-group">
<label>Job Order</label>
<input class="form-control" th:field="*{jobOrderId}" required>
<input type="number" class="form-control" th:field="*{jobOrderId}" required>
</div>
<div class="col-sm-3 form-group">
<label>Customer</label>

View File

@ -8,11 +8,7 @@
<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>Code</label>
<label>ID/Code</label>
<input type="text" class="form-control" name="code" maxlength="100" th:value="${param['code']}">
</div>
<div class="form-group">
@ -43,24 +39,30 @@
<label>Lot Number</label>
<input type="text" class="form-control" name="lot-number" maxlength="100" th:value="${param['lot-number']}">
</div>
<div class="form-group" data-vue-app th:with="id=${param['purchase-order-id']},title=${param['purchase-order-code']}">
<div class="form-group" data-vue-app th:with="id=${param['purchase-order-id']},title=${param['purchase-order-id']}">
<purchase-order-search th:attr="id=${id},title=${title}"
v-bind:id-field-name="'purchase-order-id'"
v-bind:code-field-name="'purchase-order-code'"
></purchase-order-search>
</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>
<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

@ -20,7 +20,7 @@
<input type="text" class="form-control" name="jc-id" maxlength="100" th:value="${param['jc-id']}">
</div>
<div class="form-group">
<label>Master Bundle ID</label>
<label>Master Barcode ID</label>
<input type="text" class="form-control" name="master-id" maxlength="100" th:value="${param['master-id']}">
</div>
<div>
@ -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" 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']}">
<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" maxlength="100"
th:value="${param['count']}">
<input type="number" class="form-control" name="count" min="0" maxlength="100"
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

@ -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,8 +22,8 @@
<body>
<div class="container">
<div class="row">
<div class="col-sm-10">
<table class="table table-bordered font-sm" th:if="${#lists.size(transactions) > 0}">
<div class="col-sm-12">
<table th:if="${#lists.size(transactions) != 0 && #lists != null }" class="table table-bordered font-sm">
<thead>
<tr>
<th>ID</th>
@ -38,7 +38,7 @@
</tr>
</thead>
<tbody>
<tr th:each="transaction : ${transactions}" th:object="${transaction}">
<tr th:if="${transaction.getBalance() > -1 }" th:each="transaction : ${transactions}" th:object="${transaction}">
<td th:text="*{id}"></td>
<td th:text="*{itemId}"></td>
<td th:text="*{sku}"></td>

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

@ -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

@ -50,8 +50,9 @@
<td th:text="${item.createdBy}"></td>
<td ctp:formatdatetime="${item.createdAt}"></td>
<td>
<span th:if="${not item.isSegregated}" class="badge badge-danger">PENDING</span>
<div th:if="${item.isSegregated}">
<span th:if="${not item.isSegregated && item.qaStatus != ('ALTER')}" class="badge badge-danger">PENDING</span>
<span th:if="${not item.isSegregated && item.qaStatus == ('ALTER')}" class="badge badge-warning">REVERTED</span>
<div th:if="${item.isSegregated && item.qaStatus != ('ALTER')}">
<span class="badge badge-APPROVED">DONE</span>
</div>
</td>

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 class="table table-striped" 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,10 +36,7 @@
<td th:text="*{id}"></td>
<td th:text="*{title}"></td>
<td th:text="*{parentEntityType}"></td>
<td>
<span class="badge badge-success" th:if="*{active}">ACTIVE</span>
<span class="badge badge-danger" th:unless="*{active}">INACTIVE</span>
</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 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 th:text="*{code}"></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

@ -0,0 +1,176 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:uind="http://www.w3.org/1999/xhtml">
<head th:replace="_fragments :: head('Job Card Detail')"></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">
<table class="table table-bordered" >
<thead class="thead-dark">
<tr>
<th colspan="2" class="text-center">
<span th:text="${card.getCode()}"></span>
</th>
</tr>
</thead>
<tbody>
<tr>
<td><i>Job Order ID</i></td>
<td>
<span >
<a class="text-reset" target="_blank" th:text="${card.getJobOrderId()}" ></a>
</span>
</td>
</tr>
<tr>
<td class="align-middle"><i>Card Status</i></td>
<td>
<span th:text="${card.getStatus()}"></span>
</td>
</tr>
<tr>
<td class="align-middle"><i>Inventory Status</i></td>
<td>
<span th:text="${card.getInventoryStatus()}"></span>
</td>
</tr>
<tr>
<td class="align-middle"><i>Customer</i></td>
<td>
<span th:text="${card.getCustomer()}"></span>
</td>
</tr>
<tr>
<td class="align-middle"><i>Lot Number</i></td>
<td>
<span th:text="${card.getLotNumber()}"></span>
</td>
</tr>
<tr>
<td class="align-middle"><i>Purchase Order ID</i></td>
<td>
<span th:text="${card.getPurchaseOrderId()}"></span>
</td>
</tr>
<tr>
<td class="align-middle"><i>Items</i></td>
<td class="m-0 p-0">
<table class="table mb-0 text-center">
<thead>
<tr>
<th>ID</th>
<th>Item ID</th>
<th>Sku</th>
<th>Expected Production</th>
<th>Actual Production</th>
<th>Total Production</th>
<th>Total Stitching Item</th>
<th>Total Finish Item</th>
<th class="text-center font-lg">Cut Piece Items</th>
</tr>
</thead>
<tbody>
<tr th:each="cardItem : ${jobCardItems}">
<td th:text="${cardItem.getId()}"></td>
<td th:text="${cardItem.getItemId()}"></td>
<td th:text="${cardItem.getSku()}"></td>
<td th:text="${cardItem.getExpectedProduction()}"></td>
<td th:text="${cardItem.getActualProduction()}"></td>
<td th:text="${cardItem.getTotalProduction()}"></td>
<td th:text="${totalStitchingItem.get(cardItem.getItemId())}"></td>
<td th:text="${totalFinishItem.get(cardItem.getItemId())}"></td>
<td class="m-0 p-0">
<table class="table m-0 p-0">
<tbody>
<tr th:if="*{cardItem.getId() == cutPieceItem.getJobCardItemId()}" th:each="cutPieceItem : ${cutPiece}">
<td th:text="${cutPieceItem.getType()}"></td>
<td th:text="${cutPieceItem.getQuantity()}"></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="align-middle"><i>Stitching Offline Items</i> <i ></i></td>
<td class="m-0 p-0 text-center">
<table th:if="${!stitchingItem.isEmpty() }" class="table">
<thead>
<tr>
<th>ID</th>
<th>Item ID</th>
<th>Sku</th>
<th>Bar Code</th>
<th>QA Status</th>
<th>QA Remarks</th>
<th>Created At</th>
<th>Created By</th>
</tr>
</thead>
<tbody>
<tr th:each="cardStitchingItem : ${stitchingItem}">
<td th:text="${cardStitchingItem.getId()}"></td>
<td th:text="${cardStitchingItem.getItemId()}">ad</td>
<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>
</td>
<td th:text="${cardStitchingItem.getQaRemarks()}"></td>
<td ctp:formatdatetime="${cardStitchingItem.getCreatedAt()}"></td>
<td th:text="${cardStitchingItem.getCreatedBy()}"></td>
</tr>
</tbody>
</table>
<span th:if="${stitchingItem.isEmpty() }" class="p-5 text-center font-lg font-weight-bold" > No Data Available</span>
</td>
</tr>
<tr>
<td class="align-middle"><i>Finish Items</i></td>
<td class="m-0 p-0 text-center">
<table th:if="${!finishItem.isEmpty() }" class="table mb-0">
<thead>
<tr>
<th>ID</th>
<th>Item ID</th>
<th>Sku</th>
<th>Bar Code</th>
<th>Status</th>
<th>Created At</th>
<th>Created By</th>
</tr>
</thead>
<tbody>
<tr th:each="cardfinishItem : ${finishItem}">
<td th:text="${cardfinishItem.getId()}"></td>
<td th:text="${cardfinishItem.getItemId()}">ad</td>
<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>
</td>
<td ctp:formatdatetime="${cardfinishItem.getCreatedAt()}"></td>
<td th:text="${cardfinishItem.getCreatedBy()}"></td>
</tr>
</tbody>
</table>
<span th:if="${finishItem.isEmpty() }" class="p-5 text-center font-lg font-weight-bold" > No Data Available</span>
</td>
</tr>
</tbody>
</table>
</div>
</main>
</div>
<div th:replace="_fragments :: page-footer-scripts"></div>
</body>
</html>

View File

@ -23,7 +23,7 @@
<div class="col-sm-3 form-group">
<label>Finishing Account</label>
<select class="form-control" name="account-id" th:field="*{finishedAccountId}" required>
<option value="">PLease select</option>
<option value="">Please select</option>
<option th:each="account : ${accounts}"
th:value="${account.id}"
th:text="${account.title}"></option>

View File

@ -50,8 +50,9 @@
<td th:text="${item.createdBy}"></td>
<td ctp:formatdatetime="${item.createdAt}"></td>
<td>
<span th:if="${not item.isSegregated}" class="badge badge-danger">PENDING</span>
<div th:if="${item.isSegregated}">
<span th:if="${not item.isSegregated && item.qaStatus != 'ALTER'}" class="badge badge-danger">PENDING</span>
<span th:if="${not item.isSegregated && item.qaStatus == ('ALTER')}" class="badge badge-warning" >REVERTED</span>
<div th:if="${item.isSegregated && item.qaStatus != ('ALTER')}">
<span class="badge badge-APPROVED">DONE</span>
</div>
</td>

View File

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
<head th:replace="_fragments :: head('Home Page')"></head>
<body>
<!-- sidebar starts -->
<aside class="col-sm-2" th:fragment="sidebar">
<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>SKu</label>
<input type="text" class="form-control" name="sku" maxlength="100" th:value="${param['sku']}">
</div>
<div class="form-group">
<label>Start Date</label>
<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'] ?: endDate}">
</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>
</form>
</div>
</aside>
<!-- sidebar ends -->
<div th:fragment="page-footer-scripts">
<script th:src="@{/js/vendor/lazyload-db.js}"></script>
<script th:src="@{/js/main.js}"></script>
</div>
</body>
</html>

View File

@ -0,0 +1,69 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml"
xmlns:ctp="http://www.w3.org/1999/xhtml">
<head th:replace="_fragments :: head('Summary')"></head>
<body>
<div class="container-fluid">
<header class="row page-header" th:replace="_fragments :: page-header"></header>
<main class="row page-main">
<aside class="col-sm-2" th:replace="/reporting/inventory-summary-sidebar :: sidebar"></aside>
<div class="col-sm">
<h3>Summary</h3>
usama.jameel marked this conversation as resolved

remove spaces

remove spaces
<table th:if="${tableData != null}" class=" table table-striped table-bordered table-hover font-sm " data-table data-order="[[ 0, &quot;asc&quot; ]]">
<thead>
<tr>
<th colspan="1" >SKU / Date</th>
<th class="text-center text-center" th:each="date: ${dateLimits}" >
<span class="d-block " style="width: 100px !important; padding-left: 70px; " th:text="${#temporals.format(date, 'E')}"></span>
<span class="d-block pl-4 " style="width: 150px !important; " ctp:formatdate="${date}" ></span>
</th>
</tr>
</thead>
<tbody>
<tr th:each="sku : ${tableData.keySet()}">
<!-- SKU Column (first td) -->
<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>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h4 th:if="${tableData == null}"> No data found </h4>
</div>
</main>
</div>
<div th:replace="_fragments :: page-footer-scripts"></div>
<script th:src="@{/js/summary.js}"></script>
</body>
</html>

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" 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

@ -18,7 +18,8 @@
<div class="col-sm-3 p-0">
<master-bundle-search
v-bind:id-field-name="'master-id'"
v-on:master-bundle-select="OnSelect">
v-on:master-bundle-select="OnSelect"
v-bind:required="true">
</master-bundle-search>
</div>
<div class="col-sm-3">

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 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

@ -51,8 +51,8 @@
<th>Production</th>
</tr>
<tbody>
<tr v-for="(item,index) in items">
<td>
<tr v-if="(item.actualProduction !== item.totalProduction)" v-for="(item,index) in items">
<td >
<div class="form-group form-check mb-0">
<input class="form-check-input" type="checkbox" v-bind:name="'items[' + index + '].isSelected'" v-model="item.isSelected">
<label th:for="*{id}" class="form-check-label"></label>
@ -79,7 +79,7 @@
<span class="form-control">{{item.actualProduction}}</span>
</td>
<td>
<input hidden="hidden" v-bind:name="'items[' + index + '].totalProduction'" v-bind:value="item.totalProduction">
<input hidden="hidden" v-bind:name="'items[' + index + '].totalProduction'" v-bind:value="item.totalProduction">
<span class="form-control">{{item.totalProduction}}</span>
</td>
<td>
@ -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 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>