diff --git a/JobAutoCreateFee/JobYt2D6Fee.cs b/JobAutoCreateFee/JobYt2D6Fee.cs index 7eb16cf9..2d3561fd 100644 --- a/JobAutoCreateFee/JobYt2D6Fee.cs +++ b/JobAutoCreateFee/JobYt2D6Fee.cs @@ -371,6 +371,27 @@ namespace JobCreateFee public int secondPrintFee_count { get; set; } = 0; public decimal secondPrintFee_amount { get; set; } = 0; + public string CTN20 { get; set; }//业务中的20尺柜 + + public string CTN40 { get; set; }//业务中的20尺柜 + + public string CTN + { + get + { + if (!string.IsNullOrWhiteSpace(CTN40)) + { + return CTN40; + } + else + { + return CTN20; + } + } + } + + public string ENTEROPERATOR { get; set; }//费用录入人 + public YTSumFee() { } public YTSumFee(JsonYtFee addrec) { @@ -407,7 +428,7 @@ namespace JobCreateFee public void addfee(JsonYtFee addrec) { - if (MBLNO == addrec.ctn_no) + if (MBLNO == addrec.bookingno) { var newrec = new YTSumFee(addrec); fee_count += newrec.fee_count; diff --git a/JobAutoCreateFee/JobYt2D7Fee.cs b/JobAutoCreateFee/JobYt2D7Fee.cs index 4aee8b00..5907a858 100644 --- a/JobAutoCreateFee/JobYt2D7Fee.cs +++ b/JobAutoCreateFee/JobYt2D7Fee.cs @@ -35,6 +35,7 @@ namespace JobCreateFee string CustPsw = context.JobDetail.JobDataMap.GetString("CustPsw"); int reqTimeout = Convert.ToInt32(context.JobDetail.JobDataMap.GetString("RequestTimeout")); + YTFEEHelper.feeName = context.JobDetail.JobDataMap.GetString("feeName"); YTFEEHelper.ydFeeName = context.JobDetail.JobDataMap.GetString("ydFeeName"); YTFEEHelper.secondPrintFeeName = context.JobDetail.JobDataMap.GetString("secondPrintFeeName"); @@ -43,7 +44,11 @@ namespace JobCreateFee YTFEEHelper.connStr = connStr; YTFEEHelper.告警邮箱 = context.JobDetail.JobDataMap.GetString("AlertMail"); - var yesterday = DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd"); + int DAYS = Convert.ToInt32(context.JobDetail.JobDataMap.GetString("DAYS")); + string ENTEROPERATOR = context.JobDetail.JobDataMap.GetString("ENTEROPERATOR"); + + var yesterday = DateTime.Now.AddDays(DAYS).ToString("yyyy-MM-dd"); + JsonYtSend reqObj = new JsonYtSend(); reqObj.custname = CustName; reqObj.custpsw = CustPsw; @@ -116,7 +121,8 @@ namespace JobCreateFee + "','" + returndata.ydFee + "','" + returndata.secondPrintFee + "','" + returndata.applicant_code + "')"; SqlCommand cmd = new SqlCommand(sql, dbcon); cmd.ExecuteNonQuery(); - + + D7BS.ENTEROPERATOR = ENTEROPERATOR; hp.addYTFee(returndata, D7BS); } @@ -163,7 +169,7 @@ namespace JobCreateFee var newbs = new D7BS(); newbs.BSNO = ""; var strSql = new StringBuilder(); - strSql.Append("SELECT TOP 1 BSNO, CUSTOMERNAME,FEESTATUS,ISCANCEL from op_seae where MBLNO like '" + MBLNO + "%'"); + strSql.Append("SELECT TOP 1 BSNO, CUSTOMERNAME,FEESTATUS,ISCANCEL,isnull((select top 1 CTNALL from op_ctn where bsno=op_seae.BSNO and CTNALL like '20%'),'') CTN20,isnull((select top 1 CTNALL from op_ctn where bsno=op_seae.BSNO and CTNALL like '40%'),'') CTN40 from op_seae where MBLNO like '" + MBLNO + "%'"); SqlDataAdapter adapter = new SqlDataAdapter(strSql.ToString(), dbcon); DataTable table = new DataTable(); adapter.Fill(table); @@ -176,6 +182,9 @@ namespace JobCreateFee newbs.CUSTOMERNAME = row["CUSTOMERNAME"].ToString(); newbs.FEESTATUS = row["FEESTATUS"].ToString() == "1" ? true : false; newbs.ISCANCEL = row["ISCANCEL"].ToString() == "1" ? true : false; + + newbs.CTN20 = row["CTN20"].ToString(); + newbs.CTN40 = row["CTN40"].ToString(); } } @@ -213,14 +222,27 @@ namespace JobCreateFee public string BSNO { get; set; } public string CUSTOMERNAME { get; set; } - public string FEETYPE { get; set; } public bool FEESTATUS { get; set; } public bool ISCANCEL { get; set; } public decimal AMOUNT { get; set; } - public int QUANTITY { get; set; } + public string CTN20 { get; set; }//业务中的20尺柜 + + public string CTN40 { get; set; }//业务中的20尺柜 + + public string CTN { get { + if (!string.IsNullOrWhiteSpace(CTN40)) { + return CTN40; + } + else { + return CTN20; + } + } + } + + public string ENTEROPERATOR { get; set; } } public class YTFEEHelper @@ -270,18 +292,21 @@ namespace JobCreateFee } else { - addFee(addrec, ds7info.BSNO); + addFee(addrec, ds7info); } } - private void addFee(JsonYtFee addrec, string BSNO) + private void addFee(JsonYtFee addrec, D7BS ds7info) { if (!YTSUMFeeList.Exists(x => x.MBLNO == addrec.bookingno)) { var newrec = new YTSumFee(addrec); - newrec.BSNO = BSNO; + newrec.BSNO = ds7info.BSNO; + newrec.CTN20 = ds7info.CTN20; + newrec.CTN40 = ds7info.CTN40; + newrec.ENTEROPERATOR = ds7info.ENTEROPERATOR; YTSUMFeeList.Add(newrec); } else @@ -304,6 +329,7 @@ namespace JobCreateFee makefee_应付(item); } + var cdc = new CommonDataContext(connStr); @@ -314,17 +340,24 @@ namespace JobCreateFee foreach (var fee in FeeList) { + + + if (CurrFeeList.Exists(x => x.BSNO == fee.BSNO && x.FEENAME == fee.FEENAME && x.UNITPRICE == fee.UNITPRICE)) { //var updrec = CurrFeeList.First(x => x.BSNO == fee.BSNO && x.FEENAME == fee.FEENAME && x.UNITPRICE == fee.UNITPRICE); CurrFeeList.First(x => x.BSNO == fee.BSNO && x.FEENAME == fee.FEENAME && x.UNITPRICE == fee.UNITPRICE).AMOUNT += fee.AMOUNT; + CurrFeeList.First(x => x.BSNO == fee.BSNO && x.FEENAME == fee.FEENAME && x.UNITPRICE == fee.UNITPRICE).NOTAXAMOUNT += fee.NOTAXAMOUNT; CurrFeeList.First(x => x.BSNO == fee.BSNO && x.FEENAME == fee.FEENAME && x.UNITPRICE == fee.UNITPRICE).QUANTITY += fee.QUANTITY; //ChFeeHelper.setTax(ref updrec); - + CurrFeeList.First(x => x.BSNO == fee.BSNO && x.FEENAME == fee.FEENAME && x.UNITPRICE == fee.UNITPRICE).MODIFIEDUSER = fee.ENTEROPERATOR; + CurrFeeList.First(x => x.BSNO == fee.BSNO && x.FEENAME == fee.FEENAME && x.UNITPRICE == fee.UNITPRICE).MODIFIEDTIME = DateTime.Now; //updFeeList.Add(fee); } else { + fee.ENTERDATE= DateTime.Now; + InsertFeeList.Add(fee); } } @@ -337,51 +370,77 @@ namespace JobCreateFee private void makefee_应付(YTSumFee YTSumFee) { + if (YTSumFee.fee_amount > 0) { - var newfee = ChFeeHelper.getNewChfee(); - newfee.BSNO = YTSumFee.BSNO; - newfee.CUSTOMERNAME = feeCustName; - newfee.FEETYPE = 2; - newfee.AMOUNT = YTSumFee.fee_amount; - newfee.QUANTITY = YTSumFee.fee_count; - newfee.UNIT = "箱"; + //var newfee = ChFeeHelper.getNewChfee(); + //newfee.BSNO = YTSumFee.BSNO; + //newfee.CUSTOMERNAME = feeCustName; + //newfee.FEETYPE = 2; + //newfee.AMOUNT = YTSumFee.fee_amount; + //newfee.QUANTITY = YTSumFee.fee_count; + //newfee.UNIT = "箱"; + //newfee.ENTEROPERATOR = YTSumFee.OP; + //newfee.EXCHANGERATE = 1; + //newfee.FEENAME = "小票费"; + + var newfee = ChFeeHelper.getChFee(YTSumFee.ENTEROPERATOR, YTSumFee.BSNO, feeCustName, 2, "小票费", YTSumFee.fee_amount, YTSumFee.CTN, YTSumFee.fee_count, "", ""); + newfee.CUSTOMERTYPE = "其他"; + newfee.INPUTMODE = "导入亿通账单"; ChFeeHelper.setTax(ref newfee); FeeList.Add(newfee); } if (YTSumFee.ydFee1_amount > 0) { - var newfee = ChFeeHelper.getNewChfee(); - newfee.BSNO = YTSumFee.BSNO; - newfee.CUSTOMERNAME = CarrierCustName; - newfee.FEETYPE = 2; - newfee.AMOUNT = YTSumFee.ydFee1_amount; - newfee.QUANTITY = YTSumFee.ydFee1_count; - newfee.UNIT = "20'"; + //var newfee = ChFeeHelper.getNewChfee(); + //newfee.BSNO = YTSumFee.BSNO; + //newfee.CUSTOMERNAME = CarrierCustName; + //newfee.FEETYPE = 2; + //newfee.AMOUNT = YTSumFee.ydFee1_amount; + //newfee.QUANTITY = YTSumFee.ydFee1_count; + //newfee.UNIT = "20'"; + //newfee.ENTEROPERATOR = YTSumFee.OP; + //newfee.EXCHANGERATE = 1; + //newfee.FEENAME = "调箱费"; + var newfee = ChFeeHelper.getChFee(YTSumFee.ENTEROPERATOR, YTSumFee.BSNO, CarrierCustName, 2, "调箱费", YTSumFee.ydFee1_amount, YTSumFee.CTN20, YTSumFee.ydFee1_count, "", ""); + newfee.CUSTOMERTYPE = "其他"; + newfee.INPUTMODE = "导入亿通账单"; ChFeeHelper.setTax(ref newfee); FeeList.Add(newfee); } if (YTSumFee.ydFee2_amount > 0) { - var newfee = ChFeeHelper.getNewChfee(); - newfee.BSNO = YTSumFee.BSNO; - newfee.CUSTOMERNAME = CarrierCustName; - newfee.FEETYPE = 2; - newfee.AMOUNT = YTSumFee.ydFee2_amount; - newfee.QUANTITY = YTSumFee.ydFee2_count; - newfee.UNIT = "40'"; + //var newfee = ChFeeHelper.getNewChfee(); + //newfee.BSNO = YTSumFee.BSNO; + //newfee.CUSTOMERNAME = CarrierCustName; + //newfee.FEETYPE = 2; + //newfee.AMOUNT = YTSumFee.ydFee2_amount; + //newfee.QUANTITY = YTSumFee.ydFee2_count; + //newfee.UNIT = "40'"; + //newfee.ENTEROPERATOR = YTSumFee.OP; + //newfee.EXCHANGERATE = 1; + //newfee.FEENAME = "调箱费"; + var newfee = ChFeeHelper.getChFee(YTSumFee.ENTEROPERATOR, YTSumFee.BSNO, CarrierCustName, 2, "调箱费", YTSumFee.ydFee2_amount, YTSumFee.CTN40, YTSumFee.ydFee2_count, "", ""); + newfee.CUSTOMERTYPE = "其他"; + newfee.INPUTMODE = "导入亿通账单"; ChFeeHelper.setTax(ref newfee); FeeList.Add(newfee); } if (YTSumFee.secondPrintFee_amount > 0) { - var newfee = ChFeeHelper.getNewChfee(); - newfee.BSNO = YTSumFee.BSNO; - newfee.CUSTOMERNAME = CarrierCustName; - newfee.FEETYPE = 2; - newfee.AMOUNT = YTSumFee.secondPrintFee_amount; - newfee.QUANTITY = YTSumFee.secondPrintFee_count; - newfee.UNIT = "箱"; + //var newfee = ChFeeHelper.getNewChfee(); + //newfee.BSNO = YTSumFee.BSNO; + //newfee.CUSTOMERNAME = CarrierCustName; + //newfee.FEETYPE = 2; + //newfee.AMOUNT = YTSumFee.secondPrintFee_amount; + //newfee.QUANTITY = YTSumFee.secondPrintFee_count; + //newfee.UNIT = "箱"; + //newfee.ENTEROPERATOR = YTSumFee.OP; + //newfee.EXCHANGERATE = 1; + //newfee.FEENAME = "取消小票费"; + var newfee = ChFeeHelper.getChFee(YTSumFee.ENTEROPERATOR, YTSumFee.BSNO, CarrierCustName, 2, "取消小票费", YTSumFee.secondPrintFee_amount, YTSumFee.CTN, YTSumFee.secondPrintFee_count, "", ""); + newfee.CUSTOMERTYPE = "其他"; + newfee.INPUTMODE = "导入亿通账单"; ChFeeHelper.setTax(ref newfee); FeeList.Add(newfee); } diff --git a/JobAutoCreateFee/quartz_jobs.xml b/JobAutoCreateFee/quartz_jobs.xml index 7aa4dbcf..bddcfd7a 100644 --- a/JobAutoCreateFee/quartz_jobs.xml +++ b/JobAutoCreateFee/quartz_jobs.xml @@ -17,8 +17,12 @@ ConnectString + + Data Source=221.215.122.2,12456;Initial Catalog=2024_0322;Persist Security Info=True;User ID=sa;Password=Ds20040201 + + + Data Source=.;Initial Catalog=dongshengdata_jf;Persist Security Info=True;User ID=sa;Password=ds20040201--> @@ -77,6 +81,14 @@ AlertMail hhytcma@logisticsyt.com + + DAYS + -2 + + + ENTEROPERATOR + 1BEC90E1-9780-472F-90C2-0C6390C044A4 + @@ -88,7 +100,7 @@ Job - * 0/1 * * * ? + 0 9 15 * * ? diff --git a/JobSendAgentMail/SendMailJob.cs b/JobSendAgentMail/SendMailJob.cs index e76e6557..855738cc 100644 --- a/JobSendAgentMail/SendMailJob.cs +++ b/JobSendAgentMail/SendMailJob.cs @@ -11,6 +11,53 @@ using System.Web; namespace JobSendAgentMail { + /* 注意 依赖于几个表 + * + * + //待发邮件表 自动发出其中 sendstatus=create的 + + CREATE TABLE [dbo].[Mail_Send]( + [GID] [nvarchar](128) NOT NULL, + [SendTo] [nvarchar](max) NULL, + [CCTo] [nvarchar](max) NULL, + [Title] [nvarchar](max) NULL, + [Body] [nvarchar](max) NULL, + [SendStatus] [nvarchar](40) NULL, + [SendTime] [datetime] NULL, + [TryCount] [int] NOT NULL, + [CreateTime] [datetime] NOT NULL, + [RelativeId] [nvarchar](max) NULL, + [SmtpConfig] [varchar](36) NULL, + [Sender] [varchar](64) NULL, + [ShowName] [nvarchar](50) NULL, + CONSTRAINT [PK_dbo.Mail_Send] PRIMARY KEY CLUSTERED +( + [GID] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + //发送日志记录 +CREATE TABLE [dbo].[op_mail_log]( + [GID] [varchar](60) NOT NULL, + [BSNO] [varchar](60) NULL, + [BLTYPE] [varchar](20) NULL, + [RECEIVER] [varchar](100) NULL, + [SUBJECT] [varchar](300) NULL, + [DESCRIPTION] [varchar](max) NULL, + [ATTACHMENT] [varchar](600) NULL, + [SENDTIME] [datetime] NULL, + [SENDER] [varchar](10) NULL, + [SENDUSER] [varchar](60) NULL, + CCTo varchar(500) null, + CONSTRAINT [PK_op_mail_log] PRIMARY KEY CLUSTERED +( + [GID] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + + */ + /// /// 发送邮件任务 /// @@ -74,25 +121,28 @@ namespace JobSendAgentMail { message.To.Add(MailboxAddress.Parse(sendMail.SendTo)); } - if (sendMail.CCTo.IndexOf(",") > -1) + if (!string.IsNullOrWhiteSpace(sendMail.CCTo)) { - var arrSendTo = sendMail.CCTo.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); - foreach (var s in arrSendTo) + if (sendMail.CCTo.IndexOf(",") > -1) { - message.To.Add(MailboxAddress.Parse(s)); + var arrSendTo = sendMail.CCTo.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); + foreach (var s in arrSendTo) + { + message.To.Add(MailboxAddress.Parse(s)); + } } - } - else if (sendMail.CCTo.IndexOf(";") > -1) - { - var arrSendTo = sendMail.CCTo.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); - foreach (var s in arrSendTo) + else if (sendMail.CCTo.IndexOf(";") > -1) { - message.To.Add(MailboxAddress.Parse(s)); + var arrSendTo = sendMail.CCTo.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); + foreach (var s in arrSendTo) + { + message.To.Add(MailboxAddress.Parse(s)); + } + } + else + { + message.To.Add(MailboxAddress.Parse(sendMail.CCTo)); } - } - else - { - message.To.Add(MailboxAddress.Parse(sendMail.CCTo)); } message.Subject = sendMail.Title; diff --git a/JobSendAgentMail/quartz_jobs.xml b/JobSendAgentMail/quartz_jobs.xml index 90c503b3..1c44f205 100644 --- a/JobSendAgentMail/quartz_jobs.xml +++ b/JobSendAgentMail/quartz_jobs.xml @@ -4,77 +4,128 @@ true - - - - JobSendBooking - Job - 订阅数据 - JobSendAgentMail.JobSendCtn,JobSendAgentMail - true - false - - - - ConnectString - Data Source=ds-hxt;Initial Catalog=DATA;Persist Security Info=True;User ID=sa;Password=yongfa_123 - - - - QuerySql - - SELECT 箱号 FROM [dbo].[t_op_ctn_detail] where isnull(是否还箱,0)=0 and (GETDATE()-动态时间)>180 - - - - - MAILSENDACCOUNT - han_xuntao@163.com - - - - MAILSENDPASSWORD - ds20040201 - - - - MAILSENDSERVICE - smtp.163.com - - - - MAILSENDPORT - 25 - - - - MAILISSSL - false - - - MAILRECEIVER - e.control@win-fast.com.cn,e.control2@win-fast.com.cn - - - - MAILTITLE - 集装箱超期提醒 - - - - - - - - TriggerBooking - Job - 订阅数据触发器 - JobSendBooking - Job - 0 55 14 * * ? - - - - + + + + JobSendBooking + Job + 订阅数据 + JobSendAgentMail.JobSendCtn,JobSendAgentMail + true + false + + + + ConnectString + Data Source=ds-hxt;Initial Catalog=DATA;Persist Security Info=True;User ID=sa;Password=yongfa_123 + + + + QuerySql + + SELECT 箱号 FROM [dbo].[t_op_ctn_detail] where isnull(是否还箱,0)=0 and (GETDATE()-动态时间)>180 + + + + + MAILSENDACCOUNT + han_xuntao@163.com + + + + MAILSENDPASSWORD + ds20040201 + + + + MAILSENDSERVICE + smtp.163.com + + + + MAILSENDPORT + 25 + + + + MAILISSSL + false + + + MAILRECEIVER + e.control@win-fast.com.cn,e.control2@win-fast.com.cn + + + + MAILTITLE + 集装箱超期提醒 + + + + + + + + TriggerBooking + Job + 订阅数据触发器 + JobSendBooking + Job + 0 55 14 * * ? + + + + + SendMailJob + Job + 发送邮件 + JobSendAgentMail.SendMailJob,JobSendAgentMail + true + false + + + + ConnectString + Data Source=221.215.122.2,12456;Initial Catalog=2024_0322;Persist Security Info=True;User ID=sa;Password=Ds20040201 + + + + MAILSENDACCOUNT + dongshengcangdan@h8j.top + + + + MAILSENDPASSWORD + A1B2C3ds040201 + + + + MAILSENDSERVICE + smtpdm.aliyun.com + + + + MAILSENDPORT + 80 + + + + MAILISSSL + false + + + + + + + + TriggerSendMail + Job + 订阅数据触发器 + SendMailJob + Job + 0 0/1 * * * ? + + \ No newline at end of file