Esempio n. 1
0
        /// <summary>
        /// 添加分析模型
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public string AddLargedataAnalysisConfig(LargedataAnalysisConfigBusinessModel data)
        {
            BasicResponse <JC_LargedataAnalysisConfigInfo> largedataAnalysisConfigResult = new BasicResponse <JC_LargedataAnalysisConfigInfo>();

            if (data.LargedataAnalysisConfigInfo.AnalysisModelPointRecordInfoList.GroupBy(g => g.ParameterId).ToList().Count == 1 && data.LargedataAnalysisConfigInfo.AnalysisModelPointRecordInfoList[0].PointId != "")
            {
                int transferCount = 20;
                //单参数.
                string[] points = data.LargedataAnalysisConfigInfo.AnalysisModelPointRecordInfoList[0].PointId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                if (points.Length <= transferCount)
                {
                    largedataAnalysisConfigResult =
                        largedataAnalysisConfigService.AddLargeDataAnalysisConfig(
                            new LargedataAnalysisConfigAddRequest()
                    {
                        JC_LargedataAnalysisConfigInfo = data.LargedataAnalysisConfigInfo
                    });
                }
                else
                {
                    DevExpress.Utils.WaitDialogForm wdf;
                    StringBuilder pointString = new StringBuilder();
                    int           k           = points.Length / transferCount;
                    int           m           = points.Length % transferCount;
                    for (int i = 0; i < k; i++)
                    {
                        wdf = new DevExpress.Utils.WaitDialogForm(string.Format("正在保存第{0}到第{1}个分析模型,共{2}个分析模型...", i * transferCount + 1, (i + 1) * transferCount, points.Length), "请等待...");
                        pointString.Clear();
                        for (int j = 0; j < transferCount; j++)
                        {
                            pointString.Append(points[i * transferCount + j]).Append(",");
                        }

                        foreach (var item in data.LargedataAnalysisConfigInfo.AnalysisModelPointRecordInfoList)
                        {
                            item.PointId = pointString.ToString().TrimEnd(',');
                        }
                        try
                        {
                            largedataAnalysisConfigResult = largedataAnalysisConfigService.AddLargeDataAnalysisConfig(
                                new LargedataAnalysisConfigAddRequest()
                            {
                                JC_LargedataAnalysisConfigInfo = data.LargedataAnalysisConfigInfo
                            });
                        }
                        catch (Exception ex)
                        {
                            //log
                        }
                        finally
                        {
                            wdf.Close();
                        }
                    }
                    if (m > 0)
                    {
                        wdf = new DevExpress.Utils.WaitDialogForm(string.Format("正在保存第{0}到第{1}个分析模型,共{2}个分析模型...", k * transferCount + 1, points.Length, points.Length), "请等待...");
                        pointString.Clear();
                        for (int n = k * transferCount; n < points.Length; n++)
                        {
                            pointString.Append(points[n]).Append(",");
                        }
                        foreach (var item in data.LargedataAnalysisConfigInfo.AnalysisModelPointRecordInfoList)
                        {
                            item.PointId = pointString.ToString().TrimEnd(',');
                        }
                        try
                        {
                            largedataAnalysisConfigResult = largedataAnalysisConfigService.AddLargeDataAnalysisConfig(
                                new LargedataAnalysisConfigAddRequest()
                            {
                                JC_LargedataAnalysisConfigInfo = data.LargedataAnalysisConfigInfo
                            });
                        }
                        catch (Exception ex)
                        {
                            //log
                        }
                        finally
                        {
                            wdf.Close();
                        }
                    }
                }
            }
            else
            {
                largedataAnalysisConfigResult =
                    largedataAnalysisConfigService.AddLargeDataAnalysisConfig(
                        new LargedataAnalysisConfigAddRequest()
                {
                    JC_LargedataAnalysisConfigInfo = data.LargedataAnalysisConfigInfo
                });
            }

            if (largedataAnalysisConfigResult.IsSuccess)
            {
                data.LargedataAnalysisConfigInfo = largedataAnalysisConfigResult.Data;
                return(string.Empty);
            }
            else
            {
                return(largedataAnalysisConfigResult.Message);
            }
        }
Esempio n. 2
0
 public BasicResponse <JC_LargedataAnalysisConfigInfo> AddLargeDataAnalysisConfig(LargedataAnalysisConfigAddRequest jc_LargedataAnalysisConfigRequest)
 {
     return(_largedataAnalysisConfigService.AddLargeDataAnalysisConfig(jc_LargedataAnalysisConfigRequest));
 }