예제 #1
0
        /// <summary>
        /// 加载本地图片
        /// </summary>
        /// <param name="saveDir"></param>
        //private void LoadLocalImage(string saveDir)
        //{
        //    string path = GetConfig.TempPath + "\\" + Convert.ToDateTime(mWorklist.REQ_DATE_TIME).ToString("yyyyMMdd") + "\\" + mWorklist.EXAM_ACCESSION_NUM;
        //    if (!Directory.Exists(path))
        //        Directory.CreateDirectory(path);
        //    string[] files = Directory.GetFiles(path, "*.jpg");
        //    for (int i = 0; i < files.Length; i++)
        //    {
        //        string temppath = saveDir + "\\" + files[i].Substring(files[i].LastIndexOf("\\") + 1);
        //        File.Copy(files[i].ToString(), temppath, true);
        //        ImgObj imgObj = new ImgObj(temppath, false, null);
        //        arrayImg.Add(imgObj);
        //    }
        //}

        /// <summary>
        /// 加载本次检查的图片
        /// </summary>
        /// <returns>返回值0:下载成功;-1下载失败</returns>
        private int DownLoadPicture(string saveDir)
        {
            try
            {
                string    Message = "", Message2 = "", Serverpath = "", temppath = "", MarkPath = "";
                DataTable dt = Bimage.GetList("1=1 and EXAM_ACCESSION_NUM='" + mWorklist.EXAM_ACCESSION_NUM + "'order by IS_PRINT DESC");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    fileTranfer.ConnServer();//2010-03-17修改
                    Serverpath = dt.Rows[i]["IMAGE_PATH"].ToString();
                    temppath   = saveDir.TrimEnd('\\') + "\\" + Serverpath.Substring(Serverpath.LastIndexOf("\\") + 1);
                    switch (fileTranfer.FileDown(Serverpath, temppath))
                    {
                    case 1:
                        MImage Mimg   = (MImage)Bimage.GetModel(dt.Rows[i]);
                        ImgObj imgObj = new ImgObj(temppath, Convert.ToBoolean(Mimg.IS_PRINT), Mimg);
                        arrayImg.Add(imgObj);
                        break;

                    case -1:
                        Message2 += Serverpath + ",";
                        break;

                    case -2:
                        Message += Serverpath + ",";
                        break;

                    default:
                        break;
                    }
                    if (dt.Rows[i]["MARK_IMAGE_PATH"].ToString() != "")
                    {
                        MarkPath = dt.Rows[i]["MARK_IMAGE_PATH"].ToString();
                        temppath = saveDir + "\\" + MarkPath.Substring(MarkPath.LastIndexOf("/") + 1);
                        switch (fileTranfer.FileDown(MarkPath, temppath))//下载处理后的图像
                        {
                        case 1:
                            arrayImg[arrayImg.Count - 1].MarkImgPath = temppath;
                            arrayImg[arrayImg.Count - 1].MarkInf     = dt.Rows[i]["MARK_INF"].ToString();//记录图像处理信息
                            break;

                        case -1:
                            Message2 += MarkPath + ",";
                            break;

                        case -2:
                            Message += MarkPath + ",";
                            break;

                        default:
                            break;
                        }
                    }
                    if (GetConfig.IsAddLocMap)
                    {
                        this.DownLoadLocMap(saveDir, dt.Rows[i]["IMAGE_ID"].ToString(), arrayImg.Count - 1);//下载定位图
                    }
                }
                if (Message != "")
                {
                    Message = "下载" + Message + "文件失败!";
                }
                if (Message2 != "")
                {
                    Message += "服务器图片:" + Message2 + "不存在!";
                }
                if (Message != "")
                {
                    MessageBox.Show(Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                return(0);
            }
            catch
            {
                //MessageBox.Show("下载图像失败");
                return(-1);
            }
        }