using GroupLine.App.View;
using GroupLine.App.View.AppearanceTest;
using GroupLine.App.View.MagTorque;
using GroupLine.App.View.KanBan;
using GroupLine.App.View.OffsetConfig;
using GroupLine.App.ViewModel;
using GroupLine.Com;
using GroupLine.Model;
using MaterialDesignThemes.Wpf;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using YC5.App.View.DbDataClear;
using YC5.App.View.OilPumpInstall;
using GroupLine.App.View.BurPlugInstall;
using GroupLine.App.View.CylinderEngrav;
using GroupLine.App.View.ExhInstallMes;
using GroupLine.App.View.GCDTransplant;
using GroupLine.App.View.GCylinderBurnEb;
using GroupLine.App.View.GDynStaticMach;
using GroupLine.App.View.GInsRotaRes;
using GroupLine.App.View.GLeakCheck;
using GroupLine.App.View.GLowVolStart;
using GroupLine.App.View.GMagTorque;
using GroupLine.App.View.GOilPumpInstall;
using GroupLine.App.View.GRingWeldMach;
using GroupLine.App.View.GRotorBurnEb;
using GroupLine.App.View.GRotorMag;
using GroupLine.App.View.GShrinkTub;
using GroupLine.App.View.GSpotWeldMach;
using GroupLine.App.View.GStaticDiskMach;
using GroupLine.App.View.KPCDTransplant;
using GroupLine.App.View.KPDynStaticMach;
using GroupLine.App.View.KPLeakCheck;
using GroupLine.App.View.KPLowVolStart;
using GroupLine.App.View.KPMagTorque;
using GroupLine.App.View.KPOilPumpInstall;
using GroupLine.App.View.KPRingWeldMach;
using GroupLine.App.View.KPSealInstall;
using GroupLine.App.View.KPSpotWeldMach;
using GroupLine.App.View.KPStaticDiskMach;
using GroupLine.App.View.OverflowLeakMes;
using GroupLine.App.View.PCoreMes;
using GroupLine.App.View.PLowWeld;
using GroupLine.App.View.PRacktPress;
using GroupLine.App.View.PRacktWeld;
using GroupLine.App.View.StaticDiscPress;
using GroupLine.App.View.TermWeld;
using GroupLine.App.View.KPUpBurnEb;
using GroupLine.App.View.KPRingWeldMachDw;
using GroupLine.App.View.KPRingWeldMachUp;
using GroupLine.App.View.KPShrinkTub;
using GroupLine.App.View.OilGuideMount;
using GroupLine.App.View.RotorShrinkFit;
using GroupLine.App.View.KPBarrelShrinkFit;
using GroupLine.App.View.KPReliefValveAsm;
using GroupLine.App.View.KPExhCoverSealTest;
namespace GroupLine.App
{
///
/// MainWindow.xaml 的交互逻辑
///
public partial class MainWindow : Window
{
///
/// 报表定时导出监听线程
///
private Thread ReportListenThread;
///
/// 报表导出时间字符串
///
private string ReportOutPutTime = "12:01";
//日志的实例化
private static Logger _Logger = LogManager.GetCurrentClassLogger();
//FSQL实例
static IFreeSql Fsql;
///
/// 当前程序的位置
///
private string Location;
///
/// 当前配置信息区域
///
private string CurrentRegion = "SCR组立";
///
/// 当前配置的分类
///
private string CurrentCategory = "报表信息";
///
/// 当前的报表导出的时间
///
private string CurrentReportTimeName = "导出时间";
public MainWindow()
{
InitializeComponent();
ReportTimeConfigViewModel.PubReportTimeEvent += ReportTimeConfigViewModel_PubReportTimeEvent;
//获取程序的配置信息
var SqlCon = ConfigHelper.GetValue("connecting");
Fsql = new FreeSql.FreeSqlBuilder()
.UseConnectionString(FreeSql.DataType.SqlServer, SqlCon)
.UseAutoSyncStructure(true) //自动同步实体结构到数据库
.Build(); //请务必定义成 Singleton 单例模式
var menuReports = new List();
var DeviceGroup = new List();
CurrentRegion = "GroupLine";
this.Title = "GroupLine产线管理系统";
this.LabelTitle.Content = "DAIKIN-GroupLine生产管理系统";
var item3 = new ItemMenu("设备数据", DeviceGroup, PackIconKind.CogOutline);
//DeviceGroup.Add(new SubItem("铭板打印", new PlaquePrintIndex()));
//DeviceGroup.Add(new SubItem("外观检查", new AppearanceTestIndex()));
DeviceGroup.Add(new SubItem("G型磁束扭矩检", new MagTorqueView()));
DeviceGroup.Add(new SubItem("G型油泵安装", new OilPumpInstallView()));
DeviceGroup.Add(new SubItem("筒体刻印机", new CylinderEngravView()));
DeviceGroup.Add(new SubItem("端子凸焊", new TermWeldView()));
DeviceGroup.Add(new SubItem("G型筒体烧嵌", new GCylinderBurnEbView()));
DeviceGroup.Add(new SubItem("G型转子烧嵌", new GRotorBurnEbView()));
DeviceGroup.Add(new SubItem("G型转子着磁", new GRotorMagView()));
DeviceGroup.Add(new SubItem("G型绝缘、回转方向、电阻测量", new GInsRotaResView()));
DeviceGroup.Add(new SubItem("小P支架压入", new PRacktPressView()));
DeviceGroup.Add(new SubItem("小P支架焊接", new PRacktWeldView()));
DeviceGroup.Add(new SubItem("小P下部焊接", new PLowWeldView()));
DeviceGroup.Add(new SubItem("小P芯出测定", new PCoreMesView()));
//DeviceGroup.Add(new SubItem("G型磁束扭矩检测工位", new GMagTorqueView()));
DeviceGroup.Add(new SubItem("K / P型磁束扭矩检测工位", new KPMagTorqueView()));
//DeviceGroup.Add(new SubItem("G型油泵安装工位", new GOilPumpInstallView()));
DeviceGroup.Add(new SubItem("K / P型油泵安装工位", new KPOilPumpInstallView()));
DeviceGroup.Add(new SubItem("G型C - D移栽", new GCDTransplantView()));
DeviceGroup.Add(new SubItem("K / P型C - D移栽", new KPCDTransplantView()));
DeviceGroup.Add(new SubItem("G型高低压泄露检查", new GLeakCheckView()));
DeviceGroup.Add(new SubItem("K / P型高低压泄露检查", new KPLeakCheckView()));
DeviceGroup.Add(new SubItem("K / P型密封盖板安装", new KPSealInstallView()));
DeviceGroup.Add(new SubItem("排气盖板安装气密检测", new ExhInstallMesView()));
DeviceGroup.Add(new SubItem("埋塞敲入螺旋钉安装", new BurPlugInstallView()));
DeviceGroup.Add(new SubItem("溢流阀安装泄露检查", new OverflowLeakMesView()));
DeviceGroup.Add(new SubItem("静盘注液阀压入", new StaticDiscPressView()));
DeviceGroup.Add(new SubItem("G型动静盘组装机", new GDynStaticMachView()));
DeviceGroup.Add(new SubItem("K / P型动静盘组装机", new KPDynStaticMachView()));
DeviceGroup.Add(new SubItem("G型低电压启动", new GLowVolStartView()));
DeviceGroup.Add(new SubItem("K / P型低电压启动", new KPLowVolStartView()));
DeviceGroup.Add(new SubItem("G型点焊机", new GSpotWeldMachView()));
DeviceGroup.Add(new SubItem("K / P点焊机", new KPSpotWeldMachView()));
DeviceGroup.Add(new SubItem("G型环焊机底部焊接", new GRingWeldMachView()));
DeviceGroup.Add(new SubItem("G型环焊机顶部焊接", new KPRingWeldMachView()));
DeviceGroup.Add(new SubItem("G型缩管", new GShrinkTubView()));
DeviceGroup.Add(new SubItem("K / P上配重烧嵌", new KPUpBurnEbView()));
DeviceGroup.Add(new SubItem("G型静盘组装机", new GStaticDiskMachView()));
DeviceGroup.Add(new SubItem("K / P静盘组装机", new KPStaticDiskMachView()));
DeviceGroup.Add(new SubItem("K/P型环焊机底部焊接", new KPRingWeldMachDwView()));
DeviceGroup.Add(new SubItem("K/P型环焊机顶部焊接", new KPRingWeldMachUpView()));
DeviceGroup.Add(new SubItem("K/P型缩管", new KPShrinkTubView()));
DeviceGroup.Add(new SubItem("导油板敲入", new OilGuideMountView()));
DeviceGroup.Add(new SubItem("转子烧嵌", new RotorShrinkFitView()));
DeviceGroup.Add(new SubItem("KP型筒体烧嵌", new KPBarrelShrinkFitView()));
DeviceGroup.Add(new SubItem("KP溢流阀组装机", new KPReliefValveAsmView()));
DeviceGroup.Add(new SubItem("KP排气盖板安装气密检测", new KPExhCoverSealTestView()));
var menuKanban = new List();
menuKanban.Add(new SubItem("休息时间设置", new KanBanIndex()));
menuKanban.Add(new SubItem("偏置设置", new OffsetConfigIndex()));
menuKanban.Add(new SubItem("数据备份", new DbDataClearView()));
//menuKanban.Add(new SubItem("稼动率报表", new ProductRateIndex()));
//menuKanban.Add(new SubItem("帮助"));
var item5 = new ItemMenu("配置", menuKanban, PackIconKind.MonitorDashboard);
var menuSystemConfig = new List();
menuSystemConfig.Add(new SubItem("帮助"));
var item4 = new ItemMenu("系统设置", menuSystemConfig, PackIconKind.ViewDashboard);
//MonitorDashboard ClipboardTextPlayOutline
//var menuUser = new List();
//menuUser.Add(new SubItem("用户管理"));
//var item5 = new ItemMenu("用户设置", menuUser, PackIconKind.User);
//var item0 = new ItemMenu("看板中心", new null, PackIconKind.ViewDashboard);
//Menu.Children.Add(new UserControlMenuItem(item0, this));
//Menu.Children.Add(new UserControlMenuItem(item1, this));
Menu.Children.Add(new UserControlMenuItem(item3, this));
Menu.Children.Add(new UserControlMenuItem(item5, this));
Menu.Children.Add(new UserControlMenuItem(item4, this));
//Menu.Children.Add(new UserControlMenuItem(item5, this));
var ConfigInfo = Fsql.Select().Where(a => a.Region == CurrentRegion && a.Category == CurrentCategory && a.Name == CurrentReportTimeName).ToList();
if (ConfigInfo != null && ConfigInfo.Count() > 0)
{
ReportOutPutTime = ConfigInfo.FirstOrDefault().Value;
}
else
{
ReportOutPutTime = "12:01";
}
ReportListenThread = new Thread(new ThreadStart(ReportListenThreadMethod));
ReportListenThread.Start();
}
private void ReportListenThreadMethod()
{
}
///
/// 修改了报表信息数据
///
///
private void ReportTimeConfigViewModel_PubReportTimeEvent(string ReportInfo)
{
ReportOutPutTime = ReportInfo;
}
///
/// 切换窗体
///
///
internal void SwitchScreen(object sender)
{
var screen = ((UserControl)sender);
if (screen != null)
{
StackPanelMain.Children.Clear();
StackPanelMain.Children.Add(screen);
}
}
private void Window_Closed(object sender, EventArgs e)
{
Environment.Exit(0);
}
}
}