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.
156 lines
5.4 KiB
156 lines
5.4 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using QMAPP.FJC.Entity.Operation;
|
|
using QMAPP.FJC.Entity.ProcessParameter;
|
|
using QMFrameWork.Data;
|
|
using QMFrameWork.Common.Util;
|
|
|
|
namespace EQUIPINTERFACETEST.Deal
|
|
{
|
|
public class UltrasDeal
|
|
{
|
|
public void InsertParameter()
|
|
{
|
|
List<Main> mainList = new List<Main>();
|
|
string mainSql = @"select top 300 * from t_aw_main m where
|
|
m.CREATEDATE>'2017-01-01 00:21:59.247'
|
|
and m.CURRENTPROCESS>'14'
|
|
and not exists(select 1 from T_AW_MAINOPERATION mo
|
|
where mo.CREATEDATE>'2017-01-01 00:21:59.247'
|
|
and mo.processtype='14'
|
|
and mo.PDID=m.PID)
|
|
order by m.createdate asc";
|
|
|
|
Product b9gPro = new Product() { PID = "ff99219a-fe25-4af0-898c-5ee549b7164e" };
|
|
|
|
Product b9jPro = new Product() { PID = "65fef60a-ff4f-4c36-a368-d47c20979f29" };
|
|
|
|
|
|
List<UltrasParameter> ultrasList = new List<UltrasParameter>();
|
|
string parameter = "select * from T_AW_ULTRASPARAMETERSample";
|
|
|
|
MainOperation mo = new MainOperation() { PID = "2058e14e-d23f-4554-a186-ca34d1f1e518" };
|
|
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
|
|
mainList = session.GetList<Main>(mainSql, new List<DataParameter>().ToArray()).ToList<Main>();
|
|
b9gPro = session.Get<Product>(b9gPro);
|
|
b9jPro = session.Get<Product>(b9jPro);
|
|
mo = session.Get<MainOperation>(mo);
|
|
ultrasList = session.GetList<UltrasParameter>(parameter, new List<DataParameter>().ToArray()).ToList<UltrasParameter>();
|
|
}
|
|
List<MainProduct> mpList = new List<MainProduct>();
|
|
List<MainOperation> molist = new List<MainOperation>();
|
|
|
|
List<Product> productList = new List<Product>();
|
|
List<UltrasParameter> intwildList = new List<UltrasParameter>();
|
|
|
|
|
|
int f = 0;
|
|
|
|
foreach (var m in mainList)
|
|
{
|
|
f++;
|
|
if (f == 6)
|
|
{
|
|
f = 0;
|
|
}
|
|
|
|
DateTime dt = new DateTime();
|
|
if (m.PROCESSTYPE == "16")
|
|
{
|
|
dt = m.UPDATEDATE.AddMinutes(-3);
|
|
}
|
|
else
|
|
{
|
|
dt = m.UPDATEDATE.AddSeconds(-90);
|
|
}
|
|
|
|
UltrasParameter hp = ultrasList[f];
|
|
|
|
MainOperation mi = BindHelper.CopyToModel<MainOperation, MainOperation>(mo, false);
|
|
|
|
mi.PID = Guid.NewGuid().ToString();
|
|
mi.PDID = m.PID;
|
|
mi.PRODUCTCODE = m.EPIDERMISCODE;
|
|
mi.OPERATEDDATE = dt.AddSeconds(60);
|
|
mi.CREATEDATE = dt;
|
|
mi.UPDATEDATE = dt.AddSeconds(60);
|
|
mi.PRODUCTCODESTR = b9gPro.PRODUCTCODE + ":" + b9jPro.PRODUCTCODE + ".";
|
|
|
|
molist.Add(mi);
|
|
|
|
|
|
MainProduct mp = new MainProduct();
|
|
mp.PID = Guid.NewGuid().ToString();
|
|
mp.MID = m.PID;
|
|
mp.PDID = b9gPro.PID;
|
|
mp.COUNT = 1;
|
|
mp.MOID = mi.PID;
|
|
mp.CREATEUSER = "471c7578-3474-4804-92b2-34673516bf2b";
|
|
mp.CREATEDATE = dt;
|
|
mp.UPDATEDATE = dt;
|
|
|
|
mpList.Add(mp);
|
|
|
|
MainProduct mp2 = new MainProduct();
|
|
mp2.PID = Guid.NewGuid().ToString();
|
|
mp2.MID = m.PID;
|
|
mp2.PDID = b9jPro.PID;
|
|
mp2.COUNT = 1;
|
|
mp2.MOID = mi.PID;
|
|
mp2.CREATEUSER = "471c7578-3474-4804-92b2-34673516bf2b";
|
|
mp2.CREATEDATE = dt;
|
|
mp2.UPDATEDATE = dt;
|
|
|
|
mpList.Add(mp2);
|
|
|
|
UltrasParameter htp = BindHelper.CopyToModel<UltrasParameter, UltrasParameter>(hp, false);
|
|
|
|
htp.PID = Guid.NewGuid().ToString();
|
|
htp.PDID = mi.PDID;
|
|
htp.MOID = mi.PID;
|
|
htp.PRODUCTCODE = mi.PRODUCTCODE;
|
|
htp.CREATEDATE = mi.OPERATEDDATE;
|
|
|
|
intwildList.Add(htp);
|
|
}
|
|
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
|
|
|
|
int b = 0;
|
|
foreach (var mi in intwildList)
|
|
{
|
|
b++;
|
|
session.Insert<UltrasParameter>(mi);
|
|
Console.WriteLine(mi.MAINCODE + " - " + b.ToString());
|
|
WriteLog.Write(mi.MAINCODE + " - " + b.ToString());
|
|
}
|
|
|
|
int c = 0;
|
|
foreach (var mp in molist)
|
|
{
|
|
c++;
|
|
session.Insert<MainOperation>(mp);
|
|
Console.WriteLine(mp.PRODUCTCODE + " - " + c.ToString());
|
|
WriteLog.Write(mp.PRODUCTCODE + " - " + c.ToString());
|
|
}
|
|
int d = 0;
|
|
foreach (var mp in mpList)
|
|
{
|
|
d++;
|
|
Console.WriteLine(d.ToString());
|
|
WriteLog.Write(d.ToString());
|
|
session.Insert<MainProduct>(mp);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|