public static void ProcessRecord(MyKitAssemblyEntry graph, INLocationStatus record) { graph.Setup.Current.RequireControlTotal = false; graph.Setup.Current.HoldEntry = false; INKitRegister doc = PXCache <INKitRegister> .CreateCopy(graph.Document.Insert(new INKitRegister())); doc.InventoryID = record.InventoryID; doc.SiteID = record.SiteID; doc.LocationID = record.LocationID; doc.Qty = Math.Abs((decimal)(record.QtyOnHand + record.QtyINAssemblySupply)); graph.Document.Update(doc); graph.Save.Press(); }
protected virtual void INLocation_IsCosted_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e) { if (e.Row == null) { return; } bool enable; if ((bool?)e.NewValue == true) { INLocationStatus status = PXSelect <INLocationStatus, Where <INLocationStatus.siteID, Equal <Current <INLocation.siteID> >, And <INLocationStatus.locationID, Equal <Current <INLocation.locationID> >, And <INLocationStatus.qtyOnHand, NotEqual <decimal0> > > > > .SelectSingleBound(this, new[] { e.Row }); enable = status == null; } else { INCostStatus status = PXSelect <INCostStatus, Where <INCostStatus.costSiteID, Equal <Current <INLocation.locationID> >, And <INCostStatus.qtyOnHand, Greater <decimal0> > > > .SelectSingleBound(this, new[] { e.Row }); enable = status == null; } if (!enable) { throw new PXSetPropertyException(Messages.LocationCostedWarning, PXErrorLevel.Error); } if ((bool?)e.NewValue == true) { sender.RaiseExceptionHandling <INLocation.isCosted>(e.Row, true, new PXSetPropertyException(Messages.LocationCostedSetWarning, PXErrorLevel.RowWarning)); } }
protected virtual void INLocation_TaskID_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e) { ///TODO: Redo this using Plans and Status tables once we have them in version 7.0 INLocation row = e.Row as INLocation; if (row == null) { return; } PO.POReceiptLine unreleasedPO = PXSelect <PO.POReceiptLine, Where <PO.POReceiptLine.taskID, Equal <Required <PO.POReceiptLine.taskID> >, And <PO.POReceiptLine.released, Equal <False>, And <PO.POReceiptLine.locationID, Equal <Required <INLocation.locationID> > > > > > .SelectWindowed(this, 0, 1, row.TaskID, row.LocationID); if (unreleasedPO != null) { PMTask task = PXSelect <PMTask, Where <PMTask.taskID, Equal <Required <PMTask.taskID> > > > .Select(this, row.TaskID ?? e.NewValue); if (task != null) { e.NewValue = task.TaskCD; } throw new PXSetPropertyException(Messages.TaskUsedInPO); } SO.SOShipLine unreleasedSO = PXSelect <SO.SOShipLine, Where <SO.SOShipLine.taskID, Equal <Required <SO.SOShipLine.taskID> >, And <SO.SOShipLine.released, Equal <False>, And <SO.SOShipLine.locationID, Equal <Required <INLocation.locationID> > > > > > .SelectWindowed(this, 0, 1, row.TaskID, row.LocationID); if (unreleasedSO != null) { PMTask task = PXSelect <PMTask, Where <PMTask.taskID, Equal <Required <PMTask.taskID> > > > .Select(this, row.TaskID ?? e.NewValue); if (task != null) { e.NewValue = task.TaskCD; } throw new PXSetPropertyException(Messages.TaskUsedInSO); } INLocationStatus locationStatus = PXSelect <INLocationStatus, Where <INLocationStatus.siteID, Equal <Required <INLocationStatus.siteID> >, And <INLocationStatus.locationID, Equal <Required <INLocationStatus.locationID> >, And <INLocationStatus.qtyOnHand, NotEqual <decimal0> > > > > .SelectWindowed(this, 0, 1, row.SiteID, row.LocationID); if (locationStatus != null) { PMTask task = PXSelect <PMTask, Where <PMTask.taskID, Equal <Required <PMTask.taskID> > > > .Select(this, row.TaskID ?? e.NewValue); if (task != null) { e.NewValue = task.TaskCD; } throw new PXSetPropertyException(Messages.TaskUsedInIN); } }