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.
174 lines
6.0 KiB
174 lines
6.0 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using QMFrameWork.Data;
|
|
using QMAPP.FJC.Entity.ProcessParameter;
|
|
using QMAPP.FJC.Entity.Operation;
|
|
using QMFrameWork.Common.Util;
|
|
|
|
namespace EQUIPINTERFACETEST.Deal
|
|
{
|
|
public class SkinCutDeal
|
|
{
|
|
//放行的补充加工参数
|
|
public void InsertParameter()
|
|
{
|
|
List<BurnParameter> sampleListParameter = new List<BurnParameter>();
|
|
string sampleParameterSql = "select * from t_aw_burnparametersample";
|
|
|
|
List<BurnParameter> insertListParameter = new List<BurnParameter>();
|
|
|
|
string mosql = @"select * from T_AW_MAINOPERATION mo
|
|
where
|
|
mo.createdate>'2016-9-1 00:00:00'
|
|
and mo.createdate<'2016-10-1 00:00:00'
|
|
and mo.PRODUCTCODESTR='.'
|
|
and not exists(select 1 from T_AW_BURNPARAMETER t where t.MOID=mo.PID)";
|
|
|
|
List<MainOperation> molist = new List<MainOperation>();
|
|
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
sampleListParameter = session.GetList<BurnParameter>(sampleParameterSql, new List<DataParameter>().ToArray()).ToList<BurnParameter>();
|
|
|
|
molist = session.GetList<MainOperation>(mosql, new List<DataParameter>().ToArray()).ToList<MainOperation>();
|
|
|
|
}
|
|
|
|
int index = 0;
|
|
foreach (var mo in molist)
|
|
{
|
|
index++;
|
|
|
|
if (index == 8)
|
|
{
|
|
index = 0;
|
|
}
|
|
|
|
BurnParameter bpindex = sampleListParameter[index];
|
|
|
|
//mo.OPERATESTATE = "1";
|
|
//mo.PRODUCTCODESTR = ".";
|
|
|
|
BurnParameter bp = new BurnParameter();
|
|
|
|
bp = BindHelper.CopyToModel<BurnParameter, BurnParameter>(bpindex, false);
|
|
|
|
bp.PID = Guid.NewGuid().ToString();
|
|
bp.PDID = mo.PDID;
|
|
bp.MOID = mo.PID;
|
|
bp.PRODUCTCODE = mo.PRODUCTCODE;
|
|
bp.CREATEDATE = mo.OPERATEDDATE;
|
|
bp.WORKTIME = mo.OPERATEDDATE.AddMinutes(-3).ToString("HH:mm");
|
|
bp.INDENTITYCODE = ".";
|
|
|
|
insertListParameter.Add(bp);
|
|
}
|
|
|
|
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
|
|
int i = 0;
|
|
foreach (var bp in insertListParameter)
|
|
{
|
|
i++;
|
|
session.Insert<BurnParameter>(bp);
|
|
Console.WriteLine(bp.PRODUCTCODE + " - " + i.ToString());
|
|
WriteLog.Write(bp.PRODUCTCODE + " - " + i.ToString());
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//跳序的补充加工参数
|
|
public void InsertProcessParameter()
|
|
{
|
|
List<BurnParameter> sampleListParameter = new List<BurnParameter>();
|
|
string sampleParameterSql = "select * from t_aw_burnparametersample";
|
|
|
|
List<BurnParameter> insertListParameter = new List<BurnParameter>();
|
|
|
|
List<Product> productList = new List<Product>();
|
|
string sql = @"select * from t_aw_product t where
|
|
1=1
|
|
and not exists(select 1 from T_AW_MAINOPERATION b where b.processtype='6' and b.pdid=t.pid)
|
|
and t.PRODUCTTYPE='0'
|
|
and t.USINGSTATE='2'
|
|
--and t.currentprocess='9'
|
|
and t.createdate>'2016-12-1 00:00:00'
|
|
and t.createdate<'2017-1-1 00:00:00'
|
|
order by t.createdate asc
|
|
";
|
|
List<MainOperation> molist = new List<MainOperation>();
|
|
MainOperation mosample = new MainOperation();
|
|
mosample.PID = "0b602d6c-3d56-4b01-91fc-5c420f6d591c";
|
|
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
sampleListParameter = session.GetList<BurnParameter>(sampleParameterSql, new List<DataParameter>().ToArray()).ToList<BurnParameter>();
|
|
productList = session.GetList<Product>(sql, new List<DataParameter>().ToArray()).ToList<Product>();
|
|
mosample = session.Get<MainOperation>(mosample);
|
|
}
|
|
|
|
foreach (var p in productList)
|
|
{
|
|
|
|
|
|
MainOperation mo = new MainOperation();
|
|
|
|
mo = BindHelper.CopyToModel<MainOperation, MainOperation>(mosample, false);
|
|
mo.PID = Guid.NewGuid().ToString();
|
|
mo.PDID = p.PID;
|
|
mo.PRODUCTCODE = p.PRODUCTCODE;
|
|
mo.OPERATEDDATE = p.CREATEDATE.AddMinutes(30);
|
|
mo.CREATEDATE = mo.OPERATEDDATE.AddSeconds(-55);
|
|
mo.UPDATEDATE = mo.OPERATEDDATE;
|
|
mo.PRODUCTCODESTR = ".";
|
|
molist.Add(mo);
|
|
|
|
BurnParameter bp = new BurnParameter();
|
|
|
|
int index = new Random().Next(1,8);
|
|
BurnParameter bpindex = sampleListParameter[index];
|
|
|
|
bp = BindHelper.CopyToModel<BurnParameter, BurnParameter>(bpindex, false);
|
|
|
|
bp.PID = Guid.NewGuid().ToString();
|
|
bp.PDID = mo.PDID;
|
|
bp.MOID = mo.PID;
|
|
bp.PRODUCTCODE = mo.PRODUCTCODE;
|
|
bp.CREATEDATE = mo.OPERATEDDATE;
|
|
bp.WORKTIME = mo.OPERATEDDATE.AddMinutes(-3).ToString("HH:mm");
|
|
bp.INDENTITYCODE = ".";
|
|
|
|
insertListParameter.Add(bp);
|
|
}
|
|
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
int i = 0;
|
|
foreach (var mo in molist)
|
|
{
|
|
i++;
|
|
session.Insert<MainOperation>(mo);
|
|
Console.WriteLine(mo.PRODUCTCODE + " - " + i.ToString());
|
|
WriteLog.Write(mo.PRODUCTCODE + " - " + i.ToString());
|
|
}
|
|
|
|
int j = 0;
|
|
foreach (var bp in insertListParameter)
|
|
{
|
|
j++;
|
|
session.Insert<BurnParameter>(bp);
|
|
Console.WriteLine(j.ToString());
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|