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.
254 lines
8.1 KiB
254 lines
8.1 KiB
4 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using QMAPP.BLL;
|
||
|
using QMAPP.Entity;
|
||
|
using QMAPP.FJC.DAL.Andon;
|
||
|
using QMAPP.MD.Entity;
|
||
|
using QMFrameWork.Log;
|
||
|
using QMFrameWork.Data;
|
||
|
using QMAPP.MD.DAL;
|
||
|
|
||
|
namespace QMAPP.MD.BLL
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 作 用:班组成员
|
||
|
/// 作 者:周晓东
|
||
|
/// 编写日期:2017年11月21日
|
||
|
/// </summary>
|
||
|
public class ScheduleBLL : BaseBLL
|
||
|
{
|
||
|
#region 获取信息
|
||
|
/// <summary>
|
||
|
/// 获取信息
|
||
|
/// </summary>
|
||
|
/// <param name="">条件</param>
|
||
|
/// <returns>信息</returns>
|
||
|
public DataResult<ScheduleEntity> Get(ScheduleEntity model)
|
||
|
{
|
||
|
DataResult<ScheduleEntity> result = new DataResult<ScheduleEntity>();
|
||
|
try
|
||
|
{
|
||
|
result.Result = new ScheduleDAL().Get(model);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
result.IsSuccess = false;
|
||
|
result.Msg = Resource.SystemException;
|
||
|
throw ex;
|
||
|
}
|
||
|
result.IsSuccess = true;
|
||
|
return result;
|
||
|
}
|
||
|
public DataResult<ScheduleEntity> GetEntity(ScheduleEntity model)
|
||
|
{
|
||
|
DataResult<ScheduleEntity> result = new DataResult<ScheduleEntity>();
|
||
|
try
|
||
|
{
|
||
|
result.Result = new ScheduleDAL().GetEntity(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(ScheduleEntity condition, DataPage page)
|
||
|
{
|
||
|
DataResult<DataPage> result = new DataResult<DataPage>();
|
||
|
try
|
||
|
{
|
||
|
//获取班组信息列表
|
||
|
DataPage dataPage = new ScheduleDAL().GetList(condition, page);
|
||
|
|
||
|
#region
|
||
|
List<ScheduleEntity> InfoList = dataPage.Result as List<ScheduleEntity>;
|
||
|
var shiftList = new FJC.DAL.Basic.ProduceShiftDAL().GetList(new QMAPP.FJC.Entity.Basic.ProduceShift { PRODUCELINE="All" });
|
||
|
var teamList = new TeamBLL().GetAllTeam(new Team());
|
||
|
var factoryList = new FactoryBLL().GetFactoryList(new Factory());
|
||
|
foreach (ScheduleEntity m in InfoList)
|
||
|
{
|
||
|
//班次
|
||
|
var shift = shiftList.FirstOrDefault(x => x.PRODUCESHIFTTCODE == m.SHIFT_CODE.Trim());// && x.FACTORY_CODE == m.FACTORY_CODE);
|
||
|
if (shift != null)
|
||
|
m.SHIFT_NAME = shift.PRODUCESHIFTNAME;
|
||
|
//班组
|
||
|
var team = teamList.FirstOrDefault(x => x.TEAM_CODE == m.TEAM_CODE.Trim() && x.FACTORY_CODE == m.FACTORY_CODE);
|
||
|
if (team != null)
|
||
|
m.TEAM_NAME = team.TEAM_NAME;
|
||
|
//工厂
|
||
|
var factory = factoryList.Result.FirstOrDefault(x => x.FACTORY_CODE == m.FACTORY_CODE.Trim());
|
||
|
if (factory != null)
|
||
|
m.FACTORY_NAME = factory.FACTORY_NAME;
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
result.Result = dataPage;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
result.IsSuccess = false;
|
||
|
result.Msg = Resource.SystemException;
|
||
|
throw ex;
|
||
|
}
|
||
|
result.IsSuccess = true;
|
||
|
return result;
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
// <summary>
|
||
|
/// 获取全部用户
|
||
|
/// </summary>
|
||
|
/// <param name="condition">获取条件</param>
|
||
|
/// <returns>用户信息列表</returns>
|
||
|
public List<ScheduleEntity> GetAllSchedule(ScheduleEntity condition)
|
||
|
{
|
||
|
return new ScheduleDAL().GetAllSchedule(condition);
|
||
|
}
|
||
|
|
||
|
|
||
|
#region 插入信息
|
||
|
/// <summary>
|
||
|
/// 插入信息(单表)
|
||
|
/// </summary>
|
||
|
/// <param name="">信息</param>
|
||
|
/// <returns>插入行数</returns>
|
||
|
public DataResult<int> Insert(ScheduleEntity model)
|
||
|
{
|
||
|
DataResult<int> result = new DataResult<int>();
|
||
|
//基本信息
|
||
|
model.PID = Guid.NewGuid().ToString();
|
||
|
model.CREATEUSER = this.LoginUser.UserID;
|
||
|
model.CREATEDATE = DateTime.Now;
|
||
|
model.UPDATEUSER = model.CREATEUSER;
|
||
|
model.UPDATEDATE = model.CREATEDATE;
|
||
|
try
|
||
|
{
|
||
|
//if (ExistsTeam(model) == true)
|
||
|
//{
|
||
|
// result.IsSuccess = false;
|
||
|
// result.Msg = Resource.TeamCodeIsHave;
|
||
|
// return result;
|
||
|
//}
|
||
|
result.Result = new ScheduleDAL().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(ScheduleEntity model)
|
||
|
{
|
||
|
DataResult<int> result = new DataResult<int>();
|
||
|
//基本信息
|
||
|
model.UPDATEUSER = this.LoginUser.UserID;
|
||
|
//model.UPDATEDATE = DateTime.Now;
|
||
|
try
|
||
|
{
|
||
|
//if (ExistsTeam(model) == true)
|
||
|
//{
|
||
|
// result.IsSuccess = false;
|
||
|
// result.Msg = Resource.TeamCodeIsHave;
|
||
|
// return result;
|
||
|
//}
|
||
|
result.Result = new ScheduleDAL().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)
|
||
|
//{
|
||
|
// if (IsUsing(new ScheduleEntity { PID = str }) == true)
|
||
|
// {
|
||
|
// result.IsSuccess = false;
|
||
|
// result.Msg = Resource.WorkTeamIsUsing;
|
||
|
// return result;
|
||
|
// }
|
||
|
//}
|
||
|
foreach (string str in list)
|
||
|
{
|
||
|
result.Result += this.DeleteWorkTeam(new ScheduleEntity { 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 DeleteWorkTeam(ScheduleEntity model)
|
||
|
{
|
||
|
int count = 0;
|
||
|
try
|
||
|
{
|
||
|
count = new ScheduleDAL().Delete(model);
|
||
|
return count;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|