Compare commits
No commits in common. "main" and "add-store" have entirely different histories.
|
@ -1,56 +0,0 @@
|
|||
package com.utopiaindustries.controller;
|
||||
|
||||
import com.utopiaindustries.auth.PurchaseOrderCTPRole;
|
||||
import com.utopiaindustries.model.ctp.POsDetails;
|
||||
import com.utopiaindustries.service.InventoryAccountService;
|
||||
import com.utopiaindustries.service.PurchaseOrderService;
|
||||
import com.utopiaindustries.service.ReportingService;
|
||||
import com.utopiaindustries.service.SummaryInventoryReportService;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/po-status")
|
||||
@PurchaseOrderCTPRole
|
||||
public class POStatusController {
|
||||
|
||||
private final ReportingService reportingService;
|
||||
private final PurchaseOrderService purchaseOrderService;
|
||||
|
||||
|
||||
public POStatusController(ReportingService reportingService, PurchaseOrderService purchaseOrderService) {
|
||||
this.reportingService = reportingService;
|
||||
this.purchaseOrderService = purchaseOrderService;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public String homePage( Model model ){
|
||||
return "redirect:/po-status/all-pos";
|
||||
}
|
||||
|
||||
@GetMapping( "/all-pos")
|
||||
public String poReport(@RequestParam(value = "poName", required = false) String poName, Model model){
|
||||
|
||||
model.addAttribute("allPOs", reportingService.getAllPOs(poName));
|
||||
return "/reporting/po-report";
|
||||
}
|
||||
|
||||
@GetMapping( value = "/po-report-view/{poId}" )
|
||||
public String showJobCardDetail(@PathVariable("poId") long poId, @RequestParam(value = "select-date", required = false) String selectDate ,
|
||||
Model model ){
|
||||
model.addAttribute("allJobCard", reportingService.getAllPoJobCards(poId, selectDate));
|
||||
return "/reporting/po-job-card-report";
|
||||
}
|
||||
|
||||
@GetMapping(value = "/generate-po-pdf", produces = MediaType.APPLICATION_PDF_VALUE)
|
||||
public ResponseEntity<InputStreamResource> sendPoAndReturnPdf(@ModelAttribute POsDetails pOsDetails,
|
||||
@RequestParam(required = false, defaultValue = "true") boolean includeJobCard,
|
||||
@RequestParam(required = false, defaultValue = "true") boolean includeStoreDetails,
|
||||
Model model) throws Exception{
|
||||
return purchaseOrderService.generatePOPdf(pOsDetails, model, includeJobCard, includeStoreDetails);
|
||||
}
|
||||
}
|
|
@ -5,7 +5,6 @@ import com.utopiaindustries.model.ctp.JobCard;
|
|||
import com.utopiaindustries.model.ctp.PurchaseOrderCTP;
|
||||
import com.utopiaindustries.service.PurchaseOrderCTPService;
|
||||
import com.utopiaindustries.util.StringUtils;
|
||||
import org.springframework.security.core.parameters.P;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -86,11 +85,6 @@ public class PurchaseOrderCTPController {
|
|||
return "redirect:/purchase-order";
|
||||
}
|
||||
|
||||
@GetMapping( "/store-items/{id}" )
|
||||
public String getPOStoreItems( @PathVariable("id") long poId,
|
||||
Model model ){
|
||||
model.addAttribute("storeItems", purchaseOrderCTPService.getStoreItemsByPoId( poId ));
|
||||
return "/reporting/po-store-items-table";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
package com.utopiaindustries.controller;
|
||||
|
||||
import com.utopiaindustries.auth.ReportingRole;
|
||||
import com.utopiaindustries.model.ctp.POsDetails;
|
||||
import com.utopiaindustries.model.ctp.SummaryInventoryReport;
|
||||
import com.utopiaindustries.service.InventoryAccountService;
|
||||
import com.utopiaindustries.service.PurchaseOrderService;
|
||||
import com.utopiaindustries.service.ReportingService;
|
||||
import com.utopiaindustries.service.SummaryInventoryReportService;
|
||||
import com.utopiaindustries.util.StringUtils;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
@ -28,19 +26,17 @@ public class ReportingController {
|
|||
private final ReportingService reportingService;
|
||||
private final SummaryInventoryReportService summaryInventoryReportService;
|
||||
private final InventoryAccountService inventoryAccountService;
|
||||
private final PurchaseOrderService purchaseOrderService;
|
||||
|
||||
|
||||
public ReportingController(SummaryInventoryReportService summaryInventoryReportService2, ReportingService reportingService, InventoryAccountService inventoryAccountService, PurchaseOrderService purchaseOrderService) {
|
||||
public ReportingController(SummaryInventoryReportService summaryInventoryReportService2, ReportingService reportingService, InventoryAccountService inventoryAccountService) {
|
||||
this.summaryInventoryReportService = summaryInventoryReportService2;
|
||||
this.reportingService = reportingService;
|
||||
this.inventoryAccountService = inventoryAccountService;
|
||||
this.purchaseOrderService = purchaseOrderService;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public String homePage( Model model ){
|
||||
return "redirect:/reporting/job-card-report";
|
||||
return "redirect:/reporting/po-report";
|
||||
}
|
||||
|
||||
@GetMapping( "/summary")
|
||||
|
@ -77,6 +73,20 @@ public class ReportingController {
|
|||
return "/reporting/job-card-report";
|
||||
}
|
||||
|
||||
@GetMapping( "/po-report")
|
||||
public String poReport(@RequestParam(value = "poName", required = false) String poName, Model model){
|
||||
|
||||
model.addAttribute("allPOs", reportingService.getAllPOs(poName));
|
||||
return "/reporting/po-report";
|
||||
}
|
||||
|
||||
@GetMapping( value = "/po-report-view/{poNo}" )
|
||||
public String showJobCardDetail( @PathVariable("poNo") String poNo, @RequestParam(value = "select-date", required = false) String selectDate ,
|
||||
Model model ){
|
||||
model.addAttribute("allJobCard", reportingService.getAllPoJobCards(poNo, selectDate));
|
||||
return "/reporting/po-job-card-report";
|
||||
}
|
||||
|
||||
@GetMapping( value = "/cutting-report" )
|
||||
public String cuttingReport(@RequestParam(value = "job-card-id", required = false ) String jobCardId, @RequestParam(value = "accountId" , required = false) String accountId, @RequestParam(value = "start-date", required = false) String startDate, @RequestParam(value = "end-date", required = false) String endDate, Model model ){
|
||||
|
||||
|
@ -119,6 +129,7 @@ public class ReportingController {
|
|||
return "/reporting/accounts-transaction-table";
|
||||
}
|
||||
|
||||
|
||||
private ArrayList<LocalDate> generateDateList(LocalDate start, LocalDate end) {
|
||||
ArrayList<LocalDate> localDates = new ArrayList<>();
|
||||
while (start.isBefore(end)) {
|
||||
|
|
|
@ -32,7 +32,7 @@ public class FinishedItemDAO {
|
|||
private final String SELECT_BY_TERM_FOR_PACKAGING = String.format("SELECT * FROM %s WHERE barcode LIKE :term AND is_segregated = :is_segregated AND qa_status = :qa_status AND is_packed = FALSE AND is_store = FALSE ORDER BY ID DESC", TABLE_NAME);
|
||||
private final String SELECT_BY_STITCHED_ITEM_ID = String.format("SELECT * FROM %s WHERE stitched_item_id = :stitched_item_id AND is_packed = FALSE", TABLE_NAME);
|
||||
private final String SELECT_BY_STITCHED_ITEM_IDS = String.format("SELECT * FROM %s WHERE stitched_item_id IN (:stitched_item_ids)", TABLE_NAME);
|
||||
private final String COUNT_TOTAL_FINISH_ITEM = String.format("SELECT COUNT(*) FROM %s WHERE job_card_id = :job_card_id AND is_qa = TRUE AND (is_segregated IS TRUE OR is_store = TRUE) ", TABLE_NAME);
|
||||
private final String COUNT_TOTAL_FINISH_ITEM = String.format("SELECT COUNT(*) FROM %s WHERE job_card_id = :job_card_id AND is_segregated IS TRUE ", TABLE_NAME);
|
||||
private final String SELECT_BY_JOB_CARD_AND_DATE = String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id AND (:start_date IS NULL OR :end_date IS NULL OR created_at BETWEEN :start_date AND :end_date)", TABLE_NAME);
|
||||
private final String SELECT_BY_DATE_QA_STATUS = String.format( "SELECT COUNT(*) FROM %s WHERE (:start_date IS NULL OR operation_date >= :start_date) AND operation_date <= :end_date AND qa_status = :qa_status AND id in (:ids) AND is_packed = FALSE AND is_qa = TRUE", TABLE_NAME );
|
||||
|
||||
|
|
|
@ -21,7 +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_BY_PO_ID = String.format( "SELECT * FROM %s WHERE purchase_order_id = :purchase_order_id", 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, poQuantity, articleName) VALUES (:id, :code, :job_order_id, :created_at, :created_by, :status, :inventory_status, :customer, :lot_number, :purchase_order_id, :location_site_id, :description, :poQuantity, :articleName) 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), poQuantity = VALUES(poQuantity), articleName = VALUES(articleName) ", 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 );
|
||||
|
@ -114,9 +114,9 @@ public class JobCardDAO {
|
|||
return namedParameterJdbcTemplate.query( query, new JobCardRowMapper() );
|
||||
}
|
||||
|
||||
public List<JobCard> findByPoId(long poId){
|
||||
public List<JobCard> findByAllWithLimit(Long limit){
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
params.addValue("purchase_order_id", poId);
|
||||
return namedParameterJdbcTemplate.query( SELECT_ALL_BY_PO_ID, params, new JobCardRowMapper() );
|
||||
params.addValue("limit", limit.intValue());
|
||||
return namedParameterJdbcTemplate.query( SELECT_ALL_QUERY_WITH_LIMIT, params, new JobCardRowMapper() );
|
||||
}
|
||||
}
|
|
@ -23,8 +23,8 @@ public class PurchaseOrderCTPDao {
|
|||
|
||||
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 ", TABLE_NAME );
|
||||
private final String SELECT_BY_PO_CODE = String.format( "SELECT * FROM %s WHERE purchase_order_code = :purchase_order_code", 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) " +
|
||||
|
@ -107,10 +107,10 @@ public class PurchaseOrderCTPDao {
|
|||
return namedParameterJdbcTemplate.query( SELECT_BY_LIMIT, params, new PurchaseOrderCTPRowMapper() );
|
||||
}
|
||||
|
||||
public List<PurchaseOrderCTP> findByPoCode(String poCode){
|
||||
public List<PurchaseOrderCTP> findByAllWithLimit(Long limit){
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
params.addValue("purchase_order_code", poCode);
|
||||
return namedParameterJdbcTemplate.query( SELECT_BY_PO_CODE, params, new PurchaseOrderCTPRowMapper() );
|
||||
params.addValue("limit", limit.intValue());
|
||||
return namedParameterJdbcTemplate.query( SELECT_ALL_QUERY_WITH_LIMIT, params, new PurchaseOrderCTPRowMapper() );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.utopiaindustries.dao.ctp;
|
||||
|
||||
import com.utopiaindustries.model.ctp.PackagingItems;
|
||||
import com.utopiaindustries.model.ctp.StoreItem;
|
||||
import com.utopiaindustries.util.KeyHolderFunctions;
|
||||
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
||||
|
@ -9,9 +10,7 @@ import org.springframework.jdbc.support.KeyHolder;
|
|||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Repository
|
||||
public class StoreItemDao {
|
||||
|
@ -24,24 +23,25 @@ public class StoreItemDao {
|
|||
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 final String COUNT_TOTAL_FINISH_ITEM = String.format("SELECT COUNT(*) 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, " +
|
||||
"finish_item_id, account_id, bundle_id, reject_reason" +
|
||||
"finish_item_id, account_id, bundle_id" +
|
||||
") VALUES (" +
|
||||
":id, :item_id, :sku, :barcode, :job_card_id, :created_at, :created_by, " +
|
||||
":finish_item_id, :account_id, :bundle_id, :reject_reason" +
|
||||
":finish_item_id, :account_id, :bundle_id" +
|
||||
") 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), " +
|
||||
"finish_item_id = VALUES(finish_item_id), account_id = VALUES(account_id), bundle_id = VALUES(bundle_id), reject_reason = VALUES(reject_reason)",
|
||||
"finish_item_id = VALUES(finish_item_id), account_id = VALUES(account_id), bundle_id = VALUES(bundle_id)",
|
||||
TABLE_NAME
|
||||
);
|
||||
String SELECT_BY_JOB_CARD_GROUP_REJECT_REASON = String.format("SELECT reject_reason, COUNT(*) AS total FROM %s WHERE job_card_id IN (:job_card_id) GROUP BY reject_reason", TABLE_NAME);
|
||||
|
||||
private static final String SELECT_BY_DATE_AND_IDs = String.format("SELECT COUNT(*) FROM %s WHERE (:start_date IS NULL OR created_at >= :start_date) AND created_at <= :end_date AND id IN (:ids)", TABLE_NAME);
|
||||
private static final String SELECT_BY_DATE_AND_IDs = String.format(
|
||||
"SELECT COUNT(*) FROM %s WHERE (:start_date IS NULL OR created_at >= :start_date) AND created_at <= :end_date AND id IN (:ids)",
|
||||
TABLE_NAME
|
||||
);
|
||||
|
||||
public StoreItemDao(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
|
||||
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
|
||||
|
@ -58,8 +58,7 @@ public class StoreItemDao {
|
|||
.addValue("created_by", item.getCreatedBy())
|
||||
.addValue("finish_item_id", item.getFinishedItemId())
|
||||
.addValue("account_id", item.getAccountId())
|
||||
.addValue("bundle_id", item.getBundleId())
|
||||
.addValue("reject_reason", item.getRejectedReason());
|
||||
.addValue("bundle_id", item.getBundleId());
|
||||
}
|
||||
|
||||
public StoreItem find(long id) {
|
||||
|
@ -97,13 +96,6 @@ public class StoreItemDao {
|
|||
return namedParameterJdbcTemplate.query(SELECT_BY_JOB_CARD_ID, params, new StoreItemRowMapper());
|
||||
}
|
||||
|
||||
public Long calculateTotalRejectItemByJobCardId(long jobCardId) {
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
params.addValue("job_card_id", jobCardId);
|
||||
Long count = namedParameterJdbcTemplate.queryForObject(COUNT_TOTAL_FINISH_ITEM, params, Long.class);
|
||||
return count != null ? count : 0;
|
||||
}
|
||||
|
||||
public Long findByDateAndIds(String startDate, String endDate, List<Long> ids) {
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
params.addValue("start_date", startDate);
|
||||
|
@ -112,20 +104,4 @@ public class StoreItemDao {
|
|||
Long count = namedParameterJdbcTemplate.queryForObject(SELECT_BY_DATE_AND_IDs, params, Long.class);
|
||||
return count != null ? count : 0;
|
||||
}
|
||||
|
||||
public Map<String, Integer> totalCountByJobCardIdsAndGroupByRejectReason(List<Long> jobCardIds) {
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
params.addValue("job_card_id", jobCardIds);
|
||||
|
||||
List<Map<String, Object>> rows = namedParameterJdbcTemplate.queryForList(SELECT_BY_JOB_CARD_GROUP_REJECT_REASON, params);
|
||||
|
||||
Map<String, Integer> result = new HashMap<>();
|
||||
for (Map<String, Object> row : rows) {
|
||||
String reason = (String) row.get("reject_reason");
|
||||
Integer total = ((Number) row.get("total")).intValue();
|
||||
result.put(reason, total);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ public class StoreItemRowMapper implements RowMapper<StoreItem> {
|
|||
item.setFinishedItemId(rs.getLong("finish_item_id"));
|
||||
item.setAccountId(rs.getLong("account_id"));
|
||||
item.setBundleId(rs.getLong("bundle_id"));
|
||||
item.setRejectedReason(rs.getString("reject_reason"));
|
||||
return item;
|
||||
}
|
||||
}
|
|
@ -6,7 +6,6 @@ public class FinishedItemWrapper {
|
|||
|
||||
private String qaStatus;
|
||||
private Long accountId;
|
||||
private String rejectReason;
|
||||
|
||||
private List<FinishedItem> items;
|
||||
|
||||
|
@ -34,14 +33,6 @@ public class FinishedItemWrapper {
|
|||
this.accountId = accountId;
|
||||
}
|
||||
|
||||
public String getRejectReason() {
|
||||
return rejectReason;
|
||||
}
|
||||
|
||||
public void setRejectReason(String rejectReason) {
|
||||
this.rejectReason = rejectReason;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FinishedItemWrapper{" +
|
||||
|
|
|
@ -1,33 +1,20 @@
|
|||
package com.utopiaindustries.model.ctp;
|
||||
|
||||
public class POsDetails {
|
||||
//po detail
|
||||
private long poId;
|
||||
private String poNumber;
|
||||
private String articleTitle;
|
||||
private long poQuantity;
|
||||
private long poRequiredQuantity;
|
||||
|
||||
// items detail
|
||||
private long actualCutting;
|
||||
private long balanceToCutting;
|
||||
private long cuttingReceived;
|
||||
private long cuttingOki;
|
||||
private long cuttingReject;
|
||||
private long stitchingIn;
|
||||
private long stitchingWips;
|
||||
private long stitchingOut;
|
||||
private long finishIn;
|
||||
private long finishRej;
|
||||
private long finishQaApproved;
|
||||
private long storeReceived;
|
||||
private long storeWaiting;
|
||||
private long packagingIn;
|
||||
private long packagingOut;
|
||||
private long packagingStock;
|
||||
private long shippedScan;
|
||||
private long shippedNet;
|
||||
private boolean poStatus;
|
||||
private long totalCutting;
|
||||
private long remainingCutting;
|
||||
private long totalStitching;
|
||||
private long remainingStitching;
|
||||
private long totalEndLineQC;
|
||||
private long remainingEndLineQC;
|
||||
private long totalFinishing;
|
||||
private long remainingFinishing;
|
||||
private long totalAGradeItem;
|
||||
private long totalBGradeItem;
|
||||
private long totalCGradeItem;
|
||||
|
||||
public long getPoQuantity() {
|
||||
return poQuantity;
|
||||
|
@ -53,200 +40,108 @@ public class POsDetails {
|
|||
this.articleTitle = articleTitle;
|
||||
}
|
||||
|
||||
public long getPoId() {
|
||||
return poId;
|
||||
public long getTotalCutting() {
|
||||
return totalCutting;
|
||||
}
|
||||
|
||||
public void setPoId(long poId) {
|
||||
this.poId = poId;
|
||||
public void setTotalCutting(long totalCutting) {
|
||||
this.totalCutting = totalCutting;
|
||||
}
|
||||
|
||||
public long getPoRequiredQuantity() {
|
||||
return poRequiredQuantity;
|
||||
public long getRemainingCutting() {
|
||||
return remainingCutting;
|
||||
}
|
||||
|
||||
public void setPoRequiredQuantity(long poRequiredQuantity) {
|
||||
this.poRequiredQuantity = poRequiredQuantity;
|
||||
public void setRemainingCutting(long remainingCutting) {
|
||||
this.remainingCutting = remainingCutting;
|
||||
}
|
||||
|
||||
public long getActualCutting() {
|
||||
return actualCutting;
|
||||
public long getTotalStitching() {
|
||||
return totalStitching;
|
||||
}
|
||||
|
||||
public void setActualCutting(long actualCutting) {
|
||||
this.actualCutting = actualCutting;
|
||||
public void setTotalStitching(long totalStitching) {
|
||||
this.totalStitching = totalStitching;
|
||||
}
|
||||
|
||||
public long getBalanceToCutting() {
|
||||
return balanceToCutting;
|
||||
public long getRemainingStitching() {
|
||||
return remainingStitching;
|
||||
}
|
||||
|
||||
public void setBalanceToCutting(long balanceToCutting) {
|
||||
this.balanceToCutting = balanceToCutting;
|
||||
public void setRemainingStitching(long remainingStitching) {
|
||||
this.remainingStitching = remainingStitching;
|
||||
}
|
||||
|
||||
public long getCuttingReceived() {
|
||||
return cuttingReceived;
|
||||
public long getTotalEndLineQC() {
|
||||
return totalEndLineQC;
|
||||
}
|
||||
|
||||
public void setCuttingReceived(long cuttingReceived) {
|
||||
this.cuttingReceived = cuttingReceived;
|
||||
public void setTotalEndLineQC(long totalEndLineQC) {
|
||||
this.totalEndLineQC = totalEndLineQC;
|
||||
}
|
||||
|
||||
public long getCuttingOki() {
|
||||
return cuttingOki;
|
||||
public long getRemainingEndLineQC() {
|
||||
return remainingEndLineQC;
|
||||
}
|
||||
|
||||
public void setCuttingOki(long cuttingOki) {
|
||||
this.cuttingOki = cuttingOki;
|
||||
public void setRemainingEndLineQC(long remainingEndLineQC) {
|
||||
this.remainingEndLineQC = remainingEndLineQC;
|
||||
}
|
||||
|
||||
public long getCuttingReject() {
|
||||
return cuttingReject;
|
||||
public long getTotalFinishing() {
|
||||
return totalFinishing;
|
||||
}
|
||||
|
||||
public void setCuttingReject(long cuttingReject) {
|
||||
this.cuttingReject = cuttingReject;
|
||||
public void setTotalFinishing(long totalFinishing) {
|
||||
this.totalFinishing = totalFinishing;
|
||||
}
|
||||
|
||||
public long getStitchingIn() {
|
||||
return stitchingIn;
|
||||
public long getRemainingFinishing() {
|
||||
return remainingFinishing;
|
||||
}
|
||||
|
||||
public void setStitchingIn(long stitchingIn) {
|
||||
this.stitchingIn = stitchingIn;
|
||||
public void setRemainingFinishing(long remainingFinishing) {
|
||||
this.remainingFinishing = remainingFinishing;
|
||||
}
|
||||
|
||||
public long getStitchingWips() {
|
||||
return stitchingWips;
|
||||
public long getTotalAGradeItem() {
|
||||
return totalAGradeItem;
|
||||
}
|
||||
|
||||
public void setStitchingWips(long stitchingWips) {
|
||||
this.stitchingWips = stitchingWips;
|
||||
public void setTotalAGradeItem(long totalAGradeItem) {
|
||||
this.totalAGradeItem = totalAGradeItem;
|
||||
}
|
||||
|
||||
public long getStitchingOut() {
|
||||
return stitchingOut;
|
||||
public long getTotalBGradeItem() {
|
||||
return totalBGradeItem;
|
||||
}
|
||||
|
||||
public void setStitchingOut(long stitchingOut) {
|
||||
this.stitchingOut = stitchingOut;
|
||||
public void setTotalBGradeItem(long totalBGradeItem) {
|
||||
this.totalBGradeItem = totalBGradeItem;
|
||||
}
|
||||
|
||||
public long getFinishIn() {
|
||||
return finishIn;
|
||||
public long getTotalCGradeItem() {
|
||||
return totalCGradeItem;
|
||||
}
|
||||
|
||||
public void setFinishIn(long finishIn) {
|
||||
this.finishIn = finishIn;
|
||||
}
|
||||
|
||||
public long getFinishRej() {
|
||||
return finishRej;
|
||||
}
|
||||
|
||||
public void setFinishRej(long finishRej) {
|
||||
this.finishRej = finishRej;
|
||||
}
|
||||
|
||||
public long getFinishQaApproved() {
|
||||
return finishQaApproved;
|
||||
}
|
||||
|
||||
public void setFinishQaApproved(long finishQaApproved) {
|
||||
this.finishQaApproved = finishQaApproved;
|
||||
}
|
||||
|
||||
public long getStoreReceived() {
|
||||
return storeReceived;
|
||||
}
|
||||
|
||||
public void setStoreReceived(long storeReceived) {
|
||||
this.storeReceived = storeReceived;
|
||||
}
|
||||
|
||||
public long getStoreWaiting() {
|
||||
return storeWaiting;
|
||||
}
|
||||
|
||||
public void setStoreWaiting(long storeWaiting) {
|
||||
this.storeWaiting = storeWaiting;
|
||||
}
|
||||
|
||||
public long getPackagingIn() {
|
||||
return packagingIn;
|
||||
}
|
||||
|
||||
public void setPackagingIn(long packagingIn) {
|
||||
this.packagingIn = packagingIn;
|
||||
}
|
||||
|
||||
public long getPackagingOut() {
|
||||
return packagingOut;
|
||||
}
|
||||
|
||||
public void setPackagingOut(long packagingOut) {
|
||||
this.packagingOut = packagingOut;
|
||||
}
|
||||
|
||||
public long getPackagingStock() {
|
||||
return packagingStock;
|
||||
}
|
||||
|
||||
public void setPackagingStock(long packagingStock) {
|
||||
this.packagingStock = packagingStock;
|
||||
}
|
||||
|
||||
public long getShippedScan() {
|
||||
return shippedScan;
|
||||
}
|
||||
|
||||
public void setShippedScan(long shippedScan) {
|
||||
this.shippedScan = shippedScan;
|
||||
}
|
||||
|
||||
public long getShippedNet() {
|
||||
return shippedNet;
|
||||
}
|
||||
|
||||
public void setShippedNet(long shippedNet) {
|
||||
this.shippedNet = shippedNet;
|
||||
}
|
||||
|
||||
public boolean isPoStatus() {
|
||||
return poStatus;
|
||||
}
|
||||
|
||||
public void setPoStatus(boolean poStatus) {
|
||||
this.poStatus = poStatus;
|
||||
public void setTotalCGradeItem(long totalCGradeItem) {
|
||||
this.totalCGradeItem = totalCGradeItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "POsDetails{" +
|
||||
"poId=" + poId +
|
||||
", poNumber='" + poNumber + '\'' +
|
||||
", articleTitle='" + articleTitle + '\'' +
|
||||
", poQuantity=" + poQuantity +
|
||||
", poRequiredQuantity=" + poRequiredQuantity +
|
||||
", actualCutting=" + actualCutting +
|
||||
", balanceToCutting=" + balanceToCutting +
|
||||
", cuttingReceived=" + cuttingReceived +
|
||||
", cuttingOki=" + cuttingOki +
|
||||
", cuttingReject=" + cuttingReject +
|
||||
", stitchingIn=" + stitchingIn +
|
||||
", stitchingWips=" + stitchingWips +
|
||||
", stitchingOut=" + stitchingOut +
|
||||
", finishIn=" + finishIn +
|
||||
", finishRej=" + finishRej +
|
||||
", finishQaApproved=" + finishQaApproved +
|
||||
", storeReceived=" + storeReceived +
|
||||
", storeWaiting=" + storeWaiting +
|
||||
", packagingIn=" + packagingIn +
|
||||
", packagingOut=" + packagingOut +
|
||||
", packagingStock=" + packagingStock +
|
||||
", shippedScan=" + shippedScan +
|
||||
", shippedNet=" + shippedNet +
|
||||
"totalCutting=" + totalCutting +
|
||||
", remainingCutting=" + remainingCutting +
|
||||
", totalStitching=" + totalStitching +
|
||||
", remainingStitching=" + remainingStitching +
|
||||
", totalEndLineQC=" + totalEndLineQC +
|
||||
", remainingEndLineQC=" + remainingEndLineQC +
|
||||
", totalFinishing=" + totalFinishing +
|
||||
", remainingFinishing=" + remainingFinishing +
|
||||
", totalAGradeItem=" + totalAGradeItem +
|
||||
", totalBGradeItem=" + totalBGradeItem +
|
||||
", totalCGradeItem=" + totalCGradeItem +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ public class StoreItem implements InventoryArtifact {
|
|||
private long finishedItemId;
|
||||
private long bundleId;
|
||||
private long accountId;
|
||||
private String rejectedReason;
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -123,29 +122,4 @@ public class StoreItem implements InventoryArtifact {
|
|||
public void setAccountId(long accountId) {
|
||||
this.accountId = accountId;
|
||||
}
|
||||
|
||||
public String getRejectedReason() {
|
||||
return rejectedReason;
|
||||
}
|
||||
|
||||
public void setRejectedReason(String rejectedReason) {
|
||||
this.rejectedReason = rejectedReason;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StoreItem{" +
|
||||
"id=" + id +
|
||||
", itemId=" + itemId +
|
||||
", sku='" + sku + '\'' +
|
||||
", barcode='" + barcode + '\'' +
|
||||
", jobCardId=" + jobCardId +
|
||||
", createdAt=" + createdAt +
|
||||
", createdBy='" + createdBy + '\'' +
|
||||
", finishedItemId=" + finishedItemId +
|
||||
", bundleId=" + bundleId +
|
||||
", accountId=" + accountId +
|
||||
", rejectedReason='" + rejectedReason + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,6 @@ public class DashboardService {
|
|||
progress.put("ALTER", (float) alterationPieceFinish);
|
||||
progress.put("Reject", (float) rejectFinishedItem);
|
||||
progress.put("wash", (float) washFinishedItem);
|
||||
progress.put("finishingValueForBarChart", (float) approved + alterationPieceFinish + rejectFinishedItem + washFinishedItem + packagingItems);
|
||||
|
||||
progress.put("packaging", (float) packagingItems);
|
||||
progress.put("totalPackaging", (float) packagingItemIDs.size());
|
||||
|
|
|
@ -741,7 +741,7 @@ public class InventoryService {
|
|||
|
||||
if (finishedItem.getQaStatus().equalsIgnoreCase("REJECT")) {
|
||||
// create OUT and IN transactions for FI
|
||||
StoreItem storeItem = (createStoreItems(finishedItem, wrapper.getRejectReason()));
|
||||
StoreItem storeItem = (createStoreItems(finishedItem));
|
||||
storeItem.setId(storeItemDao.save(storeItem));
|
||||
if (lastInvTransaction != null) {
|
||||
// OUT
|
||||
|
@ -751,7 +751,7 @@ public class InventoryService {
|
|||
// IN
|
||||
createInventoryTransactionLeg(transaction, storeItem, toAccount, InventoryTransactionLeg.Type.IN.name(), InventoryArtifactType.STORED_ITEM.name());
|
||||
}
|
||||
finishedItem.setIsSegregated(true);
|
||||
finishedItem.setIsSegregated(false);
|
||||
finishedItem.setStore(true);
|
||||
storeItems.add(storeItem);
|
||||
}
|
||||
|
@ -788,7 +788,7 @@ public class InventoryService {
|
|||
return packagingItems;
|
||||
}
|
||||
|
||||
private StoreItem createStoreItems(FinishedItem finishedItem, String reason) {
|
||||
private StoreItem createStoreItems(FinishedItem finishedItem) {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
StoreItem storeItem = new StoreItem();
|
||||
storeItem.setItemId(finishedItem.getItemId());
|
||||
|
@ -799,7 +799,6 @@ public class InventoryService {
|
|||
storeItem.setBarcode(finishedItem.getBarcode());
|
||||
storeItem.setCreatedAt(LocalDateTime.now());
|
||||
storeItem.setCreatedBy(authentication.getName());
|
||||
storeItem.setRejectedReason(reason);
|
||||
return storeItem;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,6 @@ public class PackagingService {
|
|||
|
||||
public void createPackagingItem(FinishedItemWrapper wrapper){
|
||||
inventoryService.createPackagingItemAndTransaction(wrapper, wrapper.getAccountId());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package com.utopiaindustries.service;
|
||||
|
||||
import com.utopiaindustries.dao.ctp.JobCardDAO;
|
||||
import com.utopiaindustries.dao.ctp.PurchaseOrderCTPDao;
|
||||
import com.utopiaindustries.dao.ctp.StoreItemDao;
|
||||
import com.utopiaindustries.model.ctp.*;
|
||||
import com.utopiaindustries.model.uind.PurchaseOrder;
|
||||
import com.utopiaindustries.querybuilder.ctp.JobCardQueryBuilder;
|
||||
|
@ -16,22 +14,15 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class PurchaseOrderCTPService {
|
||||
|
||||
private final PurchaseOrderCTPDao purchaseOrderCTPDao;
|
||||
private final JobCardDAO jobCardDAO;
|
||||
private final StoreItemDao storeItemDao;
|
||||
|
||||
public PurchaseOrderCTPService(PurchaseOrderCTPDao purchaseOrderCTPDao, JobCardDAO jobCardDAO, StoreItemDao storeItemDao) {
|
||||
public PurchaseOrderCTPService(PurchaseOrderCTPDao purchaseOrderCTPDao) {
|
||||
this.purchaseOrderCTPDao = purchaseOrderCTPDao;
|
||||
this.jobCardDAO = jobCardDAO;
|
||||
this.storeItemDao = storeItemDao;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -86,17 +77,4 @@ public class PurchaseOrderCTPService {
|
|||
return purchaseOrderCTPDao.findByTerm( term );
|
||||
}
|
||||
|
||||
public Map<String,Integer> getStoreItemsByPoId(Long poId){
|
||||
Map<String,Integer> totalItems = new HashMap<>();
|
||||
List<JobCard> jobCards = jobCardDAO.findByPoId(poId);
|
||||
List<Long> jobCardIds = jobCards.stream()
|
||||
.map(JobCard::getId)
|
||||
.collect(Collectors.toList());
|
||||
if(!jobCardIds.isEmpty()){
|
||||
return storeItemDao.totalCountByJobCardIdsAndGroupByRejectReason(jobCardIds);
|
||||
}else {
|
||||
return totalItems;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,58 +1,21 @@
|
|||
package com.utopiaindustries.service;
|
||||
|
||||
import com.utopiaindustries.dao.ctp.StoreItemDao;
|
||||
import com.utopiaindustries.dao.uind.PurchaseOrderDAO;
|
||||
import com.utopiaindustries.model.ctp.JobCardItem;
|
||||
import com.utopiaindustries.model.ctp.POsDetails;
|
||||
import com.utopiaindustries.model.uind.PurchaseOrder;
|
||||
import com.utopiaindustries.util.HTMLBuilder;
|
||||
import com.utopiaindustries.util.PDFResponseEntityInputStreamResource;
|
||||
import com.utopiaindustries.util.URLUtils;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.ui.Model;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class PurchaseOrderService {
|
||||
|
||||
private final PurchaseOrderDAO purchaseOrderDAO;
|
||||
private final PurchaseOrderCTPService purchaseOrderCTPService;
|
||||
private final HTMLBuilder htmlBuilder;
|
||||
private PDFResponseEntityInputStreamResource pdfGenerator;
|
||||
|
||||
public PurchaseOrderService(PurchaseOrderDAO purchaseOrderDAO, PurchaseOrderCTPService purchaseOrderCTPService, HTMLBuilder htmlBuilder, PDFResponseEntityInputStreamResource pdfGenerator) {
|
||||
public PurchaseOrderService(PurchaseOrderDAO purchaseOrderDAO) {
|
||||
this.purchaseOrderDAO = purchaseOrderDAO;
|
||||
this.purchaseOrderCTPService = purchaseOrderCTPService;
|
||||
this.htmlBuilder = htmlBuilder;
|
||||
this.pdfGenerator = pdfGenerator;
|
||||
}
|
||||
|
||||
public List<PurchaseOrder> findByTerm( String term ){
|
||||
return purchaseOrderDAO.findByTerm( term );
|
||||
}
|
||||
|
||||
/**
|
||||
* Print Job card *
|
||||
* **/
|
||||
public ResponseEntity<InputStreamResource> generatePOPdf(POsDetails pOsDetails, Model model, boolean jobCardDetail, boolean storeDetail ) throws Exception {
|
||||
Map<String,Integer> storeItems = purchaseOrderCTPService.getStoreItemsByPoId(pOsDetails.getPoId());
|
||||
model.addAttribute("poDetail", pOsDetails);
|
||||
model.addAttribute( "baseUrl", URLUtils.getCurrentBaseUrl() );
|
||||
|
||||
if (storeDetail && !storeItems.isEmpty()){
|
||||
model.addAttribute("showStore", true);
|
||||
model.addAttribute("store", storeItems);
|
||||
}else {
|
||||
model.addAttribute("showStore", false);
|
||||
}
|
||||
String htmlStr = htmlBuilder.buildHTML( "po-status-pdf", model );
|
||||
// return pdf
|
||||
return pdfGenerator.generatePdf( htmlStr, "Po-status", "inline" );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,26 +22,30 @@ import java.util.stream.Collectors;
|
|||
public class ReportingService {
|
||||
|
||||
private final JobCardItemDAO jobCardItemDAO;
|
||||
private final ProcessDAO processDAO;
|
||||
private final BundleDAO bundleDAO;
|
||||
private final InventoryTransactionLegDAO inventoryTransactionLegDAO;
|
||||
private final InventoryTransactionDAO inventoryTransactionDAO;
|
||||
private final JobCardDAO jobCardDAO;
|
||||
private final CryptographyService cryptographyService;
|
||||
private final MasterBundleDAO masterBundleDAO;
|
||||
private final FinishedItemDAO finishedItemDAO;
|
||||
private final StitchingOfflineItemDAO stitchingOfflineItemDAO;
|
||||
private final InventoryAccountDAO inventoryAccountDAO;
|
||||
private final PurchaseOrderCTPDao purchaseOrderCTPDao;
|
||||
private final StoreItemDao storeItemDao;
|
||||
private final PackagingItemsDAO packagingItemsDAO;
|
||||
|
||||
public ReportingService(JobCardItemDAO jobCardItemDAO, BundleDAO bundleDAO, InventoryTransactionLegDAO inventoryTransactionLegDAO, JobCardDAO jobCardDAO, FinishedItemDAO finishedItemDAO, StitchingOfflineItemDAO stitchingOfflineItemDAO, InventoryAccountDAO inventoryAccountDAO, PurchaseOrderCTPDao purchaseOrderCTPDao, StoreItemDao storeItemDao, PackagingItemsDAO packagingItemsDAO) {
|
||||
public ReportingService(JobCardItemDAO jobCardItemDAO, ProcessDAO processDAO, BundleDAO bundleDAO, InventoryTransactionLegDAO inventoryTransactionLegDAO, InventoryTransactionDAO inventoryTransactionDAO, JobCardDAO jobCardDAO, CryptographyService cryptographyService, MasterBundleDAO masterBundleDAO, FinishedItemDAO finishedItemDAO, StitchingOfflineItemDAO stitchingOfflineItemDAO, InventoryAccountDAO inventoryAccountDAO, PackagingItemsDAO packagingItemsDAO) {
|
||||
this.jobCardItemDAO = jobCardItemDAO;
|
||||
this.processDAO = processDAO;
|
||||
this.bundleDAO = bundleDAO;
|
||||
this.inventoryTransactionLegDAO = inventoryTransactionLegDAO;
|
||||
this.inventoryTransactionDAO = inventoryTransactionDAO;
|
||||
this.jobCardDAO = jobCardDAO;
|
||||
this.cryptographyService = cryptographyService;
|
||||
this.masterBundleDAO = masterBundleDAO;
|
||||
this.finishedItemDAO = finishedItemDAO;
|
||||
this.stitchingOfflineItemDAO = stitchingOfflineItemDAO;
|
||||
this.inventoryAccountDAO = inventoryAccountDAO;
|
||||
this.purchaseOrderCTPDao = purchaseOrderCTPDao;
|
||||
this.storeItemDao = storeItemDao;
|
||||
this.packagingItemsDAO = packagingItemsDAO;
|
||||
}
|
||||
|
||||
|
@ -212,7 +216,7 @@ public class ReportingService {
|
|||
List<FinishedItem> finishedItems = finishedItemDAO.findByJobCardId(Long.parseLong(jobCardID));
|
||||
|
||||
List<FinishedItem> bGradeFinishItemsIds= finishedItems.stream()
|
||||
.filter(item -> "REJECT".equals(item.getQaStatus())).collect(Collectors.toList());
|
||||
.filter(item -> "B GRADE".equals(item.getQaStatus())).collect(Collectors.toList());
|
||||
|
||||
List<FinishedItem> cGradeFinishItemsIds= finishedItems.stream()
|
||||
.filter(item -> "C GRADE".equals(item.getQaStatus())).collect(Collectors.toList());
|
||||
|
@ -277,6 +281,9 @@ public class ReportingService {
|
|||
.map(item -> Optional.ofNullable(item.getActualProduction()).orElse(BigDecimal.ZERO))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
BigDecimal expectedProduction = jobCardItems.stream()
|
||||
.map(item -> Optional.ofNullable(item.getExpectedProduction()).orElse(BigDecimal.ZERO))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
if(actualProduction.compareTo(totalProduction) == 0) {
|
||||
phasePending.put("Stitching Total Time", null);
|
||||
}else {
|
||||
|
@ -437,36 +444,38 @@ public class ReportingService {
|
|||
return barChartData;
|
||||
}
|
||||
|
||||
public List<POsDetails> getAllPOs(String poCode) {
|
||||
|
||||
public List<POsDetails> getAllPOs(String poName) {
|
||||
List<POsDetails> pOsDetailsList = new ArrayList<>();
|
||||
List<PurchaseOrderCTP> purchaseOrderCTPList;
|
||||
|
||||
if (poCode != null && !poCode.isEmpty()) {
|
||||
purchaseOrderCTPList = purchaseOrderCTPDao.findByPoCode(poCode);
|
||||
List<JobCard> jobCards = jobCardDAO.findAll() ;
|
||||
HashMap<String, List<JobCard>> filterJobCardsByPos;
|
||||
if(poName != null && !poName.isEmpty()) {
|
||||
filterJobCardsByPos = jobCards.stream()
|
||||
.filter(jobCard -> jobCard.getPurchaseOrderId().equals(poName))
|
||||
.collect(Collectors.groupingBy(
|
||||
JobCard::getPurchaseOrderId,
|
||||
HashMap::new,
|
||||
Collectors.toList()
|
||||
));
|
||||
}else {
|
||||
purchaseOrderCTPList = purchaseOrderCTPDao.findAll();
|
||||
filterJobCardsByPos = jobCards.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
JobCard::getPurchaseOrderId,
|
||||
HashMap::new,
|
||||
Collectors.toList()
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
for (PurchaseOrderCTP pos : purchaseOrderCTPList) {
|
||||
List<JobCard> jobCards = jobCardDAO.findByPoId(pos.getId());
|
||||
Map<String,Integer> jobCardCompleteItems = new HashMap<>();
|
||||
for (String pos : filterJobCardsByPos.keySet()) {
|
||||
BigDecimal totalProduction = BigDecimal.ZERO;
|
||||
BigDecimal expectedProduction = BigDecimal.ZERO;
|
||||
BigDecimal actualProduction = BigDecimal.ZERO;
|
||||
long stitchingIn = 0L;
|
||||
long stitchingOut = 0L;
|
||||
long finishApprovedItem = 0L;
|
||||
long finishRejectItem = 0L;
|
||||
long storeItems = 0L;
|
||||
long packagingItems = 0L;
|
||||
int poQuantity = 0;
|
||||
String articleName = "";
|
||||
Long qaProgressItems = 0L;
|
||||
Long totalFinishItem = 0L;
|
||||
POsDetails pOsDetails = new POsDetails();
|
||||
for (JobCard jobCard : jobCards) {
|
||||
for (JobCard jobCard : filterJobCardsByPos.get(pos)) {
|
||||
List<JobCardItem> jobCardItems = jobCardItemDAO.findByCardId(jobCard.getId());
|
||||
expectedProduction = expectedProduction.add(jobCardItems.stream()
|
||||
.map(item -> Optional.ofNullable(item.getExpectedProduction()).orElse(BigDecimal.ZERO))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
|
||||
totalProduction = totalProduction.add(jobCardItems.stream()
|
||||
.map(item -> Optional.ofNullable(item.getTotalProduction()).orElse(BigDecimal.ZERO))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
|
@ -474,67 +483,56 @@ public class ReportingService {
|
|||
actualProduction = actualProduction.add(jobCardItems.stream()
|
||||
.map(item -> Optional.ofNullable(item.getActualProduction()).orElse(BigDecimal.ZERO))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
poQuantity = jobCard.getPoQuantity();
|
||||
articleName = jobCard.getArticleName();
|
||||
qaProgressItems += Optional.ofNullable(stitchingOfflineItemDAO.CalculateTotalQA(jobCard.getId())).orElse(0L);
|
||||
totalFinishItem += Optional.ofNullable(finishedItemDAO.calculateTotalFinishItem(jobCard.getId())).orElse(0L);
|
||||
|
||||
//stitching detail
|
||||
stitchingIn += Optional.of(stitchingOfflineItemDAO.findByJobCardId(jobCard.getId()).size()).orElse(0);
|
||||
stitchingOut += Optional.ofNullable(stitchingOfflineItemDAO.CalculateTotalQA(jobCard.getId())).orElse(0L);
|
||||
|
||||
//finishItems detail
|
||||
List<FinishedItem> finishedItems = finishedItemDAO.findByJobCardId(jobCard.getId());
|
||||
finishApprovedItem += finishedItems.stream().filter(e -> e.getQaStatus().equals("APPROVED")).count();
|
||||
finishRejectItem += finishedItems.stream().filter(e -> e.getQaStatus().equals("REJECT")).count();
|
||||
|
||||
//reject store details
|
||||
storeItems += Optional.ofNullable(storeItemDao.calculateTotalRejectItemByJobCardId(jobCard.getId())).orElse(0L);
|
||||
|
||||
//reject packaging details
|
||||
packagingItems += Optional.of(packagingItemsDAO.findByJobCardId(jobCard.getId()).size()).orElse(0);
|
||||
|
||||
jobCardCompleteItems = getSegregateItems(String.valueOf(jobCard.getId()));
|
||||
if (jobCardCompleteItems == null) {
|
||||
jobCardCompleteItems = new HashMap<>();
|
||||
}
|
||||
pOsDetails.setPoId(pos.getId());
|
||||
pOsDetails.setPoNumber(pos.getPurchaseOrderCode());
|
||||
pOsDetails.setArticleTitle(pos.getArticleName());
|
||||
pOsDetails.setPoQuantity(pos.getPurchaseOrderQuantity());
|
||||
pOsDetails.setPoRequiredQuantity(pos.getPurchaseOrderQuantityRequired());
|
||||
pOsDetails.setActualCutting(expectedProduction.longValue());
|
||||
pOsDetails.setBalanceToCutting(pos.getPurchaseOrderQuantityRequired() - actualProduction.longValue());
|
||||
pOsDetails.setCuttingReceived(expectedProduction.longValue());
|
||||
pOsDetails.setCuttingOki(actualProduction.intValue());
|
||||
pOsDetails.setCuttingReject(expectedProduction.subtract(actualProduction).intValue());
|
||||
pOsDetails.setStitchingIn(stitchingIn);
|
||||
pOsDetails.setStitchingOut(stitchingOut);
|
||||
pOsDetails.setStitchingWips(stitchingIn - stitchingOut);
|
||||
pOsDetails.setFinishIn(stitchingOut);
|
||||
pOsDetails.setFinishRej(finishRejectItem);
|
||||
pOsDetails.setFinishQaApproved(finishApprovedItem);
|
||||
pOsDetails.setStoreReceived(storeItems);
|
||||
pOsDetails.setStoreWaiting(finishRejectItem - storeItems);
|
||||
pOsDetails.setFinishQaApproved(finishApprovedItem);
|
||||
pOsDetails.setPackagingIn(packagingItems);
|
||||
pOsDetails.setPackagingOut(packagingItems);
|
||||
pOsDetails.setPackagingStock(0);
|
||||
pOsDetails.setShippedScan(packagingItems);
|
||||
pOsDetails.setShippedNet(packagingItems);
|
||||
pOsDetails.setPackagingStock(0);
|
||||
pOsDetails.setPoStatus(false);
|
||||
}
|
||||
|
||||
pOsDetails.setPoNumber(pos);
|
||||
pOsDetails.setArticleTitle(articleName);
|
||||
pOsDetails.setPoQuantity(poQuantity);
|
||||
pOsDetails.setTotalCutting(actualProduction.intValue());
|
||||
pOsDetails.setTotalStitching(totalProduction.intValue());
|
||||
pOsDetails.setTotalEndLineQC(qaProgressItems.intValue());
|
||||
pOsDetails.setTotalFinishing(totalFinishItem);
|
||||
|
||||
pOsDetails.setRemainingCutting(poQuantity - actualProduction.intValue());
|
||||
pOsDetails.setRemainingStitching(poQuantity - totalProduction.intValue());
|
||||
pOsDetails.setRemainingEndLineQC(poQuantity - qaProgressItems);
|
||||
pOsDetails.setRemainingFinishing(poQuantity - totalFinishItem);
|
||||
|
||||
pOsDetails.setTotalAGradeItem(jobCardCompleteItems.getOrDefault("A GRADE", 0));
|
||||
pOsDetails.setTotalBGradeItem(jobCardCompleteItems.getOrDefault("B GRADE", 0));
|
||||
pOsDetails.setTotalCGradeItem(jobCardCompleteItems.getOrDefault("C GRADE", 0));
|
||||
|
||||
pOsDetailsList.add(pOsDetails);
|
||||
}
|
||||
return pOsDetailsList;
|
||||
}
|
||||
|
||||
public HashMap<String, Map<String, Integer>> getAllPoJobCards(long poId, String selectDate) {
|
||||
public HashMap<String, Map<String, Integer>> getAllPoJobCards(String PONumber, String selectDate) {
|
||||
String startDate = selectDate != null && !selectDate.isEmpty() ? selectDate + " 00:00:01": null;
|
||||
String endDate = selectDate != null && !selectDate.isEmpty() ? selectDate + " 23:59:59": null;
|
||||
|
||||
HashMap<String, Map<String, Integer>> poJobCardItemsProgress = new HashMap<>();
|
||||
List<JobCard> jobCards = jobCardDAO.findAll();
|
||||
// Filter JobCards by Purchase Order ID
|
||||
List<JobCard> filterJobCardsByPos = jobCardDAO.findByPoId(poId);
|
||||
List<JobCard> filterJobCardsByPos = jobCards.stream()
|
||||
.filter(e -> e.getPurchaseOrderId().equals(PONumber))
|
||||
.collect(Collectors.toList());
|
||||
List<InventoryAccount> inventoryAccounts = inventoryAccountDAO.getPackagingAccounts();
|
||||
List<Integer> gradingAccounts = inventoryAccounts.stream().map(e-> (int)(e.getId())).collect(Collectors.toList());
|
||||
for (JobCard jobCard : filterJobCardsByPos) {
|
||||
List<Bundle> bundles = bundleDAO.findByCardIdAndDATE(jobCard.getId(),startDate,endDate);
|
||||
List<StitchingOfflineItem> stitchingOfflineItems = stitchingOfflineItemDAO.findByJobCardIdAndDate(jobCard.getId(),startDate,endDate);
|
||||
List<FinishedItem> finishedItems = finishedItemDAO.calculateTotalFinishItem(jobCard.getId(),startDate,endDate);
|
||||
List<InventoryTransactionLeg> inventoryTransactionLegs = inventoryTransactionLegDAO.getTransactionByJobCardAndDatesAndTypeAndAccountID(jobCard.getId(),startDate,endDate,"IN", gradingAccounts);
|
||||
|
||||
//cutting days wise
|
||||
BigDecimal cutting = bundles.stream()
|
||||
|
@ -546,21 +544,26 @@ public class ReportingService {
|
|||
|
||||
//total qa
|
||||
Integer qa = finishedItems.size();
|
||||
Map<String, Integer> segregateItems = finishedItems.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
FinishedItem::getQaStatus,
|
||||
Collectors.collectingAndThen(
|
||||
Collectors.counting(),
|
||||
Long::intValue
|
||||
)
|
||||
Map<String, Integer> segregateItems = inventoryTransactionLegs.stream()
|
||||
.filter(leg -> inventoryAccounts.stream()
|
||||
.anyMatch(account -> (int) account.getId() == (leg.getAccountId())))
|
||||
.collect(Collectors.toMap(
|
||||
leg -> inventoryAccounts.stream()
|
||||
.filter(account -> (int) account.getId() == (leg.getAccountId()))
|
||||
.findFirst()
|
||||
.map(InventoryAccount::getTitle)
|
||||
.orElse("Unknown"),
|
||||
leg -> leg.getQuantity().intValue(),
|
||||
Integer::sum,
|
||||
HashMap::new
|
||||
));
|
||||
|
||||
Map<String, Integer> items = getCompleteProduction(String.valueOf(jobCard.getId()));
|
||||
items.put("Cutting Progress",cutting.intValue());
|
||||
items.put("Stitching Progress",stitching);
|
||||
items.put("QA Progress",qa);
|
||||
items.put("A Grade",segregateItems.get("APPROVED") != null ? segregateItems.get("APPROVED") : 0);
|
||||
items.put("B Grade / Reject",segregateItems.get("REJECT") != null ? segregateItems.get("REJECT") : 0);
|
||||
items.put("A Grade",segregateItems.get("A GRADE") != null ? segregateItems.get("A GRADE") : 0);
|
||||
items.put("B Grade",segregateItems.get("B GRADE") != null ? segregateItems.get("B GRADE") : 0);
|
||||
items.put("C Grade",segregateItems.get("C GRADE") != null ? segregateItems.get("C GRADE") : 0);
|
||||
|
||||
// Define sorting order
|
||||
Map<String, Integer> indexMap = new HashMap<>();
|
||||
|
@ -569,8 +572,9 @@ public class ReportingService {
|
|||
indexMap.put("Stitching Progress", 3);
|
||||
indexMap.put("QA Progress", 4);
|
||||
indexMap.put("Finishing Progress", 5);
|
||||
indexMap.put("APPROVED", 6);
|
||||
indexMap.put("REJECT", 7);
|
||||
indexMap.put("A GRADE", 6);
|
||||
indexMap.put("B GRADE", 7);
|
||||
indexMap.put("C GRADE", 8);
|
||||
|
||||
// Sort items based on indexMap order
|
||||
Map<String, Integer> sortedItems = items.entrySet()
|
||||
|
|
|
@ -221,7 +221,7 @@
|
|||
items: [],
|
||||
purchaseOrderID:0,
|
||||
articleName: '',
|
||||
purchaseOrderQuantityRequired: 0,
|
||||
purchaseOrderQuantity: 0,
|
||||
purchaseOrderCode: '',
|
||||
},
|
||||
methods: {
|
||||
|
@ -266,7 +266,7 @@
|
|||
}, onPoSelect(id,purchaseOrder) {
|
||||
this.purchaseOrderID = id,
|
||||
this.articleName = purchaseOrder.articleName,
|
||||
this.purchaseOrderQuantityRequired = purchaseOrder.purchaseOrderQuantityRequired,
|
||||
this.purchaseOrderQuantity = purchaseOrder.purchaseOrderQuantity,
|
||||
this.purchaseOrderCode = purchaseOrder.purchaseOrderCode
|
||||
}
|
||||
},
|
||||
|
@ -274,7 +274,7 @@
|
|||
this.jobCard = window.ctp.jobCard;
|
||||
this.purchaseOrderID = this.jobCard.purchaseOrderId,
|
||||
this.articleName = this.jobCard.articleName,
|
||||
this.purchaseOrderQuantityRequired = this.jobCard.poQuantity,
|
||||
this.purchaseOrderQuantity = this.jobCard.poQuantity,
|
||||
this.purchaseOrderCode = this.jobCard.purchaseOrderTitle
|
||||
this.items = this.jobCard.items;
|
||||
|
||||
|
|
|
@ -76,8 +76,7 @@
|
|||
let app = new Vue({
|
||||
el : '#packagingApp',
|
||||
data : {
|
||||
items : [],
|
||||
reason: '',
|
||||
items : []
|
||||
},
|
||||
methods : {
|
||||
onItemSelect: function (id, item) {
|
||||
|
@ -91,18 +90,6 @@
|
|||
const uniqueIds = new Set(ids);
|
||||
return ids.length !== uniqueIds.size;
|
||||
},
|
||||
submitWithRejectReason: function (reason) {
|
||||
this.reason = reason;
|
||||
this.$nextTick(() => {
|
||||
const form = document.getElementById('packagingApp');
|
||||
if (form.checkValidity()) {
|
||||
form.submit();
|
||||
} else {
|
||||
form.reportValidity();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
mounted : function () {
|
||||
console.log( this.$accounts )
|
||||
|
|
|
@ -88,12 +88,7 @@
|
|||
submitWithQaStatus: function (status) {
|
||||
this.QaStatus = status;
|
||||
this.$nextTick(() => {
|
||||
const form = document.getElementById('qcForm');
|
||||
if (form.checkValidity()) {
|
||||
form.submit();
|
||||
} else {
|
||||
form.reportValidity();
|
||||
}
|
||||
document.getElementById('qcForm').submit();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
@ -78,10 +78,6 @@
|
|||
<a th:href="@{/store/}" class="nav-link"
|
||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/store') ? 'active' : ''}">Store</a>
|
||||
</li>
|
||||
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_PURCHASE_ORDER', 'ROLE_ADMIN')">
|
||||
<a th:href="@{/po-status/}" class="nav-link"
|
||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/po-status') ? 'active' : ''}">Online PO Status</a>
|
||||
</li>
|
||||
<li class="nav-item" sec:authorize="hasAnyRole('ROLE_REPORTING', 'ROLE_ADMIN')">
|
||||
<a th:href="@{/reporting/}" class="nav-link"
|
||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/reporting') ? 'active' : ''}">Reporting</a>
|
||||
|
@ -187,6 +183,10 @@
|
|||
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
||||
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/reporting')}">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item"
|
||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/reporting/po-report') ? 'active' : ''}">
|
||||
<a th:href="@{/reporting/po-report}" class="nav-link">PO Report</a>
|
||||
</li>
|
||||
<li class="nav-item"
|
||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/reporting/job-card-report') ? 'active' : ''}">
|
||||
<a th:href="@{/reporting/job-card-report}" class="nav-link">Job Card Report</a>
|
||||
|
@ -205,17 +205,6 @@
|
|||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<!--Second level of po-status-->
|
||||
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
||||
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/po-status')}">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item"
|
||||
th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/po-status/all-pos') ? 'active' : ''}">
|
||||
<a th:href="@{/po-status/all-pos}" class="nav-link">All PO's</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<!-- second level stitching -->
|
||||
<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between"
|
||||
th:if="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/stitching')}">
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
<!-- Hidden Inputs for Dynamic Values -->
|
||||
<input type="hidden" name="articleName" :value="articleName">
|
||||
<input type="hidden" name="poQuantity" :value="purchaseOrderQuantityRequired">
|
||||
<input type="hidden" name="poQuantity" :value="purchaseOrderQuantity">
|
||||
<input type="hidden" name="purchaseOrderTitle" :value="purchaseOrderCode">
|
||||
<input type="hidden" name="purchaseOrderId" :value="purchaseOrderID">
|
||||
|
||||
|
@ -57,7 +57,7 @@
|
|||
<div class="col-sm-3 form-group">
|
||||
<label>PO Quantity</label>
|
||||
<!-- Dynamically show PO quantity -->
|
||||
<span class="form-control">{{ purchaseOrderQuantityRequired || jobCard.poQuantity }}</span>
|
||||
<span class="form-control">{{ purchaseOrderQuantity || jobCard.poQuantity }}</span>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3 form-group" th:with="title=*{locationTitle},id=*{locationSiteId}">
|
||||
|
|
|
@ -157,7 +157,7 @@
|
|||
th:data-title="${detail.get('articleName')} + ' (' + ${date} + ')'"
|
||||
th:data-dates="${date}"
|
||||
th:data-stitching="${phases.get('Stitching')?.intValue() ?: 0}"
|
||||
th:data-finishing="${phases.get('finishingValueForBarChart')?.intValue() ?: 0}"
|
||||
th:data-finishing="${phases.get('finishing')?.intValue() ?: 0}"
|
||||
th:data-packaging="${phases.get('packaging')?.intValue() ?: 0}"
|
||||
th:data-totalProduction="${detail.get('Shift Target')}"
|
||||
th:data-fontSize="35">
|
||||
|
@ -193,6 +193,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</main>
|
||||
</div>
|
||||
<script>
|
||||
|
|
|
@ -1,155 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:uind="http://www.w3.org/1999/xhtml"
|
||||
xml:lang="en"
|
||||
lang="en"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<title>Job Card</title>
|
||||
<link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:700|Open+Sans:400,400i&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" th:href="@{|${baseUrl}/css/print.css|}">
|
||||
<style type="text/css">
|
||||
@page {
|
||||
size: landscape;
|
||||
margin: 10mm;
|
||||
}
|
||||
@media print {
|
||||
body {
|
||||
transform: rotate(0deg); /* Not needed for @page landscape */
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.td-value{
|
||||
text-align: center;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-fluid">
|
||||
<table>
|
||||
<tr>
|
||||
<td width="50%">
|
||||
<img width="200" th:src="@{|${baseUrl}/img/utopia-industries.png|}" alt="Utopia Industries">
|
||||
</td>
|
||||
<td width="50%">
|
||||
<table class="bordered">
|
||||
<tr class="tr-header">
|
||||
<td colspan="2" style="text-align: center" th:text="'PO Online Status'"></td>
|
||||
</tr>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 40%;"><i>PO Code</i></td>
|
||||
<td style="width: 60%;">
|
||||
<a class="text-reset" target="_blank" th:text="${poDetail.getPoNumber()}"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 40%;"><i>Article Name</i></td>
|
||||
<td style="width: 60%;">
|
||||
<a class="text-reset" target="_blank" th:text="${poDetail.getArticleTitle()}"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="align-middle"><i>PO Quantity</i></td>
|
||||
<td><span th:text="${poDetail.getPoQuantity()}"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="align-middle"><i>PO Required Excess+</i></td>
|
||||
<td><span th:text="${poDetail.getPoRequiredQuantity()}"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="align-middle"><i>PO Status</i></td>
|
||||
<td>
|
||||
<span th:if="*{poDetail.isPoStatus}" th:text="'CLOSE'"></span>
|
||||
<span th:if="*{!poDetail.isPoStatus}" th:text="'OPEN'"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table style="margin-top: 10px;">
|
||||
<h5 class="no-margin-top no-margin-bottom" style="margin-top: 10px;">PO Details</h5>
|
||||
<thead>
|
||||
<tr class="tr-header">
|
||||
<td style="width: 70px; text-align: center"></td>
|
||||
<td style="width: 60px; text-align: center">Cutting Insp.</td>
|
||||
<td style="width: 150px; text-align: center">Stitching</td>
|
||||
<td style="width: 60px; text-align: center">Finished</td>
|
||||
<td style="width: 90px; text-align: center; padding-left: 40px">Rej. Store</td>
|
||||
<td style="width: 100px; text-align: center">Packaging</td>
|
||||
<td style="width: 80px; text-align: center">Shipped</td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<table >
|
||||
<thead>
|
||||
<tr class="tr-header">
|
||||
<td style="width: 50px; text-align: center" >Actual Cut</td>
|
||||
<td style="width: 50px; text-align: center; border-right: 1px solid white;">Bal.To Cut</td>
|
||||
<td style="width: 50px; text-align: center;">Rcvd.</td>
|
||||
<td style="width: 50px; text-align: center">Ok</td>
|
||||
<td style="width: 50px; text-align: center; border-right: 1px solid white;">Rej.</td>
|
||||
<td style="width: 50px; text-align: center">In</td>
|
||||
<td style="width: 50px; text-align: center">WIP</td>
|
||||
<td style="width: 50px; text-align: center; border-right: 1px solid white;">Out</td>
|
||||
<td style="width: 50px; text-align: center">In</td>
|
||||
<td style="width: 50px; text-align: center">Rej</td>
|
||||
<td style="width: 50px; text-align: center; border-right: 1px solid white;">QA Approv.</td>
|
||||
<td style="width: 50px; text-align: center">Rcvd.</td>
|
||||
<td style="width: 50px; text-align: center; border-right: 1px solid white;">waiting</td>
|
||||
<td style="width: 50px; text-align: center">In</td>
|
||||
<td style="width: 50px; text-align: center">Out</td>
|
||||
<td style="width: 50px; text-align: center; border-right: 1px solid white;">Stock</td>
|
||||
<td style="width: 50px; text-align: center">Scan</td>
|
||||
<td style="width: 50px; text-align: center; border-right: 1px solid white;">Net</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr >
|
||||
<td th:text="${poDetail.getActualCutting()}" class="td-value"></td>
|
||||
<td th:text="${poDetail.getBalanceToCutting()}" class="td-value"></td>
|
||||
<td th:text="${poDetail.getCuttingReceived()}" class="td-value"></td>
|
||||
<td th:text="${poDetail.getCuttingOki()}" class="td-value"></td>
|
||||
<td th:text="${poDetail.getCuttingReject()}" class="td-value"></td>
|
||||
<td th:text="${poDetail.getStitchingIn()}" class="td-value"></td>
|
||||
<td th:text="${poDetail.getStitchingWips()}" class="td-value"></td>
|
||||
<td th:text="${poDetail.getStitchingOut()}" class="td-value"></td>
|
||||
<td th:text="${poDetail.getFinishIn()}" class="td-value"></td>
|
||||
<td th:text="${poDetail.getFinishRej()}" class="td-value"></td>
|
||||
<td th:text="${poDetail.getFinishQaApproved()}" class="td-value"></td>
|
||||
<td th:text="${poDetail.getStoreReceived()}" class="td-value"></td>
|
||||
<td th:text="${poDetail.getStoreWaiting()}" class="td-value"></td>
|
||||
<td th:text="${poDetail.getPackagingIn()}" class="td-value"></td>
|
||||
<td th:text="${poDetail.getPackagingOut()}" class="td-value"></td>
|
||||
<td th:text="${poDetail.getPackagingStock()}" class="td-value"></td>
|
||||
<td th:text="${poDetail.getShippedScan()}" class="td-value"></td>
|
||||
<td th:text="${poDetail.getShippedNet()}" class="td-value"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table class="bordered" style="width: 50%; margin-top: 20px;" th:if="${showStore}">
|
||||
<tr class="tr-header">
|
||||
<td colspan="2" style="text-align: center" th:text="'Reject Items In Store'"></td>
|
||||
</tr>
|
||||
<tbody>
|
||||
<tr th:each="heading : ${store.keySet()}"
|
||||
th:if="${store != null and not store.isEmpty()}">
|
||||
<td style="width: 40%;"><i th:text="${heading}"></i></td>
|
||||
<td style="width: 60%;">
|
||||
<a class="text-reset" target="_blank" th:text="${store.get(heading)}"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -8,7 +8,6 @@
|
|||
<main class="row page-main">
|
||||
<aside class="col-sm-2" th:replace="/reporting/po-job-card-report-sidebar :: sidebar"></aside>
|
||||
<div class="col-sm">
|
||||
<h3>PO Job Cards</h3>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr th:if="${allJobCard != null}" th:each="jobCard : ${allJobCard.keySet()}"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<form th:action="@{${#strings.replace(#httpServletRequest.requestURI, #request.getContextPath(), '')}}">
|
||||
<h5 class="mb-4">Refine Your Search</h5>
|
||||
<div class="form-group">
|
||||
<label>PO Code</label>
|
||||
<label>PO Name</label>
|
||||
<input type="text" class="form-control" name="poName" th:value="${param['poName'] ?: poName}">
|
||||
</div>
|
||||
<input type="submit" class="btn btn-secondary btn-block" value="Search">
|
||||
|
|
|
@ -1,250 +1,63 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ctp="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head th:replace="_fragments :: head('PO Report')"></head>
|
||||
|
||||
<body>
|
||||
<div class="container-fluid">
|
||||
<header class="row page-header" th:replace="_fragments :: page-header"></header>
|
||||
<main class="row page-main">
|
||||
<aside class="col-sm-2" th:replace="/reporting/po-report-sidebar :: sidebar"></aside>
|
||||
<div class="col-lg-10 col-sm-10" style="overflow-x: auto;">
|
||||
<h3>All PO's</h3>
|
||||
<div class="table-responsive"> <!-- Bootstrap responsive table wrapper -->
|
||||
<table th:if="${ #lists != null && #lists.size(allPOs) != 0 }"
|
||||
class="table table-striped font-sm" style="min-width: 1500px;">
|
||||
<div class="col-lg-10 col-sm-10">
|
||||
<h3>PO's Report</h3>
|
||||
<table class="table table-striped font-sm" data-order="[[ 0, "asc" ]]">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>PO Number</th>
|
||||
<th>PO Article</th>
|
||||
<th>PO Quantity</th>
|
||||
<th>Req+ Excess</th>
|
||||
<th>Cut.</th>
|
||||
<th>Cut Bal.</th>
|
||||
<th>Cut Recv.</th>
|
||||
<th>Cut oki</th>
|
||||
<th>Cut Rej.</th>
|
||||
<th>Stit. In</th>
|
||||
<th>Stit. Out</th>
|
||||
<th>Stit. Wips</th>
|
||||
<th>finish In</th>
|
||||
<th>finish Rej.</th>
|
||||
<th>finish QA APP.</th>
|
||||
<th>Rej. Store Rcvd</th>
|
||||
<th>Rej. Store Waiting</th>
|
||||
<th>Packed In</th>
|
||||
<th>Packed Out</th>
|
||||
<th>Packed Stock</th>
|
||||
<th>Shipped Scan</th>
|
||||
<th>Shipped Net</th>
|
||||
<th></th>
|
||||
<th>PO Status</th>
|
||||
<th>Generate PDF</th>
|
||||
<th>Cutting</th>
|
||||
<th>Cutting Balance</th>
|
||||
<th>Stitching</th>
|
||||
<th>Stitching Balance</th>
|
||||
<th>End Line QC</th>
|
||||
<th>End Line QC Balance</th>
|
||||
<th>Finishing Items</th>
|
||||
<th>Finishing Items Balance</th>
|
||||
<th>A Grade Items</th>
|
||||
<th>B Grade Items</th>
|
||||
<th>C Grade Items</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- Dummy data for testing purposes -->
|
||||
<tr th:each="poDetail : ${allPOs}">
|
||||
<td><a class="text-reset" th:href="@{'/po-status/po-report-view/' + ${poDetail.poId}}"
|
||||
th:text="${poDetail.poNumber}"></a></td>
|
||||
<td><a class="text-reset" th:href="@{'/reporting/po-report-view/' + ${poDetail.poNumber}}" th:text="${poDetail.poNumber}"></a></td>
|
||||
<td th:text="${poDetail.articleTitle}"></td>
|
||||
<td th:text="${poDetail.poQuantity}"></td>
|
||||
<td th:text="${poDetail.poRequiredQuantity}"></td>
|
||||
<td th:text="${poDetail.actualCutting}"></td>
|
||||
<td th:text="${poDetail.balanceToCutting}"></td>
|
||||
<td th:text="${poDetail.cuttingReceived}"></td>
|
||||
<td th:text="${poDetail.cuttingOki}"></td>
|
||||
<td th:text="${poDetail.cuttingReject}"></td>
|
||||
<td th:text="${poDetail.stitchingIn}"></td>
|
||||
<td th:text="${poDetail.stitchingOut}"></td>
|
||||
<td th:text="${poDetail.stitchingWips}"></td>
|
||||
<td th:text="${poDetail.finishIn}"></td>
|
||||
<td th:text="${poDetail.finishRej}"></td>
|
||||
<td th:text="${poDetail.finishQaApproved}"></td>
|
||||
<td th:text="${poDetail.storeReceived}"></td>
|
||||
<td th:text="${poDetail.storeWaiting}"></td>
|
||||
<td th:text="${poDetail.packagingIn}"></td>
|
||||
<td th:text="${poDetail.packagingOut}"></td>
|
||||
<td th:text="${poDetail.packagingStock}"></td>
|
||||
<td th:text="${poDetail.shippedScan}"></td>
|
||||
<td th:text="${poDetail.shippedNet}"></td>
|
||||
|
||||
<td data-show-dropdown-transactions
|
||||
th:data-po-id="${poDetail.poId}"
|
||||
title="Store-Items">
|
||||
<span data-dropdown-icon-transactions class="bi bi-caret-right-fill"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="badge font-sm badge-danger" th:if="*{poDetail.poStatus}" th:text="'CLOSE'"></span>
|
||||
<span class="badge font-sm badge-ACTIVE" th:if="*{!poDetail.poStatus}" th:text="'OPEN'"></span>
|
||||
</td>
|
||||
<td>
|
||||
<form th:action="@{/po-status/generate-po-pdf}" method="get" target="_blank"
|
||||
th:id="'form-' + ${poDetail.poId}">
|
||||
<!-- Hidden inputs for all fields -->
|
||||
<input type="hidden" name="poId" th:value="${poDetail.poId}"/>
|
||||
<input type="hidden" name="poNumber" th:value="${poDetail.poNumber}"/>
|
||||
<input type="hidden" name="articleTitle" th:value="${poDetail.articleTitle}"/>
|
||||
<input type="hidden" name="poQuantity" th:value="${poDetail.poQuantity}"/>
|
||||
<input type="hidden" name="poRequiredQuantity" th:value="${poDetail.poRequiredQuantity}"/>
|
||||
<input type="hidden" name="actualCutting" th:value="${poDetail.actualCutting}"/>
|
||||
<input type="hidden" name="balanceToCutting" th:value="${poDetail.balanceToCutting}"/>
|
||||
<input type="hidden" name="cuttingReceived" th:value="${poDetail.cuttingReceived}"/>
|
||||
<input type="hidden" name="cuttingOki" th:value="${poDetail.cuttingOki}"/>
|
||||
<input type="hidden" name="cuttingReject" th:value="${poDetail.cuttingReject}"/>
|
||||
<input type="hidden" name="stitchingIn" th:value="${poDetail.stitchingIn}"/>
|
||||
<input type="hidden" name="stitchingOut" th:value="${poDetail.stitchingOut}"/>
|
||||
<input type="hidden" name="stitchingWips" th:value="${poDetail.stitchingWips}"/>
|
||||
<input type="hidden" name="finishIn" th:value="${poDetail.finishIn}"/>
|
||||
<input type="hidden" name="finishRej" th:value="${poDetail.finishRej}"/>
|
||||
<input type="hidden" name="finishQaApproved" th:value="${poDetail.finishQaApproved}"/>
|
||||
<input type="hidden" name="storeReceived" th:value="${poDetail.storeReceived}"/>
|
||||
<input type="hidden" name="storeWaiting" th:value="${poDetail.storeWaiting}"/>
|
||||
<input type="hidden" name="packagingIn" th:value="${poDetail.packagingIn}"/>
|
||||
<input type="hidden" name="packagingOut" th:value="${poDetail.packagingOut}"/>
|
||||
<input type="hidden" name="packagingStock" th:value="${poDetail.packagingStock}"/>
|
||||
<input type="hidden" name="shippedScan" th:value="${poDetail.shippedScan}"/>
|
||||
<input type="hidden" name="shippedNet" th:value="${poDetail.shippedNet}"/>
|
||||
<input type="hidden" name="poStatus" th:value="${poDetail.poStatus}"/>
|
||||
<a href="javascript:void(0);"
|
||||
th:onclick="'showPdfOptions(' + ${poDetail.poId} + ')'"
|
||||
class="btn btn-sm btn-secondary"
|
||||
title="Generate PDF">
|
||||
<i class="bi bi-filetype-pdf"></i>
|
||||
</a>
|
||||
</form>
|
||||
</td>
|
||||
<td th:text="${poDetail.totalCutting}"></td>
|
||||
<td th:text="${poDetail.remainingCutting}"></td>
|
||||
<td th:text="${poDetail.totalStitching}"></td>
|
||||
<td th:text="${poDetail.remainingStitching}"></td>
|
||||
<td th:text="${poDetail.totalEndLineQC}"></td>
|
||||
<td th:text="${poDetail.remainingEndLineQC}"></td>
|
||||
<td th:text="${poDetail.totalFinishing}"></td>
|
||||
<td th:text="${poDetail.remainingFinishing}"></td>
|
||||
<td th:text="${poDetail.totalAGradeItem}"></td>
|
||||
<td th:text="${poDetail.totalBGradeItem}"></td>
|
||||
<td th:text="${poDetail.totalCGradeItem}"></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
<h4 th:if="${#lists.size(allPOs) == 0 }">No PO found.</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="pdfOptionsModal" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Select PDF Options</h5>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- <div class="form-check">-->
|
||||
<!-- <input class="form-check-input" type="checkbox" id="includeJobCard" name="includeJobCard" value="true" checked>-->
|
||||
<!-- <label class="form-check-label" for="includeJobCard">-->
|
||||
<!-- Include Job Card Details-->
|
||||
<!-- </label>-->
|
||||
<!-- </div>-->
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="includeStoreDetails" name="includeStoreDetails" value="true" checked>
|
||||
<label class="form-check-label" for="includeStoreDetails">
|
||||
Include Store Details
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" onclick="submitPdfForm()">Generate PDF</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <h4 th:if="${#lists.size(cards) == 0 }">No cards found.</h4>-->
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<div th:replace="_fragments :: page-footer-scripts"></div>
|
||||
<script>
|
||||
// PDF Generation Functions
|
||||
let currentPoIdForPdf = null;
|
||||
|
||||
function showPdfOptions(poId) {
|
||||
currentPoIdForPdf = poId;
|
||||
$('#pdfOptionsModal').modal('show');
|
||||
}
|
||||
|
||||
function submitPdfForm() {
|
||||
if (!currentPoIdForPdf) return;
|
||||
|
||||
const form = document.getElementById('form-' + currentPoIdForPdf);
|
||||
|
||||
// Remove existing options if they exist
|
||||
const existingJobCard = form.querySelector('input[name="includeJobCard"]');
|
||||
const existingStoreDetails = form.querySelector('input[name="includeStoreDetails"]');
|
||||
|
||||
if (existingJobCard) form.removeChild(existingJobCard);
|
||||
if (existingStoreDetails) form.removeChild(existingStoreDetails);
|
||||
|
||||
// Add params to show store details in pdf
|
||||
const includeStoreDetails = document.createElement('input');
|
||||
includeStoreDetails.type = 'hidden';
|
||||
includeStoreDetails.name = 'includeStoreDetails';
|
||||
includeStoreDetails.value = document.getElementById('includeStoreDetails').checked;
|
||||
form.appendChild(includeStoreDetails);
|
||||
|
||||
form.submit();
|
||||
$('#pdfOptionsModal').modal('hide');
|
||||
}
|
||||
|
||||
// DataTable and Dropdown Initialization
|
||||
$(document).ready(function() {
|
||||
const $body = $('body');
|
||||
|
||||
// Initialize DataTables for each individual table
|
||||
$('table[data-account-table]').each(function () {
|
||||
$(this).DataTable({
|
||||
paging: false,
|
||||
pageLength: 100,
|
||||
searching: false,
|
||||
lengthChange: false,
|
||||
processing: false,
|
||||
dom: `
|
||||
<'row'<'col-sm-3'B><'col-sm-4'f>>
|
||||
<'row'<'col-sm-6't>>
|
||||
<'row'<'col-sm-3'i><'col-sm-4'p>>`,
|
||||
buttons: [{
|
||||
extend: 'excel',
|
||||
text: '',
|
||||
className: 'bi bi-file-earmark-spreadsheet btn-sm d-none'
|
||||
}]
|
||||
});
|
||||
});
|
||||
|
||||
// Dropdown transactions toggle
|
||||
$body.on('click', '[data-show-dropdown-transactions]', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const $this = $(this);
|
||||
const $tr = $this.closest('tr');
|
||||
const $table = $this.closest('table');
|
||||
const dataTable = $table.DataTable();
|
||||
const $row = dataTable.row($tr);
|
||||
const $spanDropdown = $this.find('[data-dropdown-icon-transactions]');
|
||||
const poId = $this.data('po-id');
|
||||
$spanDropdown.toggleClass('bi-caret-right-fill bi-caret-down-fill');
|
||||
|
||||
if ($row.child.isShown()) {
|
||||
$row.child.hide();
|
||||
} else {
|
||||
$row.child(`<span class="spinner-border text-center spinner-border-md" role="status"></span>`).show();
|
||||
$.ajax({
|
||||
url: `/ctp/purchase-order/store-items/${poId}`,
|
||||
success: function(data) {
|
||||
if (data.includes('page-login') ||
|
||||
data.includes('login__form') ||
|
||||
data.includes('Sign in')) {
|
||||
// Redirect to login page
|
||||
window.location.href = '/ctp/login?logout';
|
||||
} else {
|
||||
$row.child(data).show();
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
if (xhr.status === 401) {
|
||||
window.location.href = '/ctp/login?logout';
|
||||
} else {
|
||||
$row.child('<span class="text-danger">Error loading data</span>').show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script th:src="@{/js/summary.js}"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,55 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<table th:if="${#lists != null && #lists.size(storeItems.keySet()) != 0 }" class="table table-bordered font-sm mb-4" data-account-tables >
|
||||
<thead>
|
||||
<tr>
|
||||
<th th:each="heading : ${storeItems.keySet()}" th:text="${heading}"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td th:each="heading : ${storeItems.keySet()}" th:text="${storeItems.get(heading)}"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h5 th:if="${#lists.size(storeItems.keySet()) == 0}" class="mt-2">No Items found.</h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div th:replace="_fragments :: page-footer-scripts"></div>
|
||||
<script th:inline="javascript">
|
||||
|
||||
// Initialize DataTables for each individual table
|
||||
$('table[data-account-tables]').each(function () {
|
||||
const $table = $(this);
|
||||
|
||||
// Prevent reinitializing if already done
|
||||
if (!$.fn.DataTable.isDataTable($table)) {
|
||||
$table.DataTable({
|
||||
paging: false,
|
||||
searching: false,
|
||||
lengthChange: false,
|
||||
info: false,
|
||||
dom: 't',
|
||||
buttons: [{
|
||||
extend: 'excel',
|
||||
text: '',
|
||||
className: 'bi bi-file-earmark-spreadsheet btn-sm d-none'
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -21,7 +21,6 @@
|
|||
v-on:finished-item-select="onItemSelect">
|
||||
</search-item>
|
||||
</div>
|
||||
<input type="hidden" name="rejectReason" v-model="reason">
|
||||
<div class="col-sm-3 form-group">
|
||||
<label>Store Account</label>
|
||||
<select class="form-control" name="accountId" th:field="*{accountId}" required>
|
||||
|
@ -41,16 +40,8 @@
|
|||
></finish-item-table>
|
||||
</div>
|
||||
<div class="alert alert-danger" v-if="hasDuplicates()">Duplicate Item Selected</div>
|
||||
<button class="btn btn-primary mr-2" type="button" :disabled="hasDuplicates() || items.length === 0"
|
||||
@click="submitWithRejectReason('Cut To Pack')">Cut To Pack
|
||||
</button>
|
||||
<button class="btn btn-danger mr-2" type="button" :disabled="hasDuplicates() || items.length === 0"
|
||||
@click="submitWithRejectReason('Knitting')">Knitting
|
||||
</button>
|
||||
<button class="btn btn-danger mr-2" type="button" :disabled="hasDuplicates() || items.length === 0"
|
||||
@click="submitWithRejectReason('Dying')">Dying
|
||||
</button>
|
||||
<a th:href="@{/store/receive-inventory}" class="btn btn-light">Cancel</a>
|
||||
<button class="btn btn-primary" type="submit" v-bind:disabled="hasDuplicates()">Submit</button>
|
||||
<a th:href="@{/packaging/receive-inventory}" class="btn btn-light">Cancel</a>
|
||||
</form>
|
||||
<script th:inline="javascript">
|
||||
window.ctp.accounts = [[${accounts}]];
|
||||
|
|
Loading…
Reference in New Issue