<?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 06:24:28 +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;</link><atom:link href="https://svn.smartdukaan.com/rss.php?path=%2Ftrunk%2Fprofitmandi-cron%2Fsrc%2Fmain%2Fjava%2Fcom%2Fsmartdukaan%2Fcron%2Fmigrations%2FInternalGrnTask.java&amp;repname=SmartDukaan" rel="self" type="application/rss+xml" />
<item><pubDate>Mon, 14 Sep 2026 05:37:03 +0530</pubDate><dc:creator>amit</dc:creator><title>Rev 37617 – Undo an internal GRN so its invoice can be received ...</title><description>&lt;div&gt;&lt;strong&gt;amit – 3 file(s) modified&lt;/strong&gt;&lt;br/&gt;Undo an internal GRN so its invoice can be received again&lt;br /&gt;
&lt;br /&gt;
A receipt taken before the serials were split left stock that cannot be corrected in place: a&lt;br /&gt;
serialised unit is held one to a row, so an invoice that should have created several rows created one,&lt;br /&gt;
and the rows that are missing cannot be added without also unpicking the running figures the receipt&lt;br /&gt;
moved. Reversing the receipt and taking it again through the same path is the only way to arrive at&lt;br /&gt;
what the invoice actually says.&lt;br /&gt;
&lt;br /&gt;
The reversal removes what receiving created - the scans, the inventory units, the invoice items, the&lt;br /&gt;
purchase and the supplier invoice - and gives back the two running figures it moved: the warehouse&lt;br /&gt;
availability, and the quantity taken off the purchase order line. Both are worked out from the rows&lt;br /&gt;
being deleted rather than recomputed, so whatever the receipt added is exactly what comes off. A&lt;br /&gt;
purchase order the receipt closed is opened again. Availability is kept only as a running count with&lt;br /&gt;
nothing to rebuild it from, which is why it is adjusted by what is known to have been added rather&lt;br /&gt;
than by anything inferred.&lt;br /&gt;
&lt;br /&gt;
An invoice whose stock has moved since is refused, not worked around. A unit that has been scanned out&lt;br /&gt;
or partly consumed is no longer the receipt&apos;s to remove, and deleting around it would leave the&lt;br /&gt;
warehouse holding stock that no record explains. Each invoice is reversed on its own so one refusal&lt;br /&gt;
leaves the rest untouched, and a dry run reports everything it would delete and every figure it would&lt;br /&gt;
change without writing.&lt;br /&gt;
&lt;br /&gt;
Invoices are named explicitly rather than selected by date, so a reversal can only ever touch what it&lt;br /&gt;
was given.&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/InternalGrnReverser.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=37617</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=37617</guid></item>
<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</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</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</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</guid></item>
</channel></rss>