Fix osai path & added job
This commit is contained in:
@@ -149,6 +149,9 @@ namespace CMS_CORE_Application
|
||||
cmsError = N.MEM_RWIntegerList(false, 0, Nc.MEMORY_TYPE.Siemens_DB, 258, 0, 512, ref list);
|
||||
st.Stop();
|
||||
Console.WriteLine(st.ElapsedMilliseconds);
|
||||
ActiveProgramDataModel info = new ActiveProgramDataModel();
|
||||
cmsError = N.FILES_RActiveProgramData(1, ref info);
|
||||
|
||||
|
||||
sw.Stop();
|
||||
if (!this.IsDisposed && this.InvokeRequired)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using CMS_CORE_Library.Demo.Models;
|
||||
using CMS_CORE_Library.Demo.Models;
|
||||
using CMS_CORE_Library.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.ServiceModel;
|
||||
|
||||
@@ -25,7 +25,8 @@ namespace CMS_CORE_Library.Demo
|
||||
private ChannelFactory<ILibraryService> cf;
|
||||
private ILibraryService serverService;
|
||||
private DemoEdgesConfiguration DemoEdgesConfiguration = new DemoEdgesConfiguration();
|
||||
private const string FILE_FOLDER = "C:/CMS/STEP/DEMO/part_program/";
|
||||
private const string PART_PROGRAM_FOLDER = "C:/CMS/STEP/DEMO/part_program/";
|
||||
private const string JOB_PROGRAM_FOLDER = PART_PROGRAM_FOLDER + "\\job\\";
|
||||
|
||||
// Magazine config parameters
|
||||
private List<SiemensMagazineConfigModel> MagazineConfig = new List<SiemensMagazineConfigModel>()
|
||||
@@ -95,7 +96,6 @@ namespace CMS_CORE_Library.Demo
|
||||
return NO_ERROR;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
@@ -1676,9 +1676,9 @@ namespace CMS_CORE_Library.Demo
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Copy(localPath + name, FILE_FOLDER + name, true);
|
||||
File.Copy(localPath + name, PART_PROGRAM_FOLDER + name, true);
|
||||
|
||||
newFilePath = FILE_FOLDER + name;
|
||||
newFilePath = PART_PROGRAM_FOLDER + name;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -1889,14 +1889,44 @@ namespace CMS_CORE_Library.Demo
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
//public override CmsError FILES_WUploadJobMain(int processId)
|
||||
//{
|
||||
// CmsError cmsError = CheckConnection();
|
||||
// if (cmsError.IsError())
|
||||
// return cmsError;
|
||||
public override CmsError FILES_WUploadJobFilesAndActivate(int processId, string jobExtractedPath, string fileToActivate)
|
||||
{
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
// return NO_ERROR;
|
||||
//}
|
||||
try
|
||||
{
|
||||
string JobProcessFolder = PART_PROGRAM_FOLDER + "\\" + processId + "\\";
|
||||
if (!Directory.Exists(JobProcessFolder))
|
||||
Directory.CreateDirectory(JobProcessFolder);
|
||||
|
||||
foreach (string item in Directory.GetFiles(jobExtractedPath))
|
||||
{
|
||||
File.Copy(item, JobProcessFolder + Path.GetFileName(item), true);
|
||||
}
|
||||
|
||||
serverService.SetActiveProgramData(JobProcessFolder + fileToActivate, out ActiveProgramDataModel activeProgramData);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError FILES_RGetProgramType(ref PROGRAM_TYPE_ENUM programType)
|
||||
{
|
||||
byte val = 0;
|
||||
CmsError cmsError = MEM_RWByte(R, 0, PROGRAM_TYPE.MemType, PROGRAM_TYPE.Address, 0, ref val);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
programType = (PROGRAM_TYPE_ENUM)val;
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
#endregion File Management
|
||||
|
||||
@@ -3022,6 +3052,7 @@ namespace CMS_CORE_Library.Demo
|
||||
internal static MEMORY_CELL QUEUE_STATUS_MEM = new MEMORY_CELL(MEMORY_TYPE.Demo, 446, 1);
|
||||
internal static MEMORY_CELL QUEUE_START_STOP_ACTIVE = new MEMORY_CELL(MEMORY_TYPE.Demo, 447, 1);
|
||||
internal static MEMORY_CELL QUEUE_CMD = new MEMORY_CELL(MEMORY_TYPE.Demo, 448, 1);
|
||||
internal static MEMORY_CELL PROGRAM_TYPE = new MEMORY_CELL(MEMORY_TYPE.Demo, 449, 1);
|
||||
}
|
||||
|
||||
#endregion Memory addresses
|
||||
|
||||
@@ -1764,6 +1764,16 @@ namespace CMS_CORE_Library.Fanuc
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError FILES_WUploadJobFilesAndActivate(int processId, string jobExtractedPath, string fileToActivate)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError FILES_RGetProgramType(ref PROGRAM_TYPE_ENUM programType)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
#endregion File Management
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -301,6 +301,12 @@ namespace CMS_CORE_Library.Models
|
||||
WEAR = 4
|
||||
}
|
||||
|
||||
public enum PROGRAM_TYPE_ENUM
|
||||
{
|
||||
NONE = 0,
|
||||
PART_PROGRAM = 1,
|
||||
JOB = 2
|
||||
}
|
||||
public static IFormatProvider numberFormat = (NumberFormatInfo)CultureInfo.InvariantCulture.NumberFormat.Clone();
|
||||
|
||||
#region Cms Errors Codes
|
||||
|
||||
@@ -1375,6 +1375,11 @@ namespace CMS_CORE_Library
|
||||
|
||||
public abstract CmsError FILES_WLoadNextPartProgram(string localPath, string ncFileName);
|
||||
|
||||
public abstract CmsError FILES_WUploadJobFilesAndActivate(int processId, string jobExtractedPath, string fileToActivate);
|
||||
|
||||
public abstract CmsError FILES_RGetProgramType(ref PROGRAM_TYPE_ENUM programType);
|
||||
|
||||
|
||||
#endregion File Management (To override)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -12,6 +12,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.ServiceModel;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using static CMS_CORE_Library.Models.DataStructures;
|
||||
using static CMS_CORE_Library.Nc;
|
||||
@@ -118,6 +119,13 @@ namespace CMS_CORE_Library.Osai
|
||||
Connected = true;
|
||||
else
|
||||
Connected = false;
|
||||
|
||||
//Try to retireve the NC-Status
|
||||
nReturn = OpenNC.LogFSFindFirst(TOOL_MANAGER_DIRECTORY_PATH, out FILEFINDDATA findData, out uint finder, out errorClass, out errorNum);
|
||||
|
||||
//If there's an error
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
return GetNCError(errorClass, errorNum);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -155,7 +163,10 @@ namespace CMS_CORE_Library.Osai
|
||||
filePath = OSAI_PlcMessagesPath + @"Messaggi_" + langName + @".txt";
|
||||
|
||||
//Read From Files
|
||||
messages = File.ReadAllLines(filePath).Select(line => line.Split(',')).ToDictionary(line => Convert.ToInt32(line[0]), line => line[1]);
|
||||
messages = File.ReadAllLines(filePath)
|
||||
.Select(line => line.Split(','))
|
||||
.Where(line => line.Count() == 2)
|
||||
.ToDictionary(line => Convert.ToInt32(line[0]), line => line[1]);
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
@@ -2111,8 +2122,12 @@ namespace CMS_CORE_Library.Osai
|
||||
try
|
||||
{
|
||||
//read all the datas
|
||||
PROC_RPPLines((ushort)processId, ref lines);
|
||||
PROC_RPPPath((ushort)processId, ref path);
|
||||
cmsError = PROC_RPPLines((ushort)processId, ref lines);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
cmsError = PROC_RPPPath((ushort)processId, ref path);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
//manca il tempo rimanente (non so se si puo fare)
|
||||
|
||||
//save into ref data
|
||||
@@ -2326,6 +2341,15 @@ namespace CMS_CORE_Library.Osai
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError FILES_WUploadJobFilesAndActivate(int processId, string jobExtractedPath, string fileToActivate)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
public override CmsError FILES_RGetProgramType(ref PROGRAM_TYPE_ENUM programType)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
#endregion File Management
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -3492,10 +3516,8 @@ namespace CMS_CORE_Library.Osai
|
||||
return GetNCError(errorClass, errorNum);
|
||||
|
||||
//Build the new String
|
||||
path = mainPath.Replace("\\Network", "");
|
||||
path = path.Replace("\\User\\", "");
|
||||
path = path.Replace("\\user\\", "");
|
||||
path = path.Replace("\\USER\\", "");
|
||||
mainPath = Regex.Replace(mainPath, @"\\network", "", RegexOptions.IgnoreCase);
|
||||
path = Regex.Replace(mainPath, @"\\user\\", "", RegexOptions.IgnoreCase);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -1990,7 +1990,7 @@ namespace CMS_CORE_Library.Siemens
|
||||
PriorityFlag = SlPriority.highPriority
|
||||
};
|
||||
|
||||
Item readItem = new Item("/Channel/ProgramInfo/actPartProgram" + "[u" + processId + "]");
|
||||
Item readItem = new Item("/Channel/ProgramInfo/workPandProgName " + "[u" + processId + "]");
|
||||
|
||||
//Read Data
|
||||
Data.Read(readItem);
|
||||
@@ -2004,7 +2004,7 @@ namespace CMS_CORE_Library.Siemens
|
||||
|
||||
data = new ActiveProgramDataModel()
|
||||
{
|
||||
Path = "",
|
||||
Path = trimString,
|
||||
IsoLines = GetLinesFromString(trimString).ToList(),
|
||||
TimeLeft = new DateTime()
|
||||
};
|
||||
@@ -2163,6 +2163,15 @@ namespace CMS_CORE_Library.Siemens
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError FILES_WUploadJobFilesAndActivate(int processId, string jobExtractedPath, string fileToActivate)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
public override CmsError FILES_RGetProgramType(ref PROGRAM_TYPE_ENUM programType)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
private IEnumerable<string> GetLinesFromString(string text)
|
||||
{
|
||||
string line;
|
||||
|
||||
Reference in New Issue
Block a user