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.
273 lines
9.1 KiB
273 lines
9.1 KiB
4 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Data;
|
||
|
using System.Linq;
|
||
|
using QMFrameWork.Data;
|
||
|
using QMAPP.Entity;
|
||
|
using QMAPP.BLL;
|
||
|
using QMAPP.BLL.Sys;
|
||
|
using QMAPP.DAL;
|
||
|
using QMAPP.MD.BLL.Dict;
|
||
|
using QMAPP.MD.Entity;
|
||
|
using QMAPP.MD.DAL;
|
||
|
using QMAPP.FJC.DAL.QT;
|
||
|
|
||
|
|
||
|
namespace QMAPP.MD.BLL
|
||
|
{
|
||
|
/// </summary>
|
||
|
/// 模块名称:采集数据借口-状态码配置
|
||
|
/// 作 者:周晓东
|
||
|
/// 编写日期:2010514
|
||
|
/// </summary>
|
||
|
public class WorkCellStateBLL : BaseBLL
|
||
|
{
|
||
|
|
||
|
#region 获取信息
|
||
|
|
||
|
/// <summary>
|
||
|
/// 获取信息
|
||
|
/// </summary>
|
||
|
/// <param name="">条件</param>
|
||
|
/// <returns>信息</returns>
|
||
|
public WorkCellState Get(WorkCellState info)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
return new WorkCellStateDAL().Get(info);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 获取列表
|
||
|
|
||
|
/// <summary>
|
||
|
/// 获取列表
|
||
|
/// </summary>
|
||
|
/// <param name="condition">条件</param>
|
||
|
/// <param name="page">数据页</param>
|
||
|
/// <returns>数据页</returns>
|
||
|
public DataPage GetList(WorkCellState condition, DataPage page)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
var p = new WorkCellStateDAL().GetList(condition, page);
|
||
|
|
||
|
//#region 翻译
|
||
|
|
||
|
//List<WorkCellState> pList = p.Result as List<WorkCellState>;
|
||
|
|
||
|
//var workCellList = new WorkCellBLL().GetAllList(new WorkCell());
|
||
|
//var materialClassList = new MaterialBLL().GetMaterialClassList(new MaterialClass()).Result;
|
||
|
//var materialList = new MaterialBLL().GetMaterialList(new Material());
|
||
|
//var analyzerList = new AnalyzerDAL().GetList();
|
||
|
//var stateCodeList = GetWorkCellStateCodeList("");
|
||
|
//var UserList = new UserManageBLL().GetUserComboxSource();
|
||
|
//DictManageBLL dictDataType = new DictManageBLL(DictKind.DataType);
|
||
|
//DictManageBLL dictDaMode = new DictManageBLL(DictKind.DaMode);
|
||
|
//DictManageBLL dictIsProcessCode = new DictManageBLL(DictKind.IsProcessCode);
|
||
|
//DictManageBLL dictDivbyMould = new DictManageBLL(DictKind.DivbyMould);
|
||
|
//foreach (WorkCellState m in pList)
|
||
|
//{
|
||
|
// //采集类型
|
||
|
// m.DATA_TYPE_NAME = dictDataType.GetDictValue(m.DATA_TYPE);
|
||
|
// //采集方式
|
||
|
// m.DA_MODE_NAME = dictDaMode.GetDictValue(m.DA_MODE);
|
||
|
// //过程主码
|
||
|
// m.ISPROCESSCODE_NAME = dictIsProcessCode.GetDictValue(m.ISPROCESSCODE);
|
||
|
// //区分模具
|
||
|
// m.DIVBY_MOULD_NAME = dictDivbyMould.GetDictValue(m.DIVBY_MOULD);
|
||
|
// //工序
|
||
|
// var workCell = workCellList.FirstOrDefault(x => x.WORKCELL_CODE == m.WORKCELL_CODE);
|
||
|
// if (workCell != null)
|
||
|
// m.WORKCELL_NAME = workCell.WORKCELL_NAME;
|
||
|
// //物料类型
|
||
|
// var materialClass = materialClassList.FirstOrDefault(x => x.MATERIAL_TYPE_CODE == m.MATERIAL_TYPE);
|
||
|
// if (materialClass != null)
|
||
|
// m.MATERIAL_TYPE_NAME = materialClass.MATERIAL_TYPE_NAME;
|
||
|
// //物料号 如何MATERIAL_CODE==MATERIAL_TYPE说明页面选的是类型
|
||
|
// if (m.MATERIAL_TYPE == m.MATERIAL_CODE)
|
||
|
// {
|
||
|
// m.MATERIAL_CODE = null;
|
||
|
// }
|
||
|
// else
|
||
|
// {
|
||
|
// var material = materialList.FirstOrDefault(x => x.MATERIAL_CODE == m.MATERIAL_CODE);
|
||
|
// if (material != null)
|
||
|
// m.MATERIAL_CODE_NAME = material.MATERIAL_NAME;
|
||
|
// }
|
||
|
// //解析类别
|
||
|
// var analyzer = analyzerList.FirstOrDefault(x => x.ANALYZER_CODE == m.ANALYZE_CODE);
|
||
|
// if (analyzer != null)
|
||
|
// m.ANALYZE_CODE_NAME = analyzer.ANALYZER_NAME;
|
||
|
// //状态码
|
||
|
// var stateCode = stateCodeList.FirstOrDefault(x => x.STATE_CODE == m.STATE_CODE);
|
||
|
// if (stateCode != null)
|
||
|
// m.STATE_NAME = stateCode.STATE_NAME;
|
||
|
// //创建人员
|
||
|
// var userCreat = UserList.FirstOrDefault(x => x.UserID == m.CREATEUSER);
|
||
|
// if (userCreat != null)
|
||
|
// m.CREATEUSER_NAME = userCreat.UserName;
|
||
|
// //更新人员
|
||
|
// var userUpdate = UserList.FirstOrDefault(x => x.UserID == m.UPDATEUSER);
|
||
|
// if (userUpdate != null)
|
||
|
// m.UPDATEUSER_NAME = userUpdate.UserName;
|
||
|
//}
|
||
|
|
||
|
//#endregion
|
||
|
|
||
|
return p;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
|
||
|
#region 插入信息
|
||
|
/// <summary>
|
||
|
/// 插入信息(单表)
|
||
|
/// </summary>
|
||
|
/// <param name="">信息</param>
|
||
|
/// <returns>插入行数</returns>
|
||
|
public DataResult<int> Insert(WorkCellState info)
|
||
|
{
|
||
|
DataResult<int> result = new DataResult<int>();
|
||
|
try
|
||
|
{
|
||
|
|
||
|
//基本信息
|
||
|
info.PID = Guid.NewGuid().ToString();
|
||
|
info.CREATEUSER = this.LoginUser.UserID;
|
||
|
info.CREATEDATE = DateTime.Now;
|
||
|
info.UPDATEUSER = info.CREATEUSER;
|
||
|
info.UPDATEDATE = info.CREATEDATE;
|
||
|
//if (info.Details != null)
|
||
|
//{
|
||
|
// foreach (WorkCellStateData detail in info.Details)
|
||
|
// {
|
||
|
// detail.PID = Guid.NewGuid().ToString();
|
||
|
// detail.DA_CODE = info.PID;
|
||
|
// }
|
||
|
//}
|
||
|
WorkCellStateDAL cmdDAL = new WorkCellStateDAL();
|
||
|
result.Result = new WorkCellStateDAL().Insert(info);
|
||
|
result.IsSuccess = true;
|
||
|
return result;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region 更新信息
|
||
|
/// <summary>
|
||
|
/// 更新信息
|
||
|
/// </summary>
|
||
|
/// <param name="">信息</param>
|
||
|
/// <returns>更新行数</returns>
|
||
|
public DataResult<int> Update(WorkCellState info)
|
||
|
{
|
||
|
DataResult<int> result = new DataResult<int>();
|
||
|
try
|
||
|
{
|
||
|
info.UPDATEUSER = this.LoginUser.UserID;
|
||
|
info.UPDATEDATE = DateTime.Now;
|
||
|
//if (info.Details != null)
|
||
|
//{
|
||
|
// foreach (WorkCellStateData detail in info.Details)
|
||
|
// {
|
||
|
// detail.PID = Guid.NewGuid().ToString();
|
||
|
// detail.DA_CODE = info.PID;
|
||
|
// }
|
||
|
//}
|
||
|
result.Result = new WorkCellStateDAL().Update(info);
|
||
|
result.IsSuccess = true;
|
||
|
return result;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region 删除
|
||
|
/// <summary>
|
||
|
/// 删除信息
|
||
|
/// </summary>
|
||
|
/// <param name="">主键串</param>
|
||
|
/// <returns>删除个数</returns>
|
||
|
public DataResult<int> DeleteArray(string strs)
|
||
|
{
|
||
|
int count = 0;
|
||
|
DataResult<int> result = new DataResult<int>();
|
||
|
string[] list = strs.Split(":".ToCharArray());
|
||
|
try
|
||
|
{
|
||
|
foreach (string str in list)
|
||
|
{
|
||
|
count += this.Delete(new WorkCellState { PID = str });
|
||
|
}
|
||
|
result.Result = count;
|
||
|
result.IsSuccess = true;
|
||
|
return result;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 删除信息
|
||
|
/// </summary>
|
||
|
/// <param name="">信息</param>
|
||
|
/// <returns>删除个数</returns>
|
||
|
public int Delete(WorkCellState info)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
return new WorkCellStateDAL().Del(info);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
|
||
|
#region 获取录入退出
|
||
|
/// <summary>
|
||
|
/// 获取录入退出
|
||
|
/// </summary>
|
||
|
/// <returns>数据源</returns>
|
||
|
|
||
|
public List<WorkCellState> GetEntryExitActionList()
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
return new WorkCellStateDAL().GetEntryExitActionList();
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
throw e;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|