From f0028879d4b66a80f7b55c3e79e8c2000d3f458f Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周三, 26 6月 2024 19:21:18 +0800
Subject: [PATCH] 2
---
DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/Form1.cs | 102 ++++++++++++++++++++
DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/Form1.Designer.cs | 91 ++++++++++++++++++
DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/iWare_SCADA_FormTest2.csproj | 13 ++
DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/App.config | 48 ++++++++
4 files changed, 248 insertions(+), 6 deletions(-)
diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/App.config b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/App.config
index 53f82ee..110c9f0 100644
--- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/App.config
+++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/App.config
@@ -1,12 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
- <startup>
- <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
- </startup>
+ <configSections>
+ <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+ <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+ </configSections>
+
<appSettings>
<add key="OP80QualityData_Test" value="X:\CA4GC20TD_Test\"/>
<add key="OP60QualityData_Test" value="Q:\Measuring_Data_df_Test\"/>
<add key="OP60QualityData_Zhengshi" value="Q:\Measuring_Data_dfq\"/>
<add key="OP60QualityData_Test_Localhost" value="D:\鏁扮�涗俊鎭鎶�\鍏徃椤圭洰\DF22001-涓�姹借繛鏉嗛」鐩甛鏄犲皠鐩樻枃浠禱OP60锛堝凹浼竵锛塡"/>
+ <!--net use x: \\192.168.216.133\Destination /savecred /persistent:yes
+ net use z: \\192.168.216.130\kistler /savecred /persistent:yes
+ net use y: \\192.168.216.6\data /savecred /persistent:yes
+ net use u: \\192.168.216.130\NutrunnerData /savecred /persistent:yes-->
+
+ <!-- 鍒ゆ柇宸ュ簭鏄惁璺冲簭鐨勫熀鍑嗛厤缃� -->
+ <add key="WorkingProcedureAllStr" value="OP05OP10OP20OP30OP35OP40OP50OP60OP70OP80" />
+ <add key="WorkPeiceIDPath" value="Y:\qualified" />
+ <!-- op30宸ュ簭鐨勫伐浣嶈川閲忎俊鎭� -->
+ <add key="OP30QualityDataFor36Station" value="Z:\" />
+ <add key="OP30QualityDataFor45Station" value="U:\" />
+ <add key="OP60QualityData" value="V:\" />
+ <add key="OP20QualityData" value="W:\" />
+ <add key="OP80QualityData" value="X:\CA4GC20TD\" />
+ <!--<add key="WorkPeiceIDPath" value="C:\Users\13650\Desktop\yiqi" />-->
+ <add key="HeartBeatAlertInterval" value="2000" />
</appSettings>
-</configuration>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
+ </startup>
+ <entityFramework>
+ <providers>
+ <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+ </providers>
+ </entityFramework>
+ <connectionStrings>
+ <!--<add name="SCADA_DF22001_CORE" connectionString="Server=.;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />-->
+ <!--<add name="SCADA_DF22001_CORE" connectionString="Server=10.10.40.166;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />-->
+ <add name="SCADA_DF22001_CORE" connectionString="Server=.;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
+ <add name="SCModel" connectionString="data source=.;initial catalog=SCTest_new;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
+ </connectionStrings>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration>
\ No newline at end of file
diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/Form1.Designer.cs b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/Form1.Designer.cs
index b796720..c6c37cc 100644
--- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/Form1.Designer.cs
+++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/Form1.Designer.cs
@@ -31,6 +31,13 @@
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
+ this.button4 = new System.Windows.Forms.Button();
+ this.tb_TongJi = new System.Windows.Forms.TextBox();
+ this.checkBox_NowDay = new System.Windows.Forms.CheckBox();
+ this.dateTimePicker_End = new System.Windows.Forms.DateTimePicker();
+ this.label16 = new System.Windows.Forms.Label();
+ this.dateTimePicker_Start = new System.Windows.Forms.DateTimePicker();
+ this.btn_TongJi = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
@@ -63,17 +70,92 @@
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
+ // button4
+ //
+ this.button4.Location = new System.Drawing.Point(76, 335);
+ this.button4.Name = "button4";
+ this.button4.Size = new System.Drawing.Size(244, 54);
+ this.button4.TabIndex = 3;
+ this.button4.Text = "缁熻鍒嗘瀽";
+ this.button4.UseVisualStyleBackColor = true;
+ this.button4.Click += new System.EventHandler(this.button4_Click);
+ //
+ // tb_TongJi
+ //
+ this.tb_TongJi.Location = new System.Drawing.Point(444, 107);
+ this.tb_TongJi.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.tb_TongJi.Multiline = true;
+ this.tb_TongJi.Name = "tb_TongJi";
+ this.tb_TongJi.Size = new System.Drawing.Size(748, 459);
+ this.tb_TongJi.TabIndex = 19;
+ //
+ // checkBox_NowDay
+ //
+ this.checkBox_NowDay.AutoSize = true;
+ this.checkBox_NowDay.Location = new System.Drawing.Point(940, 51);
+ this.checkBox_NowDay.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.checkBox_NowDay.Name = "checkBox_NowDay";
+ this.checkBox_NowDay.Size = new System.Drawing.Size(59, 19);
+ this.checkBox_NowDay.TabIndex = 18;
+ this.checkBox_NowDay.Text = "浠婂ぉ";
+ this.checkBox_NowDay.UseVisualStyleBackColor = true;
+ //
+ // dateTimePicker_End
+ //
+ this.dateTimePicker_End.Location = new System.Drawing.Point(702, 49);
+ this.dateTimePicker_End.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.dateTimePicker_End.Name = "dateTimePicker_End";
+ this.dateTimePicker_End.Size = new System.Drawing.Size(200, 25);
+ this.dateTimePicker_End.TabIndex = 17;
+ //
+ // label16
+ //
+ this.label16.AutoSize = true;
+ this.label16.Location = new System.Drawing.Point(660, 57);
+ this.label16.Name = "label16";
+ this.label16.Size = new System.Drawing.Size(22, 15);
+ this.label16.TabIndex = 16;
+ this.label16.Text = "鑷�";
+ //
+ // dateTimePicker_Start
+ //
+ this.dateTimePicker_Start.Location = new System.Drawing.Point(444, 49);
+ this.dateTimePicker_Start.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.dateTimePicker_Start.Name = "dateTimePicker_Start";
+ this.dateTimePicker_Start.Size = new System.Drawing.Size(200, 25);
+ this.dateTimePicker_Start.TabIndex = 15;
+ //
+ // btn_TongJi
+ //
+ this.btn_TongJi.BackColor = System.Drawing.Color.Aqua;
+ this.btn_TongJi.Location = new System.Drawing.Point(1038, 37);
+ this.btn_TongJi.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btn_TongJi.Name = "btn_TongJi";
+ this.btn_TongJi.Size = new System.Drawing.Size(155, 48);
+ this.btn_TongJi.TabIndex = 14;
+ this.btn_TongJi.Text = "缁熻淇℃伅";
+ this.btn_TongJi.UseVisualStyleBackColor = false;
+ this.btn_TongJi.Click += new System.EventHandler(this.btn_TongJi_Click);
+ //
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(800, 450);
+ this.ClientSize = new System.Drawing.Size(1307, 688);
+ this.Controls.Add(this.tb_TongJi);
+ this.Controls.Add(this.checkBox_NowDay);
+ this.Controls.Add(this.dateTimePicker_End);
+ this.Controls.Add(this.label16);
+ this.Controls.Add(this.dateTimePicker_Start);
+ this.Controls.Add(this.btn_TongJi);
+ this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
+ this.PerformLayout();
}
@@ -82,6 +164,13 @@
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
+ private System.Windows.Forms.Button button4;
+ private System.Windows.Forms.TextBox tb_TongJi;
+ private System.Windows.Forms.CheckBox checkBox_NowDay;
+ private System.Windows.Forms.DateTimePicker dateTimePicker_End;
+ private System.Windows.Forms.Label label16;
+ private System.Windows.Forms.DateTimePicker dateTimePicker_Start;
+ private System.Windows.Forms.Button btn_TongJi;
}
}
diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/Form1.cs b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/Form1.cs
index b28acd6..661a76c 100644
--- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/Form1.cs
+++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/Form1.cs
@@ -1,4 +1,5 @@
锘縰sing iWare_SCADA_BusinessLogical.Utils;
+using iWare_SCADA_Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -84,7 +85,7 @@
//鐩爣鏂囦欢鐨勫畬鏁寸洰褰�
string destFileName = source_doFile.FullName.Replace("Measuring_Data_dfq", "Measuring_Data_df_Copy");
string source_file_name = source_doFile.Name.Replace(".dfq", "");//涓嶅甫鎵╁睍鍚嶇殑鏂囦欢鍚嶅瓧
- destFileName = destFileName.Replace(source_file_name, source_file_name + "_" + "_" + DateTime.Now.ToString("yyyyMMddHHmmss"));
+ destFileName = destFileName.Replace(source_file_name, source_file_name + "_" + "_" + DateTime.Now.ToString("yyyyMMddHHmmss"));
File.Copy(source_doFile.FullName, destFileName, true);
//FileInfo destFile = new FileInfo(destFileName);
@@ -98,5 +99,104 @@
MessageBox.Show("寮傚父:" + ex.Message);
}
}
+
+ private void button4_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ private void btn_TongJi_Click(object sender, EventArgs e)
+ {
+ //缁熻
+
+ int store_FDJ = 0;//鐜版湁鍙戝姩鏈烘暟
+ int store_EmptySalver = 0;//绌烘墭鐩樻暟閲�
+ int store_EmptySalver_TS = 0;//绌烘墭鐩樻墭鏁�
+
+ int count_In_FDJ = 0;//鏌ヨ鏌愬ぉ鍏ュ簱浜嗗灏戝彂鍔ㄦ満
+ int count_In_EmptySalver = 0;//鏌ヨ鏌愬ぉ鍏ュ簱浜嗗灏� 绌烘墭鐩�
+ int count_In_EmptySalver_TS = 0;//鏌ヨ鏌愬ぉ鍏ュ簱浜嗗灏� 绌烘墭鐩樻墭鏁�
+
+ int count_Out_FDJ = 0;//鏌ヨ鏌愬ぉ鍑哄簱浜嗗灏戝彂鍔ㄦ満
+ int count_Out_EmptySalver = 0;//鏌ヨ鏌愬ぉ鍑哄簱浜嗗灏� 绌烘墭鐩�
+ int count_Out_EmptySalver_TS = 0;//鏌ヨ鏌愬ぉ鍑哄簱浜嗗灏� 绌烘墭鐩樻墭鏁�
+
+ int count_ZY_EmptySalver = 0;//鏌ヨ鏌愬ぉ杞繍浜嗗灏� 绌烘墭鐩�
+ int count_ZY_EmptySalver_TS = 0;//鏌ヨ鏌愬ぉ杞繍浜嗗灏� 绌烘墭鐩樻墭鏁�
+
+ //鏌愭鏃堕棿鐨勭粺璁�
+ var str_start = this.dateTimePicker_Start.Value.ToString("yyyy-MM-dd" + " " + "00:00:00");
+ var str_end = this.dateTimePicker_End.Value.ToString("yyyy-MM-dd" + " " + "23:59:59");
+ var start = Convert.ToDateTime(str_start);
+ var end = Convert.ToDateTime(str_end);
+
+ int allPlacesCount = 0;
+
+ List<string> strList = new List<string>() {
+ "OP05","OP10","OP20","OP30","OP35","OP40","OP50","OP60","OP70","OP80"
+ };
+ var q_strList = string.Join(",", strList);
+ var str = "";
+ str += "鏃堕棿鑼冨洿: " + str_start + "鑷�" + str_end + " \r\n";
+ using (DbModel edm = new DbModel())
+ {
+ var allPlaces = edm.WorkPieceLog.Where(x =>
+ (x.CreatedTime >= start && x.CreatedTime <= end)).ToList();
+
+
+
+
+ var groups = allPlaces.GroupBy(x => x.WorkingProcedure).OrderBy(x => x.Key);
+ foreach (var gg in groups)
+ {
+ var _key = gg.Key;
+ var _list = gg.ToList();
+ var emtype = " ";
+ var _list_youzhi = _list.Where(x => x.WorkPieceID.Length > 20 && x.WorkPieceID != emtype).ToList();
+ var _list_empty = _list.Where(x => string.IsNullOrEmpty(x.WorkPieceID) || x.WorkPieceID == emtype).ToList();
+ var _list_other = _list.Where(x => !((x.WorkPieceID.Length > 20 && x.WorkPieceID != emtype) || (string.IsNullOrEmpty(x.WorkPieceID) || x.WorkPieceID == emtype))).ToList();
+ var _list_other_str_list = _list_other.Select(x => x.WorkPieceID).Distinct().ToList();
+ var _list_other_str = string.Join("|", _list_other_str_list);
+ str += $"==================銆恵_key}銆�========================= \r\n";
+ str += $"鎬婚噺: {_list.Count()},姝g‘浜岀淮鐮佹暟:{_list_youzhi.Count()},绌哄��:{_list_empty.Count},鍏朵粬:{_list_other.Count},鍒嗗埆鏄瘂_list_other_str} \r\n";
+
+ //鍐嶈繘琛屽垎缁�,缁熻 浜岀淮鐮佷笉瀵圭殑鏁版嵁
+ var _list_qc_error = _list.Where(x => string.IsNullOrEmpty(x.WorkPieceID) || x.WorkPieceID.Length <= 20).ToList();
+ var group_qc_error = _list_qc_error.GroupBy(x => new { x.WorkPieceID, x.CreatedUserName });
+ str += $"浜岀淮鐮佷笉瀵圭殑鏁版嵁锛屾�婚噺: {_list_qc_error.Count()} \r\n";
+ foreach (var item in group_qc_error)
+ {
+ str += $"浜岀淮鐮佷笉瀵圭殑鏁版嵁锛學orkPieceID: {item.Key.WorkPieceID}锛孋reatedUserName: {item.Key.CreatedUserName},鏁伴噺:{item.ToList().Count()} \r\n";
+ }
+
+
+ //鍐嶈繘琛屽垎缁�,缁熻 浜岀淮鐮佸鐨勬暟鎹�
+ var group_qc_ok = _list_youzhi.GroupBy(x => new { x.CreatedUserName });
+ str += $"浜岀淮鐮佹纭殑鏁版嵁锛屾�婚噺: {_list_youzhi.Count()} \r\n";
+ foreach (var item in group_qc_ok)
+ {
+ str += $"浜岀淮鐮佹纭殑鏁版嵁锛孋reatedUserName: {item.Key.CreatedUserName},鏁伴噺:{item.ToList().Count()} \r\n";
+ }
+
+ //鍐嶈繘琛屽垎缁�,缁熻 浜岀淮鐮佸鐨勬暟鎹�-鍘婚噸
+ var _list_youzhi_quchong = _list_youzhi.Select(x => new { x.CreatedUserName }).Distinct().ToList();
+ var group_qc_ok_quchong = _list_youzhi_quchong.GroupBy(x => new { x.CreatedUserName });
+ str += $"锛堝幓閲嶅悗锛変簩缁寸爜姝g‘鐨勬暟鎹紝鎬婚噺: {_list_youzhi_quchong.Count()} \r\n";
+ foreach (var item in group_qc_ok_quchong)
+ {
+ str += $"锛堝幓閲嶅悗锛変簩缁寸爜姝g‘鐨勬暟鎹紝CreatedUserName: {item.Key.CreatedUserName},鏁伴噺:{item.ToList().Count()} \r\n";
+ }
+
+
+ str += "\r\n";
+
+ }
+
+ }
+
+ str += "\r\n";
+
+ this.tb_TongJi.Text = str;
+ }
}
}
diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/iWare_SCADA_FormTest2.csproj b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/iWare_SCADA_FormTest2.csproj
index 37303a2..92f3f4b 100644
--- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/iWare_SCADA_FormTest2.csproj
+++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/iWare_SCADA_FormTest2.csproj
@@ -34,6 +34,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="EntityFramework">
+ <HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
+ </Reference>
+ <Reference Include="EntityFramework.SqlServer">
+ <HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@@ -45,6 +51,9 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
+ <Reference Include="Yitter.IdGenerator.Net45">
+ <HintPath>..\packages\Yitter.IdGenerator.Net45.1.0.0\lib\net452\Yitter.IdGenerator.Net45.dll</HintPath>
+ </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
@@ -86,6 +95,10 @@
<Project>{32708f19-fe1a-48f5-b373-8e1c776f216c}</Project>
<Name>iWare_SCADA_BusinessLogical</Name>
</ProjectReference>
+ <ProjectReference Include="..\iWare_SCADA_Model\iWare_SCADA_Model.csproj">
+ <Project>{91C185DE-15AB-44AE-B585-53799FC51BE0}</Project>
+ <Name>iWare_SCADA_Model</Name>
+ </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
--
Gitblit v1.9.3