But it's not the Default Bin, just a receiving bin.
Theres no Activated event, so I am using/tried the SaveStart and SaveEnd event and checking whether the bookin is being activated like this:
- Code: Select all
if (bookIn.Activated && !bookIn.OriginalActivated)
That's fine - it gets into the if codeblock on SaveStart.
The problem is, there's no LineDetails property or any other property I can find to set the bin, so instead I am just firing a SQL command
- Code: Select all
string Sql = @"UPDATE IN_SOH ";
Sql += "SET BinLocationDesc = 'MyReceivingBin' ";
Sql += "FROM SH_BookInLines INNER JOIN ";
Sql += "SH_BookInDetailLines ON SH_BookInLines.BookInLineID = SH_BookInDetailLines.Parent_RecID ";
Sql += "INNER JOIN IN_SOH ON SH_BookInDetailLines.IN_SOH_LinkID = IN_SOH.LinkID AND SH_BookInLines.BookInLineID = IN_SOH.SourceID ";
Sql += "INNER JOIN SH_BookInMain ON SH_BookInLines.BookInID = SH_BookInMain.BookInID ";
Sql += "WHERE SH_BookInMain.BookInID = @BookinID";
But when I check the SOH, the bin isn't getting written. The Default Bin is getting populated instead. I can run the exact same SQL in a sql query window and it will update, but I want it to update upon activation.
I am assuming that its not working on SaveStart because the IN_SOH lines wouldn't exist yet.
But on SaveEnd, the
- Code: Select all
if (bookIn.Activated && !bookIn.OriginalActivated)
How would I be able to populate the IN_SOH.BinLocationDesc with a value?