提交代码

This commit is contained in:
2024-02-28 16:45:20 +08:00
parent f227bbeba2
commit d28f7920d8
24 changed files with 5866 additions and 393 deletions
@@ -0,0 +1,166 @@
using System.Web.Http;
using Model;
using System.Collections.Generic;
using System;
using BLL;
namespace WebAPI.Controllers.TestRun
{
public class DriverRunController : ApiController
{
//
// 质量巡检
// GET: /Draw/
[HttpGet]
public ResponseData<List<DriverRun_DriverRun>> Index(string projectId, int index, int page, string state)
{
ResponseData<List<DriverRun_DriverRun>> res = new ResponseData<List<DriverRun_DriverRun>>();
res.successful = true;
res.resultValue = BLL.DriverRunService.GetListDataForApi(state, projectId, index, page);
return res;
}
[HttpGet]
public ResponseData<List<DriverRun_DriverRun>> Search(string state, string projectId, int index, int page)
{
ResponseData<List<DriverRun_DriverRun>> res = new ResponseData<List<DriverRun_DriverRun>>();
res.successful = true;
res.resultValue = BLL.DriverRunService.GetListDataForApi(state, projectId, index, page);
return res;
}
/// <summary>
/// 根据code获取详情
/// </summary>
/// <param name="DriverRunId"></param>
/// <returns></returns>
public ResponseData<DriverRun_DriverRun> GetDriverRun(string code)
{
ResponseData<DriverRun_DriverRun> res = new ResponseData<DriverRun_DriverRun>();
DriverRun_DriverRun DriverRun = BLL.DriverRunService.GetDriverRunForApi(code);
res.successful = true;
res.resultValue = BeanUtil.CopyOjbect<DriverRun_DriverRun>(DriverRun, true);
return res;
}
/// <summary>
/// 根据code获取 审核记录
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public ResponseData<List<DriverRun_DriverRunApprove>> GetApproveByCode(string code)
{
ResponseData<List<DriverRun_DriverRunApprove>> res = new ResponseData<List<DriverRun_DriverRunApprove>>();
res.successful = true;
res.resultValue = BLL.DriverRunApproveService.GetListDataByCodeForApi(code);
return res;
}
public ResponseData<DriverRun_DriverRunApprove> GetCurrApproveByCode(string code)
{
ResponseData<DriverRun_DriverRunApprove> res = new ResponseData<DriverRun_DriverRunApprove>();
res.successful = true;
res.resultValue = BeanUtil.CopyOjbect<DriverRun_DriverRunApprove>(BLL.DriverRunApproveService.getCurrApproveForApi(code), true);
return res;
}
[HttpPost]
public ResponseData<string> AddDriverRun([FromBody]Model.DriverRun_DriverRun DriverRun)
{
ResponseData<string> res = new ResponseData<string>();
try
{
if (string.IsNullOrEmpty(DriverRun.DriverRunId))
{
DriverRun.DriverRunId = Guid.NewGuid().ToString();
BLL.DriverRunService.AddDriverRunForApi(DriverRun);
SaveAttachFile(DriverRun.DriverRunId, BLL.Const.CheckListMenuId, DriverRun.AttachUrl);
res.resultValue = DriverRun.DriverRunId;
}
else
{
BLL.DriverRunService.UpdateDriverRunForApi(DriverRun);
SaveAttachFile(DriverRun.DriverRunId, BLL.Const.CheckListMenuId, DriverRun.AttachUrl);
res.resultValue = DriverRun.DriverRunId;
}
res.successful = true;
}
catch (Exception e)
{
res.resultHint = e.StackTrace;
res.successful = false;
}
return res;
}
/// <summary>
///
/// </summary>
public static void SaveAttachFile(string dataId, string menuId, string url)
{
Model.ToDoItem toDoItem = new Model.ToDoItem
{
MenuId = menuId,
DataId = dataId,
UrlStr = url,
};
APIUpLoadFileService.SaveAttachUrl(toDoItem);
}
[HttpPost]
public ResponseData<string> AddApprove([FromBody]Model.DriverRun_DriverRunApprove approve)
{
ResponseData<string> res = new ResponseData<string>();
try
{
Model.DriverRun_DriverRun DriverRun = new Model.DriverRun_DriverRun();
DriverRun.DriverRunId = approve.DriverRunId;
DriverRun.State = approve.ApproveType;
BLL.DriverRunService.UpdateDriverRunForApi(DriverRun);
res.resultValue = BLL.DriverRunApproveService.AddDriverRunApproveForApi(approve);
res.successful = true;
}
catch (Exception e)
{
res.resultHint = e.StackTrace;
res.successful = false;
}
return res;
}
[HttpPost]
public ResponseData<string> UpdateApprove([FromBody]Model.DriverRun_DriverRunApprove approve)
{
ResponseData<string> res = new ResponseData<string>();
try
{
approve.ApproveDate = DateTime.Now;
BLL.DriverRunApproveService.UpdateDriverRunApproveForApi(approve);
res.successful = true;
}
catch (Exception e)
{
res.resultHint = e.StackTrace;
res.successful = false;
}
return res;
}
// GET: /Draw/
[HttpGet]
public ResponseData<string> see(string dataId, string userId)
{
ResponseData<string> res = new ResponseData<string>();
res.successful = true;
BLL.DriverRunApproveService.See(dataId, userId);
return res;
}
}
}
+1
View File
@@ -210,6 +210,7 @@
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\PersonController.cs" />
<Compile Include="Controllers\ProjectController.cs" />
<Compile Include="Controllers\TestRun\DriverRunController.cs" />
<Compile Include="Controllers\ToDoItemController.cs" />
<Compile Include="Controllers\UnitController.cs" />
<Compile Include="Controllers\UserController.cs" />
+9 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />
<IISExpressSSLPort />
@@ -10,6 +10,14 @@
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile>
<Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Controller</Controller_SelectedScaffolderCategoryPath>
<WebStackScaffolding_ControllerDialogWidth>600</WebStackScaffolding_ControllerDialogWidth>
<WebStackScaffolding_IsLayoutPageSelected>True</WebStackScaffolding_IsLayoutPageSelected>
<WebStackScaffolding_IsPartialViewSelected>False</WebStackScaffolding_IsPartialViewSelected>
<WebStackScaffolding_IsReferencingScriptLibrariesSelected>True</WebStackScaffolding_IsReferencingScriptLibrariesSelected>
<WebStackScaffolding_LayoutPageFile />
<WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>