public WIPProdRoute(Session session, ProdRoute pRoute) : base(session) { _ProdRoute = pRoute; OnChanged("ProdRoute"); if (pRoute.ProdOrder.KitQty > pRoute.WipQty) _Qty = pRoute.WipQty; else _Qty = pRoute.ProdOrder.KitQty; _Qty = pRoute.WipQty; foreach (ProdRouteListTransfer listTransfer in pRoute.ProdOrder.ProdRouteListTransfers) { if (listTransfer.Status == ProdRouteListTransfer.ProdRouteListStatus.Waiting && listTransfer.FromProdRoute == pRoute && listTransfer.ToProdRoute == null) { _Qty = _Qty - listTransfer.Qty - listTransfer.ScrapQty; } } if (_Qty < 0) _Qty = 0; OnChanged("Qty"); }
private void CreateRouteTransfer(ProdRoute prodRoute, SimpleActionExecuteEventArgs e) { XPObjectSpace objectSpace = (XPObjectSpace)Application.CreateObjectSpace(); ProdRouteListTransfer rListTransfer = objectSpace.CreateObject<ProdRouteListTransfer>(); ProdOrder parentProdOrder = objectSpace.Session.GetObjectByKey<ProdOrder>(prodRoute.ProdOrder.Oid); ProdRoute pRoute = objectSpace.Session.GetObjectByKey<ProdRoute>(prodRoute.Oid); rListTransfer.ProdOrder = parentProdOrder; rListTransfer.FromProdRoute = pRoute; rListTransfer.Qty = pRoute.WipQty - pRoute.PendingQty(); if (rListTransfer.Qty < 0) rListTransfer.Qty = 0; rListTransfer.ScrapQty = 0; rListTransfer.ToProdRoute = pRoute.GetNextRoute(); e.ShowViewParameters.CreatedView = Application.CreateDetailView(objectSpace, rListTransfer); 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); }
private void GenearteProdRoute() { //using (UnitOfWork uow = (UnitOfWork)Session) //{ if (Item != null) { foreach (RouteLine routeLine in Item.RouteLines) { ProdRoute prodRoute = new ProdRoute(Session); prodRoute.NextOperNo = routeLine.NextOperNo; prodRoute.OperNo = routeLine.OperNo; prodRoute.ProcessQty = routeLine.ProcessQty; prodRoute.ProdOrder = this; prodRoute.QtyofWorkCenter = routeLine.QtyofWorkCenter; prodRoute.RunTime = routeLine.RunTime; prodRoute.SetupTime = routeLine.SetupTime; prodRoute.WorkCenter = routeLine.WorkCenter; prodRoute.WorkOper = routeLine.WorkOper; prodRoute.WorkDesc = routeLine.WorkDesc; prodRoute.wipItem = routeLine.wipItem; prodRoute.Save(); } } //} }