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

308 lines
9.0 KiB

using System;
using System.Collections.Generic;
using QMAPP.BLL;
using QMAPP.Entity;
using QMAPP.MD.BLL.Dict;
using QMAPP.MD.DAL;
using QMAPP.MD.Entity;
using QMFrameWork.Data;
namespace QMAPP.MD.BLL
{
/// <summary>
/// 模块名称:工序
/// 作 者:郭兆福
/// 编写日期:2017年05月11日
/// </summary>
public class WorkCellBLL : BaseBLL
{
#region 获取信息
/// <summary>
/// 获取信息
/// </summary>
/// <param name="">条件</param>
/// <returns>信息</returns>
public DataResult<WorkCell> Get(WorkCell model)
{
DataResult<WorkCell> result = new DataResult<WorkCell>();
try
{
result.Result = new WorkCellDAL().Get(model);
}
catch (Exception ex)
{
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(WorkCell condition, DataPage page)
{
DataResult<DataPage> result = new DataResult<DataPage>();
try
{
//获取信息列表
DataPage dataPage = new WorkCellDAL().GetList(condition, page);
List<WorkCell> workCellList = dataPage.Result as List<WorkCell>;
DictManageBLL dictBackFlushFlagBll = new DictManageBLL(DictKind.BackFlushFlag);
foreach (WorkCell m in workCellList)
{
//反冲标识
m.FLAG_BACKFLUSH_NAME = dictBackFlushFlagBll.GetDictValue(m.FLAG_BACKFLUSH);
}
result.Result = dataPage;
}
catch (Exception ex)
{
result.IsSuccess = false;
result.Msg = Resource.SystemException;
throw ex;
}
result.IsSuccess = true;
return result;
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="condition">条件</param>
/// <returns>全部集合</returns>
public List<WorkCell> GetAllList(WorkCell condition)
{
try
{
//获取物料信息列表
List<WorkCell> list = new WorkCellDAL().GetList(condition);
return list;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 信息是否重复
/// <summary>
/// 判断编码名称是否存在
/// </summary>
/// <param name="info"></param>
/// <returns>true:不存在;false:已存在</returns>
public DataResult<bool> ExistsWorkCell(WorkCell model)
{
DataResult<bool> result = new DataResult<bool>();
try
{
if (new WorkCellDAL().IsExistsWorkCellCodeName(model) == true)
{
result.IsSuccess = false;
result.Msg = "相同的工序编码已经存在";
return result;
}
}
catch (Exception ex)
{
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> Insert(WorkCell model)
{
DataResult<int> result = new DataResult<int>();
WorkCellDAL cmdDAL = new WorkCellDAL();
//基本信息
model.FLGDEL = "0";
model.PID = Guid.NewGuid().ToString();
model.CREATEUSER = this.LoginUser.UserID;
model.UPDATEUSER = model.CREATEUSER;
try
{
DataResult<bool> isExist = new DataResult<bool>();
isExist = ExistsWorkCell(model);
if (isExist.IsSuccess == false)
{
result.IsSuccess = false;
result.Msg = isExist.Msg;
return result;
}
result.Result = new WorkCellDAL().Insert(model);
}
catch (Exception ex)
{
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(WorkCell model)
{
DataResult<int> result = new DataResult<int>();
//基本信息
model.UPDATEUSER = this.LoginUser.UserID;
try
{
DataResult<bool> isExist = new DataResult<bool>();
isExist = ExistsWorkCell(model);
if (isExist.IsSuccess == false)
{
result.IsSuccess = false;
result.Msg = isExist.Msg;
return result;
}
result.Result = new WorkCellDAL().Update(model);
}
catch (Exception ex)
{
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.DeleteProcessInfo(new WorkCell { PID = str });
}
}
catch (Exception ex)
{
result.IsSuccess = false;
result.Msg = Resource.SystemException;
throw ex;
}
result.IsSuccess = true;
return result;
}
/// <summary>
/// 删除信息
/// </summary>
/// <param name="">信息</param>
/// <returns>删除个数</returns>
public int DeleteProcessInfo(WorkCell model)
{
int count = 0;
try
{
count = new WorkCellDAL().Delete(model);
return count;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取工序下拉列表数据
/// <summary>
/// 获取工序下拉列表数据
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public List<WorkCell> GetWorkCellList(WorkCell model)
{
try
{
return new WorkCellDAL().GetWorkCellList(model);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取(联动)工序下拉列表数据
/// <summary>
/// 获取工序下拉列表数据
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public List<WorkCell> GetNewWorkCellList(WorkCell model,string routecode)
{
try
{
return new WorkCellDAL().GetWorkCellWithRouteList(model,routecode);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取(联动)工序下拉列表数据排序
/// <summary>
/// 获取工序下拉列表数据
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public List<WorkCell> GetNewWorkCellListSeq(string routecode)
{
try
{
return new WorkCellDAL().GetWorkCellWithRouteListSeq(routecode);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
}
}