set naming convention and add receive inventory in packaging phase
parent
b1b4c6b634
commit
cef37b40e6
|
@ -0,0 +1,15 @@
|
|||
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_PURCHASE_ORDER','ROLE_ADMIN')")
|
||||
public @interface PurchaseOrderCTPRole {
|
||||
}
|
|
@ -1,14 +1,15 @@
|
|||
package com.utopiaindustries.controller;
|
||||
|
||||
import com.utopiaindustries.auth.PackagingRole;
|
||||
import com.utopiaindustries.model.ctp.FinishedItemWrapper;
|
||||
import com.utopiaindustries.service.InventoryAccountService;
|
||||
import com.utopiaindustries.service.LocationService;
|
||||
import com.utopiaindustries.service.PackagingService;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
|
@ -17,19 +18,39 @@ import java.time.LocalDate;
|
|||
@RequestMapping("/packaging" )
|
||||
public class PackagingController {
|
||||
|
||||
|
||||
private final InventoryAccountService inventoryAccountService;
|
||||
private final PackagingService packagingService;
|
||||
private final LocationService locationService;
|
||||
|
||||
public PackagingController(InventoryAccountService inventoryAccountService, LocationService locationService) {
|
||||
public PackagingController(InventoryAccountService inventoryAccountService, PackagingService packagingService, LocationService locationService) {
|
||||
this.inventoryAccountService = inventoryAccountService;
|
||||
this.packagingService = packagingService;
|
||||
this.locationService = locationService;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping
|
||||
public String showHome( Model model ){
|
||||
return "redirect:/packaging/inventory-accounts";
|
||||
public String showHome(Model model ){
|
||||
return "redirect:/packaging/receive-inventory";
|
||||
}
|
||||
|
||||
@GetMapping("/receive-inventory")
|
||||
public String packagingItemReceive( Model model ){
|
||||
model.addAttribute("wrapper", new FinishedItemWrapper() );
|
||||
return "/packaging/receive-inventory-form";
|
||||
}
|
||||
|
||||
|
||||
@PostMapping( "/packaging-items" )
|
||||
public String packagingItems( @ModelAttribute FinishedItemWrapper wrapper,
|
||||
RedirectAttributes redirectAttributes,
|
||||
Model model ){
|
||||
try {
|
||||
packagingService.createPackagingItem( wrapper );
|
||||
redirectAttributes.addFlashAttribute("success", "Items Successfully received !" );
|
||||
} catch ( Exception e ){
|
||||
redirectAttributes.addFlashAttribute("error", e.getMessage() );
|
||||
}
|
||||
return "redirect:/finishing/finished-items";
|
||||
}
|
||||
|
||||
@GetMapping( "/inventory-accounts" )
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
package com.utopiaindustries.controller;
|
||||
|
||||
import com.utopiaindustries.auth.PurchaseOrderCTPRole;
|
||||
import com.utopiaindustries.model.ctp.JobCard;
|
||||
import com.utopiaindustries.service.PurchaseOrderCTPService;
|
||||
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.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/purchase-order")
|
||||
@PurchaseOrderCTPRole
|
||||
|
||||
public class PurchaseOrderCTPController {
|
||||
private final PurchaseOrderCTPService purchaseOrderCTPService;
|
||||
|
||||
public PurchaseOrderCTPController(PurchaseOrderCTPService purchaseOrderCTPService) {
|
||||
this.purchaseOrderCTPService = purchaseOrderCTPService;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public String showJobCardList( @RequestParam( value = "purchaseOrderCode", required = false ) String purchaseOrderCode,
|
||||
@RequestParam( value = "articleName", required = false ) String articleName,
|
||||
@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 ){
|
||||
|
||||
LocalDate startDate = StringUtils.isNullOrEmpty(createdStartDate) ? LocalDate.now().minusDays(30) : LocalDate.parse(createdStartDate);
|
||||
LocalDate endDate = StringUtils.isNullOrEmpty(createdEndDate) ? LocalDate.now() : LocalDate.parse(createdEndDate);
|
||||
model.addAttribute("purchaseOrder", purchaseOrderCTPService.getAllPurchaseOrderCtp(purchaseOrderCode, articleName, startDate.toString(), endDate.toString(), limit) );
|
||||
model.addAttribute("startDate", startDate);
|
||||
model.addAttribute("endDate", endDate);
|
||||
return "job-card-list";
|
||||
}
|
||||
|
||||
@GetMapping( "/new" )
|
||||
public String showPurchaseOrderCTPForm( Model model ){
|
||||
model.addAttribute("purchaseOrder", purchaseOrderCTPService.createNewPurchaseOrderCTP() );
|
||||
return "/purchaseOrder/purchase-order-form";
|
||||
}
|
||||
}
|
|
@ -74,8 +74,6 @@ 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){
|
||||
|
@ -95,11 +93,11 @@ public class StitchingController {
|
|||
@RequestParam( value = "end-date", required = false ) String endDate,
|
||||
@RequestParam(value = "bundle-id", required = false) Long bundleId,
|
||||
@RequestParam( value = "count", required = false, defaultValue = "100") Long count,
|
||||
Model model
|
||||
,RedirectAttributes redirect){
|
||||
@RequestParam( value = "status", required = false) String status,
|
||||
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, bundleId ,count );
|
||||
List<StitchingOfflineItem> itemList = bundleService.getStitchedOfflineItems( id, itemId, sku, status, startDate, endDate, bundleId ,count );
|
||||
model.addAttribute("items", itemList ) ;
|
||||
model.addAttribute("startDate", startDate1);
|
||||
model.addAttribute("endDate", endDate1);
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
package com.utopiaindustries.dao.ctp;
|
||||
|
||||
import com.utopiaindustries.model.ctp.PackagingItems;
|
||||
import com.utopiaindustries.model.ctp.PackagingItemsRowMapper;
|
||||
import com.utopiaindustries.util.KeyHolderFunctions;
|
||||
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||
import org.springframework.jdbc.support.GeneratedKeyHolder;
|
||||
import org.springframework.jdbc.support.KeyHolder;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public class PackagingItemsDAO {
|
||||
|
||||
private final NamedParameterJdbcTemplate namedParameterJdbcTemplate;
|
||||
|
||||
private static final String TABLE_NAME = "packaging_items";
|
||||
|
||||
private static final String SELECT_BY_ID = String.format("SELECT * FROM %s WHERE id = :id", TABLE_NAME);
|
||||
private static final String SELECT_ALL = String.format("SELECT * FROM %s ORDER BY id DESC", TABLE_NAME);
|
||||
private static final String DELETE_BY_ID = String.format("DELETE FROM %s WHERE id = :id", TABLE_NAME);
|
||||
private static final String SELECT_BY_JOB_CARD_ID = String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id", TABLE_NAME);
|
||||
|
||||
private static final String INSERT_QUERY = String.format(
|
||||
"INSERT INTO %s (" +
|
||||
"id, item_id, sku, barcode, job_card_id, created_at, created_by, " +
|
||||
"is_qa, finish_item_id, is_segregated, account_id, qa_status, bundle_id, account_title" +
|
||||
") VALUES (" +
|
||||
":id, :item_id, :sku, :barcode, :job_card_id, :created_at, :created_by, " +
|
||||
":is_qa, :finish_item_id, :is_segregated, :account_id, :qa_status, :bundle_id, :account_title" +
|
||||
") ON DUPLICATE KEY UPDATE " +
|
||||
"item_id = VALUES(item_id), sku = VALUES(sku), barcode = VALUES(barcode), " +
|
||||
"job_card_id = VALUES(job_card_id), created_at = VALUES(created_at), created_by = VALUES(created_by), " +
|
||||
"is_qa = VALUES(is_qa), finish_item_id = VALUES(finish_item_id), " +
|
||||
"is_segregated = VALUES(is_segregated), account_id = VALUES(account_id), " +
|
||||
"qa_status = VALUES(qa_status), bundle_id = VALUES(bundle_id), account_title = VALUES(account_title)",
|
||||
TABLE_NAME
|
||||
);
|
||||
|
||||
public PackagingItemsDAO(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
|
||||
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
|
||||
}
|
||||
|
||||
private MapSqlParameterSource prepareParams(PackagingItems item) {
|
||||
return new MapSqlParameterSource()
|
||||
.addValue("id", item.getId())
|
||||
.addValue("item_id", item.getItemId())
|
||||
.addValue("sku", item.getSku())
|
||||
.addValue("barcode", item.getBarcode())
|
||||
.addValue("job_card_id", item.getJobCardId())
|
||||
.addValue("created_at", item.getCreatedAt())
|
||||
.addValue("created_by", item.getCreatedBy())
|
||||
.addValue("is_qa", item.getIsQa())
|
||||
.addValue("finish_item_id", item.getFinishedItemId())
|
||||
.addValue("is_segregated", item.getIsSegregated())
|
||||
.addValue("account_id", item.getAccountId())
|
||||
.addValue("qa_status", item.getQaStatus())
|
||||
.addValue("bundle_id", item.getBundleId())
|
||||
.addValue("account_title", item.getAccountTitle());
|
||||
}
|
||||
|
||||
public PackagingItems find(long id) {
|
||||
MapSqlParameterSource params = new MapSqlParameterSource("id", id);
|
||||
return namedParameterJdbcTemplate.query(SELECT_BY_ID, params, new PackagingItemsRowMapper())
|
||||
.stream().findFirst().orElse(new PackagingItems());
|
||||
}
|
||||
|
||||
public List<PackagingItems> findAll() {
|
||||
return namedParameterJdbcTemplate.query(SELECT_ALL, new PackagingItemsRowMapper());
|
||||
}
|
||||
|
||||
public long save(PackagingItems item) {
|
||||
KeyHolder keyHolder = new GeneratedKeyHolder();
|
||||
MapSqlParameterSource params = prepareParams(item);
|
||||
namedParameterJdbcTemplate.update(INSERT_QUERY, params, keyHolder);
|
||||
return KeyHolderFunctions.getKey(item.getId(), keyHolder);
|
||||
}
|
||||
|
||||
public int[] saveAll(List<PackagingItems> items) {
|
||||
List<MapSqlParameterSource> batchParams = new ArrayList<>();
|
||||
for (PackagingItems item : items) {
|
||||
batchParams.add(prepareParams(item));
|
||||
}
|
||||
return namedParameterJdbcTemplate.batchUpdate(INSERT_QUERY, batchParams.toArray(new MapSqlParameterSource[0]));
|
||||
}
|
||||
|
||||
public boolean delete(long id) {
|
||||
MapSqlParameterSource params = new MapSqlParameterSource("id", id);
|
||||
return namedParameterJdbcTemplate.update(DELETE_BY_ID, params) > 0;
|
||||
}
|
||||
|
||||
public List<PackagingItems> findByJobCardId(long jobCardId) {
|
||||
MapSqlParameterSource params = new MapSqlParameterSource("job_card_id", jobCardId);
|
||||
return namedParameterJdbcTemplate.query(SELECT_BY_JOB_CARD_ID, params, new PackagingItemsRowMapper());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
package com.utopiaindustries.dao.ctp;
|
||||
|
||||
import com.utopiaindustries.model.ctp.JobCard;
|
||||
import com.utopiaindustries.model.ctp.PurchaseOrderCTP;
|
||||
import com.utopiaindustries.util.KeyHolderFunctions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||
import org.springframework.jdbc.support.GeneratedKeyHolder;
|
||||
import org.springframework.jdbc.support.KeyHolder;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public class PurchaseOrderCTPDao {
|
||||
|
||||
@Autowired
|
||||
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
|
||||
|
||||
private final String TABLE_NAME = "cut_to_pack.purchase_order";
|
||||
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, purchase_order_code, purchase_order_quantity, purchase_order_quantity_required, article_name, created_by, status) " +
|
||||
"VALUES (:id, :purchase_order_code, :purchase_order_quantity, :purchase_order_quantity_required, :article_name, :created_by, :status) " +
|
||||
"ON DUPLICATE KEY UPDATE " +
|
||||
"purchase_order_code = VALUES(purchase_order_code), " +
|
||||
"purchase_order_quantity = VALUES(purchase_order_quantity), " +
|
||||
"purchase_order_quantity_required = VALUES(purchase_order_quantity_required), " +
|
||||
"article_name = VALUES(article_name), " +
|
||||
"created_by = VALUES(created_by), " +
|
||||
"status = VALUES(status)",
|
||||
TABLE_NAME);
|
||||
private final String SELECT_BY_LIMIT = String.format( "SELECT * FROM %s WHERE created_by = :created_by ORDER BY id ASC limit :limit", TABLE_NAME );
|
||||
|
||||
|
||||
// prepare query params
|
||||
private MapSqlParameterSource prepareInsertQueryParams(PurchaseOrderCTP purchaseOrderCTP) {
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
params.addValue("id", purchaseOrderCTP.getId())
|
||||
.addValue("purchase_order_code", purchaseOrderCTP.getPurchaseOrderCode())
|
||||
.addValue("purchase_order_quantity", purchaseOrderCTP.getPurchaseOrderQuantity())
|
||||
.addValue("purchase_order_quantity_required", purchaseOrderCTP.getPurchaseOrderQuantityRequired())
|
||||
.addValue("article_name", purchaseOrderCTP.getArticleName())
|
||||
.addValue("created_by", purchaseOrderCTP.getCreatedBy())
|
||||
.addValue("status", purchaseOrderCTP.getStatus());
|
||||
return params;
|
||||
}
|
||||
|
||||
|
||||
// find
|
||||
public PurchaseOrderCTP find(long id ) {
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
params.addValue( "id", id );
|
||||
return namedParameterJdbcTemplate.query( SELECT_QUERY, params, new PurchaseOrderCTPRowMapper() )
|
||||
.stream()
|
||||
.findFirst()
|
||||
.orElse( new PurchaseOrderCTP() );
|
||||
}
|
||||
|
||||
|
||||
// find all
|
||||
public List<PurchaseOrderCTP> findAll() {
|
||||
return namedParameterJdbcTemplate.query( SELECT_ALL_QUERY, new PurchaseOrderCTPRowMapper() );
|
||||
}
|
||||
|
||||
// save
|
||||
public long save( PurchaseOrderCTP PurchaseOrderCTP) {
|
||||
KeyHolder keyHolder = new GeneratedKeyHolder();
|
||||
MapSqlParameterSource params = prepareInsertQueryParams(PurchaseOrderCTP);
|
||||
namedParameterJdbcTemplate.update( INSERT_QUERY, params, keyHolder );
|
||||
return KeyHolderFunctions.getKey( PurchaseOrderCTP.getId(), keyHolder );
|
||||
}
|
||||
|
||||
// save all
|
||||
public int[] saveAll( List<PurchaseOrderCTP> purchaseOrderCTPS) {
|
||||
List<MapSqlParameterSource> batchArgs = new ArrayList<>();
|
||||
for ( PurchaseOrderCTP PurchaseOrderCTP : purchaseOrderCTPS) {
|
||||
MapSqlParameterSource params = prepareInsertQueryParams(PurchaseOrderCTP);
|
||||
batchArgs.add( params );
|
||||
}
|
||||
return namedParameterJdbcTemplate.batchUpdate( INSERT_QUERY, batchArgs.toArray(new MapSqlParameterSource[purchaseOrderCTPS.size()]) );
|
||||
}
|
||||
|
||||
// delete
|
||||
public boolean delete( long id ) {
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
params.addValue( "id", id );
|
||||
return namedParameterJdbcTemplate.update( DELETE_QUERY, params ) > 0;
|
||||
}
|
||||
|
||||
public List<PurchaseOrderCTP> findByQuery(String query ){
|
||||
return namedParameterJdbcTemplate.query( query, new PurchaseOrderCTPRowMapper() );
|
||||
}
|
||||
|
||||
public List<PurchaseOrderCTP> findByUserAndLimit(String createdBy, Long limit ){
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
params.addValue("limit", limit.intValue() );
|
||||
params.addValue("created_by", createdBy );
|
||||
return namedParameterJdbcTemplate.query( SELECT_BY_LIMIT, params, new PurchaseOrderCTPRowMapper() );
|
||||
}
|
||||
|
||||
public List<PurchaseOrderCTP> findByAllWithLimit(Long limit){
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
params.addValue("limit", limit.intValue());
|
||||
return namedParameterJdbcTemplate.query( SELECT_ALL_QUERY_WITH_LIMIT, params, new PurchaseOrderCTPRowMapper() );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.utopiaindustries.dao.ctp;
|
||||
|
||||
import com.utopiaindustries.model.ctp.PurchaseOrderCTP;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class PurchaseOrderCTPRowMapper implements RowMapper<PurchaseOrderCTP> {
|
||||
public PurchaseOrderCTP mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
PurchaseOrderCTP PurchaseOrderCTP = new PurchaseOrderCTP();
|
||||
PurchaseOrderCTP.setId(rs.getLong("id"));
|
||||
PurchaseOrderCTP.setPurchaseOrderCode(rs.getString("purchase_order_code"));
|
||||
PurchaseOrderCTP.setPurchaseOrderQuantity(rs.getInt("purchase_order_quantity"));
|
||||
PurchaseOrderCTP.setPurchaseOrderQuantityRequired(rs.getInt("purchase_order_quantity_required"));
|
||||
PurchaseOrderCTP.setArticleName(rs.getString("article_name"));
|
||||
if (rs.getTimestamp("created_at") != null) {
|
||||
PurchaseOrderCTP.setCreatedAt(rs.getTimestamp("created_at").toLocalDateTime());
|
||||
}
|
||||
PurchaseOrderCTP.setCreatedBy(rs.getString("created_by"));
|
||||
PurchaseOrderCTP.setStatus(rs.getString("status"));
|
||||
return PurchaseOrderCTP;
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ public enum InventoryArtifactType {
|
|||
BUNDLE,
|
||||
STITCHING_OFFLINE,
|
||||
FINISHED_ITEM,
|
||||
STITCH_BUNDLE
|
||||
STITCH_BUNDLE,
|
||||
PACKAGING
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,180 @@
|
|||
package com.utopiaindustries.model.ctp;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class PackagingItems implements InventoryArtifact {
|
||||
private long id;
|
||||
private long itemId;
|
||||
private String sku;
|
||||
private String barcode;
|
||||
private long jobCardId;
|
||||
@DateTimeFormat( pattern = "yyyy-MM-dd HH:mm:ss" )
|
||||
private LocalDateTime createdAt;
|
||||
private String createdBy;
|
||||
private boolean isQa;
|
||||
private long finishedItemId;
|
||||
private boolean isSegregated;
|
||||
// wrapper
|
||||
private JobCard jobCard;
|
||||
private long accountId;
|
||||
private String qaStatus;
|
||||
private long bundleId;
|
||||
private String accountTitle;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "-";
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public long getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public void setItemId(long itemId) {
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
public String getSku() {
|
||||
return sku;
|
||||
}
|
||||
|
||||
public void setSku(String sku) {
|
||||
this.sku = sku;
|
||||
}
|
||||
|
||||
public String getBarcode() {
|
||||
return barcode;
|
||||
}
|
||||
|
||||
public void setBarcode(String barcode) {
|
||||
this.barcode = barcode;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(LocalDateTime createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public long getJobCardId() {
|
||||
return jobCardId;
|
||||
}
|
||||
|
||||
public void setJobCardId(long jobCardId) {
|
||||
this.jobCardId = jobCardId;
|
||||
}
|
||||
|
||||
public boolean getIsQa() {
|
||||
return isQa;
|
||||
}
|
||||
|
||||
public void setIsQa(boolean qa) {
|
||||
isQa = qa;
|
||||
}
|
||||
|
||||
public long getFinishedItemId() {
|
||||
return finishedItemId;
|
||||
}
|
||||
|
||||
public void setFinishedItemId(long finishedItemId) {
|
||||
this.finishedItemId = finishedItemId;
|
||||
}
|
||||
|
||||
public JobCard getJobCard() {
|
||||
return jobCard;
|
||||
}
|
||||
|
||||
public void setJobCard(JobCard jobCard) {
|
||||
this.jobCard = jobCard;
|
||||
}
|
||||
|
||||
public boolean getIsSegregated() {
|
||||
return isSegregated;
|
||||
}
|
||||
|
||||
public void setIsSegregated(boolean segregated) {
|
||||
isSegregated = segregated;
|
||||
}
|
||||
|
||||
public long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
public void setAccountId(long accountId) {
|
||||
this.accountId = accountId;
|
||||
}
|
||||
|
||||
public String getQaStatus() {
|
||||
return qaStatus;
|
||||
}
|
||||
|
||||
public void setQaStatus(String qaStatus) {
|
||||
this.qaStatus = qaStatus;
|
||||
}
|
||||
|
||||
public BigDecimal getWrapQuantity(){
|
||||
return null;
|
||||
}
|
||||
|
||||
public long getMasterBundleId(){
|
||||
return 0;
|
||||
}
|
||||
|
||||
public long getBundleId(){
|
||||
return bundleId;
|
||||
}
|
||||
|
||||
public void setBundleId(long bundleId) {
|
||||
this.bundleId = bundleId;
|
||||
}
|
||||
|
||||
public String getAccountTitle() {
|
||||
return accountTitle;
|
||||
}
|
||||
|
||||
public void setAccountTitle(String accountTitle) {
|
||||
this.accountTitle = accountTitle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PackagingItems{" +
|
||||
"id=" + id +
|
||||
", itemId=" + itemId +
|
||||
", sku='" + sku + '\'' +
|
||||
", barcode='" + barcode + '\'' +
|
||||
", jobCardId=" + jobCardId +
|
||||
", createdAt=" + createdAt +
|
||||
", createdBy='" + createdBy + '\'' +
|
||||
", isQa=" + isQa +
|
||||
", finishedItemId=" + finishedItemId +
|
||||
", isSegregated=" + isSegregated +
|
||||
", jobCard=" + jobCard +
|
||||
", accountId=" + accountId +
|
||||
", qaStatus='" + qaStatus + '\'' +
|
||||
", bundleId=" + bundleId +
|
||||
", accountTitle='" + accountTitle + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.utopiaindustries.model.ctp;
|
||||
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class PackagingItemsRowMapper implements RowMapper<PackagingItems> {
|
||||
@Override
|
||||
public PackagingItems mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
PackagingItems item = new PackagingItems();
|
||||
item.setId(rs.getLong("id"));
|
||||
item.setItemId(rs.getLong("item_id"));
|
||||
item.setSku(rs.getString("sku"));
|
||||
item.setBarcode(rs.getString("barcode"));
|
||||
item.setJobCardId(rs.getLong("job_card_id"));
|
||||
item.setCreatedAt(rs.getTimestamp("created_at") != null ? rs.getTimestamp("created_at").toLocalDateTime() : null);
|
||||
item.setCreatedBy(rs.getString("created_by"));
|
||||
item.setIsQa(rs.getBoolean("is_qa"));
|
||||
item.setFinishedItemId(rs.getLong("finish_item_id"));
|
||||
item.setIsSegregated(rs.getBoolean("is_segregated"));
|
||||
item.setAccountId(rs.getLong("account_id"));
|
||||
item.setQaStatus(rs.getString("qa_status"));
|
||||
item.setBundleId(rs.getLong("bundle_id"));
|
||||
item.setAccountTitle(rs.getString("account_title"));
|
||||
return item;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
package com.utopiaindustries.model.ctp;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class PurchaseOrderCTP {
|
||||
|
||||
public enum Status{
|
||||
DRAFT,
|
||||
POSTED,
|
||||
}
|
||||
|
||||
private long id;
|
||||
private String purchaseOrderCode;
|
||||
private long purchaseOrderQuantity;
|
||||
private long purchaseOrderQuantityRequired;
|
||||
private String articleName;
|
||||
private String createdBy;
|
||||
private LocalDateTime createdAt;
|
||||
private String status;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPurchaseOrderCode() {
|
||||
return purchaseOrderCode;
|
||||
}
|
||||
|
||||
public void setPurchaseOrderCode(String purchaseOrderCode) {
|
||||
this.purchaseOrderCode = purchaseOrderCode;
|
||||
}
|
||||
|
||||
public long getPurchaseOrderQuantity() {
|
||||
return purchaseOrderQuantity;
|
||||
}
|
||||
|
||||
public void setPurchaseOrderQuantity(long purchaseOrderQuantity) {
|
||||
this.purchaseOrderQuantity = purchaseOrderQuantity;
|
||||
}
|
||||
|
||||
public long getPurchaseOrderQuantityRequired() {
|
||||
return purchaseOrderQuantityRequired;
|
||||
}
|
||||
|
||||
public void setPurchaseOrderQuantityRequired(long purchaseOrderQuantityRequired) {
|
||||
this.purchaseOrderQuantityRequired = purchaseOrderQuantityRequired;
|
||||
}
|
||||
|
||||
public String getArticleName() {
|
||||
return articleName;
|
||||
}
|
||||
|
||||
public void setArticleName(String articleName) {
|
||||
this.articleName = articleName;
|
||||
}
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(LocalDateTime createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
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 PurchaseOrderCTPQueryBuilder {
|
||||
public static String buildQuery(String purchaseOrderCode, String articleName, String createdBy, String startDate, String endDate, Long count ){
|
||||
// format date
|
||||
String formattedDate;
|
||||
String formattedEndDate;
|
||||
String startDate1 = "";
|
||||
String endDate1 = "";
|
||||
String purchaseOrderCode1 = purchaseOrderCode == null ? "" : purchaseOrderCode;
|
||||
String articleName1 = articleName == null ? "" : articleName;
|
||||
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() );
|
||||
}
|
||||
}
|
||||
|
||||
return (new QueryBuilder())
|
||||
.setTable("cut_to_pack.purchase_order")
|
||||
.setColumns("*")
|
||||
.where()
|
||||
.columnEquals("created_by", createdBy)
|
||||
.and()
|
||||
.columnLike("purchase_order_code", "%" + purchaseOrderCode1 + "%")
|
||||
.and()
|
||||
.columnLike("article_name", articleName)
|
||||
.and()
|
||||
.columnEqualToOrGreaterThan("created_at", startDate1)
|
||||
.and()
|
||||
.columnEqualToOrLessThan("created_at", endDate1)
|
||||
.limit(count.intValue())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@ import java.time.LocalDate;
|
|||
|
||||
public class StichedOfflineItemQueryBuilder {
|
||||
|
||||
public static String buildQuery(String id, String itemId, String sku, String createdStartDate, String createdEndDate, Long bundleId, Long count) {
|
||||
public static String buildQuery(String id, String itemId, String sku, String QaStatus,String createdStartDate, String createdEndDate, Long bundleId, Long count) {
|
||||
// format date
|
||||
String formattedDate;
|
||||
String formattedEndDate;
|
||||
|
@ -24,8 +24,7 @@ public class StichedOfflineItemQueryBuilder {
|
|||
endDate1 = String.format("'%s 23:59:59'", LocalDate.now());
|
||||
}
|
||||
}
|
||||
|
||||
return ( new QueryBuilder() )
|
||||
QueryBuilder qb = (new QueryBuilder())
|
||||
.setTable("cut_to_pack.stitching_offline_item")
|
||||
.setColumns("*")
|
||||
.where()
|
||||
|
@ -33,17 +32,20 @@ public class StichedOfflineItemQueryBuilder {
|
|||
.and()
|
||||
.columnEquals("sku", sku)
|
||||
.and()
|
||||
.columnEquals("item_id", itemId )
|
||||
.columnEquals("item_id", itemId)
|
||||
.and()
|
||||
.columnEquals("bundle_id", bundleId )
|
||||
.columnEquals("bundle_id", bundleId)
|
||||
.and()
|
||||
.columnEqualToOrGreaterThan("created_at", startDate1)
|
||||
.and()
|
||||
.columnEqualToOrLessThan("created_at", endDate1 )
|
||||
.orderBy("id","DESC")
|
||||
.limit(count)
|
||||
.build();
|
||||
.columnEqualToOrLessThan("created_at", endDate1);
|
||||
if (!StringUtils.isNullOrEmpty(QaStatus)) {
|
||||
qb.and().columnEquals("qa_status", QaStatus);
|
||||
}
|
||||
qb.orderBy("id", "DESC")
|
||||
.limit(count);
|
||||
|
||||
return qb.build();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,4 +24,9 @@ public class FinishedItemRestController {
|
|||
@RequestParam( "is-segregated") boolean isSegregated ){
|
||||
return finishedItemDAO.findByTerm( term, isSegregated );
|
||||
}
|
||||
@GetMapping( "/search-packaging" )
|
||||
public List<FinishedItem> searchFinishedItemsForPackaging(@RequestParam( "term") String term,
|
||||
@RequestParam( "is-segregated") boolean isSegregated ){
|
||||
return finishedItemDAO.findByTerm( term, true );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -415,7 +415,7 @@ public class BarcodeService {
|
|||
}
|
||||
|
||||
document.close();
|
||||
// sendPdfToZebraPrinter(pdfPath.toFile());
|
||||
sendPdfToZebraPrinter(pdfPath.toFile());
|
||||
}
|
||||
|
||||
public void sendPdfToZebraPrinter(File pdfFile) throws Exception {
|
||||
|
|
|
@ -125,13 +125,13 @@ public class BundleService {
|
|||
/*
|
||||
* find finished Items by params
|
||||
* */
|
||||
public List<StitchingOfflineItem> getStitchedOfflineItems(String id, String itemId, String sku, String createdStartDate, String createdEndDate, Long bundleId, Long count ){
|
||||
public List<StitchingOfflineItem> getStitchedOfflineItems(String id, String itemId, String sku,String status, String createdStartDate, String createdEndDate, Long bundleId, Long count ){
|
||||
List<StitchingOfflineItem> stitchingOfflineItems = new ArrayList<>();
|
||||
if( count == null ){
|
||||
count = 100L;
|
||||
}
|
||||
if( StringUtils.isAnyNotNullOrEmpty(id, itemId, sku, createdStartDate, createdEndDate, String.valueOf(bundleId) ) ){
|
||||
String query = StichedOfflineItemQueryBuilder.buildQuery( id, itemId, sku, createdStartDate, createdEndDate, bundleId , count );
|
||||
String query = StichedOfflineItemQueryBuilder.buildQuery( id, itemId, sku, status,createdStartDate, createdEndDate, bundleId , count );
|
||||
System.out.println( query );
|
||||
stitchingOfflineItems = stitchingOfflineItemDAO.findByQuery( query );
|
||||
} else {
|
||||
|
|
|
@ -28,8 +28,9 @@ public class InventoryService {
|
|||
private final MasterBundleDAO masterBundleDAO;
|
||||
private final FinishedItemDAO finishedItemDAO;
|
||||
private final StitchingOfflineItemDAO stitchingOfflineItemDAO;
|
||||
private final PackagingItemsDAO packagingItemsDAO;
|
||||
|
||||
public InventoryService( JobCardItemDAO jobCardItemDAO, CutPieceDAO cutPieceDAO, BundleDAO bundleDAO, InventoryTransactionLegDAO inventoryTransactionLegDAO, InventoryTransactionDAO inventoryTransactionDAO, JobCardDAO jobCardDAO, CryptographyService cryptographyService, MasterBundleDAO masterBundleDAO, FinishedItemDAO finishedItemDAO, StitchingOfflineItemDAO stitchingOfflineItemDAO) {
|
||||
public InventoryService(JobCardItemDAO jobCardItemDAO, CutPieceDAO cutPieceDAO, BundleDAO bundleDAO, InventoryTransactionLegDAO inventoryTransactionLegDAO, InventoryTransactionDAO inventoryTransactionDAO, JobCardDAO jobCardDAO, CryptographyService cryptographyService, MasterBundleDAO masterBundleDAO, FinishedItemDAO finishedItemDAO, StitchingOfflineItemDAO stitchingOfflineItemDAO, PackagingItemsDAO packagingItemsDAO) {
|
||||
this.jobCardItemDAO = jobCardItemDAO;
|
||||
this.cutPieceDAO = cutPieceDAO;
|
||||
this.bundleDAO = bundleDAO;
|
||||
|
@ -40,6 +41,7 @@ public class InventoryService {
|
|||
this.masterBundleDAO = masterBundleDAO;
|
||||
this.finishedItemDAO = finishedItemDAO;
|
||||
this.stitchingOfflineItemDAO = stitchingOfflineItemDAO;
|
||||
this.packagingItemsDAO = packagingItemsDAO;
|
||||
}
|
||||
|
||||
private void updateJobCardInventoryStatus( JobCard card ){
|
||||
|
@ -601,27 +603,93 @@ public class InventoryService {
|
|||
* item is approved and grade is selected then fI is move to grade account
|
||||
*/
|
||||
if ( finishedItem.getQaStatus( ).equalsIgnoreCase( "APPROVED") && finishedItem.getAccountId( ) != 0) {
|
||||
finishedItem.setIsSegregated( true);
|
||||
}
|
||||
updatedItems.add( finishedItem);
|
||||
}
|
||||
// save finish items
|
||||
finishedItemDAO.saveAll( updatedItems);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Packaging items
|
||||
* */
|
||||
@Transactional( rollbackFor = Exception.class, propagation = Propagation.NESTED )
|
||||
public void createPackagingItemAndTransaction( FinishedItemWrapper wrapper) {
|
||||
if ( wrapper != null && wrapper.getItems( ) != null) {
|
||||
|
||||
List<FinishedItem> items = wrapper.getItems( );
|
||||
List<FinishedItem> updatedItems = new ArrayList<>( );
|
||||
List<PackagingItems> packagingItems = new ArrayList<>( );
|
||||
// finished ids
|
||||
List<Long> finishedItemIds = items.stream( ).map( FinishedItem::getId)
|
||||
.collect( Collectors.toList( ));
|
||||
// stitched ids
|
||||
List<Long> stitchedItemIds = items.stream( ).map( FinishedItem::getStitchedItemId)
|
||||
.collect( Collectors.toList( ));
|
||||
|
||||
// find parent doc type last IN transaction map
|
||||
Map<Long, InventoryTransactionLeg> lastFinishedItemIdInTransactionMap = inventoryTransactionLegDAO
|
||||
.findLastTransactionByParentIdAndParentType( InventoryTransactionLeg.Type.IN.name( ), finishedItemIds, InventoryArtifactType.FINISHED_ITEM.name( ))
|
||||
.stream( )
|
||||
.collect( Collectors.toMap( InventoryTransactionLeg::getParentDocumentId, Function.identity( )));
|
||||
|
||||
// create transaction
|
||||
InventoryTransaction transaction = createInventoryTransaction( "Against Segregation of Finished Items");
|
||||
|
||||
|
||||
// create IN and OUT for all approved items
|
||||
for ( FinishedItem finishedItem : items) {
|
||||
InventoryTransactionLeg lastInvTransaction = lastFinishedItemIdInTransactionMap.getOrDefault( finishedItem.getId( ), null);
|
||||
finishedItem.setIsQa( true);
|
||||
|
||||
if ( finishedItem.getQaStatus( ).equalsIgnoreCase( "APPROVED") && finishedItem.getIsSegregated( )) {
|
||||
// create OUT and IN transactions for FI
|
||||
PackagingItems packagingItems1 = (createPackagingItem(finishedItem));
|
||||
packagingItems1.setId(packagingItemsDAO.save(packagingItems1));
|
||||
if ( lastInvTransaction != null) {
|
||||
// OUT
|
||||
long fromAccount = lastInvTransaction.getAccountId( );
|
||||
createInventoryTransactionLeg( transaction, finishedItem, fromAccount, InventoryTransactionLeg.Type.OUT.name( ), InventoryArtifactType.FINISHED_ITEM.name( ));
|
||||
// IN
|
||||
createInventoryTransactionLeg( transaction, finishedItem, finishedItem.getAccountId( ), InventoryTransactionLeg.Type.IN.name( ), InventoryArtifactType.FINISHED_ITEM.name( ));
|
||||
createInventoryTransactionLeg( transaction, packagingItems1, 8, InventoryTransactionLeg.Type.IN.name( ), InventoryArtifactType.PACKAGING.name( ));
|
||||
}
|
||||
finishedItem.setIsSegregated( true);
|
||||
packagingItems.add(packagingItems1);
|
||||
}
|
||||
updatedItems.add( finishedItem);
|
||||
}
|
||||
finishedItemDAO.saveAll( updatedItems);
|
||||
// save finish items
|
||||
finishedItemDAO.saveAll( updatedItems);
|
||||
System.out.println(packagingItems);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* find item summary by account
|
||||
* */
|
||||
public List<InventorySummary> findItemSummaryByAccountId( long accountId) {
|
||||
return inventoryTransactionLegDAO.findSummaryByAccountId( accountId);
|
||||
}
|
||||
|
||||
private PackagingItems createPackagingItem(FinishedItem finishedItem){
|
||||
Authentication authentication = SecurityContextHolder.getContext( ).getAuthentication( );
|
||||
PackagingItems packagingItems = new PackagingItems();
|
||||
packagingItems.setItemId(finishedItem.getItemId());
|
||||
packagingItems.setAccountId(finishedItem.getAccountId());
|
||||
packagingItems.setFinishedItemId(finishedItem.getId());
|
||||
packagingItems.setJobCardId(finishedItem.getJobCardId());
|
||||
packagingItems.setJobCard(finishedItem.getJobCard());
|
||||
packagingItems.setSku(finishedItem.getSku());
|
||||
packagingItems.setBarcode(finishedItem.getBarcode());
|
||||
packagingItems.setCreatedAt(LocalDateTime.now());
|
||||
packagingItems.setCreatedBy(authentication.getName( ));
|
||||
packagingItems.setIsQa(finishedItem.getIsQa());
|
||||
packagingItems.setIsSegregated(finishedItem.getIsSegregated());
|
||||
packagingItems.setQaStatus(finishedItem.getQaStatus());
|
||||
return packagingItems;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package com.utopiaindustries.service;
|
||||
|
||||
import com.utopiaindustries.dao.ctp.PackagingItemsDAO;
|
||||
import com.utopiaindustries.model.ctp.FinishedItemWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class PackagingService {
|
||||
|
||||
private final InventoryService inventoryService;
|
||||
private final PackagingItemsDAO packagingItemsDAO;
|
||||
|
||||
public PackagingService(InventoryService inventoryService, PackagingItemsDAO packagingItemsDAO) {
|
||||
this.inventoryService = inventoryService;
|
||||
this.packagingItemsDAO = packagingItemsDAO;
|
||||
}
|
||||
|
||||
public void createPackagingItem(FinishedItemWrapper wrapper){
|
||||
inventoryService.createPackagingItemAndTransaction(wrapper);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package com.utopiaindustries.service;
|
||||
|
||||
import com.utopiaindustries.dao.ctp.PurchaseOrderCTPDao;
|
||||
import com.utopiaindustries.model.ctp.*;
|
||||
import com.utopiaindustries.querybuilder.ctp.JobCardQueryBuilder;
|
||||
import com.utopiaindustries.querybuilder.ctp.PurchaseOrderCTPQueryBuilder;
|
||||
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.List;
|
||||
|
||||
@Service
|
||||
public class PurchaseOrderCTPService {
|
||||
|
||||
private final PurchaseOrderCTPDao purchaseOrderCTPDao;
|
||||
|
||||
public PurchaseOrderCTPService(PurchaseOrderCTPDao purchaseOrderCTPDao) {
|
||||
this.purchaseOrderCTPDao = purchaseOrderCTPDao;
|
||||
}
|
||||
|
||||
/*
|
||||
* search by id
|
||||
* */
|
||||
public PurchaseOrderCTP searchPurchaseOrderById(long id){
|
||||
return purchaseOrderCTPDao.find(id);
|
||||
}
|
||||
|
||||
/*
|
||||
* create new job card
|
||||
* */
|
||||
public PurchaseOrderCTP createNewPurchaseOrderCTP() {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
PurchaseOrderCTP purchaseOrderCTP = new PurchaseOrderCTP();
|
||||
purchaseOrderCTP.setCreatedBy( authentication.getName() );
|
||||
purchaseOrderCTP.setCreatedAt( LocalDateTime.now() );
|
||||
return purchaseOrderCTP;
|
||||
}
|
||||
|
||||
/*
|
||||
* save card
|
||||
* */
|
||||
@Transactional( rollbackFor = Exception.class )
|
||||
public void save(PurchaseOrderCTP purchaseOrderCTP) {
|
||||
purchaseOrderCTPDao.save(purchaseOrderCTP);
|
||||
}
|
||||
|
||||
public List<PurchaseOrderCTP> getAllPurchaseOrderCtp(String purchaseOrderCode, String articleName, String StartDate, String EndDate, Long limit) {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
List<PurchaseOrderCTP> list = new ArrayList<>();
|
||||
String createdBy = authentication.getName();
|
||||
if( limit == null ){
|
||||
limit = 100L;
|
||||
}
|
||||
if( !StringUtils.isAnyNotNullOrEmpty(purchaseOrderCode, articleName) ){
|
||||
for (GrantedAuthority role : authentication.getAuthorities()){
|
||||
if (role.toString().equals("ROLE_ADMIN")){
|
||||
createdBy = "";
|
||||
}
|
||||
}
|
||||
String query = PurchaseOrderCTPQueryBuilder.buildQuery(purchaseOrderCode, articleName, createdBy, StartDate, EndDate, limit );
|
||||
System.out.println( query );
|
||||
list = purchaseOrderCTPDao.findByQuery( query );
|
||||
}else {
|
||||
list = purchaseOrderCTPDao.findByUserAndLimit( authentication.getName(), limit );
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
|
@ -90,7 +90,6 @@
|
|||
},
|
||||
methods : {
|
||||
onItemSelect: function (id, item) {
|
||||
console.log("wdwawdwwadwwdwda",item.id)
|
||||
this.items.push(item);
|
||||
},
|
||||
removeItem: function (index) {
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
( async function(){
|
||||
|
||||
Vue.prototype.$accounts = window.ctp.accounts;
|
||||
|
||||
Vue.component('finish-item-table',{
|
||||
props : [ 'items' ],
|
||||
methods: {
|
||||
getFormattedDateTime: function (dateTime) {
|
||||
if (!!dateTime) {
|
||||
return dateTime.split('T')[0] + ' ' + dateTime.split('T')[1];
|
||||
}
|
||||
return luxon.DateTime.now().toFormat('yyyy-MM-dd HH:mm:ss');
|
||||
},
|
||||
removeItem: function (index) {
|
||||
this.$emit('remove-item', index)
|
||||
}
|
||||
},
|
||||
template : `
|
||||
<table class="table table-bordered bg-white col-sm-12">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Item ID</th>
|
||||
<th>Sku</th>
|
||||
<th>Created By</th>
|
||||
<th>Created At</th>
|
||||
<th>Job Card ID</th>
|
||||
<th>Barcode</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(item,index) in items">
|
||||
<td>
|
||||
<input hidden="hidden" v-bind:name="'items[' + index + '].id'" v-bind:value="item.id">
|
||||
<input hidden="hidden" v-bind:name="'items[' + index + '].itemId'" v-bind:value="item.itemId">
|
||||
<input hidden="hidden" v-bind:name="'items[' + index + '].sku'" v-bind:value="item.sku">
|
||||
<input hidden="hidden" v-bind:name="'items[' + index + '].createdBy'" v-bind:value="item.createdBy">
|
||||
<input hidden="hidden" v-bind:name="'items[' + index + '].createdAt'" v-bind:value="getFormattedDateTime(item.createdAt)">
|
||||
<input hidden="hidden" v-bind:name="'items[' + index + '].jobCardId'" v-bind:value="item.jobCardId">
|
||||
<input hidden="hidden" v-bind:name="'items[' + index + '].barcode'" v-bind:value="item.barcode" >
|
||||
<input hidden="hidden" v-bind:name="'items[' + index + '].isQa'" v-bind:value="item.isQa">
|
||||
<input hidden="hidden" v-bind:name="'items[' + index + '].stitchedItemId'" v-bind:value="item.stitchedItemId">
|
||||
<input hidden="hidden" v-bind:name="'items[' + index + '].isSegregated'" v-bind:value="item.isSegregated">
|
||||
<input hidden="hidden" v-bind:name="'items[' + index + '].qaStatus'" v-bind:value="item.qaStatus">
|
||||
<input hidden="hidden" v-bind:name="'items[' + index + '].accountId'" v-bind:value="item.accountId">
|
||||
<span> {{item.id}} </span>
|
||||
</td>
|
||||
<td> {{item.itemId}} </td>
|
||||
<td> {{item.sku}} </td>
|
||||
<td> {{item.createdBy}} </td>
|
||||
<td> {{ getFormattedDateTime( item.createdAt) }} </td>
|
||||
<td> {{item.jobCardId}}</td>
|
||||
<td> {{item.barcode}} </td>
|
||||
<td > {{item.qaStatus}} </td>
|
||||
<td>
|
||||
<button type="button" title="Remove" class="btn btn-light text-left" v-on:click="removeItem(index)">
|
||||
<i class="bi bi-trash"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
`,
|
||||
|
||||
})
|
||||
|
||||
let app = new Vue({
|
||||
el : '#packagingApp',
|
||||
data : {
|
||||
items : []
|
||||
},
|
||||
methods : {
|
||||
onItemSelect: function (id, item) {
|
||||
this.items.push(item);
|
||||
},
|
||||
removeItem: function (index) {
|
||||
this.items.splice(index, 1);
|
||||
},
|
||||
hasDuplicates: function () {
|
||||
const ids = this.items.map(item => item.id);
|
||||
const uniqueIds = new Set(ids);
|
||||
return ids.length !== uniqueIds.size;
|
||||
},
|
||||
},
|
||||
mounted : function () {
|
||||
console.log( this.$accounts )
|
||||
}
|
||||
})
|
||||
|
||||
})(jQuery)
|
|
@ -31,6 +31,10 @@
|
|||
<img th:src="@{/img/utopia-industries-white.svg}" class="page-header__logo" alt="Utopia Industries">
|
||||
</a>
|
||||
<ul class="navbar-nav">
|
||||
<!-- <li class="nav-item" sec:authorize="hasAnyRole('ROLE_PURCHASE_ORDER', 'ROLE_ADMIN')">-->
|
||||
<!-- <a th:href="@{/purchase-order/}" class="nav-link"-->
|
||||
<!-- th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/purchase-order') ? 'active' : ''}">Purchase Order</a>-->
|
||||
<!-- </li>-->
|
||||
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_JOB_CARD', 'ROLE_ADMIN')">
|
||||
<a th:href="@{/job-cards/}" class="nav-link"
|
||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/job-cards') ? 'active' : ''}">Job Cards</a>
|
||||
|
@ -91,6 +95,16 @@
|
|||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<!-- second level purchase Order-->
|
||||
<!-- <nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"-->
|
||||
<!-- th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/purchase-order')}">-->
|
||||
<!-- <ul class="navbar-nav">-->
|
||||
<!-- <li class="nav-item"-->
|
||||
<!-- th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/purchase-order') ? 'active' : ''}">-->
|
||||
<!-- <a th:href="@{/purchase-order/}" class="nav-link">Cards</a>-->
|
||||
<!-- </li>-->
|
||||
<!-- </ul>-->
|
||||
<!-- </nav>-->
|
||||
<!-- second level job cards-->
|
||||
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
||||
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/job-cards')}">
|
||||
|
@ -208,6 +222,10 @@
|
|||
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
||||
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/packaging')}">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item"
|
||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/packaging/receive-inventory') ? 'active' : ''}">
|
||||
<a th:href="@{/packaging/receive-inventory}" class="nav-link">Receive Inventory</a>
|
||||
</li>
|
||||
<li class="nav-item"
|
||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/packaging/inventory-accounts') ? 'active' : ''}">
|
||||
<a th:href="@{/packaging/inventory-accounts}" class="nav-link">Inventory Accounts</a>
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<th>Created By</th>
|
||||
<th>
|
||||
<div class="mb-2">
|
||||
<button class="btn btn-sm btn-outline-primary" type="submit">Generate Barcode</button>
|
||||
<button class="btn btn-sm btn-outline-primary" type="submit">Generate Bundle Barcode</button>
|
||||
</div>
|
||||
<div><input type="checkbox" data-checkbox-all></div>
|
||||
</th>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<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, "desc" ]]">
|
||||
data-order="[[ 6, "desc" ]]">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
|
@ -32,7 +32,7 @@
|
|||
<th>Received</th>
|
||||
<th>
|
||||
<div class="mb-2">
|
||||
<button class="btn btn-sm btn-outline-primary" type="submit">Generate
|
||||
<button class="btn btn-sm btn-outline-primary" type="submit">Generate Master
|
||||
Barcode
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<main class="row page-main">
|
||||
<div class="col-sm">
|
||||
<div th:replace="_notices :: page-notices"></div>
|
||||
<h3 class="pb-2">Receive Inventory</h3>
|
||||
<h3 class="pb-2">Receive Inventory Against Job Card</h3>
|
||||
<form th:action="@{/cutting/receive-inventory}"
|
||||
method="POST"
|
||||
id="receiveInvApp"
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml"
|
||||
xmlns:v-bind="http://www.w3.org/1999/xhtml">
|
||||
<head th:replace="_fragments :: head('Segregate Finished Items')"></head>
|
||||
<body>
|
||||
<div class="container-fluid">
|
||||
<header class="row page-header" th:replace="_fragments :: page-header"></header>
|
||||
<main class="row page-main">
|
||||
<div class="col-sm">
|
||||
<div class="mb-4 d-flex justify-content-between">
|
||||
<h3>Receive Finished Items</h3>
|
||||
</div>
|
||||
<form th:action="'/ctp/packaging/packaging-items'" method="post" id="packagingApp">
|
||||
<div class="bg-light p-3 mb-3">
|
||||
<div class="form-row">
|
||||
<div class="col-sm-3 form-group">
|
||||
<search-item
|
||||
url="/ctp/rest/finished-items/search-packaging"
|
||||
v-on:finished-item-select="onItemSelect">
|
||||
</search-item>
|
||||
</div>
|
||||
<div class="col-sm-3 form-group">
|
||||
<!-- <label>Packaging Account</label>-->
|
||||
<!-- <select class="form-control" name="account-id" th:field="*{finishedAccountId}" required>-->
|
||||
<!-- <option value="">PLease select</option>-->
|
||||
<!-- <option th:each="account : ${accounts}"-->
|
||||
<!-- th:value="${account.id}"-->
|
||||
<!-- th:text="${account.title}"></option>-->
|
||||
<!-- </select>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-light p-3 mb-3">
|
||||
<h6 class="mb-3">Search Finished Items</h6>
|
||||
<finish-item-table
|
||||
v-bind:items="items"
|
||||
v-on:remove-item="removeItem"
|
||||
></finish-item-table>
|
||||
</div>
|
||||
<div class="alert alert-danger" v-if="hasDuplicates()" >Duplicate Item Selected</div>
|
||||
<button class="btn btn-primary" type="submit" v-bind:disabled="hasDuplicates()">Submit</button>
|
||||
<a th:href="@{/finishing/finished-items}" class="btn btn-light">Cancel</a>
|
||||
</form>
|
||||
<script th:inline="javascript">
|
||||
window.ctp.accounts = [[${accounts}]];
|
||||
</script>
|
||||
<script th:src="@{/js/vendor/compressor.min.js}"></script>
|
||||
<script th:src="@{/js/packaging/packaging-item-form.js}"></script>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
<div th:replace="_fragments :: page-footer-scripts"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml" xmlns:v-bind="http://www.w3.org/1999/xhtml">
|
||||
<head th:replace="_fragments :: head('Home Page')"></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" th:fragment="cardFragment">
|
||||
<div th:replace="_notices :: page-notices"></div>
|
||||
<form th:action="@{ ${purchaseOrderCTP.id} ? ('/purchase-order/edit/' + ${purchaseOrderCTP.id}) : '/purchase-order/edit' }"
|
||||
method="POST"
|
||||
th:object="${purchaseOrderCTP}"
|
||||
id="purchaseOrderApp">
|
||||
<input hidden="hidden" th:field="*{id}">
|
||||
<input hidden="hidden" th:field="*{order}">
|
||||
<div class="bg-light p-3 mb-3">
|
||||
<h6 class="mb-3">Info</h6>
|
||||
<div class="form-row">
|
||||
<div class="col-sm-3 form-group">
|
||||
<label>Job Order</label>
|
||||
<input type="number" class="form-control" th:field="*{jobOrderId}" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button class="btn btn-secondary" type="submit" name="user" value="draft" v-bind:disabled="hasEmptyItems()">Save Draft</button>
|
||||
<button class="btn btn-primary" type="submit" name="user" value="post" v-bind:disabled="hasEmptyItems()">Post</button>
|
||||
<a th:href="@{/job-cards}" class="btn btn-light">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
<div th:replace="_fragments :: page-footer-scripts"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -13,7 +13,7 @@
|
|||
<div class="col-sm">
|
||||
<div th:replace="_notices :: page-notices"></div>
|
||||
<div class="mb-4 d-flex justify-content-between">
|
||||
<h3>Finished Items</h3>
|
||||
<h3>QC Items</h3>
|
||||
<a th:href="@{/quality-control/qc-finished-item}" class="btn btn-primary">Add Items For QC</a>
|
||||
</div>
|
||||
<div th:replace="_fragments :: table-loading-skeleton"></div>
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -9,74 +9,71 @@
|
|||
<header class="row page-header" th:replace="_fragments :: page-header"></header>
|
||||
<main class="row page-main">
|
||||
<aside class="col-sm-2" th:replace="/reporting/cutting-report-sidebar :: sidebar"></aside>
|
||||
<div class="col-sm">
|
||||
<table class="table table-striped" data-account-table data-order="[[ 0, "asc" ]]">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td th:if="${cutting.get('Date Wise Cutting') != null}" style="padding-left: 150px;">
|
||||
<div style="border: 2px solid #d5d8dc; padding-top: 10px; border-radius: 10px; height: 560px; width: 80%; overflow-x: auto;">
|
||||
<div id="singleBarChart" class="singleBarChart" style="height: 500px; width: 1600px;"
|
||||
th:data-width="1600"
|
||||
th:data-height="500"
|
||||
th:data-title="'Days Wise Progress'"
|
||||
th:data-dates="${cutting.get('Date Wise Cutting').keySet()}"
|
||||
th:data-barData="${cutting.get('Date Wise Cutting').values()}"
|
||||
th:data-barHeading="'Cutting'"
|
||||
th:data-stitching="''"
|
||||
th:data-quality="''"
|
||||
th:data-finishing="''"
|
||||
th:data-totalProduction="'30000'"
|
||||
th:data-fontSize="30"
|
||||
></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr th:if="${cutting.get('cuttingAccount') != null}" th:each="cuttingAccount, index : ${cutting.get('cuttingAccount')}">
|
||||
<td th:if="${cutting.get('accountWiseCutting').containsKey(cuttingAccount.id)}" class="p-0 text-center">
|
||||
<div class="bg-dark text-white py-2 px-3 fs-5 fw-bold text-center" th:text="${cuttingAccount.title}"></div>
|
||||
<table class="table table-bordered mt-2">
|
||||
<thead class="">
|
||||
<tr>
|
||||
<th>Job Card</th>
|
||||
<th>PO Number</th>
|
||||
<th>SKU</th>
|
||||
<th>Article Name</th>
|
||||
<th>Total Cutting</th>
|
||||
<th>Cutting Operator Name</th>
|
||||
<th>Width</th>
|
||||
<th>Length</th>
|
||||
<th>GSM</th>
|
||||
<th>WT PLY</th>
|
||||
<th>PLY</th>
|
||||
<th>Cutting Complete</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="wrap, index : ${cutting.get('accountWiseCutting').get(cuttingAccount.id)}">
|
||||
<td th:text="${wrap.jobCardCode}"></td>
|
||||
<td th:text="${wrap.poName}"></td>
|
||||
<td th:text="${wrap.sku}"></td>
|
||||
<td th:text="${wrap.articleName}"></td>
|
||||
<td th:text="${wrap.total}"></td>
|
||||
<td th:text="${wrap.operatorName}"></td>
|
||||
<td th:text="${wrap.width}"></td>
|
||||
<td th:text="${wrap.length}"></td>
|
||||
<td th:text="${wrap.gsm}"></td>
|
||||
<td th:text="${wrap.wtPly}"></td>
|
||||
<td th:text="${wrap.ply}"></td>
|
||||
<td>
|
||||
<span th:if="${!wrap.Complete}" class="badge badge-danger" >Not Complete</span>
|
||||
<div th:if="${wrap.Complete}">
|
||||
<span class="badge badge-APPROVED">Completed</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="col-lg-10">
|
||||
<div th:if="${cutting.get('Date Wise Cutting') != null}" class="d-flex justify-content-center">
|
||||
<div class="border rounded-3 pt-2 mx-auto overflow-auto" style="height: 560px; width: 80%;">
|
||||
<div id="singleBarChart" class="singleBarChart" style="height: 500px; width: 1600px;"
|
||||
th:data-width="1600"
|
||||
th:data-height="500"
|
||||
th:data-title="'Days Wise Progress'"
|
||||
th:data-dates="${cutting.get('Date Wise Cutting').keySet()}"
|
||||
th:data-barData="${cutting.get('Date Wise Cutting').values()}"
|
||||
th:data-barHeading="'Cutting'"
|
||||
th:data-stitching="''"
|
||||
th:data-quality="''"
|
||||
th:data-finishing="''"
|
||||
th:data-totalProduction="'30000'"
|
||||
th:data-fontSize="30"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-3" th:if="${cutting.get('cuttingAccount') != null}"
|
||||
th:each="cuttingAccount, index : ${cutting.get('cuttingAccount')}">
|
||||
<div th:if="${cutting.get('accountWiseCutting').containsKey(cuttingAccount.id)}"
|
||||
class="p-0 text-center">
|
||||
<div class="bg-dark text-white py-2 px-3 fs-5 fw-bold text-center"
|
||||
th:text="${cuttingAccount.title}"></div>
|
||||
<table class="table table-bordered mt-2">
|
||||
<thead class="">
|
||||
<tr>
|
||||
<th>Job Card</th>
|
||||
<th>PO Number</th>
|
||||
<th>SKU</th>
|
||||
<th>Article Name</th>
|
||||
<th>Total Cutting</th>
|
||||
<th>Cutting Operator Name</th>
|
||||
<th>Width</th>
|
||||
<th>Length</th>
|
||||
<th>GSM</th>
|
||||
<th>WT PLY</th>
|
||||
<th>PLY</th>
|
||||
<th>Cutting Complete</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="wrap, index : ${cutting.get('accountWiseCutting').get(cuttingAccount.id)}">
|
||||
<td th:text="${wrap.jobCardCode}"></td>
|
||||
<td th:text="${wrap.poName}"></td>
|
||||
<td th:text="${wrap.sku}"></td>
|
||||
<td th:text="${wrap.articleName}"></td>
|
||||
<td th:text="${wrap.total}"></td>
|
||||
<td th:text="${wrap.operatorName}"></td>
|
||||
<td th:text="${wrap.width}"></td>
|
||||
<td th:text="${wrap.length}"></td>
|
||||
<td th:text="${wrap.gsm}"></td>
|
||||
<td th:text="${wrap.wtPly}"></td>
|
||||
<td th:text="${wrap.ply}"></td>
|
||||
<td>
|
||||
<span th:if="${!wrap.Complete}" class="badge badge-danger">Not Complete</span>
|
||||
<div th:if="${wrap.Complete}">
|
||||
<span class="badge badge-APPROVED">Completed</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
|
|
@ -9,134 +9,136 @@
|
|||
<header class="row page-header" th:replace="_fragments :: page-header"></header>
|
||||
<main class="row page-main">
|
||||
<aside class="col-sm-2" th:replace="/reporting/job-card-report-sidebar :: sidebar"></aside>
|
||||
<div class="col-sm">
|
||||
<table class="table " >
|
||||
<thead>
|
||||
<tr th:if="${jobCardProgress == null}">
|
||||
<th colspan="5" style="font-size:26px; text-align: center;">Please Select Job card</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<div class="col-lg-10">
|
||||
<div th:if="${jobCardProgress == null}" class="text-center my-5">
|
||||
<h2 class="fs-1">Please Select Job Card</h2>
|
||||
</div>
|
||||
|
||||
<tbody>
|
||||
<tr th:if="${jobCardProgress != null }">
|
||||
<td style="padding:0px;">
|
||||
<div style="border: 2px solid #d5d8dc; padding: 10px; border-radius: 10px; height: 370px;">
|
||||
<h1 style="text-align: center;">Job Card Report</h1>
|
||||
<div style="display: flex; align-items: center;">
|
||||
<div style="text-align: center;margin-top: -45px">
|
||||
<div style="width: 300px; height: 330px;"
|
||||
th:id="'gauge-chart2'"
|
||||
class="gauge-chart2"
|
||||
th:data-progress="${jobCardProgress.get('Job Card Progress')}"
|
||||
th:data-title="${'Job Card Progress'}"
|
||||
th:data-width="350"
|
||||
th:data-height="350"
|
||||
th:data-totalProduction="${totalProduction}"
|
||||
th:data-actualProduction="${completeProduction.get('Job Card Progress')}"
|
||||
th:data-fontSize="30"
|
||||
th:data-fontColor="'#17202a'"
|
||||
th:data-color="'#566573'"></div>
|
||||
<div th:if="${jobCardProgress != null}">
|
||||
<div class="border rounded-3 pt-4 ">
|
||||
<h1 class="text-center mb-5">Job Card Report</h1>
|
||||
|
||||
<div class="row justify-content-center align-items-start">
|
||||
<div class="text-center">
|
||||
<div class="gauge-chart2"
|
||||
th:id="'gauge-chart2'"
|
||||
th:data-progress="${jobCardProgress.get('Job Card Progress')}"
|
||||
th:data-title="'Job Card Progress'"
|
||||
th:data-width="350"
|
||||
th:data-height="350"
|
||||
th:data-totalProduction="${totalProduction}"
|
||||
th:data-actualProduction="${completeProduction.get('Job Card Progress')}"
|
||||
th:data-fontSize="30"
|
||||
th:data-fontColor="'#17202a'"
|
||||
th:data-color="'#566573'">
|
||||
</div>
|
||||
<div style="display: flex; ">
|
||||
<div th:each="title, index : ${jobCardProgress.keySet()}" style="text-align: center; margin-top: 40px;">
|
||||
<div th:if ="${ title != 'Job Card Progress' }"
|
||||
th:id="'gauge-chart-' + ${index}" class="gauge-chart" style="width: 200px; height: 230px;"
|
||||
th:data-progress="${jobCardProgress.get(title)}"
|
||||
th:data-totalProduction="${totalProduction}"
|
||||
th:data-actualProduction="${completeProduction.get(title)}"
|
||||
th:data-title="${title}"
|
||||
th:data-width="230"
|
||||
th:data-height="230"
|
||||
th:data-fontSize="20"
|
||||
th:data-aGrade="${segregateItems.get('A GRADE') == null ? 0 : segregateItems.get('A GRADE')}"
|
||||
th:data-bGrade="${segregateItems.get('B GRADE') == null ? 0 : segregateItems.get('B GRADE')}"
|
||||
th:data-cGrade="${segregateItems.get('C GRADE') == null ? 0 : segregateItems.get('C GRADE')}"
|
||||
th:data-fontColor="'#17202a'"
|
||||
th:data-color="'#95a5a6'">
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex flex-wrap justify-content-center gap-2 " style="margin-top: 70px;">
|
||||
<div th:each="title, index : ${jobCardProgress.keySet()}"
|
||||
th:if="${title != 'Job Card Progress'}" class="text-center">
|
||||
<div class="gauge-chart"
|
||||
th:id="'gauge-chart-' + ${index}"
|
||||
th:data-progress="${jobCardProgress.get(title)}"
|
||||
th:data-totalProduction="${totalProduction}"
|
||||
th:data-actualProduction="${completeProduction.get(title)}"
|
||||
th:data-title="${title}"
|
||||
th:data-width="230"
|
||||
th:data-height="230"
|
||||
th:data-fontSize="20"
|
||||
th:data-aGrade="${segregateItems.get('A GRADE') == null ? 0 : segregateItems.get('A GRADE')}"
|
||||
th:data-bGrade="${segregateItems.get('B GRADE') == null ? 0 : segregateItems.get('B GRADE')}"
|
||||
th:data-cGrade="${segregateItems.get('C GRADE') == null ? 0 : segregateItems.get('C GRADE')}"
|
||||
th:data-fontColor="'#17202a'"
|
||||
th:data-color="'#95a5a6'">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr th:if="${phasesTimes != null }">
|
||||
<td style="display: flex; flex-direction: column; align-items: center; border: none !important; outline: none;">
|
||||
<div style="display: flex; gap: 10px;">
|
||||
<div th:each="phase, index : ${phasesTimes.keySet()}" style="border: 2px solid #d5d8dc; border-radius: 10px; text-align: center; padding:20px;">
|
||||
<H6 th:text="${phase}"></H6>
|
||||
<H6 th:text="${phasesTimes.get(phase)}"></H6>
|
||||
<H6 th:if="${pendingStatus.get(phase) != null}" th:text="${pendingStatus.get(phase)}"></H6>
|
||||
</div>
|
||||
|
||||
<div th:if="${phasesTimes != null}" class="d-flex flex-column align-items-center my-2">
|
||||
<div class="d-flex flex-wrap gap-3">
|
||||
<div th:each="phase, index : ${phasesTimes.keySet()}"
|
||||
class="border rounded-3 text-center p-3 mr-3">
|
||||
<h6 th:text="${phase}"></h6>
|
||||
<h6 th:text="${phasesTimes.get(phase)}"></h6>
|
||||
<h6 th:if="${pendingStatus.get(phase) != null}" th:text="${pendingStatus.get(phase)}"></h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<div class="row g-4">
|
||||
<div class="col-md-6"
|
||||
th:if="${cuttingDetails != null && cuttingDetails.get('accounts') != null}">
|
||||
<div class="bg-dark text-white text-center py-2 rounded-3 mb-3">
|
||||
Cutting Detail
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered align-middle">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Title</th>
|
||||
<th>Cutting</th>
|
||||
<th>Cutting Date</th>
|
||||
<th>Descriptions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="detail, index : ${cuttingDetails.get('accounts').keySet()}">
|
||||
<td th:text="${cuttingDetails.get('accounts').get(detail).id}"></td>
|
||||
<td th:text="${cuttingDetails.get('accounts').get(detail).title}"></td>
|
||||
<td th:text="${cuttingDetails.get('personName').get(detail)}"></td>
|
||||
<td>
|
||||
<span th:text="${#temporals.format(cuttingDetails.get('date').get(detail), 'E')}"></span>
|
||||
<span ctp:formatdate="${cuttingDetails.get('date').get(detail)}"></span>
|
||||
</td>
|
||||
<td th:text="${cuttingDetails.get('accounts').get(detail).notes}"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6"
|
||||
th:if="${stitchingDetails != null && stitchingDetails.get('accounts') != null}">
|
||||
<div class="bg-dark text-white text-center py-2 rounded-3 mb-3">
|
||||
Stitching Detail
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered align-middle">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Title</th>
|
||||
<th>Stitching</th>
|
||||
<th>Stitching Day</th>
|
||||
<th>Descriptions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="detail : ${stitchingDetails.get('accounts').keySet()}">
|
||||
<td th:text="${stitchingDetails.get('accounts').get(detail).id}"></td>
|
||||
<td th:text="${stitchingDetails.get('accounts').get(detail).title}"></td>
|
||||
<td th:text="${stitchingDetails.get('personName') != null ? stitchingDetails.get('personName').get(detail) : ''}"></td>
|
||||
<td>
|
||||
<span th:if="${stitchingDetails.get('date') != null and stitchingDetails.get('date').get(detail) != null}"
|
||||
th:text="${#temporals.format(stitchingDetails.get('date').get(detail), 'E')}"></span>
|
||||
<span th:if="${stitchingDetails.get('date') != null and stitchingDetails.get('date').get(detail) != null}"
|
||||
ctp:formatdate="${stitchingDetails.get('date').get(detail)}"></span>
|
||||
</td>
|
||||
<td th:text="${stitchingDetails.get('accounts').get(detail).notes}"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<!-- Cutting Details Column -->
|
||||
<td th:if="${cuttingDetails != null && cuttingDetails.get('accounts') != null}" style="padding: 0px; text-align: center;">
|
||||
<div style="background-color: black; color: white; padding: 10px; font-size: 18px; font-weight: bold; text-align: center;">
|
||||
Cutting Detail
|
||||
</div>
|
||||
<table class="table" style="width: 100%; border-collapse: collapse;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Title</th>
|
||||
<th>Cutting</th>
|
||||
<th>Cutting Date</th>
|
||||
<th>Cutting Table Descriptions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:if="${cuttingDetails != null}" th:each="detail, index : ${cuttingDetails.get('accounts').keySet()}">
|
||||
<td th:text="${cuttingDetails.get('accounts').get(detail).id}"></td>
|
||||
<td th:text="${cuttingDetails.get('accounts').get(detail).title}"></td>
|
||||
<td th:text="${cuttingDetails.get('personName').get(detail)}"></td>
|
||||
<td>
|
||||
<span th:text="${#temporals.format(cuttingDetails.get('date').get(detail), 'E')}"></span>
|
||||
<span ctp:formatdate="${cuttingDetails.get('date').get(detail)}"></span>
|
||||
</td>
|
||||
<td th:text="${cuttingDetails.get('accounts').get(detail).notes}"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</div>
|
||||
|
||||
<!-- Stitching Details Column -->
|
||||
<td th:if="${stitchingDetails != null && stitchingDetails.get('accounts') != null}" style="padding: 0px; text-align: center;">
|
||||
<div style="background-color: black; color: white; padding: 10px; font-size: 18px; font-weight: bold; text-align: center;">
|
||||
Stitching Detail
|
||||
</div>
|
||||
<table class="table" style="width: 100%; border-collapse: collapse;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Title</th>
|
||||
<th>Stitching</th>
|
||||
<th>Stitching Day</th>
|
||||
<th>Stitching Table Descriptions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody th:if="${stitchingDetails != null and stitchingDetails.get('accounts') != null}">
|
||||
<tr th:each="detail : ${stitchingDetails.get('accounts').keySet()}">
|
||||
<td th:text="${stitchingDetails.get('accounts').get(detail).id}"></td>
|
||||
<td th:text="${stitchingDetails.get('accounts').get(detail).title}"></td>
|
||||
<td th:text="${stitchingDetails.get('personName') != null ? stitchingDetails.get('personName').get(detail) : ''}"></td>
|
||||
<td>
|
||||
<span th:if="${stitchingDetails.get('date') != null and stitchingDetails.get('date').get(detail) != null}" th:text="${#temporals.format(stitchingDetails.get('date').get(detail), 'E')}"></span>
|
||||
<span th:if="${stitchingDetails.get('date') != null and stitchingDetails.get('date').get(detail) != null}" ctp:formatdate="${stitchingDetails.get('date').get(detail)}"></span>
|
||||
</td>
|
||||
<td th:text="${stitchingDetails.get('accounts').get(detail).notes}"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr th:if="${dailyProgress != null}">
|
||||
<td colspan="5" style="padding-left: 150px;">
|
||||
<div style="border: 2px solid #d5d8dc; padding-top: 10px; border-radius: 10px; height: 560px; width: 80%; overflow-x: auto;">
|
||||
<div th:if="${dailyProgress != null}" class="d-flex justify-content-center my-5">
|
||||
<div class="border rounded-3 p-3 w-75 overflow-auto" style="height: 560px;">
|
||||
<div id="barChart" class="barChart" style="height: 500px; width: 1600px;"
|
||||
th:data-width="1600"
|
||||
th:data-height="500"
|
||||
|
@ -147,13 +149,11 @@
|
|||
th:data-quality="${dailyProgress.get('quality')}"
|
||||
th:data-finishing="${dailyProgress.get('finishing')}"
|
||||
th:data-totalProduction="${completeProduction.get('Cutting Progress')}"
|
||||
th:data-fontSize="30"
|
||||
></div>
|
||||
th:data-fontSize="30">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
<div class="col-sm">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr th:if="${allJobCard != null}" th:each="jobCard : ${allJobCard.keySet()}" style="padding-bottom:10px">
|
||||
<tr th:if="${allJobCard != null}" th:each="jobCard : ${allJobCard.keySet()}"
|
||||
style="padding-bottom:10px">
|
||||
<td class="m-0 pb-3">
|
||||
<table class="table mb-0 table-bordered text-center">
|
||||
<thead>
|
||||
|
@ -25,12 +26,16 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td >
|
||||
<span style="font-size: 14px; font-weight: bold;" th:text="'Total : ' + ${allJobCard.get(jobCard).get('Cutting Progress')}"></span>
|
||||
<td>
|
||||
<span style="font-size: 14px; font-weight: bold;"
|
||||
th:text="'Total : ' + ${allJobCard.get(jobCard).get('Cutting Progress')}"></span>
|
||||
<br>
|
||||
<span style="font-size: 14px; font-weight: bold;" th:text="'Complete Products : ' + ${allJobCard.get(jobCard).get('Job Card Progress')}"></span>
|
||||
<span style="font-size: 14px; font-weight: bold;"
|
||||
th:text="'Complete Products : ' + ${allJobCard.get(jobCard).get('Job Card Progress')}"></span>
|
||||
</td>
|
||||
<td style="font-size: 14px;" th:if="${values != 'Job Card Progress'}" th:each="values : ${allJobCard.get(jobCard).keySet()}" th:text="${allJobCard.get(jobCard).get(values)}"></td>
|
||||
<td style="font-size: 14px;" th:if="${values != 'Job Card Progress'}"
|
||||
th:each="values : ${allJobCard.get(jobCard).keySet()}"
|
||||
th:text="${allJobCard.get(jobCard).get(values)}"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
<main class="row page-main">
|
||||
<aside class="col-sm-2" th:replace="/reporting/cutting-report-sidebar :: sidebar"></aside>
|
||||
<div class="col-lg-10">
|
||||
<div th:if="${stitching.get('Date Wise Stitching') != null}" style="padding-left: 150px;">
|
||||
<div style="border: 2px solid #d5d8dc; padding-top: 10px; border-radius: 10px; height: 560px; width: 80%; overflow-x: auto;">
|
||||
<div th:if="${stitching.get('Date Wise Stitching') != null}" class="d-flex justify-content-center">
|
||||
<div class="border rounded-3 pt-2 mx-auto overflow-auto" style="height: 560px; width: 80%;">
|
||||
<div id="singleBarChart" class="singleBarChart" style="height: 500px; width: 1600px;"
|
||||
th:data-width="1600"
|
||||
th:data-height="500"
|
||||
|
@ -22,13 +22,14 @@
|
|||
th:data-stitching="''"
|
||||
th:data-quality="''"
|
||||
th:data-finishing="''"
|
||||
th:data-totalProduction="'500'"
|
||||
th:data-totalProduction="'30000'"
|
||||
th:data-fontSize="30"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-3" th:if="${stitching.get('stitchingAccount') != null && stitching.get('jobCardItemsStitchingDetailsMap').get(stitchingAccount.id) != null}"
|
||||
<div class="mt-3"
|
||||
th:if="${stitching.get('stitchingAccount') != null && stitching.get('jobCardItemsStitchingDetailsMap').get(stitchingAccount.id) != null}"
|
||||
th:each="stitchingAccount, index : ${stitching.get('stitchingAccount')}">
|
||||
<div class="bg-dark text-white py-2 px-3 fs-5 fw-bold text-center mb-2"
|
||||
th:text="${stitchingAccount.title}"></div>
|
||||
|
|
|
@ -31,6 +31,15 @@
|
|||
<label>End Date</label>
|
||||
<input type="date" class="form-control" name="end-date" th:value="${param['end-date'] ?: endDate}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Status</label>
|
||||
<select class="form-control" name="status">
|
||||
<option value="" th:selected="${param.status == null}">Please Select</option>
|
||||
<option value="APPROVED" th:selected="${param.status == 'true'}">Approved</option>
|
||||
<option value="REJECT" th:selected="${param.status == 'false'}">Reject</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Count</label>
|
||||
<input type="number" class="form-control" name="count" maxlength="100" min="0" th:value="${param['count'] ?: 100}">
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<button class="btn btn-primary" type="submit">Receive Inventory</button>
|
||||
<button class="btn btn-primary" type="submit">Receive Master Bundle</button>
|
||||
<a th:href="@{/job-cards}" class="btn btn-light">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
<div class="col-sm">
|
||||
<div th:replace="_notices :: page-notices"></div>
|
||||
<div class="mb-4 d-flex justify-content-between">
|
||||
<h3>Stitching Offline Items</h3>
|
||||
<a th:href="@{/stitching/create-stitching-items}" class="btn btn-primary">Create Stitched Items</a>
|
||||
<h3>Stitching WIP's</h3>
|
||||
<a th:href="@{/stitching/create-stitching-items}" class="btn btn-primary">Create Stitching WIP's</a>
|
||||
</div>
|
||||
<div th:replace="_fragments :: table-loading-skeleton"></div>
|
||||
<form th:action="@{/stitching/generate-barcodes}" method="post">
|
||||
|
@ -32,7 +32,7 @@
|
|||
<th>Is QA</th>
|
||||
<th>
|
||||
<div class="mb-2">
|
||||
<button class="btn btn-sm btn-outline-primary" type="submit">Generate Barcode</button>
|
||||
<button class="btn btn-sm btn-outline-primary" type="submit">Generate QR code</button>
|
||||
</div>
|
||||
<div><input type="checkbox" data-checkbox-all></div>
|
||||
</th>
|
||||
|
|
Loading…
Reference in New Issue