Пример #1
0
        public override int GetHashCode()
        {
            int hashCode = -1849913550;

            if (Type != null)
            {
                hashCode += Type.GetHashCode();
            }

            if (PhysicalCount != null)
            {
                hashCode += PhysicalCount.GetHashCode();
            }

            if (Adjustment != null)
            {
                hashCode += Adjustment.GetHashCode();
            }

            if (Transfer != null)
            {
                hashCode += Transfer.GetHashCode();
            }

            return(hashCode);
        }
Пример #2
0
 protected void ToString(List <string> toStringOutput)
 {
     toStringOutput.Add($"Type = {(Type == null ? "null" : Type.ToString())}");
     toStringOutput.Add($"PhysicalCount = {(PhysicalCount == null ? "null" : PhysicalCount.ToString())}");
     toStringOutput.Add($"Adjustment = {(Adjustment == null ? "null" : Adjustment.ToString())}");
     toStringOutput.Add($"Transfer = {(Transfer == null ? "null" : Transfer.ToString())}");
 }
Пример #3
0
 public PhysicalCountForm(PhysicalCount count)
 {
     InitializeComponent();
     this.PhysicalCount          = count;
     listView1.Resize           += delegate { columnHeader2.Width = listView1.Width - 22 - (columnHeader1.Width + columnHeader3.Width + columnHeader4.Width + columnHeader5.Width); };
     addToolStripMenuItem.Click += delegate { buttonAdd.PerformClick(); };
 }
Пример #4
0
 void ListView1DoubleClick(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         PhysicalCount c = counts[listView1.SelectedItems[0].Index];
         WorkbenchSingleton.AddChild(new PhysicalCountForm(c), "Edit Physical Count");
     }
 }
        public ActionResult Create()
        {
            var physicalCount = new PhysicalCount {
                IsNew = true
            };

            _physicalCountRepository.InsertAndCommit(physicalCount);
            return(Json(new { Id = physicalCount.Id }));
        }
Пример #6
0
 void DeleteToolStripMenuItemClick(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         foreach (ListViewItem li in listView1.SelectedItems)
         {
             PhysicalCount c = counts[li.Index];
             DeletePhysicalCount(c, null);
         }
         OnActivated(null);
     }
 }
 private void Validate(PhysicalCountModel model, PhysicalCount physicalCount, string actionName)
 {
     if (!string.IsNullOrEmpty(actionName))
     {
         if (actionName == WorkflowActionName.Approve)
         {
             if (model.PhysicalCountDate != null && model.PhysicalCountDate < DateTime.UtcNow.Date)
             {
                 ModelState.AddModelError("", _localizationService.GetResource("PhysicalCount.PhysicalCountDateCannotEarlierThanToday"));
             }
             if (physicalCount.IsApproved == true)
             {
                 ModelState.AddModelError("", _localizationService.GetResource("Record.AlreadyApproved"));
             }
         }
     }
 }
        public virtual void Approve(PhysicalCount physicalCount)
        {
            if (physicalCount.IsApproved == false)
            {
                bool needAdjust = false;
                var  adjust     = new Adjust();

                //add adjust from physical count
                foreach (var item in physicalCount.PhysicalCountItems)
                {
                    var currentQuantity = _storeService.GetTotalQuantity(item.StoreLocator.StoreId, item.StoreLocatorId, item.ItemId);
                    if (item.Count.HasValue && item.Count != currentQuantity)
                    {
                        needAdjust = true;
                        var adjustItem = new AdjustItem
                        {
                            StoreLocatorId = item.StoreLocatorId,
                            ItemId         = item.ItemId,
                            AdjustQuantity = item.Count - currentQuantity
                        };
                        adjust.AdjustItems.Add(adjustItem);
                    }
                }

                if (needAdjust == true)
                {
                    adjust.Name       = adjust.Description = string.Format("Auto Generated adjust for PhysicalCount {0}", physicalCount.Number);
                    adjust.AdjustDate = DateTime.UtcNow;
                    adjust.SiteId     = physicalCount.SiteId;
                    adjust.StoreId    = physicalCount.StoreId;
                    string number = _autoNumberService.GenerateNextAutoNumber(_dateTimeHelper.ConvertToUserTime(DateTime.UtcNow, DateTimeKind.Utc), adjust);
                    adjust.Number          = number;
                    adjust.PhysicalCountId = physicalCount.Id;
                    _adjustRepository.InsertAndCommit(adjust);
                }

                physicalCount.IsApproved = true;
                if (needAdjust == true)
                {
                    physicalCount.AdjustId = adjust.Id;
                }

                _physicalCountRepository.UpdateAndCommit(physicalCount);
            }
        }
Пример #9
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is InventoryChange other &&
                   ((Type == null && other.Type == null) || (Type?.Equals(other.Type) == true)) &&
                   ((PhysicalCount == null && other.PhysicalCount == null) || (PhysicalCount?.Equals(other.PhysicalCount) == true)) &&
                   ((Adjustment == null && other.Adjustment == null) || (Adjustment?.Equals(other.Adjustment) == true)) &&
                   ((Transfer == null && other.Transfer == null) || (Transfer?.Equals(other.Transfer) == true)));
        }
Пример #10
0
 public EditPhysicalCount(PhysicalCount count)
 {
     this.count = count;
 }
Пример #11
0
 void ButtonClearClick(object sender, EventArgs e)
 {
     this.PhysicalCount = new PhysicalCount();
 }
Пример #12
0
 public void Delete(PhysicalCount t)
 {
     dao.Delete(t);
 }
Пример #13
0
 public void SaveOrUpdate(PhysicalCount t)
 {
     dao.SaveOrUpdate(t);
 }