天津投入产出系统后端
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.
 
 
 
 
 
 

300 lines
9.4 KiB

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 获取信息
/// <summary>
/// 获取信息
/// </summary>
/// <param name="">条件</param>
/// <returns>信息</returns>
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<DataPage> GetListWeb(Entity.ProductIn.ProductIn condition, DataPage page)
{
DataResult<DataPage> result = new DataResult<DataPage>();
try
{
//获取信息列表
page = new ProductInDAL().GetList(condition, page);
#region 转换状态显示类型
//处理字典信息
DictManageBLL dict = new DictManageBLL(DictKind.INTTYPE);
foreach (var info in page.Result as List<Entity.ProductIn.ProductIn>)
{
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<Entity.ProductIn.ProductIn>)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;
}
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="condition">条件</param>
/// <returns>全部数据</returns>
public List<Entity.ProductIn.ProductIn> 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 更新信息
/// <summary>
/// 更新信息
/// </summary>
/// <param name="model"></param>
/// <returns>更新行数</returns>
public DataResult<int> Update(Entity.ProductIn.ProductIn model)
{
DataResult<int> result = new DataResult<int>
{
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 插入信息
/// <summary>
/// 插入信息(单表)
/// </summary>
/// <param name="">信息</param>
/// <returns>插入行数</returns>
public DataResult<int> Insert(Entity.ProductIn.ProductIn model)
{
DataResult<int> result = new DataResult<int>();
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 删除
/// <summary>
/// 删除信息
/// </summary>
/// <param name=""></param>
/// <returns>删除个数</returns>
public DataResult<int> Delete(string str)
{
DataResult<int> result = new DataResult<int>();
//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;
}
/// <summary>
/// 删除信息
/// </summary>
/// <param name="">信息</param>
/// <returns>删除个数</returns>
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 导出数据
/// <summary>
/// 获取导出的数据
/// </summary>
/// <param name="user">查询条件</param>
/// <returns>数据</returns>
public DataResult<DataTable> GetExportData(Entity.ProductIn.ProductIn model)
{
DataResult<DataTable> result = new DataResult<DataTable>();
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
}
}