<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>SmartDukaan &#x2013; /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/migrations/InternalGrnTask.java</title><description>WebSVN RSS feed &#x2013; SmartDukaan</description><lastBuildDate>Sat, 17 Oct 2026 07:53:54 +0530</lastBuildDate><generator>WebSVN 2.8.6-DEV</generator><language>en</language><link>https://svn.smartdukaan.com/log.php?repname=SmartDukaan&amp;path=%2Ftrunk%2Fprofitmandi-cron%2Fsrc%2Fmain%2Fjava%2Fcom%2Fsmartdukaan%2Fcron%2Fmigrations%2FInternalGrnTask.java&amp;max=40&amp;peg=37614</link><atom:link href="https://svn.smartdukaan.com/rss.php?path=%2Ftrunk%2Fprofitmandi-cron%2Fsrc%2Fmain%2Fjava%2Fcom%2Fsmartdukaan%2Fcron%2Fmigrations%2FInternalGrnTask.java&amp;peg=37614&amp;repname=SmartDukaan" rel="self" type="application/rss+xml" />
<item><pubDate>Mon, 14 Sep 2026 04:46:19 +0530</pubDate><dc:creator>amit</dc:creator><title>Rev 37614 – Run each internal GRN in a transaction that is actually ...</title><description>&lt;div&gt;&lt;strong&gt;amit – 2 file(s) modified&lt;/strong&gt;&lt;br/&gt;Run each internal GRN in a transaction that is actually applied&lt;br /&gt;
&lt;br /&gt;
The internal GRN one-off failed immediately with &quot;no transaction is in progress&quot;, thrown while&lt;br /&gt;
flushing the Hibernate session at commit.&lt;br /&gt;
&lt;br /&gt;
The per invoice method was annotated to start its own transaction, but it sat in the same bean as&lt;br /&gt;
the loop that called it. Spring applies @Transactional through a proxy, and a call from one method&lt;br /&gt;
of a bean to another never leaves the object, so the annotation was inert - the receiving ran with&lt;br /&gt;
no transaction at all while the driver had suspended the surrounding one. The repositories still&lt;br /&gt;
bound a session to the thread, and the flush at commit then found nothing to flush into.&lt;br /&gt;
&lt;br /&gt;
The receiving moves to its own bean, so the driver now reaches it through the proxy and the&lt;br /&gt;
transaction is real. The driver keeps no transaction of its own, which is what lets one invoice&lt;br /&gt;
fail without disturbing those already received.&lt;br /&gt;
&lt;br /&gt;
No change to what is received or to the conditions under which an invoice is skipped.&lt;/div&gt;+ /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/migrations/InternalGrnReceiver.java&lt;br /&gt;~ /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/migrations/InternalGrnTask.java&lt;br /&gt;</description><link>https://svn.smartdukaan.com/revision.php?repname=SmartDukaan&amp;path=%2Ftrunk%2Fprofitmandi-cron%2Fsrc%2Fmain%2Fjava%2Fcom%2Fsmartdukaan%2Fcron%2Fmigrations%2FInternalGrnTask.java&amp;rev=37614&amp;peg=37614</link><guid>https://svn.smartdukaan.com/revision.php?repname=SmartDukaan&amp;path=%2Ftrunk%2Fprofitmandi-cron%2Fsrc%2Fmain%2Fjava%2Fcom%2Fsmartdukaan%2Fcron%2Fmigrations%2FInternalGrnTask.java&amp;rev=37614&amp;peg=37614</guid></item>
<item><pubDate>Mon, 14 Sep 2026 03:20:42 +0530</pubDate><dc:creator>amit</dc:creator><title>Rev 37613 – Receive internal transfer stock that was billed but never GRNed ...</title><description>&lt;div&gt;&lt;strong&gt;amit – 2 file(s) modified&lt;/strong&gt;&lt;br/&gt;Receive internal transfer stock that was billed but never GRNed&lt;br /&gt;
&lt;br /&gt;
Stock moved between our own warehouses is dispatched against an internal purchase order and&lt;br /&gt;
billed, but the destination warehouse still has to receive it by hand through the portal. Where&lt;br /&gt;
that never happened the units exist on an invoice and nowhere in inventory, and there is no way&lt;br /&gt;
to clear a backlog of them short of keying each invoice in again.&lt;br /&gt;
&lt;br /&gt;
This adds a cron one-off that receives them. Per invoice it builds the rows the Excel GRN upload&lt;br /&gt;
would have carried and hands them to PurchaseOrderService.addPORowModels, which creates the&lt;br /&gt;
supplier invoice, the purchase and the inventory items in a single call, so none of receiving is&lt;br /&gt;
reimplemented here - the portal and this take the same path and can only ever agree.&lt;br /&gt;
&lt;br /&gt;
It is deliberately narrow about what it will touch. Only INTERNAL buyers, because nothing should&lt;br /&gt;
be able to receive a partner&apos;s goods on their behalf. Only invoices with no supplier invoice&lt;br /&gt;
already recorded, so a repeat run skips what it has already done rather than receiving twice.&lt;br /&gt;
Only invoices resolving to a single purchase order, since addPORowModels resolves one order for&lt;br /&gt;
the whole map it is given and would otherwise attribute an invoice to the wrong one - for the&lt;br /&gt;
same reason each invoice is passed on its own. A serialized line whose serial number is missing&lt;br /&gt;
aborts its invoice instead of creating a unit no scan could ever match.&lt;br /&gt;
&lt;br /&gt;
Each invoice commits or rolls back on its own, so one bad invoice cannot undo the ones already&lt;br /&gt;
received, and a dry run reports what it would receive without writing anything.&lt;br /&gt;
&lt;br /&gt;
The receipt is recorded against the destination warehouse, which is what warehouse inventory is&lt;br /&gt;
keyed by. The buyer on the order is read only to confirm the store is internal; partner side&lt;br /&gt;
inventory is a separate receipt and is not touched.&lt;/div&gt;~ /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/Application.java&lt;br /&gt;+ /trunk/profitmandi-cron/src/main/java/com/smartdukaan/cron/migrations/InternalGrnTask.java&lt;br /&gt;</description><link>https://svn.smartdukaan.com/revision.php?repname=SmartDukaan&amp;path=%2Ftrunk%2Fprofitmandi-cron%2Fsrc%2Fmain%2Fjava%2Fcom%2Fsmartdukaan%2Fcron%2Fmigrations%2FInternalGrnTask.java&amp;rev=37613&amp;peg=37614</link><guid>https://svn.smartdukaan.com/revision.php?repname=SmartDukaan&amp;path=%2Ftrunk%2Fprofitmandi-cron%2Fsrc%2Fmain%2Fjava%2Fcom%2Fsmartdukaan%2Fcron%2Fmigrations%2FInternalGrnTask.java&amp;rev=37613&amp;peg=37614</guid></item>
</channel></rss>