79 lines
2.4 KiB
C#
79 lines
2.4 KiB
C#
using NPOI.SS.UserModel;
|
|
using System;
|
|
using System.ComponentModel;
|
|
using DeviceRepairAndOptimization.Common.NpoiExtend;
|
|
using System.Reflection;
|
|
|
|
namespace DeviceRepairAndOptimization.Biz.AM.Templates
|
|
{
|
|
public class FM_P0075_01
|
|
{
|
|
/// <summary>
|
|
/// 序号
|
|
/// </summary>
|
|
[Description("序号")]
|
|
public string OrderNumber = "[A,1]";
|
|
|
|
/// <summary>
|
|
/// 设备型号
|
|
/// </summary>
|
|
[Description("设备型号")]
|
|
public string EquipmentTs = "[B,1]";
|
|
|
|
/// <summary>
|
|
/// 设备编号
|
|
/// </summary>
|
|
[Description("设备编号")]
|
|
public string EquipmentID = "[D,1]";
|
|
|
|
/// <summary>
|
|
/// 班次/频次
|
|
/// </summary>
|
|
[Description("班次/频次")]
|
|
public string Banci = "[G,1]";
|
|
|
|
/// <summary>
|
|
/// 其他异常处理
|
|
/// </summary>
|
|
[Description("其他异常处理")]
|
|
public string ExceptionContent = "[A,17]";
|
|
|
|
/// <summary>
|
|
/// 签名
|
|
/// </summary>
|
|
[Description("签名")]
|
|
public string Signature = "[F,17]";
|
|
|
|
|
|
public ArgumentException CheckCurrentSheet(ISheet sheet)
|
|
{
|
|
try
|
|
{
|
|
var type = this.GetType();
|
|
FieldInfo[] fields = type.GetFields(BindingFlags.Public | BindingFlags.Instance);
|
|
foreach (var item in fields)
|
|
{
|
|
string Description = string.Empty;
|
|
object[] attrs = item.GetCustomAttributes(typeof(DescriptionAttribute), false);
|
|
if (null != attrs && attrs.Length > 0)
|
|
{
|
|
DescriptionAttribute description = (DescriptionAttribute)attrs[0];
|
|
Description = description.Description;
|
|
}
|
|
|
|
string field = item.GetValue(this)?.ToString();
|
|
string CellValue = sheet.LocateCellByAddress(field).StringCellValue;
|
|
if (!Description.Equals(CellValue, StringComparison.CurrentCultureIgnoreCase))
|
|
return new ArgumentException($"当前点检表格式不正确,操作失败!");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return new ArgumentException(ex.Message);
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
}
|