From 22af5bed0da8a5852bd824a1e21e6fc43df6df2a Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期一, 11 十二月 2023 19:20:43 +0800
Subject: [PATCH] 1.App 智能分析,生产进度看板接口 2.PC端设备点检项目、保养项目、点检标准、保养标准、点检记录、保养记录、维修记录 3.工序检验扫码添加判断(条码任务是否存在、工单是否关闭) 4.添加App图标图片文件
---
VueWebCoreApi/Controllers/ImportExcelController.cs | 137 ++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 134 insertions(+), 3 deletions(-)
diff --git a/VueWebCoreApi/Controllers/ImportExcelController.cs b/VueWebCoreApi/Controllers/ImportExcelController.cs
index 2838ec1..16276d0 100644
--- a/VueWebCoreApi/Controllers/ImportExcelController.cs
+++ b/VueWebCoreApi/Controllers/ImportExcelController.cs
@@ -1,9 +1,13 @@
锘縰sing Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
+using System.Data;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Models.SystemSetting;
using VueWebCoreApi.Tools;
namespace VueWebCoreApi.Controllers
@@ -11,11 +15,9 @@
[ApiExplorerSettings(GroupName = "Excel瀵煎叆")]
[ApiController]
[Route("api/[controller]")]
- //[ChannelActionFilter]
+ [ChannelActionFilter]
public class ImportExcelController : Controller
{
- //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
- ToMessage mes = new ToMessage();
#region[Excel瀵煎叆妯℃澘鍒楄〃]
/// <summary>
@@ -26,6 +28,7 @@
[HttpGet]
public JsonResult ExcelModelData()
{
+ ToMessage mes = new ToMessage();
List<ScoreReport> list = ExcelList.ExcelData();
mes.code = "200";
mes.data = list;
@@ -43,6 +46,7 @@
[HttpGet]
public JsonResult DownLoadExcel(string FileCode = null)
{
+ ToMessage mes = new ToMessage();
List<ScoreReport> list = ExcelList.ExcelData();
list = list.Where(s => s.FileCode == FileCode).ToList();
var filename = list[0].FileName + ".xls";
@@ -53,5 +57,132 @@
return Json(mes);
}
#endregion
+
+ #region [Excel瀵煎叆鏁版嵁鎻愪氦銆佹ā鏉块獙璇併�佹暟鎹鍏
+ /// <summary>
+ /// Excel瀵煎叆鏁版嵁鎻愪氦銆佹ā鏉块獙璇併�佹暟鎹鍏�
+ /// </summary>
+ /// <param name="myModel">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "ExcelModelCheck")]
+ [HttpPost]
+ public JsonResult ExcelModelCheck([FromBody] ExceImport myModel)
+ {
+ string FileCode = myModel.FileCode;
+ List<DataTable> dataTable = myModel.TableData;
+
+ ExcelModelCheck list = new ExcelModelCheck();
+ list.json1 = ExcelCheck(dataTable, FileCode); //妯℃澘楠岃瘉
+ if (list.json1.code == "301")
+ {
+ list.json1 = list.json1;
+ return Json(list);
+ }
+ list.json2 = ExcelCheckData(myModel); //鏁版嵁楠岃瘉
+ if (list.json2.code == "301")
+ {
+ list.json2 = list.json2;
+ return Json(list);
+ }
+ list.json3 = ExcelImportSubmit(dataTable, FileCode); //鏁版嵁瀵煎叆
+ if (list.json3.code == "300")
+ {
+ list.json3 = list.json3;
+ return Json(list);
+ }
+ return Json(list);
+ }
+ #endregion
+
+ #region [Excel瀵煎叆妯℃澘楠岃瘉]
+ /// <summary>
+ /// Excel瀵煎叆妯℃澘楠岃瘉
+ /// </summary>
+ /// <param name="dataTable">鎻愪氦鏁版嵁</param>
+ /// <param name="FileCode">鏂囦欢缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "ExcelCheckUpload")]
+ [HttpGet]
+ [ApiExplorerSettings(IgnoreApi = true)]
+ public ToMessage ExcelCheck(List<DataTable> dataTable, string FileCode = null)
+ {
+ ToMessage mes = new ToMessage();
+ try
+ {
+ mes = ExcelCheckBLL.ExcelCheck(FileCode, dataTable);
+ if (mes.code == "301") //涓婁紶妯℃澘涓嶆槸鎸囧畾妯℃澘
+ {
+ return mes;
+ }
+ return mes;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.message = e.Message;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region [Excel瀵煎叆鏁版嵁楠岃瘉]
+ /// <summary>
+ /// Excel瀵煎叆鏁版嵁楠岃瘉
+ /// </summary>
+ /// <param name="myModel">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "ExcelCheckData")]
+ [HttpPost]
+ [ApiExplorerSettings(IgnoreApi = true)]
+ public ToMessage ExcelCheckData([FromBody] ExceImport myModel)
+ {
+ ToMessage mes = new ToMessage();
+ string message = "";
+ string StuCode = "";
+ int count = 0;
+ List<ExcelErro> list = new List<ExcelErro>();
+ string FileCode = myModel.FileCode;
+ List<DataTable> dataTable = myModel.TableData;
+ list = ExcelCheckBLL.ExcelCheckData(FileCode, dataTable, out StuCode, out message, out count);
+ mes.code = StuCode;
+ mes.message = message;
+ mes.count = count;
+ mes.data = list;
+ return mes;
+ }
+ #endregion
+
+ #region[Excel瀵煎叆鏁版嵁]
+ /// <summary>
+ /// Excel瀵煎叆鏁版嵁
+ /// </summary>
+ /// <param name="dataTable">鎻愪氦鏁版嵁</param>
+ /// <param name="FileCode">鏂囦欢缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "ExcelImportSubmit")]
+ [HttpPost]
+ [ApiExplorerSettings(IgnoreApi = true)]
+ public ToMessage ExcelImportSubmit(List<DataTable> dataTable, string FileCode = null)
+ {
+ ToMessage mes = new ToMessage();
+ try
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = ExcelCheckBLL.ExcelImportSubmit(FileCode, dataTable, us);
+ if (mes.code == "300")
+ {
+ return mes;
+ }
+ return mes;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.message = e.Message;
+ }
+ return mes;
+ }
+ #endregion
}
}
--
Gitblit v1.9.3