Subversion Repositories SmartDukaan

Rev

Show changed files | Details | Compare with Previous | Blame | RSS feed

Filtering Options

Rev Age Author Path Log message Diff
37679 19 d 14 h amit /trunk/profitmandi-dao/src/main/ feat(warehouse): carry the PO creator through purchase order creation for backdated auto-approval

Backdated POs are to be auto-approved in the name of whoever raised them, but the service had no way
to know who that was: the model carried no user and buyerId is the seller, not a person.

- CreateWarehousePurchaseOrderModel carries createdBy
- resolvedMismatchRequest takes resolvedBy, so the correction PO raised on a GRN price mismatch -
dated to the supplier invoice and therefore backdated by nature - is credited to whoever resolved it
- staged backfill SQL for the three backdated POs still stuck in INIT inside POScheduler's
auto-close window; data only, no schema change, not yet run

The release-to-READY change in PurchaseOrderServiceImpl follows separately.
 
35716 239 d 7 h amit /trunk/ Refactor GrnController and PurchaseOrderController: extract business logic into focused services and fix N+1 query performance issues

- Create InvoiceService: invoice item CRUD, validation, vendor price matching
- Create GrnRequestService: GRN request lifecycle, mismatch resolution state machine
- Create DebitNoteService: debit note generation, PDF model building
- Move PO amendment logic from PurchaseOrderController to PurchaseOrderService
- Delegate generateDebitNote from PurchaseOrderServiceImpl to DebitNoteService
- Thin GrnController from ~1215 to ~717 lines, remove 15 unused autowired dependencies
- Thin PurchaseOrderController editPurchaseOrder from 40+ lines to 3 lines

Performance fixes:
- InvoiceServiceImpl.validateInvoiceDetail: batch item/vendor pricing/GST loading (4N+3 queries -> ~5)
- DebitNoteServiceImpl: batch item loading in buildDebitNotePdfModel and generateDebitNote
- GrnController.generateDebitNote: eliminate 2 redundant DB fetches
- Replace 3x supplierRepository.selectAll() with targeted selectBySupplierIds()