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.
461 lines
16 KiB
461 lines
16 KiB
4 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using QMFrameWork.Data;
|
||
|
using QMAPP.FJC.Entity.Basic;
|
||
|
using QMAPP.FJC.DAL.Basic;
|
||
|
using QMAPP.FJC.DAL.Operation;
|
||
|
using QMAPP.FJC.Entity.Injection;
|
||
|
using QMAPP.FJC.DAL.Injection;
|
||
|
using QMAPP.FJC.Entity.Operation;
|
||
|
using QMAPP.FJC.Entity.ProcessParameter;
|
||
|
using QMAPP.FJC.BLL.Process;
|
||
|
|
||
|
namespace EQUIPINTERFACETEST
|
||
|
{
|
||
|
public class InsertProcessParameter
|
||
|
{
|
||
|
public void InsertParameters()
|
||
|
{
|
||
|
|
||
|
MachineInfoDAL mid = new MachineInfoDAL();
|
||
|
MachineInfo m = mid.Get(new MachineInfo() { PID = "b2a5e86b-f416-4b27-9c89-de77ab577f59" });
|
||
|
|
||
|
ParameterConfigDAL pcd = new ParameterConfigDAL();
|
||
|
List<ParameterConfig> list = new List<ParameterConfig>();
|
||
|
list = pcd.GetList(new ParameterConfig() { MACHINECODDE = "ULTRASONICING", COLUMNTYPE = "0" })
|
||
|
.OrderBy(o => o.PID).ToList<ParameterConfig>();
|
||
|
|
||
|
List<ProcessParameter> ppList = new List<ProcessParameter>();
|
||
|
|
||
|
|
||
|
int index = 0;
|
||
|
|
||
|
for (int i = 0; i < 22; i++)
|
||
|
{
|
||
|
ParameterConfig pc = list[i];
|
||
|
|
||
|
index += 1;
|
||
|
ProcessParameter p = new ProcessParameter();
|
||
|
p.PID = Guid.NewGuid().ToString();
|
||
|
p.PARADESCRIBE = "焊接时间" + (i + 1).ToString();
|
||
|
p.PARANAME = pc.COLUMNCODE;
|
||
|
p.PROCESSTYPE = pc.PROCESSTYPE;
|
||
|
p.PARATABLENAME = "T_AW_ULTRASPARAMETER";
|
||
|
p.MACHINEID = m.PID;
|
||
|
p.MACHINECODDE = m.MACHINECODDE;
|
||
|
p.SHOWINDEX = index;
|
||
|
p.CREATEDATE = System.DateTime.Now;
|
||
|
p.ALIGNVALUE = "2";
|
||
|
p.PRODUCELINE = "B9";
|
||
|
p.MEMO = "";
|
||
|
p.WIDTH = 150;
|
||
|
ppList.Add(p);
|
||
|
|
||
|
pc = list[i + 22];
|
||
|
index += 1;
|
||
|
ProcessParameter p2 = new ProcessParameter();
|
||
|
p2.PID = Guid.NewGuid().ToString();
|
||
|
p2.PARADESCRIBE = "触发时间" + (i + 1).ToString();
|
||
|
p2.PARANAME = pc.COLUMNCODE;
|
||
|
p2.PROCESSTYPE = pc.PROCESSTYPE;
|
||
|
p2.PARATABLENAME = "T_AW_ULTRASPARAMETER";
|
||
|
p2.MACHINEID = m.PID;
|
||
|
p2.MACHINECODDE = m.MACHINECODDE;
|
||
|
p2.SHOWINDEX = index;
|
||
|
p2.CREATEDATE = System.DateTime.Now;
|
||
|
p2.ALIGNVALUE = "2";
|
||
|
p2.PRODUCELINE = "B9";
|
||
|
p2.MEMO = "";
|
||
|
p2.WIDTH = 150;
|
||
|
ppList.Add(p2);
|
||
|
|
||
|
pc = list[i + 44];
|
||
|
index += 1;
|
||
|
ProcessParameter p3 = new ProcessParameter();
|
||
|
p3.PID = Guid.NewGuid().ToString();
|
||
|
p3.PARADESCRIBE = "设定深度" + (i + 1).ToString();
|
||
|
p3.PARANAME = pc.COLUMNCODE;
|
||
|
p3.PROCESSTYPE = pc.PROCESSTYPE;
|
||
|
p3.PARATABLENAME = "T_AW_ULTRASPARAMETER";
|
||
|
p3.MACHINEID = m.PID;
|
||
|
p3.MACHINECODDE = m.MACHINECODDE;
|
||
|
p3.SHOWINDEX = index;
|
||
|
p3.CREATEDATE = System.DateTime.Now;
|
||
|
p3.ALIGNVALUE = "2";
|
||
|
p3.PRODUCELINE = "B9";
|
||
|
p3.MEMO = "";
|
||
|
p3.WIDTH = 150;
|
||
|
ppList.Add(p3);
|
||
|
|
||
|
|
||
|
pc = list[i + 66];
|
||
|
index += 1;
|
||
|
ProcessParameter p4 = new ProcessParameter();
|
||
|
p4.PID = Guid.NewGuid().ToString();
|
||
|
p4.PARADESCRIBE = "实际深度" + (i + 1).ToString();
|
||
|
p4.PARANAME = pc.COLUMNCODE;
|
||
|
p4.PROCESSTYPE = pc.PROCESSTYPE;
|
||
|
p4.PARATABLENAME = "T_AW_ULTRASPARAMETER";
|
||
|
p4.MACHINEID = m.PID;
|
||
|
p4.MACHINECODDE = m.MACHINECODDE;
|
||
|
p4.SHOWINDEX = index;
|
||
|
p4.CREATEDATE = System.DateTime.Now;
|
||
|
p4.ALIGNVALUE = "2";
|
||
|
p4.PRODUCELINE = "B9";
|
||
|
p4.MEMO = "";
|
||
|
p4.WIDTH = 150;
|
||
|
ppList.Add(p4);
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
foreach (var p in ppList)
|
||
|
{
|
||
|
session.Insert<ProcessParameter>(p);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
Console.WriteLine("插入完成!");
|
||
|
|
||
|
}
|
||
|
|
||
|
public void InsertSlushRelation()
|
||
|
{
|
||
|
ProductDAL productdal = new ProductDAL();
|
||
|
List<Product> productList = new List<Product>();
|
||
|
productList = productdal.GetList(new Product() { PRODUCTTYPE = "5" });
|
||
|
|
||
|
ProductInjectionDAL pjdal = new ProductInjectionDAL();
|
||
|
|
||
|
InjectionRecorderDAL irdal = new InjectionRecorderDAL();
|
||
|
|
||
|
List<InjectionRecorder> ijrLIst = new List<InjectionRecorder>();
|
||
|
|
||
|
InjectionRecorder r1 = irdal.Get(new InjectionRecorder() { PID = "8ccea650-d1e6-4d6f-a2fd-074bb610f886" });
|
||
|
|
||
|
List<ProductInjection> list = new List<ProductInjection>();
|
||
|
|
||
|
foreach (var p in productList)
|
||
|
{
|
||
|
ProductInjection pij = new ProductInjection();
|
||
|
pij.PID = Guid.NewGuid().ToString();
|
||
|
pij.IPID = r1.PID;
|
||
|
pij.MPPID = p.PID;
|
||
|
pij.MATERIALNAME = r1.MATERIALNAME;
|
||
|
pij.MATERIALCODE = r1.MATERIALCODE;
|
||
|
pij.MATERIALTYPE = r1.MATERIALTYPE;
|
||
|
pij.MATERIALBATCH = r1.MATERIALBATCH;
|
||
|
pij.INJECTIONINDEX = r1.INJECTIONINDEX;
|
||
|
pij.INJECTIONTERMINAL = r1.INJECTIONTERMINAL;
|
||
|
pij.USEDWEIGHT = 1;
|
||
|
pij.PROCESSTYPE = "0";
|
||
|
pij.CREATEDATE = System.DateTime.Now;
|
||
|
pij.CREATEUSER = "c361d78c-91ed-4b1f-9777-8ff0aefa6cc6";
|
||
|
pij.UPDATEUSER = "c361d78c-91ed-4b1f-9777-8ff0aefa6cc6";
|
||
|
|
||
|
|
||
|
list.Add(pij);
|
||
|
|
||
|
}
|
||
|
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
foreach (var p in list)
|
||
|
{
|
||
|
session.Insert<ProductInjection>(p);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void InserCasting()
|
||
|
{
|
||
|
List<MainOperation> list1 = new List<MainOperation>();
|
||
|
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
list1 = session.GetList<MainOperation>("select * from T_AW_MAINOPERATION where PROCESSTYPE='9'",
|
||
|
new List<DataParameter>().ToArray()).ToList<MainOperation>();
|
||
|
|
||
|
}
|
||
|
|
||
|
List<CastingParameter> castList = new List<CastingParameter>();
|
||
|
foreach (var m in list1)
|
||
|
{
|
||
|
CastingParameter c = new CastingParameter();
|
||
|
c.PID = Guid.NewGuid().ToString();
|
||
|
c.MID = m.PDID;
|
||
|
c.MACHINECODDE = "CASTING";
|
||
|
c.MACHINENAME = "浇注设备";
|
||
|
c.PDID = m.PDID;
|
||
|
c.PRODUCTCODE = m.PRODUCTCODE;
|
||
|
c.MOID = m.PID;
|
||
|
c.PRODUCTTYPE = "9";
|
||
|
c.FLOW = (decimal)394.4;
|
||
|
c.STRESSPERCENT = (decimal)0.58;
|
||
|
c.METARIALTEMPRATURE = (decimal)27.8;
|
||
|
c.METARIALTEMPRATURETWO = (decimal)28.7;
|
||
|
c.MOULDNUMBER = 1;
|
||
|
c.CREATEDATE = System.DateTime.Now;
|
||
|
castList.Add(c);
|
||
|
|
||
|
}
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
foreach (var c in castList)
|
||
|
{
|
||
|
session.Insert<CastingParameter>(c);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
public void InsertSlush()
|
||
|
{
|
||
|
SlushParamter p = new SlushParamter();
|
||
|
List<MainOperation> list1 = new List<MainOperation>();
|
||
|
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
list1 = session.GetList<MainOperation>("select * from T_AW_MAINOPERATION where PROCESSTYPE='0'",
|
||
|
new List<DataParameter>().ToArray()).ToList<MainOperation>();
|
||
|
p = session.Get<SlushParamter>(new SlushParamter() { PID = "db6747c2-8e85-4d08-bba2-f50365c17b32" });
|
||
|
}
|
||
|
|
||
|
List<SlushParamter> plist = new List<SlushParamter>();
|
||
|
|
||
|
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
|
||
|
foreach (var m in list1)
|
||
|
{
|
||
|
p.PID = Guid.NewGuid().ToString();
|
||
|
p.IOID = m.PID;
|
||
|
p.EID = m.PDID;
|
||
|
p.PRODUCTCODE = m.PRODUCTCODE;
|
||
|
p.MACHINECODDE = "DOUBLESLUSH";
|
||
|
|
||
|
|
||
|
session.Insert<SlushParamter>(p);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
public void InsertWeld()
|
||
|
{
|
||
|
|
||
|
HotweldParameter p = new HotweldParameter();
|
||
|
List<MainOperation> list1 = new List<MainOperation>();
|
||
|
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
list1 = session.GetList<MainOperation>("select * from T_AW_MAINOPERATION where PROCESSTYPE='15'",
|
||
|
new List<DataParameter>().ToArray()).ToList<MainOperation>();
|
||
|
p = session.Get<HotweldParameter>(new HotweldParameter() { PID = "8c3e2008-8527-4a66-924b-ae57bfce63a3" });
|
||
|
}
|
||
|
|
||
|
List<SlushParamter> plist = new List<SlushParamter>();
|
||
|
|
||
|
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
|
||
|
foreach (var m in list1)
|
||
|
{
|
||
|
p.PID = Guid.NewGuid().ToString();
|
||
|
p.MOID = m.PID;
|
||
|
p.MID = m.PDID;
|
||
|
p.PRODUCTCODE = m.PRODUCTCODE;
|
||
|
p.MACHINECODDE = "WELDING";
|
||
|
|
||
|
|
||
|
session.Insert<HotweldParameter>(p);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
public void InsertScoring()
|
||
|
{
|
||
|
List<ParameterConfig> parConfigList = new List<ParameterConfig>();
|
||
|
|
||
|
ParameterConfigDAL dal = new ParameterConfigDAL();
|
||
|
parConfigList = dal.GetList(new ParameterConfig() { MACHINECODDE = "SCORING", COLUMNTYPE = "0" });
|
||
|
|
||
|
foreach (var p in parConfigList)
|
||
|
{
|
||
|
if (p.DATATYPE == "DECIMAL")
|
||
|
{
|
||
|
p.PARAVALUE = -0.008;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
parConfigList.First(o => o.COLUMNCODE == "BLADECOUNTER").PARAVALUE = 54;
|
||
|
parConfigList.First(o => o.COLUMNCODE == "BLADEVALUE").PARAVALUE = 2.91;
|
||
|
parConfigList.First(o => o.COLUMNCODE == "MACHINECODE").PARAVALUE = 3;
|
||
|
parConfigList.First(o => o.COLUMNCODE == "PROGRAMNUMBER").PARAVALUE = 3;
|
||
|
parConfigList.First(o => o.COLUMNCODE == "RESULT").PARAVALUE = "OK";
|
||
|
parConfigList.First(o => o.COLUMNCODE == "TOOLCODE").PARAVALUE = "3";
|
||
|
|
||
|
parConfigList.First(o => o.COLUMNCODE == "WORKTIMEHOUR").PARAVALUE = 75;
|
||
|
parConfigList.First(o => o.COLUMNCODE == "WORKTIMEHOURDEC").PARAVALUE = 75;
|
||
|
parConfigList.First(o => o.COLUMNCODE == "WORKTIMEMINUTE").PARAVALUE = 75;
|
||
|
parConfigList.First(o => o.COLUMNCODE == "WORKTIMEMINUTEDEC").PARAVALUE = 75;
|
||
|
|
||
|
parConfigList.First(o => o.COLUMNCODE == "RELEASE1").PARAVALUE = 75;
|
||
|
parConfigList.First(o => o.COLUMNCODE == "RELEASE2").PARAVALUE = 75;
|
||
|
parConfigList.First(o => o.COLUMNCODE == "RELEASE3").PARAVALUE = 75;
|
||
|
parConfigList.First(o => o.COLUMNCODE == "RELEASE4").PARAVALUE =75;
|
||
|
|
||
|
MainOperation mainOpe = new MainOperation();
|
||
|
mainOpe.PID = Guid.NewGuid().ToString();
|
||
|
mainOpe.PDID = Guid.NewGuid().ToString();
|
||
|
mainOpe.PRODUCTTYPE = "1";
|
||
|
mainOpe.PRODUCTCODE = "15523";
|
||
|
mainOpe.MACHINECODDE = "CCCC";
|
||
|
mainOpe.MACHINENAME = "FFFFF";
|
||
|
|
||
|
mainOpe.PROCESSTYPE = "6";
|
||
|
|
||
|
|
||
|
ParameterDeal deal = new ParameterDeal();
|
||
|
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
deal.InsertParameter(parConfigList, mainOpe, session);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
public void InsertSkinProcessParameter()
|
||
|
{
|
||
|
|
||
|
|
||
|
List<ProcessParameter> list = new List<ProcessParameter>();
|
||
|
ParameterConfigDAL pcd = new ParameterConfigDAL();
|
||
|
List<ParameterConfig> pclist = new List<ParameterConfig>();
|
||
|
pclist = pcd.GetList(new ParameterConfig() { MACHINECODDE = "SCORING", COLUMNTYPE = "0" });
|
||
|
|
||
|
List<ProcessParameter> otherList = new List<ProcessParameter>();
|
||
|
List<ProcessParameter> rsList = new List<ProcessParameter>();
|
||
|
List<ProcessParameter> skList = new List<ProcessParameter>();
|
||
|
|
||
|
List<ParameterConfig> otherPcList = pclist.Where(o => o.COLUMNCODE.Contains("RWS") == false && o.COLUMNCODE.Contains("SKI") == false)
|
||
|
.OrderBy(o => o.COLUMNCODE).ToList<ParameterConfig>();
|
||
|
|
||
|
int i = 1;
|
||
|
|
||
|
foreach (var p in otherPcList)
|
||
|
{
|
||
|
ProcessParameter np = new ProcessParameter();
|
||
|
np.PID = Guid.NewGuid().ToString();
|
||
|
np.PARADESCRIBE = "";
|
||
|
np.PARANAME = p.COLUMNCODE;
|
||
|
np.PROCESSTYPE = p.PROCESSTYPE;
|
||
|
np.PRODUCELINE = "B9";
|
||
|
np.MAXVALUE = 0;
|
||
|
np.MINVALUE = 0;
|
||
|
np.MEMO = "";
|
||
|
np.CREATEDATE = System.DateTime.Now;
|
||
|
np.PARATABLENAME = "T_AW_BURNPARAMETER";
|
||
|
np.MACHINECODDE = "SCORING";
|
||
|
np.MACHINEID = "eadd52f3-9d98-4a14-8ba1-4a5fbcaa5400";
|
||
|
np.STEP = 0;
|
||
|
np.SHOWINDEX = i;
|
||
|
np.WIDTH = 150;
|
||
|
np.ALIGNVALUE = "2";
|
||
|
|
||
|
|
||
|
i++;
|
||
|
|
||
|
otherList.Add(np);
|
||
|
}
|
||
|
|
||
|
List<ParameterConfig> rwsList = pclist.Where(o => o.COLUMNCODE.Contains("RWS"))
|
||
|
.OrderBy(o => o.COLUMNCODE).ToList<ParameterConfig>();
|
||
|
|
||
|
|
||
|
foreach (var p in rwsList)
|
||
|
{
|
||
|
ProcessParameter np = new ProcessParameter();
|
||
|
np.PID = Guid.NewGuid().ToString();
|
||
|
np.PARADESCRIBE = "";
|
||
|
np.PARANAME = p.COLUMNCODE;
|
||
|
np.PROCESSTYPE = p.PROCESSTYPE;
|
||
|
np.PRODUCELINE = "B9";
|
||
|
np.MAXVALUE = 0;
|
||
|
np.MINVALUE = 0;
|
||
|
np.MEMO = "";
|
||
|
np.CREATEDATE = System.DateTime.Now;
|
||
|
np.PARATABLENAME = "T_AW_BURNPARAMETER";
|
||
|
np.MACHINECODDE = "SCORING";
|
||
|
np.MACHINEID = "eadd52f3-9d98-4a14-8ba1-4a5fbcaa5400";
|
||
|
np.STEP = 0;
|
||
|
np.SHOWINDEX = i;
|
||
|
np.WIDTH = 150;
|
||
|
np.ALIGNVALUE = "2";
|
||
|
|
||
|
|
||
|
i++;
|
||
|
|
||
|
otherList.Add(np);
|
||
|
}
|
||
|
|
||
|
|
||
|
List<ParameterConfig> skiList = pclist.Where(o => o.COLUMNCODE.Contains("SKI"))
|
||
|
.OrderBy(o => o.COLUMNCODE).ToList<ParameterConfig>();
|
||
|
|
||
|
|
||
|
foreach (var p in skiList)
|
||
|
{
|
||
|
ProcessParameter np = new ProcessParameter();
|
||
|
np.PID = Guid.NewGuid().ToString();
|
||
|
np.PARADESCRIBE = "";
|
||
|
np.PARANAME = p.COLUMNCODE;
|
||
|
np.PROCESSTYPE = p.PROCESSTYPE;
|
||
|
np.PRODUCELINE = "B9";
|
||
|
np.MAXVALUE = 0;
|
||
|
np.MINVALUE = 0;
|
||
|
np.MEMO = "";
|
||
|
np.CREATEDATE = System.DateTime.Now;
|
||
|
np.PARATABLENAME = "T_AW_BURNPARAMETER";
|
||
|
np.MACHINECODDE = "SCORING";
|
||
|
np.MACHINEID = "eadd52f3-9d98-4a14-8ba1-4a5fbcaa5400";
|
||
|
np.STEP = 0;
|
||
|
np.SHOWINDEX = i;
|
||
|
np.WIDTH = 150;
|
||
|
np.ALIGNVALUE = "2";
|
||
|
|
||
|
|
||
|
i++;
|
||
|
|
||
|
otherList.Add(np);
|
||
|
}
|
||
|
|
||
|
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
|
||
|
foreach(var p in otherList)
|
||
|
{
|
||
|
session.Insert<ProcessParameter>(p);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|