/// <summary> SOPackageDetailExt_usrShipmentSplitLineNbr Updated Event </summary> protected virtual void _(Events.FieldUpdated <SOPackageDetailExt.usrShipmentSplitLineNbr> e) { if (e.NewValue == null) { return; } var _shipLine = Base.Transactions.Cache.Cached.RowCast <SOShipLine>().Where(x => x.LineNbr == (int?)e.NewValue).SingleOrDefault(); var _stockItemInfo = GetStockInfo(_shipLine.InventoryID.Value, _MADEIN); var _shipLineSplit = new PXGraph().Select <SOShipLineSplit>().Where(x => x.ShipmentNbr == _shipLine.ShipmentNbr && x.LineNbr == _shipLine.LineNbr); var boxsInfo = GetBoxsInfo(_shipLine.InventoryID); e.Cache.SetValueExt <SOPackageDetailEx.boxID>(e.Row, string.IsNullOrEmpty(boxsInfo.stockItemBox) ? boxsInfo.sBoxID : boxsInfo.stockItemBox); e.Cache.SetValueExt <SOPackageDetail.inventoryID>(e.Row, _shipLine.InventoryID); e.Cache.SetValueExt <SOPackageDetailExt.usrCountry>(e.Row, _stockItemInfo.GetItem <CSAnswers>()?.Value); if (!this._IsAutoPacking) { e.Cache.SetValueExt <SOPackageDetail.qty>(e.Row, _shipLine.ShippedQty); } // if ShipLineSplit count == 1 then set value if (_shipLineSplit.Count() == 1) { e.Cache.SetValueExt <SOPackageDetailExt.usrDateCode>(e.Row, _shipLineSplit.FirstOrDefault()?.LotSerialNbr); } }
/// <summary> RowPersisted ENGineering </summary> public void _(Events.RowPersisted <ENGineering> e) { int count = 0; var row = e.Row as ENGineering; if (string.IsNullOrEmpty(row.Description) || string.IsNullOrEmpty(row.Prjtype) || string.IsNullOrEmpty(row.Priority) || string.IsNullOrEmpty(row.SalesRegion)) { return; } var _RevenueData = new PXGraph().Select <ENGRevenueLine>().Where(x => x.EngrRef == row.EngrRef); if (_RevenueData.Count() == 0) { var _graph = PXGraph.CreateInstance <ENGineeringMaint>(); var _oppProduct = Base.Products.Select().RowCast <CROpportunityProducts>(); foreach (var _prod in _oppProduct) { var _data = _graph.RevenueLine.Insert(_graph.RevenueLine.Cache.CreateInstance() as ENGRevenueLine); _data.EngrRef = row.EngrRef; _data.InventoryID = _prod.InventoryID; _data.Descr = _prod.Descr; _data.Quantity = _prod.Quantity; _data.Uom = _prod.UOM; _data.UnitPrice = _prod.UnitPrice; _data.ExtPrice = _prod.ExtPrice; _data.LineNbr = ++count; } _graph.Actions.PressSave(); // update reveCntr PXUpdate <Set <ENGineering.reveCntr, Required <ENGineering.reveCntr> >, ENGineering, Where <ENGineering.engrRef, Equal <Required <ENGineering.engrRef> > > > .Update(Base, count, row.EngrRef); } }