using iWareCommon.Common.Entity;
|
using iWareCommon.Utils;
|
using iWareDataCore.ORM;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace iWareDataCore.BASE.Entity
|
{
|
public class PlaceEntity : ICommonEntity<BASEPlace>
|
{
|
|
/// <summary>
|
/// 库位ID
|
/// </summary>
|
public int Id { get; set; }
|
|
/// <summary>
|
/// 库位编码
|
/// </summary>
|
public string Code { get; set; }
|
|
/// <summary>
|
/// 库位类型id
|
/// </summary>
|
public int TypeId { get; set; }
|
|
|
/// <summary>
|
/// 排
|
/// </summary>
|
public int Row { get; set; }
|
|
/// <summary>
|
/// 列
|
/// </summary>
|
public int Col { get; set; }
|
|
/// <summary>
|
/// 层
|
/// </summary>
|
public int Layer { get; set; }
|
/// <summary>
|
/// 长
|
/// </summary>
|
public decimal Length { get; set; }
|
|
/// <summary>
|
/// 宽
|
/// </summary>
|
public decimal Width { get; set; }
|
|
/// <summary>
|
/// 高
|
/// </summary>
|
public decimal Height { get; set; }
|
/// <summary>
|
/// 最大承重
|
/// </summary>
|
public decimal MaxWeight { get; set; }
|
/// <summary>
|
/// 档位
|
/// </summary>
|
public int HeightLevel { get; set; }
|
/// <summary>
|
/// X
|
/// </summary>
|
public int Posx { get; set; }
|
/// <summary>
|
/// Y
|
/// </summary>
|
public int Posy { get; set; }
|
/// <summary>
|
/// Z
|
/// </summary>
|
public int Posz { get; set; }
|
/// <summary>
|
/// 库位状态
|
/// </summary>
|
public int Status { get; set; }
|
|
/// <summary>
|
/// 库位锁
|
/// </summary>
|
public int IsLock { get; set; }
|
|
/// <summary>
|
/// 是否执行
|
/// </summary>
|
public int IsExecute { get; set; }
|
|
|
/// <summary>
|
/// 无参构造
|
/// </summary>
|
public PlaceEntity() { }
|
|
|
/// <summary>
|
/// 有参构造
|
/// </summary>
|
/// <param name="place">orm映射的类</param>
|
public PlaceEntity(BASEPlace place)
|
{
|
EntityPropHelper<PlaceEntity, BASEPlace>.CopyProp(place, this, GetColumnMap());
|
}
|
|
/// <summary>
|
/// 将对象转换成ORM中的类型
|
/// </summary>
|
/// <returns>Orm中的BASEPlace类型</returns>
|
public BASEPlace ToOrm()
|
{
|
var place = new BASEPlace();
|
|
EntityPropHelper<PlaceEntity, BASEPlace>.CopyProp(this, place, GetColumnMap());
|
|
return place;
|
}
|
|
/// <summary>
|
/// 转换视图的方法
|
/// </summary>
|
/// <param name="place"></param>
|
public PlaceEntity(PlaceViewEntity place)
|
{
|
var keys = GetColumnMap().Keys.ToList();
|
var columnMap = new Dictionary<string, string>();
|
keys.ForEach(x => columnMap.Add(x, x));
|
|
EntityPropHelper<PlaceEntity, PlaceViewEntity>.CopyProp(place, this, columnMap);
|
|
}
|
|
|
///<summary>
|
/// 获取自定义角色类中的字段名为键,orm中对象的字段名为值的字段
|
/// </summary>
|
/// <returns></returns>
|
public static Dictionary<string, string> GetColumnMap()
|
{
|
return new Dictionary<string, string>()
|
{
|
{"Id", "id"},
|
{"Code", "code"},
|
{"TypeId", "typeid"},
|
{"Row", "row"},
|
{"Col", "col"},
|
{"Layer", "layer"},
|
{"Width", "width"},
|
{"Length", "length"},
|
{"Height", "height"},
|
{"MaxWeight", "maxweight"},
|
{"HeightLevel", "heightlevel"},
|
{"Posx", "posx"},
|
{"Posy", "posy"},
|
{"Posz", "posz"},
|
{"Status", "status"},
|
{"IsLock", "islock"},
|
{"IsExecute", "isexecute"}
|
};
|
}
|
|
|
/// <summary>
|
/// 根据WareHouseAreaTypeEntity的字段转BASEPlace的字段
|
/// </summary>
|
/// <param name="name">WareHouseAreaTypeEntity的字段</param>
|
/// <returns>BASEPlace</returns>
|
public static string GetColumnName(string name)
|
{
|
var columnMap = GetColumnMap();
|
return columnMap.ContainsKey(name) ? columnMap[name] : name;
|
}
|
|
/// <summary>
|
/// 获取WareHouseAreaTypeEntity对应的表名
|
/// </summary>
|
/// <returns>表名</returns>
|
public static string GetTableName()
|
{
|
return "[dbo].[BASEPlace]";
|
}
|
|
}
|
}
|