| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340 | 
							- using Aitex.Core.Util;
 
- using Aitex.Core.Utilities;
 
- using Caliburn.Micro;
 
- using Caliburn.Micro.Core;
 
- using ExcelLibrary.BinaryFileFormat;
 
- using FurnaceUI.Models;
 
- using FurnaceUI.Views.Scheduled;
 
- using MECF.Framework.Common.CommonData.EnumData;
 
- using MECF.Framework.Common.DataCenter;
 
- using MECF.Framework.Common.OperationCenter;
 
- using MECF.Framework.Common.Utilities;
 
- using MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig;
 
- using MECF.Framework.UI.Client.CenterViews.Dialogs;
 
- using MECF.Framework.UI.Client.CenterViews.Editors;
 
- using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
 
- using MECF.Framework.UI.Client.CenterViews.Editors.Sequence;
 
- using OpenSEMI.ClientBase;
 
- using SciChart.Core.Extensions;
 
- using System.Collections.Generic;
 
- using System.Collections.ObjectModel;
 
- using System.Data;
 
- using System.Linq;
 
- using System.Windows.Controls;
 
- using System.Windows.Documents;
 
- using System.Windows.Input;
 
- using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
 
- namespace FurnaceUI.Views.Editors
 
- {
 
-     public class ScheduledMaintenanceMonitorViewModel : FurnaceUIViewModelBase
 
-     {
 
-         #region 构造函数
 
-         /// <summary>
 
-         /// 构造函数
 
-         /// </summary>
 
-         /// <param name="dataItem"></param>
 
-         public ScheduledMaintenanceMonitorViewModel(ScheduleMaintenanceDataItem dataItem)
 
-         {
 
-             EditModel = CloneUtil.CloneObject(dataItem) as ScheduleMaintenanceDataItem;
 
-             EnumLoop<MaintenanceProcessingCommandEnum>.ForEach((item) =>
 
-             {
 
-                 MaintenanceProcessingList.Add(item.ToString());
 
-             });
 
-         }
 
-         private bool _jobAutoStartCommandVisibility = false;
 
-         public bool JobAutoStartCommandVisibility
 
-         {
 
-             get => _jobAutoStartCommandVisibility;
 
-             set
 
-             {
 
-                 _jobAutoStartCommandVisibility = value;
 
-                 NotifyOfPropertyChange("JobAutoStartCommandVisibility");
 
-             }
 
-         }
 
-         private string _selectStepIdName = string.Empty;
 
-         public string SelectStepIdName
 
-         {
 
-             get => _selectStepIdName;
 
-             set
 
-             {
 
-                 _selectStepIdName = value;
 
-                 NotifyOfPropertyChange("SelectStepIdName");
 
-             }
 
-         }
 
-         private List<string> _maintenanceProcessingList = new List<string>();
 
-         public List<string> MaintenanceProcessingList
 
-         {
 
-             get => _maintenanceProcessingList;
 
-             set
 
-             {
 
-                 _maintenanceProcessingList = value;
 
-                 NotifyOfPropertyChange("MaintenanceProcessingList");
 
-             }
 
-         }
 
-         #endregion
 
-         #region 属性 EditModel
 
-         /// <summary>
 
-         /// EditModel
 
-         /// </summary>
 
-         public ScheduleMaintenanceDataItem EditModel { get; set; }
 
-         #endregion
 
-         public bool IsEnable
 
-         {
 
-             get { return _isEnable; }
 
-             set
 
-             {
 
-                 _isEnable = value;
 
-                 NotifyOfPropertyChange("IsEnable");
 
-             }
 
-         }
 
-         private bool _isEnable;
 
-         #region 方法 CurrentValueChange
 
-         /// <summary>
 
-         /// CurrentValueChange
 
-         /// </summary>
 
-         public void SetCurrentValue(object obj, MouseButtonEventArgs e)
 
-         {
 
-             e.Handled = true;
 
-             NumberKeyboard fullKeyboard = new NumberKeyboard("", "0");
 
-             if ((bool)fullKeyboard.ShowDialog())
 
-             {
 
-                 var data = fullKeyboard.ValueString;
 
-                 if (EditModel.Path == "Reactor.StepRunTime")
 
-                 {
 
-                     var dataStrs = data.Split('.').ToList();
 
-                     if (dataStrs.Count > 1)
 
-                     {
 
-                         EditModel.CurrentValue = float.Parse(dataStrs.FirstOrDefault()) * 3600 + float.Parse(dataStrs.LastOrDefault()) * 60;
 
-                     }
 
-                     else
 
-                     {
 
-                         EditModel.CurrentValue = float.Parse(dataStrs.FirstOrDefault()) * 3600;
 
-                     }
 
-                 }
 
-                 else
 
-                 {
 
-                     EditModel.CurrentValue = float.Parse(data);
 
-                 }
 
-             }
 
-             //if ((bool)fullKeyboard.ShowDialog())
 
-             //{
 
-             //    //InvokeClient.Instance.Service.DoOperation($"{SystemName}.SetConfig", path, fullKeyboard.ValueString);
 
-             //    //currentValue = fullKeyboard.ValueString;
 
-             //    //EditModel.CurrentValue = fullKeyboard.ValueString;
 
-             //}
 
-         }
 
-         public void CurrentValueChange()
 
-         {
 
-             IsEnable = !IsEnable;
 
-         }
 
-         #endregion
 
-         protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
 
-         {
 
-             if (EditModel != null && !string.IsNullOrEmpty(EditModel.MaintenanceProcessing) && EditModel.MaintenanceProcessing == MaintenanceProcessingCommandEnum.JobAutoStart.ToString())
 
-             {
 
-                 JobAutoStartCommandVisibility = true;
 
-             }
 
-             else
 
-             {
 
-                 EditModel.AssociationProcessRecipeName = "";
 
-                 JobAutoStartCommandVisibility = false;
 
-             }
 
-         }
 
-         protected override void OnViewLoaded(object view)
 
-         {
 
-             base.OnViewLoaded(view);
 
-             var isReator = EditModel.DataItemType == DataItemEnum.Reactor;
 
-             if (isReator && (EditModel.ReactorsType == ReactorsEnum.StepRunTime || EditModel.ReactorsType == ReactorsEnum.StepRunFreq) && !string.IsNullOrEmpty(EditModel.AdditionInformationDisplay))
 
-             {
 
-                 SelectStepIdName = $":{(string)QueryDataClient.Instance.Service.GetConfig($"PM1.RecipeEditParameter.StepName.{EditModel.AdditionInformationDisplay}")}";
 
-             }
 
-             if (isReator && EditModel.ReactorsType == ReactorsEnum.StepThickness)
 
-             {
 
-                 CompareConfigurations();
 
-             }
 
-         }
 
-         public void SelectStepIDMethod()
 
-         {
 
-             var windowManager = IoC.Get<IWindowManager>();
 
-             RecipeStepNameViewModel recipeStepNameViewModel = new RecipeStepNameViewModel() { CheckNumber = true, SelectedStepName = EditModel.AdditionInformationDisplay };
 
-             if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeStepNameViewModel, null, "Select Step ID"))
 
-             {
 
-                 var strs = recipeStepNameViewModel.SelectedStepName.Split(':');
 
-                 EditModel.AdditionInformationDisplay = strs.FirstOrDefault();
 
-                 if (strs.Length > 1)
 
-                 {
 
-                     SelectStepIdName = $":{strs.LastOrDefault()}";
 
-                 }
 
-             }
 
-         }
 
-         private void CompareConfigurations()
 
-         {
 
-             var groupValue = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.RecipeEditParameter.StepGroup.{EditModel.AdditionInformationDisplay}");
 
-             if (!string.IsNullOrEmpty(EditModel.AdditionInformationDisplaySupplement))
 
-             {
 
-                 if (string.IsNullOrEmpty(groupValue))
 
-                 {
 
-                     DialogBox.ShowWarning($"The selected {EditModel.AdditionInformationDisplay} does not match the  Config {EditModel.AdditionInformationDisplay}. Please confirm!");
 
-                 }
 
-                 else
 
-                 {
 
-                     var oldDatas = EditModel.AdditionInformationDisplaySupplement.Split(',').ToList();
 
-                     var newDatas = groupValue.Split(',').ToList();
 
-                     // 判断 oldDatas 中有但 newDatas 中没有的元素
 
-                     var differenceOldToNew = oldDatas.Except(newDatas).ToList();
 
-                     // 判断 newDatas 中有但 oldDatas 中没有的元素
 
-                     var differenceNewToOld = newDatas.Except(oldDatas).ToList();
 
-                     // 检查是否存在差集
 
-                     bool hasDifference = differenceOldToNew.Any() || differenceNewToOld.Any();
 
-                     if (hasDifference)
 
-                     {
 
-                         DialogBox.ShowWarning($"The selected {EditModel.AdditionInformationDisplay} does not match the  Config {EditModel.AdditionInformationDisplay}. Please confirm!");
 
-                     }
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 if (!string.IsNullOrEmpty(groupValue))
 
-                 {
 
-                     DialogBox.ShowWarning($"The selected {EditModel.AdditionInformationDisplay} does not match the  Config {EditModel.AdditionInformationDisplay}. Please confirm!");
 
-                 }
 
-             }
 
-         }
 
-         public void SelectStepGroupMethod()
 
-         {
 
-             var windowManager = IoC.Get<IWindowManager>();
 
-             StepGroupSelectViewModel recipeStepNameViewModel = new StepGroupSelectViewModel() { SelectedGroupName = EditModel.AdditionInformationDisplay };
 
-             if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeStepNameViewModel, null, "Select Step Group"))
 
-             {
 
-                 EditModel.AdditionInformationDisplay = recipeStepNameViewModel.SelectedGroupName;
 
-                 var gropuDataStr = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.RecipeEditParameter.StepGroup.{recipeStepNameViewModel.SelectedGroupName}");
 
-                 if (!string.IsNullOrEmpty(gropuDataStr))
 
-                 {
 
-                     var datas = QueryDataClient.Instance.Service.PollConfig(gropuDataStr.Split(',').ToList().Select(a => $"PM1.RecipeEditParameter.StepName.{a}"));
 
-                     var recipeNames = datas.Select(a => $"{a.Key.Split('.').LastOrDefault()}");
 
-                     EditModel.AdditionInformationDisplaySupplement = string.Join(",", recipeNames);
 
-                 }
 
-                 else
 
-                 {
 
-                     EditModel.AdditionInformationDisplaySupplement = "";
 
-                 }
 
-             }
 
-         }
 
-         public void SelectProcessRecipe(string value)
 
-         {
 
-             RecipeSelectDialogViewModel dialog = new RecipeSelectDialogViewModel();
 
-             dialog.DisplayName = "Select Recipe";
 
-             var recipeProvider = new RecipeProvider();
 
-             var processType = QueryDataClient.Instance.Service.GetConfig($"System.Recipe.SupportedProcessType");
 
-             if (processType == null)
 
-             {
 
-                 processType = "Process";
 
-             }
 
-             var ProcessTypeFileList = new ObservableCollection<ProcessTypeFileItem>();
 
-             string[] recipeProcessType = ((string)processType).Split(',');
 
-             var type = new ProcessTypeFileItem();
 
-             type.ProcessType = recipeProcessType[0];
 
-             var prefix = $"Furnace\\{recipeProcessType[0]}";
 
-             var recipes = recipeProvider.GetXmlRecipeList(prefix);
 
-             type.FileListByProcessType = RecipeSequenceTreeBuilder.BuildFileNode(prefix, "", false, recipes)[0].Files;
 
-             ProcessTypeFileList.Add(type);
 
-             dialog.ProcessTypeFileList = ProcessTypeFileList;
 
-             WindowManager wm = new WindowManager();
 
-             bool? bret = wm.ShowDialog(dialog);
 
-             if ((bool)bret)
 
-             {
 
-                 if (value == "AssociationProcessRecipeName")
 
-                 {
 
-                     EditModel.AssociationProcessRecipeName = dialog.DialogResult;
 
-                 }
 
-                 if (value == "AdditionInformationDisplay")
 
-                 {
 
-                     EditModel.AdditionInformationDisplay = dialog.DialogResult;
 
-                 }
 
-             }
 
-         }
 
-         #region 方法 ClearCurrentValue
 
-         /// <summary>
 
-         /// ClearCurrentValue
 
-         /// </summary>
 
-         public void ClearCurrentValue()
 
-         {
 
-             if (EditModel != null)
 
-             {
 
-                 EditModel.CurrentValue = 0;
 
-             }
 
-         }
 
-         #endregion
 
-         #region 方法 SetSave
 
-         public void SetSave()
 
-         {
 
-             this.TryClose(true);
 
-         }
 
-         #endregion
 
-         #region 方法 SetCancel
 
-         public void SetCancel()
 
-         {
 
-             TryClose();
 
-         }
 
-         #endregion
 
-     }
 
- }
 
 
  |