示例#1
0
        protected virtual void FixedAsset_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            FixedAsset asset = (FixedAsset)e.Row;

            // AssetID can be <0 when the datasource inserts a temporary record on redirect from selector
            if (asset == null || asset.AssetID < 0)
            {
                return;
            }

            FADetails assetdet = PXSelect <FADetails, Where <FADetails.assetID, Equal <Required <FADetails.assetID> > > > .Select(this, asset.AssetID);

            try
            {
                AssetProcess.ThrowDisabled_Dispose(this, asset, assetdet, fasetup.Current, (DateTime)Filter.Current.DisposalDate, Filter.Current.DisposalPeriodID, Filter.Current.DeprBeforeDisposal == true);
            }
            catch (PXException exc)
            {
                PXUIFieldAttribute.SetEnabled <FixedAsset.selected>(sender, asset, false);
                sender.RaiseExceptionHandling <FixedAsset.selected>(asset, null, new PXSetPropertyException(exc.MessageNoNumber, PXErrorLevel.RowWarning));
            }
            if (Filter.Current.DisposalAmtMode == DisposalFilter.disposalAmtMode.Manual && asset.Selected == true && asset.DisposalAmt == null)
            {
                sender.RaiseExceptionHandling <FixedAsset.disposalAmt>(asset, null, new PXSetPropertyException(ErrorMessages.FieldIsEmpty, PXUIFieldAttribute.GetDisplayName <FixedAsset.disposalAmt>(sender)));
            }
        }
示例#2
0
        private void SetProcessDelegate()
        {
            BalanceFilter filter     = Filter.Current;
            bool          depriciate = filter.Action == BalanceFilter.action.Depreciate;

            Balances.SetProcessDelegate(delegate(List <FABookBalance> list)
            {
                if (PXLongOperation.GetTaskList().Where(_ => _.Screen == "FA.50.20.00").ToArray().Length > 1)
                {
                    throw new PXException(Messages.AnotherDeprRunning);
                }

                List <FABookBalance> balances = GetProcessableRecords(list);

                if (depriciate)
                {
                    AssetProcess.DepreciateAsset(balances, null, filter.PeriodID, true);
                }
                else
                {
                    AssetProcess.CalculateAsset(balances, filter.PeriodID);
                }
            });

            bool canDepreciate = !string.IsNullOrEmpty(filter.PeriodID) && fasetup.Current.UpdateGL == true;

            PXUIFieldAttribute.SetEnabled <BalanceFilter.action>(Filter.Cache, filter, canDepreciate);
            if (!canDepreciate)
            {
                filter.Action = BalanceFilter.action.Calculate;
            }
        }
示例#3
0
 protected override void OnPreload(GUnit unit, List <IObservable <Unit> > taskList)
 {
     taskList.Add(AssetProcess.Load <GameObject>("Prefabs/UI/PreloadItem").Do(asset =>
     {
         asset.Prespawn(10);
     }).AsUnitObservable());
 }
        protected virtual void FixedAsset_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            FixedAsset asset = (FixedAsset)e.Row;

            // AssetID can be <0 when the datasource inserts a temporary record on redirect from selector
            if (asset == null || asset.AssetID < 0)
            {
                return;
            }

            FADetailsTransfer det = PXSelect <FADetailsTransfer, Where <FADetailsTransfer.assetID, Equal <Current <FixedAsset.assetID> > > > .SelectSingleBound(this, new object[] { asset });

            try
            {
                AssetProcess.ThrowDisabled_Transfer(this, asset, det);
            }
            catch (PXException exc)
            {
                PXUIFieldAttribute.SetEnabled <FixedAsset.selected>(sender, asset, false);
                sender.RaiseExceptionHandling <FixedAsset.selected>(asset, null, new PXSetPropertyException(exc.MessageNoNumber, PXErrorLevel.RowWarning));
            }

            if (string.IsNullOrEmpty(det.TransferPeriodID))
            {
                PXUIFieldAttribute.SetEnabled <FixedAsset.selected>(sender, asset, false);
                sender.RaiseExceptionHandling <FADetailsTransfer.transferPeriodID>(asset, null, new PXSetPropertyException(Messages.NextPeriodNotGenerated));
            }
        }
示例#5
0
    protected async void LoadGame(bool isSimulate = true)
    {
        var moduleGroupTypeConfigPath = AssetPath.GetAssetPathFromResourcePath(Constant.MODULE_GROUP_TYPE_CONFIG_PATH);
        var moduleGroupTypeConfig     = Resources.Load <LayerMaskConfig>(moduleGroupTypeConfigPath);

        var worldMgr = WorldManager.Instance;

        worldMgr.Module.Init(moduleGroupTypeConfig);

        var unitTypeConfigPath = AssetPath.GetAssetPathFromResourcePath(Constant.UNIT_TYPE_CONFIG_PATH);
        var unitTypeConfig     = Resources.Load <LayerConfig>(unitTypeConfigPath);

        worldMgr.Unit.Init(unitTypeConfig);
        RegisterECSModule();

        IAssetLoader customLoader = null;

#if UNITY_EDITOR
        if (isSimulate)
        {
            customLoader = new SimulateAssetLoader();
        }
#endif
        worldMgr.Factory.CreateAssetProcess("http://localhost:8000/AssetBundles");
        await AssetProcess.Init(customLoader);

        worldMgr.Factory.CreateUIProcess();

        RegisterGameModule();

        StartGame();
    }
示例#6
0
        protected override void OnShow(GUnit unit, PanelData panel, params object[] args)
        {
            var preloadPanelData = panel as UIPreloadTestPanelData;
            var asset            = AssetProcess.Get <GameObject>("Prefabs/UI/PreloadItem");

            for (var i = 0; i < 10; i++)
            {
                var preloadItem = asset.Spawn();
                preloadItem.transform.SetParent(preloadPanelData.grid.transform);
            }
        }
示例#7
0
        public ActionResult EditAsset(FixAssetViewModel assetModel)
        {
            FixAsset assetToEdit = new FixAsset();

            assetToEdit.AssetTag      = assetModel.AssetTag;
            assetToEdit.FixAssetID    = assetModel.FixAssetID;
            assetToEdit.SerialNumber  = assetModel.SerialNumber;
            assetToEdit.Model         = assetModel.Model;
            assetToEdit.Brand         = assetModel.Brand;
            assetToEdit.AssetClassID  = assetModel.AssetClassID;
            assetToEdit.AssetStatusID = assetModel.AssetStatusID;
            assetToEdit.AssetTypeID   = assetModel.AssetTypeID;
            assetToEdit.IssuerID      = assetModel.IssuerID;
            assetToEdit.LocationID    = assetModel.LocationID;
            assetToEdit.Remarks       = assetModel.Remarks;

            if (assetModel.AcquisitionDate != null)
            {
                assetToEdit.AcquisitionDate = assetModel.AcquisitionDate;
            }

            if (assetModel.ExpiryDate != null)
            {
                assetToEdit.ExpiryDate = assetModel.ExpiryDate;
            }


            AssetProcess assetProcess = new AssetProcess();

            try
            {
                if (assetProcess.Update(assetToEdit) == FASTConstant.RETURN_VAL_SUCCESS)
                {
                    TempData[FASTConstant.TMPDATA_RESULT]       = FASTConstant.SUCCESSFUL;
                    TempData[FASTConstant.TMPDATA_SOURCE]       = "Edit Fix Asset";
                    TempData[FASTConstant.TMPDATA_EXTRAMESSAGE] = "The asset has been successfully modified.";
                    TempData[FASTConstant.TMPDATA_ACTION]       = "Index";
                    TempData[FASTConstant.TMPDATA_CONTROLLER]   = "FixAsset";

                    return(View("~/Views/Shared/Result.cshtml"));
                }
                else
                {
                    throw new Exception("There was an error while adding the new employee.");
                }
            }
            catch (Exception ex)
            {
                TempData[FASTConstant.TMPDATA_RESULT]       = FASTConstant.FAILURE;
                TempData[FASTConstant.TMPDATA_SOURCE]       = "Edit Fix Asset";
                TempData[FASTConstant.TMPDATA_EXTRAMESSAGE] = ex.Message;
                return(View("~/Views/Shared/Result.cshtml"));
            }
        }
示例#8
0
        public ActionResult EditAsset(string tag)
        {
            AssetProcess assetProcess = new AssetProcess();
            GenericProcess <Location>   locationProcess = new GenericProcess <Location>();
            GenericProcess <Issuer>     issuerProcess   = new GenericProcess <Issuer>();
            GenericProcess <AssetType>  typeProcess     = new GenericProcess <AssetType>();
            GenericProcess <AssetStatu> statusProcess   = new GenericProcess <AssetStatu>();
            GenericProcess <AssetClass> classProcess    = new GenericProcess <AssetClass>();


            string assetTag = tag;

            vwFixAssetList assetToEdit = assetProcess.GetFixAssetByAssetTag(assetTag);

            FixAssetViewModel assetView = new FixAssetViewModel();

            assetView.AssetTag      = assetToEdit.AssetTag;
            assetView.FixAssetID    = assetToEdit.FixAssetID;
            assetView.SerialNumber  = assetToEdit.SerialNumber;
            assetView.Model         = assetToEdit.Model;
            assetView.Brand         = assetToEdit.Brand;
            assetView.AssetClassID  = assetToEdit.AssetClassID;
            assetView.AssetStatusID = assetToEdit.AssetStatusID;
            assetView.AssetTypeID   = assetToEdit.AssetTypeID;
            assetView.IssuerID      = assetToEdit.IssuerID;
            assetView.LocationID    = assetToEdit.LocationID;
            assetView.Remarks       = assetToEdit.Remarks;

            if (assetToEdit.AcquisitionDate != null)
            {
                assetView.AcquisitionDate = assetToEdit.AcquisitionDate;
            }


            if (assetToEdit.ExpiryDate != null)
            {
                assetView.ExpiryDate = assetToEdit.ExpiryDate;
            }

            ViewBag.Location    = locationProcess.GetAll().ToList();
            ViewBag.Issuer      = issuerProcess.GetAll().ToList();
            ViewBag.AssetType   = typeProcess.GetAll().ToList();
            ViewBag.AssetStatus = statusProcess.GetAll().ToList();
            ViewBag.AssetClass  = classProcess.GetAll().ToList();

            return(View(assetView));
        }
示例#9
0
    protected override void StartGame()
    {
        // spawn / despwn 接口只能用 asset资源(不能是实例化出来的资源)调用,为了统一管理资源!
        AssetProcess.Load <GameObject>("Prefabs/Actor/Plane1").Subscribe(asset =>
        {
            asset.Spawn();
        });

        AssetProcess.Load <GameObject>("Prefabs/Actor/Cube1").Subscribe(asset =>
        {
            var cubeList = new List <GameObject>();
            for (var i = 0; i < 15; i++)
            {
                var cubeAsset  = asset.Spawn();
                cubeAsset.name = "cube_" + i;
                cubeAsset.transform.position = new Vector3(URandom.Range(0, 10),
                                                           URandom.Range(0, 10), URandom.Range(0, 10));
                cubeList.Add(cubeAsset);
            }

            for (var i = 10; i < 15; i++)
            {
                cubeList[i].Despawn();
            }

            var cubeArray = cubeList.ToArray();
            AssetProcess.ClearUnusedAsset();
            Observable.Timer(TimeSpan.FromSeconds(2)).Subscribe(_ =>
            {
                Log.I("Cube list fter clear unused asset!");
                foreach (var cube in cubeArray)
                {
                    Log.I("cube {0}", cube);
                }

                AssetProcess.ClearByAssetPrefix("Prefabs/Actor");
                Observable.Timer(TimeSpan.FromSeconds(2)).Subscribe(time =>
                {
                    Log.I("Cube list fter clear asset by prefix {0}!", "Prefabs/Actor");
                    foreach (var cube in cubeArray)
                    {
                        Log.I("cube {0}", cube);
                    }
                });
            });
        });
    }
示例#10
0
        protected virtual void BalanceFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            if (e.Row != null)
            {
                BalanceFilter filter = Filter.Current;

                if (Depreciate)
                {
                    Balances.SetProcessDelegate(delegate(List <FABookBalance> list)
                    {
                        if (PXLongOperation.GetTaskList().Where(_ => _.Screen == "FA.50.20.00").ToArray().Count() > 1)
                        {
                            throw new PXException(Messages.AnotherDeprRunning);
                        }
                        AssetProcess.DepreciateAsset(list, null, filter.PeriodID, true);
                    });
                }
                else
                {
                    Balances.SetProcessDelegate(delegate(List <FABookBalance> list)
                    {
                        if (PXLongOperation.GetTaskList().Where(_ => _.Screen == "FA.50.20.00").ToArray().Count() > 1)
                        {
                            throw new PXException(Messages.AnotherDeprRunning);
                        }
                        AssetProcess.CalculateAsset(list, filter.PeriodID);
                    });
                }

                Balances.SetProcessVisible(false);
                Balances.SetProcessAllVisible(false);

                PXButtonState pstate    = Actions["Process"].GetState(e.Row) as PXButtonState;
                PXButtonState pastate   = Actions["ProcessAll"].GetState(e.Row) as PXButtonState;
                bool          penabled  = pstate == null || pstate.Enabled;
                bool          paenabled = pastate == null || pastate.Enabled;

                Calculate.SetEnabled(penabled);
                CalculateAll.SetEnabled(paenabled);

                CalcDepr.SetEnabled(!string.IsNullOrEmpty(filter.PeriodID) && fasetup.Current.UpdateGL == true && penabled);
                CalcDeprAll.SetEnabled(!string.IsNullOrEmpty(filter.PeriodID) && fasetup.Current.UpdateGL == true && paenabled);
            }
        }
示例#11
0
        public ActionResult Search(string assetTag = "", string serialNumber = "", int statusID = -1)
        {
            //FixAssetManagementProcess fixAssetManagement = new FixAssetManagementProcess();
            //BaseProcess baseProc = new BaseProcess();
            //List<FixAssetModel> assets = fixAssetManagement.Search(assetTag, serialNumber, statusID);

            //ViewBag.AssetStatus = baseProc.GetAllAssetStatus();

            AssetProcess assetProcess = new AssetProcess();

            List <vwFixAssetList>       resultList    = assetProcess.SearchAsset(anAssetTag: assetTag, aSerialNumber: serialNumber, aStatusID: statusID).ToList();
            GenericProcess <AssetStatu> statusProcess = new GenericProcess <AssetStatu>();

            ViewBag.AssetStatus = statusProcess.GetAll().ToList();

            TempData["Assets"] = resultList;

            return(View("Index", resultList));
        }
示例#12
0
        protected virtual void FABookBalance_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            FABookBalance bal = (FABookBalance)e.Row;

            if (bal == null || PXLongOperation.Exists(UID))
            {
                return;
            }

            try
            {
                AssetProcess.CheckUnreleasedTransactions(this, bal);
            }
            catch (PXException exc)
            {
                PXUIFieldAttribute.SetEnabled <FABookBalance.selected>(sender, bal, false);
                sender.RaiseExceptionHandling <FABookBalance.selected>(bal, null, new PXSetPropertyException(exc.MessageNoNumber, PXErrorLevel.RowWarning));
            }
        }
示例#13
0
    protected override void StartGame()
    {
        var moduleMgr = WorldManager.Instance.Module;
        var gameCore  = WorldManager.Instance.Unit.GetUnit(Constant.GAME_CORE_UNIT_NAME);

        gameCore.UpdateRequiredModuleGroup(moduleMgr.TagToModuleGroupType(Constant.SYNC_MODULE_GROUP_NAME));
        var syncServerData = gameCore.AddData <ObjectSyncServerData>();

        gameCore.UpdateMeetModuleList();

        var factory = WorldManager.Instance.Factory;

        var slowDownTrapObject = GameObject.Find("Ground/SlowDownTrap");

        factory.CreateSlowDownTrap(slowDownTrapObject);

        AssetProcess.Load <GameObject>("Prefabs/Cube").Subscribe(asset =>
        {
            factory.CreatePlayer(asset);
            syncServerData.enable.Value = true;
        });
    }
示例#14
0
        public static GUnit CreateAsset(this UnitFactory factory, int requiredModuleGroup, GameObject asset, bool needSpawned = true)
        {
            var unit = WorldManager.Instance.Factory.CreateUnit(requiredModuleGroup);

            if (needSpawned)
            {
                asset.Spawn(unit.UnitId);
            }
            else
            {
                var assetData = asset.GetComponent <AssetData>();
                if (assetData == null)
                {
                    assetData = asset.AddComponent <AssetData>();
                }
                unit.AddData(assetData);

                assetData.unitId    = unit.UnitId;
                assetData.isSpawned = false;
            }

            var unitData = unit.GetData <UnitData>();

            unitData.stateTypeProperty.Subscribe(_ =>
            {
                if (_ == UnitStateType.Destroy)
                {
                    var assetData    = unit.GetData <AssetData>();
                    assetData.unitId = 0;
                    if (assetData.isSpawned)
                    {
                        assetData.isSpawned = false;
                        AssetProcess.Despawn(assetData.gameObject);
                    }
                }
            }).AddTo(unitData.disposable);
            return(unit);
        }
示例#15
0
        public ActionResult UploadFile()
        {
            ExcelHelper excelHelp = new ExcelHelper();
            List <FixAssetExcelUploadModel> assets = new List <FixAssetExcelUploadModel>();
            BulkUpload           currentUpload     = new Common.BulkUpload();
            BulkUploadProcess    bulkProcess       = new BulkUploadProcess();
            AssetProcess         assetProcess      = new AssetProcess();
            EmployeeProcess      employeeProcess   = new EmployeeProcess();
            Employee             sender            = new Employee();
            ConfigurationProcess configProcess     = new ConfigurationProcess();

            FastEmailConfiguration emailConfig = configProcess.GetEmailConfiguration();

            StringBuilder uploadLog = new StringBuilder();

            string filename         = string.Empty;
            string completeFileName = string.Empty;

            //This is for the logging
            bulkProcess.UserID     = User.Identity.Name.ToInteger();
            configProcess.UserID   = User.Identity.Name.ToInteger();
            employeeProcess.UserID = User.Identity.Name.ToInteger();
            assetProcess.UserID    = User.Identity.Name.ToInteger();


            try
            {
                #region Get Request Files
                foreach (string upload in Request.Files)
                {
                    if (!(Request.Files[upload] != null && Request.Files[upload].ContentLength > 0))
                    {
                        continue;
                    }
                    string path = HttpContext.Server.MapPath("\\App_Data\\BulkUploads");
                    filename = Path.GetFileName(Request.Files[upload].FileName);

                    //check the filename and ensure its an xlsx file
                    if (String.Compare(filename.Substring(filename.Length - 4), "xlsx", true) != 0)
                    {
                        throw new Exception("Invalid file extension.");
                    }

                    //add the current time as unique indicator
                    filename = DateTime.Now.ToFileTime().ToString() + "_" + filename;

                    // If Upload folder is not yet existing, this code will create that directory.
                    if (!System.IO.Directory.Exists(path))
                    {
                        System.IO.Directory.CreateDirectory(path);
                    }
                    completeFileName = Path.Combine(path, filename);
                    Request.Files[upload].SaveAs(completeFileName);
                }
                #endregion

                BulkUpload newFile = new BulkUpload()
                {
                    EmployeeID   = User.Identity.Name.ToInteger(),
                    FilePath     = filename,
                    TotalRecords = 0,
                    TotalInserts = 0,
                    RequestDate  = DateTime.Now,
                    Type         = FASTConstant.BULKIPLOAD_TYPE_ASSET
                };

                if (bulkProcess.Add(newFile) == FASTConstant.RETURN_VAL_SUCCESS)
                {
                    //get the current upload
                    currentUpload = bulkProcess.GetCurrentUpload(newFile.FilePath, newFile.EmployeeID);
                }

                if (currentUpload != null)
                {
                    #region Process the excel file
                    //Success! Lets process the file.
                    System.Data.DataTable fixAssetTable = new DataTable();

                    fixAssetTable = excelHelp.GetExcelDataTable(completeFileName, "SELECT * FROM [FixAsset$]");
                    fixAssetTable = excelHelp.ConvertToFixAssetTable(fixAssetTable);

                    if (fixAssetTable == null)
                    {
                        throw new Exception("The upload file contains null data.");
                    }

                    assets = fixAssetTable.ToList <Models.FixAssetExcelUploadModel>();
                    sender = employeeProcess.GetEmployeeByID(currentUpload.EmployeeID);

                    if (assets.Count > 0)
                    {
                        int totalInserts = 0;
                        currentUpload.TotalRecords = assets.Count;

                        bulkProcess.UpdateProcessingStep(currentUpload, FASTConstant.BULKUPLOAD_STATUS_INPROGRESS);

                        foreach (FixAssetExcelUploadModel asset in assets)
                        {
                            FixAsset tempAsset = new FixAsset()
                            {
                                AssetTag        = asset.AssetTag,
                                SerialNumber    = asset.SerialNumber,
                                Model           = asset.Model,
                                Brand           = asset.Brand,
                                AssetClassID    = asset.AssetClassID,
                                AssetTypeID     = asset.AssetTypeID,
                                AssetStatusID   = asset.AssetStatusID,
                                AcquisitionDate = asset.AcquisitionDate
                            };


                            if (assetProcess.Add(tempAsset) == FASTConstant.RETURN_VAL_SUCCESS)
                            {
                                totalInserts++;
                                uploadLog.AppendLine(String.Format("<p>{0} : {1} inserted.</p>", FASTConstant.SUCCESSFUL, asset.AssetTag));
                            }
                            else
                            {
                                uploadLog.AppendLine(String.Format("<p>{0} : {1} not inserted.</p>", FASTConstant.FAILURE, asset.AssetTag));
                            }
                        }

                        currentUpload.TotalInserts = totalInserts;
                        bulkProcess.UpdateProcessingStep(currentUpload, FASTConstant.BULKUPLOAD_STATUS_DONE);


                        //Send email to the requestor
                        FastEmail email = new FastEmail();
                        email.Receipients = new List <string>()
                        {
                            sender.EmailAddress
                        };
                        email.Subject  = FASTConstant.EMAIL_SIMPLE_SUBJECT.Replace("[XXX]", "Fix Asset Bulk Upload Result");
                        email.HTMLBody = FASTProcess.Helper.EmailHelper.GenerateHTMLBody(FASTProcess.Helper.EmailHelper.EmailType.BULK_UPLOAD);

                        email.HTMLBody = email.HTMLBody.Replace(FASTConstant.EMAIL_RECEIPIENT_NAME, sender.FirstName + " " + sender.LastName);
                        email.HTMLBody = email.HTMLBody.Replace(FASTConstant.EMAIL_BULKUPLOAD_INFO, bulkProcess.GenerateUploadinformationHTML(currentUpload));
                        email.HTMLBody = email.HTMLBody.Replace(FASTConstant.EMAIL_BULKUPLOAD_LOG, uploadLog.ToString());
                        email.HTMLBody = email.HTMLBody.Replace(FASTConstant.EMAIL_BULKUPLOAD_SUMMARY, bulkProcess.GenerateSummaryinformationHTML(currentUpload));

                        SMTPEmail emailSender = new SMTPEmail(emailConfig, email);
                        emailSender.SendEmail();
                    }
                    else
                    {
                        bulkProcess.UpdateProcessingStep(currentUpload, FASTConstant.BULKUPLOAD_STATUS_DONE);
                    }
                    #endregion
                }

                TempData["Result"]       = "SUCCESSFUL";
                TempData["Source"]       = "File Upload";
                TempData["ExtraMessage"] = "An email will be sent to you containing the results of the upload process.";
                TempData["Action"]       = "Index";
                TempData["Controller"]   = "FixAsset";

                return(View("~/Views/Shared/Result.cshtml"));
            }
            catch (Exception ex)
            {
                TempData["Result"]       = "FAILURE";
                TempData["Source"]       = "Fix Asset Bulk Upload";
                TempData["ExtraMessage"] = ex.Message;
                return(View("~/Views/Shared/Result.cshtml"));
            }
        }
示例#16
0
        private static List <FABookBalance> GetProcessableRecords(List <FABookBalance> list)
        {
            PXGraph graph = CreateInstance <PXGraph>();

            return(list.Where(balance => !AssetProcess.UnreleasedTransactionsExistsForAsset(graph, balance.AssetID)).ToList());
        }
        protected virtual void DoTransfer(TransferFilter filter, List <FixedAsset> list)
        {
            DocumentList <FARegister> created = new DocumentList <FARegister>(this);

            foreach (FixedAsset asset in list)
            {
                FADetails det = PXSelect <FADetails, Where <FADetails.assetID, Equal <Current <FixedAsset.assetID> > > > .SelectSingleBound(this, new object[] { asset });

                FALocationHistory location = PXSelect <FALocationHistory, Where <FALocationHistory.assetID, Equal <Current <FADetails.assetID> >, And <FALocationHistory.revisionID, Equal <Current <FADetails.locationRevID> > > > > .SelectSingleBound(this, new object[] { det });

                int?   destClassID  = filter.ClassTo ?? asset.ClassID;
                int?   destBranchID = filter.BranchTo ?? location.LocationID;
                string destDeptID   = string.IsNullOrEmpty(filter.DepartmentTo) ? location.Department : filter.DepartmentTo;

                if (location.LocationID != destBranchID || location.Department != destDeptID || asset.ClassID != destClassID)
                {
                    FADetails         copy_det = (FADetails)Details.Cache.CreateCopy(det);
                    FALocationHistory copy_loc = (FALocationHistory)Lochist.Cache.CreateCopy(location);
                    copy_loc.RevisionID      = ++copy_det.LocationRevID;
                    copy_loc.LocationID      = destBranchID;
                    copy_loc.Department      = destDeptID;
                    copy_loc.PeriodID        = filter.PeriodID;
                    copy_loc.TransactionDate = filter.TransferDate;
                    copy_loc.Reason          = filter.Reason;

                    TransactionEntry.SegregateRegister(this, (int)destBranchID, FARegister.origin.Transfer, null, filter.TransferDate, "", created);

                    Details.Update(copy_det);
                    location = Lochist.Insert(copy_loc);

                    if (asset.ClassID != destClassID)
                    {
                        asset.ClassID = destClassID;
                        AssetSelect.Cache.Update(asset);
                    }

                    FARegister reg = Register.Current;
                    AssetProcess.TransferAsset(this, asset, location, ref reg);
                }
            }
            if (Register.Current != null && created.Find(Register.Current) == null)
            {
                created.Add(Register.Current);
            }
            Actions.PressSave();
            if (fasetup.Current.AutoReleaseTransfer == true)
            {
                SelectTimeStamp();
                PXLongOperation.StartOperation(this, delegate { AssetTranRelease.ReleaseDoc(created, false); });
            }
            else if (created.Count > 0)
            {
                AssetTranRelease graph = CreateInstance <AssetTranRelease>();
                AssetTranRelease.ReleaseFilter fltr = (AssetTranRelease.ReleaseFilter)graph.Filter.Cache.CreateCopy(graph.Filter.Current);
                fltr.Origin = FARegister.origin.Transfer;
                graph.Filter.Update(fltr);
                graph.SelectTimeStamp();

                Dictionary <string, string> parameters = new Dictionary <string, string>();

                for (int i = 0; i < created.Count; ++i)
                {
                    FARegister reg = created[i];
                    reg.Selected = true;
                    graph.FADocumentList.Update(reg);
                    graph.FADocumentList.Cache.SetStatus(reg, PXEntryStatus.Updated);
                    graph.FADocumentList.Cache.IsDirty = false;

                    parameters["FARegister.RefNbr" + i] = reg.RefNbr;
                }

                parameters["PeriodFrom"] = FinPeriodIDFormattingAttribute.FormatForDisplay(filter.PeriodID);
                parameters["PeriodTo"]   = FinPeriodIDFormattingAttribute.FormatForDisplay(filter.PeriodID);
                parameters["Mode"]       = "U";

                PXReportRequiredException reportex = new PXReportRequiredException(parameters, "FA642000", "Preview");
                throw new PXRedirectWithReportException(graph, reportex, "Release FA Transaction");
            }
        }
示例#18
0
    protected override void StartGame()
    {
        // spawn / despwn 接口只能用 asset资源(不能是实例化出来的资源)调用,为了统一管理资源!
        AssetProcess.Load <GameObject>("Prefabs/Actor/Plane1").Subscribe(asset =>
        {
            asset.Spawn();
        });

        AssetProcess.Load <GameObject>("Prefabs/Actor/Cube1").Subscribe(asset =>
        {
            var cubeList = new Queue <GameObject>();
            for (var i = 0; i < 10; i++)
            {
                var cubeAsset  = asset.Spawn();
                cubeAsset.name = "cube_" + i;
                cubeAsset.transform.position = new Vector3(URandom.Range(0, 10),
                                                           URandom.Range(0, 10), URandom.Range(0, 10));
                cubeList.Enqueue(cubeAsset);

                Log.I("spawned " + cubeAsset.name);
            }

            Observable.Interval(TimeSpan.FromSeconds(3)).Subscribe(_ =>
            {
                if (cubeList.Count <= 6)
                {
                    var random = URandom.Range(0, 10 - cubeList.Count);
                    for (var i = 0; i < random; i++)
                    {
                        var cubeAsset = asset.Spawn();
                        cubeAsset.transform.position = new Vector3(URandom.Range(0, 10),
                                                                   URandom.Range(0, 10), URandom.Range(0, 10));
                        cubeList.Enqueue(cubeAsset);

                        Log.I("spawned " + cubeAsset.name);
                    }
                }
                else
                {
                    var random = URandom.Range(0, 5);
                    for (var i = 0; i < random; i++)
                    {
                        var cubeAsset = cubeList.Dequeue();
                        Log.I("despawned " + cubeAsset.name);
                        cubeAsset.Despawn();
                    }
                }
            });
        }).AddTo(disposables);

        AssetProcess.Load <GameObject>("Prefabs/Actor/Sphere1").Subscribe(asset =>
        {
            var sphereList = new Queue <GameObject>();
            for (var i = 0; i < 8; i++)
            {
                var sphereAsset  = asset.Spawn();
                sphereAsset.name = "sphere_" + i;
                sphereAsset.transform.position = new Vector3(URandom.Range(0, 10),
                                                             URandom.Range(0, 10), URandom.Range(0, 10));
                sphereList.Enqueue(sphereAsset);

                Log.I("spawned " + sphereAsset.name);
            }

            Observable.Interval(TimeSpan.FromSeconds(5)).Subscribe(_ =>
            {
                if (sphereList.Count <= 4)
                {
                    var random = URandom.Range(0, 8 - sphereList.Count);
                    for (var i = 0; i < random; i++)
                    {
                        var sphereAsset = asset.Spawn();
                        sphereAsset.transform.position = new Vector3(URandom.Range(0, 10),
                                                                     URandom.Range(0, 10), URandom.Range(0, 10));
                        sphereList.Enqueue(sphereAsset);

                        Log.I("spawned " + sphereAsset.name);
                    }
                }
                else
                {
                    var random = URandom.Range(0, 5);
                    for (var i = 0; i < random; i++)
                    {
                        var sphereAsset = sphereList.Dequeue();
                        Log.I("despawned " + sphereAsset.name);
                        sphereAsset.Despawn();
                    }
                }
            });
        }).AddTo(disposables);
    }
示例#19
0
 public AssetController(AssetProcess assetProcess)
 {
     _assetProcess = assetProcess;
 }