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")); } } }
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")); } } }
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")); } } }