Added absolute path to fileManager
This commit is contained in:
@@ -281,6 +281,7 @@ namespace CMS_CORE_Library
|
||||
public class PreviewFileModel
|
||||
{
|
||||
public string Name;
|
||||
public string Path;
|
||||
public string AbsolutePath;
|
||||
public bool IsDirectory;
|
||||
}
|
||||
@@ -292,6 +293,7 @@ namespace CMS_CORE_Library
|
||||
public DateTime LastModDate;
|
||||
public List<string> Content;
|
||||
public string PreviewBase64;
|
||||
public string AbsolutePath;
|
||||
}
|
||||
|
||||
public class ActiveProgramDataModel
|
||||
@@ -717,6 +719,7 @@ namespace CMS_CORE_Library
|
||||
public int MaxToolsPerFamily;
|
||||
public int MaxMultitools;
|
||||
public int MaxToolsPerMultitools;
|
||||
public int MaxOffsets;
|
||||
|
||||
public bool MultitoolOptionActive;
|
||||
public bool FamilyOptionActive;
|
||||
@@ -766,34 +769,33 @@ namespace CMS_CORE_Library
|
||||
|
||||
public int Balluf { get; set; }
|
||||
|
||||
public byte MagazinePositionType { get; set; }
|
||||
|
||||
public byte MagazineId { get; set; }
|
||||
|
||||
public byte PositionId { get; set; }
|
||||
|
||||
public byte MagazinePositionType { get; set; }
|
||||
}
|
||||
|
||||
public class NcToolModel
|
||||
{
|
||||
public int ToolId { get; set; }
|
||||
|
||||
public int FamilyId { get; set; }
|
||||
public int ShankId { get; set; }
|
||||
|
||||
public byte Status { get; set; }
|
||||
|
||||
public int OffsetLength { get; set; }
|
||||
|
||||
public int ResidualLife { get; set; }
|
||||
|
||||
public int ResidualRevive { get; set; }
|
||||
|
||||
public byte Status { get; set; }
|
||||
|
||||
public int FamilyId { get; set; }
|
||||
|
||||
public int ShankId { get; set; }
|
||||
|
||||
public int OffsetId1 { get; set; }
|
||||
|
||||
public int OffsetId2 { get; set; }
|
||||
|
||||
public int OffsetId3 { get; set; }
|
||||
|
||||
public int ResidualRevive { get; set; }
|
||||
}
|
||||
|
||||
public class NcFamilyModel
|
||||
|
||||
@@ -1807,6 +1807,8 @@ namespace CMS_CORE.Demo
|
||||
config.MultitoolOptionActive = demoConf.MultitoolOption;
|
||||
config.FamilyOptionActive = demoConf.FamilyOption;
|
||||
config.MagPositionOptionActive = demoConf.MagPositionOption;
|
||||
config.MaxOffsets = 5;
|
||||
|
||||
|
||||
config.EdgesConfiguration.EdgesAdditionalParamsConfiguration = new Dictionary<int, List<string>>();
|
||||
// Remove path and set only names
|
||||
|
||||
@@ -38,8 +38,8 @@ namespace CMS_CORE.Osai
|
||||
private BasicHttpBinding HttpBinding;
|
||||
private static Dictionary<int, string> PlcMessages;
|
||||
|
||||
// private const string TOOL_MANAGER_DIRECTORY_PATH = @"TEST\\SYS\\STEP\\";
|
||||
private const string TOOL_MANAGER_DIRECTORY_PATH = @"test\OEM\CMS\SYS\STEP\";
|
||||
private const string TOOL_MANAGER_DIRECTORY_PATH = @"TEST\\SYS\\STEP\\";
|
||||
// private const string TOOL_MANAGER_DIRECTORY_PATH = @"test\OEM\CMS\SYS\STEP\";
|
||||
private const string NC_PROGRAM_PATH = @"CAMBIO\";
|
||||
private const string NC_PROGRAM_UPLOAD_PATH = @"CAMBIO\UPLOADED_PP\";
|
||||
private static List<string> EXT_PP = new List<string>() { "", "TXT", "CNC", "INI" };
|
||||
@@ -1960,11 +1960,11 @@ namespace CMS_CORE.Osai
|
||||
{
|
||||
do
|
||||
{
|
||||
|
||||
files.Add(new PreviewFileModel()
|
||||
{
|
||||
Name = filesearch.FileName,
|
||||
AbsolutePath = temppath + "\\" + filesearch.FileName,
|
||||
Path = temppath + "\\" + filesearch.FileName,
|
||||
AbsolutePath = NC_PROGRAM_PATH + temppath + "\\" + filesearch.FileName,
|
||||
IsDirectory = filesearch.FileAttributes == 16
|
||||
});
|
||||
|
||||
@@ -1989,23 +1989,19 @@ namespace CMS_CORE.Osai
|
||||
public override CmsError FILES_RGetFileInfo(string path, ref InfoFile fileInfo)
|
||||
{
|
||||
ushort nReturn;
|
||||
String temppath;
|
||||
String fileContent = "";
|
||||
string fileContent = "";
|
||||
List<String> rows;
|
||||
CmsError err;
|
||||
uint findHandler;
|
||||
FILEFINDDATA filesearch = new FILEFINDDATA();
|
||||
CmsError cmsError;
|
||||
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
//Fix the Path
|
||||
temppath = path;
|
||||
temppath = temppath.TrimStart('\\');
|
||||
// Set absolute path
|
||||
fileInfo.AbsolutePath = path;
|
||||
|
||||
nReturn = OpenNC.LogFSFindFirst(NC_PROGRAM_PATH + "\\" + temppath, out filesearch, out findHandler, out uint errorClass, out uint errorNum);
|
||||
nReturn = OpenNC.LogFSFindFirst(fileInfo.AbsolutePath, out FILEFINDDATA filesearch, out uint findHandler, out uint errorClass, out uint errorNum);
|
||||
//If there's an error
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
return GetNCError(errorClass, errorNum);
|
||||
@@ -2019,9 +2015,9 @@ namespace CMS_CORE.Osai
|
||||
return GetNCError(errorClass, errorNum);
|
||||
|
||||
//Read the program content
|
||||
err = FILES_RProgram(NC_PROGRAM_PATH + "\\" + temppath, ref fileContent);
|
||||
if (err != NO_ERROR)
|
||||
return err;
|
||||
cmsError = FILES_RProgram(fileInfo.AbsolutePath, ref fileContent);
|
||||
if (cmsError != NO_ERROR)
|
||||
return cmsError;
|
||||
|
||||
//Setup the Lines
|
||||
rows = fileContent.Split('\n').ToList();
|
||||
@@ -2051,18 +2047,18 @@ namespace CMS_CORE.Osai
|
||||
//Fix the Path
|
||||
temppath = filePath;
|
||||
temppath = temppath.TrimStart('\\');
|
||||
|
||||
Console.WriteLine(NC_PROGRAM_PATH + "\\" + temppath);
|
||||
|
||||
ushort nReturn;
|
||||
try
|
||||
{
|
||||
// select PP (using empty string)
|
||||
nReturn = OpenNC.SelectPartProgramFromDrive((ushort)processId, NC_PROGRAM_PATH + "\\" + temppath, out uint errorClass, out uint errorNum);
|
||||
nReturn = OpenNC.SelectPartProgramFromDrive((ushort)processId, temppath, out uint errorClass, out uint errorNum);
|
||||
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
return GetNCError(errorClass, errorNum);
|
||||
|
||||
cmsError = FILES_RActiveProgramData(processId, ref data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -2118,7 +2114,6 @@ namespace CMS_CORE.Osai
|
||||
//save into ref data
|
||||
data.IsoLines = lines;
|
||||
data.Path = path;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -2330,6 +2325,8 @@ namespace CMS_CORE.Osai
|
||||
config.ShanksConfiguration = NcShankFieldsConfig;
|
||||
config.MagazinePosConfiguration = NcMagazinePosFieldsConfig;
|
||||
config.EdgesConfiguration = NcOffsetFieldsConfiguration;
|
||||
config.MagPositionOptionActive = true;
|
||||
config.MaxOffsets = 10;
|
||||
|
||||
// Setup magazine list
|
||||
List<NcMagazineConfigModel> conf = new List<NcMagazineConfigModel>();
|
||||
@@ -2556,7 +2553,7 @@ namespace CMS_CORE.Osai
|
||||
// Convert int into to true/false array
|
||||
bits = IntToBool(status);
|
||||
// 1 = Non-editable tables, 2 = reading in progess
|
||||
if (bits[1] || bits[2])
|
||||
if (!bits[1] || bits[2])
|
||||
return MAGAZINE_BUSY_ERROR;
|
||||
|
||||
// Write busy tool manager status
|
||||
@@ -2679,38 +2676,52 @@ namespace CMS_CORE.Osai
|
||||
|
||||
string filePath = TOOL_MANAGER_DIRECTORY_PATH + "{0}.csv";
|
||||
string backupFilePath = TOOL_MANAGER_BACKUP_DIRECTORY_PATH + "{0}.csv";
|
||||
|
||||
string fileContent = "";
|
||||
// Restore tool manager backup
|
||||
string fileContent = File.ReadAllText(string.Format(backupFilePath, FAMILIES_FILE_NAME));
|
||||
cmsError = FILES_WProgram(string.Format(filePath, FAMILIES_FILE_NAME), fileContent);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
if (File.Exists(string.Format(backupFilePath, FAMILIES_FILE_NAME)))
|
||||
{
|
||||
fileContent = File.ReadAllText(string.Format(backupFilePath, FAMILIES_FILE_NAME));
|
||||
cmsError = FILES_WProgram(string.Format(filePath, FAMILIES_FILE_NAME), fileContent);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
}
|
||||
if (File.Exists(string.Format(backupFilePath, FAM_SIZE_FILE_NAME)))
|
||||
{
|
||||
fileContent = File.ReadAllText(string.Format(backupFilePath, FAM_SIZE_FILE_NAME));
|
||||
cmsError = FILES_WProgram(string.Format(filePath, FAM_SIZE_FILE_NAME), fileContent);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
}
|
||||
|
||||
fileContent = File.ReadAllText(string.Format(backupFilePath, FAM_SIZE_FILE_NAME));
|
||||
cmsError = FILES_WProgram(string.Format(filePath, FAM_SIZE_FILE_NAME), fileContent);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
if(File.Exists(string.Format(backupFilePath, MAG_POSITION_FILE_NAME)))
|
||||
{
|
||||
fileContent = File.ReadAllText(string.Format(backupFilePath, MAG_POSITION_FILE_NAME));
|
||||
cmsError = FILES_WProgram(string.Format(filePath, MAG_POSITION_FILE_NAME), fileContent);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
}
|
||||
|
||||
fileContent = File.ReadAllText(string.Format(backupFilePath, MAG_POSITION_FILE_NAME));
|
||||
cmsError = FILES_WProgram(string.Format(filePath, MAG_POSITION_FILE_NAME), fileContent);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
if (File.Exists(string.Format(backupFilePath, SHANKS_FILE_NAME)))
|
||||
{
|
||||
fileContent = File.ReadAllText(string.Format(backupFilePath, SHANKS_FILE_NAME));
|
||||
cmsError = FILES_WProgram(string.Format(filePath, SHANKS_FILE_NAME), fileContent);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
}
|
||||
|
||||
fileContent = File.ReadAllText(string.Format(backupFilePath, SHANKS_FILE_NAME));
|
||||
cmsError = FILES_WProgram(string.Format(filePath, SHANKS_FILE_NAME), fileContent);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
fileContent = File.ReadAllText(string.Format(backupFilePath, TOOLS_FILE_NAME));
|
||||
cmsError = FILES_WProgram(string.Format(filePath, TOOLS_FILE_NAME), fileContent);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
if (File.Exists(string.Format(backupFilePath, TOOLS_FILE_NAME)))
|
||||
{
|
||||
fileContent = File.ReadAllText(string.Format(backupFilePath, TOOLS_FILE_NAME));
|
||||
cmsError = FILES_WProgram(string.Format(filePath, TOOLS_FILE_NAME), fileContent);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
}
|
||||
|
||||
//cmsError = FILES_CopyProgram(string.Format(backupFilePath, FAMILIES_FILE_NAME), string.Format(filePath, FAMILIES_FILE_NAME), false);
|
||||
//if (cmsError.IsError())
|
||||
// return cmsError;
|
||||
//// FamilySize
|
||||
//cmsError = FILES_CopyProgram(string.Format(backupFilePath, FAM_SIZE_FILE_NAME), string.Format(filePath, FAM_SIZE_FILE_NAME), false);
|
||||
//cmsError = \_CopyProgram(string.Format(backupFilePath, FAM_SIZE_FILE_NAME), string.Format(filePath, FAM_SIZE_FILE_NAME), false);
|
||||
//if (cmsError.IsError())
|
||||
// return cmsError;
|
||||
//// Mag positions
|
||||
@@ -3422,7 +3433,7 @@ namespace CMS_CORE.Osai
|
||||
|
||||
|
||||
//Get Active PP Path
|
||||
private CmsError PROC_RPPPath(ushort ProcNumber, ref string Path)
|
||||
private CmsError PROC_RPPPath(ushort procNumber, ref string path)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
@@ -3430,21 +3441,23 @@ namespace CMS_CORE.Osai
|
||||
return cmsError;
|
||||
ushort nReturn;
|
||||
ushort Level = 0;
|
||||
String MainPath = "";
|
||||
String mainPath = "";
|
||||
String SubPath = "";
|
||||
|
||||
//Try to get information
|
||||
try
|
||||
{
|
||||
//Execute the method
|
||||
nReturn = OpenNC.GetActivePartProgramFullPath(ProcNumber, out Level, out MainPath, out SubPath, out uint errorClass, out uint errorNum);
|
||||
nReturn = OpenNC.GetActivePartProgramFullPath(procNumber, out Level, out mainPath, out SubPath, out uint errorClass, out uint errorNum);
|
||||
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
return GetNCError(errorClass, errorNum);
|
||||
|
||||
//Build the new String
|
||||
Path = MainPath;
|
||||
path = mainPath.Replace("\\Network", "");
|
||||
path = path.Replace("\\User\\", "");
|
||||
path = path.Replace("\\user\\", "");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -1851,7 +1851,7 @@ namespace CMS_CORE.Siemens
|
||||
{
|
||||
try
|
||||
{
|
||||
string tmpPath = FormatPath(ref path);
|
||||
string tmpPath = FormatPath(path);
|
||||
|
||||
FileSvc fileSvc = new FileSvc();
|
||||
// Preapare folder node
|
||||
@@ -1864,9 +1864,10 @@ namespace CMS_CORE.Siemens
|
||||
{
|
||||
files.Add(new PreviewFileModel()
|
||||
{
|
||||
AbsolutePath = path + "\\" + element.Name,
|
||||
Path = path + "\\" + element.Name,
|
||||
IsDirectory = element.IsDirNode,
|
||||
Name = element.Name
|
||||
Name = element.Name,
|
||||
AbsolutePath = element.RealPath
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1882,12 +1883,12 @@ namespace CMS_CORE.Siemens
|
||||
{
|
||||
try
|
||||
{
|
||||
string tmpPath = FormatPath(ref path);
|
||||
string tmpPath = FormatPath(path);
|
||||
|
||||
FileSvc fileSvc = new FileSvc();
|
||||
|
||||
// Preapare folder node
|
||||
Node fileNode = new Node(BASE_FILE_PATH + tmpPath);
|
||||
Node fileNode = new Node(tmpPath);
|
||||
|
||||
fileInfo = new InfoFile()
|
||||
{
|
||||
@@ -1895,7 +1896,8 @@ namespace CMS_CORE.Siemens
|
||||
LastModDate = fileNode.Attributes.LastAccess,
|
||||
Name = fileNode.Name,
|
||||
Content = new List<string>() { fileNode.LogicalPath },
|
||||
PreviewBase64 = FindImageBase64String(IMAGES_PATH, fileNode.Name)
|
||||
PreviewBase64 = FindImageBase64String(IMAGES_PATH, fileNode.Name),
|
||||
AbsolutePath = fileNode.RealPath
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -1910,7 +1912,7 @@ namespace CMS_CORE.Siemens
|
||||
{
|
||||
try
|
||||
{
|
||||
string ncPath = FormatPath(ref filePath);
|
||||
string ncPath = FormatPath(filePath);
|
||||
|
||||
FileSvc fileSvc = new FileSvc();
|
||||
|
||||
@@ -2104,7 +2106,7 @@ namespace CMS_CORE.Siemens
|
||||
}
|
||||
}
|
||||
|
||||
private string FormatPath(ref string path)
|
||||
private string FormatPath(string path)
|
||||
{
|
||||
path = path.TrimStart('\\');
|
||||
path = path.TrimEnd('\\');
|
||||
|
||||
Reference in New Issue
Block a user