From bc3d5d4ac9d1c4f190a2bf0d59c8886be86e8262 Mon Sep 17 00:00:00 2001 From: "usama.jameel" Date: Fri, 11 Jul 2025 13:44:08 +0500 Subject: [PATCH 1/4] create wips automatically into cutting phase --- .../controller/CuttingController.java | 40 +++++++++++- .../controller/StitchingController.java | 19 +----- .../dao/ctp/StitchingOfflineItemDAO.java | 8 +-- .../querybuilder/QueryBuilder.java | 2 + .../service/BundleService.java | 9 ++- .../service/InventoryService.java | 61 ++++++++++--------- src/main/resources/templates/_fragments.html | 5 ++ .../stitching/stitched-offline-items.html | 12 ++-- 8 files changed, 95 insertions(+), 61 deletions(-) diff --git a/src/main/java/com/utopiaindustries/controller/CuttingController.java b/src/main/java/com/utopiaindustries/controller/CuttingController.java index 5d09870..aaeaec4 100644 --- a/src/main/java/com/utopiaindustries/controller/CuttingController.java +++ b/src/main/java/com/utopiaindustries/controller/CuttingController.java @@ -3,9 +3,9 @@ package com.utopiaindustries.controller; import com.utopiaindustries.auth.CuttingRole; import com.utopiaindustries.dao.ctp.BundleWrapper; import com.utopiaindustries.model.ctp.JobCardWrapper; +import com.utopiaindustries.model.ctp.StitchingOfflineItem; import com.utopiaindustries.service.*; import com.utopiaindustries.util.StringUtils; -import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; @@ -13,6 +13,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes; import java.time.LocalDate; import java.util.Arrays; +import java.util.List; @Controller @CuttingRole @@ -184,4 +185,41 @@ public class CuttingController { return "redirect:/cutting/master-bundles"; } } + + @PostMapping( "/generate-qrCode" ) + public Object generateBarcode(@RequestParam( name = "ids" ,required = false) Long[] ids, + @RequestParam( name = "artifactType" ) String artifactType, RedirectAttributes redirectAttributes ) throws Exception { + if (ids == null){ + redirectAttributes.addFlashAttribute( "error", "Select At least One CheckBox" ); + return "redirect:/cutting/cutting-items"; } + try { + barcodeService.generateBarcodes( Arrays.asList( ids ), artifactType ); + redirectAttributes.addFlashAttribute( "success", "Barcode generated successfully" ); + return "redirect:/cutting/cutting-items"; + }catch (Exception e){ + redirectAttributes.addFlashAttribute( "error", e ); + return "redirect:/cutting/cutting-items"; } + } + + /* + * get finished items + * */ + @GetMapping( "/cutting-items" ) + public String getStitchingOfflineItems( @RequestParam(value = "id", required = false ) String id, + @RequestParam(value = "item-id", required = false ) String itemId, + @RequestParam( value = "sku", required = false ) String sku, + @RequestParam( value = "start-date", required = false) String startDate, + @RequestParam( value = "end-date", required = false ) String endDate, + @RequestParam(value = "bundle-id", required = false) Long bundleId, + @RequestParam( value = "count", required = false, defaultValue = "100") Long count, + @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 itemList = bundleService.getStitchedOfflineItems( id, itemId, sku, status, startDate, endDate, bundleId, count ); + model.addAttribute("items", itemList ) ; + model.addAttribute("startDate", startDate1); + model.addAttribute("endDate", endDate1); + return "/stitching/stitched-offline-items"; + } } diff --git a/src/main/java/com/utopiaindustries/controller/StitchingController.java b/src/main/java/com/utopiaindustries/controller/StitchingController.java index 9b7951e..2c9c353 100644 --- a/src/main/java/com/utopiaindustries/controller/StitchingController.java +++ b/src/main/java/com/utopiaindustries/controller/StitchingController.java @@ -116,7 +116,7 @@ public class StitchingController { RedirectAttributes redirectAttributes, Model model ){ try { - inventoryService.createStitchingOfflineItemsFromJobCard( bundleWrapper ); +// inventoryService.createStitchingOfflineItemsFromJobCard( bundleWrapper ); redirectAttributes.addFlashAttribute("success", "Stitch Items Created Successfully"); } catch ( Exception exception ){ exception.printStackTrace(); @@ -124,21 +124,4 @@ public class StitchingController { } return "redirect:/stitching/create-stitching-items"; } - - @PostMapping( "/generate-barcodes" ) - public Object generateBarcode(@RequestParam( name = "ids" ,required = false) Long[] ids, - @RequestParam( name = "artifactType" ) String artifactType, RedirectAttributes redirectAttributes ) throws Exception { - if (ids == null){ - redirectAttributes.addFlashAttribute( "error", "Select At least One CheckBox" ); - return "redirect:/stitching/stitching-offline-items"; - } - try { - barcodeService.generateBarcodes( Arrays.asList( ids ), artifactType ); - redirectAttributes.addFlashAttribute( "success", "Barcode generated successfully" ); - return "redirect:/stitching/stitching-offline-items"; - }catch (Exception e){ - redirectAttributes.addFlashAttribute( "error", e ); - return "redirect:/stitching/stitching-offline-items"; - } - } } diff --git a/src/main/java/com/utopiaindustries/dao/ctp/StitchingOfflineItemDAO.java b/src/main/java/com/utopiaindustries/dao/ctp/StitchingOfflineItemDAO.java index 53c5d31..94c11e4 100644 --- a/src/main/java/com/utopiaindustries/dao/ctp/StitchingOfflineItemDAO.java +++ b/src/main/java/com/utopiaindustries/dao/ctp/StitchingOfflineItemDAO.java @@ -29,7 +29,7 @@ public class StitchingOfflineItemDAO { private final String FIND_TOTAL_COUNT = String.format("SELECT COUNT(*) FROM %s where job_card_id = :job_card_id And item_id = :item_id", TABLE_NAME ); private final String SELECT_BY_IDS = String.format( "SELECT * FROM %s WHERE id IN (:ids)", TABLE_NAME ); private final String SELECT_BY_TERM = String.format( "SELECT * FROM %s WHERE barcode LIKE :term ORDER BY ID DESC", TABLE_NAME ); - private final String SELECT_BY_MASTER_ID = String.format( "SELECT * FROM %s WHERE job_card_id = :job_card_id", TABLE_NAME ); + private final String SELECT_BY_BUNDLE_ID = String.format( "SELECT * FROM %s WHERE bundle_id = :bundle_id", TABLE_NAME ); private final String COUNT_TOTAL_QA_ITEMS= String.format("SELECT COUNT(*) FROM %s WHERE job_card_id = :job_card_id AND is_qa IS TRUE",TABLE_NAME); private final String SELECT_BY_TIME_AND_CARD_ID= String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id ORDER BY created_at DESC LIMIT 1;",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 ); @@ -128,10 +128,10 @@ public class StitchingOfflineItemDAO { return namedParameterJdbcTemplate.query( SELECT_BY_TERM , params, new StitchingOfflineItemRowMapper() ); } - public List findByMasterId( long masterId ){ + public List findByBundleId( long bundleId ){ MapSqlParameterSource params = new MapSqlParameterSource(); - params.addValue("job_card_id", masterId ); - return namedParameterJdbcTemplate.query( SELECT_BY_MASTER_ID , params, new StitchingOfflineItemRowMapper() ); + params.addValue("bundle_id", bundleId ); + return namedParameterJdbcTemplate.query( SELECT_BY_BUNDLE_ID , params, new StitchingOfflineItemRowMapper() ); } public HashMap findTotalStitchingOfflineItems(List itemIds, long jobCardId) { diff --git a/src/main/java/com/utopiaindustries/querybuilder/QueryBuilder.java b/src/main/java/com/utopiaindustries/querybuilder/QueryBuilder.java index 4db43fb..25e932f 100644 --- a/src/main/java/com/utopiaindustries/querybuilder/QueryBuilder.java +++ b/src/main/java/com/utopiaindustries/querybuilder/QueryBuilder.java @@ -3,6 +3,8 @@ package com.utopiaindustries.querybuilder; import com.utopiaindustries.util.MySQLUtils; import com.utopiaindustries.util.StringUtils; +import java.util.List; + public class QueryBuilder { private StringBuilder query; private String table; diff --git a/src/main/java/com/utopiaindustries/service/BundleService.java b/src/main/java/com/utopiaindustries/service/BundleService.java index 0682982..f5fc8f0 100644 --- a/src/main/java/com/utopiaindustries/service/BundleService.java +++ b/src/main/java/com/utopiaindustries/service/BundleService.java @@ -29,13 +29,17 @@ public class BundleService { private final CryptographyService cryptographyService; private final FinishedItemDAO finishedItemDAO; private final StitchingOfflineItemDAO stitchingOfflineItemDAO; + private final InventoryService inventoryService; + private final InventoryTransactionLegDAO inventoryTransactionLegDAO; - public BundleService(BundleDAO bundleDAO, MasterBundleDAO masterBundleDAO, CryptographyService cryptographyService, FinishedItemDAO finishedItemDAO, StitchingOfflineItemDAO stitchingOfflineItemDAO) { + public BundleService(BundleDAO bundleDAO, MasterBundleDAO masterBundleDAO, CryptographyService cryptographyService, FinishedItemDAO finishedItemDAO, StitchingOfflineItemDAO stitchingOfflineItemDAO, InventoryService inventoryService, InventoryTransactionLegDAO inventoryTransactionLegDAO) { this.bundleDAO = bundleDAO; this.masterBundleDAO = masterBundleDAO; this.cryptographyService = cryptographyService; this.finishedItemDAO = finishedItemDAO; this.stitchingOfflineItemDAO = stitchingOfflineItemDAO; + this.inventoryService = inventoryService; + this.inventoryTransactionLegDAO = inventoryTransactionLegDAO; } /* @@ -169,6 +173,7 @@ public class BundleService { List newBundles = new ArrayList<>(); for( Bundle bundle : wrapper.getBundles() ){ bundle.setMasterBundleId( id ); + bundle.setCurrentProduction(bundle.getWrapQuantity()); newBundles.add( bundle ); // sku and item in master bundle if( StringUtils.isNullOrEmpty( sku ) ){ @@ -188,6 +193,8 @@ public class BundleService { masterBundleDAO.save( masterBundle ); //save child bundles bundleDAO.saveAll( newBundles ); + + inventoryService.createStitchingOfflineItemsFromBundle(newBundles); return id; } return 0; diff --git a/src/main/java/com/utopiaindustries/service/InventoryService.java b/src/main/java/com/utopiaindustries/service/InventoryService.java index 64cd142..523678d 100644 --- a/src/main/java/com/utopiaindustries/service/InventoryService.java +++ b/src/main/java/com/utopiaindustries/service/InventoryService.java @@ -285,6 +285,11 @@ public class InventoryService { masterBundle.setIsReceived(true); masterBundle.setAccountId(toAccount); masterBundleDAO.save(masterBundle); + + //create transaction of offline items And items already create when master bundle create + BundleWrapper bundleWrapper = new BundleWrapper(); + bundleWrapper.setBundles(bundles); + createStitchingOfflineItemsTransactionWhenReceivedMasterBundle(bundleWrapper); } } @@ -329,51 +334,29 @@ public class InventoryService { } /* - * create finished items from master bundles + * create stitch items from master bundles * */ @Transactional(rollbackFor = Exception.class, propagation = Propagation.NESTED) - public void createStitchingOfflineItemsFromJobCard(BundleWrapper wrapper) { + public void createStitchingOfflineItemsFromBundle(List bundles) { List updatedItems = new ArrayList<>(); - List updateBundles = new ArrayList<>(); JobCard jobCard = null; - - //switching table transaction in Transaction Table - InventoryTransaction transaction = createInventoryTransaction("Against Movement from Stitching to Stitched Offline Item"); - inventoryTransactionDAO.save(transaction); - - //TransactionLeg Transaction - List bundleIds = wrapper.getBundles().stream().map(Bundle::getId).collect(Collectors.toList()); - Map lastBundleIdInTransactionMap = inventoryTransactionLegDAO - .findLastTransactionByParentIdAndParentType(InventoryTransactionLeg.Type.IN.name(), bundleIds, InventoryArtifactType.STITCH_BUNDLE.name()) - .stream() - .collect(Collectors.toMap(InventoryTransactionLeg::getParentDocumentId, Function.identity())); - for (Bundle subBundle : wrapper.getBundles()) { - long accountId = masterBundleDAO.find(subBundle.getMasterBundleId()).getAccountId(); + for (Bundle subBundle : bundles) { if (subBundle.getCurrentProduction() != null && subBundle.getCurrentProduction().compareTo(BigDecimal.ZERO) != 0) { Bundle bundle = bundleDAO.find(subBundle.getId()); jobCard = jobCardDAO.find(subBundle.getJobCardId()); long production = (bundle.getProduction() == null) ? 0 : bundle.getProduction().longValue(); - long wrapQuantity = bundle.getWrapQuantity().longValue(); JobCardItem jobCardItem = jobCardItemDAO.findByCardIdAndItemId(subBundle.getJobCardId(), subBundle.getItemId()); BigDecimal previousTotalProduction = jobCardItem.getTotalProduction() == null ? BigDecimal.ZERO : jobCardItem.getTotalProduction(); - InventoryTransactionLeg lastInvTransaction = lastBundleIdInTransactionMap.getOrDefault(subBundle.getId(), null); - - if (lastInvTransaction != null) { - if (wrapQuantity == production + subBundle.getCurrentProduction().longValue()) { - // OUT - long fromAccount = lastInvTransaction.getAccountId(); - createInventoryTransactionLeg(transaction, subBundle, accountId, InventoryTransactionLeg.Type.OUT.name(), InventoryArtifactType.STITCH_BUNDLE.name()); - } - } // create stitchingOfflineItems items - List stitchingOfflineItems = createStitchingOfflineItems(subBundle.getCurrentProduction(), jobCardItem, subBundle.getId()); - // create IN Transactions of Finished Items into account - createTransactions(stitchingOfflineItems, accountId, InventoryArtifactType.STITCHING_OFFLINE.name()); + createStitchingOfflineItems(subBundle.getCurrentProduction(), jobCardItem, subBundle.getId()); + //update job card item and then add in list jobCardItem.setTotalProduction(previousTotalProduction.add(subBundle.getCurrentProduction())); jobCardItem.setJobCardId(jobCard.getId()); updatedItems.add(jobCardItem); + + // update bundle production BigDecimal pro = BigDecimal.valueOf(production + subBundle.getCurrentProduction().longValue()); bundle.setProduction(pro); bundleDAO.save(bundle); @@ -382,6 +365,26 @@ public class InventoryService { jobCardItemDAO.saveAll(updatedItems); } + @Transactional(rollbackFor = Exception.class, propagation = Propagation.NESTED) + public void createStitchingOfflineItemsTransactionWhenReceivedMasterBundle(BundleWrapper wrapper) { + //switching table transaction in Transaction Table + InventoryTransaction transaction = createInventoryTransaction("Against Movement from Stitching to Stitched Offline Item"); + inventoryTransactionDAO.save(transaction); + //TransactionLeg Transaction + List bundleIds = wrapper.getBundles().stream().map(Bundle::getId).collect(Collectors.toList()); + for (Bundle subBundle : wrapper.getBundles()) { + long accountId = masterBundleDAO.find(subBundle.getMasterBundleId()).getAccountId(); + // OUT + createInventoryTransactionLeg(transaction, subBundle, accountId, InventoryTransactionLeg.Type.OUT.name(), InventoryArtifactType.STITCH_BUNDLE.name()); + // find stitchingOfflineItems items + List stitchingOfflineItems = stitchingOfflineItemDAO.findByBundleId(subBundle.getId()); + // create IN Transactions of Finished Items into account + createTransactions(stitchingOfflineItems, accountId, InventoryArtifactType.STITCHING_OFFLINE.name()); + } + } + + + /* * create finished items * */ diff --git a/src/main/resources/templates/_fragments.html b/src/main/resources/templates/_fragments.html index 16c1c64..2d329a4 100644 --- a/src/main/resources/templates/_fragments.html +++ b/src/main/resources/templates/_fragments.html @@ -181,6 +181,11 @@ th:classappend="${#strings.startsWith(#httpServletRequest.getRequestURI(), '/ctp/cutting/master-bundles') ? 'active' : ''}"> Master Bundles + + diff --git a/src/main/resources/templates/stitching/stitched-offline-items.html b/src/main/resources/templates/stitching/stitched-offline-items.html index ad3eec7..3218a67 100644 --- a/src/main/resources/templates/stitching/stitched-offline-items.html +++ b/src/main/resources/templates/stitching/stitched-offline-items.html @@ -12,12 +12,8 @@
-
-

Stitching WIP's

- Create Stitching WIP's -
-
+ @@ -30,8 +26,8 @@ -
Created At Created By Is QA -
+
+
@@ -54,7 +50,7 @@
-
+
Date: Mon, 14 Jul 2025 14:33:31 +0500 Subject: [PATCH 2/4] add inline-received flag in stitch item for check bundles received or not --- .../dao/ctp/StitchingOfflineItemDAO.java | 7 ++++--- .../dao/ctp/StitchingOfflineItemRowMapper.java | 1 + .../model/ctp/StitchingOfflineItem.java | 10 ++++++++++ .../com/utopiaindustries/service/InventoryService.java | 7 +++++++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/utopiaindustries/dao/ctp/StitchingOfflineItemDAO.java b/src/main/java/com/utopiaindustries/dao/ctp/StitchingOfflineItemDAO.java index 94c11e4..fc5fc94 100644 --- a/src/main/java/com/utopiaindustries/dao/ctp/StitchingOfflineItemDAO.java +++ b/src/main/java/com/utopiaindustries/dao/ctp/StitchingOfflineItemDAO.java @@ -24,11 +24,11 @@ public class StitchingOfflineItemDAO { private final String SELECT_ALL_QUERY = String.format( "SELECT * FROM %s ORDER BY id DESC", TABLE_NAME ); private final String SELECT_QUERY_BY_JOB_CARD = String.format( "SELECT * FROM %s WHERE job_card_id = :job_card_id", TABLE_NAME ); private final String DELETE_QUERY = String.format( "DELETE FROM %s WHERE id = :id", TABLE_NAME ); - private final String INSERT_QUERY = String.format( "INSERT INTO %s (id, item_id, sku, barcode, created_at, created_by, job_card_id, is_qa, qa_remarks, qa_status,bundle_id, qc_done_at) VALUES (:id, :item_id, :sku, :barcode, :created_at, :created_by, :job_card_id, :is_qa, :qa_remarks, :qa_status, :bundle_id, :qc_done_at) ON DUPLICATE KEY UPDATE item_id = VALUES(item_id), sku = VALUES(sku), barcode = VALUES(barcode), created_at = VALUES(created_at), created_by = VALUES(created_by), job_card_id = VALUES(job_card_id), is_qa = VALUES(is_qa), qa_remarks = VALUES(qa_remarks), qa_status = VALUES(qa_status), bundle_id = VALUES(bundle_id), qc_done_at = VALUES(qc_done_at)", TABLE_NAME ); + private final String INSERT_QUERY = String.format( "INSERT INTO %s (id, item_id, sku, barcode, created_at, created_by, job_card_id, is_qa, qa_remarks, qa_status,bundle_id, qc_done_at, inline_received) VALUES (:id, :item_id, :sku, :barcode, :created_at, :created_by, :job_card_id, :is_qa, :qa_remarks, :qa_status, :bundle_id, :qc_done_at, :inline_received) ON DUPLICATE KEY UPDATE item_id = VALUES(item_id), sku = VALUES(sku), barcode = VALUES(barcode), created_at = VALUES(created_at), created_by = VALUES(created_by), job_card_id = VALUES(job_card_id), is_qa = VALUES(is_qa), qa_remarks = VALUES(qa_remarks), qa_status = VALUES(qa_status), bundle_id = VALUES(bundle_id), qc_done_at = VALUES(qc_done_at), inline_received = VALUES(inline_received)", TABLE_NAME ); private final String SELECT_BY_LIMIT = String.format("SELECT * FROM %s ORDER BY id DESC LIMIT :limit", TABLE_NAME ); private final String FIND_TOTAL_COUNT = String.format("SELECT COUNT(*) FROM %s where job_card_id = :job_card_id And item_id = :item_id", TABLE_NAME ); private final String SELECT_BY_IDS = String.format( "SELECT * FROM %s WHERE id IN (:ids)", TABLE_NAME ); - private final String SELECT_BY_TERM = String.format( "SELECT * FROM %s WHERE barcode LIKE :term ORDER BY ID DESC", TABLE_NAME ); + private final String SELECT_BY_TERM = String.format( "SELECT * FROM %s WHERE barcode LIKE :term AND inline_received = TRUE ORDER BY ID DESC", TABLE_NAME ); private final String SELECT_BY_BUNDLE_ID = String.format( "SELECT * FROM %s WHERE bundle_id = :bundle_id", TABLE_NAME ); private final String COUNT_TOTAL_QA_ITEMS= String.format("SELECT COUNT(*) FROM %s WHERE job_card_id = :job_card_id AND is_qa IS TRUE",TABLE_NAME); private final String SELECT_BY_TIME_AND_CARD_ID= String.format("SELECT * FROM %s WHERE job_card_id = :job_card_id ORDER BY created_at DESC LIMIT 1;",TABLE_NAME); @@ -54,7 +54,8 @@ public class StitchingOfflineItemDAO { .addValue("is_qa", stitchingOfflineItem.getIsQa() ) .addValue("qa_remarks", stitchingOfflineItem.getQaRemarks() ) .addValue("qc_done_at", stitchingOfflineItem.getQcDoneAt() ) - .addValue("qa_status", stitchingOfflineItem.getQaStatus() ); + .addValue("qa_status", stitchingOfflineItem.getQaStatus() ) + .addValue("inline_received", stitchingOfflineItem.isInlineReceived() ); return params; } diff --git a/src/main/java/com/utopiaindustries/dao/ctp/StitchingOfflineItemRowMapper.java b/src/main/java/com/utopiaindustries/dao/ctp/StitchingOfflineItemRowMapper.java index 895d178..408e141 100644 --- a/src/main/java/com/utopiaindustries/dao/ctp/StitchingOfflineItemRowMapper.java +++ b/src/main/java/com/utopiaindustries/dao/ctp/StitchingOfflineItemRowMapper.java @@ -25,6 +25,7 @@ public class StitchingOfflineItemRowMapper implements RowMapper stitchingOfflineItems = stitchingOfflineItemDAO.findByBundleId(subBundle.getId()); // create IN Transactions of Finished Items into account createTransactions(stitchingOfflineItems, accountId, InventoryArtifactType.STITCHING_OFFLINE.name()); + + List updatedItems = stitchingOfflineItems.stream().map(e-> { + e.setInlineReceived(true); + return e; + }).collect(Collectors.toList()); + + stitchingOfflineItemDAO.saveAll(updatedItems); } } From 5252b16c4dd6d85b68f23440dd1d8832f2dec225 Mon Sep 17 00:00:00 2001 From: "usama.jameel" Date: Wed, 16 Jul 2025 11:01:57 +0500 Subject: [PATCH 3/4] set dashboard value --- .../java/com/utopiaindustries/service/DashboardService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/utopiaindustries/service/DashboardService.java b/src/main/java/com/utopiaindustries/service/DashboardService.java index 791a15d..41a8f22 100644 --- a/src/main/java/com/utopiaindustries/service/DashboardService.java +++ b/src/main/java/com/utopiaindustries/service/DashboardService.java @@ -77,11 +77,11 @@ public class DashboardService { Long approvedStitchingOfflineItemsThenReject = 0L; long qcReject = 0L; if (stitchingItemIds != null && !stitchingItemIds.isEmpty()) { - approvedStitchingOfflineItems = stitchingOfflineItemDAO.findByQCOperationDateAndApproved(startDate1, endDate1, "APPROVED"); qcReject = stitchingOfflineItemDAO.findByQCOperationDateAndIds(startDate1, endDate1, "REJECT", stitchingItemIds); remaininfQcAlterPieces = stitchingOfflineItemDAO.findByQCOperationDateAndIds(null, forPreviousDate, "REJECT", stitchingItemIds); } if(stitchingOutIds != null && !stitchingOutIds.isEmpty()) { + approvedStitchingOfflineItems = stitchingOfflineItemDAO.findByQCOperationDateAndIds(startDate1, endDate1, "APPROVED", stitchingOutIds); approvedStitchingOfflineItemsThenReject = stitchingOfflineItemDAO.findByQCOperationDateAndIds(startDate1, endDate1, "REJECT", stitchingOutIds); } //set finishing related details From 5b8a509ae290216bfc6bfbe7e5e09a1288dd0c4a Mon Sep 17 00:00:00 2001 From: "usama.jameel" Date: Thu, 24 Jul 2025 14:24:34 +0500 Subject: [PATCH 4/4] change stitch item created-by name when received master bundle in line --- .../java/com/utopiaindustries/service/InventoryService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/utopiaindustries/service/InventoryService.java b/src/main/java/com/utopiaindustries/service/InventoryService.java index 88f1045..45953dc 100644 --- a/src/main/java/com/utopiaindustries/service/InventoryService.java +++ b/src/main/java/com/utopiaindustries/service/InventoryService.java @@ -380,9 +380,10 @@ public class InventoryService { List stitchingOfflineItems = stitchingOfflineItemDAO.findByBundleId(subBundle.getId()); // create IN Transactions of Finished Items into account createTransactions(stitchingOfflineItems, accountId, InventoryArtifactType.STITCHING_OFFLINE.name()); - + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); List updatedItems = stitchingOfflineItems.stream().map(e-> { e.setInlineReceived(true); + e.setCreatedBy(authentication.getName()); return e; }).collect(Collectors.toList());