From 2a1c73ffedfbdb08d8aa016987f413de7911dfe4 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期五, 18 十一月 2022 15:29:45 +0800
Subject: [PATCH] 修改报工接口修改
---
VueWebApi/Controllers/ImportExcelController.cs | 28 ++++++++++++++++++----------
1 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/VueWebApi/Controllers/ImportExcelController.cs b/VueWebApi/Controllers/ImportExcelController.cs
index d747136..87c3f42 100644
--- a/VueWebApi/Controllers/ImportExcelController.cs
+++ b/VueWebApi/Controllers/ImportExcelController.cs
@@ -16,7 +16,7 @@
namespace VueWebApi.Controllers
{
- [RoutePrefix(prefix: "api/BasicSetting")]
+ [RoutePrefix(prefix: "api/ImportExcel")]
[ControllerGroup("Excel瀵煎叆妯℃澘楠岃瘉", "鍦ㄧ嚎鎺ュ彛")]
public class ImportExcelController : ApiController
{
@@ -38,7 +38,7 @@
list = list.Where(s => s.FileCode == FileCode).ToList();
var filename = list[0].FileName + ".xls";
string fileip = System.Configuration.ConfigurationManager.AppSettings["FileIP"];
- var msg = fileip + "/apis/Excel/" + filename;
+ var msg = fileip + "/Excel/" + filename;
mes.code = "200";
mes.data = msg;
return TJson.toJson(mes);
@@ -49,13 +49,16 @@
/// <summary>
/// Excel瀵煎叆鏂囦欢涓婁紶銆佹ā鏉块獙璇併�佹暟鎹噺銆侀獙璇�
/// </summary>
- /// <param name="files">涓婁紶鏂囦欢</param>
/// <param name="FileCode">鏂囦欢缂栫爜</param>
+ /// <param name="files">涓婁紶鏂囦欢</param>
/// <returns></returns>
[Route(template: "ExcelModelCheck")]
- [HttpGet]
- public HttpResponseMessage ExcelModelCheck(HttpPostedFileBase files, string FileCode = null)
+ [HttpPost]
+ public HttpResponseMessage ExcelModelCheck()
{
+
+ string FileCode = HttpContext.Current.Request["FileCode"].ToString();
+ HttpPostedFile files = HttpContext.Current.Request.Files[0];
ExcelModelCheck list = new ExcelModelCheck();
Dictionary<object, object> dList = new Dictionary<object, object>();
list.json1 = ExcelCheckUpload(files, FileCode); //鏂囦欢涓婁紶
@@ -90,7 +93,7 @@
[Route(template: "ExcelCheckUpload")]
[HttpGet]
[HiddenApi]
- public ToMessage ExcelCheckUpload(HttpPostedFileBase files, string FileCode = null)
+ public ToMessage ExcelCheckUpload(HttpPostedFile files, string FileCode = null)
{
try
{
@@ -111,6 +114,9 @@
else if (Directory.Exists(path) == false)//濡傛灉涓嶅瓨鍦ㄥ氨鍒涘缓file鏂囦欢澶�
{
Directory.CreateDirectory(path); //娣诲姞鏂囦欢澶�
+ files.SaveAs(savePath); //灏嗛�夋嫨鐨勬枃浠朵繚瀛樺埌鎸囧畾鏂囦欢澶逛笅
+ mes.code = "200";
+ mes.Message = "鏂囦欢涓婁紶鎴愬姛锛�";
}
else if (Directory.Exists(savePath) == true) //濡傛灉瀛樺湪閲嶅悕鏂囦欢灏辨彁绀�
{
@@ -145,7 +151,7 @@
[Route(template: "ExcelCheckUpload")]
[HttpGet]
[HiddenApi]
- public ToMessage ExcelCheck(HttpPostedFileBase files, string FileCode = null)
+ public ToMessage ExcelCheck(HttpPostedFile files, string FileCode = null)
{
try
{
@@ -186,7 +192,7 @@
/// <param name="FileCode">鏂囦欢缂栫爜</param>
/// <returns></returns>
[HiddenApi]
- public ToMessage ExcelCheckCount(HttpPostedFileBase files, string FileCode = null)
+ public ToMessage ExcelCheckCount(HttpPostedFile files, string FileCode = null)
{
string savePath;
@@ -261,7 +267,8 @@
/// <param name="FileCode">鏂囦欢缂栫爜</param>
/// <param name="FileName">鏂囦欢鍚嶇О</param>
/// <returns></returns>
- [HiddenApi]
+ [Route(template: "ExcelCheckData")]
+ [HttpPost]
public HttpResponseMessage ExcelCheckData(string FileCode = null, string FileName = null)
{
string message = "";
@@ -293,7 +300,8 @@
/// <param name="FileCode">鏂囦欢缂栫爜</param>
/// <param name="FileName">鏂囦欢鍚嶇О</param>
/// <returns></returns>
- [HiddenApi]
+ [Route(template: "ExcelImportSubmit")]
+ [HttpPost]
public HttpResponseMessage ExcelImportSubmit(string FileCode = null, string FileName = null)
{
var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //鐧诲綍鐢ㄦ埛鍚�
--
Gitblit v1.9.3