YingHang
dengyu 3 months ago
parent 6a04e7eb10
commit 0ed499c8f0

@ -4315,4 +4315,76 @@ namespace DSWeb.Common.DB
//public string NotifypartPhoneExtension { get; set; }
}
/// <summary>
/// 大简云VGMsend
/// </summary>
[Table("op_seae_vgm_send")]
public class op_seae_vgm_send_md
{
[Key]
public string GID { get; set; }
public string BSNO { get; set; }
public string VGMSTATUS { get; set; }
public string MBLNO { get; set; }
public string ORDERNO { get; set; }
public string CARRIER { get; set; }
public string LOADPORT { get; set; }
public string MATOU { get; set; }
public bool? ISCARRIER { get; set; } = false;
public bool? ISYGT { get; set; } = false;
public string YGTSTATUS { get; set; }
public string CARRIERSTATUS { get; set; }
public string YARDSTATUS { get; set; }
public string SENDTYPE { get; set; }
public string VESSEL { get; set; }
public string VOYNO { get; set; }
public DateTime? VGM_TIME { get; set; }
public Int32? CTNNUM { get; set; } = 0;
public string REMARK { get; set; }
public string SENDERUSER { get; set; }
public DateTime? SENDTIME { get; set; }
public string LINKURL { get; set; }
}
[Table("op_seae_vgm_history")]
public class op_seae_vgm_history_md
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long ID { get; set; } = 0;
public string BSNO { get; set; }
public DateTime? SENDTIME { get; set; }
public string SENDTYPE { get; set; }
public string SENDERUSER { get; set; }
public int? CTNNUM { get; set; } = 0;
public string REMARK { get; set; }
[NotMapped]
public string SENDERNAME { get; set; }
}
/// <summary>
/// 云港通 码头 回执状态 type= YGTYARDCARRIER
/// </summary>
[Table("op_seae_vgm_state")]
public class op_seae_vgm_state_md
{
[Key]
public string gid { get; set; }
public string mfno { get; set; }
public string statustext { get; set; }
public DateTime? statustime { get; set; }
public DateTime? createtime { get; set; }
public string cntrno { get; set; }
public string mblno { get; set; }
public string TIPS { get; set; }
public string Type { get; set; }
}
}

@ -146,6 +146,15 @@ namespace DSWeb.Common.DB
public DbSet<VW_DJYORDER_LASTShipper_md> VW_DJYORDER_LASTShipper { get; set; }
public DbSet<VW_DJYORDER_LASTConsignee_md> VW_DJYORDER_LASTConsignee { get; set; }
public DbSet<VW_DJYORDER_LASTNotifypart_md> VW_DJYORDER_LASTNotifypart { get; set; }
public DbSet<op_seae_vgm_send_md> op_seae_vgm_send { get; set; }
public DbSet<op_seae_vgm_history_md> op_seae_vgm_history { get; set; }
public DbSet<op_seae_vgm_state_md> op_seae_vgm_state { get; set; }
}
}

@ -3328,7 +3328,6 @@ namespace DSWeb.Areas.CommMng.DAL
}
static public string GetPortEDICODEByPORTNAMEorPORTIDAndEDIName(string PORTNAME, string EDINAME)
{
var cdc = new CommonDataContext();
@ -7841,6 +7840,35 @@ namespace DSWeb.Areas.CommMng.DAL
return "";
}
/// <summary>
/// <summary>
/// 字符串转Unicode
/// </summary>
/// <param name="source">源字符串</param>
/// <returns>Unicode编码后的字符串</returns>
public static string String2Unicode(string source)
{
byte[] bytes = Encoding.Unicode.GetBytes(source);
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < bytes.Length; i += 2)
{
stringBuilder.AppendFormat("\\u{0}{1}", bytes[i + 1].ToString("x").PadLeft(2, '0'), bytes[i].ToString("x").PadLeft(2, '0'));
}
return stringBuilder.ToString();
}
/// <summary>
/// Unicode转字符串
/// </summary>
/// <param name="source">经过Unicode编码的字符串</param>
/// <returns>正常字符串</returns>
public static string Unicode2String(string source)
{
return new Regex(@"\\u([0-9A-F]{4})", RegexOptions.IgnoreCase | RegexOptions.Compiled).Replace(
source, x => string.Empty + Convert.ToChar(Convert.ToUInt16(x.Result("$1"), 16)));
}
}
public class BarCodeDrawing

@ -41,6 +41,8 @@ using com.sun.xml.@internal.bind.v2.model.core;
using DSWeb.Common.Helper;
using static sun.java2d.pipe.hw.ExtendedBufferCapabilities;
using DSWeb.SoftMng.Model;
using static DSWeb.Areas.CommMng.DAL.SERVICEBILL_MqWorkDAL;
using DSWeb.MvcShipping.DAL.MsOpVgmSendDAL;
namespace DSWeb.Areas.CommMng.DAL
{
@ -3504,5 +3506,82 @@ namespace DSWeb.Areas.CommMng.DAL
public string BusinessTime { get; set; }
}
#endregion
}
public class DJYVGMReceipt_MqWorkDAL {
#region 大简云VGM回执回推处理
public static void ReceiveDjyVGMReceipt(string itemstr)
{
try
{
Task.Run(() => { Do_ReceiveDjyVGMReceipt(itemstr); });
}
catch (Exception e)
{
//var errorobjstr = JsonConvert.SerializeObject(e);
//logger.Error($"导入出错:{e}//{errorobjstr}");
}
}
//ReceiveDjyVGMReceipt
public static void Do_ReceiveDjyVGMReceipt(string itemstr, int count = 0)
{
if (count > 2)
{
Thread.Sleep(300);
//loggerHelper.Save($"重试完结");
return;
}
var statusList = JsonConvert.DeserializeObject<List<op_seae_vgm_state_md>>(itemstr);
var cdc = new CommonDataContext();
try
{
var bsnoList = statusList.Select(s => s.mfno).Distinct().ToList();
var op_seaeList = cdc.OP_SEAE.Where(s => bsnoList.Contains(s.BSNO)).ToList();
foreach (var op_seae in op_seaeList) {
var head = cdc.op_seae_vgm_send.FirstOrDefault(x => x.BSNO == op_seae.BSNO);
foreach (var item in statusList.Where(s => s.mfno == op_seae.BSNO).OrderBy(o=>o.statustime).ToList())
{
cdc.op_seae_vgm_state.AddOrUpdate(item);
if(item.Type=="YGT")
head.YGTSTATUS= item.statustext;
if (item.Type == "YARD")
head.YARDSTATUS = item.statustext;
if (item.Type == "CARRIER")
head.CARRIERSTATUS = item.statustext;
cdc.op_seae_vgm_send.AddOrUpdate(head);
}
}
}
catch (Exception e)
{
}
finally
{
}
}
#endregion
}
}

@ -31,6 +31,7 @@ using DSWeb.Areas.MvcShipping.Helper;
using com.sun.jndi.dns;
using DSWeb.EntityDA;
using DSWeb.MvcShipping.Models.MsChFee;
using Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation;
namespace DSWeb.Areas.CommMng.Models
{
@ -3852,4 +3853,23 @@ namespace DSWeb.Areas.CommMng.Models
}
#endregion
public class DJYResult
{
public int statusCode { get; set; }
public object data { get; set; }
public bool? succeeded { get; set; }
public bool? errors { get; set; }
}
public class vgmResult : DJYResult
{
public string data { get; set; }
public string errors { get; set; }
}
}

@ -113,6 +113,50 @@ namespace DSWeb.Areas.MvcShipping.Comm
return responseString;
}
public static string DoGet_Param_Header(string url, Dictionary<string, string> dic, int timeout = 10000, NameValueCollection Headers = null)
{
string responseString = "";//post返回的结果
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, err) => { return true; };
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
if (dic.Count > 0) {
url += "?";
var paramstr = "";
foreach (var item in dic) {
if (paramstr != "") paramstr += "&";
paramstr += $"{item.Key}={item.Value}";
}
url+= paramstr;
}
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
req.Method = "GET";
req.Timeout = timeout;
if (Headers != null)
{
foreach (string key in Headers.Keys)
{
req.Headers.Add(key, Headers[key]);
}
}
req.ContentLength = 0;
var response = req.GetResponse();
Stream streamResponse = response.GetResponseStream();
StreamReader streamRead = new StreamReader(streamResponse);
responseString = streamRead.ReadToEnd();
response.Close();
streamRead.Close();
return responseString;
}
public static string DoPost(string url, string json, int timeout = 10000)
{
string responseString = "";//post返回的结果
@ -228,7 +272,6 @@ namespace DSWeb.Areas.MvcShipping.Comm
return responseString;
}
private static string GetResponseBody(HttpWebResponse response)
{
string responseBody = string.Empty;

@ -14,6 +14,10 @@ using Renci.SshNet.Common;
using DSWeb.MvcShipping.DAL.MsOpVgmSendDAL;
using DSWeb.MvcShipping.Models.MsOpVgmSend;
using DSWeb.MvcShipping.Models.MsOpPrice;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.Areas.Dispatch.DB;
using DSWeb.Common.DB;
using static DSWeb.MvcShipping.DAL.MsOpVgmSendDAL.MsOpVgmSendDAL;
namespace DSWeb.MvcShipping.Controllers
{
@ -65,7 +69,7 @@ namespace DSWeb.MvcShipping.Controllers
{
MsOpVgmSend head = null;
head = MsOpVgmSendDAL.GetData("BSNO='"+bsno+"'");
head = MsOpVgmSendDAL.GetData("BSNO='"+bsno+"'");
@ -75,7 +79,12 @@ namespace DSWeb.MvcShipping.Controllers
}
/// <summary>
/// 点击 发送VGM
/// </summary>
/// <param name="data"></param>
/// <param name="bodylist"></param>
/// <returns></returns>
public ContentResult SendVgm(string data,string bodylist)
{
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
@ -87,8 +96,7 @@ namespace DSWeb.MvcShipping.Controllers
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
var headData = JsonConvert.Deserialize<MsOpVgmSend>(data);
var MsOpVgmCtnList = JsonConvert.Deserialize<List<MsOpVgmCtn>>(bodylist);
var isPost = true;
var errorstr = "";
var result = new DBResult();
var oldheaddata= MsOpVgmSendDAL.GetData("BSNO='" + headData.BSNO + "'");
if (!string.IsNullOrEmpty(oldheaddata.BSNO))
{
@ -112,19 +120,24 @@ namespace DSWeb.MvcShipping.Controllers
string rq = T_ALL_DA.GetStrSQL("rq", "select getdate() as rq");
headData.SENDERUSER = Convert.ToString(Session["USERID"]);//创建人
headData.SENDTIME = DateTime.Parse(rq);//创建时间
headData.VGMSTATUS = "未发送";
headData.SENDTIME = DateTime.Parse(rq);//创建时间
headData.VGMSTATUS = "未发送";
headData.CTNNUM = MsOpVgmCtnList.Count;
//if (headData.CTNNUM == null) { headData.CTNNUM = 0; }
result.OK();
if (headData.CTNNUM == null) { headData.CTNNUM = 0; }
//if (headData.CTNNUM == 0) {
// result.SetErrorInfo("必须有至少一条集装箱信息");
//}
if (isPost)
if (result.Success)
{
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
result = modb.Save(headData);
if (result.Success) {
MsOpVgmSendDAL.SaveDetail(headData.GID, MsOpVgmCtnList);
@ -132,19 +145,30 @@ namespace DSWeb.MvcShipping.Controllers
var BSNO = headData.BSNO;
//20240830 发送vgm报文
var _r = MsOpVgmSendDAL.SendDjyVgm(headData, MsOpVgmCtnList);
var jsonRespose = new JsonResponse
if (_r.Success)
{
Success = result.Success,
Message = result.Message,
Data = MsOpVgmSendDAL.GetData("BSNO='" + BSNO + "'")
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
//记录日志
var cdc = new DSWeb.Common.DB.CommonDataContext();
var newrec = new op_seae_vgm_history_md();
newrec.BSNO = headData.BSNO;
newrec.SENDERUSER = headData.SENDERUSER;
newrec.SENDTIME = headData.SENDTIME;
newrec.CTNNUM = headData.CTNNUM;
newrec.REMARK = headData.REMARK;
newrec.SENDTYPE = headData.SENDTYPE;
cdc.op_seae_vgm_history.Add(newrec);
cdc.SaveChanges();
}
return BasicDataRefDAL.GetContentResult(_r);
}
else {
var jsonRespose = new JsonResponse { Success = false, Message =errorstr };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
return BasicDataRefDAL.GetContentResult(result);
}
}
@ -159,10 +183,60 @@ namespace DSWeb.MvcShipping.Controllers
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetVgmHistoryList(string condition)
{
var dataList = MsOpVgmSendDAL.GetVgmHistoryList(condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
/// <summary>
/// 获取回执状态历史记录
/// </summary>
/// <param name="condition"></param>
/// <returns></returns>
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetStatusList_CARRIER(string condition)
{
var dataList = MsOpVgmSendDAL.GetStatusList(condition,"CARRIER");
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetStatusList_YGT(string condition)
{
var dataList = MsOpVgmSendDAL.GetStatusList(condition,"YGT");
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetStatusList_YARD(string condition)
{
var dataList = MsOpVgmSendDAL.GetStatusList(condition,"YARD");
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetVgmLink(string BSNO,string sendCarr,string sendYGT)
{
var result = new DBResult();
getlinkparam sendparam = new getlinkparam();
sendparam.mfno = BSNO;
sendparam.sendCarr = (sendCarr.ToUpper()=="TRUE");
sendparam.sendYGT = (sendYGT.ToUpper() == "TRUE");
result = MsOpVgmSendDAL.GetDjyVgmLink(sendparam);
return BasicDataRefDAL.GetContentResult(result);
}
}

@ -10,6 +10,17 @@ using DSWeb.Areas.CommMng.Models;
using HcUtility.Comm;
using DSWeb.MvcShipping.Models.MsOpPrice;
using DSWeb.MvcContainer.Models.MsOpCtnr;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.MvcShipping.Models.MsChFee;
using DSWeb.MvcShipping.DAL.MsSysParamSet;
using DSWeb.MvcShipping.Helper;
using DSWeb.Areas.MvcShipping.Comm;
using System.Collections.Specialized;
using DSWeb.Common.DB;
using System.Linq;
using DSWeb.Areas.MvcShipping.Models.Message.VGM;
using HcUtility.Core;
using System.Data.Entity.Migrations;
namespace DSWeb.MvcShipping.DAL.MsOpVgmSendDAL
{
@ -88,7 +99,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpVgmSendDAL
{
strSql += " where " + condition;
}
var list=SetData(strSql);
var list = SetData(strSql);
if (list.Count > 0)
{
return list[0];
@ -121,6 +132,8 @@ namespace DSWeb.MvcShipping.DAL.MsOpVgmSendDAL
data.VOYNO = Convert.ToString(reader["VOYNO"]);
data.CARRIERSTATUS = Convert.ToString(reader["CARRIERSTATUS"]);
data.YGTSTATUS = Convert.ToString(reader["YGTSTATUS"]);
data.YARDSTATUS = Convert.ToString(reader["YARDSTATUS"]);
data.VGM_TIME = Convert.ToString(reader["VGM_TIME"]);
data.SENDERUSER = Convert.ToString(reader["SENDERUSER"]);
data.SENDERUSERREF = Convert.ToString(reader["SENDERUSERREF"]);
@ -134,7 +147,9 @@ namespace DSWeb.MvcShipping.DAL.MsOpVgmSendDAL
if (reader["SENDTIME"] != DBNull.Value)
data.SENDTIME = Convert.ToDateTime(reader["SENDTIME"]);
data.REMARK = Convert.ToString(reader["REMARK"]);
data.LINKURL = Convert.ToString(reader["LINKURL"]);
#endregion
headList.Add(data);
@ -211,25 +226,6 @@ namespace DSWeb.MvcShipping.DAL.MsOpVgmSendDAL
}
static public string GetCustEDICode(string CUST, string EDINAME)
{
string EDICODE = "";
CUST = CUST.Replace("'", "''");
var strSql = new StringBuilder();
strSql.Append("select EDICODE from code_cust_edi where CUST='" + CUST + "' AND EDINAME='" + EDINAME + "'");
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
EDICODE = Convert.ToString(reader["EDICODE"]).Trim();
}
reader.Close();
}
return EDICODE;
}
public static DBResult SaveDetail(string LE_ID, List<MsOpVgmCtn> bodyList)
{
@ -275,20 +271,40 @@ namespace DSWeb.MvcShipping.DAL.MsOpVgmSendDAL
public static DsVgm CreateDjyVgm(MsOpVgmSend headData, List<MsOpVgmCtn> bodyList)
{
var OpSeaehead = MsOpSeaeDAL.MsOpSeaeDAL.GetData("BSNO='" + headData.BSNO + "'");
var DsVgm = new DsVgm();
DsVgm.mfno = headData.BSNO;
DsVgm.mblno = headData.MBLNO;
DsVgm.carrier = BasicDataRefDAL.GetCustEdiCodeByName(OpSeaehead.CARRIER, "DJY");
//DsVgm.carrier = headData.CARRIER;
DsVgm.etd = OpSeaehead.ETD;
DsVgm.weiTuoFaSongFang = BasicDataRefDAL.GetCustEdiCodeByName(OpSeaehead.CUSTOMERNAME, "DJY");
DsVgm.chuanMing = headData.CARRIER;
DsVgm.vsid = OpSeaehead.VESSELID;
DsVgm.hangCi = headData.VOYNO;
DsVgm.beiZhu = headData.REMARK;
var = OpSeaehead.PORTLOAD;
var = OpSeaehead.PORTLOADID;
BasicDataRefDAL.GetPORTInfoByEDICODEAndEDIName("DJY", OpSeaehead.PORTLOADID, OpSeaehead.PORTLOAD, ref , ref );
DsVgm.zhuangHuoGang = ;
DsVgm.zhuangHuoGangDaiMa = ;
DsVgm.yard = BasicDataRefDAL.GetCustEdiCodeByName(OpSeaehead.YARD, "DJY");
DsVgm.orderno = headData.ORDERNO;
//DsVgm.yard = GetCustEDICode(headData.ya, "DJY");
DsVgm.carrier = headData.CARRIER;
DsVgm.mfno = headData.BSNO;
DsVgm.mfno = headData.BSNO;
DsVgm.mfno = headData.BSNO;
DsVgm.mfno = headData.BSNO;
DsVgm.mfno = headData.BSNO;
DsVgm.mfno = headData.BSNO;
DsVgm.mfno = headData.BSNO;
DsVgm.vgmclosetime = headData.VGM_TIME;
DsVgm.wharf = headData.MATOU;
var cntrlist = new List<Ctn>();
foreach (var ctn in bodyList)
@ -308,13 +324,163 @@ namespace DSWeb.MvcShipping.DAL.MsOpVgmSendDAL
}
DsVgm.ctnList = cntrlist;
DsVgm.sendType = Convert.ToInt32(headData.SENDTYPE);
DsVgm.sendCarr = headData.ISCARRIER;
DsVgm.sendYGT = headData.ISYGT;
return DsVgm;
}
static public List<op_seae_vgm_history_md> GetVgmHistoryList(string BSNO)
{
var result = new List<op_seae_vgm_history_md>();
var cdc = new CommonDataContext();
result = cdc.op_seae_vgm_history
.Where(x => x.BSNO == BSNO)
.OrderByDescending(o=>o.SENDTIME).ToList();
if (result != null && result.Count > 0) {
var useridlist= result.Select(x => x.SENDERUSER).Distinct().ToList();
var userlist = cdc.VW_user.Where(x => useridlist.Contains(x.USERID)).ToList();
foreach (var item in result) {
item.SENDERNAME = userlist.FirstOrDefault(x => x.USERID == item.SENDERUSER).SHOWNAME;
}
}
return result;
}
#endregion
static public List<op_seae_vgm_state_md> GetStatusList(string BSNO,string type)
{
var result = new List<op_seae_vgm_state_md>();
var cdc = new CommonDataContext();
result = cdc.op_seae_vgm_state
.Where(x => x.mfno==BSNO&& x.Type==type)
.OrderByDescending(o => o.statustime).ToList();
return result;
}
#region 发送vgm至大简云
public static DBResult SendDjyVgm(MsOpVgmSend headData, List<MsOpVgmCtn> bodyList)
{
var result = new DBResult();
result.OK();
var DsVgmUrl = MsSysParamSetDAL.GetData("PARAMNAME='DJYVGM2024URL'").PARAMVALUE;
var headers = new NameValueCollection();
var key= MsSysParamSetDAL.GetData("PARAMNAME='DJYVGM2024_Key'").PARAMVALUE;
var secret = MsSysParamSetDAL.GetData("PARAMNAME='DJYVGM2024_Secret'").PARAMVALUE;
headers["USER_KEY"] = key;
headers["USER_SECRET"] = secret;
var sendinfo = CreateDjyVgm(headData, bodyList);
BasicDataRefDAL.SaveLog(JsonConvert.Serialize(DsVgmUrl) + "////" + key +"////"+ secret + "////"+JsonConvert.Serialize(sendinfo), "", "DJYVGM2024", "发送");
var rtn = WebRequestHelper.DoPost_JSON_Header(DsVgmUrl, JsonConvert.Serialize(sendinfo), 10000,headers);
BasicDataRefDAL.SaveLog(rtn, "", "DJYVGM2024", "返回");
return result;
}
#endregion
#region 从大简云获取VGM链接
public class getlinkparam {
public string mfno { get; set; }
public bool sendCarr { get; set; } = false;
public bool sendYGT { get; set; } = false;
}
public static DBResult GetDjyVgmLink(getlinkparam sendparam)
{
var result = new DBResult();
result.OK();
var cdc = new CommonDataContext();
var _head = cdc.op_seae_vgm_send.Where(p => p.BSNO == sendparam.mfno).FirstOrDefault();
//var head = MsOpVgmSendDAL.GetData("BSNO='" + sendparam.mfno + "'");
if (!string.IsNullOrWhiteSpace(_head.LINKURL))
{
result.Data = _head.LINKURL;
return result;
}
else {
var DsVgmUrl = MsSysParamSetDAL.GetData("PARAMNAME='DJYVGM2024GetUrl'").PARAMVALUE;
var headers = new NameValueCollection();
var key = MsSysParamSetDAL.GetData("PARAMNAME='DJYVGM2024_GetUrl_Key'").PARAMVALUE;
var secret = MsSysParamSetDAL.GetData("PARAMNAME='DJYVGM2024_GetUrl_Secret'").PARAMVALUE;
//测试数据
//sendparam.mfno = "585399286181957";
headers["USER_KEY"] = key;// MsSysParamSetDAL.GetData("PARAMNAME='DJYVGM2024_GetUrl_Key'").PARAMVALUE;
headers["USER_SECRET"] = secret;// MsSysParamSetDAL.GetData("PARAMNAME='DJYVGM2024_GetUrl_Secret'").PARAMVALUE;
var sendstr= JsonConvert.Serialize(sendparam);
var dic = new Dictionary<string, string>
{
{ "mfno", sendparam.mfno },
{ "sendCarr", sendparam.sendCarr.ToString().ToLower() },
{ "sendYGT", sendparam.sendYGT.ToString().ToLower() }
};
BasicDataRefDAL.SaveLog(JsonConvert.Serialize(DsVgmUrl) + "////" + key +"//"+ secret + "////" + JsonConvert.Serialize(sendstr), "", "DJYVGM2024GetUrl", "发送");
var rtn = WebRequestHelper.DoGet_Param_Header(DsVgmUrl, dic, 10000, headers);
BasicDataRefDAL.SaveLog(rtn, "", "DJYVGM2024GetUrl", "返回");
vgmResult rp = JsonConvert.Deserialize<vgmResult>(rtn);
if (rp.statusCode == 200)
{
_head.LINKURL = BasicDataRefDAL.Unicode2String(rp.data);
_head.ISCARRIER = sendparam.sendCarr;
_head.ISYGT = sendparam.sendYGT;
cdc.op_seae_vgm_send.AddOrUpdate(_head);
cdc.SaveChangesAsync();
result.OK("获取成功");
result.Data = _head.LINKURL;
}
else {
result.SetErrorInfo(BasicDataRefDAL.Unicode2String(rp.errors));
}
}
return result;
}
#endregion
#region 判断编码是否有重复
static public int GetRdCount(string strCondition)

@ -60,6 +60,9 @@ namespace DSWeb.MvcShipping.Models.MsOpVgmSend
[ModelDB(MDBType = ModelDBOprationType.Insert)]
public string YGTSTATUS { get; set; }
[ModelDB(MDBType = ModelDBOprationType.Insert)]
public string YARDSTATUS { get; set; }
[ModelDB]
public int CTNNUM { get; set; }
@ -87,6 +90,18 @@ namespace DSWeb.MvcShipping.Models.MsOpVgmSend
set { _createtime = value; }
}
/// <summary>
/// 备注
/// </summary>
[ModelDB]
public string REMARK { get; set; }
/// <summary>
/// 链接地址
/// </summary>
[ModelDB]
public string LINKURL { get; set; }
#endregion
public MsOpVgmSend()

@ -2050,7 +2050,7 @@ Ext.extend(Shipping.MsOpSeaeEdit, Ext.Panel, {
},
scope: this
}, '-', {
text: 'VGM', //'引入场站数据',
text: 'VGM', //'打开vgm窗口',
handler: function (button, event) {
_this.onCreateDSVGMClick(button, event);
},

@ -72,7 +72,7 @@ Ext.extend(Shipping.MsOpVgmSendEdit, Ext.Panel, {
fieldLabel:'码头',
flex: 2,
store: this.storeMATOU,
name: 'PKGTYPE',
name: 'MATOU',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
@ -138,7 +138,7 @@ Ext.extend(Shipping.MsOpVgmSendEdit, Ext.Panel, {
valueField: 'NAME',
displayField: 'NAME'
});
_thissendVgm = this;
_this = this;
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
@ -244,7 +244,7 @@ Ext.extend(Shipping.MsOpVgmSendEdit, Ext.Panel, {
this.panelBodyCtn = new Ext.Panel({
layout: "border",
height: 150,
height: 180,
//margin: '5 10',
frame: true,
items: [this.gridList]
@ -265,13 +265,14 @@ Ext.extend(Shipping.MsOpVgmSendEdit, Ext.Panel, {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
labelWidth: 60,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
//xtype: 'fieldset',
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
@ -284,7 +285,7 @@ Ext.extend(Shipping.MsOpVgmSendEdit, Ext.Panel, {
items: [ {
fieldLabel: 'VGM申报',
readOnly: true,
disabled: true,
hidden: true,
name: 'VGMSTATUS'
}, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }]
}, {
@ -319,7 +320,7 @@ Ext.extend(Shipping.MsOpVgmSendEdit, Ext.Panel, {
fieldLabel: '订舱编号',
name: 'ORDERNO'
}, {
fieldLabel: '截日期',
fieldLabel: '截日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
@ -329,7 +330,8 @@ Ext.extend(Shipping.MsOpVgmSendEdit, Ext.Panel, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCARRIER, this.comboxLOADPORT, this.comboxMATOU]
items: [
this.comboxCARRIER, this.comboxLOADPORT, this.comboxMATOU]
}, {
xtype: 'container',
@ -340,20 +342,52 @@ Ext.extend(Shipping.MsOpVgmSendEdit, Ext.Panel, {
name: 'REMARK'
}]
}, this.panelBodyCtn, {
}, this.panelBodyCtn
, {
xtype: 'container',
layout: 'hbox',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '备注',
hideLabel:true,
name: 'CARRIERSTATUS'
}, {
fieldLabel: '备注',
hideLabel: true,
items: [
{
labelWidth: 90,
fieldLabel: '船公司状态',
//hideLabel:true,
name: 'CARRIERSTATUS',
readOnly:true,
listeners: {
scope: this,
focus: function () {
// 在这里编写你的点击事件逻辑
this.ShowHistory(this.bsno);
}
}
}, {
labelWidth: 90,
fieldLabel: '云港通状态',
//hideLabel: true,
name: 'YGTSTATUS'
}, { xtype: 'hiddenfield' }]
}, {
labelWidth: 90,
fieldLabel: '场站状态',
//hideLabel: true,
name: 'YARDSTATUS'
}
]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '链接地址',
id: "LINKURL",
hidden:true,
html:"",
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
@ -374,11 +408,11 @@ Ext.extend(Shipping.MsOpVgmSendEdit, Ext.Panel, {
}, {
text: "发送历史",
handler: function (button, event) {
this.ShowHistory(this.bsno);
},
scope: this
}, '-', {
text: "发送",
}, '-', {
text: "发送/获取链接",
handler: function (button, event) {
this.winVGMShow.show();
},
@ -494,16 +528,22 @@ Ext.extend(Shipping.MsOpVgmSendEdit, Ext.Panel, {
handler: function () {
var cgFILEROLE = Ext.getCmp('vGMFILEROLE');
var FILEROLE = cgFILEROLE.getValue();
var ISCARRIER = _thissendVgm.formVGMShow.getForm().findField('ISCARRIER').getValue();
var ISYGT = _thissendVgm.formVGMShow.getForm().findField('ISYGT').getValue();
var ISCARRIER = _this.formVGMShow.getForm().findField('ISCARRIER').getValue();
var ISYGT = _this.formVGMShow.getForm().findField('ISYGT').getValue();
_thissendVgm.onSendVGM(ISCARRIER, ISYGT, FILEROLE.FILEROLE);
_this.onSendVGM(ISCARRIER, ISYGT, FILEROLE.FILEROLE);
}
}, {
text: "获取链接",
handler: function (button, event) {
_this.GetVgmLink();
},
scope: this
}, '-', {
text: "关闭", //"关闭",
minWidth: 70,
handler: function () {
_thissendVgm.winVGMShow.close();
_this.winVGMShow.close();
}
}]
});
@ -571,9 +611,17 @@ Ext.extend(Shipping.MsOpVgmSendEdit, Ext.Panel, {
var data = result.data;
this.formEdit.getForm().findField('VGMSTATUS').setValue(data.VGMSTATUS);
this.formEdit.getForm().findField('CARRIERSTATUS').setValue(data.CARRIERSTATUS);
this.formEdit.getForm().findField('YGTSTATUS').setValue(data.YGTSTATUS);
//this.formEdit.getForm().findField('CARRIERSTATUS').setValue(data.CARRIERSTATUS);
//this.formEdit.getForm().findField('YGTSTATUS').setValue(data.YGTSTATUS);
if (data.LINKURL) {
var url = `<a href="` + data.LINKURL + `" target="_blank">` + data.LINKURL +`</a>`;
Ext.getCmp("LINKURL").show();
Ext.getCmp("LINKURL").getEl().dom.innerHTML = url;
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
@ -624,8 +672,8 @@ Ext.extend(Shipping.MsOpVgmSendEdit, Ext.Panel, {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
_thissendVgm.formEdit.getForm().setValues(returnData);
_thissendVgm.winVGMShow.close();
_this.formEdit.getForm().setValues(returnData);
_this.winVGMShow.close();
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
@ -639,8 +687,158 @@ Ext.extend(Shipping.MsOpVgmSendEdit, Ext.Panel, {
});
} //end save
, ShowHistory: function (BSNO) {
//var customername = this.formHead.getForm().findField('CUSTOMERNAME').getValue();
title = "历史记录";
model = Ext.define('op_seae_vgm_history_md', {
extend: 'Ext.data.Model',
idProperty: 'ID',
fields: [
{ name: 'ID', type: 'string' },
{ name: 'BSNO', type: 'string' },
{ name: 'SENDTYPE', type: 'string' },
{ name: 'SENDERNAME', type: 'string' },
{ name: 'SENDTIME', type: 'date', dateFormat: 'Y-m-d H:i:s' },
{ name: 'CTNNUM', type: 'number' },
{ name: 'REMARK', type: 'string' }
]
});
proxyUrl = '/MvcShipping/MsOpVgmSend/GetVgmHistoryList';
condition = BSNO;
columns = [
{
sortable: true,
dataIndex: 'SENDTYPE',
header: '业务操作',
width: 90,
renderer: function (value, meta) {
if (value == '9') {
return "新增";
} else if (value == '5') {
return "修改";
} else if (value == '4') {
return "删除";
} else {
return ""
}
}
}, {
sortable: true,
dataIndex: 'SENDERNAME',
header: '发送人',
width: 90
}, {
sortable: true,
dataIndex: 'SENDTIME',
header: '发送时间',
width: 120,
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s')
}, {
sortable: true,
dataIndex: 'CTNNUM',
header: '箱数',
width: 90
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 140
}
];
ShowPublicINFO(title, model, proxyUrl, condition, columns, 500);
}
, GetVgmLink: function () {
var ISCARRIER = this.formVGMShow.getForm().findField('ISCARRIER').getValue();
var ISYGT = this.formVGMShow.getForm().findField('ISYGT').getValue();
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpVgmSend/GetVgmLink',
scope: this,
params: {
BSNO: this.bsno,
sendCarr: ISCARRIER,
sendYGT: ISYGT
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
//_this.sendVgm.formEdit.getForm().setValues(returnData);
_this.winVGMShow.close();
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
_this.winVGMShow.close();
_this.LoadData(_this.bsno);
}
} else {
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
} //end save
, ShowStatus: function (BSNO,type) {
//var customername = this.formHead.getForm().findField('CUSTOMERNAME').getValue();
title = "历史记录";
model = Ext.define('op_seae_vgm_history_md', {
extend: 'Ext.data.Model',
idProperty: 'GID',
fields: [
{ name: 'GID', type: 'string' },
{ name: 'StatusText', type: 'string' },
{ name: 'StatusTime', type: 'date', dateFormat: 'Y-m-d H:i:s' },
{ name: 'CNTRNO', type: 'string' },
{ name: 'Tips', type: 'string' }
]
});
proxyUrl = '/MvcShipping/MsOpVgmSend/GetStatusList'+"_"+type;
condition = BSNO;
columns = [
{
sortable: true,
dataIndex: 'StatusText',
header: '状态信息',
width: 140
}, {
sortable: true,
dataIndex: 'StatusTime',
header: '状态时间',
width: 120,
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s')
}, {
sortable: true,
dataIndex: 'CNTRNO',
header: '箱号',
width: 90
}, {
sortable: true,
dataIndex: 'Tips',
header: 'Tips',
width: 200
}
];
ShowPublicINFO(title, model, proxyUrl, condition, columns, 500);
}
});

@ -142,6 +142,15 @@ namespace DSWeb
}
}
var ReceiveVGMReceipt = ConfigurationManager.AppSettings["ReceiveVGMReceipt"];
if (ReceiveVGMReceipt != null && ReceiveVGMReceipt.ToString().ToUpper() == "TRUE")
{
DoReceiveDjyVGMReceipt();
}
InitMapper();
JobScheduler.Start();
@ -461,5 +470,76 @@ namespace DSWeb
}
#endregion
#region 接收大简云vgm回执状态回推消息队列
private void DoReceiveDjyVGMReceipt()
{
var RecMqUri = ConfigurationManager.AppSettings["VGMMQUrl"];
var = true;
ConnectionFactory factory = new ConnectionFactory();
factory.Uri = RecMqUri;
mqConn = factory.CreateConnection();
IModel modelDingCang = mqConn.CreateModel();
//if (!string.IsNullOrWhiteSpace(ExchangeName))
// modelDingCang.ExchangeDeclare(ExchangeName, ExchangeType.Direct);
var QueuePrefix = ConfigurationManager.AppSettings["QueuePrefix_VGMReceipt"];
var Companyid = ConfigurationManager.AppSettings["DjydcCompanyid"];
modelDingCang.QueueDeclare($"{QueuePrefix}{Companyid}", false, false, false, null);
var consumer = new EventingBasicConsumer(modelDingCang);
consumer.Received += (ch, ea) =>
{
var body = ea.Body;
try
{
////不压缩
//var strBody = Encoding.UTF8.GetString(body.ToArray());
////压缩
//var strBodyZip = Encoding.UTF8.GetString(body.ToArray());
//logger.Debug($"收到大简云订舱输出压缩数据:{strBodyZip}");
//LoggerHelper loggerHelper = new LoggerHelper("接收大简云订舱");
//SaveLog(strBodyZip, "", "接收大简云订舱", "压缩内容");
//var strBody = Areas.CommMng.DAL.BasicDataRefDAL.Decompress(strBodyZip);
var strBody = Encoding.UTF8.GetString(body.ToArray());
SaveLog(strBody, "", "接收VGM回执", "解压内容");
//测试数据不需解压缩
//var strBody = strBodyZip;
//logger.Debug($"收到大简云订舱输出数据:{strBody}");
//导出到东胜6
//if(strBody.Contains("TAHT30633700"))
DSWeb.Areas.CommMng.DAL.DJYVGMReceipt_MqWorkDAL.ReceiveDjyVGMReceipt(strBody);
}
catch (Exception ex)
{
var excep = ex;
while (excep != null)
{
//logger.Error(excep.Message);
//logger.Error(excep.StackTrace);
excep = excep.InnerException;
}
}
};
//第二个参数控制【是否消费掉队列里的数据】
modelDingCang.BasicConsume($"{QueuePrefix}{Companyid}", , consumer);
}
#endregion
}
}
Loading…
Cancel
Save