示例#1
0
        public IList <Entities.Master.Unit> GetAllUnits()
        {
            Unit         tmpData;
            IList <Unit> list = new List <Unit>();

            try
            {
                Command.Connection = new SqlConnection(CurCompany.ErpConnection.CnnString);

                Query = "SELECT Code, descript, 1 factor " +
                        " FROM MEASURE WHERE code = 'EA' ";

                ds = ReturnDataSet(Query, null, "MEASURE", Command.Connection);

                if (ds == null || ds.Tables.Count == 0)
                {
                    return(null);
                }

                //En el dataset, Tables: 1 - UOFM
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    //Solo para unidades equivalentes en unidad base
                    //if (Double.Parse(dr["factor"].ToString(), ListValues.DoubleFormat()) > 0)
                    //{
                    //Map Properties
                    tmpData = new Unit();

                    tmpData.Company      = CurCompany; // WType.GetDefaultCompany();
                    tmpData.Name         = dr["descript"].ToString();
                    tmpData.ErpCode      = dr["Code"].ToString();
                    tmpData.ErpCodeGroup = WmsSetupValues.DEFAULT;
                    tmpData.BaseAmount   = double.Parse(dr["factor"].ToString(), ListValues.DoubleFormat());
                    tmpData.IsFromErp    = true;
                    list.Add(tmpData);
                    //}
                }

                return(list);
            }
            catch (Exception ex)
            {
                ExceptionMngr.WriteEvent("GetUnits", ListValues.EventType.Error, ex, null,
                                         ListValues.ErrorCategory.ErpConnection);
                //throw;
                return(null);
            }
        }
示例#2
0
        //UNITS
        /// <summary>
        /// Get Unit from Dynamics GP
        /// </summary>
        /// <returns></returns>
        public IList <Unit> GetAllUnits()
        {
            Unit         tmpData;
            IList <Unit> list = new List <Unit>();

            try
            {
                ds = DynamicsGP_ec.GetDataSet(DynamicsGP_ec.RetreiveData("WSUofMSchedule", false, 2, 0, "", true)); //WSUofMSchedule

                if (ds.Tables.Count == 0)
                {
                    return(null);
                }


                //En el dataset, Tables: 1 - UOFM
                foreach (DataRow dr in ds.Tables[2].Rows)
                {
                    //Solo para unidades equivalentes en unidad base
                    if (Double.Parse(dr["QTYBSUOM"].ToString(), ListValues.DoubleFormat()) > 0)
                    {
                        //Map Properties
                        tmpData = new Unit();

                        tmpData.Company      = CurCompany; // WType.GetDefaultCompany();
                        tmpData.Name         = dr["UOFM"].ToString();
                        tmpData.ErpCode      = dr["UOFM"].ToString();
                        tmpData.ErpCodeGroup = dr["UOMSCHDL"].ToString();
                        tmpData.BaseAmount   = double.Parse(dr["QTYBSUOM"].ToString(), ListValues.DoubleFormat());
                        tmpData.IsFromErp    = true;
                        list.Add(tmpData);
                    }
                }

                return(list);
            }
            catch (Exception ex)
            {
                ExceptionMngr.WriteEvent("GetUnits", ListValues.EventType.Error, ex, null,
                                         ListValues.ErrorCategory.ErpConnection);
                //throw;
                return(null);
            }
        }
示例#3
0
        /// <summary>
        /// Obtiene current qty de unidad basica o logistica
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public Double SelectCurrentQty(Label data, Product product, bool includeLabeled)
        {
            //Dice si se debeincluir tambien en el inventario el producto marcado.

            StringBuilder sql = new StringBuilder("select Sum(l.CurrQty*l.Unit.BaseAmount) from Label l Where l.Status.StatusID = :id4 and l.Node.NodeID = :nd0 ");

            Parms = new List <Object[]>();

            if (data.Bin != null && data.Bin.BinID != 0 && data.LabelType.DocTypeID == LabelType.BinLocation)
            {
                sql.Append(" and l.Bin.BinID = :id2 ");
                Parms.Add(new Object[] { "id2", data.Bin.BinID });

                if (!includeLabeled)
                {                                         //Solo cuenta lo que este UnLabeled en el BIN
                    sql.Append(" and l.Printed = :fl1 "); //FatherLabel.LabelID is null
                    Parms.Add(new Object[] { "fl1", false });
                }
            }
            else if (data.LabelID != 0 && (data.LabelType.DocTypeID == LabelType.ProductLabel || data.LabelType.DocTypeID == LabelType.UniqueTrackLabel))
            {
                sql.Append(" and (l.LabelID = :id1 OR l.FatherLabel.LabelID = :id1)");
                Parms.Add(new Object[] { "id1", data.LabelID });
            }

            if (product != null && product.ProductID != 0)
            {
                sql.Append(" and  l.Product.ProductID = :id3 ");
                Parms.Add(new Object[] { "id3", product.ProductID });
            }

            Parms.Add(new Object[] { "id4", EntityStatus.Active });
            Parms.Add(new Object[] { "nd0", NodeType.Stored });

            IQuery query = Factory.Session.CreateQuery(sql.ToString());

            SetParameters(query);

            try { return(Double.Parse(query.UniqueResult().ToString(), ListValues.DoubleFormat())); }
            catch { return(0); }
        }
示例#4
0
        private IList <DocumentLine> GetKitAssemblyDocumentLines(Document doc)
        {
            DocumentLine         tmpData;
            IList <DocumentLine> list = new List <DocumentLine>();
            Status lineStatus         = WType.GetStatus(new Status {
                StatusID = DocStatus.New
            });


            int    curLine   = 1;
            string curMaster = "";


            Query = GetErpQuery("KITDOC_LINE").Replace("__DOCUMENT", doc.ErpMaster.ToString());

            DataSet ds = ReturnDataSet(Query, null, "KITDOC_LINE", Command.Connection);

            if (ds == null || ds.Tables.Count == 0)
            {
                return(null);
            }


            if (ds.Tables[0].Select("rowid=0").Length == 0)
            {
                return(null);
            }

            try
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    tmpData       = new DocumentLine();
                    tmpData.Date1 = doc.Date1;

                    tmpData.LineNumber        = int.Parse(dr["rowid"].ToString()); //curLine++;
                    tmpData.Sequence          = tmpData.LineNumber;
                    tmpData.LinkDocLineNumber = int.Parse(dr["row_padre"].ToString());
                    tmpData.Note = dr["type"].ToString();

                    //TODO: Revisar el Status en GP para traer el equivalente
                    tmpData.LineStatus   = lineStatus;
                    tmpData.Document     = doc;
                    tmpData.IsDebit      = false;
                    tmpData.Quantity     = double.Parse(dr["f470_cant_base"].ToString(), ListValues.DoubleFormat());
                    tmpData.CreatedBy    = WmsSetupValues.SystemUser;
                    tmpData.CreationDate = DateTime.Now;

                    curMaster        = "Location";
                    tmpData.Location = doc.Location; //WType.GetLocation(new Location { Company = CurCompany, ErpCode = dr["LOCNCODE"].ToString() });

                    try
                    {
                        curMaster       = "Product";
                        tmpData.Product = WType.GetProduct(new Product {
                            Company = CurCompany, ProductCode = dr["item_id"].ToString()
                        });;

                        curMaster    = "Unit";
                        tmpData.Unit = WType.GetUnit(new Unit {
                            ErpCode = dr["unit_id"].ToString(), ErpCodeGroup = tmpData.Product.BaseUnit.ErpCodeGroup
                        });
                    }
                    catch (Exception ex)
                    {
                        ExceptionMngr.WriteEvent("GetKitAssemblyDocumentLines: " + doc.DocNumber + "," + curLine.ToString() + "," + curMaster,
                                                 ListValues.EventType.Error, ex, null, ListValues.ErrorCategory.ErpConnection);
                        continue;
                        //{
                        //    //Pone el Default Product
                        //    tmpData.Product = WType.GetProduct(new Product { Company = CurCompany, ProductCode = WmsSetupValues.DEFAULT });
                        //    tmpData.LineDescription = "Unknown: " + dr["ITEMNMBR"].ToString() + ", " + dr["ITEMDESC"].ToString();

                        //    curMaster = "Unit";
                        //    tmpData.Unit = WType.GetUnit(new Unit { ErpCode = dr["UOFM"].ToString() });
                    }

                    list.Add(tmpData);
                }

                return((list.Count > 0) ? list : null);
            }
            catch (Exception ex)
            {
                ExceptionMngr.WriteEvent("GetKitAssemblyDocumentLines: " + doc.DocNumber + "," + curLine.ToString() + "," + curMaster,
                                         ListValues.EventType.Error, ex, null, ListValues.ErrorCategory.ErpConnection);
                throw;
                //return null;
            }
        }
示例#5
0
        private IList <DocumentLine> GetPurchaseReturnsLines(Document doc, DataRow[] dLines, DataTable dtQty)
        {
            DocumentLine         tmpData;
            IList <DocumentLine> list = new List <DocumentLine>();
            Status lineStatus         = WType.GetStatus(new Status {
                StatusID = DocStatus.New
            });


            int    curLine   = 0;
            string curMaster = "";

            DataRow[] qtyReceipt;

            try
            {
                foreach (DataRow dr in dLines)
                {
                    tmpData       = new DocumentLine();
                    tmpData.Date1 = doc.Date1;
                    curMaster     = "";


                    tmpData.LineNumber = int.Parse(dr["RCPTLNNM"].ToString());
                    tmpData.Sequence   = tmpData.LineNumber;
                    curLine            = tmpData.LineNumber;

                    try
                    {
                        qtyReceipt = dtQty.Select("RCPTLNNM = '" + dr["RCPTLNNM"].ToString() + "' AND POPRCTNM='" + dr["POPRCTNM"].ToString() + "'");

                        //Console.WriteLine("RCPTLNNM = " + dr["RCPTLNNM"].ToString() + " AND POPRCTNM='" + dr["POPRCTNM"].ToString() + "'" + qtyReceipt.Length.ToString());

                        tmpData.Quantity = double.Parse(qtyReceipt[0]["QTYRESERVED"].ToString(), ListValues.DoubleFormat());
                    }
                    catch (Exception ez) {
                        ExceptionMngr.WriteEvent("QTYRESERVED: " + dr["POPRCTNM"].ToString() + "," + dr["RCPTLNNM"].ToString(),
                                                 ListValues.EventType.Error, ez, null, ListValues.ErrorCategory.ErpConnection);

                        tmpData.Quantity = 0;
                    }


                    //TODO: Revisar el Status en GP para traer el equivalente
                    tmpData.LineStatus   = GetShippingStatus(0);
                    tmpData.Document     = doc;
                    tmpData.IsDebit      = false;
                    tmpData.CreatedBy    = WmsSetupValues.SystemUser;
                    tmpData.CreationDate = DateTime.Now;

                    curMaster        = "Location:" + dr["LOCNCODE"].ToString();
                    tmpData.Location = WType.GetLocation(new Location {
                        Company = CurCompany, ErpCode = dr["LOCNCODE"].ToString()
                    });

                    try
                    {
                        curMaster       = "Product:" + dr["ITEMNMBR"].ToString();
                        tmpData.Product = WType.GetProduct(new Product {
                            Company = CurCompany, ProductCode = dr["ITEMNMBR"].ToString()
                        });;
                        tmpData.LineDescription = dr["ITEMDESC"].ToString();

                        curMaster    = "Uom:" + dr["UOFM"].ToString();
                        tmpData.Unit = WType.GetUnit(new Unit {
                            ErpCode = dr["UOFM"].ToString(), ErpCodeGroup = tmpData.Product.BaseUnit.ErpCodeGroup
                        });
                    }
                    catch (Exception ex)
                    {
                        ExceptionMngr.WriteEvent("GetPurchaseReturnsLines: " + doc.DocNumber + "," + curLine.ToString() + "," + curMaster,
                                                 ListValues.EventType.Error, ex, null, ListValues.ErrorCategory.ErpConnection);
                        continue;

                        //{
                        //    //Pone el Default Product
                        //    tmpData.Product = WType.GetProduct(new Product { Company = CurCompany, ProductCode = WmsSetupValues.DEFAULT });
                        //    tmpData.LineDescription = "Unknown: " + dr["ITEMNMBR"].ToString() + ", " + dr["ITEMDESC"].ToString();

                        //    curMaster = "Uom:" + dr["UOFM"].ToString();
                        //    tmpData.Unit = WType.GetUnit(new Unit { ErpCode = dr["UOFM"].ToString() });
                    }



                    //Manage Prices
                    tmpData.UnitPrice     = double.Parse(dr["UNITCOST"].ToString(), ListValues.DoubleFormat());
                    tmpData.ExtendedPrice = double.Parse(dr["EXTDCOST"].ToString(), ListValues.DoubleFormat());

                    //Asignacion de Address
                    //tmpData.DocumentLineAddresses = GetShippingDocumentAddress(tmpData.Document, tmpData, dr);

                    list.Add(tmpData);
                }

                return((list.Count > 0) ? list : null);
            }
            catch (Exception ex)
            {
                ExceptionMngr.WriteEvent("GetPurchaseReturnsLines: " + doc.DocNumber + "," + curLine.ToString() + "," + curMaster,
                                         ListValues.EventType.Error, ex, null, ListValues.ErrorCategory.ErpConnection);
                //throw;
                return(null);
            }
        }
示例#6
0
        private IList <DocumentLine> GetReceivingDocumentLines(Document doc, Company company, DataRow[] dLines)
        {
            DocumentLine         tmpData;
            IList <DocumentLine> list = new List <DocumentLine>();
            //Status lineStatus = WType.GetStatus(new Status { StatusID = DocStatus.New });

            int    curLine   = 0;
            string curMaster = "";

            try
            {
                foreach (DataRow dr in dLines)
                {
                    tmpData       = new DocumentLine();
                    tmpData.Date1 = doc.Date1;
                    curMaster     = "";

                    tmpData.Date2       = DateTime.Parse(dr["REQDATE"].ToString());
                    tmpData.Date3       = DateTime.Parse(dr["PRMSHPDTE"].ToString());
                    tmpData.Date4       = DateTime.Parse(dr["PRMDATE"].ToString());
                    tmpData.LineNumber  = int.Parse(dr["ORD"].ToString());
                    tmpData.AccountItem = dr["VNDITNUM"].ToString();
                    tmpData.Sequence    = tmpData.LineNumber;

                    curLine              = tmpData.LineNumber;
                    tmpData.Document     = doc;
                    tmpData.IsDebit      = false;
                    tmpData.Quantity     = double.Parse(dr["QTYORDER"].ToString(), ListValues.DoubleFormat());
                    tmpData.QtyCancel    = double.Parse(dr["QTYCANCE"].ToString(), ListValues.DoubleFormat());
                    tmpData.QtyPending   = double.Parse(dr["QTYUNCMTBASE"].ToString(), ListValues.DoubleFormat());
                    tmpData.CreatedBy    = WmsSetupValues.SystemUser;
                    tmpData.CreationDate = DateTime.Now;

                    curMaster          = "Status:" + dr["POLNESTA"].ToString();
                    tmpData.LineStatus = GetReceivingStatus(int.Parse(dr["POLNESTA"].ToString())); //doc.DocStatus;
                    curMaster          = "Location:" + dr["LOCNCODE"].ToString();
                    tmpData.Location   = WType.GetLocation(new Location {
                        Company = company, ErpCode = dr["LOCNCODE"].ToString()
                    });

                    try
                    {
                        curMaster       = "Product:" + dr["ITEMNMBR"].ToString();
                        tmpData.Product = WType.GetProduct(new Product {
                            Company = company, ProductCode = dr["ITEMNMBR"].ToString()
                        });
                        tmpData.LineDescription = dr["ITEMDESC"].ToString();

                        curMaster    = "Uom:" + dr["UOFM"].ToString();
                        tmpData.Unit = WType.GetUnit(new Unit {
                            ErpCode = dr["UOFM"].ToString(), ErpCodeGroup = tmpData.Product.BaseUnit.ErpCodeGroup
                        });
                    }
                    catch (Exception ex)
                    {
                        ExceptionMngr.WriteEvent("GetReceiptDocumentLines: " + doc.DocNumber + "," + curLine.ToString() + "," + curMaster,
                                                 ListValues.EventType.Error, ex, null, ListValues.ErrorCategory.ErpConnection);
                        continue;

                        //    //Pone el Default Product
                        //    tmpData.Product = WType.GetProduct(new Product { Company = company, ProductCode = WmsSetupValues.DEFAULT });
                        //    tmpData.LineDescription = "Unknown: " + dr["ITEMNMBR"].ToString() + ", " + dr["ITEMDESC"].ToString();

                        //    curMaster = "Uom:" + dr["UOFM"].ToString();
                        //    tmpData.Unit = WType.GetUnit(new Unit { ErpCode = dr["UOFM"].ToString() });
                    }

                    //Unit - Price, Cost
                    tmpData.UnitCost     = double.Parse(dr["UNITCOST"].ToString(), ListValues.DoubleFormat());
                    tmpData.ExtendedCost = double.Parse(dr["EXTDCOST"].ToString(), ListValues.DoubleFormat());

                    //SOP POP Link
                    object[] sop_popLink = GetSOP_POPLink(doc.DocNumber, tmpData.LineNumber, doc.DocType.DocTypeID);
                    if (sop_popLink != null)
                    {
                        tmpData.LinkDocNumber     = sop_popLink[0].ToString();
                        tmpData.LinkDocLineNumber = int.Parse(sop_popLink[1].ToString());
                    }


                    list.Add(tmpData);
                }

                return((list.Count > 0) ? list : null);
            }
            catch (Exception ex)
            {
                ExceptionMngr.WriteEvent("GetReceiptDocumentLines: " + doc.DocNumber + "," + curLine.ToString() + "," + curMaster,
                                         ListValues.EventType.Error, ex, null, ListValues.ErrorCategory.ErpConnection);
                //throw;
                return(null);
            }
        }
        private IList <DocumentLine> GetShippingDocumentLines(Document doc, Company company, string docID, bool useRemain)
        {
            DocumentLine         tmpData;
            IList <DocumentLine> list = new List <DocumentLine>();
            Status lineStatus         = WType.GetStatus(new Status {
                StatusID = DocStatus.New
            });


            int    curLine   = 0;
            string curMaster = "";


            try
            {
                Query = GetErpQuery("SALESORDER_LINE").Replace("__DOCUMENT", docID);

                DataSet ds = ReturnDataSet(Query, null, "SALESORDER_LINE", Command.Connection);

                if (ds == null || ds.Tables.Count == 0)
                {
                    return(null);
                }



                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    tmpData       = new DocumentLine();
                    tmpData.Date1 = doc.Date1;
                    curMaster     = "";

                    try { tmpData.Date2 = DateTime.Parse(dr["f431_fecha_entrega"].ToString()); }
                    catch { }
                    try { tmpData.Date3 = DateTime.Parse(dr["f431_fecha_cumplido"].ToString()); }
                    catch { }

                    tmpData.LineNumber = int.Parse(dr["f431_rowid"].ToString());
                    tmpData.Sequence   = tmpData.LineNumber;
                    curLine            = tmpData.LineNumber;

                    //TODO: Revisar el Status en GP para traer el equivalente
                    tmpData.LineStatus = GetShippingStatus(0);
                    tmpData.Document   = doc;
                    tmpData.IsDebit    = false;

                    if (useRemain)
                    {
                        tmpData.Quantity = double.Parse(dr["f431_cant_facturada_base"].ToString(), new NumberFormatInfo {
                            NumberDecimalSeparator = Separator
                        });
                    }
                    else
                    {
                        tmpData.Quantity = double.Parse(dr["f431_cant_facturada_base"].ToString(), ListValues.DoubleFormat());
                    }

                    //tmpData.QtyCancel = double.Parse(dr["QTYCANCE"].ToString(), ListValues.DoubleFormat());
                    //tmpData.QtyBackOrder = double.Parse(dr["QTYTBAOR"].ToString(), ListValues.DoubleFormat());
                    //tmpData.QtyPending = tmpData.Quantity - tmpData.QtyCancel - double.Parse(dr["QTYPRINV"].ToString(), ListValues.DoubleFormat());
                    //tmpData.QtyAllocated = double.Parse(dr["ATYALLOC"].ToString(), ListValues.DoubleFormat());
                    tmpData.CreatedBy    = WmsSetupValues.SystemUser;
                    tmpData.CreationDate = DateTime.Now;

                    curMaster        = "Location:" + dr["cod_bodega"].ToString();
                    tmpData.Location = WType.GetLocation(new Location {
                        Company = company, ErpCode = dr["cod_bodega"].ToString()
                    });

                    try
                    {
                        curMaster       = "Product:" + dr["f121_rowid_item"].ToString();
                        tmpData.Product = WType.GetProduct(new Product {
                            Company = company, ProductCode = dr["f121_rowid_item"].ToString()
                        });
                        tmpData.LineDescription = dr["f120_descripcion"].ToString();

                        curMaster    = "Uom:" + dr["f431_id_unidad_medida"].ToString();
                        tmpData.Unit = WType.GetUnit(new Unit {
                            ErpCode = dr["f431_id_unidad_medida"].ToString(), ErpCodeGroup = tmpData.Product.BaseUnit.ErpCodeGroup
                        });
                    }
                    catch
                    {
                        //Pone el Default Product
                        tmpData.Product = WType.GetProduct(new Product {
                            Company = doc.Location.Company, ProductCode = WmsSetupValues.DEFAULT
                        });
                        tmpData.LineDescription = "Unknown: " + dr["f121_rowid_item"].ToString() + ", " + dr["f120_descripcion"].ToString();

                        curMaster    = "Uom:" + dr["f431_id_unidad_medida"].ToString();
                        tmpData.Unit = WType.GetUnit(new Unit {
                            ErpCode = dr["f431_id_unidad_medida"].ToString()
                        });
                    }

                    //Manage Prices
                    curMaster             = "Prices Product:" + dr["f121_rowid_item"].ToString();
                    tmpData.UnitPrice     = double.Parse(dr["f431_precio_unitario_base"].ToString(), ListValues.DoubleFormat());
                    tmpData.ExtendedPrice = double.Parse(dr["subtotal"].ToString(), ListValues.DoubleFormat());

                    //Asignacion de Address
                    curMaster = "Address Doc:" + doc.DocNumber;
                    //tmpData.DocumentLineAddresses = GetShippingDocumentAddress(tmpData.Document, tmpData, dr);


                    list.Add(tmpData);
                }

                return((list.Count > 0) ? list : null);
            }
            catch (Exception ex)
            {
                ExceptionMngr.WriteEvent("GetShippingDocumentLines: " + doc.DocNumber + "," + curLine.ToString() + "," + curMaster,
                                         ListValues.EventType.Error, ex, null, ListValues.ErrorCategory.ErpConnection);
                //throw;
                return(null);
            }
        }
示例#8
0
        private IList <DocumentLine> GetKitAssemblyDocumentLines(Document doc)
        {
            DocumentLine         tmpData;
            IList <DocumentLine> list = new List <DocumentLine>();
            Status lineStatus         = WType.GetStatus(new Status {
                StatusID = DocStatus.New
            });


            int    curLine   = 1;
            string curMaster = "";

            // BM10300 - KitAssembly Document Lines
            DataSet ds = ReturnDataSet("SELECT * FROM BM10300 WHERE 1=1 ", "TRX_ID='" + doc.DocNumber + "'", "BM10300", Command.Connection);


            if (ds == null || ds.Tables.Count == 0)
            {
                return(null);
            }


            try
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    tmpData       = new DocumentLine();
                    tmpData.Date1 = doc.Date1;

                    tmpData.LineNumber        = int.Parse(dr["Component_ID"].ToString()); //curLine++;
                    tmpData.Sequence          = tmpData.LineNumber;
                    tmpData.LinkDocLineNumber = int.Parse(dr["Parent_Component_ID"].ToString());
                    tmpData.Note = dr["BM_Component_Type"].ToString();

                    //TODO: Revisar el Status en GP para traer el equivalente
                    tmpData.LineStatus   = lineStatus;
                    tmpData.Document     = doc;
                    tmpData.IsDebit      = false;
                    tmpData.Quantity     = double.Parse(dr["Extended_Standard_Quantity"].ToString(), ListValues.DoubleFormat());
                    tmpData.CreatedBy    = WmsSetupValues.SystemUser;
                    tmpData.CreationDate = DateTime.Now;

                    curMaster        = "Location";
                    tmpData.Location = WType.GetLocation(new Location {
                        Company = CurCompany, ErpCode = dr["LOCNCODE"].ToString()
                    });

                    try
                    {
                        curMaster       = "Product";
                        tmpData.Product = WType.GetProduct(new Product {
                            Company = CurCompany, ProductCode = dr["ITEMNMBR"].ToString()
                        });;

                        curMaster    = "Unit";
                        tmpData.Unit = WType.GetUnit(new Unit {
                            ErpCode = dr["UOFM"].ToString(), ErpCodeGroup = tmpData.Product.BaseUnit.ErpCodeGroup
                        });
                    }
                    catch (Exception ex)
                    {
                        ExceptionMngr.WriteEvent("GetKitAssemblyDocumentLines: " + doc.DocNumber + "," + curLine.ToString() + "," + curMaster,
                                                 ListValues.EventType.Error, ex, null, ListValues.ErrorCategory.ErpConnection);
                        continue;
                        //{
                        //    //Pone el Default Product
                        //    tmpData.Product = WType.GetProduct(new Product { Company = CurCompany, ProductCode = WmsSetupValues.DEFAULT });
                        //    tmpData.LineDescription = "Unknown: " + dr["ITEMNMBR"].ToString() + ", " + dr["ITEMDESC"].ToString();

                        //    curMaster = "Unit";
                        //    tmpData.Unit = WType.GetUnit(new Unit { ErpCode = dr["UOFM"].ToString() });
                    }

                    list.Add(tmpData);
                }

                return((list.Count > 0) ? list : null);
            }
            catch (Exception ex)
            {
                ExceptionMngr.WriteEvent("GetKitAssemblyDocumentLines: " + doc.DocNumber + "," + curLine.ToString() + "," + curMaster,
                                         ListValues.EventType.Error, ex, null, ListValues.ErrorCategory.ErpConnection);
                throw;
                //return null;
            }
        }