aggiunto progetto MapoDb...
This commit is contained in:
+17
-22
@@ -4,19 +4,28 @@
|
||||
*.pdb
|
||||
|
||||
|
||||
#--------------------------------
|
||||
# Area VersGen
|
||||
#--------------------------------
|
||||
/VersGen/bin/*
|
||||
/VersGen/obj/*
|
||||
|
||||
#--------------------------------
|
||||
# area MapoDb
|
||||
#--------------------------------
|
||||
/MapoDb/MapoDb/obj/Debug
|
||||
/MapoDb/MapoDb/obj/Release
|
||||
/MapoDb/MapoDb/obj/218
|
||||
/MapoDb/MapoDb/obj/Donati
|
||||
/MapoDb/MapoDb/obj/MoonProDemo-OVH
|
||||
/MapoDb/MapoDb/obj/Steamware
|
||||
/MapoDb/MapoDb/obj/MapoDb.csproj.FileListAbsolute.txt
|
||||
/MapoDb/MapoDb/obj/MapoDb.csproj.FileList.txt
|
||||
/MapoDb/bin/*
|
||||
/MapoDb/obj/*
|
||||
|
||||
|
||||
#--------------------------------
|
||||
# Area MP-MON (MoonPro-MONitor)
|
||||
#--------------------------------
|
||||
/MP-MON/logs/*.zip
|
||||
/MP-MON/logs/*.txt
|
||||
/MP-MON/bin/*
|
||||
/MP-MON/obj/*
|
||||
/MP-MON/WebCharts/*.png
|
||||
|
||||
#--------------------------------
|
||||
# Area MoonProAdmin
|
||||
#--------------------------------
|
||||
@@ -109,14 +118,6 @@ MoonPro/MoonPro_site/obj/218/*
|
||||
/MoonPro/MP-IO/obj/MoonProDemo-OVH/Package/PackageTmp/*
|
||||
/MoonPro/MP-IO/logs/*.txt
|
||||
|
||||
#--------------------------------
|
||||
# Area MP-MON (MoonPro-MONitor)
|
||||
#--------------------------------
|
||||
/MP-MON/logs/*.zip
|
||||
/MP-MON/logs/*.txt
|
||||
/MP-MON/bin/*
|
||||
/MP-MON/obj/*
|
||||
/MP-MON/WebCharts/*.png
|
||||
|
||||
#--------------------------------
|
||||
# Area Archivio Risorse
|
||||
@@ -139,9 +140,3 @@ MoonPro/MoonPro_site/obj/218/*
|
||||
/MoonPro/ArchivioRisorse/obj/MoonProDemo-OVH/Package/PackageTmp/*
|
||||
|
||||
|
||||
|
||||
#############################################
|
||||
# Area VersGen
|
||||
#############################################
|
||||
/VersGen/obj/*
|
||||
/VersGen/bin/*
|
||||
Binary file not shown.
@@ -0,0 +1,17 @@
|
||||
namespace MapoDb.DS_ProdTempiTableAdapters
|
||||
{
|
||||
partial class ODLTableAdapter
|
||||
{
|
||||
}
|
||||
}
|
||||
namespace MapoDb.DS_ProdTempiTableAdapters
|
||||
{
|
||||
}
|
||||
namespace MapoDb
|
||||
{
|
||||
|
||||
|
||||
public partial class DS_ProdTempi
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--<autogenerated>
|
||||
This code was generated by a tool.
|
||||
Changes to this file may cause incorrect behavior and will be lost if
|
||||
the code is regenerated.
|
||||
</autogenerated>-->
|
||||
<DataSetUISetting Version="1.00" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TableUISettings />
|
||||
</DataSetUISetting>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--<autogenerated>
|
||||
This code was generated by a tool to store the dataset designer's layout information.
|
||||
Changes to this file may cause incorrect behavior and will be lost if
|
||||
the code is regenerated.
|
||||
</autogenerated>-->
|
||||
<DiagramLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ex:showrelationlabel="False" ViewPortX="-10" ViewPortY="-10" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
|
||||
<Shapes>
|
||||
<Shape ID="DesignTable:TempiCicloRilevati" ZOrder="4" X="266" Y="244" Height="248" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="121" />
|
||||
<Shape ID="DesignTable:ODL" ZOrder="1" X="590" Y="407" Height="381" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:AnagArticoli" ZOrder="18" X="261" Y="516" Height="172" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
|
||||
<Shape ID="DesignTable:DatiMacchine" ZOrder="19" X="987" Y="357" Height="324" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="235" />
|
||||
<Shape ID="DesignTable:PostazioniMapo" ZOrder="17" X="950" Y="39" Height="248" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="140" />
|
||||
<Shape ID="DesignTable:stp_PzProd_getByMacchina" ZOrder="15" X="181" Y="769" Height="191" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="102" />
|
||||
<Shape ID="DesignTable:DatiConfermati" ZOrder="14" X="585" Y="50" Height="317" Width="228" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="228" />
|
||||
<Shape ID="DesignTable:CalendFesteFerie" ZOrder="16" X="13" Y="736" Height="134" Width="158" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="83" />
|
||||
<Shape ID="DesignTable:stp_TempoByIdxMaccPeriodClass" ZOrder="12" X="154" Y="1003" Height="96" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="46" />
|
||||
<Shape ID="DesignTable:DatiProduzione" ZOrder="13" X="556" Y="854" Height="381" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:stp_repDonati_getDatiProdMacchina" ZOrder="11" X="1005" Y="771" Height="305" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:stp_repDonati_getLastStatoDurataMacchina" ZOrder="10" X="1003" Y="1127" Height="115" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
|
||||
<Shape ID="DesignTable:stp_repDonati_getDatiProdMacchinaPeriodo" ZOrder="9" X="166" Y="1132" Height="172" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="121" />
|
||||
<Shape ID="DesignTable:TurniMacchina" ZOrder="8" X="13" Y="455" Height="191" Width="199" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="102" />
|
||||
<Shape ID="DesignTable:MappaStatoExpl" ZOrder="7" X="731" Y="1262" Height="343" Width="240" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:ProduzioneAs400" ZOrder="6" X="177" Y="1342" Height="248" Width="246" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="178" />
|
||||
<Shape ID="DesignTable:ResProdTot" ZOrder="5" X="271" Y="20" Height="191" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="140" />
|
||||
<Shape ID="DesignTable:ResProdDett_splitODL" ZOrder="3" X="27" Y="15" Height="191" Width="158" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="140" />
|
||||
<Shape ID="DesignTable:ResProdDett_splitGG" ZOrder="2" X="31" Y="224" Height="210" Width="158" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="159" />
|
||||
</Shapes>
|
||||
<Connectors />
|
||||
</DiagramLayout>
|
||||
Generated
+23263
File diff suppressed because it is too large
Load Diff
Generated
+8945
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
||||
namespace MapoDb {
|
||||
|
||||
|
||||
public partial class DS_Utility {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--<autogenerated>
|
||||
This code was generated by a tool.
|
||||
Changes to this file may cause incorrect behavior and will be lost if
|
||||
the code is regenerated.
|
||||
</autogenerated>-->
|
||||
<DataSetUISetting Version="1.00" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TableUISettings />
|
||||
</DataSetUISetting>
|
||||
@@ -0,0 +1,783 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema id="DS_Utility" targetNamespace="http://tempuri.org/DS_Utility.xsd" xmlns:mstns="http://tempuri.org/DS_Utility.xsd" xmlns="http://tempuri.org/DS_Utility.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
|
||||
<xs:annotation>
|
||||
<xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<DataSource DefaultConnectionIndex="1" FunctionsComponentName="STP_man1" GeneratorFunctionsComponentClassName="STP_man" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" UserFunctionsComponentName="STP_man" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<Connections>
|
||||
<Connection AppSettingsObjectName="Settings" AppSettingsPropertyName="MoonProConnectionString1" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly" Name="MoonProConnectionString1 (Settings)" ParameterPrefix="@" PropertyReference="ApplicationSettings.MapoDb.Properties.Settings.GlobalReference.Default.MoonProConnectionString1" Provider="System.Data.SqlClient" />
|
||||
<Connection AppSettingsObjectName="Settings" AppSettingsPropertyName="MoonProConnectionString" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly" Name="MoonProConnectionString (Settings)" ParameterPrefix="@" PropertyReference="ApplicationSettings.MapoDb.Properties.Settings.GlobalReference.Default.MoonProConnectionString" Provider="System.Data.SqlClient" />
|
||||
</Connections>
|
||||
<Tables>
|
||||
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="StatoMacchineTableAdapter" GeneratorDataComponentClassName="StatoMacchineTableAdapter" Name="StatoMacchine" UserDataComponentName="StatoMacchineTableAdapter">
|
||||
<MainSource>
|
||||
<DbSource ConnectionRef="MoonProConnectionString (Settings)" DbObjectName="MoonPro.dbo.StatoMacchine" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<DeleteCommand>
|
||||
<DbCommand CommandType="Text" ModifiedByUser="false">
|
||||
<CommandText>DELETE FROM [dbo].[StatoMacchine] WHERE (([IdxMacchina] = @Original_IdxMacchina) AND ([IdxStato] = @Original_IdxStato) AND ((@IsNull_InizioStato = 1 AND [InizioStato] IS NULL) OR ([InizioStato] = @Original_InizioStato)) AND ((@IsNull_Value = 1 AND [Value] IS NULL) OR ([Value] = @Original_Value)) AND ((@IsNull_MatricolaKanban = 1 AND [MatricolaKanban] IS NULL) OR ([MatricolaKanban] = @Original_MatricolaKanban)) AND ((@IsNull_KanbanCode = 1 AND [KanbanCode] IS NULL) OR ([KanbanCode] = @Original_KanbanCode)) AND ((@IsNull_TempoCicloBase = 1 AND [TempoCicloBase] IS NULL) OR ([TempoCicloBase] = @Original_TempoCicloBase)) AND ((@IsNull_PzPalletProd = 1 AND [PzPalletProd] IS NULL) OR ([PzPalletProd] = @Original_PzPalletProd)) AND ((@IsNull_MatrOpr = 1 AND [MatrOpr] IS NULL) OR ([MatrOpr] = @Original_MatrOpr)) AND ((@IsNull_pallet = 1 AND [pallet] IS NULL) OR ([pallet] = @Original_pallet)))</CommandText>
|
||||
<Parameters>
|
||||
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_IdxMacchina" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="IdxMacchina" SourceColumnNullMapping="false" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@Original_IdxStato" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="IdxStato" SourceColumnNullMapping="false" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_InizioStato" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="InizioStato" SourceColumnNullMapping="true" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="DateTime" Direction="Input" ParameterName="@Original_InizioStato" Precision="0" ProviderType="DateTime" Scale="0" Size="0" SourceColumn="InizioStato" SourceColumnNullMapping="false" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_Value" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="Value" SourceColumnNullMapping="true" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_Value" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="Value" SourceColumnNullMapping="false" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_MatricolaKanban" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="MatricolaKanban" SourceColumnNullMapping="true" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_MatricolaKanban" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="MatricolaKanban" SourceColumnNullMapping="false" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_KanbanCode" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="KanbanCode" SourceColumnNullMapping="true" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_KanbanCode" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="KanbanCode" SourceColumnNullMapping="false" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_TempoCicloBase" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="TempoCicloBase" SourceColumnNullMapping="true" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Double" Direction="Input" ParameterName="@Original_TempoCicloBase" Precision="0" ProviderType="Float" Scale="0" Size="0" SourceColumn="TempoCicloBase" SourceColumnNullMapping="false" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_PzPalletProd" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="PzPalletProd" SourceColumnNullMapping="true" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@Original_PzPalletProd" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="PzPalletProd" SourceColumnNullMapping="false" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_MatrOpr" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="MatrOpr" SourceColumnNullMapping="true" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@Original_MatrOpr" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="MatrOpr" SourceColumnNullMapping="false" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_pallet" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="pallet" SourceColumnNullMapping="true" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_pallet" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="pallet" SourceColumnNullMapping="false" SourceVersion="Original" />
|
||||
</Parameters>
|
||||
</DbCommand>
|
||||
</DeleteCommand>
|
||||
<InsertCommand>
|
||||
<DbCommand CommandType="Text" ModifiedByUser="false">
|
||||
<CommandText>INSERT INTO [dbo].[StatoMacchine] ([IdxMacchina], [IdxStato], [InizioStato], [Value], [MatricolaKanban], [KanbanCode], [TempoCicloBase], [PzPalletProd], [MatrOpr], [pallet]) VALUES (@IdxMacchina, @IdxStato, @InizioStato, @Value, @MatricolaKanban, @KanbanCode, @TempoCicloBase, @PzPalletProd, @MatrOpr, @pallet);
|
||||
SELECT IdxMacchina, IdxStato, InizioStato, Value, MatricolaKanban, KanbanCode, TempoCicloBase, PzPalletProd, MatrOpr, pallet FROM StatoMacchine WHERE (IdxMacchina = @IdxMacchina)</CommandText>
|
||||
<Parameters>
|
||||
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@IdxMacchina" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="IdxMacchina" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IdxStato" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="IdxStato" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="DateTime" Direction="Input" ParameterName="@InizioStato" Precision="0" ProviderType="DateTime" Scale="0" Size="0" SourceColumn="InizioStato" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Value" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="Value" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@MatricolaKanban" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="MatricolaKanban" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@KanbanCode" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="KanbanCode" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Double" Direction="Input" ParameterName="@TempoCicloBase" Precision="0" ProviderType="Float" Scale="0" Size="0" SourceColumn="TempoCicloBase" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@PzPalletProd" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="PzPalletProd" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@MatrOpr" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="MatrOpr" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@pallet" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="pallet" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
</Parameters>
|
||||
</DbCommand>
|
||||
</InsertCommand>
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="Text" ModifiedByUser="false">
|
||||
<CommandText>SELECT IdxMacchina, IdxStato, InizioStato, Value, MatricolaKanban, KanbanCode, TempoCicloBase, PzPalletProd, MatrOpr, pallet FROM dbo.StatoMacchine</CommandText>
|
||||
<Parameters />
|
||||
</DbCommand>
|
||||
</SelectCommand>
|
||||
<UpdateCommand>
|
||||
<DbCommand CommandType="Text" ModifiedByUser="false">
|
||||
<CommandText>UPDATE [dbo].[StatoMacchine] SET [IdxMacchina] = @IdxMacchina, [IdxStato] = @IdxStato, [InizioStato] = @InizioStato, [Value] = @Value, [MatricolaKanban] = @MatricolaKanban, [KanbanCode] = @KanbanCode, [TempoCicloBase] = @TempoCicloBase, [PzPalletProd] = @PzPalletProd, [MatrOpr] = @MatrOpr, [pallet] = @pallet WHERE (([IdxMacchina] = @Original_IdxMacchina) AND ([IdxStato] = @Original_IdxStato) AND ((@IsNull_InizioStato = 1 AND [InizioStato] IS NULL) OR ([InizioStato] = @Original_InizioStato)) AND ((@IsNull_Value = 1 AND [Value] IS NULL) OR ([Value] = @Original_Value)) AND ((@IsNull_MatricolaKanban = 1 AND [MatricolaKanban] IS NULL) OR ([MatricolaKanban] = @Original_MatricolaKanban)) AND ((@IsNull_KanbanCode = 1 AND [KanbanCode] IS NULL) OR ([KanbanCode] = @Original_KanbanCode)) AND ((@IsNull_TempoCicloBase = 1 AND [TempoCicloBase] IS NULL) OR ([TempoCicloBase] = @Original_TempoCicloBase)) AND ((@IsNull_PzPalletProd = 1 AND [PzPalletProd] IS NULL) OR ([PzPalletProd] = @Original_PzPalletProd)) AND ((@IsNull_MatrOpr = 1 AND [MatrOpr] IS NULL) OR ([MatrOpr] = @Original_MatrOpr)) AND ((@IsNull_pallet = 1 AND [pallet] IS NULL) OR ([pallet] = @Original_pallet)));
|
||||
SELECT IdxMacchina, IdxStato, InizioStato, Value, MatricolaKanban, KanbanCode, TempoCicloBase, PzPalletProd, MatrOpr, pallet FROM StatoMacchine WHERE (IdxMacchina = @IdxMacchina)</CommandText>
|
||||
<Parameters>
|
||||
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@IdxMacchina" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="IdxMacchina" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IdxStato" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="IdxStato" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="DateTime" Direction="Input" ParameterName="@InizioStato" Precision="0" ProviderType="DateTime" Scale="0" Size="0" SourceColumn="InizioStato" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Value" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="Value" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@MatricolaKanban" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="MatricolaKanban" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@KanbanCode" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="KanbanCode" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Double" Direction="Input" ParameterName="@TempoCicloBase" Precision="0" ProviderType="Float" Scale="0" Size="0" SourceColumn="TempoCicloBase" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@PzPalletProd" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="PzPalletProd" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@MatrOpr" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="MatrOpr" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@pallet" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="pallet" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_IdxMacchina" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="IdxMacchina" SourceColumnNullMapping="false" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@Original_IdxStato" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="IdxStato" SourceColumnNullMapping="false" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_InizioStato" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="InizioStato" SourceColumnNullMapping="true" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="DateTime" Direction="Input" ParameterName="@Original_InizioStato" Precision="0" ProviderType="DateTime" Scale="0" Size="0" SourceColumn="InizioStato" SourceColumnNullMapping="false" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_Value" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="Value" SourceColumnNullMapping="true" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_Value" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="Value" SourceColumnNullMapping="false" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_MatricolaKanban" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="MatricolaKanban" SourceColumnNullMapping="true" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_MatricolaKanban" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="MatricolaKanban" SourceColumnNullMapping="false" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_KanbanCode" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="KanbanCode" SourceColumnNullMapping="true" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_KanbanCode" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="KanbanCode" SourceColumnNullMapping="false" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_TempoCicloBase" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="TempoCicloBase" SourceColumnNullMapping="true" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Double" Direction="Input" ParameterName="@Original_TempoCicloBase" Precision="0" ProviderType="Float" Scale="0" Size="0" SourceColumn="TempoCicloBase" SourceColumnNullMapping="false" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_PzPalletProd" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="PzPalletProd" SourceColumnNullMapping="true" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@Original_PzPalletProd" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="PzPalletProd" SourceColumnNullMapping="false" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_MatrOpr" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="MatrOpr" SourceColumnNullMapping="true" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@Original_MatrOpr" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="MatrOpr" SourceColumnNullMapping="false" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_pallet" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="pallet" SourceColumnNullMapping="true" SourceVersion="Original" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_pallet" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="pallet" SourceColumnNullMapping="false" SourceVersion="Original" />
|
||||
</Parameters>
|
||||
</DbCommand>
|
||||
</UpdateCommand>
|
||||
</DbSource>
|
||||
</MainSource>
|
||||
<Mappings>
|
||||
<Mapping SourceColumn="IdxMacchina" DataSetColumn="IdxMacchina" />
|
||||
<Mapping SourceColumn="IdxStato" DataSetColumn="IdxStato" />
|
||||
<Mapping SourceColumn="InizioStato" DataSetColumn="InizioStato" />
|
||||
<Mapping SourceColumn="Value" DataSetColumn="Value" />
|
||||
<Mapping SourceColumn="MatricolaKanban" DataSetColumn="MatricolaKanban" />
|
||||
<Mapping SourceColumn="KanbanCode" DataSetColumn="KanbanCode" />
|
||||
<Mapping SourceColumn="TempoCicloBase" DataSetColumn="TempoCicloBase" />
|
||||
<Mapping SourceColumn="PzPalletProd" DataSetColumn="PzPalletProd" />
|
||||
<Mapping SourceColumn="MatrOpr" DataSetColumn="MatrOpr" />
|
||||
<Mapping SourceColumn="pallet" DataSetColumn="pallet" />
|
||||
</Mappings>
|
||||
<Sources>
|
||||
<DbSource ConnectionRef="MoonProConnectionString (Settings)" DbObjectName="MoonPro.dbo.stp_ZZZ_riallineaDateDb" DbObjectType="StoredProcedure" GenerateShortCommands="true" GeneratorSourceName="stp_ZZZ_riallineaDateDb" Modifier="Public" Name="stp_ZZZ_riallineaDateDb" QueryType="NoData" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetDataBy" UserSourceName="stp_ZZZ_riallineaDateDb">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
|
||||
<CommandText>dbo.stp_ZZZ_riallineaDateDb</CommandText>
|
||||
<Parameters>
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
</Parameters>
|
||||
</DbCommand>
|
||||
</SelectCommand>
|
||||
</DbSource>
|
||||
</Sources>
|
||||
</TableAdapter>
|
||||
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="v_selArticoliTableAdapter" GeneratorDataComponentClassName="v_selArticoliTableAdapter" Name="v_selArticoli" UserDataComponentName="v_selArticoliTableAdapter">
|
||||
<MainSource>
|
||||
<DbSource ConnectionRef="MoonProConnectionString (Settings)" DbObjectName="MoonPro.dbo.v_selArticoli" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="Text" ModifiedByUser="false">
|
||||
<CommandText>SELECT value, label FROM dbo.v_selArticoli</CommandText>
|
||||
<Parameters />
|
||||
</DbCommand>
|
||||
</SelectCommand>
|
||||
</DbSource>
|
||||
</MainSource>
|
||||
<Mappings>
|
||||
<Mapping SourceColumn="value" DataSetColumn="value" />
|
||||
<Mapping SourceColumn="label" DataSetColumn="label" />
|
||||
</Mappings>
|
||||
<Sources>
|
||||
<DbSource ConnectionRef="MoonProConnectionString (Settings)" DbObjectName="MoonPro.dbo.stp_ART_getDataFiltered" DbObjectType="StoredProcedure" GenerateMethods="Get" GenerateShortCommands="true" GeneratorGetMethodName="getByConditio" GetMethodModifier="Public" GetMethodName="getByConditio" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="getByConditio" UserSourceName="getByConditio">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
|
||||
<CommandText>dbo.stp_ART_getDataFiltered</CommandText>
|
||||
<Parameters>
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="nvarchar" DbType="String" Direction="Input" ParameterName="@conditio" Precision="0" ProviderType="NVarChar" Scale="0" Size="50" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
</Parameters>
|
||||
</DbCommand>
|
||||
</SelectCommand>
|
||||
</DbSource>
|
||||
</Sources>
|
||||
</TableAdapter>
|
||||
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="v_selKanbanTableAdapter" GeneratorDataComponentClassName="v_selKanbanTableAdapter" Name="v_selKanban" UserDataComponentName="v_selKanbanTableAdapter">
|
||||
<MainSource>
|
||||
<DbSource ConnectionRef="MoonProConnectionString1 (Settings)" DbObjectName="MoonPro.dbo.v_selKanban" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="Text" ModifiedByUser="false">
|
||||
<CommandText>SELECT value, label FROM dbo.v_selKanban</CommandText>
|
||||
<Parameters />
|
||||
</DbCommand>
|
||||
</SelectCommand>
|
||||
</DbSource>
|
||||
</MainSource>
|
||||
<Mappings>
|
||||
<Mapping SourceColumn="value" DataSetColumn="value" />
|
||||
<Mapping SourceColumn="label" DataSetColumn="label" />
|
||||
</Mappings>
|
||||
<Sources>
|
||||
<DbSource ConnectionRef="MoonProConnectionString1 (Settings)" DbObjectName="MoonPro.dbo.stp_KAN_getDataFiltered" DbObjectType="StoredProcedure" GenerateMethods="Get" GenerateShortCommands="true" GeneratorGetMethodName="getByConditio" GetMethodModifier="Public" GetMethodName="getByConditio" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="getByConditio" UserSourceName="getByConditio">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
|
||||
<CommandText>dbo.stp_KAN_getDataFiltered</CommandText>
|
||||
<Parameters>
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="nvarchar" DbType="String" Direction="Input" ParameterName="@conditio" Precision="0" ProviderType="NVarChar" Scale="0" Size="50" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
</Parameters>
|
||||
</DbCommand>
|
||||
</SelectCommand>
|
||||
</DbSource>
|
||||
</Sources>
|
||||
</TableAdapter>
|
||||
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="v_selOperatoriTableAdapter" GeneratorDataComponentClassName="v_selOperatoriTableAdapter" Name="v_selOperatori" UserDataComponentName="v_selOperatoriTableAdapter">
|
||||
<MainSource>
|
||||
<DbSource ConnectionRef="MoonProConnectionString (Settings)" DbObjectName="MoonPro.dbo.v_selOperatori" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="Text" ModifiedByUser="true">
|
||||
<CommandText>SELECT value, label
|
||||
FROM v_selOperatori
|
||||
ORDER BY label</CommandText>
|
||||
<Parameters />
|
||||
</DbCommand>
|
||||
</SelectCommand>
|
||||
</DbSource>
|
||||
</MainSource>
|
||||
<Mappings>
|
||||
<Mapping SourceColumn="value" DataSetColumn="value" />
|
||||
<Mapping SourceColumn="label" DataSetColumn="label" />
|
||||
</Mappings>
|
||||
<Sources />
|
||||
</TableAdapter>
|
||||
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="v_selODLTableAdapter" GeneratorDataComponentClassName="v_selODLTableAdapter" Name="v_selODL" UserDataComponentName="v_selODLTableAdapter">
|
||||
<MainSource>
|
||||
<DbSource ConnectionRef="MoonProConnectionString (Settings)" DbObjectName="MoonPro.dbo.v_selODL" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="Text" ModifiedByUser="false">
|
||||
<CommandText>SELECT value, label, conditio FROM dbo.v_selODL</CommandText>
|
||||
<Parameters />
|
||||
</DbCommand>
|
||||
</SelectCommand>
|
||||
</DbSource>
|
||||
</MainSource>
|
||||
<Mappings>
|
||||
<Mapping SourceColumn="value" DataSetColumn="value" />
|
||||
<Mapping SourceColumn="label" DataSetColumn="label" />
|
||||
<Mapping SourceColumn="conditio" DataSetColumn="conditio" />
|
||||
</Mappings>
|
||||
<Sources>
|
||||
<DbSource ConnectionRef="MoonProConnectionString (Settings)" DbObjectName="MoonPro.dbo.stp_vsODL_getUnused" DbObjectType="StoredProcedure" GenerateMethods="Get" GenerateShortCommands="true" GeneratorGetMethodName="getUnused" GetMethodModifier="Public" GetMethodName="getUnused" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="getUnused" UserSourceName="getUnused">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
|
||||
<CommandText>dbo.stp_vsODL_getUnused</CommandText>
|
||||
<Parameters>
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
</Parameters>
|
||||
</DbCommand>
|
||||
</SelectCommand>
|
||||
</DbSource>
|
||||
</Sources>
|
||||
</TableAdapter>
|
||||
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="v_selEventiBCodeTableAdapter" GeneratorDataComponentClassName="v_selEventiBCodeTableAdapter" Name="v_selEventiBCode" UserDataComponentName="v_selEventiBCodeTableAdapter">
|
||||
<MainSource>
|
||||
<DbSource ConnectionRef="MoonProConnectionString (Settings)" DbObjectName="MoonPro.dbo.v_selEventiBCode" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="Text" ModifiedByUser="true">
|
||||
<CommandText>SELECT value, label FROM dbo.v_selEventiBCode
|
||||
ORDER BY label</CommandText>
|
||||
<Parameters />
|
||||
</DbCommand>
|
||||
</SelectCommand>
|
||||
</DbSource>
|
||||
</MainSource>
|
||||
<Mappings>
|
||||
<Mapping SourceColumn="value" DataSetColumn="value" />
|
||||
<Mapping SourceColumn="label" DataSetColumn="label" />
|
||||
</Mappings>
|
||||
<Sources />
|
||||
</TableAdapter>
|
||||
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="v_selMacchineTableAdapter" GeneratorDataComponentClassName="v_selMacchineTableAdapter" Name="v_selMacchine" UserDataComponentName="v_selMacchineTableAdapter">
|
||||
<MainSource>
|
||||
<DbSource ConnectionRef="MoonProConnectionString (Settings)" DbObjectName="MoonPro.dbo.v_selMacchine" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="Text" ModifiedByUser="true">
|
||||
<CommandText>SELECT value, label
|
||||
FROM v_selMacchine
|
||||
ORDER BY label</CommandText>
|
||||
<Parameters />
|
||||
</DbCommand>
|
||||
</SelectCommand>
|
||||
</DbSource>
|
||||
</MainSource>
|
||||
<Mappings>
|
||||
<Mapping SourceColumn="value" DataSetColumn="value" />
|
||||
<Mapping SourceColumn="label" DataSetColumn="label" />
|
||||
</Mappings>
|
||||
<Sources>
|
||||
<DbSource ConnectionRef="MoonProConnectionString (Settings)" DbObjectName="MoonPro.dbo.stp_vsm_attive" DbObjectType="StoredProcedure" GenerateMethods="Get" GenerateShortCommands="true" GeneratorGetMethodName="getAttive" GetMethodModifier="Public" GetMethodName="getAttive" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="getAttive" UserSourceName="getAttive">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
|
||||
<CommandText>dbo.stp_vsm_attive</CommandText>
|
||||
<Parameters>
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
</Parameters>
|
||||
</DbCommand>
|
||||
</SelectCommand>
|
||||
</DbSource>
|
||||
</Sources>
|
||||
</TableAdapter>
|
||||
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="stp_statusCorrenteTableAdapter" GeneratorDataComponentClassName="stp_statusCorrenteTableAdapter" Name="stp_statusCorrente" UserDataComponentName="stp_statusCorrenteTableAdapter">
|
||||
<MainSource>
|
||||
<DbSource ConnectionRef="MoonProConnectionString (Settings)" DbObjectName="MoonPro.dbo.stp_statusCorrente" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
|
||||
<CommandText>dbo.stp_statusCorrente</CommandText>
|
||||
<Parameters>
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
</Parameters>
|
||||
</DbCommand>
|
||||
</SelectCommand>
|
||||
</DbSource>
|
||||
</MainSource>
|
||||
<Mappings>
|
||||
<Mapping SourceColumn="IdxMacchina" DataSetColumn="IdxMacchina" />
|
||||
<Mapping SourceColumn="CodMacchina" DataSetColumn="CodMacchina" />
|
||||
<Mapping SourceColumn="idxFamigliaIngresso" DataSetColumn="idxFamigliaIngresso" />
|
||||
<Mapping SourceColumn="Nome" DataSetColumn="Nome" />
|
||||
<Mapping SourceColumn="Descrizione" DataSetColumn="Descrizione" />
|
||||
<Mapping SourceColumn="url" DataSetColumn="url" />
|
||||
<Mapping SourceColumn="locazione" DataSetColumn="locazione" />
|
||||
<Mapping SourceColumn="DataOraServer" DataSetColumn="DataOraServer" />
|
||||
<Mapping SourceColumn="DataOraMacchina" DataSetColumn="DataOraMacchina" />
|
||||
<Mapping SourceColumn="DataOraStart" DataSetColumn="DataOraStart" />
|
||||
<Mapping SourceColumn="IPv4" DataSetColumn="IPv4" />
|
||||
<Mapping SourceColumn="lastReboot" DataSetColumn="lastReboot" />
|
||||
<Mapping SourceColumn="uptime" DataSetColumn="uptime" />
|
||||
<Mapping SourceColumn="lastEvent" DataSetColumn="lastEvent" />
|
||||
<Mapping SourceColumn="idxStato" DataSetColumn="idxStato" />
|
||||
</Mappings>
|
||||
<Sources />
|
||||
</TableAdapter>
|
||||
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="CommentiTableAdapter" GeneratorDataComponentClassName="CommentiTableAdapter" Name="Commenti" UserDataComponentName="CommentiTableAdapter">
|
||||
<MainSource>
|
||||
<DbSource ConnectionRef="MoonProConnectionString (Settings)" DbObjectName="Donati_MoonPro.dbo.stp_Comm_getLastByMacchina" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
|
||||
<CommandText>dbo.stp_Comm_getLastByMacchina</CommandText>
|
||||
<Parameters>
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="nvarchar" DbType="String" Direction="Input" ParameterName="@IdxMacchina" Precision="0" ProviderType="NVarChar" Scale="0" Size="50" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@showMax" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
</Parameters>
|
||||
</DbCommand>
|
||||
</SelectCommand>
|
||||
</DbSource>
|
||||
</MainSource>
|
||||
<Mappings>
|
||||
<Mapping SourceColumn="ODL" DataSetColumn="idxODL" />
|
||||
<Mapping SourceColumn="CodArticolo" DataSetColumn="CodArticolo" />
|
||||
<Mapping SourceColumn="IdxMacchina" DataSetColumn="IdxMacchina" />
|
||||
<Mapping SourceColumn="InizioStato" DataSetColumn="InizioStato" />
|
||||
<Mapping SourceColumn="Value" DataSetColumn="Value" />
|
||||
<Mapping SourceColumn="idxODL" DataSetColumn="idxODL" />
|
||||
<Mapping SourceColumn="Operatore" DataSetColumn="Operatore" />
|
||||
</Mappings>
|
||||
<Sources>
|
||||
<DbSource ConnectionRef="MoonProConnectionString (Settings)" DbObjectName="Donati_MoonPro.man.stp_riallineaDateDb" DbObjectType="StoredProcedure" GenerateShortCommands="true" GeneratorSourceName="stp_riallineaDateDb" Modifier="Public" Name="stp_riallineaDateDb" QueryType="NoData" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetDataBy" UserSourceName="stp_riallineaDateDb">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
|
||||
<CommandText>man.stp_riallineaDateDb</CommandText>
|
||||
<Parameters>
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
</Parameters>
|
||||
</DbCommand>
|
||||
</SelectCommand>
|
||||
</DbSource>
|
||||
<DbSource ConnectionRef="MoonProConnectionString (Settings)" DbObjectName="Donati_MoonPro.man.stp_ricalcolaDatiMacchinaFromDate" DbObjectType="StoredProcedure" GenerateShortCommands="true" GeneratorSourceName="stp_ricalcolaDatiMacchinaFromDate" Modifier="Public" Name="stp_ricalcolaDatiMacchinaFromDate" QueryType="NoData" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetDataBy1" UserSourceName="stp_ricalcolaDatiMacchinaFromDate">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
|
||||
<CommandText>man.stp_ricalcolaDatiMacchinaFromDate</CommandText>
|
||||
<Parameters>
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="nvarchar" DbType="String" Direction="Input" ParameterName="@idxMacchina" Precision="0" ProviderType="NVarChar" Scale="0" Size="50" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@inizio" Precision="23" ProviderType="DateTime" Scale="3" Size="8" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@idxStatoStart" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
</Parameters>
|
||||
</DbCommand>
|
||||
</SelectCommand>
|
||||
</DbSource>
|
||||
</Sources>
|
||||
</TableAdapter>
|
||||
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="FermiNonQualTableAdapter" GeneratorDataComponentClassName="FermiNonQualTableAdapter" Name="FermiNonQual" UserDataComponentName="FermiNonQualTableAdapter">
|
||||
<MainSource>
|
||||
<DbSource ConnectionRef="MoonProConnectionString (Settings)" DbObjectName="Donati_MoonPro.dbo.stp_FNQ_getFilt" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
|
||||
<CommandText>dbo.stp_FNQ_getFilt</CommandText>
|
||||
<Parameters>
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="nvarchar" DbType="String" Direction="Input" ParameterName="@IdxMacchina" Precision="0" ProviderType="NVarChar" Scale="0" Size="50" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@gg" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="float" DbType="Double" Direction="Input" ParameterName="@durataMin" Precision="53" ProviderType="Float" Scale="0" Size="8" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
</Parameters>
|
||||
</DbCommand>
|
||||
</SelectCommand>
|
||||
</DbSource>
|
||||
</MainSource>
|
||||
<Mappings>
|
||||
<Mapping SourceColumn="IdxMacchina" DataSetColumn="IdxMacchina" />
|
||||
<Mapping SourceColumn="InizioStato" DataSetColumn="InizioStato" />
|
||||
<Mapping SourceColumn="Macchina" DataSetColumn="Macchina" />
|
||||
<Mapping SourceColumn="IdxStato" DataSetColumn="IdxStato" />
|
||||
<Mapping SourceColumn="Stato" DataSetColumn="Stato" />
|
||||
<Mapping SourceColumn="Semaforo" DataSetColumn="Semaforo" />
|
||||
<Mapping SourceColumn="DurataMinuti" DataSetColumn="DurataMinuti" />
|
||||
<Mapping SourceColumn="Value" DataSetColumn="Value" />
|
||||
<Mapping SourceColumn="CodArticolo" DataSetColumn="CodArticolo" />
|
||||
</Mappings>
|
||||
<Sources />
|
||||
</TableAdapter>
|
||||
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="v_selTallyTableAdapter" GeneratorDataComponentClassName="v_selTallyTableAdapter" Name="v_selTally" UserDataComponentName="v_selTallyTableAdapter">
|
||||
<MainSource>
|
||||
<DbSource ConnectionRef="MoonProConnectionString (Settings)" DbObjectName="MoonPro.dbo.v_selTally" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="Text" ModifiedByUser="false">
|
||||
<CommandText>SELECT label, value FROM dbo.v_selTally</CommandText>
|
||||
<Parameters />
|
||||
</DbCommand>
|
||||
</SelectCommand>
|
||||
</DbSource>
|
||||
</MainSource>
|
||||
<Mappings>
|
||||
<Mapping SourceColumn="label" DataSetColumn="label" />
|
||||
<Mapping SourceColumn="value" DataSetColumn="value" />
|
||||
</Mappings>
|
||||
<Sources>
|
||||
<DbSource ConnectionRef="MoonProConnectionString (Settings)" DbObjectName="MoonPro.dbo.stp_selTallyLimit" DbObjectType="StoredProcedure" GenerateMethods="Get" GenerateShortCommands="true" GeneratorGetMethodName="getSubset" GetMethodModifier="Public" GetMethodName="getSubset" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="getSubset" UserSourceName="getSubset">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
|
||||
<CommandText>dbo.stp_selTallyLimit</CommandText>
|
||||
<Parameters>
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@minVal" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@maxVal" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
|
||||
</Parameters>
|
||||
</DbCommand>
|
||||
</SelectCommand>
|
||||
</DbSource>
|
||||
</Sources>
|
||||
</TableAdapter>
|
||||
</Tables>
|
||||
<Sources />
|
||||
</DataSource>
|
||||
</xs:appinfo>
|
||||
</xs:annotation>
|
||||
<xs:element name="DS_Utility" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:EnableTableAdapterManager="true" msprop:Generator_DataSetName="DS_Utility" msprop:Generator_UserDSName="DS_Utility">
|
||||
<xs:complexType>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="StatoMacchine" msprop:Generator_UserTableName="StatoMacchine" msprop:Generator_RowEvArgName="StatoMacchineRowChangeEvent" msprop:Generator_TableVarName="tableStatoMacchine" msprop:Generator_TablePropName="StatoMacchine" msprop:Generator_RowDeletingName="StatoMacchineRowDeleting" msprop:Generator_RowChangingName="StatoMacchineRowChanging" msprop:Generator_RowDeletedName="StatoMacchineRowDeleted" msprop:Generator_RowEvHandlerName="StatoMacchineRowChangeEventHandler" msprop:Generator_TableClassName="StatoMacchineDataTable" msprop:Generator_RowChangedName="StatoMacchineRowChanged" msprop:Generator_RowClassName="StatoMacchineRow">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="IdxMacchina" msprop:Generator_ColumnVarNameInTable="columnIdxMacchina" msprop:Generator_ColumnPropNameInRow="IdxMacchina" msprop:Generator_ColumnPropNameInTable="IdxMacchinaColumn" msprop:Generator_UserColumnName="IdxMacchina">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="IdxStato" msprop:Generator_ColumnVarNameInTable="columnIdxStato" msprop:Generator_ColumnPropNameInRow="IdxStato" msprop:Generator_ColumnPropNameInTable="IdxStatoColumn" msprop:Generator_UserColumnName="IdxStato" type="xs:int" />
|
||||
<xs:element name="InizioStato" msprop:Generator_ColumnVarNameInTable="columnInizioStato" msprop:Generator_ColumnPropNameInRow="InizioStato" msprop:Generator_ColumnPropNameInTable="InizioStatoColumn" msprop:Generator_UserColumnName="InizioStato" type="xs:dateTime" minOccurs="0" />
|
||||
<xs:element name="Value" msprop:Generator_ColumnVarNameInTable="columnValue" msprop:Generator_ColumnPropNameInRow="Value" msprop:Generator_ColumnPropNameInTable="ValueColumn" msprop:Generator_UserColumnName="Value" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="MatricolaKanban" msprop:Generator_ColumnVarNameInTable="columnMatricolaKanban" msprop:Generator_ColumnPropNameInRow="MatricolaKanban" msprop:Generator_ColumnPropNameInTable="MatricolaKanbanColumn" msprop:Generator_UserColumnName="MatricolaKanban" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="KanbanCode" msprop:Generator_ColumnVarNameInTable="columnKanbanCode" msprop:Generator_ColumnPropNameInRow="KanbanCode" msprop:Generator_ColumnPropNameInTable="KanbanCodeColumn" msprop:Generator_UserColumnName="KanbanCode" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="TempoCicloBase" msprop:Generator_ColumnVarNameInTable="columnTempoCicloBase" msprop:Generator_ColumnPropNameInRow="TempoCicloBase" msprop:Generator_ColumnPropNameInTable="TempoCicloBaseColumn" msprop:Generator_UserColumnName="TempoCicloBase" type="xs:double" minOccurs="0" />
|
||||
<xs:element name="PzPalletProd" msprop:Generator_ColumnVarNameInTable="columnPzPalletProd" msprop:Generator_ColumnPropNameInRow="PzPalletProd" msprop:Generator_ColumnPropNameInTable="PzPalletProdColumn" msprop:Generator_UserColumnName="PzPalletProd" type="xs:int" minOccurs="0" />
|
||||
<xs:element name="MatrOpr" msprop:Generator_ColumnVarNameInTable="columnMatrOpr" msprop:Generator_ColumnPropNameInRow="MatrOpr" msprop:Generator_ColumnPropNameInTable="MatrOprColumn" msprop:Generator_UserColumnName="MatrOpr" type="xs:int" minOccurs="0" />
|
||||
<xs:element name="pallet" msprop:Generator_ColumnVarNameInTable="columnpallet" msprop:Generator_ColumnPropNameInRow="pallet" msprop:Generator_ColumnPropNameInTable="palletColumn" msprop:Generator_UserColumnName="pallet" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="20" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="v_selArticoli" msprop:Generator_UserTableName="v_selArticoli" msprop:Generator_RowEvArgName="v_selArticoliRowChangeEvent" msprop:Generator_TableVarName="tablev_selArticoli" msprop:Generator_TablePropName="v_selArticoli" msprop:Generator_RowDeletingName="v_selArticoliRowDeleting" msprop:Generator_RowChangingName="v_selArticoliRowChanging" msprop:Generator_RowDeletedName="v_selArticoliRowDeleted" msprop:Generator_RowEvHandlerName="v_selArticoliRowChangeEventHandler" msprop:Generator_TableClassName="v_selArticoliDataTable" msprop:Generator_RowChangedName="v_selArticoliRowChanged" msprop:Generator_RowClassName="v_selArticoliRow">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="value" msprop:Generator_ColumnVarNameInTable="columnvalue" msprop:Generator_ColumnPropNameInRow="value" msprop:Generator_ColumnPropNameInTable="valueColumn" msprop:Generator_UserColumnName="value">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="label" msprop:Generator_ColumnVarNameInTable="columnlabel" msprop:Generator_ColumnPropNameInRow="label" msprop:Generator_ColumnPropNameInTable="labelColumn" msprop:Generator_UserColumnName="label" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="250" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="v_selKanban" msprop:Generator_TableClassName="v_selKanbanDataTable" msprop:Generator_RowEvArgName="v_selKanbanRowChangeEvent" msprop:Generator_TableVarName="tablev_selKanban" msprop:Generator_TablePropName="v_selKanban" msprop:Generator_RowDeletingName="v_selKanbanRowDeleting" msprop:Generator_RowChangingName="v_selKanbanRowChanging" msprop:Generator_RowEvHandlerName="v_selKanbanRowChangeEventHandler" msprop:Generator_RowDeletedName="v_selKanbanRowDeleted" msprop:Generator_UserTableName="v_selKanban" msprop:Generator_RowChangedName="v_selKanbanRowChanged" msprop:Generator_RowClassName="v_selKanbanRow">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="value" msprop:Generator_ColumnVarNameInTable="columnvalue" msprop:Generator_ColumnPropNameInRow="value" msprop:Generator_ColumnPropNameInTable="valueColumn" msprop:Generator_UserColumnName="value">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="label" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnlabel" msprop:Generator_ColumnPropNameInRow="label" msprop:Generator_ColumnPropNameInTable="labelColumn" msprop:Generator_UserColumnName="label" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="52" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="v_selOperatori" msprop:Generator_TableClassName="v_selOperatoriDataTable" msprop:Generator_TableVarName="tablev_selOperatori" msprop:Generator_TablePropName="v_selOperatori" msprop:Generator_RowDeletingName="v_selOperatoriRowDeleting" msprop:Generator_RowChangingName="v_selOperatoriRowChanging" msprop:Generator_RowEvHandlerName="v_selOperatoriRowChangeEventHandler" msprop:Generator_RowDeletedName="v_selOperatoriRowDeleted" msprop:Generator_UserTableName="v_selOperatori" msprop:Generator_RowChangedName="v_selOperatoriRowChanged" msprop:Generator_RowEvArgName="v_selOperatoriRowChangeEvent" msprop:Generator_RowClassName="v_selOperatoriRow">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="value" msprop:Generator_ColumnVarNameInTable="columnvalue" msprop:Generator_ColumnPropNameInRow="value" msprop:Generator_ColumnPropNameInTable="valueColumn" msprop:Generator_UserColumnName="value" type="xs:int" />
|
||||
<xs:element name="label" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnlabel" msprop:Generator_ColumnPropNameInRow="label" msprop:Generator_ColumnPropNameInTable="labelColumn" msprop:Generator_UserColumnName="label" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="101" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="v_selODL" msprop:Generator_TableClassName="v_selODLDataTable" msprop:Generator_TableVarName="tablev_selODL" msprop:Generator_RowChangedName="v_selODLRowChanged" msprop:Generator_TablePropName="v_selODL" msprop:Generator_RowDeletingName="v_selODLRowDeleting" msprop:Generator_RowChangingName="v_selODLRowChanging" msprop:Generator_RowEvHandlerName="v_selODLRowChangeEventHandler" msprop:Generator_RowDeletedName="v_selODLRowDeleted" msprop:Generator_RowClassName="v_selODLRow" msprop:Generator_UserTableName="v_selODL" msprop:Generator_RowEvArgName="v_selODLRowChangeEvent">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="value" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnVarNameInTable="columnvalue" msprop:Generator_ColumnPropNameInRow="value" msprop:Generator_ColumnPropNameInTable="valueColumn" msprop:Generator_UserColumnName="value" type="xs:int" />
|
||||
<xs:element name="label" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnlabel" msprop:Generator_ColumnPropNameInRow="label" msprop:Generator_ColumnPropNameInTable="labelColumn" msprop:Generator_UserColumnName="label" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="250" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="conditio" msprop:Generator_ColumnVarNameInTable="columnconditio" msprop:Generator_ColumnPropNameInRow="conditio" msprop:Generator_ColumnPropNameInTable="conditioColumn" msprop:Generator_UserColumnName="conditio" type="xs:dateTime" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="v_selEventiBCode" msprop:Generator_TableClassName="v_selEventiBCodeDataTable" msprop:Generator_TableVarName="tablev_selEventiBCode" msprop:Generator_TablePropName="v_selEventiBCode" msprop:Generator_RowDeletingName="v_selEventiBCodeRowDeleting" msprop:Generator_RowChangingName="v_selEventiBCodeRowChanging" msprop:Generator_RowEvHandlerName="v_selEventiBCodeRowChangeEventHandler" msprop:Generator_RowDeletedName="v_selEventiBCodeRowDeleted" msprop:Generator_UserTableName="v_selEventiBCode" msprop:Generator_RowChangedName="v_selEventiBCodeRowChanged" msprop:Generator_RowEvArgName="v_selEventiBCodeRowChangeEvent" msprop:Generator_RowClassName="v_selEventiBCodeRow">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="value" msprop:Generator_ColumnVarNameInTable="columnvalue" msprop:Generator_ColumnPropNameInRow="value" msprop:Generator_ColumnPropNameInTable="valueColumn" msprop:Generator_UserColumnName="value" type="xs:int" />
|
||||
<xs:element name="label" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnlabel" msprop:Generator_ColumnPropNameInRow="label" msprop:Generator_ColumnPropNameInTable="labelColumn" msprop:Generator_UserColumnName="label" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="4000" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="v_selMacchine" msprop:Generator_TableClassName="v_selMacchineDataTable" msprop:Generator_TableVarName="tablev_selMacchine" msprop:Generator_TablePropName="v_selMacchine" msprop:Generator_RowDeletingName="v_selMacchineRowDeleting" msprop:Generator_RowChangingName="v_selMacchineRowChanging" msprop:Generator_RowEvHandlerName="v_selMacchineRowChangeEventHandler" msprop:Generator_RowDeletedName="v_selMacchineRowDeleted" msprop:Generator_UserTableName="v_selMacchine" msprop:Generator_RowChangedName="v_selMacchineRowChanged" msprop:Generator_RowEvArgName="v_selMacchineRowChangeEvent" msprop:Generator_RowClassName="v_selMacchineRow">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="value" msprop:Generator_ColumnVarNameInTable="columnvalue" msprop:Generator_ColumnPropNameInRow="value" msprop:Generator_ColumnPropNameInTable="valueColumn" msprop:Generator_UserColumnName="value">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="label" msprop:Generator_ColumnVarNameInTable="columnlabel" msprop:Generator_ColumnPropNameInRow="label" msprop:Generator_ColumnPropNameInTable="labelColumn" msprop:Generator_UserColumnName="label" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="stp_statusCorrente" msprop:Generator_TableClassName="stp_statusCorrenteDataTable" msprop:Generator_TableVarName="tablestp_statusCorrente" msprop:Generator_TablePropName="stp_statusCorrente" msprop:Generator_RowDeletingName="stp_statusCorrenteRowDeleting" msprop:Generator_RowChangingName="stp_statusCorrenteRowChanging" msprop:Generator_RowEvHandlerName="stp_statusCorrenteRowChangeEventHandler" msprop:Generator_RowDeletedName="stp_statusCorrenteRowDeleted" msprop:Generator_UserTableName="stp_statusCorrente" msprop:Generator_RowChangedName="stp_statusCorrenteRowChanged" msprop:Generator_RowEvArgName="stp_statusCorrenteRowChangeEvent" msprop:Generator_RowClassName="stp_statusCorrenteRow">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="IdxMacchina" msprop:Generator_ColumnVarNameInTable="columnIdxMacchina" msprop:Generator_ColumnPropNameInRow="IdxMacchina" msprop:Generator_ColumnPropNameInTable="IdxMacchinaColumn" msprop:Generator_UserColumnName="IdxMacchina">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="CodMacchina" msprop:Generator_ColumnVarNameInTable="columnCodMacchina" msprop:Generator_ColumnPropNameInRow="CodMacchina" msprop:Generator_ColumnPropNameInTable="CodMacchinaColumn" msprop:Generator_UserColumnName="CodMacchina" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="idxFamigliaIngresso" msprop:Generator_ColumnVarNameInTable="columnidxFamigliaIngresso" msprop:Generator_ColumnPropNameInRow="idxFamigliaIngresso" msprop:Generator_ColumnPropNameInTable="idxFamigliaIngressoColumn" msprop:Generator_UserColumnName="idxFamigliaIngresso" type="xs:int" />
|
||||
<xs:element name="Nome" msprop:Generator_ColumnVarNameInTable="columnNome" msprop:Generator_ColumnPropNameInRow="Nome" msprop:Generator_ColumnPropNameInTable="NomeColumn" msprop:Generator_UserColumnName="Nome" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="Descrizione" msprop:Generator_ColumnVarNameInTable="columnDescrizione" msprop:Generator_ColumnPropNameInRow="Descrizione" msprop:Generator_ColumnPropNameInTable="DescrizioneColumn" msprop:Generator_UserColumnName="Descrizione" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="url" msprop:Generator_ColumnVarNameInTable="columnurl" msprop:Generator_ColumnPropNameInRow="url" msprop:Generator_ColumnPropNameInTable="urlColumn" msprop:Generator_UserColumnName="url" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="250" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="locazione" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnlocazione" msprop:Generator_ColumnPropNameInRow="locazione" msprop:Generator_ColumnPropNameInTable="locazioneColumn" msprop:Generator_UserColumnName="locazione" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="2" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="DataOraServer" msprop:Generator_ColumnVarNameInTable="columnDataOraServer" msprop:Generator_ColumnPropNameInRow="DataOraServer" msprop:Generator_ColumnPropNameInTable="DataOraServerColumn" msprop:Generator_UserColumnName="DataOraServer" type="xs:dateTime" minOccurs="0" />
|
||||
<xs:element name="DataOraMacchina" msprop:Generator_ColumnVarNameInTable="columnDataOraMacchina" msprop:Generator_ColumnPropNameInRow="DataOraMacchina" msprop:Generator_ColumnPropNameInTable="DataOraMacchinaColumn" msprop:Generator_UserColumnName="DataOraMacchina" type="xs:dateTime" minOccurs="0" />
|
||||
<xs:element name="DataOraStart" msprop:Generator_ColumnVarNameInTable="columnDataOraStart" msprop:Generator_ColumnPropNameInRow="DataOraStart" msprop:Generator_ColumnPropNameInTable="DataOraStartColumn" msprop:Generator_UserColumnName="DataOraStart" type="xs:dateTime" minOccurs="0" />
|
||||
<xs:element name="IPv4" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnIPv4" msprop:Generator_ColumnPropNameInRow="IPv4" msprop:Generator_ColumnPropNameInTable="IPv4Column" msprop:Generator_UserColumnName="IPv4" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="lastReboot" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnlastReboot" msprop:Generator_ColumnPropNameInRow="lastReboot" msprop:Generator_ColumnPropNameInTable="lastRebootColumn" msprop:Generator_UserColumnName="lastReboot" type="xs:dateTime" minOccurs="0" />
|
||||
<xs:element name="uptime" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnuptime" msprop:Generator_ColumnPropNameInRow="uptime" msprop:Generator_ColumnPropNameInTable="uptimeColumn" msprop:Generator_UserColumnName="uptime" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="15" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="lastEvent" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnlastEvent" msprop:Generator_ColumnPropNameInRow="lastEvent" msprop:Generator_ColumnPropNameInTable="lastEventColumn" msprop:Generator_UserColumnName="lastEvent" type="xs:dateTime" minOccurs="0" />
|
||||
<xs:element name="idxStato" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnidxStato" msprop:Generator_ColumnPropNameInRow="idxStato" msprop:Generator_ColumnPropNameInTable="idxStatoColumn" msprop:Generator_UserColumnName="idxStato" type="xs:int" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="Commenti" msprop:Generator_TableClassName="CommentiDataTable" msprop:Generator_TableVarName="tableCommenti" msprop:Generator_RowChangedName="CommentiRowChanged" msprop:Generator_TablePropName="Commenti" msprop:Generator_RowDeletingName="CommentiRowDeleting" msprop:Generator_RowChangingName="CommentiRowChanging" msprop:Generator_RowEvHandlerName="CommentiRowChangeEventHandler" msprop:Generator_RowDeletedName="CommentiRowDeleted" msprop:Generator_RowClassName="CommentiRow" msprop:Generator_UserTableName="Commenti" msprop:Generator_RowEvArgName="CommentiRowChangeEvent">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="idxODL" msdata:ReadOnly="true" msdata:AutoIncrement="true" msprop:Generator_ColumnVarNameInTable="columnidxODL" msprop:Generator_ColumnPropNameInRow="idxODL" msprop:Generator_ColumnPropNameInTable="idxODLColumn" msprop:Generator_UserColumnName="idxODL" type="xs:int" />
|
||||
<xs:element name="CodArticolo" msprop:Generator_ColumnVarNameInTable="columnCodArticolo" msprop:Generator_ColumnPropNameInRow="CodArticolo" msprop:Generator_ColumnPropNameInTable="CodArticoloColumn" msprop:Generator_UserColumnName="CodArticolo">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="IdxMacchina" msprop:Generator_ColumnVarNameInTable="columnIdxMacchina" msprop:Generator_ColumnPropNameInRow="IdxMacchina" msprop:Generator_ColumnPropNameInTable="IdxMacchinaColumn" msprop:Generator_UserColumnName="IdxMacchina">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="InizioStato" msprop:Generator_ColumnVarNameInTable="columnInizioStato" msprop:Generator_ColumnPropNameInRow="InizioStato" msprop:Generator_ColumnPropNameInTable="InizioStatoColumn" msprop:Generator_UserColumnName="InizioStato" type="xs:dateTime" />
|
||||
<xs:element name="Value" msprop:Generator_ColumnVarNameInTable="columnValue" msprop:Generator_ColumnPropNameInRow="Value" msprop:Generator_ColumnPropNameInTable="ValueColumn" msprop:Generator_UserColumnName="Value" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="250" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="Operatore" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnOperatore" msprop:Generator_ColumnPropNameInRow="Operatore" msprop:Generator_ColumnPropNameInTable="OperatoreColumn" msprop:Generator_UserColumnName="Operatore" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="124" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="FermiNonQual" msprop:Generator_TableClassName="FermiNonQualDataTable" msprop:Generator_TableVarName="tableFermiNonQual" msprop:Generator_RowChangedName="FermiNonQualRowChanged" msprop:Generator_TablePropName="FermiNonQual" msprop:Generator_RowDeletingName="FermiNonQualRowDeleting" msprop:Generator_RowChangingName="FermiNonQualRowChanging" msprop:Generator_RowEvHandlerName="FermiNonQualRowChangeEventHandler" msprop:Generator_RowDeletedName="FermiNonQualRowDeleted" msprop:Generator_RowClassName="FermiNonQualRow" msprop:Generator_UserTableName="FermiNonQual" msprop:Generator_RowEvArgName="FermiNonQualRowChangeEvent">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="IdxMacchina" msprop:Generator_ColumnVarNameInTable="columnIdxMacchina" msprop:Generator_ColumnPropNameInRow="IdxMacchina" msprop:Generator_ColumnPropNameInTable="IdxMacchinaColumn" msprop:Generator_UserColumnName="IdxMacchina">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="InizioStato" msprop:Generator_ColumnVarNameInTable="columnInizioStato" msprop:Generator_ColumnPropNameInRow="InizioStato" msprop:Generator_ColumnPropNameInTable="InizioStatoColumn" msprop:Generator_UserColumnName="InizioStato" type="xs:dateTime" />
|
||||
<xs:element name="Macchina" msprop:Generator_ColumnVarNameInTable="columnMacchina" msprop:Generator_ColumnPropNameInRow="Macchina" msprop:Generator_ColumnPropNameInTable="MacchinaColumn" msprop:Generator_UserColumnName="Macchina" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="IdxStato" msprop:Generator_ColumnVarNameInTable="columnIdxStato" msprop:Generator_ColumnPropNameInRow="IdxStato" msprop:Generator_ColumnPropNameInTable="IdxStatoColumn" msprop:Generator_UserColumnName="IdxStato" type="xs:int" />
|
||||
<xs:element name="Stato" msprop:Generator_ColumnVarNameInTable="columnStato" msprop:Generator_ColumnPropNameInRow="Stato" msprop:Generator_ColumnPropNameInTable="StatoColumn" msprop:Generator_UserColumnName="Stato" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="Semaforo" msprop:Generator_ColumnVarNameInTable="columnSemaforo" msprop:Generator_ColumnPropNameInRow="Semaforo" msprop:Generator_ColumnPropNameInTable="SemaforoColumn" msprop:Generator_UserColumnName="Semaforo" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="DurataMinuti" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnDurataMinuti" msprop:Generator_ColumnPropNameInRow="DurataMinuti" msprop:Generator_ColumnPropNameInTable="DurataMinutiColumn" msprop:Generator_UserColumnName="DurataMinuti" type="xs:double" minOccurs="0" />
|
||||
<xs:element name="Value" msprop:Generator_ColumnVarNameInTable="columnValue" msprop:Generator_ColumnPropNameInRow="Value" msprop:Generator_ColumnPropNameInTable="ValueColumn" msprop:Generator_UserColumnName="Value" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="CodArticolo" msprop:Generator_ColumnVarNameInTable="columnCodArticolo" msprop:Generator_ColumnPropNameInRow="CodArticolo" msprop:Generator_ColumnPropNameInTable="CodArticoloColumn" msprop:Generator_UserColumnName="CodArticolo" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="v_selTally" msprop:Generator_TableClassName="v_selTallyDataTable" msprop:Generator_TableVarName="tablev_selTally" msprop:Generator_TablePropName="v_selTally" msprop:Generator_RowDeletingName="v_selTallyRowDeleting" msprop:Generator_RowChangingName="v_selTallyRowChanging" msprop:Generator_RowEvHandlerName="v_selTallyRowChangeEventHandler" msprop:Generator_RowDeletedName="v_selTallyRowDeleted" msprop:Generator_UserTableName="v_selTally" msprop:Generator_RowChangedName="v_selTallyRowChanged" msprop:Generator_RowEvArgName="v_selTallyRowChangeEvent" msprop:Generator_RowClassName="v_selTallyRow">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="label" msprop:Generator_ColumnVarNameInTable="columnlabel" msprop:Generator_ColumnPropNameInRow="label" msprop:Generator_ColumnPropNameInTable="labelColumn" msprop:Generator_UserColumnName="label" type="xs:long" minOccurs="0" />
|
||||
<xs:element name="value" msprop:Generator_ColumnVarNameInTable="columnvalue" msprop:Generator_ColumnPropNameInRow="value" msprop:Generator_ColumnPropNameInTable="valueColumn" msprop:Generator_UserColumnName="value" type="xs:long" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:choice>
|
||||
</xs:complexType>
|
||||
<xs:unique name="Constraint1" msdata:PrimaryKey="true">
|
||||
<xs:selector xpath=".//mstns:StatoMacchine" />
|
||||
<xs:field xpath="mstns:IdxMacchina" />
|
||||
</xs:unique>
|
||||
<xs:unique name="v_selArticoli_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
|
||||
<xs:selector xpath=".//mstns:v_selArticoli" />
|
||||
<xs:field xpath="mstns:value" />
|
||||
</xs:unique>
|
||||
<xs:unique name="v_selKanban_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
|
||||
<xs:selector xpath=".//mstns:v_selKanban" />
|
||||
<xs:field xpath="mstns:value" />
|
||||
</xs:unique>
|
||||
<xs:unique name="v_selOperatori_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
|
||||
<xs:selector xpath=".//mstns:v_selOperatori" />
|
||||
<xs:field xpath="mstns:value" />
|
||||
</xs:unique>
|
||||
<xs:unique name="v_selODL_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
|
||||
<xs:selector xpath=".//mstns:v_selODL" />
|
||||
<xs:field xpath="mstns:value" />
|
||||
</xs:unique>
|
||||
<xs:unique name="v_selEventiBCode_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
|
||||
<xs:selector xpath=".//mstns:v_selEventiBCode" />
|
||||
<xs:field xpath="mstns:value" />
|
||||
</xs:unique>
|
||||
<xs:unique name="v_selMacchine_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
|
||||
<xs:selector xpath=".//mstns:v_selMacchine" />
|
||||
<xs:field xpath="mstns:value" />
|
||||
</xs:unique>
|
||||
<xs:unique name="CommentiPK">
|
||||
<xs:selector xpath=".//mstns:Commenti" />
|
||||
<xs:field xpath="mstns:IdxMacchina" />
|
||||
<xs:field xpath="mstns:InizioStato" />
|
||||
</xs:unique>
|
||||
<xs:unique name="stp_FNQ_getFiltKey1">
|
||||
<xs:selector xpath=".//mstns:FermiNonQual" />
|
||||
<xs:field xpath="mstns:IdxMacchina" />
|
||||
<xs:field xpath="mstns:InizioStato" />
|
||||
</xs:unique>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--<autogenerated>
|
||||
This code was generated by a tool to store the dataset designer's layout information.
|
||||
Changes to this file may cause incorrect behavior and will be lost if
|
||||
the code is regenerated.
|
||||
</autogenerated>-->
|
||||
<DiagramLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ex:showrelationlabel="False" ViewPortX="12" ViewPortY="224" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
|
||||
<Shapes>
|
||||
<Shape ID="DesignTable:StatoMacchine" ZOrder="11" X="472" Y="274" Height="286" Width="231" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="216" />
|
||||
<Shape ID="DesignTable:v_selArticoli" ZOrder="10" X="941" Y="372" Height="134" Width="214" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
|
||||
<Shape ID="DesignTable:v_selKanban" ZOrder="9" X="198" Y="270" Height="134" Width="216" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
|
||||
<Shape ID="DesignTable:v_selOperatori" ZOrder="8" X="443" Y="654" Height="115" Width="228" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
|
||||
<Shape ID="DesignTable:v_selODL" ZOrder="7" X="812" Y="635" Height="134" Width="197" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="83" />
|
||||
<Shape ID="DesignTable:v_selEventiBCode" ZOrder="6" X="181" Y="554" Height="115" Width="245" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
|
||||
<Shape ID="DesignTable:v_selMacchine" ZOrder="2" X="637" Y="809" Height="134" Width="227" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
|
||||
<Shape ID="DesignTable:stp_statusCorrente" ZOrder="5" X="265" Y="848" Height="305" Width="253" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:Commenti" ZOrder="3" X="591" Y="984" Height="229" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="140" />
|
||||
<Shape ID="DesignTable:FermiNonQual" ZOrder="4" X="978" Y="925" Height="248" Width="280" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="197" />
|
||||
<Shape ID="DesignTable:v_selTally" ZOrder="1" X="751" Y="263" Height="153" Width="158" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
|
||||
</Shapes>
|
||||
<Connectors />
|
||||
</DiagramLayout>
|
||||
Generated
+23810
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
namespace MapoDb
|
||||
{
|
||||
|
||||
|
||||
partial class DS_applicazione
|
||||
{
|
||||
partial class MacchineDataTable
|
||||
{
|
||||
}
|
||||
|
||||
partial class StatoMacchineDataTable
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--<autogenerated>
|
||||
This code was generated by a tool.
|
||||
Changes to this file may cause incorrect behavior and will be lost if
|
||||
the code is regenerated.
|
||||
</autogenerated>-->
|
||||
<DataSetUISetting Version="1.00" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TableUISettings />
|
||||
</DataSetUISetting>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,339 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--<autogenerated>
|
||||
This code was generated by a tool to store the dataset designer's layout information.
|
||||
Changes to this file may cause incorrect behavior and will be lost if
|
||||
the code is regenerated.
|
||||
</autogenerated>-->
|
||||
<DiagramLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ex:showrelationlabel="False" ViewPortX="-10" ViewPortY="571" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
|
||||
<Shapes>
|
||||
<Shape ID="DesignTable:Macchine2FamiglieMacchine" ZOrder="9" X="553" Y="715" Height="115" Width="226" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
|
||||
<Shape ID="DesignTable:FamiglieMacchine" ZOrder="12" X="519" Y="1007" Height="115" Width="235" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
|
||||
<Shape ID="DesignTable:Macchine" ZOrder="8" X="619" Y="324" Height="234" Width="195" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="159" />
|
||||
<Shape ID="DesignTable:TransizioneStati" ZOrder="3" X="870" Y="916" Height="219" Width="262" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="113" />
|
||||
<Shape ID="DesignTable:StatoMacchine" ZOrder="35" X="223" Y="665" Height="324" Width="240" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="216" />
|
||||
<Shape ID="DesignTable:AnagraficaStati" ZOrder="20" X="245" Y="455" Height="164" Width="229" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="83" />
|
||||
<Shape ID="DesignTable:Kanban" ZOrder="15" X="610" Y="20" Height="229" Width="262" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="121" />
|
||||
<Shape ID="DesignTable:EventList" ZOrder="4" X="920" Y="145" Height="402" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="159" />
|
||||
<Shape ID="DesignTable:AnagraficaEventi" ZOrder="26" X="1285" Y="228" Height="134" Width="238" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
|
||||
<Shape ID="DesignTable:DiarioDiBordo" ZOrder="2" X="230" Y="-18" Height="438" Width="293" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:TransizioneEventi" ZOrder="17" X="1279" Y="409" Height="210" Width="242" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="121" />
|
||||
<Shape ID="DesignTable:KeepAlive" ZOrder="7" X="1254" Y="899" Height="221" Width="224" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="113" />
|
||||
<Shape ID="DesignTable:Macchine2FamigliaIngressi" ZOrder="22" X="596" Y="1155" Height="130" Width="236" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="83" />
|
||||
<Shape ID="DesignTable:FamigliaTipoIngressi" ZOrder="33" X="943" Y="1212" Height="130" Width="261" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="79" />
|
||||
<Shape ID="DesignTable:TransizioneIngressi" ZOrder="13" X="238" Y="1197" Height="229" Width="266" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="121" />
|
||||
<Shape ID="DesignTable:AnagraficaOperatori" ZOrder="16" X="965" Y="641" Height="210" Width="263" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="121" />
|
||||
<Shape ID="DesignTable:Kanban2ins" ZOrder="27" X="1273" Y="2" Height="191" Width="212" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="102" />
|
||||
<Shape ID="DesignTable:AnagraficaOperatori2ins" ZOrder="23" X="1250" Y="1161" Height="172" Width="287" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="83" />
|
||||
<Shape ID="DesignTable:DatiMacchine" ZOrder="5" X="1299" Y="634" Height="267" Width="224" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="197" />
|
||||
<Shape ID="DesignTable:MicroStatoMacchina" ZOrder="14" X="231" Y="993" Height="191" Width="254" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="102" />
|
||||
<Shape ID="DesignTable:LinkMenuJQM" ZOrder="11" X="15" Y="266" Height="210" Width="195" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="140" />
|
||||
<Shape ID="DesignTable:RemoteRebootLog" ZOrder="6" X="603" Y="1298" Height="229" Width="253" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="140" />
|
||||
<Shape ID="DesignTable:ParetoDurate" ZOrder="1" X="5" Y="14" Height="191" Width="208" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="121" />
|
||||
</Shapes>
|
||||
<Connectors>
|
||||
<Connector ID="DesignRelation:FK_Macchine2FamiglieMacchine_FamiglieMacchine" ZOrder="45" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>667</X>
|
||||
<Y>1007</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>667</X>
|
||||
<Y>830</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_Macchine2FamiglieMacchine_Macchine" ZOrder="44" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>699</X>
|
||||
<Y>558</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>699</X>
|
||||
<Y>715</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_TransizioneStati_FamiglieMacchine" ZOrder="43" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>754</X>
|
||||
<Y>1061</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>870</X>
|
||||
<Y>1061</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_StatoMacchine_Macchine" ZOrder="25" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>636</X>
|
||||
<Y>558</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>636</X>
|
||||
<Y>682</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>463</X>
|
||||
<Y>682</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_TransizioneStati_AnagraficaStati" ZOrder="42" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>386</X>
|
||||
<Y>619</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>386</X>
|
||||
<Y>933</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>870</X>
|
||||
<Y>933</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_StatoMacchine_AnagraficaStati" ZOrder="41" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>322</X>
|
||||
<Y>619</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>322</X>
|
||||
<Y>665</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_StatoMacchine_Kanban" ZOrder="24" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>659</X>
|
||||
<Y>249</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>659</X>
|
||||
<Y>698</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>463</X>
|
||||
<Y>698</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_EventList_Kanban" ZOrder="29" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>872</X>
|
||||
<Y>193</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>920</X>
|
||||
<Y>193</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_EventList_Macchine" ZOrder="40" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>814</X>
|
||||
<Y>359</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>920</X>
|
||||
<Y>359</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_TransizioneStati_AnagraficaEventi" ZOrder="18" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>1285</X>
|
||||
<Y>343</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>1264</X>
|
||||
<Y>343</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>1264</X>
|
||||
<Y>889</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>1132</X>
|
||||
<Y>889</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>1132</X>
|
||||
<Y>916</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_EventList_AnagraficaEventi" ZOrder="39" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>1285</X>
|
||||
<Y>302</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>1220</X>
|
||||
<Y>302</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_DiarioDiBordo_AnagraficaStati" ZOrder="38" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>298</X>
|
||||
<Y>455</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>298</X>
|
||||
<Y>420</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_DiarioDiBordo_Kanban" ZOrder="37" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>610</X>
|
||||
<Y>93</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>523</X>
|
||||
<Y>93</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_DiarioDiBordo_Macchine" ZOrder="36" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>619</X>
|
||||
<Y>341</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>523</X>
|
||||
<Y>341</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_TransizioneEventi_AnagraficaEventi1" ZOrder="34" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>1444</X>
|
||||
<Y>362</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>1444</X>
|
||||
<Y>409</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_Macchine2FamigliaIngressi_Macchine" ZOrder="10" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>716</X>
|
||||
<Y>558</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>716</X>
|
||||
<Y>1155</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_Macchine2FamigliaIngressi_FamigliaTipoIngressi" ZOrder="32" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>943</X>
|
||||
<Y>1231</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>832</X>
|
||||
<Y>1231</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_TransizioneIngressi_AnagraficaEventi" ZOrder="19" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>1285</X>
|
||||
<Y>343</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>1238</X>
|
||||
<Y>343</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>1238</X>
|
||||
<Y>1213</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>504</X>
|
||||
<Y>1213</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_TransizioneIngressi_FamigliaTipoIngressi" ZOrder="21" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>943</X>
|
||||
<Y>1292</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>504</X>
|
||||
<Y>1292</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_DiarioDiBordo_AnagraficaOperatori" ZOrder="31" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>965</X>
|
||||
<Y>669</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>513</X>
|
||||
<Y>669</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>513</X>
|
||||
<Y>420</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_EventList_AnagraficaOperatori" ZOrder="30" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>1108</X>
|
||||
<Y>641</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>1108</X>
|
||||
<Y>547</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:FK_StatoMacchine_AnagraficaOperatori" ZOrder="28" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>982</X>
|
||||
<Y>851</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>982</X>
|
||||
<Y>890</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>463</X>
|
||||
<Y>890</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
</Connectors>
|
||||
</DiagramLayout>
|
||||
@@ -0,0 +1,403 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using SteamWare;
|
||||
using System.Reflection;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace MapoDb
|
||||
{
|
||||
/// <summary>
|
||||
/// classe gestione operazioni su DB tramite MapoDb
|
||||
/// </summary>
|
||||
public class DataLayer
|
||||
{
|
||||
#region area table adapters
|
||||
|
||||
// Table adapter x DS_Applicazione
|
||||
public DS_applicazioneTableAdapters.MacchineTableAdapter taMacchine;
|
||||
public DS_applicazioneTableAdapters.StatoMacchineTableAdapter taStatoMacchine;
|
||||
public DS_applicazioneTableAdapters.AnagraficaEventiTableAdapter taAnagEventi;
|
||||
public DS_applicazioneTableAdapters.AnagraficaStatiTableAdapter taAnagStati;
|
||||
public DS_applicazioneTableAdapters.KanbanTableAdapter taKanban;
|
||||
public DS_applicazioneTableAdapters.KeepAliveTableAdapter taKeepAlive;
|
||||
public DS_applicazioneTableAdapters.DiarioDiBordoTableAdapter taStati;
|
||||
public DS_applicazioneTableAdapters.EventListTableAdapter taEventi;
|
||||
public DS_applicazioneTableAdapters.Kanban2insTableAdapter taK2ins;
|
||||
public DS_applicazioneTableAdapters.AnagraficaOperatoriTableAdapter taOp;
|
||||
public DS_applicazioneTableAdapters.AnagraficaOperatori2insTableAdapter taOp2ins;
|
||||
public DS_applicazioneTableAdapters.TransizioneIngressiTableAdapter taTranIngr;
|
||||
public DS_applicazioneTableAdapters.RemoteRebootLogTableAdapter taRemReb;
|
||||
// Table adapter x DS_ProdTempi
|
||||
public DS_ProdTempiTableAdapters.AnagArticoliTableAdapter taAnagArt;
|
||||
public DS_ProdTempiTableAdapters.ODLTableAdapter taODL;
|
||||
public DS_ProdTempiTableAdapters.DatiMacchineTableAdapter taDatiMacchine;
|
||||
public DS_ProdTempiTableAdapters.stp_repDonati_getDatiProdMacchinaTableAdapter taDatiProdMacch;
|
||||
public DS_ProdTempiTableAdapters.stp_repDonati_getDatiProdMacchinaPeriodoTableAdapter taDatiProdMacchPer;
|
||||
public DS_ProdTempiTableAdapters.stp_repDonati_getLastStatoDurataMacchinaTableAdapter taDatiStatoMacch;
|
||||
public DS_ProdTempiTableAdapters.PostazioniMapoTableAdapter taPostazioni;
|
||||
public DS_ProdTempiTableAdapters.DatiConfermatiTableAdapter taDatiConfermati;
|
||||
public DS_ProdTempiTableAdapters.stp_PzProd_getByMacchinaTableAdapter taPzProd2conf;
|
||||
public DS_ProdTempiTableAdapters.TempiCicloRilevatiTableAdapter taTempiCicloRilevati;
|
||||
public DS_ProdTempiTableAdapters.DatiProduzioneTableAdapter taDatiProd;
|
||||
public DS_ProdTempiTableAdapters.stp_TempoByIdxMaccPeriodClassTableAdapter taTempoByClass;
|
||||
public DS_ProdTempiTableAdapters.TurniMacchinaTableAdapter taTurniMacc;
|
||||
public DS_ProdTempiTableAdapters.CalendFesteFerieTableAdapter taCalFF;
|
||||
public DS_ProdTempiTableAdapters.MappaStatoExplTableAdapter taMSE;
|
||||
public DS_ProdTempiTableAdapters.ProduzioneAs400TableAdapter taAs400;
|
||||
// table adapter x utility
|
||||
public DS_UtilityTableAdapters.v_selArticoliTableAdapter taSelArt;
|
||||
public DS_UtilityTableAdapters.v_selKanbanTableAdapter taSelKan;
|
||||
public DS_UtilityTableAdapters.v_selODLTableAdapter taSelOdlFree;
|
||||
public DS_UtilityTableAdapters.CommentiTableAdapter taComm;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// init dei table adapters
|
||||
/// </summary>
|
||||
protected void initTA()
|
||||
{
|
||||
// istanzio oggetto
|
||||
taMacchine = new DS_applicazioneTableAdapters.MacchineTableAdapter();
|
||||
taStatoMacchine = new DS_applicazioneTableAdapters.StatoMacchineTableAdapter();
|
||||
taAnagEventi = new DS_applicazioneTableAdapters.AnagraficaEventiTableAdapter();
|
||||
taAnagStati = new DS_applicazioneTableAdapters.AnagraficaStatiTableAdapter();
|
||||
taKanban = new DS_applicazioneTableAdapters.KanbanTableAdapter();
|
||||
taKeepAlive = new DS_applicazioneTableAdapters.KeepAliveTableAdapter();
|
||||
taStati = new DS_applicazioneTableAdapters.DiarioDiBordoTableAdapter();
|
||||
taEventi = new DS_applicazioneTableAdapters.EventListTableAdapter();
|
||||
taK2ins = new DS_applicazioneTableAdapters.Kanban2insTableAdapter();
|
||||
taOp = new DS_applicazioneTableAdapters.AnagraficaOperatoriTableAdapter();
|
||||
taOp2ins = new DS_applicazioneTableAdapters.AnagraficaOperatori2insTableAdapter();
|
||||
taTranIngr = new DS_applicazioneTableAdapters.TransizioneIngressiTableAdapter();
|
||||
taRemReb = new DS_applicazioneTableAdapters.RemoteRebootLogTableAdapter();
|
||||
taAnagArt = new DS_ProdTempiTableAdapters.AnagArticoliTableAdapter();
|
||||
taODL = new DS_ProdTempiTableAdapters.ODLTableAdapter();
|
||||
taDatiMacchine = new DS_ProdTempiTableAdapters.DatiMacchineTableAdapter();
|
||||
taDatiProdMacch = new DS_ProdTempiTableAdapters.stp_repDonati_getDatiProdMacchinaTableAdapter();
|
||||
taDatiProdMacchPer = new DS_ProdTempiTableAdapters.stp_repDonati_getDatiProdMacchinaPeriodoTableAdapter();
|
||||
taDatiStatoMacch = new DS_ProdTempiTableAdapters.stp_repDonati_getLastStatoDurataMacchinaTableAdapter();
|
||||
taPostazioni = new DS_ProdTempiTableAdapters.PostazioniMapoTableAdapter();
|
||||
taTurniMacc = new DS_ProdTempiTableAdapters.TurniMacchinaTableAdapter();
|
||||
taDatiConfermati = new DS_ProdTempiTableAdapters.DatiConfermatiTableAdapter();
|
||||
taPzProd2conf = new DS_ProdTempiTableAdapters.stp_PzProd_getByMacchinaTableAdapter();
|
||||
taTempiCicloRilevati = new DS_ProdTempiTableAdapters.TempiCicloRilevatiTableAdapter();
|
||||
taDatiProd = new DS_ProdTempiTableAdapters.DatiProduzioneTableAdapter();
|
||||
taTempoByClass = new DS_ProdTempiTableAdapters.stp_TempoByIdxMaccPeriodClassTableAdapter();
|
||||
taCalFF = new DS_ProdTempiTableAdapters.CalendFesteFerieTableAdapter();
|
||||
taMSE = new DS_ProdTempiTableAdapters.MappaStatoExplTableAdapter();
|
||||
taAs400 = new DS_ProdTempiTableAdapters.ProduzioneAs400TableAdapter();
|
||||
taSelArt = new DS_UtilityTableAdapters.v_selArticoliTableAdapter();
|
||||
taSelKan = new DS_UtilityTableAdapters.v_selKanbanTableAdapter();
|
||||
taSelOdlFree = new DS_UtilityTableAdapters.v_selODLTableAdapter();
|
||||
taComm = new DS_UtilityTableAdapters.CommentiTableAdapter();
|
||||
}
|
||||
/// <summary>
|
||||
/// effettua setup dei connection strings da web.config delal singola applicazione
|
||||
/// </summary>
|
||||
protected virtual void setupConnectionStringBase()
|
||||
{
|
||||
string connectionString = memLayer.ML.confReadString("MoonProConnectionString");
|
||||
// connections del db
|
||||
taMacchine.Connection.ConnectionString = connectionString;
|
||||
taStatoMacchine.Connection.ConnectionString = connectionString;
|
||||
taAnagEventi.Connection.ConnectionString = connectionString;
|
||||
taAnagStati.Connection.ConnectionString = connectionString;
|
||||
taKanban.Connection.ConnectionString = connectionString;
|
||||
taKeepAlive.Connection.ConnectionString = connectionString;
|
||||
taStati.Connection.ConnectionString = connectionString;
|
||||
taEventi.Connection.ConnectionString = connectionString;
|
||||
taK2ins.Connection.ConnectionString = connectionString;
|
||||
taOp.Connection.ConnectionString = connectionString;
|
||||
taOp2ins.Connection.ConnectionString = connectionString;
|
||||
taTranIngr.Connection.ConnectionString = connectionString;
|
||||
taRemReb.Connection.ConnectionString = connectionString;
|
||||
taAnagArt.Connection.ConnectionString = connectionString;
|
||||
taODL.Connection.ConnectionString = connectionString;
|
||||
taDatiMacchine.Connection.ConnectionString = connectionString;
|
||||
taDatiProdMacch.Connection.ConnectionString = connectionString;
|
||||
taDatiProdMacchPer.Connection.ConnectionString = connectionString;
|
||||
taDatiStatoMacch.Connection.ConnectionString = connectionString;
|
||||
taPostazioni.Connection.ConnectionString = connectionString;
|
||||
taTurniMacc.Connection.ConnectionString = connectionString;
|
||||
taDatiConfermati.Connection.ConnectionString = connectionString;
|
||||
taPzProd2conf.Connection.ConnectionString = connectionString;
|
||||
taTempiCicloRilevati.Connection.ConnectionString = connectionString;
|
||||
taDatiProd.Connection.ConnectionString = connectionString;
|
||||
taTempoByClass.Connection.ConnectionString = connectionString;
|
||||
taCalFF.Connection.ConnectionString = connectionString;
|
||||
taMSE.Connection.ConnectionString = connectionString;
|
||||
taAs400.Connection.ConnectionString = connectionString;
|
||||
taSelArt.Connection.ConnectionString = connectionString;
|
||||
taSelKan.Connection.ConnectionString = connectionString;
|
||||
taSelOdlFree.Connection.ConnectionString = connectionString;
|
||||
taComm.Connection.ConnectionString = connectionString;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Inizializzazione
|
||||
|
||||
protected DataLayer()
|
||||
{
|
||||
initTA();
|
||||
setupConnectionStringBase();
|
||||
|
||||
// aggiunta x gestione timeout esteso (ove necessario)!
|
||||
fixCommandTimeout();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// sistemazione timeout comandi nei tableadapter
|
||||
/// </summary>
|
||||
private void fixCommandTimeout()
|
||||
{
|
||||
//SetAllCommandTimeouts(taQL, memLayer.ML.confReadInt("sqlLongCommandTimeout"));
|
||||
//SetAllCommandTimeouts(taQFQ, memLayer.ML.confReadInt("sqlLongCommandTimeout"));
|
||||
//SetAllCommandTimeouts(taQRM, memLayer.ML.confReadInt("sqlLongCommandTimeout"));
|
||||
//SetAllCommandTimeouts(taRMD, memLayer.ML.confReadInt("sqlLongCommandTimeout"));
|
||||
//SetAllCommandTimeouts(taSCL, memLayer.ML.confReadInt("sqlLongCommandTimeout"));
|
||||
//SetAllCommandTimeouts(taVSCli, memLayer.ML.confReadInt("sqlLongCommandTimeout"));
|
||||
//SetAllCommandTimeouts(taVSItm, memLayer.ML.confReadInt("sqlLongCommandTimeout"));
|
||||
//SetAllCommandTimeouts(taVSRM, memLayer.ML.confReadInt("sqlLongCommandTimeout"));
|
||||
//SetAllCommandTimeouts(taRPT, memLayer.ML.confReadInt("sqlLongCommandTimeout"));
|
||||
//SetAllCommandTimeouts(taO4I, memLayer.ML.confReadInt("sqlLongCommandTimeout"));
|
||||
//SetAllCommandTimeouts(taOH, memLayer.ML.confReadInt("sqlLongCommandTimeout"));
|
||||
//SetAllCommandTimeouts(taSC2C, memLayer.ML.confReadInt("sqlLongCommandTimeout"));
|
||||
SetAllCommandTimeouts(taComm, memLayer.ML.confReadInt("sqlLongCommandTimeout"));
|
||||
}
|
||||
void SetAllCommandTimeouts(object adapter, int timeout)
|
||||
{
|
||||
var commands = adapter.GetType().InvokeMember(
|
||||
"CommandCollection",
|
||||
BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic,
|
||||
null, adapter, new object[0]);
|
||||
var sqlCommand = (SqlCommand[])commands;
|
||||
foreach (var cmd in sqlCommand)
|
||||
{
|
||||
cmd.CommandTimeout = timeout;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// oggetto static per fare chiamate sul magazzino
|
||||
/// </summary>
|
||||
public static DataLayer obj = new DataLayer();
|
||||
|
||||
#endregion
|
||||
|
||||
#region utility public esposte
|
||||
|
||||
/// <summary>
|
||||
/// Effettua conferma prod macchina dell'intero periodo da confermare (ultima conferma --> adesso)
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina">idx macchina da confermare</param>
|
||||
/// <param name="modoConfProd">0=periodo, 1 = giorno, 2 = turno</param>
|
||||
/// <param name="numPzConfermati">qta pezzi da confermare</param>
|
||||
/// <returns></returns>
|
||||
public bool confermaProdMacchina(string idxMacchina, int modoConfProd, int numPzConfermati)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
DS_ProdTempi.stp_PzProd_getByMacchinaRow rigaProd = DataLayer.obj.taPzProd2conf.GetData(idxMacchina.ToString())[0];
|
||||
// chiamo stored stp_ConfermaProduzCompleta(idxMacchina,MatrApp,dataFrom,dataTo,pezziConf)
|
||||
taPzProd2conf.stp_ConfermaProduzCompleta(idxMacchina, MatrOpr, rigaProd.DataFrom, rigaProd.DataTo, numPzConfermati, modoConfProd,DateTime.Now, true);
|
||||
// indico eseguito!
|
||||
answ = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore in conferma prod macchina:{0}{1}", Environment.NewLine, exc));
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// invia una mail al destinatario x linkare nuovi devices tramite URL
|
||||
/// </summary>
|
||||
/// <param name="destinatario"></param>
|
||||
/// <param name="UserAuthKey"></param>
|
||||
/// <param name="idxDipendente"></param>
|
||||
/// <returns></returns>
|
||||
public bool sendUserAuthEmail(string destinatario, string UserAuthKey, int idxDipendente)
|
||||
{
|
||||
bool fatto = false;
|
||||
string smtpCli = "";
|
||||
string mittente = "";
|
||||
string oggetto = "";
|
||||
string userUrl = "";
|
||||
string baseUrl = "";
|
||||
string userWebUrl = "";
|
||||
string baseWebUrl = "";
|
||||
string corpo = "";
|
||||
try
|
||||
{
|
||||
// compongo la stringa
|
||||
smtpCli = memLayer.ML.confReadString("_smtpCli");
|
||||
mittente = memLayer.ML.confReadString("_fromEmail");
|
||||
oggetto = "Link autorizzazione device per GPW";
|
||||
baseUrl = memLayer.ML.confReadString("baseUrl");
|
||||
baseWebUrl = memLayer.ML.confReadString("baseWebUrl");
|
||||
userUrl = string.Format("{2}jumper.aspx?UserAuthkey={0}&idxDipendente={1}", UserAuthKey, idxDipendente, baseUrl);
|
||||
userWebUrl = string.Format("{2}jumper.aspx?UserAuthkey={0}&idxDipendente={1}", UserAuthKey, idxDipendente, baseWebUrl);
|
||||
corpo = string.Format("Hai ricevuto questa email su richiesta tua o dell'Admin per poter procedere a registrare un (nuovo) devices con GPW:{0}<br/>Per proseguire clicca sul link seguente(rete interna):<br />{0}{0}{1}{0}{0}<br /><br />oppure sul link seguente (internet):<br />{0}{0}{2}{0}{0}<br /><br />Team GPW Steamware", Environment.NewLine, userUrl, userWebUrl);
|
||||
gestEmail.ge.mandaEmail(mittente, destinatario, oggetto, corpo);
|
||||
fatto = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return fatto;
|
||||
}
|
||||
/// <summary>
|
||||
/// Invia email di avviso che ci sono dei TC da confermare
|
||||
/// </summary>
|
||||
/// <param name="destinatario"></param>
|
||||
/// <returns></returns>
|
||||
public bool sendWarnTcChangeReq(string destinatario)
|
||||
{
|
||||
bool fatto = false;
|
||||
string mittente = "";
|
||||
string oggetto = "";
|
||||
string pageUrl = "";
|
||||
string corpo = "";
|
||||
try
|
||||
{
|
||||
// compongo la stringa
|
||||
mittente = memLayer.ML.confReadString("_fromEmail");
|
||||
oggetto = memLayer.ML.confReadString("oggettoChgTc");
|
||||
pageUrl = string.Format("{0}{1}", memLayer.ML.confReadString("baseUrlAdmin"), memLayer.ML.confReadString("pageUrlApprODL"));
|
||||
corpo = string.Format(memLayer.ML.confReadString("corpoChgTc"), Environment.NewLine, pageUrl);
|
||||
if (memLayer.ML.confReadBool("_useAuthSmtp"))
|
||||
{
|
||||
gestEmail.geAuth.mandaEmail(mittente, destinatario, oggetto, corpo);
|
||||
}
|
||||
else
|
||||
{
|
||||
gestEmail.ge.mandaEmail(mittente, destinatario, oggetto, corpo);
|
||||
}
|
||||
fatto = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// effettua enroll del device
|
||||
/// </summary>
|
||||
/// <param name="UserAuthKey"></param>
|
||||
/// <param name="IPv4"></param>
|
||||
/// <param name="DeviceName"></param>
|
||||
/// <param name="Description"></param>
|
||||
/// <param name="idxDipendente"></param>
|
||||
/// <returns></returns>
|
||||
public bool enrollDevice(string UserAuthKey, string IPv4, string DeviceName, string Description, int matricola)
|
||||
{
|
||||
bool fatto = false;
|
||||
// in primis testo se dipendente ed authKey sono validi..
|
||||
if (taOp.getByMatrAuthKey(matricola, UserAuthKey).Rows.Count > 0)
|
||||
{
|
||||
// salvo matrOpr
|
||||
MatrOpr = matricola;
|
||||
/************************************************
|
||||
* Gestione riconoscimento devices
|
||||
*
|
||||
* - cerco IP del device, testo se è rete interna (A) o extranet/internet (B) cercando substring "localNet" da web.config
|
||||
* (A): device interni: c'è un DHCP, e "dhcpLeaseTime" deve essere pari a lease time---
|
||||
* - verifico se IP già in uso da un tempo < "dhcpLeaseTime" --> in questo caso segnalo errore e rimbalzo (NON permetto di registrare device a nuovo utente... sospetto uso "improprio" del device
|
||||
* - se tempo > dhcpLeaseTime allora può aver cambiato IP: aggiorno IP e descrizione del device e proseguo
|
||||
* (B): all'esterno vedo tutta una subnet NATtata con unico IP, non è + discriminante
|
||||
* - le timbrature "da esterno" devono essere confermate (instrodurre "tipo timbratura" x cui interne sono autoconfermate, esterne sono "grayed" (da confermare, da admin o ad esempio se si accende secondo device utente entro 5/10 min)
|
||||
* - le timbrature ext DOVREBBERO chiedere location (jScript?) e inviarla, visibile in conferma
|
||||
*
|
||||
*
|
||||
* **********************************************/
|
||||
// calcolo il secret...
|
||||
DateTime adesso = DateTime.Now;
|
||||
string Dominio = memLayer.ML.confReadString("dominio");
|
||||
string UsrName = memLayer.ML.confReadString("user");
|
||||
// recupero dati da matricola...
|
||||
try
|
||||
{
|
||||
DataLayer_AnagGen.UTENTERow rigaUt = user_std.UtSn.rigaUtenteDaMatricola(matricola.ToString());
|
||||
if (rigaUt != null)
|
||||
{
|
||||
Dominio = rigaUt.DOMINIO;
|
||||
UsrName = rigaUt.USER_NAME;
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("non sono riuscito a recuperare RIGA utente per matricola {0}", matricola), tipoLog.ERROR);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Eccezione! non sono riuscito a recuperare utente per matricola {0}", matricola), tipoLog.ERROR);
|
||||
Dominio = memLayer.ML.confReadString("dominio");
|
||||
UsrName = memLayer.ML.confReadString("user");
|
||||
}
|
||||
string Secret = authProxy.getSecret(Dominio, UsrName, matricola, DeviceName, adesso);
|
||||
string devSecret = SteamCrypto.EncryptString(Secret, memLayer.ML.confReadString("cookieName"));
|
||||
try
|
||||
{
|
||||
// creo device + cookie!
|
||||
fatto = authProxy.createNewCookie(Dominio, UsrName, matricola, DeviceName, Description, IPv4, memLayer.ML.confReadString("cookieName"), DateTime.Now.AddDays(memLayer.ML.confReadInt("cookieDayExpire")));
|
||||
// loggo!
|
||||
logger.lg.scriviLog(string.Format("Effettuato enroll nuovo device: utente {0}\\{1} | matricola {2} | DeviceName {3} | Descrizione {4} | IP {5} | nome cookcie {6} | valido sino a {7:yyyy/MM/dd}", Dominio, UsrName, matricola, DeviceName, Description, IPv4, memLayer.ML.confReadString("cookieName"), DateTime.Now.AddDays(memLayer.ML.confReadInt("cookieDayExpire"))));
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore enroll nuovo device:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
/// <summary>
|
||||
/// MatrOpr in sessione
|
||||
/// </summary>
|
||||
public static int MatrOpr
|
||||
{
|
||||
get
|
||||
{
|
||||
int idx = 0;
|
||||
try
|
||||
{
|
||||
idx = memLayer.ML.IntSessionObj("MatrOpr");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return idx;
|
||||
}
|
||||
set
|
||||
{
|
||||
memLayer.ML.setSessionVal("MatrOpr", value);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Cognome Nome da MatrOpr in sessione
|
||||
/// </summary>
|
||||
public static string CognomeNomeOpr
|
||||
{
|
||||
get
|
||||
{
|
||||
// cerco operatore...
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
DS_applicazione.AnagraficaOperatoriRow oper = (DS_applicazione.AnagraficaOperatoriRow)DataLayer.obj.taOp.getByMatrOpr(MatrOpr)[0];
|
||||
answ = string.Format("{0} {1}", oper.Cognome, oper.Nome);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
public enum tipoSelettore
|
||||
{
|
||||
articoli
|
||||
}
|
||||
+1441
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,243 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{4617A665-D6E3-4CEB-A689-CE2EECD45713}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MapoDb</RootNamespace>
|
||||
<AssemblyName>MapoDb</AssemblyName>
|
||||
<IsWebBootstrapper>true</IsWebBootstrapper>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
<PublishUrl>http://localhost/MapoDb/</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Web</InstallFrom>
|
||||
<UpdateEnabled>true</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.ReportViewer.WinForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DataLayer.cs" />
|
||||
<Compile Include="DS_applicazione.cs">
|
||||
<DependentUpon>DS_applicazione.xsd</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DS_applicazione.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>DS_applicazione.xsd</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DS_ProdTempi.cs">
|
||||
<DependentUpon>DS_ProdTempi.xsd</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DS_ProdTempi1.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>DS_ProdTempi.xsd</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DS_Utility.cs">
|
||||
<DependentUpon>DS_Utility.xsd</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DS_Utility.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>DS_Utility.xsd</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MapoDb.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="reportExporter.cs" />
|
||||
<Compile Include="reportPrinter.cs" />
|
||||
<Compile Include="resoconti.cs" />
|
||||
<Compile Include="selData.cs" />
|
||||
<Compile Include="utility.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="DS_applicazione.xsc">
|
||||
<DependentUpon>DS_applicazione.xsd</DependentUpon>
|
||||
</None>
|
||||
<None Include="DS_applicazione.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSDataSetGenerator</Generator>
|
||||
<LastGenOutput>DS_applicazione.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="DS_applicazione.xss">
|
||||
<DependentUpon>DS_applicazione.xsd</DependentUpon>
|
||||
</None>
|
||||
<None Include="DS_ProdTempi.xsc">
|
||||
<DependentUpon>DS_ProdTempi.xsd</DependentUpon>
|
||||
</None>
|
||||
<None Include="DS_ProdTempi.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSDataSetGenerator</Generator>
|
||||
<LastGenOutput>DS_ProdTempi1.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="DS_ProdTempi.xss">
|
||||
<DependentUpon>DS_ProdTempi.xsd</DependentUpon>
|
||||
</None>
|
||||
<None Include="DS_Utility.xsc">
|
||||
<DependentUpon>DS_Utility.xsd</DependentUpon>
|
||||
</None>
|
||||
<None Include="DS_Utility.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSDataSetGenerator</Generator>
|
||||
<LastGenOutput>DS_Utility.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="DS_Utility.xss">
|
||||
<DependentUpon>DS_Utility.xsd</DependentUpon>
|
||||
</None>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="SqlUpdate\MoonPro\V2.0\MoonPro_00319.sql" />
|
||||
<None Include="SqlUpdate\MoonPro\V2.0\MoonPro_00320.sql" />
|
||||
<None Include="SqlUpdate\MoonPro\V2.0\MoonPro_00318.sql" />
|
||||
<None Include="SqlUpdate\MoonPro\V2.0\MoonPro_00317.sql" />
|
||||
<None Include="SqlUpdate\MoonPro\V2.0\MoonPro_00316.sql" />
|
||||
<None Include="SqlUpdate\MoonPro\V2.0\MoonPro_00315.sql" />
|
||||
<None Include="SqlUpdate\MoonPro\V2.0\MoonPro_00310.sql" />
|
||||
<None Include="SqlUpdate\MoonPro\V2.0\MoonPro_00305.sql" />
|
||||
<None Include="SqlUpdate\MoonPro\V2.0\MoonPro_00300.sql" />
|
||||
<None Include="SqlUpdate\MoonPro\V2.0\MoonPro_00245.sql" />
|
||||
<None Include="SqlUpdate\MoonPro\V2.0\MoonPro_00240.sql" />
|
||||
<None Include="SqlUpdate\MoonPro\V2.0\MoonPro_00236.sql" />
|
||||
<None Include="SqlUpdate\MoonPro\V2.0\MoonPro_00235.sql" />
|
||||
<None Include="SqlUpdate\MoonPro\V2.0\MoonPro_00230.sql" />
|
||||
<None Include="SqlUpdate\MoonPro\V1.0\MoonPro_00025.sql" />
|
||||
<None Include="SqlUpdate\MoonPro\V1.0\MoonPro_00020.sql" />
|
||||
<None Include="SqlUpdate\MoonPro\V1.0\MoonPro_00015.sql" />
|
||||
<None Include="SqlUpdate\MoonPro\V1.0\MoonPro_00010.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Sql.Server.Express.1.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>SQL Server 2005 Express Edition</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="SqlUpdate\Vocabolario\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="SqlUpdate\MoonPro\V2.1\MoonPro_00353.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\SteamWareLibrary\SteamWare\SteamWare.csproj">
|
||||
<Project>{2872DCFE-8B46-43B2-BAA0-842A816A2DD5}</Project>
|
||||
<Name>SteamWare</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="SqlUpdate\MoonPro\V3.2\MoonPro_00370.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="SqlUpdate\MoonPro\V3.2\MoonPro_00375.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="SqlUpdate\MoonPro\V3.2\MoonPro_00380.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="SqlUpdate\MoonPro\V3.2\MoonPro_00385.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="SqlUpdate\MoonPro\V3.2\MoonPro_00390.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="SqlUpdate\MoonPro\V3.4\MoonPro_00401.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="SqlUpdate\MoonPro\V3.4\MoonPro_00409.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="SqlUpdate\MoonPro\V3.4\MoonPro_00414.sql" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<PublishUrlHistory>
|
||||
</PublishUrlHistory>
|
||||
<InstallUrlHistory>
|
||||
</InstallUrlHistory>
|
||||
<SupportUrlHistory>
|
||||
</SupportUrlHistory>
|
||||
<UpdateUrlHistory>
|
||||
</UpdateUrlHistory>
|
||||
<BootstrapperUrlHistory>
|
||||
</BootstrapperUrlHistory>
|
||||
<FallbackCulture>en-US</FallbackCulture>
|
||||
<VerifyUploadedFiles>true</VerifyUploadedFiles>
|
||||
<ErrorReportUrlHistory>
|
||||
</ErrorReportUrlHistory>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapoDb", "MapoDb.csproj", "{4617A665-D6E3-4CEB-A689-CE2EECD45713}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{4617A665-D6E3-4CEB-A689-CE2EECD45713}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4617A665-D6E3-4CEB-A689-CE2EECD45713}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4617A665-D6E3-4CEB-A689-CE2EECD45713}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4617A665-D6E3-4CEB-A689-CE2EECD45713}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Binary file not shown.
@@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("MapoDb")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Steamware s.r.l.")]
|
||||
[assembly: AssemblyProduct("MapoDb")]
|
||||
[assembly: AssemblyCopyright("Copyright © Steamware 2007")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(true)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("b264378f-27d7-4101-9202-b75160f8a80b")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.1")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.1")]
|
||||
Generated
+48
@@ -0,0 +1,48 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34014
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MapoDb.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=192.168.51.71\\sqlexpress;Initial Catalog=MoonPro;Persist Security Inf" +
|
||||
"o=True;User ID=sa;Password=keyhammer")]
|
||||
public string MoonProConnectionString {
|
||||
get {
|
||||
return ((string)(this["MoonProConnectionString"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=T110-WIN2008R2\\SQL2008R2;Initial Catalog=MoonPro;Persist Security Inf" +
|
||||
"o=True;User ID=sa;Password=keyhammer")]
|
||||
public string MoonProConnectionString1 {
|
||||
get {
|
||||
return ((string)(this["MoonProConnectionString1"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="MapoDb.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="MoonProConnectionString" Type="(Connection string)" Scope="Application">
|
||||
<DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
|
||||
<SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<ConnectionString>Data Source=192.168.51.71\sqlexpress;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer</ConnectionString>
|
||||
<ProviderName>System.Data.SqlClient</ProviderName>
|
||||
</SerializableConnectionString></DesignTimeValue>
|
||||
<Value Profile="(Default)">Data Source=192.168.51.71\sqlexpress;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer</Value>
|
||||
</Setting>
|
||||
<Setting Name="MoonProConnectionString1" Type="(Connection string)" Scope="Application">
|
||||
<DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
|
||||
<SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<ConnectionString>Data Source=T110-WIN2008R2\SQL2008R2;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer</ConnectionString>
|
||||
<ProviderName>System.Data.SqlClient</ProviderName>
|
||||
</SerializableConnectionString></DesignTimeValue>
|
||||
<Value Profile="(Default)">Data Source=T110-WIN2008R2\SQL2008R2;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,28 @@
|
||||
namespace MapoDb.Properties {
|
||||
|
||||
|
||||
// This class allows you to handle specific events on the settings class:
|
||||
// The SettingChanging event is raised before a setting's value is changed.
|
||||
// The PropertyChanged event is raised after a setting's value is changed.
|
||||
// The SettingsLoaded event is raised after the setting values are loaded.
|
||||
// The SettingsSaving event is raised before the setting values are saved.
|
||||
internal sealed partial class Settings {
|
||||
|
||||
public Settings() {
|
||||
// // To add event handlers for saving and changing settings, uncomment the lines below:
|
||||
//
|
||||
// this.SettingChanging += this.SettingChangingEventHandler;
|
||||
//
|
||||
// this.SettingsSaving += this.SettingsSavingEventHandler;
|
||||
//
|
||||
}
|
||||
|
||||
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
|
||||
// Add code to handle the SettingChangingEvent event here.
|
||||
}
|
||||
|
||||
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
|
||||
// Add code to handle the SettingsSaving event here.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
create table LogUpdateDb(
|
||||
Versione int not null constraint PK_LogUpdateDb primary key,
|
||||
Data datetime
|
||||
)
|
||||
go
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
alter table AnagraficaStati add
|
||||
Priorita int
|
||||
go
|
||||
|
||||
exec sp_addextendedproperty 'MS_Description', 'livello di precedenza (il minore precede e sovrascrive i livelli successivi)', 'SCHEMA', 'dbo', 'TABLE', 'AnagraficaStati', 'COLUMN', 'Priorita'
|
||||
go
|
||||
|
||||
set ANSI_NULLS on
|
||||
go
|
||||
|
||||
alter TRIGGER UpdDiarioDiBordo
|
||||
ON DiarioDiBordo
|
||||
FOR INSERT
|
||||
AS
|
||||
|
||||
/* dichiaro variabili */
|
||||
DECLARE @IdxMacchina NVARCHAR(50)
|
||||
DECLARE @InizioStato DATETIME
|
||||
DECLARE @soloMinuti FLOAT
|
||||
DECLARE @IdxStatoOld INT
|
||||
DECLARE @IdxStatoNew INT
|
||||
DECLARE @semaforoOld VARCHAR(50)
|
||||
DECLARE @semaforoNew VARCHAR(50)
|
||||
DECLARE @prioritaOld INT
|
||||
DECLARE @prioritaNew INT
|
||||
|
||||
/* recupero valori x inserting */
|
||||
SET @IdxMacchina = ( SELECT i.IdxMacchina FROM inserted i )
|
||||
SET @InizioStato = ( SELECT i.InizioStato FROM inserted i )
|
||||
SET @soloMinuti = ( SELECT DATEDIFF(n, InizioStato, @InizioStato) FROM DiarioDiBordo WHERE (FineStato IS NULL) AND (IdxMacchina = @IdxMacchina) AND (InizioStato <>@InizioStato) )
|
||||
/* recupero dati x stati e semafori/priorità x eventuale update a ritroso dello stato */
|
||||
SET @IdxStatoOld = ( SELECT IdxStato FROM DiarioDiBordo WHERE (FineStato IS NULL) AND (IdxMacchina = @IdxMacchina) AND (InizioStato <>@InizioStato) )
|
||||
SET @IdxStatoNew = ( SELECT i.IdxStato FROM inserted i )
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------ */
|
||||
/* CONTROLLO SE NECESSARIO AGGIORNARE STATO PRECEDENTE guardando le famiglie "semaforiche" e la priorità dello stato vecchio e nuovo*/
|
||||
/* faccio i controlli SOLO se lo stato è cambiato da vecchio a nuovo */
|
||||
IF (@IdxStatoOld <> @IdxStatoNew)
|
||||
BEGIN
|
||||
SET @semaforoOld = ( SELECT Semaforo FROM AnagraficaStati WHERE IdxStato = @IdxStatoOld )
|
||||
SET @semaforoNew = ( SELECT Semaforo FROM AnagraficaStati WHERE IdxStato = @IdxStatoNew )
|
||||
|
||||
/* questo controllo ed eventuale update lo faccio SOLO se i semafori corrispondono (stessa "famiglia" */
|
||||
IF (@semaforoOld = @semaforoNew)
|
||||
BEGIN
|
||||
SET @prioritaOld = ( SELECT Priorita FROM AnagraficaStati WHERE IdxStato = @IdxStatoOld )
|
||||
SET @prioritaNew = ( SELECT Priorita FROM AnagraficaStati WHERE IdxStato = @IdxStatoNew )
|
||||
|
||||
/* controlo se la priorità nuova sia + bassa della precedente e nel caso sovrascrivo */
|
||||
IF (@prioritaNew < @prioritaOld)
|
||||
BEGIN
|
||||
/* in questo caso imposto lo stato precedente come quello nuovo */
|
||||
UPDATE DiarioDiBordo
|
||||
SET IdxStato = @IdxStatoNew
|
||||
WHERE (FineStato IS NULL) AND (IdxMacchina = @IdxMacchina) AND (InizioStato <> @InizioStato)
|
||||
END
|
||||
END
|
||||
END
|
||||
/* ------------------------------------------------------------------------------------------------------------ */
|
||||
|
||||
/* Chiudo lo stato precedente */
|
||||
UPDATE DiarioDiBordo
|
||||
SET FineStato = @InizioStato, DurataMinuti = @soloMinuti + CAST((DATEDIFF(ms, DATEADD(n,@soloMinuti,InizioStato), @InizioStato)) AS FLOAT)/60000
|
||||
WHERE (FineStato IS NULL) AND (IdxMacchina = @IdxMacchina) AND (InizioStato <> @InizioStato)
|
||||
|
||||
/* Aggiorno tabella stato corrente della macchina */
|
||||
DELETE FROM StatoMacchine
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
|
||||
INSERT INTO StatoMacchine(IdxMacchina, IdxStato, InizioStato, Value, MatricolaKanban, KanbanCode, TempoCicloBase, PzPalletProd)
|
||||
SELECT IdxMacchina, IdxStato, InizioStato, Value, MatricolaKanban, KanbanCode, TempoCicloBase, PzPalletProd
|
||||
FROM inserted
|
||||
|
||||
/* aggiorno dati kanban DiarioDiBordo... */
|
||||
UPDATE DiarioDiBordo
|
||||
SET KanbanCode = k.KanbanCode, TempoCicloBase = k.TempoCicloBase, PzPalletProd = k.PzPallet
|
||||
FROM Kanban AS k INNER JOIN
|
||||
DiarioDiBordo ON k.MatricolaKanban = DiarioDiBordo.MatricolaKanban
|
||||
WHERE (DiarioDiBordo.TempoCicloBase IS NULL)
|
||||
|
||||
/* aggiorno dati kanban statoMacchine... */
|
||||
UPDATE StatoMacchine
|
||||
SET KanbanCode = k.KanbanCode, TempoCicloBase = k.TempoCicloBase, PzPalletProd = k.PzPallet
|
||||
FROM Kanban AS k INNER JOIN
|
||||
StatoMacchine ON k.MatricolaKanban = StatoMacchine.MatricolaKanban
|
||||
WHERE (StatoMacchine.TempoCicloBase IS NULL)
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
Priorita=1
|
||||
WHERE IdxStato=1
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
Priorita=1
|
||||
WHERE IdxStato=2
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
Priorita=1
|
||||
WHERE IdxStato=3
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
Priorita=1
|
||||
WHERE IdxStato=4
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
Priorita=3
|
||||
WHERE IdxStato=5
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
Priorita=1
|
||||
WHERE IdxStato=6
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
Priorita=1
|
||||
WHERE IdxStato=7
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
Priorita=1
|
||||
WHERE IdxStato=8
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
Priorita=1
|
||||
WHERE IdxStato=9
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
Priorita=1
|
||||
WHERE IdxStato=10
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
Priorita=1
|
||||
WHERE IdxStato=11
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
Priorita=4
|
||||
WHERE IdxStato=12
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
Priorita=1
|
||||
WHERE IdxStato=13
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
Priorita=1
|
||||
WHERE IdxStato=14
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
Priorita=5
|
||||
WHERE IdxStato=15
|
||||
go
|
||||
|
||||
commit transaction
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(10, GETDATE())
|
||||
GO
|
||||
@@ -0,0 +1,45 @@
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
create table TempiCicloRilevati(
|
||||
IdxMacchina nvarchar(50) not null,
|
||||
DataOraRif datetime not null,
|
||||
TempoMedio decimal(18,8) not null constraint DF_TempiCicloRilevati_TempoMedio default (1),
|
||||
PzProd int not null constraint DF_TempiCicloRilevati_PzProd default (1),
|
||||
|
||||
constraint PK_TempiCicloRilevati primary key(IdxMacchina,DataOraRif)
|
||||
)
|
||||
go
|
||||
|
||||
alter table TempiCicloRilevati add
|
||||
constraint FK_TempiCicloRilevati_Macchine foreign key(IdxMacchina) references Macchine(IdxMacchina) on update cascade
|
||||
go
|
||||
|
||||
create table TempiCicloTeorici(
|
||||
IdxMacchina nvarchar(50) not null,
|
||||
DataOraFrom datetime not null,
|
||||
DataOraTo datetime,
|
||||
TempoAssegnato decimal(18,8) not null constraint DF_TempiCicloTeorici_TempoMedio default (1),
|
||||
|
||||
constraint PK_TempiCicloTeorici primary key(IdxMacchina,DataOraFrom)
|
||||
)
|
||||
go
|
||||
|
||||
alter table TempiCicloTeorici add
|
||||
constraint FK_TempiCicloTeorici_Macchine foreign key(IdxMacchina) references Macchine(IdxMacchina) on update cascade
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(15, GETDATE())
|
||||
GO
|
||||
@@ -0,0 +1,215 @@
|
||||
create table AnagClassiTempo(
|
||||
ClasseTempo nvarchar(50) not null constraint PK_AnagClassiTempo primary key,
|
||||
Descrizione nvarchar(500)
|
||||
)
|
||||
go
|
||||
|
||||
|
||||
alter table AnagraficaStati add
|
||||
ClasseTempo nvarchar(50)
|
||||
go
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
INSERT INTO dbo.AnagClassiTempo
|
||||
VALUES (N'T_Auto', N'Macchina in Automatico')
|
||||
INSERT INTO dbo.AnagClassiTempo
|
||||
VALUES (N'T_AutoRun', N'Macchina in Automatico e Lavora')
|
||||
INSERT INTO dbo.AnagClassiTempo
|
||||
VALUES (N'T_Fermo', N'Macchina Ferma')
|
||||
INSERT INTO dbo.AnagClassiTempo
|
||||
VALUES (N'T_ND', N'Macchina non disponibile')
|
||||
go
|
||||
|
||||
commit transaction
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
ClasseTempo=N'T_Auto'
|
||||
WHERE IdxStato=1
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
ClasseTempo=N'T_ND'
|
||||
WHERE IdxStato=2
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
ClasseTempo=N'T_ND'
|
||||
WHERE IdxStato=3
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
ClasseTempo=N'T_Fermo'
|
||||
WHERE IdxStato=4
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
ClasseTempo=N'T_Fermo'
|
||||
WHERE IdxStato=5
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
ClasseTempo=N'T_Fermo'
|
||||
WHERE IdxStato=6
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
ClasseTempo=N'T_Fermo'
|
||||
WHERE IdxStato=7
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
ClasseTempo=N'T_Fermo'
|
||||
WHERE IdxStato=8
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
ClasseTempo=N'T_Fermo'
|
||||
WHERE IdxStato=9
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
ClasseTempo=N'T_ND'
|
||||
WHERE IdxStato=10
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
ClasseTempo=N'T_ND'
|
||||
WHERE IdxStato=11
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
ClasseTempo=N'T_Fermo'
|
||||
WHERE IdxStato=12
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
ClasseTempo=N'T_AutoRun'
|
||||
WHERE IdxStato=13
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
ClasseTempo=N'T_ND'
|
||||
WHERE IdxStato=14
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
ClasseTempo=N'T_Auto'
|
||||
WHERE IdxStato=15
|
||||
go
|
||||
|
||||
commit transaction
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
create table DatiConfermati(
|
||||
IdxConferma int not null identity constraint PK_DatiConfermati primary key,
|
||||
DataOraApp datetime not null,
|
||||
DataRif datetime not null,
|
||||
TurnoRif int,
|
||||
CodArticolo nvarchar(50),
|
||||
IdxMacchina nvarchar(50) not null,
|
||||
TCAssegnato decimal(18,8),
|
||||
MatrOpr int,
|
||||
MatrApp int not null,
|
||||
DataOraFrom datetime,
|
||||
DataOraTo datetime,
|
||||
IdxStato int not null,
|
||||
TotPzProd int,
|
||||
TempoProdotto decimal(18,8),
|
||||
TempoLavoro decimal(18,8),
|
||||
TempoAuto decimal(18,8),
|
||||
TempoFermo decimal(18,8),
|
||||
TotPzFermo int
|
||||
)
|
||||
go
|
||||
|
||||
exec sp_addextendedproperty 'MS_Description', 'matricola dell''operatore che ha lavorato sulla macchina', 'SCHEMA', 'dbo', 'TABLE', 'DatiConfermati', 'COLUMN', 'MatrOpr'
|
||||
go
|
||||
|
||||
exec sp_addextendedproperty 'MS_Description', 'matricola dell''approvatore del record', 'SCHEMA', 'dbo', 'TABLE', 'DatiConfermati', 'COLUMN', 'MatrApp'
|
||||
go
|
||||
|
||||
exec sp_addextendedproperty 'MS_Description', 'pezzi prodotti in ciclo', 'SCHEMA', 'dbo', 'TABLE', 'DatiConfermati', 'COLUMN', 'TotPzProd'
|
||||
go
|
||||
|
||||
exec sp_addextendedproperty 'MS_Description', 'TCAssegnato x num pezzi prodotti', 'SCHEMA', 'dbo', 'TABLE', 'DatiConfermati', 'COLUMN', 'TempoProdotto'
|
||||
go
|
||||
|
||||
exec sp_addextendedproperty 'MS_Description', 'Totale tempo macchina in automatico ed in lavoro', 'SCHEMA', 'dbo', 'TABLE', 'DatiConfermati', 'COLUMN', 'TempoLavoro'
|
||||
go
|
||||
|
||||
exec sp_addextendedproperty 'MS_Description', 'Totale tempo macchina in automatico', 'SCHEMA', 'dbo', 'TABLE', 'DatiConfermati', 'COLUMN', 'TempoAuto'
|
||||
go
|
||||
|
||||
exec sp_addextendedproperty 'MS_Description', 'Totale tempo macchina in fermo (anche ND)', 'SCHEMA', 'dbo', 'TABLE', 'DatiConfermati', 'COLUMN', 'TempoFermo'
|
||||
go
|
||||
|
||||
exec sp_addextendedproperty 'MS_Description', 'pezzi prodotti durante la fermata (es setup)', 'SCHEMA', 'dbo', 'TABLE', 'DatiConfermati', 'COLUMN', 'TotPzFermo'
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
|
||||
create table TabAvvioProduzione(
|
||||
IdxProduzione int not null identity constraint PK_TabAvvioProduzione primary key,
|
||||
CodArticolo nvarchar(50) not null,
|
||||
NumPezzi int not null,
|
||||
TCAssegnato decimal(18,8) not null constraint DF_TabAvvioProduzione_TCAssegnato default (1)
|
||||
)
|
||||
go
|
||||
|
||||
|
||||
drop table TempiCicloRilevati
|
||||
go
|
||||
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
create table TempiCicloRilevati(
|
||||
IdxMacchina nvarchar(50) not null,
|
||||
DataOraRif datetime not null,
|
||||
TCMedio decimal(18,8) not null constraint DF_TempiCicloRilevati_TempoMedio default (1),
|
||||
PzProd int not null constraint DF_TempiCicloRilevati_PzProd default (1),
|
||||
|
||||
constraint PK_TempiCicloRilevati primary key(IdxMacchina,DataOraRif)
|
||||
)
|
||||
go
|
||||
|
||||
alter table TempiCicloRilevati add
|
||||
constraint FK_TempiCicloRilevati_Macchine foreign key(IdxMacchina) references Macchine(IdxMacchina) on update cascade
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
drop table TempiCicloTeorici
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
create table TempiCicloTeorici(
|
||||
IdxMacchina nvarchar(50) not null,
|
||||
DataOraFrom datetime not null,
|
||||
DataOraTo datetime,
|
||||
TCAssegnato decimal(18,8) not null constraint DF_TempiCicloTeorici_TempoMedio default (1),
|
||||
|
||||
constraint PK_TempiCicloTeorici primary key(IdxMacchina,DataOraFrom)
|
||||
)
|
||||
go
|
||||
|
||||
alter table TempiCicloTeorici add
|
||||
constraint FK_TempiCicloTeorici_Macchine foreign key(IdxMacchina) references Macchine(IdxMacchina) on update cascade
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(20, GETDATE())
|
||||
GO
|
||||
@@ -0,0 +1,258 @@
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
drop table TempiCicloRilevati
|
||||
go
|
||||
|
||||
create table TempiCicloRilevati(
|
||||
IdxMacchina nvarchar(50) not null,
|
||||
CodArticolo nvarchar(50) not null,
|
||||
DataOraRif datetime not null,
|
||||
TCMedio decimal(18,8) not null constraint DF_TempiCicloRilevati_TempoMedio default (1),
|
||||
PzProd int not null constraint DF_TempiCicloRilevati_PzProd default (1),
|
||||
|
||||
constraint PK_TempiCicloRilevati primary key(IdxMacchina,CodArticolo,DataOraRif)
|
||||
)
|
||||
go
|
||||
|
||||
alter table TempiCicloRilevati add
|
||||
constraint FK_TempiCicloRilevati_Macchine foreign key(IdxMacchina) references Macchine(IdxMacchina) on update cascade
|
||||
go
|
||||
|
||||
drop table TempiCicloTeorici
|
||||
go
|
||||
|
||||
create table TempiCicloTeorici(
|
||||
IdxMacchina nvarchar(50) not null,
|
||||
CodArticolo nvarchar(50) not null,
|
||||
DataOraFrom datetime not null,
|
||||
DataOraTo datetime,
|
||||
TCAssegnato decimal(18,8) not null constraint DF_TempiCicloTeorici_TempoMedio default (1),
|
||||
|
||||
constraint PK_TempiCicloTeorici primary key(IdxMacchina,CodArticolo,DataOraFrom)
|
||||
)
|
||||
go
|
||||
|
||||
alter table TempiCicloTeorici add
|
||||
constraint FK_TempiCicloTeorici_Macchine foreign key(IdxMacchina) references Macchine(IdxMacchina) on update cascade
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
INSERT INTO dbo.AnagraficaEventi
|
||||
VALUES (20, N'Contapezzi')
|
||||
go
|
||||
|
||||
commit transaction
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
alter table Kanban add
|
||||
CodArticolo nvarchar(50)
|
||||
go
|
||||
|
||||
set ANSI_NULLS on
|
||||
go
|
||||
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
alter table AnagraficaEventi add
|
||||
TabAzione nvarchar(50) constraint DF_AnagraficaEventi_TabAzione default (''),
|
||||
Azione nvarchar(50) constraint DF_AnagraficaEventi_Azione default ('')
|
||||
go
|
||||
|
||||
update AnagraficaEventi set TabAzione='',Azione=''
|
||||
go
|
||||
|
||||
set ANSI_NULLS on
|
||||
go
|
||||
|
||||
create TRIGGER trg_doActions
|
||||
ON EventList
|
||||
FOR INSERT
|
||||
AS
|
||||
|
||||
/* dichiarazione variabili */
|
||||
DECLARE @IdxTipo INT
|
||||
DECLARE @TabAzione NVARCHAR(50)
|
||||
DECLARE @Azione NVARCHAR(50)
|
||||
DECLARE @IdxMacchina NVARCHAR(50)
|
||||
DECLARE @MatricolaKanban NVARCHAR(50)
|
||||
DECLARE @CodArticolo NVARCHAR(50)
|
||||
DECLARE @TCMedio DECIMAL(18,8)
|
||||
DECLARE @DataOra DATETIME
|
||||
DECLARE @DataOraPrec DATETIME
|
||||
|
||||
|
||||
/* recupero valori dell'INSERT */
|
||||
SET @IdxTipo = ( SELECT i.IdxTipo FROM inserted i )
|
||||
SET @IdxMacchina = ( SELECT i.IdxMacchina FROM inserted i )
|
||||
/* recupero altri valori */
|
||||
SET @TabAzione = ( SELECT ISNULL(TabAzione,'') FROM AnagraficaEventi WHERE IdxTipo = @IdxTipo )
|
||||
SET @Azione = ( SELECT ISNULL(Azione,'') FROM AnagraficaEventi WHERE IdxTipo = @IdxTipo )
|
||||
/* controllo se l'evento richieda azioni successive */
|
||||
IF(@TabAzione <> '' AND @Azione <> '')
|
||||
BEGIN
|
||||
/* azioni richieste: seconda dei casi eseguo... */
|
||||
IF(@TabAzione = 'TempiCicloRilevati' AND @Azione = 'Insert')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @DataOra = ( SELECT i.InizioStato FROM inserted i )
|
||||
SET @MatricolaKanban = ( SELECT i.MatricolaKanban FROM inserted i )
|
||||
SET @CodArticolo = ( SELECT CodArticolo FROM Kanban WHERE MatricolaKanban = @MatricolaKanban )
|
||||
/* calcolo tempo tra gli ultimi 2 eventi "contapezzi" */
|
||||
SET @DataOraPrec = ( SELECT ISNULL((SELECT Top 1 InizioStato FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo AND InizioStato < @DataOra ORDER BY InizioStato DESC), @DataOra ) )
|
||||
/* è in millisecondi, divido per 60'000.00 x avere minuti centesimali*/
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(ms, @DataOraPrec, @DataOra) / 60000.00 ) )
|
||||
/* inserisco riga di tempo ciclo */
|
||||
INSERT INTO TempiCicloRilevati
|
||||
VALUES(@IdxMacchina, @CodArticolo, @DataOra, @TCMedio, 1)
|
||||
END
|
||||
END
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
UPDATE dbo.AnagraficaEventi SET
|
||||
TabAzione=N'TempiCicloRilevati', Azione=N'Insert'
|
||||
WHERE IdxTipo=20
|
||||
go
|
||||
|
||||
commit transaction
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
set ANSI_NULLS on
|
||||
go
|
||||
|
||||
alter TRIGGER trg_doActions
|
||||
ON EventList
|
||||
FOR INSERT
|
||||
AS
|
||||
|
||||
/* dichiarazione variabili */
|
||||
DECLARE @IdxTipo INT
|
||||
DECLARE @TabAzione NVARCHAR(50)
|
||||
DECLARE @Azione NVARCHAR(50)
|
||||
DECLARE @IdxMacchina NVARCHAR(50)
|
||||
DECLARE @MatricolaKanban NVARCHAR(50)
|
||||
DECLARE @CodArticolo NVARCHAR(50)
|
||||
DECLARE @TCMedio DECIMAL(18,8)
|
||||
DECLARE @DataOra DATETIME
|
||||
DECLARE @DataOraPrec DATETIME
|
||||
DECLARE @NumPz INT
|
||||
|
||||
|
||||
/* recupero valori dell'INSERT */
|
||||
SET @IdxTipo = ( SELECT i.IdxTipo FROM inserted i )
|
||||
SET @IdxMacchina = ( SELECT i.IdxMacchina FROM inserted i )
|
||||
/* recupero altri valori */
|
||||
SET @TabAzione = ( SELECT ISNULL(TabAzione,'') FROM AnagraficaEventi WHERE IdxTipo = @IdxTipo )
|
||||
SET @Azione = ( SELECT ISNULL(Azione,'') FROM AnagraficaEventi WHERE IdxTipo = @IdxTipo )
|
||||
/* controllo se l'evento richieda azioni successive */
|
||||
IF(@TabAzione <> '' AND @Azione <> '')
|
||||
BEGIN
|
||||
/* azioni richieste: seconda dei casi eseguo... */
|
||||
IF(@TabAzione = 'TempiCicloRilevati' AND @Azione = 'Insert')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @DataOra = ( SELECT i.InizioStato FROM inserted i )
|
||||
SET @MatricolaKanban = ( SELECT i.MatricolaKanban FROM inserted i )
|
||||
SET @NumPz = ( SELECT CASE WHEN (ISNUMERIC(value)=1) THEN value ELSE 1 END FROM inserted i )
|
||||
SET @CodArticolo = ( SELECT CodArticolo FROM Kanban WHERE MatricolaKanban = @MatricolaKanban )
|
||||
/* calcolo tempo tra gli ultimi 2 eventi "contapezzi" */
|
||||
SET @DataOraPrec = ( SELECT ISNULL((SELECT Top 1 InizioStato FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo AND InizioStato < @DataOra ORDER BY InizioStato DESC), @DataOra ) )
|
||||
/* è in millisecondi, divido per 60'000.00 x avere minuti centesimali*/
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(ms, @DataOraPrec, @DataOra) / 60000.00 ) )
|
||||
/* inserisco riga di tempo ciclo */
|
||||
INSERT INTO TempiCicloRilevati
|
||||
VALUES(@IdxMacchina, @CodArticolo, @DataOra, @TCMedio, @NumPz)
|
||||
END
|
||||
END
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
set ANSI_NULLS on
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_TC_getByMacchinaPeriodo
|
||||
* recupera tempi ciclo x machcian e periodo
|
||||
*
|
||||
* modif.: S.E.L. - 2010.12.15
|
||||
**************************************/
|
||||
create PROCEDURE stp_TC_getByMacchinaPeriodo
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@Inizio DATETIME,
|
||||
@Fine DATETIME
|
||||
)
|
||||
AS
|
||||
|
||||
SELECT * FROM TempiCicloRilevati
|
||||
WHERE IdxMacchina = @IdxMacchina AND
|
||||
(DataOraRif >= @Inizio) AND (DataOraRif <= @Fine)
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(25, GETDATE())
|
||||
GO
|
||||
@@ -0,0 +1,223 @@
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
set ANSI_NULLS on
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_TC_getMaxByMacchinaPeriodo
|
||||
* recupera tempi ciclo x macchina e periodo
|
||||
*
|
||||
* modif.: S.E.L. - 2010.12.15
|
||||
**************************************/
|
||||
create PROCEDURE stp_TC_getMaxByMacchinaPeriodo
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@Inizio DATETIME,
|
||||
@Fine DATETIME
|
||||
)
|
||||
AS
|
||||
|
||||
SELECT @IdxMacchina AS IdxMacchina, '' AS CodArticolo, GETDATE() as DataOraRif, MAX(TCMedio) AS TCMedio, 0 AS PzProd FROM TempiCicloRilevati
|
||||
WHERE IdxMacchina = @IdxMacchina AND
|
||||
(DataOraRif >= @Inizio) AND (DataOraRif <= @Fine)
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_TC_getMinByMacchinaPeriodo
|
||||
* recupera tempi ciclo x macchina e periodo
|
||||
*
|
||||
* modif.: S.E.L. - 2010.12.15
|
||||
**************************************/
|
||||
create PROCEDURE stp_TC_getMinByMacchinaPeriodo
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@Inizio DATETIME,
|
||||
@Fine DATETIME
|
||||
)
|
||||
AS
|
||||
|
||||
SELECT @IdxMacchina AS IdxMacchina, '' AS CodArticolo, GETDATE() as DataOraRif, MIN(TCMedio) AS TCMedio, 0 AS PzProd FROM TempiCicloRilevati
|
||||
WHERE IdxMacchina = @IdxMacchina AND
|
||||
(DataOraRif >= @Inizio) AND (DataOraRif <= @Fine)
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
set ANSI_NULLS on
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_TC_getMaxByMacchinaPeriodo
|
||||
* recupera tempi ciclo x macchina e periodo
|
||||
*
|
||||
* modif.: S.E.L. - 2010.12.15
|
||||
**************************************/
|
||||
alter PROCEDURE stp_TC_getMaxByMacchinaPeriodo
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@Inizio DATETIME,
|
||||
@Fine DATETIME
|
||||
)
|
||||
AS
|
||||
|
||||
SELECT @IdxMacchina AS IdxMacchina, '' AS CodArticolo, GETDATE() as DataOraRif, MAX(TCMedio) AS TCMedio, 0 AS PzProd FROM TempiCicloRilevati
|
||||
WHERE IdxMacchina = @IdxMacchina AND
|
||||
(DataOraRif >= @Inizio) AND (DataOraRif <= @Fine)
|
||||
AND TCMedio > 0
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_TC_getMedByMacchinaPeriodo
|
||||
* recupera tempi ciclo x macchina e periodo
|
||||
*
|
||||
* modif.: S.E.L. - 2010.12.24
|
||||
**************************************/
|
||||
create PROCEDURE stp_TC_getMedByMacchinaPeriodo
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@Inizio DATETIME,
|
||||
@Fine DATETIME
|
||||
)
|
||||
AS
|
||||
|
||||
SELECT @IdxMacchina AS IdxMacchina, '' AS CodArticolo, GETDATE() as DataOraRif, SUM(TCMedio * PzProd) / SUM(PzProd) AS TCMedio, 0 AS PzProd FROM TempiCicloRilevati
|
||||
WHERE IdxMacchina = @IdxMacchina AND
|
||||
(DataOraRif >= @Inizio) AND (DataOraRif <= @Fine)
|
||||
AND TCMedio > 0
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_TC_getMinByMacchinaPeriodo
|
||||
* recupera tempi ciclo x macchina e periodo
|
||||
*
|
||||
* modif.: S.E.L. - 2010.12.15
|
||||
**************************************/
|
||||
alter PROCEDURE stp_TC_getMinByMacchinaPeriodo
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@Inizio DATETIME,
|
||||
@Fine DATETIME
|
||||
)
|
||||
AS
|
||||
|
||||
SELECT @IdxMacchina AS IdxMacchina, '' AS CodArticolo, GETDATE() as DataOraRif, MIN(TCMedio) AS TCMedio, 0 AS PzProd FROM TempiCicloRilevati
|
||||
WHERE IdxMacchina = @IdxMacchina AND
|
||||
(DataOraRif >= @Inizio) AND (DataOraRif <= @Fine)
|
||||
AND TCMedio > 0
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
-- =============================================
|
||||
-- Author: Samuele E. Locatelli
|
||||
-- Create date: 2009-03-04
|
||||
-- mod date: 2010-07-14
|
||||
--
|
||||
-- Description: riallineamento con update massivo dati db
|
||||
-- aggiorna i dati nel db per portarli ad essere "odierni" ovvero ultimo evento appena successo
|
||||
-- =============================================
|
||||
alter PROCEDURE stp_ZZZ_riallineaDateDb
|
||||
AS
|
||||
|
||||
DBCC SHOWCONTIG(EventList)
|
||||
DBCC SHOWCONTIG(DiarioDiBordo)
|
||||
|
||||
EXEC USP_DisableEnableNonClusteredIndexes 'Mapo_ColMecc',null, 1 --disabilito indici
|
||||
|
||||
|
||||
PRINT 'inizio UPDATE tabelle...'
|
||||
|
||||
DECLARE @lastData AS DATETIME
|
||||
DECLARE @diff_min as INT
|
||||
|
||||
-- calcolo l'ultima data degli eventi
|
||||
SET @lastData = (SELECT MAX(InizioStato) AS inizio FROM EventList)
|
||||
|
||||
-- ora calcolo la differenza tra quello e la data/ora odierna
|
||||
SET @diff_min = (SELECT DATEDIFF(n, @lastData, getdate()))
|
||||
|
||||
-- aggiorno tabelle di conseguenza modificando le date
|
||||
|
||||
-- aggiorno EventList
|
||||
UPDATE EventList SET InizioStato = DATEADD(n, @diff_min, InizioStato)
|
||||
|
||||
-- aggiorno DiarioDiBordo
|
||||
UPDATE DiarioDiBordo SET InizioStato = DATEADD(n, @diff_min, InizioStato),FineStato = DATEADD(n, @diff_min, FineStato)
|
||||
|
||||
|
||||
-- aggiorno StatoMacchine
|
||||
UPDATE StatoMacchine SET InizioStato = DATEADD(n, @diff_min, InizioStato)
|
||||
|
||||
-- aggiorno KeepAlive
|
||||
UPDATE KeepAlive SET DataOraServer = DATEADD(n, @diff_min, DataOraServer), DataOraMacchina = DATEADD(n, @diff_min, DataOraMacchina), DataOraStart = DATEADD(n, @diff_min, DataOraStart)
|
||||
|
||||
-- aggiorno TC teorici
|
||||
UPDATE TempiCicloTeorici SET DataOraFrom = DATEADD(n, @diff_min, DataOraFrom), DataOraTo = DATEADD(n, @diff_min, DataOraTo)
|
||||
|
||||
-- aggiorno TC rilevati
|
||||
UPDATE TempiCicloRilevati SET DataOraRif = DATEADD(n, @diff_min, DataOraRif)
|
||||
|
||||
|
||||
PRINT 'concluso UPDATE tabelle...'
|
||||
|
||||
|
||||
DBCC SHOWCONTIG(EventList)
|
||||
DBCC SHOWCONTIG(DiarioDiBordo)
|
||||
EXEC USP_DisableEnableNonClusteredIndexes 'Mapo_ColMecc',null, 2 --riattivo indici
|
||||
|
||||
|
||||
--ricostruisco indici
|
||||
PRINT 'ricostruisco indici...'
|
||||
DBCC DBREINDEX(EventList)
|
||||
DBCC DBREINDEX(DiarioDiBordo)
|
||||
DBCC DBREINDEX(TransizioneIngressi)
|
||||
DBCC DBREINDEX(Kanban2ins)
|
||||
DBCC DBREINDEX(Kanban)
|
||||
DBCC DBREINDEX(AnagraficaOperatori)
|
||||
DBCC DBREINDEX(AnagraficaOperatori2ins)
|
||||
|
||||
DBCC SHOWCONTIG(EventList)
|
||||
DBCC SHOWCONTIG(DiarioDiBordo)
|
||||
|
||||
--shrink del db
|
||||
PRINT 'compatto DB...'
|
||||
DBCC SHRINKDATABASE (Mapo_ColMecc)
|
||||
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(30, GETDATE())
|
||||
GO
|
||||
@@ -0,0 +1,172 @@
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
set ANSI_NULLS on
|
||||
go
|
||||
|
||||
-- =============================================
|
||||
-- Author: Samuele E. Locatelli
|
||||
-- Create date: 2011-02-20
|
||||
-- Description:
|
||||
-- =============================================
|
||||
create PROCEDURE stp_zzz_rimuoviDuplicatiConsecutivi
|
||||
-- Add the parameters for the stored procedure here
|
||||
@idxMacchina int
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
|
||||
DECLARE @InizioStato DATETIME, @IdxTipo INT, @MatricolaKanban NVARCHAR(50);
|
||||
DECLARE @InizioStatoPrec DATETIME, @IdxTipoPrec INT, @MatricolaKanbanPrec NVARCHAR(50);
|
||||
DECLARE @messaggio NVARCHAR(500);
|
||||
|
||||
-- mostro conteggio eventi
|
||||
SELECT count(*), DATEPART(DD,InizioStato) AS inizio FROM EventList
|
||||
WHERE IdxMacchina=37
|
||||
GROUP BY DATEPART(DD,InizioStato)
|
||||
|
||||
-- inizializzo valori precedenti
|
||||
SET @InizioStatoPrec = (SELECT Top 1 InizioStato FROM EventList WHERE idxMacchina = @idxMacchina ORDER BY InizioStato ASC);
|
||||
SET @IdxTipoPrec = (SELECT Top 1 IdxTipo FROM EventList WHERE idxMacchina = @idxMacchina ORDER BY InizioStato ASC);
|
||||
SET @MatricolaKanbanPrec = (SELECT Top 1 MatricolaKanban FROM EventList WHERE idxMacchina = @idxMacchina ORDER BY InizioStato ASC);
|
||||
|
||||
-- uso un cursore x percorrere i dati...
|
||||
DECLARE eventiDuplicati CURSOR FOR
|
||||
SELECT InizioStato, IdxTipo, MatricolaKanban
|
||||
FROM EventList
|
||||
WHERE IdxMacchina = @idxMacchina
|
||||
ORDER BY InizioStato;
|
||||
|
||||
OPEN eventiDuplicati;
|
||||
|
||||
FETCH NEXT FROM eventiDuplicati
|
||||
INTO @InizioStato, @IdxTipo,@MatricolaKanban;
|
||||
|
||||
WHILE @@FETCH_STATUS = 0
|
||||
BEGIN
|
||||
-- controllo: se uguali i valori ai precedenti elimino attuale...
|
||||
IF((@InizioStato > @InizioStatoPrec) AND (@IdxTipo = @IdxTipoPrec) AND (@MatricolaKanban = @MatricolaKanbanPrec))
|
||||
BEGIN
|
||||
SELECT @messaggio = '--> Old tipo: ' + CAST(@IdxTipoPrec AS NVARCHAR(50)) + ' - new: ' + CAST(@IdxTipo AS NVARCHAR(50)) + ' | old time: ' + CAST(@InizioStatoPrec AS NVARCHAR(250)) + ' - new: ' +CAST(@InizioStato AS NVARCHAR(250)) + ' | old kanban: ' + CAST(@MatricolaKanbanPrec AS NVARCHAR(250)) + ' - new: ' +CAST(@MatricolaKanban AS NVARCHAR(250));
|
||||
PRINT @messaggio;
|
||||
-- elimino riga errata
|
||||
DELETE FROM EventList
|
||||
WHERE InizioStato=@InizioStato and IdxMacchina=@idxMacchina and IdxTipo=@IdxTipo and MatricolaKanban=@MatricolaKanban;
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
SELECT @messaggio = 'Ok Old tipo: ' + CAST(@IdxTipoPrec AS NVARCHAR(50)) + ' - new: ' + CAST(@IdxTipo AS NVARCHAR(50)) + ' | old time: ' + CAST(@InizioStatoPrec AS NVARCHAR(250)) + ' - new: ' +CAST(@InizioStato AS NVARCHAR(250)) + ' | old kanban: ' + CAST(@MatricolaKanbanPrec AS NVARCHAR(250)) + ' - new: ' +CAST(@MatricolaKanban AS NVARCHAR(250));
|
||||
--PRINT @messaggio;
|
||||
END
|
||||
|
||||
|
||||
SET @InizioStatoPrec = @InizioStato;
|
||||
SET @IdxTipoPrec = @IdxTipo;
|
||||
SET @MatricolaKanbanPrec = @MatricolaKanban;
|
||||
|
||||
-- Get the next values.
|
||||
FETCH NEXT FROM eventiDuplicati
|
||||
INTO @InizioStato, @IdxTipo, @MatricolaKanban;
|
||||
END
|
||||
CLOSE eventiDuplicati;
|
||||
DEALLOCATE eventiDuplicati;
|
||||
|
||||
-- mostro conteggio eventi
|
||||
SELECT count(*), DATEPART(DD,InizioStato) AS inizio FROM EventList
|
||||
WHERE IdxMacchina=37
|
||||
GROUP BY DATEPART(DD,InizioStato)
|
||||
|
||||
END
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
set ANSI_NULLS on
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_TC_getCodArticoliByMacchinaPeriodo
|
||||
* recupera tempi ciclo x machcian e periodo
|
||||
*
|
||||
* modif.: S.E.L. - 2010.12.18
|
||||
**************************************/
|
||||
create PROCEDURE stp_TC_getCodArticoliByMacchinaPeriodo
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@Inizio DATETIME,
|
||||
@Fine DATETIME
|
||||
)
|
||||
AS
|
||||
|
||||
SELECT DISTINCT(CodArticolo) FROM TempiCicloRilevati
|
||||
WHERE IdxMacchina = @IdxMacchina AND
|
||||
(DataOraRif >= @Inizio) AND (DataOraRif <= @Fine)
|
||||
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
set ANSI_NULLS on
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_TC_getByMacchinaPeriodoArticolo
|
||||
* recupera tempi ciclo x macchina, articolo e periodo
|
||||
*
|
||||
* modif.: S.E.L. - 2010.12.18
|
||||
**************************************/
|
||||
create PROCEDURE stp_TC_getByMacchinaPeriodoArticolo
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@CodArticolo NVARCHAR(50),
|
||||
@Inizio DATETIME,
|
||||
@Fine DATETIME
|
||||
)
|
||||
AS
|
||||
|
||||
SELECT * FROM TempiCicloRilevati
|
||||
WHERE IdxMacchina = @IdxMacchina AND CodArticolo = @CodArticolo AND
|
||||
(DataOraRif >= @Inizio) AND (DataOraRif <= @Fine)
|
||||
ORDER BY DataOraRif
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
|
||||
|
||||
alter table DatiMacchine add
|
||||
constraint PK_DatiMacchine primary key(idxMacchina)
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(230, GETDATE())
|
||||
GO
|
||||
@@ -0,0 +1,129 @@
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
set ANSI_NULLS on
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_DDB_getDataFiltered
|
||||
* ottiene i dati nel diario di bordo filtrati x macchina, periodo e durata
|
||||
*
|
||||
* modif.: S.E.L. - 2010.07.13
|
||||
**************************************/
|
||||
alter PROCEDURE stp_DDB_getDataFiltered
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@Inizio DATETIME,
|
||||
@Fine DATETIME,
|
||||
@durataMin FLOAT
|
||||
)
|
||||
AS
|
||||
|
||||
-- controllo fine sia max uguale ad istante attuale
|
||||
DECLARE @adesso DATETIME
|
||||
SET @adesso = GETDATE()
|
||||
|
||||
IF @fine > @adesso
|
||||
BEGIN
|
||||
SET @fine = @adesso
|
||||
END
|
||||
|
||||
SELECT IdxMacchina, InizioStato, ISNULL(FineStato, @Fine) AS FineStato, IdxStato,
|
||||
ISNULL(DurataMinuti, DATEDIFF(s, InizioStato, @Fine)/60) AS DurataMinuti, Value, MatricolaKanban, KanbanCode, TempoCicloBase,
|
||||
PzPalletProd, MatrOpr, pallet
|
||||
FROM DiarioDiBordo
|
||||
WHERE ((IdxMacchina = @IdxMacchina) AND (InizioStato >= @Inizio) AND (InizioStato <= @Fine)) OR
|
||||
((IdxMacchina = @IdxMacchina) AND (FineStato >= @Inizio) AND (FineStato <= @Fine))
|
||||
ORDER BY InizioStato DESC
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
set ANSI_NULLS on
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_DDB_getSequenza
|
||||
* ottiene la serie in sequenza di dati x macchina-periodo con durata > 0
|
||||
*
|
||||
* modif.: S.E.L. - 2010.07.14
|
||||
**************************************/
|
||||
alter PROCEDURE stp_DDB_getSequenza
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@Inizio DATETIME,
|
||||
@Fine DATETIME
|
||||
)
|
||||
AS
|
||||
|
||||
|
||||
SELECT IdxMacchina, InizioStato, ISNULL(FineStato, @Fine) AS FineStato, IdxStato,
|
||||
ISNULL(DurataMinuti, DATEDIFF(n, InizioStato, @Fine)) AS DurataMinuti, Value, MatricolaKanban, KanbanCode, TempoCicloBase,
|
||||
PzPalletProd, MatrOpr, pallet
|
||||
FROM DiarioDiBordo
|
||||
WHERE ((IdxMacchina = @IdxMacchina) AND (InizioStato >= @Inizio) AND (InizioStato <= @Fine)) OR
|
||||
((IdxMacchina = @IdxMacchina) AND (FineStato >= @Inizio) AND (FineStato <= @Fine))
|
||||
ORDER BY InizioStato
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
INSERT INTO dbo.Permessi
|
||||
VALUES ('ADMIN_kanban', 'caricaUpdateKanban.aspx', 5, 3, 'UpdateKanban', 'UpdateKanbanExpl')
|
||||
INSERT INTO dbo.Permessi
|
||||
VALUES ('ADMIN_operatori', 'caricaUpdateOperatori.aspx', 5, 4, 'UpdateOperatori', 'UpdateOperatoriExpl')
|
||||
UPDATE dbo.Permessi SET
|
||||
URL='~/../MoonPro/MappaStato.aspx'
|
||||
WHERE COD_PERMESSO='MAP'
|
||||
go
|
||||
|
||||
commit transaction
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
INSERT INTO dbo.Permessi2Funzione
|
||||
VALUES ('ADMIN_kanban', N'MoonPro_admin', 'S')
|
||||
INSERT INTO dbo.Permessi2Funzione
|
||||
VALUES ('ADMIN_operatori', N'MoonPro_admin', 'S')
|
||||
go
|
||||
|
||||
commit transaction
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(235, GETDATE())
|
||||
GO
|
||||
@@ -0,0 +1,55 @@
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
set ANSI_NULLS on
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_DDB_getDataFiltered
|
||||
* ottiene i dati nel diario di bordo filtrati x macchina, periodo e durata
|
||||
*
|
||||
* modif.: S.E.L. - 2010.07.13
|
||||
**************************************/
|
||||
alter PROCEDURE stp_DDB_getDataFiltered
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@Inizio DATETIME,
|
||||
@Fine DATETIME,
|
||||
@durataMin FLOAT
|
||||
)
|
||||
AS
|
||||
|
||||
-- controllo fine sia max uguale ad istante attuale
|
||||
DECLARE @adesso DATETIME
|
||||
SET @adesso = GETDATE()
|
||||
|
||||
IF @fine > @adesso
|
||||
BEGIN
|
||||
SET @fine = @adesso
|
||||
END
|
||||
|
||||
SELECT IdxMacchina, InizioStato, ISNULL(FineStato, @Fine) AS FineStato, IdxStato,
|
||||
ISNULL(DurataMinuti, DATEDIFF(s, InizioStato, @Fine)/60) AS DurataMinuti, Value, MatricolaKanban, KanbanCode, TempoCicloBase,
|
||||
PzPalletProd, MatrOpr, pallet
|
||||
FROM DiarioDiBordo
|
||||
WHERE ((IdxMacchina = @IdxMacchina) AND (InizioStato >= @Inizio) AND (InizioStato <= @Fine)) OR
|
||||
((IdxMacchina = @IdxMacchina) AND (FineStato >= @Inizio) AND (FineStato <= @Fine))
|
||||
ORDER BY InizioStato DESC
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(236, GETDATE())
|
||||
GO
|
||||
@@ -0,0 +1,124 @@
|
||||
-- =============================================
|
||||
-- Author: Samuele E. Locatelli
|
||||
-- Create date: 2009-03-04
|
||||
-- mod date: 2010-07-14
|
||||
--
|
||||
-- Description: riallineamento con update massivo dati db
|
||||
-- aggiorna i dati nel db per portarli ad essere "odierni" ovvero ultimo evento appena successo
|
||||
-- =============================================
|
||||
ALTER PROCEDURE [dbo].[stp_ZZZ_riallineaDateDb]
|
||||
AS
|
||||
|
||||
DBCC SHOWCONTIG(EventList)
|
||||
DBCC SHOWCONTIG(DiarioDiBordo)
|
||||
|
||||
EXEC USP_DisableEnableNonClusteredIndexes 'MoonPro',null, 1 --disabilito indici
|
||||
|
||||
|
||||
PRINT 'inizio UPDATE tabelle...'
|
||||
|
||||
DECLARE @lastData AS DATETIME
|
||||
DECLARE @diff_min as INT
|
||||
|
||||
-- calcolo l'ultima data degli eventi
|
||||
SET @lastData = (SELECT MAX(InizioStato) AS inizio FROM DiarioDiBordo )--WHERE IdxMacchina < 99)
|
||||
|
||||
-- elimino gli eventi della macchina test DOPO @lastData...
|
||||
DELETE FROM EventList WHERE IdxMacchina = 99 AND InizioStato > @lastData
|
||||
|
||||
-- elimino da diario di bordo della macchina test DOPO @lastData...
|
||||
DELETE FROM DiarioDiBordo WHERE IdxMacchina = 99 AND InizioStato > @lastData
|
||||
|
||||
-- elimino da tempi ciclo teorici della macchina test DOPO @lastData...
|
||||
DELETE FROM TempiCicloTeorici WHERE IdxMacchina = 99 AND DataOraFrom > @lastData
|
||||
|
||||
-- elimino da tempi ciclo rilevati della macchina test DOPO @lastData...
|
||||
DELETE FROM TempiCicloRilevati WHERE IdxMacchina = 99 AND DataOraRif > @lastData
|
||||
|
||||
-- ora calcolo la differenza tra quello e la data/ora odierna
|
||||
SET @diff_min = (SELECT DATEDIFF(n, @lastData, getdate()))
|
||||
|
||||
-- aggiorno tabelle di conseguenza modificando le date
|
||||
|
||||
-- aggiorno EventList
|
||||
UPDATE EventList SET InizioStato = DATEADD(n, @diff_min, InizioStato)
|
||||
|
||||
-- aggiorno DiarioDiBordo
|
||||
UPDATE DiarioDiBordo SET InizioStato = DATEADD(n, @diff_min, InizioStato),FineStato = DATEADD(n, @diff_min, FineStato)
|
||||
|
||||
|
||||
-- aggiorno StatoMacchine
|
||||
UPDATE StatoMacchine SET InizioStato = DATEADD(n, @diff_min, InizioStato)
|
||||
|
||||
-- aggiorno KeepAlive
|
||||
UPDATE KeepAlive SET DataOraServer = DATEADD(n, @diff_min, DataOraServer), DataOraMacchina = DATEADD(n, @diff_min, DataOraMacchina), DataOraStart = DATEADD(n, @diff_min, DataOraStart)
|
||||
|
||||
-- aggiorno TC teorici
|
||||
UPDATE TempiCicloTeorici SET DataOraFrom = DATEADD(n, @diff_min, DataOraFrom), DataOraTo = DATEADD(n, @diff_min, DataOraTo)
|
||||
|
||||
-- aggiorno TC rilevati
|
||||
UPDATE TempiCicloRilevati SET DataOraRif = DATEADD(n, @diff_min, DataOraRif)
|
||||
|
||||
-- aggiorno Dati confermati
|
||||
UPDATE DatiConfermati SET DataOraApp = DATEADD(n, @diff_min, DataOraApp), DataRif = DATEADD(n, @diff_min, DataRif), DataOraFrom = DATEADD(n, @diff_min, DataOraFrom), DataOraTo = DATEADD(n, @diff_min, DataOraTo)
|
||||
|
||||
|
||||
PRINT 'concluso UPDATE tabelle...'
|
||||
|
||||
|
||||
DBCC SHOWCONTIG(EventList)
|
||||
DBCC SHOWCONTIG(DiarioDiBordo)
|
||||
EXEC USP_DisableEnableNonClusteredIndexes 'MoonPro',null, 2 --riattivo indici
|
||||
|
||||
|
||||
--ricostruisco indici
|
||||
PRINT 'ricostruisco indici...'
|
||||
DBCC DBREINDEX(EventList)
|
||||
DBCC DBREINDEX(DiarioDiBordo)
|
||||
DBCC DBREINDEX(TransizioneIngressi)
|
||||
DBCC DBREINDEX(Kanban2ins)
|
||||
DBCC DBREINDEX(Kanban)
|
||||
DBCC DBREINDEX(AnagraficaOperatori)
|
||||
DBCC DBREINDEX(AnagraficaOperatori2ins)
|
||||
|
||||
DBCC SHOWCONTIG(EventList)
|
||||
DBCC SHOWCONTIG(DiarioDiBordo)
|
||||
|
||||
--shrink del db
|
||||
PRINT 'compatto DB...'
|
||||
DBCC SHRINKDATABASE (MoonPro)
|
||||
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_DatiCOnf_getByMacchPeriodo
|
||||
*
|
||||
* recupera i dati confermati x una amcchina e periodo, ordinati in data DESC
|
||||
*
|
||||
* modif.: S.E.L.
|
||||
* il: 2008.08.07
|
||||
**************************************/
|
||||
create PROCEDURE dbo.stp_DatiConf_getByMacchPeriodo
|
||||
(
|
||||
@idxMacchina NVARCHAR(50),
|
||||
@dataFrom DATETIME,
|
||||
@dataTo DATETIME
|
||||
)
|
||||
AS
|
||||
|
||||
SELECT *
|
||||
FROM DatiConfermati
|
||||
WHERE IdxMacchina = @idxMacchina AND (DataRif >= @dataFrom AND DataRif <= @dataTo)
|
||||
ORDER BY DataRif DESC
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(240, GETDATE())
|
||||
GO
|
||||
@@ -0,0 +1,538 @@
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
set ANSI_NULLS on
|
||||
go
|
||||
|
||||
-- =============================================
|
||||
-- TRIGGER trg_kanban4articoloIns
|
||||
--
|
||||
-- Author: S.E.L.
|
||||
-- Create date: 2011.05.17
|
||||
-- Description: Controlla esistenza etichette kanban per l'articolo creato ed in caso sia necessario le crea
|
||||
-- =============================================
|
||||
create TRIGGER trg_kanban4articoloIns
|
||||
ON AnagArticoli
|
||||
AFTER INSERT
|
||||
AS
|
||||
BEGIN
|
||||
-- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET NOCOUNT ON;
|
||||
|
||||
-- seleziono il nuovo articolo...
|
||||
DECLARE @kanbanTrovati INT
|
||||
DECLARE @CodArticolo NVARCHAR(50)
|
||||
|
||||
SET @CodArticolo = ( SELECT CodArticolo FROM inserted )
|
||||
-- ...e cerco se ci sia un kanban x tale articolo tabella
|
||||
SET @kanbanTrovati = ( SELECT ISNULL(COUNT(*),0) FROM Kanban WHERE CodArticolo = @CodArticolo )
|
||||
|
||||
-- se non ne ho trovati creo articolo!
|
||||
IF(@kanbanTrovati = 0)
|
||||
BEGIN
|
||||
-- inserisco nuovo articolo!
|
||||
INSERT INTO Kanban(MatricolaKanban, KanbanCode, TempoCicloBase, PzPallet, CodArticolo)
|
||||
VALUES ('KA'+@CodArticolo, @CodArticolo, 1, 1, @CodArticolo)
|
||||
END
|
||||
|
||||
END
|
||||
go
|
||||
|
||||
-- =============================================
|
||||
-- TRIGGER trg_kanban4articoloUpd
|
||||
--
|
||||
-- Author: S.E.L.
|
||||
-- Create date: 2011.05.17
|
||||
-- Description: Controlla esistenza etichette kanban per l'articolo modificato ed in caso sia necessario le modifica
|
||||
-- =============================================
|
||||
create TRIGGER trg_kanban4articoloUpd
|
||||
ON AnagArticoli
|
||||
AFTER UPDATE
|
||||
AS
|
||||
BEGIN
|
||||
-- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET NOCOUNT ON;
|
||||
|
||||
-- solo se è stato aggiornato codice articolo...
|
||||
IF UPDATE(CodArticolo)
|
||||
BEGIN
|
||||
-- seleziono l'articolo...
|
||||
DECLARE @kanbanTrovati INT
|
||||
DECLARE @CodArticoloOld NVARCHAR(50)
|
||||
DECLARE @CodArticoloNew NVARCHAR(50)
|
||||
|
||||
SET @CodArticoloOld = ( SELECT CodArticolo FROM deleted )
|
||||
SET @CodArticoloNew = ( SELECT CodArticolo FROM inserted )
|
||||
-- ...e cerco se ci sia un kanban x tale articolo tabella
|
||||
SET @kanbanTrovati = ( SELECT ISNULL(COUNT(*),0) FROM Kanban WHERE CodArticolo = @CodArticoloOld )
|
||||
|
||||
-- se non ne ho trovati creo articolo!
|
||||
IF(@kanbanTrovati = 0)
|
||||
BEGIN
|
||||
-- inserisco nuovo articolo!
|
||||
INSERT INTO Kanban(MatricolaKanban, KanbanCode, TempoCicloBase, PzPallet, CodArticolo)
|
||||
VALUES ('KA'+@CodArticoloNew, @CodArticoloNew, 1, 1, @CodArticoloNew)
|
||||
END
|
||||
ELSE -- altrimenti aggiorno!
|
||||
BEGIN
|
||||
UPDATE Kanban
|
||||
SET MatricolaKanban = 'KA'+@CodArticoloNew,
|
||||
CodArticolo = @CodArticoloNew,
|
||||
KanbanCode = @CodArticoloNew
|
||||
WHERE CodArticolo = @CodArticoloOld
|
||||
END
|
||||
END
|
||||
END
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
set ANSI_NULLS on
|
||||
go
|
||||
|
||||
create TRIGGER trg_updateKanban
|
||||
ON EventList
|
||||
FOR INSERT
|
||||
AS /* dichiarazione variabili */
|
||||
DECLARE @IdxTipo INT
|
||||
DECLARE @TabAzione NVARCHAR(50)
|
||||
DECLARE @Azione NVARCHAR(50)
|
||||
DECLARE @IdxMacchina NVARCHAR(50)
|
||||
DECLARE @MatricolaKanban NVARCHAR(50)
|
||||
DECLARE @MatricolaKanbanOk NVARCHAR(50)
|
||||
DECLARE @CodArticolo NVARCHAR(50)
|
||||
DECLARE @TCMedio DECIMAL(18,8)
|
||||
DECLARE @DataOra DATETIME
|
||||
DECLARE @DataOraPrec DATETIME
|
||||
DECLARE @NumPz INT
|
||||
|
||||
/* recupero valori dell'INSERT */
|
||||
SET @IdxTipo = ( SELECT i.IdxTipo FROM inserted i )
|
||||
SET @IdxMacchina = ( SELECT i.IdxMacchina FROM inserted i )
|
||||
/* recupero altri valori */
|
||||
SET @TabAzione = ( SELECT ISNULL(TabAzione,'') FROM AnagraficaEventi WHERE IdxTipo = @IdxTipo )
|
||||
SET @Azione = ( SELECT ISNULL(Azione,'') FROM AnagraficaEventi WHERE IdxTipo = @IdxTipo )
|
||||
/* controllo se l'evento richieda azioni successive */
|
||||
IF(@TabAzione <> '' AND @Azione <> '')
|
||||
BEGIN
|
||||
/* azioni richieste: seconda dei casi eseguo... */
|
||||
IF(@TabAzione = 'TempiCicloRilevati' AND @Azione = 'Insert')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @DataOra = ( SELECT i.InizioStato FROM inserted i )
|
||||
SET @MatricolaKanban = ( SELECT i.MatricolaKanban FROM inserted i )
|
||||
SET @NumPz = ( SELECT CASE WHEN (ISNUMERIC(value)=1) THEN value ELSE 1 END FROM inserted i )
|
||||
SET @CodArticolo = ( SELECT CodArticolo FROM Kanban WHERE MatricolaKanban = @MatricolaKanban )
|
||||
/* calcolo tempo tra gli ultimi 2 eventi "contapezzi" */
|
||||
SET @DataOraPrec = ( SELECT ISNULL((SELECT Top 1 InizioStato FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo AND InizioStato < @DataOra ORDER BY InizioStato DESC), @DataOra ) )
|
||||
/* è in millisecondi, divido per 60'000.00 x avere minuti centesimali*/
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(ms, @DataOraPrec, @DataOra) / 60000.00 ) )
|
||||
/* inserisco riga di tempo ciclo */
|
||||
INSERT INTO TempiCicloRilevati
|
||||
VALUES(@IdxMacchina, @CodArticolo, @DataOra, @TCMedio, @NumPz)
|
||||
END
|
||||
ELSE IF(@TabAzione = 'TempiCicloRilevati' AND @Azione = 'Stop2StartCiclo')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @DataOra = ( SELECT i.InizioStato FROM inserted i )
|
||||
SET @MatricolaKanban = ( SELECT i.MatricolaKanban FROM inserted i )
|
||||
/* prendo la matricola dall'evento inizio (precedente) */
|
||||
SET @MatricolaKanbanOk = ( SELECT ISNULL((SELECT Top 1 MatricolaKanban FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo - 1 AND InizioStato < @DataOra ORDER BY InizioStato DESC), @MatricolaKanban ) )
|
||||
|
||||
-- calcolare num pezzi da codice...
|
||||
SET @NumPz = ( SELECT CASE WHEN (ISNUMERIC(value)=1) THEN value ELSE 1 END FROM inserted i )
|
||||
SET @CodArticolo = ( SELECT CodArticolo FROM Kanban WHERE MatricolaKanban = @MatricolaKanbanOk )
|
||||
/* calcolo tempo tra eventi "contapezzi" inizio - fine NB: idxEvento per fine è idxEvento inizio + 1 ... HARD CODED!!! */
|
||||
SET @DataOraPrec = ( SELECT ISNULL((SELECT Top 1 InizioStato FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo - 1 AND InizioStato < @DataOra ORDER BY InizioStato DESC), @DataOra ) )
|
||||
/* è in millisecondi, divido per 60'000.00 x avere minuti centesimali*/
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(ms, @DataOraPrec, @DataOra) / 60000.00 ) )
|
||||
/* inserisco riga di tempo ciclo */
|
||||
INSERT INTO TempiCicloRilevati
|
||||
VALUES(@IdxMacchina, @CodArticolo, @DataOra, @TCMedio, @NumPz)
|
||||
END
|
||||
ELSE IF(@TabAzione = 'TempiCicloRilevati' AND @Azione = 'Stop2StopCiclo')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @DataOra = ( SELECT i.InizioStato FROM inserted i )
|
||||
SET @MatricolaKanban = ( SELECT i.MatricolaKanban FROM inserted i )
|
||||
/* prendo la matricola dall'evento inizio (precedente) */
|
||||
SET @MatricolaKanbanOk = ( SELECT ISNULL((SELECT Top 1 MatricolaKanban FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo AND InizioStato < @DataOra ORDER BY InizioStato DESC), @MatricolaKanban ) )
|
||||
|
||||
-- calcolare num pezzi da codice...
|
||||
SET @NumPz = ( SELECT PzPallet FROM Kanban WHERE MatricolaKanban = @MatricolaKanbanOk )
|
||||
SET @CodArticolo = ( SELECT CodArticolo FROM Kanban WHERE MatricolaKanban = @MatricolaKanbanOk )
|
||||
/* calcolo tempo tra eventi "contapezzi" fine - fine NB: idxEvento per fine è idxEvento inizio + 1 ... HARD CODED!!! */
|
||||
SET @DataOraPrec = ( SELECT ISNULL((SELECT Top 1 InizioStato FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo AND InizioStato < @DataOra ORDER BY InizioStato DESC), @DataOra ) )
|
||||
/* è in millisecondi, divido per 60'000.00 x avere minuti centesimali*/
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(ms, @DataOraPrec, @DataOra) / 60000.00 ) )
|
||||
/* inserisco riga di tempo ciclo */
|
||||
INSERT INTO TempiCicloRilevati
|
||||
VALUES(@IdxMacchina, @CodArticolo, @DataOra, @TCMedio, @NumPz)
|
||||
END
|
||||
END
|
||||
go
|
||||
|
||||
/***************************************************
|
||||
* Trigger trg_doActions
|
||||
*
|
||||
* processa eventuali azioni legate ad un inserimento evento
|
||||
*
|
||||
* modificato: S.E.L.
|
||||
* 2011.05.18
|
||||
*
|
||||
***************************************************/
|
||||
alter TRIGGER trg_doActions
|
||||
ON EventList
|
||||
FOR INSERT
|
||||
AS /* dichiarazione variabili */
|
||||
DECLARE @IdxTipo INT
|
||||
DECLARE @TabAzione NVARCHAR(50)
|
||||
DECLARE @Azione NVARCHAR(50)
|
||||
DECLARE @IdxMacchina NVARCHAR(50)
|
||||
DECLARE @MatricolaKanban NVARCHAR(50)
|
||||
DECLARE @MatricolaKanbanOk NVARCHAR(50)
|
||||
DECLARE @CodArticolo NVARCHAR(50)
|
||||
DECLARE @TCMedio DECIMAL(18,8)
|
||||
DECLARE @DataOra DATETIME
|
||||
DECLARE @DataOraPrec DATETIME
|
||||
DECLARE @NumPz INT
|
||||
|
||||
/* recupero valori dell'INSERT */
|
||||
SET @IdxTipo = ( SELECT i.IdxTipo FROM inserted i )
|
||||
SET @IdxMacchina = ( SELECT i.IdxMacchina FROM inserted i )
|
||||
/* recupero altri valori */
|
||||
SET @TabAzione = ( SELECT ISNULL(TabAzione,'') FROM AnagraficaEventi WHERE IdxTipo = @IdxTipo )
|
||||
SET @Azione = ( SELECT ISNULL(Azione,'') FROM AnagraficaEventi WHERE IdxTipo = @IdxTipo )
|
||||
/* controllo se l'evento richieda azioni successive */
|
||||
IF(@TabAzione <> '' AND @Azione <> '')
|
||||
BEGIN
|
||||
/* azioni richieste: seconda dei casi eseguo... */
|
||||
|
||||
/******************************************
|
||||
*
|
||||
* Calcolo tempo ciclo per INIZIO
|
||||
*
|
||||
******************************************/
|
||||
IF(@TabAzione = 'TempiCicloRilevati' AND @Azione = 'Insert')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @DataOra = ( SELECT i.InizioStato FROM inserted i )
|
||||
SET @MatricolaKanban = ( SELECT i.MatricolaKanban FROM inserted i )
|
||||
SET @NumPz = ( SELECT CASE WHEN (ISNUMERIC(value)=1) THEN value ELSE 1 END FROM inserted i )
|
||||
SET @CodArticolo = ( SELECT CodArticolo FROM Kanban WHERE MatricolaKanban = @MatricolaKanban )
|
||||
/* calcolo tempo tra gli ultimi 2 eventi "contapezzi" */
|
||||
SET @DataOraPrec = ( SELECT ISNULL((SELECT Top 1 InizioStato FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo AND InizioStato < @DataOra ORDER BY InizioStato DESC), @DataOra ) )
|
||||
/* è in millisecondi, divido per 60'000.00 x avere minuti centesimali*/
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(ms, @DataOraPrec, @DataOra) / 60000.00 ) )
|
||||
/* inserisco riga di tempo ciclo */
|
||||
INSERT INTO TempiCicloRilevati
|
||||
VALUES(@IdxMacchina, @CodArticolo, @DataOra, @TCMedio, @NumPz)
|
||||
END
|
||||
/******************************************
|
||||
*
|
||||
* Calcolo tempo ciclo con logica stop/start
|
||||
*
|
||||
******************************************/
|
||||
ELSE IF(@TabAzione = 'TempiCicloRilevati' AND @Azione = 'Stop2StartCiclo')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @DataOra = ( SELECT i.InizioStato FROM inserted i )
|
||||
SET @MatricolaKanban = ( SELECT i.MatricolaKanban FROM inserted i )
|
||||
/* prendo la matricola dall'evento inizio (precedente) */
|
||||
SET @MatricolaKanbanOk = ( SELECT ISNULL((SELECT Top 1 MatricolaKanban FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo - 1 AND InizioStato < @DataOra ORDER BY InizioStato DESC), @MatricolaKanban ) )
|
||||
|
||||
-- calcolare num pezzi da codice...
|
||||
SET @NumPz = ( SELECT CASE WHEN (ISNUMERIC(value)=1) THEN value ELSE 1 END FROM inserted i )
|
||||
SET @CodArticolo = ( SELECT CodArticolo FROM Kanban WHERE MatricolaKanban = @MatricolaKanbanOk )
|
||||
/* calcolo tempo tra eventi "contapezzi" inizio - fine NB: idxEvento per fine è idxEvento inizio + 1 ... HARD CODED!!! */
|
||||
SET @DataOraPrec = ( SELECT ISNULL((SELECT Top 1 InizioStato FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo - 1 AND InizioStato < @DataOra ORDER BY InizioStato DESC), @DataOra ) )
|
||||
/* è in millisecondi, divido per 60'000.00 x avere minuti centesimali*/
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(ms, @DataOraPrec, @DataOra) / 60000.00 ) )
|
||||
/* inserisco riga di tempo ciclo */
|
||||
INSERT INTO TempiCicloRilevati
|
||||
VALUES(@IdxMacchina, @CodArticolo, @DataOra, @TCMedio, @NumPz)
|
||||
END
|
||||
/******************************************
|
||||
*
|
||||
* calcolo tempo ciclo con logica stop/stop
|
||||
*
|
||||
******************************************/
|
||||
ELSE IF(@TabAzione = 'TempiCicloRilevati' AND @Azione = 'Stop2StopCiclo')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @DataOra = ( SELECT i.InizioStato FROM inserted i )
|
||||
SET @MatricolaKanban = ( SELECT i.MatricolaKanban FROM inserted i )
|
||||
/* prendo la matricola dall'evento inizio (precedente) */
|
||||
SET @MatricolaKanbanOk = ( SELECT ISNULL((SELECT Top 1 MatricolaKanban FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo AND InizioStato < @DataOra ORDER BY InizioStato DESC), @MatricolaKanban ) )
|
||||
|
||||
-- calcolare num pezzi da codice...
|
||||
SET @NumPz = ( SELECT PzPallet FROM Kanban WHERE MatricolaKanban = @MatricolaKanbanOk )
|
||||
SET @CodArticolo = ( SELECT CodArticolo FROM Kanban WHERE MatricolaKanban = @MatricolaKanbanOk )
|
||||
/* calcolo tempo tra eventi "contapezzi" fine - fine NB: idxEvento per fine è idxEvento inizio + 1 ... HARD CODED!!! */
|
||||
SET @DataOraPrec = ( SELECT ISNULL((SELECT Top 1 InizioStato FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo AND InizioStato < @DataOra ORDER BY InizioStato DESC), @DataOra ) )
|
||||
/* è in millisecondi, divido per 60'000.00 x avere minuti centesimali*/
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(ms, @DataOraPrec, @DataOra) / 60000.00 ) )
|
||||
/* inserisco riga di tempo ciclo */
|
||||
INSERT INTO TempiCicloRilevati
|
||||
VALUES(@IdxMacchina, @CodArticolo, @DataOra, @TCMedio, @NumPz)
|
||||
END
|
||||
/******************************************
|
||||
*
|
||||
* Aggiorno kanban in dati macchine per
|
||||
* INIZIO ATTREZZAGGIO
|
||||
*
|
||||
******************************************/
|
||||
ELSE IF(@TabAzione = 'DatiMacchine' AND @Azione = 'Inizio')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @MatricolaKanban = ( SELECT i.MatricolaKanban FROM inserted i )
|
||||
/* aggiorno riga di dati macchina */
|
||||
UPDATE DatiMacchine
|
||||
SET kanban_A = @MatricolaKanban,
|
||||
kanban_B = @MatricolaKanban
|
||||
WHERE idxMacchina = @IdxMacchina
|
||||
/* aggiorno stato macchina */
|
||||
UPDATE StatoMacchine
|
||||
SET MatricolaKanban = @MatricolaKanban
|
||||
WHERE idxMacchina = @IdxMacchina
|
||||
/* aggiorno dati kanban statoMacchine... */
|
||||
UPDATE StatoMacchine
|
||||
SET KanbanCode = k.KanbanCode, TempoCicloBase = k.TempoCicloBase, PzPalletProd = k.PzPallet
|
||||
FROM Kanban AS k INNER JOIN StatoMacchine ON k.MatricolaKanban = StatoMacchine.MatricolaKanban
|
||||
WHERE (StatoMacchine.idxMacchina = @IdxMacchina)
|
||||
END
|
||||
/******************************************
|
||||
*
|
||||
* Aggiorno kanban in dati macchine per
|
||||
* FINE PRODUZIONE
|
||||
*
|
||||
******************************************/
|
||||
ELSE IF(@TabAzione = 'DatiMacchine' AND @Azione = 'Fine')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @MatricolaKanban = 'KAND' -- kanban non definito !!!HARD CODED!!!
|
||||
/* aggiorno riga di dati macchina */
|
||||
UPDATE DatiMacchine
|
||||
SET kanban_A = @MatricolaKanban,
|
||||
kanban_B = @MatricolaKanban
|
||||
WHERE idxMacchina = @IdxMacchina
|
||||
/* aggiorno stato macchina */
|
||||
UPDATE StatoMacchine
|
||||
SET MatricolaKanban = @MatricolaKanban
|
||||
WHERE idxMacchina = @IdxMacchina
|
||||
/* aggiorno dati kanban statoMacchine... */
|
||||
UPDATE StatoMacchine
|
||||
SET KanbanCode = k.KanbanCode, TempoCicloBase = k.TempoCicloBase, PzPalletProd = k.PzPallet
|
||||
FROM Kanban AS k INNER JOIN StatoMacchine ON k.MatricolaKanban = StatoMacchine.MatricolaKanban
|
||||
WHERE (StatoMacchine.idxMacchina = @IdxMacchina)
|
||||
|
||||
END
|
||||
END
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
set ANSI_NULLS on
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* Function f_turnoByDate
|
||||
* calcola il turno in cui cade una data
|
||||
*
|
||||
* modif.: S.E.L.
|
||||
* il: 2011.03.30
|
||||
**************************************/
|
||||
create FUNCTION f_oreNdPeriodo
|
||||
(
|
||||
@dataFrom DATETIME,
|
||||
@dataTo DATETIME
|
||||
)
|
||||
RETURNS DECIMAL(18,8)
|
||||
AS
|
||||
BEGIN
|
||||
/*
|
||||
per farlo va reinserito codice come GIM in questo modo...
|
||||
- tempo totale iniziale c'è...
|
||||
A) va tolto tempo dell'apertura std
|
||||
B) vanno tolte le fermate tipo ferie, chiusure...x la loro durata std
|
||||
|
||||
|
||||
*/
|
||||
|
||||
RETURN 0.0
|
||||
END
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
set ANSI_NULLS on
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_DP_ricalcolaTempi
|
||||
*
|
||||
* calcola i tempi
|
||||
* - T_AutoRun (lavorazione in auto)
|
||||
* - T_Auto (in auto sia lavora che non lavora)
|
||||
* - T_fermo (tempo fermata)
|
||||
* - T_ND (tempo ND)
|
||||
*
|
||||
* dato una riga di dichairazione produzione (prendendo come riferimento i tempi from/to)
|
||||
*
|
||||
* modif.: S.E.L. - 2011.04.18
|
||||
**************************************/
|
||||
alter PROCEDURE stp_DP_ricalcolaTempi
|
||||
(
|
||||
@idxConferma INT
|
||||
)
|
||||
AS
|
||||
|
||||
BEGIN TRAN
|
||||
-- dichiaro variabili
|
||||
DECLARE @DataFrom AS DATETIME
|
||||
DECLARE @DataTo AS DATETIME
|
||||
DECLARE @IdxMacchina AS NVARCHAR(50)
|
||||
|
||||
-- variabili tempo
|
||||
DECLARE @TempoCron DECIMAL(18,8)
|
||||
DECLARE @TempoND DECIMAL(18,8)
|
||||
DECLARE @TempoApertura DECIMAL(18,8)
|
||||
DECLARE @TempoOFF DECIMAL(18,8)
|
||||
DECLARE @TempoON DECIMAL(18,8)
|
||||
DECLARE @TempoFermoON DECIMAL(18,8)
|
||||
DECLARE @TempoAuto DECIMAL(18,8)
|
||||
DECLARE @TempoFermoAuto DECIMAL(18,8)
|
||||
DECLARE @TempoRun DECIMAL(18,8)
|
||||
|
||||
-- setto date
|
||||
SET @DataFrom = ( SELECT DataOraFrom FROM DatiConfermati WHERE IdxConferma = @idxConferma )
|
||||
SET @DataTo = ( SELECT DataOraTo FROM DatiConfermati WHERE IdxConferma = @idxConferma )
|
||||
SET @IdxMacchina = ( SELECT IdxMacchina FROM DatiConfermati WHERE IdxConferma = @idxConferma )
|
||||
|
||||
-- calcolo i tempi
|
||||
SET @TempoCron = ( SELECT CAST(ISNULL(DATEDIFF (n, @DataFrom, @DataTo), 0) AS DECIMAL(18,8)) / 60)
|
||||
SET @TempoND = dbo.f_oreNdPeriodo(@DataFrom, @DataTo)-- 0 -- FARE!!! (SELECT DATEDIFF (n, DataOraFrom, DataOraTo) / 60 FROM DatiConfermati WHERE IdxConferma = @idxConferma )
|
||||
|
||||
|
||||
|
||||
SET @TempoApertura = @TempoCron - @TempoND
|
||||
SET @TempoOFF = ( SELECT CAST(ISNULL(SUM(ddb.DurataMinuti),0) AS DECIMAL(18,8)) / 60 AS ore FROM DiarioDiBordo ddb
|
||||
INNER JOIN AnagraficaStati a ON ddb.IdxStato = a.IdxStato
|
||||
WHERE (a.ClasseTempo = 'T_OFF')
|
||||
AND (ddb.IdxMacchina = @IdxMacchina)
|
||||
AND (ddb.InizioStato >= @DataFrom)
|
||||
AND (ddb.FineStato <= @DataTo) )-- sistemare eventuali eventi sui bordi inizio/fine
|
||||
SET @TempoON = @TempoApertura - @TempoOFF
|
||||
SET @TempoFermoON = ( SELECT CAST(ISNULL(SUM(ddb.DurataMinuti),0) AS DECIMAL(18,8)) / 60 AS ore FROM DiarioDiBordo ddb
|
||||
INNER JOIN AnagraficaStati a ON ddb.IdxStato = a.IdxStato
|
||||
WHERE (a.ClasseTempo = 'T_FermoOn')
|
||||
AND (ddb.IdxMacchina = @IdxMacchina)
|
||||
AND (ddb.InizioStato >= @DataFrom)
|
||||
AND (ddb.FineStato <= @DataTo) )-- sistemare eventuali eventi sui bordi inizio/fine
|
||||
SET @TempoAuto = @TempoON - @TempoFermoON
|
||||
/* -- lo derivo x riportare eventuali "resti" ed errori riclassifica
|
||||
SET @TempoFermoAuto = (SELECT SUM(ddb.DurataMinuti) / 60 AS ore FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati a ON ddb.IdxStato = a.IdxStato
|
||||
WHERE (a.ClasseTempo = 'T_FermoAuto')
|
||||
AND (ddb.IdxMacchina = @IdxMacchina)
|
||||
AND (ddb.InizioStato >= @DataFrom)
|
||||
AND (ddb.FineStato <= @DataTo) )-- sistemare eventuali eventi sui bordi inizio/fine
|
||||
*/
|
||||
SET @TempoRun = ( SELECT CAST(ISNULL(SUM(ddb.DurataMinuti),0) AS DECIMAL(18,8)) / 60 AS ore FROM DiarioDiBordo ddb
|
||||
INNER JOIN AnagraficaStati a ON ddb.IdxStato = a.IdxStato
|
||||
WHERE (a.ClasseTempo = 'T_Run')
|
||||
AND (ddb.IdxMacchina = @IdxMacchina)
|
||||
AND (ddb.InizioStato >= @DataFrom)
|
||||
AND (ddb.FineStato <= @DataTo) )-- sistemare eventuali eventi sui bordi inizio/fine
|
||||
SET @TempoFermoAuto = @TempoAuto - @TempoRun
|
||||
|
||||
-- aggiorno record
|
||||
UPDATE DatiConfermati
|
||||
SET TempoCron = @TempoCron,
|
||||
TempoND = @TempoND,
|
||||
TempoApertura = @TempoApertura,
|
||||
TempoOFF = @TempoOFF,
|
||||
TempoON = @TempoON,
|
||||
TempoFermoON = @TempoFermoON,
|
||||
TempoAuto = @TempoAuto,
|
||||
TempoFermoAuto = @TempoFermoAuto,
|
||||
TempoRun = @TempoRun
|
||||
WHERE idxConferma = @idxConferma
|
||||
|
||||
COMMIT TRAN
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
UPDATE dbo.AnagraficaEventi SET
|
||||
TabAzione=N'DatiMacchine', Azione=N'Inizio'
|
||||
WHERE IdxTipo=2
|
||||
UPDATE dbo.AnagraficaEventi SET
|
||||
TabAzione=N'DatiMacchine', Azione=N'Fine'
|
||||
WHERE IdxTipo=7
|
||||
go
|
||||
|
||||
commit transaction
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
INSERT INTO dbo.Kanban
|
||||
VALUES (N'KAND', N'ND', 1, 1, N'ND')
|
||||
go
|
||||
|
||||
commit transaction
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(245, GETDATE())
|
||||
GO
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,100 @@
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_repDonati_getDatiProdMacchina
|
||||
* restituisce i dati di produzione di una macchina
|
||||
*
|
||||
* modif.: S.E.L. - 2012.03.08
|
||||
**************************************/
|
||||
alter PROCEDURE stp_repDonati_getDatiProdMacchina
|
||||
(
|
||||
@idxMacchina NVARCHAR(50)
|
||||
)
|
||||
AS
|
||||
|
||||
-- calcolo codice articolo
|
||||
DECLARE @CodArticolo NVARCHAR (50)
|
||||
SET @CodArticolo = (
|
||||
SELECT CodArticolo FROM Kanban k
|
||||
INNER JOIN StatoMacchine sm ON k.MatricolaKanban=sm.MatricolaKanban
|
||||
WHERE sm.IdxMacchina = @idxMacchina
|
||||
)
|
||||
-- calcolo il codice operatore
|
||||
DECLARE @CodOperatore INT
|
||||
SET @CodOperatore = (
|
||||
SELECT MatrOpr FROM StatoMacchine
|
||||
WHERE IdxMacchina = @idxMacchina
|
||||
)
|
||||
-- calcolo il codice ODL
|
||||
DECLARE @idxODL INT
|
||||
SET @idxODL = (
|
||||
SELECT idxODL FROM ODL
|
||||
WHERE CodArticolo = @CodArticolo AND IdxMacchina = @idxMacchina AND (ISNULL(DataFine,DATEADD(hh,1,GETDATE())) > GETDATE())
|
||||
)
|
||||
|
||||
|
||||
DECLARE @PezziConf INT
|
||||
SET @PezziConf = (
|
||||
SELECT ISNULL(SUM(TotPzProd),0) FROM DatiConfermati
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @PezziLanciati INT
|
||||
SET @PezziLanciati =(
|
||||
SELECT ISNULL(SUM(NumPezzi),0) FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @TCAss DECIMAL(18,8)
|
||||
SET @TCAss = (
|
||||
SELECT ISNULL(SUM(TCAssegnato),0) FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
-- dato l'ODL calcolo il TC Medio ed i pezzi prodotti per l'ODL
|
||||
DECLARE @inizioOdl DATETIME
|
||||
SET @inizioOdl = (
|
||||
SELECT DataInizio FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @PezziProd INT
|
||||
SET @PezziProd = (
|
||||
SELECT COUNT(*) FROM TempiCicloRilevati
|
||||
WHERE DataOraRif >= @inizioOdl
|
||||
AND TCMedio < 3 * @TCAss
|
||||
)
|
||||
|
||||
DECLARE @TCMed DECIMAL(18,8)
|
||||
SET @TCMed = (
|
||||
SELECT SUM(TCMedio)/@PezziProd FROM TempiCicloRilevati
|
||||
WHERE DataOraRif >= @inizioOdl
|
||||
AND TCMedio < 3 * @TCAss
|
||||
)
|
||||
|
||||
|
||||
SELECT @CodArticolo as CodArticolo, @PezziLanciati as PezziLanciati, @PezziProd as PezziProd, @PezziConf as PezziConf, @TCAss AS TCAssegnato, @TCMed AS TCMedio, @CodOperatore AS CodOperatore
|
||||
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(305, GETDATE())
|
||||
GO
|
||||
@@ -0,0 +1,328 @@
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_TC_getByMacchinaPeriodo
|
||||
* recupera tempi ciclo x machcian e periodo filtrando il MAX ammissibile
|
||||
*
|
||||
* modif.: S.E.L. - 2010.12.15
|
||||
**************************************/
|
||||
create PROCEDURE stp_TC_getByMacchinaPeriodoFiltMax
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@Inizio DATETIME,
|
||||
@Fine DATETIME,
|
||||
@MAX DECIMAL(18, 8)
|
||||
)
|
||||
AS
|
||||
|
||||
SELECT * FROM TempiCicloRilevati
|
||||
WHERE IdxMacchina = @IdxMacchina AND
|
||||
(DataOraRif >= @Inizio) AND (DataOraRif <= @Fine)
|
||||
AND TCMedio <= @MAX
|
||||
ORDER BY DataOraRif
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_DDB_getParetoDurate
|
||||
* ottiene il pareto delle durate eventi diario di bordo
|
||||
*
|
||||
* modif.: S.E.L. - 2010.07.13
|
||||
**************************************/
|
||||
alter PROCEDURE stp_DDB_getParetoDurateFilt
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@minDurata FLOAT,
|
||||
@fine DATETIME,
|
||||
@inizio DATETIME
|
||||
)
|
||||
AS
|
||||
|
||||
|
||||
WITH my_cte AS
|
||||
(
|
||||
SELECT *
|
||||
FROM DiarioDiBordo
|
||||
WHERE IdxMacchina=@IdxMacchina AND
|
||||
DurataMinuti >= @minDurata AND
|
||||
( (InizioStato BETWEEN @inizio AND @fine) OR (FineStato BETWEEN @inizio AND @fine) )
|
||||
)
|
||||
|
||||
|
||||
SELECT IdxMacchina,
|
||||
CASE WHEN MIN(InizioStato) < @inizio THEN @inizio ELSE MIN(InizioStato) END AS InizioStato,
|
||||
CASE WHEN MAX(FineStato) > @fine THEN @fine ELSE MAX(FineStato) END AS FineStato,
|
||||
IdxStato,
|
||||
SUM( DATEDIFF(n, CASE WHEN InizioStato < @inizio THEN @inizio ELSE InizioStato END, CASE WHEN ISNULL(FineStato, GETDATE()) > @fine THEN @fine ELSE FineStato END) ) AS DurataMinuti
|
||||
FROM my_cte
|
||||
GROUP BY IdxMacchina, IdxStato
|
||||
ORDER BY DurataMinuti DESC
|
||||
|
||||
/*
|
||||
SELECT IdxMacchina, MIN(InizioStato) AS InizioStato, MAX(FineStato) AS FineStato, IdxStato,
|
||||
SUM(ISNULL(DurataMinuti, DATEDIFF(n, InizioStato, GETDATE()))) AS DurataMinuti
|
||||
FROM DiarioDiBordo
|
||||
WHERE IdxMacchina=@IdxMacchina AND DurataMinuti >= @minDurata AND
|
||||
(((FineStato <= @fine) AND (InizioStato >= @inizio)) OR ((FineStato IS NULL) AND (InizioStato >= @inizio AND InizioStato <= @fine)))
|
||||
GROUP BY IdxMacchina, IdxStato
|
||||
ORDER BY DurataMinuti DESC
|
||||
*/
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_DDB_getParetoDurateHideSpentaFilt
|
||||
* ottiene il pareto delle durate eventi diario di bordo filtrato eventi spenta
|
||||
*
|
||||
* modif.: S.E.L. - 2010.07.14
|
||||
**************************************/
|
||||
alter PROCEDURE stp_DDB_getParetoDurateHideSpentaFilt
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@minDurata FLOAT,
|
||||
@fine DATETIME,
|
||||
@inizio DATETIME
|
||||
)
|
||||
AS
|
||||
|
||||
WITH my_cte AS
|
||||
(
|
||||
SELECT *
|
||||
FROM DiarioDiBordo
|
||||
WHERE IdxMacchina=@IdxMacchina AND
|
||||
DurataMinuti >= @minDurata AND
|
||||
IdxStato <>11 AND
|
||||
( (InizioStato BETWEEN @inizio AND @fine) OR (FineStato BETWEEN @inizio AND @fine) )
|
||||
)
|
||||
|
||||
|
||||
SELECT IdxMacchina,
|
||||
CASE WHEN MIN(InizioStato) < @inizio THEN @inizio ELSE MIN(InizioStato) END AS InizioStato,
|
||||
CASE WHEN MAX(FineStato) > @fine THEN @fine ELSE MAX(FineStato) END AS FineStato,
|
||||
IdxStato,
|
||||
SUM( DATEDIFF(n, CASE WHEN InizioStato < @inizio THEN @inizio ELSE InizioStato END, CASE WHEN ISNULL(FineStato, GETDATE()) > @fine THEN @fine ELSE FineStato END) ) AS DurataMinuti
|
||||
FROM my_cte
|
||||
GROUP BY IdxMacchina, IdxStato
|
||||
ORDER BY DurataMinuti DESC
|
||||
|
||||
|
||||
/*
|
||||
SELECT IdxMacchina, MIN(InizioStato) AS InizioStato, MAX(FineStato) AS FineStato, IdxStato,
|
||||
SUM(ISNULL(DurataMinuti, DATEDIFF(n, InizioStato, GETDATE()))) AS DurataMinuti
|
||||
FROM DiarioDiBordo
|
||||
WHERE IdxMacchina=@IdxMacchina AND
|
||||
DurataMinuti >= @minDurata AND
|
||||
IdxStato <>11 AND
|
||||
(((FineStato <= @fine) AND (InizioStato >= @inizio)) OR ((FineStato IS NULL) AND (InizioStato >= @inizio AND InizioStato <= @fine)))
|
||||
GROUP BY IdxMacchina, IdxStato
|
||||
ORDER BY DurataMinuti DESC
|
||||
|
||||
*/
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
|
||||
drop table AnagraficaStatiOld;
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_repDonati_getDatiProdMacchina
|
||||
* restituisce i dati di produzione di una macchina
|
||||
*
|
||||
* modif.: S.E.L. - 2012.03.08
|
||||
**************************************/
|
||||
alter PROCEDURE stp_repDonati_getDatiProdMacchina
|
||||
(
|
||||
@idxMacchina NVARCHAR(50)
|
||||
)
|
||||
AS
|
||||
|
||||
-- calcolo codice articolo
|
||||
DECLARE @CodArticolo NVARCHAR (50)
|
||||
SET @CodArticolo = (
|
||||
SELECT CodArticolo FROM Kanban k
|
||||
INNER JOIN StatoMacchine sm ON k.MatricolaKanban=sm.MatricolaKanban
|
||||
WHERE sm.IdxMacchina = @idxMacchina
|
||||
)
|
||||
-- calcolo il codice operatore
|
||||
DECLARE @CodOperatore INT
|
||||
SET @CodOperatore = (
|
||||
SELECT MatrOpr FROM StatoMacchine
|
||||
WHERE IdxMacchina = @idxMacchina
|
||||
)
|
||||
-- calcolo il codice ODL
|
||||
DECLARE @idxODL INT
|
||||
SET @idxODL = (
|
||||
SELECT idxODL FROM ODL
|
||||
WHERE CodArticolo = @CodArticolo AND IdxMacchina = @idxMacchina AND (ISNULL(DataFine,DATEADD(hh,1,GETDATE())) > GETDATE())
|
||||
)
|
||||
|
||||
|
||||
DECLARE @PezziConf INT
|
||||
SET @PezziConf = (
|
||||
SELECT ISNULL(SUM(TotPzProd),0) FROM DatiProduzione
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @PezziLanciati INT
|
||||
SET @PezziLanciati =(
|
||||
SELECT ISNULL(SUM(NumPezzi),0) FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @TCAss DECIMAL(18,8)
|
||||
SET @TCAss = (
|
||||
SELECT ISNULL(SUM(TCAssegnato),0) FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
-- dato l'ODL calcolo il TC Medio ed i pezzi prodotti per l'ODL
|
||||
DECLARE @inizioOdl DATETIME
|
||||
SET @inizioOdl = (
|
||||
SELECT DataInizio FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @PezziProd INT
|
||||
SET @PezziProd = (
|
||||
SELECT COUNT(*) FROM TempiCicloRilevati
|
||||
WHERE DataOraRif >= @inizioOdl
|
||||
)
|
||||
|
||||
/****************************************************
|
||||
* Calcolo tempi apertura confermati
|
||||
****************************************************/
|
||||
-- calcolo i tempi di apertura: TempoON (Verde + giallo + rosso)
|
||||
DECLARE @TempoOn DECIMAL(18,8)
|
||||
SET @TempoOn = (
|
||||
SELECT ISNULL(SUM(Tempo),0) FROM DatiProduzione
|
||||
WHERE ClasseTempo NOT IN ('T_OFF', 'T_OFF_ND') AND idxODL = @idxOdl
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoAuto (Verde + giallo) - precedente meno "T_FermoRosso"
|
||||
DECLARE @TempoAuto DECIMAL(18,8)
|
||||
SET @TempoAuto = (
|
||||
SELECT @TempoOn - ISNULL(SUM(Tempo),0) FROM DatiProduzione
|
||||
WHERE ClasseTempo = 'T_FermoRosso' AND idxODL = @idxOdl
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoRun (Verde)
|
||||
DECLARE @TempoRun DECIMAL(18,8)
|
||||
SET @TempoRun = (
|
||||
SELECT ISNULL(SUM(Tempo),0) FROM DatiProduzione
|
||||
WHERE ClasseTempo = 'T_AutoRun' AND idxODL = @idxOdl
|
||||
)
|
||||
|
||||
/****************************************************
|
||||
* Calcolo tempi apertura realtime
|
||||
****************************************************/
|
||||
-- calcolo i tempi di apertura: TempoON (Verde + giallo + rosso)
|
||||
DECLARE @TempoOnRT DECIMAL(18,8)
|
||||
SET @TempoOnRT = (
|
||||
SELECT ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo NOT IN ('T_OFF', 'T_OFF_ND') AND InizioStato >= @inizioOdl
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoAuto (Verde + giallo) - precedente meno "T_FermoRosso"
|
||||
DECLARE @TempoAutoRT DECIMAL(18,8)
|
||||
SET @TempoAutoRT = (
|
||||
SELECT @TempoOnRT - ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo = 'T_FermoRosso' AND InizioStato >= @inizioOdl
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoRun (Verde)
|
||||
DECLARE @TempoRunRT DECIMAL(18,8)
|
||||
SET @TempoRunRT = (
|
||||
SELECT ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo = 'T_AutoRun' AND InizioStato >= @inizioOdl
|
||||
)
|
||||
|
||||
/****************************************************
|
||||
* Calcolo i TEMPI CICLO confermati
|
||||
****************************************************/
|
||||
DECLARE @TCMed DECIMAL(18,8)
|
||||
SET @TCMed = (
|
||||
SELECT @TempoOn * 60 / @PezziConf -- tempo in ore
|
||||
)
|
||||
DECLARE @TCLav DECIMAL(18,8)
|
||||
SET @TCLav = (
|
||||
SELECT @TempoAuto * 60 / @PezziConf -- tempo in ore
|
||||
)
|
||||
DECLARE @TCEff DECIMAL(18,8)
|
||||
SET @TCEff = (
|
||||
SELECT @TempoRun * 60 / @PezziConf -- tempo in ore
|
||||
)
|
||||
|
||||
/****************************************************
|
||||
* Calcolo i TEMPI CICLO realtime (anche non confermati)
|
||||
****************************************************/
|
||||
DECLARE @TCMedRT DECIMAL(18,8)
|
||||
SET @TCMedRT = (
|
||||
SELECT @TempoOnRT / @PezziProd
|
||||
)
|
||||
DECLARE @TCLavRT DECIMAL(18,8)
|
||||
SET @TCLavRT = (
|
||||
SELECT @TempoAutoRT / @PezziProd
|
||||
)
|
||||
DECLARE @TCEffRT DECIMAL(18,8)
|
||||
SET @TCEffRT = (
|
||||
SELECT @TempoRunRT / @PezziProd
|
||||
)
|
||||
|
||||
|
||||
SELECT @CodArticolo as CodArticolo, @PezziLanciati as PezziLanciati, @PezziProd as PezziProd, @PezziConf as PezziConf, @TCAss AS TCAssegnato, @CodOperatore AS CodOperatore, @TempoOn AS TempoOn, @TempoAuto AS TempoAuto, @TempoRun AS TempoRun, @TCMed AS TCMedio, @TCLav AS TCLav, @TCEff AS TCEff, @TCMedRT AS TCMedioRT, @TCLavRT AS TCLavRT, @TCEffRT AS TCEffRT
|
||||
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(310, GETDATE())
|
||||
GO
|
||||
@@ -0,0 +1,182 @@
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_repDonati_getDatiProdMacchina
|
||||
* restituisce i dati di produzione di una macchina
|
||||
*
|
||||
* modif.: S.E.L. - 2012.03.08
|
||||
**************************************/
|
||||
alter PROCEDURE stp_repDonati_getDatiProdMacchina
|
||||
(
|
||||
@idxMacchina NVARCHAR(50)
|
||||
)
|
||||
AS
|
||||
|
||||
-- calcolo codice articolo
|
||||
DECLARE @CodArticolo NVARCHAR (50)
|
||||
SET @CodArticolo = (
|
||||
SELECT CodArticolo FROM Kanban k
|
||||
INNER JOIN StatoMacchine sm ON k.MatricolaKanban=sm.MatricolaKanban
|
||||
WHERE sm.IdxMacchina = @idxMacchina
|
||||
)
|
||||
-- calcolo il codice operatore
|
||||
DECLARE @CodOperatore INT
|
||||
SET @CodOperatore = (
|
||||
SELECT MatrOpr FROM StatoMacchine
|
||||
WHERE IdxMacchina = @idxMacchina
|
||||
)
|
||||
-- calcolo il codice ODL
|
||||
DECLARE @idxODL INT
|
||||
SET @idxODL = (
|
||||
SELECT idxODL FROM ODL
|
||||
WHERE CodArticolo = @CodArticolo AND IdxMacchina = @idxMacchina AND (ISNULL(DataFine,DATEADD(hh,1,GETDATE())) > GETDATE())
|
||||
)
|
||||
|
||||
|
||||
DECLARE @PezziConf INT
|
||||
SET @PezziConf = (
|
||||
SELECT ISNULL(SUM(TotPzProd),0) FROM DatiProduzione
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @PezziLanciati INT
|
||||
SET @PezziLanciati =(
|
||||
SELECT ISNULL(SUM(NumPezzi),0) FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @TCAss DECIMAL(18,8)
|
||||
SET @TCAss = (
|
||||
SELECT ISNULL(SUM(TCAssegnato),0) FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
-- dato l'ODL calcolo il TC Medio ed i pezzi prodotti per l'ODL
|
||||
DECLARE @inizioOdl DATETIME
|
||||
SET @inizioOdl = (
|
||||
SELECT DataInizio FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @PezziProd INT
|
||||
SET @PezziProd = (
|
||||
SELECT COUNT(*) FROM TempiCicloRilevati
|
||||
WHERE DataOraRif >= @inizioOdl
|
||||
)
|
||||
|
||||
|
||||
/****************************************************
|
||||
* Calcolo tempi apertura confermati
|
||||
****************************************************/
|
||||
-- calcolo i tempi di apertura: TempoON (Verde + giallo + rosso)
|
||||
DECLARE @TempoOn DECIMAL(18,8)
|
||||
SET @TempoOn = (
|
||||
SELECT ISNULL(SUM(Tempo),0) FROM DatiProduzione
|
||||
WHERE ClasseTempo NOT IN ('T_OFF', 'T_OFF_ND') AND idxODL = @idxOdl
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoAuto (Verde + giallo) - precedente meno "T_FermoRosso"
|
||||
DECLARE @TempoAuto DECIMAL(18,8)
|
||||
SET @TempoAuto = (
|
||||
SELECT @TempoOn - ISNULL(SUM(Tempo),0) FROM DatiProduzione
|
||||
WHERE ClasseTempo = 'T_FermoRosso' AND idxODL = @idxOdl
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoRun (Verde)
|
||||
DECLARE @TempoRun DECIMAL(18,8)
|
||||
SET @TempoRun = (
|
||||
SELECT ISNULL(SUM(Tempo),0) FROM DatiProduzione
|
||||
WHERE ClasseTempo = 'T_AutoRun' AND idxODL = @idxOdl
|
||||
)
|
||||
|
||||
/****************************************************
|
||||
* Calcolo tempi apertura realtime
|
||||
****************************************************/
|
||||
-- calcolo i tempi di apertura: TempoON (Verde + giallo + rosso)
|
||||
DECLARE @TempoOnRT DECIMAL(18,8)
|
||||
SET @TempoOnRT = (
|
||||
SELECT ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo NOT IN ('T_OFF', 'T_OFF_ND') AND InizioStato >= @inizioOdl
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoAuto (Verde + giallo) - precedente meno "T_FermoRosso"
|
||||
DECLARE @TempoAutoRT DECIMAL(18,8)
|
||||
SET @TempoAutoRT = (
|
||||
SELECT @TempoOnRT - ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo = 'T_FermoRosso' AND InizioStato >= @inizioOdl
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoRun (Verde)
|
||||
DECLARE @TempoRunRT DECIMAL(18,8)
|
||||
SET @TempoRunRT = (
|
||||
SELECT ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo = 'T_AutoRun' AND InizioStato >= @inizioOdl
|
||||
)
|
||||
|
||||
/****************************************************
|
||||
* Calcolo i TEMPI CICLO confermati
|
||||
****************************************************/
|
||||
|
||||
-- DIVISIONE PER ZERO: controllo pezzi conf > 0...
|
||||
IF(@PezziConf = 0) SET @PezziConf = 1
|
||||
|
||||
DECLARE @TCMed DECIMAL(18,8)
|
||||
SET @TCMed = (
|
||||
SELECT @TempoOn * 60 / @PezziConf -- tempo in ore
|
||||
)
|
||||
DECLARE @TCLav DECIMAL(18,8)
|
||||
SET @TCLav = (
|
||||
SELECT @TempoAuto * 60 / @PezziConf -- tempo in ore
|
||||
)
|
||||
DECLARE @TCEff DECIMAL(18,8)
|
||||
SET @TCEff = (
|
||||
SELECT @TempoRun * 60 / @PezziConf -- tempo in ore
|
||||
)
|
||||
|
||||
/****************************************************
|
||||
* Calcolo i TEMPI CICLO realtime (anche non confermati)
|
||||
****************************************************/
|
||||
|
||||
-- DIVISIONE PER ZERO: controllo pezzi prod > 0...
|
||||
IF(@PezziProd = 0) SET @PezziProd = 1
|
||||
|
||||
DECLARE @TCMedRT DECIMAL(18,8)
|
||||
SET @TCMedRT = (
|
||||
SELECT @TempoOnRT / @PezziProd
|
||||
)
|
||||
DECLARE @TCLavRT DECIMAL(18,8)
|
||||
SET @TCLavRT = (
|
||||
SELECT @TempoAutoRT / @PezziProd
|
||||
)
|
||||
DECLARE @TCEffRT DECIMAL(18,8)
|
||||
SET @TCEffRT = (
|
||||
SELECT @TempoRunRT / @PezziProd
|
||||
)
|
||||
|
||||
|
||||
SELECT @CodArticolo as CodArticolo, @PezziLanciati as PezziLanciati, @PezziProd as PezziProd, @PezziConf as PezziConf, @TCAss AS TCAssegnato, @CodOperatore AS CodOperatore, @TempoOn AS TempoOn, @TempoAuto AS TempoAuto, @TempoRun AS TempoRun, @TCMed AS TCMedio, @TCLav AS TCLav, @TCEff AS TCEff, @TCMedRT AS TCMedioRT, @TCLavRT AS TCLavRT, @TCEffRT AS TCEffRT
|
||||
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(315, GETDATE())
|
||||
GO
|
||||
@@ -0,0 +1,275 @@
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* Function f_lastTempoTecnico
|
||||
* calcola il tempo tecnico per un impianto dato idxMacchina e intervallo di tempo x filtraggio
|
||||
* utilizza migliori 10 tempi nell'intervallo e fa media
|
||||
*
|
||||
* modif.: S.E.L.
|
||||
* il: 2011.03.30
|
||||
**************************************/
|
||||
create FUNCTION f_lastTempoTecnico
|
||||
(
|
||||
@idxMacchina NVARCHAR(50),
|
||||
@finestraOre INT
|
||||
)
|
||||
RETURNS DECIMAL(18,8)
|
||||
AS
|
||||
|
||||
|
||||
BEGIN
|
||||
DECLARE @TcTecnico AS DECIMAL (18,8)
|
||||
;WITH LastTempi AS
|
||||
(
|
||||
SELECT TOP 10 *
|
||||
FROM TempiCicloRilevati
|
||||
WHERE IdxMacchina = @idxMacchina
|
||||
AND DataOraRif >= DATEADD(HH,-@finestraOre,getdate())
|
||||
ORDER BY TCMedio
|
||||
)
|
||||
|
||||
SELECT @TcTecnico = AVG(TcMedio) FROM LastTempi
|
||||
RETURN @TcTecnico
|
||||
END
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_repDonati_getDatiProdMacchina
|
||||
* restituisce i dati di produzione di una macchina
|
||||
*
|
||||
* modif.: S.E.L. - 2012.03.08
|
||||
**************************************/
|
||||
alter PROCEDURE stp_repDonati_getDatiProdMacchina
|
||||
(
|
||||
@idxMacchina NVARCHAR(50)
|
||||
)
|
||||
AS
|
||||
|
||||
|
||||
-- calcolo codice articolo
|
||||
DECLARE @CodArticolo NVARCHAR (50)
|
||||
SET @CodArticolo = (
|
||||
SELECT CodArticolo FROM Kanban k
|
||||
INNER JOIN StatoMacchine sm ON k.MatricolaKanban=sm.MatricolaKanban
|
||||
WHERE sm.IdxMacchina = @idxMacchina
|
||||
)
|
||||
-- calcolo il codice operatore
|
||||
DECLARE @CodOperatore INT
|
||||
SET @CodOperatore = (
|
||||
SELECT MatrOpr FROM StatoMacchine
|
||||
WHERE IdxMacchina = @idxMacchina
|
||||
)
|
||||
-- calcolo il codice ODL
|
||||
DECLARE @idxODL INT
|
||||
SET @idxODL = (
|
||||
SELECT idxODL FROM ODL
|
||||
WHERE CodArticolo = @CodArticolo AND IdxMacchina = @idxMacchina AND (ISNULL(DataFine,DATEADD(hh,1,GETDATE())) > GETDATE())
|
||||
)
|
||||
|
||||
|
||||
DECLARE @PezziConf INT
|
||||
SET @PezziConf = (
|
||||
SELECT ISNULL(SUM(TotPzProd),0) FROM DatiProduzione
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @PezziLanciati INT
|
||||
SET @PezziLanciati =(
|
||||
SELECT ISNULL(SUM(NumPezzi),0) FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @TCAss DECIMAL(18,8)
|
||||
SET @TCAss = (
|
||||
SELECT ISNULL(SUM(TCAssegnato),0) FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
-- dato l'ODL calcolo il TC Medio ed i pezzi prodotti per l'ODL
|
||||
DECLARE @inizioOdl DATETIME
|
||||
SET @inizioOdl = (
|
||||
SELECT DataInizio FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @PezziProd INT
|
||||
SET @PezziProd = (
|
||||
SELECT COUNT(*) FROM TempiCicloRilevati
|
||||
WHERE DataOraRif >= @inizioOdl
|
||||
)
|
||||
|
||||
|
||||
/****************************************************
|
||||
* Calcolo tempi apertura confermati
|
||||
****************************************************/
|
||||
-- calcolo i tempi di apertura: TempoON (Verde + giallo + rosso)
|
||||
DECLARE @TempoOn DECIMAL(18,8)
|
||||
SET @TempoOn = (
|
||||
SELECT ISNULL(SUM(Tempo),0) FROM DatiProduzione
|
||||
WHERE ClasseTempo NOT IN ('T_OFF', 'T_OFF_ND') AND idxODL = @idxOdl
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoAuto (Verde + giallo) - precedente meno "T_FermoRosso"
|
||||
DECLARE @TempoAuto DECIMAL(18,8)
|
||||
SET @TempoAuto = (
|
||||
SELECT @TempoOn - ISNULL(SUM(Tempo),0) FROM DatiProduzione
|
||||
WHERE ClasseTempo = 'T_FermoRosso' AND idxODL = @idxOdl
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoRun (Verde)
|
||||
DECLARE @TempoRun DECIMAL(18,8)
|
||||
SET @TempoRun = (
|
||||
SELECT ISNULL(SUM(Tempo),0) FROM DatiProduzione
|
||||
WHERE ClasseTempo = 'T_AutoRun' AND idxODL = @idxOdl
|
||||
)
|
||||
|
||||
/****************************************************
|
||||
* Calcolo tempi apertura realtime
|
||||
****************************************************/
|
||||
-- calcolo i tempi di apertura: TempoON (Verde + giallo + rosso)
|
||||
DECLARE @TempoOnRT DECIMAL(18,8)
|
||||
SET @TempoOnRT = (
|
||||
SELECT ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo NOT IN ('T_OFF', 'T_OFF_ND') AND InizioStato >= @inizioOdl
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoAuto (Verde + giallo) - precedente meno "T_FermoRosso"
|
||||
DECLARE @TempoAutoRT DECIMAL(18,8)
|
||||
SET @TempoAutoRT = (
|
||||
SELECT @TempoOnRT - ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo = 'T_FermoRosso' AND InizioStato >= @inizioOdl
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoRun (Verde)
|
||||
DECLARE @TempoRunRT DECIMAL(18,8)
|
||||
SET @TempoRunRT = (
|
||||
SELECT ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo = 'T_AutoRun' AND InizioStato >= @inizioOdl
|
||||
)
|
||||
|
||||
DECLARE @numPezzi INT
|
||||
|
||||
/****************************************************
|
||||
* Calcolo i TEMPI CICLO confermati
|
||||
****************************************************/
|
||||
|
||||
-- DIVISIONE PER ZERO: controllo pezzi conf > 0
|
||||
SET @numPezzi = @PezziConf
|
||||
IF(@numPezzi = 0) SET @numPezzi = 1
|
||||
|
||||
DECLARE @TCMed DECIMAL(18,8)
|
||||
SET @TCMed = (
|
||||
SELECT @TempoOn * 60 / @numPezzi -- tempo in ore
|
||||
)
|
||||
DECLARE @TCLav DECIMAL(18,8)
|
||||
SET @TCLav = (
|
||||
SELECT @TempoAuto * 60 / @numPezzi -- tempo in ore
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
DECLARE @TCEff DECIMAL(18,8) -- è la media degli ultimi 10 migliori tempi minimi nell'ultima giornata
|
||||
SET @TCEff = ISNULL(( SELECT dbo.f_lastTempoTecnico(@idxMacchina, 8) ), -1) -- provo a calcolare ultimi tempi tecnici
|
||||
IF (@TCEff =-1)
|
||||
BEGIN
|
||||
SET @TCEff = (
|
||||
SELECT @TempoRun * 60 / @numPezzi -- tempo in ore
|
||||
)
|
||||
END
|
||||
|
||||
/****************************************************
|
||||
* Calcolo i TEMPI CICLO realtime (anche non confermati)
|
||||
****************************************************/
|
||||
|
||||
-- DIVISIONE PER ZERO: controllo pezzi prod > 0...
|
||||
SET @numPezzi = @PezziProd
|
||||
IF(@numPezzi = 0) SET @numPezzi = 1
|
||||
|
||||
DECLARE @TCMedRT DECIMAL(18,8)
|
||||
SET @TCMedRT = (
|
||||
SELECT @TempoOnRT / @numPezzi
|
||||
)
|
||||
DECLARE @TCLavRT DECIMAL(18,8)
|
||||
SET @TCLavRT = (
|
||||
SELECT @TempoAutoRT / @numPezzi
|
||||
)
|
||||
DECLARE @TCEffRT DECIMAL(18,8)
|
||||
SET @TCEffRT = (
|
||||
SELECT @TempoRunRT / @numPezzi
|
||||
)
|
||||
|
||||
|
||||
SELECT @CodArticolo as CodArticolo, @PezziLanciati as PezziLanciati, @PezziProd as PezziProd, @PezziConf as PezziConf, @TCAss AS TCAssegnato, @CodOperatore AS CodOperatore, @TempoOn AS TempoOn, @TempoAuto AS TempoAuto, @TempoRun AS TempoRun, @TCMed AS TCMedio, @TCLav AS TCLav, @TCEff AS TCEff, @TCMedRT AS TCMedioRT, @TCLavRT AS TCLavRT, @TCEffRT AS TCEffRT
|
||||
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_repDonati_getLastStatoDurataMacchina
|
||||
* restituisce l'ultimo stato di una macchina e la durata
|
||||
* andando a filtrare gli eventi sotto una soglia indicata (default 6 sec)
|
||||
* e quindi sommando
|
||||
*
|
||||
* modif.: S.E.L. - 2012.03.08
|
||||
**************************************/
|
||||
create PROCEDURE stp_repDonati_getLastStatoDurataMacchina
|
||||
(
|
||||
@idxMacchina NVARCHAR(50),
|
||||
@minDurata FLOAT
|
||||
)
|
||||
AS
|
||||
|
||||
-- calcolo codice articolo
|
||||
DECLARE @idxStato INT
|
||||
SET @idxStato = (
|
||||
SELECT TOP 1 ISNULL(IdxStato,0)
|
||||
FROM DiarioDiBordo
|
||||
WHERE idxMacchina = @idxMacchina
|
||||
AND ISNULL(durataMinuti, 0) > @minDurata
|
||||
ORDER BY InizioStato DESC
|
||||
)
|
||||
-- calcolo durata filtrata... ovvero evento più recente NON dello stato indicato (changed)
|
||||
DECLARE @lastChTime DATETIME
|
||||
SET @lastChTime = (
|
||||
SELECT TOP 1 ISNULL(inizioStato, GetDate())
|
||||
FROM DiarioDiBordo
|
||||
WHERE idxMacchina = @idxMacchina
|
||||
AND idxStato <> @idxStato
|
||||
AND ISNULL(durataMinuti, 0) > @minDurata
|
||||
ORDER BY InizioStato DESC
|
||||
)
|
||||
|
||||
DECLARE @timeMinuti FLOAT
|
||||
SET @timeMinuti = ( SELECT DATEDIFF(n, @lastChTime, GetDate()) )
|
||||
|
||||
SELECT @idxStato AS idxStato, @timeMinuti AS Minuti
|
||||
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(316, GETDATE())
|
||||
GO
|
||||
@@ -0,0 +1,291 @@
|
||||
drop table DiarioDiBordo_backup;
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_repDonati_getDatiProdMacchina
|
||||
* restituisce i dati di produzione di una macchina
|
||||
*
|
||||
* modif.: S.E.L. - 2012.03.08
|
||||
**************************************/
|
||||
alter PROCEDURE stp_repDonati_getDatiProdMacchina
|
||||
(
|
||||
@idxMacchina NVARCHAR(50)
|
||||
)
|
||||
AS
|
||||
|
||||
|
||||
-- calcolo codice articolo
|
||||
DECLARE @CodArticolo NVARCHAR (50)
|
||||
SET @CodArticolo = (
|
||||
SELECT CodArticolo FROM Kanban k
|
||||
INNER JOIN StatoMacchine sm ON k.MatricolaKanban=sm.MatricolaKanban
|
||||
WHERE sm.IdxMacchina = @idxMacchina
|
||||
)
|
||||
-- calcolo il codice operatore
|
||||
DECLARE @CodOperatore INT
|
||||
SET @CodOperatore = (
|
||||
SELECT MatrOpr FROM StatoMacchine
|
||||
WHERE IdxMacchina = @idxMacchina
|
||||
)
|
||||
-- calcolo il codice ODL
|
||||
DECLARE @idxODL INT
|
||||
SET @idxODL = (
|
||||
SELECT idxODL FROM ODL
|
||||
WHERE CodArticolo = @CodArticolo AND IdxMacchina = @idxMacchina AND (ISNULL(DataFine,DATEADD(hh,1,GETDATE())) > GETDATE())
|
||||
)
|
||||
|
||||
|
||||
DECLARE @PezziConf INT
|
||||
SET @PezziConf = (
|
||||
SELECT ISNULL(SUM(TotPzProd),0) FROM DatiProduzione
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @PezziLanciati INT
|
||||
SET @PezziLanciati =(
|
||||
SELECT ISNULL(SUM(NumPezzi),0) FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @TCAss DECIMAL(18,8)
|
||||
SET @TCAss = (
|
||||
SELECT ISNULL(SUM(TCAssegnato),0) FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
-- dato l'ODL calcolo il TC Medio ed i pezzi prodotti per l'ODL
|
||||
DECLARE @inizioOdl DATETIME
|
||||
SET @inizioOdl = (
|
||||
SELECT DataInizio FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @PezziProd INT
|
||||
SET @PezziProd = (
|
||||
SELECT COUNT(*) FROM TempiCicloRilevati
|
||||
WHERE DataOraRif >= @inizioOdl
|
||||
)
|
||||
|
||||
|
||||
/****************************************************
|
||||
* Calcolo tempi apertura confermati
|
||||
****************************************************/
|
||||
-- calcolo i tempi di apertura: TempoON (Verde + giallo + rosso)
|
||||
DECLARE @TempoOn DECIMAL(18,8)
|
||||
SET @TempoOn = (
|
||||
SELECT ISNULL(SUM(Tempo),0) FROM DatiProduzione
|
||||
WHERE ClasseTempo NOT IN ('T_OFF', 'T_OFF_ND') AND idxODL = @idxOdl
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoAuto (Verde + giallo) - precedente meno "T_FermoRosso"
|
||||
DECLARE @TempoAuto DECIMAL(18,8)
|
||||
SET @TempoAuto = (
|
||||
SELECT @TempoOn - ISNULL(SUM(Tempo),0) FROM DatiProduzione
|
||||
WHERE ClasseTempo = 'T_FermoRosso' AND idxODL = @idxOdl
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoRun (Verde)
|
||||
DECLARE @TempoRun DECIMAL(18,8)
|
||||
SET @TempoRun = (
|
||||
SELECT ISNULL(SUM(Tempo),0) FROM DatiProduzione
|
||||
WHERE ClasseTempo = 'T_AutoRun' AND idxODL = @idxOdl
|
||||
)
|
||||
|
||||
/****************************************************
|
||||
* Calcolo tempi apertura realtime
|
||||
****************************************************/
|
||||
-- calcolo i tempi di apertura: TempoON (Verde + giallo + rosso)
|
||||
DECLARE @TempoOnRT DECIMAL(18,8)
|
||||
SET @TempoOnRT = (
|
||||
SELECT ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo NOT IN ('T_OFF', 'T_OFF_ND') AND InizioStato >= @inizioOdl
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoAuto (Verde + giallo) - precedente meno "T_FermoRosso"
|
||||
DECLARE @TempoAutoRT DECIMAL(18,8)
|
||||
SET @TempoAutoRT = (
|
||||
SELECT @TempoOnRT - ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo = 'T_FermoRosso' AND InizioStato >= @inizioOdl
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoRun (Verde)
|
||||
DECLARE @TempoRunRT DECIMAL(18,8)
|
||||
SET @TempoRunRT = (
|
||||
SELECT ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo = 'T_AutoRun' AND InizioStato >= @inizioOdl
|
||||
)
|
||||
|
||||
DECLARE @numPezzi INT
|
||||
|
||||
/****************************************************
|
||||
* Calcolo i TEMPI CICLO confermati
|
||||
****************************************************/
|
||||
|
||||
-- DIVISIONE PER ZERO: controllo pezzi conf > 0
|
||||
SET @numPezzi = @PezziConf
|
||||
IF(@numPezzi = 0) SET @numPezzi = 1
|
||||
|
||||
DECLARE @TCMed DECIMAL(18,8)
|
||||
SET @TCMed = (
|
||||
SELECT @TempoOn * 60 / @numPezzi -- tempo in ore
|
||||
)
|
||||
DECLARE @TCLav DECIMAL(18,8)
|
||||
SET @TCLav = (
|
||||
SELECT @TempoAuto * 60 / @numPezzi -- tempo in ore
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
DECLARE @TCEff DECIMAL(18,8) -- è la media degli ultimi 10 migliori tempi minimi nell'ultima giornata
|
||||
SET @TCEff = (
|
||||
SELECT @TempoRun * 60 / @numPezzi -- tempo in ore
|
||||
)
|
||||
|
||||
/****************************************************
|
||||
* Calcolo i TEMPI CICLO realtime (anche non confermati)
|
||||
****************************************************/
|
||||
|
||||
-- DIVISIONE PER ZERO: controllo pezzi prod > 0...
|
||||
SET @numPezzi = @PezziProd
|
||||
IF(@numPezzi = 0) SET @numPezzi = 1
|
||||
|
||||
DECLARE @TCMedRT DECIMAL(18,8)
|
||||
SET @TCMedRT = (
|
||||
SELECT @TempoOnRT / @numPezzi
|
||||
)
|
||||
DECLARE @TCLavRT DECIMAL(18,8)
|
||||
SET @TCLavRT = (
|
||||
SELECT @TempoAutoRT / @numPezzi
|
||||
)
|
||||
DECLARE @TCEffRT DECIMAL(18,8)
|
||||
SET @TCEffRT = ISNULL(( SELECT dbo.f_lastTempoTecnico(@idxMacchina, 2) ), -1) -- provo a calcolare ultimi tempi tecnici
|
||||
IF (@TCEffRT =-1)
|
||||
BEGIN
|
||||
SET @TCEffRT = (
|
||||
SELECT @TempoRunRT / @numPezzi
|
||||
)
|
||||
END
|
||||
|
||||
|
||||
SELECT @CodArticolo as CodArticolo, @PezziLanciati as PezziLanciati, @PezziProd as PezziProd, @PezziConf as PezziConf, @TCAss AS TCAssegnato, @CodOperatore AS CodOperatore, @TempoOn AS TempoOn, @TempoAuto AS TempoAuto, @TempoRun AS TempoRun, @TCMed AS TCMedio, @TCLav AS TCLav, @TCEff AS TCEff, @TCMedRT AS TCMedioRT, @TCLavRT AS TCLavRT, @TCEffRT AS TCEffRT
|
||||
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_repDonati_getLastStatoDurataMacchina
|
||||
* restituisce l'ultimo stato di una macchina e la durata
|
||||
* andando a filtrare gli eventi sotto una soglia indicata (default 6 sec)
|
||||
* e quindi sommando
|
||||
*
|
||||
* modif.: S.E.L. - 2012.03.08
|
||||
**************************************/
|
||||
alter PROCEDURE stp_repDonati_getLastStatoDurataMacchina
|
||||
(
|
||||
@idxMacchina NVARCHAR(50),
|
||||
@minDurata FLOAT
|
||||
)
|
||||
AS
|
||||
|
||||
-- calcolo codice articolo
|
||||
DECLARE @idxStato INT
|
||||
SET @idxStato = (
|
||||
SELECT TOP 1 ISNULL(IdxStato,0)
|
||||
FROM DiarioDiBordo
|
||||
WHERE idxMacchina = @idxMacchina
|
||||
--AND ISNULL(durataMinuti, 0) > @minDurata
|
||||
ORDER BY InizioStato DESC
|
||||
)
|
||||
-- calcolo durata filtrata... ovvero evento più recente NON dello stato indicato (changed)
|
||||
DECLARE @lastChTime DATETIME
|
||||
SET @lastChTime = (
|
||||
SELECT TOP 1 ISNULL(inizioStato, GetDate())
|
||||
FROM DiarioDiBordo
|
||||
WHERE idxMacchina = @idxMacchina
|
||||
AND idxStato <> @idxStato
|
||||
AND ISNULL(durataMinuti, 0) > @minDurata
|
||||
ORDER BY InizioStato DESC
|
||||
)
|
||||
|
||||
DECLARE @timeMinuti FLOAT
|
||||
SET @timeMinuti = ( SELECT DATEDIFF(n, @lastChTime, GetDate()) )
|
||||
|
||||
SELECT @idxStato AS idxStato, @timeMinuti AS Minuti
|
||||
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* Function f_lastTempoTecnico
|
||||
* calcola il tempo tecnico per un impianto dato idxMacchina e intervallo di tempo x filtraggio
|
||||
* utilizza migliori 10 tempi nell'intervallo e fa media
|
||||
*
|
||||
* modif.: S.E.L.
|
||||
* il: 2011.03.30
|
||||
**************************************/
|
||||
alter FUNCTION f_lastTempoTecnico
|
||||
(
|
||||
@idxMacchina NVARCHAR(50),
|
||||
@finestraOre INT
|
||||
)
|
||||
RETURNS DECIMAL(18,8)
|
||||
AS
|
||||
|
||||
|
||||
BEGIN
|
||||
DECLARE @TcTecnico AS DECIMAL (18,8)
|
||||
;WITH LastTempi AS
|
||||
(
|
||||
SELECT TOP 5 *
|
||||
FROM TempiCicloRilevati
|
||||
WHERE IdxMacchina = @idxMacchina
|
||||
AND DataOraRif >= DATEADD(HH,-@finestraOre,getdate())
|
||||
ORDER BY TCMedio
|
||||
)
|
||||
|
||||
SELECT @TcTecnico = AVG(TcMedio) FROM LastTempi
|
||||
RETURN @TcTecnico
|
||||
END
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(317, GETDATE())
|
||||
GO
|
||||
@@ -0,0 +1,420 @@
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_repDonati_getDatiProdMacchina
|
||||
* restituisce i dati di produzione di una macchina per l'ULTIMO ODL
|
||||
*
|
||||
* modif.: S.E.L. - 2012.03.08
|
||||
**************************************/
|
||||
alter PROCEDURE stp_repDonati_getDatiProdMacchina
|
||||
(
|
||||
@idxMacchina NVARCHAR(50)
|
||||
)
|
||||
AS
|
||||
|
||||
|
||||
-- calcolo codice articolo
|
||||
DECLARE @CodArticolo NVARCHAR (50)
|
||||
SET @CodArticolo = (
|
||||
SELECT CodArticolo FROM Kanban k
|
||||
INNER JOIN StatoMacchine sm ON k.MatricolaKanban=sm.MatricolaKanban
|
||||
WHERE sm.IdxMacchina = @idxMacchina
|
||||
)
|
||||
-- calcolo il codice operatore
|
||||
DECLARE @CodOperatore INT
|
||||
SET @CodOperatore = (
|
||||
SELECT MatrOpr FROM StatoMacchine
|
||||
WHERE IdxMacchina = @idxMacchina
|
||||
)
|
||||
-- calcolo il codice ODL
|
||||
DECLARE @idxODL INT
|
||||
SET @idxODL = (
|
||||
SELECT idxODL FROM ODL
|
||||
WHERE CodArticolo = @CodArticolo AND IdxMacchina = @idxMacchina AND (ISNULL(DataFine,DATEADD(hh,1,GETDATE())) > GETDATE())
|
||||
)
|
||||
|
||||
|
||||
DECLARE @PezziConf INT
|
||||
SET @PezziConf = (
|
||||
SELECT ISNULL(SUM(TotPzProd),0) FROM DatiProduzione
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @PezziLanciati INT
|
||||
SET @PezziLanciati =(
|
||||
SELECT ISNULL(SUM(NumPezzi),0) FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @TCAss DECIMAL(18,8)
|
||||
SET @TCAss = (
|
||||
SELECT ISNULL(SUM(TCAssegnato),0) FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
-- dato l'ODL calcolo il TC Medio ed i pezzi prodotti per l'ODL
|
||||
DECLARE @inizioOdl DATETIME
|
||||
SET @inizioOdl = (
|
||||
SELECT DataInizio FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @PezziProd INT
|
||||
SET @PezziProd = (
|
||||
SELECT COUNT(*) FROM TempiCicloRilevati
|
||||
WHERE DataOraRif >= @inizioOdl
|
||||
AND idxMacchina = @idxMacchina
|
||||
)
|
||||
|
||||
|
||||
/****************************************************
|
||||
* Calcolo tempi apertura confermati
|
||||
****************************************************/
|
||||
-- calcolo i tempi di apertura: TempoON (Verde + giallo + rosso)
|
||||
DECLARE @TempoOn DECIMAL(18,8)
|
||||
SET @TempoOn = (
|
||||
SELECT ISNULL(SUM(Tempo),0) FROM DatiProduzione
|
||||
WHERE ClasseTempo NOT IN ('T_OFF', 'T_OFF_ND') AND idxODL = @idxOdl
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoAuto (Verde + giallo) - precedente meno "T_FermoRosso"
|
||||
DECLARE @TempoAuto DECIMAL(18,8)
|
||||
SET @TempoAuto = (
|
||||
SELECT @TempoOn - ISNULL(SUM(Tempo),0) FROM DatiProduzione
|
||||
WHERE ClasseTempo = 'T_FermoRosso' AND idxODL = @idxOdl
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoRun (Verde)
|
||||
DECLARE @TempoRun DECIMAL(18,8)
|
||||
SET @TempoRun = (
|
||||
SELECT ISNULL(SUM(Tempo),0) FROM DatiProduzione
|
||||
WHERE ClasseTempo = 'T_AutoRun' AND idxODL = @idxOdl
|
||||
)
|
||||
|
||||
/****************************************************
|
||||
* Calcolo tempi apertura realtime
|
||||
****************************************************/
|
||||
-- calcolo i tempi di apertura: TempoON (Verde + giallo + rosso)
|
||||
DECLARE @TempoOnRT DECIMAL(18,8)
|
||||
SET @TempoOnRT = (
|
||||
SELECT ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo NOT IN ('T_OFF', 'T_OFF_ND') AND InizioStato >= @inizioOdl
|
||||
AND IdxMacchina = @idxMacchina
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoAuto (Verde + giallo) - precedente meno "T_FermoRosso"
|
||||
DECLARE @TempoAutoRT DECIMAL(18,8)
|
||||
SET @TempoAutoRT = (
|
||||
SELECT @TempoOnRT - ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo = 'T_FermoRosso' AND InizioStato >= @inizioOdl
|
||||
AND IdxMacchina = @idxMacchina
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoRun (Verde)
|
||||
DECLARE @TempoRunRT DECIMAL(18,8)
|
||||
SET @TempoRunRT = (
|
||||
SELECT ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo = 'T_AutoRun' AND InizioStato >= @inizioOdl
|
||||
AND IdxMacchina = @idxMacchina
|
||||
)
|
||||
|
||||
DECLARE @numPezzi INT
|
||||
|
||||
/****************************************************
|
||||
* Calcolo i TEMPI CICLO confermati
|
||||
****************************************************/
|
||||
|
||||
-- DIVISIONE PER ZERO: controllo pezzi conf > 0
|
||||
SET @numPezzi = @PezziConf
|
||||
IF(@numPezzi = 0) SET @numPezzi = 1
|
||||
|
||||
DECLARE @TCMed DECIMAL(18,8)
|
||||
SET @TCMed = (
|
||||
SELECT @TempoOn * 60 / @numPezzi -- tempo in ore
|
||||
)
|
||||
DECLARE @TCLav DECIMAL(18,8)
|
||||
SET @TCLav = (
|
||||
SELECT @TempoAuto * 60 / @numPezzi -- tempo in ore
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
DECLARE @TCEff DECIMAL(18,8) -- è la media degli ultimi 10 migliori tempi minimi nell'ultima giornata
|
||||
SET @TCEff = (
|
||||
SELECT @TempoRun * 60 / @numPezzi -- tempo in ore
|
||||
)
|
||||
|
||||
/****************************************************
|
||||
* Calcolo i TEMPI CICLO realtime (anche non confermati)
|
||||
****************************************************/
|
||||
|
||||
-- DIVISIONE PER ZERO: controllo pezzi prod > 0...
|
||||
SET @numPezzi = @PezziProd
|
||||
IF(@numPezzi = 0) SET @numPezzi = 1
|
||||
|
||||
DECLARE @TCMedRT DECIMAL(18,8)
|
||||
SET @TCMedRT = (
|
||||
SELECT @TempoOnRT / @numPezzi
|
||||
)
|
||||
DECLARE @TCLavRT DECIMAL(18,8)
|
||||
SET @TCLavRT = (
|
||||
SELECT @TempoAutoRT / @numPezzi
|
||||
)
|
||||
DECLARE @TCEffRT DECIMAL(18,8)
|
||||
SET @TCEffRT = ISNULL(( SELECT dbo.f_lastTempoTecnico(@idxMacchina, 2) ), -1) -- provo a calcolare ultimi tempi tecnici
|
||||
IF (@TCEffRT =-1)
|
||||
BEGIN
|
||||
SET @TCEffRT = (
|
||||
SELECT @TempoRunRT / @numPezzi
|
||||
)
|
||||
END
|
||||
|
||||
|
||||
SELECT @CodArticolo as CodArticolo, @PezziLanciati as PezziLanciati, @PezziProd as PezziProd, @PezziConf as PezziConf, @TCAss AS TCAssegnato, @CodOperatore AS CodOperatore, @TempoOn AS TempoOn, @TempoAuto AS TempoAuto, @TempoRun AS TempoRun, @TCMed AS TCMedio, @TCLav AS TCLav, @TCEff AS TCEff, @TCMedRT AS TCMedioRT, @TCLavRT AS TCLavRT, @TCEffRT AS TCEffRT
|
||||
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_repDonati_getDatiProdMacchina
|
||||
* restituisce i dati di produzione di una macchina per PERIODO
|
||||
*
|
||||
* modif.: S.E.L. - 2012.03.21
|
||||
**************************************/
|
||||
create PROCEDURE stp_repDonati_getDatiProdMacchinaPeriodo
|
||||
(
|
||||
@idxMacchina NVARCHAR(50),
|
||||
@dataFrom DATETIME,
|
||||
@dataTo DATETIME
|
||||
)
|
||||
AS
|
||||
|
||||
-- calcolo pezzi CONTATI, non quelli poi confermati...
|
||||
DECLARE @PezziProd INT
|
||||
SET @PezziProd = ISNULL((
|
||||
SELECT COUNT(*)FROM TempiCicloRilevati
|
||||
WHERE idxMacchina = @idxMacchina
|
||||
AND DataOraRif BETWEEN @dataFrom AND @dataTo
|
||||
), 0)
|
||||
|
||||
-- calcolo TEMPO MEDIO ponderato in base al num di pezzi per tipo...
|
||||
DECLARE @TCAss DECIMAL(18,8)
|
||||
|
||||
;WITH cte_tabMinProd as
|
||||
(
|
||||
SELECT ISNULL(COUNT(tcr.DataOraRif), 0) * ISNULL(o.TCAssegnato, 0) AS MinProd
|
||||
FROM TempiCicloRilevati tcr INNER JOIN ODL o
|
||||
ON o.IdxMacchina=tcr.IdxMacchina AND o.CodArticolo = tcr.CodArticolo
|
||||
WHERE tcr.DataOraRif BETWEEN o.DataInizio and o.DataFine
|
||||
AND tcr.DataOraRif BETWEEN @dataFrom AND @dataTo
|
||||
AND ((o.DataInizio <= @dataTo) AND (o.DataFine >= @dataFrom))
|
||||
GROUP BY o.TCAssegnato--, tcr.IdxMacchina, tcr.CodArticolo,
|
||||
)
|
||||
SELECT @TCAss = ISNULL(SUM(MinProd) / @PezziProd, 0)
|
||||
FROM cte_tabMinProd
|
||||
|
||||
|
||||
/****************************************************
|
||||
* Calcolo tempi apertura realtime
|
||||
****************************************************/
|
||||
-- calcolo i tempi di apertura: TempoON (Verde + giallo + rosso)
|
||||
DECLARE @TempoOnRT DECIMAL(18,8)
|
||||
SET @TempoOnRT = (
|
||||
SELECT ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo NOT IN ('T_OFF', 'T_OFF_ND') AND InizioStato BETWEEN @dataFrom AND @dataTo
|
||||
AND IdxMacchina = @idxMacchina
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoAuto (Verde + giallo) - precedente meno "T_FermoRosso"
|
||||
DECLARE @TempoAutoRT DECIMAL(18,8)
|
||||
SET @TempoAutoRT = (
|
||||
SELECT @TempoOnRT - ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo = 'T_FermoRosso' AND InizioStato BETWEEN @dataFrom AND @dataTo
|
||||
AND IdxMacchina = @idxMacchina
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoRun (Verde)
|
||||
DECLARE @TempoRunRT DECIMAL(18,8)
|
||||
SET @TempoRunRT = (
|
||||
SELECT ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo = 'T_AutoRun' AND InizioStato BETWEEN @dataFrom AND @dataTo
|
||||
AND IdxMacchina = @idxMacchina
|
||||
)
|
||||
|
||||
|
||||
|
||||
/****************************************************
|
||||
* Calcolo i TEMPI CICLO realtime (anche non confermati)
|
||||
****************************************************/
|
||||
|
||||
-- DIVISIONE PER ZERO: controllo pezzi prod > 0...
|
||||
DECLARE @numPezzi INT
|
||||
SET @numPezzi = @PezziProd
|
||||
IF(@numPezzi = 0) SET @numPezzi = 1
|
||||
|
||||
DECLARE @TCMedRT DECIMAL(18,8)
|
||||
SET @TCMedRT = (
|
||||
SELECT @TempoOnRT / @numPezzi
|
||||
)
|
||||
DECLARE @TCLavRT DECIMAL(18,8)
|
||||
SET @TCLavRT = (
|
||||
SELECT @TempoAutoRT / @numPezzi
|
||||
)
|
||||
DECLARE @TCEffRT DECIMAL(18,8)
|
||||
SET @TCEffRT = ISNULL(( SELECT dbo.f_lastTempoTecnico(@idxMacchina, 2) ), -1) -- provo a calcolare ultimi tempi tecnici
|
||||
IF (@TCEffRT =-1)
|
||||
BEGIN
|
||||
SET @TCEffRT = (
|
||||
SELECT @TempoRunRT / @numPezzi
|
||||
)
|
||||
END
|
||||
|
||||
|
||||
SELECT @PezziProd as PezziProd, @TCAss AS TCAssegnato, @TCMedRT AS TCMedioRT, @TCLavRT AS TCLavRT, @TCEffRT AS TCEffRT
|
||||
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_repDonati_getDatiProdMacchina
|
||||
* restituisce i dati di produzione di una macchina per PERIODO
|
||||
*
|
||||
* modif.: S.E.L. - 2012.03.21
|
||||
**************************************/
|
||||
alter PROCEDURE stp_repDonati_getDatiProdMacchinaPeriodo
|
||||
(
|
||||
@idxMacchina NVARCHAR(50),
|
||||
@dataFrom DATETIME,
|
||||
@dataTo DATETIME
|
||||
)
|
||||
AS
|
||||
|
||||
-- calcolo pezzi CONTATI, non quelli poi confermati...
|
||||
DECLARE @PezziProd INT
|
||||
SET @PezziProd = ISNULL((
|
||||
SELECT COUNT(*)FROM TempiCicloRilevati
|
||||
WHERE idxMacchina = @idxMacchina
|
||||
AND DataOraRif BETWEEN @dataFrom AND @dataTo
|
||||
), 0)
|
||||
|
||||
-- calcolo TEMPO MEDIO ponderato in base al num di pezzi per tipo...
|
||||
DECLARE @TCAss DECIMAL(18,8)
|
||||
|
||||
;WITH cte_tabMinProd as
|
||||
(
|
||||
SELECT ISNULL(COUNT(tcr.DataOraRif), 0) * ISNULL(o.TCAssegnato, 0) AS MinProd
|
||||
FROM TempiCicloRilevati tcr INNER JOIN ODL o
|
||||
ON o.IdxMacchina=tcr.IdxMacchina AND o.CodArticolo = tcr.CodArticolo
|
||||
WHERE tcr.DataOraRif BETWEEN o.DataInizio AND ISNULL(o.DataFine, GETDATE())
|
||||
AND tcr.DataOraRif BETWEEN @dataFrom AND @dataTo
|
||||
AND ((o.DataInizio <= @dataTo) AND (ISNULL(o.DataFine, GETDATE()) >= @dataFrom))
|
||||
GROUP BY o.TCAssegnato
|
||||
)
|
||||
SELECT @TCAss = ISNULL(SUM(MinProd) / @PezziProd, 0)
|
||||
FROM cte_tabMinProd
|
||||
|
||||
|
||||
/****************************************************
|
||||
* Calcolo tempi apertura realtime
|
||||
****************************************************/
|
||||
-- calcolo i tempi di apertura: TempoON (Verde + giallo + rosso)
|
||||
DECLARE @TempoOnRT DECIMAL(18,8)
|
||||
SET @TempoOnRT = (
|
||||
SELECT ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo NOT IN ('T_OFF', 'T_OFF_ND') AND InizioStato BETWEEN @dataFrom AND @dataTo
|
||||
AND IdxMacchina = @idxMacchina
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoAuto (Verde + giallo) - precedente meno "T_FermoRosso"
|
||||
DECLARE @TempoAutoRT DECIMAL(18,8)
|
||||
SET @TempoAutoRT = (
|
||||
SELECT @TempoOnRT - ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo = 'T_FermoRosso' AND InizioStato BETWEEN @dataFrom AND @dataTo
|
||||
AND IdxMacchina = @idxMacchina
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoRun (Verde)
|
||||
DECLARE @TempoRunRT DECIMAL(18,8)
|
||||
SET @TempoRunRT = (
|
||||
SELECT ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo = 'T_AutoRun' AND InizioStato BETWEEN @dataFrom AND @dataTo
|
||||
AND IdxMacchina = @idxMacchina
|
||||
)
|
||||
|
||||
|
||||
|
||||
/****************************************************
|
||||
* Calcolo i TEMPI CICLO realtime (anche non confermati)
|
||||
****************************************************/
|
||||
|
||||
-- DIVISIONE PER ZERO: controllo pezzi prod > 0...
|
||||
DECLARE @numPezzi INT
|
||||
SET @numPezzi = @PezziProd
|
||||
IF(@numPezzi = 0) SET @numPezzi = 1
|
||||
|
||||
DECLARE @TCMedRT DECIMAL(18,8)
|
||||
SET @TCMedRT = (
|
||||
SELECT @TempoOnRT / @numPezzi
|
||||
)
|
||||
DECLARE @TCLavRT DECIMAL(18,8)
|
||||
SET @TCLavRT = (
|
||||
SELECT @TempoAutoRT / @numPezzi
|
||||
)
|
||||
DECLARE @TCEffRT DECIMAL(18,8)
|
||||
SET @TCEffRT = ISNULL(( SELECT dbo.f_lastTempoTecnico(@idxMacchina, 2) ), -1) -- provo a calcolare ultimi tempi tecnici
|
||||
IF (@TCEffRT =-1)
|
||||
BEGIN
|
||||
SET @TCEffRT = (
|
||||
SELECT @TempoRunRT / @numPezzi
|
||||
)
|
||||
END
|
||||
|
||||
|
||||
SELECT @PezziProd as PezziProd, @TCAss AS TCAssegnato, @TCMedRT AS TCMedioRT, @TCLavRT AS TCLavRT, @TCEffRT AS TCEffRT
|
||||
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(318, GETDATE())
|
||||
GO
|
||||
@@ -0,0 +1,444 @@
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* Function f_lastTempoTecnico
|
||||
* calcola il tempo tecnico per un impianto dato idxMacchina e intervallo di tempo x filtraggio
|
||||
* utilizza migliori 10 tempi nell'intervallo e fa media
|
||||
*
|
||||
* modif.: S.E.L.
|
||||
* il: 2011.03.30
|
||||
**************************************/
|
||||
alter FUNCTION f_lastTempoTecnico
|
||||
(
|
||||
@idxMacchina NVARCHAR(50),
|
||||
@finestraOre INT
|
||||
)
|
||||
RETURNS DECIMAL(18,8)
|
||||
AS
|
||||
|
||||
|
||||
BEGIN
|
||||
DECLARE @TcTecnico AS DECIMAL (18,8)
|
||||
;WITH LastTempi AS
|
||||
(
|
||||
SELECT TOP 5 *
|
||||
FROM TempiCicloRilevati
|
||||
WHERE IdxMacchina = @idxMacchina
|
||||
AND DataOraRif >= DATEADD(HH,-@finestraOre,getdate())
|
||||
ORDER BY TCMedio
|
||||
)
|
||||
|
||||
SELECT @TcTecnico = ISNULL(MIN(TcMedio),0) FROM LastTempi
|
||||
--SELECT @TcTecnico = AVG(TcMedio) FROM LastTempi
|
||||
RETURN @TcTecnico
|
||||
END
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_repDonati_getDatiProdMacchina
|
||||
* restituisce i dati di produzione di una macchina per l'ULTIMO ODL
|
||||
*
|
||||
* modif.: S.E.L. - 2012.03.08
|
||||
**************************************/
|
||||
alter PROCEDURE stp_repDonati_getDatiProdMacchina
|
||||
(
|
||||
@idxMacchina NVARCHAR(50)
|
||||
)
|
||||
AS
|
||||
|
||||
|
||||
-- calcolo codice articolo
|
||||
DECLARE @CodArticolo NVARCHAR (50)
|
||||
SET @CodArticolo = (
|
||||
SELECT CodArticolo FROM Kanban k
|
||||
INNER JOIN StatoMacchine sm ON k.MatricolaKanban=sm.MatricolaKanban
|
||||
WHERE sm.IdxMacchina = @idxMacchina
|
||||
)
|
||||
-- calcolo il codice operatore
|
||||
DECLARE @CodOperatore INT
|
||||
SET @CodOperatore = (
|
||||
SELECT MatrOpr FROM StatoMacchine
|
||||
WHERE IdxMacchina = @idxMacchina
|
||||
)
|
||||
-- calcolo il codice ODL
|
||||
DECLARE @idxODL INT
|
||||
SET @idxODL = (
|
||||
SELECT idxODL FROM ODL
|
||||
WHERE CodArticolo = @CodArticolo AND IdxMacchina = @idxMacchina AND (ISNULL(DataFine,DATEADD(hh,1,GETDATE())) > GETDATE())
|
||||
)
|
||||
|
||||
|
||||
DECLARE @PezziConf INT
|
||||
SET @PezziConf = (
|
||||
SELECT ISNULL(SUM(TotPzProd),0) FROM DatiProduzione
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @PezziLanciati INT
|
||||
SET @PezziLanciati =(
|
||||
SELECT ISNULL(SUM(NumPezzi),0) FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @TCAss DECIMAL(18,8)
|
||||
SET @TCAss = (
|
||||
SELECT ISNULL(SUM(TCAssegnato),0) FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
-- dato l'ODL calcolo il TC Medio ed i pezzi prodotti per l'ODL
|
||||
DECLARE @inizioOdl DATETIME
|
||||
SET @inizioOdl = (
|
||||
SELECT DataInizio FROM ODL
|
||||
WHERE idxODL = @idxOdl
|
||||
)
|
||||
|
||||
DECLARE @PezziProd INT
|
||||
SET @PezziProd = (
|
||||
SELECT COUNT(*) FROM TempiCicloRilevati
|
||||
WHERE DataOraRif >= @inizioOdl
|
||||
AND idxMacchina = @idxMacchina
|
||||
)
|
||||
|
||||
|
||||
/****************************************************
|
||||
* Calcolo tempi apertura confermati
|
||||
****************************************************/
|
||||
-- calcolo i tempi di apertura: TempoON (Verde + giallo + rosso)
|
||||
DECLARE @TempoOn DECIMAL(18,8)
|
||||
SET @TempoOn = (
|
||||
SELECT ISNULL(SUM(Tempo),0) FROM DatiProduzione
|
||||
WHERE ClasseTempo NOT IN ('T_OFF', 'T_OFF_ND') AND idxODL = @idxOdl
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoAuto (Verde + giallo) - precedente meno "T_FermoRosso"
|
||||
DECLARE @TempoAuto DECIMAL(18,8)
|
||||
SET @TempoAuto = (
|
||||
SELECT @TempoOn - ISNULL(SUM(Tempo),0) FROM DatiProduzione
|
||||
WHERE ClasseTempo = 'T_FermoRosso' AND idxODL = @idxOdl
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoRun (Verde)
|
||||
DECLARE @TempoRun DECIMAL(18,8)
|
||||
SET @TempoRun = (
|
||||
SELECT ISNULL(SUM(Tempo),0) FROM DatiProduzione
|
||||
WHERE ClasseTempo = 'T_AutoRun' AND idxODL = @idxOdl
|
||||
)
|
||||
|
||||
/****************************************************
|
||||
* Calcolo tempi apertura realtime
|
||||
****************************************************/
|
||||
-- calcolo i tempi di apertura: TempoON (Verde + giallo + rosso)
|
||||
DECLARE @TempoOnRT DECIMAL(18,8)
|
||||
SET @TempoOnRT = (
|
||||
SELECT ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo NOT IN ('T_OFF', 'T_OFF_ND') AND InizioStato >= @inizioOdl
|
||||
AND IdxMacchina = @idxMacchina
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoAuto (Verde + giallo) - precedente meno "T_FermoRosso"
|
||||
DECLARE @TempoAutoRT DECIMAL(18,8)
|
||||
SET @TempoAutoRT = (
|
||||
SELECT @TempoOnRT - ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo = 'T_FermoRosso' AND InizioStato >= @inizioOdl
|
||||
AND IdxMacchina = @idxMacchina
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoRun (Verde)
|
||||
DECLARE @TempoRunRT DECIMAL(18,8)
|
||||
SET @TempoRunRT = (
|
||||
SELECT ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo = 'T_AutoRun' AND InizioStato >= @inizioOdl
|
||||
AND IdxMacchina = @idxMacchina
|
||||
)
|
||||
|
||||
DECLARE @numPezzi INT
|
||||
|
||||
/****************************************************
|
||||
* Calcolo i TEMPI CICLO confermati
|
||||
****************************************************/
|
||||
|
||||
-- DIVISIONE PER ZERO: controllo pezzi conf > 0
|
||||
SET @numPezzi = @PezziConf - 1 -- divido per n-1 per avere numIntervalli = numPezzi
|
||||
IF(@numPezzi < 1) SET @numPezzi = 1
|
||||
|
||||
DECLARE @TCMed DECIMAL(18,8)
|
||||
SET @TCMed = (
|
||||
SELECT @TempoOn * 60 / @numPezzi -- tempo in ore
|
||||
)
|
||||
DECLARE @TCLav DECIMAL(18,8)
|
||||
SET @TCLav = (
|
||||
SELECT @TempoAuto * 60 / @numPezzi -- tempo in ore
|
||||
)
|
||||
DECLARE @TCEff DECIMAL(18,8) -- è la media degli ultimi 10 migliori tempi minimi nell'ultima giornata
|
||||
SET @TCEff = (
|
||||
SELECT @TempoRun * 60 / @numPezzi -- tempo in ore
|
||||
)
|
||||
|
||||
/****************************************************
|
||||
* Calcolo i TEMPI CICLO realtime (anche non confermati)
|
||||
****************************************************/
|
||||
|
||||
-- DIVISIONE PER ZERO: controllo pezzi prod > 0...
|
||||
SET @numPezzi = @PezziProd - 1 -- divido per n-1 per avere numIntervalli = numPezzi
|
||||
IF(@numPezzi < 1) SET @numPezzi = 1
|
||||
|
||||
DECLARE @TCMedRT DECIMAL(18,8)
|
||||
SET @TCMedRT = (
|
||||
SELECT @TempoOnRT / @numPezzi
|
||||
)
|
||||
DECLARE @TCLavRT DECIMAL(18,8)
|
||||
SET @TCLavRT = (
|
||||
SELECT @TempoAutoRT / @numPezzi
|
||||
)
|
||||
DECLARE @TCEffRT DECIMAL(18,8)
|
||||
SET @TCEffRT = ISNULL(( SELECT dbo.f_lastTempoTecnico(@idxMacchina, 2) ), -1) -- provo a calcolare ultimi tempi tecnici
|
||||
IF (@TCEffRT =-1)
|
||||
BEGIN
|
||||
SET @TCEffRT = (
|
||||
SELECT @TempoRunRT / @numPezzi
|
||||
)
|
||||
END
|
||||
|
||||
|
||||
SELECT @CodArticolo as CodArticolo, @PezziLanciati as PezziLanciati, @PezziProd as PezziProd, @PezziConf as PezziConf, @TCAss AS TCAssegnato, @CodOperatore AS CodOperatore, @TempoOn AS TempoOn, @TempoAuto AS TempoAuto, @TempoRun AS TempoRun, @TCMed AS TCMedio, @TCLav AS TCLav, @TCEff AS TCEff, @TCMedRT AS TCMedioRT, @TCLavRT AS TCLavRT, @TCEffRT AS TCEffRT
|
||||
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_repDonati_getLastStatoDurataMacchina
|
||||
* restituisce l'ultimo stato di una macchina e la durata
|
||||
* andando a filtrare gli eventi sotto una soglia indicata @minDurata (in minuti)
|
||||
* e quindi sommando
|
||||
*
|
||||
* modif.: S.E.L. - 2012.03.08
|
||||
**************************************/
|
||||
alter PROCEDURE stp_repDonati_getLastStatoDurataMacchina
|
||||
(
|
||||
@idxMacchina NVARCHAR(50),
|
||||
@minDurata FLOAT
|
||||
)
|
||||
AS
|
||||
|
||||
-- calcolo codice articolo
|
||||
DECLARE @idxStato INT
|
||||
SET @idxStato = (
|
||||
SELECT TOP 1 ISNULL(IdxStato,0)
|
||||
FROM DiarioDiBordo
|
||||
WHERE idxMacchina = @idxMacchina
|
||||
--AND ISNULL(durataMinuti, 0) > @minDurata
|
||||
ORDER BY InizioStato DESC
|
||||
)
|
||||
-- calcolo durata filtrata... ovvero evento più recente NON dello stato indicato (changed)
|
||||
DECLARE @lastChTime DATETIME
|
||||
SET @lastChTime = (
|
||||
SELECT TOP 1 ISNULL(inizioStato, GetDate())
|
||||
FROM DiarioDiBordo
|
||||
WHERE idxMacchina = @idxMacchina
|
||||
AND idxStato <> @idxStato
|
||||
AND ISNULL(durataMinuti, 0) > @minDurata
|
||||
ORDER BY InizioStato DESC
|
||||
)
|
||||
|
||||
DECLARE @timeMinuti FLOAT
|
||||
SET @timeMinuti = ( SELECT DATEDIFF(n, @lastChTime, GetDate()) )
|
||||
|
||||
SELECT @idxStato AS idxStato, @timeMinuti AS Minuti
|
||||
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_repDonati_getDatiProdMacchina
|
||||
* restituisce i dati di produzione di una macchina per PERIODO
|
||||
*
|
||||
* modif.: S.E.L. - 2012.03.21
|
||||
**************************************/
|
||||
alter PROCEDURE stp_repDonati_getDatiProdMacchinaPeriodo
|
||||
(
|
||||
@idxMacchina NVARCHAR(50),
|
||||
@dataFrom DATETIME,
|
||||
@dataTo DATETIME
|
||||
)
|
||||
AS
|
||||
|
||||
-- calcolo pezzi CONTATI, non quelli poi confermati...
|
||||
DECLARE @PezziProd INT
|
||||
SET @PezziProd = ISNULL((
|
||||
SELECT COUNT(*)FROM TempiCicloRilevati
|
||||
WHERE idxMacchina = @idxMacchina
|
||||
AND DataOraRif BETWEEN @dataFrom AND @dataTo
|
||||
), 0)
|
||||
|
||||
-- calcolo TEMPO MEDIO ponderato in base al num di pezzi per tipo...
|
||||
DECLARE @TCAss DECIMAL(18,8)
|
||||
|
||||
;WITH cte_tabMinProd as
|
||||
(
|
||||
SELECT ISNULL(COUNT(tcr.DataOraRif), 0) * ISNULL(o.TCAssegnato, 0) AS MinProd
|
||||
FROM TempiCicloRilevati tcr INNER JOIN ODL o
|
||||
ON o.IdxMacchina=tcr.IdxMacchina AND o.CodArticolo = tcr.CodArticolo
|
||||
WHERE tcr.DataOraRif BETWEEN o.DataInizio AND ISNULL(o.DataFine, GETDATE())
|
||||
AND tcr.DataOraRif BETWEEN @dataFrom AND @dataTo
|
||||
AND ((o.DataInizio <= @dataTo) AND (ISNULL(o.DataFine, GETDATE()) >= @dataFrom))
|
||||
GROUP BY o.TCAssegnato
|
||||
)
|
||||
SELECT @TCAss = ISNULL(SUM(MinProd) / @PezziProd, 0)
|
||||
FROM cte_tabMinProd
|
||||
|
||||
|
||||
/****************************************************
|
||||
* Calcolo tempi apertura realtime
|
||||
****************************************************/
|
||||
-- calcolo i tempi di apertura: TempoON (Verde + giallo + rosso)
|
||||
DECLARE @TempoOnRT DECIMAL(18,8)
|
||||
SET @TempoOnRT = (
|
||||
SELECT ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo NOT IN ('T_OFF', 'T_OFF_ND') AND InizioStato BETWEEN @dataFrom AND @dataTo
|
||||
AND IdxMacchina = @idxMacchina
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoAuto (Verde + giallo) - precedente meno "T_FermoRosso"
|
||||
DECLARE @TempoAutoRT DECIMAL(18,8)
|
||||
SET @TempoAutoRT = (
|
||||
SELECT @TempoOnRT - ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo = 'T_FermoRosso' AND InizioStato BETWEEN @dataFrom AND @dataTo
|
||||
AND IdxMacchina = @idxMacchina
|
||||
)
|
||||
|
||||
-- calcolo i tempi di apertura: TempoRun (Verde)
|
||||
DECLARE @TempoRunRT DECIMAL(18,8)
|
||||
SET @TempoRunRT = (
|
||||
SELECT ISNULL(SUM(DurataMinuti),0)
|
||||
FROM DiarioDiBordo ddb INNER JOIN AnagraficaStati AnSt ON ddb.IdxStato= AnSt.IdxStato
|
||||
WHERE AnSt.ClasseTempo = 'T_AutoRun' AND InizioStato BETWEEN @dataFrom AND @dataTo
|
||||
AND IdxMacchina = @idxMacchina
|
||||
)
|
||||
|
||||
|
||||
|
||||
/****************************************************
|
||||
* Calcolo i TEMPI CICLO realtime (anche non confermati)
|
||||
****************************************************/
|
||||
|
||||
-- DIVISIONE PER ZERO: controllo pezzi prod > 0...
|
||||
DECLARE @numPezzi INT
|
||||
SET @numPezzi = @PezziProd - 1 -- divido per n-1 per avere numIntervalli = numPezzi
|
||||
IF(@numPezzi < 1) SET @numPezzi = 1
|
||||
|
||||
DECLARE @TCMedRT DECIMAL(18,8)
|
||||
SET @TCMedRT = (
|
||||
SELECT @TempoOnRT / @numPezzi
|
||||
)
|
||||
DECLARE @TCLavRT DECIMAL(18,8)
|
||||
SET @TCLavRT = (
|
||||
SELECT @TempoAutoRT / @numPezzi
|
||||
)
|
||||
DECLARE @TCEffRT DECIMAL(18,8)
|
||||
SET @TCEffRT = ISNULL(( SELECT dbo.f_lastTempoTecnico(@idxMacchina, 2) ), -1) -- provo a calcolare ultimi tempi tecnici
|
||||
IF (@TCEffRT =-1)
|
||||
BEGIN
|
||||
SET @TCEffRT = (
|
||||
SELECT @TempoRunRT / @numPezzi
|
||||
)
|
||||
END
|
||||
|
||||
|
||||
SELECT @PezziProd as PezziProd, @TCAss AS TCAssegnato, @TCMedRT AS TCMedioRT, @TCLavRT AS TCLavRT, @TCEffRT AS TCEffRT
|
||||
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* Function f_TC_60-100
|
||||
* converte il tempo in min e sec (60)
|
||||
* in minuti centesimali (100)
|
||||
*
|
||||
* modif.: S.E.L.
|
||||
* il: 2012.03.22
|
||||
**************************************/
|
||||
create FUNCTION f_TC_60_100
|
||||
(
|
||||
@TC_60 DECIMAL(18,8)
|
||||
)
|
||||
RETURNS DECIMAL(18,8)
|
||||
AS
|
||||
|
||||
|
||||
BEGIN
|
||||
DECLARE @TC_100 AS DECIMAL (18,8)
|
||||
|
||||
SELECT @TC_100 = FLOOR(@TC_60) + (@TC_60 - FLOOR(@TC_60)) * 100 / 60
|
||||
|
||||
RETURN @TC_100
|
||||
END
|
||||
go
|
||||
|
||||
|
||||
|
||||
update ODL
|
||||
set TCAssegnato = dbo.f_TC_60_100(TCAssegnato)
|
||||
|
||||
update DatiProduzione
|
||||
set TCAssegnato = dbo.f_TC_60_100(TCAssegnato)
|
||||
|
||||
update TempiCicloTeorici
|
||||
set TCAssegnato = dbo.f_TC_60_100(TCAssegnato)
|
||||
|
||||
update DatiConfermati
|
||||
set TCAssegnato = dbo.f_TC_60_100(TCAssegnato)
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(319, GETDATE())
|
||||
GO
|
||||
@@ -0,0 +1,304 @@
|
||||
/*******************************************************
|
||||
* GESTIONE NUOVO EVENTO per timeout contapezzo
|
||||
*******************************************************/
|
||||
|
||||
-- tab eventi, nuovo evento 27
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
INSERT INTO dbo.AnagraficaEventi
|
||||
VALUES (27, N'Timer - timeout tempo ciclo', N'', N'')
|
||||
go
|
||||
|
||||
commit transaction
|
||||
go
|
||||
|
||||
|
||||
-- tab transazioneEventi x andare da lavora a fermoGenerico
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 13, 27, 12)
|
||||
go
|
||||
|
||||
commit transaction
|
||||
go
|
||||
|
||||
|
||||
create table TurniMacchina(
|
||||
IdxMacchina nvarchar(50) not null constraint PK_TurniMacchina primary key,
|
||||
T1 bit,
|
||||
T2 bit,
|
||||
T3 bit
|
||||
);
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
INSERT INTO dbo.TurniMacchina
|
||||
VALUES (N'1005', 1, 1, 0)
|
||||
go
|
||||
|
||||
commit transaction
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_DatiProd_getByMacchPeriodo
|
||||
*
|
||||
* recupera i dati confermati x una macchina e periodo, ordinati in data DESC
|
||||
*
|
||||
* modif.: S.E.L.
|
||||
* il: 2011.07.04
|
||||
**************************************/
|
||||
alter PROCEDURE stp_DatiProd_getByMacchPeriodo
|
||||
(
|
||||
@idxMacchina NVARCHAR(50),
|
||||
@dataFrom DATETIME,
|
||||
@dataTo DATETIME
|
||||
)
|
||||
AS
|
||||
|
||||
SELECT *
|
||||
FROM DatiProduzione
|
||||
WHERE IdxMacchina = @idxMacchina AND (DataRif >= @dataFrom AND DataRif <= @dataTo)
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_turniMacchineByIdxMacc
|
||||
* elenco turni x macchina
|
||||
*
|
||||
* modif.: S.E.L. - 2012.03.26
|
||||
**************************************/
|
||||
create PROCEDURE stp_turniMacchineByIdxMacc
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50)
|
||||
)
|
||||
AS
|
||||
|
||||
SELECT *
|
||||
FROM TurniMacchina
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* Function f_lastTempoTecnico
|
||||
* calcola il tempo tecnico per un impianto dato idxMacchina e intervallo di tempo x filtraggio
|
||||
* utilizza migliori 10 tempi nell'intervallo e fa media
|
||||
*
|
||||
* modif.: S.E.L.
|
||||
* il: 2011.03.30
|
||||
**************************************/
|
||||
alter FUNCTION f_lastTempoTecnico
|
||||
(
|
||||
@idxMacchina NVARCHAR(50),
|
||||
@finestraOre INT
|
||||
)
|
||||
RETURNS DECIMAL(18,8)
|
||||
AS
|
||||
|
||||
|
||||
BEGIN
|
||||
DECLARE @TcTecnico AS DECIMAL (18,8)
|
||||
;WITH LastTempi AS
|
||||
(
|
||||
SELECT TOP 5 *
|
||||
FROM TempiCicloRilevati
|
||||
WHERE IdxMacchina = @idxMacchina
|
||||
AND DataOraRif >= DATEADD(HH,-@finestraOre,getdate())
|
||||
ORDER BY TCMedio
|
||||
)
|
||||
|
||||
SELECT @TcTecnico = ISNULL(AVG(TcMedio), 0) FROM LastTempi
|
||||
--SELECT @TcTecnico = ISNULL(MIN(TcMedio), 0) FROM LastTempi
|
||||
--SELECT @TcTecnico = AVG(TcMedio) FROM LastTempi
|
||||
RETURN @TcTecnico
|
||||
END
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_turniMacchineUpdateTurno
|
||||
* cambia il turno specificato per la macchina (toggle: attivo/disattivo)
|
||||
*
|
||||
* modif.: S.E.L. - 2012.03.26
|
||||
**************************************/
|
||||
create PROCEDURE stp_turniMacchineUpdateTurno
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@numTurno INT
|
||||
)
|
||||
AS
|
||||
|
||||
-- in base al turno indicato cambio solo uno
|
||||
UPDATE TurniMacchina
|
||||
SET T1 = CASE @numTurno WHEN 1 THEN 1-T1 ELSE T1 END,
|
||||
T2 = CASE @numTurno WHEN 2 THEN 1-T2 ELSE T2 END,
|
||||
T3 = CASE @numTurno WHEN 3 THEN 1-T3 ELSE T3 END
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
INSERT INTO dbo.AnagraficaEventi
|
||||
VALUES (28, N'Timer - timeout TURNO by tempo ciclo', N'', N'')
|
||||
go
|
||||
|
||||
commit transaction
|
||||
go
|
||||
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 1, 28, 26)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 2, 28, 26)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 3, 28, 26)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 4, 28, 26)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 5, 28, 26)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 6, 28, 26)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 7, 28, 26)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 8, 28, 26)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 9, 28, 26)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 10, 28, 26)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 12, 28, 26)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 13, 28, 26)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 14, 28, 26)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 15, 28, 26)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 23, 28, 26)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 24, 28, 26)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 25, 28, 26)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 26, 14, 11)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 26, 15, 12)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 26, 16, 13)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 26, 17, 14)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 26, 18, 15)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 26, 20, 14)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 26, 21, 13)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 26, 22, 14)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 26, 23, 23)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 26, 24, 24)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 26, 25, 25)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 26, 26, 27)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 27, 14, 11)
|
||||
INSERT INTO dbo.TransizioneStati
|
||||
VALUES (10, 27, 28, 26)
|
||||
DELETE FROM dbo.TransizioneStati WHERE IdxFamiglia=10 and IdxStato=11 and IdxTipo=14
|
||||
go
|
||||
|
||||
commit transaction
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(320, GETDATE())
|
||||
GO
|
||||
@@ -0,0 +1,123 @@
|
||||
create table AnagraficaStatiOld(
|
||||
IdxStato int not null,
|
||||
Descrizione nvarchar(50),
|
||||
Semaforo nvarchar(50),
|
||||
Priorita int,
|
||||
ClasseTempo nvarchar(50)
|
||||
)
|
||||
go
|
||||
|
||||
|
||||
--
|
||||
|
||||
create table DatiConf_old(
|
||||
IdxConferma int not null identity,
|
||||
IdxODL int not null,
|
||||
DataOraApp datetime not null,
|
||||
DataRif datetime not null,
|
||||
TurnoRif int,
|
||||
CodArticolo nvarchar(50),
|
||||
IdxMacchina nvarchar(50) not null,
|
||||
TCAssegnato decimal(18,8),
|
||||
MatrOpr int,
|
||||
MatrApp int not null,
|
||||
DataOraFrom datetime,
|
||||
DataOraTo datetime,
|
||||
IdxStato int not null,
|
||||
TotPzProd int,
|
||||
TempoProdotto decimal(18,8),
|
||||
TempoCron decimal(18,8),
|
||||
TempoND decimal(18,8),
|
||||
TempoApertura decimal(18,8),
|
||||
TempoOFF decimal(18,8),
|
||||
TempoON decimal(18,8),
|
||||
TempoFermoOn decimal(18,8),
|
||||
TempoAuto decimal(18,8),
|
||||
TempoFermoAuto decimal(18,8),
|
||||
TempoRun decimal(18,8),
|
||||
TotPzFermo int
|
||||
)
|
||||
go
|
||||
|
||||
|
||||
--
|
||||
|
||||
create table DatiConf_older(
|
||||
IdxConferma int not null identity,
|
||||
IdxODL int not null,
|
||||
DataOraApp datetime not null,
|
||||
DataRif datetime not null,
|
||||
TurnoRif int,
|
||||
CodArticolo nvarchar(50),
|
||||
IdxMacchina nvarchar(50) not null,
|
||||
TCAssegnato decimal(18,8),
|
||||
MatrOpr int,
|
||||
MatrApp int not null,
|
||||
DataOraFrom datetime,
|
||||
DataOraTo datetime,
|
||||
IdxStato int not null,
|
||||
TotPzProd int,
|
||||
TempoProdotto decimal(18,8),
|
||||
TempoCron decimal(18,8),
|
||||
TempoND decimal(18,8),
|
||||
TempoApertura decimal(18,8),
|
||||
TempoOFF decimal(18,8),
|
||||
TempoON decimal(18,8),
|
||||
TempoFermoOn decimal(18,8),
|
||||
TempoAuto decimal(18,8),
|
||||
TempoFermoAuto decimal(18,8),
|
||||
TempoRun decimal(18,8),
|
||||
TotPzFermo int
|
||||
)
|
||||
go
|
||||
|
||||
|
||||
--
|
||||
|
||||
create table DatiProd_old(
|
||||
IdxConferma int not null identity,
|
||||
IdxODL int not null,
|
||||
DataOraApp datetime not null,
|
||||
DataRif datetime not null,
|
||||
TurnoRif int,
|
||||
CodArticolo nvarchar(50),
|
||||
IdxMacchina nvarchar(50) not null,
|
||||
TCAssegnato decimal(18,8),
|
||||
MatrOpr int,
|
||||
MatrApp int not null,
|
||||
DataOraFrom datetime,
|
||||
DataOraTo datetime,
|
||||
TotPzProd int,
|
||||
Tempo decimal(18,8),
|
||||
ClasseTempo nvarchar(50)
|
||||
)
|
||||
go
|
||||
|
||||
|
||||
--
|
||||
|
||||
create table DatiProd_older(
|
||||
IdxConferma int not null identity,
|
||||
IdxODL int not null,
|
||||
DataOraApp datetime not null,
|
||||
DataRif datetime not null,
|
||||
TurnoRif int,
|
||||
CodArticolo nvarchar(50),
|
||||
IdxMacchina nvarchar(50) not null,
|
||||
TCAssegnato decimal(18,8),
|
||||
MatrOpr int,
|
||||
MatrApp int not null,
|
||||
DataOraFrom datetime,
|
||||
DataOraTo datetime,
|
||||
TotPzProd int,
|
||||
Tempo decimal(18,8),
|
||||
ClasseTempo nvarchar(50)
|
||||
)
|
||||
go
|
||||
|
||||
|
||||
--
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(301, GETDATE())
|
||||
GO
|
||||
@@ -0,0 +1,17 @@
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
UPDATE dbo.AnagraficaStati SET
|
||||
ShowArticolo=1
|
||||
WHERE IdxStato=1
|
||||
go
|
||||
|
||||
commit transaction
|
||||
go
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(302, GETDATE())
|
||||
GO
|
||||
@@ -0,0 +1,356 @@
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
alter table DatiMacchine add
|
||||
insEnabled bit constraint DF_DatiMacchine_insEnabled default ((1));
|
||||
go
|
||||
|
||||
exec sp_addextendedproperty 'MS_Description', 'definisce se l''INSERT sia abilitato per la macchina (disabilitato in fase di ricostruzione batch...)', 'SCHEMA', 'dbo', 'TABLE', 'DatiMacchine', 'COLUMN', 'insEnabled';
|
||||
go
|
||||
|
||||
update DatiMacchine set insEnabled=((1));
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE InsStatoBatch
|
||||
* inserimento di uno stato nel db (tab DiarioDiBordo)
|
||||
* inerimento in anagrafica a "nd" dell'operatore se matricola mancasse
|
||||
*
|
||||
* modif.: S.E.L.
|
||||
* il: 2008.08.07
|
||||
**************************************/
|
||||
alter PROCEDURE stp_DDB_InsStatoBatch
|
||||
(
|
||||
@IdxMacchina varchar(50),
|
||||
@InizioStato datetime,
|
||||
@IdxStato int,
|
||||
@MatricolaKanban varchar(50),
|
||||
@Value varchar(50),
|
||||
@MatrOpr int,
|
||||
@pallet varchar(20)
|
||||
)
|
||||
AS
|
||||
/*************************************
|
||||
* verifico se esista operatore
|
||||
**************************************/
|
||||
DECLARE @matrOut INT = @MatrOpr + 1
|
||||
SELECT @matrOut = ISNULL (
|
||||
(
|
||||
SELECT MatrOpr FROM AnagraficaOperatori
|
||||
WHERE (MatrOpr = @MatrOpr)
|
||||
),-999999
|
||||
)
|
||||
IF (@matrOut <> @MatrOpr ) -- significa che la matricola NON C'E'...
|
||||
BEGIN
|
||||
/* inserisco nuovo record */
|
||||
INSERT INTO AnagraficaOperatori(MatrOpr, Cognome, Nome)
|
||||
VALUES (@MatrOpr,'nd (cognome)','nd (nome)')
|
||||
END
|
||||
|
||||
-- controllo se input abilitato
|
||||
DECLARE @insEnabled BIT
|
||||
SET @insEnabled = ( SELECT insEnabled FROM DatiMacchine WHERE IdxMacchina = @IdxMacchina )
|
||||
|
||||
-- inserisco SOLO SE è abilitato input x quella macchina
|
||||
IF(@insEnabled = 1)
|
||||
BEGIN
|
||||
/* inserisco valori */
|
||||
INSERT INTO DiarioDiBordo
|
||||
(IdxMacchina, InizioStato, FineStato, IdxStato, MatricolaKanban, Value, MatrOpr, pallet)
|
||||
VALUES (@IdxMacchina, @InizioStato, NULL, @IdxStato, @MatricolaKanban, @Value, @MatrOpr, @pallet)
|
||||
END
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE InsStato
|
||||
* inserimento di uno stato nel db (tab DiarioDiBordo)
|
||||
* inerimento in anagrafica a "nd" dell'operatore se matricola mancasse
|
||||
*
|
||||
* modif.: S.E.L.
|
||||
* il: 2008.08.07
|
||||
**************************************/
|
||||
alter PROCEDURE stp_DDB_InsStato
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@IdxStato INT,
|
||||
@MatricolaKanban NVARCHAR(50),
|
||||
@Value NVARCHAR(50),
|
||||
@MatrOpr INT,
|
||||
@pallet NVARCHAR(20)
|
||||
)
|
||||
AS
|
||||
/*************************************
|
||||
* verifico se esista operatore
|
||||
**************************************/
|
||||
DECLARE @matrOut INT = @MatrOpr + 1
|
||||
SELECT @matrOut = ISNULL (
|
||||
(
|
||||
SELECT MatrOpr FROM AnagraficaOperatori
|
||||
WHERE (MatrOpr = @MatrOpr)
|
||||
),-999999
|
||||
)
|
||||
IF (@matrOut <> @MatrOpr ) -- significa che la matricola NON C'E'...
|
||||
BEGIN
|
||||
/* inserisco nuovo record */
|
||||
INSERT INTO AnagraficaOperatori(MatrOpr, Cognome, Nome)
|
||||
VALUES (@MatrOpr,'nd (cognome)','nd (nome)')
|
||||
END
|
||||
|
||||
-- controllo se input abilitato
|
||||
DECLARE @insEnabled BIT
|
||||
SET @insEnabled = ( SELECT insEnabled FROM DatiMacchine WHERE IdxMacchina = @IdxMacchina )
|
||||
|
||||
-- inserisco SOLO SE è abilitato input x quella macchina
|
||||
IF(@insEnabled = 1)
|
||||
BEGIN
|
||||
/* inserisco valori */
|
||||
INSERT INTO DiarioDiBordo
|
||||
(IdxMacchina, InizioStato, FineStato, IdxStato, MatricolaKanban, Value, MatrOpr, pallet)
|
||||
VALUES (@IdxMacchina, GETDATE(), NULL, @IdxStato, @MatricolaKanban, @Value, @MatrOpr, @pallet)
|
||||
END
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
-- ================================================
|
||||
-- Author: Samuele E. Locatelli
|
||||
-- Create date: 2012.11.23
|
||||
--
|
||||
-- Description: rigenerazioen del diario di bordo
|
||||
-- a partire da macchina eventi/stati + EventList
|
||||
-- ================================================
|
||||
create PROCEDURE stp_ZZZ_rigeneraDDB
|
||||
(
|
||||
@idxStatoStart INT = 1,
|
||||
@idxMacchina NVARCHAR(50),
|
||||
@inizio DATETIME,
|
||||
@fine DATETIME
|
||||
)
|
||||
AS
|
||||
|
||||
DBCC SHOWCONTIG(EventList)
|
||||
DBCC SHOWCONTIG(DiarioDiBordo)
|
||||
|
||||
EXEC USP_DisableEnableNonClusteredIndexes 'MoonPro',null, 1 --disabilito indici
|
||||
|
||||
-- svuoto dati che vado a sostituire
|
||||
PRINT 'svuoto DiarioDiBordo per periodo indicato...'
|
||||
EXEC stp_DDB_deleteMacchinaPeriodo @idxMacchina, @inizio, @fine
|
||||
PRINT 'svuoto TempiCicloRilevati per periodo indicato...'
|
||||
DELETE FROM TempiCicloRilevati WHERE idxMacchina = @idxMacchina AND DataOraRif BETWEEN @inizio AND @fine
|
||||
|
||||
PRINT 'processo EventList per periodo indicato...'
|
||||
DECLARE @InizioStato DATETIME
|
||||
DECLARE @IdxTipo INT
|
||||
DECLARE @MatricolaKanban NVARCHAR(50)
|
||||
DECLARE @Value NVARCHAR(50)
|
||||
DECLARE @MatrOpr INT
|
||||
DECLARE @pallet NVARCHAR(20)
|
||||
DECLARE @nextIdxStato INT
|
||||
DECLARE @currIdxStato INT
|
||||
DECLARE @IdxFamiglia INT
|
||||
|
||||
-- calcolo famiglia macchina!
|
||||
SET @IdxFamiglia = ( SELECT IdxFamiglia FROM Macchine2FamiglieMacchine WHERE idxMacchina = @idxMacchina )
|
||||
|
||||
-- ipotizzo macchina inizialmente in stato richiesto (default: 1 = pronta) e quindi imposto stato current a quello iniziale richiesto...
|
||||
SET @currIdxStato = @idxStatoStart
|
||||
|
||||
-- DISATTIVO inserimento in DiarioDiBordo per la macchina indicata
|
||||
UPDATE DatiMacchine
|
||||
SET insEnabled = 0
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
|
||||
-- leggo la tabella degli eventi con cursore x percorrere i dati...
|
||||
DECLARE event2proc CURSOR FOR
|
||||
SELECT InizioStato, IdxTipo, MatricolaKanban, Value, MatrOpr, pallet
|
||||
FROM EventList
|
||||
WHERE IdxMacchina = @idxMacchina
|
||||
AND InizioStato BETWEEN @inizio AND @fine
|
||||
ORDER BY InizioStato;
|
||||
|
||||
OPEN event2proc;
|
||||
|
||||
FETCH NEXT FROM event2proc
|
||||
INTO @InizioStato, @IdxTipo, @MatricolaKanban, @Value, @MatrOpr, @pallet;
|
||||
|
||||
WHILE @@FETCH_STATUS = 0
|
||||
BEGIN
|
||||
-- calcolo l'eventuale NUOVO idxStato
|
||||
SET @nextIdxStato = ( SELECT ISNULL( (SELECT next_IdxStato FROM TransizioneStati WHERE IdxFamiglia = @IdxFamiglia AND IdxStato = @currIdxStato AND IdxTipo = @IdxTipo ), @currIdxStato) )
|
||||
|
||||
-- SE lo stato cambia registro nel DiarioDiBordo!
|
||||
IF(@nextIdxStato <> @currIdxStato)
|
||||
BEGIN
|
||||
-- inserisco in DiarioDiBordo
|
||||
INSERT INTO DiarioDiBordo
|
||||
(IdxMacchina, InizioStato, FineStato, IdxStato, MatricolaKanban, Value, MatrOpr, pallet)
|
||||
VALUES (@IdxMacchina, @InizioStato, NULL, @nextIdxStato, @MatricolaKanban, @Value, @MatrOpr, @pallet)
|
||||
-- infine imposto il nuovo stato current...
|
||||
SET @currIdxStato = @nextIdxStato
|
||||
END
|
||||
|
||||
-- Get the next values
|
||||
FETCH NEXT FROM event2proc
|
||||
INTO @InizioStato, @IdxTipo, @MatricolaKanban, @Value, @MatrOpr, @pallet;
|
||||
END
|
||||
CLOSE event2proc;
|
||||
DEALLOCATE event2proc;
|
||||
|
||||
-- RI-ATTIVO inserimento in DiarioDiBordo per la macchina indicata
|
||||
UPDATE DatiMacchine
|
||||
SET insEnabled = 1
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
|
||||
PRINT 'concluso UPDATE tabelle...'
|
||||
|
||||
|
||||
DBCC SHOWCONTIG(EventList)
|
||||
DBCC SHOWCONTIG(DiarioDiBordo)
|
||||
EXEC USP_DisableEnableNonClusteredIndexes 'MoonPro',null, 2 --riattivo indici
|
||||
|
||||
|
||||
--ricostruisco indici
|
||||
PRINT 'ricostruisco indici...'
|
||||
DBCC DBREINDEX(EventList)
|
||||
DBCC DBREINDEX(DiarioDiBordo)
|
||||
DBCC DBREINDEX(TransizioneIngressi)
|
||||
DBCC DBREINDEX(Kanban2ins)
|
||||
DBCC DBREINDEX(Kanban)
|
||||
DBCC DBREINDEX(AnagraficaOperatori)
|
||||
DBCC DBREINDEX(AnagraficaOperatori2ins)
|
||||
|
||||
DBCC SHOWCONTIG(EventList)
|
||||
DBCC SHOWCONTIG(DiarioDiBordo)
|
||||
|
||||
/*
|
||||
--shrink del db
|
||||
PRINT 'compatto DB...'
|
||||
DBCC SHRINKDATABASE (MoonPro)
|
||||
*/
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_TS_getByIdxMacchIdxTipoEv
|
||||
* restituisce una riga transizione stati/eventi data macchina ed evento (confrontando lo stato attuale della macchina)
|
||||
*
|
||||
* modif.: S.E.L. - 2012.11.23
|
||||
**************************************/
|
||||
create PROCEDURE stp_TS_getByIdxMacchIdxTipoEv
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@IdxTipo INT
|
||||
)
|
||||
AS
|
||||
|
||||
|
||||
SELECT TransizioneStati.IdxFamiglia, TransizioneStati.IdxStato, TransizioneStati.IdxTipo, TransizioneStati.next_IdxStato
|
||||
FROM TransizioneStati INNER JOIN
|
||||
Macchine2FamiglieMacchine ON TransizioneStati.IdxFamiglia = Macchine2FamiglieMacchine.IdxFamiglia INNER JOIN
|
||||
Macchine ON Macchine2FamiglieMacchine.IdxMacchina = Macchine.IdxMacchina INNER JOIN
|
||||
StatoMacchine ON Macchine.IdxMacchina = StatoMacchine.IdxMacchina AND TransizioneStati.IdxStato = StatoMacchine.IdxStato
|
||||
WHERE (Macchine.IdxMacchina = @IdxMacchina) AND (TransizioneStati.IdxTipo = @IdxTipo) AND (TransizioneStati.IdxFamiglia <> 1)
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/***************************************************
|
||||
* Trigger trg_EV_filtroIns
|
||||
*
|
||||
* filtro operazioni scrittura su tab EventList:
|
||||
* - scrive un NUOVO recordo SOLO SE la chiave differisce per almeno 2 valori
|
||||
*
|
||||
* modificato: S.E.L.
|
||||
* 2012.11.26
|
||||
*
|
||||
***************************************************/
|
||||
create TRIGGER trg_EV_filtroIns
|
||||
ON EventList
|
||||
INSTEAD OF INSERT
|
||||
AS
|
||||
|
||||
IF (@@ROWCOUNT = 1)
|
||||
BEGIN
|
||||
DECLARE @IdxMacchina AS NVARCHAR(50)
|
||||
DECLARE @InizioStato AS DATETIME
|
||||
DECLARE @IdxTipo AS INT
|
||||
DECLARE @numMin AS INT=4
|
||||
DECLARE @trovati AS INT=0
|
||||
|
||||
SELECT @IdxMacchina=IdxMacchina, @InizioStato=InizioStato, @IdxTipo=IdxTipo FROM INSERTED
|
||||
|
||||
;WITH myCTE AS
|
||||
(
|
||||
SELECT TOP(@numMin) ev.*
|
||||
FROM EventList ev
|
||||
INNER JOIN INSERTED i ON ev.IdxMacchina=i.IdxMacchina
|
||||
ORDER BY InizioStato DESC
|
||||
)
|
||||
SELECT @trovati=COUNT(IdxTipo) FROM myCTE WHERE idxTipo = @IdxTipo
|
||||
|
||||
-- se tutte le righe sono con stesso tipo...
|
||||
|
||||
IF(@trovati < @numMin)
|
||||
BEGIN
|
||||
INSERT INTO EventList
|
||||
SELECT * FROM INSERTED
|
||||
END
|
||||
END
|
||||
|
||||
go
|
||||
|
||||
alter table EventList disable trigger trg_doActions;
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(353, GETDATE())
|
||||
GO
|
||||
|
||||
SELECT TOP 10 * FROM LogUpdateDb ORDER BY Versione DESC
|
||||
GO
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,605 @@
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_MSE_refresh
|
||||
* AGGIORNA tabella stato attuale macchine x macchina indicata
|
||||
*
|
||||
* modif.: S.E.L. - 2013.02.28
|
||||
**************************************/
|
||||
create PROCEDURE stp_MSE_refresh
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50) -- macchina da aggiornare
|
||||
)
|
||||
AS
|
||||
|
||||
--init variabili!
|
||||
DECLARE @adesso DATETIME = GETDATE()
|
||||
DECLARE @trovate INT = 0
|
||||
DECLARE @tvStato TABLE (
|
||||
idxStato INT NULL,
|
||||
DescrizioneStato NVARCHAR(50),
|
||||
Semaforo NVARCHAR(50),
|
||||
Minuti INT NULL
|
||||
)
|
||||
DECLARE @tvODL TABLE (
|
||||
IdxODL INT NULL,
|
||||
CodArticolo NVARCHAR(50),
|
||||
DescArticolo NVARCHAR(50),
|
||||
IdxMacchina INT NULL,
|
||||
CodMacchina NVARCHAR(50),
|
||||
Nome NVARCHAR(50),
|
||||
NumPezzi INT NULL,
|
||||
TCAssegnato DECIMAL(18,8),
|
||||
DataInizio DATETIME,
|
||||
DataFine DATETIME
|
||||
)
|
||||
DECLARE @tvProd TABLE (
|
||||
CodArticolo NVARCHAR(50),
|
||||
PezziLanciati INT NULL,
|
||||
PezziProd INT NULL,
|
||||
PezziConf INT NULL,
|
||||
TCAssegnato DECIMAL(18,8),
|
||||
CodOperatore INT NULL,
|
||||
TempoOn DECIMAL(18,8),
|
||||
TempoAuto DECIMAL(18,8),
|
||||
TempoRun DECIMAL(18,8),
|
||||
TCMedio DECIMAL(18,8),
|
||||
TCLav DECIMAL(18,8),
|
||||
TCEff DECIMAL(18,8),
|
||||
TCMedioRT DECIMAL(18,8),
|
||||
TCLavRT DECIMAL(18,8),
|
||||
TCEffRT DECIMAL(18,8)
|
||||
)
|
||||
|
||||
BEGIN
|
||||
-- controllo: se c'è riga macchina richiesta...
|
||||
SELECT @trovate=COUNT(*) FROM MappaStatoExpl WHERE IdxMacchina = @IdxMacchina
|
||||
|
||||
-- se NON c'è la creo...
|
||||
IF(@trovate = 0)
|
||||
BEGIN
|
||||
-- calcolo ODL
|
||||
;WITH cteODL AS
|
||||
(
|
||||
SELECT * FROM ODL
|
||||
WHERE IdxODL IN
|
||||
(
|
||||
SELECT IdxODL
|
||||
FROM ODL
|
||||
WHERE DataFine IS NULL
|
||||
AND (IdxMacchina = @IdxMacchina)
|
||||
|
||||
UNION
|
||||
|
||||
SELECT MAX(IdxODL)
|
||||
FROM ODL
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
)
|
||||
)
|
||||
-- inserisco i nuovi dati
|
||||
INSERT INTO MappaStatoExpl(lastUpdate, IdxMacchina, CodMacchina, Nome, url, IdxODL, CodArticolo, NumPezzi, TCAssegnato, DataInizioODL)
|
||||
SELECT @adesso, ma.IdxMacchina, ma.CodMacchina, ma.Nome, url, ISNULL(o.IdxODL,0), ISNULL(o.CodArticolo,'-'), ISNULL(o.NumPezzi,0), ISNULL(o.TCAssegnato,0), ISNULL(o.DataInizio,'2000/01/01')
|
||||
FROM Macchine ma LEFT OUTER JOIN cteODL o ON ma.IdxMacchina=o.IdxMacchina
|
||||
WHERE ma.IdxMacchina = @IdxMacchina
|
||||
AND NOT (locazione IS NULL)
|
||||
AND ( (ISNULL(o.IdxODL,0) = 0) OR ((o.DataFine IS NULL) AND NOT (o.DataInizio IS NULL)) )
|
||||
ORDER BY ma.locazione
|
||||
END
|
||||
|
||||
-- popolo tab stati
|
||||
INSERT @tvStato(idxStato, Minuti)
|
||||
EXEC stp_repDonati_getLastStatoDurataMacchina @IdxMacchina, 0.1
|
||||
-- fix dati mancanti
|
||||
UPDATE tvs
|
||||
SET tvs.Semaforo = s.Semaforo
|
||||
,tvs.DescrizioneStato = s.Descrizione
|
||||
FROM @tvStato tvs INNER JOIN AnagraficaStati s ON tvs.idxStato=s.IdxStato
|
||||
|
||||
-- popolo tab ODL
|
||||
INSERT @tvODL
|
||||
EXEC stp_ODL_getByMacchina @IdxMacchina
|
||||
|
||||
-- popolo tab pezzi/tempi
|
||||
INSERT @tvProd(CodArticolo,PezziLanciati,PezziProd,PezziConf,TCAssegnato,CodOperatore,TempoOn,TempoAuto,TempoRun,TCMedio,TCLav,TCEff,TCMedioRT,TCLavRT,TCEffRT )
|
||||
EXEC stp_repDonati_getDatiProdMacchina @IdxMacchina
|
||||
|
||||
-- aggiorno in blocco i valori
|
||||
UPDATE mse
|
||||
SET mse.lastUpdate = @adesso
|
||||
,mse.idxStato = ISNULL(tvs.idxStato,0)
|
||||
,mse.durata = ISNULL(tvs.Minuti,0)
|
||||
,mse.Semaforo = ISNULL(tvs.Semaforo,'')
|
||||
,mse.DescrizioneStato = ISNULL(tvs.DescrizioneStato,'')
|
||||
,mse.TCAssegnato = ISNULL(tvo.TCAssegnato,0)
|
||||
,mse.NumPezzi = ISNULL(tvo.NumPezzi,0)
|
||||
,mse.DataInizioODL = ISNULL(tvo.DataInizio,'2000/01/01')
|
||||
,mse.PezziProd = ISNULL(tvp.PezziProd,0)
|
||||
,mse.PezziConf = ISNULL(tvp.PezziConf,0)
|
||||
,mse.TempoOn = ISNULL(tvp.TempoOn,0)
|
||||
,mse.TempoAuto = ISNULL(tvp.TempoAuto,0)
|
||||
,mse.TempoRun = ISNULL(tvp.TempoRun,0)
|
||||
,mse.TCMedio = ISNULL(tvp.TCMedio,0)
|
||||
,mse.TCLav = ISNULL(tvp.TCLav,0)
|
||||
,mse.TCEff = ISNULL(tvp.TCEff,0)
|
||||
,mse.TCMedioRT = ISNULL(tvp.TCMedioRT,0)
|
||||
,mse.TCLavRT = ISNULL(tvp.TCLavRT,0)
|
||||
,mse.TCEffRT = ISNULL(tvp.TCEffRT,0)
|
||||
FROM MappaStatoExpl mse
|
||||
CROSS JOIN @tvStato tvs
|
||||
CROSS JOIN @tvODL tvo
|
||||
CROSS JOIN @tvProd tvp
|
||||
WHERE mse.Idxmacchina = @IdxMacchina
|
||||
|
||||
END
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE InsEvento
|
||||
* inserimento di un evento nel db (tab EventList)
|
||||
* inerimento in anagrafica a "nd" dell'operatore se matricola mancasse
|
||||
*
|
||||
* modif.: S.E.L.
|
||||
* il: 2008.08.07
|
||||
**************************************/
|
||||
alter PROCEDURE stp_EL_InsEvento
|
||||
(
|
||||
@IdxMacchina varchar(50),
|
||||
@IdxTipo int,
|
||||
@MatricolaKanban varchar(50),
|
||||
@Value varchar(50),
|
||||
@MatrOpr int,
|
||||
@pallet varchar(20)
|
||||
)
|
||||
AS
|
||||
/*************************************
|
||||
* verifico se esista operatore
|
||||
**************************************/
|
||||
SELECT *
|
||||
FROM AnagraficaOperatori
|
||||
WHERE (MatrOpr = @MatrOpr)
|
||||
IF(@@ROWCOUNT = 0 )
|
||||
BEGIN
|
||||
/* inserisco nuovo record */
|
||||
INSERT INTO AnagraficaOperatori(MatrOpr, Cognome, Nome, isAdmin, authKey)
|
||||
VALUES (@MatrOpr,'nd (cognome)','nd (nome)', 0, '12345')
|
||||
END
|
||||
|
||||
/* inserisco evento*/
|
||||
INSERT INTO EventList
|
||||
(IdxMacchina, InizioStato, IdxTipo, MatricolaKanban, Value, MatrOpr, pallet)
|
||||
VALUES (@IdxMacchina, GETDATE(), @IdxTipo, @MatricolaKanban, @Value, @MatrOpr, @pallet)
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_MSE_getData
|
||||
* tabella stato attuale macchine (da mostrare)
|
||||
*
|
||||
* modif.: S.E.L. - 2013.02.28
|
||||
**************************************/
|
||||
alter PROCEDURE stp_MSE_getData
|
||||
(
|
||||
@maxAgeSec INT -- soglia di "vecchiaia" del dato massima accettabile dopo cui parte ricalcolo, in millisec, se < 1000 ignoro!
|
||||
)
|
||||
AS
|
||||
|
||||
-- cerco dato + recente
|
||||
DECLARE @adesso DATETIME = GETDATE()
|
||||
DECLARE @lastUpdate DATETIME
|
||||
|
||||
SELECT TOP 1 @lastUpdate=ISNULL(lastUpdate, '2000/01/01') FROM MappaStatoExpl ORDER BY lastUpdate DESC
|
||||
SELECT @lastUpdate= ISNULL(@lastUpdate, '2000/01/01')
|
||||
|
||||
-- solo se sup ai 1000 ms! oppure zero...
|
||||
IF(@maxAgeSec > 1000 OR @maxAgeSec=0)
|
||||
BEGIN
|
||||
-- dato vecchio! aggiorno!
|
||||
IF(DATEDIFF(s,@lastUpdate,@adesso)*1000 > @maxAgeSec)
|
||||
BEGIN
|
||||
-- truncate table precedente
|
||||
TRUNCATE TABLE MappaStatoExpl
|
||||
|
||||
;WITH cteODL AS
|
||||
(
|
||||
SELECT * FROM ODL
|
||||
WHERE IdxODL IN
|
||||
(
|
||||
SELECT IdxODL
|
||||
FROM ODL
|
||||
WHERE DataFine IS NULL
|
||||
|
||||
UNION
|
||||
|
||||
SELECT MAX(IdxODL)
|
||||
FROM ODL
|
||||
GROUP BY IdxMacchina
|
||||
)
|
||||
)
|
||||
-- inserisco di nuovo i dati
|
||||
INSERT INTO MappaStatoExpl(lastUpdate, IdxMacchina, CodMacchina, Nome, url, IdxODL, CodArticolo, NumPezzi, TCAssegnato, DataInizioODL)
|
||||
SELECT @adesso, ma.IdxMacchina, ma.CodMacchina, ma.Nome, url, ISNULL(o.IdxODL,0), ISNULL(o.CodArticolo,'-'), ISNULL(o.NumPezzi,0), ISNULL(o.TCAssegnato,0), ISNULL(o.DataInizio,'2000/01/01')
|
||||
FROM Macchine ma LEFT OUTER JOIN cteODL o ON ma.IdxMacchina=o.IdxMacchina
|
||||
WHERE NOT (locazione IS NULL) AND ( (ISNULL(o.IdxODL,0) = 0) OR ((o.DataFine IS NULL) AND NOT (o.DataInizio IS NULL)) )
|
||||
ORDER BY ma.locazione
|
||||
|
||||
-- dichiaro le 2 table variables che userò x caricare i dati di stato
|
||||
DECLARE @tvStato TABLE (
|
||||
IdxMacchina INT NULL,
|
||||
idxStato INT NULL,
|
||||
DescrizioneStato NVARCHAR(50),
|
||||
Semaforo NVARCHAR(50),
|
||||
Minuti INT NULL
|
||||
)
|
||||
DECLARE @tvODL TABLE (
|
||||
IdxODL INT NULL,
|
||||
CodArticolo NVARCHAR(50),
|
||||
DescArticolo NVARCHAR(50),
|
||||
IdxMacchina INT NULL,
|
||||
CodMacchina NVARCHAR(50),
|
||||
Nome NVARCHAR(50),
|
||||
NumPezzi INT NULL,
|
||||
TCAssegnato DECIMAL(18,8),
|
||||
DataInizio DATETIME,
|
||||
DataFine DATETIME
|
||||
)
|
||||
DECLARE @tvProd TABLE (
|
||||
IdxMacchina INT NULL,
|
||||
CodArticolo NVARCHAR(50),
|
||||
PezziLanciati INT NULL,
|
||||
PezziProd INT NULL,
|
||||
PezziConf INT NULL,
|
||||
TCAssegnato DECIMAL(18,8),
|
||||
CodOperatore INT NULL,
|
||||
TempoOn DECIMAL(18,8),
|
||||
TempoAuto DECIMAL(18,8),
|
||||
TempoRun DECIMAL(18,8),
|
||||
TCMedio DECIMAL(18,8),
|
||||
TCLav DECIMAL(18,8),
|
||||
TCEff DECIMAL(18,8),
|
||||
TCMedioRT DECIMAL(18,8),
|
||||
TCLavRT DECIMAL(18,8),
|
||||
TCEffRT DECIMAL(18,8)
|
||||
)
|
||||
|
||||
DECLARE @numRows INT = 0
|
||||
DECLARE @currRow INT = 1
|
||||
DECLARE @IdxMacchina INT = 0
|
||||
|
||||
SET @numRows = ISNULL((SELECT COUNT(*) FROM MappaStatoExpl),0)
|
||||
|
||||
-- carico altri dati con ciclo while
|
||||
WHILE (@currRow <= @numRows)
|
||||
BEGIN
|
||||
-- macchina corrente!
|
||||
SELECT @IdxMacchina = IdxMacchina FROM MappaStatoExpl WHERE RowNum = @currRow
|
||||
|
||||
-- popolo tab stati
|
||||
INSERT @tvStato(idxStato, Minuti)
|
||||
EXEC stp_repDonati_getLastStatoDurataMacchina @IdxMacchina, 0.1
|
||||
-- fix dati mancanti
|
||||
UPDATE tvs
|
||||
SET tvs.IdxMacchina = @IdxMacchina
|
||||
,tvs.Semaforo = s.Semaforo
|
||||
,tvs.DescrizioneStato = s.Descrizione
|
||||
FROM @tvStato tvs INNER JOIN AnagraficaStati s ON tvs.idxStato=s.IdxStato
|
||||
WHERE tvs.IdxMacchina IS NULL
|
||||
|
||||
-- popolo tab ODL
|
||||
INSERT @tvODL
|
||||
EXEC stp_ODL_getByMacchina @IdxMacchina
|
||||
|
||||
-- popolo tab pezzi/tempi
|
||||
INSERT @tvProd(CodArticolo,PezziLanciati,PezziProd,PezziConf,TCAssegnato,CodOperatore,TempoOn,TempoAuto,TempoRun,TCMedio,TCLav,TCEff,TCMedioRT,TCLavRT,TCEffRT )
|
||||
EXEC stp_repDonati_getDatiProdMacchina @IdxMacchina
|
||||
-- fix dati mancanti
|
||||
UPDATE tvp
|
||||
SET tvp.IdxMacchina = @IdxMacchina
|
||||
FROM @tvProd tvp
|
||||
WHERE tvp.IdxMacchina IS NULL
|
||||
|
||||
-- aggiorno contatore
|
||||
SET @currRow = @currRow + 1
|
||||
END
|
||||
-- aggiorno in blocco i valori x stato e pezzi prodotti
|
||||
UPDATE mse
|
||||
SET mse.idxStato = ISNULL(tvs.idxStato,0)
|
||||
,mse.durata = ISNULL(tvs.Minuti,0)
|
||||
,mse.Semaforo = ISNULL(tvs.Semaforo,'')
|
||||
,mse.DescrizioneStato = ISNULL(tvs.DescrizioneStato,'')
|
||||
FROM MappaStatoExpl mse INNER JOIN @tvStato tvs ON mse.IdxMacchina=tvs.IdxMacchina
|
||||
|
||||
-- aggiorno in blocco i valori x ODL
|
||||
UPDATE mse
|
||||
SET mse.TCAssegnato = ISNULL(tvo.TCAssegnato,0)
|
||||
,mse.NumPezzi = ISNULL(tvo.NumPezzi,0)
|
||||
,mse.DataInizioODL = ISNULL(tvo.DataInizio,'2000/01/01')
|
||||
FROM MappaStatoExpl mse INNER JOIN @tvODL tvo ON mse.IdxMacchina=tvo.IdxMacchina
|
||||
|
||||
-- aggiorno in blocco i valori x produzione
|
||||
UPDATE mse
|
||||
SET mse.PezziProd = ISNULL(tvp.PezziProd,0)
|
||||
,mse.PezziConf = ISNULL(tvp.PezziConf,0)
|
||||
,mse.TempoOn = ISNULL(tvp.TempoOn,0)
|
||||
,mse.TempoAuto = ISNULL(tvp.TempoAuto,0)
|
||||
,mse.TempoRun = ISNULL(tvp.TempoRun,0)
|
||||
,mse.TCMedio = ISNULL(tvp.TCMedio,0)
|
||||
,mse.TCLav = ISNULL(tvp.TCLav,0)
|
||||
,mse.TCEff = ISNULL(tvp.TCEff,0)
|
||||
,mse.TCMedioRT = ISNULL(tvp.TCMedioRT,0)
|
||||
,mse.TCLavRT = ISNULL(tvp.TCLavRT,0)
|
||||
,mse.TCEffRT = ISNULL(tvp.TCEffRT,0)
|
||||
FROM MappaStatoExpl mse INNER JOIN @tvProd tvp ON mse.IdxMacchina=tvp.IdxMacchina
|
||||
|
||||
END
|
||||
END
|
||||
-- restituisco la tabella finale
|
||||
SELECT *
|
||||
FROM MappaStatoExpl
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/***************************************************
|
||||
* Trigger trg_ODL_updateMSE
|
||||
*
|
||||
* fa un refresh completo della MSE ad ogni intervento sull'ODL
|
||||
*
|
||||
* modificato: S.E.L.
|
||||
* 2013.03.14
|
||||
*
|
||||
***************************************************/
|
||||
create TRIGGER trg_ODL_updateMSE
|
||||
ON ODL
|
||||
FOR INSERT, UPDATE
|
||||
AS
|
||||
|
||||
-- eseguo RICALCOLO tabella stato expl
|
||||
EXEC stp_MSE_getData 0
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/***************************************************
|
||||
* Trigger trg_doActions
|
||||
*
|
||||
* processa eventuali azioni legate ad un inserimento evento
|
||||
*
|
||||
* modificato: S.E.L.
|
||||
* 2011.05.18
|
||||
*
|
||||
***************************************************/
|
||||
alter TRIGGER trg_doActions
|
||||
ON EventList
|
||||
FOR INSERT
|
||||
AS /* dichiarazione variabili */
|
||||
DECLARE @IdxTipo INT
|
||||
DECLARE @TabAzione NVARCHAR(50)
|
||||
DECLARE @Azione NVARCHAR(50)
|
||||
DECLARE @IdxMacchina NVARCHAR(50)
|
||||
DECLARE @MatricolaKanban NVARCHAR(50)
|
||||
DECLARE @MatricolaKanbanOk NVARCHAR(50)
|
||||
DECLARE @CodArticolo NVARCHAR(50)
|
||||
DECLARE @TCMedio DECIMAL(18,8)
|
||||
DECLARE @DataOra DATETIME
|
||||
DECLARE @DataOraPrec DATETIME
|
||||
DECLARE @NumPz INT
|
||||
|
||||
/* recupero valori dell'INSERT */
|
||||
SET @IdxTipo = ( SELECT i.IdxTipo FROM inserted i )
|
||||
SET @IdxMacchina = ( SELECT i.IdxMacchina FROM inserted i )
|
||||
/* recupero altri valori */
|
||||
SET @TabAzione = ( SELECT ISNULL(TabAzione,'') FROM AnagraficaEventi WHERE IdxTipo = @IdxTipo )
|
||||
SET @Azione = ( SELECT ISNULL(Azione,'') FROM AnagraficaEventi WHERE IdxTipo = @IdxTipo )
|
||||
/* controllo se l'evento richieda azioni successive */
|
||||
IF(@TabAzione <> '' AND @Azione <> '')
|
||||
BEGIN
|
||||
/* azioni richieste: seconda dei casi eseguo... */
|
||||
|
||||
/******************************************
|
||||
*
|
||||
* Calcolo tempo ciclo per INIZIO
|
||||
*
|
||||
******************************************/
|
||||
IF(@TabAzione = 'TempiCicloRilevati' AND @Azione = 'Insert')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @DataOra = ( SELECT i.InizioStato FROM inserted i )
|
||||
SET @MatricolaKanban = ( SELECT i.MatricolaKanban FROM inserted i )
|
||||
SET @NumPz = ( SELECT CASE WHEN (ISNUMERIC(value)=1) THEN value ELSE 1 END FROM inserted i )
|
||||
SET @CodArticolo = ( SELECT CodArticolo FROM Kanban WHERE MatricolaKanban = @MatricolaKanban )
|
||||
/* calcolo tempo tra gli ultimi 2 eventi "contapezzi" */
|
||||
SET @DataOraPrec = ( SELECT ISNULL((SELECT Top 1 InizioStato FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo AND InizioStato < @DataOra ORDER BY InizioStato DESC), @DataOra ) )
|
||||
BEGIN TRY
|
||||
/* è in millisecondi, divido per 60'000.00 x avere minuti centesimali*/
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(ms, @DataOraPrec, @DataOra) / 60000.00 ) )
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(s, @DataOraPrec, @DataOra) / 60.00 ) ) --calcolo in secondi
|
||||
END CATCH
|
||||
/* inserisco riga di tempo ciclo */
|
||||
INSERT INTO TempiCicloRilevati
|
||||
VALUES(@IdxMacchina, @CodArticolo, @DataOra, @TCMedio, @NumPz)
|
||||
END
|
||||
/******************************************
|
||||
*
|
||||
* Calcolo tempo ciclo con logica stop/start
|
||||
*
|
||||
******************************************/
|
||||
ELSE IF(@TabAzione = 'TempiCicloRilevati' AND @Azione = 'Stop2StartCiclo')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @DataOra = ( SELECT i.InizioStato FROM inserted i )
|
||||
SET @MatricolaKanban = ( SELECT i.MatricolaKanban FROM inserted i )
|
||||
/* prendo la matricola dall'evento inizio (precedente) */
|
||||
SET @MatricolaKanbanOk = ( SELECT ISNULL((SELECT Top 1 MatricolaKanban FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo - 1 AND InizioStato < @DataOra ORDER BY InizioStato DESC), @MatricolaKanban ) )
|
||||
|
||||
-- calcolare num pezzi da codice...
|
||||
SET @NumPz = ( SELECT CASE WHEN (ISNUMERIC(value)=1) THEN value ELSE 1 END FROM inserted i )
|
||||
SET @CodArticolo = ( SELECT CodArticolo FROM Kanban WHERE MatricolaKanban = @MatricolaKanbanOk )
|
||||
/* calcolo tempo tra eventi "contapezzi" inizio - fine NB: idxEvento per fine è idxEvento inizio + 1 ... HARD CODED!!! */
|
||||
SET @DataOraPrec = ( SELECT ISNULL((SELECT Top 1 InizioStato FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo - 1 AND InizioStato < @DataOra ORDER BY InizioStato DESC), @DataOra ) )
|
||||
BEGIN TRY
|
||||
/* è in millisecondi, divido per 60'000.00 x avere minuti centesimali*/
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(ms, @DataOraPrec, @DataOra) / 60000.00 ) )
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(s, @DataOraPrec, @DataOra) / 60.00 ) ) -- calcolo in secondi
|
||||
END CATCH
|
||||
/* inserisco riga di tempo ciclo */
|
||||
INSERT INTO TempiCicloRilevati
|
||||
VALUES(@IdxMacchina, @CodArticolo, @DataOra, @TCMedio, @NumPz)
|
||||
END
|
||||
/******************************************
|
||||
*
|
||||
* calcolo tempo ciclo con logica stop/stop
|
||||
*
|
||||
******************************************/
|
||||
ELSE IF(@TabAzione = 'TempiCicloRilevati' AND @Azione = 'Stop2StopCiclo')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @DataOra = ( SELECT i.InizioStato FROM inserted i )
|
||||
SET @MatricolaKanban = ( SELECT i.MatricolaKanban FROM inserted i )
|
||||
/* prendo la matricola dall'evento inizio (precedente) */
|
||||
SET @MatricolaKanbanOk = ( SELECT ISNULL((SELECT Top 1 MatricolaKanban FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo AND InizioStato < @DataOra ORDER BY InizioStato DESC), @MatricolaKanban ) )
|
||||
|
||||
-- calcolare num pezzi da codice...
|
||||
SET @NumPz = ( SELECT PzPallet FROM Kanban WHERE MatricolaKanban = @MatricolaKanbanOk )
|
||||
SET @CodArticolo = ( SELECT CodArticolo FROM Kanban WHERE MatricolaKanban = @MatricolaKanbanOk )
|
||||
/* calcolo tempo tra eventi "contapezzi" fine - fine NB: idxEvento per fine è idxEvento inizio + 1 ... HARD CODED!!! */
|
||||
SET @DataOraPrec = ( SELECT ISNULL((SELECT Top 1 InizioStato FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo AND InizioStato < @DataOra ORDER BY InizioStato DESC), @DataOra ) )
|
||||
BEGIN TRY
|
||||
/* è in millisecondi, divido per 60'000.00 x avere minuti centesimali*/
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(ms, @DataOraPrec, @DataOra) / 60000.00 ) )
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(s, @DataOraPrec, @DataOra) / 60.00 ) ) -- calcolo in secondi
|
||||
END CATCH
|
||||
/* inserisco riga di tempo ciclo */
|
||||
BEGIN TRY
|
||||
INSERT INTO TempiCicloRilevati
|
||||
VALUES(@IdxMacchina, @CodArticolo, @DataOra, @TCMedio, @NumPz)
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
-- dovrei loggare...
|
||||
END CATCH
|
||||
END
|
||||
/******************************************
|
||||
*
|
||||
* Aggiorno kanban in dati macchine per
|
||||
* INIZIO ATTREZZAGGIO
|
||||
*
|
||||
******************************************/
|
||||
ELSE IF(@TabAzione = 'DatiMacchine' AND @Azione = 'Inizio')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @MatricolaKanban = ( SELECT i.MatricolaKanban FROM inserted i )
|
||||
/* aggiorno riga di dati macchina */
|
||||
UPDATE DatiMacchine
|
||||
SET kanban_A = @MatricolaKanban,
|
||||
kanban_B = @MatricolaKanban
|
||||
WHERE idxMacchina = @IdxMacchina
|
||||
/* aggiorno stato macchina */
|
||||
UPDATE StatoMacchine
|
||||
SET MatricolaKanban = @MatricolaKanban
|
||||
WHERE idxMacchina = @IdxMacchina
|
||||
/* aggiorno dati kanban statoMacchine... */
|
||||
UPDATE StatoMacchine
|
||||
SET KanbanCode = k.KanbanCode, TempoCicloBase = k.TempoCicloBase, PzPalletProd = k.PzPallet
|
||||
FROM Kanban AS k INNER JOIN StatoMacchine ON k.MatricolaKanban = StatoMacchine.MatricolaKanban
|
||||
WHERE (StatoMacchine.idxMacchina = @IdxMacchina)
|
||||
END
|
||||
/******************************************
|
||||
*
|
||||
* Aggiorno kanban in dati macchine per
|
||||
* FINE PRODUZIONE
|
||||
*
|
||||
******************************************/
|
||||
ELSE IF(@TabAzione = 'DatiMacchine' AND @Azione = 'Fine')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @MatricolaKanban = 'KAND' -- kanban non definito !!!HARD CODED!!!
|
||||
/* aggiorno riga di dati macchina */
|
||||
UPDATE DatiMacchine
|
||||
SET kanban_A = @MatricolaKanban,
|
||||
kanban_B = @MatricolaKanban
|
||||
WHERE idxMacchina = @IdxMacchina
|
||||
/* aggiorno stato macchina */
|
||||
UPDATE StatoMacchine
|
||||
SET MatricolaKanban = @MatricolaKanban
|
||||
WHERE idxMacchina = @IdxMacchina
|
||||
/* aggiorno dati kanban statoMacchine... */
|
||||
UPDATE StatoMacchine
|
||||
SET KanbanCode = k.KanbanCode, TempoCicloBase = k.TempoCicloBase, PzPalletProd = k.PzPallet
|
||||
FROM Kanban AS k INNER JOIN StatoMacchine ON k.MatricolaKanban = StatoMacchine.MatricolaKanban
|
||||
WHERE (StatoMacchine.idxMacchina = @IdxMacchina)
|
||||
|
||||
END
|
||||
END
|
||||
|
||||
-- INFINE CHIAMO REFRESH TAB STATO...
|
||||
EXEC stp_MSE_refresh @IdxMacchina
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(375, GETDATE())
|
||||
GO
|
||||
|
||||
SELECT TOP 10 * FROM LogUpdateDb ORDER BY Versione DESC
|
||||
GO
|
||||
@@ -0,0 +1,616 @@
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_ODL_updateChild
|
||||
* aggiorna le tabelle che dipendono dai dati dell'ODL
|
||||
*
|
||||
* modif.: S.E.L.
|
||||
* il: 2013.03.15
|
||||
**************************************/
|
||||
create PROCEDURE stp_ODL_updateChild
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@IdxODL INT,
|
||||
@CodArticoloOld NVARCHAR(50),
|
||||
@DataInizioOld DATETIME,
|
||||
@DataFineOld DATETIME,
|
||||
@CodArticoloNew NVARCHAR(50),
|
||||
@DataInizioNew DATETIME,
|
||||
@DataFineNew DATETIME
|
||||
)
|
||||
AS
|
||||
|
||||
BEGIN TRAN
|
||||
|
||||
/*****************************************************************************************************
|
||||
* AGGIORNO TUTTO!
|
||||
* - DatiConfermati
|
||||
* - DatiMacchine
|
||||
* - DatiProduzione
|
||||
* - DiarioDiBordo
|
||||
* - EventList
|
||||
* - StatoMacchine
|
||||
* - TempiCicloRilevati
|
||||
*****************************************************************************************************/
|
||||
|
||||
-- DatiConfermati
|
||||
UPDATE DatiConfermati
|
||||
SET CodArticolo = @CodArticoloNew
|
||||
WHERE CodArticolo = @CodArticoloOld
|
||||
AND ( DataRif >= @DataInizioNew AND DataRif <= ISNULL(@DataFineNew, GETDATE()) )
|
||||
|
||||
-- DatiMacchine
|
||||
UPDATE DatiMacchine
|
||||
SET kanban_A = CASE WHEN kanban_A = 'KA'+ @CodArticoloOLD THEN 'KA'+ @CodArticoloNew ELSE kanban_A END
|
||||
,kanban_B = CASE WHEN kanban_B = 'KA'+ @CodArticoloOLD THEN 'KA'+ @CodArticoloNew ELSE kanban_B END
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
|
||||
-- DatiProduzione
|
||||
UPDATE DatiProduzione
|
||||
SET CodArticolo = @CodArticoloNew
|
||||
,IdxODL = @IdxODL
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
AND ( DataRif >= @DataInizioNew AND DataRif <= ISNULL(@DataFineNew, GETDATE()) )
|
||||
|
||||
-- DiarioDiBordo
|
||||
UPDATE DiarioDiBordo
|
||||
SET KanbanCode = @CodArticoloNew
|
||||
,MatricolaKanban = 'KA'+@CodArticoloNew
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
AND ( InizioStato >= @DataInizioNew AND InizioStato <= ISNULL(@DataFineNew, GETDATE()) )
|
||||
AND KanbanCode = @CodArticoloOld
|
||||
|
||||
-- EventList
|
||||
UPDATE EventList
|
||||
SET MatricolaKanban = 'KA'+@CodArticoloNew
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
AND ( InizioStato >= @DataInizioNew AND InizioStato <= ISNULL(@DataFineNew, GETDATE()) )
|
||||
AND MatricolaKanban = 'KA'+@CodArticoloOld
|
||||
|
||||
-- StatoMacchine
|
||||
UPDATE StatoMacchine
|
||||
SET KanbanCode = @CodArticoloNew
|
||||
,MatricolaKanban = 'KA'+@CodArticoloNew
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
AND ( InizioStato >= @DataInizioNew AND InizioStato <= ISNULL(@DataFineNew, GETDATE()) )
|
||||
AND KanbanCode = @CodArticoloOld
|
||||
|
||||
-- TempiCicloRilevati
|
||||
UPDATE TempiCicloRilevati
|
||||
SET CodArticolo = @CodArticoloNew
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
AND ( DataOraRif >= @DataInizioNew AND DataOraRif <= ISNULL(@DataFineNew, GETDATE()) )
|
||||
AND CodArticolo = @CodArticoloOld
|
||||
|
||||
COMMIT TRAN
|
||||
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/***************************************************
|
||||
* Trigger trg_ODL_updateMSE
|
||||
*
|
||||
* fa un refresh completo della MSE ad ogni intervento sull'ODL
|
||||
*
|
||||
* modificato: S.E.L.
|
||||
* 2013.03.14
|
||||
*
|
||||
***************************************************/
|
||||
create TRIGGER trg_ODL_updateAllChild
|
||||
ON ODL
|
||||
FOR UPDATE
|
||||
AS
|
||||
|
||||
-- dichiarazione variabili
|
||||
DECLARE @IdxMacchina NVARCHAR(50)
|
||||
DECLARE @IdxODL INT
|
||||
DECLARE @CodArtOld NVARCHAR(50)
|
||||
DECLARE @CodArtNew NVARCHAR(50)
|
||||
DECLARE @DataInizioOld DATETIME
|
||||
DECLARE @DataInizioNew DATETIME
|
||||
DECLARE @DataFineOld DATETIME
|
||||
DECLARE @DataFineNew DATETIME
|
||||
|
||||
-- calcolo valori articolo, date validità...
|
||||
SELECT @CodArtOld=CodArticolo, @DataInizioOld=DataInizio, @DataFineOld=DataFine FROM deleted
|
||||
SELECT @IdxODL=IdxODL, @IdxMacchina=IdxMacchina, @CodArtNew=CodArticolo, @DataInizioNew=DataInizio, @DataFineNew=DataFine FROM inserted
|
||||
|
||||
-- PRIMA REGOLA: proseguo SOLO SE la data inizio è NOT NULL
|
||||
IF(NOT (@DataInizioNew IS NULL))
|
||||
BEGIN
|
||||
|
||||
/***************************************************************
|
||||
* Eseguo SOLO SE:
|
||||
* - faccio un update del kanban e se il mio ODL ha un periodo di validità (inizio non nullo)
|
||||
* - cambia inizio periodo validità
|
||||
* - cambia fine validità (MA NON ERA NULL!!!)
|
||||
***************************************************************/
|
||||
IF( ( UPDATE(CodArticolo) AND @CodArtOld<>@CodArtNew ) OR ( UPDATE(DataInizio) AND @DataInizioOld<>@DataInizioNew ) OR ( UPDATE(DataFine) AND @DataFineOld<>@DataFineNew AND NOT (@DataFineOld IS NULL) ) )
|
||||
BEGIN
|
||||
exec stp_ODL_updateChild @IdxMacchina, @IdxODL, @CodArtOld, @DataInizioOld, @DataFineOld, @CodArtNew, @DataInizioNew, @DataFineNew
|
||||
END
|
||||
|
||||
END
|
||||
-- eseguo RICALCOLO tabella stato expl
|
||||
EXEC stp_MSE_getData 0
|
||||
go
|
||||
|
||||
/***************************************************
|
||||
* Trigger trg_ODL_updateMSE
|
||||
*
|
||||
* fa un refresh completo della MSE ad ogni insert di ODL
|
||||
*
|
||||
* modificato: S.E.L.
|
||||
* 2013.03.14
|
||||
*
|
||||
***************************************************/
|
||||
alter TRIGGER trg_ODL_updateMSE
|
||||
ON ODL
|
||||
FOR INSERT
|
||||
AS
|
||||
|
||||
-- eseguo RICALCOLO tabella stato expl
|
||||
EXEC stp_MSE_getData 0
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_ODL_updateChild
|
||||
* aggiorna le tabelle che dipendono dai dati dell'ODL
|
||||
*
|
||||
* modif.: S.E.L.
|
||||
* il: 2013.03.15
|
||||
**************************************/
|
||||
alter PROCEDURE stp_ODL_updateChild
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@IdxODL INT,
|
||||
@CodArticoloOld NVARCHAR(50),
|
||||
@DataInizioOld DATETIME,
|
||||
@DataFineOld DATETIME,
|
||||
@CodArticoloNew NVARCHAR(50),
|
||||
@DataInizioNew DATETIME,
|
||||
@DataFineNew DATETIME
|
||||
)
|
||||
AS
|
||||
|
||||
BEGIN TRAN
|
||||
|
||||
/*****************************************************************************************************
|
||||
* AGGIORNO TUTTO!
|
||||
* - DatiConfermati
|
||||
* - DatiMacchine
|
||||
* - DatiProduzione
|
||||
* - DiarioDiBordo
|
||||
* - EventList
|
||||
* - StatoMacchine
|
||||
* - TempiCicloRilevati
|
||||
*****************************************************************************************************/
|
||||
|
||||
-- DatiConfermati
|
||||
UPDATE DatiConfermati
|
||||
SET CodArticolo = @CodArticoloNew
|
||||
WHERE CodArticolo = @CodArticoloOld
|
||||
AND ( DataRif >= @DataInizioNew AND DataRif <= ISNULL(@DataFineNew, GETDATE()) )
|
||||
|
||||
-- DatiMacchine, SOLO SE è ODL corrente
|
||||
IF(@DataFineNew IS NULL)
|
||||
BEGIN
|
||||
UPDATE DatiMacchine
|
||||
SET kanban_A = CASE WHEN kanban_A = 'KA'+ @CodArticoloOLD THEN 'KA'+ @CodArticoloNew ELSE kanban_A END
|
||||
,kanban_B = CASE WHEN kanban_B = 'KA'+ @CodArticoloOLD THEN 'KA'+ @CodArticoloNew ELSE kanban_B END
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
END
|
||||
|
||||
-- DatiProduzione
|
||||
UPDATE DatiProduzione
|
||||
SET CodArticolo = @CodArticoloNew
|
||||
,IdxODL = @IdxODL
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
AND ( DataRif >= @DataInizioNew AND DataRif <= ISNULL(@DataFineNew, GETDATE()) )
|
||||
|
||||
-- DiarioDiBordo
|
||||
UPDATE DiarioDiBordo
|
||||
SET KanbanCode = @CodArticoloNew
|
||||
,MatricolaKanban = 'KA'+@CodArticoloNew
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
AND ( InizioStato >= @DataInizioNew AND InizioStato <= ISNULL(@DataFineNew, GETDATE()) )
|
||||
AND KanbanCode = @CodArticoloOld
|
||||
|
||||
-- EventList
|
||||
UPDATE EventList
|
||||
SET MatricolaKanban = 'KA'+@CodArticoloNew
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
AND ( InizioStato >= @DataInizioNew AND InizioStato <= ISNULL(@DataFineNew, GETDATE()) )
|
||||
AND MatricolaKanban = 'KA'+@CodArticoloOld
|
||||
|
||||
-- StatoMacchine
|
||||
UPDATE StatoMacchine
|
||||
SET KanbanCode = @CodArticoloNew
|
||||
,MatricolaKanban = 'KA'+@CodArticoloNew
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
AND ( InizioStato >= @DataInizioNew AND InizioStato <= ISNULL(@DataFineNew, GETDATE()) )
|
||||
AND KanbanCode = @CodArticoloOld
|
||||
|
||||
-- TempiCicloRilevati
|
||||
UPDATE TempiCicloRilevati
|
||||
SET CodArticolo = @CodArticoloNew
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
AND ( DataOraRif >= @DataInizioNew AND DataOraRif <= ISNULL(@DataFineNew, GETDATE()) )
|
||||
AND CodArticolo = @CodArticoloOld
|
||||
|
||||
COMMIT TRAN
|
||||
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
drop trigger trg_ODL_updateMSE;
|
||||
go
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_MSE_getData
|
||||
* tabella stato attuale macchine (da mostrare)
|
||||
*
|
||||
* modif.: S.E.L. - 2013.02.28
|
||||
**************************************/
|
||||
alter PROCEDURE stp_MSE_getData
|
||||
(
|
||||
@maxAgeSec INT -- soglia di "vecchiaia" del dato massima accettabile dopo cui parte ricalcolo, in millisec, se < 1000 ignoro!
|
||||
)
|
||||
AS
|
||||
|
||||
-- cerco dato + recente
|
||||
DECLARE @adesso DATETIME = GETDATE()
|
||||
DECLARE @lastUpdate DATETIME
|
||||
|
||||
SELECT TOP 1 @lastUpdate=ISNULL(lastUpdate, '2000/01/01') FROM MappaStatoExpl ORDER BY lastUpdate DESC
|
||||
SELECT @lastUpdate= ISNULL(@lastUpdate, '2000/01/01')
|
||||
|
||||
-- solo se sup ai 1000 ms! oppure zero...
|
||||
IF(@maxAgeSec > 1000 OR @maxAgeSec=0)
|
||||
BEGIN
|
||||
-- dato vecchio! aggiorno!
|
||||
IF(DATEDIFF(s,@lastUpdate,@adesso)*1000 > @maxAgeSec)
|
||||
BEGIN
|
||||
-- truncate table precedente
|
||||
TRUNCATE TABLE MappaStatoExpl
|
||||
|
||||
;WITH cteODL AS
|
||||
(
|
||||
SELECT TOP 1 * FROM ODL
|
||||
WHERE IdxODL IN
|
||||
(
|
||||
SELECT IdxODL
|
||||
FROM ODL
|
||||
WHERE DataFine IS NULL
|
||||
|
||||
UNION
|
||||
|
||||
SELECT MAX(IdxODL)
|
||||
FROM ODL
|
||||
GROUP BY IdxMacchina
|
||||
)
|
||||
)
|
||||
-- inserisco di nuovo i dati
|
||||
INSERT INTO MappaStatoExpl(lastUpdate, IdxMacchina, CodMacchina, Nome, url, IdxODL, CodArticolo, NumPezzi, TCAssegnato, DataInizioODL)
|
||||
SELECT @adesso, ma.IdxMacchina, ma.CodMacchina, ma.Nome, url, ISNULL(o.IdxODL,0), ISNULL(o.CodArticolo,'-'), ISNULL(o.NumPezzi,0), ISNULL(o.TCAssegnato,0), ISNULL(o.DataInizio,'2000/01/01')
|
||||
FROM Macchine ma LEFT OUTER JOIN cteODL o ON ma.IdxMacchina=o.IdxMacchina
|
||||
WHERE NOT (locazione IS NULL)
|
||||
--AND ( (ISNULL(o.IdxODL,0) = 0) OR ((o.DataFine IS NULL) AND NOT (o.DataInizio IS NULL)) )
|
||||
ORDER BY ma.locazione
|
||||
|
||||
-- dichiaro le 2 table variables che userò x caricare i dati di stato
|
||||
DECLARE @tvStato TABLE (
|
||||
IdxMacchina INT NULL,
|
||||
idxStato INT NULL,
|
||||
DescrizioneStato NVARCHAR(50),
|
||||
Semaforo NVARCHAR(50),
|
||||
Minuti INT NULL
|
||||
)
|
||||
DECLARE @tvODL TABLE (
|
||||
IdxODL INT NULL,
|
||||
CodArticolo NVARCHAR(50),
|
||||
DescArticolo NVARCHAR(50),
|
||||
IdxMacchina INT NULL,
|
||||
CodMacchina NVARCHAR(50),
|
||||
Nome NVARCHAR(50),
|
||||
NumPezzi INT NULL,
|
||||
TCAssegnato DECIMAL(18,8),
|
||||
DataInizio DATETIME,
|
||||
DataFine DATETIME
|
||||
)
|
||||
DECLARE @tvProd TABLE (
|
||||
IdxMacchina INT NULL,
|
||||
CodArticolo NVARCHAR(50),
|
||||
PezziLanciati INT NULL,
|
||||
PezziProd INT NULL,
|
||||
PezziConf INT NULL,
|
||||
TCAssegnato DECIMAL(18,8),
|
||||
CodOperatore INT NULL,
|
||||
TempoOn DECIMAL(18,8),
|
||||
TempoAuto DECIMAL(18,8),
|
||||
TempoRun DECIMAL(18,8),
|
||||
TCMedio DECIMAL(18,8),
|
||||
TCLav DECIMAL(18,8),
|
||||
TCEff DECIMAL(18,8),
|
||||
TCMedioRT DECIMAL(18,8),
|
||||
TCLavRT DECIMAL(18,8),
|
||||
TCEffRT DECIMAL(18,8)
|
||||
)
|
||||
|
||||
DECLARE @numRows INT = 0
|
||||
DECLARE @currRow INT = 1
|
||||
DECLARE @IdxMacchina INT = 0
|
||||
|
||||
SET @numRows = ISNULL((SELECT COUNT(*) FROM MappaStatoExpl),0)
|
||||
|
||||
-- carico altri dati con ciclo while
|
||||
WHILE (@currRow <= @numRows)
|
||||
BEGIN
|
||||
-- macchina corrente!
|
||||
SELECT @IdxMacchina = IdxMacchina FROM MappaStatoExpl WHERE RowNum = @currRow
|
||||
|
||||
-- popolo tab stati
|
||||
INSERT @tvStato(idxStato, Minuti)
|
||||
EXEC stp_repDonati_getLastStatoDurataMacchina @IdxMacchina, 0.1
|
||||
-- fix dati mancanti
|
||||
UPDATE tvs
|
||||
SET tvs.IdxMacchina = @IdxMacchina
|
||||
,tvs.Semaforo = s.Semaforo
|
||||
,tvs.DescrizioneStato = s.Descrizione
|
||||
FROM @tvStato tvs INNER JOIN AnagraficaStati s ON tvs.idxStato=s.IdxStato
|
||||
WHERE tvs.IdxMacchina IS NULL
|
||||
|
||||
-- popolo tab ODL
|
||||
INSERT @tvODL
|
||||
EXEC stp_ODL_getByMacchina @IdxMacchina
|
||||
|
||||
-- popolo tab pezzi/tempi
|
||||
INSERT @tvProd(CodArticolo,PezziLanciati,PezziProd,PezziConf,TCAssegnato,CodOperatore,TempoOn,TempoAuto,TempoRun,TCMedio,TCLav,TCEff,TCMedioRT,TCLavRT,TCEffRT )
|
||||
EXEC stp_repDonati_getDatiProdMacchina @IdxMacchina
|
||||
-- fix dati mancanti
|
||||
UPDATE tvp
|
||||
SET tvp.IdxMacchina = @IdxMacchina
|
||||
FROM @tvProd tvp
|
||||
WHERE tvp.IdxMacchina IS NULL
|
||||
|
||||
-- aggiorno contatore
|
||||
SET @currRow = @currRow + 1
|
||||
END
|
||||
-- aggiorno in blocco i valori x stato e pezzi prodotti
|
||||
UPDATE mse
|
||||
SET mse.idxStato = ISNULL(tvs.idxStato,0)
|
||||
,mse.durata = ISNULL(tvs.Minuti,0)
|
||||
,mse.Semaforo = ISNULL(tvs.Semaforo,'')
|
||||
,mse.DescrizioneStato = ISNULL(tvs.DescrizioneStato,'')
|
||||
FROM MappaStatoExpl mse INNER JOIN @tvStato tvs ON mse.IdxMacchina=tvs.IdxMacchina
|
||||
|
||||
-- aggiorno in blocco i valori x ODL
|
||||
UPDATE mse
|
||||
SET mse.TCAssegnato = ISNULL(tvo.TCAssegnato,0)
|
||||
,mse.NumPezzi = ISNULL(tvo.NumPezzi,0)
|
||||
,mse.DataInizioODL = ISNULL(tvo.DataInizio,'2000/01/01')
|
||||
FROM MappaStatoExpl mse INNER JOIN @tvODL tvo ON mse.IdxMacchina=tvo.IdxMacchina
|
||||
|
||||
-- aggiorno in blocco i valori x produzione
|
||||
UPDATE mse
|
||||
SET mse.PezziProd = ISNULL(tvp.PezziProd,0)
|
||||
,mse.PezziConf = ISNULL(tvp.PezziConf,0)
|
||||
,mse.TempoOn = ISNULL(tvp.TempoOn,0)
|
||||
,mse.TempoAuto = ISNULL(tvp.TempoAuto,0)
|
||||
,mse.TempoRun = ISNULL(tvp.TempoRun,0)
|
||||
,mse.TCMedio = ISNULL(tvp.TCMedio,0)
|
||||
,mse.TCLav = ISNULL(tvp.TCLav,0)
|
||||
,mse.TCEff = ISNULL(tvp.TCEff,0)
|
||||
,mse.TCMedioRT = ISNULL(tvp.TCMedioRT,0)
|
||||
,mse.TCLavRT = ISNULL(tvp.TCLavRT,0)
|
||||
,mse.TCEffRT = ISNULL(tvp.TCEffRT,0)
|
||||
FROM MappaStatoExpl mse INNER JOIN @tvProd tvp ON mse.IdxMacchina=tvp.IdxMacchina
|
||||
|
||||
END
|
||||
END
|
||||
-- restituisco la tabella finale
|
||||
SELECT *
|
||||
FROM MappaStatoExpl
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_MSE_refresh
|
||||
* AGGIORNA tabella stato attuale macchine x macchina indicata
|
||||
*
|
||||
* modif.: S.E.L. - 2013.02.28
|
||||
**************************************/
|
||||
alter PROCEDURE stp_MSE_refresh
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50) -- macchina da aggiornare
|
||||
)
|
||||
AS
|
||||
|
||||
--init variabili!
|
||||
DECLARE @adesso DATETIME = GETDATE()
|
||||
DECLARE @trovate INT = 0
|
||||
DECLARE @tvStato TABLE (
|
||||
idxStato INT NULL,
|
||||
DescrizioneStato NVARCHAR(50),
|
||||
Semaforo NVARCHAR(50),
|
||||
Minuti INT NULL
|
||||
)
|
||||
DECLARE @tvODL TABLE (
|
||||
IdxODL INT NULL,
|
||||
CodArticolo NVARCHAR(50),
|
||||
DescArticolo NVARCHAR(50),
|
||||
IdxMacchina INT NULL,
|
||||
CodMacchina NVARCHAR(50),
|
||||
Nome NVARCHAR(50),
|
||||
NumPezzi INT NULL,
|
||||
TCAssegnato DECIMAL(18,8),
|
||||
DataInizio DATETIME,
|
||||
DataFine DATETIME
|
||||
)
|
||||
DECLARE @tvProd TABLE (
|
||||
CodArticolo NVARCHAR(50),
|
||||
PezziLanciati INT NULL,
|
||||
PezziProd INT NULL,
|
||||
PezziConf INT NULL,
|
||||
TCAssegnato DECIMAL(18,8),
|
||||
CodOperatore INT NULL,
|
||||
TempoOn DECIMAL(18,8),
|
||||
TempoAuto DECIMAL(18,8),
|
||||
TempoRun DECIMAL(18,8),
|
||||
TCMedio DECIMAL(18,8),
|
||||
TCLav DECIMAL(18,8),
|
||||
TCEff DECIMAL(18,8),
|
||||
TCMedioRT DECIMAL(18,8),
|
||||
TCLavRT DECIMAL(18,8),
|
||||
TCEffRT DECIMAL(18,8)
|
||||
)
|
||||
|
||||
BEGIN
|
||||
-- controllo: se c'è riga macchina richiesta...
|
||||
SELECT @trovate=COUNT(*) FROM MappaStatoExpl WHERE IdxMacchina = @IdxMacchina
|
||||
|
||||
-- se NON c'è la creo...
|
||||
IF(@trovate = 0)
|
||||
BEGIN
|
||||
-- calcolo ODL
|
||||
;WITH cteODL AS
|
||||
(
|
||||
SELECT top 1 * FROM ODL
|
||||
WHERE IdxODL IN
|
||||
(
|
||||
SELECT IdxODL
|
||||
FROM ODL
|
||||
WHERE DataFine IS NULL
|
||||
AND (IdxMacchina = @IdxMacchina)
|
||||
|
||||
UNION
|
||||
|
||||
SELECT MAX(IdxODL)
|
||||
FROM ODL
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
)
|
||||
)
|
||||
-- inserisco i nuovi dati
|
||||
INSERT INTO MappaStatoExpl(lastUpdate, IdxMacchina, CodMacchina, Nome, url, IdxODL, CodArticolo, NumPezzi, TCAssegnato, DataInizioODL)
|
||||
SELECT @adesso, ma.IdxMacchina, ma.CodMacchina, ma.Nome, url, ISNULL(o.IdxODL,0), ISNULL(o.CodArticolo,'-'), ISNULL(o.NumPezzi,0), ISNULL(o.TCAssegnato,0), ISNULL(o.DataInizio,'2000/01/01')
|
||||
FROM Macchine ma LEFT OUTER JOIN cteODL o ON ma.IdxMacchina=o.IdxMacchina
|
||||
WHERE ma.IdxMacchina = @IdxMacchina
|
||||
AND NOT (locazione IS NULL)
|
||||
--AND ( (ISNULL(o.IdxODL,0) = 0) OR ((o.DataFine IS NULL) AND NOT (o.DataInizio IS NULL)) )
|
||||
ORDER BY ma.locazione
|
||||
END
|
||||
|
||||
-- popolo tab stati
|
||||
INSERT @tvStato(idxStato, Minuti)
|
||||
EXEC stp_repDonati_getLastStatoDurataMacchina @IdxMacchina, 0.1
|
||||
-- fix dati mancanti
|
||||
UPDATE tvs
|
||||
SET tvs.Semaforo = s.Semaforo
|
||||
,tvs.DescrizioneStato = s.Descrizione
|
||||
FROM @tvStato tvs INNER JOIN AnagraficaStati s ON tvs.idxStato=s.IdxStato
|
||||
|
||||
-- popolo tab ODL
|
||||
INSERT @tvODL
|
||||
EXEC stp_ODL_getByMacchina @IdxMacchina
|
||||
|
||||
-- popolo tab pezzi/tempi
|
||||
INSERT @tvProd(CodArticolo,PezziLanciati,PezziProd,PezziConf,TCAssegnato,CodOperatore,TempoOn,TempoAuto,TempoRun,TCMedio,TCLav,TCEff,TCMedioRT,TCLavRT,TCEffRT )
|
||||
EXEC stp_repDonati_getDatiProdMacchina @IdxMacchina
|
||||
|
||||
-- aggiorno in blocco i valori
|
||||
UPDATE mse
|
||||
SET mse.lastUpdate = @adesso
|
||||
,mse.idxStato = ISNULL(tvs.idxStato,0)
|
||||
,mse.durata = ISNULL(tvs.Minuti,0)
|
||||
,mse.Semaforo = ISNULL(tvs.Semaforo,'')
|
||||
,mse.DescrizioneStato = ISNULL(tvs.DescrizioneStato,'')
|
||||
,mse.TCAssegnato = ISNULL(tvo.TCAssegnato,0)
|
||||
,mse.NumPezzi = ISNULL(tvo.NumPezzi,0)
|
||||
,mse.DataInizioODL = ISNULL(tvo.DataInizio,'2000/01/01')
|
||||
,mse.PezziProd = ISNULL(tvp.PezziProd,0)
|
||||
,mse.PezziConf = ISNULL(tvp.PezziConf,0)
|
||||
,mse.TempoOn = ISNULL(tvp.TempoOn,0)
|
||||
,mse.TempoAuto = ISNULL(tvp.TempoAuto,0)
|
||||
,mse.TempoRun = ISNULL(tvp.TempoRun,0)
|
||||
,mse.TCMedio = ISNULL(tvp.TCMedio,0)
|
||||
,mse.TCLav = ISNULL(tvp.TCLav,0)
|
||||
,mse.TCEff = ISNULL(tvp.TCEff,0)
|
||||
,mse.TCMedioRT = ISNULL(tvp.TCMedioRT,0)
|
||||
,mse.TCLavRT = ISNULL(tvp.TCLavRT,0)
|
||||
,mse.TCEffRT = ISNULL(tvp.TCEffRT,0)
|
||||
FROM MappaStatoExpl mse
|
||||
CROSS JOIN @tvStato tvs
|
||||
CROSS JOIN @tvODL tvo
|
||||
CROSS JOIN @tvProd tvp
|
||||
WHERE mse.Idxmacchina = @IdxMacchina
|
||||
|
||||
END
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(380, GETDATE())
|
||||
GO
|
||||
|
||||
SELECT TOP 10 * FROM LogUpdateDb ORDER BY Versione DESC
|
||||
GO
|
||||
@@ -0,0 +1,194 @@
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_MSE_getByIdxMacchina
|
||||
* ottiene riga stato x macchina indicata
|
||||
*
|
||||
* modif.: S.E.L. - 2013.03.15
|
||||
**************************************/
|
||||
create PROCEDURE stp_MSE_getByIdxMacchina
|
||||
(
|
||||
@IdxMacchina nvarchar(50)
|
||||
)
|
||||
AS
|
||||
SET NOCOUNT ON;
|
||||
SELECT RowNum, lastUpdate, IdxMacchina, CodMacchina, Nome, url, idxODL, CodArticolo, NumPezzi, TCAssegnato, DataInizioODL, Semaforo, idxStato, DescrizioneStato, durata, PezziProd, PezziConf, TempoOn, TempoAuto, TempoRun, TCMedio, TCLav, TCEff, TCMedioRT, TCLavRT, TCEffRT
|
||||
FROM dbo.MappaStatoExpl
|
||||
WHERE IdxMacchina=@IdxMacchina
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_MSE_refresh
|
||||
* AGGIORNA tabella stato attuale macchine x macchina indicata
|
||||
*
|
||||
* modif.: S.E.L. - 2013.02.28
|
||||
**************************************/
|
||||
alter PROCEDURE stp_MSE_refresh
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50) -- macchina da aggiornare
|
||||
)
|
||||
AS
|
||||
|
||||
--init variabili!
|
||||
DECLARE @adesso DATETIME = GETDATE()
|
||||
DECLARE @trovate INT = 0
|
||||
DECLARE @tvStato TABLE (
|
||||
idxStato INT NULL,
|
||||
DescrizioneStato NVARCHAR(50),
|
||||
Semaforo NVARCHAR(50),
|
||||
Minuti INT NULL
|
||||
)
|
||||
DECLARE @tvODL TABLE (
|
||||
IdxODL INT NULL,
|
||||
CodArticolo NVARCHAR(50),
|
||||
DescArticolo NVARCHAR(50),
|
||||
IdxMacchina INT NULL,
|
||||
CodMacchina NVARCHAR(50),
|
||||
Nome NVARCHAR(50),
|
||||
NumPezzi INT NULL,
|
||||
TCAssegnato DECIMAL(18,8),
|
||||
DataInizio DATETIME,
|
||||
DataFine DATETIME
|
||||
)
|
||||
DECLARE @tvProd TABLE (
|
||||
CodArticolo NVARCHAR(50),
|
||||
PezziLanciati INT NULL,
|
||||
PezziProd INT NULL,
|
||||
PezziConf INT NULL,
|
||||
TCAssegnato DECIMAL(18,8),
|
||||
CodOperatore INT NULL,
|
||||
TempoOn DECIMAL(18,8),
|
||||
TempoAuto DECIMAL(18,8),
|
||||
TempoRun DECIMAL(18,8),
|
||||
TCMedio DECIMAL(18,8),
|
||||
TCLav DECIMAL(18,8),
|
||||
TCEff DECIMAL(18,8),
|
||||
TCMedioRT DECIMAL(18,8),
|
||||
TCLavRT DECIMAL(18,8),
|
||||
TCEffRT DECIMAL(18,8)
|
||||
)
|
||||
|
||||
BEGIN
|
||||
-- controllo: se c'è riga macchina richiesta...
|
||||
SELECT @trovate=COUNT(*) FROM MappaStatoExpl WHERE IdxMacchina = @IdxMacchina
|
||||
|
||||
-- se NON c'è la creo...
|
||||
IF(@trovate = 0)
|
||||
BEGIN
|
||||
-- calcolo ODL
|
||||
;WITH cteODL AS
|
||||
(
|
||||
SELECT top 1 * FROM ODL
|
||||
WHERE IdxODL IN
|
||||
(
|
||||
SELECT IdxODL
|
||||
FROM ODL
|
||||
WHERE DataFine IS NULL
|
||||
AND (IdxMacchina = @IdxMacchina)
|
||||
|
||||
UNION
|
||||
|
||||
SELECT MAX(IdxODL)
|
||||
FROM ODL
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
)
|
||||
)
|
||||
-- inserisco i nuovi dati
|
||||
INSERT INTO MappaStatoExpl(lastUpdate, IdxMacchina, CodMacchina, Nome, url, IdxODL, CodArticolo, NumPezzi, TCAssegnato, DataInizioODL)
|
||||
SELECT @adesso, ma.IdxMacchina, ma.CodMacchina, ma.Nome, url, ISNULL(o.IdxODL,0), ISNULL(o.CodArticolo,'-'), ISNULL(o.NumPezzi,0), ISNULL(o.TCAssegnato,0), ISNULL(o.DataInizio,'2000/01/01')
|
||||
FROM Macchine ma LEFT OUTER JOIN cteODL o ON ma.IdxMacchina=o.IdxMacchina
|
||||
WHERE ma.IdxMacchina = @IdxMacchina
|
||||
AND NOT (locazione IS NULL)
|
||||
--AND ( (ISNULL(o.IdxODL,0) = 0) OR ((o.DataFine IS NULL) AND NOT (o.DataInizio IS NULL)) )
|
||||
ORDER BY ma.locazione
|
||||
END
|
||||
|
||||
-- popolo tab stati
|
||||
INSERT @tvStato(idxStato, Minuti)
|
||||
EXEC stp_repDonati_getLastStatoDurataMacchina @IdxMacchina, 0.1
|
||||
-- fix dati mancanti
|
||||
UPDATE tvs
|
||||
SET tvs.Semaforo = s.Semaforo
|
||||
,tvs.DescrizioneStato = s.Descrizione
|
||||
FROM @tvStato tvs INNER JOIN AnagraficaStati s ON tvs.idxStato=s.IdxStato
|
||||
|
||||
-- popolo tab ODL
|
||||
INSERT @tvODL
|
||||
EXEC stp_ODL_getByMacchina @IdxMacchina
|
||||
|
||||
-- popolo tab pezzi/tempi
|
||||
INSERT @tvProd(CodArticolo,PezziLanciati,PezziProd,PezziConf,TCAssegnato,CodOperatore,TempoOn,TempoAuto,TempoRun,TCMedio,TCLav,TCEff,TCMedioRT,TCLavRT,TCEffRT )
|
||||
EXEC stp_repDonati_getDatiProdMacchina @IdxMacchina
|
||||
|
||||
-- aggiorno in blocco i valori
|
||||
UPDATE mse
|
||||
SET mse.lastUpdate = @adesso
|
||||
,mse.idxStato = ISNULL(tvs.idxStato,0)
|
||||
,mse.durata = ISNULL(tvs.Minuti,0)
|
||||
,mse.Semaforo = ISNULL(tvs.Semaforo,'')
|
||||
,mse.DescrizioneStato = ISNULL(tvs.DescrizioneStato,'')
|
||||
,mse.IdxODL = ISNULL(tvo.IdxODL,0)
|
||||
,mse.CodArticolo = ISNULL(tvo.CodArticolo,0)
|
||||
,mse.TCAssegnato = ISNULL(tvo.TCAssegnato,0)
|
||||
,mse.NumPezzi = ISNULL(tvo.NumPezzi,0)
|
||||
,mse.DataInizioODL = ISNULL(tvo.DataInizio,'2000/01/01')
|
||||
,mse.PezziProd = ISNULL(tvp.PezziProd,0)
|
||||
,mse.PezziConf = ISNULL(tvp.PezziConf,0)
|
||||
,mse.TempoOn = ISNULL(tvp.TempoOn,0)
|
||||
,mse.TempoAuto = ISNULL(tvp.TempoAuto,0)
|
||||
,mse.TempoRun = ISNULL(tvp.TempoRun,0)
|
||||
,mse.TCMedio = ISNULL(tvp.TCMedio,0)
|
||||
,mse.TCLav = ISNULL(tvp.TCLav,0)
|
||||
,mse.TCEff = ISNULL(tvp.TCEff,0)
|
||||
,mse.TCMedioRT = ISNULL(tvp.TCMedioRT,0)
|
||||
,mse.TCLavRT = ISNULL(tvp.TCLavRT,0)
|
||||
,mse.TCEffRT = ISNULL(tvp.TCEffRT,0)
|
||||
FROM MappaStatoExpl mse
|
||||
CROSS JOIN @tvStato tvs
|
||||
CROSS JOIN @tvODL tvo
|
||||
CROSS JOIN @tvProd tvp
|
||||
WHERE mse.Idxmacchina = @IdxMacchina
|
||||
|
||||
END
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(385, GETDATE())
|
||||
GO
|
||||
|
||||
SELECT TOP 10 * FROM LogUpdateDb ORDER BY Versione DESC
|
||||
GO
|
||||
@@ -0,0 +1,78 @@
|
||||
create table RemoteRebootLog(
|
||||
idxReboot int not null identity constraint PK_RemoteRebootLog primary key,
|
||||
IdxMacchina nvarchar(50) not null,
|
||||
IPv4 nvarchar(50),
|
||||
Agent nvarchar(250),
|
||||
DataOraBoot datetime
|
||||
);
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_TC_getByMacchinaPeriodo
|
||||
* recupera tempi ciclo x macchina e periodo
|
||||
*
|
||||
* modif.: S.E.L. - 2010.12.15
|
||||
**************************************/
|
||||
alter PROCEDURE stp_TC_getByMacchinaPeriodo
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@Inizio DATETIME,
|
||||
@Fine DATETIME
|
||||
)
|
||||
AS
|
||||
|
||||
SELECT * FROM TempiCicloRilevati
|
||||
WHERE IdxMacchina = @IdxMacchina AND
|
||||
(DataOraRif >= @Inizio) AND (DataOraRif <= @Fine)
|
||||
ORDER BY DataOraRif
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_TRI_getByIdxMacchina
|
||||
* recupera dati transizione ingressi da idx Macchina
|
||||
*
|
||||
* modif.: S.E.L.
|
||||
* il: 2011.03.23
|
||||
**************************************/
|
||||
alter PROCEDURE stp_TRI_getByIdxMacchina
|
||||
(
|
||||
@IdxMacchina NVARCHAR(50)
|
||||
)
|
||||
AS
|
||||
|
||||
SELECT *
|
||||
FROM TransizioneIngressi
|
||||
WHERE IdxFamigliaIngresso = (SELECT IdxFamigliaIngresso FROM Macchine2FamigliaIngressi WHERE IdxMacchina=@IdxMacchina)
|
||||
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(390, GETDATE())
|
||||
GO
|
||||
|
||||
SELECT TOP 10 * FROM LogUpdateDb ORDER BY Versione DESC
|
||||
GO
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,839 @@
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
-- ================================================
|
||||
-- Author: Samuele E. Locatelli
|
||||
-- Create date: 2012.11.23
|
||||
--
|
||||
-- Description: rigenerazione del diario di bordo
|
||||
-- a partire da macchina eventi/stati + EventList
|
||||
-- ================================================
|
||||
alter PROCEDURE man.stp_ricalcolaDatiMacchinaFromDate
|
||||
(
|
||||
@idxMacchina NVARCHAR(50),
|
||||
@inizio DATETIME,
|
||||
@idxStatoStart INT = 1
|
||||
)
|
||||
AS
|
||||
|
||||
SET NOCOUNT ON;
|
||||
|
||||
DECLARE @fine DATETIME
|
||||
|
||||
--DBCC SHOWCONTIG(EventList)
|
||||
--DBCC SHOWCONTIG(DiarioDiBordo)
|
||||
|
||||
/* DA USARE ? Verificare */
|
||||
--DECLARE @Database AS SYSNAME;
|
||||
--SET @Database = DB_NAME()
|
||||
--EXEC USP_DisableEnableNonClusteredIndexes @Database ,null, 1 -- disabilito indici
|
||||
|
||||
-- update SAM 2013.10.24: "torno indietro" di 2 eventi rispetto alal data ora indicata come start, SE CI SONO
|
||||
SELECT @inizio = ISNULL(MIN(InizioStato),@inizio) FROM
|
||||
(
|
||||
SELECT TOP 3 InizioStato
|
||||
FROM DiarioDiBordo
|
||||
WHERE IdxMacchina = @idxMacchina AND InizioStato < @inizio
|
||||
ORDER BY InizioStato DESC
|
||||
) AS tbl
|
||||
|
||||
|
||||
-- DISATTIVO inserimento in DiarioDiBordo per la macchina indicata
|
||||
-- DEVE disattivare anche il caricamento degli eventi
|
||||
UPDATE DatiMacchine
|
||||
SET insEnabled = 0
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
|
||||
-- devo sempre rielaborare tutti gli eventi fino a dataora odierna
|
||||
SET @fine = ( SELECT MAX(InizioStato) FROM EventList
|
||||
WHERE idxMacchina = @idxMacchina )
|
||||
|
||||
-- svuoto dati che vado a sostituire
|
||||
PRINT 'svuoto TempiCicloRilevati per periodo indicato...'
|
||||
DELETE FROM TempiCicloRilevati WHERE idxMacchina = @idxMacchina AND DataOraRif BETWEEN @inizio AND @fine
|
||||
|
||||
PRINT 'svuoto DiarioDiBordo per periodo indicato...'
|
||||
EXEC stp_DDB_deleteMacchinaPeriodo @idxMacchina, @inizio, @fine -- cancella diario di bordo
|
||||
|
||||
PRINT 'processo EventList per periodo indicato...'
|
||||
DECLARE @InizioStato DATETIME
|
||||
DECLARE @IdxTipo INT
|
||||
DECLARE @MatricolaKanban NVARCHAR(50)
|
||||
DECLARE @Value NVARCHAR(50)
|
||||
DECLARE @MatrOpr INT
|
||||
DECLARE @pallet NVARCHAR(20)
|
||||
DECLARE @nextIdxStato INT
|
||||
DECLARE @currIdxStato INT
|
||||
DECLARE @IdxFamiglia INT
|
||||
DECLARE @TabAzione NVARCHAR(50) = '';
|
||||
DECLARE @Azione NVARCHAR(50) = '';
|
||||
DECLARE @FlgAggTempiC CHAR(1) = 'N'; -- Y/N = elabora o meno i tempi ciclo
|
||||
|
||||
-- calcolo famiglia macchina!
|
||||
SET @IdxFamiglia = ( SELECT IdxFamiglia FROM Macchine2FamiglieMacchine WHERE idxMacchina = @idxMacchina )
|
||||
|
||||
-- Recupero stato precedente, altrimenti ipotizzo macchina inizialmente in stato richiesto (default: 1 = pronta) e quindi imposto stato current a quello iniziale richiesto...
|
||||
SET @currIdxStato = ISNULL( ( SELECT TOP 1 IdxStato FROM DiarioDiBordo WHERE IdxMacchina = @idxMacchina AND InizioStato < @inizio
|
||||
ORDER BY InizioStato DESC ) , @idxStatoStart)
|
||||
|
||||
-- verifico i record elaborati
|
||||
SELECT COUNT(*)
|
||||
FROM EventList AS e
|
||||
LEFT JOIN dbo.AnagraficaEventi AS a ON e.idxTipo = a.IdxTipo
|
||||
WHERE e.IdxMacchina = @idxMacchina
|
||||
AND e.InizioStato BETWEEN @inizio AND @fine
|
||||
|
||||
-- leggo la tabella degli eventi con cursore x percorrere i dati...
|
||||
DECLARE event2proc CURSOR FOR
|
||||
SELECT e.InizioStato, e.IdxTipo, e.MatricolaKanban, e.Value, e.MatrOpr, e.pallet,
|
||||
a.TabAzione, a.Azione
|
||||
FROM EventList AS e
|
||||
LEFT JOIN dbo.AnagraficaEventi AS a ON e.idxTipo = a.IdxTipo
|
||||
WHERE e.IdxMacchina = @idxMacchina
|
||||
AND e.InizioStato BETWEEN @inizio AND @fine
|
||||
ORDER BY e.InizioStato;
|
||||
/*
|
||||
SELECT InizioStato, IdxTipo, MatricolaKanban, Value, MatrOpr, pallet
|
||||
FROM EventList
|
||||
WHERE IdxMacchina = @idxMacchina
|
||||
AND InizioStato BETWEEN @inizio AND @fine
|
||||
ORDER BY InizioStato;
|
||||
*/
|
||||
OPEN event2proc;
|
||||
|
||||
FETCH NEXT FROM event2proc
|
||||
INTO @InizioStato, @IdxTipo, @MatricolaKanban, @Value, @MatrOpr, @pallet, @TabAzione, @Azione;
|
||||
|
||||
DECLARE @NumPz INT = 1;
|
||||
DECLARE @ContaInsert INT = 0;
|
||||
|
||||
WHILE @@FETCH_STATUS = 0
|
||||
BEGIN
|
||||
|
||||
IF ( ISNULL(@TabAzione,'') <> '' AND ISNULL(@Azione,'') <> '')
|
||||
BEGIN
|
||||
SET @NumPz = CASE WHEN (ISNUMERIC(@Value)=1) THEN @Value ELSE 1 END
|
||||
-- controllo se devo aggiornare i Tempi ciclo in base allo stato macchina ( se null resta precedente )
|
||||
SELECT @FlgAggTempiC = ( CASE Semaforo WHEN 'V' THEN 'Y' ELSE 'N' END ) FROM dbo.AnagraficaStati
|
||||
WHERE IdxStato = @currIdxStato
|
||||
EXEC dbo.stp_EL_processaEvento @IdxTipo, @idxMacchina, @MatricolaKanban, @InizioStato, @NumPz, 'N', @FlgAggTempiC
|
||||
END
|
||||
|
||||
-- calcolo l'eventuale NUOVO idxStato
|
||||
SET @nextIdxStato = ISNULL( (SELECT next_IdxStato FROM TransizioneStati
|
||||
WHERE IdxFamiglia = @IdxFamiglia AND IdxStato = @currIdxStato AND IdxTipo = @IdxTipo ), @currIdxStato )
|
||||
|
||||
-- SE lo stato cambia registro nel DiarioDiBordo!
|
||||
IF (@nextIdxStato <> @currIdxStato)
|
||||
BEGIN
|
||||
-- inserisco in DiarioDiBordo
|
||||
INSERT INTO DiarioDiBordo
|
||||
(IdxMacchina, InizioStato, FineStato, IdxStato, MatricolaKanban, Value, MatrOpr, pallet)
|
||||
VALUES (@IdxMacchina, @InizioStato, NULL, @nextIdxStato, @MatricolaKanban, @Value, @MatrOpr, @pallet)
|
||||
|
||||
-- infine imposto il nuovo stato current...
|
||||
SET @currIdxStato = @nextIdxStato
|
||||
SET @ContaInsert = @ContaInsert + 1
|
||||
END
|
||||
|
||||
-- Get the next values
|
||||
FETCH NEXT FROM event2proc
|
||||
INTO @InizioStato, @IdxTipo, @MatricolaKanban, @Value, @MatrOpr, @pallet, @TabAzione, @Azione;
|
||||
|
||||
END
|
||||
CLOSE event2proc;
|
||||
DEALLOCATE event2proc;
|
||||
|
||||
-- resetto microStato a 1
|
||||
UPDATE dbo.MicroStatoMacchina
|
||||
SET IdxMicroStato = 1,
|
||||
InizioStato = @InizioStato,
|
||||
Value = '0'
|
||||
WHERE IdxMacchina = @idxMacchina
|
||||
|
||||
-- fa un controllo: elimina eventuali dichairazioni in DDB SE durata < 0...
|
||||
DELETE FROM DiarioDiBordo WHERE DurataMinuti < 0 AND IdxMacchina = @idxMacchina
|
||||
|
||||
-- RI-ATTIVO inserimento in DiarioDiBordo per la macchina indicata
|
||||
UPDATE DatiMacchine
|
||||
SET insEnabled = 1
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
|
||||
PRINT 'concluso UPDATE tabelle...' + 'INSERT DiarioBordo : ' + CONVERT(VARCHAR(30),@ContaInsert)
|
||||
|
||||
--DBCC SHOWCONTIG(EventList)
|
||||
--DBCC SHOWCONTIG(DiarioDiBordo)
|
||||
--EXEC USP_DisableEnableNonClusteredIndexes @Database,null, 2 --riattivo indici
|
||||
|
||||
--ricostruisco indici X QUESTE TABELLE DOPPIA RICOSTRUZIONE INDICI NON NECESSARIA
|
||||
--PRINT 'ricostruisco indici...'
|
||||
--DBCC DBREINDEX(EventList)
|
||||
--DBCC DBREINDEX(DiarioDiBordo)
|
||||
--DBCC DBREINDEX(TransizioneIngressi)
|
||||
--DBCC DBREINDEX(Kanban2ins)
|
||||
--DBCC DBREINDEX(Kanban)
|
||||
--DBCC DBREINDEX(AnagraficaOperatori)
|
||||
--DBCC DBREINDEX(AnagraficaOperatori2ins)
|
||||
|
||||
--DBCC SHOWCONTIG(EventList)
|
||||
--DBCC SHOWCONTIG(DiarioDiBordo)
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_EL_processaEvento
|
||||
* Processa un singolo evento
|
||||
*
|
||||
* Note : richiamata anche nel trigger della tabella EventList
|
||||
*
|
||||
* modif.:
|
||||
**************************************/
|
||||
alter PROCEDURE stp_EL_processaEvento
|
||||
(
|
||||
@IdxTipo INT,
|
||||
@IdxMacchina NVARCHAR(50),
|
||||
@MatricolaKanban NVARCHAR(50),
|
||||
@DataOra DATETIME,
|
||||
@NumPz INT,
|
||||
@FlgAggStato CHAR(1) = 'Y', -- Y/N = elabora o meno aggiornamento StatiMacchine e DatiMacchine
|
||||
@FlgAggTempiC CHAR(1) = 'N' -- Y/N = elabora o meno i tempi ciclo
|
||||
)
|
||||
AS
|
||||
|
||||
---- parametri x test
|
||||
--DECLARE @IdxTipo INT = 0
|
||||
--DECLARE @IdxMacchina NVARCHAR(50)
|
||||
--DECLARE @DataOra DATETIME
|
||||
--DECLARE @MatricolaKanban NVARCHAR(50)
|
||||
--DECLARE @TCMedio DECIMAL(18,8)
|
||||
--DECLARE @NumPz INT
|
||||
|
||||
--SET @IdxTipo = ( SELECT i.IdxTipo FROM inserted i )
|
||||
--SET @IdxMacchina = ( SELECT i.IdxMacchina FROM inserted i )
|
||||
--SET @DataOra = ( SELECT i.InizioStato FROM inserted i )
|
||||
--SET @MatricolaKanban = ( SELECT i.MatricolaKanban FROM inserted i )
|
||||
--SET @NumPz = ( SELECT CASE WHEN (ISNUMERIC(value)=1) THEN value ELSE 1 END FROM inserted i )
|
||||
|
||||
-- INIZIO DICHIARAZIONI
|
||||
DECLARE @TabAzione NVARCHAR(50) = '';
|
||||
DECLARE @Azione NVARCHAR(50) = '';
|
||||
DECLARE @CodArticolo NVARCHAR(50) = ''
|
||||
DECLARE @MatricolaKanbanOk NVARCHAR(50);
|
||||
DECLARE @DataOraPrec DATETIME;
|
||||
DECLARE @TCMedio DECIMAL(18,8) = 0;
|
||||
|
||||
/* recupero altri valori ( se non trova record lascia il valore invariato cioè = '' )*/
|
||||
SELECT @TabAzione = ISNULL(TabAzione,'')
|
||||
, @Azione = ISNULL(Azione,'')
|
||||
FROM AnagraficaEventi WHERE IdxTipo = @IdxTipo
|
||||
|
||||
--SELECT @TabAzione , @Azione
|
||||
|
||||
---- SOLO se lo stato della macchina è VERDE ( lavora ) devo aggiornare i tempi ciclo
|
||||
---- NON VA BENE QUANDO FA RICALCOLO NON C'é NULL
|
||||
--IF EXISTS ( SELECT D.IdxStato FROM dbo.DiarioDiBordo AS D
|
||||
-- INNER JOIN dbo.AnagraficaStati AS S ON d.idxStato = S.IdxStato
|
||||
-- WHERE d.IdxMacchina = @IdxMacchina AND d.FineStato IS NULL AND s.Semaforo = 'V' )
|
||||
-- SET @FlgAggTempiC = 'Y'
|
||||
|
||||
IF (@TabAzione <> '' AND @Azione <> '')
|
||||
BEGIN
|
||||
/* azioni richieste: seconda dei casi eseguo... */
|
||||
|
||||
/******************************************
|
||||
*
|
||||
* Calcolo tempo ciclo per INIZIO
|
||||
*
|
||||
******************************************/
|
||||
IF(@TabAzione = 'TempiCicloRilevati' AND @Azione = 'Insert' AND @FlgAggTempiC = 'Y' )
|
||||
BEGIN
|
||||
-- recupero codice articolo
|
||||
SET @CodArticolo = ( SELECT CodArticolo FROM Kanban WHERE MatricolaKanban = @MatricolaKanban )
|
||||
/* calcolo tempo tra gli ultimi 2 eventi "contapezzi" */
|
||||
SET @DataOraPrec = ISNULL((SELECT Top 1 InizioStato FROM EventList WHERE IdxMacchina = @IdxMacchina
|
||||
AND IdxTipo = @IdxTipo AND InizioStato < @DataOra ORDER BY InizioStato DESC), @DataOra )
|
||||
|
||||
-- se è oltre 10 gg calcolo in secondi... 2013.8.30
|
||||
IF (DATEDIFF(DD, @DataOraPrec, @DataOra) > 10)
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(s, @DataOraPrec, @DataOra) / 60.00 ) ) --calcolo in secondi
|
||||
ELSE
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(ms, @DataOraPrec, @DataOra) / 60000.00 ) )
|
||||
|
||||
/* inserisco riga di tempo ciclo */
|
||||
INSERT INTO TempiCicloRilevati
|
||||
VALUES(@IdxMacchina, @CodArticolo, @DataOra, @TCMedio, @NumPz)
|
||||
END
|
||||
/******************************************
|
||||
*
|
||||
* Calcolo tempo ciclo con logica stop/start
|
||||
*
|
||||
******************************************/
|
||||
ELSE IF(@TabAzione = 'TempiCicloRilevati' AND @Azione = 'Stop2StartCiclo' AND @FlgAggTempiC = 'Y' )
|
||||
BEGIN
|
||||
/* prendo la matricola dall'evento inizio (precedente) */
|
||||
SET @MatricolaKanbanOk = ISNULL((SELECT Top 1 MatricolaKanban FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo - 1 AND InizioStato < @DataOra ORDER BY InizioStato DESC), @MatricolaKanban )
|
||||
|
||||
-- calcolare num pezzi da codice...
|
||||
SET @CodArticolo = ( SELECT CodArticolo FROM Kanban WHERE MatricolaKanban = @MatricolaKanbanOk )
|
||||
/* calcolo tempo tra eventi "contapezzi" inizio - fine NB: idxEvento per fine è idxEvento inizio + 1 ... HARD CODED!!! */
|
||||
SET @DataOraPrec = ISNULL((SELECT Top 1 InizioStato FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo - 1 AND InizioStato < @DataOra ORDER BY InizioStato DESC), @DataOra )
|
||||
|
||||
-- se è oltre 10 gg calcolo in secondi... 2013.8.30
|
||||
IF (DATEDIFF(DD, @DataOraPrec, @DataOra) > 10)
|
||||
SET @TCMedio = ( DATEDIFF(s, @DataOraPrec, @DataOra) / 60.00 ) --calcolo in secondi
|
||||
ELSE
|
||||
SET @TCMedio = ( DATEDIFF(ms, @DataOraPrec, @DataOra) / 60000.00 )
|
||||
|
||||
/* inserisco riga di tempo ciclo */
|
||||
INSERT INTO TempiCicloRilevati
|
||||
VALUES(@IdxMacchina, @CodArticolo, @DataOra, @TCMedio, @NumPz)
|
||||
END
|
||||
/******************************************
|
||||
*
|
||||
* calcolo tempo ciclo con logica stop/stop
|
||||
*
|
||||
******************************************/
|
||||
ELSE IF(@TabAzione = 'TempiCicloRilevati' AND @Azione = 'Stop2StopCiclo' AND @FlgAggTempiC = 'Y' )
|
||||
BEGIN
|
||||
/* prendo la matricola dall'evento inizio (precedente) */
|
||||
SET @MatricolaKanbanOk = ISNULL((SELECT Top 1 MatricolaKanban FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo AND InizioStato < @DataOra ORDER BY InizioStato DESC), @MatricolaKanban )
|
||||
|
||||
-- calcolare num pezzi da codice...
|
||||
SET @NumPz = ( SELECT PzPallet FROM Kanban WHERE MatricolaKanban = @MatricolaKanbanOk )
|
||||
SET @CodArticolo = ( SELECT CodArticolo FROM Kanban WHERE MatricolaKanban = @MatricolaKanbanOk )
|
||||
/* calcolo tempo tra eventi "contapezzi" fine - fine NB: idxEvento per fine è idxEvento inizio + 1 ... HARD CODED!!! */
|
||||
SET @DataOraPrec = ISNULL( (SELECT Top 1 InizioStato FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo AND InizioStato < @DataOra ORDER BY InizioStato DESC), @DataOra )
|
||||
|
||||
-- se è oltre 10 gg calcolo in secondi... 2013.8.30
|
||||
IF (DATEDIFF(DD, @DataOraPrec, @DataOra) > 10)
|
||||
SET @TCMedio = ( DATEDIFF(s, @DataOraPrec, @DataOra) / 60.00 ) --calcolo in secondi
|
||||
ELSE
|
||||
SET @TCMedio = ( DATEDIFF(ms, @DataOraPrec, @DataOra) / 60000.00 )
|
||||
|
||||
/* inserisco riga di tempo ciclo */
|
||||
INSERT INTO TempiCicloRilevati
|
||||
VALUES(@IdxMacchina, @CodArticolo, @DataOra, @TCMedio, @NumPz)
|
||||
END
|
||||
|
||||
/******************************************
|
||||
*
|
||||
* Aggiorno kanban in dati macchine per
|
||||
* INIZIO ATTREZZAGGIO
|
||||
*
|
||||
******************************************/
|
||||
ELSE IF(@TabAzione = 'DatiMacchine' AND @Azione = 'Inizio' AND @FlgAggStato = 'Y')
|
||||
BEGIN
|
||||
/* aggiorno riga di dati macchina */
|
||||
UPDATE DatiMacchine
|
||||
SET kanban_A = @MatricolaKanban,
|
||||
kanban_B = @MatricolaKanban
|
||||
WHERE idxMacchina = @IdxMacchina
|
||||
/* aggiorno stato macchina */
|
||||
UPDATE StatoMacchine
|
||||
SET MatricolaKanban = @MatricolaKanban
|
||||
WHERE idxMacchina = @IdxMacchina
|
||||
/* aggiorno dati kanban statoMacchine... */
|
||||
UPDATE StatoMacchine
|
||||
SET KanbanCode = k.KanbanCode, TempoCicloBase = k.TempoCicloBase, PzPalletProd = k.PzPallet
|
||||
FROM Kanban AS k
|
||||
INNER JOIN StatoMacchine ON k.MatricolaKanban = StatoMacchine.MatricolaKanban
|
||||
WHERE (StatoMacchine.idxMacchina = @IdxMacchina)
|
||||
END
|
||||
/******************************************
|
||||
*
|
||||
* Aggiorno kanban in dati macchine per
|
||||
* FINE PRODUZIONE
|
||||
*
|
||||
******************************************/
|
||||
ELSE IF(@TabAzione = 'DatiMacchine' AND @Azione = 'Fine' AND @FlgAggStato = 'Y')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @MatricolaKanban = 'KAND' -- kanban non definito !!!HARD CODED!!!
|
||||
/* aggiorno riga di dati macchina */
|
||||
UPDATE DatiMacchine
|
||||
SET kanban_A = @MatricolaKanban,
|
||||
kanban_B = @MatricolaKanban
|
||||
WHERE idxMacchina = @IdxMacchina
|
||||
/* aggiorno stato macchina */
|
||||
UPDATE StatoMacchine
|
||||
SET MatricolaKanban = @MatricolaKanban
|
||||
WHERE idxMacchina = @IdxMacchina
|
||||
/* aggiorno dati kanban statoMacchine... */
|
||||
UPDATE StatoMacchine
|
||||
SET KanbanCode = k.KanbanCode, TempoCicloBase = k.TempoCicloBase, PzPalletProd = k.PzPallet
|
||||
FROM Kanban AS k INNER JOIN StatoMacchine ON k.MatricolaKanban = StatoMacchine.MatricolaKanban
|
||||
WHERE (StatoMacchine.idxMacchina = @IdxMacchina)
|
||||
|
||||
END
|
||||
END
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
/***************************************************
|
||||
* Trigger trg_doActions
|
||||
*
|
||||
* processa eventuali azioni legate ad un inserimento evento
|
||||
*
|
||||
* modificato: S.E.L.
|
||||
* 2011.05.18
|
||||
*
|
||||
***************************************************/
|
||||
alter TRIGGER trg_doActions
|
||||
ON EventList
|
||||
FOR INSERT
|
||||
AS
|
||||
/* dichiarazione variabili */
|
||||
DECLARE @IdxTipo INT
|
||||
DECLARE @TabAzione NVARCHAR(50)
|
||||
DECLARE @Azione NVARCHAR(50)
|
||||
DECLARE @IdxMacchina NVARCHAR(50)
|
||||
DECLARE @MatricolaKanban NVARCHAR(50)
|
||||
DECLARE @MatricolaKanbanOk NVARCHAR(50)
|
||||
DECLARE @CodArticolo NVARCHAR(50)
|
||||
DECLARE @TCMedio DECIMAL(18,8)
|
||||
DECLARE @DataOra DATETIME
|
||||
DECLARE @DataOraPrec DATETIME
|
||||
DECLARE @NumPz INT
|
||||
DECLARE @FlgAggTempiC CHAR(1) = 'N' -- Y/N = elabora o meno i tempi ciclo
|
||||
|
||||
|
||||
/* recupero valori dell'INSERT */
|
||||
SET @IdxTipo = ( SELECT i.IdxTipo FROM inserted i )
|
||||
SET @IdxMacchina = ( SELECT i.IdxMacchina FROM inserted i )
|
||||
SET @MatricolaKanban = ( SELECT i.MatricolaKanban FROM inserted i )
|
||||
SET @DataOra = ( SELECT i.InizioStato FROM inserted i )
|
||||
SET @NumPz = ( SELECT CASE WHEN (ISNUMERIC(value)=1) THEN value ELSE 1 END FROM inserted i )
|
||||
|
||||
-- SOLO SE lo stato della macchina è VERDE ( lavora ) devo aggiornare i tempi ciclo
|
||||
IF EXISTS ( SELECT M.IdxStato FROM dbo.StatoMacchine AS M
|
||||
INNER JOIN dbo.AnagraficaStati AS S ON M.idxStato = S.IdxStato
|
||||
WHERE M.IdxMacchina = @IdxMacchina AND s.Semaforo = 'V' )
|
||||
SET @FlgAggTempiC = 'Y'
|
||||
|
||||
EXECUTE dbo.stp_EL_processaEvento @IdxTipo, @IdxMacchina, @MatricolaKanban, @DataOra, @NumPz, 'Y', @FlgAggTempiC
|
||||
|
||||
/* SOSTITUITA CON STORED
|
||||
|
||||
/* controllo se l'evento richieda azioni successive */
|
||||
IF(@TabAzione <> '' AND @Azione <> '')
|
||||
BEGIN
|
||||
/* azioni richieste: seconda dei casi eseguo... */
|
||||
|
||||
/******************************************
|
||||
*
|
||||
* Calcolo tempo ciclo per INIZIO
|
||||
*
|
||||
******************************************/
|
||||
IF(@TabAzione = 'TempiCicloRilevati' AND @Azione = 'Insert')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @DataOra = ( SELECT i.InizioStato FROM inserted i )
|
||||
SET @MatricolaKanban = ( SELECT i.MatricolaKanban FROM inserted i )
|
||||
SET @NumPz = ( SELECT CASE WHEN (ISNUMERIC(value)=1) THEN value ELSE 1 END FROM inserted i )
|
||||
SET @CodArticolo = ( SELECT CodArticolo FROM Kanban WHERE MatricolaKanban = @MatricolaKanban )
|
||||
/* calcolo tempo tra gli ultimi 2 eventi "contapezzi" */
|
||||
SET @DataOraPrec = ( SELECT ISNULL((SELECT Top 1 InizioStato FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo AND InizioStato < @DataOra ORDER BY InizioStato DESC), @DataOra ) )
|
||||
-- se è oltre 10 gg calcolo in secondi... 2013.8.30
|
||||
IF (DATEDIFF(DD, @DataOraPrec, @DataOra) > 10)
|
||||
BEGIN
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(s, @DataOraPrec, @DataOra) / 60.00 ) ) --calcolo in secondi
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(ms, @DataOraPrec, @DataOra) / 60000.00 ) )
|
||||
END
|
||||
-- versione vecchia (blocco se oltre 24 gg di fermo...)
|
||||
--BEGIN TRY
|
||||
-- /* è in millisecondi, divido per 60'000.00 x avere minuti centesimali*/
|
||||
-- SET @TCMedio = ( SELECT (DATEDIFF(ms, @DataOraPrec, @DataOra) / 60000.00 ) )
|
||||
--END TRY
|
||||
--BEGIN CATCH
|
||||
-- SET @TCMedio = ( SELECT (DATEDIFF(s, @DataOraPrec, @DataOra) / 60.00 ) ) --calcolo in secondi
|
||||
--END CATCH
|
||||
/* inserisco riga di tempo ciclo */
|
||||
INSERT INTO TempiCicloRilevati
|
||||
VALUES(@IdxMacchina, @CodArticolo, @DataOra, @TCMedio, @NumPz)
|
||||
END
|
||||
/******************************************
|
||||
*
|
||||
* Calcolo tempo ciclo con logica stop/start
|
||||
*
|
||||
******************************************/
|
||||
ELSE IF(@TabAzione = 'TempiCicloRilevati' AND @Azione = 'Stop2StartCiclo')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @DataOra = ( SELECT i.InizioStato FROM inserted i )
|
||||
SET @MatricolaKanban = ( SELECT i.MatricolaKanban FROM inserted i )
|
||||
/* prendo la matricola dall'evento inizio (precedente) */
|
||||
SET @MatricolaKanbanOk = ( SELECT ISNULL((SELECT Top 1 MatricolaKanban FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo - 1 AND InizioStato < @DataOra ORDER BY InizioStato DESC), @MatricolaKanban ) )
|
||||
|
||||
-- calcolare num pezzi da codice...
|
||||
SET @NumPz = ( SELECT CASE WHEN (ISNUMERIC(value)=1) THEN value ELSE 1 END FROM inserted i )
|
||||
SET @CodArticolo = ( SELECT CodArticolo FROM Kanban WHERE MatricolaKanban = @MatricolaKanbanOk )
|
||||
/* calcolo tempo tra eventi "contapezzi" inizio - fine NB: idxEvento per fine è idxEvento inizio + 1 ... HARD CODED!!! */
|
||||
SET @DataOraPrec = ( SELECT ISNULL((SELECT Top 1 InizioStato FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo - 1 AND InizioStato < @DataOra ORDER BY InizioStato DESC), @DataOra ) )
|
||||
-- se è oltre 10 gg calcolo in secondi... 2013.8.30
|
||||
IF (DATEDIFF(DD, @DataOraPrec, @DataOra) > 10)
|
||||
BEGIN
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(s, @DataOraPrec, @DataOra) / 60.00 ) ) --calcolo in secondi
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(ms, @DataOraPrec, @DataOra) / 60000.00 ) )
|
||||
END
|
||||
-- versione vecchia (blocco se oltre 24 gg di fermo...)
|
||||
--BEGIN TRY
|
||||
-- /* è in millisecondi, divido per 60'000.00 x avere minuti centesimali*/
|
||||
-- SET @TCMedio = ( SELECT (DATEDIFF(ms, @DataOraPrec, @DataOra) / 60000.00 ) )
|
||||
--END TRY
|
||||
--BEGIN CATCH
|
||||
-- SET @TCMedio = ( SELECT (DATEDIFF(s, @DataOraPrec, @DataOra) / 60.00 ) ) --calcolo in secondi
|
||||
--END CATCH
|
||||
/* inserisco riga di tempo ciclo */
|
||||
INSERT INTO TempiCicloRilevati
|
||||
VALUES(@IdxMacchina, @CodArticolo, @DataOra, @TCMedio, @NumPz)
|
||||
END
|
||||
/******************************************
|
||||
*
|
||||
* calcolo tempo ciclo con logica stop/stop
|
||||
*
|
||||
******************************************/
|
||||
ELSE IF(@TabAzione = 'TempiCicloRilevati' AND @Azione = 'Stop2StopCiclo')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @DataOra = ( SELECT i.InizioStato FROM inserted i )
|
||||
SET @MatricolaKanban = ( SELECT i.MatricolaKanban FROM inserted i )
|
||||
/* prendo la matricola dall'evento inizio (precedente) */
|
||||
SET @MatricolaKanbanOk = ( SELECT ISNULL((SELECT Top 1 MatricolaKanban FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo AND InizioStato < @DataOra ORDER BY InizioStato DESC), @MatricolaKanban ) )
|
||||
|
||||
-- calcolare num pezzi da codice...
|
||||
SET @NumPz = ( SELECT PzPallet FROM Kanban WHERE MatricolaKanban = @MatricolaKanbanOk )
|
||||
SET @CodArticolo = ( SELECT CodArticolo FROM Kanban WHERE MatricolaKanban = @MatricolaKanbanOk )
|
||||
/* calcolo tempo tra eventi "contapezzi" fine - fine NB: idxEvento per fine è idxEvento inizio + 1 ... HARD CODED!!! */
|
||||
SET @DataOraPrec = ( SELECT ISNULL((SELECT Top 1 InizioStato FROM EventList WHERE IdxMacchina = @IdxMacchina AND IdxTipo = @IdxTipo AND InizioStato < @DataOra ORDER BY InizioStato DESC), @DataOra ) )
|
||||
-- se è oltre 10 gg calcolo in secondi... 2013.8.30
|
||||
IF (DATEDIFF(DD, @DataOraPrec, @DataOra) > 10)
|
||||
BEGIN
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(s, @DataOraPrec, @DataOra) / 60.00 ) ) --calcolo in secondi
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
SET @TCMedio = ( SELECT (DATEDIFF(ms, @DataOraPrec, @DataOra) / 60000.00 ) )
|
||||
END
|
||||
-- versione vecchia (blocco se oltre 24 gg di fermo...)
|
||||
--BEGIN TRY
|
||||
-- /* è in millisecondi, divido per 60'000.00 x avere minuti centesimali*/
|
||||
-- SET @TCMedio = ( SELECT (DATEDIFF(ms, @DataOraPrec, @DataOra) / 60000.00 ) )
|
||||
--END TRY
|
||||
--BEGIN CATCH
|
||||
-- SET @TCMedio = ( SELECT (DATEDIFF(s, @DataOraPrec, @DataOra) / 60.00 ) ) --calcolo in secondi
|
||||
--END CATCH
|
||||
/* inserisco riga di tempo ciclo */
|
||||
BEGIN TRY
|
||||
INSERT INTO TempiCicloRilevati
|
||||
VALUES(@IdxMacchina, @CodArticolo, @DataOra, @TCMedio, @NumPz)
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
-- dovrei loggare...
|
||||
END CATCH
|
||||
END
|
||||
/******************************************
|
||||
*
|
||||
* Aggiorno kanban in dati macchine per
|
||||
* INIZIO ATTREZZAGGIO
|
||||
*
|
||||
******************************************/
|
||||
ELSE IF(@TabAzione = 'DatiMacchine' AND @Azione = 'Inizio')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @MatricolaKanban = ( SELECT i.MatricolaKanban FROM inserted i )
|
||||
/* aggiorno riga di dati macchina */
|
||||
UPDATE DatiMacchine
|
||||
SET kanban_A = @MatricolaKanban,
|
||||
kanban_B = @MatricolaKanban
|
||||
WHERE idxMacchina = @IdxMacchina
|
||||
/* aggiorno stato macchina */
|
||||
UPDATE StatoMacchine
|
||||
SET MatricolaKanban = @MatricolaKanban
|
||||
WHERE idxMacchina = @IdxMacchina
|
||||
/* aggiorno dati kanban statoMacchine... */
|
||||
UPDATE StatoMacchine
|
||||
SET KanbanCode = k.KanbanCode, TempoCicloBase = k.TempoCicloBase, PzPalletProd = k.PzPallet
|
||||
FROM Kanban AS k INNER JOIN StatoMacchine ON k.MatricolaKanban = StatoMacchine.MatricolaKanban
|
||||
WHERE (StatoMacchine.idxMacchina = @IdxMacchina)
|
||||
END
|
||||
/******************************************
|
||||
*
|
||||
* Aggiorno kanban in dati macchine per
|
||||
* FINE PRODUZIONE
|
||||
*
|
||||
******************************************/
|
||||
ELSE IF(@TabAzione = 'DatiMacchine' AND @Azione = 'Fine')
|
||||
BEGIN
|
||||
/* calcolo valori */
|
||||
SET @MatricolaKanban = 'KAND' -- kanban non definito !!!HARD CODED!!!
|
||||
/* aggiorno riga di dati macchina */
|
||||
UPDATE DatiMacchine
|
||||
SET kanban_A = @MatricolaKanban,
|
||||
kanban_B = @MatricolaKanban
|
||||
WHERE idxMacchina = @IdxMacchina
|
||||
/* aggiorno stato macchina */
|
||||
UPDATE StatoMacchine
|
||||
SET MatricolaKanban = @MatricolaKanban
|
||||
WHERE idxMacchina = @IdxMacchina
|
||||
/* aggiorno dati kanban statoMacchine... */
|
||||
UPDATE StatoMacchine
|
||||
SET KanbanCode = k.KanbanCode, TempoCicloBase = k.TempoCicloBase, PzPalletProd = k.PzPallet
|
||||
FROM Kanban AS k INNER JOIN StatoMacchine ON k.MatricolaKanban = StatoMacchine.MatricolaKanban
|
||||
WHERE (StatoMacchine.idxMacchina = @IdxMacchina)
|
||||
|
||||
END
|
||||
END
|
||||
*/
|
||||
|
||||
-- INFINE CHIAMO REFRESH TAB STATO...
|
||||
EXEC stp_MSE_refresh @IdxMacchina
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
set xact_abort on;
|
||||
go
|
||||
|
||||
begin transaction;
|
||||
go
|
||||
|
||||
set ANSI_NULLS on;
|
||||
go
|
||||
|
||||
-- ================================================
|
||||
-- Author: Samuele E. Locatelli
|
||||
-- Create date: 2012.11.23
|
||||
--
|
||||
-- Description: rigenerazione del diario di bordo
|
||||
-- a partire da macchina eventi/stati + EventList
|
||||
-- ================================================
|
||||
alter PROCEDURE man.stp_ricalcolaDatiMacchinaFromDate
|
||||
(
|
||||
@idxMacchina NVARCHAR(50),
|
||||
@inizio DATETIME,
|
||||
@idxStatoStart INT = 1
|
||||
)
|
||||
AS
|
||||
|
||||
SET NOCOUNT ON;
|
||||
|
||||
DECLARE @fine DATETIME
|
||||
|
||||
--DBCC SHOWCONTIG(EventList)
|
||||
--DBCC SHOWCONTIG(DiarioDiBordo)
|
||||
|
||||
/* DA USARE ? Verificare */
|
||||
--DECLARE @Database AS SYSNAME;
|
||||
--SET @Database = DB_NAME()
|
||||
--EXEC USP_DisableEnableNonClusteredIndexes @Database ,null, 1 -- disabilito indici
|
||||
|
||||
-- update SAM 2013.10.24: "torno indietro" di 2 eventi rispetto alal data ora indicata come start, SE CI SONO
|
||||
SELECT @inizio = ISNULL(MIN(InizioStato),@inizio) FROM
|
||||
(
|
||||
SELECT TOP 3 InizioStato
|
||||
FROM DiarioDiBordo
|
||||
WHERE IdxMacchina = @idxMacchina AND InizioStato < @inizio
|
||||
ORDER BY InizioStato DESC
|
||||
) AS tbl
|
||||
|
||||
|
||||
-- DISATTIVO inserimento in DiarioDiBordo per la macchina indicata
|
||||
-- DEVE disattivare anche il caricamento degli eventi
|
||||
UPDATE DatiMacchine
|
||||
SET insEnabled = 0
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
|
||||
-- devo sempre rielaborare tutti gli eventi fino a dataora odierna o a ultimo evento in diario di bordo
|
||||
SET @fine = ( SELECT MAX(InizioStato) FROM DiarioDiBordo
|
||||
WHERE idxMacchina = @idxMacchina )
|
||||
|
||||
-- svuoto dati che vado a sostituire
|
||||
PRINT 'svuoto TempiCicloRilevati per periodo indicato...'
|
||||
DELETE FROM TempiCicloRilevati WHERE idxMacchina = @idxMacchina AND DataOraRif BETWEEN @inizio AND @fine
|
||||
|
||||
PRINT 'svuoto DiarioDiBordo per periodo indicato...'
|
||||
EXEC stp_DDB_deleteMacchinaPeriodo @idxMacchina, @inizio, @fine -- cancella diario di bordo
|
||||
|
||||
PRINT 'processo EventList per periodo indicato...'
|
||||
DECLARE @InizioStato DATETIME
|
||||
DECLARE @IdxTipo INT
|
||||
DECLARE @MatricolaKanban NVARCHAR(50)
|
||||
DECLARE @Value NVARCHAR(50)
|
||||
DECLARE @MatrOpr INT
|
||||
DECLARE @pallet NVARCHAR(20)
|
||||
DECLARE @nextIdxStato INT
|
||||
DECLARE @currIdxStato INT
|
||||
DECLARE @IdxFamiglia INT
|
||||
DECLARE @TabAzione NVARCHAR(50) = '';
|
||||
DECLARE @Azione NVARCHAR(50) = '';
|
||||
DECLARE @FlgAggTempiC CHAR(1) = 'N'; -- Y/N = elabora o meno i tempi ciclo
|
||||
|
||||
-- calcolo famiglia macchina!
|
||||
SET @IdxFamiglia = ( SELECT IdxFamiglia FROM Macchine2FamiglieMacchine WHERE idxMacchina = @idxMacchina )
|
||||
|
||||
-- Recupero stato precedente, altrimenti ipotizzo macchina inizialmente in stato richiesto (default: 1 = pronta) e quindi imposto stato current a quello iniziale richiesto...
|
||||
SET @currIdxStato = ISNULL( ( SELECT TOP 1 IdxStato FROM DiarioDiBordo WHERE IdxMacchina = @idxMacchina AND InizioStato < @inizio
|
||||
ORDER BY InizioStato DESC ) , @idxStatoStart)
|
||||
|
||||
-- verifico i record elaborati
|
||||
SELECT COUNT(*)
|
||||
FROM EventList AS e
|
||||
LEFT JOIN dbo.AnagraficaEventi AS a ON e.idxTipo = a.IdxTipo
|
||||
WHERE e.IdxMacchina = @idxMacchina
|
||||
AND e.InizioStato BETWEEN @inizio AND @fine
|
||||
|
||||
-- leggo la tabella degli eventi con cursore x percorrere i dati...
|
||||
DECLARE event2proc CURSOR FOR
|
||||
SELECT e.InizioStato, e.IdxTipo, e.MatricolaKanban, e.Value, e.MatrOpr, e.pallet,
|
||||
a.TabAzione, a.Azione
|
||||
FROM EventList AS e
|
||||
LEFT JOIN dbo.AnagraficaEventi AS a ON e.idxTipo = a.IdxTipo
|
||||
WHERE e.IdxMacchina = @idxMacchina
|
||||
AND e.InizioStato BETWEEN @inizio AND @fine
|
||||
ORDER BY e.InizioStato;
|
||||
/*
|
||||
SELECT InizioStato, IdxTipo, MatricolaKanban, Value, MatrOpr, pallet
|
||||
FROM EventList
|
||||
WHERE IdxMacchina = @idxMacchina
|
||||
AND InizioStato BETWEEN @inizio AND @fine
|
||||
ORDER BY InizioStato;
|
||||
*/
|
||||
OPEN event2proc;
|
||||
|
||||
FETCH NEXT FROM event2proc
|
||||
INTO @InizioStato, @IdxTipo, @MatricolaKanban, @Value, @MatrOpr, @pallet, @TabAzione, @Azione;
|
||||
|
||||
DECLARE @NumPz INT = 1;
|
||||
DECLARE @ContaInsert INT = 0;
|
||||
|
||||
WHILE @@FETCH_STATUS = 0
|
||||
BEGIN
|
||||
|
||||
IF ( ISNULL(@TabAzione,'') <> '' AND ISNULL(@Azione,'') <> '')
|
||||
BEGIN
|
||||
SET @NumPz = CASE WHEN (ISNUMERIC(@Value)=1) THEN @Value ELSE 1 END
|
||||
-- controllo se devo aggiornare i Tempi ciclo in base allo stato macchina ( se null resta precedente )
|
||||
SELECT @FlgAggTempiC = ( CASE Semaforo WHEN 'V' THEN 'Y' ELSE 'N' END ) FROM dbo.AnagraficaStati
|
||||
WHERE IdxStato = @currIdxStato
|
||||
EXEC dbo.stp_EL_processaEvento @IdxTipo, @idxMacchina, @MatricolaKanban, @InizioStato, @NumPz, 'N', @FlgAggTempiC
|
||||
END
|
||||
|
||||
-- calcolo l'eventuale NUOVO idxStato
|
||||
SET @nextIdxStato = ISNULL( (SELECT next_IdxStato FROM TransizioneStati
|
||||
WHERE IdxFamiglia = @IdxFamiglia AND IdxStato = @currIdxStato AND IdxTipo = @IdxTipo ), @currIdxStato )
|
||||
|
||||
-- SE lo stato cambia registro nel DiarioDiBordo!
|
||||
IF (@nextIdxStato <> @currIdxStato)
|
||||
BEGIN
|
||||
-- inserisco in DiarioDiBordo
|
||||
INSERT INTO DiarioDiBordo
|
||||
(IdxMacchina, InizioStato, FineStato, IdxStato, MatricolaKanban, Value, MatrOpr, pallet)
|
||||
VALUES (@IdxMacchina, @InizioStato, NULL, @nextIdxStato, @MatricolaKanban, @Value, @MatrOpr, @pallet)
|
||||
|
||||
-- infine imposto il nuovo stato current...
|
||||
SET @currIdxStato = @nextIdxStato
|
||||
SET @ContaInsert = @ContaInsert + 1
|
||||
END
|
||||
|
||||
-- Get the next values
|
||||
FETCH NEXT FROM event2proc
|
||||
INTO @InizioStato, @IdxTipo, @MatricolaKanban, @Value, @MatrOpr, @pallet, @TabAzione, @Azione;
|
||||
|
||||
END
|
||||
CLOSE event2proc;
|
||||
DEALLOCATE event2proc;
|
||||
|
||||
-- resetto microStato a 1
|
||||
UPDATE dbo.MicroStatoMacchina
|
||||
SET IdxMicroStato = 1,
|
||||
InizioStato = @InizioStato,
|
||||
Value = '0'
|
||||
WHERE IdxMacchina = @idxMacchina
|
||||
|
||||
-- fa un controllo: elimina eventuali dichairazioni in DDB SE durata < 0...
|
||||
DELETE FROM DiarioDiBordo WHERE DurataMinuti < 0 AND IdxMacchina = @idxMacchina
|
||||
|
||||
-- RI-ATTIVO inserimento in DiarioDiBordo per la macchina indicata
|
||||
UPDATE DatiMacchine
|
||||
SET insEnabled = 1
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
|
||||
PRINT 'concluso UPDATE tabelle...' + 'INSERT DiarioBordo : ' + CONVERT(VARCHAR(30),@ContaInsert)
|
||||
|
||||
--DBCC SHOWCONTIG(EventList)
|
||||
--DBCC SHOWCONTIG(DiarioDiBordo)
|
||||
--EXEC USP_DisableEnableNonClusteredIndexes @Database,null, 2 --riattivo indici
|
||||
|
||||
--ricostruisco indici X QUESTE TABELLE DOPPIA RICOSTRUZIONE INDICI NON NECESSARIA
|
||||
--PRINT 'ricostruisco indici...'
|
||||
--DBCC DBREINDEX(EventList)
|
||||
--DBCC DBREINDEX(DiarioDiBordo)
|
||||
--DBCC DBREINDEX(TransizioneIngressi)
|
||||
--DBCC DBREINDEX(Kanban2ins)
|
||||
--DBCC DBREINDEX(Kanban)
|
||||
--DBCC DBREINDEX(AnagraficaOperatori)
|
||||
--DBCC DBREINDEX(AnagraficaOperatori2ins)
|
||||
|
||||
--DBCC SHOWCONTIG(EventList)
|
||||
--DBCC SHOWCONTIG(DiarioDiBordo)
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit;
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(409, GETDATE())
|
||||
GO
|
||||
|
||||
SELECT TOP 10 * FROM LogUpdateDb ORDER BY Versione DESC
|
||||
GO
|
||||
@@ -0,0 +1,44 @@
|
||||
set xact_abort on
|
||||
go
|
||||
|
||||
begin transaction
|
||||
go
|
||||
|
||||
set ANSI_NULLS on
|
||||
go
|
||||
|
||||
/*************************************
|
||||
* STORED PROCEDURE stp_STM_setInsEnabled
|
||||
* imposta stato amcchian x permettere o meno caricamento
|
||||
*
|
||||
* modif.: S.E.L.
|
||||
* il: 2014.01.10
|
||||
**************************************/
|
||||
create PROCEDURE stp_STM_setInsEnabled
|
||||
(
|
||||
@idxMacchina NVARCHAR(50),
|
||||
@insEnabled BIT
|
||||
)
|
||||
AS
|
||||
|
||||
-- ATTIVO/DISATTIVO il caricamento degli eventi
|
||||
UPDATE DatiMacchine
|
||||
SET insEnabled = @insEnabled
|
||||
WHERE IdxMacchina = @IdxMacchina
|
||||
|
||||
RETURN
|
||||
go
|
||||
|
||||
commit
|
||||
go
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- registro versione...
|
||||
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(414, GETDATE())
|
||||
GO
|
||||
|
||||
SELECT TOP 10 * FROM LogUpdateDb ORDER BY Versione DESC
|
||||
GO
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
</configSections>
|
||||
|
||||
<connectionStrings>
|
||||
<add name="MapoDb.Properties.Settings.MoonProConnectionString" connectionString="Data Source=SQL-STEAM\SQL2012;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer" providerName="System.Data.SqlClient"/>
|
||||
</connectionStrings>
|
||||
<!--<connectionStrings>
|
||||
<add name="MapoDb.Properties.Settings.MoonProConnectionString"
|
||||
connectionString="Data Source=localhost\SQLEXPRESS;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer"
|
||||
providerName="System.Data.SqlClient" />
|
||||
</connectionStrings>-->
|
||||
|
||||
<!--<connectionStrings>
|
||||
<add name="MapoDb.Properties.Settings.MoonProConnectionString"
|
||||
connectionString="Data Source=192.168.0.102\SQLEXPRESS;Initial Catalog=MAPO_ColMecc;Persist Security Info=True;User ID=conn_mapo;Password=mapopwd"
|
||||
providerName="System.Data.SqlClient" />
|
||||
</connectionStrings>-->
|
||||
|
||||
|
||||
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
|
||||
@@ -0,0 +1,230 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using SteamWare;
|
||||
using Microsoft.Reporting.WinForms;
|
||||
|
||||
/// <summary>
|
||||
/// Classe che restituisce uno stream ed i dati accessori per reinviare un report in pdf
|
||||
/// </summary>
|
||||
public class reportExporter
|
||||
{
|
||||
/// <summary>
|
||||
/// mimeType del report
|
||||
/// </summary>
|
||||
public string mimeType;
|
||||
/// <summary>
|
||||
/// encoding dei dati
|
||||
/// </summary>
|
||||
public string encoding;
|
||||
/// <summary>
|
||||
/// nome estensione
|
||||
/// </summary>
|
||||
public string fileNameExtension;
|
||||
/// <summary>
|
||||
/// steam di bytes del report
|
||||
/// </summary>
|
||||
public byte[] renderedBytes;
|
||||
/// <summary>
|
||||
/// metodo protected
|
||||
/// </summary>
|
||||
public reportExporter()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// carica i dati richiesti dal report dalla StoredProcedure (filtrando quindi...)
|
||||
/// </summary>
|
||||
/// <param name="tipoReport">report ammessi: RichiestaIntervento</param>
|
||||
/// <param name="idxObj">num int mtz</param>
|
||||
/// <returns>tabella dati</returns>
|
||||
private DataTable caricaDati(reportRichiesto tipoReport, string idxObj)
|
||||
{
|
||||
// calcolo idxODL
|
||||
int idxOdl = 0;
|
||||
try
|
||||
{
|
||||
idxOdl = Convert.ToInt32(idxObj);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
DataTable tab = new DataTable();
|
||||
switch (tipoReport)
|
||||
{
|
||||
case reportRichiesto.SchedaODL:
|
||||
tab = (DataTable)MapoDb.DataLayer.obj.taODL.getByIdx(idxOdl, false);
|
||||
break;
|
||||
//case reportRichiesto.RichiestaIntervento:
|
||||
// tab = (DataTable)TA_app.obj.taInterventiMtz.getByIdx(Convert.ToInt32(idxObj));
|
||||
// break;
|
||||
//default:
|
||||
// break;
|
||||
}
|
||||
return tab;
|
||||
}
|
||||
#if false
|
||||
/// <summary>
|
||||
/// carica i dati richiesti dal report dalla StoredProcedure (filtrando quindi...)
|
||||
/// </summary>
|
||||
/// <param name="tipoReport">report ammessi: ElencoMacchine</param>
|
||||
/// <returns>tabella dati</returns>
|
||||
private DataTable caricaDati(reportRichiesto tipoReport)
|
||||
{
|
||||
DataTable tab = new DataTable();
|
||||
switch (tipoReport)
|
||||
{
|
||||
case reportRichiesto.SchedaODL:
|
||||
tab = (DataTable)TA_app.obj.taElencoImpMacch.GetData();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return tab;
|
||||
}
|
||||
#endif
|
||||
#if false
|
||||
/// <summary>
|
||||
/// carica i dati richiesti dal report dalla StoredProcedure (filtrando quindi...)
|
||||
/// </summary>
|
||||
/// <param name="tipoReport">report ammessi: ElencoInterventi / MTBF_MTTR</param>
|
||||
/// <param name="periodoAnalizzato">oggetto che contiene data inizio e data fine dell'analisi richiesta per il report</param>
|
||||
/// <param name="username">username (per caricare i suoi filtraggi...</param>
|
||||
/// <param name="soloMacchinaFerma">se si devono includere SOLO i dati di macchina ferma</param>
|
||||
/// <param name="includiMtzPrev">se si deve includere anche nel report le fermate di mtz preventiva</param>
|
||||
/// <returns>tabella dati</returns>
|
||||
private DataTable caricaDati(reportRichiesto tipoReport, intervalloDate periodoAnalizzato, string username, bool soloMacchinaFerma, bool includiMtzPrev)
|
||||
{
|
||||
DataTable tab = new DataTable();
|
||||
switch (tipoReport)
|
||||
{
|
||||
case reportRichiesto.ElencoInterventi:
|
||||
// controllo: se include mtz prev e non solo ferma
|
||||
if (!soloMacchinaFerma && includiMtzPrev)
|
||||
{
|
||||
// ...uso metodo std
|
||||
tab = (DataTable)TA_app.obj.taElencoIntFilt.getByIntervDateUsernameFilt(periodoAnalizzato.inizio, periodoAnalizzato.fine, username);
|
||||
}
|
||||
else
|
||||
{
|
||||
// altrimenti stored compelta (e + lenta)
|
||||
tab = (DataTable)TA_app.obj.taElencoIntFilt.getByIntervDateUsernameFilt_fermaPrev(periodoAnalizzato.inizio, periodoAnalizzato.fine, username, soloMacchinaFerma, includiMtzPrev);
|
||||
}
|
||||
break;
|
||||
case reportRichiesto.MTBF_MTTR:
|
||||
// controllo: se include mtz prev e non solo ferma
|
||||
if (!soloMacchinaFerma && includiMtzPrev)
|
||||
{
|
||||
// ...uso metodo std
|
||||
tab = (DataTable)TA_app.obj.taElenco_MTBF_MTTR.GetData(periodoAnalizzato.inizio, periodoAnalizzato.fine, username);
|
||||
}
|
||||
else
|
||||
{
|
||||
// altrimenti stored compelta (e + lenta)
|
||||
tab = (DataTable)TA_app.obj.taElenco_MTBF_MTTR.getByFermaPrev(periodoAnalizzato.inizio, periodoAnalizzato.fine, username, soloMacchinaFerma, includiMtzPrev);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return tab;
|
||||
}
|
||||
#endif
|
||||
#if false
|
||||
/// <summary>
|
||||
/// renderizza il report in pdf
|
||||
/// </summary>
|
||||
/// <param name="tipoReport">report ammessi: ElencoMacchine</param>
|
||||
/// <returns></returns>
|
||||
public void popolaPdfStream(reportRichiesto tipoReport)
|
||||
{
|
||||
LocalReport report = new LocalReport();
|
||||
devInfoParam deviceInfo = new devInfoParam("PDF", "21cm", "29.7cm", "0.2cm", "0.2cm", "0.2cm", "0.2cm");
|
||||
switch (tipoReport)
|
||||
{
|
||||
case reportRichiesto.SchedaODL:
|
||||
report.ReportPath = @".\Reports\Donati_ODL.rdlc";
|
||||
report.DataSources.Add(new ReportDataSource("MoonPro", caricaDati(tipoReport)));
|
||||
deviceInfo = new devInfoParam("PDF", "21cm", "29.7cm", "0.2cm", "0.2cm", "0.2cm", "0.2cm");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
createPdfStream(report, deviceInfo.xmlParam);
|
||||
}
|
||||
#endif
|
||||
/// <summary>
|
||||
/// renderizza il report in pdf
|
||||
/// </summary>
|
||||
/// <param name="tipoReport">report ammessi: RichiestaIntervento</param>
|
||||
/// <param name="parametro">idx della richiesta (numIntMtz)</param>
|
||||
/// <returns></returns>
|
||||
public void popolaPdfStream(reportRichiesto tipoReport, string parametro)
|
||||
{
|
||||
LocalReport report = new LocalReport();
|
||||
devInfoParam deviceInfo = new devInfoParam("PDF", "21cm", "29.7cm", "0.2cm", "0.2cm", "0.2cm", "0.2cm");
|
||||
switch (tipoReport)
|
||||
{
|
||||
case reportRichiesto.SchedaODL:
|
||||
report.ReportPath = @".\Reports\Donati_ODL.rdlc";
|
||||
report.DataSources.Add(new ReportDataSource("MoonPro", caricaDati(tipoReport, parametro))); // OCCHIO!!! va messa sorgente dati CORRETTA
|
||||
deviceInfo = new devInfoParam("PDF", "29.7cm", "21cm", "0.2cm", "0.2cm", "0.2cm", "0.2cm");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
createPdfStream(report, deviceInfo.xmlParam);
|
||||
}
|
||||
#if false
|
||||
/// <summary>
|
||||
/// renderizza il report in pdf
|
||||
/// </summary>
|
||||
/// <param name="tipoReport">report ammessi: ElencoInterventi / MTBF_MTTR</param>
|
||||
/// <param name="periodoAnalizzato">oggetto che contiene data inizio e data fine dell'analisi richiesta per il report</param>
|
||||
/// <param name="username">username (per caricare i suoi filtraggi...</param>
|
||||
/// <param name="soloMacchinaFerma">se si devono includere SOLO i dati di macchina ferma</param>
|
||||
/// <param name="includiMtzPrev">se si deve includere anche nel report le fermate di mtz preventiva</param>
|
||||
public void popolaPdfStream(reportRichiesto tipoReport, intervalloDate periodoAnalizzato, string username, bool soloMacchinaFerma, bool includiMtzPrev)
|
||||
{
|
||||
LocalReport report = new LocalReport();
|
||||
devInfoParam deviceInfo = new devInfoParam("PDF", "21cm", "29.7cm", "0.2cm", "0.2cm", "0.2cm", "0.2cm");
|
||||
switch (tipoReport)
|
||||
{
|
||||
case reportRichiesto.ElencoInterventi:
|
||||
report.ReportPath = @".\Reports\ReportInterventi.rdlc";
|
||||
report.DataSources.Add(new ReportDataSource("WebGim", caricaDati(tipoReport, periodoAnalizzato, username, soloMacchinaFerma, includiMtzPrev)));
|
||||
deviceInfo = new devInfoParam("PDF", "29.7cm", "21cm", "0.2cm", "0.2cm", "0.2cm", "0.2cm");
|
||||
break;
|
||||
case reportRichiesto.MTBF_MTTR:
|
||||
report.ReportPath = @".\Reports\Report_MTBF_MTTR.rdlc";
|
||||
report.DataSources.Add(new ReportDataSource("WebGim", caricaDati(tipoReport, periodoAnalizzato, username, soloMacchinaFerma, includiMtzPrev)));
|
||||
deviceInfo = new devInfoParam("PDF", "29.7cm", "21cm", "0.2cm", "0.2cm", "0.2cm", "0.2cm");
|
||||
// calcolo le ore totali equivalenti...
|
||||
ReportParameter[] OreTotali = { new ReportParameter("OreTotali", WebGimUtils.obj.oreEquivalenti(periodoAnalizzato).ToString()) };
|
||||
report.SetParameters(OreTotali);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
createPdfStream(report, deviceInfo.xmlParam);
|
||||
}
|
||||
#endif
|
||||
/// <summary>
|
||||
/// crea il vero e proprio stream pdf
|
||||
/// </summary>
|
||||
/// <param name="report"></param>
|
||||
/// <param name="deviceInfo"></param>
|
||||
private void createPdfStream(LocalReport report, string deviceInfo)
|
||||
{
|
||||
// export in PDF
|
||||
string reportType = "PDF";
|
||||
Warning[] warnings;
|
||||
string[] streams;
|
||||
renderedBytes = report.Render(
|
||||
reportType,
|
||||
deviceInfo,
|
||||
out mimeType,
|
||||
out encoding,
|
||||
out fileNameExtension,
|
||||
out streams,
|
||||
out warnings);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing.Printing;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using SteamWare;
|
||||
using Microsoft.Reporting.WinForms;
|
||||
|
||||
/// <summary>
|
||||
/// Classe che si occupa di stampare report da reportViewer via printer remota
|
||||
/// </summary>
|
||||
public class reportPrinter
|
||||
{
|
||||
|
||||
#region area codice da non modificare
|
||||
|
||||
private int m_currentPageIndex;
|
||||
private IList<Stream> m_streams;
|
||||
/// <summary>
|
||||
/// ciclo da fornire al renderizzatore dei report, per salvare 1 immagine da ogni pagina del report
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="fileNameExtension"></param>
|
||||
/// <param name="encoding"></param>
|
||||
/// <param name="mimeType"></param>
|
||||
/// <param name="willSeek"></param>
|
||||
/// <returns></returns>
|
||||
private Stream CreateStream(string name, string fileNameExtension, Encoding encoding, string mimeType, bool willSeek)
|
||||
{
|
||||
Stream stream = new FileStream(SteamWare.SteamwareStrings.getFilePath(@".\temp\" + name + "." + fileNameExtension), FileMode.Create);
|
||||
m_streams.Add(stream);
|
||||
return stream;
|
||||
}
|
||||
/// <summary>
|
||||
/// Handler per PrintPageEvents
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="ev"></param>
|
||||
private void PrintPage(object sender, PrintPageEventArgs ev)
|
||||
{
|
||||
Metafile pageImage = new Metafile(m_streams[m_currentPageIndex]);
|
||||
ev.Graphics.DrawImage(pageImage, ev.PageBounds);
|
||||
m_currentPageIndex++;
|
||||
ev.HasMorePages = (m_currentPageIndex < m_streams.Count);
|
||||
}
|
||||
/// <summary>
|
||||
/// funzione di stampa...
|
||||
/// </summary>
|
||||
private void Print(string printerName)
|
||||
{
|
||||
//const string printerName = "Microsoft Office Document Image Writer";
|
||||
//const string printerName = "Brother HL-2170W series";
|
||||
if (m_streams == null || m_streams.Count == 0)
|
||||
return;
|
||||
PrintDocument printDoc = new PrintDocument();
|
||||
printDoc.PrinterSettings.PrinterName = printerName;
|
||||
if (!printDoc.PrinterSettings.IsValid)
|
||||
{
|
||||
logger.lg.scriviLog(String.Format("Can't find printer \"{0}\".", printerName), tipoLog.ERROR);
|
||||
return;
|
||||
}
|
||||
printDoc.PrintPage += new PrintPageEventHandler(PrintPage);
|
||||
printDoc.Print();
|
||||
}
|
||||
/// <summary>
|
||||
/// Export del report come EMF (Enhanced Metafile) file.
|
||||
/// </summary>
|
||||
/// <param name="report"></param>
|
||||
private void Export(LocalReport report, string deviceInfo)
|
||||
{
|
||||
Warning[] warnings;
|
||||
m_streams = new List<Stream>();
|
||||
report.Render("Image", deviceInfo, CreateStream, out warnings);
|
||||
foreach (Stream stream in m_streams) stream.Position = 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// dispone l'applicazione e rilascia le risorse
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (m_streams != null)
|
||||
{
|
||||
foreach (Stream stream in m_streams)
|
||||
stream.Close();
|
||||
m_streams = null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region area codice da modificare
|
||||
|
||||
/// <summary>
|
||||
/// carica i dati richiesti dal report dalla StoredProcedure (filtrando quindi...)
|
||||
/// </summary>
|
||||
/// <param name="tipoReport">report ammessi: ElencoMacchine / RichiestaIntervento</param>
|
||||
/// <param name="periodoAnalizzato">oggetto che contiene data inizio e data fine dell'analisi richiesta per il report</param>
|
||||
/// <returns>tabella dati</returns>
|
||||
private DataTable caricaDati(reportRichiesto tipoReport, string idxObj)
|
||||
{
|
||||
// calcolo idxODL
|
||||
int idxOdl = 0;
|
||||
try
|
||||
{
|
||||
idxOdl = Convert.ToInt32(idxObj);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
DataTable tab = new DataTable();
|
||||
switch (tipoReport)
|
||||
{
|
||||
case reportRichiesto.SchedaODL:
|
||||
tab = (DataTable)MapoDb.DataLayer.obj.taODL.getByIdx(idxOdl, false);
|
||||
break;
|
||||
//case reportRichiesto.RichiestaIntervento:
|
||||
// tab = (DataTable)TA_app.obj.taInterventiMtz.getByIdx(Convert.ToInt32(idxObj));
|
||||
// break;
|
||||
//default:
|
||||
// break;
|
||||
}
|
||||
return tab;
|
||||
}
|
||||
#if false
|
||||
/// <summary>
|
||||
/// carica i dati richiesti dal report dalla StoredProcedure (filtrando quindi...)
|
||||
/// </summary>
|
||||
/// <param name="tipoReport">report ammessi: ElencoInterventi / MTBF_MTTR</param>
|
||||
/// <param name="periodoAnalizzato">oggetto che contiene data inizio e data fine dell'analisi richiesta per il report</param>
|
||||
/// <returns>tabella dati</returns>
|
||||
private DataTable caricaDati(reportRichiesto tipoReport, intervalloDate periodoAnalizzato, string username)
|
||||
{
|
||||
DataTable tab = new DataTable();
|
||||
switch (tipoReport)
|
||||
{
|
||||
case reportRichiesto.ElencoInterventi:
|
||||
tab = (DataTable)TA_app.obj.taElencoIntFilt.getByIntervDateUsernameFilt(periodoAnalizzato.inizio, periodoAnalizzato.fine, username);
|
||||
break;
|
||||
case reportRichiesto.MTBF_MTTR:
|
||||
tab = (DataTable)TA_app.obj.taElenco_MTBF_MTTR.GetData(periodoAnalizzato.inizio, periodoAnalizzato.fine, username);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return tab;
|
||||
}
|
||||
#endif
|
||||
/// <summary>
|
||||
/// Crea un report locale da file rdlc, carica i dati, esporta report come EMF file e quindi lo invia alla stampante
|
||||
/// </summary>
|
||||
/// <param name="tipoReport">report ammessi: ElencoMacchine / RichiestaIntervento</param>
|
||||
/// <param name="printerName">nome completo stampante (rispetto al server)</param>
|
||||
/// <param name="parametro">numIntMtz (codice numero richiesta)</param>
|
||||
public void printReport(reportRichiesto tipoReport, string printerName, string parametro)
|
||||
{
|
||||
LocalReport report = new LocalReport();
|
||||
devInfoParam deviceInfo = new devInfoParam("EMF", "21cm", "29.7cm", "0.2cm", "0.2cm", "0.2cm", "0.2cm");
|
||||
switch (tipoReport)
|
||||
{
|
||||
case reportRichiesto.SchedaODL:
|
||||
report.ReportPath = @".\Reports\Donati_ODL.rdlc";
|
||||
report.DataSources.Add(new ReportDataSource("MoonPro", caricaDati(tipoReport, parametro)));
|
||||
deviceInfo = new devInfoParam("EMF", "21cm", "29.7cm", "0.2cm", "0.2cm", "0.2cm", "0.2cm");
|
||||
break;
|
||||
//case reportRichiesto.RichiestaIntervento:
|
||||
// report.ReportPath = @".\Reports\RichiestaIntervento.rdlc";
|
||||
// report.DataSources.Add(new ReportDataSource("WebGim", caricaDati(tipoReport, parametro)));
|
||||
// deviceInfo = new devInfoParam("EMF", "29.7cm", "21cm", "0.2cm", "0.2cm", "0.2cm", "0.2cm");
|
||||
// break;
|
||||
//default:
|
||||
// break;
|
||||
}
|
||||
doEmfPrint(printerName, report, deviceInfo.xmlParam);
|
||||
}
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Crea un report locale da file rdlc, carica i dati, esporta report come EMF file e quindi lo invia alla stampante
|
||||
/// </summary>
|
||||
/// <param name="tipoReport">report ammessi: ElencoInterventi / MTBF_MTTR</param>
|
||||
/// <param name="printerName">nome completo stampante (rispetto al server)</param>
|
||||
/// <param name="periodoAnalizzato">oggetto che contiene data inizio e data fine dell'analisi richiesta per il report</param>
|
||||
public void printReport(reportRichiesto tipoReport, string printerName, intervalloDate periodoAnalizzato, string username)
|
||||
{
|
||||
LocalReport report = new LocalReport();
|
||||
devInfoParam deviceInfo = new devInfoParam("EMF", "21cm", "29.7cm", "0.2cm", "0.2cm", "0.2cm", "0.2cm");
|
||||
switch (tipoReport)
|
||||
{
|
||||
case reportRichiesto.ElencoInterventi:
|
||||
report.ReportPath = @".\Reports\ReportInterventi.rdlc";
|
||||
report.DataSources.Add(new ReportDataSource("WebGim", caricaDati(tipoReport, periodoAnalizzato, username)));
|
||||
deviceInfo = new devInfoParam("EMF", "29.7cm", "21cm", "0.2cm", "0.2cm", "0.2cm", "0.2cm");
|
||||
break;
|
||||
case reportRichiesto.MTBF_MTTR:
|
||||
report.ReportPath = @".\Reports\Report_MTBF_MTTR.rdlc";
|
||||
report.DataSources.Add(new ReportDataSource("WebGim", caricaDati(tipoReport, periodoAnalizzato, username)));
|
||||
deviceInfo = new devInfoParam("EMF", "29.7cm", "21cm", "0.2cm", "0.2cm", "0.2cm", "0.2cm");
|
||||
// calcolo le ore totali equivalenti...
|
||||
ReportParameter[] OreTotali = { new ReportParameter("OreTotali", WebGimUtils.obj.oreEquivalenti(periodoAnalizzato).ToString()) };
|
||||
report.SetParameters(OreTotali);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
doEmfPrint(printerName, report, deviceInfo.xmlParam);
|
||||
}
|
||||
#endif
|
||||
/// <summary>
|
||||
/// esegue print vero e proprio
|
||||
/// </summary>
|
||||
/// <param name="printerName"></param>
|
||||
/// <param name="report"></param>
|
||||
/// <param name="deviceInfo"></param>
|
||||
private void doEmfPrint(string printerName, LocalReport report, string deviceInfo)
|
||||
{
|
||||
// export in EMF
|
||||
Export(report, deviceInfo);
|
||||
m_currentPageIndex = 0;
|
||||
// stampo
|
||||
Print(printerName);
|
||||
// do dispose?
|
||||
Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// oggetto protected
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
protected reportPrinter()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// singleton pubblico
|
||||
/// </summary>
|
||||
public static reportPrinter obj = new reportPrinter();
|
||||
|
||||
#endregion
|
||||
}
|
||||
/// <summary>
|
||||
/// tipologia di report ammessi alla stampa...
|
||||
/// </summary>
|
||||
public enum reportRichiesto
|
||||
{
|
||||
SchedaODL
|
||||
}
|
||||
@@ -0,0 +1,545 @@
|
||||
using System;
|
||||
using SteamWare;
|
||||
|
||||
/// <summary>
|
||||
/// Summary description for resoconti
|
||||
/// </summary>
|
||||
public enum statoMacchina
|
||||
{
|
||||
Run = 1,
|
||||
Setup,
|
||||
Guasto,
|
||||
Campionatura,
|
||||
Disposizione,
|
||||
Varie
|
||||
}
|
||||
/// <summary>
|
||||
/// oggetto dati per grafico sequencer
|
||||
/// </summary>
|
||||
public struct objSequencer
|
||||
{
|
||||
public intervalloDate intervallo;
|
||||
/// <summary>
|
||||
/// serie dei dati da plottare
|
||||
/// </summary>
|
||||
public DataLayer_generic.serieDatiDataTable serieDati;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// oggetto dati per grafico TempiCiclo
|
||||
/// </summary>
|
||||
public struct objTempiCiclo
|
||||
{
|
||||
public intervalloDate intervallo;
|
||||
public decimal minVal;
|
||||
public decimal maxVal;
|
||||
public decimal targetVal;
|
||||
public bool palletChange;
|
||||
/// <summary>
|
||||
/// serie dei dati da plottare
|
||||
/// </summary>
|
||||
public DataLayer_generic.serieTimeValDataTable serieDati;
|
||||
}
|
||||
//public struct intervallo
|
||||
//{
|
||||
// public DateTime inizio;
|
||||
// public DateTime fine;
|
||||
//}
|
||||
public class resoconti
|
||||
{
|
||||
#region area protected
|
||||
|
||||
protected MapoDb.DS_applicazioneTableAdapters.MacchineTableAdapter taMacchine;
|
||||
protected MapoDb.DS_ProdTempiTableAdapters.TempiCicloRilevatiTableAdapter taTempiCiclo;
|
||||
protected MapoDb.DS_applicazione.MacchineDataTable _Macchine;
|
||||
protected MapoDb.DS_applicazione.MacchineDataTable Macchine
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!memLayer.ML.isInCacheObject("Macchine"))
|
||||
//if (HttpContext.Current.Cache["Macchine"] == null)
|
||||
{
|
||||
_Macchine = taMacchine.GetData();
|
||||
SteamWare.memLayer.ML.setCacheVal("Macchine", _Macchine, true);
|
||||
//HttpContext.Current.Cache["Macchine"] = _Macchine;
|
||||
}
|
||||
else
|
||||
{
|
||||
_Macchine = (MapoDb.DS_applicazione.MacchineDataTable)SteamWare.memLayer.ML.objCacheObj("Macchine");
|
||||
//_Macchine = (MapoDb.DS_applicazione.MacchineDataTable)HttpContext.Current.Cache["Macchine"];
|
||||
}
|
||||
return _Macchine;
|
||||
}
|
||||
}
|
||||
protected MapoDb.DS_applicazioneTableAdapters.StatoMacchineTableAdapter taStatoMacchine;
|
||||
protected MapoDb.DS_applicazione.StatoMacchineDataTable _StatoMacchine;
|
||||
protected MapoDb.DS_applicazione.StatoMacchineDataTable StatoMacchine
|
||||
{
|
||||
get
|
||||
{
|
||||
//if (_StatoMacchine == null)
|
||||
//{
|
||||
// _StatoMacchine = taStatoMacchine.GetData();
|
||||
//}
|
||||
if (!memLayer.ML.isInCacheObject("StatoMacchine"))
|
||||
{
|
||||
_StatoMacchine = taStatoMacchine.GetData();
|
||||
SteamWare.memLayer.ML.setCacheVal("StatoMacchine", _StatoMacchine, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_StatoMacchine = (MapoDb.DS_applicazione.StatoMacchineDataTable)SteamWare.memLayer.ML.objCacheObj("StatoMacchine");
|
||||
}
|
||||
return _StatoMacchine;
|
||||
}
|
||||
}
|
||||
protected MapoDb.DS_applicazioneTableAdapters.AnagraficaStatiTableAdapter taStati;
|
||||
protected MapoDb.DS_applicazione.AnagraficaStatiDataTable _Stati;
|
||||
protected MapoDb.DS_applicazione.AnagraficaStatiDataTable Stati
|
||||
{
|
||||
get
|
||||
{
|
||||
//if (HttpContext.Current.Cache["Stati"] == null)
|
||||
if (!memLayer.ML.isInCacheObject("Stati"))
|
||||
{
|
||||
_Stati = taStati.GetData();
|
||||
SteamWare.memLayer.ML.setCacheVal("Stati", _Stati, true);
|
||||
//HttpContext.Current.Cache["Stati"] = _Stati;
|
||||
}
|
||||
else
|
||||
{
|
||||
_Stati = (MapoDb.DS_applicazione.AnagraficaStatiDataTable)SteamWare.memLayer.ML.objCacheObj("Stati");
|
||||
//_Stati = (MapoDb.DS_applicazione.AnagraficaStatiDataTable)HttpContext.Current.Cache["Stati"];
|
||||
}
|
||||
return _Stati;
|
||||
}
|
||||
}
|
||||
protected MapoDb.DS_applicazioneTableAdapters.DiarioDiBordoTableAdapter taDiarioDiBordo;
|
||||
protected MapoDb.DS_applicazione.DiarioDiBordoDataTable _DiarioDiBordo;
|
||||
protected MapoDb.DS_applicazione.DiarioDiBordoDataTable DiarioDiBordo
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_DiarioDiBordo == null)
|
||||
{
|
||||
_DiarioDiBordo = taDiarioDiBordo.GetData();
|
||||
}
|
||||
return _DiarioDiBordo;
|
||||
}
|
||||
}
|
||||
protected MapoDb.DS_applicazioneTableAdapters.ParetoDurateTableAdapter taParetoDurate;
|
||||
#if false
|
||||
protected MapoDb.DS_applicazione.ParetoDurateDataTable _ParetoDurate;
|
||||
protected MapoDb.DS_applicazione.ParetoDurateDataTable ParetoDurate
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ParetoDurate == null)
|
||||
{
|
||||
// set vuoto...
|
||||
_ParetoDurate = taParetoDurate.GetParetoDurateFilt("", 100, DateTime.Now, DateTime.Now);
|
||||
}
|
||||
return _ParetoDurate;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
protected MapoDb.DS_applicazioneTableAdapters.AnagraficaEventiTableAdapter taAnagraficaEventi;
|
||||
protected MapoDb.DS_applicazione.AnagraficaEventiDataTable _AnagraficaEventi;
|
||||
protected MapoDb.DS_applicazione.AnagraficaEventiDataTable AnagraficaEventi
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!memLayer.ML.isInCacheObject("AnagraficaEventi"))
|
||||
//if (HttpContext.Current.Cache["AnagraficaEventi"] == null)
|
||||
{
|
||||
_AnagraficaEventi = taAnagraficaEventi.GetData();
|
||||
SteamWare.memLayer.ML.setCacheVal("AnagraficaEventi", _AnagraficaEventi, true);
|
||||
//HttpContext.Current.Cache["AnagraficaEventi"] = _AnagraficaEventi;
|
||||
}
|
||||
else
|
||||
{
|
||||
_AnagraficaEventi = (MapoDb.DS_applicazione.AnagraficaEventiDataTable)SteamWare.memLayer.ML.objCacheObj("AnagraficaEventi");
|
||||
//_AnagraficaEventi = (MapoDb.DS_applicazione.AnagraficaEventiDataTable)HttpContext.Current.Cache["AnagraficaEventi"];
|
||||
}
|
||||
return _AnagraficaEventi;
|
||||
}
|
||||
}
|
||||
protected MapoDb.DS_applicazioneTableAdapters.KanbanTableAdapter taKanban;
|
||||
protected MapoDb.DS_applicazione.KanbanDataTable _Kanban;
|
||||
protected MapoDb.DS_applicazione.KanbanDataTable Kanban
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!memLayer.ML.isInCacheObject("Kanban"))
|
||||
//if (HttpContext.Current.Cache["Kanban"] == null)
|
||||
{
|
||||
_Kanban = taKanban.GetData();
|
||||
SteamWare.memLayer.ML.setCacheVal("Kanban", _Kanban, true);
|
||||
//HttpContext.Current.Cache["Kanban"] = _Kanban;
|
||||
}
|
||||
else
|
||||
{
|
||||
_Kanban = (MapoDb.DS_applicazione.KanbanDataTable)SteamWare.memLayer.ML.objCacheObj("Kanban");
|
||||
//_Kanban = (MapoDb.DS_applicazione.KanbanDataTable)HttpContext.Current.Cache["Kanban"];
|
||||
}
|
||||
return _Kanban;
|
||||
}
|
||||
}
|
||||
protected MapoDb.DS_applicazioneTableAdapters.AnagraficaOperatoriTableAdapter taAnagOpr;
|
||||
protected MapoDb.DS_applicazione.AnagraficaOperatoriDataTable _AnagOpr;
|
||||
protected MapoDb.DS_applicazione.AnagraficaOperatoriDataTable AnagOpr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!memLayer.ML.isInCacheObject("AnagOpr"))
|
||||
//if (HttpContext.Current.Cache["AnagOpr"] == null)
|
||||
{
|
||||
_AnagOpr = taAnagOpr.GetData();
|
||||
SteamWare.memLayer.ML.setCacheVal("AnagOpr", _AnagOpr, true);
|
||||
//HttpContext.Current.Cache["AnagOpr"] = _AnagOpr;
|
||||
}
|
||||
else
|
||||
{
|
||||
_AnagOpr = (MapoDb.DS_applicazione.AnagraficaOperatoriDataTable)SteamWare.memLayer.ML.objCacheObj("AnagOpr");
|
||||
//_AnagOpr = (MapoDb.DS_applicazione.AnagraficaOperatoriDataTable)HttpContext.Current.Cache["AnagOpr"];
|
||||
}
|
||||
return _AnagOpr;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region area public
|
||||
|
||||
public resoconti()
|
||||
{
|
||||
AvviaTabAdapt();
|
||||
setConnString();
|
||||
}
|
||||
/// <summary>
|
||||
/// singleton accesso resoconti
|
||||
/// </summary>
|
||||
public static resoconti mngr = new resoconti();
|
||||
|
||||
/// <summary>
|
||||
/// avvio i table adapter della classe
|
||||
/// </summary>
|
||||
private void AvviaTabAdapt()
|
||||
{
|
||||
taMacchine = new MapoDb.DS_applicazioneTableAdapters.MacchineTableAdapter();
|
||||
taStatoMacchine = new MapoDb.DS_applicazioneTableAdapters.StatoMacchineTableAdapter();
|
||||
taStati = new MapoDb.DS_applicazioneTableAdapters.AnagraficaStatiTableAdapter();
|
||||
taDiarioDiBordo = new MapoDb.DS_applicazioneTableAdapters.DiarioDiBordoTableAdapter();
|
||||
taParetoDurate = new MapoDb.DS_applicazioneTableAdapters.ParetoDurateTableAdapter();
|
||||
taAnagraficaEventi = new MapoDb.DS_applicazioneTableAdapters.AnagraficaEventiTableAdapter();
|
||||
taKanban = new MapoDb.DS_applicazioneTableAdapters.KanbanTableAdapter();
|
||||
taAnagOpr = new MapoDb.DS_applicazioneTableAdapters.AnagraficaOperatoriTableAdapter();
|
||||
taTempiCiclo = new MapoDb.DS_ProdTempiTableAdapters.TempiCicloRilevatiTableAdapter();
|
||||
}
|
||||
/// <summary>
|
||||
/// forza la connString x i vari table adapters
|
||||
/// </summary>
|
||||
private void setConnString()
|
||||
{
|
||||
string _connectionString = SteamWare.memLayer.ML.confReadString("MoonProConnectionString");
|
||||
taMacchine.Connection.ConnectionString = _connectionString;
|
||||
taStatoMacchine.Connection.ConnectionString = _connectionString;
|
||||
taStati.Connection.ConnectionString = _connectionString;
|
||||
taDiarioDiBordo.Connection.ConnectionString = _connectionString;
|
||||
taParetoDurate.Connection.ConnectionString = _connectionString;
|
||||
taAnagraficaEventi.Connection.ConnectionString = _connectionString;
|
||||
taKanban.Connection.ConnectionString = _connectionString;
|
||||
taAnagOpr.Connection.ConnectionString = _connectionString;
|
||||
taTempiCiclo.Connection.ConnectionString = _connectionString;
|
||||
}
|
||||
|
||||
public string locazioneDaIdx(string idx)
|
||||
{
|
||||
MapoDb.DS_applicazione.MacchineRow riga = Macchine.FindByIdxMacchina(idx);
|
||||
return string.Format("{0}", riga.locazione);
|
||||
}
|
||||
public string idxDaLocazione(string locazione)
|
||||
{
|
||||
MapoDb.DS_applicazione.MacchineRow riga = (MapoDb.DS_applicazione.MacchineRow)Macchine.Select(string.Format("locazione = '{0}'", locazione))[0];
|
||||
return string.Format("{0}", riga.IdxMacchina);
|
||||
}
|
||||
public string nomeMacchina(string idx)
|
||||
{
|
||||
string answ = "";
|
||||
MapoDb.DS_applicazione.MacchineRow riga = Macchine.FindByIdxMacchina(idx);
|
||||
try
|
||||
{
|
||||
answ = string.Format("{0} ({1} - {2})", riga.Nome, riga.CodMacchina, riga.Descrizione);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
public string macchinaDaIdx(string idx)
|
||||
{
|
||||
MapoDb.DS_applicazione.MacchineRow riga = Macchine.FindByIdxMacchina(idx);
|
||||
return string.Format("{0}", riga.CodMacchina);
|
||||
}
|
||||
public string urlMacchina(string idx)
|
||||
{
|
||||
MapoDb.DS_applicazione.MacchineRow riga = Macchine.FindByIdxMacchina(idx);
|
||||
return string.Format("{0}", riga.url);
|
||||
}
|
||||
/// <summary>
|
||||
/// fornisce idxStato della macchina indicata
|
||||
/// </summary>
|
||||
/// <param name="idx"></param>
|
||||
/// <returns></returns>
|
||||
public int statoMacchina(string idx)
|
||||
{
|
||||
int answ = 0;
|
||||
try
|
||||
{
|
||||
MapoDb.DS_ProdTempi.stp_repDonati_getLastStatoDurataMacchinaRow riga = (MapoDb.DS_ProdTempi.stp_repDonati_getLastStatoDurataMacchinaRow)(MapoDb.DataLayer.obj.taDatiStatoMacch.GetData(idx, 0)[0]);
|
||||
answ = riga.idxStato;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// fornisce descrizione stato da IdxStato
|
||||
/// </summary>
|
||||
/// <param name="idx"></param>
|
||||
/// <returns></returns>
|
||||
public string statoDaIdx(int idx)
|
||||
{
|
||||
return Stati.FindByIdxStato(idx).Descrizione;
|
||||
}
|
||||
/// <summary>
|
||||
/// fornisce cod operatore data matricola
|
||||
/// </summary>
|
||||
/// <param name="matr"></param>
|
||||
/// <returns></returns>
|
||||
public string oprDaMatr(int matr)
|
||||
{
|
||||
string answ = "nd";
|
||||
try
|
||||
{
|
||||
MapoDb.DS_applicazione.AnagraficaOperatoriRow riga = AnagOpr.FindByMatrOpr(matr);
|
||||
answ = string.Format("{0} {1}", riga.Cognome, riga.Nome);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Restituisce colore da IdxStato
|
||||
/// </summary>
|
||||
/// <param name="idx"></param>
|
||||
/// <returns></returns>
|
||||
public string coloreDaIdx(int idx)
|
||||
{
|
||||
string _answ = "";
|
||||
switch (Stati.FindByIdxStato(idx).Semaforo)
|
||||
{
|
||||
case "G": // giallo
|
||||
_answ = "#ffec00";
|
||||
break;
|
||||
case "R": // rosso
|
||||
_answ = "#e2001a";
|
||||
break;
|
||||
case "S": // grigio - spenta
|
||||
_answ = "#bcbcbc";
|
||||
break;
|
||||
case "V": // verde
|
||||
_answ = "#009036";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return _answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// restituisce cod semaforo dato IdxStato
|
||||
/// </summary>
|
||||
/// <param name="idx"></param>
|
||||
/// <returns></returns>
|
||||
public string semaforoDaIdxStato(int idx)
|
||||
{
|
||||
return Stati.FindByIdxStato(idx).Semaforo;
|
||||
}
|
||||
/// <summary>
|
||||
/// restituisce cod CSS dato IdxStato
|
||||
/// </summary>
|
||||
/// <param name="idx"></param>
|
||||
/// <returns></returns>
|
||||
public string cssDaCodColore(string codColore)
|
||||
{
|
||||
string cssClass = "";
|
||||
switch (codColore)
|
||||
{
|
||||
case "V":
|
||||
cssClass = "semaforoVerde";
|
||||
break;
|
||||
case "G":
|
||||
cssClass = "semaforoGiallo";
|
||||
break;
|
||||
case "R":
|
||||
cssClass = "semaforoRosso";
|
||||
break;
|
||||
case "S":
|
||||
cssClass = "semaforoSpento";
|
||||
break;
|
||||
default:
|
||||
cssClass = "semaforoSpento";
|
||||
break;
|
||||
}
|
||||
return cssClass;
|
||||
}
|
||||
/// <summary>
|
||||
/// fornisce una torta stati
|
||||
/// </summary>
|
||||
/// <param name="idx"></param>
|
||||
/// <param name="_intervallo"></param>
|
||||
/// <param name="minDurata"></param>
|
||||
/// <param name="hideSpenta"></param>
|
||||
/// <returns></returns>
|
||||
public DataLayer_generic.serieDatiDataTable tortaStati(string idx, intervalloDate _intervallo, int minDurata, bool hideSpenta)
|
||||
{
|
||||
// leggo i dati e costituisco una collezione...
|
||||
DataLayer_generic.serieDatiDataTable punti = new DataLayer_generic.serieDatiDataTable();
|
||||
// seleziono i dati...
|
||||
MapoDb.DS_applicazione.ParetoDurateDataTable tabPareto;
|
||||
if (hideSpenta)
|
||||
{
|
||||
tabPareto = taParetoDurate.GetParetoDurateHideSpenta(idx, minDurata, _intervallo.fine, _intervallo.inizio);
|
||||
}
|
||||
else
|
||||
{
|
||||
tabPareto = taParetoDurate.GetParetoDurateFilt(idx, minDurata, _intervallo.fine, _intervallo.inizio);
|
||||
}
|
||||
double totale = 1;
|
||||
try
|
||||
{
|
||||
totale = (double)tabPareto.Compute("SUM(DurataMinuti)", "");
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
foreach (MapoDb.DS_applicazione.ParetoDurateRow riga in tabPareto.Rows)
|
||||
{
|
||||
punti.AddserieDatiRow((float)((Math.Round(((float)riga.DurataMinuti) / totale * 1000)) / 1000), coloreDaIdx(riga.IdxStato), statoDaIdx(riga.IdxStato), riga.InizioStato);
|
||||
}
|
||||
return punti;
|
||||
}
|
||||
/// <summary>
|
||||
/// tipo evento da Idx
|
||||
/// </summary>
|
||||
/// <param name="idx"></param>
|
||||
/// <returns></returns>
|
||||
public string tipoDaIdx(int idx)
|
||||
{
|
||||
return AnagraficaEventi.FindByIdxTipo(idx).Nome;
|
||||
}
|
||||
/// <summary>
|
||||
/// Kanban da Idx
|
||||
/// </summary>
|
||||
/// <param name="idx"></param>
|
||||
/// <returns></returns>
|
||||
public MapoDb.DS_applicazione.KanbanRow kanbanDaIdx(string idx)
|
||||
{
|
||||
return Kanban.FindByMatricolaKanban(idx);
|
||||
}
|
||||
/// <summary>
|
||||
/// oggetto sequenza dati x sequencer
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina">IdxMacchina</param>
|
||||
/// <param name="_intervallo"></param>
|
||||
/// <returns></returns>
|
||||
public objSequencer sequenzaDati(string idxMacchina, intervalloDate _intervallo)
|
||||
{
|
||||
// leggo i dati e costituisco una collezione...
|
||||
objSequencer _sequenza = new objSequencer();
|
||||
_sequenza.serieDati = new DataLayer_generic.serieDatiDataTable();
|
||||
// seleziono i dati...
|
||||
MapoDb.DS_applicazione.DiarioDiBordoDataTable tabSeq = taDiarioDiBordo.GetSequenza(idxMacchina, _intervallo.inizio, _intervallo.fine);
|
||||
foreach (MapoDb.DS_applicazione.DiarioDiBordoRow riga in tabSeq.Rows)
|
||||
{
|
||||
_sequenza.serieDati.AddserieDatiRow(riga.DurataMinuti, semaforoDaIdxStato(riga.IdxStato), string.Format("{0} {1}", riga.KanbanCode, riga.MatricolaKanban), riga.InizioStato);
|
||||
}
|
||||
// faccio trim x primo evento...
|
||||
if (_sequenza.serieDati[0].timeData < _intervallo.inizio)
|
||||
{
|
||||
_sequenza.serieDati[0].valore -= _intervallo.inizio.Subtract(_sequenza.serieDati[0].timeData).TotalMinutes;
|
||||
_sequenza.serieDati[0].timeData = _intervallo.inizio;
|
||||
}
|
||||
//...e ultimo evento...
|
||||
int numValori = _sequenza.serieDati.Count - 1;
|
||||
_sequenza.serieDati[numValori].valore = _intervallo.fine.Subtract(_sequenza.serieDati[numValori].timeData).TotalMinutes;
|
||||
// salvo intervallo
|
||||
_sequenza.intervallo = _intervallo;
|
||||
return _sequenza;
|
||||
}
|
||||
/// <summary>
|
||||
/// oggetto sequenza tempi ciclo x visualizzatore
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="_intervallo"></param>
|
||||
/// <param name="targetVal">tempo target di riferimento (se zero calcola la media...)</param>
|
||||
/// <returns></returns>
|
||||
public objTempiCiclo tempiCiclo(string idxMacchina, intervalloDate _intervallo, decimal targetVal)
|
||||
{
|
||||
// inizializzo
|
||||
objTempiCiclo _serie = new objTempiCiclo();
|
||||
_serie.serieDati = new DataLayer_generic.serieTimeValDataTable();
|
||||
// seleziono i dati
|
||||
if (targetVal > 0)
|
||||
{
|
||||
_serie.targetVal = targetVal;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
_serie.targetVal = taTempiCiclo.getMedByMacchinaPeriodo(idxMacchina, _intervallo.inizio, _intervallo.fine)[0].TCMedio;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
int TcMaxFactor = memLayer.ML.confReadInt("TcMaxFactor");
|
||||
MapoDb.DS_ProdTempi.TempiCicloRilevatiDataTable tabTempi = taTempiCiclo.getByMacchinaPeriodoFiltMax(idxMacchina, _intervallo.inizio, _intervallo.fine, _serie.targetVal * TcMaxFactor);
|
||||
// converto!
|
||||
DateTime inizio;
|
||||
foreach (MapoDb.DS_ProdTempi.TempiCicloRilevatiRow riga in tabTempi.Rows)
|
||||
{
|
||||
inizio = riga.DataOraRif.AddMinutes(Convert.ToDouble(-riga.TCMedio * riga.PzProd)); // tolgo il tempo necessario a produrre i pezzi indicati come inizio
|
||||
_serie.serieDati.AddserieTimeValRow(inizio, riga.DataOraRif, riga.TCMedio, string.Format("Art: {0} - T.C. {1}'", riga.CodArticolo, riga.TCMedio), riga.CodArticolo);
|
||||
}
|
||||
// sistemo estremi x date e valori
|
||||
try
|
||||
{
|
||||
_serie.maxVal = taTempiCiclo.getMaxByMacchinaPeriodo(idxMacchina, _intervallo.inizio, _intervallo.fine)[0].TCMedio;
|
||||
if (_serie.maxVal > _serie.targetVal * TcMaxFactor)
|
||||
{
|
||||
_serie.maxVal = _serie.targetVal * TcMaxFactor;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
try
|
||||
{
|
||||
_serie.minVal = taTempiCiclo.getMinByMacchinaPeriodo(idxMacchina, _intervallo.inizio, _intervallo.fine)[0].TCMedio;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
_serie.intervallo = _intervallo;
|
||||
|
||||
// imposto se abbia cambio pallet
|
||||
_serie.palletChange = false;
|
||||
try
|
||||
{
|
||||
_serie.palletChange = MapoDb.DataLayer.obj.taDatiMacchine.getByIdx(Convert.ToInt32(idxMacchina))[0].palletChange;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return _serie;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using SteamWare;
|
||||
|
||||
|
||||
public class selData
|
||||
{
|
||||
/// <summary>
|
||||
/// classe accesso tabelle selettori
|
||||
/// </summary>
|
||||
public selData()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tabella elenco Articoli
|
||||
/// </summary>
|
||||
/// <param name="conditio"></param>
|
||||
/// <returns></returns>
|
||||
public MapoDb.DS_ProdTempi.AnagArticoliDataTable getSelAllArticoli()
|
||||
{
|
||||
return MapoDb.DataLayer.obj.taAnagArt.GetData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,274 @@
|
||||
using System;
|
||||
using MapoDb;
|
||||
using SteamWare;
|
||||
|
||||
/// <summary>
|
||||
/// Summary description for utility
|
||||
/// </summary>
|
||||
public class utility
|
||||
{
|
||||
MapoDb.DS_applicazioneTableAdapters.DiarioDiBordoTableAdapter taStati;
|
||||
MapoDb.DS_applicazioneTableAdapters.EventListTableAdapter taEventi;
|
||||
MapoDb.DS_UtilityTableAdapters.StatoMacchineTableAdapter taSM;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// effettua primo step
|
||||
/// * se 13,4,17 --> (da lavora a cambioPallet) pulizia righe tab elenco stati x caber 1 e 2 (cambio pallet "instabile" su lavorazione)
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="idxStatoFrom"></param>
|
||||
/// <param name="idxStatoTo"></param>
|
||||
/// <param name="idxEventoTo"></param>
|
||||
public void ripulisciStepOne(string idxMacchina, int idxStatoFrom, int idxStatoTo, int idxEventoTo)
|
||||
{
|
||||
// recupero SOLO le righe delle caber,1 alla volta...
|
||||
DS_applicazione.DiarioDiBordoDataTable tabella = taStati.GetShortChanging(idxMacchina, (float)1, idxStatoFrom); // prendo solo le lavorazioni...
|
||||
foreach (DS_applicazione.DiarioDiBordoRow riga in tabella)
|
||||
{
|
||||
// modifico lavorazione in cambiopallet...
|
||||
taStati.UpdateStato(idxStatoTo, riga.IdxMacchina, riga.InizioStato);
|
||||
taEventi.UpdateTipo(idxEventoTo, riga.IdxMacchina, riga.InizioStato);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// effettua secondo step (eliminazione e ricalcolo durate) pulizia righe tab elenco stati
|
||||
/// * 14 --> x caber 1 e 2 (cambio pallet "instabile" su lavorazione)
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="idxStato2reduce"></param>
|
||||
public void ripulisciStepTwo(string idxMacchina, int idxStato2reduce)
|
||||
{
|
||||
DS_applicazione.DiarioDiBordoDataTable tabella = taStati.GetData();
|
||||
// inizializzo riga...
|
||||
DS_applicazione.DiarioDiBordoRow rigaCumulo = (DS_applicazione.DiarioDiBordoRow)tabella.Rows[0];
|
||||
// controllo ogni riga, salvo i valori cumsum e start dalla prima, cancello corrente ed infine inserisco riga di sunto delle contigue...
|
||||
double durata;
|
||||
foreach (DS_applicazione.DiarioDiBordoRow riga in tabella)
|
||||
{
|
||||
// verifico se sia identica alla precedente...
|
||||
if (rigaCumulo.IdxStato == idxStato2reduce && riga.IdxStato == idxStato2reduce && rigaCumulo.KanbanCode == riga.KanbanCode && rigaCumulo.MatricolaKanban == riga.MatricolaKanban)
|
||||
{
|
||||
if (riga.InizioStato != rigaCumulo.InizioStato)
|
||||
{
|
||||
|
||||
durata = ((TimeSpan)riga.FineStato.Subtract(rigaCumulo.InizioStato)).TotalMinutes;
|
||||
taStati.UpdateFineDurata(riga.FineStato, (float)durata, rigaCumulo.IdxMacchina, rigaCumulo.InizioStato);
|
||||
// cancello riga duplicata
|
||||
taStati.DeleteQuery(riga.IdxMacchina, riga.InizioStato);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rigaCumulo = riga;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// effettua terzo step (eliminazione e ricalcolo durate) pulizia righe tab elenco eventi
|
||||
/// * 17 --> x caber 1 e 2 (cambio pallet "instabile" su lavorazione)
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="idxEvento2del"></param>
|
||||
public void ripulisciStepThree(string idxMacchina, int idxEvento2del)
|
||||
{
|
||||
// adesso svuoto i duplicati dalla tab eventi...
|
||||
DS_applicazione.EventListRow[] righe = (DS_applicazione.EventListRow[])taEventi.GetDataFiltered(idxMacchina, new DateTime(1999, 1, 1), new DateTime(9999, 1, 1)).Select("", "InizioStato ASC");
|
||||
DS_applicazione.EventListRow rigaEvPrev = (DS_applicazione.EventListRow)righe[0];
|
||||
foreach (DS_applicazione.EventListRow riga in righe)
|
||||
{
|
||||
if (riga.IdxTipo == idxEvento2del && rigaEvPrev.IdxTipo == idxEvento2del && riga.MatricolaKanban == rigaEvPrev.MatricolaKanban)
|
||||
{
|
||||
if (riga.InizioStato != rigaEvPrev.InizioStato)
|
||||
{
|
||||
taEventi.DeleteQuery(riga.IdxMacchina, riga.InizioStato);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rigaEvPrev = riga;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// effettua terzo step (eliminazione e ricalcolo durate) pulizia righe tab elenco eventi
|
||||
/// * 16/17 --> x caber 1 e 2 (cambio pallet "instabile" su lavorazione)
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="idxEvento2del"></param>
|
||||
public void ripulisciStepFour(string idxMacchina, int idxEventoPre, int idxEvento2del)
|
||||
{
|
||||
// adesso svuoto i duplicati dalla tab eventi...
|
||||
DS_applicazione.EventListRow[] righe = (DS_applicazione.EventListRow[])taEventi.GetDataFiltered(idxMacchina, new DateTime(1999, 1, 1), new DateTime(9999, 1, 1)).Select("", "InizioStato ASC");
|
||||
DS_applicazione.EventListRow rigaEvPrev = (DS_applicazione.EventListRow)righe[0];
|
||||
foreach (DS_applicazione.EventListRow riga in righe)
|
||||
{
|
||||
if (riga.IdxTipo == idxEvento2del && rigaEvPrev.IdxTipo == idxEventoPre && riga.MatricolaKanban == rigaEvPrev.MatricolaKanban)
|
||||
{
|
||||
if (riga.InizioStato != rigaEvPrev.InizioStato)
|
||||
{
|
||||
taEventi.DeleteQuery(riga.IdxMacchina, riga.InizioStato);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rigaEvPrev = riga;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// effettua ultimo step (eliminazione eventi) * 16/15 --> x Syntesy L11
|
||||
/// (HW - machining / HW - power on)
|
||||
/// elimino se è (15/16) ed i 2 prec sono 15+16...
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="idxEvento1"></param>
|
||||
/// <param name="idxEvento2"></param>
|
||||
public void ripulisciStepFive(string idxMacchina, int idxEvento1, int idxEvento2)
|
||||
{
|
||||
// adesso svuoto i duplicati dalla tab eventi...
|
||||
DS_applicazione.EventListRow[] righe = (DS_applicazione.EventListRow[])taEventi.GetDataFiltered(idxMacchina, new DateTime(1999, 1, 1), new DateTime(9999, 1, 1)).Select("", "InizioStato ASC");
|
||||
DS_applicazione.EventListRow rigaMenoUno = (DS_applicazione.EventListRow)righe[0];
|
||||
DS_applicazione.EventListRow rigaMenoDue = (DS_applicazione.EventListRow)righe[1];
|
||||
foreach (DS_applicazione.EventListRow riga in righe)
|
||||
{
|
||||
if (riga.InizioStato > rigaMenoDue.InizioStato)
|
||||
{
|
||||
if (riga.IdxTipo == idxEvento1 || riga.IdxTipo == idxEvento2)
|
||||
{
|
||||
if ((rigaMenoUno.IdxTipo == idxEvento1 && rigaMenoDue.IdxTipo == idxEvento2) || (rigaMenoUno.IdxTipo == idxEvento2 && rigaMenoDue.IdxTipo == idxEvento1))
|
||||
{
|
||||
taEventi.DeleteQuery(riga.IdxMacchina, riga.InizioStato);
|
||||
}
|
||||
}
|
||||
rigaMenoDue = rigaMenoUno;
|
||||
rigaMenoUno = riga;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// effettua reset del db
|
||||
/// </summary>
|
||||
public void resetDb()
|
||||
{
|
||||
taSM.stp_ZZZ_riallineaDateDb();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// restituisce stringa formattata in HH:mm:ss
|
||||
/// </summary>
|
||||
/// <param name="durataMinuti"></param>
|
||||
/// <returns></returns>
|
||||
public static string durataEventoHMS(double durataMinuti)
|
||||
{
|
||||
string durataFormattata = "";
|
||||
try
|
||||
{
|
||||
DateTime tempo = new DateTime();
|
||||
tempo = tempo.AddMinutes((double)durataMinuti);
|
||||
durataFormattata = string.Format("{0:00}:{1:00}:{2:00}", tempo.Hour, tempo.Minute, tempo.Second);
|
||||
}
|
||||
catch
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("errore calcolo durata: durataMinuti {0}", durataMinuti), tipoLog.EXCEPTION);
|
||||
}
|
||||
return durataFormattata;
|
||||
}
|
||||
|
||||
#region Inizializzazione
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// init dei table adapters
|
||||
/// </summary>
|
||||
protected void initTA()
|
||||
{
|
||||
// istanzio oggetto
|
||||
taStati = new MapoDb.DS_applicazioneTableAdapters.DiarioDiBordoTableAdapter();
|
||||
taEventi = new MapoDb.DS_applicazioneTableAdapters.EventListTableAdapter();
|
||||
taSM = new MapoDb.DS_UtilityTableAdapters.StatoMacchineTableAdapter();
|
||||
}
|
||||
/// <summary>
|
||||
/// effettua setup dei connection strings da web.config delal singola applicazione
|
||||
/// </summary>
|
||||
protected virtual void setupConnectionStringBase()
|
||||
{
|
||||
// connections del db
|
||||
taStati.Connection.ConnectionString = memLayer.ML.confReadString("MoonProConnectionString");
|
||||
taEventi.Connection.ConnectionString = memLayer.ML.confReadString("MoonProConnectionString");
|
||||
taSM.Connection.ConnectionString = memLayer.ML.confReadString("MoonProConnectionString");
|
||||
}
|
||||
|
||||
|
||||
protected utility()
|
||||
{
|
||||
initTA();
|
||||
setupConnectionStringBase();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// oggetto static per fare chiamate sul magazzino
|
||||
/// </summary>
|
||||
public static utility obj = new utility();
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
public enum tipoBarcode
|
||||
{
|
||||
/// <summary>
|
||||
/// tipo non riconosciuto
|
||||
/// </summary>
|
||||
nd,
|
||||
/// <summary>
|
||||
/// identifica una matricola operatore nel formato OPxxxxx (xxxxx è un intero che rappresenta la matricola, std fino a 8 cifre)
|
||||
/// </summary>
|
||||
matrOperatore,
|
||||
/// <summary>
|
||||
/// identifica un cartellino di tipo KANBAN
|
||||
/// </summary>
|
||||
kanban,
|
||||
/// <summary>
|
||||
/// identifica un codice per le attività di inizio/fine attrezzaggio e inizio/fine produzione
|
||||
/// </summary>
|
||||
attrezzaggio,
|
||||
/// <summary>
|
||||
/// identifica un codice per le attività di conferma produzione/fermi
|
||||
/// </summary>
|
||||
confermaProduzione,
|
||||
/// <summary>
|
||||
/// identifica un cartellino di dichiarazione fermata nel formato FExxxx dove xxxx è idxEvento dichiarato...
|
||||
/// </summary>
|
||||
dichiaraFermata,
|
||||
/// <summary>
|
||||
/// indentifica un codice di modifica turno
|
||||
/// </summary>
|
||||
modificaTurno
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tipologia di evento (generico) segnalato
|
||||
/// </summary>
|
||||
public enum tipoEvento
|
||||
{
|
||||
/// <summary>
|
||||
/// evento di reset
|
||||
/// </summary>
|
||||
reset,
|
||||
/// <summary>
|
||||
/// richiesta editing
|
||||
/// </summary>
|
||||
edit,
|
||||
/// <summary>
|
||||
/// nuova selezione
|
||||
/// </summary>
|
||||
selection,
|
||||
/// <summary>
|
||||
/// eliminazione record(s)
|
||||
/// </summary>
|
||||
delete
|
||||
}
|
||||
Reference in New Issue
Block a user