|  | @@ -119,12 +119,10 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
 | 
	
		
			
				|  |  |              int serialNumber = 1;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              //------------------加载模块,获取数据-------------------------------------------------
 | 
	
		
			
				|  |  | -            //if (m_otsreport_export.m_ReportApp.im_ParticlesGridDevidePage!=null)
 | 
	
		
			
				|  |  |              m_otsreport_export.m_ReportApp.im_ParticlesGridDevidePage = new ParticlesGridDevidePage(m_otsreport_export.m_ReportApp);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              //根据sql条件,查询获取颗粒信息数据
 | 
	
		
			
				|  |  |              ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath);
 | 
	
		
			
				|  |  | -            //DataTable dt_ParticlesGridDevidePage = fielddata.GetInfoForPartucleDevidePage(0, 200, "fieldid,particleid", "");
 | 
	
		
			
				|  |  |              DataTable dt = fielddata.GetIncaSurfaceData();
 | 
	
		
			
				|  |  |              //将颗粒大小排序(从大到小)
 | 
	
		
			
				|  |  |              DataView dv = dt.DefaultView;
 | 
	
	
		
			
				|  | @@ -340,36 +338,33 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
 | 
	
		
			
				|  |  |              DirectoryInfo theFolder = new DirectoryInfo(str_path_FIELD_FILES_MARK);
 | 
	
		
			
				|  |  |              if (theFolder.Exists)
 | 
	
		
			
				|  |  |              {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                foreach (FileInfo nextifile in theFolder.GetFiles())
 | 
	
		
			
				|  |  | +                for (int i = 0; i <= theFolder.GetFiles().Count(); i++)
 | 
	
		
			
				|  |  |                  {
 | 
	
		
			
				|  |  | -                    if (nextifile.Name.Contains(".bmp") == true || nextifile.Name.Contains(".BMP") == true)
 | 
	
		
			
				|  |  | +                    //判断i.bmp图片是否存在,如果不存在跳出当前循环
 | 
	
		
			
				|  |  | +                    if (!DetermineWhetherTheFileExists(theFolder, i))
 | 
	
		
			
				|  |  | +                        continue;
 | 
	
		
			
				|  |  | +                    //在数据表中有颗粒在该帧图中的话,则对该帧图标记图像进行读取存入数据库
 | 
	
		
			
				|  |  | +                    DataRow[] datarowlist = dt_ParticlesGridDevidePage.Select(" fieldid = " + i);
 | 
	
		
			
				|  |  | +                    if (datarowlist.Count() > 0)
 | 
	
		
			
				|  |  |                      {
 | 
	
		
			
				|  |  | -                        //确认对应的帧图名
 | 
	
		
			
				|  |  | -                        string str_fieldid = Path.GetFileNameWithoutExtension(nextifile.Name);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                        //在数据表中有颗粒在该帧图中的话,则对该帧图标记图像进行读取存入数据库
 | 
	
		
			
				|  |  | -                        DataRow[] datarowlist = dt_ParticlesGridDevidePage.Select(" fieldid = " + str_fieldid);
 | 
	
		
			
				|  |  | -                        if (datarowlist.Count() > 0)
 | 
	
		
			
				|  |  | -                        {
 | 
	
		
			
				|  |  | -                            Bitmap ls_bp_fieldmark = new Bitmap(nextifile.FullName);
 | 
	
		
			
				|  |  | +                        Bitmap ls_bp_fieldmark = new Bitmap(theFolder.GetFiles()[i].FullName);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                            DataRow dr = DT_field_dt.NewRow();
 | 
	
		
			
				|  |  | -                            MemoryStream newms_bp_fieldmark = new MemoryStream();
 | 
	
		
			
				|  |  | -                            ls_bp_fieldmark.Save(newms_bp_fieldmark, System.Drawing.Imaging.ImageFormat.Bmp);
 | 
	
		
			
				|  |  | -                            newms_bp_fieldmark.Seek(0, SeekOrigin.Begin);
 | 
	
		
			
				|  |  | -                            byte[] newarr_fieldmark = new byte[newms_bp_fieldmark.Length];
 | 
	
		
			
				|  |  | -                            newms_bp_fieldmark.Read(newarr_fieldmark, 0, newarr_fieldmark.Length);
 | 
	
		
			
				|  |  | -                            dr["FieldImg"] = newarr_fieldmark;
 | 
	
		
			
				|  |  | -                            dr["FieldId"] = str_fieldid;
 | 
	
		
			
				|  |  | +                        DataRow dr = DT_field_dt.NewRow();
 | 
	
		
			
				|  |  | +                        MemoryStream newms_bp_fieldmark = new MemoryStream();
 | 
	
		
			
				|  |  | +                        ls_bp_fieldmark.Save(newms_bp_fieldmark, System.Drawing.Imaging.ImageFormat.Bmp);
 | 
	
		
			
				|  |  | +                        newms_bp_fieldmark.Seek(0, SeekOrigin.Begin);
 | 
	
		
			
				|  |  | +                        byte[] newarr_fieldmark = new byte[newms_bp_fieldmark.Length];
 | 
	
		
			
				|  |  | +                        newms_bp_fieldmark.Read(newarr_fieldmark, 0, newarr_fieldmark.Length);
 | 
	
		
			
				|  |  | +                        dr["FieldImg"] = newarr_fieldmark;
 | 
	
		
			
				|  |  | +                        dr["FieldId"] = i;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                            ls_bp_fieldmark.Dispose();
 | 
	
		
			
				|  |  | -                            DT_field_dt.Rows.Add(dr);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | +                        ls_bp_fieldmark.Dispose();
 | 
	
		
			
				|  |  | +                        DT_field_dt.Rows.Add(dr);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +               
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -378,6 +373,8 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
 | 
	
		
			
				|  |  |              #region 插入-前20颗粒外的颗粒
 | 
	
		
			
				|  |  |              for (int i_row = 0; i_row < dt_ParticlesGridDevidePage.Rows.Count; i_row++)
 | 
	
		
			
				|  |  |              {
 | 
	
		
			
				|  |  | +                if (dt_ParticlesGridDevidePage.Rows[i_row]["element"].ToString() == "")
 | 
	
		
			
				|  |  | +                    continue;
 | 
	
		
			
				|  |  |                  //获取颗粒的fieldid,和particleid
 | 
	
		
			
				|  |  |                  string str_fieldid = dt_ParticlesGridDevidePage.Rows[i_row]["fieldid"].ToString();
 | 
	
		
			
				|  |  |                  if (Convert.ToInt32(str_fieldid) < 20)
 | 
	
	
		
			
				|  | @@ -475,6 +472,19 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              return true;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        private bool DetermineWhetherTheFileExists(DirectoryInfo theFolder ,int id)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            foreach (FileInfo nextifile in theFolder.GetFiles())
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                if (nextifile.Name.Contains(id.ToString()+".bmp") == true || nextifile.Name.Contains(id.ToString()+".BMP") == true)
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    return true;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            return false;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          #endregion
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          #region 插入颗粒尺寸表
 |