From e7833ca98ca6b1140cc141b2336ac961e33ddc8f Mon Sep 17 00:00:00 2001 From: hanxuntao Date: Fri, 8 Nov 2024 13:55:33 +0800 Subject: [PATCH] 1 --- DSWeb/Areas/MvcShipping/Comm/MailMessage.cs | 16 ++- .../MvcShipping/DAL/MsOpSeae/MsOpSeaeDAL.cs | 68 +++++----- .../DAL/MsOpSeaePre/MsOpSeaePreDAL.cs | 116 ++++++++++++++++++ DSWeb/DSWeb.csproj.user | 2 +- DSWeb/Web.config | 4 +- 5 files changed, 166 insertions(+), 40 deletions(-) diff --git a/DSWeb/Areas/MvcShipping/Comm/MailMessage.cs b/DSWeb/Areas/MvcShipping/Comm/MailMessage.cs index dc684633..f36204ff 100644 --- a/DSWeb/Areas/MvcShipping/Comm/MailMessage.cs +++ b/DSWeb/Areas/MvcShipping/Comm/MailMessage.cs @@ -42,14 +42,18 @@ namespace CommonTool.MailKit multipart.Add(alternative); } - //插入附件 - foreach (var mailFile in mailBodyEntity.MailFiles) + + if (mailBodyEntity.MailFiles != null) { - if (mailFile.MailFilePath != null && File.Exists(mailFile.MailFilePath)) + //插入附件 + foreach (var mailFile in mailBodyEntity.MailFiles) { - var mimePart = AssemblyMailAttachmentMessage(mailFile.MailFileType, mailFile.MailFileSubType, - mailFile.MailFilePath); - multipart.Add(mimePart); + if (mailFile.MailFilePath != null && File.Exists(mailFile.MailFilePath)) + { + var mimePart = AssemblyMailAttachmentMessage(mailFile.MailFileType, mailFile.MailFileSubType, + mailFile.MailFilePath); + multipart.Add(mimePart); + } } } diff --git a/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeDAL.cs b/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeDAL.cs index a394a4d4..ea6d1132 100644 --- a/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeDAL.cs +++ b/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeDAL.cs @@ -5605,7 +5605,16 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL db.ExecuteNonQuery(cmdDelete, tran); var cmdUpdateOrder = db.GetSqlStringCommand("update crm_seaeorder set ORSTATUS=4 where bsno='" + billno.BSNO + "'"); db.ExecuteNonQuery(cmdUpdateOrder, tran); + + var OPPRE = MsOpSeaePreDAL.MsOpSeaePreDAL.GetData(" ORDNO IN (SELECT ORDNO FROM crm_seaeorder WHERE BSNO='" + billno.BSNO + "')",db,tran); + if (!string.IsNullOrEmpty(OPPRE.ORDNO)) + { + var cmdUpdateOrder2 = db.GetSqlStringCommand("update op_seae_pre set ISORDER=0,ISUP=0,ORDNO='' where ORDNO='" + OPPRE.ORDNO + "'"); + db.ExecuteNonQuery(cmdUpdateOrder2, tran); + SENDCANCELORDNO(OPPRE, billno); } + + } else { _Comm = "update OP_SEAE set ISCANCEL='2' where BSNO=@BSNO"; @@ -5820,39 +5829,37 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL var mailtitle = "舱位回收 "; - if (!string.IsNullOrEmpty(headData.CARRIER)) - mailtitle = mailtitle + headData.CARRIER; + if (!string.IsNullOrEmpty(opSeae.CARRIER)) + mailtitle = mailtitle + "-" + opSeae.CARRIER; if (!string.IsNullOrEmpty(headData.ORDNO)) mailtitle = mailtitle + "-" + headData.ORDNO; - if (!string.IsNullOrEmpty(headData.MBLNO)) - mailtitle = mailtitle + "-" + headData.MBLNO; - if (!string.IsNullOrEmpty(headData.MBLNO)) - mailtitle = mailtitle + "-" + headData.MBLNO; - if (!string.IsNullOrEmpty(headData.LANE)) - mailtitle = mailtitle + "-" + headData.LANE; - if (!string.IsNullOrEmpty(headData.ETD)) - mailtitle = mailtitle + "-" + headData.ETD; - if (!string.IsNullOrEmpty(headData.PORTDISCHARGE)) - mailtitle = mailtitle + "-" + headData.PORTDISCHARGE; - if (!string.IsNullOrEmpty(headData.COUNTRY)) - mailtitle = mailtitle + "," + headData.COUNTRY; - if (!string.IsNullOrEmpty(headData.CNTRTOTAL)) - mailtitle = mailtitle + "-" + headData.CNTRTOTAL; + if (!string.IsNullOrEmpty(opSeae.MBLNO)) + mailtitle = mailtitle + "-" + opSeae.MBLNO; + if (!string.IsNullOrEmpty(opSeae.LANE)) + mailtitle = mailtitle + "-" + opSeae.LANE; + if (!string.IsNullOrEmpty(opSeae.ETD)) + mailtitle = mailtitle + "-" + opSeae.ETD; + if (!string.IsNullOrEmpty(opSeae.PORTDISCHARGE)) + mailtitle = mailtitle + "-" + opSeae.PORTDISCHARGE; + if (!string.IsNullOrEmpty(opSeae.COUNTRY)) + mailtitle = mailtitle + "," + opSeae.COUNTRY; + if (!string.IsNullOrEmpty(opSeae.CNTRTOTAL)) + mailtitle = mailtitle + "-" + opSeae.CNTRTOTAL; var Body = new StringBuilder(); Body.Append(" "); - Body.Append("
提单号:" + headData.MBLNO); - Body.Append("
运费协议号:" + headData.CONTRACTNO); + Body.Append("
提单号:" + opSeae.MBLNO); + Body.Append("
运费协议号:" + opSeae.CONTRACTNO); Body.Append("
货物标识:" + opSeae.CARGOID); - Body.Append("
开船日期:" + headData.ETD); - Body.Append("
箱型箱量:" + headData.CNTRTOTAL); - Body.Append("
起运港:" + headData.PORTLOAD); - Body.Append("
目的港及国家:" + headData.PORTDISCHARGE+","+headData.COUNTRY); - Body.Append("
五字代码:" + headData.PORTDISCHARGEID); - Body.Append("
船名航次:" + headData.VESSEL + headData.VOYNO); - Body.Append("
订舱代理:" + headData.FORWARDER); - Body.Append("
订舱号:" + headData.ORDERNO); - Body.Append("
退仓客户:" + headData.CUSTOMERNAME); + Body.Append("
开船日期:" + opSeae.ETD); + Body.Append("
箱型箱量:" + opSeae.CNTRTOTAL); + Body.Append("
起运港:" + opSeae.PORTLOAD); + Body.Append("
目的港及国家:" + opSeae.PORTDISCHARGE+","+ opSeae.COUNTRY); + Body.Append("
五字代码:" + opSeae.PORTDISCHARGEID); + Body.Append("
船名航次:" + opSeae.VESSEL + opSeae.VOYNO); + Body.Append("
订舱代理:" + opSeae.FORWARDER); + Body.Append("
订舱号:" + opSeae.ORDERNO); + Body.Append("
退仓客户:" + opSeae.CUSTOMERNAME); Body.Append(" "); var mailto = ""; void mailtoAdd(string mail) @@ -5862,7 +5869,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL else mailto = mailto + ";" + mail; } - var oplist = SysUserDAL.GetDataList("U.SHOWNAME='" + headData.CUSTSERVICE + "'"); + var oplist = SysUserDAL.GetDataList("U.SHOWNAME='" + opSeae.CUSTSERVICE + "'"); foreach (var opbs in oplist) { if (opbs.EMAIL1 != "") @@ -5875,13 +5882,13 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL { - result = SendMailWithNoFile(mailtitle, Body.ToString(), "", mailto, ""); + result = SendMailWithNoFile(mailtitle, Body.ToString(), mailto, ""); } return result; } - public static DBResult SendMailWithNoFile(string title, string context, string filePath, string MailToAddress, string username) + public static DBResult SendMailWithNoFile(string title, string context, string MailToAddress, string username) { var result = new DBResult(); @@ -5909,7 +5916,6 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='MAILISSSL'"); if (PARAMVALUE.PARAMVALUE == "1") MAILISSSL = true; - filePath = System.Web.HttpContext.Current.Server.MapPath(filePath); try { var recipients = new List(); diff --git a/DSWeb/Areas/MvcShipping/DAL/MsOpSeaePre/MsOpSeaePreDAL.cs b/DSWeb/Areas/MvcShipping/DAL/MsOpSeaePre/MsOpSeaePreDAL.cs index 760578c5..1228635f 100644 --- a/DSWeb/Areas/MvcShipping/DAL/MsOpSeaePre/MsOpSeaePreDAL.cs +++ b/DSWeb/Areas/MvcShipping/DAL/MsOpSeaePre/MsOpSeaePreDAL.cs @@ -122,7 +122,26 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaePreDAL } return new MsOpSeaePre(); } + static public MsOpSeaePre GetData(string condition, Database db, DbTransaction tran) + { + String strSql = "SELECT [BSNO],[MASTERNO],[CUSTOMERNAME],[MBLNO],[CONTRACTNO],[VESSEL],[VOYNO],[ETD],[CLOSINGDATE],[CLOSEDOCDATE],[ETA]" + + ",CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR" + + ",(select top 1 showname from [user] where GID=op_seae_pre.CREATEUSER) as CREATEUSER,(select top 1 showname from [user] where GID=op_seae_pre.MODIFIEDUSER) as MODIFIEDUSER" + + ",[PORTLOADID],[PORTLOAD],[PORTDISCHARGEID],[PORTDISCHARGE],[LANE],[CARRIER],[FORWARDER],[BSSTATUS],[CNTRTOTAL],[OP],[REMARK],[CREATEUSER],[CREATETIME],[MODIFIEDUSER],[MODIFIEDTIME] " + + ",CASE WHEN len(PORTDISCHARGEID)<>5 THEN '' ELSE (select top 1 c_country_name from t_sys_country_code where c_country_code=LEFT(PORTDISCHARGEID,2)) END as COUNTRY " + + ",ORDERNO,CUSTSERVICE,HSCODE,GOODSNAME,SALEDEPT,ISUP,ISORDER,ORDNO,TEU,KGS,COST,SELL FROM op_seae_pre"; + if (!string.IsNullOrEmpty(condition)) + { + strSql += " where " + condition; + } + var list = SetData(strSql, db, tran); + if (list.Count > 0) + { + return list[0]; + } + return new MsOpSeaePre(); + } static public List GetHisDataList(string strCondition, string userid, string usercode, string companyid, string sort = null) { @@ -314,7 +333,104 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaePreDAL return headList; } + private static List SetData(String strSql, Database db, DbTransaction tran) + { + var headList = new List(); + using (IDataReader reader = db.ExecuteReader(tran, CommandType.Text, strSql.ToString())) + { + while (reader.Read()) + { + MsOpSeaePre data = new MsOpSeaePre(); + #region Set DB data to Object + data.BSNO = Convert.ToString(reader["BSNO"]); + data.MASTERNO = Convert.ToString(reader["MASTERNO"]); + data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]); + data.MBLNO = Convert.ToString(reader["MBLNO"]); + data.CONTRACTNO = Convert.ToString(reader["CONTRACTNO"]); + data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]); + data.VESSEL = Convert.ToString(reader["VESSEL"]); + data.VOYNO = Convert.ToString(reader["VOYNO"]); + if (reader["ETD"] != DBNull.Value) + data.ETD = Convert.ToDateTime(reader["ETD"]).ToString("yyyy-MM-dd"); + data.PORTLOAD = Convert.ToString(reader["PORTLOAD"]); + data.PORTDISCHARGE = Convert.ToString(reader["PORTDISCHARGE"]); + data.PORTLOADID = Convert.ToString(reader["PORTLOADID"]); + data.PORTDISCHARGEID = Convert.ToString(reader["PORTDISCHARGEID"]); + data.LANE = Convert.ToString(reader["LANE"]); + data.CARRIER = Convert.ToString(reader["CARRIER"]); + data.FORWARDER = Convert.ToString(reader["FORWARDER"]); + data.BSSTATUS = Convert.ToString(reader["BSSTATUS"]); + data.CNTRTOTAL = Convert.ToString(reader["CNTRTOTAL"]); + data.COUNTRY = Convert.ToString(reader["COUNTRY"]); + data.OP = Convert.ToString(reader["OP"]); + data.REMARK = Convert.ToString(reader["REMARK"]); + data.CREATEUSER = Convert.ToString(reader["CREATEUSER"]); + if (reader["CREATETIME"] != DBNull.Value) + data.CREATETIME = Convert.ToDateTime(reader["CREATETIME"]); + data.MODIFIEDUSER = Convert.ToString(reader["MODIFIEDUSER"]); + if (reader["MODIFIEDTIME"] != DBNull.Value) + data.MODIFIEDTIME = Convert.ToDateTime(reader["MODIFIEDTIME"]); + if (reader["CLOSINGDATE"] != DBNull.Value) + data.CLOSINGDATE = Convert.ToDateTime(reader["CLOSINGDATE"]).ToString("yyyy-MM-dd HH:mm:ss");//截港日期 + if (reader["CLOSEDOCDATE"] != DBNull.Value) + data.CLOSEDOCDATE = Convert.ToDateTime(reader["CLOSEDOCDATE"]).ToString("yyyy-MM-dd HH:mm:ss");//截港日期 + if (reader["CNTR1"] != DBNull.Value) + data.CNTR1 = Convert.ToInt32(reader["CNTR1"]);//箱型1 + if (reader["CNTR2"] != DBNull.Value) + data.CNTR2 = Convert.ToInt32(reader["CNTR2"]);//箱型2 + if (reader["CNTR3"] != DBNull.Value) + data.CNTR3 = Convert.ToInt32(reader["CNTR3"]);//箱型3 + if (reader["CNTR4"] != DBNull.Value) + data.CNTR4 = Convert.ToInt32(reader["CNTR4"]);//箱型4 + if (reader["CNTR5"] != DBNull.Value) + data.CNTR5 = Convert.ToInt32(reader["CNTR5"]);//箱型5 + if (reader["CNTR6"] != DBNull.Value) + data.CNTR6 = Convert.ToInt32(reader["CNTR6"]);//箱型6 + if (reader["CNTR7"] != DBNull.Value) + data.CNTR7 = Convert.ToInt32(reader["CNTR7"]);//箱型7 + if (reader["CNTR8"] != DBNull.Value) + data.CNTR8 = Convert.ToInt32(reader["CNTR8"]);//箱型8 + if (reader["CNTR9"] != DBNull.Value) + data.CNTR9 = Convert.ToInt32(reader["CNTR9"]);//箱型9 + if (reader["CNTR10"] != DBNull.Value) + data.CNTR10 = Convert.ToInt32(reader["CNTR10"]);//箱型10 + if (reader["OTCNTR"] != DBNull.Value) + data.OTCNTR = Convert.ToInt32(reader["OTCNTR"]);//其他箱型 + if (!string.IsNullOrEmpty(data.ETD) && (data.BSSTATUS == "船公司已放舱未使用")) + { + if ((Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(2)) >= (Convert.ToDateTime(data.ETD))) + { + data.LISTSTATUS = "1"; + } + } + else data.LISTSTATUS = "0"; + //if (reader["BSLOCK"] != DBNull.Value) + // data.BSLOCK = Convert.ToBoolean(reader["BSLOCK"]); + if (reader["ISUP"] != DBNull.Value) + data.ISUP = Convert.ToBoolean(reader["ISUP"]); + if (reader["ISORDER"] != DBNull.Value) + data.ISORDER = Convert.ToBoolean(reader["ISORDER"]); + data.ORDERNO = Convert.ToString(reader["ORDERNO"]); + data.CUSTSERVICE = Convert.ToString(reader["CUSTSERVICE"]); + data.HSCODE = Convert.ToString(reader["HSCODE"]); + data.GOODSNAME = Convert.ToString(reader["GOODSNAME"]); + data.SALEDEPT = Convert.ToString(reader["SALEDEPT"]); + data.ORDNO = Convert.ToString(reader["ORDNO"]); + if (reader["TEU"] != DBNull.Value) + data.TEU = Convert.ToInt32(reader["TEU"]);//其他箱型 + if (reader["KGS"] != DBNull.Value) + data.KGS = Convert.ToDecimal(reader["KGS"]);//其他箱型 + data.COST = Convert.ToString(reader["COST"]); + data.SELL = Convert.ToString(reader["SELL"]); + + #endregion + headList.Add(data); + } + reader.Close(); + } + return headList; + } #endregion #region 批量修改 diff --git a/DSWeb/DSWeb.csproj.user b/DSWeb/DSWeb.csproj.user index 2ea1f905..b93622d6 100644 --- a/DSWeb/DSWeb.csproj.user +++ b/DSWeb/DSWeb.csproj.user @@ -4,7 +4,7 @@ ShowAllFiles D:\DONGSHENG7\DS7HHYT\DSWeb\Properties\PublishProfiles\FolderProfile.pubxml true - Debug|Any CPU + Release|Any CPU diff --git a/DSWeb/Web.config b/DSWeb/Web.config index 5eff424d..b838f8c6 100644 --- a/DSWeb/Web.config +++ b/DSWeb/Web.config @@ -115,8 +115,8 @@ --> - - + +