Syntax to get to inventory MinSOH, Safety Min, Safety max  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Re: Syntax to get to inventory MinSOH, Safety Min, Safety ma

Postby SBarnes » Wed Feb 24, 2021 5:53 pm

At a quick guess call read on order levels first.

Which Mike has just confirmed.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Syntax to get to inventory MinSOH, Safety Min, Safety ma

Postby DannyC » Thu Feb 25, 2021 2:20 pm

Nearly there (I hope) but orderLevel is still null. The only difference I can see is that you've supplied VB and I've done it in as C#.

Here's my code
Code: Select all
   private void Check_MinSOH(JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrderLine item)
   {
      System.Diagnostics.Debugger.Launch();
        JiwaFinancials.Jiwa.JiwaApplication.Manager manager = item.Manager;
        JiwaFinancials.Jiwa.JiwaInventory.Inventory inventory = manager.BusinessLogicFactory.CreateBusinessLogic<JiwaFinancials.Jiwa.JiwaInventory.Inventory>(null);
      inventory.Read(item.InventoryID);

      foreach(JiwaFinancials.Jiwa.JiwaInventory.Month month in inventory.Months)
      {
         if (month.Index == System.DateTime.Now.Month)
         {
            foreach (JiwaFinancials.Jiwa.JiwaApplication.Inventory.Warehouse.PhysicalWarehouse phys in item.Manager.PhysicalWarehouseCollection)
            {
               foreach (JiwaFinancials.Jiwa.JiwaApplication.Inventory.Warehouse.LogicalWarehouse loglwarehouse in phys.LogicalWarehouseCollection)
               {
                  if (loglwarehouse.IN_LogicalID == item.SalesOrderLines.SalesOrder.LogicalWarehouseResidingIn.IN_LogicalID)
                  {
                     JiwaFinancials.Jiwa.JiwaInventory.OrderLevel orderLevel = inventory.OrderLevels.RetrieveOrderLevel(month, loglwarehouse);
                     MessageBox.Show(orderLevel.MinSOHUnits.ToString());
                  }
               }
            }
         }
      }
   }


null orderlevel.png
User avatar
DannyC
Senpai
Senpai
 
Posts: 635
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 29

Re: Syntax to get to inventory MinSOH, Safety Min, Safety ma  Topic is solved

Postby SBarnes » Thu Feb 25, 2021 2:36 pm

Try this change, as Mike said the values need to be read into order levels

Code: Select all

 private void Check_MinSOH(JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrderLine item)
   {
      System.Diagnostics.Debugger.Launch();
        JiwaFinancials.Jiwa.JiwaApplication.Manager manager = item.Manager;
        JiwaFinancials.Jiwa.JiwaInventory.Inventory inventory = manager.BusinessLogicFactory.CreateBusinessLogic<JiwaFinancials.Jiwa.JiwaInventory.Inventory>(null);
      inventory.Read(item.InventoryID);
     inventory.OrderLevels.Read(); ///*****************Line Added*********************************
      foreach(JiwaFinancials.Jiwa.JiwaInventory.Month month in inventory.Months)
      {
         if (month.Index == System.DateTime.Now.Month)
         {
            foreach (JiwaFinancials.Jiwa.JiwaApplication.Inventory.Warehouse.PhysicalWarehouse phys in item.Manager.PhysicalWarehouseCollection)
            {
               foreach (JiwaFinancials.Jiwa.JiwaApplication.Inventory.Warehouse.LogicalWarehouse loglwarehouse in phys.LogicalWarehouseCollection)
               {
                  if (loglwarehouse.IN_LogicalID == item.SalesOrderLines.SalesOrder.LogicalWarehouseResidingIn.IN_LogicalID)
                  {
                     JiwaFinancials.Jiwa.JiwaInventory.OrderLevel orderLevel = inventory.OrderLevels.RetrieveOrderLevel(month, loglwarehouse);
                     MessageBox.Show(orderLevel.MinSOHUnits.ToString());
                  }
               }
            }
         }
      }
   }

Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Syntax to get to inventory MinSOH, Safety Min, Safety ma

Postby DannyC » Thu Feb 25, 2021 2:43 pm

YES! :D
User avatar
DannyC
Senpai
Senpai
 
Posts: 635
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 29

Re: Syntax to get to inventory MinSOH, Safety Min, Safety ma

Postby Mike.Sheen » Thu Feb 25, 2021 3:24 pm

/me grumbles :/
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755

Re: Syntax to get to inventory MinSOH, Safety Min, Safety ma

Postby DannyC » Fri Feb 26, 2021 4:53 pm

/me grumbles :/


In my defense I didn't know why or where I should use Inventory.OrderLevels.Read().
To my thinking, RetrieveOrderLevel(month, inventorywhouse) would be reading the values so it didn't occur to me I'd need to read twice using different code. Well, to me it's reading twice anyway :)
User avatar
DannyC
Senpai
Senpai
 
Posts: 635
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 29

Re: Syntax to get to inventory MinSOH, Safety Min, Safety ma

Postby SBarnes » Fri Feb 26, 2021 4:59 pm

Don't feel too bad Mike when I look back at the post we both said call read on the order level guess he missed it from both of us /me grumbles too :/ :lol:

The reason the order level doesn't read by default unless you need the data for the tab there is no point in answering a question no one is asking and slow the screen down by loading unnecessary data.

This quite common on all the business objects.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Previous

Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 3 guests

cron