Exemplo n.º 1
0
 private async Task ExecuteFinish()
 {
     try
     {
         try
         {
             using (WMSToUIClient client = new WMSToUIClient())
             {
                 var cmd = DataListCommand.FirstOrDefault(p => (p.Operation == EnumOrderOperation.ConfirmStore || p.Operation == EnumOrderOperation.ConfirmFinish) && p.Status == EnumCommandWMSStatus.Active);
                 await client.CommandStatusChangedAsync(cmd.WMSID, (int)EnumCommandWMSStatus.Finished);
             }
         }
         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));
         }
     }
     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));
     }
 }
Exemplo n.º 2
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"));
         }
     }
 }