using System;
using System.Collections.Generic;
using System.Data;
using QMAPP.BLL;
using QMAPP.Entity;
using QMAPP.FJC.BLL.Dict;
using QMAPP.FJC.DAL.Operation;
using QMAPP.FJC.DAL.ProductIn;
using QMAPP.FJC.Entity;
using QMAPP.FJC.Entity.Operation;
using QMFrameWork.Data;
using QMFrameWork.Log;
namespace QMAPP.FJC.BLL.ProductIn
{
public class ProductInBLL : BaseBLL
{
#region 获取信息
///
/// 获取信息
///
/// 条件
/// 信息
public Entity.ProductIn.ProductIn Get(Entity.ProductIn.ProductIn model)
{
try
{
return new ProductInDAL().Get(model);
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "设备停机维护--获取停机信息"
});
throw ex;
}
}
public Entity.ProductIn.ProductIn GetInRecord(string productcode)
{
return new DAL.ProductIn.ProductInDAL().GetInRecord(productcode);
}
public Entity.ProductIn.ProductIn GetInRecordmp4(string productcode)
{
return new DAL.ProductIn.ProductInDAL().GetInRecordmp4(productcode);
}
#endregion
public DataResult GetListWeb(Entity.ProductIn.ProductIn condition, DataPage page)
{
DataResult result = new DataResult();
try
{
//获取信息列表
page = new ProductInDAL().GetList(condition, page);
#region 转换状态显示类型
//处理字典信息
DictManageBLL dict = new DictManageBLL(DictKind.INTTYPE);
foreach (var info in page.Result as List)
{
info.INTTYPE_NAME = dict.GetDictValue(info.INTTYPE);
}
#endregion
result.Result = page;
}
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;
}
//分页
public DataPage GetList(Entity.ProductIn.ProductIn condition, DataPage page)
{
try
{
var pageList= new ProductInDAL().GetList(condition, page);
DictManageBLL dictINTTYPE = new DictManageBLL(DictKind.INTTYPE);
foreach (var productIn in (List)pageList.Result)
{
productIn.INTTYPE_NAME = dictINTTYPE.GetDictValue(productIn.INTTYPE);
}
return pageList;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "入库--获取列表"
});
throw ex;
}
}
///
/// 获取列表
///
/// 条件
/// 全部数据
public List GetAllList(Entity.ProductIn.ProductIn condition)
{
try
{
return new ProductInDAL().GetAllList(condition);
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo { ErrorInfo = ex, Tag = ex.StackTrace, Info = "入库查询错误!" });
throw;
}
}
#region 更新信息
///
/// 更新信息
///
///
/// 更新行数
public DataResult Update(Entity.ProductIn.ProductIn model)
{
DataResult result = new DataResult
{
IsSuccess = true,
Msg = Resource.MsgSuccess
};
try
{
result.Result = new ProductInDAL().Update(model);
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo { ErrorInfo = ex, Tag = ex.StackTrace, Info = "更新表异常!" });
result.IsSuccess = false;
result.Msg = Resource.SystemException;
}
return result;
}
#endregion
#region 插入信息
///
/// 插入信息(单表)
///
/// 信息
/// 插入行数
public DataResult Insert(Entity.ProductIn.ProductIn model)
{
DataResult result = new DataResult();
try
{
//基本信息
model.PID = Guid.NewGuid().ToString();
model.INUSER = this.LoginUser.UserID;
model.INDATE = DateTime.Now;
result.Result = new ProductInDAL().Insert(model);
if (result.Result > 0)
{
result.IsSuccess = true;
result.Msg = Resource.MsgSuccess;
}
else
{
result.IsSuccess = false;
result.Msg = Resource.SystemException;
}
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "入库插入信息"
});
result.IsSuccess = false;
result.Msg = Resource.SystemException;
}
return result;
}
#endregion
#region 删除
///
/// 删除信息
///
///
/// 删除个数
public DataResult Delete(string str)
{
DataResult result = new DataResult();
//string[] list = strs.Split(":".ToCharArray());
try
{
result.Result = this.Del(new Entity.ProductIn.ProductIn { PID = str });
result.IsSuccess = true;
result.Msg = Resource.MsgSuccess;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "入库删除信息"
});
result.IsSuccess = false;
result.Msg = Resource.SystemException;
}
return result;
}
///
/// 删除信息
///
/// 信息
/// 删除个数
public int Del(Entity.ProductIn.ProductIn model)
{
int count = 0;
try
{
count = new ProductInDAL().Delete(model);
return count;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "视频类型维护--视频类型信息"
});
throw ex;
}
}
#endregion
#region 导出数据
///
/// 获取导出的数据
///
/// 查询条件
/// 数据
public DataResult GetExportData(Entity.ProductIn.ProductIn model)
{
DataResult result = new DataResult();
try
{
result.IsSuccess = true;
result.Result = new ProductInDAL().GetExportData(model);
//DataTable result = new ProductInDAL().GetExportData(model);
DictManageBLL dict = new DictManageBLL(DictKind.INTTYPE);
foreach (DataRow dr in result.Result.Rows)
{
//替换状态类别显示值
dr["INTTYPE"] = dict.GetDictValue(dr["INTTYPE"].ToString());
}
//return result;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "导出错误!"
});
result.IsSuccess = false;
result.Msg = "导出错误!";
}
return result;
}
#endregion
}
}