add inline-received flag in stitch item for check bundles received or not

pull/40/head
usama.jameel 2025-07-14 14:33:31 +05:00
parent bc3d5d4ac9
commit b8f94705d3
4 changed files with 22 additions and 3 deletions

View File

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

View File

@ -25,6 +25,7 @@ public class StitchingOfflineItemRowMapper implements RowMapper<StitchingOffline
stitchingOfflineItem.setCreatedBy( rs.getString( "created_by" ) );
stitchingOfflineItem.setJobCardId( rs.getLong("job_card_id") );
stitchingOfflineItem.setIsQa( rs.getBoolean("is_qa"));
stitchingOfflineItem.setInlineReceived( rs.getBoolean("inline_received"));
stitchingOfflineItem.setQaStatus( rs.getString("qa_status" ) );
stitchingOfflineItem.setQaRemarks( rs.getString("qa_remarks") );
return stitchingOfflineItem;

View File

@ -23,6 +23,8 @@ public class StitchingOfflineItem implements InventoryArtifact {
private String qaRemarks;
private String qaStatus;
private long bundleId;
private boolean inlineReceived;
@Override
public String getType() {
@ -137,6 +139,14 @@ public class StitchingOfflineItem implements InventoryArtifact {
this.qcDoneAt = qcDoneAt;
}
public boolean isInlineReceived() {
return inlineReceived;
}
public void setInlineReceived(boolean inlineReceived) {
this.inlineReceived = inlineReceived;
}
@Override
public String toString() {
return "StitchingOfflineItem{" +

View File

@ -380,6 +380,13 @@ public class InventoryService {
List<StitchingOfflineItem> stitchingOfflineItems = stitchingOfflineItemDAO.findByBundleId(subBundle.getId());
// create IN Transactions of Finished Items into account
createTransactions(stitchingOfflineItems, accountId, InventoryArtifactType.STITCHING_OFFLINE.name());
List<StitchingOfflineItem> updatedItems = stitchingOfflineItems.stream().map(e-> {
e.setInlineReceived(true);
return e;
}).collect(Collectors.toList());
stitchingOfflineItemDAO.saveAll(updatedItems);
}
}