Added file manager DEMO

This commit is contained in:
Lucio Maranta
2018-07-27 13:33:57 +02:00
parent a2863ca9b5
commit 9259c80154
4 changed files with 72 additions and 0 deletions
Binary file not shown.
+22
View File
@@ -3,6 +3,7 @@ using CMS_CORE.Demo;
using CMS_CORE.Fanuc;
using CMS_CORE.Osai;
using CMS_CORE.Siemens;
using CMS_CORE_Library;
using Step.Database.Controllers;
using Step.Model.DatabaseModels;
using Step.Model.DTOModels;
@@ -63,6 +64,22 @@ namespace Step.NC
return null;
}
#region File manager
public CmsError GetFileList(string path, out List<PreviewFileModel> fileList)
{
fileList = new List<PreviewFileModel>();
return numericalControl.FILES_RGetFileList(path, ref fileList);
}
public CmsError GetFileInfo(string path, out InfoFile fileInfo)
{
fileInfo = new InfoFile();
return numericalControl.FILES_RGetFileInfo(path, ref fileInfo);
}
#endregion
#region Read Data
public CmsError GetNcGenericData(out DTONcGenericDataModel genericData)
@@ -1036,6 +1053,11 @@ namespace Step.NC
return numericalControl.TOOLS_WUnloadToolFromShank(shankId, positionId);
}
public CmsError GetFileList(string filePath, out PreviewFileModel fileList)
{
throw new NotImplementedException();
}
#endregion
#endregion Write data
}
@@ -0,0 +1,49 @@
using Step.NC;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using static CMS_CORE_Library.DataStructures;
namespace Step.Controllers.WebApi
{
[RoutePrefix("api/file_manager")]
public class NcFileController : ApiController
{
[Route("files"), HttpGet]
public IHttpActionResult GetFileList(string filePath = "")
{
using (NcHandler ncHandler = new NcHandler())
{
ncHandler.Connect();
CmsError cmsError = ncHandler.GetFileList(filePath, out List<PreviewFileModel> fileList);
if (cmsError.IsError())
return BadRequest(cmsError.localizationKey);
return Ok(fileList);
}
}
[Route("file/info/{*filePath}"), HttpGet]
public IHttpActionResult GetFileInfo(string filePath)
{
using (NcHandler ncHandler = new NcHandler())
{
ncHandler.Connect();
CmsError cmsError = ncHandler.GetFileInfo(filePath, out InfoFile fileInfo);
if (cmsError.IsError())
return BadRequest(cmsError.localizationKey);
return Ok(fileInfo);
}
}
}
}
+1
View File
@@ -175,6 +175,7 @@
<Compile Include="Controllers\WebApi\FavoriteUserSoftKeyController.cs" />
<Compile Include="Controllers\WebApi\LanguageController.cs" />
<Compile Include="Controllers\WebApi\MaintenanceController.cs" />
<Compile Include="Controllers\WebApi\NcFileController.cs" />
<Compile Include="Controllers\WebApi\ToolTableController.cs" />
<Compile Include="Controllers\WebApi\UserController.cs" />
<Compile Include="Controllers\WebApi\NcApiController.cs" />