谢翼翔 пре 1 година
родитељ
комит
9815126e97

+ 366 - 1
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ.DAL/SqlServer.cs

@@ -2,7 +2,6 @@
 using System;
 using System.Collections.Generic;
 using System.Data.SqlClient;
-using System.Linq.Expressions;
 using SCADA.CommonLib;
 using SCADA.CommonLib.Data;
 using SCADA.CommonLib.Data.DIL;
@@ -493,6 +492,85 @@ public static class T_Col_Name
                 /// </summary>
                  public const string @StateId_Str=nameof(@StateId_Str);
                     
+             }
+             /// <summary> 
+             /// App_Vertiv_Statistics
+             /// </summary>
+             public class App_Vertiv_Statistics
+             {
+             	/// <summary>
+                /// 
+                /// </summary>
+                 public const string @ID=nameof(@ID);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @Source_Str=nameof(@Source_Str);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @Value_Int=nameof(@Value_Int);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @Mac_1_Int=nameof(@Mac_1_Int);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @Mac_2_Int=nameof(@Mac_2_Int);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @Mac_3_Int=nameof(@Mac_3_Int);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @Mac_4_Int=nameof(@Mac_4_Int);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @Mac_5_Int=nameof(@Mac_5_Int);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @Mac_6_Int=nameof(@Mac_6_Int);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @Mac_7_Int=nameof(@Mac_7_Int);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @Mac_8_Int=nameof(@Mac_8_Int);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @Mac_9_Int=nameof(@Mac_9_Int);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @Mac_10_Int=nameof(@Mac_10_Int);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @CreateTime_Dt=nameof(@CreateTime_Dt);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @ModifyTime_Dt=nameof(@ModifyTime_Dt);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @ModifyUser_Str=nameof(@ModifyUser_Str);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @Remark_Str=nameof(@Remark_Str);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @CreateUser_Str=nameof(@CreateUser_Str);
+                    
              }
              /// <summary> 
              /// App_Vertiv_WorkTime
@@ -2405,6 +2483,283 @@ namespace DBModel
                 }
             }
             
+             }
+             /// <summary> 
+             /// 
+             /// </summary>
+             public class App_Vertiv_Statistics:ObservableObject
+             {
+             	  private int _ID;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public int ID
+                {
+                get {return _ID;}
+                set{
+                    if(value!=(_ID))
+                    {
+                        _ID=value;
+                        OnPropertyChanged(nameof( ID));
+                    }
+                }
+            }
+              private string _Source_Str;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public string Source_Str
+                {
+                get {return _Source_Str;}
+                set{
+                    if(value!=(_Source_Str))
+                    {
+                        _Source_Str=value;
+                        OnPropertyChanged(nameof( Source_Str));
+                    }
+                }
+            }
+              private string _Value_Int;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public string Value_Int
+                {
+                get {return _Value_Int;}
+                set{
+                    if(value!=(_Value_Int))
+                    {
+                        _Value_Int=value;
+                        OnPropertyChanged(nameof( Value_Int));
+                    }
+                }
+            }
+              private int? _Mac_1_Int;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public int? Mac_1_Int
+                {
+                get {return _Mac_1_Int;}
+                set{
+                    if(value!=(_Mac_1_Int))
+                    {
+                        _Mac_1_Int=value;
+                        OnPropertyChanged(nameof( Mac_1_Int));
+                    }
+                }
+            }
+              private int? _Mac_2_Int;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public int? Mac_2_Int
+                {
+                get {return _Mac_2_Int;}
+                set{
+                    if(value!=(_Mac_2_Int))
+                    {
+                        _Mac_2_Int=value;
+                        OnPropertyChanged(nameof( Mac_2_Int));
+                    }
+                }
+            }
+              private int? _Mac_3_Int;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public int? Mac_3_Int
+                {
+                get {return _Mac_3_Int;}
+                set{
+                    if(value!=(_Mac_3_Int))
+                    {
+                        _Mac_3_Int=value;
+                        OnPropertyChanged(nameof( Mac_3_Int));
+                    }
+                }
+            }
+              private int? _Mac_4_Int;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public int? Mac_4_Int
+                {
+                get {return _Mac_4_Int;}
+                set{
+                    if(value!=(_Mac_4_Int))
+                    {
+                        _Mac_4_Int=value;
+                        OnPropertyChanged(nameof( Mac_4_Int));
+                    }
+                }
+            }
+              private int? _Mac_5_Int;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public int? Mac_5_Int
+                {
+                get {return _Mac_5_Int;}
+                set{
+                    if(value!=(_Mac_5_Int))
+                    {
+                        _Mac_5_Int=value;
+                        OnPropertyChanged(nameof( Mac_5_Int));
+                    }
+                }
+            }
+              private int? _Mac_6_Int;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public int? Mac_6_Int
+                {
+                get {return _Mac_6_Int;}
+                set{
+                    if(value!=(_Mac_6_Int))
+                    {
+                        _Mac_6_Int=value;
+                        OnPropertyChanged(nameof( Mac_6_Int));
+                    }
+                }
+            }
+              private int? _Mac_7_Int;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public int? Mac_7_Int
+                {
+                get {return _Mac_7_Int;}
+                set{
+                    if(value!=(_Mac_7_Int))
+                    {
+                        _Mac_7_Int=value;
+                        OnPropertyChanged(nameof( Mac_7_Int));
+                    }
+                }
+            }
+              private int? _Mac_8_Int;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public int? Mac_8_Int
+                {
+                get {return _Mac_8_Int;}
+                set{
+                    if(value!=(_Mac_8_Int))
+                    {
+                        _Mac_8_Int=value;
+                        OnPropertyChanged(nameof( Mac_8_Int));
+                    }
+                }
+            }
+              private int? _Mac_9_Int;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public int? Mac_9_Int
+                {
+                get {return _Mac_9_Int;}
+                set{
+                    if(value!=(_Mac_9_Int))
+                    {
+                        _Mac_9_Int=value;
+                        OnPropertyChanged(nameof( Mac_9_Int));
+                    }
+                }
+            }
+              private int? _Mac_10_Int;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public int? Mac_10_Int
+                {
+                get {return _Mac_10_Int;}
+                set{
+                    if(value!=(_Mac_10_Int))
+                    {
+                        _Mac_10_Int=value;
+                        OnPropertyChanged(nameof( Mac_10_Int));
+                    }
+                }
+            }
+              private DateTime? _CreateTime_Dt;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public DateTime? CreateTime_Dt
+                {
+                get {return _CreateTime_Dt;}
+                set{
+                    if(value!=(_CreateTime_Dt))
+                    {
+                        _CreateTime_Dt=value;
+                        OnPropertyChanged(nameof( CreateTime_Dt));
+                    }
+                }
+            }
+              private DateTime? _ModifyTime_Dt;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public DateTime? ModifyTime_Dt
+                {
+                get {return _ModifyTime_Dt;}
+                set{
+                    if(value!=(_ModifyTime_Dt))
+                    {
+                        _ModifyTime_Dt=value;
+                        OnPropertyChanged(nameof( ModifyTime_Dt));
+                    }
+                }
+            }
+              private string _ModifyUser_Str;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public string ModifyUser_Str
+                {
+                get {return _ModifyUser_Str;}
+                set{
+                    if(value!=(_ModifyUser_Str))
+                    {
+                        _ModifyUser_Str=value;
+                        OnPropertyChanged(nameof( ModifyUser_Str));
+                    }
+                }
+            }
+              private string _Remark_Str;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public string Remark_Str
+                {
+                get {return _Remark_Str;}
+                set{
+                    if(value!=(_Remark_Str))
+                    {
+                        _Remark_Str=value;
+                        OnPropertyChanged(nameof( Remark_Str));
+                    }
+                }
+            }
+              private string _CreateUser_Str;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public string CreateUser_Str
+                {
+                get {return _CreateUser_Str;}
+                set{
+                    if(value!=(_CreateUser_Str))
+                    {
+                        _CreateUser_Str=value;
+                        OnPropertyChanged(nameof( CreateUser_Str));
+                    }
+                }
+            }
+            
              }
              /// <summary> 
              /// 
@@ -3573,6 +3928,10 @@ public BaseTable App_Vertiv_ScheduleStop{get;private set;}
  /// <summary> 
  ///  
  /// </summary> 
+public BaseTable App_Vertiv_Statistics{get;private set;}
+ /// <summary> 
+ ///  
+ /// </summary> 
 public BaseTable App_Vertiv_WorkTime{get;private set;}
  /// <summary> 
  ///  
@@ -3602,6 +3961,7 @@ App_Vertiv_MaintenanceTable=CreateTable("ID","App_Vertiv_MaintenanceTable");
 App_Vertiv_ProductionLog=CreateTable("ID","App_Vertiv_ProductionLog");
 APP_Vertiv_RepairTable=CreateTable("ID","APP_Vertiv_RepairTable");
 App_Vertiv_ScheduleStop=CreateTable("ID","App_Vertiv_ScheduleStop");
+App_Vertiv_Statistics=CreateTable("ID","App_Vertiv_Statistics");
 App_Vertiv_WorkTime=CreateTable("ID","App_Vertiv_WorkTime");
 Base_AlarmCode=CreateTable("ID","Base_AlarmCode");
 Base_AlarmLog=CreateTable("ID","Base_AlarmLog");
@@ -3656,6 +4016,10 @@ public BaseTable App_Vertiv_ScheduleStop{get;private set;}
  /// <summary> 
  ///  
  /// </summary> 
+public BaseTable App_Vertiv_Statistics{get;private set;}
+ /// <summary> 
+ ///  
+ /// </summary> 
 public BaseTable App_Vertiv_WorkTime{get;private set;}
  /// <summary> 
  ///  
@@ -3691,6 +4055,7 @@ App_Vertiv_MaintenanceTable=innerDb.CreateTable("ID","App_Vertiv_MaintenanceTabl
 App_Vertiv_ProductionLog=innerDb.CreateTable("ID","App_Vertiv_ProductionLog");
 APP_Vertiv_RepairTable=innerDb.CreateTable("ID","APP_Vertiv_RepairTable");
 App_Vertiv_ScheduleStop=innerDb.CreateTable("ID","App_Vertiv_ScheduleStop");
+App_Vertiv_Statistics=innerDb.CreateTable("ID","App_Vertiv_Statistics");
 App_Vertiv_WorkTime=innerDb.CreateTable("ID","App_Vertiv_WorkTime");
 Base_AlarmCode=innerDb.CreateTable("ID","Base_AlarmCode");
 Base_AlarmLog=innerDb.CreateTable("ID","Base_AlarmLog");

+ 4 - 0
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/Machines/SampleMachine.cs

@@ -37,6 +37,8 @@ namespace SCADA_DAQ.Customer.Machines
         public DateTime StartTime { get; set; }
 
         public string HoldID { get; set; }
+
+        public int Increase { get; set; }
         /// <summary>
         /// 计划停止时间
         /// </summary>
@@ -147,6 +149,7 @@ namespace SCADA_DAQ.Customer.Machines
                     new UpdateItem(SqlSchema.DBNames.T_Col_Name.App_Vertiv_ProductionLog.DeviceName_Str, BaseDevice.DeviceID),
                     new UpdateItem(SqlSchema.DBNames.T_Col_Name.App_Vertiv_ProductionLog.DeviceReg_Str, reg.Comment.RegName),
                     new UpdateItem(SqlSchema.DBNames.T_Col_Name.App_Vertiv_ProductionLog.DeviceRegValue_Int, reg.Value));
+                Increase++;
             }
             if (reg.Comment.Variable == "折弯次数" && reg.Value != 0)
             {
@@ -154,6 +157,7 @@ namespace SCADA_DAQ.Customer.Machines
                     new UpdateItem(SqlSchema.DBNames.T_Col_Name.App_Vertiv_BendCounter.DeviceName_Str, BaseDevice.DeviceID),
                     new UpdateItem(SqlSchema.DBNames.T_Col_Name.App_Vertiv_BendCounter.DeviceReg_Str, reg.Comment.RegName),
                     new UpdateItem(SqlSchema.DBNames.T_Col_Name.App_Vertiv_BendCounter.DeviceRegValue_Int, reg.Reading));
+                Increase++;
             }
             //else if (reg.Comment.Variable == "折弯次数" && BendOn == false)
             //{

+ 212 - 0
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/Models/Statistics/StatisticsDBModel.cs

@@ -0,0 +1,212 @@
+using SCADA.CommonLib;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SCADA_DAQ.Customer.Models.Statistics
+{
+    [Table(nameof(SqlSchema.DBModel.App_Vertiv_Statistics))]
+    public class StatisticsDBModel : ObservableObject
+    {
+
+        /// <summary>
+        /// 类型
+        /// </summary>
+        public string Source
+        {
+            get { return _Source; }
+            set
+            {
+                if (value != _Source)
+                {
+                    _Source = value;
+                    OnPropertyChanged(nameof(Source));
+                }
+            }
+        }
+        private string _Source;
+
+
+        /// <summary>
+        /// 激光机
+        /// </summary>
+        public int Mac_1Value
+        {
+            get { return _Mac_1Value; }
+            set
+            {
+                if (value != _Mac_1Value)
+                {
+                    _Mac_1Value = value;
+                    OnPropertyChanged(nameof(Mac_1Value));
+                }
+            }
+        }
+        private int _Mac_1Value;
+
+
+        /// <summary>
+        /// 西门子plc
+        /// </summary>
+        public int Mac_2Value
+        {
+            get { return _Mac_2Value; }
+            set
+            {
+                if (value != _Mac_2Value)
+                {
+                    _Mac_2Value = value;
+                    OnPropertyChanged(nameof(Mac_2Value));
+                }
+            }
+        }
+        private int _Mac_2Value;
+
+
+        /// <summary>
+        /// 倍福
+        /// </summary>
+        public int Mac_3Value
+        {
+            get { return _Mac_3Value; }
+            set
+            {
+                if (value != _Mac_3Value)
+                {
+                    _Mac_3Value = value;
+                    OnPropertyChanged(nameof(Mac_3Value));
+                }
+            }
+        }
+        private int _Mac_3Value;
+
+
+        /// <summary>
+        /// 百超折弯
+        /// </summary>
+        public int Mac_4Value
+        {
+            get { return _Mac_4Value; }
+            set
+            {
+                if (value != _Mac_4Value)
+                {
+                    _Mac_4Value = value;
+                    OnPropertyChanged(nameof(Mac_4Value));
+                }
+            }
+        }
+        private int _Mac_4Value;
+
+
+        /// <summary>
+        /// 一号折弯机
+        /// </summary>
+        public int Mac_5Value
+        {
+            get { return _Mac_5Value; }
+            set
+            {
+                if (value != _Mac_5Value)
+                {
+                    _Mac_5Value = value;
+                    OnPropertyChanged(nameof(Mac_5Value));
+                }
+            }
+        }
+        private int _Mac_5Value;
+
+
+        /// <summary>
+        /// 二号折弯机
+        /// </summary>
+        public int Mac_6Value
+        {
+            get { return _Mac_6Value; }
+            set
+            {
+                if (value != _Mac_6Value)
+                {
+                    _Mac_6Value = value;
+                    OnPropertyChanged(nameof(Mac_6Value));
+                }
+            }
+        }
+        private int _Mac_6Value;
+
+
+        /// <summary>
+        /// PBC折弯机
+        /// </summary>
+        public int Mac_7Value
+        {
+            get { return _Mac_7Value; }
+            set
+            {
+                if (value != _Mac_7Value)
+                {
+                    _Mac_7Value = value;
+                    OnPropertyChanged(nameof(Mac_7Value));
+                }
+            }
+        }
+        private int _Mac_7Value;
+
+
+        /// <summary>
+        /// 三号折弯机
+        /// </summary>
+        public int Mac_8Value
+        {
+            get { return _Mac_8Value; }
+            set
+            {
+                if (value != _Mac_8Value)
+                {
+                    _Mac_8Value = value;
+                    OnPropertyChanged(nameof(Mac_8Value));
+                }
+            }
+        }
+        private int _Mac_8Value;
+
+
+        /// <summary>
+        /// 高机冲孔机
+        /// </summary>
+        public int Mac_9Value
+        {
+            get { return _Mac_9Value; }
+            set
+            {
+                if (value != _Mac_9Value)
+                {
+                    _Mac_9Value = value;
+                    OnPropertyChanged(nameof(Mac_9Value));
+                }
+            }
+        }
+        private int _Mac_9Value;
+
+
+        /// <summary>
+        /// 金方圆冲孔机
+        /// </summary>
+        public int Mac_10Value
+        {
+            get { return _Mac_10Value; }
+            set
+            {
+                if (value != _Mac_10Value)
+                {
+                    _Mac_10Value = value;
+                    OnPropertyChanged(nameof(Mac_10Value));
+                }
+            }
+        }
+        private int _Mac_10Value;
+
+    }
+}

+ 135 - 7
skoda-scada-daq3.0-master/skoda-scada-daq3.0-master/scada_-daq3.0-master/SCADA_DAQ/Customer/Service/CustomerService.cs

@@ -7,9 +7,12 @@ using SCADA.CommonLib;
 using SCADA.CommonLib.Data.DIL;
 using SCADA.CommonLib.Helper;
 using SCADA.CommonLib.Service;
+using SCADA_DAQ.Customer.Machines;
 using SCADA_DAQ.Customer.Models;
 using SCADA_DAQ.Customer.Models.DeviceInfoTime;
 using SCADA_DAQ.Customer.Models.OEEData;
+using SCADA_DAQ.Customer.Models.Statistics;
+using SCADA_DAQ.Plugin.Machine;
 using SCADA_DAQ.Plugin.Machine.Config;
 using SqlSchema.DBNames;
 using System;
@@ -24,6 +27,7 @@ using System.Threading;
 using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Shapes;
+using Xceed.Wpf.Toolkit.PropertyGrid.Editors;
 
 namespace SCADA_DAQ.Customer.Service
 {
@@ -42,6 +46,34 @@ namespace SCADA_DAQ.Customer.Service
 
         public List<YaweiStateInfoModel> alarmList = new List<YaweiStateInfoModel>();
 
+        public FXMachine LaserMac { get; set; } = MachineServer.GetInstance().GetMachine<FXMachine>("激光机");
+
+        public FXMachine SimenseMac { get; set; } = MachineServer.GetInstance().GetMachine<FXMachine>("西门子840D数冲");
+
+        public FXMachine BackoffMac { get; set; } = MachineServer.GetInstance().GetMachine<FXMachine>("倍福数冲机");
+
+
+        public FXMachine BystronicMac { get; set; } = MachineServer.GetInstance().GetMachine<FXMachine>("百超折弯机");
+
+
+        public FXMachine BendMac_1 { get; set; } = MachineServer.GetInstance().GetMachine<FXMachine>("一号YaWei折弯机");
+
+
+        public FXMachine BendMac_2 { get; set; } = MachineServer.GetInstance().GetMachine<FXMachine>("二号YaWei折弯机");
+
+
+        public FXMachine PbcBendMac { get; set; } = MachineServer.GetInstance().GetMachine<FXMachine>("亚威PBC折弯机");
+
+
+        public FXMachine BendMac_3 { get; set; } = MachineServer.GetInstance().GetMachine<FXMachine>("三号YaWei折弯机");
+
+
+        public FXMachine GaojiCisailleMac { get; set; } = MachineServer.GetInstance().GetMachine<FXMachine>("高机母线冲剪机");
+
+        public FXMachine JinfangyuanCisailleMac { get; set; } = MachineServer.GetInstance().GetMachine<FXMachine>("金方圆数控母线冲剪机");
+
+
+
         public string OrgID { get; set; }
 
         public DateTime StartTime { get; set; }
@@ -90,8 +122,9 @@ namespace SCADA_DAQ.Customer.Service
             // RpcService.GetInstance().Regiseter(this);   //将服务中方法注册到RPC服务器,可以给WebApi调用
             //Timer.Start();
             //Timer.Elapsed += Timer_Elapsed;
-            Env.Schedual.DateTimeChanged += Schedual_DateTimeChanged;
             GetOeeData();
+            Env.Schedual.DateTimeChanged += Schedual_DateTimeChanged;
+
             //var str = $"{T_Col_Name.App_Vertiv_MachineInfo.Device_Str} = '亚威PBC折弯机' ";
             //var lastTime = Env.SqlDAL.App_Vertiv_MachineInfo.GetTopOne(str, "StartTime_Dt", " ID Desc ");
             //LastRecordTime = Convert.ToDateTime(lastTime);
@@ -100,20 +133,115 @@ namespace SCADA_DAQ.Customer.Service
 
         private void Schedual_DateTimeChanged(object sender, DateTimeChangedArgs e)
         {
-       
+
             if (e.ChangeType == DateTimeChangeType.DayChanged)
             {
-              
+
                 OeePercent();
 
             }
 
-       
-            if (e.ChangeType == SCADA.CommonLib.DateTimeChangeType.SecondChanged & e.TimeFlag.Second % 10 == 0 )
+
+            if (e.ChangeType == SCADA.CommonLib.DateTimeChangeType.SecondChanged & e.TimeFlag.Second % 2 == 0)
             {
                 GetOeeData();
                 OeePercent();
+
             }
+            if ((e.ChangeType == SCADA.CommonLib.DateTimeChangeType.SecondChanged & e.TimeFlag.Second % 30 == 0) || e.ChangeType == DateTimeChangeType.HourChanged || e.ChangeType == DateTimeChangeType.DayChanged)
+            {
+
+                var addInfo = new List<StatisticsDBModel>();
+                var hourFilterStr = $"{T_Col_Name.App_Vertiv_Statistics.Source_Str} = 'Hour' and " +
+                    $"{T_Col_Name.App_Vertiv_Statistics.CreateTime_Dt} between '{DateTime.Now.ToString("yyyy-MM-dd HH:00:00")}' and '{DateTime.Now.ToString("yyyy-MM-dd HH:59:59")}'";
+                var dayFilterStr = $"{T_Col_Name.App_Vertiv_Statistics.Source_Str} = 'Day' and " +
+                    $"{T_Col_Name.App_Vertiv_Statistics.CreateTime_Dt} between '{DateTimeHelper.ToDayStart(DateTime.Now)}' and '{DateTimeHelper.ToDayEnd(DateTime.Now)}'";
+                var monthFilterStr = $"{T_Col_Name.App_Vertiv_Statistics.Source_Str} = 'Month' and " +
+                    $"{T_Col_Name.App_Vertiv_Statistics.CreateTime_Dt} between '{DateTimeHelper.ToMonthStart(DateTime.Now)}' and '{DateTimeHelper.ToMonthEnd(DateTime.Now)}'";
+
+                var yearFilterStr = $"{T_Col_Name.App_Vertiv_Statistics.Source_Str} = 'Year' and " +
+                    $"{T_Col_Name.App_Vertiv_Statistics.CreateTime_Dt} between '{DateTimeHelper.ToYearStart(DateTime.Now)}' and '{DateTimeHelper.ToMonthStart(DateTime.Now)}'";
+
+                //将产量/折弯的记录转存到这张表上
+                var hourStatistics = Env.SqlDAL.App_Vertiv_Statistics.GetData<StatisticsDBModel>(hourFilterStr);
+
+                var dayStatistics = Env.SqlDAL.App_Vertiv_Statistics.GetData<StatisticsDBModel>(dayFilterStr);
+
+                var monthStatistics = Env.SqlDAL.App_Vertiv_Statistics.GetData<StatisticsDBModel>(monthFilterStr);
+
+                var yearStatistics = Env.SqlDAL.App_Vertiv_Statistics.GetData<StatisticsDBModel>(yearFilterStr);
+
+                if (hourStatistics.Count == 0)
+                {
+                    hourStatistics.Add(new StatisticsDBModel
+                    {
+                        Source = "Hour"
+                    });
+                    addInfo.Add(hourStatistics.First());
+                }
+                if (dayStatistics.Count == 0)
+                {
+                    dayStatistics.Add(new StatisticsDBModel
+                    {
+                        Source = "Day"
+                    });
+                    addInfo.Add(dayStatistics.First());
+                }
+                if (monthStatistics.Count == 0)
+                {
+                    monthStatistics.Add(new StatisticsDBModel
+                    {
+                        Source = "Month"
+                    });
+                    addInfo.Add(monthStatistics.First());
+
+                }
+                if (yearStatistics.Count == 0)
+                {
+                    yearStatistics.Add(new StatisticsDBModel
+                    {
+                        Source = "Year"
+                    });
+                    addInfo.Add(yearStatistics.First());
+                }
+                if (addInfo.Count != 0)
+                {
+                    Env.SqlDAL.Insert(addInfo);
+                }
+                UpdateItems(hourStatistics, hourFilterStr);
+                UpdateItems(dayStatistics, dayFilterStr);
+                UpdateItems(monthStatistics, monthFilterStr);
+                UpdateItems(yearStatistics, yearFilterStr);
+                LaserMac.Increase = 0;
+                SimenseMac.Increase = 0;
+                BackoffMac.Increase = 0;
+                BystronicMac.Increase = 0;
+                BendMac_1.Increase = 0;
+                BendMac_2.Increase = 0;
+                BendMac_3.Increase = 0;
+                PbcBendMac.Increase = 0;
+                GaojiCisailleMac.Increase = 0;
+                JinfangyuanCisailleMac.Increase = 0;
+
+
+
+
+            }
+        }
+
+        private void UpdateItems(List<StatisticsDBModel> statisticses, string filterStr)
+        {
+            Env.SqlDAL.App_Vertiv_Statistics.Update(
+                    filterStr, new UpdateItem(T_Col_Name.App_Vertiv_Statistics.Mac_1_Int, statisticses.First().Mac_1Value + LaserMac.Increase),
+                    new UpdateItem(T_Col_Name.App_Vertiv_Statistics.Mac_2_Int, statisticses.First().Mac_2Value + SimenseMac.Increase),
+                    new UpdateItem(T_Col_Name.App_Vertiv_Statistics.Mac_3_Int, statisticses.First().Mac_3Value + BackoffMac.Increase),
+                    new UpdateItem(T_Col_Name.App_Vertiv_Statistics.Mac_4_Int, statisticses.First().Mac_4Value + BystronicMac.Increase),
+                    new UpdateItem(T_Col_Name.App_Vertiv_Statistics.Mac_5_Int, statisticses.First().Mac_5Value + BendMac_1.Increase),
+                    new UpdateItem(T_Col_Name.App_Vertiv_Statistics.Mac_6_Int, statisticses.First().Mac_6Value + BendMac_2.Increase),
+                    new UpdateItem(T_Col_Name.App_Vertiv_Statistics.Mac_7_Int, statisticses.First().Mac_7Value + PbcBendMac.Increase),
+                    new UpdateItem(T_Col_Name.App_Vertiv_Statistics.Mac_8_Int, statisticses.First().Mac_8Value + BendMac_3.Increase),
+                    new UpdateItem(T_Col_Name.App_Vertiv_Statistics.Mac_9_Int, statisticses.First().Mac_9Value + GaojiCisailleMac.Increase),
+                    new UpdateItem(T_Col_Name.App_Vertiv_Statistics.Mac_10_Int, statisticses.First().Mac_10Value + JinfangyuanCisailleMac.Increase));
         }
 
 
@@ -218,7 +346,7 @@ namespace SCADA_DAQ.Customer.Service
         }
 
         public string OeeValue { get; set; }
-         public void OeePercent()
+        public void OeePercent()
         {
             var deviceName = new List<string>{"高机母线冲剪机", "2号YaWei折弯机", "3号YaWei折弯机", "激光机", "1号YaWei折弯机", "百超折弯机",
             "倍福数冲机", "金方圆数控母线冲孔机", "西门子840D数冲", "亚威PBC折弯机"};
@@ -236,7 +364,7 @@ namespace SCADA_DAQ.Customer.Service
                 else
                 {
                     OeeValue = Math.Round(Convert.ToDouble(deviceRunDayTIme) / deviceDayTIme, 4).ToString();
-                  
+
                 }
                 if (DailyOeeData.Count() != 0)
                 {