示例#1
0
        protected override void OnViewLoaded()
        {
            base.OnViewLoaded();
            TakeTip = TakeTip ?? new TakeTipAction();
            if (BJList == null)
            {
                BJList = new Stylet.BindableCollection <VBJ>();
                var Key = typeof(T_BJ_Tip).Name;

                if (Constants.BJDict.ContainsKey(Key))
                {
                    BJList.AddRange(Constants.BJDict[Key]);
                }
            }
        }
示例#2
0
 protected override void OnViewLoaded()
 {
     base.OnViewLoaded();
     TakeGel = TakeGel ?? new GelAction();
     PutGel  = PutGel ?? new GelAction();
     if (BJList == null)
     {
         BJList = new Stylet.BindableCollection <VBJ>();
         String[] keys = new string[] { "T_BJ_GelSeat", "T_BJ_Centrifuge", "T_BJ_GelWarehouse", "T_BJ_Camera" };
         foreach (var Key in keys)
         {
             if (Constants.BJDict.ContainsKey(Key))
             {
                 BJList.AddRange(Constants.BJDict[Key]);
             }
         }
     }
 }
示例#3
0
 protected override void OnViewLoaded()
 {
     base.OnViewLoaded();
     TakeGel = TakeGel ?? new GelAction();
     if (BJList == null)
     {
         BJList = new Stylet.BindableCollection <VBJ>();
         String[] keys = new string[] { "T_BJ_GelSeat", "T_BJ_Centrifuge", "T_BJ_GelWarehouse" };
         foreach (var Key in keys)
         {
             if (Constants.BJDict.ContainsKey(Key))
             {
                 BJList.AddRange(Constants.BJDict[Key]);
             }
         }
         if (Constants.BJDict.ContainsKey(typeof(T_BJ_WastedSeat).Name))
         {
             BJList.AddRange(Constants.BJDict[typeof(T_BJ_WastedSeat).Name].Where(item => (item as T_BJ_WastedSeat).Purpose == 1));
         }
     }
 }
示例#4
0
        public static bool Export(Stylet.BindableCollection <T_Result> ResultList)
        {
            try
            {
                //设置新建文件路径及名称
                string savePath = ShowSaveFileDialog();
                if (savePath == "")
                {
                    return(false);
                }
                //创建一个工作簿
                IWorkbook workbook = new XSSFWorkbook();
                //创建一个 sheet 表
                ISheet sheet = workbook.CreateSheet("test");
                sheet.SetColumnWidth(0, 30 * 256);
                sheet.SetColumnWidth(1, 30 * 256);
                sheet.SetColumnWidth(2, 30 * 256);
                sheet.SetColumnWidth(3, 10 * 256);
                sheet.SetColumnWidth(4, 10 * 256);
                sheet.SetColumnWidth(5, 30 * 256);
                sheet.SetColumnWidth(6, 10 * 256);
                sheet.SetColumnWidth(7, 10 * 256);
                sheet.SetColumnWidth(8, 10 * 256);
                sheet.SetColumnWidth(9, 10 * 256);
                sheet.SetColumnWidth(10, 10 * 256);
                sheet.SetColumnWidth(11, 10 * 256);
                sheet.SetColumnWidth(12, 10 * 256);
                sheet.SetColumnWidth(13, 10 * 256);
                sheet.SetColumnWidth(14, 10 * 256);
                sheet.SetColumnWidth(15, 10 * 256);
                //创建一行
                IRow rowH = sheet.CreateRow(0);
                //创建一个单元格
                ICell cell = null;
                //创建单元格样式
                ICellStyle cellStyle = workbook.CreateCellStyle();
                //创建格式
                IDataFormat dataFormat = workbook.CreateDataFormat();
                //设置为文本格式,也可以为 text,即 dataFormat.GetFormat("text");
                cellStyle.DataFormat = dataFormat.GetFormat("@");
                string[] colname =
                {
                    "GEL卡名称", "GEL卡条码", "完成时间", "结果",  "人工判定", "样本条码", "献血员条码",
                    "备注",     "实验人",    "修改人",  "复核人", "报告人",  "载架位置", "LED", "载架脱离"
                };
                for (int i = 0; i < colname.Length; i++)
                {
                    rowH.CreateCell(i).SetCellValue(colname[i]);
                    rowH.Cells[i].CellStyle = cellStyle;
                }

                for (int i = 0; i < ResultList.Count; i++)
                {
                    //跳过第一行,第一行为列名
                    IRow     row          = sheet.CreateRow(i + 1);
                    string[] cellvaluestr =
                    {
                        ResultList[i].GelName,    ResultList[i].GelBarcode,   ResultList[i].EndTime.ToString(), ResultList[i].Result,   ResultList[i].IsManJudger.ToString(),
                        ResultList[i].SmpBarcode, ResultList[i].DonorBarcode, ResultList[i].Remark,             ResultList[i].TestUser, ResultList[i].EditUser,
                        ResultList[i].VerifyUser, ResultList[i].ReportUser,   ResultList[i].RackIndex,          ResultList[i].LED,      ResultList[i].Outed.ToString()
                    };
                    for (int j = 0; j < cellvaluestr.Length; j++)
                    {
                        cell = row.CreateCell(j);
                        cell.SetCellValue(cellvaluestr[j]);
                        cell.CellStyle = cellStyle;
                    }
                }
                //创建文件
                FileStream file = new FileStream(savePath, FileMode.CreateNew, FileAccess.Write);
                //创建一个 IO 流
                MemoryStream ms = new MemoryStream();
                //写入到流
                workbook.Write(ms);
                //转换为字节数组
                byte[] bytes = ms.ToArray();
                file.Write(bytes, 0, bytes.Length);
                file.Flush();
                //释放资源
                bytes = null;
                ms.Close();
                ms.Dispose();
                file.Close();
                file.Dispose();
                workbook.Close();
                sheet    = null;
                workbook = null;
            }
            catch (Exception ex)
            {
            }
            return(true);
        }