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

299 lines
9.6 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SimulateServiceHost.DataTest;
using System.Threading.Tasks;
using QMFrameWork.Data;
using QMAPP.FJC.Entity.FeedInManage;
using QMAPP.ServicesAgent;
using QMAPP.Entity;
using QMAPP.FJC.Entity.Basic;
using QMFrameWork.Common.Serialization;
using SimulateServiceHost.OpcServiceHost;
using QMAPP.FJC.DAL.Basic;
using QMAPP.FJC.BLL.Common;
namespace SimulateServiceHost
{
class Program
{
static void Main(string[] args)
{
//装配数据工厂
QMFrameWork.Data.DataFactory.Configure(true);
#region
//SlushClass slush = new SlushClass();
//slush.Create();
#endregion
#region 大数据量性能测试插入数据
//DateTime dt = Convert.ToDateTime(System.DateTime.Now.AddMonths(-6).ToShortDateString());
//DateTime dt = Convert.ToDateTime("2015-02-27 00:00:00.000");
//HalfYearCreate test = new HalfYearCreate();
//Action ac1 = () =>
//{
// test.InsertData(
// Convert.ToDateTime("2014-06-23 23:31:37.000"),
// Convert.ToDateTime("2014-08-27 00:00:00.000")
// );
//};
//Action ac2 = () =>
//{
// test.InsertData(
// Convert.ToDateTime("2013-12-20 19:48:03.000"),
// Convert.ToDateTime("2014-02-27 00:00:00.000")
// );
//};
//Action ac3 = () =>
//{
// test.InsertData(
// Convert.ToDateTime("2013-06-24 03:18:02.000"),
// Convert.ToDateTime("2013-08-27 00:00:00.000")
// );
//};
//Action ac4 = () =>
//{
// test.InsertData(
// Convert.ToDateTime("2012-12-22 06:19:10.000"),
// Convert.ToDateTime("2013-02-27 00:00:00.000")
// );
//};
//Task task1 = new Task(ac1);
//Task task2 = new Task(ac2);
//Task task3 = new Task(ac3);
//Task task4 = new Task(ac4);
//task1.Start();
//task2.Start();
//task3.Start();
//task4.Start();
#endregion
#region 数据地层测试
//GetListTest test = new GetListTest();
//DataPage dg = new DataPage();
//dg.PageIndex = 1;
//dg.PageSize = 20;
//dg.KeyName = "PID";
//dg.RecordCount = 0;
//dg.PageCount = 0;
//dg.SortExpression = "UPDATEDATE DESC";
//Epidermis entity = new Epidermis();
//entity.ENDCREATEDATE = Convert.ToDateTime("2015-09-09 00:00:00");
//entity.STARTCREATEDATE = Convert.ToDateTime("2015-03-09 00:00:00");
//entity.PRODUCTTYPE = "0";
//dg = test.GetList(entity, dg);
#endregion
//string a = JsonConvertHelper.GetSerializes(paraConfigList);
OpcServiceClient client = new OpcServiceClient();
//string a = client.GetMachineList();
//List<MachineInfo> machineList = new List<MachineInfo>();
//machineList = JsonConvertHelper.GetDeserialize<List<MachineInfo>>(a);
string b = client.GetParaConfigList();
List<ParameterConfig> paraList = new List<ParameterConfig>();
paraList = JsonConvertHelper.GetDeserialize<List<ParameterConfig>>(b);
paraList = paraList.Where(o => o.MACHINECODDE == "101").ToList<ParameterConfig>();
List<ParameterConfig> list = new List<ParameterConfig>();
#region 产品条码号
//年
ParameterConfig ypc = paraList.First(o => o.MACHINECODDE == "101"
&& o.MOLDNUMBER == "1" && o.COLUMNCODE.Contains("YEAR"));
ypc.PARAVALUE = BinaryConvert.HexToDec("15");
list.Add(ypc);
//月
ParameterConfig mpc = paraList.First(o => o.MACHINECODDE == "101"
&& o.MOLDNUMBER == "1" && o.COLUMNCODE.Contains("MONTH"));
mpc.PARAVALUE = BinaryConvert.HexToDec("09");
list.Add(mpc);
ParameterConfig dpc = paraList.First(o => o.MACHINECODDE == "101"
&& o.MOLDNUMBER == "1" && o.COLUMNCODE.Contains("DAY"));
dpc.PARAVALUE = BinaryConvert.HexToDec("13");
list.Add(dpc);
ParameterConfig hpc = paraList.First(o => o.MACHINECODDE == "101"
&& o.MOLDNUMBER == "1" && o.COLUMNCODE.Contains("HOUR"));
hpc.PARAVALUE = BinaryConvert.HexToDec("10");
list.Add(hpc);
ParameterConfig mipc = paraList.First(o => o.MACHINECODDE == "101"
&& o.MOLDNUMBER == "1" && o.COLUMNCODE.Contains("MINUTE"));
mipc.PARAVALUE = BinaryConvert.HexToDec("40");
list.Add(mipc);
ParameterConfig spc = paraList.First(o => o.MACHINECODDE == "101"
&& o.MOLDNUMBER == "1" && o.COLUMNCODE.Contains("SECOND"));
spc.PARAVALUE = BinaryConvert.HexToDec("40");
list.Add(spc);
//设备号
ParameterConfig machineno = paraList.First(o => o.MACHINECODDE == "101"
&& o.MOLDNUMBER == "1" && o.COLUMNCODE.Contains("MACHINENO"));
machineno.PARAVALUE = "2";
list.Add(machineno);
//高低配
ParameterConfig hudbasic = paraList.First(o => o.MACHINECODDE == "101"
&& o.MOLDNUMBER == "1" && o.COLUMNCODE.Contains("HUDORBASIC"));
hudbasic.PARAVALUE = "H/H";
list.Add(hudbasic);
//产品类别
ParameterConfig product = paraList.First(o => o.MACHINECODDE == "101"
&& o.MOLDNUMBER == "1" && o.COLUMNCODE.Contains("PRODUCT"));
product.PARAVALUE = "B";
list.Add(product);
//产品颜色
ParameterConfig color = paraList.First(o => o.MACHINECODDE == "101"
&& o.MOLDNUMBER == "1" && o.COLUMNCODE.Contains("COLOR"));
color.PARAVALUE = "2";
list.Add(color);
//产品模具类型
ParameterConfig cavitytype = paraList.First(o => o.MACHINECODDE == "101"
&& o.MOLDNUMBER == "1" && o.COLUMNCODE.Contains("CAVITYTYPE"));
cavitytype.PARAVALUE = "A/B";
list.Add(cavitytype);
//模具号
ParameterConfig mouldcarrier = paraList.First(o => o.MACHINECODDE == "101"
&& o.MOLDNUMBER == "1" && o.COLUMNCODE.Contains("MOULDCARRIER"));
mouldcarrier.PARAVALUE = "1/1";
list.Add(mouldcarrier);
//模具号
ParameterConfig aremnuber = paraList.First(o => o.MACHINECODDE == "101"
&& o.MOLDNUMBER == "1" && o.COLUMNCODE.Contains("ARMNUMBER"));
aremnuber.PARAVALUE = "1";
list.Add(aremnuber);
#endregion
paraList = paraList.Where(o => o.MACHINECODDE == "101" && o.COLUMNTYPE == "5").ToList<ParameterConfig>();
foreach (var p in paraList)
{
if (p.COLUMNCODE.Contains("PRODUCTCODE"))
{
p.PARAVALUE = "B";
list.Add(p);
}
else if (p.COLUMNCODE.Contains("HB"))
{
p.PARAVALUE = "A/A";
list.Add(p);
}
else if (p.COLUMNCODE.Contains("PRODUCTSTATUS"))
{
p.PARAVALUE = "1";
list.Add(p);
}
else if (p.COLUMNCODE.Contains("RECIPENUMBER"))
{
p.PARAVALUE = "4";
list.Add(p);
}
else if (p.COLUMNCODE.Contains("ARMNUMBER"))
{
p.PARAVALUE = "3";
list.Add(p);
}
else if (p.COLUMNCODE.Contains("COLORCODE"))
{
p.PARAVALUE = "2";
list.Add(p);
}
else
{
if (p.DATATYPE == "DECIMAL")
{
p.PARAVALUE = Convert.ToDecimal(1.5);
list.Add(p);
}
else if (p.DATATYPE == "INT")
{
p.PARAVALUE = Convert.ToDecimal(1);
list.Add(p);
}
else
{
p.PARAVALUE = "2";
list.Add(p);
}
}
}
b = JsonConvertHelper.GetSerializes(list);
client.SubmitParameters(b);
Console.WriteLine(System.DateTime.Now.ToLongTimeString());
Console.ReadKey(true);
}
public static ServiceAgent GetServiceAgent()
{
try
{
//创建代理
ServiceAgent agent = new ServiceAgent();
//设置凭据
agent.ClientCredential = new QMFrameWork.ServiceInterface.CredentialInfo();
agent.ClientCredential.UserID = "c361d78c-91ed-4b1f-9777-8ff0aefa6cc6";
agent.ClientCredential.CredentialID = "d7911036-d36f-460f-a052-979628322df3";
return agent;
}
catch (Exception ex)
{
throw ex;
}
}
}
}