Beispiel #1
0
        private void ExecuteCancel()
        {
            try
            {
                if (Operation is StationActionViewModel)
                {
                    var cmd = DataListCommand.FirstOrDefault(p => p.Status == EnumCommandWMSStatus.Active);
                    if (cmd != null)
                    {
                        using (WMSToUIClient client = new WMSToUIClient())
                        {
                            client.CancelCommand(new DTOCommand
                            {
                                ID = cmd.WMSID
                            });
                        }
                    }
                }

                Operation        = null;
                EnabledCC        = false;
                VisibleOperation = false;
            }
            catch (Exception e)
            {
                _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception, e.Message);
            }
        }
Beispiel #2
0
        private async Task ExecuteConfirm()
        {
            try
            {
                DetailedPlaceID.EditVisible = true;
                EditEnabled = false;
                EnabledCC   = false;
                try
                {
                    switch (_selectedCommand)
                    {
                    case CommandType.Edit:
                        _dbservicewms.UpdatePlaceID(DetailedPlaceID.PlaceID);
                        _warehouse.AddEvent(Event.EnumSeverity.Event, Event.EnumType.Material,
                                            String.Format("PlaceID changed: id: {0}", DetailedPlaceID.ID));
                        SelectedPlaceID.PositionTravel = DetailedPlaceID.PositionTravel;
                        SelectedPlaceID.PositionHoist  = DetailedPlaceID.PositionHoist;
                        SelectedPlaceID.DimensionClass = DetailedPlaceID.DimensionClass;
                        SelectedPlaceID.FrequencyClass = DetailedPlaceID.FrequencyClass;
                        SelectedPlaceID.Status         = DetailedPlaceID.Status;
                        _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Edit PlaceID: {DetailedPlaceID.PlaceID.ToString()}");
                        break;

                    case CommandType.Block:
                    case CommandType.Unblock:
                        using (WMSToUIClient client = new WMSToUIClient())
                        {
                            EnumBlockedWMS reason = (DetailedPlaceID.ID.Length <= 4 && DetailedPlaceID.ID.StartsWith("W")) ? EnumBlockedWMS.Vehicle : EnumBlockedWMS.Rack;
                            await client.BlockLocationsAsync(DetailedPlaceID.ID, _selectedCommand == CommandType.Block, (int)reason);
                            await ExecuteRefresh();

                            string bl = _selectedCommand == CommandType.Block ? "BLOCK" : "UNBLOCK";
                            _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Block locations: {DetailedPlaceID.ID}|{bl}|{(int)reason}|");
                        }
                        break;
                    }
                    if (DetailedPlaceID != null)
                    {
                        DetailedPlaceID.ValidationEnabled = false;
                    }
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Event.EnumSeverity.Error, Event.EnumType.Exception, 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));
            }
        }
        private void ExecuteConfirm()
        {
            try
            {
                EditEnabled = false;
                EnabledCC   = false;
                try
                {
                    switch (_selectedCommand)
                    {
                    case CommandType.Delete:
                        using (WMSToUIClient client = new WMSToUIClient())
                        {
                            client.UpdateERPCommandStatus(Detailed.ID, CommandERP.CommandERPStatus.Canceled);
                        }
                        Detailed.Status    = EnumCommandERPStatus.Canceled;
                        Selected.ERPID     = Detailed.ERPID;
                        Selected.Reference = Detailed.Reference;
                        Selected.Command   = Detailed.Command;
                        Selected.Status    = Detailed.Status;
                        Selected.Time      = Detailed.Time;
                        _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Command ERP cancel: {Detailed.Data.ToString()}");
                        break;

                    default:
                        break;
                    }
                    if (Detailed != null)
                    {
                        Detailed.ValidationEnabled = false;
                    }
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Event.EnumSeverity.Error, Event.EnumType.Exception, 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));
            }
        }
        public async Task ExecuteSuggestTU()
        {
            try
            {
                using (WMSToUIClient client = new WMSToUIClient())
                {
                    TUID = await client.SuggestTUIDAsync(_boxList.ToArray());

                    TUIDstr = TUID.ToString();
                    var place = DBServiceWMS.GetPlaceWithTUID(TUID);
                    PlaceID = place != null ? place.PlaceID : "-";
                }
            }
            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));
            }
        }
        private void ExecuteConfirm()
        {
            try
            {
                EditEnabled = false;
                EnabledCC   = false;
                try
                {
                    switch (_selectedCommand)
                    {
                    case CommandType.Delete:
                        using (WMSToUIClient client = new WMSToUIClient())
                        {
                            client.CancelCommand(new DTOCommand
                            {
                                ID = Selected.WMSID
                            });
                            _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Delete command: |{Selected.WMSID}|");
                        }
                        break;

                    default:
                        break;
                    }
                    if (Detailed != null)
                    {
                        Detailed.ValidationEnabled = false;
                    }
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Event.EnumSeverity.Error, Event.EnumType.Exception, 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));
            }
        }
Beispiel #6
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));
     }
 }
        private void ExecuteConfirm()
        {
            try
            {
                EditEnabled = false;
                EnabledCC   = false;
                List <DataServiceWMS.PlaceDiff> pd      = new List <DataServiceWMS.PlaceDiff>();
                List <ProxyWMS_UI.PlaceDiff>    pdproxy = new List <ProxyWMS_UI.PlaceDiff>();
                try
                {
                    switch (_selectedCommand)
                    {
                    case CommandType.UpdateMFCS:
                        foreach (var d in DataList)
                        {
                            pd.Add(new DataServiceWMS.PlaceDiff {
                                TUID          = d.TUID,
                                PlaceMFCS     = d.PlaceMFCS,
                                PlaceWMS      = d.PlaceWMS,
                                DimensionMFCS = d.DimensionMFCS,
                                DimensionWMS  = d.DimensionWMS,
                                TimeMFCS      = d.TimeMFCS,
                                TimeWMS       = d.TimeWMS
                            });
                        }
                        _dbservicewms.UpdatePlacesMFCS(pd, _accessUser);
                        break;

                    case CommandType.UpdateWMS:
                        foreach (var d in DataList)
                        {
                            pdproxy.Add(new ProxyWMS_UI.PlaceDiff {
                                TUID          = d.TUID,
                                PlaceMFCS     = d.PlaceMFCS,
                                PlaceWMS      = d.PlaceWMS,
                                DimensionMFCS = d.DimensionMFCS != null? d.DimensionMFCS.Value: 0,
                                DimensionWMS  = d.DimensionWMS != null? d.DimensionWMS.Value: 0,
                                TimeMFCS      = d.TimeMFCS,
                                TimeWMS       = d.TimeWMS
                            });
                        }
                        using (WMSToUIClient client = new WMSToUIClient())
                        {
                            client.UpdatePlace(pdproxy.ToArray(), _accessUser);
                        }
                        break;

                    default:
                        break;
                    }
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Event.EnumSeverity.Error, Event.EnumType.Exception, 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));
            }
        }
 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"));
         }
     }
 }
Beispiel #9
0
        private void ExecuteConfirm()
        {
            try
            {
                EditEnabled      = false;
                EnabledCC        = false;
                VisibleOperation = false;
                try
                {
                    switch (_selectedCmd)
                    {
                    case CommandType.StoreTray:
                        using (WMSToUIClient client = new WMSToUIClient())
                        {
                            client.StoreTUID((Operation as StationStoreTrayViewModel).TUID);
//                              _dbservicewms.CreateOrder_StoreTUID((Operation as StationStoreTrayViewModel).TUID);
                        }
                        break;

                    case CommandType.BringTray:
                        _dbservicewms.CreateOrder_BringTUID((Operation as StationRemoveTrayViewModel).TUID);
                        break;

                    case CommandType.RemoveTray:
                        _dbservicewms.CreateOrder_RemoveTUID((Operation as StationRemoveTrayViewModel).TUID);
                        break;

                    case CommandType.DropBox:
                        _dbservicewms.CreateOrder_DropBox((Operation as StationDropBoxViewModel).TUID, (Operation as StationDropBoxViewModel).BoxList);
                        break;

                    case CommandType.BringBox:
                        _dbservicewms.CreateOrder_BringBox((Operation as StationPickBoxViewModel).BoxList);
                        break;

                    case CommandType.PickBox:
                        _dbservicewms.CreateOrder_PickBox((Operation as StationPickBoxViewModel).BoxList);
                        break;

                    case CommandType.CancelOrder:
                        using (WMSToUIClient client = new WMSToUIClient())
                        {
                            client.CancelOrder(new DTOOrder
                            {
                                ERP_ID     = SelectedOrder.ERPID,
                                OrderID    = SelectedOrder.OrderID,
                                SubOrderID = 0          // cancel all suborders
                            });
                        }
                        break;
                    }
                    _selectedCmd = CommandType.None;
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Event.EnumSeverity.Error, Event.EnumType.Exception, e.Message);
                }
                Operation = 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));
            }
        }
Beispiel #10
0
        private void ExecuteConfirm()
        {
            try
            {
                EditEnabled = false;
                EnabledCC   = false;
                try
                {
                    switch (_selectedCommand)
                    {
                    case CommandType.Edit:
                        DatabaseWMS.TU_ID tuid = new DatabaseWMS.TU_ID {
                            ID = Detailed.TUID, DimensionClass = Detailed.DimensionClass, Blocked = (int)Detailed.Blocked
                        };
                        List <TUs> tulist = new List <TUs>();
                        foreach (var l in Detailed.DetailList)
                        {
                            tulist.Add(new TUs {
                                TU_ID    = Detailed.TUID,
                                Box_ID   = l.BoxID,
                                Qty      = 1,
                                ProdDate = l.ProdDate,
                                ExpDate  = l.ExpDate
                            });
                        }
                        _dbservicewms.UpdateTUID(tuid);
                        _dbservicewms.UpdateTUs(tuid, tulist);
                        _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Edit TUID: {tuid.ToString()}");
                        Selected.TUID           = Detailed.TUID;
                        Selected.PlaceID        = Detailed.PlaceID;
                        Selected.DimensionClass = Detailed.DimensionClass;
                        Selected.Blocked        = Detailed.Blocked;
                        break;

                    case CommandType.Book:
                        using (WMSToUIClient client = new WMSToUIClient())
                        {
                            var pd = new ProxyWMS_UI.PlaceDiff[] { new ProxyWMS_UI.PlaceDiff {
                                                                       TUID = Detailed.TUID, PlaceWMS = Selected.PlaceID, PlaceMFCS = Detailed.PlaceID
                                                                   } };
                            client.UpdatePlace(pd, _accessUser);
                            _dbservicewms.UpdatePlaceMFCS(new Database.Place {
                                Material = Detailed.TUID, Place1 = Detailed.PlaceID
                            });
                        }
                        _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Rebook TUID: {Detailed.TUID} {Detailed.PlaceID}");
                        Selected.TUID           = Detailed.TUID;
                        Selected.PlaceID        = Detailed.PlaceID;
                        Selected.DimensionClass = Detailed.DimensionClass;
                        Selected.Blocked        = Detailed.Blocked;
                        break;

                    case CommandType.Block:
                        using (WMSToUIClient client = new WMSToUIClient())
                        {
                            client.BlockTU(Detailed.TUID, Detailed.BlockedQC, (int)EnumBlockedWMS.Quality);
                            _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Request block TUID: |{Detailed.TUID:d5}|{Detailed.BlockedQC}|{(int)EnumBlockedWMS.Quality}|");
                            Selected.TUID           = Detailed.TUID;
                            Selected.PlaceID        = Detailed.PlaceID;
                            Selected.DimensionClass = Detailed.DimensionClass;
                            Selected.Blocked        = Detailed.Blocked;
                        }
                        break;

                    case CommandType.Delete:
                        _dbservicewms.DeleteTUs(Detailed.TUID);
                        using (WMSToUIClient client = new WMSToUIClient())
                        {
                            var pd = new ProxyWMS_UI.PlaceDiff[] { new ProxyWMS_UI.PlaceDiff {
                                                                       TUID = Detailed.TUID, PlaceWMS = Detailed.PlaceID, PlaceMFCS = null
                                                                   } };
                            client.UpdatePlace(pd, _accessUser);
                            _dbservicewms.UpdatePlaceMFCS(new Database.Place {
                                Material = Detailed.TUID, Place1 = Detailed.PlaceID
                            });
                        }
                        _dbservicewms.DeletePlaceMFCS(new Database.Place {
                            Material = Detailed.TUID, Place1 = Detailed.PlaceID
                        });
                        _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Delete Place: {Detailed.TUID}, {Detailed.PlaceID}");
                        Selected.TUID           = Detailed.TUID;
                        Selected.PlaceID        = Detailed.PlaceID;
                        Selected.DimensionClass = Detailed.DimensionClass;
                        Selected.Blocked        = Detailed.Blocked;
                        break;

                    case CommandType.Add:
                        List <TUs> tul = new List <TUs>();
                        foreach (var l in Detailed.DetailList)
                        {
                            tul.Add(new TUs {
                                TU_ID    = Detailed.TUID,
                                Box_ID   = l.BoxID,
                                Qty      = 1,
                                ProdDate = l.ProdDate,
                                ExpDate  = l.ExpDate
                            });
                        }
                        using (WMSToUIClient client = new WMSToUIClient())
                        {
                            var pd = new ProxyWMS_UI.PlaceDiff[] {
                                new ProxyWMS_UI.PlaceDiff {
                                    TUID          = Detailed.TUID,
                                    PlaceWMS      = null,
                                    PlaceMFCS     = Detailed.PlaceID,
                                    DimensionMFCS = Detailed.DimensionClass
                                }
                            };
                            client.UpdatePlace(pd, _accessUser);
                            _dbservicewms.UpdatePlaceMFCS(new Database.Place {
                                Material = Detailed.TUID, Place1 = Detailed.PlaceID
                            });
                        }
                        _dbservicewms.AddTUs(tul);
                        _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Add Place: {Detailed.TUID}, {Detailed.PlaceID}");
                        break;

                    default:
                        break;
                    }
                    if (Detailed != null)
                    {
                        Detailed.ValidationEnabled = false;
                    }
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Event.EnumSeverity.Error, Event.EnumType.Exception, 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));
            }
        }
        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"));
                }
            }
        }
        private void ExecuteConfirm()
        {
            try
            {
                EditEnabled = false;
                EnabledCC   = false;
                try
                {
                    switch (_selectedCmd)
                    {
                    case CommandType.ReleaseOrder:
                        _dbservicewms.UpdateOrders(DetailedOrder.ERPID, DetailedOrder.OrderID, DetailedOrder.Order);
                        SelectedOrder.Destination = DetailedOrder.Destination;
                        SelectedOrder.ReleaseTime = DetailedOrder.ReleaseTime;
                        _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Release order: {DetailedOrder.Order.ToString()}");
                        break;

                    case CommandType.DeleteOrder:
                        using (WMSToUIClient client = new WMSToUIClient())
                        {
                            client.CancelOrder(new DTOOrder
                            {
                                ID          = 0,
                                ERP_ID      = DetailedOrder.ERPID,
                                OrderID     = DetailedOrder.OrderID,
                                ReleaseTime = DetailedOrder.ReleaseTime,
                                Destination = DetailedOrder.Destination
                            });
                            _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Cancel order: {DetailedOrder.Order.ToString()}");
                        }
                        break;

                    case CommandType.DeleteSubOrder:
                        using (WMSToUIClient client = new WMSToUIClient())
                        {
                            client.CancelOrder(new DTOOrder
                            {
                                ID          = SelectedSubOrder.ID,
                                ERP_ID      = SelectedSubOrder.ERPIDref,
                                OrderID     = SelectedSubOrder.OrderID,
                                ReleaseTime = SelectedSubOrder.ReleaseTime,
                                Destination = SelectedSubOrder.Destination
                            });
                            _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Cancel suborder: {DetailedOrder.Order.ToString()}");
                        }
                        break;

                    case CommandType.DeleteCommand:
                        using (WMSToUIClient client = new WMSToUIClient())
                        {
                            client.CancelCommand(new DTOCommand
                            {
                                ID = SelectedCommand.WMSID
                            });
                            _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Delete command: |{SelectedCommand.WMSID}|");
                        }
                        break;

                    case CommandType.ClearRamp:
                        if (_dbservicewms.ClearRamp(SelectedPlaceID))
                        {
                            _warehouse.DBService.ClearRamp(SelectedPlaceID);
                            _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Clear ramp: |{SelectedPlaceID}|");
                        }
                        break;

                    case CommandType.ReleaseRamp:
                        using (WMSToUIClient client = new WMSToUIClient())
                        {
//                                client.ReleaseRamp(SelectedPlaceID);
                        }
                        //_dbservicewms.ReleaseRamp(SelectedPlaceID);
                        _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Release ramp: |{SelectedPlaceID}|");
                        break;
                    }
                    VisibleOrder = true;
                    VisibleRamp  = false;
                    _selectedCmd = CommandType.None;
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Event.EnumSeverity.Error, Event.EnumType.Exception, 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));
            }
        }