private void CreateProdOrderFinishToHKWarehouse(SimpleActionExecuteEventArgs e) { UnitOfWork uow = new UnitOfWork(); uow.BeginTransaction(); rListTransfer = (ProdRouteListTransfer)View.CurrentObject; ProdOrder prodOrder = uow.GetObjectByKey<ProdOrder>(rListTransfer.ProdOrder.Oid); WareHouse hkWH = WareHouse.Find(uow, "HK良品仓"); prodOrderFinish = new ProdOrderFinish(uow); prodOrderFinish.ProdOrder = prodOrder; prodOrderFinish.Qty = rListTransfer.Qty; prodOrderFinish.Warehouse = hkWH; prodOrderFinish.ScrapQty = rListTransfer.ScrapQty; prodOrderFinish.ScrapWarehouse = hkWH; prodOrderFinish.Save(); uow.CommitChanges(); ProdRouteListTransfer rL = uow.GetObjectByKey<ProdRouteListTransfer>(rListTransfer.Oid); prodOrderFinish.Post(uow); rL.Post(); uow.CommitTransaction(); View.ObjectSpace.Refresh(); }
private void CreateProdOrderFinish(SimpleActionExecuteEventArgs e) { objectSpace = (XPObjectSpace)Application.CreateObjectSpace(); objectSpace.Committed += new EventHandler(ObjectSpace_Committed); //ObjectSpace objectSpace = View.ObjectSpace; ProdOrder prodOrder = objectSpace.Session.FindObject<ProdOrder>(new DevExpress.Data.Filtering.BinaryOperator("Oid", rListTransfer.ProdOrder.Oid)); prodOrderFinish = objectSpace.CreateObject<ProdOrderFinish>(); prodOrderFinish.ProdOrder = prodOrder; prodOrderFinish.Qty = rListTransfer.Qty; prodOrderFinish.Warehouse = prodOrder.Warehouse; prodOrderFinish.ScrapQty = rListTransfer.ScrapQty; prodOrderFinish.ScrapWarehouse = prodOrder.ScrapWareHouse; e.ShowViewParameters.CreatedView = Application.CreateDetailView(objectSpace, prodOrderFinish); e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow; e.ShowViewParameters.Context = TemplateContext.PopupWindow; e.ShowViewParameters.CreateAllControllers = true; DialogController dialogController = new DialogController(); e.ShowViewParameters.Controllers.Add(dialogController); dialogController.Accepting += new EventHandler<DialogControllerAcceptingEventArgs>(dialogController_Accepting); }