|
|
using Aspose.Words.Saving;
|
|
|
using com.sun.org.apache.bcel.@internal.generic;
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
|
|
|
using DSWeb.Areas.MvcShipping.Models.Message.VGM;
|
|
|
using DSWeb.Areas.MvcShipping.Models.MsOpSeaeBaoXian;
|
|
|
using DSWeb.Common.DB;
|
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
using HcUtility.Comm;
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Data.Entity.Core.Metadata.Edm;
|
|
|
using System.Data.Entity.Migrations;
|
|
|
using System.Diagnostics.Contracts;
|
|
|
using System.IO;
|
|
|
using System.Linq;
|
|
|
using System.Net.Http;
|
|
|
using System.Reflection;
|
|
|
using System.Text;
|
|
|
using System.Web;
|
|
|
using System.Web.Mvc;
|
|
|
using DSWeb.SoftMng.Filter;
|
|
|
using System.Web.Script.Serialization;
|
|
|
using System.Web.UI.MobileControls.Adapters;
|
|
|
|
|
|
|
|
|
namespace DSWeb.Areas.CommMng.Controllers
|
|
|
{
|
|
|
[JsonRequestBehavior]
|
|
|
public class PublicInterfaceController : Controller
|
|
|
{
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
public InterfaceResult PostInterface(InterfaceParam param) {
|
|
|
try {
|
|
|
Assembly assembly = Assembly.Load("DSWeb.Areas.CommMng.Controllers");
|
|
|
var type = assembly.GetType("DSWeb.Areas.CommMng.Controllers.InterfaceBase." + param.PORTNAME);
|
|
|
|
|
|
Object obj = type.Assembly.CreateInstance(type.ToString());
|
|
|
|
|
|
var doset = type.GetMethod("DoSet");
|
|
|
var _param = new object[]{ param};
|
|
|
InterfaceResult result = (InterfaceResult)doset.Invoke(obj,BindingFlags.Instance|BindingFlags.NonPublic,null, _param, null);
|
|
|
return result;
|
|
|
} catch (Exception e) {
|
|
|
var _r = new InterfaceResult();
|
|
|
_r.errCode = "1";
|
|
|
|
|
|
var msg = e.Message;
|
|
|
if (e.InnerException != null && e.InnerException.Message != null) {
|
|
|
msg += "//InnerException.Message:" + e.InnerException.Message;
|
|
|
}
|
|
|
var _rs= BasicDataRefDAL.SaveLog(msg, "", param.PORTNAME, "公开接口");
|
|
|
var _rr = JsonConvert.Deserialize<DBResult>(_rs.Content);
|
|
|
_r.errMsg = "未知错误,请联系相关人员,错误日志号【" + _rr.Data.ToString() + "】";
|
|
|
return _r;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 诺诺开票回调 未完成
|
|
|
/// </summary>
|
|
|
/// <param name="param"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
public InterfaceResult NNCallBack(InterfaceParam param)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
Assembly assembly = Assembly.Load("DSWeb.Areas.Account.Controllers");
|
|
|
var type = assembly.GetType("DSWeb.Areas.CommMng.Controllers.InterfaceBase." + param.PORTNAME);
|
|
|
|
|
|
Object obj = type.Assembly.CreateInstance(type.ToString());
|
|
|
|
|
|
var doset = type.GetMethod("DoSet");
|
|
|
var _param = new object[] { param };
|
|
|
InterfaceResult result = (InterfaceResult)doset.Invoke(obj, BindingFlags.Instance | BindingFlags.NonPublic, null, _param, null);
|
|
|
return result;
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
var _r = new InterfaceResult();
|
|
|
_r.errCode = "1";
|
|
|
|
|
|
var msg = e.Message;
|
|
|
if (e.InnerException != null && e.InnerException.Message != null)
|
|
|
{
|
|
|
msg += "//InnerException.Message:" + e.InnerException.Message;
|
|
|
}
|
|
|
var _rs = BasicDataRefDAL.SaveLog(msg, "", param.PORTNAME, "公开接口");
|
|
|
var _rr = JsonConvert.Deserialize<DBResult>(_rs.Content);
|
|
|
_r.errMsg = "未知错误,请联系相关人员,错误日志号【" + _rr.Data.ToString() + "】";
|
|
|
return _r;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void DJYBILLCHECK()
|
|
|
{
|
|
|
|
|
|
var sr = new StreamReader(Request.InputStream, Encoding.UTF8);
|
|
|
var strJson = sr.ReadToEnd();
|
|
|
var param = JsonConvert.Deserialize<DJYCHECK_DATA_SEND>(strJson);
|
|
|
try
|
|
|
{
|
|
|
//param.Save();
|
|
|
Assembly assembly = Assembly.Load("DSWeb");
|
|
|
var classname = "DSWeb.Areas.CommMng.PublicInterfaceDAL.DJYBILLCHECK";
|
|
|
var type = assembly.GetType(classname);
|
|
|
|
|
|
Object obj = type.Assembly.CreateInstance(type.ToString());
|
|
|
|
|
|
var doset = type.GetMethod("DoSet");
|
|
|
var _param = new object[] { param };
|
|
|
DJYCHECK_REPLY result = (DJYCHECK_REPLY)doset.Invoke(obj, BindingFlags.Instance | BindingFlags.NonPublic, null, _param, null);
|
|
|
|
|
|
//var str = JsonConvert.Serialize(result);
|
|
|
|
|
|
string json = JsonConvert.Serialize(result);
|
|
|
//Response.Clear();
|
|
|
Response.AddHeader("Content-type", "text/json");
|
|
|
Response.AddHeader("Content-type", "application/json");
|
|
|
Response.ContentType = "application/json";
|
|
|
Response.Write(json);
|
|
|
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
var _r = new DJYINFOBASE();
|
|
|
_r.Code = 1;
|
|
|
|
|
|
var msg = e.Message;
|
|
|
if (e.InnerException != null && e.InnerException.Message != null)
|
|
|
{
|
|
|
msg += "//InnerException.Message:" + e.InnerException.Message;
|
|
|
}
|
|
|
var _rs = BasicDataRefDAL.SaveLog(msg, "", "大简云比对", "数据比对");
|
|
|
//var _rr = JsonConvert.Deserialize<DBResult>(_rs.Content);
|
|
|
_r.Message = msg;
|
|
|
|
|
|
string json = JsonConvert.Serialize(_r);
|
|
|
//Response.Clear();
|
|
|
Response.AddHeader("Content-type", "text/json");
|
|
|
Response.AddHeader("Content-type", "application/json");
|
|
|
Response.ContentType = "application/json";
|
|
|
Response.Write(json);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void DJYDELBILL()
|
|
|
{
|
|
|
|
|
|
var sr = new StreamReader(Request.InputStream, Encoding.UTF8);
|
|
|
var strJson = sr.ReadToEnd();
|
|
|
//BasicDataRefDAL.SaveLog(strJson, "", "大简云比对", "删除业务");
|
|
|
var param = JsonConvert.Deserialize<DJYBILLDELETE_SEND>(strJson);
|
|
|
try
|
|
|
{
|
|
|
//param.Save();
|
|
|
InterfaceLog.Save("DJYDELETEHead", strJson);
|
|
|
|
|
|
Assembly assembly = Assembly.Load("DSWeb");
|
|
|
var classname = "DSWeb.Areas.CommMng.PublicInterfaceDAL.DJYBILLDELETE";
|
|
|
var type = assembly.GetType(classname);
|
|
|
|
|
|
Object obj = type.Assembly.CreateInstance(type.ToString());
|
|
|
|
|
|
var doset = type.GetMethod("DoSet");
|
|
|
var _param = new object[] { param };
|
|
|
DJYBILLDELETE_REPLY result = (DJYBILLDELETE_REPLY)doset.Invoke(obj, BindingFlags.Instance | BindingFlags.NonPublic, null, _param, null);
|
|
|
|
|
|
//var str = JsonConvert.Serialize(result);
|
|
|
|
|
|
string json = JsonConvert.Serialize(result);
|
|
|
//Response.Clear();
|
|
|
Response.AddHeader("Content-type", "text/json");
|
|
|
Response.AddHeader("Content-type", "application/json");
|
|
|
Response.ContentType = "application/json";
|
|
|
Response.Write(json);
|
|
|
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
var _r = new DJYINFOBASE();
|
|
|
_r.Code = 1;
|
|
|
|
|
|
var msg = e.Message;
|
|
|
if (e.InnerException != null && e.InnerException.Message != null)
|
|
|
{
|
|
|
msg += "//InnerException.Message:" + e.InnerException.Message;
|
|
|
}
|
|
|
var _rs = BasicDataRefDAL.SaveLog(msg, "", "大简云比对", "删除业务");
|
|
|
//var _rr = JsonConvert.Deserialize<DBResult>(_rs.Content);
|
|
|
_r.Message = msg;
|
|
|
|
|
|
string json = JsonConvert.Serialize(_r);
|
|
|
//Response.Clear();
|
|
|
Response.AddHeader("Content-type", "text/json");
|
|
|
Response.AddHeader("Content-type", "application/json");
|
|
|
Response.ContentType = "application/json";
|
|
|
Response.Write(json);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void PublicInterface()
|
|
|
{
|
|
|
|
|
|
var sr = new StreamReader(Request.InputStream, Encoding.UTF8);
|
|
|
var strJson = sr.ReadToEnd();
|
|
|
//BasicDataRefDAL.SaveLog(strJson, "", "大简云比对", "删除业务");
|
|
|
var paramHead = JsonConvert.Deserialize<InterfaceParam_Base>(strJson);
|
|
|
try
|
|
|
{
|
|
|
//param.Save();
|
|
|
InterfaceLog.Save("PublicInterface", strJson);
|
|
|
|
|
|
Assembly assembly = Assembly.Load("DSWeb");
|
|
|
var classname = "DSWeb.Areas.CommMng.PublicInterfaceDAL."+ paramHead.PORTNAME;
|
|
|
var type = assembly.GetType(classname);
|
|
|
|
|
|
Object obj = type.Assembly.CreateInstance(type.ToString());
|
|
|
|
|
|
var doset = type.GetMethod("DoSet");
|
|
|
var _param = new object[] { paramHead.Param };
|
|
|
DBResult result = (DBResult)doset.Invoke(obj, BindingFlags.Instance | BindingFlags.NonPublic, null, _param, null);
|
|
|
|
|
|
//var str = JsonConvert.Serialize(result);
|
|
|
|
|
|
string json = JsonConvert.Serialize(result);
|
|
|
//Response.Clear();
|
|
|
Response.AddHeader("Content-type", "text/json");
|
|
|
Response.AddHeader("Content-type", "application/json");
|
|
|
Response.ContentType = "application/json";
|
|
|
Response.Write(json);
|
|
|
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
var _r = new DJYINFOBASE();
|
|
|
_r.Code = 1;
|
|
|
|
|
|
var msg = JsonConvert.Serialize(e);
|
|
|
var _rs = BasicDataRefDAL.SaveLog(msg, "", "PublicInterface", "错误");
|
|
|
//var _rr = JsonConvert.Deserialize<DBResult>(_rs.Content);
|
|
|
_r.Message = msg;
|
|
|
|
|
|
string json = JsonConvert.Serialize(_r);
|
|
|
//Response.Clear();
|
|
|
Response.AddHeader("Content-type", "text/json");
|
|
|
Response.AddHeader("Content-type", "application/json");
|
|
|
Response.ContentType = "application/json";
|
|
|
Response.Write(json);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public class InterfaceResult {
|
|
|
public string errCode { get; set; }
|
|
|
public string errMsg { get; set; }
|
|
|
|
|
|
public InterfaceResult() { }
|
|
|
|
|
|
public InterfaceResult(DBResult dbresult) {
|
|
|
if (dbresult.Success)
|
|
|
{
|
|
|
errCode = "0";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
errCode = "1";
|
|
|
}
|
|
|
|
|
|
errMsg = dbresult.Message + ";Data:" + JsonConvert.Serialize(dbresult.Data);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public class InterfaceParam {
|
|
|
public string PORTNAME { get; set; }
|
|
|
public string GID { get; set; }
|
|
|
|
|
|
public string Param { get; set; }
|
|
|
}
|
|
|
|
|
|
public class InterfaceParam_Base
|
|
|
{
|
|
|
public string PORTNAME { get; set; }
|
|
|
public string GID { get; set; }
|
|
|
public object Param { get; set; }
|
|
|
}
|
|
|
|
|
|
|
|
|
public class 全泰账单_Fee
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 单证费
|
|
|
/// </summary>
|
|
|
public string cost_name { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string cost_unit { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string cost_price { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string cost_count { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string cost_currency { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string cost_amount { get; set; }
|
|
|
}
|
|
|
|
|
|
public class 全泰账单_Bill
|
|
|
{
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string bill_no { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string bill_date { get; set; }
|
|
|
/// <summary>
|
|
|
/// 正本提单
|
|
|
/// </summary>
|
|
|
public string bill_type { get; set; }
|
|
|
/// <summary>
|
|
|
/// 已出单
|
|
|
/// </summary>
|
|
|
public string bill_status { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string bill_vessel { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string bill_voyage { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string bill_amount_usa { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string bill_amount_rmb { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string bill_container_type { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string bill_container_count { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string bill_remark { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public List<全泰账单_Fee> bill_details { get; set; }
|
|
|
}
|
|
|
|
|
|
|
|
|
public static class InterfaceLog
|
|
|
{
|
|
|
public static void Save(string PORTNAME, object c)
|
|
|
{
|
|
|
var saverec = getsaverec(PORTNAME, c);
|
|
|
if (!string.IsNullOrWhiteSpace(saverec.Param) && !string.IsNullOrWhiteSpace(saverec.PORTNAME))
|
|
|
{
|
|
|
var cdc = new CommonDataContext();
|
|
|
cdc.t_PublicInterface_Log.Add(saverec);
|
|
|
cdc.SaveChanges();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private static t_PublicInterface_Log_md getsaverec(string PORTNAME, object c)
|
|
|
{
|
|
|
var result = new t_PublicInterface_Log_md();
|
|
|
try
|
|
|
{
|
|
|
result.GID = Guid.NewGuid().ToString();
|
|
|
result.PORTNAME = PORTNAME;
|
|
|
result.Param = JsonConvert.Serialize(c);
|
|
|
result.CreateTime = DateTime.Now;
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
public class InterfaceBase
|
|
|
{
|
|
|
public InterfaceBase() { }
|
|
|
|
|
|
public InterfaceResult DoSet(InterfaceParam param) {
|
|
|
return new InterfaceResult();
|
|
|
}
|
|
|
|
|
|
public class csCust: InterfaceBase
|
|
|
{
|
|
|
public InterfaceResult DoSet(InterfaceParam param)
|
|
|
{
|
|
|
return new InterfaceResult();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public class NNCallBackInfo {
|
|
|
public string operater { get; set; }
|
|
|
public string billNo { get; set; }
|
|
|
public NNContent content { get; set; }
|
|
|
}
|
|
|
|
|
|
public class NNContent {
|
|
|
|
|
|
|
|
|
List<NNDetail> details { get; set; }
|
|
|
}
|
|
|
|
|
|
public class NNDetail
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
#region 大简云 数据比对校验
|
|
|
/// <summary>
|
|
|
/// 用于比对大简云和ds6数据之间,谁有谁没有的问题
|
|
|
/// </summary>
|
|
|
public class DJYBILLCHECK
|
|
|
{
|
|
|
|
|
|
public DJYCHECK_REPLY DoSet(DJYCHECK_DATA_SEND param)
|
|
|
{
|
|
|
|
|
|
var errorstr = "";
|
|
|
var result = new DBResult();
|
|
|
errorstr = JsonConvert.Serialize(param);
|
|
|
try
|
|
|
{
|
|
|
|
|
|
var resultData = new DJYCHECK_DATA_REPLY();
|
|
|
|
|
|
resultData.Normal = new List<DJYCHECK_BILL_REPLY>();
|
|
|
resultData.Deleted = new List<DJYCHECK_BILL_REPLY>();
|
|
|
|
|
|
|
|
|
var djyidList_have = new List<DJYCHECK_BILL_SEND>();
|
|
|
var djyidList_have_child = new List<long>();
|
|
|
var djyidList_deleted = new List<DJYCHECK_BILL_SEND>();
|
|
|
//大简云已有
|
|
|
if (param.Normal != null && param.Normal.Count > 0)
|
|
|
{
|
|
|
foreach (var head in param.Normal)
|
|
|
{
|
|
|
djyidList_have.Add(head);
|
|
|
if (head.Sub != null && head.Sub.Count > 1)
|
|
|
{
|
|
|
foreach (var child in head.Sub)
|
|
|
{
|
|
|
djyidList_have_child.Add(child.Id);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (param.Deleted != null && param.Deleted.Count > 0)
|
|
|
{
|
|
|
foreach (var head in param.Deleted)
|
|
|
{
|
|
|
djyidList_deleted.Add(head);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var cdc = new CommonDataContext();
|
|
|
|
|
|
if (djyidList_have.Count > 0)
|
|
|
{
|
|
|
var djyidList_have_id = djyidList_have.Select(s => s.Id).ToList();
|
|
|
var currList = cdc.OP_SEAE.Where(x => djyidList_have_id.Contains((long)x.DJYID)).ToList();
|
|
|
if (currList.Count == djyidList_have.Count)
|
|
|
{
|
|
|
//对应正确
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
foreach (var item in djyidList_have)
|
|
|
{
|
|
|
|
|
|
if (!currList.Exists(x => x.DJYID == item.Id && x.MBLNO == item.MBLNO))
|
|
|
{
|
|
|
var senditem = param.Normal.First(x => x.Id == item.Id);
|
|
|
var rec = new DJYCHECK_BILL_REPLY(item.Id, "Normal", item.MBLNO);
|
|
|
resultData.Normal.Add(rec);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//分单
|
|
|
//if (djyidList_have_child.Count > 0)
|
|
|
//{
|
|
|
// var currList = cdc.t_op_seae_assistant.Where(x => djyidList_have_child.Contains((long)x.DJYCHILDRENID)).ToList();
|
|
|
// if (currList.Count == djyidList_have_child.Count)
|
|
|
// {
|
|
|
// //对应正确
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// foreach (var item in djyidList_have_child)
|
|
|
// {
|
|
|
// if (!currList.Exists(x => x.DJYCHILDRENID == item))
|
|
|
// {
|
|
|
// //看看返回数据里有没有主单信息 如果没有
|
|
|
// var zd = param.Normal.FirstOrDefault(x => x.Sub.Exists(y => y.Id == item));
|
|
|
// var hblno = zd.Sub.FirstOrDefault(x => x.Id == item).MBLNO;
|
|
|
// var mblno = zd.MBLNO;
|
|
|
|
|
|
// var rec = new DJYCHECK_BILL_REPLY(item, "Normal", mblno);
|
|
|
// rec.Result = $"分单号[{hblno}]" + rec.Result;
|
|
|
// resultData.Normal.Add(rec);
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
if (djyidList_deleted.Count > 0)
|
|
|
{
|
|
|
var djyidList_deleted_id = djyidList_have.Select(s => s.Id).ToList();
|
|
|
var currList = cdc.OP_SEAE.Where(x => djyidList_deleted_id.Contains((long)x.DJYID)).ToList();
|
|
|
if (currList.Count == 0)
|
|
|
{
|
|
|
//对应正确
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
foreach (var item in djyidList_deleted)
|
|
|
{
|
|
|
if (currList.Exists(x => x.DJYID == item.Id))
|
|
|
{
|
|
|
var currrec = currList.First(x => x.DJYID == item.Id);
|
|
|
var rec = new DJYCHECK_BILL_REPLY(item.Id, "Deleted", currrec.MBLNO);
|
|
|
resultData.Deleted.Add(rec);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result.Success = true;
|
|
|
result.Message = "";
|
|
|
result.Data = resultData;
|
|
|
|
|
|
return new DJYCHECK_REPLY(result);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
//var newerror = new t_sys_soft_error_md();
|
|
|
//newerror.针对版本 = 0;
|
|
|
//newerror.升级日期 = DateTime.Now;
|
|
|
//newerror.升级人 = "管理员";
|
|
|
//newerror.执行文件 = $"[{ex.Message}]" + errorstr;
|
|
|
//var ds62 = new CommonDataContext();
|
|
|
//ds62.t_sys_soft_error.Add(newerror);
|
|
|
//ds62.SaveChanges();
|
|
|
|
|
|
BasicDataRefDAL.SaveLog(JsonConvert.Serialize(ex),"", "大简云数据比对校验", "错误");
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = ex.Message;
|
|
|
|
|
|
return new DJYCHECK_REPLY(result);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
public class DJYINFOBASE
|
|
|
{
|
|
|
// {
|
|
|
// {
|
|
|
// "Normal": [
|
|
|
// {
|
|
|
// "Id": 0,
|
|
|
// "MBLNO": "",
|
|
|
// "Sub": [
|
|
|
// {
|
|
|
// "Id": 0,
|
|
|
// "MBLNO": ""
|
|
|
// }
|
|
|
// ]
|
|
|
// }
|
|
|
// ],
|
|
|
// "Deleted": [
|
|
|
// {
|
|
|
// "Id": 0,
|
|
|
// "MBLNO": ""
|
|
|
// }
|
|
|
// ]
|
|
|
//}
|
|
|
|
|
|
|
|
|
// {
|
|
|
// {
|
|
|
// "Code": 200,
|
|
|
// "Message": "",
|
|
|
// "Data": {
|
|
|
// "Normal": [
|
|
|
// {
|
|
|
// "Id": 123123,
|
|
|
// "Result": "没有此票业务"
|
|
|
// }
|
|
|
// ],
|
|
|
// "Deleted": [
|
|
|
// {
|
|
|
// "Id": 234234,
|
|
|
// "Result": "此业务未删除"
|
|
|
// }
|
|
|
// ]
|
|
|
// }
|
|
|
//}
|
|
|
public int? Code { get; set; }
|
|
|
public string Message { get; set; }
|
|
|
}
|
|
|
|
|
|
|
|
|
public class DJYCHECK_BILL_SEND
|
|
|
{
|
|
|
public long Id { get; set; }
|
|
|
public string MBLNO { get; set; }
|
|
|
public List<DJYCHECK_BILL_SEND> Sub { get; set; }
|
|
|
}
|
|
|
public class DJYCHECK_DATA_SEND
|
|
|
{
|
|
|
public List<DJYCHECK_BILL_SEND> Normal { get; set; }
|
|
|
public List<DJYCHECK_BILL_SEND> Deleted { get; set; }
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class DJYCHECK_BILL_REPLY
|
|
|
{
|
|
|
public long Id { get; set; }
|
|
|
public int Code { get; set; } = 200;
|
|
|
public string MBLNO { get; set; }
|
|
|
|
|
|
public string Result { get; set; }
|
|
|
|
|
|
|
|
|
public DJYCHECK_BILL_REPLY() { }
|
|
|
|
|
|
public DJYCHECK_BILL_REPLY(long id, string replytype, string MBLNO)
|
|
|
{
|
|
|
Id = id;
|
|
|
this.MBLNO = MBLNO;
|
|
|
if (replytype == "Normal") Result = "没有此票业务";
|
|
|
if (replytype == "Deleted") Result = "此业务未删除";
|
|
|
}
|
|
|
}
|
|
|
public class DJYCHECK_DATA_REPLY
|
|
|
{
|
|
|
public List<DJYCHECK_BILL_REPLY> Normal { get; set; }
|
|
|
public List<DJYCHECK_BILL_REPLY> Deleted { get; set; }
|
|
|
}
|
|
|
public class DJYCHECK_REPLY : DJYINFOBASE
|
|
|
{
|
|
|
public DJYCHECK_DATA_REPLY Data { get; set; }
|
|
|
public DJYCHECK_REPLY() { }
|
|
|
public DJYCHECK_REPLY(DBResult result)
|
|
|
{
|
|
|
if (result.Success)
|
|
|
{
|
|
|
Code = 200;
|
|
|
}
|
|
|
else { Code = 1; }
|
|
|
|
|
|
Message = result.Message;
|
|
|
|
|
|
Data = (DJYCHECK_DATA_REPLY)(result.Data);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 大简云 删除业务
|
|
|
public class DJYBILLDELETE_SEND : t_PublicInterface_Log_md
|
|
|
{
|
|
|
public List<DJYCHECK_BILL_SEND> Delete { get; set; }
|
|
|
|
|
|
public void Save()
|
|
|
{
|
|
|
var saverec = getsaverec();
|
|
|
if (!string.IsNullOrWhiteSpace(saverec.Param) && !string.IsNullOrWhiteSpace(saverec.PORTNAME))
|
|
|
{
|
|
|
var cdc = new CommonDataContext();
|
|
|
cdc.t_PublicInterface_Log.Add(saverec);
|
|
|
cdc.SaveChanges();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public t_PublicInterface_Log_md getsaverec()
|
|
|
{
|
|
|
var result = new t_PublicInterface_Log_md();
|
|
|
try
|
|
|
{
|
|
|
result.GID = Guid.NewGuid().ToString();
|
|
|
result.Param = JsonConvert.Serialize(Delete);
|
|
|
result.CreateTime = DateTime.Now;
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public class DJYBILLDELETE_REPLYDATA
|
|
|
{
|
|
|
public List<DJYCHECK_BILL_REPLY> Deleted { get; set; }
|
|
|
public List<DJYCHECK_BILL_REPLY> NoDeleted { get; set; }
|
|
|
|
|
|
public DJYBILLDELETE_REPLYDATA()
|
|
|
{
|
|
|
Deleted = new List<DJYCHECK_BILL_REPLY>();
|
|
|
NoDeleted = new List<DJYCHECK_BILL_REPLY>();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public class DJYBILLDELETE_REPLY : DJYINFOBASE
|
|
|
{
|
|
|
public DJYBILLDELETE_REPLYDATA Data { get; set; }
|
|
|
|
|
|
//public DJYBILLDELETE_REPLY() { }
|
|
|
public DJYBILLDELETE_REPLY()
|
|
|
{
|
|
|
Code = 200;
|
|
|
Message = null;
|
|
|
Data = new DJYBILLDELETE_REPLYDATA();
|
|
|
}
|
|
|
|
|
|
public void Deleted(long Id, string MBLNO)
|
|
|
{
|
|
|
var newrec = new DJYCHECK_BILL_REPLY() { Id = Id, MBLNO = MBLNO };
|
|
|
Data.Deleted.Add(newrec);
|
|
|
}
|
|
|
public void NoDeleted(long Id, string MBLNO, string Result, int code = 200)
|
|
|
{
|
|
|
var newrec = new DJYCHECK_BILL_REPLY() { Id = Id, MBLNO = MBLNO, Result = Result, Code = code };
|
|
|
Data.NoDeleted.Add(newrec);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 用于删除大简云业务
|
|
|
/// </summary>
|
|
|
public class DJYBILLDELETE
|
|
|
{
|
|
|
|
|
|
public DJYBILLDELETE_REPLY DoSet(DJYBILLDELETE_SEND param)
|
|
|
{
|
|
|
|
|
|
var errorstr = "";
|
|
|
var result = new DJYBILLDELETE_REPLY();
|
|
|
errorstr = JsonConvert.Serialize(param);
|
|
|
var curritem = new DJYCHECK_BILL_SEND();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//大简云已有
|
|
|
if (param.Delete != null && param.Delete.Count > 0)
|
|
|
{
|
|
|
var cdc = new CommonDataContext();
|
|
|
|
|
|
foreach (var item in param.Delete)
|
|
|
{
|
|
|
curritem = item;
|
|
|
var id = item.Id;
|
|
|
//logger.Debug($"删除订舱信息:DJYID:{id}");
|
|
|
|
|
|
long idlong = Convert.ToInt64(id);
|
|
|
|
|
|
var currentBillList = cdc.OP_SEAE.Where(x => x.DJYID == idlong).ToList();
|
|
|
|
|
|
if (currentBillList != null && currentBillList.Count > 0)
|
|
|
{
|
|
|
var delrec = currentBillList[0];
|
|
|
var headid = delrec.BSNO;
|
|
|
|
|
|
|
|
|
|
|
|
if (!CanDelete(delrec))
|
|
|
{
|
|
|
result.NoDeleted(item.Id, item.MBLNO, "该业务存在费用或已锁定,无法删除");
|
|
|
|
|
|
continue;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
var _r = DoDelete(headid);
|
|
|
|
|
|
if (_r)
|
|
|
{
|
|
|
result.Deleted(item.Id, item.MBLNO);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.NoDeleted(item.Id, item.MBLNO, "查看东胜日志表t_PublicInterface_Log", 500);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
{
|
|
|
result.NoDeleted(item.Id, item.MBLNO, "东胜系统不存在该业务", 201);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
BasicDataRefDAL.SaveLog(JsonConvert.Serialize( result),"DJYDELETE","大简云订舱删除","记录" );
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
//var newerror = new t_sys_soft_error_md();
|
|
|
//newerror.针对版本 = 0;
|
|
|
//newerror.升级日期 = DateTime.Now;
|
|
|
//newerror.升级人 = "管理员";
|
|
|
//newerror.执行文件 = $"[{ex.Message}]" + errorstr;
|
|
|
//var ds62 = new DS6DataContext();
|
|
|
//ds62.t_sys_soft_error.Add(newerror);
|
|
|
//ds62.SaveChanges();
|
|
|
|
|
|
//InterfaceLog.Save("DJYDELETE_Error", ex);
|
|
|
BasicDataRefDAL.SaveLog(JsonConvert.Serialize(ex), "DJYDELETE_Error", "大简云订舱删除", "错误");
|
|
|
|
|
|
|
|
|
result.Code = 0;
|
|
|
result.Message = ex.Message;
|
|
|
result.NoDeleted(curritem.Id, curritem.MBLNO, ex.Message);
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
public bool DoDelete(string BSNO)
|
|
|
{
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
var DS6Data = new CommonDataContext();
|
|
|
|
|
|
var delrec = DS6Data.OP_SEAE.FirstOrDefault(x => x.BSNO == BSNO);
|
|
|
|
|
|
|
|
|
var ctnlist = DS6Data.OP_CTN.Where(x => x.BSNO == BSNO).ToList();
|
|
|
if (ctnlist != null && ctnlist.Count > 0)
|
|
|
{
|
|
|
//logger.Debug($"删除订舱信息:ctnlist:{JsonConvert.SerializeObject(ctnlist)}");
|
|
|
DS6Data.OP_CTN.RemoveRange(ctnlist);
|
|
|
//blUpSQL1 += $" delete from t_op_ctn where 编号='{编号}' ";
|
|
|
}
|
|
|
|
|
|
InterfaceLog.Save("DJYDELETE_DoDelete", delrec);
|
|
|
DS6Data.OP_SEAE.Remove(delrec);
|
|
|
|
|
|
//logger.Debug($"删除订舱信息:DJYID:{id}");
|
|
|
DS6Data.SaveChanges();
|
|
|
//logger.Debug($"删除订舱信息:DJYID:OK");
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
InterfaceLog.Save("DJYDELETE_DoDeleteError", ex);
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public bool CanDelete(op_seae_md opseae)
|
|
|
{
|
|
|
var cdc = new CommonDataContext();
|
|
|
var chfeeList = cdc.ch_fee.Where(x => x.BSNO == opseae.BSNO).ToList();
|
|
|
|
|
|
if (chfeeList == null || chfeeList.Count == 0)
|
|
|
{
|
|
|
//return true;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
var headList = cdc.OP_SEAE.Where(s => s.BSNO == opseae.BSNO).ToList();
|
|
|
|
|
|
if (headList != null && headList.Count > 0)
|
|
|
{
|
|
|
var head = headList[0];
|
|
|
|
|
|
if (head.BSSTATUS == true || head.FEESTATUS == true) {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
} |