135 lines
5.6 KiB
C#
135 lines
5.6 KiB
C#
using GetHttpData.SDK;
|
|
using GetHttpData.SDK.ThreadPool;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace GetMembership
|
|
{
|
|
public partial class LodData : Form
|
|
{
|
|
ClientThread _ClientThread = new ClientThread();
|
|
Timer _Timer = new Timer();
|
|
public LodData()
|
|
{
|
|
try
|
|
{
|
|
ConfigThread _ConfigThread = new ConfigThread();
|
|
QualityHelper _QualityHelper = new QualityHelper();
|
|
|
|
//_ClientThread.setConfiguration("192.168.12.110:7000",
|
|
//_QualityHelper.authorization, _QualityHelper.serverpartcode, _QualityHelper.serverpartshop_id,
|
|
//_QualityHelper.shopcode, _QualityHelper.macaddress, _QualityHelper.machinecode, 400);
|
|
|
|
//TableDataService、DataServices
|
|
StringBuilder _ConfigSql = new StringBuilder();
|
|
_ConfigSql.Append("http://" + _QualityHelper.dbip + ":" + _QualityHelper.serviceport + "/DataServices/Service.asmx").Append(" ");
|
|
_ConfigSql.Append(_QualityHelper.authorization).Append(" ");
|
|
_ConfigSql.Append(_QualityHelper.serverpartcode).Append(" ");
|
|
_ConfigSql.Append(_QualityHelper.serverpartshop_id).Append(" ");
|
|
_ConfigSql.Append(_QualityHelper.shopcode).Append(" ");
|
|
_ConfigSql.Append(_QualityHelper.macaddress).Append(" ");
|
|
_ConfigSql.Append(_QualityHelper.machinecode);
|
|
|
|
_ClientThread.setConfiguration("http://" + _QualityHelper.dbip + ":" + _QualityHelper.serviceport + "/DataServices/Service.asmx",
|
|
_QualityHelper.authorization, _QualityHelper.serverpartcode, _QualityHelper.serverpartshop_id,
|
|
_QualityHelper.shopcode, _QualityHelper.macaddress, _QualityHelper.machinecode, 400);
|
|
//_ClientThread.IsUpload(true, new List<string>() { "T_BUSINESSTIME", "T_DATACOLLECTION", "T_EXCEPTION", "T_MOBILE_PAY", "T_MOBILE_PAYCHECK", "T_COMMODITYEX_NEW" });
|
|
//_ClientThread.IsDownload(true, new List<string>() { "T_CONFIGURATION", "T_ICCARDINFO", "T_MEMBERSHIP", "T_SALESPROMOTE", "T_SHOPMESSAGE", "T_SELLWORKER" });
|
|
//_ClientThread.IsUpload(true, new List<string>() { "T_ENDACCOUNT", "T_PERSONSELL" });
|
|
|
|
_ClientThread.IsUpload(true);
|
|
_ClientThread.IsDownload(true);
|
|
_ClientThread.setConfigThread(_ConfigThread);
|
|
_ClientThread.UploadStringEvent += new ClientThread.OutputResultsUploadArg(UploadStringEvent);//监听上传事件
|
|
_ClientThread.DownloadStringEvent += new ClientThread.OutputResultsDownArg(DownloadStringEvent);//监听下发事件
|
|
_Timer.Interval = 120 * 1000;
|
|
_Timer.Tick += new System.EventHandler(this.timer1_Tick);
|
|
_Timer.Start();
|
|
LogHelper.WriteServiceLog(_ConfigSql.ToString());
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteServiceLog(ex.ToString());
|
|
}
|
|
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
bool falg = _ClientThread.onState();
|
|
}
|
|
|
|
#region 方法 -> 上传、下发回调结果
|
|
/// <summary>
|
|
/// 上传回调结果
|
|
/// </summary>
|
|
/// <param name="uploadResultInfo"></param>
|
|
/// <param name="resultString"></param>
|
|
private void UploadStringEvent(UploadResultInfo uploadResultInfo, string resultString)
|
|
{
|
|
//switch (uploadResultInfo.TableName)
|
|
//{
|
|
// case "HIGHWAY_EXCHANGE.T_SELLMASTER":
|
|
// if (uploadResultInfo.StartToEnd)
|
|
// {
|
|
// //开始
|
|
// }
|
|
// else
|
|
// {
|
|
// //结束
|
|
// }
|
|
// break;
|
|
// case "HIGHWAY_EXCHANGE.T_PERSONSELL_NEW":
|
|
// break;
|
|
// case "HIGHWAY_EXCHANGE.T_ENDACCOUNT_NEW":
|
|
// break;
|
|
//}
|
|
//System.Diagnostics.Debug.WriteLine(resultString, "OpenTopThreads_" + uploadResultInfo.TableName);
|
|
LogHelper.WriteServiceLog(resultString);
|
|
}
|
|
/// <summary>
|
|
/// 下发回调结果
|
|
/// </summary>
|
|
/// <param name="downResultInfo"></param>
|
|
/// <param name="resultString"></param>
|
|
private void DownloadStringEvent(DownResultInfo downResultInfo, string resultString)
|
|
{
|
|
//switch (downResultInfo.TableName)
|
|
//{
|
|
// case "HIGHWAY_EXCHANGE.T_USERDEFINEDTYPE":
|
|
// if (downResultInfo.StartToEnd)
|
|
// {
|
|
// //开始
|
|
// }
|
|
// else
|
|
// {
|
|
// //结束
|
|
// }
|
|
// break;
|
|
// case "HIGHWAY_EXCHANGE.T_COMMODITYEX":
|
|
// break;
|
|
//}
|
|
//System.Diagnostics.Debug.WriteLine(resultString, "OpenDownThreads_" + downResultInfo.TableName);
|
|
LogHelper.WriteServiceLog(resultString);
|
|
}
|
|
#endregion
|
|
|
|
private void timer1_Tick(object sender, EventArgs e)
|
|
{
|
|
bool falg = _ClientThread.onState();
|
|
}
|
|
|
|
private void LodData_Load(object sender, EventArgs e)
|
|
{
|
|
this.Visible = false;
|
|
}
|
|
}
|
|
}
|