Ejemplo n.º 1
0
        protected virtual void INItemClass_RowPersisting(PXCache sender, PXRowPersistingEventArgs e)
        {
            if ((e.Operation & PXDBOperation.Command) == PXDBOperation.Delete)
            {
                return;
            }
            INItemClass cLass = e.Row as INItemClass;

            PX.SM.RelationGroup group = Group.Current;
            if (cLass != null && cLass.GroupMask != null && group != null && group.GroupMask != null)
            {
                if (cLass.GroupMask.Length < group.GroupMask.Length)
                {
                    byte[] mask = cLass.GroupMask;
                    Array.Resize <byte>(ref mask, group.GroupMask.Length);
                    cLass.GroupMask = mask;
                }
                for (int i = 0; i < group.GroupMask.Length; i++)
                {
                    if (group.GroupMask[i] == 0x00)
                    {
                        continue;
                    }
                    if (cLass.Included == true)
                    {
                        cLass.GroupMask[i] = (byte)(cLass.GroupMask[i] | group.GroupMask[i]);
                    }
                    else
                    {
                        cLass.GroupMask[i] = (byte)(cLass.GroupMask[i] & ~group.GroupMask[i]);
                    }
                }
            }
        }
        protected virtual void INLotSerClass_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            INLotSerClass row = (INLotSerClass)e.Row;

            if (row != null)
            {
                INItemClass classUse =
                    PXSelect <INItemClass, Where <INItemClass.lotSerClassID, Equal <Required <INItemClass.lotSerClassID> > > > .SelectWindowed(
                        this, 0, 1, row.LotSerClassID);

                InventoryItem itemUse =
                    PXSelect <InventoryItem, Where <InventoryItem.lotSerClassID, Equal <Required <INItemClass.lotSerClassID> > > > .
                    SelectWindowed(this, 0, 1, row.LotSerClassID);

                PXUIFieldAttribute.SetEnabled <INLotSerClass.lotSerTrack>(sender, row, classUse == null && itemUse == null);
                PXUIFieldAttribute.SetEnabled <INLotSerClass.lotSerTrackExpiration>(sender, row, classUse == null && itemUse == null);

                bool enable = row.LotSerTrack != INLotSerTrack.NotNumbered;

                this.lotsersegments.Cache.AllowInsert = enable;
                this.lotsersegments.Cache.AllowUpdate = enable;
                this.lotsersegments.Cache.AllowDelete = enable;

                PXUIFieldAttribute.SetEnabled <INLotSerClass.lotSerNumVal>(sender, row, enable && row.LotSerNumShared == true);
                PXUIFieldAttribute.SetEnabled <INLotSerClass.autoNextNbr>(sender, row, enable);
                PXUIFieldAttribute.SetEnabled <INLotSerClass.lotSerNumShared>(sender, row, enable);
                PXUIFieldAttribute.SetEnabled <INLotSerClass.requiredForDropship>(sender, row, row.LotSerTrack != INLotSerTrack.NotNumbered);
                PXUIFieldAttribute.SetEnabled <INLotSerClass.autoSerialMaxCount>(sender, row, enable && row.AutoNextNbr == true && row.LotSerTrack == INLotSerTrack.SerialNumbered);
                PXUIFieldAttribute.SetVisible <INLotSerClass.lotSerIssueMethod>(sender, row, row.LotSerAssign == INLotSerAssign.WhenReceived);
            }
        }
        private void SyncTreeCurrentWithPrimaryViewCurrent(INItemClass primaryViewCurrent)
        {
            if (_allowToSyncTreeCurrentWithPrimaryViewCurrent && !_forbidToSyncTreeCurrentWithPrimaryViewCurrent &&
                primaryViewCurrent != null && (ItemClasses.Current == null || ItemClasses.Current.ItemClassID != primaryViewCurrent.ItemClassID))
            {
                ItemClassTree.INItemClass current = ItemClassTree.Instance.GetNodeByID(primaryViewCurrent.ItemClassID ?? 0);
                ItemClasses.Current         = current;
                ItemClasses.Cache.ActiveRow = current;
            }

            if (_keepInventoryFilter == false)
            {
                InventoryFilter.Cache.SetValueExt <InventoryByClassFilter.inventoryID>(InventoryFilter.Current, null);
            }
        }
Ejemplo n.º 4
0
        protected virtual void INItemClass_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            INItemClass cLass = e.Row as INItemClass;

            PX.SM.RelationGroup group = Group.Current;
            if (cLass != null && cLass.GroupMask != null && group != null && group.GroupMask != null &&
                sender.GetStatus(cLass) == PXEntryStatus.Notchanged)
            {
                for (int i = 0; i < cLass.GroupMask.Length && i < group.GroupMask.Length; i++)
                {
                    if (group.GroupMask[i] != 0x00 && (cLass.GroupMask[i] & group.GroupMask[i]) == group.GroupMask[i])
                    {
                        cLass.Included = true;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        protected virtual void InventoryItem_ItemClassID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            var row = (InventoryItem)e.Row;

            if (row != null && row.ItemClassID < 0)
            {
                INItemClass ic = ItemClass.Select();
                row.ParentItemClassID = ic?.ParentItemClassID;
            }
            else if (row != null)
            {
                row.ParentItemClassID = row.ItemClassID;
            }

            if (doResetDefaultsOnItemClassChange)
            {
                ResetConversionsSettings(sender, row);

                if (PXAccess.FeatureInstalled <FeaturesSet.inventory>())
                {
                    sender.SetDefaultExt <InventoryItem.dfltSiteID>(e.Row);
                }

                if (PXAccess.FeatureInstalled <FeaturesSet.distributionModule>())
                {
                    sender.SetDefaultExt <InventoryItem.deferredCode>(e.Row);
                    sender.SetDefaultExt <InventoryItem.postClassID>(e.Row);
                    sender.SetDefaultExt <InventoryItem.markupPct>(e.Row);
                    sender.SetDefaultExt <InventoryItem.minGrossProfitPct>(e.Row);
                }

                sender.SetDefaultExt <InventoryItem.taxCategoryID>(e.Row);
                sender.SetDefaultExt <InventoryItem.itemType>(e.Row);
                sender.SetDefaultExt <InventoryItem.priceClassID>(e.Row);
                sender.SetDefaultExt <InventoryItem.accrueCost>(e.Row);
                sender.SetDefaultExt <InventoryItem.undershipThreshold>(e.Row);
                sender.SetDefaultExt <InventoryItem.overshipThreshold>(e.Row);

                INItemClass ic = ItemClass.Select();
                if (ic != null)
                {
                    sender.SetValue <InventoryItem.priceWorkgroupID>(e.Row, ic.PriceWorkgroupID);
                    sender.SetValue <InventoryItem.priceManagerID>(e.Row, ic.PriceManagerID);
                }
            }
        }
        /// <summary><see cref="InventoryByClassFilter.InventoryID"/> Updated</summary>
        protected virtual void InventoryByClassFilter_InventoryID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            var row = (InventoryByClassFilter)e.Row;

            if (row?.InventoryID != null)
            {
                INItemClass current = PXSelectReadonly2 <INItemClass,
                                                         InnerJoin <InventoryItem, On <InventoryItem.FK.ItemClass> >,
                                                         Where <InventoryItem.inventoryID, Equal <Required <InventoryItem.inventoryID> > > >
                                      .SelectWindowed(this, 0, 1, row.InventoryID);

                _allowToSyncTreeCurrentWithPrimaryViewCurrent  = true;
                _forbidToSyncTreeCurrentWithPrimaryViewCurrent = false;
                _keepInventoryFilter    = true;
                ItemClassFilter.Current = current;
            }
        }
Ejemplo n.º 7
0
        protected virtual void InventoryItem_ItemClassID_FieldVerifying(PXCache cache, PXFieldVerifyingEventArgs e)
        {
            this.doResetDefaultsOnItemClassChange = false;
            INItemClass ic = ItemClass.Select(e.NewValue);

            if (ic != null)
            {
                this.doResetDefaultsOnItemClassChange = true;
                if (e.ExternalCall && cache.GetStatus(e.Row) != PXEntryStatus.Inserted)
                {
                    if (Item.Ask(AR.Messages.Warning, Messages.ItemClassChangeWarning, MessageButtons.YesNo) == WebDialogResult.No)
                    {
                        this.doResetDefaultsOnItemClassChange = false;
                    }
                }
            }
        }
Ejemplo n.º 8
0
        public override void Persist()
        {
            using (PXTransactionScope tscope = new PXTransactionScope())
            {
                INItemClass itemClassOnTheFly = null;
                if (Item.Current != null && Item.Current.ItemClassID < 0)
                {
                    itemClassOnTheFly = ItemClass.Select();
                    var itemClassGraph = PXGraph.CreateInstance <INItemClassMaint>();
                    var itemClassCopy  = (INItemClass)itemClassGraph.itemclass.Cache.CreateCopy(itemClassOnTheFly);
                    itemClassCopy = itemClassGraph.itemclass.Insert(itemClassCopy);
                    itemClassGraph.Actions.PressSave();

                    foreach (var row in ItemClass.Cache.Inserted)
                    {
                        ItemClass.Cache.SetStatus(row, PXEntryStatus.Held);
                    }
                    Item.Current.ItemClassID = itemClassGraph.itemclass.Current.ItemClassID;
                }
                try
                {
                    base.Persist();
                }
                catch
                {
                    if (itemClassOnTheFly != null)
                    {
                        Item.Current.ItemClassID = itemClassOnTheFly.ItemClassID;
                        ItemClass.Cache.SetStatus(itemClassOnTheFly, PXEntryStatus.Inserted);
                    }
                    throw;
                }
                ItemClass.Cache.Clear();

                tscope.Complete();
            }
        }