add job card screen

pull/1/head
usama.jameel 2024-12-31 13:28:55 +05:00
parent 45a929fbfb
commit 40a18eb266
33 changed files with 495 additions and 76 deletions

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,8 +61,12 @@ public class CuttingController {
@RequestParam( value = "site-id", required = false ) String siteId,
@RequestParam( value = "count", required = false ) Long count,
Model model ){
model.addAttribute("accounts", inventoryAccountService.getInventoryAccounts( id, title, active, createdBy, startDate, endDate, siteId, count , "PROCESS", "1", false) );
model.addAttribute("locations", locationService.findAll() );
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";
}
return "/cutting/inventory-accounts";
}
@ -73,7 +77,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() );
}
@ -105,6 +109,7 @@ public class CuttingController {
@GetMapping( "/bundles" )
public String showBundles( @RequestParam( value = "id", required = false ) String id,
@RequestParam( value = "sku", required = false) String sku,
@RequestParam( value = "exceptionCheck", required = false, defaultValue = "false") boolean exceptionCheck,
@RequestParam( value = "jc-id", required = false) String jobCardId,
@RequestParam( value = "master-id" , required = false ) String masterId,
@RequestParam( value = "type", required = false) String type,
@ -112,9 +117,18 @@ 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, RedirectAttributes redirectAttributes){
LocalDate startDate1 = StringUtils.isNullOrEmpty(startDate) ? LocalDate.now().minusDays(30) : LocalDate.parse(startDate);
LocalDate endDate1 = StringUtils.isNullOrEmpty(endDate) ? LocalDate.now() : LocalDate.parse(endDate);
model.addAttribute("bundles", bundleService.getBundles( id, sku, jobCardId, masterId, type, status, startDate1.toString(), endDate1.toString() ,count ) );
model.addAttribute("types", jobCardService.getAllPieceTypes() );
if(exceptionCheck){
redirectAttributes.addFlashAttribute("error", "Please Select At least One CheckBox." );
}
if(StringUtils.isNullOrEmpty( startDate) || StringUtils.isNullOrEmpty( endDate )){
return "redirect:/cutting/bundles?id=&sku=&jc-id=&master-id=&type=&status=0&start-date="+startDate1+"&end-date="+endDate1+"&count=100";
}
return "/cutting/bundles";
}
@ -126,7 +140,12 @@ public class CuttingController {
@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 ) );
LocalDate startDate1 = StringUtils.isNullOrEmpty(startDate) ? LocalDate.now().minusDays(30) : LocalDate.parse(startDate);
LocalDate endDate1 = StringUtils.isNullOrEmpty(endDate) ? LocalDate.now() : LocalDate.parse(endDate);
model.addAttribute("masterBundles", bundleService.getMasterBundles( id, jobCardId, startDate1.toString(), endDate1.toString(), count ) );
if(StringUtils.isNullOrEmpty( startDate) || StringUtils.isNullOrEmpty( endDate )){
return "redirect:/cutting/master-bundles?id=&jc-id=&start-date="+startDate1+"&end-date="+endDate1+"&count=100";
}
return "/cutting/master-bundles";
}
@ -139,9 +158,11 @@ public class CuttingController {
@PostMapping( "/generate-barcodes" )
public ResponseEntity<InputStreamResource> generateBarcode(@RequestParam( name = "ids", required = true ) Long[] ids,
@RequestParam( name = "artifactType", required = true ) String artifactType ) throws Exception {
public Object generateBarcode(@RequestParam( name = "ids", required = false ) Long[] ids,
@RequestParam( name = "artifactType", required = true ) String artifactType ) throws Exception {
if(ids == null){
return "redirect:/cutting/bundles?exceptionCheck=true";
}
return 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,13 @@ 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);
List<FinishedItem> itemList = bundleService.getFinishedItem( id, itemId, sku, startDate1.toString(), endDate1.toString(), jobCardId ,count );
model.addAttribute("items", itemList ) ;
if(StringUtils.isNullOrEmpty( startDate) || StringUtils.isNullOrEmpty( endDate )){
return "redirect:/finishing/finished-items?id=&item-id=&sku=&job-card-id=&start-date="+startDate1+"&end-date="+endDate1+"&count=100";
}
return "finishing/finished-item-list";
}
@ -70,6 +77,9 @@ public class FinishingController {
// 5 for Finishing
model.addAttribute("accounts", inventoryAccountService.getInventoryAccounts( id, title, active, createdBy, startDate, endDate, siteId, count, "PROCESS", "5" , false ));
model.addAttribute("locations", locationService.findAll() );
if(count == null){
return "redirect:/finishing/inventory-accounts?id=&title=&active=&created-by=&start-date=&end-date=&site-id=&site-title=&count=100";
}
return "/finishing/inventory-accounts";
}

View File

@ -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,19 +26,20 @@ 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,
@ -43,11 +50,17 @@ public class JobCardController {
@RequestParam( value = "created-end-date", required = false ) String createdEndDate,
@RequestParam( value = "limit" , required = false) Long limit,
Model model ){
List<JobCard> cards = jobCardService.getCards( id, code, status, inventoryStatus, customer, lotNumber, purchaseOrderId, locationSiteId,createdStartDate, createdEndDate, limit );
List<JobCard> cards = jobCardService.getCards(code, status, inventoryStatus, customer, lotNumber, purchaseOrderId, locationSiteId,createdStartDate, createdEndDate, limit );
model.addAttribute("cards", cards );
model.addAttribute("statuses", JobCard.Status.values() );
model.addAttribute("invStatuses", JobCard.InventoryStatus.values() );
model.addAttribute("locations", locationService.findAll() );
LocalDate startDate = StringUtils.isNullOrEmpty(createdStartDate) ? LocalDate.now().minusDays(30) : LocalDate.parse(createdStartDate);
LocalDate endDate = StringUtils.isNullOrEmpty(createdEndDate) ? LocalDate.now() : LocalDate.parse(createdEndDate);
if(StringUtils.isNullOrEmpty( createdStartDate) || StringUtils.isNullOrEmpty( createdEndDate )){
return "redirect:/job-cards/?code=&status=&inventory-status=&customer=&lot-number=&purchase-order-id=&purchase-order-code=&purchaseOrderTitle=&site-id=&site-title=&created-start-date="+startDate+"&created-end-date="+endDate+"&limit=100";
}
return "job-card-list";
}
@ -141,4 +154,28 @@ public class JobCardController {
}
return "redirect:/job-cards";
}
@GetMapping( value = "/job-card-detail/{id}" )
public String showJobCardDetail( @PathVariable("id") long id,
Model model ){
List<JobCardItem> jobCardItems = jobCardService.findJobCardItemByJobCardId(id);
List<Long> jobCardItemIds = jobCardItems.stream()
.map(JobCardItem::getId)
.collect(Collectors.toList());
model.addAttribute( "card", jobCardService.findByID(id));
model.addAttribute("jobCardItems", jobCardItems);
model.addAttribute("cutPiece",jobCardService.findCutPieceByJobCardItemIds(jobCardItemIds));
model.addAttribute("finishItem",jobCardService.findFinishItemByJobCardId(id));
model.addAttribute("stitchingItem",jobCardService.findStitchItemByJobCardId(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" )
@ -41,8 +44,9 @@ public class PackagingController {
Model model ){
model.addAttribute("accounts", inventoryAccountService.getInventoryAccounts( id, title, active, createdBy, startDate, endDate, siteId, count , null, null,true ) );
model.addAttribute("locations", locationService.findAll() );
if(count == null){
return "redirect:/packaging/inventory-accounts?id=&title=&active=1&created-by=&start-date=&end-date=&site-id=&site-title=&count=100";
}
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
@ -64,8 +66,13 @@ public class QualityControlController {
@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);
List<FinishedItem> itemList = bundleService.getFinishedItem( id, itemId, sku, startDate1.toString(), endDate1.toString(), jobCardId ,count );
model.addAttribute("items", itemList ) ;
if(StringUtils.isNullOrEmpty( startDate) || StringUtils.isNullOrEmpty( endDate )){
return "redirect:/quality-control/qc-finished-items?id=&item-id=&sku=&job-card-id=&start-date="+startDate1+"&end-date="+endDate1+"&count=100";
}
return "/quality-control/qc-items-list";
}

View File

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

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

View File

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

View File

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

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

View File

@ -1,6 +1,7 @@
package com.utopiaindustries.dao.ctp;
import com.utopiaindustries.model.ctp.FinishedItem;
import com.utopiaindustries.model.ctp.JobCard;
import com.utopiaindustries.util.KeyHolderFunctions;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
@ -19,6 +20,7 @@ public class FinishedItemDAO {
private final String TABLE_NAME = "cut_to_pack.finished_item";
private final String SELECT_QUERY = String.format( "SELECT * FROM %s WHERE id = :id", TABLE_NAME );
private final String SELECT_ALL_QUERY = String.format( "SELECT * FROM %s ORDER BY id DESC", TABLE_NAME );
private final String SELECT_QUERY_BY_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 );
@ -98,6 +100,10 @@ public class FinishedItemDAO {
return namedParameterJdbcTemplate.query( query, new FinishedItemRowMapper() );
}
public List<FinishedItem> findFinishOfflineItemByQuery(String query ){
return namedParameterJdbcTemplate.query( query, new FinishedItemRowMapper() );
}
public List<FinishedItem> findByIds(List<Long> ids ){
if( ids == null || ids.isEmpty() ) return new ArrayList<>();
MapSqlParameterSource params = new MapSqlParameterSource();
@ -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();

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){
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("limit", limit.intValue());
return namedParameterJdbcTemplate.query( SELECT_ALL_QUERY_WITH_LIMIT, params, new JobCardRowMapper() );
}
}

View File

@ -19,6 +19,7 @@ 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 );
@ -103,6 +104,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 + "%" );

View File

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

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;
@ -30,9 +30,9 @@ public class JobCardQueryBuilder {
.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 )
.and()

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

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

@ -51,4 +51,13 @@ public class InventoryArtifactService {
finishedItem.setJobCard( jobCardDAO.find( finishedItem.getJobCardId() ) );
return finishedItem;
}
/*
* get finished Items By Job Card ID
* */
public FinishedItem findFinishedItemByJobCardId( long id ){
FinishedItem finishedItem = finishedItemDAO.find( id );
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

View File

@ -9,6 +9,7 @@ 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;
@ -31,8 +32,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 +44,8 @@ public class JobCardService {
this.locationSiteDAO = locationSiteDAO;
this.purchaseOrderDAO = purchaseOrderDAO;
this.userInventoryAccountDAO = userInventoryAccountDAO;
this.finishedItemDAO = finishedItemDAO;
this.stitchingOfflineItemDAO = stitchingOfflineItemDAO;
}
/*
@ -63,8 +68,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,
@ -79,11 +83,16 @@ public class JobCardService {
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 ) ){
String query = JobCardQueryBuilder.buildQuery(code, authentication.getName(), status, inventoryStatus, customer, lotNumber, purchaseOrderId, locationSiteId, createdStartDate, createdEndDate, limit );
System.out.println( query );
for (GrantedAuthority role : authentication.getAuthorities()){
if (role.toString().equals("ROLE_ADMIN")){
return jobCards = jobCardDAO.findByAllWithLimit(limit);
}
}
jobCards = jobCardDAO.findByQuery( query );
} else {
}else {
jobCards = jobCardDAO.findByUserAndLimit( authentication.getName(), limit );
}
return jobCards;
@ -115,6 +124,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 +202,6 @@ public class JobCardService {
return jobCard;
}
/*
* find card recursively
* */
@ -255,5 +262,22 @@ 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 );
}
}

View File

@ -87,7 +87,9 @@ 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()));
}
List<UserInventoryAccount> newInventoryAccounts = user.getInventoryAccounts();
if( newInventoryAccounts != null ){
newInventoryAccounts.forEach(account -> account.setUsername( user.getUsername() ));

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,7 +53,7 @@
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/packaging') ? 'active' : ''}">Packaging</a>
</li>
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_PACKAGING', 'ROLE_ADMIN')">
<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>

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

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>

View File

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

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

@ -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-card-detail/' + *{getId()}}" 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,168 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:uind="http://www.w3.org/1999/xhtml">
<head th:replace="_fragments :: head('View PO')"></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="'Job Card Detail'"></span>
</th>
</tr>
</thead>
<tbody>
<tr>
<td width="200"><i>Code</i></td>
<td th:text="${card.getCode()}"></td>
</tr>
<tr>
<td><i>Job Order ID</i></td>
<td>
<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">
<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 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 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">
<table 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 th:text="${cardStitchingItem.getQaStatus()}"></td>
<td th:text="${cardStitchingItem.getQaRemarks()}"></td>
<td th:text="${cardStitchingItem.getCreatedAt()}"></td>
<td th:text="${cardStitchingItem.getCreatedBy()}"></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="align-middle"><i>Finish Items</i></td>
<td class="m-0 p-0">
<table 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 th:text="${cardfinishItem.getQaStatus()}"></td>
<td th:text="${cardfinishItem.getCreatedAt()}"></td>
<td th:text="${cardfinishItem.getCreatedBy()}"></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</main>
</div>
<div th:replace="_fragments :: page-footer-scripts"></div>
</body>
</html>

View File

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

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