Fix cms client primary screen
Removed shanks from Siemens library Fix "isInUse" param etc
This commit is contained in:
+626
-623
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<serverConfig>
|
||||
<ncConfig>
|
||||
<ncVendor>DEMO</ncVendor> <!-- NO_NC/DEMO/FANUC/SIEMENS/OSAI -->
|
||||
<ncVendor>SIEMENS</ncVendor> <!-- NO_NC/DEMO/FANUC/SIEMENS/OSAI -->
|
||||
<showNcHMI>true</showNcHMI>
|
||||
<ncIpAddress>localhost</ncIpAddress>
|
||||
<ncPort>8080</ncPort>
|
||||
|
||||
@@ -734,24 +734,6 @@ public static class ThreadsFunctions
|
||||
case CMS_ERROR_CODES.PROC_NOT_FOUND:
|
||||
break;
|
||||
|
||||
case CMS_ERROR_CODES.FUNCTION_NOT_ALLOWED:
|
||||
break;
|
||||
|
||||
case CMS_ERROR_CODES.BIT_NOT_IN_RANGE:
|
||||
break;
|
||||
|
||||
case CMS_ERROR_CODES.BYTE_NOT_IN_RANGE:
|
||||
break;
|
||||
|
||||
case CMS_ERROR_CODES.INTERNAL_ERROR:
|
||||
break;
|
||||
|
||||
case CMS_ERROR_CODES.INCORRECT_PARAMETERS:
|
||||
break;
|
||||
|
||||
case CMS_ERROR_CODES.NC_LANGUAGE_ERROR:
|
||||
break;
|
||||
|
||||
case CMS_ERROR_CODES.SIEMENS_ENVIRONMENT_NOT_FOUND:
|
||||
Manage(ERROR_LEVEL.FATAL, cmsError.localizationKey);
|
||||
break;
|
||||
|
||||
@@ -4,7 +4,6 @@ using Step.Model.DTOModels.AlarmModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Entity;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using static Step.Model.Constants;
|
||||
@@ -27,41 +26,20 @@ namespace Step.Database.Controllers
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
public List<AlarmOccurrencesModel> GetPaginated(int page, int pageSize)
|
||||
{
|
||||
Stopwatch st = new Stopwatch();
|
||||
st.Start();
|
||||
DateTime l = DateTime.Parse("2013/01/01");
|
||||
var paginated = dbCtx.AlarmOccurrences.Include("AlarmDescription").OrderBy(x => x.AlarmOccurrenceId)
|
||||
.Where(x => x.TimeStamp < DateTime.Today && x.TimeStamp > l)
|
||||
.Skip(page * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
|
||||
Console.WriteLine(st.ElapsedMilliseconds);
|
||||
|
||||
st.Stop();
|
||||
|
||||
return paginated;
|
||||
}
|
||||
|
||||
public List<DTOAlarmHistoricModel> GetPaginatedWithFilter(string message, ALARM_TYPE type, int page, int pageSize, DateTime startDate, DateTime endDate, List<int> userIds)
|
||||
{
|
||||
var occurrences = dbCtx
|
||||
.AlarmOccurrences
|
||||
.OrderBy(x => x.AlarmOccurrenceId)
|
||||
.Where(x =>
|
||||
x.TimeStamp >= startDate && x.TimeStamp <= endDate
|
||||
x.TimeStamp >= startDate && x.TimeStamp <= endDate && x.Type == type
|
||||
// && userIds.Any(y => x.Users.Select(z => z.UserId).Any(z => z == y))
|
||||
)
|
||||
.Skip(page * pageSize)
|
||||
.Take(pageSize)
|
||||
.Include("AlarmDescription")
|
||||
.ToList();
|
||||
|
||||
//var ids = occurrences.Select(x => x.Id).ToList();
|
||||
//var users = dbCtx.AlarmUsers.Where(x => ids.Contains(x.AlarmOccurrenceId) && userIds.Contains(x.UserId)).ToList();
|
||||
|
||||
|
||||
return occurrences
|
||||
.Select(x => (DTOAlarmHistoricModel)x)
|
||||
.ToList();
|
||||
@@ -191,7 +169,7 @@ namespace Step.Database.Controllers
|
||||
|
||||
#endregion NOTES
|
||||
|
||||
#region Attachment
|
||||
#region ATTACHMENT
|
||||
|
||||
public List<AlarmFileModel> FindAttachmentByAlarmDescId(int alarmDescId)
|
||||
{
|
||||
@@ -253,6 +231,6 @@ namespace Step.Database.Controllers
|
||||
File.Delete(ALARM_ATTACHMENT_PATH + attachment.LocalFileName);
|
||||
}
|
||||
|
||||
#endregion Attachment
|
||||
#endregion ATTACHMENT
|
||||
}
|
||||
}
|
||||
+16
-8
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Step.Model
|
||||
@@ -69,7 +68,7 @@ namespace Step.Model
|
||||
MACHINE_INTERVAL = 1,
|
||||
TIME_INTERVAL = 2
|
||||
}
|
||||
|
||||
|
||||
public enum QUEUE_ITEM_STATUS
|
||||
{
|
||||
NOT_ACTIVE = 0,
|
||||
@@ -85,22 +84,26 @@ namespace Step.Model
|
||||
public const string SIEMENS = "SIEMENS";
|
||||
public const string OSAI = "OSAI";
|
||||
}
|
||||
|
||||
// Database config
|
||||
public const string DATABASE_USER = "root";
|
||||
|
||||
public const string DATABASE_PWD = "root";
|
||||
public const string DATABASE_NAME = "step";
|
||||
|
||||
// Registry key
|
||||
// Registry key
|
||||
public const string REGISTER_MACHINE_ID_KEY_NAME = "MachineUniqueId";
|
||||
|
||||
// Token fields Keys
|
||||
public const string MACHINE_ID_KEY = "machineId";
|
||||
|
||||
public const string ROLE_LEVEL_KEY = "roleLevel";
|
||||
public const string USERNAME_KEY = "username";
|
||||
public const string USER_ID_KEY = "id";
|
||||
|
||||
// Names in the xml file
|
||||
public const string SERVER_CONFIG_KEY = "serverConfig";
|
||||
|
||||
public const string NC_CONFIG_KEY = "ncConfig";
|
||||
public const string AREAS_CONFIG_KEY = "areasConfig";
|
||||
|
||||
@@ -116,16 +119,17 @@ namespace Step.Model
|
||||
public const string SCADA_KEY = "scada";
|
||||
public const string GENERAL_KEY = "general";
|
||||
public const string UNDER_HOOD = "underHood";
|
||||
public const string JOBEDITOR_KEY = "jobeditor";
|
||||
public const string JOBEDITOR_KEY = "jobeditor";
|
||||
}
|
||||
|
||||
// Config File Names
|
||||
public static readonly string BASE_PATH = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
|
||||
public const string CONFIG_DIRECTORY = "Config\\";
|
||||
public const string RESOURCE_DIRECTORY = @"Step.Config.Config.";
|
||||
public const string SERVER_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + @"serverConfigValidator.xsd";
|
||||
public const string SERVER_CONFIG_PATH = CONFIG_DIRECTORY + "serverConfig.xml";
|
||||
|
||||
|
||||
public const string AREAS_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "areasConfigValidator.xsd";
|
||||
public const string AREAS_CONFIG_PATH = CONFIG_DIRECTORY + "areasConfig.xml";
|
||||
|
||||
@@ -156,14 +160,16 @@ namespace Step.Model
|
||||
|
||||
// MVVM Messages to server UI
|
||||
public const string SEND_STOP_SERVER = "STOP_SERVER";
|
||||
|
||||
public const string SEND_MESSAGE = "SEND_MESSAGE";
|
||||
public const string SEND_NC_STATUS = "NC_STATUS";
|
||||
public const string SEND_THREADS_STATUS = "THREAD_STATUS";
|
||||
public const string SHOW_MSG_UI = "SHOW_MSG_UI";
|
||||
public const string SEND_ERROR_TO_UI = "SEND_ERROR_TO_UI";
|
||||
|
||||
// MVVM Messages to signalR tasks
|
||||
// MVVM Messages to signalR tasks
|
||||
public const string SEND_ALARMS = "SEND_ALARMS";
|
||||
|
||||
public const string SEND_POWER_ON_DATA = "SEND_POWER_ON_DATA";
|
||||
public const string SEND_GENERIC_DATA = "SEND_GENERIC_DATA";
|
||||
public const string SEND_AXES = "SEND_AXES";
|
||||
@@ -184,6 +190,7 @@ namespace Step.Model
|
||||
|
||||
// ID prefix
|
||||
public const string MAINTENANCE_PREFIX_ID = "maint_";
|
||||
|
||||
public const string MAINTENANCE_DESC_PREFIX_ID = "maint_desc_";
|
||||
public const string SOFTKEY_PREFIX_ID = "softkey_";
|
||||
public const string SOFTKEY_HEAD_ID = "Head_";
|
||||
@@ -217,6 +224,7 @@ namespace Step.Model
|
||||
public const string CLIENT_EXE_NAME = @"CMS-Active Client.exe";
|
||||
public const string CLIENT_EXE_NAME_NOEXT = @"CMS-Active Client";
|
||||
public const string MAINTENANCE_ATTACHMENT_PATH = @"C:\CMS\STEP\attachment\maintenance\";
|
||||
|
||||
public const string ALARM_ATTACHMENT_PATH = @"C:\CMS\STEP\attachment\alarm\";
|
||||
public const string TEMP_FOLDER = @"C:\CMS\STEP\TMP\";
|
||||
public const string TEMP_PP_FOLDER = TEMP_FOLDER + @"pp\";
|
||||
@@ -232,4 +240,4 @@ namespace Step.Model
|
||||
public const string JOB_METADATA_FILENAME = "metadata.json";
|
||||
public static string[] JOB_EXTENSIONS = { ".job", ".zip" };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,11 @@ namespace Step.NC
|
||||
numericalControl.NC_Disconnect();
|
||||
}
|
||||
|
||||
public void Disconnect()
|
||||
{
|
||||
numericalControl.NC_Disconnect();
|
||||
}
|
||||
|
||||
public CmsError Connect()
|
||||
{
|
||||
// Connect NC
|
||||
|
||||
@@ -269,7 +269,7 @@
|
||||
<tooling_equipment_param_inFixedPlace>Ut. In pos fissa</tooling_equipment_param_inFixedPlace>
|
||||
<tooling_equipment_param_isMeasured>Ut. Misurato</tooling_equipment_param_isMeasured>
|
||||
<tooling_equipment_param_inChangeTool>Ut. in CU</tooling_equipment_param_inChangeTool>
|
||||
<tooling_equipment_param_inUse>Ut. in Uso</tooling_equipment_param_inUse>
|
||||
<tooling_equipment_param_isInUse>Ut. in Uso</tooling_equipment_param_isInUse>
|
||||
<tooling_equipment_param_preAlarm>Ut. in Preallarme</tooling_equipment_param_preAlarm>
|
||||
<tooling_equipment_param_cooling>Raffreddamento principale</tooling_equipment_param_cooling>
|
||||
<tooling_equipment_param_cooling1>Raffreddamento 1</tooling_equipment_param_cooling1>
|
||||
|
||||
@@ -268,7 +268,7 @@
|
||||
<tooling_equipment_param_inFixedPlace>Tool In Fixed Place</tooling_equipment_param_inFixedPlace>
|
||||
<tooling_equipment_param_isMeasured>Tool Measured</tooling_equipment_param_isMeasured>
|
||||
<tooling_equipment_param_inChangeTool>Tool in Tool Change</tooling_equipment_param_inChangeTool>
|
||||
<tooling_equipment_param_inUse>Tool in Use</tooling_equipment_param_inUse>
|
||||
<tooling_equipment_param_isInUse>Tool in Use</tooling_equipment_param_isInUse>
|
||||
<tooling_equipment_param_preAlarm>Tool in Prealarm</tooling_equipment_param_preAlarm>
|
||||
<tooling_equipment_param_cooling>Main Cooling</tooling_equipment_param_cooling>
|
||||
<tooling_equipment_param_cooling1>Cooling 1</tooling_equipment_param_cooling1>
|
||||
|
||||
@@ -180,7 +180,7 @@
|
||||
<tooling_equipment_param_inFixedPlace>工具在固定的地方</tooling_equipment_param_inFixedPlace>
|
||||
<tooling_equipment_param_isMeasured>測量工具</tooling_equipment_param_isMeasured>
|
||||
<tooling_equipment_param_inChangeTool>刀具更換中的工具</tooling_equipment_param_inChangeTool>
|
||||
<tooling_equipment_param_inUse>正在使用的工具</tooling_equipment_param_inUse>
|
||||
<tooling_equipment_param_isInUse>正在使用的工具</tooling_equipment_param_isInUse>
|
||||
<tooling_equipment_param_preAlarm>預報警中的工具</tooling_equipment_param_preAlarm>
|
||||
<tooling_equipment_param_cooling1>冷卻1</tooling_equipment_param_cooling1>
|
||||
<tooling_equipment_param_cooling2>冷卻2</tooling_equipment_param_cooling2>
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
using Step.Model.DTOModels;
|
||||
using CMS_CORE_Library.Models;
|
||||
using Step.Model.DTOModels;
|
||||
using Step.NC;
|
||||
using Step.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using static Step.Model.Constants;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
using System.Linq;
|
||||
using static Step.Config.ServerConfig;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using CMS_CORE_Library.Models;
|
||||
using static CMS_CORE_Library.Models.DataStructures;
|
||||
using static Step.Config.ServerConfig;
|
||||
using static Step.Model.Constants;
|
||||
|
||||
namespace Step.Controllers.WebApi
|
||||
{
|
||||
@@ -28,7 +25,7 @@ namespace Step.Controllers.WebApi
|
||||
{
|
||||
ncHandler.Connect();
|
||||
|
||||
CmsError cmsError = ncHandler.GetFileList(filePath, out List<PreviewFileModel> fileList);
|
||||
CmsError cmsError = ncHandler.GetFileList(filePath, out List<PreviewFileModel> fileList);
|
||||
if (cmsError.IsError())
|
||||
return BadRequest(cmsError.localizationKey);
|
||||
|
||||
@@ -37,7 +34,7 @@ namespace Step.Controllers.WebApi
|
||||
}
|
||||
|
||||
[Route("file/info"), HttpGet]
|
||||
public IHttpActionResult GetFileInfo([FromUri]string filePath)
|
||||
public IHttpActionResult GetFileInfo([FromUri]string filePath)
|
||||
{
|
||||
using (NcHandler ncHandler = new NcHandler())
|
||||
{
|
||||
@@ -93,7 +90,7 @@ namespace Step.Controllers.WebApi
|
||||
return BadRequest(cmsError.localizationKey);
|
||||
|
||||
return Ok(fileInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Route("upload"), HttpPost]
|
||||
@@ -110,7 +107,7 @@ namespace Step.Controllers.WebApi
|
||||
{
|
||||
if (item.IsAFile)
|
||||
{
|
||||
if(item.ParameterName == "file")
|
||||
if (item.ParameterName == "file")
|
||||
{
|
||||
using (NcHandler ncHandler = new NcHandler())
|
||||
{
|
||||
@@ -123,7 +120,7 @@ namespace Step.Controllers.WebApi
|
||||
return BadRequest(cmsError.localizationKey);
|
||||
}
|
||||
}
|
||||
else if(item.ParameterName == "image")
|
||||
else if (item.ParameterName == "image")
|
||||
{
|
||||
File.WriteAllBytes(PART_PRG_IMAGES + item.FileName, item.Data);
|
||||
}
|
||||
@@ -133,8 +130,7 @@ namespace Step.Controllers.WebApi
|
||||
return Ok();
|
||||
}
|
||||
|
||||
|
||||
[Route("shared_files"), HttpGet]
|
||||
[Route("shared_files"), HttpGet]
|
||||
public IHttpActionResult GetSharedFolderFileList(string sharedPath)
|
||||
{
|
||||
List<object> filelist = new List<object>();
|
||||
@@ -172,7 +168,6 @@ namespace Step.Controllers.WebApi
|
||||
return Ok(filelist);
|
||||
}
|
||||
|
||||
|
||||
#region Queue Manager
|
||||
|
||||
[Route("queue/add"), HttpPost]
|
||||
@@ -242,7 +237,7 @@ namespace Step.Controllers.WebApi
|
||||
CmsError cmsError = ncHandler.MoveQueueItems(processId, itemsPositions.ObjectId, itemsPositions.NewPosition, out List<DTOQueueModel> queue);
|
||||
if (cmsError.IsError())
|
||||
return BadRequest(cmsError.localizationKey);
|
||||
|
||||
|
||||
return Ok(queue);
|
||||
}
|
||||
}
|
||||
@@ -258,7 +253,7 @@ namespace Step.Controllers.WebApi
|
||||
CmsError cmsError = ncHandler.EditQueueItemReps(processId, itemId, reps.Reps, out DTOQueueModel queueItem);
|
||||
if (cmsError.IsError())
|
||||
return BadRequest(cmsError.localizationKey);
|
||||
|
||||
|
||||
return Ok(queueItem);
|
||||
}
|
||||
}
|
||||
@@ -282,10 +277,10 @@ namespace Step.Controllers.WebApi
|
||||
using (NcHandler ncHandler = new NcHandler())
|
||||
{
|
||||
ncHandler.Connect();
|
||||
|
||||
|
||||
CmsError cmsError = ncHandler.StartWorkingQueue(processId);
|
||||
if (cmsError.IsError())
|
||||
return BadRequest(cmsError.localizationKey);
|
||||
return BadRequest(cmsError.localizationKey);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
@@ -324,6 +319,6 @@ namespace Step.Controllers.WebApi
|
||||
public int Reps;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion Queue Manager
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -14,7 +14,7 @@
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Step</RootNamespace>
|
||||
<AssemblyName>CMS-Active</AssemblyName>
|
||||
<AssemblyName>CMS Active</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
@@ -117,7 +117,6 @@
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Web.Http.Cors, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Cors.5.2.3\lib\net45\System.Web.Http.Cors.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@@ -37,6 +37,9 @@ namespace Step
|
||||
// Start WinForm
|
||||
ServerControlWindow.Start();
|
||||
|
||||
// Create unhandled exception handler
|
||||
// AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ExceptionHandler);
|
||||
|
||||
// Read config
|
||||
ServerConfigController.ReadStartupConfig();
|
||||
|
||||
@@ -80,6 +83,10 @@ namespace Step
|
||||
|
||||
// Wait interrupt from client
|
||||
StopRequest.WaitOne();
|
||||
|
||||
using (NcHandler ncHandler = new NcHandler())
|
||||
ncHandler.Disconnect();
|
||||
|
||||
LogInfo("Application closed");
|
||||
}
|
||||
|
||||
@@ -106,5 +113,13 @@ namespace Step
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void ExceptionHandler(object sender, UnhandledExceptionEventArgs args)
|
||||
{
|
||||
using (NcHandler ncHandler = new NcHandler())
|
||||
ncHandler.Disconnect();
|
||||
|
||||
LogException((Exception)args.ExceptionObject, ERROR_LEVEL.FATAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user