You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
259 lines
8.1 KiB
259 lines
8.1 KiB
4 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using QMAPP.BLL;
|
||
|
using QMAPP.FJC.Entity.Basic;
|
||
|
using QMFrameWork.Data;
|
||
|
using QMAPP.FJC.DAL.Basic;
|
||
|
using QMAPP.FJC.BLL.Dict;
|
||
|
using QMAPP.Entity;
|
||
|
using QMFrameWork.Log;
|
||
|
using QMAPP.FJC.Entity;
|
||
|
|
||
|
namespace QMAPP.FJC.BLL.Basic
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 模块编号:M2-4
|
||
|
/// 作 用:零件条码标识逻辑层
|
||
|
/// 作 者:王丹丹
|
||
|
/// 编写日期:2015年05月29日
|
||
|
///</summary>
|
||
|
public class ProductCodeIdentityBLL : BaseBLL
|
||
|
{
|
||
|
#region 获取信息
|
||
|
/// <summary>
|
||
|
/// 获取信息
|
||
|
/// </summary>
|
||
|
/// <param name="">条件</param>
|
||
|
/// <returns>信息</returns>
|
||
|
public DataResult<ProductCodeIdentity> Get(ProductCodeIdentity model)
|
||
|
{
|
||
|
DataResult<ProductCodeIdentity> result = new DataResult<ProductCodeIdentity>();
|
||
|
try
|
||
|
{
|
||
|
result.Result = new ProductCodeIdentityDAL().Get(model);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogManager.LogHelper.Error(new LogInfo()
|
||
|
{
|
||
|
ErrorInfo = ex,
|
||
|
Tag = ex.StackTrace,
|
||
|
Info = "零件条码标识逻辑层-获取信息!"
|
||
|
});
|
||
|
result.IsSuccess = false;
|
||
|
result.Msg = Resource.SystemException;
|
||
|
throw ex;
|
||
|
}
|
||
|
result.IsSuccess = true;
|
||
|
return result;
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region 获取列表
|
||
|
/// <summary>
|
||
|
/// 获取列表
|
||
|
/// </summary>
|
||
|
/// <param name="condition">条件</param>
|
||
|
/// <param name="page">数据页</param>
|
||
|
/// <returns>数据页</returns>
|
||
|
public DataResult<DataPage> GetList(ProductCodeIdentity condition, DataPage page)
|
||
|
{
|
||
|
DataResult<DataPage> result = new DataResult<DataPage>();
|
||
|
try
|
||
|
{
|
||
|
//获取信息列表
|
||
|
DataPage dataPage = new ProductCodeIdentityDAL().GetList(condition, page);
|
||
|
|
||
|
#region 转换零件类别类别显示类型
|
||
|
List<ProductCodeIdentity> materielList = dataPage.Result as List<ProductCodeIdentity>;
|
||
|
|
||
|
DictManageBLL dictProductTypeBll = new DictManageBLL(DictKind.PRODUCTTYPE);
|
||
|
|
||
|
foreach (ProductCodeIdentity m in materielList)
|
||
|
{
|
||
|
//零件类别
|
||
|
m.PRODUCTTYPETXT = dictProductTypeBll.GetDictValue(m.PRODUCTTYPE);
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
result.Result = dataPage;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogManager.LogHelper.Error(new LogInfo()
|
||
|
{
|
||
|
ErrorInfo = ex,
|
||
|
Tag = ex.StackTrace,
|
||
|
Info = "零件条码标识逻辑层-获取列表!"
|
||
|
});
|
||
|
result.IsSuccess = false;
|
||
|
result.Msg = Resource.SystemException;
|
||
|
throw ex;
|
||
|
}
|
||
|
result.IsSuccess = true;
|
||
|
return result;
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region 信息是否重复
|
||
|
/// <summary>
|
||
|
/// 判断名称是否存在
|
||
|
/// </summary>
|
||
|
/// <param name="info"></param>
|
||
|
/// <returns>true:已存在;fasel:不存在。</returns>
|
||
|
public bool ExistsProductCodeIdentity(ProductCodeIdentity model)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
return new ProductCodeIdentityDAL().ExistsProductCodeIdentity(model);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 插入信息
|
||
|
/// <summary>
|
||
|
/// 插入信息(单表)
|
||
|
/// </summary>
|
||
|
/// <param name="">信息</param>
|
||
|
/// <returns>插入行数</returns>
|
||
|
public DataResult<int> Insert(ProductCodeIdentity model)
|
||
|
{
|
||
|
DataResult<int> result = new DataResult<int>();
|
||
|
ProductCodeIdentityDAL cmdDAL = new ProductCodeIdentityDAL();
|
||
|
//基本信息
|
||
|
model.PID = Guid.NewGuid().ToString();
|
||
|
model.CREATEUSER = this.LoginUser.UserID;
|
||
|
model.CREATEDATE = DateTime.Now;
|
||
|
model.UPDATEUSER = model.CREATEUSER;
|
||
|
model.UPDATEDATE = model.CREATEDATE;
|
||
|
try
|
||
|
{
|
||
|
if (ExistsProductCodeIdentity(model) == true)
|
||
|
{
|
||
|
result.IsSuccess = false;
|
||
|
result.Msg = Resource.IsHaving;
|
||
|
return result;
|
||
|
}
|
||
|
result.Result = new ProductCodeIdentityDAL().Insert(model);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogManager.LogHelper.Error(new LogInfo()
|
||
|
{
|
||
|
ErrorInfo = ex,
|
||
|
Tag = ex.StackTrace,
|
||
|
Info = "零件条码标识逻辑层-插入信息!"
|
||
|
});
|
||
|
result.IsSuccess = false;
|
||
|
result.Msg = Resource.SystemException;
|
||
|
throw ex;
|
||
|
}
|
||
|
result.IsSuccess = true;
|
||
|
return result;
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region 更新信息
|
||
|
/// <summary>
|
||
|
/// 更新信息
|
||
|
/// </summary>
|
||
|
/// <param name=""></param>
|
||
|
/// <returns>更新行数</returns>
|
||
|
public DataResult<int> Update(ProductCodeIdentity model)
|
||
|
{
|
||
|
DataResult<int> result = new DataResult<int>();
|
||
|
//基本信息
|
||
|
model.UPDATEUSER = this.LoginUser.UserID;
|
||
|
try
|
||
|
{
|
||
|
if (ExistsProductCodeIdentity(model) == true)
|
||
|
{
|
||
|
result.IsSuccess = false;
|
||
|
result.Msg = Resource.IsHaving;
|
||
|
return result;
|
||
|
}
|
||
|
result.Result = new ProductCodeIdentityDAL().Update(model);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogManager.LogHelper.Error(new LogInfo()
|
||
|
{
|
||
|
ErrorInfo = ex,
|
||
|
Tag = ex.StackTrace,
|
||
|
Info = "零件条码标识逻辑层-更新信息!"
|
||
|
});
|
||
|
result.IsSuccess = false;
|
||
|
result.Msg = Resource.SystemException;
|
||
|
throw ex;
|
||
|
}
|
||
|
result.IsSuccess = true;
|
||
|
return result;
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region 删除
|
||
|
/// <summary>
|
||
|
/// 删除信息
|
||
|
/// </summary>
|
||
|
/// <param name=""></param>
|
||
|
/// <returns>删除个数</returns>
|
||
|
public DataResult<int> Delete(string strs)
|
||
|
{
|
||
|
DataResult<int> result = new DataResult<int>();
|
||
|
string[] list = strs.Split(":".ToCharArray());
|
||
|
try
|
||
|
{
|
||
|
foreach (string str in list)
|
||
|
{
|
||
|
result.Result += this.DeleteProductCodeIdentity(new ProductCodeIdentity { PID = str });
|
||
|
}
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogManager.LogHelper.Error(new LogInfo()
|
||
|
{
|
||
|
ErrorInfo = ex,
|
||
|
Tag = ex.StackTrace,
|
||
|
Info = "零件条码标识逻辑层-删除!"
|
||
|
});
|
||
|
result.IsSuccess = false;
|
||
|
result.Msg = Resource.SystemException;
|
||
|
throw ex;
|
||
|
}
|
||
|
result.IsSuccess = true;
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
|
||
|
/// <summary>
|
||
|
/// 删除信息
|
||
|
/// </summary>
|
||
|
/// <param name="">信息</param>
|
||
|
/// <returns>删除个数</returns>
|
||
|
public int DeleteProductCodeIdentity(ProductCodeIdentity model)
|
||
|
{
|
||
|
int count = 0;
|
||
|
try
|
||
|
{
|
||
|
count = new ProductCodeIdentityDAL().Delete(model);
|
||
|
return count;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
}
|
||
|
}
|