private MethodReturnResult FinishChest(ChestViewModel model) { MethodReturnResult result = new MethodReturnResult(); //进行批次包装作业。 ChestParameter p = new ChestParameter() { Editor = User.Identity.Name, ChestNo = model.ChestNo, IsFinishPackageInChest = model.IsFinishPackage, IsLastestPackageInChest = model.IsLastestPackageInChest, ChestFullQty = model.FullQuantity, StoreLocation = model.StoreLocation, PackageNo = model.PackageNo.ToUpper().Trim(), isManual = model.IsManual, ModelType = 0 }; using (PackageInChestServiceClient client = new PackageInChestServiceClient()) { result = client.FinishChest(p); if (result.Code == 0 && model.IsFinishPackage == true) { result.Message = string.Format("尾柜 {0} 已手动完成入柜。", model.ChestNo); } } return(result); }
// 托号入柜作业---包装模型对象model private MethodReturnResult Chest(ChestViewModel model) { MethodReturnResult result = new MethodReturnResult(); //进行包装入柜作业。 ChestParameter p = new ChestParameter() { Editor = User.Identity.Name, ChestNo = model.ChestNo, IsFinishPackageInChest = model.IsFinishPackage, IsLastestPackageInChest = model.IsLastestPackageInChest, ChestFullQty = model.FullQuantity, StoreLocation = model.StoreLocation, PackageNo = model.PackageNo.ToUpper().Trim(), isManual = model.IsManual, ModelType = 0 }; if (model.CurrentQuantity == model.FullQuantity) { p.IsFinishPackageInChest = true; model.IsFinishPackage = true; } using (PackageInChestServiceClient client = new PackageInChestServiceClient()) { result = client.Chest(p); string detailInfo = result.Detail; if (result.Code == 0 && model.IsFinishPackage == false) { result.Message = string.Format("托号 {0} 成功入柜到({1})。" , model.PackageNo.ToUpper().Trim() , model.ChestNo); } else if (result.Code == 0 && model.IsFinishPackage == true) { result = client.ChangeChest(model.ChestNo, User.Identity.Name); if (result.Code <= 0) { result.Detail = detailInfo; result.Message = string.Format("托号 {0} 成功入柜到({1}),柜号{1}入柜完成。" , model.PackageNo.ToUpper().Trim(), model.ChestNo); } } } return(result); }
public ActionResult QueryChecked(ChestViewModel model) { MethodReturnResult <DataSet> result = new MethodReturnResult <DataSet>(); try { if (!string.IsNullOrEmpty(model.ChestNo)) { model.ChestNo = model.ChestNo.ToUpper().Trim(); ChestParameter param = new ChestParameter(); param.ChestNo = model.ChestNo; using (PackageInChestServiceClient client = new PackageInChestServiceClient()) { MethodReturnResult <DataSet> ds = client.GetCheckedChestDetailByDB(ref param); if (ds.Code > 0) { result.Code = ds.Code; result.Message = ds.Message; result.Detail = ds.Detail; return(Json(result)); } ViewBag.ListData = ds.Data.Tables[0]; } } } catch (Exception ex) { result.Code = 1000; result.Message = ex.Message; result.Detail = ex.ToString(); } if (Request.IsAjaxRequest()) { return(PartialView("_ListPartialCheck", model)); } else { return(View("check", model)); } }
public ActionResult UnPackageInChest(string chestNo, int itemNo, string packageNo) { MethodReturnResult result = new MethodReturnResult(); if (packageNo == null || packageNo == "") { result.Code = 1001; result.Message = string.Format("托号不可为空。"); return(Json(result)); } //进行批次包装作业。 ChestParameter p = new ChestParameter() { Editor = User.Identity.Name, ChestNo = chestNo.ToUpper(), PackageNo = packageNo.ToUpper(), ModelType = 0 }; try { //获取包装记录 using (PackageInChestServiceClient client = new PackageInChestServiceClient()) { MethodReturnResult <Chest> rst1 = client.Get(chestNo); if (rst1.Code > 0 || rst1.Data == null) { return(Json(rst1)); } else { #region 注释--出柜条件 //if (rst1.Data.ChestState != EnumChestState.Packaging) //{ // result.Code = 1001; // result.Message = string.Format("柜[{0}]已完成入柜,不可出柜。", chestNo); // return Json(result); //} #endregion } } using (PackageInChestServiceClient client = new PackageInChestServiceClient()) { result = client.UnPackageInChest(p); if (result.Code == 0) { result.Message = string.Format("托号[{0}]出柜({1})成功。" , p.PackageNo, p.ChestNo); } } return(Json(result)); } catch (Exception ex) { result.Code = 1000; result.Message = ex.Message; result.Detail = ex.ToString(); } // 如果我们进行到这一步时某个地方出错,则重新显示表单 return(Json(result)); }
public ActionResult Query(ChestViewModel model) { MethodReturnResult <DataSet> result = new MethodReturnResult <DataSet>(); try { if (!string.IsNullOrEmpty(model.ChestNo)) { model.ChestNo = model.ChestNo.ToUpper().Trim(); ChestParameter param = new ChestParameter(); param.ChestNo = model.ChestNo; using (PackageInChestServiceClient client = new PackageInChestServiceClient()) { MethodReturnResult <DataSet> ds = client.GetRefreshChestDetailByDB(ref param); if (ds.Code > 0) { result.Code = ds.Code; result.Message = ds.Message; result.Detail = ds.Detail; return(Json(result)); } ViewBag.ListData = ds.Data.Tables[0]; //MethodReturnResult<Chest> result1 = client.Get(model.ChestNo); //if (result1.Code == 0) //{ // using (MaterialChestParameterServiceClient client1 = new MaterialChestParameterServiceClient()) // { // MethodReturnResult<MaterialChestParameter> rst3 = client1.Get(result1.Data.MaterialCode); // if (rst3.Data != null) // { // model.FullQuantity = rst3.Data.FullChestQty; // } // else // { // return Json(rst3); // } // } // ViewBag.Chest = result1.Data; // model.StoreLocation = result1.Data.StoreLocation; // model.CurrentQuantity = result1.Data.Quantity; //} } } } catch (Exception ex) { result.Code = 1000; result.Message = ex.Message; result.Detail = ex.ToString(); } if (Request.IsAjaxRequest()) { return(PartialView("_ListPartial", model)); } else { return(View("Index", model)); } }
public ActionResult ChestDetailQuery(ChestDetailQueryViewModel model) { string strErrorMessage = string.Empty; MethodReturnResult <DataSet> result = new MethodReturnResult <DataSet>(); try { ChestParameter param = new ChestParameter(); if (model.PackageNo != "" && model.PackageNo != null) { param.PackageNo = model.PackageNo; } else { param.PackageNo = ""; } if (model.ChestNo != "" && model.ChestNo != null) { param.ChestNo = model.ChestNo; } else { param.ChestNo = ""; } if (model.MaterialCode != "" && model.MaterialCode != null) { param.MaterialCode = model.MaterialCode; } else { param.MaterialCode = ""; } if (model.ChestDate != "" && model.ChestDate != null) { param.ChestDateStart = model.ChestDate; param.ChestDateEnd = Convert.ToDateTime(model.ChestDate).AddDays(1).ToString("yyyy-MM-dd"); } else { param.ChestDateStart = ""; param.ChestDateEnd = ""; } if (model.LotNumber != "" && model.LotNumber != null) { param.LotNumber = model.LotNumber; } else { param.LotNumber = ""; } if (model.OrderNumber != "" && model.OrderNumber != null) { param.OrderNumber = model.OrderNumber; } else { param.OrderNumber = ""; } param.PageSize = model.PageSize; param.PageNo = model.PageNo; using (PackageInChestServiceClient client = new PackageInChestServiceClient()) { MethodReturnResult <DataSet> ds = client.GetChestDetailByDB(ref param); if (ds.Code > 0) { result.Code = ds.Code; result.Message = ds.Message; result.Detail = ds.Detail; return(Json(result)); } ViewBag.ListData = ds.Data.Tables[0]; ViewBag.PagingConfig = new PagingConfig() { PageNo = model.PageNo, PageSize = model.PageSize, Records = param.TotalRecords }; model.TotalRecords = param.TotalRecords; } } catch (Exception ex) { result.Code = 1000; result.Message = ex.Message; result.Detail = ex.ToString(); } if (Request.IsAjaxRequest()) { return(PartialView("_ChestDetailListPartial", model)); } else { return(View("ChestIndex", model)); } }
public async Task <ActionResult> ExportToExcelChest(ChestDetailQueryViewModel model) { //IList<ChestDetail> lstChestDetail = new List<ChestDetail>(); //using (PackageInChestServiceClient client = new PackageInChestServiceClient()) //{ // await Task.Run(() => // { // PagingConfig cfg = new PagingConfig() // { // IsPaging = false, // OrderBy = "Key.ChestNo Desc,ItemNo Asc", // Where = GetQueryCondition(model) // }; // MethodReturnResult<IList<ChestDetail>> result = client.GetDetail(ref cfg); // if (result.Code == 0) // { // lstChestDetail = result.Data; // } // }); //} DataTable dt = new DataTable(); ChestParameter param = new ChestParameter(); if (model.PackageNo != "" && model.PackageNo != null) { param.PackageNo = model.PackageNo; } else { param.PackageNo = ""; } if (model.ChestNo != "" && model.ChestNo != null) { param.ChestNo = model.ChestNo; } else { param.ChestNo = ""; } if (model.MaterialCode != "" && model.MaterialCode != null) { param.MaterialCode = model.MaterialCode; } else { param.MaterialCode = ""; } if (model.ChestDate != "" && model.ChestDate != null) { param.ChestDateStart = model.ChestDate; param.ChestDateEnd = Convert.ToDateTime(model.ChestDate).AddDays(1).ToString("yyyy-MM-dd"); } else { param.ChestDateStart = ""; param.ChestDateEnd = ""; } if (model.LotNumber != "" && model.LotNumber != null) { param.LotNumber = model.LotNumber; } else { param.LotNumber = ""; } if (model.OrderNumber != "" && model.OrderNumber != null) { param.OrderNumber = model.OrderNumber; } else { param.OrderNumber = ""; } param.PageSize = model.PageSize; param.PageNo = -1; await Task.Run(() => { using (PackageInChestServiceClient client = new PackageInChestServiceClient()) { MethodReturnResult <DataSet> ds = client.GetChestDetailByDB(ref param); if (ds.Code == 0 && ds.Data != null && ds.Data.Tables.Count > 0) { dt = ds.Data.Tables[0]; } } }); //创建工作薄。 IWorkbook wb = new HSSFWorkbook(); //设置EXCEL格式 ICellStyle style = wb.CreateCellStyle(); style.FillForegroundColor = 10; //有边框 style.BorderBottom = BorderStyle.Thin; style.BorderLeft = BorderStyle.Thin; style.BorderRight = BorderStyle.Thin; style.BorderTop = BorderStyle.Thin; IFont font = wb.CreateFont(); font.Boldweight = 10; style.SetFont(font); ChestDetailQueryViewModel m = new ChestDetailQueryViewModel(); ISheet ws = null; for (int j = 0; j < dt.Rows.Count; j++) { if (j % 65535 == 0) { ws = wb.CreateSheet(); IRow row = ws.CreateRow(0); #region //列名 ICell cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(StringResource.ItemNo); //项目号 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("柜号"); //柜号 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("库位"); //库位 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("柜属性"); //柜属性 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("项目号"); //柜属性 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("包装号"); //包装号 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("托内数量"); //托内数量 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("工单号"); //工单号 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("产品编码"); //产品编码 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("等级"); //等级 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("花色"); //花色 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("功率档位"); //功率档位 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("电流档"); //电流档 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("入柜时间"); //入柜时间 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("托号状态"); //托号状态 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("入库单号"); //花色 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("入库单状态"); //功率档位 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("入库接收核对状态"); //电流档 #endregion font.Boldweight = 5; } //Package package = m.GetPackage(lstChestDetail[j].Key.ObjectNumber); //Chest chest = m.GetChest(lstChestDetail[j].Key.ChestNo); //WOReportDetail woReportDetail = m.GetWOReportDetail(lstChestDetail[j].Key.ObjectNumber); //WOReport woReport = null; //if (woReportDetail != null) //{ // woReport = m.GetWOReport(woReportDetail.Key.BillCode); //} IRow rowData = ws.CreateRow(j + 1); #region //数据 ICell cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(j + 1); //项目号 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["柜号"].ToString()); //柜号 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["库位"].ToString()); //库位 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["柜属性"].ToString()); //柜属性 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["项目号"].ToString()); //项目号 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["包装号"].ToString()); //包装号 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["托内数量"].ToString()); //托内数量 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["工单号"].ToString()); //工单号 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["产品编码"].ToString()); //产品编码 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["等级"].ToString()); //等级 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["花色"].ToString()); //花色 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["功率档"].ToString()); //功率档 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["电流档"].ToString()); //电流档 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["入柜时间"].ToString()); //入柜时间 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(((EnumPackageState)dt.Rows[j]["托号状态"]).GetDisplayName()); //托号状态 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["入库单号"].ToString()); //入库单号 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; if (dt.Rows[j]["入库单状态"].ToString() == "") { cellData.SetCellValue(""); //入库单状态 } else { cellData.SetCellValue(((EnumBillState)dt.Rows[j]["入库单状态"]).GetDisplayName()); //入库单状态 } cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; if (dt.Rows[j]["入库接收核对状态"].ToString() == "") { cellData.SetCellValue(""); //入库接收核对状态 } else { cellData.SetCellValue(((EnumPackageCheckState)dt.Rows[j]["入库接收核对状态"]).GetDisplayName()); //入库接收核对状态 } #endregion } MemoryStream ms = new MemoryStream(); wb.Write(ms); ms.Flush(); ms.Position = 0; return(File(ms, "application/vnd.ms-excel", "柜明细数据.xls")); }
public async Task <ActionResult> ExportToExcel(ChestDetailQueryViewModel model) { //JsonResult JsonResult = null; DataTable dt = new DataTable(); ChestParameter param = new ChestParameter(); if (model.PackageNo != "" && model.PackageNo != null) { param.PackageNo = model.PackageNo; } else { param.PackageNo = ""; } if (model.ChestNo != "" && model.ChestNo != null) { param.ChestNo = model.ChestNo; } else { param.ChestNo = ""; } if (model.MaterialCode != "" && model.MaterialCode != null) { param.MaterialCode = model.MaterialCode; } else { param.MaterialCode = ""; } if (model.ChestDate != "" && model.ChestDate != null) { param.ChestDateStart = model.ChestDate; param.ChestDateEnd = Convert.ToDateTime(model.ChestDate).AddDays(1).ToString("yyyy-MM-dd"); } else { param.ChestDateStart = ""; param.ChestDateEnd = ""; } if (model.LotNumber != "" && model.LotNumber != null) { param.LotNumber = model.LotNumber; } else { param.LotNumber = ""; } if (model.OrderNumber != "" && model.OrderNumber != null) { param.OrderNumber = model.OrderNumber; } else { param.OrderNumber = ""; } param.PageSize = model.PageSize; param.PageNo = -1; await Task.Run(() => { using (PackageInChestServiceClient client = new PackageInChestServiceClient()) { MethodReturnResult <DataSet> ds = client.GetChestDetail(ref param); if (ds.Code == 0 && ds.Data != null && ds.Data.Tables.Count > 0) { dt = ds.Data.Tables[0]; } } }); string template_path = Server.MapPath("~\\Labels\\");//模板路径 string template_file = template_path + "报检数据.xls"; FileInfo tempFileInfo = new FileInfo(template_file); FileStream file = new FileStream(template_file, FileMode.Open, FileAccess.Read); IWorkbook hssfworkbook = new HSSFWorkbook(file); //创建sheet NPOI.SS.UserModel.ISheet sheet1 = hssfworkbook.GetSheet("Sheet0"); //创建单元格和单元格样式 ICellStyle styles = hssfworkbook.CreateCellStyle(); styles.FillForegroundColor = 10; styles.BorderBottom = BorderStyle.Thin; styles.BorderLeft = BorderStyle.Thin; styles.BorderRight = BorderStyle.Thin; styles.BorderTop = BorderStyle.Thin; styles.VerticalAlignment = VerticalAlignment.Center; styles.Alignment = HorizontalAlignment.Center; IFont font = hssfworkbook.CreateFont(); font.Boldweight = 10; styles.SetFont(font); ICellStyle style = hssfworkbook.CreateCellStyle(); style.FillForegroundColor = 10; style.BorderBottom = BorderStyle.Thin; style.BorderLeft = BorderStyle.Thin; style.BorderRight = BorderStyle.Thin; style.BorderTop = BorderStyle.Thin; style.VerticalAlignment = VerticalAlignment.Center; IFont fonts = hssfworkbook.CreateFont(); font.Boldweight = 10; for (int j = 0; j < dt.Rows.Count; j++) { ICell cellData = null; IRow rowData = null; //string isLast; rowData = sheet1.CreateRow(j + 1); #region //数据 //cellData = rowData.CreateCell(rowData.Cells.Count); //cellData.CellStyle = style; //cellData.SetCellValue(j + 1); //序号 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["组件号"].ToString());//组件号 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["入库日期"].ToString());//入库日期 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["托盘号"].ToString());//托盘号 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["柜号"].ToString());//柜号 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["组件型号"].ToString());//组件型号 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["VOC (V)"].ToString());//VOC (V) cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["ISC(A)"].ToString());//ISC(A) cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["Vmpp (V)"].ToString());//Vmpp (V) cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["Impp(A)"].ToString());//Impp(A) cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["Pmpp(W)"].ToString());//Pmpp(W) cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["FF(%)"].ToString());//FF(%) cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["SurfTemp"].ToString());//SurfTemp cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["电流分档"].ToString());//电流分档 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["标称功率"].ToString());//标称功率 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["电池片厂家"].ToString());//电池片厂家 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["栅线数量"].ToString());//栅线数量 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["电池片档位"].ToString());//电池片档位 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["背板厂家+规格"].ToString());//背板厂家+规格 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["EVA厂家+型号"].ToString());//EVA厂家+型号 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["玻璃厂家型号"].ToString());//玻璃厂家型号 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["镀膜与否"].ToString());//镀膜与否 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["接线盒厂家+型号+承载电压"].ToString());//接线盒厂家+型号+承载电压 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["线缆长度"].ToString());//线缆长度 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["接线端子型号"].ToString());//接线端子型号 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["铝框厂家+型号+颜色+有无加强筋"].ToString());//铝框厂家+型号+颜色+有无加强筋 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["涂锡带厂家"].ToString());//涂锡带厂家 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["硅胶厂家+型号"].ToString());//硅胶厂家+型号 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["灌封胶厂家+型号"].ToString());//灌封胶厂家+型号 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["认证类型"].ToString());//认证类型 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["包装方式"].ToString());//包装方式 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["组件类型+耐压"].ToString());//组件类型+耐压 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["电池片数"].ToString());//电池片数 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["电池片类型"].ToString());//电池片类型 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["电池片工艺"].ToString());//电池片工艺 cellData = rowData.CreateCell(rowData.Cells.Count); cellData.CellStyle = style; cellData.SetCellValue(dt.Rows[j]["单位号"].ToString());//单位号 #endregion } MemoryStream ms = new MemoryStream(); hssfworkbook.Write(ms); ms.Flush(); ms.Position = 0; return(File(ms, "application/vnd.ms-excel", "报检数据.xls")); }