123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- /* ==============================================================================
- * 功能描述:CheckOperation
- * 创 建 者:Garrett
- * 创建日期:2018/11/29 17:22:05
- * ==============================================================================*/
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using NPOI.SS.UserModel;
- using SAGA.MBI.ToolsData.ModeCheck;
- using SAGA.DotNetUtils.Extend;
- using SAGA.DotNetUtils.Logger;
- using SAGA.MBI.ToolsData.DataCheck;
- namespace SAGA.MBI.ToolsData.CheckBase
- {
- /// <summary>
- /// CheckOperation
- /// </summary>
- public class CheckOperation
- {
- /// <summary>
- /// 获取检查项
- /// </summary>
- /// <param name="type"></param>
- /// <returns></returns>
- public static List<ICheckBase> GetCheckItems(CheckType type)
- {
- List<ICheckBase> list = new List<ICheckBase>();
- switch (type)
- {
- case CheckType.ModeCheck:
- list = GetModeCheckItems();
- break;
- case CheckType.DataCheck:
- list = GetDataCheckItems();
- break;
- }
- return list;
- }
- /// <summary>
- /// 获取模型检查的检查项
- /// </summary>
- /// <returns></returns>
- public static List<ICheckBase> GetModeCheckItems()
- {
- List<ModeCheckBase> list = new List<ModeCheckBase>();
- var checkBase = new SagaSignCheck();
- list.Add(new FloorMiss());
- list.Add(new FloorSequenceCheck());
- list.Add(new UnitCheck());
- list.Add(new GridCheck());
- list.Add(new FamilyNameCheck());
- list.Add(new EquipmentPartRefEqCheck());
- list.Add(new ColumnCheck());
- list.Add(new ElementRangeCheck());
- list.Add(new SagaPositionCheck());
- list.Add(new ConnectorCheck());
- list.Add(new SystemCheck());
- list.Add(new EquipmentInSpaceCheck());
- list.ForEach(t =>
- {
- t.SetBaseCheck(checkBase);
- t.RIsChecked = true;
- });
- list.Insert(0, checkBase);
- return list.ToList<ICheckBase>();
- }
- /// <summary>
- /// 获取垃圾数据检查的检查项
- /// </summary>
- /// <returns></returns>
- public static List<ICheckBase> GetDataCheckItems()
- {
- List<DataCheckBase> list = new List<DataCheckBase>();
- list.Add(new DutyFMInfoCheck());
- list.Add(new QRCodeContextCheck());
- list.Add(new MissDutyOrMode());
- list.ForEach(t =>
- {
- t.RIsChecked = true;
- });
- return list.ToList<ICheckBase>();
- }
- /// <summary>
- /// 执行检查并保存
- /// </summary>
- /// <param name="list"></param>
- /// <param name="context"></param>
- public static void Execute(List<ICheckBase> list, CheckContext context)
- {
- DataCheckProgressBarClient.Start("正在进行数据检查", list.Count(t => t.RIsChecked), false);
- //检查
- list.ForEach(t => t.Check2(context));
- DataCheckProgressBarClient.UpdateBigTip("正在进行数据保存");
- //重置workbook准备保存结果
- DCRExport.ClearWorkbook();
- //保存
- list.ForEach(t => t.Export2());
- DCRExport.Save(context.SavePath, DCRExport.GetWorkbook());
- DataCheckProgressBarClient.UpdateBigTip("结束");
- }
- /// <summary>
- /// 获取保存模版的地址
- /// </summary>
- /// <param name="type"></param>
- /// <returns></returns>
- public static string GetSaveTemplatePath(CheckType type)
- {
- string path = null;
- switch (type)
- {
- case CheckType.DataCheck:
- path = DCRExport.DCRPath;
- break;
- case CheckType.ModeCheck:
- path = DCRExport.MCRPath;
- break;
- }
- return path;
- }
- }
- }
|