From fd7c9de4bfb1424e11fcd0f423d258d7d4a167b0 Mon Sep 17 00:00:00 2001 From: hanxuntao <641739520@qq.com> Date: Wed, 23 Aug 2023 15:15:58 +0800 Subject: [PATCH] 1 --- BookingJieFeng/BookingJieFeng.csproj.user | 2 +- BookingWeb/BookingWeb.csproj.user | 2 +- .../DAL/Chfee_invoice/Chfee_InvoiceDAL.cs | 4 +- .../Chfee_invoice_HangXin/Chfee_InvoiceDAL.cs | 2 +- .../Chfee_PayapplicationDAL.cs | 6 +- .../Chfee_settlement/Chfee_SettlementDAL.cs | 4 +- .../Viewsjs/Chfee_Audit/Chfee_AuditLR.js | 2 +- .../MvcShipping/Comm/DateTimeExtension.cs | 141 ++++++ .../Areas/MvcShipping/Comm/Int32Extensions.cs | 90 ++++ .../Areas/MvcShipping/Comm/StringExtension.cs | 479 ++++++++++++++++++ .../MsCwVouchersGlSettlementController.cs | 2 +- .../Controllers/MsOpSeaeController.cs | 7 +- .../DAL/MsCodeFtpSet/MsCodeFtpSetDAL.cs | 6 +- .../DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs | 49 ++ .../MvcShipping/Models/MsCodeFtp/FtpSet.cs | 7 + .../Views/MsRptOpProfitCompare/YearIndex.aspx | 2 +- .../Viewsjs/MsChFee/FeeDrCrGrid.js | 6 +- .../Viewsjs/MsCodeFtpSet/MsCodeFtpSetEdit.js | 6 + .../Viewsjs/MsCodeFtpSet/MsCodeFtpSetModel.js | 1 + .../MsRptOpProfitYearCompareIndex.js | 61 ++- DSWeb/DSWeb.csproj | 3 + DSWeb/DSWeb.csproj.user | 2 +- DispatchWeb/DispatchWeb.csproj.user | 2 +- JobAutoCreateFee/JobAutoCreateFee.csproj | 2 + JobAutoCreateFee/JobDjyD6Xf.cs | 2 +- JobAutoCreateFee/JobDjyD7Xf.cs | 190 +++++++ JobAutoCreateFee/JobYt2D6Fee.cs | 283 +++++++++++ JobAutoCreateFee/quartz_jobs.xml | 46 ++ 28 files changed, 1386 insertions(+), 23 deletions(-) create mode 100644 DSWeb/Areas/MvcShipping/Comm/DateTimeExtension.cs create mode 100644 DSWeb/Areas/MvcShipping/Comm/Int32Extensions.cs create mode 100644 DSWeb/Areas/MvcShipping/Comm/StringExtension.cs create mode 100644 JobAutoCreateFee/JobDjyD7Xf.cs create mode 100644 JobAutoCreateFee/JobYt2D6Fee.cs diff --git a/BookingJieFeng/BookingJieFeng.csproj.user b/BookingJieFeng/BookingJieFeng.csproj.user index a48b3371..28be9c4c 100644 --- a/BookingJieFeng/BookingJieFeng.csproj.user +++ b/BookingJieFeng/BookingJieFeng.csproj.user @@ -1,7 +1,7 @@  - Debug|Any CPU + Release|Any CPU FolderProfile true diff --git a/BookingWeb/BookingWeb.csproj.user b/BookingWeb/BookingWeb.csproj.user index 6bc24ada..4edb5e0f 100644 --- a/BookingWeb/BookingWeb.csproj.user +++ b/BookingWeb/BookingWeb.csproj.user @@ -1,7 +1,7 @@  - Debug|Any CPU + Release|Any CPU true diff --git a/DSWeb/Areas/Account/DAL/Chfee_invoice/Chfee_InvoiceDAL.cs b/DSWeb/Areas/Account/DAL/Chfee_invoice/Chfee_InvoiceDAL.cs index ec191ad9..ec71b8aa 100644 --- a/DSWeb/Areas/Account/DAL/Chfee_invoice/Chfee_InvoiceDAL.cs +++ b/DSWeb/Areas/Account/DAL/Chfee_invoice/Chfee_InvoiceDAL.cs @@ -4760,11 +4760,11 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice { if (str == "") { - str = " COMPANYID='" + companyid + "' "; + str = " (COMPANYID='" + Convert.ToString(reader["COMPANYID"]) + "' "; } else { - str = str + " or COMPANYID='" + companyid + "' "; + str = str + " or COMPANYID='" + Convert.ToString(reader["COMPANYID"]) + "' "; }; } str = str + ")"; diff --git a/DSWeb/Areas/Account/DAL/Chfee_invoice_HangXin/Chfee_InvoiceDAL.cs b/DSWeb/Areas/Account/DAL/Chfee_invoice_HangXin/Chfee_InvoiceDAL.cs index 4bcf81c2..24ac052a 100644 --- a/DSWeb/Areas/Account/DAL/Chfee_invoice_HangXin/Chfee_InvoiceDAL.cs +++ b/DSWeb/Areas/Account/DAL/Chfee_invoice_HangXin/Chfee_InvoiceDAL.cs @@ -4736,7 +4736,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin { if (str == "") { - str = " COMPANYID='" + companyid + "' "; + str = "(COMPANYID='" + companyid + "' "; } else { diff --git a/DSWeb/Areas/Account/DAL/Chfee_payapplication/Chfee_PayapplicationDAL.cs b/DSWeb/Areas/Account/DAL/Chfee_payapplication/Chfee_PayapplicationDAL.cs index 3a313f8a..7701a333 100644 --- a/DSWeb/Areas/Account/DAL/Chfee_payapplication/Chfee_PayapplicationDAL.cs +++ b/DSWeb/Areas/Account/DAL/Chfee_payapplication/Chfee_PayapplicationDAL.cs @@ -4321,11 +4321,11 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication { if (str == "") { - str = " COMPANYID='" + companyid + "' "; + str = " (COMPANYID='" + Convert.ToString(reader["COMPANYID"]) + "' "; } else { - str = str + " or COMPANYID='" + companyid + "' "; + str = str + " or COMPANYID='" + Convert.ToString(reader["COMPANYID"]) + "' "; }; } str = str + ")"; @@ -4342,7 +4342,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication Database userdb = DatabaseFactory.CreateDatabase(); using (IDataReader reader = userdb.ExecuteReader(CommandType.Text, userstr.ToString())) { - str = ""; + str = "("; while (reader.Read()) { if (str == "") diff --git a/DSWeb/Areas/Account/DAL/Chfee_settlement/Chfee_SettlementDAL.cs b/DSWeb/Areas/Account/DAL/Chfee_settlement/Chfee_SettlementDAL.cs index 26b36824..1fc2f1f1 100644 --- a/DSWeb/Areas/Account/DAL/Chfee_settlement/Chfee_SettlementDAL.cs +++ b/DSWeb/Areas/Account/DAL/Chfee_settlement/Chfee_SettlementDAL.cs @@ -6686,11 +6686,11 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Settlement { if (str == "") { - str = " (APPLICANT in (select USERID from user_company where COMPANYID='" + companyid + "') "; + str = " (APPLICANT in (select USERID from user_company where COMPANYID='" + Convert.ToString(reader["COMPANYID"]) + "') "; } else { - str = str + " or APPLICANT in (select USERID from user_company where COMPANYID='" + companyid + "')" ; + str = str + " or APPLICANT in (select USERID from user_company where COMPANYID='" + Convert.ToString(reader["COMPANYID"]) + "')" ; }; } str = str + ")"; diff --git a/DSWeb/Areas/Account/Viewsjs/Chfee_Audit/Chfee_AuditLR.js b/DSWeb/Areas/Account/Viewsjs/Chfee_Audit/Chfee_AuditLR.js index 5046dc0f..03605a9a 100644 --- a/DSWeb/Areas/Account/Viewsjs/Chfee_Audit/Chfee_AuditLR.js +++ b/DSWeb/Areas/Account/Viewsjs/Chfee_Audit/Chfee_AuditLR.js @@ -4222,7 +4222,7 @@ Ext.extend(Shipping.MsChfeeAudit, Ext.Panel, { if (ttlprofit < 0) feecolor = 'red'; ttllb = "   " + Zi.LAN.ReceivableSum + ": " + returnfloat(ttldr) + "   " + Zi.LAN.profitSum + ":" + returnfloat(ttlcr) + "   " + Zi.LAN.Hejiprofit + "" + returnfloat(ttlprofit) + "  " + Zi.LAN.ProfitMargins + "" + returnfloat(profitrate) + ""; - ttllb = ttllb + "  " + Zi.LAN.noacctaxttldr + ": " + returnfloat(noacctaxttldr) + "   " + Zi.LAN.acctaxttldr + ":" + returnfloat(acctaxttldr) + "   " + Zi.LAN.noacctaxttlcr + "" + returnfloat(noacctaxttlcr) + "  " + Zi.LAN.acctaxttlcr + "" + returnfloat(acctaxttlcr) + ""; + // ttllb = ttllb + "  " + Zi.LAN.noacctaxttldr + ": " + returnfloat(noacctaxttldr) + "   " + Zi.LAN.acctaxttldr + ":" + returnfloat(acctaxttldr) + "   " + Zi.LAN.noacctaxttlcr + "" + returnfloat(noacctaxttlcr) + "  " + Zi.LAN.acctaxttlcr + "" + returnfloat(acctaxttlcr) + ""; } diff --git a/DSWeb/Areas/MvcShipping/Comm/DateTimeExtension.cs b/DSWeb/Areas/MvcShipping/Comm/DateTimeExtension.cs new file mode 100644 index 00000000..88ddbe4f --- /dev/null +++ b/DSWeb/Areas/MvcShipping/Comm/DateTimeExtension.cs @@ -0,0 +1,141 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DSWeb.MvcShipping.Comm +{ + + /// + /// datetime数据类型拓展 + /// + public static class DateTimeExtension + { + + /// + ///将一个时间转换为秒级时间戳 + /// + /// 时间 + /// + public static long ToTimeStampSeconds(this DateTime datetime) + { + return (long)Math.Round((datetime.ToUniversalTime() - new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero)).TotalSeconds); + } + + /// + ///将一个时间转换为毫秒级时间戳 + /// + /// + /// + public static long ToTimeStampMilliSeconds(this DateTime datetime) + { + + return (long)Math.Round((datetime.ToUniversalTime() - new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero)).TotalMilliseconds); + } + + /// + /// 获取标准时间戳 秒级 + /// + /// + /// + public static long ToTimeStamp(this DateTime datetime) + { return ToTimeStampSeconds(datetime); } + + /// + /// 将时间转换为时间字符串编码 yyyyMMddHHmmssffff + /// + /// + /// + public static string ToTimeStr(this DateTime datetime) + { + return datetime.ToString("yyyyMMddHHmmssffff"); + } + + /// + /// 判断时间是否大于1970年的有效时间 + /// + /// + /// + public static bool IsValidTime(this DateTime dateTime) + { + if (dateTime.Date >= DateTime.Parse("1970-1-1")) + return true; + else return false; + } + /// + /// 获时间一天中的开始时间 + /// + /// + public static DateTime GetDayStartTime(this DateTime dateTime) + { + return dateTime.Date; + } + /// + /// 获取时间一天的结束时间 + /// + /// + /// + + public static DateTime GetDateEndTime(this DateTime dateTime) + { + return dateTime.Date.AddDays(1).AddSeconds(-1); + } + + /// + /// 获取时间周的星期一的时间 + /// + /// + /// + public static DateTime GetWeekStartTime(this DateTime dateTime) + { + return dateTime.GetWeekOfDayTime(1); + } + + /// + /// 获取时间周的周日 + /// + /// + /// + public static DateTime GetWeekEndTime(this DateTime dateTime) + { + return dateTime.GetWeekOfDayTime(7); + } + + /// + /// 获取时间周的指定周几时间 + /// + /// + /// 周几 1 2 3 4 5 6 7 + /// + public static DateTime GetWeekOfDayTime(this DateTime dateTime, int Day) + { + if (Day < 1) + Day = 1; + if (Day > 7) + Day = (int)dateTime.DayOfWeek; + return dateTime.Subtract(new TimeSpan(dateTime.DayOfWeek - (DayOfWeek)Day, 0, 0, 0)).Date; + } + + /// + /// 获取时间月开始时间 + /// + /// + /// + public static DateTime GetMonthStartTime(this DateTime dateTime) + { + return new DateTime(dateTime.Year, dateTime.Month, 1).Date; + } + /// + /// 获取一个月的结束时间 + /// + /// + /// + public static DateTime GetMonthEndTime(this DateTime dateTime) + { + return dateTime.GetMonthStartTime().AddMonths(1).AddDays(-1); + + } + } + +} diff --git a/DSWeb/Areas/MvcShipping/Comm/Int32Extensions.cs b/DSWeb/Areas/MvcShipping/Comm/Int32Extensions.cs new file mode 100644 index 00000000..195ee335 --- /dev/null +++ b/DSWeb/Areas/MvcShipping/Comm/Int32Extensions.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DSWeb.MvcShipping.Comm +{ + /// + /// 扩展Int32功能 + /// + public static class Int32Extensions + { + /// + /// 向上整除 + /// 1.当num能被divideBy整除时,结果即为num/divideBy; + /// 2.当num不能被divideBy整除时,结果为num/divideBy + 1; + /// + /// 被除数,大于或者等于0 + /// 除数,大于0 + /// 向上整除结果 + public static int CeilingDivide(this int num, int divideBy) + { + if (num < 0 || divideBy <= 0) + { + return 0; + } + + return (num + divideBy - 1) / divideBy; + + } + /// + /// 向上整除 + /// 1.当num能被divideBy整除时,结果即为num/divideBy; + /// 2.当num不能被divideBy整除时,结果为num/divideBy + 1; + /// + /// 被除数,大于或者等于0 + /// 除数,大于0 + /// 向上整除结果 + public static long CeilingDivide(this long num, long divideBy) + { + if (num < 0 || divideBy <= 0) + { + return 0; + } + + return (num + divideBy - 1) / divideBy; + + } + + /// + /// 将List 转为间隔字符串 + /// + /// + public static string ListToString(this List strlist, char Split = ',') + { + StringBuilder str = new StringBuilder(); + foreach (var item in strlist) + { + str.Append(item.ToString() + Split); + } + return str.ToString(); + } + + /// + /// 拓展 将字符串抓换为int + /// + /// + /// + public static int StrToInt(this string str) + { + if (str.Isint()) + { return Convert.ToInt32(str); } + else + { + return 0; + } + } + /// + /// 拓展 将字符串数组转换成int 数组 + /// + /// + /// + public static int[] strToIntArray(this string[] str) + { + return Array.ConvertAll(str, new Converter(StrToInt)); + } + + } +} diff --git a/DSWeb/Areas/MvcShipping/Comm/StringExtension.cs b/DSWeb/Areas/MvcShipping/Comm/StringExtension.cs new file mode 100644 index 00000000..32b02425 --- /dev/null +++ b/DSWeb/Areas/MvcShipping/Comm/StringExtension.cs @@ -0,0 +1,479 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Newtonsoft.Json; +namespace DSWeb.MvcShipping.Comm +{ + /// + /// string 拓展 + /// + public static class StringExtension + { + + + /// + /// 隐藏中间字符串 + /// + /// + /// + public static string GetHideCentre(this string str) + { + if (str.Length > 8) + { + + return string.Format("{0}***{1}", str.Substring(0, 4), str.Substring(str.Length - 4, 4)); + } + else if (str.Length > 5) + { + return string.Format("{0}***{1}", str.Substring(0, 2), str.Substring(str.Length - 2, 2)); + + } + else if (str.Length > 4) + { + return string.Format("{0}***{1}", str.Substring(0, 1), str.Substring(str.Length - 1, 1)); + + } + else + { + return GetHideHead(str); + } + } + + /// + /// 隐藏头部 + /// + /// + /// + public static string GetHideHead(this string str) + { + var length = 1; + length = length > str.Length ? str.Length : length; + if (str.Length < 4) + { + length = 1; + if (str.Length == 1) + { + return str; + } + + return "**" + str.Substring(str.Length - length, length); + } + length = 4; + return "****" + str.Substring(str.Length - length, length); + + + } + + /// + /// 用于判断是否为空字符 + /// + /// + /// + public static bool IsNull(this string s) + { + return s == null || (s.Trim().Length == 0); + } + + /// + /// 用于判断是否为非空字符 + /// + /// + /// + public static bool IsNotNull(this string s) + { + return !s.IsNull(); + } + + #region 加密算法 + + + /// + /// DES对称加密字符串 + /// + /// 待加密的字符串 + /// 加密密钥,要求为16位 + /// 加密成功返回加密后的字符串,失败返回源串 + public static string DESEncrypt(this string encryptString, string key) + { + try + { + byte[] rgbKey = Encoding.UTF8.GetBytes(key); + //用于对称算法的初始化向量(默认值)。 + byte[] rgbIV = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; + byte[] inputByteArray = Encoding.UTF8.GetBytes(encryptString); + Aes dCSP = Aes.Create(); + + MemoryStream mStream = new MemoryStream(); + CryptoStream cStream = new CryptoStream(mStream, dCSP.CreateEncryptor(rgbKey, rgbIV), CryptoStreamMode.Write); + cStream.Write(inputByteArray, 0, inputByteArray.Length); + cStream.FlushFinalBlock(); + return Convert.ToBase64String(mStream.ToArray()); + } + catch (Exception ex) + { + throw ex; + } + } + + /// + /// DES对称解密字符串 + /// + /// 待解密的字符串 + /// 解密密钥,要求16位 + /// + public static string DESDecrypt(this string decryptString, string key) + { + try + { + //用于对称算法的初始化向量(默认值) + byte[] Keys = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; + byte[] rgbKey = Encoding.UTF8.GetBytes(key); + byte[] rgbIV = Keys; + byte[] inputByteArray = Convert.FromBase64String(decryptString); + Aes DCSP = Aes.Create(); + + MemoryStream mStream = new MemoryStream(); + CryptoStream cStream = new CryptoStream(mStream, DCSP.CreateDecryptor(rgbKey, rgbIV), CryptoStreamMode.Write); + cStream.Write(inputByteArray, 0, inputByteArray.Length); + cStream.FlushFinalBlock(); + return Encoding.UTF8.GetString(mStream.ToArray()); + } + catch + { + return decryptString; + } + } + + /// + /// 将字符串转换成MD5加密字符串 + /// + /// + /// + public static string ToMd5(this string orgStr) + { + using (var md5 = MD5.Create()) + { + var encoding = Encoding.UTF8; + var encryptedBytes = md5.ComputeHash(encoding.GetBytes(orgStr)); + var sb = new StringBuilder(32); + foreach (var bt in encryptedBytes) + { + sb.Append(bt.ToString("x").PadLeft(2, '0')); + } + return sb.ToString().ToLower(); + } + } + #endregion + /// + /// 获取扩展名 + /// + /// + /// + public static string GetExt(this string s) + { + var ret = string.Empty; + if (!s.Contains('.')) return ret; + var temp = s.Split('.'); + ret = temp[temp.Length - 1]; + + return ret; + } + /// + /// 验证QQ格式 + /// + /// + /// + public static bool IsQq(this string s) + { + return s.IsNull() || Regex.IsMatch(s, @"^[1-9]\d{4,15}$"); + } + + /// + /// 将字符串根据分隔符转换我List + /// + /// + /// 分隔符 + /// + public static List ToListString(this string str, char split) + { + return new List(str.Split(split)); + + } + + /// + /// 判断是否为有效的Email地址 + /// + /// + /// + public static bool IsEmail(this string s) + { + if (!s.IsNull()) + { + //return Regex.IsMatch(s, + // @"^(?("")("".+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))" + + // @"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$"); + const string pattern = @"^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$"; + return Regex.IsMatch(s, pattern); + } + return false; + } + /// + /// 判断是否是url + /// + /// + /// + public static bool IsUrl(this string s) + { + if (!s.IsNull()) + { + const string pattern = @"^(http://|https://)?((?:[A-Za-z0-9]+-[A-Za-z0-9]+|[A-Za-z0-9]+)\.)+([A-Za-z]+)[/\?\:]?.*$"; + return Regex.IsMatch(s, pattern); + } + return false; + } + + /// + /// 验证是否是合法的电话号码 + /// + /// + /// + public static bool IsPhone(this string s) + { + if (!s.IsNull()) + { + return Regex.IsMatch(s, @"^\+?((\d{2,4}(-)?)|(\(\d{2,4}\)))*(\d{0,16})*$"); + } + return true; + } + + /// + /// 验证是否是合法的手机号码 + /// + /// + /// + public static bool IsMobile(this string s) + { + if (!s.IsNull()) + { + return Regex.IsMatch(s, @"^\+?\d{0,4}?[1][3-8]\d{9}$"); + } + return false; + } + + /// + /// 验证是否是合法的邮编 + /// + /// + /// + public static bool IsZipCode(this string s) + { + if (!s.IsNull()) + { + return Regex.IsMatch(s, @"[1-9]\d{5}(?!\d)"); + } + return true; + } + + /// + /// 验证是否是合法的传真 + /// + /// + /// + public static bool IsFax(this string s) + { + if (!s.IsNull()) + { + return Regex.IsMatch(s, @"(^[0-9]{3,4}\-[0-9]{7,8}$)|(^[0-9]{7,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)"); + } + return true; + } + + /// + /// 检查字符串是否为有效的int数字 + /// + /// + /// + public static bool Isint(this string val) + { + if (IsNull(val)) + return false; + int k; + return int.TryParse(val, out k); + } + + /// + /// 字符串转数字,未转换成功返回0 + /// + /// + /// + public static int ToInt(this string val) + { + + if (IsNull(val)) + return 0; + int k; + return int.TryParse(val, out k) ? k : 0; + } + + /// + /// 将int间隔字符串抓换为list + /// + /// + /// + /// + public static List ToIntList(this string str, char Split = ',') + { + return str.Split(Split).strToIntArray().ToList(); + } + + /// + /// 判断是否是json字符串 + /// + /// + /// + public static bool IsJson(this string str) + { + try + { + if (str.IsNull()) + return false; + + JsonConvert.DeserializeObject(str); + return true; + } + catch + { + return false; + } + } + + /// + /// 检查字符串是否为有效的INT64数字 + /// + /// + /// + public static bool IsInt64(this string val) + { + if (IsNull(val)) + return false; + long k; + return long.TryParse(val, out k); + } + + /// + /// 验证是否是身份证 + /// + /// + /// + public static bool IsCardId(this string ID) + { + var r = false; + if (IsNull(ID)) + r = false; + if (ID.Length == 15) + { + + var date = $"19{ID.Substring(6, 2)}-{ID.Substring(8, 2)}-{ID.Substring(10, 2)}"; + DateTime dt; + return DateTime.TryParse(date, out dt); + } + else if (ID.Length == 18) + { + var date = $"{ID.Substring(6, 4)}-{ID.Substring(10, 2)}-{ID.Substring(12, 2)}"; + DateTime dt; + return DateTime.TryParse(date, out dt); + } + else { r = false; } + + return r; + } + + /// + /// 检查字符串是否为有效的double + /// + /// + /// + public static bool IsDecimal(this string val) + { + if (IsNull(val)) + return false; + double d; + return double.TryParse(val, out d); + } + + /// + ///检测字符串是否是时间类型 + /// + /// + /// + public static bool IsDateTime(this string val) + { + if (IsNull(val)) + return false; + DateTime d; + return DateTime.TryParse(val, out d); + } + /// + /// 字符串转时间 非时间返回空 + /// + /// + /// + public static DateTime? ToDateTime(this string val) + { + if (val.IsDateTime()) + { + return DateTime.Parse(val); + } + else + { + return null; + } + } + /// + /// 将时间类型字符转时间戳 + /// + /// + /// + public static long ToTimestamp(this string Val) + { + var time = Val.ToDateTime(); + return time != null ? ((DateTime)time).ToTimeStamp() : 0; + } + + /// + /// 从左边截取N个字符 + /// + /// + /// + public static string GetLeftStr(this string val, int count = 0) + { + if (count > val.Length) + return null; + + return val.Substring(0, count); + } + + /// + ///从右边截取N个字符 + /// + /// + /// + /// + public static string GetRightStr(this string val, int count = 0) + { + + if (count > val.Length) + return null; + + return val.Substring(val.Length - count, count); + + } + + + } +} diff --git a/DSWeb/Areas/MvcShipping/Controllers/MsCwVouchersGlSettlementController.cs b/DSWeb/Areas/MvcShipping/Controllers/MsCwVouchersGlSettlementController.cs index b8a4bd64..dc51c80c 100644 --- a/DSWeb/Areas/MvcShipping/Controllers/MsCwVouchersGlSettlementController.cs +++ b/DSWeb/Areas/MvcShipping/Controllers/MsCwVouchersGlSettlementController.cs @@ -58,7 +58,7 @@ namespace DSWeb.MvcShipping.Controllers { sortStr = sort.Replace("SETTLEMODEREF", "SETTLEMODE"); sortStr = sortStr.Replace("SETTLETYPEREF", "SETTLETYPE"); - sortStr = sortStr.Replace("ACCOUNTREF", "ACCOUNTRMB"); + sortStr = sortStr.Replace("ACCOUNTREF", "ACCOUNTRMB+ACCOUNTUSD"); sortStr = sortStr.Replace("SETTLEUSERREF", "SETTLEUSER"); } var dataList = MsCwVouchersGlSettlementDAL.GetDataList(start, limit,condition, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]), sortStr); diff --git a/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs b/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs index 99c5c81a..916d2a9d 100644 --- a/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs +++ b/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs @@ -3772,7 +3772,12 @@ namespace DSWeb.MvcShipping.Controllers result = MsOpSeaeEdiPortDAL.FtpFile2(filename, ftpset); else result = MsOpSeaeEdiPortDAL.FtpFile(filename, ftpset); - + if (ftpset.ISDJYKF && result.Success) { + foreach (var bill in headEdiList) + { + MsOpSeaeEdiPortDAL.DeductionFee(bill.MBLNO, "19"); + } + } var afilename = Path.GetFileName(filename); MsOpSeaeEdiPortDAL.InsertEdiLog(bsnos, type, filetype, "", ftpset.SERVERIP, afilename, "../../EDIFiles/SeaeEdi/" + afilename, Convert.ToString(Session["SHOWNAME"])); diff --git a/DSWeb/Areas/MvcShipping/DAL/MsCodeFtpSet/MsCodeFtpSetDAL.cs b/DSWeb/Areas/MvcShipping/DAL/MsCodeFtpSet/MsCodeFtpSetDAL.cs index 1d84a0eb..e9e8ea82 100644 --- a/DSWeb/Areas/MvcShipping/DAL/MsCodeFtpSet/MsCodeFtpSetDAL.cs +++ b/DSWeb/Areas/MvcShipping/DAL/MsCodeFtpSet/MsCodeFtpSetDAL.cs @@ -19,7 +19,7 @@ namespace DSWeb.MvcShipping.DAL.MsCodeFtpSet var strSql = new StringBuilder(); strSql.Append("SELECT "); - strSql.Append("GID,EDINAME,SERVERIP,FOLDERNAME,USERNAME,[PASSWORD],CORPID,SENDCODE,RECEIVEEMAIL,RECEIVESIEMAIL,SERVERIP2,FOLDERNAME2,USERNAME2,[PASSWORD2],ISSSL,SFTPPORT,"); + strSql.Append("GID,EDINAME,SERVERIP,FOLDERNAME,USERNAME,[PASSWORD],CORPID,SENDCODE,RECEIVEEMAIL,RECEIVESIEMAIL,SERVERIP2,FOLDERNAME2,USERNAME2,[PASSWORD2],ISSSL,SFTPPORT,ISDJYKF,"); strSql.Append("RECEIVECODE,SENDNAME,SENDATTN,SENDTEL,SENDEMAIL,RECEIVEOP,RECEIVESALE,RECEIVEDEPT,SENDCOMPANYCODE,SENDSUBCOMPANYCODE,CARRIERID,SHIPPERTEL,CONSIGNEETEL,NOTIFYPARTYTEL,ISUSETEL,ALIASSENDCODE,TMPFOLDERNAME,SFTPCERFILENAME "); strSql.Append(" from code_FtpSet where CORPID='"+companyid+"'"); @@ -98,7 +98,9 @@ namespace DSWeb.MvcShipping.DAL.MsCodeFtpSet data.TMPFOLDERNAME = Convert.ToString(reader["TMPFOLDERNAME"]); data.SFTPCERFILENAME = Convert.ToString(reader["SFTPCERFILENAME"]); if (reader["ISSSL"] != DBNull.Value) - data.ISSSL = Convert.ToBoolean(reader["ISSSL"]);//货主箱标志,是否自有箱 + data.ISSSL = Convert.ToBoolean(reader["ISSSL"]);//货主箱标志,是否自有箱 + if (reader["ISDJYKF"] != DBNull.Value) + data.ISDJYKF = Convert.ToBoolean(reader["ISDJYKF"]);//货主箱标志,是否自有箱 if (reader["SFTPPORT"] != DBNull.Value) data.SFTPPORT = Convert.ToString(reader["SFTPPORT"]); #endregion diff --git a/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs b/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs index 57b55e83..a14c6495 100644 --- a/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs +++ b/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs @@ -28,6 +28,7 @@ using DSWeb.Areas.Account.Models.BSNOLB; using DSWeb.MvcShipping.DAL.MsCodeYardDataSet; using DSWeb.MvcShipping.DAL.MsCodeCtnEdi; using System.Xml.Serialization; +using DSWeb.MvcShipping.Comm; namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL { @@ -48148,6 +48149,54 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL return result; } + public static bool DeductionFee(string _MBLNO, string bsType) + { + string KFCUSTCODE =MsSysParamSetDAL.GetData("PARAMNAME='KFCUSTCODE'").PARAMVALUE; + string KFCUSTKEY = MsSysParamSetDAL.GetData("PARAMNAME='KFCUSTKEY'").PARAMVALUE; + string KFUSERID = MsSysParamSetDAL.GetData("PARAMNAME='KFUSERID'").PARAMVALUE; + string KFURL = MsSysParamSetDAL.GetData("PARAMNAME='KFURL'").PARAMVALUE; + string _Guid= Guid.NewGuid().ToString(); + var seconds = DateTime.Now.ToTimeStamp(); + var runId = Guid.NewGuid().ToString(); + var srcBeforMD5 = $"{runId}{KFCUSTCODE}expend{bsType}0{_Guid}{_MBLNO}{seconds}{KFCUSTKEY}"; + //调用扣费接口 + var postObj = new + { + runId, + userId = KFCUSTCODE, + module = "expend",//固定 + bsType = bsType, + sendType = "0", + timestamp = seconds,//秒级时间戳 + md5 = srcBeforMD5.ToMd5(),// 加密字符串小写 RunId + UserId + Module + BsType + SendType+Timestamp+ Key + Data = new + { + BSNO = _Guid, + MBLNO = _MBLNO, + CtnrInfo = "", + CtnrCount = 1, + IsCredit = 1,//是否是信用支付 1 信用支付 0不允许信用支付默认值为0 + LURURENID = KFUSERID,///当前登录人id + SENDUSERID = KFUSERID + } + }; + var apiJson = JsonConvert.SerializeObject(postObj); +// log.Debug($"扣费上传数据:{apiJson}"); + var apiRtn = WebRequestHelper.DoPost(KFURL, apiJson); + //var jobjApiRtn = JObject.Parse(apiRtn); + //var code = Convert.ToInt32(jobjApiRtn.GetValue("code").ToString()); + //if (code == 200 || code == 450) + //{ + // return true; + //} + //else + //{ + // log.Debug($"扣费失败提醒,执行扣费失败!"); + + //} + return false; + + } public static DBResult SendToDJYDel(List headData, string companyid) { diff --git a/DSWeb/Areas/MvcShipping/Models/MsCodeFtp/FtpSet.cs b/DSWeb/Areas/MvcShipping/Models/MsCodeFtp/FtpSet.cs index 5b6a58ac..72c02854 100644 --- a/DSWeb/Areas/MvcShipping/Models/MsCodeFtp/FtpSet.cs +++ b/DSWeb/Areas/MvcShipping/Models/MsCodeFtp/FtpSet.cs @@ -266,6 +266,13 @@ namespace DSWeb.MvcShipping.Models.FtpSet get { return _ISSSL; } set { _ISSSL = value; } } + private bool _ISDJYKF = false; + [ModelDB] + public bool ISDJYKF + { + get { return _ISDJYKF; } + set { _ISDJYKF = value; } + } private string _SFTPPORT ="22"; [ModelDB] public string SFTPPORT diff --git a/DSWeb/Areas/MvcShipping/Views/MsRptOpProfitCompare/YearIndex.aspx b/DSWeb/Areas/MvcShipping/Views/MsRptOpProfitCompare/YearIndex.aspx index 949b747e..13d88e2f 100644 --- a/DSWeb/Areas/MvcShipping/Views/MsRptOpProfitCompare/YearIndex.aspx +++ b/DSWeb/Areas/MvcShipping/Views/MsRptOpProfitCompare/YearIndex.aspx @@ -21,7 +21,7 @@ - +