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

908 lines
39 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.BLL;
using QMAPP.Entity;
using QMAPP.FJC.Entity.ProcessParameter;
using QMAPP.FJC.Entity.ProductPetrospect;
using QMAPP.FJC.DAL.Produce;
using QMAPP.FJC.DAL.ProductPetrospect;
using System.Data;
using QMAPP.FJC.DAL.Operation;
using QMAPP.FJC.Entity.Operation;
using QMAPP.FJC.Entity.Produce;
using System.ComponentModel;
using System.Reflection;
using QMAPP.FJC.Entity.Basic;
using QMAPP.FJC.DAL.Basic;
using QMAPP.FJC.BLL.Dict;
using QMAPP.FJC.BLL.Operation;
using QMAPP.FJC.Entity;
using QMFrameWork.Log;
namespace QMAPP.FJC.BLL.ProductPetrospect
{
/// <summary>
/// 模块编号:M5-1
/// 作 用:产品档案逻辑层
/// 作 者:王丹丹
/// 编写日期:2015年06月08日
///</summary>
public class ProductArchivesBLL : BaseBLL
{
#region 获取加工参数信息
/// <summary>
/// 获取加工参数信息
/// </summary>
/// <param name="condition"></param>
/// <returns>DataTable</returns>
public DataResult<DataTable> GetProductParameter(ProductArchives condition)
{
MainDAL mainDal = new MainDAL();
ProductArchivesDAL paDal = new ProductArchivesDAL();
MainOperation mainPoeration = new MainOperation();
Main main = new Main();
DataResult<DataTable> dataResult = new DataResult<DataTable>();
DataTable dt = new DataTable();
try
{
//表皮条码
main.EPIDERMISCODE = condition.ERMISCODE;
//总成条码
main.MAINCODE = condition.MAINCODE;
main.PROCESSTYPE = condition.PROCESSTYPE;
main = mainDal.GetMain(main);
if (main == null)
{
dataResult.IsSuccess = false;
dataResult.Msg = "本体信息不存在!";
dataResult.Result = new DataTable();
return dataResult;
}
//获取加工记录信息
main.PROCESSTYPE = condition.PROCESSTYPE;
mainPoeration = paDal.GetMainOperation(main);
if (mainPoeration == null)
{
dataResult.IsSuccess = false;
dataResult.Msg = "加工记录不存在!";
dataResult.Result = new DataTable();
return dataResult;
}
//获取加工参数信息
dt = GetProductParameterInfoList(mainPoeration);
#region 获得加工参数标准值
var conditionPParameter = new ProcessParameter();
conditionPParameter.PROCESSTYPE = condition.PROCESSTYPE;
if (condition.PROCESSTYPE == EnumGeter.ProcessType.qinangzhijiazhusu.GetHashCode().ToString()
|| condition.PROCESSTYPE == EnumGeter.ProcessType.fengdaozhusu.GetHashCode().ToString()
|| condition.PROCESSTYPE == EnumGeter.ProcessType.HUDfengdaozhusu.GetHashCode().ToString()
)
{
conditionPParameter.PROCESSTYPE = EnumGeter.ProcessType.gujiazhusu.GetHashCode().ToString();
}
var listPParameter = new ProcessParameterDAL().GetList(conditionPParameter);
if (listPParameter == null || listPParameter.Count == 0)
{
dataResult.IsSuccess = false;
dataResult.Msg = "未指定加工参数标准值!";
dataResult.Result = new DataTable();
return dataResult;
}
#endregion
//加工参数信息转置,转换成显示在页面上的格式
dt = GetTransposeInfo(dt, listPParameter);
dataResult.Result = dt;
dataResult.IsSuccess = true;
return dataResult;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "产品档案逻辑层-获取加工参数信息!"
});
dataResult.IsSuccess = false;
dataResult.Msg = Resource.SystemException;
dataResult.Result = new DataTable();
throw ex;
}
}
public List<ProcessParameter> GetProductParameterNew1(ProductArchives condition)
{
ProductArchivesDAL paDal = new ProductArchivesDAL();
DataResult<DataTable> dataResult = new DataResult<DataTable>();
DataTable dt = new DataTable();
List<DataTable> dtList = new List<DataTable>();
try
{
if (string.IsNullOrEmpty(condition.ERMISCODE))
{
if (string.IsNullOrEmpty(condition.MAINCODE))
{
return null;
}
MainBLL mb = new MainBLL();
var m = mb.GetByCondition(new Main{publicCode=condition.MAINCODE});
if (m==null)
{
return null;
}
condition.ERMISCODE = m.EPIDERMISCODE;
}
//获取加工参数信息
dtList = paDal.GetTableParamter(condition.ERMISCODE);
#region 获得加工参数标准值
var conditionPParameter = new ProcessParameter();
var listPParameter = new ProcessParameterDAL().GetList(conditionPParameter);
#endregion
//加工参数信息转置,转换成显示在页面上的格式
//dt = GetTransposeInfoNew(dt);
return GetTransposeInfoNew1(dtList, listPParameter);
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "产品档案逻辑层-获取加工参数信息!"
});
dataResult.IsSuccess = false;
dataResult.Msg = Resource.SystemException;
dataResult.Result = new DataTable();
throw ex;
}
}
/// <summary>
/// 获取加工参数信息DataTable
/// </summary>
/// <param name="mainPoeration"></param>
/// <returns>DataTable</returns>
public DataTable GetProductParameterInfoList(MainOperation mainPoeration)
{
ProductArchivesDAL paDal = new ProductArchivesDAL();
DataTable dt = new DataTable();
try
{
switch (mainPoeration.PROCESSTYPE)
{
#region 获取加工参数
//获取搪塑加工参数
case "0":
SlushParamter slushParamter = new SlushParamter();
slushParamter.IOID = mainPoeration.PID;
dt = paDal.GetSlushParamter(slushParamter); break;
//获取注塑加工参数
case "1":
case "2":
case "3":
case "4":
case "5":
InJectionParameter inJectionParameter = new InJectionParameter();
inJectionParameter.MOID = mainPoeration.PID;
inJectionParameter.PRODUCTTYPE = mainPoeration.PRODUCTTYPE;
dt = paDal.GetInJectionParameter(inJectionParameter); break;
//获取冷刀弱化加工参数
case "6":
BurnParameter burnParameter = new BurnParameter();
burnParameter.MOID = mainPoeration.PID;
dt = paDal.GetBurnParameter(burnParameter); break;
//获取火焰加工参数
case "7":
FlamepParameter flamepParameter = new FlamepParameter();
flamepParameter.MOID = mainPoeration.PID;
dt = paDal.GetFlamepParameter(flamepParameter); break;
//获取预热参数
case "8":
PreheatParameter preheatParameter = new PreheatParameter();
preheatParameter.MOID = mainPoeration.PID;
dt = paDal.GetPreheatParameter(preheatParameter); break;
//获取浇注参数
case "9":
CastingParameter castingParameter = new CastingParameter();
castingParameter.MOID = mainPoeration.PID;
dt = paDal.GetCastingParameter(castingParameter); break;
//获取红外扫描参数
case "10":
HostcanPatameter hostcanPatameter = new HostcanPatameter();
hostcanPatameter.MOID = mainPoeration.PID;
dt = paDal.GetHostcanPatameter(hostcanPatameter); break;
//获取冲切参数
case "11":
PunchParameter punchParameter = new PunchParameter();
punchParameter.MOID = mainPoeration.PID;
dt = paDal.GetPunchParameter(punchParameter); break;
//获取铣削参数
case "12":
MilingParameter milingParameter = new MilingParameter();
milingParameter.MOID = mainPoeration.PID;
dt = paDal.GetMilingParameter(milingParameter); break;
//获取铆接参数
case "13":
RivetingPatameter rivetingPatameter = new RivetingPatameter();
rivetingPatameter.MOID = mainPoeration.PID;
dt = paDal.GetRivetingPatameter(rivetingPatameter); break;
//获取超时波焊接参数
case "14":
UltrasParameter ultrasParameter = new UltrasParameter();
ultrasParameter.MOID = mainPoeration.PID;
dt = paDal.GetUltrasParameter(ultrasParameter); break;
//获取红外焊接参数
case "15":
HotweldParameter hotweldParameter = new HotweldParameter();
hotweldParameter.MOID = mainPoeration.PID;
dt = paDal.GetHotweldParameter(hotweldParameter); break;
//获取总成装配参数
case "16":
AssembleParameter assembleParameter = new AssembleParameter();
assembleParameter.MOID = mainPoeration.PID;
dt = paDal.GetAssembleParameter(assembleParameter); break;
#endregion
}
return dt;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region DataTable转置
/// <summary>
/// DataTable转置
/// </summary>
/// <param name="dt"></param>
/// <returns></returns>
public DataTable GetTransposeInfo(DataTable dt, List<ProcessParameter> listPParameter)
{
DataTable dtBefore = new DataTable();
try
{
DataColumn dttxt = new DataColumn("PARAMETERNAME", typeof(string));
dtBefore.Columns.Add(dttxt);
DataColumn dtvalue = new DataColumn("PARAMETERVALUE", typeof(string));
dtBefore.Columns.Add(dtvalue);
if (dt.Rows.Count != 0)
{
for (int i = 0; i < dt.Columns.Count; i++)
{
//转换参数名称
var entityParam = listPParameter.FirstOrDefault(o => o.PARANAME == dt.Columns[i].ColumnName);
if (entityParam != null)
{
DataRow dr = dtBefore.NewRow();
//添加数据到DataTable
dr["PARAMETERNAME"] = entityParam.PARADESCRIBE;
dr["PARAMETERVALUE"] = dt.Rows[0][i];
dtBefore.Rows.Add(dr);
}
}
DataRow dr0 = dtBefore.NewRow();
//添加数据到DataTable
dr0["PARAMETERNAME"] = "产品条码";
dr0["PARAMETERVALUE"] = dt.Rows[0]["PRODUCTCODE"].ToString();
dtBefore.Rows.InsertAt(dr0,0);
}
return dtBefore;
}
catch (Exception ex)
{
throw ex;
}
}
public List<ProcessParameter> GetTransposeInfoNew1(List<DataTable> dtList, List<ProcessParameter> listPParameter)
{
List<ProcessParameter> dtBefore = new List<ProcessParameter>();
try
{
foreach (var dt in dtList)
{
if (dt.Rows.Count != 0)
{
var code = dt.Rows[0]["MACHINECODDE"].ToString();
if (listPParameter.FindAll(o => o.MACHINECODDE == code) != null)
{
List<ProcessParameter> newlist = listPParameter.FindAll(o => o.MACHINECODDE == code);
//if (dt.Rows.Count != 0)
//{
for (int i = 0; i < dt.Columns.Count; i++)
{
//转换参数名称
var columnName = dt.Columns[i].ColumnName;
var entityParam = newlist.FirstOrDefault(o => o.PARANAME == columnName);
if (entityParam != null)
{
entityParam.MEMO = dt.Rows[0][i].ToString();
dtBefore.Add(entityParam);
}
}
//DataRow dr0 = dtBefore.NewRow();
////添加数据到DataTable
//dr0["PARAMETERNAME"] = "产品条码";
//dr0["PARAMETERVALUE"] = dt.Rows[0]["PRODUCTCODE"].ToString();
//dtBefore.Rows.InsertAt(dr0, 0);
//}
}
}
}
return dtBefore.OrderBy(x=> x.MACHINECODDE).ToList();
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 导出数据
/// <summary>
/// 获取导出的数据
/// </summary>
/// <param name="user">查询条件</param>
/// <returns>数据</returns>
public DataResult<DataSet> GetExportData(ProductArchives condition)
{
MainDAL mainDal = new MainDAL();
ProductArchivesDAL paDal = new ProductArchivesDAL();
MainOperation mainPoeration = new MainOperation();
Main main = new Main();
DataResult<DataSet> dataResult = new DataResult<DataSet>();
try
{
//根据表皮条码获取本体信息
main.EPIDERMISCODE = condition.ERMISCODE;
main.MAINCODE = condition.MAINCODE;
main.PROCESSTYPE = condition.PROCESSTYPE;
main = mainDal.GetMain(main);
if (main == null)
{
dataResult.IsSuccess = false;
dataResult.Msg = "本体信息不存在!";
dataResult.Result = new DataSet();
return dataResult;
}
//获取加工记录信息
//mainPoeration.PROCESSTYPE = condition.PROCESSTYPE;
List<MainOperation> mainPoerations = paDal.GetMainOperations(main);
if (mainPoerations.Count <= 0)
{
dataResult.IsSuccess = false;
dataResult.Msg = "加工记录不存在!";
dataResult.Result = new DataSet();
return dataResult;
}
var conditionPParameter = new ProcessParameter();
#region 获取加工参数信息
//获取搪塑加工参数
DataTable dtSlush = new DataTable();
DataTable dtgujia = new DataTable();
DataTable dtqinangzhijia = new DataTable();
DataTable dtfengdao = new DataTable();
DataTable dthudfengdao = new DataTable();
DataTable dtBurn = new DataTable();
DataTable dtCasting = new DataTable();
DataTable dtPunch = new DataTable();
DataTable dtMiling = new DataTable();
DataTable dtUltras = new DataTable();
DataTable dtHot = new DataTable();
#region 获取数据信息
mainPoeration = mainPoerations.Find(m => m.PROCESSTYPE == EnumGeter.ProcessType.tangsu.GetHashCode().ToString());
if (mainPoeration != null)
{
conditionPParameter.PROCESSTYPE = EnumGeter.ProcessType.tangsu.GetHashCode().ToString();
var listPParameter = new ProcessParameterDAL().GetList(conditionPParameter);
if (listPParameter != null && listPParameter.Count >0)
{
SlushParamter slushParamter = new SlushParamter();
slushParamter.IOID = mainPoeration.PID;
dtSlush = paDal.GetSlushParamter(slushParamter);
//加工参数信息转置,转换成显示在页面上的格式
dtSlush = GetTransposeInfo(dtSlush, listPParameter);
}
}
//获取骨架注塑加工参数
mainPoeration = mainPoerations.Find(m => m.PROCESSTYPE == EnumGeter.ProcessType.gujiazhusu.GetHashCode().ToString()
&& m.PRODUCTTYPE == EnumGeter.ProductType.gujia.GetHashCode().ToString());
if (mainPoeration != null)
{
conditionPParameter.PROCESSTYPE = EnumGeter.ProcessType.gujiazhusu.GetHashCode().ToString();
var listPParameter = new ProcessParameterDAL().GetList(conditionPParameter);
if (listPParameter != null && listPParameter.Count > 0)
{
InJectionParameter gujiaParameter = new InJectionParameter();
gujiaParameter.MOID = mainPoeration.PID;
gujiaParameter.PRODUCTTYPE = EnumGeter.ProductType.gujia.GetHashCode().ToString();
dtgujia = paDal.GetInJectionParameter(gujiaParameter);
//DataRow dr = dtgujia.NewRow();
//dr[""] = "";
//dr[""] = "";
//dtgujia.Rows.InsertAt(dr, 0);
//加工参数信息转置,转换成显示在页面上的格式
dtgujia = GetTransposeInfo(dtgujia, listPParameter);
}
}
//获取气囊支架注塑加工参数
mainPoeration = mainPoerations.Find(m => m.PROCESSTYPE == EnumGeter.ProcessType.qinangzhijiazhusu.GetHashCode().ToString()
&& m.PRODUCTTYPE == EnumGeter.ProductType.qinangzhijia.GetHashCode().ToString());
if (mainPoeration != null)
{
conditionPParameter.PROCESSTYPE = EnumGeter.ProcessType.gujiazhusu.GetHashCode().ToString();
var listPParameter = new ProcessParameterDAL().GetList(conditionPParameter);
if (listPParameter != null && listPParameter.Count > 0)
{
InJectionParameter qinangzhijiaParameter = new InJectionParameter();
qinangzhijiaParameter.MOID = mainPoeration.PID;
qinangzhijiaParameter.PRODUCTTYPE = EnumGeter.ProductType.qinangzhijia.GetHashCode().ToString();
dtqinangzhijia = paDal.GetInJectionParameter(qinangzhijiaParameter);
//加工参数信息转置,转换成显示在页面上的格式
dtqinangzhijia = GetTransposeInfo(dtqinangzhijia, listPParameter);
}
}
//获取风道注塑加工参数
mainPoeration = mainPoerations.Find(m => m.PROCESSTYPE == EnumGeter.ProcessType.fengdaozhusu.GetHashCode().ToString()
&& m.PRODUCTTYPE == EnumGeter.ProductType.fengdao.GetHashCode().ToString());
if (mainPoeration != null)
{
conditionPParameter.PROCESSTYPE = EnumGeter.ProcessType.gujiazhusu.GetHashCode().ToString();
var listPParameter = new ProcessParameterDAL().GetList(conditionPParameter);
if (listPParameter != null && listPParameter.Count > 0)
{
InJectionParameter fengdaoParameter = new InJectionParameter();
fengdaoParameter.MOID = mainPoeration.PID;
fengdaoParameter.PRODUCTTYPE = EnumGeter.ProductType.fengdao.GetHashCode().ToString();
dtfengdao = paDal.GetInJectionParameter(fengdaoParameter);
//加工参数信息转置,转换成显示在页面上的格式
dtfengdao = GetTransposeInfo(dtfengdao, listPParameter);
}
}
//获取HUD风道注塑加工参数
mainPoeration = mainPoerations.Find(m => m.PROCESSTYPE == EnumGeter.ProcessType.HUDfengdaozhusu.GetHashCode().ToString()
&& m.PRODUCTTYPE == EnumGeter.ProductType.HUDfengdao.GetHashCode().ToString());
if (mainPoeration != null)
{
conditionPParameter.PROCESSTYPE = EnumGeter.ProcessType.gujiazhusu.GetHashCode().ToString();
var listPParameter = new ProcessParameterDAL().GetList(conditionPParameter);
if (listPParameter != null && listPParameter.Count > 0)
{
InJectionParameter hudfengdaoParameter = new InJectionParameter();
hudfengdaoParameter.MOID = mainPoeration.PID;
hudfengdaoParameter.PRODUCTTYPE = EnumGeter.ProductType.HUDfengdao.GetHashCode().ToString();
dthudfengdao = paDal.GetInJectionParameter(hudfengdaoParameter);
//加工参数信息转置,转换成显示在页面上的格式
dthudfengdao = GetTransposeInfo(dthudfengdao, listPParameter);
}
}
//获取冷刀弱化加工参数
mainPoeration = mainPoerations.Find(m => m.PROCESSTYPE == EnumGeter.ProcessType.lengdaoruohua.GetHashCode().ToString());
if (mainPoeration != null)
{
conditionPParameter.PROCESSTYPE = EnumGeter.ProcessType.lengdaoruohua.GetHashCode().ToString();
var listPParameter = new ProcessParameterDAL().GetList(conditionPParameter);
if (listPParameter != null && listPParameter.Count > 0)
{
BurnParameter burnParameter = new BurnParameter();
burnParameter.MOID = mainPoeration.PID;
dtBurn = paDal.GetBurnParameter(burnParameter);
//加工参数信息转置,转换成显示在页面上的格式
dtBurn = GetTransposeInfo(dtBurn, listPParameter);
}
}
//获取浇注参数
mainPoeration = mainPoerations.Find(m => m.PROCESSTYPE == EnumGeter.ProcessType.jiaozhu.GetHashCode().ToString());
if (mainPoeration != null)
{
conditionPParameter.PROCESSTYPE = EnumGeter.ProcessType.jiaozhu.GetHashCode().ToString();
var listPParameter = new ProcessParameterDAL().GetList(conditionPParameter);
if (listPParameter != null && listPParameter.Count > 0)
{
CastingParameter castingParameter = new CastingParameter();
castingParameter.MOID = mainPoeration.PID;
dtCasting = paDal.GetCastingParameter(castingParameter);
//加工参数信息转置,转换成显示在页面上的格式
dtCasting = GetTransposeInfo(dtCasting, listPParameter);
}
}
//获取冲切参数
mainPoeration = mainPoerations.Find(m => m.PROCESSTYPE == EnumGeter.ProcessType.chongqie.GetHashCode().ToString());
if (mainPoeration != null)
{
conditionPParameter.PROCESSTYPE = EnumGeter.ProcessType.chongqie.GetHashCode().ToString();
var listPParameter = new ProcessParameterDAL().GetList(conditionPParameter);
if (listPParameter != null && listPParameter.Count > 0)
{
PunchParameter punchParameter = new PunchParameter();
punchParameter.MOID = mainPoeration.PID;
dtPunch = paDal.GetPunchParameter(punchParameter);
//加工参数信息转置,转换成显示在页面上的格式
dtPunch = GetTransposeInfo(dtPunch, listPParameter);
}
}
//获取铣削参数
mainPoeration = mainPoerations.Find(m => m.PROCESSTYPE == EnumGeter.ProcessType.xixiao.GetHashCode().ToString());
if (mainPoeration != null)
{
conditionPParameter.PROCESSTYPE = EnumGeter.ProcessType.xixiao.GetHashCode().ToString();
var listPParameter = new ProcessParameterDAL().GetList(conditionPParameter);
if (listPParameter != null && listPParameter.Count > 0)
{
MilingParameter milingParameter = new MilingParameter();
milingParameter.MOID = mainPoeration.PID;
dtMiling = paDal.GetMilingParameter(milingParameter);
//加工参数信息转置,转换成显示在页面上的格式
dtMiling = GetTransposeInfo(dtMiling, listPParameter);
}
}
//获取超时波焊接参数
mainPoeration = mainPoerations.Find(m => m.PROCESSTYPE == EnumGeter.ProcessType.chaoshengbohanjie.GetHashCode().ToString());
if (mainPoeration != null)
{
conditionPParameter.PROCESSTYPE = EnumGeter.ProcessType.chaoshengbohanjie.GetHashCode().ToString();
var listPParameter = new ProcessParameterDAL().GetList(conditionPParameter);
if (listPParameter != null && listPParameter.Count > 0)
{
UltrasParameter ultrasParameter = new UltrasParameter();
ultrasParameter.MOID = mainPoeration.PID;
dtUltras = paDal.GetUltrasParameter(ultrasParameter);
//加工参数信息转置,转换成显示在页面上的格式
dtUltras = GetTransposeInfo(dtUltras, listPParameter);
}
}
//获取红外焊接参数
mainPoeration = mainPoerations.Find(m => m.PROCESSTYPE == EnumGeter.ProcessType.hongwaihanjie.GetHashCode().ToString());
if (mainPoeration != null)
{
conditionPParameter.PROCESSTYPE = EnumGeter.ProcessType.hongwaihanjie.GetHashCode().ToString();
var listPParameter = new ProcessParameterDAL().GetList(conditionPParameter);
if (listPParameter != null && listPParameter.Count > 0)
{
HotweldParameter hotweldParameter = new HotweldParameter();
hotweldParameter.MOID = mainPoeration.PID;
dtHot = paDal.GetHotweldParameter(hotweldParameter);
//加工参数信息转置,转换成显示在页面上的格式
dtHot = GetTransposeInfo(dtHot, listPParameter);
}
}
#endregion
#region 将不同工序类别的加工参数信息整理到DataSet
DataSet ds = new DataSet();
ds.DataSetName="Parameter";
#region
if (dtSlush.Rows.Count> 0 )
{
DataRow drSlush = dtSlush.NewRow();
//加一行工序分类标题,将导出的不同工序分割开
drSlush["PARAMETERNAME"] = "搪塑加工参数";
drSlush["PARAMETERVALUE"] = "";
dtSlush.Rows.InsertAt(drSlush, 0);
//获取搪塑加工参数
ds.Tables.Add(dtSlush);
}
if (dtgujia.Rows.Count > 0)
{
DataRow drgujia = dtgujia.NewRow();
drgujia["PARAMETERNAME"] = "骨架注塑加工参数";
drgujia["PARAMETERVALUE"] = "";
dtgujia.Rows.InsertAt(drgujia, 0);
ds.Tables.Add(dtgujia);
}
if (dtqinangzhijia.Rows.Count > 0)
{
DataRow drqinangzhijia = dtqinangzhijia.NewRow();
drqinangzhijia["PARAMETERNAME"] = "气囊支架注塑加工参数";
drqinangzhijia["PARAMETERVALUE"] = "";
dtqinangzhijia.Rows.InsertAt(drqinangzhijia, 0);
ds.Tables.Add(dtqinangzhijia);
}
if (dtfengdao.Rows.Count > 0)
{
DataRow drfengdao = dtfengdao.NewRow();
drfengdao["PARAMETERNAME"] = "风道注塑加工参数";
drfengdao["PARAMETERVALUE"] = "";
dtfengdao.Rows.InsertAt(drfengdao, 0);
ds.Tables.Add(dtfengdao);
}
if (dthudfengdao.Rows.Count > 0)
{
DataRow drhudfengdao = dthudfengdao.NewRow();
drhudfengdao["PARAMETERNAME"] = "HUD风道注塑加工参数";
drhudfengdao["PARAMETERVALUE"] = "";
dthudfengdao.Rows.InsertAt(drhudfengdao, 0);
ds.Tables.Add(dthudfengdao);
}
if (dtBurn.Rows.Count > 0)
{
DataRow drBurn = dtBurn.NewRow();
drBurn["PARAMETERNAME"] = "冷刀弱化加工参数";
drBurn["PARAMETERVALUE"] = "";
dtBurn.Rows.InsertAt(drBurn, 0);
//获取冷刀弱化加工参数
ds.Tables.Add(dtBurn);
}
if (dtCasting.Rows.Count > 0)
{
DataRow drCasting = dtCasting.NewRow();
drCasting["PARAMETERNAME"] = "浇注加工参数";
drCasting["PARAMETERVALUE"] = "";
dtCasting.Rows.InsertAt(drCasting, 0);
//获取浇注参数
ds.Tables.Add(dtCasting);
}
if (dtPunch.Rows.Count > 0)
{
DataRow drPunch = dtPunch.NewRow();
drPunch["PARAMETERNAME"] = "冲切加工参数";
drPunch["PARAMETERVALUE"] = "";
dtPunch.Rows.InsertAt(drPunch, 0);
//获取冲切参数
ds.Tables.Add(dtPunch);
}
if (dtMiling.Rows.Count > 0)
{
DataRow drMiling = dtMiling.NewRow();
drMiling["PARAMETERNAME"] = "铣削加工参数";
drMiling["PARAMETERVALUE"] = "";
dtMiling.Rows.InsertAt(drMiling, 0);
//获取铣削参数
ds.Tables.Add(dtMiling);
}
if (dtUltras.Rows.Count > 0)
{
DataRow drUltras = dtUltras.NewRow();
drUltras["PARAMETERNAME"] = "超声波焊接加工参数";
drUltras["PARAMETERVALUE"] = "";
dtUltras.Rows.InsertAt(drUltras, 0);
//获取超时波焊接参数
ds.Tables.Add(dtUltras);
}
if (dtHot.Rows.Count > 0)
{
DataRow drHot = dtHot.NewRow();
drHot["PARAMETERNAME"] = "红外焊接加工参数";
drHot["PARAMETERVALUE"] = "";
dtHot.Rows.InsertAt(drHot, 0);
//获取红外焊接参数
ds.Tables.Add(dtHot);
}
#endregion
#endregion
for (int i = 0; i < ds.Tables.Count; i++)
{
ds.Tables[i].Columns[0].ColumnName = "加工参数名称";
ds.Tables[i].Columns[1].ColumnName = "加工参数值";
}
dataResult.Result = ds;
dataResult.IsSuccess = true;
#endregion
if (string.IsNullOrEmpty(main.MAINCODE) == false)
{
dataResult.Msg = main.MAINCODE;
}
else
{
dataResult.Msg = main.EPIDERMISCODE;
}
return dataResult;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "产品档案逻辑层-获取加工参数信息!"
});
dataResult.IsSuccess = false;
dataResult.Msg = Resource.SystemException;
dataResult.Result = new DataSet();
throw ex;
}
}
public DataResult<List<ProcessParameter>> GetExportDataNew(ProductArchives condition)
{
MainDAL mainDal = new MainDAL();
ProductArchivesDAL paDal = new ProductArchivesDAL();
MainOperation mainPoeration = new MainOperation();
Main main = new Main();
DataResult<List<ProcessParameter>> dataResult = new DataResult<List<ProcessParameter>>();
List<DataTable> dtList = new List<DataTable>();
try
{
if (string.IsNullOrEmpty(condition.ERMISCODE))
{
if (string.IsNullOrEmpty(condition.MAINCODE))
{
return null;
}
MainBLL mb = new MainBLL();
var m = mb.GetByCondition(new Main { publicCode = condition.MAINCODE });
if (m == null)
{
return null;
}
condition.ERMISCODE = m.EPIDERMISCODE;
}
//获取加工参数信息
dtList = paDal.GetTableParamter(condition.ERMISCODE);
#region 获得加工参数标准值
var conditionPParameter = new ProcessParameter();
var listPParameter = new ProcessParameterDAL().GetList(conditionPParameter);
#endregion
//加工参数信息转置,转换成显示在页面上的格式
//dt = GetTransposeInfoNew(dt);
dataResult.Result = GetTransposeInfoNew1(dtList, listPParameter);
//dataResult.Result = ds;
dataResult.IsSuccess = true;
return dataResult;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "产品档案逻辑层-获取加工参数信息!"
});
dataResult.IsSuccess = false;
dataResult.Msg = Resource.SystemException;
dataResult.Result = null;
throw ex;
}
}
#endregion
/// <summary>
/// 获取本体信息
/// </summary>
/// <param name="condition"></param>
/// <returns></returns>
public Main GetMainInfo(ProductArchives condition)
{
Main main = new Main();
//根据表皮条码获取本体信息
main.EPIDERMISCODE = condition.ERMISCODE;
main.MAINCODE = condition.MAINCODE;
main.PROCESSTYPE = condition.PROCESSTYPE;
try
{
return new MainDAL().GetMain(main);
}
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 MainOperation GetMainOperationInfo(ProductArchives condition)
{
ProductArchivesDAL paDal = new ProductArchivesDAL();
MainOperation mainPoeration = new MainOperation();
Main main = new Main();
main.PROCESSTYPE = condition.PROCESSTYPE;
try
{
return new ProductArchivesDAL().GetMainOperation(main);
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "产品档案逻辑层-获取加工记录信息!"
});
throw ex;
}
}
}
}