// GET: LangleyExperiment public ActionResult LangleyExperiment(int let_id) { LangleyExperimentTable langlryExpTable = dbDrive.GetLangleyExperimentTable(let_id); ViewData["langlryExpTableId"] = langlryExpTable.let_Id; ViewData["langLeyStringName"] = langlryExpTable.let_ProductName; ViewData["langLeyNameString"] = LangleyPublic.DistributionState(langlryExpTable) + "/" + LangleyPublic.Correction(langlryExpTable.let_Correction); return(View()); }
public static string LangleyFreeSpireExcel(LangleyExperimentTable langlryExpTable, List <LangleyDataTable> ldts) { var lr = LangleyPublic.SelectState(langlryExpTable); ldts.RemoveRange(ldts.Count - 1, 1); var xOrVArray = LangleyPublic.XAndVArrays(ldts); Workbook book = new Workbook(); Worksheet sheet = book.Worksheets[0]; var iCellcount = 1; //1.设置表头 sheet.Range[1, iCellcount++].Text = "兰利法感度试验数据记录及处理结果"; sheet.Range["A1:H1"].Merge(); sheet.Range["A1:H1"].Style.HorizontalAlignment = HorizontalAlignType.Center; sheet.Range["E2"].Text = "打印时间"; sheet.Range["F2:H2"].Text = DateTime.Now.ToString("yyyy-MM-dd"); sheet.Range["F2:H2"].Merge(); sheet.Range["A3"].Text = "样本名称"; sheet.Range["B3:D3"].Text = langlryExpTable.let_ProductName; sheet.Range["B3:D3"].Merge(); sheet.Range["E3"].Text = "试验时间"; sheet.Range["F3:H3"].Text = langlryExpTable.let_ExperimentalDate.ToString("yyyy-MM-dd HH:mm"); sheet.Range["F3:H3"].Merge(); sheet.Range["A4"].Text = "实验数量"; sheet.Range["B4"].Text = ldts.Count.ToString(); sheet.Range["C4"].Text = "分辨率"; sheet.Range["D4"].Text = langlryExpTable.let_PrecisionInstruments.ToString(); sheet.Range["E4"].Text = "发布选择"; sheet.Range["F4:H4"].Text = LangleyPublic.DistributionState(langlryExpTable); sheet.Range["F4:H4"].Merge(); sheet.Range["A5"].Text = "刺激量上限"; sheet.Range["B5"].Text = langlryExpTable.let_StimulusQuantityCeiling.ToString(); sheet.Range["C5"].Text = "刺激量下限"; sheet.Range["D5"].Text = langlryExpTable.let_StimulusQuantityFloor.ToString(); sheet.Range["E5"].Text = "标准差修正"; sheet.Range["F5"].Text = langlryExpTable.let_Correction == 0 ? "是" : "否"; sheet.Range["G5"].Text = "翻转响应"; sheet.Range["H5"].Text = langlryExpTable.let_FlipTheResponse == 1 ? "是" : "否"; sheet.Range["A6"].Text = "技术条件"; sheet.Range["B6:H6"].Text = langlryExpTable.let_TechnicalConditions; sheet.Range["B6:H6"].Merge(); if (langlryExpTable.let_FlipTheResponse == 0) { if (langlryExpTable.let_Correction == 1) { sheet.Range["A7:H7"].Text = "标记:发火:“1”,不发火:“0” 点估计标准差计算结果为最大拟然估计结果"; } else { sheet.Range["A7:H7"].Text = "标记:发火:“1”,不发火:“0” 点估计标准差计算结果为按照GJB377修正结果"; } } else if (langlryExpTable.let_Correction == 1) { sheet.Range["A7:H7"].Text = "标记:发火:“0”,不发火:“1” 点估计标准差计算结果为最大拟然估计结果"; } else { sheet.Range["A7:H7"].Text = "标记:发火:“0”,不发火:“1” 点估计标准差计算结果为按照GJB377修正结果"; } TableHead(sheet); int count = 9; for (int i = 0; i < ldts.Count; i++) { sheet.Range["A" + count + ""].Text = (i + 1).ToString(); sheet.Range["B" + count + ":C" + count + ""].Text = ldts[i].ldt_StimulusQuantity.ToString(); sheet.Range["B" + count + ":C" + count + ""].Merge(); sheet.Range["D" + count + ""].Text = ldts[i].ldt_Response.ToString(); sheet.Range["E" + count + ":F" + count + ""].Text = ldts[i].ldt_Mean.ToString(); sheet.Range["E" + count + ":F" + count + ""].Merge(); sheet.Range["G" + count + ":H" + count + ""].Text = ldts[i].ldt_StandardDeviation.ToString(); sheet.Range["G" + count + ":H" + count + ""].Merge(); count++; } sheet.Range["A" + count + ""].Text = "点估计:"; sheet.Range["B" + count + ":D" + count + ""].Text = "均值:" + ldts[ldts.Count - 1].ldt_Mean + ""; sheet.Range["B" + count + ":D" + count + ""].Merge(); sheet.Range["E" + count + ":H" + count + ""].Text = "标准差:" + ldts[ldts.Count - 1].ldt_StandardDeviation + ""; sheet.Range["E" + count + ":H" + count + ""].Merge(); count++; var ignition99 = LangleyIgnition(ldts, lr, 0.99); var ignition1 = LangleyIgnition(ldts, lr, 0.01); var ignition999 = LangleyIgnition(ldts, lr, 0.999); var ignition01 = LangleyIgnition(ldts, lr, 0.001); var ignition9999 = LangleyIgnition(ldts, lr, 0.9999); var ignition001 = LangleyIgnition(ldts, lr, 0.0001); count = PointCalculation(count, ignition99, ignition1, ignition999, ignition01, ignition9999, ignition001, sheet); var ie = lr.GetIntervalEstimationValue(lr.DoubleSideEstimation(xOrVArray.xArray, xOrVArray.vArray, 0.999, 0.8)); var ie01 = lr.GetIntervalEstimationValue(lr.DoubleSideEstimation(xOrVArray.xArray, xOrVArray.vArray, 0.001, 0.8)); count = IntervalEstimation(count, sheet, ie, ie01, 0.8); ie = lr.GetIntervalEstimationValue(lr.DoubleSideEstimation(xOrVArray.xArray, xOrVArray.vArray, 0.999, 0.95)); ie01 = lr.GetIntervalEstimationValue(lr.DoubleSideEstimation(xOrVArray.xArray, xOrVArray.vArray, 0.001, 0.95)); count = IntervalEstimation(count, sheet, ie, ie01, 0.95); ie = lr.GetIntervalEstimationValue(lr.DoubleSideEstimation(xOrVArray.xArray, xOrVArray.vArray, 0.999, 0.99)); ie01 = lr.GetIntervalEstimationValue(lr.DoubleSideEstimation(xOrVArray.xArray, xOrVArray.vArray, 0.001, 0.99)); count = IntervalEstimation(count, sheet, ie, ie01, 0.99); sheet.Range["A3:H" + count + ""].BorderInside(LineStyleType.Thin, Color.Black); sheet.Range["A3:H" + count + ""].BorderAround(LineStyleType.Medium, Color.Black); count++; sheet.Range["B" + count + ""].Text = "复查人"; sheet.Range["F" + count + ""].Text = "试验人"; //设置行宽 sheet.Range["A1:H1"].RowHeight = 20; var strFullName = @"C:\兰利法\" + "兰利法" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".xlsx"; book.SaveToFile(strFullName, ExcelVersion.Version2010); return(strFullName); }