Exemplo n.º 1
0
        public string this[string propertyName]
        {
            get
            {
                try
                {
                    string validationResult = String.Empty;

                    switch (propertyName)
                    {
                    case "IDString":
                        if (EnabledMaterial && ID <= 0)
                        {
                            validationResult = ResourceReader.GetString("ERR_MATERIALNOTVALID");
                        }
                        else if (EnabledMaterial && _warehouse.DBService.FindMaterial(ID) != null)
                        {
                            validationResult = ResourceReader.GetString("ERR_MATERIALEXSITS");
                        }
                        break;

                    case "Location":
                        if (EnabledLocation && _warehouse.DBService.FindPlaceID(Location) == null)
                        {
                            validationResult = ResourceReader.GetString("ERR_NOLOCATION");
                        }
                        else if (EnabledLocation && _warehouse.DBService.FindPlace(Location) != null)
                        {
                            validationResult = ResourceReader.GetString("ERR_LOCATIONFULL");
                        }
                        break;

                    case "Size":
                        if (EnabledProperty && !(Size >= 0 && Size <= 2))
                        {
                            validationResult = ResourceReader.GetString("ERR_SIZE");
                        }
                        break;

                    case "Weight":
                        if (EnabledProperty && !(Weight >= 0 && Weight < 10000))
                        {
                            validationResult = ResourceReader.GetString("ERR_WEIGHT");
                        }
                        break;
                    }
                    Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                    AllPropertiesValid = Validator.IsValid();
                    return(validationResult);
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                        string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }
Exemplo n.º 2
0
 public string this[string propertyName]
 {
     get
     {
         try
         {
             string validationResult = String.Empty;
             switch (propertyName)
             {
             case "Size":
                 if (ID != null && !(Size >= 0 && Size <= 2))
                 {
                     validationResult = ResourceReader.GetString("ERR_RANGE") + " 1, 999";
                 }
                 break;
             }
             Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
             AllPropertiesValid = Validator.IsValid();
             return(validationResult);
         }
         catch (Exception e)
         {
             _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                 string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
             Validator.AddOrUpdate(propertyName, false);
             AllPropertiesValid = Validator.IsValid();
             return(ResourceReader.GetString("ERR_EXCEPTION"));
         }
     }
 }
Exemplo n.º 3
0
 public string this[string propertyName]
 {
     get
     {
         try
         {
             string validationResult = String.Empty;
             if (ValidationEnabled)
             {
                 switch (propertyName)
                 {
                 case "WMSID":
                     break;
                 }
             }
             Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
             AllPropertiesValid = Validator.IsValid();
             return(validationResult);
         }
         catch (Exception e)
         {
             _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                 string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
             Validator.AddOrUpdate(propertyName, false);
             AllPropertiesValid = Validator.IsValid();
             return(ResourceReader.GetString("ERR_EXCEPTION"));
         }
     }
 }
Exemplo n.º 4
0
        public string this[string propertyName]
        {
            get
            {
                try
                {
                    string validationResult = String.Empty;
                    if (ValidationEnabled)
                    {
                        switch (propertyName)
                        {
                        case "TUID":
                            if (TUID == 0 || _dbservicewms.FindPlaceByTUID(TUID) != null)
                            {
                                validationResult = ResourceReader.GetString("ERR_MATERIALEXISTS");
                            }
                            break;

                        case "PlaceID":
                            var pid = _dbservicewms.FindPlaceID(PlaceID);
                            if (!PlaceID.StartsWith("W"))
                            {
                                validationResult = ResourceReader.GetString("ERR_NOTWH");
                            }
                            else if (pid == null || pid.DimensionClass < 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_PLACE");
                            }
                            else if (pid.DimensionClass < 999 && _dbservicewms.FindPlaceByPlace(PlaceID) != null)
                            {
                                validationResult = ResourceReader.GetString("ERR_OCCUPIED");
                            }
                            break;

                        case "DimensionClass":
                            var p = _dbservicewms.FindPlaceID(PlaceID);
                            if (p != null && DimensionClass > p.DimensionClass)
                            {
                                validationResult = ResourceReader.GetString("ERR_CLASS");
                            }
                            break;
                        }
                    }
                    Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                    AllPropertiesValid = Validator.IsValid() && SubTableValidation;
                    return(validationResult);
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                        string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }
Exemplo n.º 5
0
        public string this[string propertyName]
        {
            get
            {
                try
                {
                    string validationResult = String.Empty;
                    if (ValidationEnabled)
                    {
                        switch (propertyName)
                        {
                        case "BoxID":
                            if (_dbservicewms.FindSKUID(BoxID) == null)
                            {
                                validationResult = ResourceReader.GetString("ERR_BOXID");
                            }
                            break;

                        case "Qty":
                            if (Qty <= 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_RANGE");
                            }
                            break;

                        case "ProdDate":
                            if (ProdDate < SqlDateTime.MinValue.Value || ProdDate > SqlDateTime.MaxValue.Value)
                            {
                                validationResult = ResourceReader.GetString("ERR_DATE");
                            }
                            break;

                        case "ExpDate":
                            if (ExpDate < SqlDateTime.MinValue.Value || ExpDate > SqlDateTime.MaxValue.Value)
                            {
                                validationResult = ResourceReader.GetString("ERR_DATE");
                            }
                            break;
                        }
                    }
                    Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                    AllPropertiesValid = Validator.IsValid();
                    return(validationResult);
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                        string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }
Exemplo n.º 6
0
        public string this[string propertyName]
        {
            get
            {
                try
                {
                    if (_warehouse.DBService != null)
                    {
                        string validationResult = String.Empty;
                        if (ValidationEnabled)
                        {
                            switch (propertyName)
                            {
                            case "Task":
                                if (Task < EnumCommandTask.SegmentInfo || Task > EnumCommandTask.SegmentReset)
                                {
                                    validationResult = ResourceReader.GetString("ERR_TASK");
                                }
                                break;

                            case "Segment":
                                if (!_warehouse.SegmentList.Exists(p => p.Name == (_command as CommandSegment).Segment) && Segment != "*")
                                {
                                    validationResult = ResourceReader.GetString("ERR_SEGMENT");
                                }
                                break;

                            case "Priority":
                                if (Priority < 0 || Priority > 10)
                                {
                                    validationResult = ResourceReader.GetString("ERR_PRIORITY");
                                }
                                break;
                            }
                        }
                        Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                        AllPropertiesValid = Validator.IsValid();
                        return(validationResult);
                    }
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_NULL"));
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                        string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }
Exemplo n.º 7
0
        public string this[string propertyName]
        {
            get
            {
                try
                {
                    string validationResult = String.Empty;
                    if (ValidationEnabled)
                    {
                        switch (propertyName)
                        {
                        case "ID":
                            if (ID == null || ID.Trim().Length == 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_INDEX_FORMAT");
                            }
                            else if (AllowChangeIndex && _dbservicewms.FindSKUID(ID) != null)
                            {
                                validationResult = ResourceReader.GetString("ERR_INDEX_EXISTS");
                            }
                            break;

                        case "DefaultQty":
                            if (DefaultQty <= 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_RANGE") + " > 0";
                            }
                            break;

                        case "FrequencyClass":
                            if (FrequencyClass < 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_RANGE") + " >= 0";
                            }
                            break;
                        }
                    }
                    Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                    AllPropertiesValid = Validator.IsValid();
                    return(validationResult);
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                        string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }
 public override string this[string propertyName]
 {
     get
     {
         try
         {
             string validationResult = String.Empty;
             if (ValidationEnabled)
             {
                 switch (propertyName)
                 {
                 case "TUIDstr":
                     PlaceID = "";
                     if (TUID == 0)
                     {
                         validationResult = ResourceReader.GetString("ERR_TUID");
                     }
                     else
                     {
                         var place = DBServiceWMS.FindPlaceByTUID(TUID);
                         if (place == null || place.PlaceID == "W:out")
                         {
                             validationResult = ResourceReader.GetString("ERR_TUID");
                         }
                         else if (RemoveTray && !DBServiceWMS.IsTUIDEmpty(place.TU_ID))
                         {
                             validationResult = ResourceReader.GetString("ERR_TUIDFULL");
                         }
                         PlaceID = place?.PlaceID;
                     }
                     break;
                 }
             }
             Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
             AllPropertiesValid = Validator.IsValid();
             return(validationResult);
         }
         catch (Exception e)
         {
             Warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
             Validator.AddOrUpdate(propertyName, false);
             AllPropertiesValid = Validator.IsValid();
             return(ResourceReader.GetString("ERR_EXCEPTION"));
         }
     }
 }
Exemplo n.º 9
0
        public string this[string propertyName]
        {
            get
            {
                try
                {
                    if (_warehouse.DBService != null)
                    {
                        string validationResult = String.Empty;

                        switch (propertyName)
                        {
                        case "Reason":
                            if (IsInDeleteMode && _detailedContent.Command.Reason == Command.EnumCommandReason.OK)
                            {
                                validationResult = ResourceReader.GetString("ERR_REASON");
                            }
                            break;

                        case "GenerateLoc":
                            if (GenerateLoc != null && (GenerateLoc.StartsWith("W:3") || !GenerateLoc.StartsWith("W")))
                            {
                                validationResult = ResourceReader.GetString("ERR_RACKNOTOK");
                            }
                            break;
                        }
                        Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                        AllPropertiesValid = Validator.IsValid();
                        return(validationResult);
                    }
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_NULL"));
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                        string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }
Exemplo n.º 10
0
        public string this[string propertyName]
        {
            get
            {
                try
                {
                    string validationResult = String.Empty;
                    if (ValidationEnabled)
                    {
                        switch (propertyName)
                        {
                        case "UserName":
                            if (_editEnabledUser && (_warehouse.DBService.GetUser(_userName) != null || _userName.Length == 0))
                            {
                                validationResult = ResourceReader.GetString("ERR_USER");
                            }
                            break;

                        case "Password1":
                        case "Password2":
                            if (Password1 != Password2)
                            {
                                validationResult = ResourceReader.GetString("ERR_PASSWORD");
                            }
                            break;
                        }
                    }
                    Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                    AllPropertiesValid = Validator.IsValid();
                    return(validationResult);
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                        string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }
Exemplo n.º 11
0
        public string this[string propertyName]
        {
            get
            {
                try
                {
                    string validationResult = String.Empty;
                    if (ValidationEnabled)
                    {
                        switch (propertyName)
                        {
                        case "ID":
                            if (_dbservicewms.CountPlaceIDs(ID) == 0 || ID.Length == 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_LOC_RANGE");
                            }
                            break;

                        case "FrequencyClass":
                            if (FrequencyClass < 0 || (FrequencyClass == 0 && ID.StartsWith("W")))
                            {
                                validationResult = ResourceReader.GetString("ERR_RANGE");
                            }
                            break;
                        }
                    }
                    Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                    AllPropertiesValid = Validator.IsValid();
                    return(validationResult);
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                        string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }
Exemplo n.º 12
0
        public string this[string propertyName]
        {
            get
            {
                try
                {
                    string validationResult = String.Empty;
                    if (ValidationEnabled)
                    {
                        switch (propertyName)
                        {
                        case "ID":
                            if (AddEnabled && _dbservicewms.CountBoxIDs(ID) != 0 || ID.Length == 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_BOXID_EXISTS");
                            }
                            break;

                        case "SKUID":
                            if (_dbservicewms.FindSKUID(SKUID) == null || SKUID == null || SKUID.Length == 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_SKUID_NONE");
                            }
                            break;
                        }
                    }
                    Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                    AllPropertiesValid = Validator.IsValid();
                    return(validationResult);
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                        string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }
Exemplo n.º 13
0
        public string this[string propertyName]
        {
            get
            {
                try
                {
                    string validationResult = String.Empty;
                    if (ValidationEnabled)
                    {
                        switch (propertyName)
                        {
                        case "TaskSegment":
                            if (TaskSegment < EnumSimpleCommandSegmentTask.Reset)
                            {
                                validationResult = ResourceReader.GetString("ERR_TASK");
                            }
                            break;

                        case "Segment":
                            if (!Segments.Any(p => p == Segment))
                            {
                                validationResult = ResourceReader.GetString("ERR_SEGMENT");
                            }
                            break;
                        }
                    }
                    Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                    AllPropertiesValid = Validator.IsValid();
                    return(validationResult);
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                        string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }
        public string this[string propertyName]
        {
            get
            {
                try
                {
                    string validationResult = String.Empty;
                    if (ValidationEnabled)
                    {
                        switch (propertyName)
                        {
                        case "TaskCrane":
                            if (TaskCrane != EnumSimpleCommandCraneTask.Move &&
                                TaskCrane != EnumSimpleCommandCraneTask.Pick &&
                                TaskCrane != EnumSimpleCommandCraneTask.Drop &&
                                TaskCrane != EnumSimpleCommandCraneTask.Create &&
                                TaskCrane != EnumSimpleCommandCraneTask.Delete)
                            {
                                validationResult = ResourceReader.GetString("ERR_TASK");
                            }
                            if (TaskCrane == EnumSimpleCommandCraneTask.Move)
                            {
                                Material = null;
                            }
                            if (TaskCrane == EnumSimpleCommandCraneTask.Create ||
                                TaskCrane == EnumSimpleCommandCraneTask.Delete)
                            {
                                Source = Unit;
                            }
                            RaisePropertyChanged("Source");
                            RaisePropertyChanged("MaterialStr");
                            break;

                        case "MaterialStr":
                            if (TaskCrane == EnumSimpleCommandCraneTask.Create)
                            {
                                if (Material.HasValue && _warehouse.DBService.FindMaterial(Material.Value) != null)
                                {
                                    validationResult = ResourceReader.GetString("ERR_MATERIALEXISTS");
                                }
                            }
                            else if (TaskCrane != EnumSimpleCommandCraneTask.Move)
                            {
                                if (!Material.HasValue || Material <= 0)
                                {
                                    validationResult = ResourceReader.GetString("ERR_MATERIALNOTVALID");
                                }
                                else if (Material.HasValue && _warehouse.DBService.FindMaterial(Material.Value) == null)
                                {
                                    validationResult = ResourceReader.GetString("ERR_MATERIALUNKNOWN");
                                }
                            }
                            break;

                        case "Unit":
                            if (!Devices.Any(p => p == Unit))
                            {
                                validationResult = ResourceReader.GetString("ERR_UNIT");
                            }
                            if (TaskCrane == EnumSimpleCommandCraneTask.Create || TaskCrane == EnumSimpleCommandCraneTask.Delete)
                            {
                                Source = Unit;
                            }
                            RaisePropertyChanged("Source");
                            break;

                        case "Source":
                            if (Source != null)
                            {
                                if (TaskCrane == EnumSimpleCommandCraneTask.Create ||
                                    TaskCrane == EnumSimpleCommandCraneTask.Delete)
                                {
                                    if (Source != Unit)
                                    {
                                        validationResult = ResourceReader.GetString("ERR_LOCATION");
                                    }
                                }
                                else
                                {
                                    int s = (Source.Length > 4 && Source[0] == 'W' && int.TryParse(Source.Substring(2, 2), out s)) ? s : -1;
                                    if (Devices.Any(p => p == Unit))
                                    {
                                        bool inconv = _warehouse.Crane[Unit].InConveyor != null &&
                                                      (_warehouse.Crane[Unit].InConveyor.Any(p => p.Name == Source) &&
                                                       (TaskCrane == EnumSimpleCommandCraneTask.Move ||
                                                        TaskCrane == EnumSimpleCommandCraneTask.Pick));
                                        bool outconv = _warehouse.Crane[Unit].OutConveyor != null &&
                                                       (_warehouse.Crane[Unit].OutConveyor.Any(p => p.Name == Source) &&
                                                        (TaskCrane == EnumSimpleCommandCraneTask.Move ||
                                                         TaskCrane == EnumSimpleCommandCraneTask.Drop));
                                        bool wh = _warehouse.Crane[Unit].Shelve != null &&
                                                  _warehouse.Crane[Unit].Shelve.Any(p => p == s);
                                        if (_warehouse.DBService.FindPlaceID(Source) == null)
                                        {
                                            validationResult = ResourceReader.GetString("ERR_LOCATIONEXISTS");
                                        }
                                        else if (!inconv && !outconv && !wh)
                                        {
                                            validationResult = ResourceReader.GetString("ERR_LOCATION");
                                        }
                                        else if (wh && TaskCrane == EnumSimpleCommandCraneTask.Drop)
                                        {
                                            var mat = _warehouse.DBService.FindMaterialID(_command.Material.Value, false);
                                            var pid = _warehouse.DBService.FindPlaceID(Source);
                                            if (mat != null && pid != null && mat.Weight / 10000 > pid.Size)
                                            {
                                                validationResult = ResourceReader.GetString("ERR_LOCATIONCLASS");
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                validationResult = ResourceReader.GetString("ERR_LOCATION");
                            }
                            break;
                        }
                    }
                    Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                    AllPropertiesValid = Validator.IsValid();
                    return(validationResult);
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                        string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }
Exemplo n.º 15
0
        public string this[string propertyName]
        {
            get
            {
                try
                {
                    string validationResult = String.Empty;
                    if (ValidationEnabled)
                    {
                        switch (propertyName)
                        {
                        case "ERPID":
                            break;

                        case "OrderID":
                            if (OrderID <= 0 || (_dbservicewms.ExistsOrderID(ERPID, OrderID) && OrderID != ReferenceOrderID))
                            {
                                validationResult = ResourceReader.GetString("ERR_ORDERID");
                            }
                            break;

                        case "Destination":
                            if (_dbservicewms.FindPlaceID(Destination) == null)
                            {
                                validationResult = ResourceReader.GetString("ERR_DESTINATION");
                            }
                            break;

                        case "ReleaseTime":
                            if (ReleaseTime < SqlDateTime.MinValue.Value || ReleaseTime > SqlDateTime.MaxValue.Value)
                            {
                                validationResult = ResourceReader.GetString("ERR_RANGE");
                            }
                            break;

                        case "SubOrderID":
                            if (SubOrderID <= 0 || (_dbservicewms.ExistsSubOrderID(OrderID, SubOrderID) && SubOrderID != ReferenceSubOrderID))
                            {
                                validationResult = ResourceReader.GetString("ERR_SUBORDERID");
                            }
                            break;

                        case "SubOrderERPID":
                            if (SubOrderERPID < 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_SUBORDERID");
                            }
                            break;

                        case "SubOrderName":
                            if (SubOrderName == null || SubOrderName.Length == 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_SUBORDERNAME");
                            }
                            break;

                        case "SKUID":
                            if (_dbservicewms.FindSKUID(SKUID) == null)
                            {
                                validationResult = ResourceReader.GetString("ERR_SKU");
                            }
                            break;

                        case "SKUBatch":
                            break;

                        case "SKUQty":
                            if (SKUQty <= 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_RANGE");
                            }
                            break;
                        }
                    }
                    Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                    AllPropertiesValid = Validator.IsValid();
                    return(validationResult);
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                        string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }
Exemplo n.º 16
0
 public override string this[string propertyName]
 {
     get
     {
         try
         {
             string validationResult = String.Empty;
             if (ValidationEnabled)
             {
                 switch (propertyName)
                 {
                 case "Boxes":
                     string[] boxArray = Regex.Split(Boxes, @"[,|;\s\n]+");
                     _boxList.Clear();
                     foreach (var b in boxArray)
                     {
                         var c = _cmds.Find(p => p.Box_ID == b);
                         if (c != null)
                         {
                             using (WMSToUIClient client = new WMSToUIClient())
                             {
                                 if (Command == CommandType.DropBox)
                                 {
                                     DBServiceWMS.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Drop request: {c.Box_ID} to {c.TU_ID}");
                                     var tul = new List <TU>()
                                     {
                                         new TU
                                         {
                                             TU_ID    = c.TU_ID,
                                             Box_ID   = c.Box_ID,
                                             Qty      = 1,
                                             ProdDate = DateTime.Now,
                                             ExpDate  = DateTime.Now
                                         }
                                     };
                                     client.AddTUs(tul.ToArray());
                                     Boxes = "";
                                 }
                                 else if (Command == CommandType.PickBox)
                                 {
                                     DBServiceWMS.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Pick request: {c.Box_ID} from {c.TU_ID}");
                                     client.DeleteTU(new TU
                                     {
                                         TU_ID  = c.TU_ID,
                                         Box_ID = c.Box_ID,
                                     });
                                     Boxes = "";
                                 }
                                 client.CommandStatusChangedAsync(c.ID, (int)EnumCommandWMSStatus.Finished);
                             }
                         }
                     }
                     if (Boxes != "")
                     {
                         validationResult = ResourceReader.GetString("ERR_TUID");
                     }
                     break;
                 }
             }
             Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
             AllPropertiesValid = Validator.IsValid();
             return(validationResult);
         }
         catch (Exception e)
         {
             Warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
             Validator.AddOrUpdate(propertyName, false);
             AllPropertiesValid = Validator.IsValid();
             return(ResourceReader.GetString("ERR_EXCEPTION"));
         }
     }
 }
Exemplo n.º 17
0
        public string this[string propertyName]
        {
            get
            {
                try
                {
                    string validationResult = String.Empty;
                    if (ValidationEnabled)
                    {
                        switch (propertyName)
                        {
                        case "TaskConveyor":
                            if (TaskConveyor != EnumSimpleCommandConveyorTask.Move &&
                                TaskConveyor != EnumSimpleCommandConveyorTask.Create &&
                                TaskConveyor != EnumSimpleCommandConveyorTask.Delete)
                            {
                                validationResult = ResourceReader.GetString("ERR_TASK");
                            }
                            RaisePropertyChanged("Source");
                            break;

                        case "MaterialStr":
                            if (TaskConveyor == EnumSimpleCommandConveyorTask.Create)
                            {
                                if (Material.HasValue && _warehouse.DBService.FindMaterial(Material.Value) != null)
                                {
                                    validationResult = ResourceReader.GetString("ERR_MATERIALEXISTS");
                                }
                            }
                            else
                            {
                                if (!Material.HasValue || Material <= 0)
                                {
                                    validationResult = ResourceReader.GetString("ERR_MATERIALNOTVALID");
                                }
                                else if (_warehouse.DBService.FindMaterial(Material.Value) == null)
                                {
                                    validationResult = ResourceReader.GetString("ERR_MATERIALUNKNOWN");
                                }
                            }
                            break;

                        case "Source":
                            if (Sources != null && !Sources.Any(p => p == Source))
                            {
                                validationResult = ResourceReader.GetString("ERR_LOCATION");
                            }
                            if (TaskConveyor == EnumSimpleCommandConveyorTask.Create ||
                                TaskConveyor == EnumSimpleCommandConveyorTask.Delete)
                            {
                                Target = Source;
                            }
                            break;

                        case "Target":
                            if (Targets != null && !Targets.Any(p => p == Target))
                            {
                                validationResult = ResourceReader.GetString("ERR_LOCATION");
                            }
                            if (TaskConveyor == EnumSimpleCommandConveyorTask.Create ||
                                TaskConveyor == EnumSimpleCommandConveyorTask.Delete)
                            {
                                Source = Target;
                            }
                            break;
                        }
                    }
                    Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                    AllPropertiesValid = Validator.IsValid();
                    return(validationResult);
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                        string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }
Exemplo n.º 18
0
        public override string this[string propertyName]
        {
            get
            {
                try
                {
                    string validationResult = String.Empty;
                    if (ValidationEnabled)
                    {
                        switch (propertyName)
                        {
                        case "TUID":
                        case "TUIDstr":
                            if (TUID == 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_TUID");
                            }
                            else
                            {
                                var p = DBServiceWMS.FindPlaceByTUID(TUID);
                                if (p == null)
                                {
                                    validationResult = ResourceReader.GetString("ERR_TUID");
                                }
                                else if (p.PlaceID.StartsWith("W:out"))
                                {
                                    validationResult = ResourceReader.GetString("ERR_TUID");
                                }
                                var place = DBServiceWMS.GetPlaceWithTUID(TUID);
                                PlaceID = place != null ? place.PlaceID : "-";
                            }
                            break;

                        case "Boxes":
                            if (Boxes != null)
                            {
                                string[] boxArray = Regex.Split(Boxes, @"[,|;\s\n]+");
                                _boxList.Clear();
                                foreach (var b in boxArray)
                                {
                                    if (b != "")
                                    {
                                        if (DBServiceWMS.FindBoxByBoxID(b) == null)
                                        {
                                            if (b.Length == 14 && b[4] == '-' && b[9] == '-' &&
                                                !_boxesAnnounced.Exists(p => p == b))      // announce box to WMS and ERP
                                            {
                                                using (WMSToUIClient client = new WMSToUIClient())
                                                {
                                                    client.BoxEntry(b);
                                                    _boxesAnnounced.Add(b);
                                                }
                                            }
                                            validationResult = ResourceReader.GetString("ERR_NOBOXID");
                                        }
                                        else if (DBServiceWMS.FindTUByBoxID(b) != null)
                                        {
                                            validationResult = ResourceReader.GetString("ERR_TUBOXEXISTS");
                                        }
                                        else if (_boxList.Contains(b))
                                        {
                                            validationResult = ResourceReader.GetString("ERR_TUBOXEXISTS");
                                        }
                                        else
                                        {
                                            _boxList.Add(b);
                                        }
                                    }
                                }
                                if (validationResult == String.Empty && _boxList.Count > 1)
                                {
                                    var skuid = DBServiceWMS.FindBoxByBoxID(_boxList[0]).SKU_ID;
                                    foreach (var b in _boxList)
                                    {
                                        if (DBServiceWMS.FindBoxByBoxID(b).SKU_ID != skuid)
                                        {
                                            validationResult = ResourceReader.GetString("ERR_NOTSAMESKUID");
                                        }
                                    }
                                }
                            }
                            if (validationResult != String.Empty)
                            {
                                _boxList.Clear();
                            }
                            break;
                        }
                    }
                    Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                    AllPropertiesValid = Validator.IsValid();
                    return(validationResult);
                }
                catch (Exception e)
                {
                    Warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                       string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }
Exemplo n.º 19
0
        public string this[string propertyName]
        {
            get
            {
                try
                {
                    string validationResult = String.Empty;
                    if (ValidationEnabled)
                    {
                        switch (propertyName)
                        {
                        case "BoxID":
                            var b = _dbservicewms.FindBoxByBoxID(BoxID);
                            if (b != null)
                            {
                                SKUID       = b.SKU_ID;
                                Batch       = b.Batch;
                                Description = _dbservicewms.FindSKUID(SKUID)?.Description ?? "-";
                                var tu = _dbservicewms.FindTUByBoxID(BoxID);
                                if (tu != null && tu.TU_ID != _tuid)
                                {
                                    validationResult = ResourceReader.GetString("ERR_BOXID_EXISTS");
                                }
                            }
                            else
                            {
                                SKUID       = null;
                                Batch       = null;
                                Description = null;
                                if (BoxID != null)
                                {
                                    validationResult = ResourceReader.GetString("ERR_BOXID_EXISTS");
                                }
                            }
                            break;

                        case "Qty":
                            if (Qty <= 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_RANGE");
                            }
                            break;

                        case "DimensionClass":
                            if (Qty <= 0)
                            {
                                validationResult = ResourceReader.GetString("ERR_CLASS");
                            }
                            break;

                        case "ProdDate":
                            if (ProdDate < SqlDateTime.MinValue.Value || ProdDate > SqlDateTime.MaxValue.Value)
                            {
                                validationResult = ResourceReader.GetString("ERR_DATE");
                            }
                            break;

                        case "ExpDate":
                            if (ExpDate < SqlDateTime.MinValue.Value || ExpDate > SqlDateTime.MaxValue.Value)
                            {
                                validationResult = ResourceReader.GetString("ERR_DATE");
                            }
                            break;
                        }
                    }
                    Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                    AllPropertiesValid = Validator.IsValid();
                    Messenger.Default.Send <MessageValidationInfo>(new MessageValidationInfo()
                    {
                        AllPropertiesValid = AllPropertiesValid
                    });
                    return(validationResult);
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                        string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }
Exemplo n.º 20
0
 public override string this[string propertyName]
 {
     get
     {
         try
         {
             string validationResult = String.Empty;
             if (ValidationEnabled)
             {
                 switch (propertyName)
                 {
                 case "Boxes":
                     string[] boxArray = Regex.Split(Boxes, @"[,|;\s\n]+");
                     _boxList.Clear();
                     foreach (var b in boxArray)
                     {
                         if (b != "")
                         {
                             if (DBServiceWMS.FindBoxByBoxID(b) == null)
                             {
                                 validationResult = ResourceReader.GetString("ERR_NOBOXID");
                             }
                             else if (DBServiceWMS.FindTUByBoxID(b) == null)
                             {
                                 validationResult = ResourceReader.GetString("ERR_TUBOXNOEXISTS");
                             }
                             else if (_boxList.Contains(b))
                             {
                                 validationResult = ResourceReader.GetString("ERR_TUBOXEXISTS");
                             }
                             else
                             {
                                 _boxList.Add(b);
                             }
                         }
                     }
                     if (validationResult != String.Empty)
                     {
                         _boxList.Clear();
                     }
                     else
                     {
                         var x = DBServiceWMS.GetTUIDsForBoxes(_boxList);
                         if (x.Count == 0)
                         {
                             validationResult = ResourceReader.GetString("ERR_NOTUID");
                         }
                         else if (x.Count > 1)
                         {
                             validationResult = ResourceReader.GetString("ERR_MANYTUIDFORBOXES");
                         }
                         else if (PickBox &&
                                  DBServiceWMS.GetPlaceWithTUID(x[0]).PlaceID != DBServiceWMS.GetParameter("Place.IOStation"))
                         {
                             validationResult = ResourceReader.GetString("ERR_BOXNOTONSTATION");
                         }
                     }
                     break;
                 }
             }
             Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
             AllPropertiesValid = Validator.IsValid();
             return(validationResult);
         }
         catch (Exception e)
         {
             Warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
             Validator.AddOrUpdate(propertyName, false);
             AllPropertiesValid = Validator.IsValid();
             return(ResourceReader.GetString("ERR_EXCEPTION"));
         }
     }
 }
Exemplo n.º 21
0
        public string this[string propertyName]
        {
            get
            {
                try
                {
                    LPosition p;
                    string    frontLoc;

                    if (_warehouse.DBService != null)
                    {
                        string validationResult = String.Empty;
                        if (ValidationEnabled)
                        {
                            switch (propertyName)
                            {
                            case "TaskTU":
                                if (TaskTU >= EnumCommandTUTask.InfoMaterial)
                                {
                                    validationResult = ResourceReader.GetString("ERR_TASK");
                                }
                                break;

                            case "MaterialStr":
                                if (TaskTU == EnumCommandTUTask.Move ||
                                    TaskTU == EnumCommandTUTask.CreateMaterial ||
                                    (TaskTU == EnumCommandTUTask.DeleteMaterial && Material != null))
                                {
                                    if (!Material.HasValue || Material <= 0)
                                    {
                                        validationResult = ResourceReader.GetString("ERR_MATERIALNOTVALID");
                                    }
                                    else if (TaskTU != EnumCommandTUTask.CreateMaterial && _warehouse.DBService.FindMaterial(Material.Value) == null)
                                    {
                                        validationResult = ResourceReader.GetString("ERR_MATERIALNOTEXISTS");
                                    }
                                    else if (TaskTU == EnumCommandTUTask.CreateMaterial && _warehouse.DBService.FindMaterial(Material.Value) != null)
                                    {
                                        validationResult = ResourceReader.GetString("ERR_MATERIALEXISTS");
                                    }
                                }
                                break;

                            case "Source":
                                if (_warehouse.DBService.FindPlaceID(Source) == null)
                                {
                                    validationResult = ResourceReader.GetString("ERR_LOCATION");
                                }
                                else if (TaskTU == EnumCommandTUTask.Move && _warehouse.DBService.FindPlaceID(Target) != null &&
                                         !(_warehouse.WCFClient as WCFUIClient).NotifyUIClient.RouteExists(Source, Target, false))
                                {
                                    validationResult = ResourceReader.GetString("ERR_ROUTE");
                                }
                                else
                                {
                                    p        = LPosition.FromString(Source);
                                    frontLoc = Source;
                                    if (p.Shelve > 0 && p.Depth == 2)
                                    {
                                        LPosition pOther = new LPosition {
                                            Shelve = p.Shelve, Travel = p.Travel, Height = p.Height, Depth = 1
                                        };
                                        frontLoc = pOther.ToString();
                                    }
                                    if (_warehouse.DBService.FindPlaceID(Source).Blocked || _warehouse.DBService.FindPlaceID(frontLoc).Blocked)
                                    {
                                        validationResult = ResourceReader.GetString("ERR_BLOCKED");
                                    }
                                }
                                break;

                            case "Target":
                                if (_warehouse.DBService.FindPlaceID(Target) == null)
                                {
                                    validationResult = ResourceReader.GetString("ERR_LOCATION");
                                }
                                else if (TaskTU == EnumCommandTUTask.Move && _warehouse.DBService.FindPlaceID(Source) != null &&
                                         !(_warehouse.WCFClient as WCFUIClient).NotifyUIClient.RouteExists(Source, Target, false))
                                {
                                    validationResult = ResourceReader.GetString("ERR_ROUTE");
                                }
                                else
                                {
                                    p        = LPosition.FromString(Target);
                                    frontLoc = Target;
                                    if (p.Shelve > 0 && p.Depth == 2)
                                    {
                                        frontLoc = frontLoc.Substring(0, frontLoc.Length - 1) + '1';
                                    }
                                    if (_warehouse.DBService.FindPlaceID(Target).Blocked || _warehouse.DBService.FindPlaceID(frontLoc).Blocked)
                                    {
                                        validationResult = ResourceReader.GetString("ERR_BLOCKED");
                                    }
                                    else
                                    {
                                        var mat = Material.HasValue ? _warehouse.DBService.FindMaterialID(Material.Value, false) : null;
                                        var pid = _warehouse.DBService.FindPlaceID(Target);
                                        if (Target.StartsWith("W") && mat != null && pid != null && mat.ID / 10000 > pid.Size)
                                        {
                                            validationResult = ResourceReader.GetString("ERR_LOCATIONCLASS");
                                        }
                                    }
                                }
                                break;

                            case "Priority":
                                if (Priority < 0 || Priority > 100)
                                {
                                    validationResult = ResourceReader.GetString("ERR_PRIORITY");
                                }
                                break;
                            }
                        }
                        Validator.AddOrUpdate(propertyName, validationResult == String.Empty);
                        AllPropertiesValid = Validator.IsValid();
                        return(validationResult);
                    }
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_NULL"));
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                        string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
                    Validator.AddOrUpdate(propertyName, false);
                    AllPropertiesValid = Validator.IsValid();
                    return(ResourceReader.GetString("ERR_EXCEPTION"));
                }
            }
        }