diff --git a/FactorySystemApi/Controllers/FormulaController.cs b/FactorySystemApi/Controllers/FormulaController.cs
index 1337332..ac36be9 100644
--- a/FactorySystemApi/Controllers/FormulaController.cs
+++ b/FactorySystemApi/Controllers/FormulaController.cs
@@ -465,6 +465,79 @@ namespace FactorySystemApi.Controllers
}, apiResult, Request);
}
+ ///
+ /// 导出申请配方记录
+ ///
+ ///
+ ///
+ [HttpPost]
+ public ApiResult ExportFormulaApplyHistory(Dictionary inParam)
+ {
+ ApiResult apiResult = new ApiResult();
+ string rootPath = System.Web.Hosting.HostingEnvironment.MapPath("/");
+ string savePath = "/File/Temp/配方清单/查询记录_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";
+
+ return ExceptionHelper.TryReturnException(() =>
+ {
+ if (inParam != null && inParam.ContainsKey("applyHistory"))
+ {
+ inParam.TryGetValue("applyHistory", out object applyHistory);
+ List> hisList = JsonConvert.DeserializeObject>>(JsonConvert.SerializeObject(applyHistory));
+ DataTable dataList = new DataTable();
+
+ if (hisList != null && hisList.Count > 0)
+ {
+ dataList.Columns.Add("申请日期");
+ dataList.Columns.Add("申请人");
+ dataList.Columns.Add("试验号");
+ dataList.Columns.Add("产品名称");
+ dataList.Columns.Add("申请数量");
+ dataList.Columns.Add("备注");
+
+ foreach (Dictionary his in hisList)
+ {
+ DataRow row = dataList.NewRow();
+
+ string applyTime = his["FApplyTime"] != null ? his["FApplyTime"].ToString() : "";
+ string userName = his["FUserName"] != null ? his["FUserName"].ToString() : "";
+ string testCode = his["FTestCode"] != null ? his["FTestCode"].ToString() : "";
+ string formulaName = his["FFormulaName"] != null ? his["FFormulaName"].ToString() : "";
+ string applyNumber = his["FApplyNumber"] != null ? his["FApplyNumber"].ToString() : "";
+ string remark = his["FRemark"] != null ? his["FRemark"].ToString() : "";
+
+ row["申请日期"] = applyTime;
+ row["申请人"] = userName;
+ row["试验号"] = testCode;
+ row["产品名称"] = formulaName;
+ row["申请数量"] = applyNumber;
+ row["备注"] = remark;
+
+ dataList.Rows.Add(row);
+ }
+
+ if (dataList != null && dataList.Rows.Count > 0)
+ {
+ NPOIHelper.ExportDTtoExcel(dataList, "sheet1", rootPath + savePath);
+ apiResult.Data = Request.RequestUri.AbsoluteUri.Replace(Request.RequestUri.AbsolutePath, "").Trim('/') + savePath;
+ }
+ else
+ {
+ apiResult.Data = "";
+ }
+ }
+ else
+ {
+ apiResult.Data = "";
+ }
+ }
+ else
+ {
+ apiResult.Data = "";
+ }
+ }, apiResult, Request);
+
+ }
+
#region 内部方法
///