/// <summary> /// 关帐日导入,17/06/08 戴锐 /// </summary> /// <returns></returns> public ActionResult CloseDataFile() { string strErrorPath = null; HttpFileCollectionBase httfiles = Request.Files; if (httfiles.Count > 0) { HttpPostedFileBase httpfile = httfiles[0]; try { List <string[]> arrstrmapplst = new List <string[]> { new string[] { "关账日名称", "AccountDateName" }, new string[] { "年份", "AccountDateYear" }, new string[] { "送货地址", "AccountDatePlace" }, new string[] { "所属模块", "AccountDateBelongModelstr" }, new string[] { "一月", "MonthDate" }, new string[] { "二月", "FebDate" }, new string[] { "三月", "MarchDate" }, new string[] { "四月", "AprilDate" }, new string[] { "五月", "MayDate" }, new string[] { "六月", "JuneDate" }, new string[] { "七月", "JulyDate" }, new string[] { "八月", "AugustDate" }, new string[] { "九月", "SepDate" }, new string[] { "十月", "OctDate" }, new string[] { "十一月", "NovDate" }, new string[] { "十二月", "DecDate" }, new string[] { "检测情况", "CheckInfo" } }; string strGenarateDir = Server.MapPath(@"~/TempFile"); string strGenarateFile = Guid.NewGuid().ToString("N") + ".xlsx"; string strExportFile = strGenarateDir + "\\" + strGenarateFile; List <ExclCloseDataDTO> rplst = ExcelHelper.Import <ExclCloseDataDTO>(httpfile.InputStream, "Sheet1", arrstrmapplst, CheckCloseDataInfo, strExportFile); if (rplst == null) { strErrorPath = strGenarateFile; } else { var boolD = BaseInfoProvider.ImportColseData(rplst); if (!boolD.SubmitResult) { Logger.WriteLog(boolD.Message.ToString()); strErrorPath = "导入失败"; } } } catch (Exception ex) { Logger.WriteLog(ex.ToString()); strErrorPath = "导入失败"; } } return(Json(strErrorPath)); }