Browse Source

202502171622

baowei 1 week ago
parent
commit
0f58e95e67

+ 399 - 22
ProductionLineMonitor.Application/Services/ExcelService.cs

@@ -10,8 +10,10 @@ using OfficeOpenXml.Drawing.Chart;
 using OfficeOpenXml.Style;
 using ProductionLineMonitor.Application.Services.FaultService;
 using ProductionLineMonitor.Application.Services.OEEService;
+using ProductionLineMonitor.Application.Services.OEEService.Dtos;
 using ProductionLineMonitor.Core.Dtos;
 using ProductionLineMonitor.Core.IRepositories;
+using ProductionLineMonitor.Core.Models;
 using System;
 using System.Collections.Generic;
 using System.Drawing;
@@ -50,11 +52,13 @@ namespace ProductionLineMonitor.Application.Services
                 }
 
                 JToken? UtilizationRateEmailList;
+                JToken? ExcelChartsSettings;
                 using (StreamReader file = File.OpenText("D:\\ReportForms\\Email.json"))
                 {
                     using JsonTextReader reader = new JsonTextReader(file);
                     JObject jsonObject = (JObject)JToken.ReadFrom(reader);
                     UtilizationRateEmailList = jsonObject["UtilizationRateEmail"];
+                    ExcelChartsSettings = jsonObject["ExcelChartsSettings"];
                 }
 
                 if (UtilizationRateEmailList == null || UtilizationRateEmailList.Count() == 0)
@@ -90,6 +94,18 @@ namespace ProductionLineMonitor.Application.Services
                         continue;
                     }
 
+                    var HideEquipmentProduction = ExcelChartsSettings["HideEquipmentProduction"].ToString().Split(',');
+
+                    //List<int> [产能,稼动,待机,报警,待料,合计]
+                    Dictionary<string, List<int>> OEE_Temp1 = new Dictionary<string, List<int>>();
+                    //List<int> [运行时间,报警时间,待料时间,换料时间,产能,报警次数]
+                    Dictionary<string, List<int>> OEE_Temp2 = new Dictionary<string, List<int>>();
+                    //机种
+                    List<List<string>> ModuleType = new List<List<string>>();
+                    for (int i = 0; i < 24; i++)
+                        ModuleType.Add(new List<string>());
+
+
                     foreach (var machineId in machineIdString)
                     {
                         var machine = _unitOfWork.MachineRepository.GetById(machineId);
@@ -108,6 +124,7 @@ namespace ProductionLineMonitor.Application.Services
                         using ExcelPackage package = new ExcelPackage(file);
 
                         ExcelWorksheet worksheet = package.Workbook.Worksheets.Add($"{line.Name} {machine.Name}");
+
                         worksheet.View.ZoomScale = 80;
 
                         worksheet.Cells.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
@@ -235,8 +252,9 @@ namespace ProductionLineMonitor.Application.Services
 
                         for (int i = 0; i < machineOEE.Count; i++)
                         {
+                            string dateStr = machineOEE[i].Date + " " + machineOEE[i].Shift;
                             worksheet.Cells[i + 2, 1].Value = i + 1;
-                            worksheet.Cells[i + 2, 2].Value = machineOEE[i].Date + " " + machineOEE[i].Shift;
+                            worksheet.Cells[i + 2, 2].Value = dateStr;
                             worksheet.Cells[i + 2, 3].Value = (int)machineOEE[i].RunTimeRate;
                             worksheet.Cells[i + 2, 4].Value = (int)machineOEE[i].IdelTimeRate;
                             worksheet.Cells[i + 2, 5].Value = (int)machineOEE[i].DownTimeRate;
@@ -248,12 +266,34 @@ namespace ProductionLineMonitor.Application.Services
                             worksheet.Cells[i + 2, 11].Value = machineOEE[i].LoadMATTime / 60;
                             worksheet.Cells[i + 2, 12].Value
                                 = (machineOEE[i].RunTime + machineOEE[i].IdelTime + machineOEE[i].DownTime + machineOEE[i].LoadMATTime) / 60;
+                            if (OEE_Temp1.ContainsKey(dateStr))
+                            {
+                                OEE_Temp1[dateStr][0] += machineOEE[i].Outputs;
+                                OEE_Temp1[dateStr][1] += machineOEE[i].RunTime;
+                                OEE_Temp1[dateStr][2] += machineOEE[i].IdelTime;
+                                OEE_Temp1[dateStr][3] += machineOEE[i].DownTime;
+                                OEE_Temp1[dateStr][4] += machineOEE[i].LoadMATTime;
+                                OEE_Temp1[dateStr][5]
+                                    += machineOEE[i].RunTime + machineOEE[i].IdelTime + machineOEE[i].DownTime + machineOEE[i].LoadMATTime;
+                            }
+                            else
+                            {
+                                List<int> list_temp = new List<int>();
+                                list_temp.Add(machineOEE[i].Outputs);
+                                list_temp.Add(machineOEE[i].RunTime);
+                                list_temp.Add(machineOEE[i].IdelTime);
+                                list_temp.Add(machineOEE[i].DownTime);
+                                list_temp.Add(machineOEE[i].LoadMATTime);
+                                list_temp.Add(machineOEE[i].RunTime + machineOEE[i].IdelTime + machineOEE[i].DownTime + machineOEE[i].LoadMATTime);
+                                OEE_Temp1.Add(dateStr, list_temp);
+                            }
                         }
 
                         if (machineHourDatas != null)
                         {
                             if (machineHourDatas.Count == 24)
                             {
+                                List<string> temp = new List<string>();
                                 {
                                     int autoSum = 0;
                                     int alarmTimeSum = 0;
@@ -264,11 +304,11 @@ namespace ProductionLineMonitor.Application.Services
                                     int loadTimeSum = 0;
                                     for (int i = 0; i < 12; i++)
                                     {
-                                        int auto = machineHourDatas[i].AutoRunTime.Value / 60;
+                                        int auto = (int)Math.Round(machineHourDatas[i].AutoRunTime.Value / 60.0);
                                         autoSum += auto;
-                                        int alarmTime = machineHourDatas[i].AlarmTime.Value / 60;
+                                        int alarmTime = (int)Math.Round(machineHourDatas[i].AlarmTime.Value / 60.0);
                                         alarmTimeSum += alarmTime;
-                                        int idel = machineHourDatas[i].IdleTime.Value / 60;
+                                        int idel = (int)Math.Round(machineHourDatas[i].IdleTime.Value / 60.0);
                                         idelSum += idel;
                                         int output = machineHourDatas[i].OutPut.Value;
                                         outputSum += output;
@@ -276,11 +316,19 @@ namespace ProductionLineMonitor.Application.Services
                                         //ttSum += tt;
                                         int alarm = machineHourDatas[i].AlarmSum.Value;
                                         alarmSum += alarm;
-                                        int loadTime = machineHourDatas[i].LoadMATTime.Value / 60;
+                                        int loadTime = (int)Math.Round(machineHourDatas[i].LoadMATTime.Value / 60.0);
                                         loadTimeSum += loadTime;
 
+                                        string periodStr = machineHourDatas[i].Period;
+                                        string moduleTypeStr = machineHourDatas[i].ModuleType;
+
+                                        if (ModuleType[i] == null || ModuleType[i].Count == 0 || !ModuleType[i].Contains(moduleTypeStr))
+                                        {
+                                            ModuleType[i].Add(moduleTypeStr);
+                                        }
+
                                         worksheet.Cells[i + 3, 15].Value = i + 1;
-                                        worksheet.Cells[i + 3, 16].Value = machineHourDatas[i].Period;
+                                        worksheet.Cells[i + 3, 16].Value = periodStr;
                                         worksheet.Cells[i + 3, 17].Value = machineHourDatas[i].ModuleType;
                                         worksheet.Cells[i + 3, 18].Value = auto;
                                         worksheet.Cells[i + 3, 19].Value = alarmTime;
@@ -289,6 +337,28 @@ namespace ProductionLineMonitor.Application.Services
                                         worksheet.Cells[i + 3, 22].Value = output;
                                         worksheet.Cells[i + 3, 23].Value = Math.Round(tt, 2);
                                         worksheet.Cells[i + 3, 24].Value = alarm;
+
+                                        if (OEE_Temp2.ContainsKey(periodStr))
+                                        {
+                                            OEE_Temp2[periodStr][0] += auto;
+                                            OEE_Temp2[periodStr][1] += alarmTime;
+                                            OEE_Temp2[periodStr][2] += idel;
+                                            OEE_Temp2[periodStr][3] += loadTime;
+                                            OEE_Temp2[periodStr][4] += output;
+                                            OEE_Temp2[periodStr][5] += alarm;
+                                        }
+                                        else
+                                        {
+                                            List<int> list_temp = new List<int>();
+                                            list_temp.Add(auto);
+                                            list_temp.Add(alarmTime);
+                                            list_temp.Add(idel);
+                                            list_temp.Add(loadTime);
+                                            list_temp.Add(output);
+                                            list_temp.Add(alarm);
+                                            OEE_Temp2.Add(periodStr, list_temp);
+                                        }
+
                                     }
 
                                     worksheet.Cells[15, 15].Value = "合计";
@@ -326,11 +396,11 @@ namespace ProductionLineMonitor.Application.Services
                                     int loadTimeSum = 0;
                                     for (int i = 12; i < 24; i++)
                                     {
-                                        int auto = machineHourDatas[i].AutoRunTime.Value / 60;
+                                        int auto = (int)Math.Round(machineHourDatas[i].AutoRunTime.Value / 60.0);
                                         autoSum += auto;
-                                        int alarmTime = machineHourDatas[i].AlarmTime.Value / 60;
+                                        int alarmTime = (int)Math.Round(machineHourDatas[i].AlarmTime.Value / 60.0);
                                         alarmTimeSum += alarmTime;
-                                        int idel = machineHourDatas[i].IdleTime.Value / 60;
+                                        int idel = (int)Math.Round(machineHourDatas[i].IdleTime.Value / 60.0);
                                         idelSum += idel;
                                         int output = machineHourDatas[i].OutPut.Value;
                                         outputSum += output;
@@ -338,9 +408,17 @@ namespace ProductionLineMonitor.Application.Services
                                         //ttSum += tt;
                                         int alarm = machineHourDatas[i].AlarmSum.Value;
                                         alarmSum += alarm;
-                                        int loadTime = machineHourDatas[i].LoadMATTime.Value / 60;
+                                        int loadTime = (int)Math.Round(machineHourDatas[i].LoadMATTime.Value / 60.0);
                                         loadTimeSum += loadTime;
 
+                                        string periodStr = machineHourDatas[i].Period;
+                                        string moduleTypeStr = machineHourDatas[i].ModuleType;
+
+                                        if (ModuleType[i] == null || ModuleType[i].Count == 0 || !ModuleType[i].Contains(moduleTypeStr))
+                                        {
+                                            ModuleType[i].Add(moduleTypeStr);
+                                        }
+
                                         worksheet.Cells[i - 12 + 3, 26].Value = i + 1;
                                         worksheet.Cells[i - 12 + 3, 27].Value = machineHourDatas[i].Period;
                                         worksheet.Cells[i - 12 + 3, 28].Value = machineHourDatas[i].ModuleType;
@@ -351,6 +429,27 @@ namespace ProductionLineMonitor.Application.Services
                                         worksheet.Cells[i - 12 + 3, 33].Value = output;
                                         worksheet.Cells[i - 12 + 3, 34].Value = Math.Round(tt, 2);
                                         worksheet.Cells[i - 12 + 3, 35].Value = alarm;
+
+                                        if (OEE_Temp2.ContainsKey(periodStr))
+                                        {
+                                            OEE_Temp2[periodStr][0] += auto;
+                                            OEE_Temp2[periodStr][1] += alarmTime;
+                                            OEE_Temp2[periodStr][2] += idel;
+                                            OEE_Temp2[periodStr][3] += loadTime;
+                                            OEE_Temp2[periodStr][4] += output;
+                                            OEE_Temp2[periodStr][5] += alarm;
+                                        }
+                                        else
+                                        {
+                                            List<int> list_temp = new List<int>();
+                                            list_temp.Add(auto);
+                                            list_temp.Add(alarmTime);
+                                            list_temp.Add(idel);
+                                            list_temp.Add(loadTime);
+                                            list_temp.Add(output);
+                                            list_temp.Add(alarm);
+                                            OEE_Temp2.Add(periodStr, list_temp);
+                                        }
                                     }
 
                                     worksheet.Cells[15, 26].Value = "合计";
@@ -456,25 +555,303 @@ namespace ProductionLineMonitor.Application.Services
                             pieSerie.DataLabel.ShowValue = true;
                         }
 
-                        ExcelChart chart1 = worksheet.Drawings.AddChart("chart1", eChartType.ColumnStacked);
-                        chart1.Legend.Position = eLegendPosition.Bottom;
-                        chart1.Legend.Add();
-                        chart1.Title.Text = "设备产能曲线";    //设置图表的名称   
-                        chart1.SetPosition(540, 1030);         //设置图表位置   
-                        chart1.SetSize(1000, 400);           //设置图表大小   
-                        chart1.ShowHiddenData = true;
-                        chart1.YAxis.Format = "0 \"pcs\"";
-                        ExcelChartSerie chartSerie1;
-                        chartSerie1 = chart1.Series.Add(worksheet.Cells[2, 7, machineOEE.Count + 1, 7], worksheet.Cells[2, 2, machineOEE.Count + 1, 2]);
-                        chartSerie1.HeaderAddress = worksheet.Cells[1, 7];
-                        foreach (var item in chart1.Series)
+                        if (HideEquipmentProduction == null || HideEquipmentProduction.Count() == 0 || !HideEquipmentProduction.Contains(machineId))
+                        {
+                            ExcelChart chart1 = worksheet.Drawings.AddChart("chart1", eChartType.ColumnStacked);
+                            chart1.Legend.Position = eLegendPosition.Bottom;
+                            chart1.Legend.Add();
+                            chart1.Title.Text = "设备产能曲线";    //设置图表的名称   
+                            chart1.SetPosition(540, 1030);         //设置图表位置   
+                            chart1.SetSize(1000, 400);           //设置图表大小   
+                            chart1.ShowHiddenData = true;
+                            chart1.YAxis.Format = "0 \"pcs\"";
+                            ExcelChartSerie chartSerie1;
+                            chartSerie1 = chart1.Series.Add(worksheet.Cells[2, 7, machineOEE.Count + 1, 7], worksheet.Cells[2, 2, machineOEE.Count + 1, 2]);
+                            chartSerie1.HeaderAddress = worksheet.Cells[1, 7];
+                            foreach (var item in chart1.Series)
+                            {
+                                var pieSerie = (ExcelBarChartSerie)item;
+                                pieSerie.DataLabel.ShowValue = true;
+                            }
+                        }
+
+                        package.Save();
+                    }
+                    if ((bool)UtilizationRateEmail["DataSummary"]["IsAble"])
+                    {
+                        FileInfo file = new FileInfo(path);
+
+                        using ExcelPackage package = new ExcelPackage(file);
+
+                        ExcelWorksheet worksheet = package.Workbook.Worksheets.Add($"汇总");
+
+                        worksheet.View.ZoomScale = 80;
+
+                        worksheet.Cells.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
+
+                        #region tab header
+
+                        worksheet.Cells[1, 1].Value = "NO";
+                        worksheet.Cells[1, 2].Value = "时间";
+                        worksheet.Cells[1, 3].Value = "稼动率(%)";
+                        worksheet.Cells[1, 4].Value = "待机率(%)";
+                        worksheet.Cells[1, 5].Value = "报警率(%)";
+                        worksheet.Cells[1, 6].Value = "换料率(%)";
+                        worksheet.Cells[1, 7].Value = "产能(pcs)";
+                        worksheet.Cells[1, 8].Value = "稼动(min)";
+                        worksheet.Cells[1, 9].Value = "待机(min)";
+                        worksheet.Cells[1, 10].Value = "报警(min)";
+                        worksheet.Cells[1, 11].Value = "换料(min)";
+                        worksheet.Cells[1, 12].Value = "合计(min)";
+
+                        worksheet.Cells[1, 15].Value = $"{startTime:yyyy-MM-dd} 早班";
+                        worksheet.Cells[1, 15, 1, 24].Merge = true;
+
+                        worksheet.Cells[2, 15].Value = "NO";
+                        worksheet.Cells[2, 16].Value = "时段";
+                        worksheet.Cells[2, 17].Value = "机种";
+                        worksheet.Cells[2, 18].Value = "运行时间";
+                        worksheet.Cells[2, 19].Value = "报警时间";
+                        worksheet.Cells[2, 20].Value = "待料时间";
+                        worksheet.Cells[2, 21].Value = "换料时间";
+                        worksheet.Cells[2, 22].Value = "产能";
+                        worksheet.Cells[2, 23].Value = "TT";
+                        worksheet.Cells[2, 24].Value = "报警次数";
+
+                        worksheet.Cells[1, 26].Value = $"{startTime:yyyy-MM-dd} 夜班";
+                        worksheet.Cells[1, 26, 1, 35].Merge = true;
+
+                        worksheet.Cells[2, 26].Value = "NO";
+                        worksheet.Cells[2, 27].Value = "时段";
+                        worksheet.Cells[2, 28].Value = "机种";
+                        worksheet.Cells[2, 29].Value = "运行时间";
+                        worksheet.Cells[2, 30].Value = "报警时间";
+                        worksheet.Cells[2, 31].Value = "待料时间";
+                        worksheet.Cells[2, 32].Value = "换料时间";
+                        worksheet.Cells[2, 33].Value = "产能";
+                        worksheet.Cells[2, 34].Value = "TT";
+                        worksheet.Cells[2, 35].Value = "报警次数";
+
+                        worksheet.Column(1).Width = 5;
+                        worksheet.Column(2).Width = 12;
+                        worksheet.Column(3).Width = 12;
+                        worksheet.Column(4).Width = 12;
+                        worksheet.Column(5).Width = 12;
+                        worksheet.Column(6).Width = 12;
+                        worksheet.Column(7).Width = 12;
+                        worksheet.Column(8).Width = 12;
+                        worksheet.Column(9).Width = 12;
+                        worksheet.Column(10).Width = 12;
+                        worksheet.Column(11).Width = 12;
+                        worksheet.Column(12).Width = 12;
+
+                        worksheet.Column(13).Width = 2;
+                        worksheet.Column(14).Width = 2;
+
+                        worksheet.Column(15).Width = 5;
+                        worksheet.Column(16).Width = 12;
+                        worksheet.Column(17).Width = 12;
+                        worksheet.Column(18).Width = 12;
+                        worksheet.Column(19).Width = 12;
+                        worksheet.Column(20).Width = 12;
+                        worksheet.Column(21).Width = 12;
+                        worksheet.Column(22).Width = 12;
+                        worksheet.Column(23).Width = 12;
+                        worksheet.Column(24).Width = 12;
+                        worksheet.Column(22).Width = 12;
+                        worksheet.Column(23).Width = 12;
+
+                        worksheet.Column(25).Width = 2;
+
+                        worksheet.Column(26).Width = 5;
+                        worksheet.Column(27).Width = 12;
+                        worksheet.Column(28).Width = 12;
+                        worksheet.Column(29).Width = 12;
+                        worksheet.Column(30).Width = 12;
+                        worksheet.Column(31).Width = 12;
+                        worksheet.Column(32).Width = 12;
+                        worksheet.Column(33).Width = 12;
+                        worksheet.Column(34).Width = 12;
+                        worksheet.Column(35).Width = 12;
+
+                        #endregion
+
+                        List<string> OEE1Keys = new List<string>(OEE_Temp1.Keys);
+                        for (int i = 0; i < OEE1Keys.Count(); i++)
+                        {
+                            int total = OEE_Temp1[OEE1Keys[i]][5];
+                            worksheet.Cells[i + 2, 1].Value = i + 1;
+                            worksheet.Cells[i + 2, 2].Value = OEE1Keys[i];
+                            worksheet.Cells[i + 2, 3].Value = Math.Round(OEE_Temp1[OEE1Keys[i]][1] * 100.0 / total);
+                            worksheet.Cells[i + 2, 4].Value = Math.Round(OEE_Temp1[OEE1Keys[i]][2] * 100.0 / total);
+                            worksheet.Cells[i + 2, 5].Value = Math.Round(OEE_Temp1[OEE1Keys[i]][3] * 100.0 / total);
+                            worksheet.Cells[i + 2, 6].Value = Math.Round(OEE_Temp1[OEE1Keys[i]][4] * 100.0 / total);
+                            worksheet.Cells[i + 2, 7].Value = OEE_Temp1[OEE1Keys[i]][0];
+                            worksheet.Cells[i + 2, 8].Value = OEE_Temp1[OEE1Keys[i]][1] / 60;
+                            worksheet.Cells[i + 2, 9].Value = OEE_Temp1[OEE1Keys[i]][2] / 60;
+                            worksheet.Cells[i + 2, 10].Value = OEE_Temp1[OEE1Keys[i]][3] / 60;
+                            worksheet.Cells[i + 2, 11].Value = OEE_Temp1[OEE1Keys[i]][4] / 60;
+                            worksheet.Cells[i + 2, 12].Value = total / 60;
+                        }
+
+                        if (OEE_Temp2 != null && OEE_Temp2.Count == 24)
+                        {
+                            List<string> OEE2Keys = new List<string>(OEE_Temp2.Keys);
+                            {
+                                int autoTimeSum = 0;
+                                int alarmTimeSum = 0;
+                                int idelTimeSum = 0;
+                                int loadTimeSum = 0;
+                                int outputSum = 0;
+                                int alarmSum = 0;
+                                double ttSum;
+                                for (int i = 0; i < 12; i++)
+                                {
+
+                                    int autoTime = OEE_Temp2[OEE2Keys[i]][0];
+                                    autoTimeSum += autoTime;
+                                    int alarmTime = OEE_Temp2[OEE2Keys[i]][1];
+                                    alarmTimeSum += alarmTime;
+                                    int idelTime = OEE_Temp2[OEE2Keys[i]][2];
+                                    idelTimeSum += idelTime;
+                                    int loadTime = OEE_Temp2[OEE2Keys[i]][3];
+                                    loadTimeSum += loadTime;
+                                    int output = OEE_Temp2[OEE2Keys[i]][4];
+                                    outputSum += output;
+                                    int alarm = OEE_Temp2[OEE2Keys[i]][5];
+                                    alarmSum += alarm;
+                                    worksheet.Cells[i + 3, 15].Value = i + 1;
+                                    worksheet.Cells[i + 3, 16].Value = OEE2Keys[i];
+                                    worksheet.Cells[i + 3, 17].Value = String.Join(",", ModuleType[i]);
+                                    worksheet.Cells[i + 3, 18].Value = autoTime;
+                                    worksheet.Cells[i + 3, 19].Value = alarmTime;
+                                    worksheet.Cells[i + 3, 20].Value = idelTime;
+                                    worksheet.Cells[i + 3, 21].Value = loadTimeSum;
+                                    worksheet.Cells[i + 3, 22].Value = output;
+                                    worksheet.Cells[i + 3, 23].Value = output == 0 ? 0 : Math.Round(OEE_Temp2[OEE2Keys[i]][0] * 60.0 / OEE_Temp2[OEE2Keys[i]][4], 2);
+                                    worksheet.Cells[i + 3, 24].Value = alarm;
+                                }
+
+                                worksheet.Cells[15, 15].Value = "合计";
+                                worksheet.Cells[15, 15, 15, 17].Merge = true;
+                                worksheet.Cells[15, 18].Value = autoTimeSum;
+                                worksheet.Cells[15, 19].Value = alarmTimeSum;
+                                worksheet.Cells[15, 20].Value = idelTimeSum;
+                                worksheet.Cells[15, 21].Value = loadTimeSum;
+                                worksheet.Cells[15, 22].Value = outputSum;
+                                if (outputSum != 0)
+                                    ttSum = autoTimeSum * 60.0 / outputSum;
+                                else
+                                    ttSum = 0;
+                                worksheet.Cells[15, 23].Value = Math.Round(ttSum, 2);
+                                worksheet.Cells[15, 24].Value = alarmSum;
+                            }
+
+                            {
+                                int autoTimeSum = 0;
+                                int alarmTimeSum = 0;
+                                int idelTimeSum = 0;
+                                int loadTimeSum = 0;
+                                int outputSum = 0;
+                                int alarmSum = 0;
+                                double ttSum;
+                                for (int i = 12; i < 24; i++)
+                                {
+
+                                    int autoTime = OEE_Temp2[OEE2Keys[i]][0]; ;
+                                    autoTimeSum += autoTime;
+                                    int alarmTime = OEE_Temp2[OEE2Keys[i]][1];
+                                    alarmTimeSum += alarmTime;
+                                    int idelTime = OEE_Temp2[OEE2Keys[i]][2];
+                                    idelTimeSum += idelTime;
+                                    int loadTime = OEE_Temp2[OEE2Keys[i]][3];
+                                    loadTimeSum += loadTime;
+                                    int output = OEE_Temp2[OEE2Keys[i]][4];
+                                    outputSum += output;
+                                    int alarm = OEE_Temp2[OEE2Keys[i]][5];
+                                    alarmSum += alarm;
+                                    worksheet.Cells[i - 12 + 3, 26].Value = i + 1;
+                                    worksheet.Cells[i - 12 + 3, 27].Value = OEE2Keys[i];
+                                    worksheet.Cells[i - 12 + 3, 28].Value = String.Join(",", ModuleType[i]);
+                                    worksheet.Cells[i - 12 + 3, 29].Value = autoTime;
+                                    worksheet.Cells[i - 12 + 3, 30].Value = alarmTime;
+                                    worksheet.Cells[i - 12 + 3, 31].Value = idelTime;
+                                    worksheet.Cells[i - 12 + 3, 32].Value = loadTimeSum;
+                                    worksheet.Cells[i - 12 + 3, 33].Value = output;
+                                    worksheet.Cells[i - 12 + 3, 34].Value = output == 0 ? 0 : Math.Round(OEE_Temp2[OEE2Keys[i]][0] * 60.0 / OEE_Temp2[OEE2Keys[i]][4], 2);
+                                    worksheet.Cells[i - 12 + 3, 35].Value = alarm;
+                                }
+
+                                worksheet.Cells[15, 26].Value = "合计";
+                                worksheet.Cells[15, 26, 15, 28].Merge = true;
+                                worksheet.Cells[15, 29].Value = autoTimeSum;
+                                worksheet.Cells[15, 30].Value = alarmTimeSum;
+                                worksheet.Cells[15, 31].Value = idelTimeSum;
+                                worksheet.Cells[15, 32].Value = loadTimeSum;
+                                worksheet.Cells[15, 33].Value = outputSum;
+                                if (outputSum != 0)
+                                    ttSum = autoTimeSum * 60.0 / outputSum;
+                                else
+                                    ttSum = 0;
+                                worksheet.Cells[15, 34].Value = Math.Round(ttSum, 2);
+                                worksheet.Cells[15, 35].Value = alarmSum;
+
+                            }
+                        }
+
+                        ExcelChartSerie chartSerie;
+                        ExcelChart chart = worksheet.Drawings.AddChart("chart", eChartType.ColumnStacked);
+
+                        chart.YAxis.MinValue = 0;
+                        chart.YAxis.MaxValue = 100;
+                        chart.YAxis.Format = "0 \"%\"";
+
+                        chart.Legend.Position = eLegendPosition.Bottom;
+                        chart.Legend.Add();
+                        chart.Title.Text = "设备稼动曲线";    //设置图表的名称   
+                        chart.SetPosition(540, 20);         //设置图表位置   
+                        chart.SetSize(1000, 400);           //设置图表大小   
+                        chart.ShowHiddenData = true;
+
+                        chartSerie = chart.Series.Add(worksheet.Cells[2, 3, OEE_Temp1.Count() + 1, 3], worksheet.Cells[2, 2, OEE_Temp1.Count() + 1, 2]);
+                        chartSerie.HeaderAddress = worksheet.Cells[1, 3];
+                        chartSerie = chart.Series.Add(worksheet.Cells[2, 4, OEE_Temp1.Count() + 1, 4], worksheet.Cells[2, 2, OEE_Temp1.Count() + 1, 2]);
+                        chartSerie.HeaderAddress = worksheet.Cells[1, 4];
+                        chartSerie = chart.Series.Add(worksheet.Cells[2, 5, OEE_Temp1.Count() + 1, 5], worksheet.Cells[2, 2, OEE_Temp1.Count() + 1, 2]);
+                        chartSerie.HeaderAddress = worksheet.Cells[1, 5];
+                        chartSerie = chart.Series.Add(worksheet.Cells[2, 6, OEE_Temp1.Count() + 1, 6], worksheet.Cells[2, 2, OEE_Temp1.Count() + 1, 2]);
+                        chartSerie.HeaderAddress = worksheet.Cells[1, 6];
+
+
+                        foreach (var item in chart.Series)
                         {
                             var pieSerie = (ExcelBarChartSerie)item;
                             pieSerie.DataLabel.ShowValue = true;
                         }
 
+                        if (!(bool)UtilizationRateEmail["DataSummary"]["HideProductionUtilizationChart"])
+                        {
+                            ExcelChart chart1 = worksheet.Drawings.AddChart("chart1", eChartType.ColumnStacked);
+                            chart1.Legend.Position = eLegendPosition.Bottom;
+                            chart1.Legend.Add();
+                            chart1.Title.Text = "设备产能曲线";    //设置图表的名称   
+                            chart1.SetPosition(540, 1030);         //设置图表位置   
+                            chart1.SetSize(1000, 400);           //设置图表大小   
+                            chart1.ShowHiddenData = true;
+                            chart1.YAxis.Format = "0 \"pcs\"";
+                            ExcelChartSerie chartSerie1;
+                            chartSerie1 = chart1.Series.Add(worksheet.Cells[2, 7, OEE_Temp1.Count() + 1, 7], worksheet.Cells[2, 2, OEE_Temp1.Count() + 1, 2]);
+                            chartSerie1.HeaderAddress = worksheet.Cells[1, 7];
+                            foreach (var item in chart1.Series)
+                            {
+                                var pieSerie = (ExcelBarChartSerie)item;
+                                pieSerie.DataLabel.ShowValue = true;
+                            }
+                        }
+                        package.Workbook.Worksheets.MoveToStart("汇总");
                         package.Save();
                     }
+
                     string ReceiverAppSettingName = UtilizationRateEmail["ReceiverAppSettingName"].ToString();
                     if (ReceiverAppSettingName == null || String.IsNullOrEmpty(ReceiverAppSettingName))
                     {

+ 4 - 0
ProductionLineMonitor.Core/Models/Machine.cs

@@ -39,5 +39,9 @@ namespace ProductionLineMonitor.Core.Models
         /// 故障Topic
         /// </summary>
         public string FaultTopic { get; set; }
+        /// <summary>
+        /// OEE配置项
+        /// </summary>
+        public string OEEExtendSettings { get; set; }
     }
 }

+ 2 - 2
ProductionLineMonitor.Core/Services/ProductionLine/ProductionLineCoreService.cs

@@ -162,7 +162,7 @@ namespace ProductionLineMonitor.Core.Services
                    .GetList(x => x.ProductionLineId == production.Id)
                    .OrderBy(o => o.ProductionLineOrder).ToList();
 
-                if (production.Name != "H5 Chamber")
+                if (production.Name != "Y5 Chamber")
                 {
                     foreach (var machine in machines)
                     {
@@ -195,7 +195,7 @@ namespace ProductionLineMonitor.Core.Services
                             Children = null
                         });
                     }
-                    node.Children[0].Id = JsonConvert.SerializeObject(String.Join(",", chamberids));
+                    node.Children[0].Id = String.Join(",", chamberids);
                 }
 
 

+ 81 - 0
ProductionLineMonitor.Web/Controllers/EYZManufacturingPlatformController.cs

@@ -0,0 +1,81 @@
+using Microsoft.AspNetCore.Mvc;
+using ProductionLineMonitor.Application.Services.OEEService.Dtos;
+using System.Collections.Generic;
+using System;
+using ProductionLineMonitor.Application.Services.OEEService;
+using ProductionLineMonitor.Application.Services;
+using ProductionLineMonitor.Core.IRepositories;
+using ProductionLineMonitor.Core.Services;
+using ProductionLineMonitor.Core.Dtos;
+using System.Linq;
+using ProductionLineMonitor.Core.Models;
+
+namespace ProductionLineMonitor.Web.Controllers
+{
+    public class EYZManufacturingPlatformController : Controller
+    {
+        private readonly IReportFormService _reportFormService;
+        private readonly IOEEService _oeeService;
+        private readonly IExcelService _excelService;
+        private readonly IUnitOfWork _unitOfWork;
+        public EYZManufacturingPlatformController(
+            IReportFormService reportFormService,
+            IOEEService oeeService,
+            IExcelService excelService,
+            IUnitOfWork unitOfWork)
+        {
+            _reportFormService = reportFormService;
+            _oeeService = oeeService;
+            _excelService = excelService;
+            _unitOfWork = unitOfWork;
+        }
+
+        [HttpGet]
+        public IActionResult Y5OEE()
+        {
+            return View();
+        }
+
+        [HttpPost]
+        public IActionResult GetMachineStatisticV2(string id, DateTime startTime, DateTime endTime, int peroid)
+        {
+            //MachineOEE machine = new MachineOEE();
+            Dictionary<string, List<MachineOEEInfoByPeriod>> lst = new Dictionary<string, List<MachineOEEInfoByPeriod>>();
+            if (peroid == 3)
+            {
+                lst = _oeeService.GetOEEByPeriod(id,
+                startTime.ToString("yyyy-MM"), endTime.ToString("yyyy-MM"), peroid);
+            }
+            else
+            {
+                lst = _oeeService.GetOEEByPeriod(id,
+                startTime.ToString("yyyy-MM-dd"), endTime.ToString("yyyy-MM-dd"), peroid);
+            }
+
+            return Ok(ResultDto<Dictionary<string, List<MachineOEEInfoByPeriod>>>.Success(lst));
+        }
+
+        [HttpPost]
+        public IActionResult GetMachineStatisticV1(string id, DateTime startTime, DateTime endTime)
+        {
+            //MachineOEE machine = new MachineOEE();
+            List<MachineOEEInfo> lst = _oeeService.GetOEE(id,
+                startTime.ToString("yyyy-MM-dd"), endTime.ToString("yyyy-MM-dd"));
+            return Ok(ResultDto<List<MachineOEEInfo>>.Success(lst));
+        }
+
+        [HttpPost]
+        public IActionResult GetOEEExtendSetting(string id)
+        {
+            var machine = _unitOfWork.Repository<Machine>().GetList().Where(x => x.Id == id);
+            if (machine != null && machine.Count() != 0 && !String.IsNullOrEmpty(machine.First().OEEExtendSettings))
+            {
+                return Ok(ResultDto<string>.Success(machine.First().OEEExtendSettings));
+            }
+            else
+            {
+                return Ok(ResultDto<string>.Success(""));
+            }
+        }
+    }
+}

+ 19 - 1
ProductionLineMonitor.Web/Controllers/ReportFormController.cs

@@ -3,6 +3,7 @@ using ProductionLineMonitor.Application.Services;
 using ProductionLineMonitor.Application.Services.OEEService;
 using ProductionLineMonitor.Application.Services.OEEService.Dtos;
 using ProductionLineMonitor.Core.Dtos;
+using ProductionLineMonitor.Core.IRepositories;
 using ProductionLineMonitor.Core.Models;
 using ProductionLineMonitor.Core.Services;
 using ProductionLineMonitor.Core.Utils;
@@ -17,15 +18,18 @@ namespace ProductionLineMonitor.Web.Controllers
         private readonly IReportFormService _reportFormService;
         private readonly IOEEService _oeeService;
         private readonly IExcelService _excelService;
+        private readonly IUnitOfWork _unitOfWork;
 
         public ReportFormController(
             IReportFormService reportFormService,
             IOEEService oeeService,
-            IExcelService excelService)
+            IExcelService excelService,
+            IUnitOfWork unitOfWork)
         {
             _reportFormService = reportFormService;
             _oeeService = oeeService;
             _excelService = excelService;
+            _unitOfWork = unitOfWork;
         }
 
         [HttpGet]
@@ -88,6 +92,20 @@ namespace ProductionLineMonitor.Web.Controllers
             return Ok(ResultDto<Dictionary<string, List<MachineOEEInfoByPeriod>>>.Success(lst));
         }
 
+        [HttpPost]
+        public IActionResult GetOEEExtendSetting(string id)
+        {
+            var machine = _unitOfWork.Repository<Machine>().GetList().Where(x => x.Id == id);
+            if (machine != null && machine.Count() != 0 && !String.IsNullOrEmpty(machine.First().OEEExtendSettings))
+            {
+                return Ok(ResultDto<string>.Success(machine.First().OEEExtendSettings));
+            }
+            else
+            {
+                return Ok(ResultDto<string>.Success(""));
+            }
+        }
+
         private List<object[]> GetOee(string moduleType, IEnumerable<MachineStatistic> oees)
         {
             var result = new List<object[]>();

+ 144 - 0
ProductionLineMonitor.Web/Views/EYZManufacturingPlatform/Y5OEE.cshtml

@@ -0,0 +1,144 @@
+@{
+    Layout = null;
+}
+
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta http-equiv="cache-control" content="no-cache, must-revalidate">
+    <meta http-equiv="expires" content="0">
+    <meta name="google" content="notranslate" />
+    <meta http-equiv="Content-Language" content="zh-cn" />
+    <link rel="stylesheet" href="/lib/adminlte/bower/bootstrap/dist/css/bootstrap.min.css">
+    <link rel="stylesheet" href="/lib/adminlte/bower/font-awesome/css/font-awesome.min.css">
+    <link rel="stylesheet" href="/lib/adminlte/dist/css/AdminLTE.min.css">
+    <link rel="stylesheet" href="/lib/adminlte/dist/css/skins/skin-blue.min.css">
+    <script src="~/axios/axios.min.js"></script>
+    <script src="~/lib/vue/vue.min.js"></script>
+    <link rel="stylesheet" href="/css/site.css" asp-append-version="true" />
+    <link rel="stylesheet" href="~/lib/zTree.v3/css/zTreeStyle/zTreeStyle.min.css">
+    <link rel="stylesheet" href="~/lib/adminlte/bower/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css" />
+    <style>
+        table {
+            border-right: 1px solid WhiteSmoke;
+            border-bottom: 1px solid WhiteSmoke;
+            text-align: center;
+        }
+
+            table th {
+                border-left: 1px solid WhiteSmoke;
+                border-top: 1px solid WhiteSmoke;
+                text-align: center;
+            }
+
+            table td {
+                border-left: 1px solid WhiteSmoke;
+                border-top: 1px solid WhiteSmoke;
+            }
+    </style>
+</head>
+@* skin-blue sidebar-mini sidebar-collapse
+hold-transition skin-blue sidebar-mini *@
+<body id="main_body" class="skin-blue sidebar-mini sidebar-collapse">
+    <div class="wrapper">
+        <div class="content">
+
+            <div id="app" class="col-md-12">
+                <div class="box box-primary">
+                    <div class="box-body">
+                        <div class="col-md-1">
+                            <div class="over">
+                                <ul id="productionLineTree" class="ztree"></ul>
+                            </div>
+                        </div>
+                        <div class="col-md-11">
+                            <div id="form1" class="col-md-12">
+                                <div class="input-group input-daterange" style="width:400px;float:left;padding:0px">
+                                    <div class="input-group-addon">起止日期</div>
+                                    <input id="date1" type="text" class="form-control date" value="@DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd")">
+                                    <div class="input-group-addon">-</div>
+                                    <input id="date2" type="text" class="form-control date" value="@DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd")">
+                                </div>
+                                <div id="methodchoose" class="input-group input-daterange" style="width:200px;float:left;padding-left:15px">
+                                    <div class="input-group-addon">By</div>
+                                    <select id="selectMonth" class="form-control" v-on:change="selected()">
+                                        <option value="1">Day</option>
+                                        <option value="2">Week</option>
+                                        <option value="3">Month</option>
+                                    </select>
+                                </div>
+                                <div id="menuContent" style="position:absolute; display:none; z-index:10">
+                                    <ul id="treeDemo" class="ztree" style="margin-top:0; width:180px; height: 200px;"></ul>
+                                </div>
+                                <div class="col-md-1" style="padding-left:15px">
+                                    <div class="btn-group">
+                                        <button type="button" class="btn btn-block btn-default"
+                                                v-on:click="getOEES()">
+                                            <i class="fa fa-search"></i> 查询
+                                        </button>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="col-md-12" style="padding-top: 20px;">
+                                <div class="box-body">
+                                    <p class="text-center">
+                                        <strong>稼动曲线</strong>
+                                    </p>
+                                    <div id="container1"
+                                         style="height: 500px;">
+                                    </div>
+                                    <div id="container2"
+                                         class="col-md-6"
+                                         style="height: 500px;">
+                                    </div>
+
+                                    <div id="tbdata" class="col-md-12" style="padding-top: 10px;">
+                                        <p class="text-center">
+                                            {{ outputInfo }}
+                                        </p>
+                                        <table id="data" height="500px" style="margin-left: 4px;margin:auto">
+                                            <thead>
+                                                <tr>
+                                                    <th style="width: 10%">时段</th>
+                                                    <th style="width: 10%">机种</th>
+                                                    <th style="width: 10%">运行时间</th>
+                                                    <th style="width: 10%">报警时间</th>
+                                                    <th style="width: 10%">待料时间</th>
+                                                </tr>
+                                            </thead>
+                                            <tbody>
+                                                <tr v-for="(output, index) in outputs">
+                                                    <td>{{ output.period }}</td>
+                                                    <td>{{ output.moduleType }}</td>
+                                                    <td>{{ }}</td>
+                                                    <td>{{ }}</td>
+                                                    <td>{{ }}</td>
+                                                </tr>
+                                            </tbody>
+                                        </table>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+    <script src="~/lib/adminlte/bower/jquery/dist/jquery.min.js"></script>
+    <script src="~/lib/adminlte/bower/bootstrap/dist/js/bootstrap.min.js"></script>
+    <script src="~/lib/adminlte/dist/js/adminlte.min.js"></script>
+    <script src="~/js/adminlte-extend.js"></script>
+    <script src="~/js/site.js" asp-append-version="true"></script>
+    <script src="/lib/zTree.v3/js/jquery.ztree.core.min.js"></script>
+    <script src="~/lib/xlsx/xlsx.full.min.js"></script>
+    <script src="~/lib/adminlte/bower/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
+    <script src="~/lib/adminlte/bower/bootstrap-datepicker/js/locales/bootstrap-datepicker.zh-cn.js"></script>
+    <script src="~/lib/echarts/echarts.min.js"></script>
+    <script src="~/lib/ztree.v3/js/jquery.ztree.excheck.min.js"></script>
+    <script src="~/lib/moment.js/moment-with-locales.min.js"></script>
+    <script src="~/js/eyz-manufacturing-platform/eyz-manufacturing-platform.js"></script>
+</body>
+</html>

+ 12 - 0
ProductionLineMonitor.Web/Views/EYZManufacturingPlatform/Y5OEE.cshtml.cs

@@ -0,0 +1,12 @@
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.RazorPages;
+
+namespace ProductionLineMonitor.Web.Views.EYZManufacturingPlatform
+{
+    public class Y5OEEModel : PageModel
+    {
+        public void OnGet()
+        {
+        }
+    }
+}

+ 41 - 5
ProductionLineMonitor.Web/Views/ReportForm/Index.cshtml

@@ -73,13 +73,49 @@
                             <strong>稼动曲线</strong>
                         </p>
                         <div id="container1"
-                             style="height: 400px;">
+                             style="height: 500px;">
+                        </div>
+                        <div id="container2"
+                             class="col-md-6"
+                            style="height: 500px;">
+                         </div>
+
+                        <div id="tbdata" class="col-md-12" style="padding-top: 10px;">
+                            <p class="text-center">
+                                {{ outputInfo }}
+                            </p>
+                            <table id="data" height="500px" style="margin-left: 4px">
+                                <thead>
+                                    <tr>
+                                        <th style="width: 10%">时段</th>
+                                        <th style="width: 10%">机种</th>
+                                        <th style="width: 10%">运行时间</th>
+                                        <th style="width: 10%">报警时间</th>
+                                        <th style="width: 10%">待料时间</th>
+                                        <th style="width: 10%">换料时间</th>
+                                        <th style="width: 10%">产能</th>
+                                        <th style="width: 10%">TT</th>
+                                        <th style="width: 10%">报警次数</th>
+                                    </tr>
+                                </thead>
+                                <tbody>
+                                    <tr v-for="(output, index) in outputs">
+                                        <td>{{ output.period }}</td>
+                                        <td>{{ output.moduleType }}</td>
+                                        <td>{{ Math.round(output.autoRunTime/60*10)/10 }}</td>
+                                        <td>{{ Math.round(output.alarmTime/60*10)/10 }}</td>
+                                        <td>{{ Math.round(output.idleTime/60*10)/10 }}</td>
+                                        <td>{{ Math.round(output.loadMATTime/60*10)/10 }}</td>
+                                        <td>{{ output.outPut }}</td>
+                                        <td>{{ output.tt }}</td>
+                                        <td>{{ output.alarmSum }}</td>
+                                    </tr>
+                                </tbody>
+                            </table>
                         </div>
-                        @*  <div id="container2" style="height: 280px">
-                        </div> *@
                     </div>
                 </div>
-                <div class="col-md-6" style="padding-top: 10px;">
+                @* <div class="col-md-6" style="padding-top: 10px;">
                     <p class="text-center">
                         日期:{{ outputInfo }}
                     </p>
@@ -111,7 +147,7 @@
                             </tr>
                         </tbody>
                     </table>
-                </div>
+                 </div> *@
             </div>
         </div>
     </div>

+ 1135 - 0
ProductionLineMonitor.Web/wwwroot/js/EYZ-manufacturing-platform/EYZ-manufacturing-platform.js

@@ -0,0 +1,1135 @@
+var vm = new Vue({
+    el: '#app',
+    data: {
+        dom: Object,
+        myChart: Object,
+        myChart_2: Object,
+        option_1: Object,
+        option_2: Object,
+        option_3: Object,
+
+        oees_1: [],
+        oees_2: [],
+        mode: 1,//1为正常,2为chamber汇总
+        outputInfo: '',
+        outputs: [],
+        CheckedChamber: [{ "id": "5EFFEA4F-AD8F-463F-95DC-0A123572901E", "name": "Chamber 01", "open": false, "children": null }, { "id": "04F6759F-BFE2-4BDE-999F-C8AE2AE92C05", "name": "Chamber 02", "open": false, "children": null }, { "id": "3647CB82-C0DA-4864-A2C2-387FDED2D95A", "name": "Chamber 03", "open": false, "children": null }, { "id": "3AB1B8F9-4180-4DB0-AA8D-8C6BD2104FC4", "name": "Chamber 04", "open": false, "children": null }, { "id": "84F56A7A-7928-4AFF-9F30-B1BE4666F7D5", "name": "Chamber 05", "open": false, "children": null }, { "id": "22852C0C-DB89-4F59-8ADA-5CDE557EF150", "name": "Chamber 06", "open": false, "children": null }, { "id": "821B6F54-10D7-465D-846B-AA1CFC874954", "name": "Chamber 07", "open": false, "children": null }, { "id": "0E61855E-44CB-462E-A497-B8D436583237", "name": "Chamber 08", "open": false, "children": null }, { "id": "1F7FDE85-F6C4-4977-80A6-960F89FD24FD", "name": "Chamber 09", "open": false, "children": null }],
+        EchartsDataIndex: 0,
+        param_temp : {
+            dataIndex: 0,
+            name: "",
+            componentType :'series',
+            seriesName:''
+        },
+
+        OEEExtendSetting1: ["", "", ""],
+        OEEExtendSetting2: ["", "", "", "", ""],
+
+        machine: "",
+        machineid: ""
+
+    },
+    mounted() {
+        this.init();
+        this.getOEES();
+        this.getOutputs(this.param_temp, this.mode);
+    },
+    methods: {
+        init() {
+            const searchParams = new URLSearchParams(window.location.search);
+            this.machine = searchParams.get('machine');
+            if (this.machine == "Y5Front") {
+                this.machineid = "9E812380-A9BD-4C8B-96A0-6BACB928498F";
+                $("#methodchoose").hide();
+                $("#container2").hide();
+                $(".date").datepicker("destroy");
+                $(".date").datepicker({
+                    minViewMode: 'days',
+                    format: 'yyyy-mm-dd',
+                    language: 'zh-CN',
+                    autoclose: true,
+                    todayBtn: 'linked'
+                }).on('changeDate', function () {
+
+                }).on('keydown', function (e) {
+                    return false;
+                });
+                var date1 = new Date(new Date().setDate(new Date().getDate() - 7));
+                var date2 = new Date(new Date().setDate(new Date().getDate() - 1));
+                var date1_1 = moment(date1);
+                var date2_1 = moment(date2);
+                $("#date1").val(date1_1.format('YYYY-MM-DD'));
+                $("#date2").val(date2_1.format('YYYY-MM-DD'));
+            }
+            else if (this.machine == "Y5Chamber") {
+                this.machineid = "5EFFEA4F-AD8F-463F-95DC-0A123572901E,04F6759F-BFE2-4BDE-999F-C8AE2AE92C05,3647CB82-C0DA-4864-A2C2-387FDED2D95A,3AB1B8F9-4180-4DB0-AA8D-8C6BD2104FC4,84F56A7A-7928-4AFF-9F30-B1BE4666F7D5,22852C0C-DB89-4F59-8ADA-5CDE557EF150,821B6F54-10D7-465D-846B-AA1CFC874954,0E61855E-44CB-462E-A497-B8D436583237,1F7FDE85-F6C4-4977-80A6-960F89FD24FD";
+                $("#methodchoose").show();
+                this.selected();
+            }
+            else if (this.machine == "Y5Back") {
+                this.machineid = "7d8cbeed-ce3c-442a-8a58-5e0242b1a488"; $("#devicechoose").hide();
+                $("#methodchoose").hide();
+                $("#container2").hide();
+                $(".date").datepicker("destroy");
+                $(".date").datepicker({
+                    minViewMode: 'days',
+                    format: 'yyyy-mm-dd',
+                    language: 'zh-CN',
+                    autoclose: true,
+                    todayBtn: 'linked'
+                }).on('changeDate', function () {
+
+                }).on('keydown', function (e) {
+                    return false;
+                });
+                var date1 = new Date(new Date().setDate(new Date().getDate() - 7));
+                var date2 = new Date(new Date().setDate(new Date().getDate() - 1));
+                var date1_1 = moment(date1);
+                var date2_1 = moment(date2);
+                $("#date1").val(date1_1.format('YYYY-MM-DD'));
+                $("#date2").val(date2_1.format('YYYY-MM-DD'));
+            }
+            $("#container2").hide();
+
+            this.outputs = [
+                {
+
+                }
+            ];
+
+            $(".date").datepicker({
+                format: 'yyyy-mm-dd',
+                language: 'zh-CN',
+                autoclose: true,
+                todayBtn: 'linked'
+            }).on('changeDate', function () {
+
+            }).on('keydown', function (e) {
+                return false;
+            });
+
+            //zTreeObj = $.fn.zTree.init($("#treeDemo"), settings, res); //初始化树
+            //zTreeObj.expandAll(true);   //true 节点全部展开、false节点收缩
+
+            this.dom = document.getElementById('container1');
+            this.myChart = echarts.init(this.dom, 'vintage', {
+                renderer: 'canvas',
+                useDirtyRect: false
+            });
+            this.dom_2 = document.getElementById('container2');
+            this.myChart_2 = echarts.init(this.dom_2, 'vintage', {
+                renderer: 'canvas',
+                useDirtyRect: false
+            });
+            this.option_1 = {
+                grid: {
+                    left: '4%',
+                    right: '10%',
+                },
+                tooltip: {
+                    trigger: 'axis',
+                    axisPointer: {
+                        type: 'cross',
+                        crossStyle: {
+                            color: '#999'
+                        }
+                    }
+                },
+                toolbox: {
+                    right: '10%',
+                    feature: {
+                        dataZoom: { yAxisIndex: 'none' },
+                        mySaveAsExcel: {
+                            show: true,
+                            title: 'save excel',
+                            icon: 'M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0',
+                            onclick: () => {
+                                this.exportExcelTemplate();
+                            }
+                        }
+                    },
+                    iconStyle: {
+                        borderColor: "white",
+                    },
+                },
+                color: ['#5b9bd5', '#ed7d31', '#a5a5a5', '#008080', '#546fc6'],
+                xAxis: {
+                    type: 'category',
+                    data: [],
+                    axisLabel: {
+                        color: 'white',
+                        fontSize: 14
+                    }
+                },
+                yAxis: [
+                    {
+                        type: 'value',
+                        max: 100,
+                        axisLabel: {
+                            color: 'white',
+                            fontSize: 14,
+                            formatter: '{value} %'
+                        },
+                        splitLine: {
+                            show: true, // 是否显示轴线
+                            lineStyle: {
+                                color: '#e0e6f1', // 刻度线的颜色
+                                width: 1, // 刻度线的宽度
+                                type: 'dashed' // 刻度线的类型
+                            }
+                        }
+                    },
+                    {
+                        type: 'value',
+                        //max: 8000,
+                        axisLabel: {
+                            color: 'white',
+                            fontSize: 14,
+                            formatter: '{value} pcs'
+                        },
+                        splitLine: {
+                            show: false, // 是否显示轴线
+                            lineStyle: {
+                                color: '#e0e6f1', // 刻度线的颜色
+                                width: 1, // 刻度线的宽度
+                                type: 'dashed' // 刻度线的类型
+                            }
+                        }
+                    }
+                ],
+                legend: {
+                    data: ['稼动率', '待料率', '报警率', '换料率', '产能'],
+                    textStyle: {
+                        color: 'white',
+                        fontSize: 14
+                    }
+                },
+                series: []
+            };
+            this.option_2 = {
+                title: {
+                    left: 'center',
+                    text: 'Y5 Chamber 9台平均稼动率',
+                    textStyle: {
+                        color: "white"
+                    }
+                },
+                grid: {
+                    left: '4%',
+                    right: '10%',
+                },
+                tooltip: {
+                    trigger: 'axis',
+                    axisPointer: {
+                        type: 'cross',
+                        crossStyle: {
+                            color: '#999'
+                        }
+                    }
+                },
+                toolbox: {
+                    right: '10%',
+                    feature: {
+                        dataZoom: { yAxisIndex: 'none' }
+                    },
+                    iconStyle: {
+                        borderColor: "white",
+                    },
+                },
+                color: ['#5b9bd5', '#ed7d31', '#a5a5a5', '#008080', '#546fc6'],
+                xAxis: {
+                    type: 'category',
+                    data: [],
+                    axisLabel: {
+                        color: 'white',
+                        fontSize: 14
+                    }
+                },
+                yAxis: [
+                    {
+                        type: 'value',
+                        max: function (value) {
+                            var val = Math.ceil(value.max * 1.2);
+                            if (val >= 100) {
+                                return 100;
+                            }
+                            else {
+                                return val;
+                            }
+                        },
+                        axisLabel: {
+                            color: 'white',
+                            fontSize: 14,
+                            formatter: '{value} %'
+                        },
+                        splitLine: {
+                            show: true, // 是否显示轴线
+                            lineStyle: {
+                                color: '#e0e6f1', // 刻度线的颜色
+                                width: 1, // 刻度线的宽度
+                                type: 'dashed' // 刻度线的类型
+                            }
+                        }
+                    },
+                    {
+                        type: 'value',
+                        //max: 8000,
+                        axisLabel: {
+                            color: 'white',
+                            fontSize: 14,
+                            formatter: '{value} %'
+                        },
+                        splitLine: {
+                            show: false, // 是否显示轴线
+                            lineStyle: {
+                                color: '#e0e6f1', // 刻度线的颜色
+                                width: 1, // 刻度线的宽度
+                                type: 'dashed' // 刻度线的类型
+                            }
+                        }
+                    }
+                ],
+                legend: {
+                    data: ['平均稼动率', '平均待料率', '平均故障率'],
+                    textStyle: {
+                        color: 'white',
+                        fontSize: 14
+                    },
+                    "top": "5.5%"
+                },
+                series: [
+                ]
+            };
+            this.option_3 = {
+                title: {
+                    left: 'center',
+                    text: 'Y5 Chamber 单台稼动率明细',
+                    textStyle: {
+                        color: "white"
+                    }
+                },
+                grid: {
+                    left: '10%',
+                    right: '10%',
+                },
+                tooltip: {
+                    trigger: 'axis',
+                    axisPointer: {
+                        type: 'cross',
+                        crossStyle: {
+                            color: '#999'
+                        }
+                    }
+                },
+                toolbox: {
+                    right: '10%',
+                    feature: {
+                        dataZoom: { yAxisIndex: 'none' }
+                    },
+                    iconStyle: {
+                        borderColor: "white",
+                    },
+                },
+                color: ['#5b9bd5', '#ed7d31', '#a5a5a5', '#008080', '#546fc6'],
+                xAxis: {
+                    type: 'category',
+                    data: [],
+                    axisLabel: {
+                        color: 'white',
+                        fontSize: 14,
+                        interval: 0,
+                        rotate: 30
+                    }
+                },
+                yAxis: [
+                    {
+                        type: 'value',
+                        max: function (value) {
+                            var val = Math.ceil(value.max * 1.2);
+                            if (val >= 100) {
+                                return 100;
+                            }
+                            else {
+                                return val;
+                            }
+                        },
+                        axisLabel: {
+                            color: 'white',
+                            fontSize: 14,
+                            formatter: '{value} %'
+                        },
+                        splitLine: {
+                            show: true, // 是否显示轴线
+                            lineStyle: {
+                                color: '#e0e6f1', // 刻度线的颜色
+                                width: 1, // 刻度线的宽度
+                                type: 'dashed' // 刻度线的类型
+                            }
+                        }
+                    },
+                    {
+                        type: 'value',
+                        //max: 8000,
+                        axisLabel: {
+                            color: 'white',
+                            fontSize: 14,
+                            formatter: '{value} %'
+                        },
+                        splitLine: {
+                            show: false, // 是否显示轴线
+                            lineStyle: {
+                                color: '#e0e6f1', // 刻度线的颜色
+                                width: 1, // 刻度线的宽度
+                                type: 'dashed' // 刻度线的类型
+                            }
+                        }
+                    }
+                ],
+                legend: {
+                    data: ['稼动率', '待机率', '故障率'],
+                    textStyle: {
+                        color: 'white',
+                        fontSize: 14
+                    },
+                    "top": "5.5%"
+                },
+                series: [
+                    {
+                        type: 'value',
+                        name: '稼动率',
+                        data: [],
+                        type: 'bar',
+                        stack: "stack1",
+                        label: {
+                            show: true,
+                            color: 'white',
+                            fontSize: 12
+                        }
+                    },
+                    {
+                        type: 'value',
+                        name: '待机率',
+                        data: [],
+                        type: 'bar',
+                        stack: "stack1",
+                        label: {
+                            show: true,
+                            color: 'white',
+                            fontSize: 12
+                        }
+                    },
+                    {
+                        type: 'value',
+                        name: '故障率',
+                        data: [],
+                        type: 'bar',
+                        stack: "stack1",
+                        label: {
+                            show: true,
+                            color: 'white',
+                            fontSize: 12
+                        }
+                    }
+                ]
+            };
+            this.myChart.on('click', (params) => this.getOutputs(params, this.mode));
+            if (this.option_1 && typeof option_1 === 'object') {
+                this.myChart.setOption(this.option_1);
+            }
+            if (this.option_2 && typeof option_2 === 'object') {
+                this.myChart.setOption(this.option_2);
+            }
+            this.myChart_2.on('click', (params) => this.getOutputs(params, this.mode));
+            if (this.option_3 && typeof option_3 === 'object') {
+                this.myChart_2.setOption(this.option_3);
+            }
+            window.addEventListener('resize', this.myChart.resize);
+            window.addEventListener('resize', this.myChart_2.resize);
+        },
+        getOutputs(params, mode) {
+            console.log(params);
+            if (params.componentType == 'series') {
+                var oee;
+                if (mode == 1) {
+                    console.log(this.oees_1)
+                    $("#tbdata").attr("class", "col-md-12");
+                    oee = this.oees_1[params.dataIndex];
+                    this.outputInfo = oee.date + ' ' + oee.shift;
+                    this.outputs = [];
+                    this.outputs = oee.outPutPerHours;
+                    var flagList = [false, false, false, false, false];
+                    var num = 8;
+                    for (let i = 0; i < this.OEEExtendSetting2.length; i++) {
+                        if (this.OEEExtendSetting2[i] != "") {
+                            flagList[i] = true;
+                            num++;
+                        }
+                    }
+                    var width = 62 / (num - 4);
+                    var htmlstr = '<thead>< tr >'
+                        + '<th style="width: 10%">时段</th>'
+                        + '<th style="width: 10%">机种</th>'
+                        + '<th style="width: ' + width + '%">运行时间</th>'
+                        + '<th style="width: ' + width + '%">报警时间</th>'
+                        + '<th style="width: ' + width + '%">待料时间</th>';
+                    for (let i = 0; i < flagList.length; i++) {
+                        if (i == 3) {
+                            htmlstr += '<th style="width: 10%">报警次数</th>';
+                        }
+                        if (flagList[i]) {
+                            htmlstr = htmlstr + '<th style="width: ' + width + '%">' + this.OEEExtendSetting2[i] + '</th>';
+                        }
+                    }
+
+                    var moduleTypelist = [];
+                    var numlist = [0, 0, 0];
+                    htmlstr = htmlstr
+                        + ' <th style = "width: 8%"> 产能</th> '
+                        + '<th style="width: 8%">TT</th>';
+                    for (var item in this.outputs) {
+                        if (!moduleTypelist.includes(this.outputs[item].moduleType)) {
+                            moduleTypelist.push(this.outputs[item].moduleType);
+                        }
+                        htmlstr = htmlstr + '<tbody><tr>'
+                            + '<td>' + this.outputs[item].period + '</td>'
+                            + '<td>' + this.outputs[item].moduleType + '</td>'
+                            + '<td>' + Math.round(this.outputs[item].autoRunTime / 60 * 10) / 10 + '</td>'
+                            + '<td>' + Math.round(this.outputs[item].alarmTime / 60 * 10) / 10 + '</td>'
+                            + '<td>' + Math.round(this.outputs[item].idleTime / 60 * 10) / 10 + '</td>';
+                        if (flagList[0]) {
+                            htmlstr = htmlstr + '<td>' + Math.round(this.outputs[item].loadMATTime / 60 * 10) / 10 + '</td>';
+                        }
+                        if (flagList[1]) {
+                            htmlstr = htmlstr + '<td>' + Math.round(this.outputs[item].reservedOne / 60 * 10) / 10 + '</td>';
+                        }
+                        if (flagList[2]) {
+                            htmlstr = htmlstr + '<td>' + Math.round(this.outputs[item].reservedThree / 60 * 10) / 10 + '</td>';
+                        }
+                        htmlstr = htmlstr + '<td>' + this.outputs[item].alarmSum + '</td>';
+                        numlist[0] += this.outputs[item].alarmSum;
+                        if (flagList[3]) {
+                            numlist[1] += this.outputs[item].loadMATSum;
+                            htmlstr = htmlstr + '<td>' + this.outputs[item].loadMATSum + '</td>';
+                        }
+                        if (flagList[4]) {
+                            numlist[2] += this.outputs[item].reservedTwo;
+                            htmlstr = htmlstr + '<td>' + this.outputs[item].reservedTwo + '</td>';
+                        }
+                        htmlstr = htmlstr + '<td>' + this.outputs[item].outPut + '</td>'
+                            + '<td>' + this.outputs[item].tt + '</td>'
+                            + '</tr></tbody>';
+                    }
+                    htmlstr = htmlstr + '<tbody><tr>'
+                        + '<td>合计</td>'
+                        + '<td>' + moduleTypelist.toString() + '</td>'
+                        + '<td>' + Math.round(oee.runTime / 60 * 10) / 10 + '</td>'
+                        + '<td>' + Math.round(oee.downTime / 60 * 10) / 10 + '</td>'
+                        + '<td>' + Math.round(oee.idelTime / 60 * 10) / 10 + '</td>';
+                    if (flagList[0]) {
+                        htmlstr = htmlstr + '<td>' + Math.round(oee.loadMATTime / 60 * 10) / 10 + '</td>';
+                    }
+                    if (flagList[1]) {
+                        htmlstr = htmlstr + '<td>' + Math.round(oee.reservedOne / 60 * 10) / 10 + '</td>';
+                    }
+                    if (flagList[2]) {
+                        htmlstr = htmlstr + '<td>' + Math.round(oee.reservedThree / 60 * 10) / 10 + '</td>';
+                    }
+                    htmlstr = htmlstr + '<td>' + numlist[0] + '</td>';
+                    if (flagList[3]) {
+                        htmlstr = htmlstr + '<td>' + numlist[1] + '</td>';
+                    }
+                    if (flagList[4]) {
+                        htmlstr = htmlstr + '<td>' + numlist[2] + '</td>';
+                    }
+                    var TT = 0;
+                    if (oee.outputs != 0) {
+                        TT = Math.round(oee.runTime / oee.outputs * 10) / 10;
+                    }
+                    htmlstr = htmlstr
+                        + '<td>' + oee.outputs + '</td>'
+                        + '<td>' + TT + '</td>'
+                        + '</tr></tbody>';
+                    $("#data").html(htmlstr);
+                }
+                else if (mode == 2) {
+                    $("#tbdata").attr("class", "col-md-5");
+                    if (params.seriesName == "平均稼动率" || params.seriesName == "平均待料率" || params.seriesName == "平均故障率") {
+                        this.EchartsDataIndex = params.dataIndex;
+                        var runratedata = [];
+                        var idleratedata = [];
+                        var downratedata = [];
+                        var x_data = [];
+                        var outputs_temp = {};
+
+                        for (var item in this.oees_2) {
+                            for (var item2 in this.CheckedChamber) {
+                                if (item == this.CheckedChamber[item2].id) {
+                                    x_data.push(this.CheckedChamber[item2].name);
+                                    break;
+                                }
+                            }
+                            var outputperhours = this.oees_2[item][params.dataIndex].outPutPerHours;
+                            for (var item3 in outputperhours) {
+                                if (outputperhours[item3].dataTime in outputs_temp) {
+                                    outputs_temp[outputperhours[item3].dataTime].autoRunTime += outputperhours[item3].autoRunTime;
+                                    outputs_temp[outputperhours[item3].dataTime].idleTime += outputperhours[item3].idleTime;
+                                    outputs_temp[outputperhours[item3].dataTime].alarmTime += outputperhours[item3].alarmTime;
+                                }
+                                else {
+                                    outputs_temp[outputperhours[item3].dataTime] = {
+                                        "period": outputperhours[item3].period,
+                                        "dataTime": outputperhours[item3].dataTime,
+                                        "moduleType": outputperhours[item3].moduleType,
+                                        "autoRunTime": outputperhours[item3].autoRunTime,
+                                        "idleTime": outputperhours[item3].idleTime,
+                                        "alarmTime": outputperhours[item3].alarmTime
+                                    }
+                                }
+                            }
+                            runratedata.push(this.oees_2[item][params.dataIndex].runTimeRate);
+                            idleratedata.push(this.oees_2[item][params.dataIndex].idelTimeRate);
+                            downratedata.push(this.oees_2[item][params.dataIndex].downTimeRate);
+                        }
+                        this.option_3.series[0].data = runratedata;
+                        this.option_3.series[1].data = idleratedata;
+                        this.option_3.series[2].data = downratedata;
+                        this.option_3.xAxis.data = x_data;
+
+                        $("#container2").show();
+
+                        this.myChart_2.clear();
+                        this.myChart_2.setOption(this.option_3, true);//true重绘
+                        this.myChart_2.resize();
+
+
+                        this.outputInfo = params.name + "【汇总】";
+                        var htmlstr = '<thead>< tr >'
+                            + '<th style="width: 10%">时间</th>'
+                            + '<th style="width: 10%">机种</th>'
+                            + '<th style="width: 10%">运行时间</th>'
+                            + '<th style="width: 10%">故障时间</th>'
+                            + '<th style="width: 10%">待料时间</th>'
+                        if ($("#selectMonth").val() == 1) {
+                            for (var item in outputs_temp) {
+                                htmlstr = htmlstr + '<tbody><tr>'
+                                    + '<td>' + outputs_temp[item].period + '</td>'
+                                    + '<td>' + outputs_temp[item].moduleType + '</td>'
+                                    + '<td>' + Math.round(outputs_temp[item].autoRunTime / 60 * 10) / 10 + '</td>'
+                                    + '<td>' + Math.round(outputs_temp[item].alarmTime / 60 * 10) / 10 + '</td>'
+                                    + '<td>' + Math.round(outputs_temp[item].idleTime / 60 * 10) / 10 + '</td>'
+                                    + '</tr></tbody>';
+                            }
+                        }
+                        else {
+                            for (var item in outputs_temp) {
+                                var datetime = moment(outputs_temp[item].dataTime);
+                                htmlstr = htmlstr + '<tbody><tr>'
+                                    + '<td>' + datetime.format('YYYY-MM-DD') + '</td>'
+                                    + '<td>' + outputs_temp[item].moduleType + '</td>'
+                                    + '<td>' + Math.round(outputs_temp[item].autoRunTime / 60 * 10) / 10 + '</td>'
+                                    + '<td>' + Math.round(outputs_temp[item].alarmTime / 60 * 10) / 10 + '</td>'
+                                    + '<td>' + Math.round(outputs_temp[item].idleTime / 60 * 10) / 10 + '</td>'
+                                    + '</tr></tbody>';
+                            }
+                        }
+                        $("#data").html(htmlstr);
+                    }
+                    else {
+                        var outputperhours = this.oees_2[Object.keys(this.oees_2)[params.dataIndex]][this.EchartsDataIndex].outPutPerHours;
+                        var datetimestr = this.oees_2[Object.keys(this.oees_2)[params.dataIndex]][this.EchartsDataIndex].date;
+                        this.outputInfo = datetimestr + "【" + params.name + "】";
+                        var htmlstr = '<thead>< tr >'
+                            + '<th style="width: 10%">时间</th>'
+                            + '<th style="width: 10%">机种</th>'
+                            + '<th style="width: 10%">运行时间</th>'
+                            + '<th style="width: 10%">报警时间</th>'
+                            + '<th style="width: 10%">待料时间</th>'
+                        if ($("#selectMonth").val() == 1) {
+                            for (var item in outputperhours) {
+                                htmlstr = htmlstr + '<tbody><tr>'
+                                    + '<td>' + outputperhours[item].period + '</td>'
+                                    + '<td>' + outputperhours[item].moduleType + '</td>'
+                                    + '<td>' + Math.round(outputperhours[item].autoRunTime / 60 * 10) / 10 + '</td>'
+                                    + '<td>' + Math.round(outputperhours[item].alarmTime / 60 * 10) / 10 + '</td>'
+                                    + '<td>' + Math.round(outputperhours[item].idleTime / 60 * 10) / 10 + '</td>'
+                                    + '</tr></tbody>';
+                            }
+                        }
+                        else {
+                            for (var item in outputperhours) {
+                                var datetime = moment(outputperhours[item].dataTime);
+                                htmlstr = htmlstr + '<tbody><tr>'
+                                    + '<td>' + datetime.format('YYYY-MM-DD') + '</td>'
+                                    + '<td>' + outputperhours[item].moduleType + '</td>'
+                                    + '<td>' + Math.round(outputperhours[item].autoRunTime / 60 * 10) / 10 + '</td>'
+                                    + '<td>' + Math.round(outputperhours[item].alarmTime / 60 * 10) / 10 + '</td>'
+                                    + '<td>' + Math.round(outputperhours[item].idleTime / 60 * 10) / 10 + '</td>'
+                                    + '</tr></tbody>';
+                            }
+                        }
+                        $("#data").html(htmlstr);
+                    }
+                }
+            }
+        },
+        getOEES() {
+            if ($("#menuContent").css("display") == "block") {
+                $("#menuContent").css("display", "none");
+            }
+            let _this = this
+            if (_this.machine == "Y5Chamber") {
+                _this.mode = 2;
+                _this.param_temp.dataIndex = 14;
+                $("#methodchoose").show();
+                if ($("#selectMonth").val() == 1 && Math.floor(Math.abs(Date.parse($("#date2").val()) - Date.parse($("#date1").val())) / (1000 * 3600 * 24)) > 14) {
+                    alert("按天统计时,不可超过15日!!");
+                    return;
+                }
+                $.ajax({
+                    url: '/EYZManufacturingPlatform/GetMachineStatisticV2',
+                    type: 'POST',
+                    async: false,
+                    data: {
+                        "id": _this.machineid,
+                        "startTime": $("#date1").val(),
+                        "endTime": $("#date2").val(),
+                        "peroid": $("#selectMonth").val()
+                    },
+                    success: function (rev) {
+                        if (rev.code === 0) {
+                            _this.oees_2 = rev.data;
+                            var xData = [];
+                            _this.option_2.series = [];
+                            var chambernum = 0;
+                            var avgrunrate = [];
+                            var avgidlerate = [];
+                            var avgdownrate = [];
+                            for (var i in rev.data) {
+                                for (var k in rev.data[i]) {
+                                    if (chambernum == 0) {
+                                        xData.push(rev.data[i][k].date);
+                                        avgrunrate.push(rev.data[i][k].runTimeRate);
+                                        avgidlerate.push(rev.data[i][k].idelTimeRate);
+                                        avgdownrate.push(rev.data[i][k].downTimeRate);
+                                    }
+                                    else {
+                                        avgrunrate[k] += rev.data[i][k].runTimeRate;
+                                        avgidlerate[k] += rev.data[i][k].idelTimeRate;
+                                        avgdownrate[k] += rev.data[i][k].downTimeRate;
+                                    }
+                                }
+                                chambernum++;
+                            }
+                            for (var item in avgrunrate) {
+                                avgrunrate[item] = (avgrunrate[item] / chambernum).toFixed(1);
+                                avgidlerate[item] = (avgidlerate[item] / chambernum).toFixed(1);
+                                avgdownrate[item] = (avgdownrate[item] / chambernum).toFixed(1);
+                            }
+                            _this.option_2.series.push({
+                                type: 'value',
+                                name: '平均稼动率',
+                                data: avgrunrate,
+                                type: 'bar',
+                                stack: "stack1",
+                                label: {
+                                    show: true,
+                                    color: 'white',
+                                    fontSize: 12
+                                }
+                            })
+                            _this.option_2.series.push({
+                                type: 'value',
+                                name: '平均待料率',
+                                data: avgidlerate,
+                                type: 'bar',
+                                stack: "stack1",
+                                label: {
+                                    show: true,
+                                    color: 'white',
+                                    fontSize: 12
+                                }
+                            })
+                            _this.option_2.series.push({
+                                type: 'value',
+                                name: '平均故障率',
+                                data: avgdownrate,
+                                type: 'bar',
+                                stack: "stack1",
+                                label: {
+                                    show: true,
+                                    color: 'white',
+                                    fontSize: 12
+                                }
+                            })
+                            _this.option_2.xAxis.data = xData;
+                            _this.myChart.clear();
+                            _this.myChart.setOption(_this.option_2, true);//true重绘
+                            _this.param_temp.dataIndex = xData.length - 1;
+                            _this.param_temp.seriesName = '平均稼动率';
+                            _this.param_temp.name = xData[xData.length - 1];
+
+                        } else {
+                            alert(rev.message);
+                        }
+                    }
+                });
+            }
+            else {
+                this.mode = 1;
+                $("#methodchoose").hide();
+                $.ajax({
+                    url: '/EYZManufacturingPlatform/GetMachineStatisticV1',
+                    type: 'POST',
+                    async: false,
+                    data: {
+                        "id": _this.machineid,
+                        "startTime": $("#date1").val(),
+                        "endTime": $("#date2").val()
+                    },
+                    success: function (rev) {
+                        if (rev.code === 0) {
+                            $.ajax({
+                                url: '/EYZManufacturingPlatform/GetOEEExtendSetting',
+                                type: 'POST',
+                                async: false,
+                                data: {
+                                    "id": _this.machineid
+                                },
+                                success: function (rst) {
+                                    if (rst.code != 0 || rst.data == "") {
+                                        _this.OEEExtendSetting1 = ["", "", ""];
+                                        _this.OEEExtendSetting2 = ["", "", "", "", ""];
+                                    }
+                                    else {
+                                        var settinglist = rst.data.split(",");
+                                        _this.OEEExtendSetting1 = ["", "", ""];
+                                        _this.OEEExtendSetting2 = ["", "", "", "", ""];
+                                        if (settinglist[0] != '') {
+                                            if (settinglist[0] == "换料时间") {
+                                                _this.OEEExtendSetting1[0] = "换料率";
+                                                _this.OEEExtendSetting2[0] = "换料时间";
+                                            }
+                                            else {
+                                                _this.OEEExtendSetting1[0] = settinglist[0] + "占比";
+                                                _this.OEEExtendSetting2[0] = settinglist[0];
+                                            }
+                                        }
+                                        if (settinglist[2] != "") {
+                                            _this.OEEExtendSetting1[1] = settinglist[2] + "占比";
+                                            _this.OEEExtendSetting2[1] = settinglist[2];
+                                        }
+                                        if (settinglist[4] != "") {
+                                            _this.OEEExtendSetting1[2] = settinglist[4] + "占比";
+                                            _this.OEEExtendSetting2[2] = settinglist[4];
+                                        }
+                                        if (settinglist[1] != "") {
+                                            _this.OEEExtendSetting2[3] = settinglist[1];
+                                        }
+                                        if (settinglist[3] != "") {
+                                            _this.OEEExtendSetting2[4] = settinglist[3];
+                                        }
+                                    }
+                                }
+                            })
+                            _this.oees_1 = rev.data;
+                            var xData = [];
+                            var yDataProductA = [];
+                            var yDataProductB = [];
+                            var yDataProductC = [];
+                            var yDataProductD = [];
+                            var yDataProductE = [];//loadmatt
+                            var yDataProductF = [];//reservedOne
+                            var yDataProductG = [];//reservedThree
+
+                            for (var i = 0; i < rev.data.length; i++) {
+                                xData.push(rev.data[i].date + ' ' + rev.data[i].shift);
+                                yDataProductA.push(rev.data[i].outputs);
+                                yDataProductB.push(rev.data[i].runTimeRate);
+                                yDataProductC.push(rev.data[i].idelTimeRate);
+                                yDataProductD.push(rev.data[i].downTimeRate);
+                                yDataProductE.push(rev.data[i].loadMATTimeRate);
+                                yDataProductF.push(rev.data[i].reservedOneTimeRate);
+                                yDataProductG.push(rev.data[i].reservedThreeTimeRate);
+                            }
+
+                            _this.option_1.series = [];
+                            _this.option_1.xAxis.data = xData;
+                            _this.option_1.series.push({
+                                type: 'value',
+                                name: '稼动率',
+                                data: yDataProductB,
+                                type: 'bar',
+                                stack: 'toral',
+                                axisLabel: {
+                                    formatter: '{value} %'
+                                },
+                                label: {
+                                    show: true,
+                                    color: 'white',
+                                    fontSize: 12
+                                }
+                            });
+                            _this.option_1.series.push({
+                                type: 'value',
+                                name: '待料率',
+                                data: yDataProductC,
+                                type: 'bar',
+                                stack: 'toral',
+                                axisLabel: {
+                                    formatter: '{value} %'
+                                },
+                                label: {
+                                    show: true,
+                                    color: 'white',
+                                    fontSize: 12
+                                }
+                            });
+                            _this.option_1.series.push({
+                                type: 'value',
+                                name: '故障率',
+                                data: yDataProductD,
+                                type: 'bar',
+                                stack: 'toral',
+                                axisLabel: {
+                                    formatter: '{value} %'
+                                },
+                                label: {
+                                    show: true,
+                                    color: 'white',
+                                    fontSize: 12
+                                }
+                            });
+                            _this.option_1.color = ['#5b9bd5', '#ed7d31', '#a5a5a5'];
+                            _this.option_1.legend.data = ["稼动率", "待料率", "故障率"];
+                            var loadmatt = _this.OEEExtendSetting1[0];
+                            if (loadmatt != "") {
+                                _this.option_1.series.push({
+                                    type: 'value',
+                                    name: _this.OEEExtendSetting1[0],
+                                    data: yDataProductE,
+                                    type: 'bar',
+                                    stack: 'toral',
+                                    axisLabel: {
+                                        formatter: '{value} %'
+                                    },
+                                    label: {
+                                        show: true,
+                                        color: 'white',
+                                        fontSize: 12
+                                    }
+                                });
+                                _this.option_1.legend.data.push(_this.OEEExtendSetting1[0]);
+                                _this.option_1.color.push('#008080');
+                            }
+                            var reservedOne = _this.OEEExtendSetting1[1];
+                            if (reservedOne != "") {
+                                _this.option_1.series.push({
+                                    type: 'value',
+                                    name: reservedOne,
+                                    data: yDataProductF,
+                                    type: 'bar',
+                                    stack: 'toral',
+                                    axisLabel: {
+                                        formatter: '{value} %'
+                                    },
+                                    label: {
+                                        show: true,
+                                        color: 'white',
+                                        fontSize: 12
+                                    }
+                                });
+                                _this.option_1.legend.data.push(_this.OEEExtendSetting1[1]);
+                                _this.option_1.color.push('#f47a75');
+                            }
+                            var reservedTwo = _this.OEEExtendSetting1[2];
+                            if (reservedTwo != "") {
+                                _this.option_1.series.push({
+                                    type: 'value',
+                                    name: reservedTwo,
+                                    data: yDataProductG,
+                                    type: 'bar',
+                                    stack: 'toral',
+                                    axisLabel: {
+                                        formatter: '{value} %'
+                                    },
+                                    label: {
+                                        show: true,
+                                        color: 'white',
+                                        fontSize: 12
+                                    }
+                                });
+                                _this.option_1.legend.data.push(_this.OEEExtendSetting1[2]);
+                                _this.option_1.color.push('#765005');
+                            }
+                            _this.option_1.series.push({
+                                type: 'value',
+                                name: '产能',
+                                data: yDataProductA,
+                                type: 'bar',
+                                axisLabel: {
+                                    formatter: '{value} pcs'
+                                },
+                                label: {
+                                    show: true,
+                                    color: 'white',
+                                    fontSize: 12
+                                },
+                                yAxisIndex: 1
+                            });
+                            _this.option_1.legend.data.push("产能");
+                            _this.option_1.color.push('#546fc6');
+
+                            _this.myChart.clear();
+                            _this.myChart.setOption(_this.option_1, true);//true重绘
+
+
+                            _this.param_temp.dataIndex = xData.length - 1;
+                            _this.param_temp.seriesName = '稼动率';
+                            _this.param_temp.name = xData[xData.length - 1];
+                        } else {
+                            alert(rev.message);
+                        }
+                    }
+                });
+            }
+        },
+        exportExcelTemplate() {
+            var sheetName = 'sheet1';
+            var workbook = {
+                SheetNames: [sheetName],
+                Sheets: {}
+            };
+
+            var sheet = {};
+
+            sheet['!ref'] = 'A1:' + 'K' + (this.oees_1.length + 1);
+            sheet['!cols'] = [
+                { wch: 10 },
+                { wch: 12 },
+                { wch: 12 },
+                { wch: 12 },
+                { wch: 12 },
+                { wch: 12 },
+                { wch: 12 },
+                { wch: 12 },
+                { wch: 12 },
+                { wch: 12 },
+                { wch: 12 }
+            ];
+
+            sheet['A1'] = { t: "s", v: "日期" };
+            sheet['B1'] = { t: "s", v: "班别" };
+            sheet['C1'] = { t: "s", v: "产能(pcs)" };
+            sheet['D1'] = { t: "s", v: "稼动时间(min)" };
+            sheet['E1'] = { t: "s", v: "待料时间(min)" };
+            sheet['F1'] = { t: "s", v: "报警时间(min)" };
+            sheet['G1'] = { t: "s", v: "换料时间(min)" };
+            sheet['H1'] = { t: "s", v: "稼动率(%)" };
+            sheet['I1'] = { t: "s", v: "待料率(%)" };
+            sheet['J1'] = { t: "s", v: "报警率(%)" };
+            sheet['K1'] = { t: "s", v: "换料率(%)" };
+
+            this.oees_1.forEach(function (row, i) {
+                sheet[String.fromCharCode(65) + (i + 2)] = { v: row.date };
+                sheet[String.fromCharCode(66) + (i + 2)] = { v: row.shift };
+                sheet[String.fromCharCode(67) + (i + 2)] = { v: row.outputs };
+                sheet[String.fromCharCode(68) + (i + 2)] = { v: row.runTime / 60 };
+                sheet[String.fromCharCode(69) + (i + 2)] = { v: row.idelTime / 60 };
+                sheet[String.fromCharCode(70) + (i + 2)] = { v: row.downTime / 60 };
+                sheet[String.fromCharCode(71) + (i + 2)] = { v: row.loadMATTime / 60 };
+                sheet[String.fromCharCode(72) + (i + 2)] = { v: row.runTimeRate };
+                sheet[String.fromCharCode(73) + (i + 2)] = { v: row.idelTimeRate };
+                sheet[String.fromCharCode(74) + (i + 2)] = { v: row.downTimeRate };
+                sheet[String.fromCharCode(75) + (i + 2)] = { v: row.loadMATTimeRate };
+            });
+
+            workbook.Sheets[sheetName] = sheet;
+
+            // 生成excel的配置项
+            var wopts = {
+                bookType: 'xlsx', // 要生成的文件类型
+                bookSST: false, // 是否生成Shared String Table,官方解释是,如果开启生成速度会下降,但在低版本IOS设备上有更好的兼容性
+                type: 'binary'
+            };
+            var wbout = XLSX.write(workbook, wopts);
+            var blob = new Blob([s2ab(wbout)], { type: "application/octet-stream" });
+
+            // 字符串转ArrayBuffer
+            function s2ab(s) {
+                var buf = new ArrayBuffer(s.length);
+                var view = new Uint8Array(buf);
+                for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
+                return buf;
+            }
+
+            this.openDownloadDialog(blob, '稼动数据.xlsx');
+        },
+        openDownloadDialog(url, saveName) {
+            if (typeof url == 'object' && url instanceof Blob) {
+                url = URL.createObjectURL(url); // 创建blob地址
+            }
+            var aLink = document.createElement('a');
+            aLink.href = url;
+            aLink.download = saveName || ''; // HTML5新增的属性,指定保存文件名,可以不要后缀,注意,file:///模式下不会生效
+            var event;
+            if (window.MouseEvent) event = new MouseEvent('click');
+            else {
+                event = document.createEvent('MouseEvents');
+                event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
+            }
+            aLink.dispatchEvent(event);
+        },
+        selected() {
+            var v = $("#selectMonth").val();
+            if (v == 1 || v == 2 || v == "") {
+                $(".date").datepicker("destroy");
+                $(".date").datepicker({
+                    minViewMode: 'days',
+                    format: 'yyyy-mm-dd',
+                    language: 'zh-CN',
+                    autoclose: true,
+                    todayBtn: 'linked'
+                }).on('changeDate', function () {
+
+                }).on('keydown', function (e) {
+                    return false;
+                });
+                var date1 = new Date(new Date().setDate(new Date().getDate() - 15));
+                var date2 = new Date(new Date().setDate(new Date().getDate() - 1));
+                var date1_1 = moment(date1);
+                var date2_1 = moment(date2);
+                $("#date1").val(date1_1.format('YYYY-MM-DD'));
+                $("#date2").val(date2_1.format('YYYY-MM-DD'));
+            }
+            else {
+                $(".date").datepicker("destroy");
+                $(".date").datepicker({
+                    minViewMode: 'months',
+                    format: 'yyyy-mm',
+                    language: 'zh-CN',
+                    autoclose: true,
+                    todayBtn: 'linked'
+                }).on('changeDate', function () {
+
+                }).on('keydown', function (e) {
+                    return false;
+                });
+                var date1 = new Date(new Date().setDate(new Date().getDate() - 7));
+                var date2 = new Date(new Date().setDate(new Date().getDate() - 1));
+                var date1_1 = moment(date1);
+                var date2_1 = moment(date2);
+                $("#date1").val(date1_1.format('YYYY-MM'));
+                $("#date2").val(date2_1.format('YYYY-MM'));
+            }
+        }
+    },
+    filters: {
+
+    },
+    created: function () {
+
+    },
+    destroyed: function () {
+
+    }
+})

+ 15 - 4
ProductionLineMonitor.Web/wwwroot/js/fault/fault.js

@@ -130,12 +130,23 @@ option = {
         },
         axisLabel: {
             interval: 0,
-            rotate: 30,
+            rotate: 0,
             formatter: function (value) {
-                if (value.length > 5) {
-                    return value.substring(5, 15) + "..";
+                var length = value.length;
+                var str = "";
+                var num = 8;
+                for (let i = 0; i * num < length; i++) {
+                    if ((i + 1) * num <= length) {
+                        str += value.substring(i * num, (i + 1) * num) + "\r\n";
+                    }
+                    else {
+                        str += value.substring(i * num, length);
+                    }
                 }
-                return value;
+                //if (value.length > 5) {
+                //    return value.substring(5, 15) + "..";
+                //}
+                return str;
             }
         }
     },

File diff suppressed because it is too large
+ 542 - 250
ProductionLineMonitor.Web/wwwroot/js/report-form/report-form-v1.js


+ 1 - 1
ProductionLineMonitor.sln

@@ -19,7 +19,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProductionLineMonitorGarnet
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GarnetClient", "GarnetClient\GarnetClient.csproj", "{2DDD350B-16FE-433A-89A3-E5F4F3628485}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "Core\Core.csproj", "{5C691CD9-62BE-40CB-A0AE-531DDF6EE68C}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core", "Core\Core.csproj", "{5C691CD9-62BE-40CB-A0AE-531DDF6EE68C}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution

Some files were not shown because too many files changed in this diff