Example #1
0
        public IList <Location> GetLocations(string sWhere)
        {
            Location         tmpData;
            IList <Location> list = new List <Location>();

            try
            {
                //Lamar los documents que necesita del Erp usando econnect
                ds = DynamicsGP_ec.GetDataSet(DynamicsGP_ec.RetreiveData("WSWarehouse", false, 2, 0, sWhere, true));

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


                Status status = WType.GetStatus(new Status {
                    StatusID = EntityStatus.Active
                });

                //En el dataset, Tables: 1 - Locations
                foreach (DataRow dr in ds.Tables[1].Rows)
                {
                    if (string.IsNullOrEmpty(dr["LOCNCODE"].ToString()))
                    {
                        continue;
                    }

                    //Map Properties
                    tmpData = new Location();

                    tmpData.Company      = CurCompany;
                    tmpData.ErpCode      = dr["LOCNCODE"].ToString();
                    tmpData.Name         = dr["LOCNDSCR"].ToString();
                    tmpData.AddressLine1 = dr["ADDRESS1"].ToString();
                    tmpData.AddressLine2 = dr["ADDRESS2"].ToString();
                    tmpData.AddressLine3 = dr["ADDRESS3"].ToString();
                    tmpData.City         = dr["CITY"].ToString();
                    tmpData.State        = dr["STATE"].ToString();
                    tmpData.ZipCode      = dr["ZIPCODE"].ToString();
                    tmpData.Phone1       = dr["PHONE1"].ToString();
                    tmpData.Phone2       = dr["PHONE2"].ToString();
                    tmpData.Phone3       = dr["FAXNUMBR"].ToString();
                    //tmpData.ContactPerson = dr[""].ToString();
                    tmpData.IsDefault = false;
                    tmpData.Status    = status;
                    tmpData.IsFromErp = true;

                    list.Add(tmpData);
                }

                return(list);
            }
            catch (Exception ex)
            {
                ExceptionMngr.WriteEvent("GetLocations", ListValues.EventType.Error, ex, null, ListValues.ErrorCategory.ErpConnection);
                //throw;
                return(null);
            }
        }
        private Status GetReceivingStatus(int GPStatus)
        {
            /*
             * 401	0	En elaboraciĆ³n
             * 401	1	Aprobado
             * 401	2	Parcial
             * 401	3	Cumplido
             * 401	9	Anulado
             */


            if (GPStatus == 3)
            {
                return(WType.GetStatus(new Status {
                    StatusID = DocStatus.Completed
                }));
            }
            else if (GPStatus == 9)
            {
                return(WType.GetStatus(new Status {
                    StatusID = DocStatus.Cancelled
                }));
            }
            else //es nueva (1,2,3)
            {
                return(WType.GetStatus(new Status {
                    StatusID = DocStatus.New
                }));
            }
        }
Example #3
0
 private Status GetReceivingStatus(int GPStatus)
 {
     if (GPStatus == 4 || GPStatus == 5)
     {
         return(WType.GetStatus(new Status {
             StatusID = DocStatus.Completed
         }));
     }
     else if (GPStatus == 6)
     {
         return(WType.GetStatus(new Status {
             StatusID = DocStatus.Cancelled
         }));
     }
     else //es nueva (1,2,3)
     {
         return(WType.GetStatus(new Status {
             StatusID = DocStatus.New
         }));
     }
 }
Example #4
0
        public IList <Location> GetLocations(string sWhere)
        {
            Location         tmpData;
            IList <Location> list = new List <Location>();

            try
            {
                Command.Connection = new SqlConnection(CurCompany.ErpConnection.CnnString);
                // CAA ?????
                Query = "select DEP_CODE,DESCRIPT,STREET_ADDRESS,CITY,STATE,ZIP,TEL1,TEL2,FAX " +
                        " from DEPART where ACTIVE ='T'";

                ds = ReturnDataSet(Query, sWhere, "DEPART", Command.Connection);

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


                Status status = WType.GetStatus(new Status {
                    StatusID = EntityStatus.Active
                });

                //En el dataset, Tables: 1 - Locations
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    //Map Properties
                    tmpData = new Location();

                    tmpData.Company      = CurCompany;
                    tmpData.ErpCode      = dr["DEP_CODE"].ToString();
                    tmpData.Name         = dr["DESCRIPT"].ToString();
                    tmpData.AddressLine1 = dr["STREET_ADDRESS"].ToString();
                    //tmpData.AddressLine2 = dr["ADDRESS2"].ToString();
                    //tmpData.AddressLine3 = dr["ADDRESS3"].ToString();
                    tmpData.City    = dr["CITY"].ToString();
                    tmpData.State   = dr["STATE"].ToString();
                    tmpData.ZipCode = dr["ZIP"].ToString();
                    tmpData.Phone1  = dr["TEL1"].ToString();
                    tmpData.Phone2  = dr["TEL2"].ToString();
                    tmpData.Phone3  = dr["FAX"].ToString();
                    //tmpData.ContactPerson = dr[""].ToString();

                    tmpData.IsDefault = false;
                    tmpData.Status    = status;
                    tmpData.IsFromErp = true;

                    list.Add(tmpData);
                }

                return(list);
            }
            catch (Exception ex)
            {
                ExceptionMngr.WriteEvent("GetLocations", ListValues.EventType.Error, ex, null, ListValues.ErrorCategory.ErpConnection);
                //throw;
                return(null);
            }
        }
Example #5
0
        public IList <Label> CreateEmptyPackLabel(Location location, int numLabels, Product product, string printSession,
                                                  SysUser user)
        {
            Factory.IsTransactional = true;

            Node recNode = WType.GetNode(new Node {
                NodeID = NodeType.Stored
            });
            Status status = WType.GetStatus(new Status {
                StatusID = EntityStatus.Active
            });
            DocumentType labelType = WType.GetLabelType(new DocumentType {
                DocTypeID = LabelType.ProductLabel
            });
            Unit logisticUnit = WType.GetUnit(new Unit {
                Company = location.Company, Name = WmsSetupValues.CustomUnit
            });
            Bin destLocation = WType.GetBin(new Bin {
                Location = location, BinCode = DefaultBin.PUTAWAY
            });


            IList <Label> listLabel = new List <Label>();

            //Generate new logistig labels located in MAIN
            //Labels shouldbe activated the next transaction
            try {
                //Funcion para obtener siguiente Label
                //DocumentTypeSequence initSequence = GetNextDocSequence(location.Company, labelType);
                Label fatherLabel = null;

                for (int i = 0; i < (int)numLabels; i++)
                {
                    fatherLabel              = new Label();
                    fatherLabel.Node         = recNode;
                    fatherLabel.Bin          = destLocation;
                    fatherLabel.Product      = product;
                    fatherLabel.CreatedBy    = user.UserName;
                    fatherLabel.Status       = status;
                    fatherLabel.LabelType    = labelType;
                    fatherLabel.CreationDate = DateTime.Now;
                    fatherLabel.Printed      = false;

                    fatherLabel.Unit        = logisticUnit;
                    fatherLabel.IsLogistic  = false;
                    fatherLabel.FatherLabel = null;
                    fatherLabel.LabelCode   = ""; //(initSequence.NumSequence + i).ToString() + GetRandomHex(user.UserName, initSequence.NumSequence + i);
                    fatherLabel.CurrQty     = 0;
                    //Aqui guardan las logisitcas las hijas que contienen unas vez se imprimen
                    fatherLabel.StartQty    = 0;
                    fatherLabel.Notes       = "Empty Label";
                    fatherLabel.PrintingLot = printSession;
                    fatherLabel             = Factory.DaoLabel().Save(fatherLabel);

                    //Registra el movimiento del nodo
                    fatherLabel.LabelCode = fatherLabel.LabelID.ToString();

                    SaveNodeTrace(
                        new NodeTrace
                    {
                        Node      = recNode,
                        Document  = null,
                        Label     = fatherLabel,
                        Quantity  = fatherLabel.CurrQty,
                        IsDebit   = false,
                        CreatedBy = user.UserName
                    }
                        );

                    listLabel.Add(fatherLabel);
                }

                //Ajustando la sequencia
                //initSequence.NumSequence += numLabels;

                //Factory.DaoDocumentTypeSequence().Update(initSequence);

                Factory.Commit();

                return(listLabel);
            }
            catch (Exception ex)
            {
                Factory.Rollback();
                ExceptionMngr.WriteEvent("CreateEmptyLabel:", ListValues.EventType.Fatal, ex, null, ListValues.ErrorCategory.Business);
                throw new Exception(WriteLog.GetTechMessage(ex));
            }
        }
        public IList <Location> GetLocations(string sWhere)
        {
            Location         tmpData;
            IList <Location> list = new List <Location>();

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

                Query = GetErpQuery("LOCATIONS");

                ds = ReturnDataSet(Query, sWhere, "LOCATIONS", Command.Connection);

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


                Status status = WType.GetStatus(new Status {
                    StatusID = EntityStatus.Active
                });

                //En el dataset, Tables: 1 - Locations
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    //Map Properties
                    tmpData = new Location();

                    tmpData.Company      = CurCompany;
                    tmpData.ErpCode      = dr["f150_id"].ToString();
                    tmpData.Name         = dr["f150_descripcion"].ToString();
                    tmpData.AddressLine1 = dr["f157_descripcion"].ToString();
                    tmpData.BatchNo      = dr["f150_rowid"].ToString();

                    /*
                     * tmpData.AddressLine2 = dr["ADDRESS2"].ToString();
                     * tmpData.AddressLine3 = dr["ADDRESS3"].ToString();
                     * tmpData.City = dr["CITY"].ToString();
                     * tmpData.State = dr["STATE"].ToString();
                     * tmpData.ZipCode = dr["ZIPCODE"].ToString();
                     * tmpData.Phone1 = dr["PHONE1"].ToString();
                     * tmpData.Phone2 = dr["PHONE2"].ToString();
                     * tmpData.Phone3 = dr["FAXNUMBR"].ToString();
                     * //tmpData.ContactPerson = dr[""].ToString();
                     */
                    tmpData.IsDefault = false;
                    tmpData.Status    = status;
                    tmpData.IsFromErp = true;

                    list.Add(tmpData);
                }

                return(list);
            }
            catch (Exception ex)
            {
                ExceptionMngr.WriteEvent("GetLocations", ListValues.EventType.Error, ex, null, ListValues.ErrorCategory.ErpConnection);
                //throw;
                return(null);
            }
        }