Ejemplo n.º 1
0
        private void ExecuteConfirm()
        {
            try
            {
                EditEnabled = false;
                EnabledCC   = false;
                try
                {
                    switch (_selectedCommand)
                    {
                    case CommandType.Add:
                        _dbservicewms.AddSKUID(DetailedSKUID.SKUID);
                        SKUIDList.Add(DetailedSKUID);
                        SelectedSKUID = SKUIDList.FirstOrDefault(p => p.ID == DetailedSKUID.ID);
                        _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Add SKUID: {DetailedSKUID.SKUID.ToString()}");
                        break;

                    case CommandType.Edit:
                        _dbservicewms.UpdateSKUID(DetailedSKUID.SKUID);
                        _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Edit SKUID: {DetailedSKUID.SKUID.ToString()}");
                        SelectedSKUID.ID             = DetailedSKUID.ID;
                        SelectedSKUID.Description    = DetailedSKUID.Description;
                        SelectedSKUID.DefaultQty     = DetailedSKUID.DefaultQty;
                        SelectedSKUID.Unit           = DetailedSKUID.Unit;
                        SelectedSKUID.Layout         = DetailedSKUID.Layout;
                        SelectedSKUID.Capacity       = DetailedSKUID.Capacity;
                        SelectedSKUID.Height         = DetailedSKUID.Height;
                        SelectedSKUID.Weight         = DetailedSKUID.Weight;
                        SelectedSKUID.FrequencyClass = DetailedSKUID.FrequencyClass;
                        break;

                    default:
                        break;
                    }
                    if (DetailedSKUID != null)
                    {
                        DetailedSKUID.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));
            }
        }
Ejemplo n.º 2
0
        private async Task ExecuteRefresh()
        {
            try
            {
                SKUIDViewModel sl     = SelectedSKUID;
                var            skuids = await _dbservicewms.GetSKUIDs();

                SKUIDList.Clear();
                foreach (var p in skuids)
                {
                    SKUIDList.Add(new SKUIDViewModel {
                        ID             = p.ID,
                        Description    = p.Description,
                        DefaultQty     = p.DefaultQty,
                        Unit           = p.Unit,
                        Weight         = p.Weight,
                        FrequencyClass = p.FrequencyClass,
                        Layout         = p.Layout,
                        Capacity       = p.Capacity,
                        Height         = p.Height
                    });
                }
                foreach (var l in SKUIDList)
                {
                    l.Initialize(_warehouse);
                }
                if (sl != null)
                {
                    SelectedSKUID = SKUIDList.FirstOrDefault(p => p.ID == sl.ID);
                }
                if (SelectedSKUID == null)
                {
                    SelectedSKUID = SKUIDList.FirstOrDefault();
                }
            }
            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));
            }
        }