首次提交:添加src文件夹代码
This commit is contained in:
66
Cowain.Bake.UI/CsvMap/BatteryInfoDetailMap.cs
Normal file
66
Cowain.Bake.UI/CsvMap/BatteryInfoDetailMap.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using Cowain.Bake.Model.Entity;
|
||||
using CsvHelper.Configuration;
|
||||
|
||||
namespace Cowain.Bake.UI.CsvMap
|
||||
{
|
||||
// 5. 创建自定义ClassMap
|
||||
//public sealed class BatteryInfoMap : ClassMap<TBatteryInfo>
|
||||
public sealed class BatteryInfoDetailMap : ClassMap<BatteryInfoEntity>
|
||||
{
|
||||
public BatteryInfoDetailMap()
|
||||
{
|
||||
Map(m => m.Id).Name("电池序号");
|
||||
Map(m => m.PalletCode).Name("夹具条码");
|
||||
|
||||
// 应用枚举描述转换器
|
||||
Map(m => m.BatteryStatus)
|
||||
.Name("状态")
|
||||
.TypeConverter<BatteryStatusMapConverter>();
|
||||
|
||||
Map(m => m.ScanTime)
|
||||
.Name("扫码时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.BatteryCode).Name("电池条码");
|
||||
Map(m => m.PositionX).Name("行号");
|
||||
Map(m => m.PositionY).Name("列号");
|
||||
|
||||
Map(m => m.BindingTime)
|
||||
.Name("绑定时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.BindingTime)
|
||||
.Name("解绑时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.BakingPosition).Name("所属烤箱")
|
||||
.TypeConverter<CavityInfoIdMapConverter>();
|
||||
|
||||
Map(m => m.LoadingBegingTime)
|
||||
.Name("上料开始时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.LoadingOverTime)
|
||||
.Name("上料结束时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.BakingBeginTime)
|
||||
.Name("烘烤开始时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.BakingOverTime)
|
||||
.Name("烘烤结束时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.UnLoadingBegingTime)
|
||||
.Name("下料开始时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.UnLoadingOverTime)
|
||||
.Name("下料结束时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.WaterValue).Name("水含量结果");
|
||||
}
|
||||
}
|
||||
}
|
||||
44
Cowain.Bake.UI/CsvMap/BatteryInfoMap.cs
Normal file
44
Cowain.Bake.UI/CsvMap/BatteryInfoMap.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using Cowain.Bake.Model;
|
||||
using CsvHelper.Configuration;
|
||||
|
||||
|
||||
namespace Cowain.Bake.UI.CsvMap
|
||||
{
|
||||
// 4. 创建CsvHelper自定义转换器
|
||||
|
||||
|
||||
// 5. 创建自定义ClassMap
|
||||
//public sealed class BatteryInfoMap : ClassMap<TBatteryInfo>
|
||||
public sealed class BatteryInfoMap : ClassMap<TBatteryInfo>
|
||||
{
|
||||
public BatteryInfoMap()
|
||||
{
|
||||
Map(m => m.Id).Name("电池序号");
|
||||
Map(m => m.PalletVirtualId).Name("夹具条码")
|
||||
.TypeConverter<PalletVirtualIdMapConverter>();
|
||||
// 应用枚举描述转换器
|
||||
Map(m => m.BatteryStatus)
|
||||
.Name("状态")
|
||||
.TypeConverter<BatteryStatusMapConverter>();
|
||||
|
||||
Map(m => m.ScanTime)
|
||||
.Name("扫码时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.BatteryCode).Name("条码");
|
||||
Map(m => m.PositionX).Name("行号");
|
||||
Map(m => m.PositionY).Name("列号");
|
||||
|
||||
Map(m => m.BindingTime)
|
||||
.Name("绑定时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.BindingTime)
|
||||
.Name("解绑时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
Map(m => m.DummyFlag).Name("假电芯");
|
||||
Map(m => m.Remarks).Name("备注");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
26
Cowain.Bake.UI/CsvMap/FailBatteryMap.cs
Normal file
26
Cowain.Bake.UI/CsvMap/FailBatteryMap.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Cowain.Bake.Model;
|
||||
using Cowain.Bake.Model.Entity;
|
||||
using CsvHelper.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Cowain.Bake.Common.CsvMap
|
||||
{
|
||||
public sealed class FailBatteryMap : ClassMap<TBatteryNG>
|
||||
{
|
||||
public FailBatteryMap()
|
||||
{
|
||||
Map(m => m.Id).Name("序号");
|
||||
Map(m => m.PalletCode).Name("夹具条码");
|
||||
Map(m => m.BatteryCode).Name("电芯条码");
|
||||
Map(m => m.CreateTime)
|
||||
.Name("创建时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
Map(m => m.Desc).Name("描述");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
32
Cowain.Bake.UI/CsvMap/MesDataMap.cs
Normal file
32
Cowain.Bake.UI/CsvMap/MesDataMap.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Cowain.Bake.Common.Converter;
|
||||
using Cowain.Bake.Model.Entity;
|
||||
using Cowain.Bake.UI.CsvMap;
|
||||
using CsvHelper;
|
||||
using CsvHelper.Configuration;
|
||||
using CsvHelper.TypeConversion;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Cowain.Bake.Common.CsvMap
|
||||
{
|
||||
|
||||
public sealed class MesDataMap : ClassMap<MesDataEntity>
|
||||
{
|
||||
public MesDataMap()
|
||||
{
|
||||
Map(m => m.CreateTime).Name("创建时间").TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss"); ;
|
||||
Map(m => m.SendTime).Name("发送时间").TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss"); ;
|
||||
Map(m => m.RecvTime).Name("接收时间").TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss"); ;
|
||||
Map(m => m.Content).Name("发送信息");
|
||||
Map(m => m.RecvContent).Name("接收信息");
|
||||
Map(m => m.BatteryCode).Name("电芯条码");
|
||||
Map(m => m.SendFlag)
|
||||
.Name("发送状态")
|
||||
.TypeConverter<MesDataMapConverter>();
|
||||
}
|
||||
}
|
||||
}
|
||||
65
Cowain.Bake.UI/CsvMap/PalletInfoMap.cs
Normal file
65
Cowain.Bake.UI/CsvMap/PalletInfoMap.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using Cowain.Bake.Model;
|
||||
using CsvHelper;
|
||||
using CsvHelper.Configuration;
|
||||
using CsvHelper.TypeConversion;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Cowain.Bake.UI.CsvMap
|
||||
{
|
||||
public sealed class PalletInfoMap : ClassMap<TPalletInfo>
|
||||
{
|
||||
public PalletInfoMap()
|
||||
{
|
||||
Map(m => m.Id).Name("序号");
|
||||
Map(m => m.PalletCode).Name("夹具条码");
|
||||
|
||||
// 应用枚举描述转换器
|
||||
Map(m => m.PalletStatus)
|
||||
.Name("状态")
|
||||
.TypeConverter<PalletStatusMapConverter>();
|
||||
|
||||
Map(m => m.BatteryQty).Name("电芯数量");
|
||||
Map(m => m.BakingCount).Name("烘烤次数");
|
||||
Map(m => m.JobNum).Name("工单号");;
|
||||
|
||||
Map(m => m.BakingPosition).Name("烘烤位置")
|
||||
.TypeConverter<CavityInfoIdMapConverter>();
|
||||
|
||||
Map(m => m.ScanTime)
|
||||
.Name("扫码时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.LoadingPosition).Name("上料位置")
|
||||
.TypeConverter<CavityInfoIdMapConverter>();
|
||||
|
||||
//Map(m => m.UnLoadingPosition).Name("下料位置")
|
||||
// .TypeConverter<CavityInfoIdMapConverter>();
|
||||
|
||||
Map(m => m.LoadingBegingTime)
|
||||
.Name("上料开始时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.LoadingOverTime)
|
||||
.Name("上料结束时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.BakingBeginTime)
|
||||
.Name("烘烤开始时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.BakingOverTime)
|
||||
.Name("烘烤结束时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.UnLoadingBegingTime)
|
||||
.Name("下料开始时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.UnLoadingOverTime)
|
||||
.Name("下料结束时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.WaterValue).Name("水含量结果");
|
||||
}
|
||||
}
|
||||
}
|
||||
63
Cowain.Bake.UI/CsvMap/TypeConverter.cs
Normal file
63
Cowain.Bake.UI/CsvMap/TypeConverter.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using Cowain.Bake.Common.Converter;
|
||||
using Cowain.Bake.BLL.Converter;
|
||||
using Cowain.Bake.Model;
|
||||
using CsvHelper;
|
||||
using CsvHelper.Configuration;
|
||||
using CsvHelper.TypeConversion;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Cowain.Bake.UI.CsvMap
|
||||
{
|
||||
public class PalletStatusMapConverter : DefaultTypeConverter
|
||||
{
|
||||
private static readonly PalletStatusConvertor _converter = new PalletStatusConvertor();
|
||||
public override string ConvertToString(object value, IWriterRow row, MemberMapData memberMapData)
|
||||
{
|
||||
// 使用IValueConverter转换逻辑
|
||||
return _converter.Convert(value, typeof(string), null, CultureInfo.InvariantCulture) as string;
|
||||
}
|
||||
}
|
||||
|
||||
public class MesDataMapConverter : DefaultTypeConverter
|
||||
{
|
||||
private static readonly SendFlagConvertor _converter = new SendFlagConvertor();
|
||||
|
||||
public override string ConvertToString(object value, IWriterRow row, MemberMapData memberMapData)
|
||||
{
|
||||
// 使用IValueConverter转换逻辑
|
||||
return _converter.Convert(value, typeof(string), null, CultureInfo.InvariantCulture) as string;
|
||||
}
|
||||
}
|
||||
|
||||
public class BatteryStatusMapConverter : DefaultTypeConverter
|
||||
{
|
||||
private static readonly BatteryStatusConvertor _converter = new BatteryStatusConvertor();
|
||||
public override string ConvertToString(object value, IWriterRow row, MemberMapData memberMapData)
|
||||
{
|
||||
// 使用IValueConverter转换逻辑
|
||||
return _converter.Convert(value, typeof(string), null, CultureInfo.InvariantCulture) as string;
|
||||
}
|
||||
}
|
||||
|
||||
public class PalletVirtualIdMapConverter : DefaultTypeConverter
|
||||
{
|
||||
private static readonly PalletVirtualIdConverter _converter = new PalletVirtualIdConverter();
|
||||
|
||||
public override string ConvertToString(object value, IWriterRow row, MemberMapData memberMapData)
|
||||
{
|
||||
// 使用IValueConverter转换逻辑
|
||||
return _converter.Convert(value, typeof(string), null, CultureInfo.InvariantCulture) as string;
|
||||
}
|
||||
}
|
||||
|
||||
public class CavityInfoIdMapConverter : DefaultTypeConverter
|
||||
{
|
||||
private static readonly CavityInfoIdConverter _converter = new CavityInfoIdConverter();
|
||||
|
||||
public override string ConvertToString(object value, IWriterRow row, MemberMapData memberMapData)
|
||||
{
|
||||
// 使用IValueConverter转换逻辑
|
||||
return _converter.Convert(value, typeof(string), null, CultureInfo.InvariantCulture) as string;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user