Example #1
0
        public ActionResult LockDataAll(string clientKey, string ids, string type)
        {
            var itemIdList = ids.Split(',').ToList();

            Task.Factory.StartNew(() =>
            {
                double index = 0;
                itemIdList.ForEach(r =>
                {
                    index         += 1;
                    var percent    = Math.Round(index * 100 / itemIdList.Count, 2);
                    var primaryKey = int.Parse(r);
                    var model      = _itemService.Get(i => i.SD_ITEM_ID == primaryKey);
                    var itemState  = _procStateService.DataItemProcCatCode();
                    var sdId       = _projectService.GetCurrentSD().SD_ID;
                    var procState  = _procStateService.Get(proc => proc.PROC_CONTENT_ID == r && proc.PROC_CAT_CODE == itemState && proc.SD_ID == sdId);
                    if (procState.PROC_STAT_CODE != _procStateService.HadExedProcStatCode() && procState.PROC_STAT_CODE != _procStateService.LockProcStatCode())
                    {
                        ProcessHub.GetInstance().Send(clientKey, percent.ToString(), "批量锁定", $"数据项:{model.SD_ITEM_NAME} 信息:数据项未执行,无法锁定!!!", "");
                    }
                    else if (model.IS_RESULT == 0)
                    {
                        ProcessHub.GetInstance().Send(clientKey, percent.ToString(), "批量锁定", $"数据项:{model.SD_ITEM_NAME} 信息:非结果数据项,不需要锁定!!!", "");
                    }
                    else
                    {
                        var result = _itemValueLockService.LockData(primaryKey, model);
                        ProcessHub.GetInstance()
                        .Send(clientKey, percent.ToString(), "批量锁定", $"数据项:{model.SD_ITEM_NAME} 信息:{result.Item2}!!!", "");
                    }
                });
            });
            return(View("ExecuteProgress"));;
        }
Example #2
0
        public ActionResult Demo(string primaryKey)
        {
            for (int i = 0; i < 10; i++)
            {
                Thread.Sleep(4000);
                Random ran = new Random();
                ProcessHub.GetInstance().Send(primaryKey, ran.NextDouble().ToString());
            }

            return(null);
        }
Example #3
0
        public ActionResult JobNotification(JobNotification jobNotification)
        {
            var connectionID = ProcessHub.GetConnectionIdByJobId(jobNotification.JobID);

            if (connectionID != null)
            {
                var hubContext = GlobalHost.ConnectionManager.GetHubContext <ProcessHub>();
                hubContext.Clients.Clients(new[] { connectionID }).jobCompleted(
                    jobNotification.JobID,
                    jobNotification.JobStatus,
                    JsonConvert.SerializeObject(jobNotification.User));
            }

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
Example #4
0
        public ActionResult ClearDataAll(string clientKey, string kpiArray)
        {
            try
            {
                var list = new List <KPI_EXCUTE_VIEWMODEL>();
                foreach (var item in kpiArray?.Trim('|').Split('|'))
                {
                    var id  = int.Parse(item.ToString());
                    var kpi = _kpiService.Get(r => r.SD_EKPI_ID == id);
                    if (kpi.VALUE_TABLE_ID == 1)
                    {
                        list.Add(new KPI_EXCUTE_VIEWMODEL()
                        {
                            primaryKey = item.ToString(), KPI_NAME = kpi.SD_EKPI_NAME, clientKey = clientKey
                        });
                    }
                }

                Task.Factory.StartNew(() =>
                {
                    double index = 0;
                    list.ForEach(r =>
                    {
                        index      += 1;
                        var percent = Math.Round(index * 100 / list.Count, 2);
                        _procStateService.KPIDoClear(ProjectProvider.Instance.Current.SD_ID, r.primaryKey);
                        var result = _kpiService.Clear(r.primaryKey);
                        _procLogService.Insert(new PDP_PROC_LOG()
                        {
                            PROC_CONTENT_ID = r.primaryKey,
                            SD_ID           = ProjectProvider.Instance.Current.SD_ID,
                            PROC_CAT_CODE   = "3",
                            PROC_STAT_CODE  = 3,
                        });
                        ProcessHub.GetInstance().Send(clientKey, $"{percent}%", "批量清库", $"评价指标:{r.KPI_NAME} 清库成功,共清除 {result}条!!!", "");
                    });
                });

                return(View("Progress"));;
            }
            catch (Exception e)
            {
                return(Error(e.Message));
            }
        }
Example #5
0
        public ActionResult ClearDataAll(string clientKey, string ids, string type)
        {
            var itemIdList = ids.Split(',').ToList();

            Task.Factory.StartNew(() =>
            {
                double index = 0;
                itemIdList.ForEach(r =>
                {
                    index         += 1;
                    var percent    = Math.Round(index * 100 / itemIdList.Count, 2);
                    var primaryKey = int.Parse(r);
                    var model      = _itemService.Get(i => i.SD_ITEM_ID == primaryKey);
                    var count      = _itemResultService.GetUnitDataCount(primaryKey);
                    var result     = _itemResultService.UnitClearData(primaryKey);
                    if (result == count)
                    {
                        //更新执行状态表
                        _procStateService.DataItemDoClear(model.SD_ID.Value, primaryKey.ToString());
                        //更新执行日志表
                        var proLog = new PDP_PROC_LOG()
                        {
                            SD_ID           = model.SD_ID,
                            PROC_CAT_CODE   = _procLogService.DataItemCatCode(),
                            PROC_CONTENT_ID = model.SD_ITEM_ID.ToString(),
                            PATIENT_ID      = "",
                            PROC_URL        = "",
                            PROC_STAT_CODE  = 3
                        };
                        _procLogService.Insert(proLog);
                        //更新数据项
                        _itemService.Update(model);
                    }
                    ProcessHub.GetInstance()
                    .Send(clientKey, percent.ToString(), "清库", $"数据项:{model.SD_ITEM_NAME}清库成功,共清除 {result}条!!!", "");
                });
            });
            return(View("ExecuteProgress"));;
        }
Example #6
0
        public ActionResult LockAll(string clientKey, string kpiArray)
        {
            try
            {
                var list = new List <KPI_EXCUTE_VIEWMODEL>();
                foreach (var item in kpiArray?.Trim('|').Split('|'))
                {
                    var id  = int.Parse(item.ToString());
                    var kpi = _kpiService.Get(r => r.SD_EKPI_ID == id);
                    if (kpi.VALUE_TABLE_ID == 1)
                    {
                        list.Add(new KPI_EXCUTE_VIEWMODEL()
                        {
                            primaryKey = item.ToString(), KPI_NAME = kpi.SD_EKPI_NAME, clientKey = clientKey
                        });
                    }
                }

                Task.Factory.StartNew(() =>
                {
                    double index = 0;
                    list.ForEach(r =>
                    {
                        index      += 1;
                        var percent = Math.Round(index * 100 / list.Count, 2);
                        var result  = _kpiService.LockKPI(r);
                        ProcessHub.GetInstance().Send(clientKey, $"{percent}%", "批量锁定", $"评价指标:{r.KPI_NAME} 信息:{result}!!!", "");
                    });
                });

                return(View("Progress"));;
            }
            catch (Exception e)
            {
                return(Error(e.Message));
            }
        }