Compare commits

..

2 Commits

@ -45,6 +45,11 @@ namespace DSWeb.MvcShipping.Controllers
return View();
}
public ActionResult ENSEdit()
{
return View();
}
public ActionResult CustomIndex()
{
return View();

@ -20386,15 +20386,15 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
{
if (bill.HSCODE == null || bill.HSCODE == "")
{ error = error + "<br />HSCODE不能为空"; }
if (!string.IsNullOrEmpty(bill.MBLNO)) {
if (bill.MBLNO.Length > 10) {
//if (!string.IsNullOrEmpty(bill.MBLNO)) {
// if (bill.MBLNO.Length > 10) {
error = error + "<br />主提单号不允许超过10位";
// error = error + "<br />主提单号不允许超过10位";
}
// }
}
//}
T_ALL_DA T_ALL_DA = new T_ALL_DA();
DataSet dsUserOp = T_ALL_DA.GetAllSQL("select top 1 * from [user] as u INNER JOIN user_baseinfo as b on u.GID=b.USERID where u.GID='" + userid + "'");
var sendno = dsUserOp.Tables[0].Rows[0]["EMAIL1"].ToString().Trim();

@ -84,6 +84,9 @@ namespace DSWeb.Areas.MvcShipping.DAL.MsOpSeaeEdiTemplate
data.CODE = reader["CODE"].ToString();
data.TEL = reader["TEL"].ToString();
data.POSTCODE = reader["POSTCODE"].ToString();
data.HOUSENO = reader["HOUSENO"].ToString();
data.EORI = reader["EORI"].ToString();
data.CORPTYPE = reader["CORPTYPE"].ToString();
data.ATTN = reader["ATTN"].ToString();
data.CreateTime = reader["CreateTime"].ToString();
data.DisplayName = data.TEMPLATENAME + "-" + data.NAME;
@ -162,6 +165,9 @@ namespace DSWeb.Areas.MvcShipping.DAL.MsOpSeaeEdiTemplate
sbIns.Append("PROVINCE,");
sbIns.Append("CODETYPE,");
sbIns.Append("CODE,");
sbIns.Append("HOUSENO,");
sbIns.Append("EORI,");
sbIns.Append("CORPTYPE,");
sbIns.Append("POSTCODE,");
sbIns.Append("ATTN,");
sbIns.Append("TEL");
@ -181,6 +187,9 @@ namespace DSWeb.Areas.MvcShipping.DAL.MsOpSeaeEdiTemplate
sbIns.Append("'" + et.PROVINCE + "',");
sbIns.Append("'" + et.CODETYPE + "',");
sbIns.Append("'" + et.CODE + "',");
sbIns.Append("'" + et.HOUSENO + "',");
sbIns.Append("'" + et.EORI + "',");
sbIns.Append("'" + et.CORPTYPE + "',");
sbIns.Append("'" + et.POSTCODE + "',");
sbIns.Append("'" + et.ATTN + "',");
sbIns.Append("'" + et.TEL + "'");
@ -221,6 +230,9 @@ namespace DSWeb.Areas.MvcShipping.DAL.MsOpSeaeEdiTemplate
sbUpd.Append("PROVINCE='" + et.PROVINCE + "',");
sbUpd.Append("CODETYPE= '" + et.CODETYPE + "',");
sbUpd.Append("CODE= '" + et.CODE + "',");
sbUpd.Append("HOUSENO='" + et.HOUSENO + "',");
sbUpd.Append("EORI='" + et.EORI + "',");
sbUpd.Append("CORPTYPE='" + et.CORPTYPE + "',");
sbUpd.Append("POSTCODE='" + et.POSTCODE + "',");
sbUpd.Append("ATTN='" + et.ATTN + "',");
sbUpd.Append("TEL= '" + et.TEL + "'");

@ -37,6 +37,9 @@ namespace DSWeb.Areas.MvcShipping.Models.MsOpSeaeEdiTemplate
public string TEL { get; set; }
public string POSTCODE { get; set; }
public string HOUSENO { get; set; }
public string EORI { get; set; }
public string CORPTYPE { get; set; }
public string ATTN { get; set; }
public string CreateTime { get; set; }
public string DisplayName { get; set; }

@ -0,0 +1,60 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/MvcShipping/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript">
var GID;
function getSessgion1() {
GID = '<%= Session["USERID"] %>';
}
getSessgion1();
var usercode;
function getSessgion2() {
usercode = '<%= Session["CODENAME"] %>';
}
getSessgion2();
var SHOWNAME;
function getSessgion3() {
SHOWNAME = '<%= Session["SHOWNAME"] %>';
}
getSessgion3();
var COMPANYID;
function getSessgion4() {
COMPANYID = '<%=Session["COMPANYID"] %>';
}
getSessgion4();
var DEPTNAME;
function getSessgion5() {
DEPTNAME = '<%= Session["DEPTNAME"] %>';
}
getSessgion5();
</script>
<%--<script type="text/javascript" src="../../../../Views/../TruckMng/Scripts/ExtjsEx/datetime/DateTimePicker.js"></script>
<script type="text/javascript" src="../../../../Views/../TruckMng/Scripts/ExtjsEx/datetime/DateTime.js"></script>--%>
<script type="text/javascript" src="../../../../Areas/MvcShipping/Viewsjs/Comm/TimePickerField.js"></script>
<script type="text/javascript" src="../../../../Areas/MvcShipping/Viewsjs/Comm/DateTimePicker.js"></script>
<script type="text/javascript" src="../../../../Areas/MvcShipping/Viewsjs/Comm/DateTimeField.js"></script>
<script type="text/javascript" src="../../../../Areas/MvcShipping/Viewsjs/Comm/DateTimeMenu.js"></script>
<script type="text/javascript" src="../../../../Areas/MvcShipping/Viewsjs/Comm/MonthField.js"></script>
<script type="text/javascript" src="../../../../Areas/MvcShipping/Viewsjs/MsOpSeaeEdi/MsOpSeaeEdiModel.js"></script>
<script type="text/javascript" src="../../../../Areas/MvcShipping/Viewsjs/MsOpSeaeEdi/MsOpSeaeENSEdit.js"></script>
<script type="text/javascript" src="../../../../Areas/MvcShipping/Viewsjs/MsOpSeaeEdi/ENSEdit.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
<div id="viewport" ></div>
</asp:Content>

@ -0,0 +1,22 @@

Ext.BLANK_IMAGE_URL = '../../TruckMng/Content/Images/s.gif';
var panelEdit = null;
Ext.onReady(function () {
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';
panelEdit = Ext.create('Shipping.MsOpSeaeENSEdit', {
id:'OpSeaeEdiEdit',
layout: 'border',
region: 'center' });
var view = new Ext.Viewport({
layout: 'border',
renderTo: 'viewport',
border: false,
items: [
panelEdit
]
});
});

@ -243,7 +243,7 @@ Ext.extend(Shipping.MsOpSeaeEdiIndex, Ext.Panel, {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/MvcShipping/MsOpSeaeEdi/ENSEdit');
DsOpenEditWin('/MvcShipping/MsOpSeaeEdi/Edit');
// window.open('/MvcShipping/MsOpSubSeaOrder/Edit', "ORDER EDIT", 'width=1200,height=' + (window.screen.availHeight - 55) + ',top=0,left=0,resizable=yes,status=yes,menubar=no,scrollbars=yes');
}, this);

@ -435,6 +435,24 @@ namespace DSWeb.Areas.TruckMng.Controllers
}
}
public ContentResult IsSaveHYRD(string GID,string MBLNO)
{
var ct = MsRptPcHeadEditDAL.GetRdCount("Gid<>'" + GID + "' AND PGID='" + GID + "' and MblNoSe<>'" + MBLNO + "' ");
if (ct != 0)
{
var jsonRespose = new JsonResponse { Success = false, Message = "存在分单,并且主提单号不一致!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else
{
var jsonRespose = new JsonResponse { Success = true };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
public ContentResult SaveHYRD(string opstatus, string data, string ctnbody,
string fixbody, string fixdelbody,string createpc="0")
{
@ -532,6 +550,18 @@ namespace DSWeb.Areas.TruckMng.Controllers
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
if (headData.BLTYPE != "派车主票")
{
var ct = MsRptPcHeadEditDAL.GetRdCount("Gid<>'" + headData.gId + "' and PGID='" + headData.gId + "' ");
if (ct != 0)
{
isPost = false;
var jsonRespose = new JsonResponse { Success = false, Message = "存在分单,装运方式必须为派车主票,不允许保存!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
}
else
{

@ -2386,18 +2386,18 @@ Ext.extend(DsTruck.MsPcHYRDEdit, Ext.Panel, {
//#endregion
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
/* basicForm.findField('BillNo').setDisabled(false);*/
/* basicForm.findField('BillNo').setDisabled(false);*/
var data = basicForm.getValues();
/* basicForm.findField('BillNo').setDisabled(true);*/
/* basicForm.findField('BillNo').setDisabled(true);*/
var bodyctndatas = [];
//for (var i = 0; i < this.storeCtnList.getCount(); i += 1) {
// var member = this.storeCtnList.getAt(i);
@ -2425,7 +2425,7 @@ Ext.extend(DsTruck.MsPcHYRDEdit, Ext.Panel, {
data: Ext.JSON.encode(data),
fixbody: jsonFixBody,
fixdelbody: jsonFixDelBody,
ctnbody:jsonCtnBody
ctnbody: jsonCtnBody
},
callback: function (options, success, response) {
if (success) {
@ -2457,7 +2457,7 @@ Ext.extend(DsTruck.MsPcHYRDEdit, Ext.Panel, {
}
if (type == '0') {
this.opStatus = 'edit';
/* basicForm.findField('BillNo').setDisabled(true);*/
/* basicForm.findField('BillNo').setDisabled(true);*/
//for (var i = 0; i < this.storeBodyFix.getCount(); i += 1) {
// var member = this.storeBodyFix.getAt(i);
@ -2476,6 +2476,9 @@ Ext.extend(DsTruck.MsPcHYRDEdit, Ext.Panel, {
this.panelFee.StoreDateCurr.load({ params: { optype: "tMsWlPcHead", bsno: LE_ID } });
this.panelFee.StoreUnit.load({ params: { bsno: LE_ID, bstype: "tMsWlPcHead" } });
this.storeBodyFix.load({ params: { billno: LE_ID } });
if (jsonresult.Message != '保存成功')
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
} else if (type == '1') {
window.close();
@ -2486,7 +2489,8 @@ Ext.extend(DsTruck.MsPcHYRDEdit, Ext.Panel, {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
@ -2494,13 +2498,10 @@ Ext.extend(DsTruck.MsPcHYRDEdit, Ext.Panel, {
}
});
_thisPc.panelFee.onPostDetailClick(null,null,3);
_thisPc.panelFee.onPostDetailClick(null, null, 3);
}, //end save
getCustName: function () {
var custName = this.formEdit.getForm().findField('CustName');
return custName.getValue();

@ -1677,8 +1677,8 @@ Ext.extend(DsTruck.MsWlPcEdit, Ext.Panel, {
// member.commit();
// };
let gid = this.editRecord.get('GId');
let billno = this.editRecord.get('BillNo')
this.storeBodyChFee.load({ params: { condition: "Bsno='" + gid + "' or Bsno='" + billno + "'" } });
this.storeBodyChFee.load({ params: { billno: gid } });
/* this.storeBodyChFee.load({ params: { condition: "Bsno='" + gid + "' or Bsno='" + billno + "'" } });*/
} else if (type == '1') {

@ -2495,6 +2495,8 @@
<Content Include="Areas\MvcShipping\Viewsjs\MsOpLetter\TruckLSEdit2.js" />
<Content Include="Areas\MvcShipping\Viewsjs\MsOpLetter\Zi_en-us.js" />
<Content Include="Areas\MvcShipping\Viewsjs\MsOpLetter\Zi_zh-cn.js" />
<Content Include="Areas\MvcShipping\Viewsjs\MsOpSeaeEdi\ENSEdit.js" />
<Content Include="Areas\MvcShipping\Viewsjs\MsOpSeaeEdi\MsOpSeaeENSEdit.js" />
<Content Include="Areas\MvcShipping\Viewsjs\MsOpSeai\MsOpSeae2SeaiCtnIndex.js" />
<Content Include="Areas\MvcShipping\Viewsjs\MsOpVgmSend\Edit.js" />
<Content Include="Areas\MvcShipping\Viewsjs\MsOpVgmSend\Index.js" />
@ -3688,6 +3690,7 @@
<Content Include="Areas\MvcShipping\Views\MsInfoClient\BlackIndex.aspx" />
<Content Include="Areas\MvcShipping\Views\MsOpLetter\HistryTruckIndex.aspx" />
<Content Include="Areas\MvcShipping\Views\MsOpLetter\TruckLSEdit2.aspx" />
<Content Include="Areas\MvcShipping\Views\MsOpSeaeEdi\ENSEdit.aspx" />
<Content Include="Areas\MvcShipping\Views\MsOpSeai\Seae2SeaiCtnIndex.aspx" />
<Content Include="Areas\MvcShipping\Views\MsOpVgmSend\Edit.aspx" />
<Content Include="Areas\MvcShipping\Views\MsOpVgmSend\Index.aspx" />

@ -84,6 +84,7 @@
<ItemGroup>
<Compile Include="DsSendMail.cs" />
<Compile Include="JobReceiveMail.cs" />
<Compile Include="JobSendArrivalNotice.cs" />
<Compile Include="JobSendCtn.cs" />
<Compile Include="JobSendBooking.cs" />
<Compile Include="MailReceiveRecordInfo.cs" />

@ -0,0 +1,195 @@
using log4net;
using Quartz;
using System;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
using MailKit.Net.Smtp;
using MimeKit;
using HtmlAgilityPack;
namespace JobSendAgentMail
{
public class JobSendArrivalNotice : IJob
{
private ILog log = LogManager.GetLogger(typeof(JobSendArrivalNotice));
public void Execute(IJobExecutionContext context)
{
string connStr = context.JobDetail.JobDataMap.GetString("ConnectString");
string querySql = context.JobDetail.JobDataMap.GetString("QuerySql");
string DocType = context.JobDetail.JobDataMap.GetString("DocType");
string D7FilePath = context.JobDetail.JobDataMap.GetString("D7FilePath");
string MAILSENDACCOUNT = context.JobDetail.JobDataMap.GetString("MAILSENDACCOUNT");
string MAILSENDPASSWORD = context.JobDetail.JobDataMap.GetString("MAILSENDPASSWORD");
string MAILSENDSERVICE = context.JobDetail.JobDataMap.GetString("MAILSENDSERVICE");
string MAILSENDPORT = context.JobDetail.JobDataMap.GetString("MAILSENDPORT");
string MAILISSSL = context.JobDetail.JobDataMap.GetString("MAILISSSL");
string MAILTEMPLATE = context.JobDetail.JobDataMap.GetString("MAILTEMPLATE");
string MAILTITLEJOB = context.JobDetail.JobDataMap.GetString("MAILTITLE");
log.Debug($"开始执行发送邮件");
using (SqlConnection dbcon = new SqlConnection(connStr))
{
SqlDataAdapter adapter = new SqlDataAdapter(querySql, dbcon);
DataTable table = new DataTable();
adapter.Fill(table);
if (table.Columns.Contains("EMAIL"))
{
if (table.Rows.Count > 0)
{
foreach (DataRow row in table.Rows)
{
if (row["EMAIL"].ToString() != "")
{
var htmlFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, MAILTEMPLATE);
var content = File.ReadAllText(htmlFile);
//var REMARKSTR = row["BLREMARK"].ToString();
//REMARKSTR = REMARKSTR.Replace("\r\n", "<br />");
//REMARKSTR = REMARKSTR.Replace("\n", "<br />");
//REMARKSTR = REMARKSTR.Replace("\r", "");
//content = content.Replace("$MBLNO$", row["MBLNO"].ToString());
//content = content.Replace("$ETD$", row["ETD"].ToString());
//content = content.Replace("$BLFRT$", row["BLFRT"].ToString());
//content = content.Replace("$PORTLOAD$", row["PORTLOAD"].ToString());
//content = content.Replace("$PORTDISCHARGE$", row["PORTDISCHARGE"].ToString());
//content = content.Replace("$DESTINATION$", row["DESTINATION"].ToString());
//content = content.Replace("$ATD$", row["ATD"].ToString());
//content = content.Replace("$HBLNO$", row["HBLNO"].ToString());
//content = content.Replace("$ORDERNO$", row["ORDERNO"].ToString());
//content = content.Replace("$ETA$", row["ETA"].ToString());
//content = content.Replace("$CNTRTOTAL$", row["CNTRTOTAL"].ToString());
//content = content.Replace("$CARRIERID$", row["CARRIERID"].ToString());
//content = content.Replace("$ISSUETYPE$", row["ISSUETYPE"].ToString());
//content = content.Replace("$BLREMARK$", REMARKSTR);
var MAILTITLE = MAILTITLEJOB;
MAILTITLE = MAILTITLE.Replace("$MBLNO$", row["MBLNO"].ToString());
MAILTITLE = MAILTITLE.Replace("$HBLNO$", row["HBLNO"].ToString());
MAILTITLE = MAILTITLE.Replace("$ETA$", row["ETA"].ToString());
MAILTITLE = MAILTITLE.Replace("$VESSEL$", row["VESSEL"].ToString());
MAILTITLE = MAILTITLE.Replace("$VOYNO$", row["VOYNO"].ToString());
StringWriter writer = new StringWriter();
HtmlDocument htmlDoc = new HtmlDocument();
htmlDoc.LoadHtml(content);
htmlDoc.Save(writer);
string str = writer.ToString();
try
{
var message = new MimeMessage();
message.From.Add(new MailboxAddress(row["OPNAME"].ToString(), row["OPEMAIL"].ToString()));
var maillist = row["EMAIL"].ToString().Split(';');
foreach (var mailaddr in maillist)
{
message.To.Add(MailboxAddress.Parse(mailaddr));
}
// message.To.Add(MailboxAddress.Parse(row["OPEMAIL"].ToString()));
// message.Subject = "Pre-alert/" + row["ORDERNO"].ToString() + "/" + row["HBLNO"].ToString();
message.Subject = MAILTITLE;
var html = new TextPart("html")
{
Text = str
};
MimeEntity entity = html;
//SendEmail se = new SendEmail(row["AGENTEMAIL"].ToString(), row["OPEMAIL"].ToString(), "", row["OPNAME"].ToString(), "Pre-alert/" + row["ORDERNO"].ToString() + "/" + row["HBLNO"].ToString(), str,true);
SqlDataAdapter fileadapter = new SqlDataAdapter("SELECT * FROM Receipt_Doc where RECEIPTTYPE='" + DocType + "' and BSNO='" + row["BSNO"].ToString() + "'", dbcon);
DataTable filetable = new DataTable();
fileadapter.Fill(filetable);
if (filetable.Rows.Count > 0)
{
var mult = new Multipart("mixed") { html };
foreach (DataRow filerow in filetable.Rows)
{
var attfile = filerow["Driect_URL"].ToString();
if (!string.IsNullOrEmpty(attfile))
{
attfile = attfile.Replace("../../", D7FilePath);
while ((attfile.IndexOf("/") >= 0))
{
attfile = attfile.Replace("/", @"\");
}
if (File.Exists(attfile))
{
var tmpDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "temp");
if (!Directory.Exists(tmpDir))
{
Directory.CreateDirectory(tmpDir);
}
var tmpFile = Path.Combine(tmpDir, filerow["URL"].ToString());
File.Copy(attfile, tmpFile, true);
var attPart = new MimePart();
attPart.Content = new MimeContent(new FileStream(attfile, FileMode.Open));
attPart.ContentDisposition = new ContentDisposition(ContentDisposition.Attachment);
attPart.FileName = filerow["URL"].ToString();
mult.Add(attPart);
//se.Attachments(attfile);
}
else
{
log.Debug($"附件文件:{attfile}不存在");
// logger.Error($"邮件{sendMail.GID}的附件文件{att.FilePath}不存在");
}
}
}
entity = mult;
}
//se.SetSmtp(MAILSENDACCOUNT, MAILSENDPASSWORD, MAILSENDSERVICE, Convert.ToInt16(MAILSENDPORT), Convert.ToBoolean(MAILISSSL), System.Net.Mail.MailPriority.Normal); //必须在所有参数设置完后调用此方法
message.Body = entity;
using (var client = new SmtpClient())
{
client.Connect(MAILSENDSERVICE, Convert.ToInt16(MAILSENDPORT), Convert.ToBoolean(MAILISSSL));
client.Authenticate(MAILSENDACCOUNT, MAILSENDPASSWORD);
client.Send(message);
client.Disconnect(true);
}
log.Debug($"邮件发送成功");
}
catch (Exception ex)
{
log.Debug($"邮件发送失败:错误信息{ex.Message}");
}
}
else {
log.Debug($"资料不全:{row["BSNO"].ToString()}");
}
}
}
else
{
log.Debug($"未查询到数据SQL语句{querySql}");
}
}
else
{
log.Error($"未包含所需的列(mblno,carrierid,portloadid)SQL语句{querySql}");
}
}
}
}
}
Loading…
Cancel
Save