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.
880 lines
35 KiB
880 lines
35 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using QMAPP.FJC.Entity.Basic;
|
|
using QMAPP.FJC.Entity.Operation;
|
|
using QMFrameWork.Data;
|
|
using QMAPP.FJC.Entity.ProcessParameter;
|
|
using QMAPP.FJC.DAL;
|
|
using System.Reflection;
|
|
using QMFrameWork.Log;
|
|
using QMAPP.FJC.Entity.QT;
|
|
using QMAPP.FJC.DAL.QT;
|
|
|
|
namespace QMAPP.FJC.BLL.Process
|
|
{
|
|
/// <summary>
|
|
/// 加工参数处理类
|
|
/// </summary>
|
|
public class ParameterDeal
|
|
{
|
|
private List<ParameterConfig> paraList;
|
|
|
|
private IDataSession session;
|
|
|
|
private MainOperation mainOpe;
|
|
|
|
/// <summary>
|
|
/// 插入加工参数
|
|
/// </summary>
|
|
/// <param name="paraList"></param>
|
|
/// <param name="entity"></param>
|
|
/// <param name="session"></param>
|
|
public void InsertParameter(List<ParameterConfig> paraList, MainOperation entity, IDataSession session)
|
|
{
|
|
this.paraList = paraList;
|
|
this.session = session;
|
|
this.mainOpe = entity;
|
|
|
|
try
|
|
{
|
|
switch (entity.PROCESSTYPE)
|
|
{
|
|
case "0":
|
|
//插入搪塑加工参数
|
|
InsertSlushParameter();
|
|
break;
|
|
|
|
case "6":
|
|
//插入冷刀弱化加工参数
|
|
InsertBurnParameter();
|
|
break;
|
|
|
|
case "9":
|
|
//插入浇注加工参数
|
|
InsertCastingParameter();
|
|
break;
|
|
|
|
case "11":
|
|
//插入冲切加工参数
|
|
InsertPunchParameter();
|
|
break;
|
|
case "12":
|
|
//插入铣削加工参数
|
|
InsertMilingParameter();
|
|
break;
|
|
|
|
case "14":
|
|
//插入超声波加工参数
|
|
InsertUltrasParameter();
|
|
break;
|
|
|
|
case "15":
|
|
//插入红外焊接加工参数
|
|
InsertHotweldParameter();
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
///插入搪塑加工参数
|
|
private void InsertSlushParameter()
|
|
{
|
|
|
|
SlushParamter slushParamter = new SlushParamter();
|
|
try
|
|
{
|
|
slushParamter.PID = Guid.NewGuid().ToString();
|
|
slushParamter.IOID = mainOpe.PID;
|
|
slushParamter.EID = mainOpe.PDID;
|
|
slushParamter.PRODUCTCODE = mainOpe.PRODUCTCODE;
|
|
slushParamter.MACHINECODDE = mainOpe.MACHINECODDE;
|
|
slushParamter.MACHINENAME = mainOpe.MACHINENAME;
|
|
slushParamter.CREATEDATE = System.DateTime.Now;
|
|
|
|
Type t = typeof(SlushParamter);
|
|
|
|
foreach (ParameterConfig pc in paraList)
|
|
{
|
|
t.GetProperty(pc.COLUMNCODE).SetValue(slushParamter, pc.PARAVALUE, null);
|
|
}
|
|
|
|
//SlushParamterDAL slushParaDal = new SlushParamterDAL();
|
|
//slushParaDal.BaseSession = session;
|
|
//slushParaDal.Insert(slushParamter);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 插入注塑加工参数
|
|
/// </summary>
|
|
private void InsertInjection()
|
|
{
|
|
InJectionParameter parameter = new InJectionParameter();
|
|
|
|
parameter.PID = Guid.NewGuid().ToString();
|
|
parameter.MOID = mainOpe.PID;
|
|
parameter.PDID = mainOpe.PDID;
|
|
parameter.PRODUCTTYPE = mainOpe.PRODUCTTYPE;
|
|
parameter.PRODUCTCODE = mainOpe.PRODUCTCODE;
|
|
parameter.MACHINECODDE = mainOpe.MACHINECODDE;
|
|
parameter.MACHINENAME = mainOpe.MACHINENAME;
|
|
parameter.CREATEDATE = System.DateTime.Now;
|
|
|
|
Type t = typeof(InJectionParameter);
|
|
|
|
foreach (ParameterConfig pc in paraList)
|
|
{
|
|
t.GetProperty(pc.COLUMNCODE).SetValue(parameter, pc.PARAVALUE, null);
|
|
}
|
|
|
|
//InjectionParameterDAL injectParaDal = new InjectionParameterDAL();
|
|
//injectParaDal.BaseSession = session;
|
|
//injectParaDal.Insert(parameter);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 插入冷刀弱化加工参数
|
|
/// </summary>
|
|
private void InsertBurnParameter()
|
|
{
|
|
|
|
try
|
|
{
|
|
BurnParameter parameter = new BurnParameter();
|
|
|
|
parameter.PID = Guid.NewGuid().ToString();
|
|
parameter.MOID = mainOpe.PID;
|
|
parameter.PDID = mainOpe.PDID;
|
|
parameter.PRODUCTTYPE = mainOpe.PRODUCTTYPE;
|
|
parameter.PRODUCTCODE = mainOpe.PRODUCTCODE;
|
|
parameter.MACHINECODDE = mainOpe.MACHINECODDE;
|
|
parameter.MACHINENAME = mainOpe.MACHINENAME;
|
|
parameter.CREATEDATE = System.DateTime.Now;
|
|
|
|
|
|
Type t = typeof(BurnParameter);
|
|
|
|
List<ParameterConfig> decimalList = paraList.Where(o => o.DATATYPE == "DECIMAL")
|
|
.ToList<ParameterConfig>();
|
|
|
|
foreach (ParameterConfig pc in decimalList)
|
|
{
|
|
var decimalValue = Convert.ToDecimal(pc.PARAVALUE);
|
|
t.GetProperty(pc.COLUMNCODE).SetValue(parameter, decimalValue, null);
|
|
}
|
|
|
|
List<ParameterConfig> otherList = paraList.Except(decimalList).ToList<ParameterConfig>();
|
|
|
|
//胎具号
|
|
if (otherList.Count(o => o.COLUMNCODE == "TOOLCODE") > 0)
|
|
{
|
|
parameter.TOOLCODE = otherList.First(o => o.COLUMNCODE == "TOOLCODE").PARAVALUE == null ? "" : otherList.First(o => o.COLUMNCODE == "TOOLCODE").PARAVALUE.ToString();
|
|
}
|
|
|
|
if (otherList.Count(o => o.COLUMNCODE == "BLADECOUNTER") > 0)
|
|
{
|
|
parameter.BLADECOUNTER = otherList.First(o => o.COLUMNCODE == "BLADECOUNTER").PARAVALUE == null ? "" : otherList.First(o => o.COLUMNCODE == "BLADECOUNTER").PARAVALUE.ToString();
|
|
}
|
|
|
|
if (otherList.Count(o => o.COLUMNCODE == "PROGRAMNUMBER") > 0)
|
|
{
|
|
parameter.PROGRAMNUMBER = otherList.First(o => o.COLUMNCODE == "PROGRAMNUMBER").PARAVALUE == null ? "" : otherList.First(o => o.COLUMNCODE == "PROGRAMNUMBER").PARAVALUE.ToString();
|
|
}
|
|
|
|
if (otherList.Count(o => o.COLUMNCODE == "RESULT") > 0)
|
|
{
|
|
parameter.RESULT = otherList.First(o => o.COLUMNCODE == "RESULT").PARAVALUE == null ? "" : otherList.First(o => o.COLUMNCODE == "RESULT").PARAVALUE.ToString();
|
|
}
|
|
|
|
if (otherList.Count(o => o.COLUMNCODE == "INDENTITYCODE") > 0)
|
|
{
|
|
parameter.INDENTITYCODE = otherList.First(o => o.COLUMNCODE == "INDENTITYCODE").PARAVALUE == null ? "" : otherList.First(o => o.COLUMNCODE == "INDENTITYCODE").PARAVALUE.ToString();
|
|
}
|
|
|
|
|
|
//固定
|
|
parameter.MACHINECODE = "3";
|
|
|
|
#region 脱模剂
|
|
|
|
List<ParameterConfig> releaseList = paraList.Where(o => o.COLUMNCODE.Contains("RELEASE")).OrderBy(o => o.COLUMNCODE)
|
|
.ToList<ParameterConfig>();
|
|
|
|
string releaseResult = "";
|
|
foreach (var re in releaseList)
|
|
{
|
|
releaseResult += ((char)Convert.ToInt32(re.PARAVALUE)).ToString();
|
|
}
|
|
|
|
parameter.RELEASE = releaseResult.Trim();
|
|
|
|
#endregion
|
|
|
|
|
|
#region 工作时间
|
|
|
|
List<ParameterConfig> workList = paraList.Where(o => o.COLUMNCODE.Contains("WORKTIME"))
|
|
.ToList<ParameterConfig>();
|
|
|
|
if (workList.Count > 0)
|
|
{
|
|
|
|
string workTime = "";
|
|
if (workList.Count(o => o.COLUMNCODE == "WORKTIMEHOURDEC") > 0)
|
|
{
|
|
workTime += workList.First(o => o.COLUMNCODE == "WORKTIMEHOURDEC").PARAVALUE == null ? "" : ((char)Convert.ToInt32(otherList.First(o => o.COLUMNCODE == "WORKTIMEHOURDEC").PARAVALUE.ToString())).ToString();
|
|
}
|
|
|
|
if (workList.Count(o => o.COLUMNCODE == "WORKTIMEHOUR") > 0)
|
|
{
|
|
workTime += workList.First(o => o.COLUMNCODE == "WORKTIMEHOUR").PARAVALUE == null ? "" : ((char)Convert.ToInt32(otherList.First(o => o.COLUMNCODE == "WORKTIMEHOUR").PARAVALUE.ToString())).ToString();
|
|
|
|
}
|
|
workTime += ":";
|
|
if (workList.Count(o => o.COLUMNCODE == "WORKTIMEMINUTEDEC") > 0)
|
|
{
|
|
workTime += workList.First(o => o.COLUMNCODE == "WORKTIMEMINUTEDEC").PARAVALUE == null ? "" : ((char)Convert.ToInt32(otherList.First(o => o.COLUMNCODE == "WORKTIMEMINUTEDEC").PARAVALUE.ToString())).ToString();
|
|
}
|
|
|
|
if (workList.Count(o => o.COLUMNCODE == "WORKTIMEMINUTE") > 0)
|
|
{
|
|
workTime += workList.First(o => o.COLUMNCODE == "WORKTIMEMINUTE").PARAVALUE == null ? "" : ((char)Convert.ToInt32(otherList.First(o => o.COLUMNCODE == "WORKTIMEMINUTE").PARAVALUE.ToString())).ToString();
|
|
}
|
|
|
|
parameter.WORKTIME = workTime;
|
|
}
|
|
|
|
#endregion
|
|
|
|
//BurnParameterDAL burnParaDal = new BurnParameterDAL();
|
|
//burnParaDal.BaseSession = session;
|
|
//burnParaDal.Insert(parameter);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
LogManager.LogHelper.Error(new LogInfo() {
|
|
ErrorInfo=ex,
|
|
Info = "插入冷刀加工参数异常!加工记录主键:" + mainOpe.PID
|
|
});
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 插入火焰加工参数信息
|
|
/// </summary>
|
|
private void InsertFlameParameter()
|
|
{
|
|
FlamepParameter parameter = new FlamepParameter();
|
|
|
|
parameter.PID = Guid.NewGuid().ToString();
|
|
parameter.MOID = mainOpe.PID;
|
|
parameter.PDID = mainOpe.PDID;
|
|
parameter.PRODUCTTYPE = mainOpe.PRODUCTTYPE;
|
|
parameter.PRODUCTCODE = mainOpe.PRODUCTCODE;
|
|
parameter.MACHINECODDE = mainOpe.MACHINECODDE;
|
|
parameter.MACHINENAME = mainOpe.MACHINENAME;
|
|
parameter.CREATEDATE = System.DateTime.Now;
|
|
|
|
Type t = typeof(FlamepParameter);
|
|
|
|
foreach (ParameterConfig pc in paraList)
|
|
{
|
|
t.GetProperty(pc.COLUMNCODE).SetValue(parameter, pc.PARAVALUE, null);
|
|
}
|
|
|
|
//FlameParameterDAL flameParaDal = new FlameParameterDAL();
|
|
//flameParaDal.BaseSession = session;
|
|
//flameParaDal.Insert(parameter);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 插入预热加工参数
|
|
/// </summary>
|
|
private void InsertPreheatParameter()
|
|
{
|
|
PreheatParameter parameter = new PreheatParameter();
|
|
parameter.PID = Guid.NewGuid().ToString();
|
|
parameter.MOID = mainOpe.PID;
|
|
parameter.PDID = mainOpe.PDID;
|
|
parameter.PRODUCTTYPE = mainOpe.PRODUCTTYPE;
|
|
parameter.PRODUCTCODE = mainOpe.PRODUCTCODE;
|
|
parameter.MACHINECODDE = mainOpe.MACHINECODDE;
|
|
parameter.MACHINENAME = mainOpe.MACHINENAME;
|
|
parameter.CREATEDATE = System.DateTime.Now;
|
|
|
|
Type t = typeof(PreheatParameter);
|
|
|
|
foreach (ParameterConfig pc in paraList)
|
|
{
|
|
t.GetProperty(pc.COLUMNCODE).SetValue(parameter, pc.PARAVALUE, null);
|
|
}
|
|
|
|
//PreHeatParameterDAL paraDal = new PreHeatParameterDAL();
|
|
//paraDal.BaseSession = session;
|
|
//paraDal.Insert(parameter);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 插入浇注加工参数
|
|
/// </summary>
|
|
private void InsertCastingParameter()
|
|
{
|
|
CastingParameter parameter = new CastingParameter();
|
|
parameter.PID = Guid.NewGuid().ToString();
|
|
parameter.MOID = mainOpe.PID;
|
|
parameter.PDID = mainOpe.PDID;
|
|
parameter.PRODUCTTYPE = mainOpe.PRODUCTTYPE;
|
|
parameter.PRODUCTCODE = mainOpe.PRODUCTCODE;
|
|
parameter.MACHINECODDE = mainOpe.MACHINECODDE;
|
|
parameter.MACHINENAME = mainOpe.MACHINENAME;
|
|
//parameter.CREATEDATE = System.DateTime.Now;
|
|
|
|
|
|
try
|
|
{
|
|
#region 操作时间
|
|
|
|
//string year = paraList.First(o => o.COLUMNCODE.Contains("YEAR")).PARAVALUE.ToString();
|
|
//string month = paraList.First(o => o.COLUMNCODE.Contains("MONTH")).PARAVALUE.ToString();
|
|
//string day = paraList.First(o => o.COLUMNCODE.Contains("DAY")).PARAVALUE.ToString();
|
|
//string hour = paraList.First(o => o.COLUMNCODE.Contains("HOUR")).PARAVALUE.ToString();
|
|
//string minnute = paraList.First(o => o.COLUMNCODE.Contains("MINUTE")).PARAVALUE.ToString();
|
|
//string second = paraList.First(o => o.COLUMNCODE.Contains("SECOND")).PARAVALUE.ToString();
|
|
//Convert.ToDateTime(year + "-" + month + "-" + day + " " + hour + ":" + minnute + ":" + second);
|
|
parameter.CREATEDATE = System.DateTime.Now;
|
|
|
|
#endregion
|
|
|
|
try
|
|
{
|
|
var moldnumber = paraList.First(o => o.COLUMNCODE.Contains("MOULDNO")).PARAVALUE;
|
|
if (moldnumber != null && string.IsNullOrEmpty(moldnumber.ToString()) == false)
|
|
{
|
|
parameter.MOULDNUMBER = Convert.ToInt32(moldnumber);
|
|
}
|
|
|
|
var flowOjb = paraList.First(o => o.COLUMNCODE.Contains("FLOW")).PARAVALUE;
|
|
if (flowOjb != null && string.IsNullOrEmpty(flowOjb.ToString()) == false)
|
|
{
|
|
parameter.FLOW = Convert.ToDecimal(flowOjb);
|
|
}
|
|
|
|
var stressPercentObj = paraList.First(o => o.COLUMNCODE.Contains("STRESSPERCENT")).PARAVALUE;
|
|
if (stressPercentObj != null && string.IsNullOrEmpty(stressPercentObj.ToString()) == false)
|
|
{
|
|
parameter.STRESSPERCENT = Convert.ToDecimal(stressPercentObj);
|
|
}
|
|
|
|
var temp1 = paraList.First(o => o.COLUMNCODE.Contains("METARIALTEMPRATURE")).PARAVALUE;
|
|
if (temp1 != null && string.IsNullOrEmpty(temp1.ToString()) == false)
|
|
{
|
|
parameter.METARIALTEMPRATURE = Convert.ToDecimal(temp1);
|
|
}
|
|
|
|
var temp2 = paraList.First(o => o.COLUMNCODE.Contains("METARIALTEMPRATURETWO")).PARAVALUE;
|
|
if (temp2 != null && string.IsNullOrEmpty(temp2.ToString()) == false)
|
|
{
|
|
parameter.METARIALTEMPRATURETWO = Convert.ToDecimal(temp2);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogManager.LogHelper.Error(new LogInfo() { Info = ex.Message });
|
|
|
|
}
|
|
|
|
|
|
//CastingParameterDAL paraDal = new CastingParameterDAL();
|
|
//paraDal.BaseSession = session;
|
|
//paraDal.Insert(parameter);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogManager.LogHelper.Error(new LogInfo() { Info = ex.Message });
|
|
|
|
}
|
|
}
|
|
|
|
public void InsertCastingParameter(List<ParameterConfig> paraList)
|
|
{
|
|
|
|
try
|
|
{
|
|
CastingParameter parameter = new CastingParameter();
|
|
parameter.PID = Guid.NewGuid().ToString();
|
|
parameter.MOID = Guid.NewGuid().ToString();
|
|
parameter.PDID = Guid.NewGuid().ToString();
|
|
parameter.PRODUCTTYPE = "1";
|
|
parameter.PRODUCTCODE = "";
|
|
parameter.MACHINECODDE = "009";
|
|
parameter.MACHINENAME = "009";
|
|
//parameter.CREATEDATE = System.DateTime.Now;
|
|
|
|
|
|
#region 操作时间
|
|
|
|
string year = paraList.First(o => o.COLUMNCODE.Contains("YEAR")).PARAVALUE.ToString();
|
|
string month = paraList.First(o => o.COLUMNCODE.Contains("MONTH")).PARAVALUE.ToString();
|
|
string day = paraList.First(o => o.COLUMNCODE.Contains("DAY")).PARAVALUE.ToString();
|
|
string hour = paraList.First(o => o.COLUMNCODE.Contains("HOUR")).PARAVALUE.ToString();
|
|
string minnute = paraList.First(o => o.COLUMNCODE.Contains("MINUTE")).PARAVALUE.ToString();
|
|
string second = paraList.First(o => o.COLUMNCODE.Contains("SECOND")).PARAVALUE.ToString();
|
|
parameter.CREATEDATE = Convert.ToDateTime(year + "-" + month + "-" + day + " " + hour + ":" + minnute + ":" + second);
|
|
|
|
#endregion
|
|
|
|
parameter.FLOW = Convert.ToDecimal(paraList.First(o => o.COLUMNCODE.Contains("FLOW")).PARAVALUE.ToString());
|
|
parameter.STRESSPERCENT = Convert.ToDecimal(paraList.First(o => o.COLUMNCODE.Contains("STRESSPERCENT")).PARAVALUE.ToString());
|
|
parameter.METARIALTEMPRATURE = Convert.ToDecimal(paraList.First(o => o.COLUMNCODE.Contains("METARIALTEMPRATURE")).PARAVALUE.ToString());
|
|
parameter.METARIALTEMPRATURETWO = Convert.ToDecimal(paraList.First(o => o.COLUMNCODE.Contains("METARIALTEMPRATURETWO")).PARAVALUE.ToString());
|
|
parameter.MOULDNUMBER = Convert.ToInt32(paraList.First(o => o.COLUMNCODE.Contains("MOULDNO")).PARAVALUE.ToString());
|
|
|
|
|
|
//CastingParameterDAL paraDal = new CastingParameterDAL();
|
|
//paraDal.BaseSession = session;
|
|
//paraDal.Insert(parameter);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 插入红外扫描加工参数
|
|
/// </summary>
|
|
private void InsertHotScanParameter()
|
|
{
|
|
HostcanPatameter parameter = new HostcanPatameter();
|
|
parameter.PID = Guid.NewGuid().ToString();
|
|
parameter.MOID = mainOpe.PID;
|
|
parameter.PDID = mainOpe.PDID;
|
|
parameter.PRODUCTTYPE = mainOpe.PRODUCTTYPE;
|
|
parameter.PRODUCTCODE = mainOpe.PRODUCTCODE;
|
|
parameter.MACHINECODDE = mainOpe.MACHINECODDE;
|
|
parameter.MACHINENAME = mainOpe.MACHINENAME;
|
|
parameter.CREATEDATE = System.DateTime.Now;
|
|
|
|
Type t = typeof(HostcanPatameter);
|
|
|
|
foreach (ParameterConfig pc in paraList)
|
|
{
|
|
t.GetProperty(pc.COLUMNCODE).SetValue(parameter, pc.PARAVALUE, null);
|
|
}
|
|
|
|
//HotScanParameterDAL paraDal = new HotScanParameterDAL();
|
|
//paraDal.BaseSession = session;
|
|
//paraDal.Insert(parameter);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 插入冲切加工参数
|
|
/// </summary>
|
|
private void InsertPunchParameter()
|
|
{
|
|
PunchParameter parameter = new PunchParameter(mainOpe.PRODUCTCODE);
|
|
parameter.PID = Guid.NewGuid().ToString();
|
|
parameter.MOID = mainOpe.PID;
|
|
parameter.PDID = mainOpe.PDID;
|
|
parameter.PRODUCTTYPE = mainOpe.PRODUCTTYPE;
|
|
parameter.PRODUCTCODE = mainOpe.PRODUCTCODE;
|
|
parameter.MACHINECODDE = mainOpe.MACHINECODDE;
|
|
parameter.MACHINENAME = mainOpe.MACHINENAME;
|
|
parameter.CREATEDATE = System.DateTime.Now;
|
|
|
|
//var worktime = paraList.First(o => o.COLUMNCODE == "WORKTIME").PARAVALUE;
|
|
//parameter.WORKTIME = Convert.ToDecimal(worktime) / 10;
|
|
|
|
//var pc1 = paraList.First(o => o.COLUMNCODE == "PRESSURECIRCUIT1").PARAVALUE;
|
|
|
|
//parameter.PRESSURECIRCUIT1 = Convert.ToInt32(pc1);
|
|
|
|
//var pc2 = paraList.First(o => o.COLUMNCODE == "PRESSURECIRCUIT2").PARAVALUE;
|
|
//parameter.PRESSURECIRCUIT2 = Convert.ToInt32(pc2);
|
|
|
|
//var pc3 = paraList.First(o => o.COLUMNCODE == "PRESSURECIRCUIT3").PARAVALUE;
|
|
//parameter.PRESSURECIRCUIT3 = Convert.ToInt32(pc3);
|
|
|
|
//var pc4 = paraList.First(o => o.COLUMNCODE == "PRESSURECIRCUIT4").PARAVALUE;
|
|
//parameter.PRESSURECIRCUIT4 = Convert.ToInt32(pc4);
|
|
|
|
//var result = paraList.First(o => o.COLUMNCODE == "PROCESSOK").PARAVALUE;
|
|
//parameter.RESULT = result.ToString();
|
|
|
|
//parameter.RESULT = (paraList.Count(o => o.COLUMNCODE == "ProcessOK") > 0) ? paraList.First(o => o.COLUMNCODE == "ProcessOK").PARAVALUE.ToString() : "";
|
|
|
|
//if (parameter.RESULT == "True")
|
|
//{
|
|
// parameter.RESULT = "OK";
|
|
//}
|
|
//else
|
|
//{
|
|
// parameter.RESULT = "NOK";
|
|
//}
|
|
|
|
////PunchParameterDAL paraDal = new PunchParameterDAL();
|
|
//paraDal.BaseSession = session;
|
|
//paraDal.Insert(parameter);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 插入铣削加工参数
|
|
/// </summary>
|
|
private void InsertMilingParameter()
|
|
{
|
|
|
|
|
|
try
|
|
{
|
|
MilingParameter parameter = new MilingParameter();
|
|
parameter.PID = Guid.NewGuid().ToString();
|
|
parameter.MOID = mainOpe.PID;
|
|
parameter.PDID = mainOpe.PDID;
|
|
parameter.PRODUCTTYPE = mainOpe.PRODUCTTYPE;
|
|
parameter.PRODUCTCODE = mainOpe.PRODUCTCODE;
|
|
parameter.MACHINECODDE = mainOpe.MACHINECODDE;
|
|
parameter.MACHINENAME = mainOpe.MACHINENAME;
|
|
//parameter.CREATEDATE = System.DateTime.Now;
|
|
|
|
//(char)Convert.ToInt32(result)
|
|
|
|
string hourDec = (paraList.Count(o => o.COLUMNCODE == "WORKTIMEHOURDEC") > 0) ? ((char)Convert.ToInt32(paraList.First(o => o.COLUMNCODE == "WORKTIMEHOURDEC").PARAVALUE.ToString())).ToString() : "0";
|
|
string hour = (paraList.Count(o => o.COLUMNCODE == "WORKTIMEHOUR") > 0) ? ((char)Convert.ToInt32(paraList.First(o => o.COLUMNCODE == "WORKTIMEHOUR").PARAVALUE.ToString())).ToString() : "0";
|
|
string minuteDec = (paraList.Count(o => o.COLUMNCODE == "WORKTIMEMINUTEDEC") > 0) ? ((char)Convert.ToInt32(paraList.First(o => o.COLUMNCODE == "WORKTIMEMINUTEDEC").PARAVALUE.ToString())).ToString() : "0";
|
|
string minute = (paraList.Count(o => o.COLUMNCODE == "WORKTIMEMINUTE") > 0) ? ((char)Convert.ToInt32(paraList.First(o => o.COLUMNCODE == "WORKTIMEMINUTE").PARAVALUE.ToString())).ToString() : "0";
|
|
|
|
DateTime dt = System.DateTime.Now;
|
|
int actuallyHour = (Convert.ToInt32(hourDec + hour) == 0) ? dt.Hour : Convert.ToInt32(hourDec + hourDec);
|
|
int actuallyMinute = (Convert.ToInt32(minuteDec + minute) == 0) ? dt.Minute : Convert.ToInt32(minuteDec + minute);
|
|
string dateString = dt.ToShortDateString();
|
|
dateString += " ";
|
|
dateString += actuallyHour.ToString();
|
|
dateString += ":";
|
|
dateString += actuallyMinute.ToString();
|
|
dateString += ":";
|
|
dateString += "00";
|
|
parameter.CREATEDATE = Convert.ToDateTime(dateString);
|
|
|
|
parameter.RESULT = (paraList.Count(o => o.COLUMNCODE == "RESULT") > 0) ? paraList.First(o => o.COLUMNCODE == "RESULT").PARAVALUE.ToString() : "";
|
|
|
|
var VARIANT = ((char)Convert.ToInt32(paraList.First(o => o.COLUMNCODE == "VARIANT").PARAVALUE.ToString())).ToString();
|
|
|
|
//MilingParameterDAL paraDal = new MilingParameterDAL();
|
|
//paraDal.BaseSession = session;
|
|
//paraDal.Insert(parameter);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 插入铣削加工参数
|
|
/// </summary>
|
|
private void InsertRivetingPatameter()
|
|
{
|
|
RivetingPatameter parameter = new RivetingPatameter();
|
|
parameter.PID = Guid.NewGuid().ToString();
|
|
parameter.MOID = mainOpe.PID;
|
|
parameter.PDID = mainOpe.PDID;
|
|
parameter.PRODUCTTYPE = mainOpe.PRODUCTTYPE;
|
|
parameter.PRODUCTCODE = mainOpe.PRODUCTCODE;
|
|
parameter.MACHINECODDE = mainOpe.MACHINECODDE;
|
|
parameter.MACHINENAME = mainOpe.MACHINENAME;
|
|
parameter.CREATEDATE = System.DateTime.Now;
|
|
|
|
Type t = typeof(RivetingPatameter);
|
|
|
|
foreach (ParameterConfig pc in paraList)
|
|
{
|
|
t.GetProperty(pc.COLUMNCODE).SetValue(parameter, pc.PARAVALUE, null);
|
|
}
|
|
|
|
//RivetingPatameterDAL paraDal = new RivetingPatameterDAL();
|
|
//paraDal.BaseSession = session;
|
|
//paraDal.Insert(parameter);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 插入超声波加工参数
|
|
/// </summary>
|
|
private void InsertUltrasParameter()
|
|
{
|
|
UltrasParameter parameter = new UltrasParameter();
|
|
parameter.PID = Guid.NewGuid().ToString();
|
|
parameter.MOID = mainOpe.PID;
|
|
parameter.PDID = mainOpe.PDID;
|
|
parameter.PRODUCTTYPE = mainOpe.PRODUCTTYPE;
|
|
parameter.PRODUCTCODE = mainOpe.PRODUCTCODE;
|
|
parameter.MACHINECODDE = mainOpe.MACHINECODDE;
|
|
parameter.MACHINENAME = mainOpe.MACHINENAME;
|
|
parameter.CREATEDATE = System.DateTime.Now;
|
|
|
|
Type t = typeof(UltrasParameter);
|
|
|
|
foreach (ParameterConfig pc in paraList)
|
|
{
|
|
|
|
try
|
|
{
|
|
var columnValue= Convert.ToDecimal(pc.PARAVALUE);
|
|
|
|
if (pc.DEALTYPE == "DIVIDE")
|
|
{
|
|
columnValue = columnValue / 10;
|
|
}
|
|
|
|
PropertyInfo f = t.GetProperty(pc.COLUMNCODE);
|
|
f.SetValue(parameter, columnValue, null);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine(ex.Message);
|
|
Console.WriteLine(pc.COLUMNCODE);
|
|
continue;
|
|
}
|
|
|
|
}
|
|
|
|
//UltrasParameterDAL paraDal = new UltrasParameterDAL();
|
|
//paraDal.BaseSession = session;
|
|
//paraDal.Insert(parameter);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 插入红外加工参数
|
|
/// </summary>
|
|
private void InsertHotweldParameter()
|
|
{
|
|
HotweldParameter parameter = new HotweldParameter();
|
|
parameter.PID = Guid.NewGuid().ToString();
|
|
parameter.MOID = mainOpe.PID;
|
|
parameter.PDID = mainOpe.PDID;
|
|
parameter.PRODUCTTYPE = mainOpe.PRODUCTTYPE;
|
|
parameter.PRODUCTCODE = mainOpe.PRODUCTCODE;
|
|
parameter.MACHINECODDE = mainOpe.MACHINECODDE;
|
|
parameter.MACHINENAME = mainOpe.MACHINENAME;
|
|
parameter.CREATEDATE = System.DateTime.Now;
|
|
|
|
if (paraList.Count(o => o.COLUMNCODE == "WELDINGDISTANCEAIRB") > 0)
|
|
{
|
|
var dict = paraList.First(o => o.COLUMNCODE == "WELDINGDISTANCEAIRB").PARAVALUE;
|
|
if (dict != null)
|
|
{
|
|
parameter.WELDINGDISTANCEAIRB = Convert.ToInt32(dict);
|
|
}
|
|
}
|
|
|
|
if (paraList.Count(o => o.COLUMNCODE == "WELDINGDISTINCTVERT") > 0)
|
|
{
|
|
var dict = paraList.First(o => o.COLUMNCODE == "WELDINGDISTINCTVERT").PARAVALUE;
|
|
if (dict != null)
|
|
{
|
|
parameter.WELDINGDISTINCTVERT = Convert.ToInt32(dict);
|
|
}
|
|
}
|
|
|
|
if (paraList.Count(o => o.COLUMNCODE == "WELDINGTIME") > 0)
|
|
{
|
|
var dict = paraList.First(o => o.COLUMNCODE == "WELDINGTIME").PARAVALUE;
|
|
if (dict != null)
|
|
{
|
|
parameter.WELDINGTIME = Convert.ToInt32(dict);
|
|
}
|
|
}
|
|
|
|
if (paraList.Count(o => o.COLUMNCODE == "CHANGEOVERTIME") > 0)
|
|
{
|
|
var dict = paraList.First(o => o.COLUMNCODE == "CHANGEOVERTIME").PARAVALUE;
|
|
if (dict != null)
|
|
{
|
|
parameter.CHANGEOVERTIME = Convert.ToInt32(dict);
|
|
}
|
|
}
|
|
|
|
if (paraList.Count(o => o.COLUMNCODE == "RESULT") > 0)
|
|
{
|
|
var dict = paraList.First(o => o.COLUMNCODE == "RESULT").PARAVALUE;
|
|
if (dict != null)
|
|
{
|
|
parameter.RESULT = dict.ToString();
|
|
}
|
|
}
|
|
|
|
if (paraList.Count(o => o.COLUMNCODE == "HEATINGTIME") > 0)
|
|
{
|
|
var dict = paraList.First(o => o.COLUMNCODE == "HEATINGTIME").PARAVALUE;
|
|
if (dict != null)
|
|
{
|
|
parameter.HEATINGTIME = Convert.ToInt32(dict);
|
|
}
|
|
}
|
|
|
|
if (paraList.Count(o => o.COLUMNCODE == "CAMERARESULT") > 0)
|
|
{
|
|
var dict = paraList.First(o => o.COLUMNCODE == "CAMERARESULT").PARAVALUE;
|
|
if (dict != null)
|
|
{
|
|
parameter.CAMERARESULT = dict.ToString();
|
|
}
|
|
}
|
|
|
|
if (paraList.Count(o => o.COLUMNCODE == "TIMESTAMPHOUR") > 0)
|
|
{
|
|
var hourstr = paraList.First(o => o.COLUMNCODE == "TIMESTAMPHOUR").PARAVALUE.ToString();
|
|
var minutestr = paraList.First(o => o.COLUMNCODE == "TIMESTAMPMINUTES").PARAVALUE.ToString();
|
|
parameter.OPERATETIME = hourstr + ":" + minutestr;
|
|
}
|
|
|
|
|
|
//HotWeldParameterDAL paraDal = new HotWeldParameterDAL();
|
|
//paraDal.BaseSession = session;
|
|
//paraDal.Insert(parameter);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 插入总成加工参数
|
|
/// </summary>
|
|
private void InsertAssembleParameter()
|
|
{
|
|
AssembleParameter parameter = new AssembleParameter();
|
|
parameter.PID = Guid.NewGuid().ToString();
|
|
parameter.MOID = mainOpe.PID;
|
|
parameter.PDID = mainOpe.PDID;
|
|
parameter.PRODUCTTYPE = mainOpe.PRODUCTTYPE;
|
|
parameter.PRODUCTCODE = mainOpe.PRODUCTCODE;
|
|
parameter.MACHINECODDE = mainOpe.MACHINECODDE;
|
|
parameter.MACHINENAME = mainOpe.MACHINENAME;
|
|
parameter.CREATEDATE = System.DateTime.Now;
|
|
|
|
Type t = typeof(AssembleParameter);
|
|
|
|
foreach (ParameterConfig pc in paraList)
|
|
{
|
|
t.GetProperty(pc.COLUMNCODE).SetValue(parameter, pc.PARAVALUE, null);
|
|
}
|
|
|
|
//AssembleParameterDAL paraDal = new AssembleParameterDAL();
|
|
//paraDal.BaseSession = session;
|
|
//paraDal.Insert(parameter);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 插入加工参数
|
|
/// </summary>
|
|
/// <param name="recorder"></param>
|
|
/// <param name="parConfigList"></param>
|
|
public void InsertParameter(ProcessParameters recorder, List<ParameterConfig> parConfigList)
|
|
{
|
|
|
|
StringBuilder paraValue = new StringBuilder();
|
|
|
|
try
|
|
{
|
|
foreach (var pc in parConfigList)
|
|
{
|
|
paraValue.Append(",");
|
|
paraValue.Append("'" + pc.COLUMNCODE + "':'" + ((pc.PARAVALUE != null) ? pc.PARAVALUE.ToString() : "") + "'");
|
|
}
|
|
recorder.PARM_VAL = ("{" + paraValue.ToString().Substring(1) + "}");
|
|
recorder.CREATEDATE = System.DateTime.Now;
|
|
|
|
ProcessParametersDAL ppdal = new ProcessParametersDAL();
|
|
ppdal.Insert(recorder);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogManager.LogHelper.Error(new LogInfo() { ErrorInfo = ex, Info = "插入加工参数异常!" });
|
|
LogManager.LogHelper.Error(new LogInfo() { ErrorInfo = ex, Info = "PRODUCTID:" + recorder.PRODUCT_PID });
|
|
LogManager.LogHelper.Error(new LogInfo() { ErrorInfo = ex, Info = "WORKCELL_CODE:" + recorder.WORKCELL_CODE });
|
|
LogManager.LogHelper.Error(new LogInfo() { ErrorInfo = ex, Info = "PARAMETER:" + recorder.PARM_VAL });
|
|
}
|
|
|
|
}
|
|
|
|
public void InsertParameter(MainOperation mo, List<ParameterConfig> parConfigList)
|
|
{
|
|
var tableName = "";
|
|
var sqlStr2 = "";
|
|
var sqlStr4 = "";
|
|
var sqlStr = "";
|
|
|
|
var groups = parConfigList.GroupBy(x => x.TABLENAME);
|
|
|
|
try
|
|
{
|
|
string paramPID = Guid.NewGuid().ToString();
|
|
string createdate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
foreach (var group in groups)
|
|
{
|
|
sqlStr2 = "";
|
|
sqlStr4 = "";
|
|
#region 拼写插入语句
|
|
foreach (var pc in group)
|
|
{
|
|
if (pc.COLUMNCODE == "TotalCount")
|
|
{
|
|
int m = 0;
|
|
}
|
|
|
|
tableName = pc.TABLENAME;
|
|
sqlStr2 += "," + pc.COLUMNCODE;
|
|
if (pc.PARAVALUE == null)
|
|
{
|
|
sqlStr4 += ",''";
|
|
}
|
|
else
|
|
{
|
|
sqlStr4 += ",'" + pc.PARAVALUE.ToString() + "'";
|
|
}
|
|
}
|
|
var sqlStr1 = "INSERT INTO [" + tableName + "] (PID,PDID,PRODUCTCODE,MOID,PRODUCTTYPE,MACHINENAME,MACHINECODDE,MOLDNUMBER,CREATEDATE";
|
|
sqlStr2 += ") ";
|
|
var sqlStr3 = "VALUES ('" + paramPID + "','" + mo.PDID + "','" + mo.PRODUCTCODE + "','" + mo.PID + "','" + mo.PRODUCTTYPE + "','" + mo.MACHINENAME + "','" + mo.MACHINECODDE + "','" +mo.MOLDNUMBER+ "','" + createdate + "'";
|
|
sqlStr4 += ") ";
|
|
sqlStr = sqlStr1 + sqlStr2 + sqlStr3 + sqlStr4;
|
|
|
|
#endregion
|
|
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
session.ExecuteSql(sqlStr);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogManager.LogHelper.Error(new LogInfo() { ErrorInfo = ex, Info = "插入加工参数异常!" });
|
|
LogManager.LogHelper.Error(new LogInfo() { ErrorInfo = ex, Info = sqlStr });
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|