Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ead2b7283 | |||
| 66ba44868e | |||
| 529266b57b | |||
| e1280c193f | |||
| 77cec0160a | |||
| f7234dd34b | |||
| 4c7ad000db | |||
| 140afc4539 | |||
| 699ccfbfba | |||
| 3877cb7843 | |||
| 80e6192e46 | |||
| 2786c8e6a8 | |||
| efbfd857f6 | |||
| 3968f72061 | |||
| 88e78736f0 | |||
| a362829256 | |||
| 43abdd203b | |||
| 74e51a4156 | |||
| 52621f83e8 |
@@ -5,11 +5,24 @@
|
||||
|
||||
## Ambiente sviluppo e simulazione
|
||||
|
||||
## Procedura udpate DB
|
||||
|
||||
In caso di update del modello DB, seguendo questa guida (https://www.entityframeworktutorial.net/efcore/entity-framework-core-migration.aspx#:~:text=Adding%20a%20Migration,-At%20the%20very&text=So%2C%20firstly%2C%20you%20need%20to,command%20to%20add%20a%20migration.&text=If%20you%20are%20using%20dotnet,Interface%2C%20execute%20the%20following%20command.)
|
||||
|
||||
* si modifica lato classe il modello
|
||||
* si apre il PM Nuget,s elezionando il progetto DB (che contiene le migrations)
|
||||
* si da il comando di migrazione con un testo descrittivo, tipo
|
||||
add-migration MyFirstMigration
|
||||
* si può poi aggiornare il DB manualmente (o all'avvio del sw) con il comando
|
||||
Update-Database
|
||||
|
||||
## Procedura Riavvio su SIM
|
||||
|
||||
Step come indicati da M.Carissoni:
|
||||
* Dai un paio di ResetSK
|
||||
* fai cicloReset
|
||||
* mettere macchina in MANUAL
|
||||
* Dai un paio di ResetSK (prima softkey! oppure sul pannello siemens)
|
||||
* fai cicloReset (softkey)
|
||||
* parcheggio macchina da GANT (fino a che si spegne)
|
||||
* quando si spegne ciclo reset auto
|
||||
* Inizia a lampeggiare start e lo clicchi e parte
|
||||
* Quando si spegne cicloReset fai cicloAuto
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<userSoftKeys>
|
||||
|
||||
<softKey_procedure>
|
||||
<active>false</active>
|
||||
<active>true</active>
|
||||
<category>1</category>
|
||||
<operatorConfirmationNeeded>false</operatorConfirmationNeeded>
|
||||
<plcId>1</plcId>
|
||||
|
||||
@@ -810,8 +810,6 @@ public static class ThreadsFunctions
|
||||
|
||||
MessageServices.Current.Publish(SEND_THERMO_RECIPE_FULL, null, currRecipe);
|
||||
|
||||
// FIXME TODO verificare come ridurre chiamate
|
||||
|
||||
// ora gestisco la overview!
|
||||
libraryError = ncAdapter.GetRecipeOverview(out Dictionary<RecipeSection, RecipeCatStatus> currOverview);
|
||||
if (libraryError.IsError())
|
||||
|
||||
@@ -67,8 +67,9 @@ namespace Thermo.Active.Database.Controllers
|
||||
/// <param name="VacuumReadVal"></param>
|
||||
/// <param name="MouldEnergyOUT"></param>
|
||||
/// <param name="MouldEnergyIN"></param>
|
||||
/// <param name="IsScrap"></param>
|
||||
/// <returns></returns>
|
||||
public ProdInfoModel Create(short NumTarget, short NumDone, int TimeWarm, int TimeVent, int TimeVacuum, int TimeCycleGross, int TimeCycleNet, double MaterialTempEndWarm, double MaterialTempEndVent, double MoldTemp, double VacuumReadVal, double MouldEnergyOUT, double MouldEnergyIN)
|
||||
public ProdInfoModel Create(short NumTarget, short NumDone, int TimeWarm, int TimeVent, int TimeVacuum, int TimeCycleGross, int TimeCycleNet, double MaterialTempEndWarm, double MaterialTempEndVent, double MoldTemp, double VacuumReadVal, double MouldEnergyOUT, double MouldEnergyIN, bool IsScrap)
|
||||
{
|
||||
// Create database machine model
|
||||
ProdInfoModel prodData = new ProdInfoModel()
|
||||
@@ -86,7 +87,8 @@ namespace Thermo.Active.Database.Controllers
|
||||
MoldTemp = MoldTemp,
|
||||
VacuumReadVal = VacuumReadVal,
|
||||
MouldEnergyOUT = MouldEnergyOUT,
|
||||
MouldEnergyIN = MouldEnergyIN
|
||||
MouldEnergyIN = MouldEnergyIN,
|
||||
IsScrap = IsScrap
|
||||
};
|
||||
try
|
||||
{
|
||||
@@ -100,6 +102,33 @@ namespace Thermo.Active.Database.Controllers
|
||||
|
||||
return prodData;
|
||||
}
|
||||
/// <summary>
|
||||
/// Process table and set as scrap by num value
|
||||
/// </summary>
|
||||
/// <param name="maxKeep"></param>
|
||||
/// <returns></returns>
|
||||
public bool SetScrap(int num, bool isScrap)
|
||||
{
|
||||
bool answ = false;
|
||||
|
||||
var currRecord = dbCtx
|
||||
.ProdInfo
|
||||
.Where(x => x.NumDone == num)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
if (currRecord != null)
|
||||
{
|
||||
currRecord.IsScrap = isScrap;
|
||||
}
|
||||
// save!
|
||||
dbCtx.SaveChanges();
|
||||
answ = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Process table and keep only maxKeep most recent ones
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace Thermo.Active.Database.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
|
||||
public sealed partial class AddedScrapPartMgmt : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(AddedScrapPartMgmt));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202009021558544_AddedScrapPartMgmt"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace Thermo.Active.Database.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class AddedScrapPartMgmt : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.ProdInfo", "IsScrap", c => c.Boolean(nullable: false));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("dbo.ProdInfo", "IsScrap");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -131,6 +131,10 @@
|
||||
<Compile Include="Migrations\202006170558519_AddedProdInfoModel.Designer.cs">
|
||||
<DependentUpon>202006170558519_AddedProdInfoModel.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202009021558544_AddedScrapPartMgmt.cs" />
|
||||
<Compile Include="Migrations\202009021558544_AddedScrapPartMgmt.Designer.cs">
|
||||
<DependentUpon>202009021558544_AddedScrapPartMgmt.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Redis\redUtil.cs" />
|
||||
@@ -173,6 +177,9 @@
|
||||
<EmbeddedResource Include="Migrations\202006170558519_AddedProdInfoModel.resx">
|
||||
<DependentUpon>202006170558519_AddedProdInfoModel.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202009021558544_AddedScrapPartMgmt.resx">
|
||||
<DependentUpon>202009021558544_AddedScrapPartMgmt.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -25,6 +25,7 @@ namespace Thermo.Active.Model.DTOModels.ThProd
|
||||
public double VacuumReadVal { get; set; } = 0;
|
||||
public double MouldEnergyOUT { get; set; } = 0;
|
||||
public double MouldEnergyIN { get; set; } = 0;
|
||||
public bool IsScrap { get; set; } = false;
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
@@ -60,6 +61,8 @@ namespace Thermo.Active.Model.DTOModels.ThProd
|
||||
return false;
|
||||
if (MouldEnergyIN != item.MouldEnergyIN)
|
||||
return false;
|
||||
if (IsScrap != item.IsScrap)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -88,6 +91,7 @@ namespace Thermo.Active.Model.DTOModels.ThProd
|
||||
this.VacuumReadVal = pimRawData.VacuumReadVal;
|
||||
this.MouldEnergyIN = pimRawData.MouldEnergyIN;
|
||||
this.MouldEnergyOUT = pimRawData.MouldEnergyOUT;
|
||||
this.IsScrap = pimRawData.IsScrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ namespace Thermo.Active.Model.DatabaseModels
|
||||
public double MouldEnergyOUT { get; set; }
|
||||
[Column("MouldEnergyIN")]
|
||||
public double MouldEnergyIN { get; set; }
|
||||
[Column("IsScrap")]
|
||||
public bool IsScrap { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using CMS_CORE_Library.Models;
|
||||
using CMS_CORE_Library.S7Net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using Thermo.Active.Database.Controllers;
|
||||
@@ -53,6 +54,46 @@ namespace Thermo.Active.NC
|
||||
/// </summary>
|
||||
public static LiveData RecipeLiveData = new LiveData();
|
||||
|
||||
/// <summary>
|
||||
/// Max number of param writable as single operation
|
||||
/// </summary>
|
||||
public int nMaxParamWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 5;
|
||||
int.TryParse(ConfigurationManager.AppSettings["nMaxParamWrite"], out answ);
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Delay between single param write operation
|
||||
/// </summary>
|
||||
public int delayParamWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 5;
|
||||
int.TryParse(ConfigurationManager.AppSettings["delayParamWrite"], out answ);
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Parametro lambda per EWMA smoothing
|
||||
/// </summary>
|
||||
public double ewmaLambda
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 50;
|
||||
int.TryParse(ConfigurationManager.AppSettings["ewmaPar100"], out answ);
|
||||
return (double)answ / 100;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public NcAdapter() =>
|
||||
// Choose NC
|
||||
numericalControl = SetNumericalControl();
|
||||
@@ -388,7 +429,7 @@ namespace Thermo.Active.NC
|
||||
}
|
||||
}
|
||||
// se si in questo caso scrivo configurazione attuale...
|
||||
WriteRecipeParams(updtRecipe);
|
||||
WriteRecipeParams(updtRecipe, nMaxParamWrite, delayParamWrite);
|
||||
// Ack !
|
||||
libraryError = numericalControl.PLC_WAckConfRecipeRequest();
|
||||
if (libraryError.IsError())
|
||||
@@ -1400,7 +1441,9 @@ namespace Thermo.Active.NC
|
||||
currentProdPanel.LastCadenza = Math.Round((double)3600000 / lastProdInfoData.TimeCycleGross, 2);
|
||||
}
|
||||
// stima durata da pz fatti...
|
||||
currentProdPanel.StimaDurata = Math.Round((currentProdPanel.NumTarget - currentProdPanel.NumDone) * currentProdPanel.LastTCiclo, 2);
|
||||
//currentProdPanel.StimaDurata = Math.Round((currentProdPanel.NumTarget - currentProdPanel.NumDone) * currentProdPanel.LastTCiclo, 2);
|
||||
// 2020.09.03 uso dati da ricetta corrente... stimata con EWMA
|
||||
currentProdPanel.StimaDurata = Math.Round((currentProdPanel.NumTarget - currentProdPanel.NumDone) * RecipeLiveData.TC_last, 2);
|
||||
// se stima negativa (+ pezzi di quanti richiesti...) --> ZERO!
|
||||
currentProdPanel.StimaDurata = currentProdPanel.StimaDurata < 0 ? 0 : currentProdPanel.StimaDurata;
|
||||
}
|
||||
@@ -1501,10 +1544,10 @@ namespace Thermo.Active.NC
|
||||
// do comparison with old record and if changed --> persist on DB!
|
||||
if (!prodInfoRawData.Equals(lastProdInfoData))
|
||||
{
|
||||
// save on DB! attenzione: num pezzi -1 perché salvo pezzo PRECEDENTE...
|
||||
// save on DB! attenzione: RAW DATA perché salvo pezzo PRECEDENTE...
|
||||
using (ProdInfoController prodInfoController = new ProdInfoController())
|
||||
{
|
||||
prodInfoController.Create(prodInfoRawData.NumTarget, prodInfoRawData.NumDone, prodInfoRawData.TimeWarm, prodInfoRawData.TimeVent, prodInfoRawData.TimeVacuum, prodInfoRawData.TimeCycleGross, prodInfoRawData.TimeCycleNet, prodInfoRawData.MaterialTempEndWarm, prodInfoRawData.MaterialTempEndVent, prodInfoRawData.MoldTemp, prodInfoRawData.VacuumReadVal, prodInfoRawData.MouldEnergyOUT, prodInfoRawData.MouldEnergyIN);
|
||||
prodInfoController.Create(prodInfoRawData.NumTarget, prodInfoRawData.NumDone, prodInfoRawData.TimeWarm, prodInfoRawData.TimeVent, prodInfoRawData.TimeVacuum, prodInfoRawData.TimeCycleGross, prodInfoRawData.TimeCycleNet, prodInfoRawData.MaterialTempEndWarm, prodInfoRawData.MaterialTempEndVent, prodInfoRawData.MoldTemp, prodInfoRawData.VacuumReadVal, prodInfoRawData.MouldEnergyOUT, prodInfoRawData.MouldEnergyIN, false);
|
||||
}
|
||||
// update last info data
|
||||
lastProdInfoData = prodInfoRawData;
|
||||
@@ -1534,15 +1577,16 @@ namespace Thermo.Active.NC
|
||||
lastProdEnd = DateTime.Now;
|
||||
// calcolo ultimo ciclo...
|
||||
var lastDuration = lastProdEnd.Subtract(lastProdStart).TotalSeconds;
|
||||
// se il valore SALVATO è > 3 * valore rilevato (ma NON inferiore a 1/3...) --> uso SOLO ultimo
|
||||
if ((lastCycle > 3 * lastDuration) && (lastCycle / 3 < lastDuration))
|
||||
// se il valore SALVATO è > 3 * valore rilevato --> uso SOLO ultimo
|
||||
if (lastCycle > 3 * lastDuration)
|
||||
{
|
||||
lastCycle = lastDuration;
|
||||
}
|
||||
// altrimenti EWMA 50%
|
||||
// altrimenti EWMA da parametro calcolato standard, default 50%
|
||||
else
|
||||
{
|
||||
lastCycle = 0.5 * lastCycle + 0.5 * lastDuration;
|
||||
//lastCycle = 0.5 * lastCycle + 0.5 * lastDuration;
|
||||
lastCycle = ewmaLambda * lastDuration + (1 - ewmaLambda) * lastCycle;
|
||||
}
|
||||
// salvo anche nei live data della ricetta...
|
||||
RecipeLiveData.TC_last = lastCycle;
|
||||
@@ -1588,26 +1632,45 @@ namespace Thermo.Active.NC
|
||||
MoldTemp = x.MoldTemp,
|
||||
VacuumReadVal = x.VacuumReadVal,
|
||||
MouldEnergyOUT = x.MouldEnergyOUT,
|
||||
MouldEnergyIN = x.MouldEnergyIN
|
||||
MouldEnergyIN = x.MouldEnergyIN,
|
||||
IsScrap = x.IsScrap
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
return libraryError;
|
||||
}
|
||||
/// <summary>
|
||||
/// Get historical prodinfo data from DB
|
||||
/// </summary>
|
||||
/// <param name="num"></param>
|
||||
/// <param name="isScrap"></param>
|
||||
/// <returns></returns>
|
||||
public CmsError SetScrap(int num, bool isScrap)
|
||||
{
|
||||
CmsError libraryError = NO_ERROR;
|
||||
|
||||
using (ProdInfoController prodInfoController = new ProdInfoController())
|
||||
{
|
||||
prodInfoController.SetScrap(num, isScrap);
|
||||
}
|
||||
|
||||
return libraryError;
|
||||
}
|
||||
/// <summary>
|
||||
/// Update requested prod quantity
|
||||
/// </summary>
|
||||
/// <param name="numTarget"></param>
|
||||
/// <param name="newWorkOrder"></param>
|
||||
/// <param name="numTarget">Total qty requested</param>
|
||||
/// <param name="newWorkOrder">Reset counter = new order</param>
|
||||
/// <param name="preWarmCycle">Number of pre-warm cycle requested</param>
|
||||
/// <returns></returns>
|
||||
public CmsError UpdateProdInfoData(short numTarget, bool newWorkOrder)
|
||||
public CmsError UpdateProdInfoData(short numTarget, bool newWorkOrder, short preWarmCycle)
|
||||
{
|
||||
CmsError libraryError = NO_ERROR;
|
||||
|
||||
using (ProdInfoController prodInfoController = new ProdInfoController())
|
||||
{
|
||||
// registro dati aggiornati sul PLC
|
||||
libraryError = numericalControl.PLC_WProdInfo(numTarget, newWorkOrder);
|
||||
libraryError = numericalControl.PLC_WProdInfo(numTarget, newWorkOrder, preWarmCycle);
|
||||
if (libraryError.IsError())
|
||||
return libraryError;
|
||||
|
||||
@@ -1761,9 +1824,11 @@ namespace Thermo.Active.NC
|
||||
/// <summary>
|
||||
/// Recipe Parameters write to PLC (only SetpointHMI)
|
||||
/// </summary>
|
||||
/// <param name="updtRecipe"></param>
|
||||
/// <param name="updtRecipe">Oggetto parametri da aggiornare (from HMI)</param>
|
||||
/// <param name="nMaxParamWrite">num max parametri da scrivere singolarmente</param>
|
||||
/// <param name="delayParamWrite">delay in scriottura multi parametri singoli</param>
|
||||
/// <returns></returns>
|
||||
public CmsError WriteRecipeParametersToPLC(Dictionary<string, DTORecipeParam> updtRecipe)
|
||||
public CmsError WriteRecipeParametersToPLC(Dictionary<string, DTORecipeParam> updtRecipe, int nMaxParamWrite, int delayParamWrite)
|
||||
{
|
||||
Dictionary<int, int> newParameters = new Dictionary<int, int>();
|
||||
// solo x S7...
|
||||
@@ -1775,7 +1840,7 @@ namespace Thermo.Active.NC
|
||||
newParameters.Add(item.Value.Id, (int)(item.Value.SetpointHMI * item.Value.ScaleFactor));
|
||||
}
|
||||
// scrivo!
|
||||
CmsError libraryError = numericalControl.PLC_WRecipeParameters(newParameters);
|
||||
CmsError libraryError = numericalControl.PLC_WRecipeParameters(newParameters, nMaxParamWrite, delayParamWrite);
|
||||
if (libraryError.IsError())
|
||||
return libraryError;
|
||||
}
|
||||
@@ -2245,10 +2310,12 @@ namespace Thermo.Active.NC
|
||||
/// Scrive tutti i parametri della ricetta indicati
|
||||
/// </summary>
|
||||
/// <param name="updtRecipe">Oggetto parametri da aggiornare (from HMI)</param>
|
||||
/// <param name="nMaxParamWrite">num max parametri da scrivere singolarmente</param>
|
||||
/// <param name="delayParamWrite">delay in scriottura multi parametri singoli</param>
|
||||
/// <returns></returns>
|
||||
public CmsError WriteRecipeParams(Dictionary<string, DTORecipeParam> updtRecipe)
|
||||
public CmsError WriteRecipeParams(Dictionary<string, DTORecipeParam> updtRecipe, int nMaxParamWrite, int delayParamWrite)
|
||||
{
|
||||
CmsError libraryError = WriteRecipeParametersToPLC(updtRecipe);
|
||||
CmsError libraryError = WriteRecipeParametersToPLC(updtRecipe, nMaxParamWrite, delayParamWrite);
|
||||
|
||||
return libraryError;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
<add key="enableDirectoryBrowsing" value="true" />
|
||||
<add key="ClientSettingsProvider.ServiceUri" value="" />
|
||||
<add key="ServerServiceName" value="MariaDB" />
|
||||
<add key="nMaxParamWrite" value="5" />
|
||||
<add key="delayParamWrite" value="10" />
|
||||
<add key="ewmaPar100" value="40" />
|
||||
</appSettings>
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.6.2" />
|
||||
|
||||
@@ -45,6 +45,7 @@ namespace Thermo.Active.Controllers.WebApi
|
||||
// ritorno solo fatto!
|
||||
return Ok();
|
||||
}
|
||||
#if true
|
||||
/// <summary>
|
||||
/// Request mode AUTO
|
||||
/// </summary>
|
||||
@@ -71,7 +72,8 @@ namespace Thermo.Active.Controllers.WebApi
|
||||
|
||||
// ritorno solo fatto!
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/// <summary>
|
||||
/// Request mode SETUP
|
||||
/// </summary>
|
||||
@@ -100,9 +102,42 @@ namespace Thermo.Active.Controllers.WebApi
|
||||
return Ok();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Set item as scrap
|
||||
/// </summary>
|
||||
/// <param name="num">item NUM</param>
|
||||
/// <param name="isScrap">scrap flag (true/false)</param>
|
||||
/// <returns></returns>
|
||||
[Route("setScrap"), HttpPut]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.RECIPE_MANAGER, Action = ACTIONS.READ)]
|
||||
public IHttpActionResult SetScrap(int num, bool isScrap)
|
||||
{
|
||||
// Try connection
|
||||
CmsError libraryError = ncAdapter.Connect();
|
||||
if (libraryError.IsError())
|
||||
{
|
||||
ThermoActiveLogger.LogError($"NC Not connected! | SetScrap | {libraryError.exception}");
|
||||
return BadRequest(libraryError.localizationKey);
|
||||
}
|
||||
|
||||
// scrivo sul DB che il pezzo è SCRAPPED
|
||||
libraryError = ncAdapter.SetScrap(num, isScrap);
|
||||
if (libraryError.IsError())
|
||||
{
|
||||
ThermoActiveLogger.LogError($"SetScrap error | {libraryError.exception}");
|
||||
return BadRequest(libraryError.localizationKey);
|
||||
}
|
||||
|
||||
// ritorno solo fatto!
|
||||
return Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request start production
|
||||
/// </summary>
|
||||
/// <param name="requestQty">item NUM</param>
|
||||
/// <param name="newWorkOrder">scrap flag (true/false)</param>
|
||||
/// <returns></returns>
|
||||
[Route("start"), HttpPut]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.RECIPE_MANAGER, Action = ACTIONS.READ)]
|
||||
@@ -116,19 +151,73 @@ namespace Thermo.Active.Controllers.WebApi
|
||||
return BadRequest(libraryError.localizationKey);
|
||||
}
|
||||
|
||||
// scrivo sul PLC il comando strobe richiesta AUTO!
|
||||
libraryError = ncAdapter.UpdateProdInfoData((short)requestQty, newWorkOrder);
|
||||
// legacy method
|
||||
short numCicliRisc = 0;
|
||||
|
||||
// scrivo sul PLC pezzi richiesti, cicli riscaldo + comando strobe reset se encessario!
|
||||
libraryError = ncAdapter.UpdateProdInfoData((short)requestQty, newWorkOrder, numCicliRisc);
|
||||
if (libraryError.IsError())
|
||||
{
|
||||
ThermoActiveLogger.LogError($"StartProd error | {libraryError.exception}");
|
||||
return BadRequest(libraryError.localizationKey);
|
||||
}
|
||||
// se new workorder --> registro nuova data lorro!
|
||||
// se new workorder --> registro nuova data x start lotto!
|
||||
if (newWorkOrder)
|
||||
{
|
||||
ncAdapter.lottoStart = DateTime.Now;
|
||||
}
|
||||
|
||||
// scrivo sul PLC il comando strobe richiesta AUTO!
|
||||
libraryError = ncAdapter.StrobeMode(Mode.AUTO);
|
||||
if (libraryError.IsError())
|
||||
{
|
||||
ThermoActiveLogger.LogError($"RequestAuto error | {libraryError.exception}");
|
||||
return BadRequest(libraryError.localizationKey);
|
||||
}
|
||||
|
||||
// ritorno solo fatto!
|
||||
return Ok();
|
||||
}
|
||||
/// <summary>
|
||||
/// Request start production
|
||||
/// </summary>
|
||||
/// <param name="requestQty">item NUM</param>
|
||||
/// <param name="newWorkOrder">scrap flag (true/false)</param>
|
||||
/// <param name="numCicliRisc">warmup cycle requested (0=none)</param>
|
||||
/// <returns></returns>
|
||||
[Route("startFull"), HttpPut]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.RECIPE_MANAGER, Action = ACTIONS.READ)]
|
||||
public IHttpActionResult StartProdFull(int requestQty, bool newWorkOrder, int numCicliRisc)
|
||||
{
|
||||
// Try connection
|
||||
CmsError libraryError = ncAdapter.Connect();
|
||||
if (libraryError.IsError())
|
||||
{
|
||||
ThermoActiveLogger.LogError($"NC Not connected! | StartProd | {libraryError.exception}");
|
||||
return BadRequest(libraryError.localizationKey);
|
||||
}
|
||||
|
||||
// scrivo sul PLC pezzi richiesti, cicli riscaldo + comando strobe reset se encessario!
|
||||
libraryError = ncAdapter.UpdateProdInfoData((short)requestQty, newWorkOrder, (short)numCicliRisc);
|
||||
if (libraryError.IsError())
|
||||
{
|
||||
ThermoActiveLogger.LogError($"StartProd error | {libraryError.exception}");
|
||||
return BadRequest(libraryError.localizationKey);
|
||||
}
|
||||
// se new workorder --> registro nuova data x start lotto!
|
||||
if (newWorkOrder)
|
||||
{
|
||||
ncAdapter.lottoStart = DateTime.Now;
|
||||
}
|
||||
|
||||
// scrivo sul PLC il comando strobe richiesta AUTO!
|
||||
libraryError = ncAdapter.StrobeMode(Mode.AUTO);
|
||||
if (libraryError.IsError())
|
||||
{
|
||||
ThermoActiveLogger.LogError($"RequestAuto error | {libraryError.exception}");
|
||||
return BadRequest(libraryError.localizationKey);
|
||||
}
|
||||
|
||||
// ritorno solo fatto!
|
||||
return Ok();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using CMS_CORE_Library.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
@@ -118,8 +119,8 @@ namespace Thermo.Active.Controllers.WebApi
|
||||
|
||||
if (updtRecipe.Count > 0)
|
||||
{
|
||||
// scrivo sul PLC
|
||||
ncAdapter.WriteRecipeParams(updtRecipe);
|
||||
// scrivo sul PLC con i parametri specificati x ritardo/raggruppamento
|
||||
ncAdapter.WriteRecipeParams(updtRecipe, ncAdapter.nMaxParamWrite, ncAdapter.delayParamWrite);
|
||||
}
|
||||
|
||||
// ritorno solo fatto!
|
||||
@@ -621,7 +622,7 @@ namespace Thermo.Active.Controllers.WebApi
|
||||
}
|
||||
|
||||
// write to PLC
|
||||
checkError = ncAdapter.WriteRecipeParams(updtRecipe);
|
||||
checkError = ncAdapter.WriteRecipeParams(updtRecipe, ncAdapter.nMaxParamWrite, ncAdapter.delayParamWrite);
|
||||
if (checkError.IsError())
|
||||
{
|
||||
ThermoActiveLogger.LogError($"WriteCurrentRecipeToPlc | WriteRecipeParams error | {checkError.exception}");
|
||||
|
||||
@@ -78,12 +78,6 @@ namespace Thermo.Active.Listeners
|
||||
SignalRListener.SendPartProgramQueue(a);
|
||||
SignalRDatabaseHandler.UpdateQueue(a);
|
||||
}));
|
||||
#if false
|
||||
infos.Add(MessageServices.Current.Subscribe(SEND_M155_DATA, (a, b) =>
|
||||
{
|
||||
SignalRListener.SendM155Data(a);
|
||||
}));
|
||||
#endif
|
||||
infos.Add(MessageServices.Current.Subscribe(SEND_SCADA_DATA, (a, b) =>
|
||||
{
|
||||
SignalRListener.SendScadaData(a);
|
||||
|
||||
@@ -514,10 +514,7 @@ namespace Thermo.Active.Listeners.SignalR
|
||||
group.magazineIsActive(LastNcMagazineIsActive);
|
||||
// Send PP Queue
|
||||
group.partProgramQueue(LastPartProgramQueue);
|
||||
#if false
|
||||
// Send m155 data
|
||||
group.m155Data(LastM155Data);
|
||||
#endif
|
||||
|
||||
// Send Scada
|
||||
group.scadaData(LastScadaData);
|
||||
|
||||
|
||||
@@ -30,4 +30,4 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("0.12.65")]
|
||||
[assembly: AssemblyVersion("0.12.70")]
|
||||
Reference in New Issue
Block a user