Scripting

  • 1.  Client wants to automatically allocate Lots in FIF

    Posted 05-24-2018 15:39
    Client wants to automatically allocate Lots in FIFO order by ReceiptDate, does anyone have any sample code that allocates Lots via scripting? Ideas? TIA


  • 2.  RE: Client wants to automatically allocate Lots in FIF

    Posted 05-24-2018 15:50
    Blytheco has a enhancement listed that is called Automatic Lot Distribution (SO-1270) if your client will consider an extended solution.


  • 3.  RE: Client wants to automatically allocate Lots in FIF

    Posted 05-24-2018 16:11
    Thank you @DavidSpeckII for your response. I don't see that they have any information online about that enhancement. Do you know if it can distribute based on ReceiptDate?


  • 4.  RE: Client wants to automatically allocate Lots in FIF

    Posted 05-24-2018 16:26
    I don't know much about it other than coming across it while looking at extended solutions a while back. Would be nice if they had more info posted.


  • 5.  RE: Client wants to automatically allocate Lots in FIF

    Posted 05-24-2018 16:31
    Now that i think about it, i can't remember which one i came across, just saw that DSD has one listed too (SO-1503). Says ""This DSD enhancement provides several options for automatically distributing Lot/Serial Numbers on Sales Order Invoices.


  • 6.  RE: Client wants to automatically allocate Lots in FIF

    Posted 05-24-2018 16:52
    Regarding your question about allocating Lots via scripting, you can try the following code but you will need to figure out how you are going to supply the lots but this should give you a foundation for distributing the lots via scripting. _______________ ```vb sValidItemTypes = """"""5"""",""""6"""""" sItemCode = """" : oBusObj.GetValue ""ItemCode$"", sItemCode nQuantityOrdered = 0 : oBusObj.GetValue ""QuantityOrdered"", nQuantityOrdered nQuantityShipped = 0 : oBusObj.GetValue ""QuantityShipped"", nQuantityShipped sItemValuation = """" : oBusObj.GetValue ""Valuation$"", sItemValuation If InStr(sValidItemTypes, """""""" & sItemValuation & """""""") > 0 Then nRetval = 0 : nRetval = oBusObj.SetValue(""QuantityShipped"", 0) nRetval = 0 : nRetval = oBusObj.SetValue(""QuantityShipped"", nQuantityOrdered) nLineDistributionBalance = 0 : nLineDistributionBalance = nQuantityOrdered nInvoiceLineDistributionBus = 0 : nInvoiceLineDistributionBus = oBusObj.Distribution If nInvoiceLineDistributionBus > 0 Then Set oInvoiceLineDistributionBus = oSession.AsObject(nInvoiceLineDistributionBus) nRetval = 0 : nRetval = oInvoiceLineDistributionBus.AddDistributionLine(""YourLotNumber"") nRetval = 0 : nRetval = oInvoiceLineDistributionBus.Write() nLineDistributionBalance = oInvoiceLineDistributionBus.Balance Set oInvoiceLineDistributionBus = Nothing End If If nLineDistributionBalance > 0 Then nRetval = 0 : nRetval = oBusObj.SetValue(""QuantityShipped"", 0) End If ``` _______________


  • 7.  RE: Client wants to automatically allocate Lots in FIF

    Posted 05-24-2018 17:01
      |   view attached
    $3,000 on perpetual / $750 main or $1,650 on subscription

    Attachment(s)

    pdf
    SO-1503.pdf   374 KB 1 version


  • 8.  RE: Client wants to automatically allocate Lots in FIF

    Posted 05-24-2018 17:32
    Thanks again @DavidSpeckII ! That's exactly what I needed. I'm going to give that a try!


  • 9.  RE: Client wants to automatically allocate Lots in FIF

    Posted 05-25-2018 05:41
    I re-purposed an example from Steve Malmgren using GetResultsSets to do something similar. Set oItmCost = oSession.AsObject(oSession.GetObject(""IM_ItemCost_svc"")) retVal = oScript.DebugPrint(strCostFilter) ' check Providex Trace window to see filter retVal = oItmCost.GetResultSets(""LotSerialNo$"", ""ReceiptDate$"", lotNums, receiptDates, strCostFilter, """", """", """", 1) arrLots = Split(lotNums, CHR(138) ) ' this splits out the values in the above GetResultSets() call ' into an array containing lot numbers arrDates = Split(receiptDates, CHR(138) ) ' the is the array of receipt dates. CHR(138) is the delimiter ' of fields coming back from GetResultSets numLots = UBound(arrLots)-1 ' UBound is VBScript function that returns number of elements in the array


  • 10.  RE: Client wants to automatically allocate Lots in FIF

    Posted 05-25-2018 14:15
    Thanks @MichaelNottoli, I keep those original sample scripts plus some from @AlnoorCassim in my top drawer, indexed and ready. It was the use of the distribution object and methods @DavidSpeckII revealed that I couldn't find.