DS7_JinGang
hanxuntao 1 year ago
parent 32564a977d
commit fd7c9de4bf

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />
<IISExpressSSLPort />

@ -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 + ")";

@ -4736,7 +4736,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
{
if (str == "")
{
str = " COMPANYID='" + companyid + "' ";
str = "(COMPANYID='" + companyid + "' ";
}
else
{

@ -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 == "")

@ -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 + ")";

@ -4222,7 +4222,7 @@ Ext.extend(Shipping.MsChfeeAudit, Ext.Panel, {
if (ttlprofit < 0) feecolor = 'red';
ttllb = "&nbsp&nbsp&nbsp" + Zi.LAN.ReceivableSum + ": <font color='" + feecolor + "'>" + returnfloat(ttldr) + "</font> &nbsp&nbsp" + Zi.LAN.profitSum + ":<font color='" + feecolor + "'>" + returnfloat(ttlcr) + "</font> &nbsp&nbsp" + Zi.LAN.Hejiprofit + "<font color='" + feecolor + "'>" + returnfloat(ttlprofit) + "</font>&nbsp&nbsp" + Zi.LAN.ProfitMargins + "<font color='" + feecolor + "'>" + returnfloat(profitrate) + "</font>";
ttllb = ttllb + "&nbsp&nbsp" + Zi.LAN.noacctaxttldr + ": <font color='" + feecolor + "'>" + returnfloat(noacctaxttldr) + "</font> &nbsp&nbsp" + Zi.LAN.acctaxttldr + ":<font color='" + feecolor + "'>" + returnfloat(acctaxttldr) + "</font> &nbsp&nbsp" + Zi.LAN.noacctaxttlcr + "<font color='" + feecolor + "'>" + returnfloat(noacctaxttlcr) + "</font>&nbsp&nbsp" + Zi.LAN.acctaxttlcr + "<font color='" + feecolor + "'>" + returnfloat(acctaxttlcr) + "</font>";
// ttllb = ttllb + "&nbsp&nbsp" + Zi.LAN.noacctaxttldr + ": <font color='" + feecolor + "'>" + returnfloat(noacctaxttldr) + "</font> &nbsp&nbsp" + Zi.LAN.acctaxttldr + ":<font color='" + feecolor + "'>" + returnfloat(acctaxttldr) + "</font> &nbsp&nbsp" + Zi.LAN.noacctaxttlcr + "<font color='" + feecolor + "'>" + returnfloat(noacctaxttlcr) + "</font>&nbsp&nbsp" + Zi.LAN.acctaxttlcr + "<font color='" + feecolor + "'>" + returnfloat(acctaxttlcr) + "</font>";
}

@ -0,0 +1,141 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DSWeb.MvcShipping.Comm
{
/// <summary>
/// datetime数据类型拓展
/// </summary>
public static class DateTimeExtension
{
/// <summary>
///将一个时间转换为秒级时间戳
/// </summary>
/// <param name="datetime">时间</param>
/// <returns></returns>
public static long ToTimeStampSeconds(this DateTime datetime)
{
return (long)Math.Round((datetime.ToUniversalTime() - new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero)).TotalSeconds);
}
/// <summary>
///将一个时间转换为毫秒级时间戳
/// </summary>
/// <param name="datetime"></param>
/// <returns></returns>
public static long ToTimeStampMilliSeconds(this DateTime datetime)
{
return (long)Math.Round((datetime.ToUniversalTime() - new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero)).TotalMilliseconds);
}
/// <summary>
/// 获取标准时间戳 秒级
/// </summary>
/// <param name="datetime"></param>
/// <returns></returns>
public static long ToTimeStamp(this DateTime datetime)
{ return ToTimeStampSeconds(datetime); }
/// <summary>
/// 将时间转换为时间字符串编码 yyyyMMddHHmmssffff
/// </summary>
/// <param name="datetime"></param>
/// <returns></returns>
public static string ToTimeStr(this DateTime datetime)
{
return datetime.ToString("yyyyMMddHHmmssffff");
}
/// <summary>
/// 判断时间是否大于1970年的有效时间
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static bool IsValidTime(this DateTime dateTime)
{
if (dateTime.Date >= DateTime.Parse("1970-1-1"))
return true;
else return false;
}
/// <summary>
/// 获时间一天中的开始时间
/// </summary>
/// <param name="dateTime"></param>
public static DateTime GetDayStartTime(this DateTime dateTime)
{
return dateTime.Date;
}
/// <summary>
/// 获取时间一天的结束时间
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static DateTime GetDateEndTime(this DateTime dateTime)
{
return dateTime.Date.AddDays(1).AddSeconds(-1);
}
/// <summary>
/// 获取时间周的星期一的时间
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static DateTime GetWeekStartTime(this DateTime dateTime)
{
return dateTime.GetWeekOfDayTime(1);
}
/// <summary>
/// 获取时间周的周日
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static DateTime GetWeekEndTime(this DateTime dateTime)
{
return dateTime.GetWeekOfDayTime(7);
}
/// <summary>
/// 获取时间周的指定周几时间
/// </summary>
/// <param name="dateTime"></param>
/// <param name="Day">周几 1 2 3 4 5 6 7</param>
/// <returns></returns>
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;
}
/// <summary>
/// 获取时间月开始时间
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static DateTime GetMonthStartTime(this DateTime dateTime)
{
return new DateTime(dateTime.Year, dateTime.Month, 1).Date;
}
/// <summary>
/// 获取一个月的结束时间
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static DateTime GetMonthEndTime(this DateTime dateTime)
{
return dateTime.GetMonthStartTime().AddMonths(1).AddDays(-1);
}
}
}

@ -0,0 +1,90 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DSWeb.MvcShipping.Comm
{
/// <summary>
/// 扩展Int32功能
/// </summary>
public static class Int32Extensions
{
/// <summary>
/// 向上整除
/// 1.当num能被divideBy整除时,结果即为num/divideBy;
/// 2.当num不能被divideBy整除时,结果为num/divideBy + 1;
/// </summary>
/// <param name="num">被除数,大于或者等于0</param>
/// <param name="divideBy">除数,大于0</param>
/// <returns>向上整除结果</returns>
public static int CeilingDivide(this int num, int divideBy)
{
if (num < 0 || divideBy <= 0)
{
return 0;
}
return (num + divideBy - 1) / divideBy;
}
/// <summary>
/// 向上整除
/// 1.当num能被divideBy整除时,结果即为num/divideBy;
/// 2.当num不能被divideBy整除时,结果为num/divideBy + 1;
/// </summary>
/// <param name="num">被除数,大于或者等于0</param>
/// <param name="divideBy">除数,大于0</param>
/// <returns>向上整除结果</returns>
public static long CeilingDivide(this long num, long divideBy)
{
if (num < 0 || divideBy <= 0)
{
return 0;
}
return (num + divideBy - 1) / divideBy;
}
/// <summary>
/// 将List<int> 转为间隔字符串
/// </summary>
/// <param name="strlist"></param>
public static string ListToString(this List<int> strlist, char Split = ',')
{
StringBuilder str = new StringBuilder();
foreach (var item in strlist)
{
str.Append(item.ToString() + Split);
}
return str.ToString();
}
/// <summary>
/// 拓展 将字符串抓换为int
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static int StrToInt(this string str)
{
if (str.Isint())
{ return Convert.ToInt32(str); }
else
{
return 0;
}
}
/// <summary>
/// 拓展 将字符串数组转换成int 数组
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static int[] strToIntArray(this string[] str)
{
return Array.ConvertAll(str, new Converter<string, int>(StrToInt));
}
}
}

@ -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
{
/// <summary>
/// string 拓展
/// </summary>
public static class StringExtension
{
/// <summary>
/// 隐藏中间字符串
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
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);
}
}
/// <summary>
/// 隐藏头部
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
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);
}
/// <summary>
/// 用于判断是否为空字符
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static bool IsNull(this string s)
{
return s == null || (s.Trim().Length == 0);
}
/// <summary>
/// 用于判断是否为非空字符
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static bool IsNotNull(this string s)
{
return !s.IsNull();
}
#region 加密算法
/// <summary>
/// DES对称加密字符串
/// </summary>
/// <param name="encryptString">待加密的字符串</param>
/// <param name="key">加密密钥,要求为16位</param>
/// <returns>加密成功返回加密后的字符串,失败返回源串</returns>
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;
}
}
/// <summary>
/// DES对称解密字符串
/// </summary>
/// <param name="decryptString">待解密的字符串</param>
/// <param name="key">解密密钥要求16位</param>
/// <returns></returns>
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;
}
}
/// <summary>
/// 将字符串转换成MD5加密字符串
/// </summary>
/// <param name="orgStr"></param>
/// <returns></returns>
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
/// <summary>
/// 获取扩展名
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
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;
}
/// <summary>
/// 验证QQ格式
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static bool IsQq(this string s)
{
return s.IsNull() || Regex.IsMatch(s, @"^[1-9]\d{4,15}$");
}
/// <summary>
/// 将字符串根据分隔符转换我List<string>
/// </summary>
/// <param name="str"></param>
/// <param name="split">分隔符</param>
/// <returns></returns>
public static List<string> ToListString(this string str, char split)
{
return new List<string>(str.Split(split));
}
/// <summary>
/// 判断是否为有效的Email地址
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
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;
}
/// <summary>
/// 判断是否是url
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
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;
}
/// <summary>
/// 验证是否是合法的电话号码
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
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;
}
/// <summary>
/// 验证是否是合法的手机号码
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static bool IsMobile(this string s)
{
if (!s.IsNull())
{
return Regex.IsMatch(s, @"^\+?\d{0,4}?[1][3-8]\d{9}$");
}
return false;
}
/// <summary>
/// 验证是否是合法的邮编
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static bool IsZipCode(this string s)
{
if (!s.IsNull())
{
return Regex.IsMatch(s, @"[1-9]\d{5}(?!\d)");
}
return true;
}
/// <summary>
/// 验证是否是合法的传真
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
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;
}
/// <summary>
/// 检查字符串是否为有效的int数字
/// </summary>
/// <param name="val"></param>
/// <returns></returns>
public static bool Isint(this string val)
{
if (IsNull(val))
return false;
int k;
return int.TryParse(val, out k);
}
/// <summary>
/// 字符串转数字未转换成功返回0
/// </summary>
/// <param name="val"></param>
/// <returns></returns>
public static int ToInt(this string val)
{
if (IsNull(val))
return 0;
int k;
return int.TryParse(val, out k) ? k : 0;
}
/// <summary>
/// 将int间隔字符串抓换为list<int>
/// </summary>
/// <param name="str"></param>
/// <param name="Split"></param>
/// <returns></returns>
public static List<int> ToIntList(this string str, char Split = ',')
{
return str.Split(Split).strToIntArray().ToList();
}
/// <summary>
/// 判断是否是json字符串
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static bool IsJson(this string str)
{
try
{
if (str.IsNull())
return false;
JsonConvert.DeserializeObject(str);
return true;
}
catch
{
return false;
}
}
/// <summary>
/// 检查字符串是否为有效的INT64数字
/// </summary>
/// <param name="val"></param>
/// <returns></returns>
public static bool IsInt64(this string val)
{
if (IsNull(val))
return false;
long k;
return long.TryParse(val, out k);
}
/// <summary>
/// 验证是否是身份证
/// </summary>
/// <param name="ID"></param>
/// <returns></returns>
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;
}
/// <summary>
/// 检查字符串是否为有效的double
/// </summary>
/// <param name="val"></param>
/// <returns></returns>
public static bool IsDecimal(this string val)
{
if (IsNull(val))
return false;
double d;
return double.TryParse(val, out d);
}
/// <summary>
///检测字符串是否是时间类型
/// </summary>
/// <param name="val"></param>
/// <returns></returns>
public static bool IsDateTime(this string val)
{
if (IsNull(val))
return false;
DateTime d;
return DateTime.TryParse(val, out d);
}
/// <summary>
/// 字符串转时间 非时间返回空
/// </summary>
/// <param name="val"></param>
/// <returns></returns>
public static DateTime? ToDateTime(this string val)
{
if (val.IsDateTime())
{
return DateTime.Parse(val);
}
else
{
return null;
}
}
/// <summary>
/// 将时间类型字符转时间戳
/// </summary>
/// <param name="Val"></param>
/// <returns></returns>
public static long ToTimestamp(this string Val)
{
var time = Val.ToDateTime();
return time != null ? ((DateTime)time).ToTimeStamp() : 0;
}
/// <summary>
/// 从左边截取N个字符
/// </summary>
/// <param name="val"></param>
/// <returns></returns>
public static string GetLeftStr(this string val, int count = 0)
{
if (count > val.Length)
return null;
return val.Substring(0, count);
}
/// <summary>
///从右边截取N个字符
/// </summary>
/// <param name="val"></param>
/// <param name="count"></param>
/// <returns></returns>
public static string GetRightStr(this string val, int count = 0)
{
if (count > val.Length)
return null;
return val.Substring(val.Length - count, count);
}
}
}

@ -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);

@ -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"]));

@ -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

@ -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<BSNOLB> headData, string companyid)
{

@ -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

@ -21,7 +21,7 @@
<script type="text/javascript" src="../../../../Areas/MvcShipping/Viewsjs/Comm/MonthField.js"></script>
<script type="text/javascript" src="../../../../Areas/MvcShipping/Viewsjs/MsRptOpProfitCompare/MsRptOpProfitYearCompareIndex.js"></script>
<script type="text/javascript" src="../../../../Areas/MvcShipping/Viewsjs/Comm/DsQuery.js"></script>
<script type="text/javascript">
Ext.onReady(function () {
Ext.QuickTips.init();

@ -630,7 +630,7 @@ Ext.extend(Shipping.FeeEditGrid, Ext.Panel, {
} else if (value == '仓库') {
return Zi.LAN.FEE.CANGKU;
} else {
return "";
return value;
}
}
}, {
@ -1876,7 +1876,7 @@ Ext.extend(Shipping.FeeEditGrid, Ext.Panel, {
} else if (value == '仓库') {
return Zi.LAN.FEE.CANGKU;
} else {
return "";
return value;
}
}
}, {
@ -6258,7 +6258,7 @@ Ext.extend(Shipping.FeeEditGrid, Ext.Panel, {
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='FEESAVENOTSAMEAMOUNT'"
condition: "PARAMNAME='FEENOTPILIANGEDIT'"
},
callback: function (options, success, response) {
if (success) {

@ -216,6 +216,12 @@ Ext.extend(Shipping.MsCodeFtpSetEdit, Ext.Panel, {
}, {
fieldLabel: 'SFTP认证文件',
name: 'SFTPCERFILENAME'
}, {
fieldLabel: '是否大简云下货纸扣费', //'是否SOC',
labelWidth: 120,
inputValue: true,
xtype: 'checkboxfield',
name: 'ISDJYKF'
}
]
}

@ -31,6 +31,7 @@
{ name: 'USERNAME2', type: 'string' },
{ name: 'PASSWORD2', type: 'string' },
{ name: 'ISSSL', type: 'bool' },
{ name: 'ISDJYKF', type: 'bool' },
{ name: 'SFTPPORT', type: 'string' },
{ name: 'ISUSETEL', type: 'string' },
{ name: 'TMPFOLDERNAME', type: 'string' },

@ -599,7 +599,23 @@ Ext.extend(Shipping.MsRptOpProfitYearCompareIndex, Ext.Panel, {
},
scope: this
}, '-', this.SearchBtn, {
}, '-', {
xtype: 'button',
text: "高级查询",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
var winAccess = new Shipping.DsQuery({
});
winAccess.StoreList = this.storeList;
winAccess.formname = this.formname;
winAccess.condition = sql;
winAccess.show();
return;
},
scope: this
}, this.SearchBtn, {
xtype: 'button',
width: 90,
text: "清空条件",
@ -923,6 +939,49 @@ Ext.extend(Shipping.MsRptOpProfitYearCompareIndex, Ext.Panel, {
// });
},
onDsQuery: function (button, event) {
if (!this.checkSearchCondition())
return;
this.isquery = true;
var form = this.formSearch.getForm();
var rdOBJNUM = Ext.getCmp('rdOBJNUM');
var OBJNUM = rdOBJNUM.getValue();
var form = this.formSearch.getForm();
var expDate_Min = form.findField('FrmYear').getValue();
var expDate_Max = form.findField('ToYear').getValue();
if (expDate_Min == '' || expDate_Min == null || expDate_Min == undefined) {
Ext.Msg.alert('提示', '开始年度不能为空!');
return;
}
if (expDate_Max == '' || expDate_Max == null || expDate_Max == undefined) {
Ext.Msg.alert('提示', '结束年度不能为空!');
return;
}
var rdOBJNUM = Ext.getCmp('rdOBJNUM');
var OBJNAME = form.findField('COMTYPE').getValue();
var OBJNUM = rdOBJNUM.getValue();
var sql = this.sqlcontext;
this.InitGrid(sql, OBJNAME, OBJNUM, expDate_Min, expDate_Max);
// this.storeList.load({
// params: { start: 0, limit: this.PageSize, condition: sql, sumfieldtype: OBJNUM, startmonth: expDate_Min, endmonth: expDate_Max },
// waitMsg: "正在查询数据...",
// scope: this
// });
},
getCondition: function () {
var form = this.formSearch.getForm();
var sql = '';

@ -7620,8 +7620,11 @@
<Compile Include="Areas\MvcContainer\Controllers\MsOpCtnrController.cs" />
<Compile Include="Areas\MvcContainer\DAL\MsOpCtnr\MsOpCtnrDAL.cs" />
<Compile Include="Areas\MvcContainer\Models\MsOpCtnr\MsOpCtnr.cs" />
<Compile Include="Areas\MvcShipping\Comm\DateTimeExtension.cs" />
<Compile Include="Areas\MvcShipping\Comm\DsSendMail.cs" />
<Compile Include="Areas\MvcShipping\Comm\Int32Extensions.cs" />
<Compile Include="Areas\MvcShipping\Comm\MailBodyEntity.cs" />
<Compile Include="Areas\MvcShipping\Comm\StringExtension.cs" />
<Compile Include="Areas\MvcShipping\Controllers\BookingConfirmController.cs" />
<Compile Include="Areas\MvcShipping\Controllers\MsChFeeAgentDcController.cs" />
<Compile Include="Areas\MvcShipping\Controllers\BillCheckOutController.cs" />

@ -4,7 +4,7 @@
<ProjectView>ShowAllFiles</ProjectView>
<NameOfLastUsedPublishProfile>配置文件1</NameOfLastUsedPublishProfile>
<UseIISExpress>true</UseIISExpress>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<Use64BitIISExpress />
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />
<IISExpressSSLPort />

@ -67,7 +67,9 @@
<ItemGroup>
<Compile Include="DateTimeExtension.cs" />
<Compile Include="Helpers.cs" />
<Compile Include="JobDjyD7Xf.cs" />
<Compile Include="JobDjyD6Xf.cs" />
<Compile Include="JobYt2D6Fee.cs" />
<Compile Include="JobGetMhData.cs" />
<Compile Include="JobD7CreateFee.cs" />
<Compile Include="JobD7BcEdiReply.cs" />

@ -87,7 +87,7 @@ namespace JobCreateFee
if (returndata.price == "" || returndata.price == null) returndata.price = "0";
if (returndata.ctnrCount == "" || returndata.ctnrCount == null) returndata.ctnrCount = "0";
var feecustname = CustName;
if (COSCOAUTOCREATEFEE == "1"&& returndata.forwarder=="中远海运") {
if (COSCOAUTOCREATEFEE == "1"&& returndata.forwarder=="中远海运"&& (Convert.ToDecimal(returndata.price) == 0)) {
if (Convert.ToDecimal(returndata.price) == 0) returndata.price = "30";
feecustname = CoscoCustName;
}

@ -0,0 +1,190 @@
using log4net;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Quartz;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
namespace JobCreateFee
{
public class JobDjyD7Xf : IJob
{
private ILog log = LogManager.GetLogger(typeof(JobDjyD7Xf));
private const string CfgFileName = "starttime.cfg";
private static string CfgFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, CfgFileName);
public void Execute(IJobExecutionContext context)
{
log.Debug($"Execute开始");
try
{
string connStr = context.JobDetail.JobDataMap.GetString("ConnectString");
string reqUrl = context.JobDetail.JobDataMap.GetString("DjyReqUrl");
string companyCode = context.JobDetail.JobDataMap.GetString("DjyCompanyCode");
string companyName = context.JobDetail.JobDataMap.GetString("DjyCompanyName");
string FeeName = context.JobDetail.JobDataMap.GetString("FeeName");
string CustName = context.JobDetail.JobDataMap.GetString("CustName");
string companySecret = context.JobDetail.JobDataMap.GetString("DjyCompanySecret");
string bsType = context.JobDetail.JobDataMap.GetString("DjybsType");
string COSCOAUTOCREATEFEE = context.JobDetail.JobDataMap.GetString("COSCOAUTOCREATEFEE");
string CoscoCustName = context.JobDetail.JobDataMap.GetString("COSCOCustName");
string ENTEROPERATOR = context.JobDetail.JobDataMap.GetString("ENTEROPERATOR");
int reqTimeout = Convert.ToInt32(context.JobDetail.JobDataMap.GetString("RequestTimeout"));
long ts = DataTableToJsonHelper.ConvertDateTimeToInt(DateTime.Now);
JsonD6XFSend reqObj = new JsonD6XFSend();
var runid = Guid.NewGuid().ToString();
reqObj.runid = runid;
reqObj.userId = companyCode;
reqObj.module = "expendlist";
reqObj.bsType = bsType;
reqObj.sendType = "0";
reqObj.timestamp = ts;
var md5str = DataTableToJsonHelper.MD5Encrypt32(runid + companyCode + "expendlist" + bsType + "0" + ts.ToString() + companySecret);
reqObj.md5 = md5str;
//JArray jarrTemps = new JArray();
JsonD6XFData jobjTemp = new JsonD6XFData();
jobjTemp.page = 1;
jobjTemp.limit = 10000;
jobjTemp.BsType =Convert.ToInt16(bsType);
jobjTemp.Name = companyName;
var starttimestr = File.ReadAllText(CfgFilePath);
if (!string.IsNullOrEmpty(starttimestr)) {
long startts = DataTableToJsonHelper.ConvertDateTimeToInt(Convert.ToDateTime(starttimestr));
jobjTemp.starttime = startts;
}
var endtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
long endts = DataTableToJsonHelper.ConvertDateTimeToInt(Convert.ToDateTime(endtime));
jobjTemp.endtime = endts;
reqObj.data = jobjTemp;
var sendstr = JsonConvert.SerializeObject(reqObj);
log.Debug($"发送包:{sendstr}");
//发送请求数据
string rtn = WebRequestHelper.DoPost(reqUrl, sendstr, reqTimeout * 1000);
//var objRtn = JsonConvert.DeserializeAnonymousType(rtn, new { status = "", message = "" });
log.Debug($"数据返回:{rtn}");
var parseJsonObj = JsonConvert.DeserializeObject<JsonXFResponse>(rtn);
if (parseJsonObj.status)
{
var returnlist = parseJsonObj.data;
try
{
using (SqlConnection dbcon = new SqlConnection(connStr))
{
dbcon.Open();
foreach (var returndata in returnlist)
{
var BS = GETBSNO(returndata.mblno, dbcon);
if (returndata.price == "" || returndata.price == null) returndata.price = "0";
if (returndata.ctnrCount == "" || returndata.ctnrCount == null) returndata.ctnrCount = "0";
var feecustname = CustName;
if (COSCOAUTOCREATEFEE == "1"&& returndata.forwarder=="中远海运"&& (Convert.ToDecimal(returndata.price) == 0)) {
if (Convert.ToDecimal(returndata.price) == 0) returndata.price = "30";
feecustname = CoscoCustName;
}
string sql = " if (select GID from t_op_txxp_log where GID='" + returndata.gid + "') is null INSERT INTO t_op_txxp_log([编号],[GID],[beizhu],[mblno],[bsstatus],[bstype],[createtime]";
sql = sql + ",[price],[sendtype],[ctnrCount],[ctnrInfo]) values ('" + BS.BSNO + "','" + returndata.gid + "'";
sql = sql + ",'" + returndata.beizhu + "','" + returndata.mblno + "','" + returndata.bsstatus + "','" + returndata.bstype + "','" + returndata.createtime + "'";
sql = sql + "," + returndata.price + ",'" + returndata.sendtype + "'," + returndata.ctnrCount + ",'" + returndata.ctnrInfo + "')";
SqlCommand cmd = new SqlCommand(sql, dbcon);
cmd.ExecuteNonQuery();
if (!string.IsNullOrEmpty(BS.BSNO) && BS.FEESTATUS != "1" && BS.BSSTATUS != "1")
{
if (Convert.ToDecimal(returndata.price) != 0 && !string.IsNullOrEmpty(feecustname) && !string.IsNullOrEmpty(FeeName))
{
sql = "INSERT INTO ch_fee(GID, BSNO, FEETYPE, FEENAME,CUSTOMERTYPE, CUSTOMERNAME, UNIT, UNITPRICE, QUANTITY, AMOUNT, CURRENCY,";
sql = sql + "EXCHANGERATE, REASON, REMARK, COMMISSIONRATE,ENTEROPERATOR, ENTERDATE,ISOPEN, ISADVANCEDPAY, SORT, FEESTATUS, FEEFRT,CARGO_GID,";
sql = sql + "TAXRATE,NOTAXAMOUNT,ACCTAXRATE,LINENUM,TAXUNITPRICE,MODIFIEDUSER,MODIFIEDTIME,WMSOUTBSNO,PREAMOUNT,ISINVOICE,INPUTMODE,LOCALCURR,MANAGER,ISACC,FEEDESCRIPTION,DELIVERYNO,SETTLEMENT,INVOICE,ORDERAMOUNT,ORDERINVOICE,ORDERSETTLEMENT,ORDERINVSETTLEMENT)";
sql = sql + "VALUES ";
sql = sql + "('" + Guid.NewGuid().ToString() + "','" + BS.BSNO + "',2,'" + FeeName + "','','" + feecustname + "','票'";
sql = sql + "," + returndata.price + ",1," + returndata.price + ",'RMB',1,'','',0";
sql = sql + ",'" + ENTEROPERATOR + "',GETDATE(),0,0,10,1,'',''";
sql = sql + ",0," + returndata.price + ",0,0," + returndata.price + ",'" + ENTEROPERATOR + "',GETDATE(),'',0,0,'大简云消费记录','RMB','',0,''";
sql = sql + ",'"+ returndata.gid + "',0,0,0,0,0,0)";
log.Debug($"{returndata.mblno},-费用语句-{sql}");
//dbcon.Open();
SqlCommand cmd2 = new SqlCommand(sql, dbcon);
cmd2.ExecuteNonQuery();
//dbcon.Close();
}
}
}
dbcon.Close();
}
}
catch (Exception e) {
log.Debug($"记录插入错误:{e.Message}");
}
File.WriteAllText(CfgFilePath, endtime);
}
else {
log.Debug($"数据返回错误:{parseJsonObj.message}");
}
}
catch (Exception ex)
{
log.Error(ex.Message);
log.Error(ex.StackTrace);
}
}
public static int SaveMail(SqlConnection dbcon, string sendto, string title, string body, string smtpid)
{
var sqlstr = $" INSERT INTO [Mail_Send] ([GID],[SendTo],[Title],[Body],[SendStatus],[TryCount],[CreateTime],[SmtpConfig],[Sender],[ShowName]) select newid(),'{sendto}','{title}','{body.Replace("'", "''")}','Create',0,GETDATE(),'{smtpid}','','' ";
SqlCommand cmd = new SqlCommand(sqlstr, dbcon);
return cmd.ExecuteNonQuery();
}
static public OPSEAE GETBSNO(string MBLNO, SqlConnection dbcon)
{
var OPSEAE = new OPSEAE();
var strSql = new StringBuilder();
strSql.Append("SELECT BSNO,FEESTATUS,BSSTATUS from op_seae where MBLNO='" + MBLNO + "'");
SqlDataAdapter adapter = new SqlDataAdapter(strSql.ToString(), dbcon);
DataTable table = new DataTable();
adapter.Fill(table);
var BSNO = "";
if (table.Rows.Count > 0)
{
foreach (DataRow row in table.Rows)
{
OPSEAE.BSNO = row["BSNO"].ToString();
OPSEAE.FEESTATUS = row["FEESTATUS"].ToString();
OPSEAE.BSSTATUS = row["BSSTATUS"].ToString();
}
}
return OPSEAE;
}
}
}

@ -0,0 +1,283 @@
using log4net;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Quartz;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
namespace JobCreateFee
{
public class JobYtD6Fee : IJob
{
private ILog log = LogManager.GetLogger(typeof(JobYtD6Fee));
//private const string CfgFileName = "starttime.cfg";
//private static string CfgFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, CfgFileName);
public void Execute(IJobExecutionContext context)
{
log.Debug($"Execute开始");
try
{
string connStr = context.JobDetail.JobDataMap.GetString("ConnectString");
string reqUrl = context.JobDetail.JobDataMap.GetString("YTReqUrl");
string YTUserName = context.JobDetail.JobDataMap.GetString("YTUserName");
string YTPassWord = context.JobDetail.JobDataMap.GetString("YTPassWord");
string CustName = context.JobDetail.JobDataMap.GetString("CustName");
string CustPsw = context.JobDetail.JobDataMap.GetString("CustPsw");
int reqTimeout = Convert.ToInt32(context.JobDetail.JobDataMap.GetString("RequestTimeout"));
var yesterday = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
JsonYtSend reqObj = new JsonYtSend();
reqObj.custname = CustName;
reqObj.custpsw= CustPsw;
reqObj.username = YTUserName;
reqObj.password = YTPassWord;
reqObj.start_time = yesterday;
reqObj.end_time= yesterday;
var sendstr = JsonConvert.SerializeObject(reqObj);
log.Debug($"发送包:{sendstr}");
//发送请求数据
string rtn = WebRequestHelper.DoPost(reqUrl, sendstr, reqTimeout * 1000);
log.Debug($"数据返回:{rtn}");
var objRtn = JsonConvert.DeserializeAnonymousType(rtn, new { status = "", message = "" });
if (objRtn.status == "1")
{
var parseJsonObj = JsonConvert.DeserializeObject<List<JsonYtFee>>(objRtn.message);
try
{
using (SqlConnection dbcon = new SqlConnection(connStr))
{
dbcon.Open();
foreach (var returndata in parseJsonObj)
{
if (returndata.fee == "" || returndata.fee == null) returndata.fee = "0";
if (returndata.ydFee == "" || returndata.ydFee == null) returndata.ydFee = "0";
if (returndata.secondPrintFee == "" || returndata.secondPrintFee == null) returndata.secondPrintFee = "0";
var D6BS = GETD6BS(returndata.bookingno, dbcon);
string sql = " INSERT INTO t_op_ytfee_log([bsno],[vessel],[voyage],[bookingno],[ctn_type],[ctn_no],[yard],[operatetime],[operatetype]";
sql = sql + ",[printType],[fee],[ydFee],[secondPrintFee],[applicant_code]) values ('" + D6BS.BSNO + "','" + returndata.vessel + "'";
sql = sql + ",'" + returndata.voyage + "','" + returndata.bookingno + "','" + returndata.ctn_type + "','" + returndata.ctn_no + "','" + returndata.yard + "'";
sql = sql + "," + returndata.operatetime + ",'" + returndata.operatetype + "'," + returndata.printType + ",'" + returndata.fee
+ "','" + returndata.ydFee + "','" + returndata.secondPrintFee + "','" + returndata.applicant_code + "')";
SqlCommand cmd = new SqlCommand(sql, dbcon);
cmd.ExecuteNonQuery();
if (!string.IsNullOrEmpty(D6BS.BSNO)) {
if (Convert.ToDecimal(returndata.fee) != 0)
{
string Feesql = "INSERT INTO [t_ch_fee] ([类型],[费用状态],[编号],[费用名称],[结算单位],[客户名称],[标准]";
Feesql = Feesql + ",[单价],[数量],[金额],[币别],[汇率],[备注],[结算金额],[开票金额]";
Feesql = Feesql + ",[录入人],[录入日期],[是否对帐],[顺序],[冲抵金额]";
Feesql = Feesql + ",[机密],[是否垫付],[申请金额],[不开发票],[费用英文名称]";
Feesql = Feesql + ",[申请开票],[提交],[不含税价],[税率],[税额],PROJECTFEEID) VALUES ";
Feesql = Feesql + "('收','审核通过','" + D6BS.BSNO + "','提箱小票费','委托单位','" + D6BS.CUSTOMERNAME + "','单票'";
Feesql = Feesql + ",5,1,5,'RMB',1,'',0,0";
Feesql = Feesql + ",'DEMO-SA',GETDATE(),0,100,0";
Feesql = Feesql + ",0,0,0,0,''";
Feesql = Feesql + ",0,0,5,0,0,'易通小票费')";
Feesql = Feesql + " INSERT INTO [t_ch_fee] ([类型],[费用状态],[编号],[费用名称],[结算单位],[客户名称],[标准]";
Feesql = Feesql + ",[单价],[数量],[金额],[币别],[汇率],[备注],[结算金额],[开票金额]";
Feesql = Feesql + ",[录入人],[录入日期],[是否对帐],[顺序],[冲抵金额]";
Feesql = Feesql + ",[机密],[是否垫付],[申请金额],[不开发票],[费用英文名称]";
Feesql = Feesql + ",[申请开票],[提交],[不含税价],[税率],[税额],PROJECTFEEID) VALUES ";
Feesql = Feesql + "('付','审核通过','" + D6BS.BSNO + "','提箱小票费','代理','亿通(付费)','单票'";
Feesql = Feesql + ","+ returndata.fee + ",1,"+ returndata.fee + ",'RMB',1,'',0,0";
Feesql = Feesql + ",'DEMO-SA',GETDATE(),0,100,0";
Feesql = Feesql + ",0,0,0,0,''";
Feesql = Feesql + ",0,0,"+ returndata.fee + ",0,0,'易通小票费')";
log.Debug($"费用语句-{Feesql}");
dbcon.Open();
SqlCommand Feecmd = new SqlCommand(Feesql, dbcon);
Feecmd.ExecuteNonQuery();
dbcon.Close();
}
if (Convert.ToDecimal(returndata.ydFee) != 0)
{
string Feesql = "INSERT INTO [t_ch_fee] ([类型],[费用状态],[编号],[费用名称],[结算单位],[客户名称],[标准]";
Feesql = Feesql + ",[单价],[数量],[金额],[币别],[汇率],[备注],[结算金额],[开票金额]";
Feesql = Feesql + ",[录入人],[录入日期],[是否对帐],[顺序],[冲抵金额]";
Feesql = Feesql + ",[机密],[是否垫付],[申请金额],[不开发票],[费用英文名称]";
Feesql = Feesql + ",[申请开票],[提交],[不含税价],[税率],[税额],PROJECTFEEID) VALUES ";
Feesql = Feesql + "('收','审核通过','" + D6BS.BSNO + "','提箱小票费','委托单位','" + D6BS.CUSTOMERNAME + "','单票'";
Feesql = Feesql + "," + returndata.ydFee + ",1," + returndata.ydFee + ",'RMB',1,'',0,0";
Feesql = Feesql + ",'DEMO-SA',GETDATE(),0,100,0";
Feesql = Feesql + ",0,0,0,0,''";
Feesql = Feesql + ",0,0," + returndata.ydFee + ",0,0,'易通小票费')";
Feesql = Feesql + " INSERT INTO [t_ch_fee] ([类型],[费用状态],[编号],[费用名称],[结算单位],[客户名称],[标准]";
Feesql = Feesql + ",[单价],[数量],[金额],[币别],[汇率],[备注],[结算金额],[开票金额]";
Feesql = Feesql + ",[录入人],[录入日期],[是否对帐],[顺序],[冲抵金额]";
Feesql = Feesql + ",[机密],[是否垫付],[申请金额],[不开发票],[费用英文名称]";
Feesql = Feesql + ",[申请开票],[提交],[不含税价],[税率],[税额],PROJECTFEEID) VALUES ";
Feesql = Feesql + "('付','审核通过','" + D6BS.BSNO + "','提箱小票费','代理','C亿通付费','单票'";
Feesql = Feesql + "," + returndata.ydFee + ",1," + returndata.ydFee + ",'RMB',1,'',0,0";
Feesql = Feesql + ",'DEMO-SA',GETDATE(),0,100,0";
Feesql = Feesql + ",0,0,0,0,''";
Feesql = Feesql + ",0,0," + returndata.ydFee + ",0,0,'易通小票费')";
log.Debug($"费用语句-{Feesql}");
dbcon.Open();
SqlCommand Feecmd = new SqlCommand(Feesql, dbcon);
Feecmd.ExecuteNonQuery();
dbcon.Close();
}
if (Convert.ToDecimal(returndata.secondPrintFee) != 0)
{
string Feesql = "INSERT INTO [t_ch_fee] ([类型],[费用状态],[编号],[费用名称],[结算单位],[客户名称],[标准]";
Feesql = Feesql + ",[单价],[数量],[金额],[币别],[汇率],[备注],[结算金额],[开票金额]";
Feesql = Feesql + ",[录入人],[录入日期],[是否对帐],[顺序],[冲抵金额]";
Feesql = Feesql + ",[机密],[是否垫付],[申请金额],[不开发票],[费用英文名称]";
Feesql = Feesql + ",[申请开票],[提交],[不含税价],[税率],[税额],PROJECTFEEID) VALUES ";
Feesql = Feesql + "('收','审核通过','" + D6BS.BSNO + "','调箱费','委托单位','" + D6BS.CUSTOMERNAME + "','单票'";
Feesql = Feesql + "," + returndata.secondPrintFee + ",1," + returndata.secondPrintFee + ",'RMB',1,'',0,0";
Feesql = Feesql + ",'DEMO-SA',GETDATE(),0,100,0";
Feesql = Feesql + ",0,0,0,0,''";
Feesql = Feesql + ",0,0," + returndata.secondPrintFee + ",0,0,'易通小票费')";
Feesql = Feesql + " INSERT INTO [t_ch_fee] ([类型],[费用状态],[编号],[费用名称],[结算单位],[客户名称],[标准]";
Feesql = Feesql + ",[单价],[数量],[金额],[币别],[汇率],[备注],[结算金额],[开票金额]";
Feesql = Feesql + ",[录入人],[录入日期],[是否对帐],[顺序],[冲抵金额]";
Feesql = Feesql + ",[机密],[是否垫付],[申请金额],[不开发票],[费用英文名称]";
Feesql = Feesql + ",[申请开票],[提交],[不含税价],[税率],[税额],PROJECTFEEID) VALUES ";
Feesql = Feesql + "('付','审核通过','" + D6BS.BSNO + "','调箱费','代理','C亿通付费','单票'";
Feesql = Feesql + "," + returndata.secondPrintFee + ",1," + returndata.secondPrintFee + ",'RMB',1,'',0,0";
Feesql = Feesql + ",'DEMO-SA',GETDATE(),0,100,0";
Feesql = Feesql + ",0,0,0,0,''";
Feesql = Feesql + ",0,0," + returndata.secondPrintFee + ",0,0,'易通小票费')";
log.Debug($"费用语句-{Feesql}");
dbcon.Open();
SqlCommand Feecmd = new SqlCommand(Feesql, dbcon);
Feecmd.ExecuteNonQuery();
dbcon.Close();
}
}
var headstr = "";
if (returndata.bookingno.Length > 3)
{
headstr = returndata.bookingno.Substring(0, 3);
}
if (string.IsNullOrEmpty(D6BS.BSNO) && (headstr == "QGD" || headstr == "AMQ" || headstr == "AMG" || headstr == "AYQ"))
{
SaveMail(dbcon, "CMABKG@SDSMARTLOGISTICS.COM", returndata.bookingno + "此单号已退仓,但是系统检测到打印过小票" + returndata.printType + ",请知悉,谢谢", returndata.bookingno + "此单号已退仓,但是系统检测到打印过小票" + returndata.printType + ",请知悉,谢谢", "1");
}
}
dbcon.Close();
}
}
catch (Exception e) {
log.Debug($"记录插入错误:{e.Message}");
}
}
else {
log.Debug($"数据返回错误:{objRtn.message}");
}
}
catch (Exception ex)
{
log.Error(ex.Message);
log.Error(ex.StackTrace);
}
}
public static int SaveMail(SqlConnection dbcon, string sendto, string title, string body, string smtpid)
{
var sqlstr = $" INSERT INTO [Mail_Send] ([GID],[SendTo],[Title],[Body],[SendStatus],[TryCount],[CreateTime],[SmtpConfig],[Sender],[ShowName]) select newid(),'{sendto}','{title}','{body.Replace("'", "''")}','Create',0,GETDATE(),'{smtpid}','','' ";
SqlCommand cmd = new SqlCommand(sqlstr, dbcon);
return cmd.ExecuteNonQuery();
}
static public D6BS GETD6BS(string MBLNO, SqlConnection dbcon)
{
var newbs = new D6BS();
var strSql = new StringBuilder();
strSql.Append("SELECT TOP 1 编号 BSNO,委托单位 CUSTOMERNAME from t_op_seae where 主提单号='" + MBLNO + "'");
SqlDataAdapter adapter = new SqlDataAdapter(strSql.ToString(), dbcon);
DataTable table = new DataTable();
adapter.Fill(table);
var BSNO = "";
if (table.Rows.Count > 0)
{
foreach (DataRow row in table.Rows)
{
newbs.BSNO = row["BSNO"].ToString();
newbs.CUSTOMERNAME = row["CUSTOMERNAME"].ToString();
}
}
return newbs;
}
}
public class JsonYtSend
{
public string custname { get; set; }
public string custpsw { get; set; }
public string username { get; set; }
public string password { get; set; }
public string start_time { get; set; }
public string end_time { get; set; }
}
public class JsonYtFee
{
public string vessel { get; set; }
public string voyage { get; set; }
public string bookingno { get; set; }
public string ctn_type { get; set; }
public string ctn_no { get; set; }
public string yard { get; set; }
public string trans_port_code { get; set; }
public string operatetime { get; set; }
public string operatetype { get; set; }
public string printType { get; set; }
public string fee { get; set; }
public string ydFee { get; set; }
public string secondPrintFee { get; set; }
public string applicant_code { get; set; }
}
public class D6BS
{
public string BSNO { get; set; }
public string CUSTOMERNAME { get; set; }
}
}

@ -143,7 +143,53 @@
</cron>
</trigger>
<!--订阅下载亿通提箱小票费任务-->
<job>
<name>JobGetYTFeeData</name>
<group>Job</group>
<description>下载亿通提箱小票费</description>
<job-type>JobCreateFee.JobYtD6Fee,JobAutoCreateFee</job-type>
<durable>true</durable>
<recover>false</recover>
<job-data-map>
<!--连接字符串-->
<entry>
<key>ConnectString</key>
<value>Data Source=.;Initial Catalog=dongshengdata_jf;Persist Security Info=True;User ID=sa;Password=ds20040201</value>
</entry>
<!--接口地址-->
<entry>
<key>YTReqUrl</key>
<value>http://47.104.90.170:9000/easipass/cdbb/fee/</value>
</entry>
<!--亿通用户名-->
<entry>
<key>YTUserName</key>
<value>XXXXXX</value>
</entry>
<!--亿通密码-->
<entry>
<key>YTPassWord</key>
<value>XXXXXX</value>
</entry>
<!--用户名-->
<entry>
<key>CustName</key>
<value>XXXXXX</value>
</entry>
<!--密码-->
<entry>
<key>CustPsw</key>
<value>XXXXXX</value>
</entry>
<!--请求超时(单位:秒)-->
<entry>
<key>RequestTimeout</key>
<value>60</value>
</entry>
</job-data-map>
</job>
</schedule>
</job-scheduling-data>
Loading…
Cancel
Save