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

331 lines
11 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OPCPLC;
using OPCAutomation;
using System.Threading;
using QMAPP.FJC.Entity.Basic;
using QMAPP.FJC.Entity;
using QMAPP.FJC.DAL.Basic;
using System.Configuration;
using EQUIPINTERFACETEST.NewFolder1;
using QMFrameWork.Data;
using QMAPP.FJC.Entity.Operation;
using QMAPP.FJC.DAL.Operation;
using System.Configuration;
using QMAPP.FJC.Entity.ProduceManage;
using QMAPP.FJC.BLL.Operation;
using System.Data;
using EQUIPINTERFACETEST.Deal;
using QMAPP.BLL.Sys;
using QMAPP.Entity.Sys;
using QMAPP.FJC.BLL.FwMark;
using QMFrameWork.Mail;
namespace EQUIPINTERFACETEST
{
class Program
{
static void Main(string[] args)
{
//装配数据工厂
QMFrameWork.Data.DataFactory.Configure(true);
SendMsgAndMailForServer();
//List<string> list = new List<string>();
//list.Add("DP_L_PRE1");
//FWMARKDeal deal = new FWMARKDeal();
//deal.SetMark("WORKCELL", list);
//MesInsertParameterTest test = new MesInsertParameterTest();
//test.Test();
//ProductBLL prdouctbll = new ProductBLL();
//prdouctbll.InsertAirbagSupportPackage("B9022016070801A00000");
//Console.WriteLine(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff"));
//DataTable dt = new DataTable();
//DataTable dt2 = new DataTable();
//using (IDataSession session = AppDataFactory.CreateMainSession())
//{
// string tyreSql = string.Format("select * from T_CL_TYER where TYERCODE='{0}'", "059873600055");
// dt = session.GetTable(tyreSql, new List<DataParameter>().ToArray());
// if (dt.Rows.Count > 0)
// {
// string tyreCode = dt.Rows[0]["TYERCODE"].ToString();
// string planSql = string.Format("select top 1 * from t_cl_plan where tyercode is null order by PRODUCEINDEX asc");
// dt2 = session.GetTable(planSql, new List<DataParameter>().ToArray());
// Console.WriteLine("获取t_cl_plan表");
// if(dt2.Rows.Count>0)
// {
// string meterialCode = dt2.Rows[0]["METERIALCODE"].ToString();
// int pid = Convert.ToInt32(dt2.Rows[0]["PID"]);
// string updateSql = string.Format("update t_cl_plan set tyercode='{0}' where pid={1}", tyreCode, pid);
// session.ExecuteSql(updateSql, new List<DataParameter>().ToArray());
// Console.WriteLine("更新t_cl_plan表");
// }
// }
//}
//Console.WriteLine(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff"));
//List<MendRecorder> list = new List<MendRecorder>();
//List<MainOperation> molist = new List<MainOperation>();
//string sql = "select * from T_AW_MENDRECORDER where MOLDNUMBER='1' ";
//string mosql = "select * from T_AW_MAINOPERATION mo where exists (select 1 from T_AW_MENDRECORDER t where t.PPID=mo.PDID and mo.PROCESSTYPE='9')";
//using (IDataSession session = AppDataFactory.CreateMainSession())
//{
// list = session.GetList<MendRecorder>(sql, new List<DataParameter>().ToArray()).ToList<MendRecorder>();
// molist = session.GetList<MainOperation>(mosql, new List<DataParameter>().ToArray()).ToList<MainOperation>();
//}
//foreach (var p in list)
//{
// if (molist.Count(o => o.PDID == p.PPID) > 0)
// {
// MainOperation mo = molist.First(o => o.PDID == p.PPID);
// p.MOLDNUMBER = mo.MOLDNUMBER;
// }
//}
//using (IDataSession session = AppDataFactory.CreateMainSession())
//{
// foreach (var o in list)
// {
// Console.WriteLine(o.PRODUCTCODE);
// session.Update<MendRecorder>(o);
// }
//}
//List<string> barcodeList = new List<string>();
//barcodeList.Add("16062414322CH1A01");
//barcodeList.Add("16062414322CB1A01");
//var barCode = barcodeList.ToArray();
//for (int i = 0; i < barCode.Length; i++)
//{
// QM.Assist.LabelInfo ll = new QM.Assist.LabelInfo();
// string item = barCode[i].Trim();
// string hb = item.Substring(12, 1);
// ll.BarCode = item + ",*" + item + "*" + "," + (hb == "H" ? "高" : "");
// QM.Assist.PrintUtil.LabelList2.Add(ll);
//}
//QM.Assist.PrintUtil pu = new QM.Assist.PrintUtil();
//pu.PrintLabel2(System.Configuration.ConfigurationManager.AppSettings["proPath"].ToString
// (), System.Configuration.ConfigurationManager.AppSettings["BPtemPath"].ToString(),
// System.Configuration.ConfigurationManager.AppSettings["BPdataPath"].ToString());
//var barCode = barcodeList.ToArray();
//for (int i = 0; i < barCode.Length; i++)
//{
// QM.Assist.LabelInfo ll = new QM.Assist.LabelInfo();
// string item = barCode[i].Trim();
// string hb = item.Substring(12, 1);
// ll.BarCode = item + ",*" + item + "*" + "," + (hb == "H" ? "高" : "");
// QM.Assist.PrintUtil.LabelList2.Add(ll);
//}
//QM.Assist.PrintUtil pu = new QM.Assist.PrintUtil();
//pu.PrintLabel2(System.Configuration.ConfigurationManager.AppSettings["proPath"].ToString
// (), System.Configuration.ConfigurationManager.AppSettings["BPtemPath"].ToString(),
// System.Configuration.ConfigurationManager.AppSettings["BPdataPath"].ToString());
//string a = "1";
//string b = a.Substring(0, a.IndexOf('/')).PadLeft(2, '0');
//EQUIPINTERFACETEST.PrintTestModel.BarCodePrintClient printClient = new EQUIPINTERFACETEST.PrintTestModel.BarCodePrintClient();
//bool b = printClient.Print(barcodeList.ToArray(), "BP");
#region 必要项加载
#endregion
#region 红外焊接
//WeldTest test = new WeldTest();
//test.InitParameter();
//decimal flowValue = new Random().Next(3943, 3944);
//Console.WriteLine(flowValue / 10);
#endregion
#region 冷刀弱化
//SkinScoreTest test = new SkinScoreTest();
//test.InitParameter();
//test.Test();
//test.WriteTest();
#endregion
#region 超声波焊接
//AltraSpaTest altraSpaTest = new AltraSpaTest();
//altraSpaTest.InitParameter();
//altraSpaTest.Test();
#endregion
//SlushInsertTest test = new SlushInsertTest();
//test.Test();
//SlushTest slushTest = new SlushTest();
//slushTest.InitParameter();
//slushTest.Test();
//PunchTest punchTest = new PunchTest();
//punchTest.InitParameter();
//punchTest.WriteTest();
//punchTest.Test();
//MillTest test = new MillTest();
//test.InitParameter();
//test.Test();
//CastingMachineTest test = new CastingMachineTest();
//test.InitParameter();
//test.WriteParameter();
//test.Test();
//InsertProcessParameter t = new InsertProcessParameter();
//t.InsertSlushRelation();
//InsertProcessParameter test = new InsertProcessParameter();
//test.InsertWeld();
//InsertProcessParameter test = new InsertProcessParameter();
//test.InsertScoring();
//InsertProcessParameter ipp = new InsertProcessParameter();
//ipp.InsertSkinProcessParameter();
//ColorDistinguishTest test = new ColorDistinguishTest();
//test.Test();
//CastOperateTest test = new CastOperateTest();
//test.Test();
//InterruptTest test = new InterruptTest();
//test.Test();
//FS_FJC_Test test = new FS_FJC_Test();
//test.GetValueTest();
//AirbagSupportPackageServiceClient client = new AirbagSupportPackageServiceClient();
//client.AddAirbagSupport("E8WY43KDKKDH");
//GetBarCodeTest test = new GetBarCodeTest();
//test.StartTCPServer();
//ProductBLL productbll = new ProductBLL();
//productbll.InsertAirbagSupportPackage("B920938273723");
//AltraSpaTest test = new AltraSpaTest();
//test.InitParametert
//CastingMachineTest test = new CastingMachineTest();
//test.InitParameter();
//test.WriteParameter();
//string barcode = "B90220151201A00000";
//ProductBLL productbll = new ProductBLL();
//productbll.InsertAirbagSupportPackage(barcode);
//InsertCastingParameter test = new InsertCastingParameter();
//test.Insert();
//InsertCastingParameter c = new InsertCastingParameter();
//c.Insert();
//SlushTest test = new SlushTest();
//test.InitParameter();
//test.Test();
//CastingMachineTest test = new CastingMachineTest();
//test.InitParameter();
//test.WriteParameter();
//test.Test();
//PunchTest test = new PunchTest();
//test.InitParameter();
////test.WriteTest();
//test.Test();
//LoadOpcLeafTest test = new LoadOpcLeafTest();
//test.LoadLeafTest();
//UltrasDeal deal = new UltrasDeal();
//deal.InsertParameter();
Console.ReadKey(true);
}
//短信邮件发送
public static void SendMsgAndMailForServer()
{
//com口
var commPort = ConfigurationManager.AppSettings["CommPort"];
//短信
//SMSAdapter smsAdapter = new SMSAdapter(commPort);
//邮件参数
var smtpServer = ConfigurationManager.AppSettings["SmtpServerAndon"];
var senderUser = ConfigurationManager.AppSettings["SenderUser"];
var senderPassword = ConfigurationManager.AppSettings["SenderPassword"];
var doMain = ConfigurationManager.AppSettings["DoMainAndon"];
var senderUserEmail = ConfigurationManager.AppSettings["SenderUserEmail"];
//标题
var subject = ConfigurationManager.AppSettings["Subject"];
//邮件服务器
SmtpServerInfo smtpServerInfo =
new SmtpServerInfo(smtpServer, senderUser, senderPassword, doMain, senderUserEmail);
MailHelper mailHelper = new MailHelper();
//邮件
MailInfo mailInfo = new MailInfo();
mailInfo.Subject = subject;
mailInfo.Content = "测试邮件";
mailInfo.ToMail = new[] { "yyg_dlqm@faw.com.cn" };
mailHelper.SendMailForServer(mailInfo, smtpServerInfo);
}
}
}