|
|
|
@ -13,6 +13,7 @@ using System.Text;
|
|
|
|
|
using HcUtility.Core;
|
|
|
|
|
using HcUtility.Comm;
|
|
|
|
|
using System.Data.Entity;
|
|
|
|
|
using RabbitMQ.Client;
|
|
|
|
|
|
|
|
|
|
namespace JobPingTaiWork
|
|
|
|
|
{
|
|
|
|
@ -145,6 +146,7 @@ namespace JobPingTaiWork
|
|
|
|
|
connStr = context.JobDetail.JobDataMap.GetString("ConnectString");
|
|
|
|
|
reqUrl = context.JobDetail.JobDataMap.GetString("ReqUrl");
|
|
|
|
|
reqTimeout = Convert.ToInt32(context.JobDetail.JobDataMap.GetString("RequestTimeout"));
|
|
|
|
|
var mqConnStr = context.JobDetail.JobDataMap.GetString("RabbitConnectString");
|
|
|
|
|
|
|
|
|
|
log.Debug($"连接字符串:{connStr}");
|
|
|
|
|
log.Debug($"请求URL:{reqUrl}");
|
|
|
|
@ -196,7 +198,7 @@ namespace JobPingTaiWork
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var needPushStatus = false;
|
|
|
|
|
var PortResult = Newtonsoft.Json.JsonConvert.DeserializeObject<RepWLXXModel>(rtn);
|
|
|
|
|
|
|
|
|
|
var portstatus = PortResult.message[0];
|
|
|
|
@ -232,7 +234,7 @@ namespace JobPingTaiWork
|
|
|
|
|
//result = SaveStatus(newStatusRecord, headdata.MFNO);
|
|
|
|
|
upd = true;
|
|
|
|
|
EdiStatusDAL.Update(newStatusRecord);
|
|
|
|
|
|
|
|
|
|
needPushStatus = true;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
newStatusRecord = status;
|
|
|
|
@ -253,14 +255,49 @@ namespace JobPingTaiWork
|
|
|
|
|
newStatusRecord.SetValue("mblno", MBLNO);
|
|
|
|
|
|
|
|
|
|
EdiStatusDAL.Insert(newStatusRecord);
|
|
|
|
|
|
|
|
|
|
needPushStatus= true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
DelMinMblno(connStr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(needPushStatus)
|
|
|
|
|
{
|
|
|
|
|
//回推舱单状态
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(mqConnStr))
|
|
|
|
|
{
|
|
|
|
|
log.Warn($"未配置舱单回推消息队列,不会回推状态:{MFNO}");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
log.Debug($"准备推送舱单状态回推到消息队列:{string.Join(",", MFNO)}");
|
|
|
|
|
//推送消息
|
|
|
|
|
ConnectionFactory factory = new ConnectionFactory();
|
|
|
|
|
factory.Uri = mqConnStr;
|
|
|
|
|
var mqConn = factory.CreateConnection("JobPingTaiWork");
|
|
|
|
|
|
|
|
|
|
var exchangeName = "myshiping.feedback.status.cangdan";
|
|
|
|
|
IModel model = mqConn.CreateModel();
|
|
|
|
|
model.ExchangeDeclare(exchange: exchangeName, type: ExchangeType.Fanout);
|
|
|
|
|
model.BasicPublish(exchange: exchangeName,
|
|
|
|
|
routingKey: "",
|
|
|
|
|
basicProperties: null,
|
|
|
|
|
body: Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(new { MfnoList = new string[] { MFNO } })));
|
|
|
|
|
|
|
|
|
|
mqConn.Close();
|
|
|
|
|
log.Debug($"推送舱单状态回推消息完成");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
log.Error($"推送舱单状态回推消息失败:{ex.Message}");
|
|
|
|
|
log.Error(ex.StackTrace);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|