|
|
|
@ -14,6 +14,7 @@ using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Data.Entity;
|
|
|
|
|
using JobAutoCreateFee.Model;
|
|
|
|
|
using System.Runtime.Remoting;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace JobCreateFee
|
|
|
|
@ -61,12 +62,6 @@ namespace JobCreateFee
|
|
|
|
|
reqObj.end_time = yesterday;
|
|
|
|
|
reqObj.company = "CMA_TAO";
|
|
|
|
|
|
|
|
|
|
var sendstr = JsonConvert.SerializeObject(reqObj);
|
|
|
|
|
log.Debug($"发送包{reqObj.company}:{sendstr}");
|
|
|
|
|
|
|
|
|
|
//发送请求数据
|
|
|
|
|
string rtnStr_CMA_TAO = WebRequestHelper.DoPost(reqUrl, sendstr, reqTimeout * 1000);
|
|
|
|
|
|
|
|
|
|
//var testrtnobject = new josnYtData();
|
|
|
|
|
//testrtnobject.status = "1";
|
|
|
|
|
//var testfee = new JsonYtFee();
|
|
|
|
@ -86,6 +81,12 @@ namespace JobCreateFee
|
|
|
|
|
//testrtnobject.message.Add(testfee);
|
|
|
|
|
//var rtn = JsonConvert.SerializeObject(testrtnobject);
|
|
|
|
|
|
|
|
|
|
var sendstr = JsonConvert.SerializeObject(reqObj);
|
|
|
|
|
log.Debug($"发送包{reqObj.company}:{sendstr}");
|
|
|
|
|
|
|
|
|
|
//发送请求数据
|
|
|
|
|
string rtnStr_CMA_TAO = "{\"message\":\"未查询出数据\",\"status\":\"0\"}";
|
|
|
|
|
rtnStr_CMA_TAO=WebRequestHelper.DoPost(reqUrl, sendstr, reqTimeout * 1000);
|
|
|
|
|
log.Debug($"数据返回{reqObj.company}:{rtnStr_CMA_TAO}");
|
|
|
|
|
//var objRtn = JsonConvert.DeserializeAnonymousType(rtn, new { status = "", message = "" });
|
|
|
|
|
|
|
|
|
@ -94,14 +95,17 @@ namespace JobCreateFee
|
|
|
|
|
reqObj.company = "CMA_DLC";
|
|
|
|
|
sendstr = JsonConvert.SerializeObject(reqObj);
|
|
|
|
|
log.Debug($"发送包{reqObj.company}:{sendstr}");
|
|
|
|
|
string rtnStr_CMA_DLC = WebRequestHelper.DoPost(reqUrl, sendstr, reqTimeout * 1000);
|
|
|
|
|
string rtnStr_CMA_DLC = "{\"message\":\"未查询出数据\",\"status\":\"0\"}";
|
|
|
|
|
rtnStr_CMA_DLC=WebRequestHelper.DoPost(reqUrl, sendstr, reqTimeout * 1000);
|
|
|
|
|
log.Debug($"数据返回{reqObj.company}:{rtnStr_CMA_DLC}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reqObj.company = "CMA_TXG";
|
|
|
|
|
sendstr = JsonConvert.SerializeObject(reqObj);
|
|
|
|
|
log.Debug($"发送包{reqObj.company}:{sendstr}");
|
|
|
|
|
string rtnStr_CMA_TXG = WebRequestHelper.DoPost(reqUrl, sendstr, reqTimeout * 1000);
|
|
|
|
|
string rtnStr_CMA_TXG = "{\"message\":\"未查询出数据\",\"status\":\"0\"}";
|
|
|
|
|
//"{\"message\":[{\"applicant_code\":\"hhcma\",\"barcode\":\"1056936938466968\",\"bookingno\":\"TJN0471222\",\"ctn_no\":\"TEMU0083340\",\"ctn_type\":\"20ST\",\"fee\":\"1.0\",\"operatetime\":\"2024-08-18 12:27:00\",\"operatetype\":\"打印通知单\",\"printType\":\"纸面\",\"secondPrintFee\":\"30.0\",\"trans_port_code\":\"MXZLO\",\"vessel\":\"GREGOS\",\"voyage\":\"0WU0VE\",\"yard\":\"克运物流\"},{\"applicant_code\":\"hhcma\",\"barcode\":\"1058836938466967\",\"bookingno\":\"TJN0471222\",\"ctn_no\":\"CMAU3066259\",\"ctn_type\":\"20ST\",\"fee\":\"1.0\",\"operatetime\":\"2024-08-18 12:27:00\",\"operatetype\":\"打印通知单\",\"printType\":\"纸面\",\"secondPrintFee\":\"30.0\",\"trans_port_code\":\"MXZLO\",\"vessel\":\"GREGOS\",\"voyage\":\"0WU0VE\",\"yard\":\"克运物流\"},{\"applicant_code\":\"hhcma\",\"barcode\":\"1084536938466966\",\"bookingno\":\"TJN0471222\",\"ctn_no\":\"TEMU5580118\",\"ctn_type\":\"20ST\",\"fee\":\"1.0\",\"operatetime\":\"2024-08-18 12:27:00\",\"operatetype\":\"打印通知单\",\"printType\":\"纸面\",\"secondPrintFee\":\"30.0\",\"trans_port_code\":\"MXZLO\",\"vessel\":\"GREGOS\",\"voyage\":\"0WU0VE\",\"yard\":\"克运物流\"},{\"applicant_code\":\"hhcma\",\"barcode\":\"1041136938466965\",\"bookingno\":\"TJN0471222\",\"ctn_no\":\"TCLU7442738\",\"ctn_type\":\"20ST\",\"fee\":\"1.0\",\"operatetime\":\"2024-08-18 12:27:00\",\"operatetype\":\"打印通知单\",\"printType\":\"纸面\",\"secondPrintFee\":\"30.0\",\"trans_port_code\":\"MXZLO\",\"vessel\":\"GREGOS\",\"voyage\":\"0WU0VE\",\"yard\":\"克运物流\"}],\"status\":\"1\"}";
|
|
|
|
|
rtnStr_CMA_DLC=WebRequestHelper.DoPost(reqUrl, sendstr, reqTimeout * 1000);
|
|
|
|
|
log.Debug($"数据返回{reqObj.company}:{rtnStr_CMA_TXG}");
|
|
|
|
|
|
|
|
|
|
DealReturnJson(rtnStr_CMA_TAO);
|
|
|
|
@ -110,70 +114,95 @@ namespace JobCreateFee
|
|
|
|
|
|
|
|
|
|
void DealReturnJson(string rtn)
|
|
|
|
|
{
|
|
|
|
|
var objRtn = JsonConvert.DeserializeObject<josnYtData>(rtn);
|
|
|
|
|
if (objRtn.status == "1")
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//var parseJsonObj = JsonConvert.DeserializeObject<List<JsonYtFee>>(objRtn.message);
|
|
|
|
|
log.Debug($"开始解析:{rtn}");
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//1 记录进t_op_ytfee_log 表
|
|
|
|
|
//2 遍历信息,将同提单号的费用合起来
|
|
|
|
|
//3 遍历提单号,寻找业务,判断业务能否增加费用
|
|
|
|
|
//3.1 业务是否已退仓
|
|
|
|
|
//3.2 业务是否费用锁定
|
|
|
|
|
//3.3 业务会计期间是否已锁帐
|
|
|
|
|
//以上情况分别发送邮件提醒
|
|
|
|
|
//4 如能增加费用 则插入费用
|
|
|
|
|
|
|
|
|
|
using (SqlConnection dbcon = new SqlConnection(connStr))
|
|
|
|
|
var candeal = JsonConvert.DeserializeObject<josnYtData_State>(rtn);
|
|
|
|
|
if (candeal.status == "0")
|
|
|
|
|
{
|
|
|
|
|
var hp = new YTFEEHelper();
|
|
|
|
|
var FEELIST = new List<D7BS>();
|
|
|
|
|
dbcon.Open();
|
|
|
|
|
log.Debug($"解析结束:status={candeal.status}:{candeal.message}");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var returndata in objRtn.message)
|
|
|
|
|
var objRtn = JsonConvert.DeserializeObject<josnYtData>(rtn);
|
|
|
|
|
if (objRtn.status == "1")
|
|
|
|
|
{
|
|
|
|
|
//var parseJsonObj = JsonConvert.DeserializeObject<List<JsonYtFee>>(objRtn.message);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//1 记录进t_op_ytfee_log 表
|
|
|
|
|
//2 遍历信息,将同提单号的费用合起来
|
|
|
|
|
//3 遍历提单号,寻找业务,判断业务能否增加费用
|
|
|
|
|
//3.1 业务是否已退仓
|
|
|
|
|
//3.2 业务是否费用锁定
|
|
|
|
|
//3.3 业务会计期间是否已锁帐
|
|
|
|
|
//以上情况分别发送邮件提醒
|
|
|
|
|
//4 如能增加费用 则插入费用
|
|
|
|
|
|
|
|
|
|
using (SqlConnection dbcon = new SqlConnection(connStr))
|
|
|
|
|
{
|
|
|
|
|
//测试数据
|
|
|
|
|
//if (returndata.bookingno != "QGD0721089") continue;
|
|
|
|
|
var hp = new YTFEEHelper();
|
|
|
|
|
var FEELIST = new List<D7BS>();
|
|
|
|
|
dbcon.Open();
|
|
|
|
|
|
|
|
|
|
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";
|
|
|
|
|
foreach (var returndata in objRtn.message)
|
|
|
|
|
{
|
|
|
|
|
//测试数据
|
|
|
|
|
//if (returndata.bookingno != "QGD0721089") continue;
|
|
|
|
|
|
|
|
|
|
var D7BS = GETD7OPSEAEBS(returndata, YTD7Condition, dbcon);
|
|
|
|
|
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";
|
|
|
|
|
|
|
|
|
|
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 ('" + D7BS.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();
|
|
|
|
|
var D7BS = GETD7OPSEAEBS(returndata, YTD7Condition, dbcon);
|
|
|
|
|
|
|
|
|
|
D7BS.ENTEROPERATOR = ENTEROPERATOR;
|
|
|
|
|
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 ('" + D7BS.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();
|
|
|
|
|
|
|
|
|
|
hp.addYTFee(returndata, D7BS, YTD7NoUseCORPID);
|
|
|
|
|
}
|
|
|
|
|
//hp.makefee();
|
|
|
|
|
D7BS.ENTEROPERATOR = ENTEROPERATOR;
|
|
|
|
|
|
|
|
|
|
hp.SendMail();
|
|
|
|
|
hp.addYTFee(returndata, D7BS, YTD7NoUseCORPID);
|
|
|
|
|
}
|
|
|
|
|
//hp.makefee();
|
|
|
|
|
|
|
|
|
|
dbcon.Close();
|
|
|
|
|
hp.SendMail();
|
|
|
|
|
|
|
|
|
|
hp.makefee_应付();
|
|
|
|
|
dbcon.Close();
|
|
|
|
|
|
|
|
|
|
hp.makefee_应付();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
log.Debug($"记录插入错误:{e.Message}");
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
log.Debug($"记录插入错误:{e.Message}");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
log.Debug($"数据返回错误:{objRtn.message}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
log.Debug($"数据返回错误:{objRtn.message}");
|
|
|
|
|
log.Debug($"解析错误:{JsonConvert.SerializeObject(e) }");
|
|
|
|
|
}
|
|
|
|
|
finally {
|
|
|
|
|
log.Debug($"解析完成");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -247,8 +276,8 @@ namespace JobCreateFee
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
log.Error(ex.Message);
|
|
|
|
|
log.Error(ex.StackTrace);
|
|
|
|
|
log.Error($"execute错误:{JsonConvert.SerializeObject(ex)}");
|
|
|
|
|
//log.Error(ex.StackTrace);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|