Esempio n. 1
0
        protected virtual void INBarCodeItem_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            INBarCodeItem row = (INBarCodeItem)e.Row;

            if (row != null && row.AutoAddLine == true && this.AddByBarCode.VerifyRequired(true) && row.Qty > 0)
            {
                UpdatePhysicalQty();
            }
        }
Esempio n. 2
0
        private void UpdatePhysicalQty()
        {
            INBarCodeItem item = AddByBarCode.Current;
            INPIHeader    d    = this.PIHeader.Current;

            this.SelectTimeStamp();

            using (PXTransactionScope sc = new PXTransactionScope())
            {
                INPIDetail detail =
                    PXSelectReadonly <INPIDetail,
                                      Where <INPIDetail.pIID, Equal <Current <INPIHeader.pIID> >,
                                             And <INPIDetail.inventoryID, Equal <Current <INBarCodeItem.inventoryID> >,
                                                  And <INPIDetail.subItemID, Equal <Current <INBarCodeItem.subItemID> >,
                                                       And <INPIDetail.locationID, Equal <Current <INBarCodeItem.locationID> >,
                                                            And <Where <INPIDetail.lotSerialNbr, IsNull,
                                                                        Or <INPIDetail.lotSerialNbr, Equal <Current <INBarCodeItem.lotSerialNbr> > > > > > > > > > .SelectWindowed(this, 0, 1);

                if (detail == null)
                {
                    INPIEntry entry = PXGraph.CreateInstance <INPIEntry>();
                    entry.PIHeader.Current = entry.PIHeader.Search <INPIHeader.pIID>(d.PIID);
                    detail = PXCache <INPIDetail> .CreateCopy(entry.PIDetail.Insert(new INPIDetail()));

                    detail.InventoryID = item.InventoryID;
                    detail             = PXCache <INPIDetail> .CreateCopy(entry.PIDetail.Update(detail));

                    detail.SubItemID    = item.SubItemID;
                    detail.LocationID   = item.LocationID;
                    detail.LotSerialNbr = item.LotSerialNbr;
                    detail.PhysicalQty  = item.Qty;
                    detail.ExpireDate   = item.ExpireDate;
                    entry.PIDetail.Update(detail);
                    entry.Save.Press();
                    this.PIHeader.View.RequestRefresh();
                }
                else
                {
                    detail = PXCache <INPIDetail> .CreateCopy(detail);

                    detail.PhysicalQty = detail.PhysicalQty.GetValueOrDefault() + item.Qty.GetValueOrDefault();
                    this.PIDetail.Update(detail);
                }
                sc.Complete();

                item.Description = PXMessages.LocalizeFormatNoPrefixNLA(Messages.PILineUpdated,
                                                                        AddByBarCode.GetValueExt <INBarCodeItem.inventoryID>(item).ToString().Trim(),
                                                                        Setup.Current.UseInventorySubItem == true ? ":" + AddByBarCode.GetValueExt <INBarCodeItem.subItemID>(item) : string.Empty,
                                                                        AddByBarCode.GetValueExt <INBarCodeItem.qty>(item),
                                                                        item.UOM,
                                                                        detail.LineNbr);
            }
            AddByBarCode.Reset(true);
            this.AddByBarCode.View.RequestRefresh();
            this.SelectTimeStamp();
        }
Esempio n. 3
0
        protected virtual void INBarCodeItem_LocationID_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
        {
            if (((e.NewValue as int?) == null) || (e.Row == null))
            {
                return;
            }
            INBarCodeItem d = (INBarCodeItem)e.Row;

            INPIReview.ValidateInventory(this, d.InventoryID, (int?)e.NewValue);
        }
Esempio n. 4
0
        protected virtual void INBarCodeItem_LocationID_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
        {
            INBarCodeItem detail = (INBarCodeItem)e.Row;

            if (e.NewValue as int? == null || detail == null)
            {
                return;
            }

            try
            {
                ValidatePIInventoryLocation(detail.InventoryID, (int?)e.NewValue);
            }
            catch (PXSetPropertyException ex)
            {
                var invalidLocation = INLocation.PK.Find(this, (int)e.NewValue);
                e.NewValue = invalidLocation?.LocationCD;
                throw ex;
            }
        }
Esempio n. 5
0
 public bool PrepareImportRow(string viewName, IDictionary keys, IDictionary values)
 {
     if (string.Compare(viewName, PIDetail.View.Name, true) == 0)
     {
         PXCache       barCodeCache = AddByBarCode.Cache;
         INBarCodeItem item         = (INBarCodeItem)(AddByBarCode.Current ?? barCodeCache.CreateInstance());
         try
         {
             barCodeCache.SetValueExt <INBarCodeItem.inventoryID>(item, GetImportedValue <INPIDetail.inventoryID>(values, true));
             if (PXAccess.FeatureInstalled <FeaturesSet.subItem>())
             {
                 barCodeCache.SetValueExt <INBarCodeItem.subItemID>(item, GetImportedValue <INPIDetail.subItemID>(values, true));
             }
             if (PXAccess.FeatureInstalled <FeaturesSet.warehouseLocation>())
             {
                 barCodeCache.SetValueExt <INBarCodeItem.locationID>(item, GetImportedValue <INPIDetail.locationID>(values, true));
             }
             if (PXAccess.FeatureInstalled <FeaturesSet.lotSerialTracking>())
             {
                 barCodeCache.SetValueExt <INBarCodeItem.lotSerialNbr>(item, GetImportedValue <INPIDetail.lotSerialNbr>(values, false));
             }
             barCodeCache.SetValueExt <INBarCodeItem.qty>(item, GetImportedValue <INPIDetail.physicalQty>(values, true));
             barCodeCache.SetValueExt <INBarCodeItem.autoAddLine>(item, false);
             barCodeCache.Update(item);
             UpdatePhysicalQty();
         }
         catch (Exception e)
         {
             PXTrace.WriteError(IN.Messages.RowError, excelRowNumber, e.Message);
             importHasError = true;
         }
         finally
         {
             excelRowNumber++;
         }
     }
     return(false);
 }