diff --git a/DSWeb/Areas/CommMng/DAL/PubSysDAL.cs b/DSWeb/Areas/CommMng/DAL/PubSysDAL.cs index fae5fdf..64aafbb 100644 --- a/DSWeb/Areas/CommMng/DAL/PubSysDAL.cs +++ b/DSWeb/Areas/CommMng/DAL/PubSysDAL.cs @@ -2854,7 +2854,7 @@ namespace DSWeb.Areas.CommMng.DAL if (!hp.CanMake.Success) { BasicDataRefDAL.SaveLog(hp.CanMake.Message, "", "接收全泰账单", "错误"); - hp.DoSendMail(); + hp.DoSendErrorMail(); return; } diff --git a/DSWeb/Areas/CommMng/Models/PubSysModel.cs b/DSWeb/Areas/CommMng/Models/PubSysModel.cs index 47edebe..1283b5d 100644 --- a/DSWeb/Areas/CommMng/Models/PubSysModel.cs +++ b/DSWeb/Areas/CommMng/Models/PubSysModel.cs @@ -225,7 +225,7 @@ namespace DSWeb.Areas.CommMng.Models private void addfee(ch_fee_md fee) { if (NewFeeList == null) NewFeeList = new List(); - + fee.CUSTOMERTYPE = "订舱代理"; fee.INPUTMODE = INPUTMODE; NewFeeList.Add(fee); } @@ -406,12 +406,14 @@ namespace DSWeb.Areas.CommMng.Models { cdc.ch_fee.AddRange(NewFeeList); cdc.SaveChanges(); + + DoSendSuccessMail(); } else { if (!CanMake.Success) { //发出提醒邮件 - DoSendMail(); + DoSendErrorMail(); return CanMake; } @@ -474,24 +476,50 @@ namespace DSWeb.Areas.CommMng.Models if (ctnList != null && CtnNum > 0) { + var 铅封费price = GetPrice("铅封费"); var 信息费price = GetPrice("信息费"); - foreach (var ctn in ctnList) + + if (单证费 < CtnNum * (铅封费price + 信息费price)) + { + foreach (var ctn in ctnList) + { + //var newfee = MsChFeeDAL.getChFee(OP.GID, head.BSNO, head.FORWARDER, 2, "海运费", 单价 * (decimal)ctn.CTNNUM, ctn.CTNALL, (decimal)ctn.CTNNUM); + + var 铅封费 = MsChFeeDAL.getChFee(OP.GID, head.BSNO, head.FORWARDER, 2, "铅封费", 铅封费price * (decimal)ctn.CTNNUM, ctn.CTNALL, (decimal)ctn.CTNNUM); + + //var 信息费 = MsChFeeDAL.getChFee(OP.GID, head.BSNO, head.FORWARDER, 2, "信息费", 信息费price * (decimal)ctn.CTNNUM, ctn.CTNALL, (decimal)ctn.CTNNUM); + + //SetUsd(ref 铅封费); + //SetUsd(ref 信息费); + + add单证费(铅封费, ctn); + //add单证费(信息费, ctn); + } + } + else { - //var newfee = MsChFeeDAL.getChFee(OP.GID, head.BSNO, head.FORWARDER, 2, "海运费", 单价 * (decimal)ctn.CTNNUM, ctn.CTNALL, (decimal)ctn.CTNNUM); - var 铅封费 = MsChFeeDAL.getChFee(OP.GID, head.BSNO, head.FORWARDER, 2, "铅封费", 铅封费price * (decimal)ctn.CTNNUM, ctn.CTNALL, (decimal)ctn.CTNNUM); - var 信息费 = MsChFeeDAL.getChFee(OP.GID, head.BSNO, head.FORWARDER, 2, "信息费", 信息费price * (decimal)ctn.CTNNUM, ctn.CTNALL, (decimal)ctn.CTNNUM); + foreach (var ctn in ctnList) + { + //var newfee = MsChFeeDAL.getChFee(OP.GID, head.BSNO, head.FORWARDER, 2, "海运费", 单价 * (decimal)ctn.CTNNUM, ctn.CTNALL, (decimal)ctn.CTNNUM); + + var 铅封费 = MsChFeeDAL.getChFee(OP.GID, head.BSNO, head.FORWARDER, 2, "铅封费", 铅封费price * (decimal)ctn.CTNNUM, ctn.CTNALL, (decimal)ctn.CTNNUM); - //SetUsd(ref 铅封费); - //SetUsd(ref 信息费); + var 信息费 = MsChFeeDAL.getChFee(OP.GID, head.BSNO, head.FORWARDER, 2, "信息费", 信息费price * (decimal)ctn.CTNNUM, ctn.CTNALL, (decimal)ctn.CTNNUM); - add单证费(铅封费, ctn); - add单证费(信息费, ctn); + //SetUsd(ref 铅封费); + //SetUsd(ref 信息费); + + add单证费(铅封费, ctn); + add单证费(信息费, ctn); + } } + addfee(单证费List); + if (单证费 > 0) { @@ -526,7 +554,7 @@ namespace DSWeb.Areas.CommMng.Models addfee(_单证费); } - addfee(单证费List); + } else if (单证费 < 0) { @@ -964,7 +992,7 @@ namespace DSWeb.Areas.CommMng.Models return result; } - public void DoSendMail() + public void DoSendErrorMail() { //首先判断该业务的 op_logicinfo.propname= 账单解析错误 bsno=head.bsno的值是否存在 //如不存在设置为1 如存在判断其是否大于等于3,如大于等于3则不执行 @@ -1036,6 +1064,64 @@ namespace DSWeb.Areas.CommMng.Models // + } + } + + public void DoSendSuccessMail() + { + + + //向OP的邮箱发提醒邮件 + var user_op = cdc.VW_user.FirstOrDefault(x => x.USERID == OP.GID); + if (user_op == null) return; + + var OPEmail = cdc.VW_user.FirstOrDefault(x => x.USERID == OP.GID).EMAIL1; + + var email = OPEmail; + + + var mailbody = $"尊敬的{OP.SHOWNAME},您好:
提单号【{head.MBLNO}】的账单解析成功"; + + var bodystr = CanMake.Message.Replace(";,", "
"); + //string toNames = "frank,lee"; + + mailbody += bodystr; + + var mailtopic = $"【账单解析成功】:提单号 {head.MBLNO} 账单下载成功"; + + var MAILTONAME = "admin@dongshengsoft.com"; + var PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='MAILTONAME'"); + if (PARAMVALUE.PARAMVALUE != "") MAILTONAME = PARAMVALUE.PARAMVALUE; + var MAILTOPASSWORD = "ds!@#)(*"; + PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='MAILTOPASSWORD'"); + if (PARAMVALUE.PARAMVALUE != "") MAILTOPASSWORD = PARAMVALUE.PARAMVALUE; + var MAILTOSERVER = "smtpcom.263xmail.com"; + PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='MAILTOSERVER'"); + if (PARAMVALUE.PARAMVALUE != "") MAILTOSERVER = PARAMVALUE.PARAMVALUE; + var MAILTOPORT = "465"; + PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='MAILTOPORT'"); + if (PARAMVALUE.PARAMVALUE != "") MAILTOPORT = PARAMVALUE.PARAMVALUE; + var MAILISSSL = false; + PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='MAILISSSL'"); + if (PARAMVALUE.PARAMVALUE == "1") MAILISSSL = true; + + SendEmail se = new SendEmail(email, MAILTONAME, "", "", mailtopic, mailbody, true); + // SendEmail se = new SendEmail("dev001@dongshengsoft.com", "admin@dongshengsoft.com", "", "", mailtopic, mailbody, false); + //string filePath = filename; + //se.Attachments(filePath); + + try + { + se.SetSmtp(MAILTONAME, MAILTOPASSWORD, MAILTOSERVER, Convert.ToInt32(MAILTOPORT), MAILISSSL, System.Net.Mail.MailPriority.Normal); //必须在所有参数设置完后调用此方法 + // + + } + catch (Exception e) + { + se.SetSmtp(MAILTONAME, MAILTOPASSWORD, MAILTOSERVER, Convert.ToInt32(MAILTOPORT), MAILISSSL, System.Net.Mail.MailPriority.Normal); //必须在所有参数设置完后调用此方法 + // + + } } }