cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot add Serial/Batch Numbers when i update the Pick List quanity

Former Member
0 Kudos

This is the code when i update the pick list with the quantity.

In this case when i update the exact serial number for the particular pick number this code works.Suppose the client need to change the another serial number this code doesn't work.

Please what are the things that i need to change to update the serial numbers for the pick list.

XmlNodeList elemList = xmlDocument.SelectNodes("PickList/LineNum");

                oPickList.GetByKey(PickListNo);

                int x = 0;

                foreach (XmlNode ele in elemList)

                {

                    XmlAttribute lID = ele.Attributes["LineNum"];

                    if (lID != null)

                    {

                        lineNumber = lID.Value;

                    }

                    oPickList.Lines.SetCurrentLine(Convert.ToInt32(lineNumber));

                    oPickList.Lines.PickedQuantity += Convert.ToDouble(ele.SelectSingleNode("QTP").InnerText);

                    oPickList.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = x;

                    oPickList.Lines.BinAllocations.BinAbsEntry = Convert.ToInt32(ele.SelectSingleNode("BinLocation").InnerText.ToString());

                    oPickList.Lines.BinAllocations.Quantity = Convert.ToDouble(ele.SelectSingleNode("QTP").InnerText);

                    oPickList.Lines.BinAllocations.Add();

                    oPickList.Lines.SerialNumbers.SetCurrentLine(x);

                    oPickList.Lines.SerialNumbers.InternalSerialNumber = ele.SelectSingleNode("ScanSerialNumber").InnerText.ToString();

                    oPickList.Lines.SerialNumbers.Quantity = Convert.ToDouble(ele.SelectSingleNode("QTP").InnerText);

                    oPickList.Lines.SerialNumbers.Add();   

                    x++;

                }

                oPickList.Update();

                ((SAPbobsCOM.Company)HttpContext.Current.Cache[sid]).GetLastError(out iErrorCode, out sErrMsg);

                System.Runtime.InteropServices.Marshal.ReleaseComObject(oPickList);

                oPickList = null;

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Karthik,

The loop has at least a miss when IID == null.

Besides this, easiest would be to empty fully the BatchNumbers list and to reconstruct it entirely...

Regards,

Eric