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.
105 lines
4.1 KiB
105 lines
4.1 KiB
using ICSSoft.FromERP.Model;
|
|
using Newtonsoft.Json;
|
|
using Quartz;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ICSSoft.FromERP
|
|
{
|
|
/// <summary>
|
|
/// 数采上传(金杨)
|
|
/// </summary>
|
|
public class SyncCas_Jinyang : IJob
|
|
{
|
|
private static object key = new object();
|
|
private static log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
|
public void Execute(IJobExecutionContext context)
|
|
{
|
|
try
|
|
{
|
|
lock (key)
|
|
{
|
|
log.Info("开始……………………………………………………………………");
|
|
Execute();
|
|
log.Info("结束……………………………………………………………………");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex.ToString());
|
|
}
|
|
}
|
|
|
|
public void Execute()
|
|
{
|
|
try
|
|
{
|
|
string conStr = ICSHelper.GetConnectString();
|
|
string Namespace = this.GetType().Namespace;
|
|
//string Class = this.GetType().Name;
|
|
DataTable dt = ICSHelper.GetERPDB(conStr);
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
//var dtNowBegin = new DateTime(2000, 1, 1, 0, 0, 0);//默认开始时间
|
|
//var dtNow = DateTime.Now;
|
|
//string erpName = ICSHelper.GetConfigString()["ERPDB"];
|
|
//string TenantId = dr["TenantId"].ToString();//mes 组织
|
|
//string TenantCode = dr["TenantCode"].ToString();
|
|
//string ErpId = dr["ErpID"].ToString(); //erpID
|
|
//string Class = this.GetType().Name + TenantCode;
|
|
//erpName = string.Format(erpName, TenantId);
|
|
|
|
//string sql0 = " SELECT top 1 ModifyDate FROM ICSERPTime where ClassName='" + Class + "'";
|
|
//var lastDate = ICSHelper.ExecuteScalar(conStr, sql0).ToDateOrNull();
|
|
//if (!lastDate.HasValue)
|
|
//{
|
|
// lastDate = dtNowBegin;
|
|
//}
|
|
|
|
//string sql = @" select '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' as MTIME into #TempVendor ";
|
|
//sql = ICSHelper.Time(Namespace, Class, TenantId, sql, "#TempVendor");
|
|
//sql += "DROP TABLE #TempVendor";
|
|
//ICSHelper.ExecuteDate(conStr, sql);
|
|
|
|
|
|
List<CapInputDto> list = new List<CapInputDto>();
|
|
var input = new CapInputDto();
|
|
input.WorkshopID = "1";
|
|
input.EquipmentID = "1";
|
|
input.ProductNo = "1";
|
|
input.LotNo = "1";
|
|
input.CollectionTime = "1";
|
|
input.ParamValue_Resistance = 12;
|
|
input.ParamValue_Height = 12;
|
|
input.Msg = "";
|
|
|
|
list.Add(input);
|
|
|
|
var inputObj = JsonConvert.SerializeObject(list);
|
|
//string url = ICSHelper.GetConfigString()["JinyangCapUrl"]+ @"?deipaaskeyauth=a5P1RTL4380zd9jpb57qXx63rdynUHN2";
|
|
string url = ICSHelper.GetConfigString()["JinyangCapUrl"];
|
|
|
|
var result = HttpHelper.HttpClientPost<ResponseInfoDto>(url, inputObj, new Dictionary<string, string>() { { "deipaaskeyauth", "a5P1RTL4380zd9jpb57qXx63rdynUHN2" } }).Result;
|
|
// var result = HttpHelper.HttpClientPost<ResponseInfoDto>(url, inputObj).Result;
|
|
if (result.Result == "OK")
|
|
{
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
throw new Exception(result.Result);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error(ex.ToString());
|
|
}
|
|
}
|
|
}
|
|
}
|