|
|
using System;
|
|
|
using System.Web.Mvc;
|
|
|
using DSWeb.EntityDA;
|
|
|
using System.Data;
|
|
|
using System.Text;
|
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
|
using System.Net;
|
|
|
using System.IO;
|
|
|
using System.Linq;
|
|
|
using System.Data.Entity.Validation;
|
|
|
using System.Collections.Generic;
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
using Newtonsoft.Json;
|
|
|
using System.Net.Http;
|
|
|
using DSWeb.Common.DbContexts.Model;
|
|
|
using DSWeb.Common.DbContexts;
|
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
using log4net;
|
|
|
using DSWeb.Models;
|
|
|
using DSWeb.Common.DB;
|
|
|
using DSWeb.Common.Model;
|
|
|
using DSWeb.Common.Helper;
|
|
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
|
{
|
|
|
public class HuaiTaiInsuranceController : Controller
|
|
|
{
|
|
|
// GET:
|
|
|
OpSeaePxDbContenxt context = new OpSeaePxDbContenxt();
|
|
|
CommonDataContext commonData = new CommonDataContext();
|
|
|
private ILog logger = LogManager.GetLogger("HuaiTaiInsuranceController");
|
|
|
private string HTUrl = "";
|
|
|
private string userKey = "";
|
|
|
private string FilePathStr = "http://localhost:64909/Default.aspx";
|
|
|
|
|
|
private const string MianPeiStr = "Deductible and special condition to the specified subject matter insured: 1.Fragile Products,showcase, Furniture and Electrical Appliance, Digital Products: USD500 or 2% of total sum insured each and every loss, whichever is higher; 2. Metal Products and Machinery and Equipment: Excluding the risks of oxidation, denting, marring, chipping and scratching unless caused by a peril covered; 3. Pharmaceuticals (In normal temperature): 2% of total sum insured each and every loss; 4. Packed Foods: 0.5% of total sum insured each and every loss.";
|
|
|
|
|
|
#region 构造
|
|
|
public HuaiTaiInsuranceController()
|
|
|
{
|
|
|
var paraUrl = commonData.ParamSets.AsNoTracking().FirstOrDefault(p => p.PARAMNAME == "HuaiTaiInsuranceUrl");
|
|
|
if (paraUrl == null || string.IsNullOrEmpty(paraUrl.PARAMVALUE))
|
|
|
{
|
|
|
throw new Exception("华泰保险url配置有误,请联系管理员");
|
|
|
}
|
|
|
|
|
|
HTUrl = paraUrl.PARAMVALUE;
|
|
|
if (!HTUrl.EndsWith("/"))
|
|
|
{
|
|
|
HTUrl = HTUrl + "/";
|
|
|
}
|
|
|
|
|
|
var paraInfoUrl = commonData.ParamSets.AsNoTracking().FirstOrDefault(p => p.PARAMNAME == "HuaiTaiInsuranceUserInfoUrl");
|
|
|
if (paraInfoUrl == null || string.IsNullOrEmpty(paraInfoUrl.PARAMVALUE))
|
|
|
{
|
|
|
throw new Exception("华泰保险用户信息url配置有误,请联系管理员");
|
|
|
}
|
|
|
|
|
|
FilePathStr = paraInfoUrl.PARAMVALUE;
|
|
|
if (FilePathStr.EndsWith("/"))
|
|
|
{
|
|
|
FilePathStr = FilePathStr.Substring(0, FilePathStr.Length - 1);
|
|
|
}
|
|
|
|
|
|
var paraUserKey = commonData.ParamSets.AsNoTracking().FirstOrDefault(p => p.PARAMNAME == "HuaiTaiInsuranceUserKey");
|
|
|
if (paraUserKey == null || string.IsNullOrEmpty(paraUserKey.PARAMVALUE))
|
|
|
{
|
|
|
throw new Exception("华泰保险用户KEY配置有误,请联系管理员");
|
|
|
}
|
|
|
|
|
|
userKey = paraUserKey.PARAMVALUE;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
string userid = Convert.ToString(Session["USERID"]);
|
|
|
//var str = GetRangDAStr("index", userid, Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
if (userid == "" || userid == null)
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登陆状态失效,请重新登陆进行操作!" };
|
|
|
return Json(new { Success = false, Message = "登陆状态失效,请重新登陆进行操作!", totalCount = 0, data = 0 }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
|
|
|
//加验证:必须通过企业认证
|
|
|
var user = context.Users.AsNoTracking().First(u => u.GID == userid);
|
|
|
if (!string.IsNullOrEmpty(user.CompId))
|
|
|
{
|
|
|
var comp = context.CompanyNew.AsNoTracking().First(c => c.CompId == user.CompId);
|
|
|
if (comp.AuditStatus == Common.DB.CompanyNew.AuditStatusSuccess)
|
|
|
{
|
|
|
var action = commonData.action.Where(x => x.NAME == "modbaoxianShowDelManage").FirstOrDefault();
|
|
|
if (action != null)
|
|
|
{
|
|
|
|
|
|
var action_user = commonData.user_action.Where(x => x.ACTIONID == action.GID && x.USERID == user.GID).FirstOrDefault();
|
|
|
if (action_user != null)
|
|
|
{
|
|
|
|
|
|
ViewData["isedit"] = "true";
|
|
|
}
|
|
|
else { ViewData["isedit"] = "false"; }
|
|
|
|
|
|
}
|
|
|
else { ViewData["isedit"] = "false"; }
|
|
|
|
|
|
ViewData["isedit"] = "true";
|
|
|
return View();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return Content("<script>location.href='/MvcShipping/HuaiTaiInsurance/Error'</script>");
|
|
|
}
|
|
|
public ActionResult InsuranceOK(string id = null, string InsID = null)
|
|
|
{
|
|
|
string userid = Convert.ToString(Session["USERID"]);
|
|
|
//var str = GetRangDAStr("index", userid, Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
if (userid == "" || userid == null)
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登陆状态失效,请重新登陆进行操作!" };
|
|
|
return Json(new { Success = false, Message = "登陆状态失效,请重新登陆进行操作!", totalCount = 0, data = 0 }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
id = Request.QueryString["id"];
|
|
|
InsID = Request.QueryString["InsID"];
|
|
|
if (!string.IsNullOrEmpty(InsID))
|
|
|
{
|
|
|
var t = context.Insurance.Where(p => p.GID == InsID).FirstOrDefault();
|
|
|
var moneyType = context.CodeInsuranceCurrency.Select(p => p.Code).Distinct().ToList();
|
|
|
ViewData["moneyType"] = moneyType;
|
|
|
ViewData["MBLNO"] = t.BillNumber;//提单号
|
|
|
ViewData["Marks"] = t.Sign;//唛头
|
|
|
ViewData["Descript"] = t.FregihtItem;//描述
|
|
|
ViewData["Vessel"] = t.TrafficNumber;//船名
|
|
|
ViewData["Voyno"] = t.FlightsCheduled;//航次
|
|
|
ViewData["state"] = t.states;
|
|
|
ViewData["Etd"] = t.StartTM == null ? "" : Convert.ToDateTime(t.StartTM).ToString("yyyy-MM-dd");//起运日期
|
|
|
ViewData["Scountry"] = CountryName(t.FromContry);//启运国
|
|
|
ViewData["Ecountry"] = CountryName(t.ToContry);//目的国
|
|
|
ViewData["DispFromCountry"] = CountryDisplay(t.FromContry);
|
|
|
ViewData["DispToCountry"] = CountryDisplay(t.ToContry);
|
|
|
ViewData["portload"] = t.FromArea;//启运港
|
|
|
ViewData["PORTDISCHARGE"] = t.ToArea;//目的港
|
|
|
ViewData["beibaoren"] = t.BInsuredName;//被保人
|
|
|
ViewData["toubaoren"] = Convert.ToString(Session["COMNAME"]);//投保人
|
|
|
//var snumb = "QDDJY" + DateTime.Now.ToString("yyyyMMddHHmmss") + DateTime.Now.Millisecond;//流水号
|
|
|
//ViewData["liushui"] = snumb;
|
|
|
ViewData["sumAndb"] = t.PackAndQuantity;
|
|
|
var vnumb = context.TSysCountryCode.AsNoTracking().Where(c => c.parameterCode != null && c.parameterCode != "").OrderBy(c => c.CountryCode).Distinct().ToList();
|
|
|
ViewData["country"] = vnumb;
|
|
|
ViewData["StartPort"] = context.CodeLoadport.ToList();
|
|
|
ViewData["EndPort"] = context.CodeDisport.ToList();
|
|
|
//var chaka = CountryCode(context.TSysCountryCode.Where(p => p.CountryCode == t.ToContry).FirstOrDefault().CountryName);
|
|
|
ViewData["ChaK"] = context.TsysCountryCodeCheckone.Where(p => p.Nation == t.ToContry).ToList();
|
|
|
ViewData["CDid"] = id;
|
|
|
ViewData["currency"] = GetMoneyName(t.AmtCurrency);
|
|
|
ViewData["letterOf"] = t.CreditNODesc;
|
|
|
ViewData["NewSpecialAgreement"] = t.NewSpecialAgreement;
|
|
|
ViewData["SurveyAdr"] = t.SurveyAdr == null ? "" : t.SurveyAdr;
|
|
|
ViewData["InvoiceMoney"] = t.InvoiceMoney;
|
|
|
ViewData["ExchangeRate"] = t.ExchangeRate;
|
|
|
ViewData["InvoiceBonus"] = t.InvoiceBonus;
|
|
|
ViewData["CargoType"] = t.CargoType;
|
|
|
ViewData["TransportDetail"] = t.TransportDetail;
|
|
|
ViewData["OriginalSum"] = t.OriginalSum;
|
|
|
ViewData["toubaoren"] = t.ApplicantName;
|
|
|
ViewData["liushui"] = t.SerialNumber;
|
|
|
ViewData["Premium"] = t.Premium;
|
|
|
ViewData["CargoType"] = t.CargoType;
|
|
|
ViewData["WarIns"] = t.WarIns.ToString();
|
|
|
ViewData["StrikeIns"] = t.StrikeIns.ToString();
|
|
|
ViewData["changeRate"] = t.ChargeRate;
|
|
|
ViewData["IsModify"] = true;
|
|
|
ViewData["MianPeiContent"] = t.MianPeiContent;
|
|
|
ViewData["InvoiceNumber"] = t.InvoiceNumber;
|
|
|
ViewData["InsuranceNumber"] = t.InsuranceNumber;
|
|
|
return View();
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(id))
|
|
|
{
|
|
|
var pople = Convert.ToString(Session["COMNAME"]);
|
|
|
var s = context.CompanyNew.Where(p => p.CompName == pople).ToList();
|
|
|
if (s.Count() < 1)
|
|
|
{
|
|
|
return Content("<script>location.href='/MvcShipping/HuaiTaiInsurance/Error'</script>");
|
|
|
}
|
|
|
if (s.FirstOrDefault().AuditStatus != "Success")
|
|
|
{
|
|
|
return Content("<script>alert('企业认证尚未通过,请稍后'); window.close();</script> ");
|
|
|
}
|
|
|
var cd = context.OpSeaeEdi.Where(p => p.MFNO == id).FirstOrDefault();
|
|
|
var sss = context.Insurance.Where(p => p.BillNumber == cd.MBLNO).ToList();
|
|
|
var model = sss.FirstOrDefault();
|
|
|
var ts = sss.Count();
|
|
|
if (ts > 0)
|
|
|
{
|
|
|
return Content("<script>location.href=\"/MvcShipping/HuaiTaiInsurance/InsuranceOK?id=&InsID=" + model.GID + "\"</script>");
|
|
|
}
|
|
|
if (id == null)
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
ViewData["changeRate"] = 0.00035;
|
|
|
ViewData["state"] = "";
|
|
|
ViewData["WarIns"] = false;
|
|
|
ViewData["StrikeIns"] = false;
|
|
|
ViewData["CargoType"] = "";
|
|
|
ViewData["Premium"] = "0";
|
|
|
ViewData["InvoiceBonus"] = "";
|
|
|
ViewData["CargoType"] = "";
|
|
|
ViewData["TransportType"] = "";
|
|
|
ViewData["OriginalSum"] = "";
|
|
|
var moneyType = context.CodeInsuranceCurrency.Select(p => p.Code).Distinct().ToList();
|
|
|
ViewData["moneyType"] = moneyType;
|
|
|
ViewData["currency"] = "USD";
|
|
|
ViewData["letterOf"] = "";
|
|
|
ViewData["SurveyAdr"] = "";
|
|
|
ViewData["InvoiceMoney"] = "";
|
|
|
ViewData["TransportDetail"] = "";
|
|
|
ViewData["NewSpecialAgreement"] = "";
|
|
|
var t = context.OpSeaeEdi.Where(p => p.MFNO == id).FirstOrDefault();
|
|
|
ViewData["MBLNO"] = t.MBLNO;//提单号
|
|
|
ViewData["Marks"] = t.MARKS;//唛头
|
|
|
ViewData["Descript"] = t.DESCRIPTION;//描述
|
|
|
ViewData["Vessel"] = t.VESSEL;//船名
|
|
|
ViewData["Voyno"] = t.VOYNO;//航次
|
|
|
ViewData["Etd"] = t.ETD == null ? "" : Convert.ToDateTime(t.ETD).ToString("yyyy-MM-dd");//起运日期
|
|
|
ViewData["Scountry"] = CountryName(t.SHIPPERCOUNTRY);//启运国
|
|
|
ViewData["Ecountry"] = CountryName(t.NOTIFYPARTYCOUNTRY);//目的国
|
|
|
ViewData["portload"] = t.PORTLOAD;//启运港
|
|
|
ViewData["PORTDISCHARGE"] = t.PORTDISCHARGE;//目的港
|
|
|
ViewData["DispFromCountry"] = CountryDisplay(t.SHIPPERCOUNTRY);
|
|
|
ViewData["DispToCountry"] = CountryDisplay(t.NOTIFYPARTYCOUNTRY);
|
|
|
if (t.CONSIGNEENAME.ToUpper().Contains("ORDER"))
|
|
|
{
|
|
|
ViewData["beibaoren"] = t.NOTIFYPARTYNAME;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ViewData["beibaoren"] = t.CONSIGNEENAME;//被保人
|
|
|
}
|
|
|
ViewData["toubaoren"] = Convert.ToString(Session["COMNAME"]);//投保人
|
|
|
var snumb = "QDDJY" + DateTime.Now.ToString("yyyyMMddHHmmss") + DateTime.Now.Millisecond;//流水号
|
|
|
ViewData["liushui"] = snumb;
|
|
|
ViewData["sumAndb"] = t.PKGS + t.KINDPKGS;
|
|
|
var vnumb = context.TSysCountryCode.AsNoTracking().Where(c => c.parameterCode != null && c.parameterCode != "").OrderBy(c => c.CountryCode).Distinct().ToList();
|
|
|
ViewData["country"] = vnumb;
|
|
|
ViewData["StartPort"] = context.CodeLoadport.ToList();
|
|
|
ViewData["EndPort"] = context.CodeDisport.ToList();
|
|
|
var countryname = context.TSysCountryCode.Where(p => p.CountryCode == t.NOTIFYPARTYCOUNTRY).FirstOrDefault();
|
|
|
var chaka = "";
|
|
|
if (countryname == null)
|
|
|
{
|
|
|
chaka = CountryCode("HTC01");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
chaka = CountryCode(countryname.CountryName);
|
|
|
}
|
|
|
|
|
|
ViewData["ChaK"] = context.TsysCountryCodeCheckone.Where(p => p.Nation == chaka).ToList();
|
|
|
ViewData["CDid"] = id;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ActionResult InsuranceEdit(string id = null)
|
|
|
{
|
|
|
string userid = Convert.ToString(Session["USERID"]);
|
|
|
|
|
|
if (userid == "" || userid == null)
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登陆状态失效,请重新登陆进行操作!" };
|
|
|
return Json(new { Success = false, Message = "登陆状态失效,请重新登陆进行操作!", totalCount = 0, data = 0 }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(id))
|
|
|
{
|
|
|
var t = context.Insurance.Where(p => p.GID == id).FirstOrDefault();
|
|
|
ViewData["InsuranceNumber"] = t.InsuranceNumber;//保单号
|
|
|
ViewData["MBLNO"] = t.BillNumber;//提单号
|
|
|
ViewData["states"] = t.states;//保单状态
|
|
|
ViewData["SerialNumber"] = t.SerialNumber; ///流水
|
|
|
ViewData["PdfURL"] = t.PdfURL;//船名
|
|
|
ViewData["Premium"] = t.Premium;//航次
|
|
|
ViewData["id"] = t.GID;//航次
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
[ValidateInput(false)]
|
|
|
[HttpPost]
|
|
|
public ActionResult insert(Insurance insursn, string GID, string InsId = null)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
|
|
|
var moth = Convert.ToDateTime(DateTime.Now.Year + "/" + (DateTime.Now.Month) + "/01");
|
|
|
var type = context.CodeInsuranceCurrency.Where(p => p.Code == "USD").FirstOrDefault();
|
|
|
var hl = context.CodeInsuranceExchange.Where(p => p.CurrencyId == type.Gid && p.Month >= moth).FirstOrDefault();
|
|
|
if (!string.IsNullOrEmpty(InsId))
|
|
|
{
|
|
|
var insmod = context.Insurance.Where(p => p.GID == InsId).FirstOrDefault();
|
|
|
if (insmod.states != "已录入" && insmod.states != "发送失败" && insmod.states != "保单生效")
|
|
|
{
|
|
|
return Json(new { state = 1, msg = "当前状态不符合投保条件", id = "" }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
insmod.AmtCurrency = GetMoneyCode(insursn.AmtCurrency);
|
|
|
insmod.BInsuredName = insursn.BInsuredName;
|
|
|
insmod.BillNumber = insursn.BillNumber;
|
|
|
insmod.CargoType = insursn.CargoType;
|
|
|
insmod.ChargeRate = insursn.ChargeRate;
|
|
|
insmod.CreditNODesc = insursn.CreditNODesc;
|
|
|
insmod.ExchangeRate = insursn.ExchangeRate;
|
|
|
insmod.FlightsCheduled = insursn.FlightsCheduled;
|
|
|
insmod.FregihtItem = insursn.FregihtItem;
|
|
|
insmod.FromArea = insursn.FromArea;
|
|
|
insmod.FromContry = CountryCode(insursn.FromContry);
|
|
|
insmod.InsuranceName = insursn.InsuranceName;
|
|
|
insmod.InvoiceBonus = insursn.InvoiceBonus;
|
|
|
insmod.InvoiceMoney = insursn.InvoiceMoney;
|
|
|
insmod.NewSpecialAgreement = insursn.NewSpecialAgreement;
|
|
|
insmod.OriginalSum = insursn.OriginalSum;
|
|
|
insmod.PackAndQuantity = insursn.PackAndQuantity;
|
|
|
insmod.RdrCde = insursn.RdrCde;
|
|
|
insmod.SerialNumber = insursn.SerialNumber;
|
|
|
insmod.Sign = insursn.Sign;
|
|
|
insmod.InsuranceNumber = insursn.InsuranceNumber;
|
|
|
insmod.Amt = insursn.InvoiceMoney * insursn.InvoiceBonus;
|
|
|
if (insursn.CargoType == "21")
|
|
|
{
|
|
|
insmod.SpecialAgreement = (500 * hl.EXChange) > (insursn.InvoiceMoney * (decimal)0.05) ? (500 * hl.EXChange).ToString() : (insursn.InvoiceMoney * (decimal)0.05).ToString();
|
|
|
}
|
|
|
else if (insursn.CargoType == "22")
|
|
|
{
|
|
|
insmod.SpecialAgreement = (1000 * hl.EXChange) > (insursn.InvoiceMoney * (decimal)0.05) ? (1000 * hl.EXChange).ToString() : (insursn.InvoiceMoney * (decimal)0.05).ToString();
|
|
|
}
|
|
|
else if (insursn.CargoType == "25")
|
|
|
{
|
|
|
insmod.SpecialAgreement = (insursn.InvoiceMoney * (decimal)0.05).ToString();
|
|
|
}
|
|
|
else if (insursn.CargoType == "26")
|
|
|
{
|
|
|
insmod.SpecialAgreement = (insursn.InvoiceMoney * (decimal)0.005).ToString();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
insmod.SpecialAgreement = "0";
|
|
|
}
|
|
|
insmod.StartTM = insursn.StartTM;
|
|
|
insmod.SurveyAdrID = insursn.SurveyAdr;
|
|
|
if (!string.IsNullOrEmpty(insursn.SurveyAdr))
|
|
|
{
|
|
|
insmod.SurveyAdr = context.TsysCountryCodeCheckone.Where(p => p.PARTYCODE == insursn.SurveyAdr).FirstOrDefault().SurveyAddress;
|
|
|
}
|
|
|
|
|
|
//货物类型是特殊货物、货值大于500万、信用证条款或备注不为空、特殊国家,需要人工核保
|
|
|
if (insursn.CargoType == "29" || insursn.InvoiceMoney * insursn.InvoiceBonus > 5000000 || !string.IsNullOrEmpty(insursn.CreditNODesc) || !string.IsNullOrEmpty(insursn.NewSpecialAgreement) || IsCoutryTS(CountryCode(insursn.ToContry)))
|
|
|
{
|
|
|
insmod.HBFlag = false;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
insmod.HBFlag = true;
|
|
|
}
|
|
|
insmod.ToArea = insursn.ToArea;
|
|
|
insmod.ToContry = CountryCode(insursn.ToContry);
|
|
|
insmod.TrafficNumber = insursn.TrafficNumber;
|
|
|
insmod.TransportDetail = insursn.TransportDetail;
|
|
|
insmod.WarIns = insursn.WarIns;
|
|
|
insmod.StrikeIns = insursn.StrikeIns;
|
|
|
insmod.NewSpecialAgreement = insursn.NewSpecialAgreement == null ? "" : insursn.NewSpecialAgreement;
|
|
|
insmod.CreditNODesc = insursn.CreditNODesc == null ? "" : insursn.CreditNODesc;
|
|
|
insmod.FregihtItem = insursn.FregihtItem == null ? "" : insursn.FregihtItem;
|
|
|
insmod.PackAndQuantity = insursn.PackAndQuantity == null ? "" : insursn.PackAndQuantity;
|
|
|
insmod.Sign = insursn.Sign == null ? "" : insursn.Sign;
|
|
|
insmod.MianPeiContent = insursn.MianPeiContent;
|
|
|
insmod.InvoiceNumber = string.IsNullOrEmpty(insursn.InvoiceNumber) ? "" : insursn.InvoiceNumber;
|
|
|
context = new OpSeaePxDbContenxt();
|
|
|
context.Entry(insmod).State = System.Data.Entity.EntityState.Modified;
|
|
|
var sta = context.SaveChanges();
|
|
|
if (sta > 0)
|
|
|
{
|
|
|
return Json(new { state = 1, msg = "修改成功", id = "" }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
return Json(new { state = -2, msg = "修改失败", id = "" }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var pople = Convert.ToString(Session["COMNAME"]);
|
|
|
var info = context.CompanyNew.Where(p => p.CompName == pople).ToList();
|
|
|
var ts = context.Insurance.Where(p => p.CDID == GID).Count();
|
|
|
if (ts > 0 && GID != "")
|
|
|
{
|
|
|
return Json(new { state = -5, msg = "保单已存在不允许重复添加", id = insursn.GID }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
var userid = Convert.ToString(Session["USERID"]);
|
|
|
var user = context.Users.Where(p => p.GID == userid).FirstOrDefault();
|
|
|
if (!user.isinsurance.HasValue || !user.isinsurance.Value)
|
|
|
{
|
|
|
|
|
|
var rgin = Registe(userid);
|
|
|
if (rgin == -1)
|
|
|
{
|
|
|
return Json(new { state = -1, msg = "账户注册失败" }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var edi = context.OpSeaeEdi.Where(p => p.MFNO == GID).FirstOrDefault();
|
|
|
var uid = Session["USERID"].ToString();
|
|
|
var use = context.Users.Where(p => p.GID == uid).FirstOrDefault();
|
|
|
insursn.CDID = GID;
|
|
|
insursn.GID = getGUID();
|
|
|
insursn.InsuranceCode = "3501";
|
|
|
insursn.TransportType = "SX001501";
|
|
|
insursn.Amt = insursn.InvoiceMoney * insursn.InvoiceBonus;
|
|
|
insursn.AmtCurrency = GetMoneyCode(insursn.AmtCurrency);
|
|
|
if (insursn.ChargeRate == 0)
|
|
|
{
|
|
|
insursn.ChargeRate = (decimal)0.35;
|
|
|
}
|
|
|
insursn.subTim = Convert.ToDateTime("1753/1/2 00:00:00");
|
|
|
//货物类型是特殊货物、货值大于500万、信用证条款或备注不为空、特殊国家,需要人工核保
|
|
|
if (insursn.CargoType == "29" || insursn.InvoiceMoney * insursn.InvoiceBonus > 5000000 || !string.IsNullOrEmpty(insursn.CreditNODesc) || !string.IsNullOrEmpty(insursn.NewSpecialAgreement) || IsCoutryTS(CountryCode(insursn.ToContry)))
|
|
|
{
|
|
|
insursn.HBFlag = false;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
insursn.HBFlag = true;
|
|
|
}
|
|
|
insursn.BIDType = "99";
|
|
|
insursn.FromContry = CountryCode(insursn.FromContry);
|
|
|
insursn.ToContry = CountryCode(insursn.ToContry);
|
|
|
insursn.ApplicantName = Convert.ToString(Session["COMNAME"]);
|
|
|
insursn.BID = edi == null ? string.Empty : (edi.CONSIGNEETEL == null ? "" : edi.CONSIGNEETEL);
|
|
|
if (string.IsNullOrEmpty(insursn.BID))
|
|
|
{
|
|
|
insursn.BID = "13400000000";
|
|
|
}
|
|
|
insursn.DatePritType = "02";
|
|
|
insursn.states = "已录入";
|
|
|
insursn.EmpAccount = use.CODENAME;
|
|
|
if (insursn.CargoType == "21")
|
|
|
{
|
|
|
insursn.SpecialAgreement = (500 * hl.EXChange) > (insursn.InvoiceMoney * (decimal)0.05) ? (500 * hl.EXChange).ToString() : (insursn.InvoiceMoney * (decimal)0.05).ToString();
|
|
|
}
|
|
|
else if (insursn.CargoType == "22")
|
|
|
{
|
|
|
insursn.SpecialAgreement = (1000 * hl.EXChange) > (insursn.InvoiceMoney * (decimal)0.05) ? (1000 * hl.EXChange).ToString() : (insursn.InvoiceMoney * (decimal)0.05).ToString();
|
|
|
}
|
|
|
else if (insursn.CargoType == "25")
|
|
|
{
|
|
|
insursn.SpecialAgreement = (insursn.InvoiceMoney * (decimal)0.05).ToString();
|
|
|
}
|
|
|
else if (insursn.CargoType == "26")
|
|
|
{
|
|
|
insursn.SpecialAgreement = (insursn.InvoiceMoney * (decimal)0.005).ToString();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
insursn.SpecialAgreement = "0";
|
|
|
}
|
|
|
insursn.SurveyAdr = insursn.SurveyAdr == null ? "" : insursn.SurveyAdr;
|
|
|
insursn.SurveyAdrID = insursn.SurveyAdr;
|
|
|
if (!string.IsNullOrEmpty(insursn.SurveyAdr))
|
|
|
{
|
|
|
insursn.SurveyAdr = context.TsysCountryCodeCheckone.Where(p => p.PARTYCODE == insursn.SurveyAdr).FirstOrDefault().SurveyAddress;
|
|
|
}
|
|
|
|
|
|
insursn.NewSpecialAgreement = insursn.NewSpecialAgreement == null ? "" : insursn.NewSpecialAgreement;
|
|
|
insursn.CreditNODesc = insursn.CreditNODesc == null ? "" : insursn.CreditNODesc;
|
|
|
insursn.FregihtItem = insursn.FregihtItem == null ? "" : insursn.FregihtItem;
|
|
|
insursn.PackAndQuantity = insursn.PackAndQuantity == null ? "" : insursn.PackAndQuantity;
|
|
|
insursn.Sign = insursn.Sign == null ? "" : insursn.Sign;
|
|
|
insursn.Address = edi == null ? string.Empty : (edi.SHIPPERADDR1 == null ? "" : edi.SHIPPERADDR1);
|
|
|
insursn.Cell = edi == null ? string.Empty : (edi.SHIPPERTEL == null ? "" : edi.SHIPPERTEL);
|
|
|
insursn.Email = "";
|
|
|
insursn.BAddress = edi == null ? string.Empty : (edi.CONSIGNEEADDR1 == null ? "" : edi.CONSIGNEEADDR1);
|
|
|
insursn.BCell = edi == null ? string.Empty : (edi.CONSIGNEETEL == null ? "" : edi.CONSIGNEETEL);
|
|
|
insursn.BEmail = "";
|
|
|
insursn.BusinessNo = "";
|
|
|
insursn.CreditNO = "";
|
|
|
//if (edi != null)
|
|
|
//{
|
|
|
// insursn.EndTM = Convert.ToDateTime(Convert.ToDateTime(edi.ETD).ToString("yyyy-MM-dd") == null
|
|
|
// ? "1753/1/2 00:00:00" :
|
|
|
// Convert.ToDateTime(edi.ETA).ToString("yyyy-MM-dd")) < Convert.ToDateTime("1753/1/2 00:00:00") ? Convert.ToDateTime("1753/1/2 00:00:00") : Convert.ToDateTime(Convert.ToDateTime(edi.ETA).ToString("yyyy-MM-dd"));
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
insursn.EndTM = insursn.StartTM.Value.AddDays(90);
|
|
|
//}
|
|
|
insursn.IndemnityClaim = "";
|
|
|
insursn.InsuranceNumber = "";
|
|
|
insursn.InvoiceNumber = string.IsNullOrEmpty(insursn.InvoiceNumber) ? "" : insursn.InvoiceNumber;
|
|
|
insursn.PassPort = "";
|
|
|
insursn.PremiumPrit = "02";
|
|
|
insursn.RdrName = "";
|
|
|
insursn.RdrCde = "SX300105";
|
|
|
insursn.Operator = Convert.ToString(Session["SHOWNAME"]);
|
|
|
insursn.OperatorId = Convert.ToString(Session["USERID"]);
|
|
|
insursn.ComName = Convert.ToString(Session["COMNAME"]);
|
|
|
insursn.Premium = insursn.Premium;
|
|
|
//(insursn.InvoiceMoney * insursn.ChargeRate * insursn.InvoiceBonus * insursn.ExchangeRate) < 20 ? 20 : (insursn.InvoiceMoney * insursn.ChargeRate * insursn.InvoiceBonus * insursn.ExchangeRate);
|
|
|
context.Insurance.Add(insursn);
|
|
|
InsuranceRider ride = new InsuranceRider();
|
|
|
ride.RiderState = "创建业务";
|
|
|
ride.RiderAudit = Convert.ToString(Session["SHOWNAME"]);
|
|
|
ride.Gid = getGUID();
|
|
|
ride.Remark = "创建保单";
|
|
|
ride.NID = insursn.GID;
|
|
|
ride.Rider = DateTime.Now;
|
|
|
context.InsuranceRider.Add(ride);
|
|
|
var stae = context.SaveChanges();
|
|
|
if (stae > 0)
|
|
|
{
|
|
|
return Json(new { state = 1, msg = "录入成功", id = insursn.GID }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
return Json(new { state = 0, msg = "录入失败", id = "" }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
catch (DbEntityValidationException ex)
|
|
|
{
|
|
|
return Json(new { state = -1, msg = ex.Message.ToString() }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
}
|
|
|
public ActionResult detales() { return View(); }
|
|
|
[HttpGet]
|
|
|
public ActionResult SendInsurance(string id, string InsId)
|
|
|
{
|
|
|
logger.Debug($"SendInsurance:{id} {InsId}");
|
|
|
string idare = "";
|
|
|
if (!string.IsNullOrEmpty(id))
|
|
|
{
|
|
|
idare = id;
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(InsId))
|
|
|
{
|
|
|
idare = InsId;
|
|
|
}
|
|
|
var dats = context.Insurance.Where(p => p.GID == idare).FirstOrDefault();
|
|
|
try
|
|
|
{
|
|
|
if (dats.states != "已录入" && dats.states != "发送失败" && dats.states != "保单生效")
|
|
|
{
|
|
|
return Json(new { state = -1, msg = "当前状态不符合投保条件", id = dats.GID }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
InsurancePolicyModel insurance = new InsurancePolicyModel();
|
|
|
|
|
|
if (true)
|
|
|
{
|
|
|
InsuranceRider ride = new InsuranceRider();
|
|
|
ride.RiderState = "提交保单";
|
|
|
ride.Rider = DateTime.Now;
|
|
|
ride.RiderAudit = Convert.ToString(Session["SHOWNAME"]);
|
|
|
ride.Gid = getGUID();
|
|
|
ride.Remark = "";
|
|
|
ride.NID = dats.GID;
|
|
|
context.InsuranceRider.Add(ride);
|
|
|
context.SaveChanges();
|
|
|
context = new OpSeaePxDbContenxt();
|
|
|
}
|
|
|
var snumb = dats.SerialNumber;//流水号
|
|
|
if (!string.IsNullOrEmpty(InsId) && !string.IsNullOrEmpty(dats.InsuranceNumber) && dats.subTim != Convert.ToDateTime("1753-01-02"))
|
|
|
{
|
|
|
snumb = dats.SerialNumber;
|
|
|
}
|
|
|
if (string.IsNullOrEmpty(dats.CargoType))
|
|
|
{
|
|
|
return Json(new { state = -2, msg = "请选择货物类型!", id = dats.GID }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
insurance.SerialNumber = snumb;
|
|
|
insurance.EmpAccount = dats.EmpAccount == null ? "" : dats.EmpAccount.ToString();
|
|
|
insurance.BusinessNo = dats.BusinessNo == null ? "" : dats.BusinessNo.ToString();
|
|
|
insurance.InsuranceCode = dats.InsuranceCode == null ? "" : dats.InsuranceCode.ToString();
|
|
|
insurance.InsuranceName = dats.InsuranceName == null ? "" : dats.InsuranceName.ToString();
|
|
|
insurance.OriginalSum = dats.OriginalSum.ToString();
|
|
|
insurance.HBFlag = dats.HBFlag == true ? "1" : "0";
|
|
|
insurance.Sign = dats.Sign == null ? "" : dats.Sign.ToString();
|
|
|
insurance.PackAndQuantity = dats.PackAndQuantity == null ? "" : dats.PackAndQuantity.Replace('&', ' ');
|
|
|
insurance.FregihtItem = dats.FregihtItem == null ? "" : dats.FregihtItem.ToString().Trim();
|
|
|
insurance.InvoiceNumber = dats.InvoiceNumber == null ? "" : dats.InvoiceNumber;
|
|
|
insurance.BillNumber = dats.BillNumber == null ? "" : dats.BillNumber.ToString();
|
|
|
insurance.CargoType = dats.CargoType == null ? "" : dats.CargoType.ToString();
|
|
|
insurance.InvoiceMoney = dats.InvoiceMoney.ToString();
|
|
|
insurance.InvoiceBonus = dats.InvoiceBonus.ToString();
|
|
|
insurance.Amt = dats.Amt.ToString();
|
|
|
insurance.AmtCurrency = dats.AmtCurrency == null ? "" : dats.AmtCurrency.ToString();
|
|
|
insurance.ExchangeRate = dats.ExchangeRate.ToString();
|
|
|
insurance.ChargeRate = dats.ChargeRate.ToString() == "0.0000" ? GetRate(dats.ToContry) : dats.ChargeRate.ToString();
|
|
|
insurance.Premium = Math.Round(dats.Premium, 2, MidpointRounding.AwayFromZero).ToString();
|
|
|
insurance.PremiumPrit = dats.PremiumPrit == null ? "" : dats.PremiumPrit.ToString();
|
|
|
insurance.TransportType = dats.TransportType == null ? "" : dats.TransportType.ToString();
|
|
|
insurance.TransportDetail = dats.TransportDetail == null ? "" : dats.TransportDetail.ToString();
|
|
|
insurance.TrafficNumber = dats.TrafficNumber == null ? "" : dats.TrafficNumber.ToString();
|
|
|
insurance.FlightsCheduled = dats.FlightsCheduled == null ? "" : dats.FlightsCheduled.ToString();
|
|
|
insurance.FromContry = dats.FromContry == null ? "" : dats.FromContry.ToString();
|
|
|
insurance.FromArea = dats.FromArea == null ? "" : dats.FromArea.ToString();
|
|
|
insurance.PassPort = dats.PassPort == null ? "" : dats.PassPort.ToString();
|
|
|
insurance.ToContry = dats.ToContry == null ? "" : dats.ToContry.ToString();
|
|
|
insurance.ToArea = dats.ToArea == null ? "" : dats.ToArea.ToString();
|
|
|
insurance.SurveyAdrID = dats.SurveyAdrID == null ? "" : dats.SurveyAdrID.ToString();
|
|
|
insurance.SurveyAdr = dats.SurveyAdr == null ? "" : dats.SurveyAdr.ToString();
|
|
|
insurance.StartTM = Convert.ToDateTime(dats.StartTM).ToString("yyyy-MM-dd");
|
|
|
insurance.EndTM = Convert.ToDateTime(dats.StartTM).AddDays(90).ToString("yyyy-MM-dd");
|
|
|
insurance.DatePritType = dats.DatePritType == null ? "" : dats.DatePritType.ToString();
|
|
|
insurance.CreditNO = dats.CreditNO == null ? "" : dats.CreditNO.ToString();
|
|
|
insurance.CreditNODesc = dats.CreditNODesc == null ? "" : dats.CreditNODesc.ToString();
|
|
|
|
|
|
//2020年11月3日,调用华泰保险接口的时候,如果货物类型选的普通货物,SpecialAgreement这个字段传免赔内容。如果是特殊货物,传0。
|
|
|
if (insurance.CargoType == "27")
|
|
|
{
|
|
|
insurance.SpecialAgreement = MianPeiStr;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
insurance.SpecialAgreement = "0";
|
|
|
}
|
|
|
|
|
|
insurance.NewSpecialAgreement = dats.NewSpecialAgreement == null ? "" : dats.NewSpecialAgreement.ToString();
|
|
|
insurance.IndemnityClaim = dats.IndemnityClaim == null ? "" : dats.IndemnityClaim.ToString();
|
|
|
insurance.RdrCde = dats.RdrCde == null ? "" : dats.RdrCde.ToString();
|
|
|
insurance.RdrName = dats.RdrName == null ? "" : dats.RdrName.ToString();
|
|
|
insurance.WarIns = dats.WarIns == true ? "1" : "0";
|
|
|
insurance.StrikeIns = dats.StrikeIns == true ? "1" : "0";
|
|
|
insurance.TheftIns = "0";
|
|
|
insurance.CtoCIns = dats.CtoCIns == true ? "1" : "0";
|
|
|
insurance.ApplicantName = dats.ApplicantName == null ? "" : dats.ApplicantName.ToString();
|
|
|
insurance.Cell = dats.Cell == null ? "" : dats.Cell.ToString();
|
|
|
insurance.Address = dats.Address == null ? "" : dats.Address.ToString();
|
|
|
insurance.Email = dats.Email == null ? "" : dats.Email.ToString();
|
|
|
insurance.BInsuredName = dats.BInsuredName == null ? "" : dats.BInsuredName.ToString();
|
|
|
insurance.BIDType = dats.BIDType == null ? "" : dats.BIDType.ToString();
|
|
|
insurance.BID = dats.BID == null ? "13400000000" : dats.BID.ToString().Replace(" ", "");
|
|
|
insurance.BCell = dats.BCell == null ? "" : dats.BCell.ToString().Replace(" ", "");
|
|
|
insurance.BAddress = dats.BAddress == null ? "" : dats.BAddress.ToString();
|
|
|
//insurance.SurveyAdr = "河北省石家庄市槐安路26号诚铭商务大厦 TEL:4006095509 FAX:0311-86123007";
|
|
|
//insurance.SurveyAdrID = "501422495720";
|
|
|
insurance.BEmail = dats.BEmail == null ? "" : dats.BEmail.ToString();
|
|
|
HttpClient httpclient = new HttpClient();
|
|
|
var backs = context.InsuranceBack.Where(p => p.NID == dats.GID & p.BackCause == "保单生效").ToList();
|
|
|
var sids = context.InsuranceRider.Where(p => p.NID == dats.GID & p.RiderState == "保单生效").ToList();
|
|
|
string strjson = Newtonsoft.Json.JsonConvert.SerializeObject(insurance);
|
|
|
//strjson = "{\"SerialNumber\":\"QDDJY2020081817183629347\",\"EmpAccount\":\"ZWK888\",\"BusinessNo\":\"\",\"InsuranceCode\":\"3501\",\"InsuranceName\":\"出口海洋运输货物保险\",\"OriginalSum\":\"3\",\"HBFlag\":\"1\",\"Sign\":\"LAIWU\nMANHING\",\"PackAndQuantity\":\"BULK GAS 123\",\"FregihtItem\":\"FRESHAPPLE\",\"InvoiceNumber\":\"\",\"BillNumber\":\"ceshi0001test\",\"CargoType\":\"26\",\"InvoiceMoney\":\"10000.0000\",\"InvoiceBonus\":\"1.0\",\"Amt\":\"10000.0000\",\"AmtCurrency\":\"03\",\"ExchangeRate\":\"1.00\",\"ChargeRate\":\"0.00035\",\"Premium\":\"35.0000\",\"PremiumPrit\":\"02\",\"TransportType\":\"SX001501\",\"TransportDetail\":\"01\",\"TrafficNumber\":\"COSCO SHIPPING LIBRA\",\"FlightsCheduled\":\"003W\",\"FromContry\":\"HTC01\",\"FromArea\":\"QINGDAO,CHINA\",\"PassPort\":\"\",\"ToContry\":\"HTCA3\",\"ToArea\":\"BUENAVENTURA, COLOMBIA\",\"SurveyAdrID\":\"501422494456\",\"SurveyAdr\":\" Finlay House,Agrabad Commercial Area,(P.O. Box 118),CHITTAGONG.TEL:(880) 31 716321/5 & 715542.FAX:(880) 31 710006\",\"StartTM\":\"2020-08-22\",\"EndTM\":\"2020-09-22\",\"DatePritType\":\"02\",\"CreditNO\":\"\",\"CreditNODesc\":\"\",\"SpecialAgreement\":\"1233433\",\"NewSpecialAgreement\":\"\",\"IndemnityClaim\":\"\",\"RdrCde\":\"SX300105\",\"RdrName\":\"\",\"WarIns\":\"0\",\"StrikeIns\":\"0\",\"TheftIns\":\"0\",\"CtoCIns\":\"1\",\"ApplicantName\":\"邹文坤\",\"Cell\":\"0634-6328588\",\"Address\":\"NO.8,WANXING ROAD,YANGZHUANG LAIWU,SHANDONG,CHINA.\",\"Email\":\"\",\"BInsuredName\":\"TO ORDER OF AB BANK LTD.\",\"BIDType\":\"99\",\"BID\":\"008801713104452\",\"BCell\":\"008801713104452\",\"BAddress\":\"STATION ROAD BRANCH, CHITTAGONG, BANGLADESH (BIN-000000293) \",\"BEmail\":\"\"}";
|
|
|
System.Threading.Tasks.Task<HttpResponseMessage> responseMessage;
|
|
|
|
|
|
if (backs.Count() > 0 || sids.Count() > 0)
|
|
|
{
|
|
|
logger.Debug($"InsurancePut:{userKey} {strjson}");
|
|
|
responseMessage = httpclient.PutAsJsonAsync(HTUrl + "api/ApiInsurancePolicy/InsurancePut?apiUserKey=" + userKey + "", strjson);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
logger.Debug($"InsuranceApply:{userKey} {strjson}");
|
|
|
responseMessage = httpclient.PostAsJsonAsync(HTUrl + "api/ApiInsurancePolicy/InsuranceApply?apiUserKey=" + userKey + "", strjson);
|
|
|
}
|
|
|
HttpStatusCode httpStatusCode = responseMessage.Result.StatusCode;
|
|
|
var result = responseMessage.Result.Content.ReadAsStringAsync().Result;
|
|
|
|
|
|
logger.Debug($"返回:{httpStatusCode} {result}");
|
|
|
decimal Premium=0;
|
|
|
decimal ExchangeRate = 0;
|
|
|
decimal ChargeRate = 0;
|
|
|
var result_ = Newtonsoft.Json.JsonConvert.DeserializeObject(result);
|
|
|
var SendData = (JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(result_.ToString());
|
|
|
logger.Debug($"SendData:{SendData}");
|
|
|
if (Convert.ToInt32(SendData["Flag"]) > 0)
|
|
|
{
|
|
|
if (Convert.ToInt32(SendData["Flag"])==1) {
|
|
|
Premium = System.Decimal.Round(Convert.ToDecimal(SendData["Premium"]), 5) ;
|
|
|
ExchangeRate = System.Decimal.Round(Convert.ToDecimal(SendData["ExchangeRate"]), 5);
|
|
|
ChargeRate = System.Decimal.Round(Convert.ToDecimal(SendData["ChargeRater"]), 5);
|
|
|
dats.Premium = Premium;
|
|
|
dats.ExchangeRate = ExchangeRate;
|
|
|
dats.ChargeRate = ChargeRate;
|
|
|
dats.MianPeiContent = SendData["SpecialAgreement"].ToString();
|
|
|
}
|
|
|
System.Threading.Tasks.Task<HttpResponseMessage> responseMessageState;
|
|
|
responseMessageState = httpclient.GetAsync(HTUrl + "api/ApiInsurancePolicy/GetInsuranceState?apiUserKey=" + userKey + "&serialNumber=" + insurance.SerialNumber);
|
|
|
var resultState = responseMessageState.Result.Content.ReadAsStringAsync().Result;
|
|
|
logger.Debug($"GetInsuranceState返回:{resultState}");
|
|
|
var resultState_ = Newtonsoft.Json.JsonConvert.DeserializeObject(resultState);
|
|
|
SendData = (JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(resultState_.ToString());
|
|
|
}
|
|
|
dats.subTim = DateTime.Now;
|
|
|
if (Convert.ToInt32(SendData["Flag"]) > 0)
|
|
|
{
|
|
|
logger.Debug($"flag状态:{Convert.ToInt32(SendData["Flag"])}");
|
|
|
InsuranceRider ride = new InsuranceRider();
|
|
|
ride.Rider = DateTime.Now;
|
|
|
|
|
|
if (!string.IsNullOrEmpty(InsId))
|
|
|
{
|
|
|
dats.TheBathNum = SendData.ToString().Contains("EdrPolicy") ? SendData["EdrPolicy"].ToString() : "";
|
|
|
}
|
|
|
dats.states = "发送成功";
|
|
|
ride.Remark = "保单已提交";
|
|
|
var flag = Convert.ToInt32(SendData["Flag"]);
|
|
|
if (flag == 1)
|
|
|
{
|
|
|
logger.Debug($"flag状态为1:{flag}");
|
|
|
dats.PdfURL = SendData["PdfURL"].ToString();
|
|
|
|
|
|
dats.InsuranceNumber = SendData["InsurancePolicy"].ToString();
|
|
|
if (SendData["Premium"]!=null&&!string.IsNullOrEmpty(SendData["Premium"].ToString().Trim())) {
|
|
|
dats.Premium = Convert.ToDecimal(SendData["Premium"]);
|
|
|
}
|
|
|
dats.states = "保单生效";
|
|
|
|
|
|
ride.Remark = "保单已生效";
|
|
|
}
|
|
|
if (flag == 2)
|
|
|
{
|
|
|
logger.Debug($"flag状态为2:{flag}");
|
|
|
dats.states = "人工核保";
|
|
|
ride.Remark = "正在人工核保";
|
|
|
}
|
|
|
if (flag == 3)
|
|
|
{
|
|
|
logger.Debug($"flag状态为3:{flag}");
|
|
|
dats.states = "核保通过待确认";
|
|
|
if (Premium!=null&& ExchangeRate!=null&& ChargeRate!=null) {
|
|
|
ride.Remark = "等待确认保单,保费更新为"+ Premium+ " 汇率更新为:" + ExchangeRate + " 费率更新为万分之" + System.Decimal.Round(Convert.ToDecimal(ChargeRate * 10000),1) ;
|
|
|
}
|
|
|
else {
|
|
|
ride.Remark = "等待确认保单";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (flag == 4)
|
|
|
{
|
|
|
logger.Debug($"flag状态为4:{flag}");
|
|
|
dats.PdfURL = SendData["PdfURL"].ToString();
|
|
|
|
|
|
dats.InsuranceNumber = SendData["InsurancePolicy"].ToString();
|
|
|
dats.states = "待确认";
|
|
|
if (Premium != null && ExchangeRate != null && ChargeRate != null)
|
|
|
{
|
|
|
ride.Remark = "保单待确认,保费更新为" + Premium + " 汇率更新为:" + ExchangeRate + " 费率更新为万分之" + System.Decimal.Round(Convert.ToDecimal(ChargeRate * 10000), 1);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ride.Remark = "保单待确认";
|
|
|
}
|
|
|
}
|
|
|
ride.RiderState = dats.states;
|
|
|
ride.RiderAudit = "华泰保险";
|
|
|
ride.Gid = getGUID();
|
|
|
ride.NID = dats.GID;
|
|
|
context.InsuranceRider.Add(ride);
|
|
|
context.Entry(dats).State = System.Data.Entity.EntityState.Modified;
|
|
|
context.Configuration.ValidateOnSaveEnabled = false;
|
|
|
context.SaveChanges();
|
|
|
context.Configuration.ValidateOnSaveEnabled = true;
|
|
|
return Json(new { state = flag, msg = "保单已发送", id = dats.GID }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
//"QDDJY" + DateTime.Now.ToString("yyyyMMddHHmmss") + DateTime.Now.Millisecond;
|
|
|
|
|
|
if (backs.Count() <= 0 || sids.Count() <= 0)
|
|
|
{
|
|
|
dats.SerialNumber = "QDDJY" + DateTime.Now.ToString("yyyyMMddHHmmss") + DateTime.Now.Millisecond;
|
|
|
}
|
|
|
dats.states = "发送失败";
|
|
|
InsuranceBack back = new InsuranceBack();
|
|
|
back.BackTim = DateTime.Now;
|
|
|
back.BackCause = "驳回保单";
|
|
|
back.BackSide = "华泰保险";
|
|
|
back.Remark = SendData["Msg"].ToString();
|
|
|
back.Gid = getGUID();
|
|
|
back.NID = dats.GID;
|
|
|
context.InsuranceBack.Add(back);
|
|
|
context.Entry(dats).State = System.Data.Entity.EntityState.Modified;
|
|
|
context.Configuration.ValidateOnSaveEnabled = false;
|
|
|
context.SaveChanges();
|
|
|
context.Configuration.ValidateOnSaveEnabled = true;
|
|
|
return Json(new { state = 0, msg = SendData["Msg"].ToString(), id = dats.GID }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
return Json(new { state = -1, msg = ex.Message.ToString(), id = dats.GID }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public int Registe(string pople)
|
|
|
{
|
|
|
var context = new OpSeaePxDbContenxt();
|
|
|
var mod = context.Users.First(u => u.GID == pople);
|
|
|
if (!(bool)(mod.isinsurance == null ? false : mod.isinsurance))
|
|
|
{
|
|
|
var userMsg = context.UserBaseInfo.Where(p => p.USERID == pople).FirstOrDefault();
|
|
|
var comnew = context.CompanyNew.Where(p => p.CompName == mod.COMNAME).FirstOrDefault();
|
|
|
UserInfo userInfo = new UserInfo();
|
|
|
userInfo.UserName = mod.CODENAME;
|
|
|
userInfo.ComName = mod.COMNAME;
|
|
|
userInfo.RealName = Session["SHOWNAME"].ToString();
|
|
|
userInfo.Tel = userMsg.MOBILE;
|
|
|
userInfo.Email = userMsg.EMAIL1;
|
|
|
var path = comnew.LicenceImage;
|
|
|
mod.isinsurance = true;
|
|
|
var tyu = path.Substring(1);
|
|
|
userInfo.FilePathStr = FilePathStr + tyu;
|
|
|
var msg = PostHuaTai(HTUrl + "api/ApiUser/Register?apiUserKey=" + userKey, userInfo);
|
|
|
logger.Debug($"发送用户注册:{Newtonsoft.Json.JsonConvert.SerializeObject(userInfo)},\r\n返回:{msg}");
|
|
|
var SendData = (JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(msg);
|
|
|
if (Convert.ToInt32(SendData["Flag"]) > 0)
|
|
|
{
|
|
|
//context = new OpSeaePxDbContenxt();
|
|
|
//context.Entry(mod).State = System.Data.Entity.EntityState.Modified;
|
|
|
context.SaveChanges();
|
|
|
return 1;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
return 2;
|
|
|
}
|
|
|
[HttpGet]
|
|
|
public ActionResult GetTable(string SerialNumber = null, string BLNO = null, string InsuranceNumber = null, string States = null, DateTime? SubtimS = null, DateTime? SubtimE = null, int limit = 12, int offset = 1)
|
|
|
{
|
|
|
StringBuilder sbsql = new StringBuilder("select * from HuaTai_Insurance where 1=1 ");
|
|
|
if (!string.IsNullOrEmpty(SerialNumber))
|
|
|
{
|
|
|
sbsql.Append(" and SerialNumber like '%" + SerialNumber + "%'");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(BLNO))
|
|
|
{
|
|
|
sbsql.Append(" and BillNumber like '%" + BLNO + "%'");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(InsuranceNumber))
|
|
|
{
|
|
|
sbsql.Append(" and InsuranceNumber like '%" + InsuranceNumber + "%'");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(States))
|
|
|
{
|
|
|
sbsql.Append(" and states='" + States + "'");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(SubtimS.ToString()))
|
|
|
{
|
|
|
sbsql.Append(" and subTim>'" + SubtimS + "'");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(SubtimE.ToString()))
|
|
|
{
|
|
|
sbsql.Append("and subTim<'" + SubtimE + "'");
|
|
|
}
|
|
|
|
|
|
var rangeWhere = GetRangDAStr("index", Session["USERID"].ToString(), Session["SHOWNAME"].ToString(), Session["COMPANYID"].ToString());
|
|
|
if (!string.IsNullOrEmpty(rangeWhere))
|
|
|
{
|
|
|
sbsql.Append(" and " + rangeWhere);
|
|
|
}
|
|
|
|
|
|
sbsql.Append(" order by subTim desc");
|
|
|
var lis = context.Insurance.SqlQuery(sbsql.ToString()).Skip(offset).Take(limit).OrderByDescending(p => p.subTim).ToList();
|
|
|
var count = context.Insurance.SqlQuery(sbsql.ToString()).Count();
|
|
|
var json = new { Success = true, Message = "查询成功", total = count, rows = lis, Offset = offset };
|
|
|
return Json(json, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
public ActionResult GetDetalis()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
private string getGUID()
|
|
|
{
|
|
|
return Guid.NewGuid().ToString();
|
|
|
}
|
|
|
|
|
|
[HttpPost]
|
|
|
public ActionResult SaveUpdateInsurance(string Gid, string SerialNumber,string InsuranceNumber,string BillNumber,string Premium,string bdstatas,string pdfurl)
|
|
|
{
|
|
|
RespCommon resp = new RespCommon();
|
|
|
if (!string.IsNullOrEmpty(Gid)) {
|
|
|
var dats = context.Insurance.Where(p => p.GID == Gid).FirstOrDefault();
|
|
|
dats.SerialNumber = SerialNumber;
|
|
|
dats.InsuranceNumber = InsuranceNumber;
|
|
|
dats.BillNumber = BillNumber;
|
|
|
if (!string.IsNullOrEmpty(Premium)) {
|
|
|
dats.Premium = Convert.ToDecimal( Premium);
|
|
|
}
|
|
|
dats.states = bdstatas;
|
|
|
dats.PdfURL = pdfurl;
|
|
|
context.SaveChanges();
|
|
|
}
|
|
|
resp.Success = true;
|
|
|
resp.Message = "保存成功";
|
|
|
return Json(resp);
|
|
|
}
|
|
|
public static string GetRangDAStr(string tb, string userid, string username, string companyid, int type = 0)
|
|
|
{
|
|
|
string str = "";
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT ");
|
|
|
strSql.Append(" VISIBLERANGE,OPERATERANGE ");
|
|
|
strSql.Append(" from VW_User_Authority ");
|
|
|
strSql.Append(" where [NAME]='ThePolicyList' and USERID='" + userid + "' and ISDELETE=0");
|
|
|
|
|
|
string visiblerange = "3";
|
|
|
string operaterange = "3";
|
|
|
|
|
|
Microsoft.Practices.EnterpriseLibrary.Data.Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
visiblerange = Convert.ToString(reader["VISIBLERANGE"]);
|
|
|
operaterange = Convert.ToString(reader["OPERATERANGE"]);
|
|
|
break;
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
if (visiblerange == "4")
|
|
|
{
|
|
|
str = "1=2";
|
|
|
}
|
|
|
else if (visiblerange == "3")
|
|
|
{
|
|
|
|
|
|
str = " (OperatorId ='" + userid + "')";
|
|
|
|
|
|
}
|
|
|
else if (visiblerange == "2")
|
|
|
{
|
|
|
if (tb == "index")
|
|
|
{
|
|
|
var rangeDa = new RangeDA();
|
|
|
var deptname = rangeDa.GetDEPTNAME(userid);
|
|
|
var userstr = new StringBuilder();
|
|
|
userstr.Append(" select SHOWNAME from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "') and GID in (select userid from user_baseinfo where DEPTNAME='" + deptname + "')");
|
|
|
Microsoft.Practices.EnterpriseLibrary.Data.Database userdb = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = userdb.ExecuteReader(CommandType.Text, userstr.ToString()))
|
|
|
{
|
|
|
str = "";
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
if (str == "")
|
|
|
{
|
|
|
str = " (OperatorId='" + Convert.ToString(reader["SHOWNAME"]) + "'";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
str = str + " or OperatorId='" + Convert.ToString(reader["SHOWNAME"]) + "'";
|
|
|
}
|
|
|
}
|
|
|
str = str + ")";
|
|
|
reader.Close();
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
str = " UPPER(Corpid)='" + companyid + "'";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else if (visiblerange == "1")
|
|
|
{
|
|
|
str = " gid in (select gid from HuaTai_Insurance where OperatorId in (select userid from [user_company] where companyid = '" + companyid + "'))";
|
|
|
//str = " UPPER(Corpid)='" + companyid + "'";
|
|
|
}
|
|
|
else if (visiblerange == "7")
|
|
|
{
|
|
|
str = " gid in (select gid from HuaTai_Insurance where OperatorId in (select gid from [user] where COMNAME = (select COMNAME from [user] where GID='" + userid + "')))";
|
|
|
}
|
|
|
return str;
|
|
|
}
|
|
|
public static string DoPost(string json, string url, int timeout = 90000)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
|
|
|
string responseString = "";//post返回的结果
|
|
|
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, err) => { return true; };
|
|
|
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
|
|
|
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
|
|
|
req.Method = "POST";
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(json))
|
|
|
{
|
|
|
byte[] postBytes = Encoding.UTF8.GetBytes(json);
|
|
|
req.ContentType = "application/json; charset=utf-8";
|
|
|
req.ContentLength = Encoding.UTF8.GetByteCount(json);
|
|
|
Stream stream = req.GetRequestStream();
|
|
|
stream.Write(postBytes, 0, postBytes.Length);
|
|
|
req.Timeout = 90000;
|
|
|
|
|
|
stream.Close();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
req.ContentLength = 0;
|
|
|
}
|
|
|
|
|
|
var response = req.GetResponse();
|
|
|
|
|
|
Stream streamResponse = response.GetResponseStream();
|
|
|
StreamReader streamRead = new StreamReader(streamResponse);
|
|
|
responseString = streamRead.ReadToEnd();
|
|
|
response.Close();
|
|
|
streamRead.Close();
|
|
|
|
|
|
return responseString;
|
|
|
|
|
|
}
|
|
|
catch (WebException ex)
|
|
|
{
|
|
|
var res = (HttpWebResponse)ex.Response;
|
|
|
return "-1";
|
|
|
}
|
|
|
}
|
|
|
public string PostHuaTai(string url, UserInfo json)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
var s = json.ToString();
|
|
|
HttpClient httpclient = new HttpClient();
|
|
|
string strjson = Newtonsoft.Json.JsonConvert.SerializeObject(json);
|
|
|
System.Threading.Tasks.Task<HttpResponseMessage> responseMessage = httpclient.PostAsJsonAsync(url, strjson);
|
|
|
HttpStatusCode httpStatusCode = responseMessage.Result.StatusCode;
|
|
|
string result = responseMessage.Result.Content.ReadAsStringAsync().Result;
|
|
|
|
|
|
var result_ = Newtonsoft.Json.JsonConvert.DeserializeObject(result);
|
|
|
return Convert.ToString(result_);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
return "Flag:-1";
|
|
|
}
|
|
|
}
|
|
|
public ActionResult SubMain()
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
return Json("", JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
throw;
|
|
|
}
|
|
|
}
|
|
|
public string CountryCode(string countryName)
|
|
|
{
|
|
|
#region 废弃
|
|
|
/*
|
|
|
try
|
|
|
{
|
|
|
Dictionary<string, string> type = new Dictionary<string, string>() {
|
|
|
|
|
|
|
|
|
{"阿布扎比","HTCA11"},
|
|
|
{"阿尔巴尼亚","HTCB5"},
|
|
|
{"阿尔及利亚","HTCZ2"},
|
|
|
{"阿富汗","HTCD6"},
|
|
|
{"阿根廷","HTC92"},
|
|
|
{"阿联酋","HTCG9"},
|
|
|
{"阿鲁巴","HTCA13"},
|
|
|
{"阿曼苏丹国","HTCK8"},
|
|
|
{"阿塞拜疆","HTCK2"},
|
|
|
{"埃及","HTC95"},
|
|
|
{"埃塞俄比亚","HTCB2"},
|
|
|
{"爱尔兰","HTC72"},
|
|
|
{"爱沙尼亚","HTCA10"},
|
|
|
{"安哥拉","HTCF1"},
|
|
|
{"奥地利","HTCL3"},
|
|
|
{"澳大利亚","HTC25"},
|
|
|
{"巴巴多斯","HTCB13"},
|
|
|
{"巴布亚新几内亚","HTCD8"},
|
|
|
{"巴哈马","HTCC1"},
|
|
|
{"巴基斯坦","HTCB8"},
|
|
|
{"巴拉圭","HTC62"},
|
|
|
{"巴林","HTC63"},
|
|
|
{"巴拿马","HTCA9"},
|
|
|
{"巴西","HTC79"},
|
|
|
{"白俄罗斯","HTCB11"},
|
|
|
{"百慕大群岛","HTC84"},
|
|
|
{"保加利亚","HTC50"},
|
|
|
{"北爱尔兰","HTC80"},
|
|
|
{"北朝鲜","HTCN1"},
|
|
|
{"北非西班牙领土","HTCA2"},
|
|
|
{"贝宁","HTCA8"},
|
|
|
{"比利时","HTC45"},
|
|
|
{"冰岛","HTCH1"},
|
|
|
{"波多黎各(美)","HTCH5"},
|
|
|
{"波兰","HTC31"},
|
|
|
{"波利尼西亚","HTCG8"},
|
|
|
{"玻利维亚","HTCA5"},
|
|
|
{"伯利兹","HTC81"},
|
|
|
{"博茨瓦纳","HTCB9"},
|
|
|
{"布基纳法索","HTC100"},
|
|
|
{"布隆迪","HTC93"},
|
|
|
{"赤道几内亚","HTCC10"},
|
|
|
{"丹麦","HTC39"},
|
|
|
{"德国","HTC18"},
|
|
|
{"多哥","HTCF0"},
|
|
|
{"多米尼加","HTC73"},
|
|
|
{"俄罗斯","HTC34"},
|
|
|
{"厄瓜多尔","HTCB6"},
|
|
|
{"厄立特里亚国","HTC61"},
|
|
|
{"法国","HTC20"},
|
|
|
{"法罗群岛","HTCG7"},
|
|
|
{"法属圭亚那","HTCA1"},
|
|
|
{"菲律宾","HTC08"},
|
|
|
{"斐济","HTCE6"},
|
|
|
{"芬兰","HTCD3"},
|
|
|
{"佛得角群岛","HTCH3"},
|
|
|
{"福克兰群岛","HTCH8"},
|
|
|
{"冈比亚","HTC71"},
|
|
|
{"刚果","HTC90"},
|
|
|
{"哥伦比亚","HTC74"},
|
|
|
{"哥斯达黎加","HTCH4"},
|
|
|
{"格陵兰岛","HTC16"},
|
|
|
{"格鲁吉亚","HTCL4"},
|
|
|
{"格鲁吉亚共和国","HTC75"},
|
|
|
{"古巴","HTCD2"},
|
|
|
{"圭亚那","HTCC4"},
|
|
|
{"哈萨克斯坦","HTCK1"},
|
|
|
{"海地","HTC98"},
|
|
|
{"韩国","HTC03"},
|
|
|
{"荷兰","HTC44"},
|
|
|
{"荷属安的列斯群岛","HTC59"},
|
|
|
{"黑山共和国","HTCK7"},
|
|
|
{"洪都拉斯","HTCE5"},
|
|
|
{"吉布提","HTCB3"},
|
|
|
{"吉尔吉斯斯坦","HTCJ6"},
|
|
|
{"几内亚","HTCG11"},
|
|
|
{"几内亚比绍","HTC85"},
|
|
|
{"加拿大","HTC23"},
|
|
|
{"加那利群岛","HTCC6"},
|
|
|
{"加纳","HTCG3"},
|
|
|
{"加蓬","HTCE8"},
|
|
|
{"柬埔寨","HTCG10"},
|
|
|
{"捷克","HTC38"},
|
|
|
{"津巴布韦","HTC94"},
|
|
|
{"喀麦隆","HTC68"},
|
|
|
{"卡塔尔","HTCB4"},
|
|
|
{"开曼群岛","HTCC7"},
|
|
|
{"科特迪瓦(象牙海岸)","HTC51"},
|
|
|
{"科威特","HTCE4"},
|
|
|
{"克罗地亚","HTC48"},
|
|
|
{"肯尼亚","HTCF7"},
|
|
|
{"库克群岛","HTCG0"},
|
|
|
{"拉脱维亚","HTCE9"},
|
|
|
{"老挝","HTCZ3"},
|
|
|
{"黎巴嫩","HTC78"},
|
|
|
{"立陶宛共和国","HTCE2"},
|
|
|
{"利比里亚","HTC91"},
|
|
|
{"利比亚","HTC82"},
|
|
|
{"留尼汪岛","HTCH0"},
|
|
|
{"卢森堡大公国","HTCL6"},
|
|
|
{"卢旺达","HTCE0"},
|
|
|
{"罗马尼亚","HTC29"},
|
|
|
{"马达加斯加","HTC57"},
|
|
|
{"马德拉群岛","HTCC3"},
|
|
|
{"马尔代夫","HTCM3"},
|
|
|
{"马耳他","HTCF4"},
|
|
|
{"马拉维","HTC87"},
|
|
|
{"马来西亚","HTC06"},
|
|
|
{"马里亚纳群岛(美国)","HTCC9"},
|
|
|
{"马其顿","HTCZZ"},
|
|
|
{"毛里求斯","HTCF6"},
|
|
|
{"毛里塔尼亚","HTC21"},
|
|
|
{"美国","HTC22"},
|
|
|
{"美国加拿大地区","HTCJ0"},
|
|
|
{"美属萨摩亚群岛","HTC26"},
|
|
|
{"蒙古","HTCZ1"},
|
|
|
{"孟加拉","HTCA3"},
|
|
|
{"秘鲁","HTC76"},
|
|
|
{"缅甸","HTC53"},
|
|
|
{"摩尔多瓦共和国","HTCZ5"},
|
|
|
{"摩洛哥","HTCA0"},
|
|
|
{"莫桑比克","HTCF5"},
|
|
|
{"墨西哥","HTC43"},
|
|
|
{"纳米比亚","HTCN2"},
|
|
|
{"南非","HTC15"},
|
|
|
{"南斯拉夫","HTC69"},
|
|
|
{"瑙鲁","HTCG1"},
|
|
|
{"尼泊尔","HTC11"},
|
|
|
{"尼加拉瓜","HTC88"},
|
|
|
{"尼日利亚","HTC96"},
|
|
|
{"挪威","HTC41"},
|
|
|
{"诺福克岛","HTC19"},
|
|
|
{"葡萄牙","HTC47"},
|
|
|
{"日本","HTC02"},
|
|
|
{"瑞典","HTC28"},
|
|
|
{"瑞士","HTC40"},
|
|
|
{"萨尔瓦多","HTCH6"},
|
|
|
{"萨摩亚","HTCS1"},
|
|
|
{"萨摩亚独立国","HTC58"},
|
|
|
{"塞尔维亚共和国","HTCK9"},
|
|
|
{"塞拉利昂","HTCC2"},
|
|
|
{"塞内加尔","HTC65"},
|
|
|
{"塞浦路斯","HTCE7"},
|
|
|
{"塞舌尔","HTCF3"},
|
|
|
{"沙特阿拉伯","HTC12"},
|
|
|
{"圣多美和普林民主","HTCH9"},
|
|
|
{"圣赫勒拿岛","HTCD5"},
|
|
|
{"圣卢西亚","HTCS2"},
|
|
|
{"斯里兰卡","HTCA6"},
|
|
|
{"斯洛伐克","HTC32"},
|
|
|
{"斯洛文尼亚","HTCE3"},
|
|
|
{"苏丹","HTCD9"},
|
|
|
{"苏里南","HTCG2"},
|
|
|
{"所罗门群岛","HTCD4"},
|
|
|
{"索马里","HTC83"},
|
|
|
{"塔吉克斯坦","HTCT11"},
|
|
|
{"台湾","HTC36"},
|
|
|
{"泰国","HTC05"},
|
|
|
{"坦桑尼亚","HTCB1"},
|
|
|
{"汤加","HTCG6"},
|
|
|
{"特克斯和凯科斯群","HTCC8"},
|
|
|
{"特立尼达和多巴哥","HTCT1"},
|
|
|
{"突尼斯","HTC86"},
|
|
|
{"土耳其","HTC54"},
|
|
|
{"土库曼斯坦","HTCT12"},
|
|
|
{"瓦努阿图共和国","HTCB7"},
|
|
|
{"危地马拉","HTCD0"},
|
|
|
{"维尔京群岛(美国","HTCC0"},
|
|
|
{"维尔京群岛(英国","HTCH2"},
|
|
|
{"委内瑞拉","HTCL5"},
|
|
|
{"文莱达鲁萨兰国","HTC67"},
|
|
|
{"乌干达","HTCD7"},
|
|
|
{"乌克兰","HTC49"},
|
|
|
{"乌拉圭","HTCF8"},
|
|
|
{"乌兹别克斯坦","HTCG5"},
|
|
|
{"西班牙","HTC46"},
|
|
|
{"西印度群岛","HTC55"},
|
|
|
{"希腊","HTC42"},
|
|
|
{"香港","HTP71"},
|
|
|
{"新加坡","HTC07"},
|
|
|
{"新喀里多尼亚","HTC13"},
|
|
|
{"新西兰","HTC35"},
|
|
|
{"匈牙利","HTC33"},
|
|
|
{"叙利亚","HTC70"},
|
|
|
{"牙买加","HTCE1"},
|
|
|
{"亚美尼亚共和国","HTCY2"},
|
|
|
{"亚速尔群岛","HTC97"},
|
|
|
{"也门","HTC52"},
|
|
|
{"伊拉克","HTCH7"},
|
|
|
{"伊朗","HTC66"},
|
|
|
{"以色列","HTCD1"},
|
|
|
{"意大利","HTC30"},
|
|
|
{"印度","HTC10"},
|
|
|
{"印度尼西亚","HTC09"},
|
|
|
{"印度洋","HTCA4"},
|
|
|
{"英国","HTC27"},
|
|
|
{"约旦","HTCJ1"},
|
|
|
{"越南","HTCY1"},
|
|
|
{"赞比亚","HTCF2"},
|
|
|
{"乍得","HTCZ10"},
|
|
|
{"直布罗陀","HTCC5"},
|
|
|
{"智利","HTC56"},
|
|
|
{"中国","HTC01"},
|
|
|
|
|
|
};
|
|
|
return type[countryName];
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
return "";
|
|
|
}
|
|
|
*/
|
|
|
#endregion
|
|
|
|
|
|
var cc = context.TSysCountryCode.AsNoTracking().FirstOrDefault(c => c.CountryName == countryName && c.parameterCode != null && c.parameterCode != "");
|
|
|
if (cc != null)
|
|
|
{
|
|
|
return cc.parameterCode;
|
|
|
}
|
|
|
return string.Empty;
|
|
|
}
|
|
|
public string GetMoneyCode(string name)
|
|
|
{
|
|
|
#region 废弃
|
|
|
// try
|
|
|
// {
|
|
|
// Dictionary<string, string> type = new Dictionary<string, string>() {
|
|
|
// {"CNY","01"},
|
|
|
//{"HKD","02"},
|
|
|
//{"USD","03"},
|
|
|
//{"GBP","04"},
|
|
|
//{"JPY","05"},
|
|
|
//{"DM","06"},
|
|
|
//{"SF","07"},
|
|
|
//{"FF","08"},
|
|
|
//{"SGD","09"},
|
|
|
//{"C$","10"},
|
|
|
//{"NT$","11"},
|
|
|
//{"EUR","12"},
|
|
|
//{"A$","13"},
|
|
|
//{"ITL","14"},
|
|
|
//{"NLG","15"},
|
|
|
//{"ATS","16"},
|
|
|
//{"BEF","17"},
|
|
|
//{"SEK","18"},
|
|
|
//{"DKK","19"},
|
|
|
//{"NZD","20"},
|
|
|
//{"MYR","21"},
|
|
|
//{"KER","22"},
|
|
|
//{"NOK","23"},
|
|
|
//{"CZK","24"},
|
|
|
//{"SUR","25"},
|
|
|
//{"InsuredValueCurrency","90"},
|
|
|
//{"PremiumValueCurrency","91"},
|
|
|
|
|
|
// };
|
|
|
// return type[name];
|
|
|
// }
|
|
|
// catch (Exception)
|
|
|
// {
|
|
|
// return "";
|
|
|
// }
|
|
|
#endregion
|
|
|
|
|
|
var curr = context.CodeInsuranceCurrency.AsNoTracking().FirstOrDefault(c => c.Code == name);
|
|
|
if (curr != null)
|
|
|
{
|
|
|
return curr.HtCode;
|
|
|
}
|
|
|
|
|
|
return string.Empty;
|
|
|
}
|
|
|
public string GetMoneyName(string code)
|
|
|
{
|
|
|
#region 废弃
|
|
|
// try
|
|
|
// {
|
|
|
// Dictionary<string, string> type = new Dictionary<string, string>()
|
|
|
// {
|
|
|
//{"01","CNY"},
|
|
|
//{"02","HKD"},
|
|
|
//{"03","USD"},
|
|
|
//{"04","GBP"},
|
|
|
//{"05","JPY"},
|
|
|
//{"06","DM"},
|
|
|
//{"07","SF"},
|
|
|
//{"08","FF"},
|
|
|
//{"09","SGD"},
|
|
|
//{"10","C$"},
|
|
|
//{"11","NT$"},
|
|
|
//{"12","EUR"},
|
|
|
//{"13","A$"},
|
|
|
//{"14","ITL"},
|
|
|
//{"15","NLG"},
|
|
|
//{"16","ATS"},
|
|
|
//{"17","BEF"},
|
|
|
//{"18","SEK"},
|
|
|
//{"19","DKK"},
|
|
|
//{"20","NZD"},
|
|
|
//{"21","MYR"},
|
|
|
//{"22","KER"},
|
|
|
//{"23","NOK"},
|
|
|
//{"24","CZK"},
|
|
|
//{"25","SUR"},
|
|
|
//{"90","InsuredValueCurrency"},
|
|
|
//{"91","PremiumValueCurrency"},
|
|
|
// };
|
|
|
// return type[code];
|
|
|
// }
|
|
|
// catch (Exception)
|
|
|
// {
|
|
|
// return "";
|
|
|
// }
|
|
|
#endregion
|
|
|
|
|
|
var curr = context.CodeInsuranceCurrency.AsNoTracking().FirstOrDefault(c => c.HtCode == code);
|
|
|
if (curr != null)
|
|
|
{
|
|
|
return curr.Code;
|
|
|
}
|
|
|
|
|
|
return string.Empty;
|
|
|
}
|
|
|
public string CountryName(string countryCode)
|
|
|
{
|
|
|
#region 废弃
|
|
|
/*
|
|
|
try
|
|
|
{
|
|
|
Dictionary<string, string> type = new Dictionary<string, string>() {
|
|
|
{"HTC01","中国"},
|
|
|
{"HTC02","日本"},
|
|
|
{"HTC03","韩国"},
|
|
|
{"HTC05","泰国"},
|
|
|
{"HTC06","马来西亚"},
|
|
|
{"HTC07","新加坡"},
|
|
|
{"HTC08","菲律宾"},
|
|
|
{"HTC09","印度尼西亚"},
|
|
|
{"HTC10","印度"},
|
|
|
{"HTC100","布基纳法索"},
|
|
|
{"HTC11","尼泊尔"},
|
|
|
{"HTC12","沙特阿拉伯"},
|
|
|
{"HTC13","新喀里多尼亚"},
|
|
|
{"HTC15","南非"},
|
|
|
{"HTC16","格陵兰岛"},
|
|
|
{"HTC18","德国"},
|
|
|
{"HTC19","诺福克岛"},
|
|
|
{"HTC20","法国"},
|
|
|
{"HTC21","毛里塔尼亚"},
|
|
|
{"HTC22","美国"},
|
|
|
{"HTC23","加拿大"},
|
|
|
{"HTC25","澳大利亚"},
|
|
|
{"HTC26","美属萨摩亚群岛"},
|
|
|
{"HTC27","英国"},
|
|
|
{"HTC28","瑞典"},
|
|
|
{"HTC29","罗马尼亚"},
|
|
|
{"HTC30","意大利"},
|
|
|
{"HTC31","波兰"},
|
|
|
{"HTC32","斯洛伐克"},
|
|
|
{"HTC33","匈牙利"},
|
|
|
{"HTC34","俄罗斯"},
|
|
|
{"HTC35","新西兰"},
|
|
|
{"HTC38","捷克"},
|
|
|
{"HTC39","丹麦"},
|
|
|
{"HTC40","瑞士"},
|
|
|
{"HTC41","挪威"},
|
|
|
{"HTC42","希腊"},
|
|
|
{"HTC43","墨西哥"},
|
|
|
{"HTC44","荷兰"},
|
|
|
{"HTC45","比利时"},
|
|
|
{"HTC46","西班牙"},
|
|
|
{"HTC47","葡萄牙"},
|
|
|
{"HTC48","克罗地亚"},
|
|
|
{"HTC49","乌克兰"},
|
|
|
{"HTC50","保加利亚"},
|
|
|
{"HTC51","科特迪瓦(象牙海岸)"},
|
|
|
{"HTC52","也门"},
|
|
|
{"HTC53","缅甸"},
|
|
|
{"HTC54","土耳其"},
|
|
|
{"HTC55","西印度群岛"},
|
|
|
{"HTC56","智利"},
|
|
|
{"HTC57","马达加斯加"},
|
|
|
{"HTC58","萨摩亚独立国"},
|
|
|
{"HTC59","荷属安的列斯群岛"},
|
|
|
{"HTC61","厄立特里亚国"},
|
|
|
{"HTC62","巴拉圭"},
|
|
|
{"HTC63","巴林"},
|
|
|
{"HTC65","塞内加尔"},
|
|
|
{"HTC66","伊朗"},
|
|
|
{"HTC67","文莱达鲁萨兰国"},
|
|
|
{"HTC68","喀麦隆"},
|
|
|
{"HTC69","南斯拉夫"},
|
|
|
{"HTC70","叙利亚"},
|
|
|
{"HTC71","冈比亚"},
|
|
|
{"HTC72","爱尔兰"},
|
|
|
{"HTC73","多米尼加"},
|
|
|
{"HTC74","哥伦比亚"},
|
|
|
{"HTC75","格鲁吉亚共和国"},
|
|
|
{"HTC76","秘鲁"},
|
|
|
{"HTC78","黎巴嫩"},
|
|
|
{"HTC79","巴西"},
|
|
|
{"HTC80","北爱尔兰"},
|
|
|
{"HTC81","伯利兹"},
|
|
|
{"HTC82","利比亚"},
|
|
|
{"HTC83","索马里"},
|
|
|
{"HTC84","百慕大群岛"},
|
|
|
{"HTC85","几内亚比绍"},
|
|
|
{"HTC86","突尼斯"},
|
|
|
{"HTC87","马拉维"},
|
|
|
{"HTC88","尼加拉瓜"},
|
|
|
{"HTC90","刚果"},
|
|
|
{"HTC91","利比里亚"},
|
|
|
{"HTC92","阿根廷"},
|
|
|
{"HTC93","布隆迪"},
|
|
|
{"HTC94","津巴布韦"},
|
|
|
{"HTC95","埃及"},
|
|
|
{"HTC96","尼日利亚"},
|
|
|
{"HTC97","亚速尔群岛"},
|
|
|
{"HTC98","海地"},
|
|
|
{"HTCA0","摩洛哥"},
|
|
|
{"HTCA1","法属圭亚那"},
|
|
|
{"HTCA10","爱沙尼亚"},
|
|
|
{"HTCA11","阿布扎比"},
|
|
|
{"HTCA13","阿鲁巴"},
|
|
|
{"HTCA2","北非西班牙领土"},
|
|
|
{"HTCA3","孟加拉"},
|
|
|
{"HTCA4","印度洋"},
|
|
|
{"HTCA5","玻利维亚"},
|
|
|
{"HTCA6","斯里兰卡"},
|
|
|
{"HTCA8","贝宁"},
|
|
|
{"HTCA9","巴拿马"},
|
|
|
{"HTCB1","坦桑尼亚"},
|
|
|
{"HTCB11","白俄罗斯"},
|
|
|
{"HTCB13","巴巴多斯"},
|
|
|
{"HTCB2","埃塞俄比亚"},
|
|
|
{"HTCB3","吉布提"},
|
|
|
{"HTCB4","卡塔尔"},
|
|
|
{"HTCB5","阿尔巴尼亚"},
|
|
|
{"HTCB6","厄瓜多尔"},
|
|
|
{"HTCB7","瓦努阿图共和国"},
|
|
|
{"HTCB8","巴基斯坦"},
|
|
|
{"HTCB9","博茨瓦纳"},
|
|
|
{"HTCC0","维尔京群岛(美国)"},
|
|
|
{"HTCC1","巴哈马"},
|
|
|
{"HTCC10","赤道几内亚"},
|
|
|
{"HTCC2","塞拉利昂"},
|
|
|
{"HTCC3","马德拉群岛"},
|
|
|
{"HTCC4","圭亚那"},
|
|
|
{"HTCC5","直布罗陀"},
|
|
|
{"HTCC6","加那利群岛"},
|
|
|
{"HTCC7","开曼群岛"},
|
|
|
{"HTCC8","特克斯和凯科斯群岛"},
|
|
|
{"HTCC9","马里亚纳群岛(美国)"},
|
|
|
{"HTCD0","危地马拉"},
|
|
|
{"HTCD1","以色列"},
|
|
|
{"HTCD2","古巴"},
|
|
|
{"HTCD3","芬兰"},
|
|
|
{"HTCD4","所罗门群岛"},
|
|
|
{"HTCD5","圣赫勒拿岛"},
|
|
|
{"HTCD6","阿富汗"},
|
|
|
{"HTCD7","乌干达"},
|
|
|
{"HTCD8","巴布亚新几内亚"},
|
|
|
{"HTCD9","苏丹"},
|
|
|
{"HTCE0","卢旺达"},
|
|
|
{"HTCE1","牙买加"},
|
|
|
{"HTCE2","立陶宛共和国"},
|
|
|
{"HTCE3","斯洛文尼亚"},
|
|
|
{"HTCE4","科威特"},
|
|
|
{"HTCE5","洪都拉斯"},
|
|
|
{"HTCE6","斐济"},
|
|
|
{"HTCE7","塞浦路斯"},
|
|
|
{"HTCE8","加蓬"},
|
|
|
{"HTCE9","拉脱维亚"},
|
|
|
{"HTCF0","多哥"},
|
|
|
{"HTCF1","安哥拉"},
|
|
|
{"HTCF2","赞比亚"},
|
|
|
{"HTCF3","塞舌尔"},
|
|
|
{"HTCF4","马耳他"},
|
|
|
{"HTCF5","莫桑比克"},
|
|
|
{"HTCF6","毛里求斯"},
|
|
|
{"HTCF7","肯尼亚"},
|
|
|
{"HTCF8","乌拉圭"},
|
|
|
{"HTCG0","库克群岛"},
|
|
|
{"HTCG1","瑙鲁"},
|
|
|
{"HTCG10","柬埔寨"},
|
|
|
{"HTCG11","几内亚"},
|
|
|
{"HTCG2","苏里南"},
|
|
|
{"HTCG3","加纳"},
|
|
|
{"HTCG5","乌兹别克斯坦"},
|
|
|
{"HTCG6","汤加"},
|
|
|
{"HTCG7","法罗群岛"},
|
|
|
{"HTCG8","波利尼西亚"},
|
|
|
{"HTCG9","阿联酋"},
|
|
|
{"HTCH0","留尼汪岛"},
|
|
|
{"HTCH1","冰岛"},
|
|
|
{"HTCH2","维尔京群岛(英国)"},
|
|
|
{"HTCH3","佛得角群岛"},
|
|
|
{"HTCH4","哥斯达黎加"},
|
|
|
{"HTCH5","波多黎各(美)"},
|
|
|
{"HTCH6","萨尔瓦多"},
|
|
|
{"HTCH7","伊拉克"},
|
|
|
{"HTCH8","福克兰群岛"},
|
|
|
{"HTCH9","圣多美和普林民主共和国"},
|
|
|
{"HTCJ0","美国加拿大地区"},
|
|
|
{"HTCJ1","约旦"},
|
|
|
{"HTCJ6","吉尔吉斯斯坦"},
|
|
|
{"HTCK1","哈萨克斯坦"},
|
|
|
{"HTCK2","阿塞拜疆"},
|
|
|
{"HTCK7","黑山共和国"},
|
|
|
{"HTCK8","阿曼苏丹国"},
|
|
|
{"HTCK9","塞尔维亚共和国"},
|
|
|
{"HTCL3","奥地利"},
|
|
|
{"HTCL4","格鲁吉亚"},
|
|
|
{"HTCL5","委内瑞拉"},
|
|
|
{"HTCL6","卢森堡大公国"},
|
|
|
{"HTCM3","马尔代夫"},
|
|
|
{"HTCN1","北朝鲜"},
|
|
|
{"HTCN2","纳米比亚"},
|
|
|
{"HTCS1","萨摩亚"},
|
|
|
{"HTCS2","圣卢西亚"},
|
|
|
{"HTCT1","特立尼达和多巴哥"},
|
|
|
{"HTCT11","塔吉克斯坦"},
|
|
|
{"HTCT12","土库曼斯坦"},
|
|
|
{"HTCY1","越南"},
|
|
|
{"HTCY2","亚美尼亚共和国"},
|
|
|
{"HTCZ1","蒙古"},
|
|
|
{"HTCZ10","乍得"},
|
|
|
{"HTCZ2","阿尔及利亚"},
|
|
|
{"HTCZ3","老挝"},
|
|
|
{"HTCZ5","摩尔多瓦共和国"},
|
|
|
{"HTCZZ","马其顿"},
|
|
|
{"HTC36","台湾"},
|
|
|
{"HTP71","香港"},
|
|
|
};
|
|
|
return type[countryCode];
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
return "";
|
|
|
}
|
|
|
*/
|
|
|
#endregion
|
|
|
|
|
|
var cc = context.TSysCountryCode.AsNoTracking().FirstOrDefault(c => c.parameterCode == countryCode);
|
|
|
if (cc != null)
|
|
|
{
|
|
|
return cc.CountryName;
|
|
|
}
|
|
|
cc = context.TSysCountryCode.AsNoTracking().FirstOrDefault(c => c.CountryCode == countryCode);
|
|
|
if (cc != null)
|
|
|
{
|
|
|
return cc.CountryName;
|
|
|
}
|
|
|
return string.Empty;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据华泰国家代码获取前端显示的“CN-中国”形式的字符串
|
|
|
/// </summary>
|
|
|
/// <param name="code"></param>
|
|
|
/// <returns></returns>
|
|
|
public string CountryDisplay(string code)
|
|
|
{
|
|
|
var cc = context.TSysCountryCode.AsNoTracking().FirstOrDefault(c => c.parameterCode == code);
|
|
|
if (cc != null)
|
|
|
{
|
|
|
return $"{cc.CountryCode}-{cc.CountryName}";
|
|
|
}
|
|
|
cc = context.TSysCountryCode.AsNoTracking().FirstOrDefault(c => c.CountryCode == code);
|
|
|
if (cc != null)
|
|
|
{
|
|
|
return $"{cc.CountryCode}-{cc.CountryName}";
|
|
|
}
|
|
|
return string.Empty;
|
|
|
}
|
|
|
[HttpGet]
|
|
|
public ActionResult GetExChangeRate(string Currency, string json = null)
|
|
|
{
|
|
|
var lis = context.CodeInsuranceCurrency.Where(p => p.Code == Currency).FirstOrDefault();
|
|
|
if (lis != null)
|
|
|
{
|
|
|
var tomoth = Convert.ToDateTime(DateTime.Now.Year + "-" + DateTime.Now.Month);
|
|
|
var moth = DateTime.Now.Month + 1;
|
|
|
var year = DateTime.Now.Year;
|
|
|
if (moth > 12)
|
|
|
{
|
|
|
moth = 1;
|
|
|
year = year + 1;
|
|
|
}
|
|
|
var nextmoth = Convert.ToDateTime(year + "-" + moth);
|
|
|
var data = context.CodeInsuranceExchange.Where(p => p.CurrencyId == lis.Gid && p.Month >= tomoth && p.Month < nextmoth).OrderByDescending(p => p.CreateTime).FirstOrDefault();
|
|
|
if (data == null)
|
|
|
{
|
|
|
return Json(new { state = 0, datas = data, msg = "该币别当前月份没有汇率信息,请联系平台业务人员!" }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
return Json(new { state = 1, datas = data }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
return Json(new { state = 0, msg = "没有查询到汇率信息" }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
|
|
|
[HttpGet]
|
|
|
public ActionResult GetSurver(string country)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
var a = CountryCode(country);
|
|
|
if (string.IsNullOrEmpty(a))
|
|
|
{
|
|
|
a = country;
|
|
|
}
|
|
|
var chakan = context.TsysCountryCodeCheckone.Where(p => p.Nation == a).ToList();
|
|
|
return Json(new { state = 1, msg = "", data = chakan }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
return Json(new { state = 0, msg = ex.Message.ToString(), data = "" }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
}
|
|
|
[HttpGet]
|
|
|
public ActionResult GetIns(string InsId)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
var data = context.Insurance.Where(p => p.GID == InsId).FirstOrDefault();
|
|
|
if (data != null)
|
|
|
{
|
|
|
data.AmtCurrency = GetMoneyName(data.AmtCurrency);
|
|
|
data.FromContry = CountryName(data.FromContry);
|
|
|
data.ToContry = CountryName(data.ToContry);
|
|
|
if (data.TransportType == "01")
|
|
|
{
|
|
|
data.TransportType = "集装箱整箱(全程)";
|
|
|
}
|
|
|
else if (data.TransportType == "13")
|
|
|
{
|
|
|
data.TransportType = "集装箱整箱(目的港拆箱)";
|
|
|
}
|
|
|
else if (data.TransportType == "03")
|
|
|
{
|
|
|
data.TransportType = "集装箱拼箱";
|
|
|
}
|
|
|
else if (data.TransportType == "02")
|
|
|
{
|
|
|
data.TransportType = "特种集装箱";
|
|
|
}
|
|
|
else if (data.TransportType == "05")
|
|
|
{
|
|
|
data.TransportType = "固态散货 / 散杂件 ";
|
|
|
}
|
|
|
else if (data.TransportType == "06")
|
|
|
{
|
|
|
data.TransportType = "集装箱冷箱 ";
|
|
|
}
|
|
|
data.RdrCde = "一切险";
|
|
|
if (data.CargoType == "21")
|
|
|
{
|
|
|
data.CargoType = "易碎品";
|
|
|
}
|
|
|
else if (data.CargoType == "22")
|
|
|
{
|
|
|
data.CargoType = "电器、电子产品";
|
|
|
}
|
|
|
else if (data.CargoType == "23")
|
|
|
{
|
|
|
data.CargoType = "机械设备";
|
|
|
}
|
|
|
else if (data.CargoType == "24")
|
|
|
{
|
|
|
data.CargoType = "金属";
|
|
|
}
|
|
|
else if (data.CargoType == "25")
|
|
|
{
|
|
|
data.CargoType = "医药用品";
|
|
|
}
|
|
|
else if (data.CargoType == "26")
|
|
|
{
|
|
|
data.CargoType = "包装食品";
|
|
|
}
|
|
|
else if (data.CargoType == "28")
|
|
|
{
|
|
|
data.CargoType = "家具、乐器、二手物品";
|
|
|
}
|
|
|
else if (data.CargoType == "27")
|
|
|
{
|
|
|
data.CargoType = "其他普通货物";
|
|
|
}
|
|
|
else if (data.CargoType == "29")
|
|
|
{
|
|
|
data.CargoType = "特殊货物";
|
|
|
}
|
|
|
return Json(new { state = 1, msg = "成功", datas = data }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
return Json(new { state = 0, msg = "保单查询失败,请刷新页面后重试", datas = "" }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
return Json(new { state = 0, msg = ex.Message.ToString(), datas = "" }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
}
|
|
|
public ActionResult Error()
|
|
|
{
|
|
|
string userid = Convert.ToString(Session["USERID"]);
|
|
|
//var str = GetRangDAStr("index", userid, Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
if (userid == "" || userid == null)
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登陆状态失效,请重新登陆进行操作!" };
|
|
|
return Json(new { Success = false, Message = "登陆状态失效,请重新登陆进行操作!", totalCount = 0, data = 0 }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult MoneyTypeSet()
|
|
|
{
|
|
|
string userid = Convert.ToString(Session["USERID"]);
|
|
|
//var str = GetRangDAStr("index", userid, Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
if (userid == "" || userid == null)
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登陆状态失效,请重新登陆进行操作!" };
|
|
|
return Json(new { Success = false, Message = "登陆状态失效,请重新登陆进行操作!", totalCount = 0, data = 0 }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
List<string> lis = context.CodeInsuranceCurrency.Select(p => p.Code).Distinct().ToList();
|
|
|
|
|
|
ViewData["currcy"] = lis == null ? new List<string>() : lis;
|
|
|
return View();
|
|
|
}
|
|
|
[HttpGet]
|
|
|
public ActionResult GetMoneyTab(string Code = null, DateTime? SubtimS = null, DateTime? Month = null)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
string sql = "select (select Code from code_insurance_currency where Gid=code_insurance_exchange.Currencyid) as CurrencyId,code_insurance_exchange.Gid,code_insurance_exchange.EXChange,code_insurance_exchange.Month,code_insurance_exchange.CreateUser,code_insurance_exchange.CreateTime,code_insurance_exchange.Remark from code_insurance_exchange join code_insurance_currency on code_insurance_exchange.CurrencyId=code_insurance_currency.Gid where 1=1 ";
|
|
|
if (!string.IsNullOrEmpty(Code))
|
|
|
{
|
|
|
sql += " and code_insurance_currency.Code like '%" + Code + "%'";
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(SubtimS.ToString()))
|
|
|
{
|
|
|
sql += " and Month>='" + SubtimS + "'";
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(Month.ToString()))
|
|
|
{
|
|
|
sql += " and Month<='" + Month + "'";
|
|
|
}
|
|
|
var lis = context.CodeInsuranceExchange.SqlQuery(sql).ToList();
|
|
|
return Json(new { state = 1, data = lis, msg = "成功" }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
return Json(new { state = 0, data = "", msg = ex.Message.ToString() }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
}
|
|
|
[HttpGet]
|
|
|
public ActionResult Delmoney(string idstr)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
string sql = "delete from code_insurance_exchange where Gid in (" + idstr + ")";
|
|
|
var state = context.CodeInsuranceExchange.SqlQuery(sql);
|
|
|
return Json(new { state = 1, msg = "删除成功" }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
return Json(new { state = 0, msg = ex.Message.ToString() }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
}
|
|
|
[HttpGet]
|
|
|
public ActionResult IndexMoney(string id)
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(id))
|
|
|
{
|
|
|
string sql = "select (select Code from code_insurance_currency where Gid=code_insurance_exchange.Currencyid) as CurrencyId,Gid,EXChange,Month,CreateUser,CreateTime,Remark from code_insurance_exchange where Gid='" + id + "'";
|
|
|
var data = context.CodeInsuranceExchange.SqlQuery(sql).FirstOrDefault();
|
|
|
return Json(new { datas = data, state = 1 }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return Json(new { state = -1, msg = "汇率查询失败", datas = new CodeInsuranceExchange() }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
}
|
|
|
[HttpGet]
|
|
|
public ActionResult AddMoney(string Gid, string CurrencyId, string Huilv, string Months, string Remark)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(Gid))
|
|
|
{
|
|
|
var exchng = context.CodeInsuranceExchange.Where(p => p.Gid == Gid).FirstOrDefault();
|
|
|
var curr = context.CodeInsuranceCurrency.Where(p => p.Gid == exchng.CurrencyId).FirstOrDefault();
|
|
|
curr.Code = CurrencyId;
|
|
|
curr.Remark = Remark;
|
|
|
exchng.EXChange = Convert.ToDecimal(Huilv);
|
|
|
exchng.Month = Convert.ToDateTime(Months);
|
|
|
exchng.Remark = Remark;
|
|
|
context = new OpSeaePxDbContenxt();
|
|
|
context.Entry(curr).State = System.Data.Entity.EntityState.Modified;
|
|
|
context.Entry(exchng).State = System.Data.Entity.EntityState.Modified;
|
|
|
var state = context.SaveChanges();
|
|
|
if (state > 0)
|
|
|
{
|
|
|
return Json(new { state = 1, msg = "修改成功" }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
CodeInsuranceCurrency curren = new CodeInsuranceCurrency();
|
|
|
CodeInsuranceExchange change = new CodeInsuranceExchange();
|
|
|
context = new OpSeaePxDbContenxt();
|
|
|
var lis = context.CodeInsuranceCurrency.Where(p => p.Code == CurrencyId).ToList();
|
|
|
if (lis.Count() <= 0)
|
|
|
{
|
|
|
curren.Gid = getGUID();
|
|
|
curren.Code = CurrencyId;
|
|
|
curren.ShowName = "";
|
|
|
curren.CreateUser = Convert.ToString(Session["SHOWNAME"]);
|
|
|
curren.CreateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss"));
|
|
|
curren.Remark = Remark;
|
|
|
change.CurrencyId = curren.Gid;
|
|
|
context.CodeInsuranceCurrency.Add(curren);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
change.CurrencyId = lis[0].Gid;
|
|
|
}
|
|
|
change.Gid = getGUID();
|
|
|
change.EXChange = decimal.Round(decimal.Parse(Huilv), 6);
|
|
|
change.Month = Convert.ToDateTime(Months);
|
|
|
change.CreateUser = Convert.ToString(Session["SHOWNAME"]);
|
|
|
change.CreateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss"));
|
|
|
change.Remark = Remark;
|
|
|
context.CodeInsuranceExchange.Add(change);
|
|
|
var state = context.SaveChanges();
|
|
|
if (state > 0)
|
|
|
{
|
|
|
return Json(new { state = 1, msg = "添加成功" }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
}
|
|
|
return Json(new { state = 0, msg = "操作失败" }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
return Json(new { state = -1, msg = ex.Message.ToString() }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
}
|
|
|
[HttpGet]
|
|
|
public ActionResult DropIns(string str)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
var idarr = str.Split(',');
|
|
|
string id = "";
|
|
|
foreach (var item in idarr)
|
|
|
{
|
|
|
id += "'" + item + "',";
|
|
|
}
|
|
|
id = id.Substring(0, id.Length - 1);
|
|
|
string sql = "select * from HuaTai_Insurance where Gid in(" + id + ")";
|
|
|
var lis = context.Insurance.SqlQuery(sql).ToList();
|
|
|
var ride = context.InsuranceRider.SqlQuery("select * from HuaTai_Insurance_Rider where NID in (" + id + ")").ToList();
|
|
|
var back = context.InsuranceBack.SqlQuery("select * from HuaTai_Insurance_InsuranceBack where NID in (" + id + ")").ToList();
|
|
|
context.InsuranceRider.RemoveRange(ride);
|
|
|
context.InsuranceBack.RemoveRange(back);
|
|
|
context.Insurance.RemoveRange(lis);
|
|
|
var states = context.SaveChanges();
|
|
|
return Json(new { state = states }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
throw;
|
|
|
}
|
|
|
}
|
|
|
public ActionResult InsuranceOKIns()
|
|
|
{
|
|
|
string userid = Convert.ToString(Session["USERID"]);
|
|
|
|
|
|
if (userid == "" || userid == null)
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登陆状态失效,请重新登陆进行操作!" };
|
|
|
return Json(new { Success = false, Message = "登陆状态失效,请重新登陆进行操作!", totalCount = 0, data = 0 }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
var moneyType = context.CodeInsuranceCurrency.Select(p => p.Code).Distinct().ToList();
|
|
|
ViewData["moneyType"] = moneyType;
|
|
|
|
|
|
ViewData["toubaoren"] = Convert.ToString(Session["COMNAME"]);//投保人
|
|
|
var snumb = "QDDJY" + DateTime.Now.ToString("yyyyMMddHHmmss") + DateTime.Now.Millisecond;//流水号
|
|
|
ViewData["liushui"] = snumb;
|
|
|
|
|
|
var vnumb = context.TSysCountryCode.AsNoTracking().Where(c => c.parameterCode != null && c.parameterCode != "").OrderBy(c => c.CountryCode).Distinct().ToList();
|
|
|
ViewData["country"] = vnumb;
|
|
|
ViewData["StartPort"] = context.CodeLoadport.ToList();
|
|
|
ViewData["EndPort"] = context.CodeDisport.ToList();
|
|
|
|
|
|
ViewData["ChaK"] = context.TsysCountryCodeCheckone.ToList();
|
|
|
|
|
|
return View();
|
|
|
}
|
|
|
[HttpGet]
|
|
|
public ActionResult GetInsBack(string id)
|
|
|
{
|
|
|
var backlis = context.InsuranceBack.Where(p => p.NID == id).ToList();
|
|
|
return Json(new { lis = backlis }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
[HttpGet]
|
|
|
public ActionResult GetInsRider(string id)
|
|
|
{
|
|
|
var ridelis = context.InsuranceRider.Where(p => p.NID == id);
|
|
|
return Json(new { lis = ridelis }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
[HttpGet]
|
|
|
public ActionResult GetAllLogs(string id)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
var backlis = context.InsuranceBack.Where(p => p.NID == id).ToList();
|
|
|
var ridelis = context.InsuranceRider.Where(p => p.NID == id);
|
|
|
foreach (var item in ridelis)
|
|
|
{
|
|
|
InsuranceBack back = new InsuranceBack();
|
|
|
back.BackTim = item.Rider;
|
|
|
back.BackCause = item.RiderState;
|
|
|
back.BackSide = item.RiderAudit;
|
|
|
back.Remark = item.Remark;
|
|
|
backlis.Add(back);
|
|
|
}
|
|
|
return Json(new { state = 1, data = backlis.OrderByDescending(p => p.BackTim).ToList(), msg = "查询日志成功" }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
return Json(new { state = 0, data = "", msg = ex.Message.ToString() }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
}
|
|
|
[HttpGet]
|
|
|
public ActionResult GetInsState(string id)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
var ins = context.Insurance.Where(p => p.GID == id).FirstOrDefault();
|
|
|
if (!string.IsNullOrEmpty(ins.InsuranceNumber) && ins.subTim != Convert.ToDateTime("1753-01-02"))
|
|
|
{
|
|
|
return Json(new { istrue = 1 }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
return Json(new { istrue = 0 }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
return Json(new { istrue = -1 }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public string GetRate(string code)
|
|
|
{
|
|
|
#region 废弃
|
|
|
//try
|
|
|
//{
|
|
|
// Dictionary<string, string> rate = new Dictionary<string, string>();
|
|
|
// rate.Add("AF", "0.00022");
|
|
|
// rate.Add("AD", "0.00028");
|
|
|
// rate.Add("AO", "0.00022");
|
|
|
// rate.Add("AI", "0.00022");
|
|
|
// rate.Add("AG", "0.00022");
|
|
|
// rate.Add("AM", "0.00022");
|
|
|
|
|
|
// rate.Add("AW", "0.00022");
|
|
|
// rate.Add("AZ", "0.00022");
|
|
|
// rate.Add("AL", "0.00022");
|
|
|
// rate.Add("DZ", "0.00022");
|
|
|
// rate.Add("AR", "0.00022");
|
|
|
// rate.Add("AU", "0.00035");
|
|
|
|
|
|
// rate.Add("AT", "0.00022");
|
|
|
// rate.Add("BD", "0.00022");
|
|
|
// rate.Add("BB", "0.00022");
|
|
|
// rate.Add("BZ", "0.00022");
|
|
|
|
|
|
// rate.Add("BT", "0.00022");
|
|
|
// rate.Add("BW", "0.00022");
|
|
|
// rate.Add("BN", "0.00028");
|
|
|
// rate.Add("BF", "0.00022");
|
|
|
// rate.Add("BI", "0.00022");
|
|
|
// rate.Add("BS", "0.00022");
|
|
|
// rate.Add("BH", "0.00022");
|
|
|
|
|
|
// rate.Add("BY", "0.00022");
|
|
|
// rate.Add("BE", "0.00022");
|
|
|
|
|
|
// rate.Add("BJ", "0.00022");
|
|
|
// rate.Add("BM", "0.00022");
|
|
|
// rate.Add("BO", "0.00022");
|
|
|
// rate.Add("BA", "0.00028");
|
|
|
|
|
|
// rate.Add("BR", "0.00022");
|
|
|
// rate.Add("BG", "0.00028");
|
|
|
|
|
|
// rate.Add("KH", "0.00028");
|
|
|
// rate.Add("CV", "0.00022");
|
|
|
// rate.Add("KY", "0.00022");
|
|
|
|
|
|
// rate.Add("CF", "0.00022");
|
|
|
// rate.Add("TD", "0.00022");
|
|
|
// rate.Add("KM", "0.00022");
|
|
|
// rate.Add("CG", "0.00022");
|
|
|
// rate.Add("CD", "0.00022");
|
|
|
// rate.Add("CI", "0.00022");
|
|
|
// rate.Add("CU", "0.00022");
|
|
|
// rate.Add("CW", "0.00022");
|
|
|
|
|
|
// rate.Add("CM", "0.00022");
|
|
|
|
|
|
// rate.Add("CA", "0.00035");
|
|
|
// rate.Add("CL", "0.00022");
|
|
|
|
|
|
// rate.Add("CN", "0.00022");
|
|
|
// rate.Add("CO", "0.00022");
|
|
|
// rate.Add("CR", "0.00022");
|
|
|
|
|
|
// rate.Add("HR", "0.00028");
|
|
|
// rate.Add("CY", "0.00022");
|
|
|
|
|
|
// rate.Add("CZ", "0.00022");
|
|
|
// rate.Add("DM", "0.00022");
|
|
|
|
|
|
// rate.Add("DK", "0.00022");
|
|
|
// rate.Add("DJ", "0.00022");
|
|
|
// rate.Add("DO", "0.00022");
|
|
|
// rate.Add("GQ", "0.00022");
|
|
|
// rate.Add("ER", "0.00022");
|
|
|
// rate.Add("ET", "0.00022");
|
|
|
// rate.Add("EC", "0.00022");
|
|
|
|
|
|
// rate.Add("EG", "0.00022");
|
|
|
// rate.Add("SV", "0.00022");
|
|
|
|
|
|
// rate.Add("EE", "0.00022");
|
|
|
// rate.Add("EL", "0.00022");
|
|
|
// rate.Add("FJ", "0.00022");
|
|
|
// rate.Add("FI", "0.00022");
|
|
|
|
|
|
// rate.Add("FR", "0.00028");
|
|
|
// rate.Add("GA", "0.00022");
|
|
|
// rate.Add("GM", "0.00022");
|
|
|
// rate.Add("GI", "0.00022");
|
|
|
|
|
|
// rate.Add("GD", "0.00022");
|
|
|
// rate.Add("GN", "0.00022");
|
|
|
// rate.Add("GW", "0.00022");
|
|
|
// rate.Add("GY", "0.00022");
|
|
|
// rate.Add("GE", "0.00022");
|
|
|
|
|
|
// rate.Add("DE", "0.00022");
|
|
|
// rate.Add("GH", "0.00022");
|
|
|
// rate.Add("GR", "0.00028");
|
|
|
|
|
|
// rate.Add("GT", "0.00022");
|
|
|
// rate.Add("GG", "0.00022");
|
|
|
// rate.Add("HT", "0.00022");
|
|
|
// rate.Add("HN", "0.00022");
|
|
|
// rate.Add("HK", "0.00022");
|
|
|
|
|
|
// rate.Add("HU", "0.00022");
|
|
|
|
|
|
// rate.Add("IS", "0.00022");
|
|
|
|
|
|
// rate.Add("IN", "0.00022");
|
|
|
// rate.Add("ID", "0.00028");
|
|
|
|
|
|
// rate.Add("IE", "0.00022");
|
|
|
// rate.Add("IM", "0.00022");
|
|
|
// rate.Add("IR", "0.00022");
|
|
|
|
|
|
// rate.Add("IQ", "0.00022");
|
|
|
// rate.Add("IL", "0.00022");
|
|
|
|
|
|
// rate.Add("IT", "0.00028");
|
|
|
// rate.Add("JM", "0.00022");
|
|
|
|
|
|
// rate.Add("JP", "0.00019");
|
|
|
// rate.Add("GB", "0.00022");
|
|
|
// rate.Add("JO", "0.00022");
|
|
|
|
|
|
// rate.Add("KI", "0.00022");
|
|
|
// rate.Add("KP", "0.00022");
|
|
|
// rate.Add("KG", "0.00022");
|
|
|
// rate.Add("KZ", "0.00022");
|
|
|
|
|
|
// rate.Add("KE", "0.00022");
|
|
|
// rate.Add("KV", "0.00022");
|
|
|
// rate.Add("KW", "0.00022");
|
|
|
|
|
|
// rate.Add("LA", "0.00028");
|
|
|
|
|
|
// rate.Add("LR", "0.00022");
|
|
|
// rate.Add("LY", "0.00022");
|
|
|
|
|
|
// rate.Add("LV", "0.00022");
|
|
|
// rate.Add("LB", "0.00022");
|
|
|
|
|
|
// rate.Add("LS", "0.00022");
|
|
|
// rate.Add("LI", "0.00022");
|
|
|
|
|
|
// rate.Add("LT", "0.00022");
|
|
|
// rate.Add("LU", "0.00022");
|
|
|
|
|
|
// rate.Add("MW", "0.00022");
|
|
|
// rate.Add("MV", "0.00022");
|
|
|
// rate.Add("MH", "0.00022");
|
|
|
|
|
|
// rate.Add("MR", "0.00022");
|
|
|
|
|
|
// rate.Add("FM", "0.00022");
|
|
|
// rate.Add("MN", "0.00022");
|
|
|
// rate.Add("MZ", "0.00022");
|
|
|
// rate.Add("MM", "0.00028");
|
|
|
// rate.Add("MK", "0.00028");
|
|
|
|
|
|
// rate.Add("MO", "0.00022");
|
|
|
// rate.Add("MG", "0.00022");
|
|
|
|
|
|
// rate.Add("MY", "0.00028");
|
|
|
// rate.Add("ML", "0.00022");
|
|
|
// rate.Add("MT", "0.00028");
|
|
|
|
|
|
// rate.Add("MU", "0.00022");
|
|
|
// rate.Add("MX", "0.00022");
|
|
|
|
|
|
// rate.Add("MC", "0.00022");
|
|
|
// rate.Add("ME", "0.00028");
|
|
|
// rate.Add("MA", "0.00022");
|
|
|
// rate.Add("NR", "0.00022");
|
|
|
// rate.Add("NP", "0.00022");
|
|
|
// rate.Add("NI", "0.00022");
|
|
|
// rate.Add("NE", "0.00022");
|
|
|
|
|
|
// rate.Add("NA", "0.00022");
|
|
|
// rate.Add("NL", "0.00022");
|
|
|
|
|
|
// rate.Add("NZ", "0.00035");
|
|
|
// rate.Add("NG", "0.00022");
|
|
|
|
|
|
// rate.Add("NO", "0.00022");
|
|
|
// rate.Add("OM", "0.00022");
|
|
|
|
|
|
// rate.Add("PK", "0.00022");
|
|
|
// rate.Add("PS", "0.00022");
|
|
|
|
|
|
// rate.Add("PA", "0.00022");
|
|
|
// rate.Add("PG", "0.00022");
|
|
|
// rate.Add("PY", "0.00022");
|
|
|
// rate.Add("PE", "0.00022");
|
|
|
// rate.Add("PH", "0.00028");
|
|
|
// rate.Add("PL", "0.00022");
|
|
|
|
|
|
// rate.Add("PT", "0.00028");
|
|
|
// rate.Add("PW", "0.00022");
|
|
|
// rate.Add("QA", "0.00022");
|
|
|
|
|
|
// rate.Add("KR", "0.00019");
|
|
|
// rate.Add("MD", "0.00022");
|
|
|
// rate.Add("RO", "0.00028");
|
|
|
|
|
|
// rate.Add("RU", "0.00022");
|
|
|
// rate.Add("RW", "0.00022");
|
|
|
// rate.Add("KN", "0.00022");
|
|
|
// rate.Add("LC", "0.00022");
|
|
|
// rate.Add("VC", "0.00022");
|
|
|
// rate.Add("WS", "0.00022");
|
|
|
// rate.Add("SM", "0.00028");
|
|
|
// rate.Add("ST", "0.00022");
|
|
|
// rate.Add("SC", "0.00022");
|
|
|
|
|
|
// rate.Add("SL", "0.00022");
|
|
|
// rate.Add("SX", "0.00022");
|
|
|
// rate.Add("SB", "0.00022");
|
|
|
// rate.Add("SO", "0.00022");
|
|
|
// rate.Add("SS", "0.00022");
|
|
|
// rate.Add("SD", "0.00022");
|
|
|
// rate.Add("SR", "0.00022");
|
|
|
// rate.Add("SZ", "0.00022");
|
|
|
// rate.Add("SA", "0.00022");
|
|
|
|
|
|
// rate.Add("SN", "0.00022");
|
|
|
// rate.Add("RS", "0.00028");
|
|
|
|
|
|
// rate.Add("SG", "0.00028");
|
|
|
// rate.Add("SK", "0.00022");
|
|
|
|
|
|
// rate.Add("SI", "0.00028");
|
|
|
|
|
|
// rate.Add("ZA", "0.00022");
|
|
|
// rate.Add("ES", "0.00028");
|
|
|
|
|
|
// rate.Add("LK", "0.00022");
|
|
|
// rate.Add("SE", "0.00022");
|
|
|
|
|
|
// rate.Add("CH", "0.00022");
|
|
|
|
|
|
// rate.Add("SY", "0.00022");
|
|
|
|
|
|
// rate.Add("TJ", "0.00022");
|
|
|
|
|
|
// rate.Add("TO", "0.00022");
|
|
|
// rate.Add("TT", "0.00022");
|
|
|
// rate.Add("TM", "0.00022");
|
|
|
// rate.Add("TV", "0.00022");
|
|
|
// rate.Add("TW", "0.00022");
|
|
|
|
|
|
// rate.Add("TZ", "0.00022");
|
|
|
// rate.Add("TH", "0.00028");
|
|
|
// rate.Add("TG", "0.00022");
|
|
|
// rate.Add("TN", "0.00022");
|
|
|
// rate.Add("TR", "0.00022");
|
|
|
|
|
|
// rate.Add("UG", "0.00022");
|
|
|
// rate.Add("UA", "0.00022");
|
|
|
|
|
|
// rate.Add("AE", "0.00022");
|
|
|
|
|
|
// rate.Add("US", "0.00035");
|
|
|
|
|
|
// rate.Add("PR", "0.00022");
|
|
|
|
|
|
// rate.Add("UY", "0.00022");
|
|
|
// rate.Add("UZ", "0.00022");
|
|
|
// rate.Add("VU", "0.00022");
|
|
|
// rate.Add("VA", "0.00028");
|
|
|
// rate.Add("VG", "0.00022");
|
|
|
|
|
|
// rate.Add("VE", "0.00022");
|
|
|
// rate.Add("VN", "0.00028");
|
|
|
// rate.Add("YE", "0.00022");
|
|
|
|
|
|
// rate.Add("ZM", "0.00022");
|
|
|
// rate.Add("ZW", "0.00022");
|
|
|
// rate.Add("", "");
|
|
|
// return rate[code];
|
|
|
//}
|
|
|
//catch (Exception ex)
|
|
|
//{
|
|
|
// return "";
|
|
|
//}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
var country = context.TSysCountryCode.AsNoTracking().FirstOrDefault(c => c.CountryCode == code && c.FeePersent != null && c.FeePersent != "");
|
|
|
if (country != null)
|
|
|
{
|
|
|
return country.FeePersent;
|
|
|
}
|
|
|
|
|
|
return string.Empty;
|
|
|
}
|
|
|
[HttpGet]
|
|
|
public ActionResult GetthisState(string code)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
var hl = GetRate(code);
|
|
|
return Json(new { state = 1, msg = 'f', data = hl }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
return Json(new { state = -1, msg = ex.Message.ToString(), data = "" }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
}
|
|
|
[HttpGet]
|
|
|
public ActionResult ConfimIns(string insid)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
var ins = context.Insurance.Where(p => p.GID == insid&&p.states== "核保通过待确认").FirstOrDefault();
|
|
|
if (ins==null) {
|
|
|
return Json(new { state = 1, msg = "保单不是核保待确认状态,不能确认保单" }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
context = new OpSeaePxDbContenxt();
|
|
|
InsuranceRider rides = new InsuranceRider();
|
|
|
rides.RiderState = "确认保单";
|
|
|
rides.Remark = Convert.ToString(Session["SHOWNAME"]) + ",确认了保单";
|
|
|
rides.Rider = DateTime.Now;
|
|
|
rides.Gid = getGUID();
|
|
|
rides.RiderAudit = Convert.ToString(Session["SHOWNAME"]);
|
|
|
rides.NID = ins.GID;
|
|
|
context.InsuranceRider.Add(rides);
|
|
|
context.SaveChanges();
|
|
|
context = new OpSeaePxDbContenxt();
|
|
|
HttpClient httpclient = new HttpClient();
|
|
|
System.Threading.Tasks.Task<HttpResponseMessage> responseMessageState;
|
|
|
responseMessageState = httpclient.GetAsync(HTUrl + "api/ApiInsurancePolicy/SetChargeRateConfirm?apiUserKey=" + userKey + "&serialNumber=" + ins.SerialNumber);
|
|
|
var resultState = responseMessageState.Result.Content.ReadAsStringAsync().Result;
|
|
|
logger.Debug($"ConfimIns:{resultState}");
|
|
|
var resultState_ = Newtonsoft.Json.JsonConvert.DeserializeObject(resultState);
|
|
|
var SendData = (JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(resultState_.ToString());
|
|
|
if (Convert.ToInt32(SendData["Flag"]) > 0)
|
|
|
{
|
|
|
InsuranceRider ride = new InsuranceRider();
|
|
|
ride.Rider = DateTime.Now;
|
|
|
ins.InsuranceNumber = SendData.ToString().Contains("InsurancePolicy") ? SendData["InsurancePolicy"].ToString() : ins.InsuranceNumber;
|
|
|
ins.TheBathNum = SendData.ToString().Contains("EdrPolicy") ? SendData["EdrPolicy"].ToString() : ins.TheBathNum;
|
|
|
|
|
|
ins.PdfURL = SendData.ToString().Contains("PdfURL") ? SendData["PdfURL"].ToString() : ins.PdfURL;
|
|
|
|
|
|
ins.states = "发送成功";
|
|
|
ride.Remark = "保单已提交";
|
|
|
if (Convert.ToInt32(SendData["Flag"]) == 1)
|
|
|
{
|
|
|
|
|
|
ins.states = "保单生效";
|
|
|
ride.Remark = "保单已生效";
|
|
|
//ins.Premium = (ins.InvoiceMoney * ins.ChargeRate * ins.InvoiceBonus * ins.ExchangeRate) < 20 ? 20 : (ins.InvoiceMoney * ins.ChargeRate * ins.InvoiceBonus * ins.ExchangeRate);
|
|
|
}
|
|
|
if (Convert.ToInt32(SendData["Flag"]) == 4)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
ride.RiderState = ins.states;
|
|
|
ride.RiderAudit = "华泰保险";
|
|
|
ride.Gid = getGUID();
|
|
|
ride.NID = ins.GID;
|
|
|
context.InsuranceRider.Add(ride);
|
|
|
context.Entry(ins).State = System.Data.Entity.EntityState.Modified;
|
|
|
context.Configuration.ValidateOnSaveEnabled = false;
|
|
|
context.SaveChanges();
|
|
|
context.Configuration.ValidateOnSaveEnabled = true;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var backs = context.InsuranceBack.Where(p => p.NID == ins.GID & p.BackCause == "保单生效").ToList();
|
|
|
var sids = context.InsuranceRider.Where(p => p.NID == ins.GID & p.RiderState == "保单生效").ToList();
|
|
|
if (backs.Count() <= 0 || sids.Count() <= 0)
|
|
|
{
|
|
|
ins.SerialNumber = "QDDJY" + DateTime.Now.ToString("yyyyMMddHHmmss") + DateTime.Now.Millisecond;
|
|
|
}
|
|
|
ins.states = "确认失败";
|
|
|
InsuranceBack back = new InsuranceBack();
|
|
|
back.BackTim = DateTime.Now;
|
|
|
back.BackCause = "驳回保单";
|
|
|
back.BackSide = "华泰保险";
|
|
|
back.Remark = SendData["Msg"].ToString();
|
|
|
back.Gid = getGUID();
|
|
|
back.NID = ins.GID;
|
|
|
context.InsuranceBack.Add(back);
|
|
|
context.Entry(ins).State = System.Data.Entity.EntityState.Modified;
|
|
|
context.Configuration.ValidateOnSaveEnabled = false;
|
|
|
context.SaveChanges();
|
|
|
}
|
|
|
return Json(new { state = 1, msg = "已确认" }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
return Json(new { state = 0, msg = ex.Message.ToString() }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//特殊国家人工审核(t_sys_country_code_checkone的AutoAudit)
|
|
|
private bool IsCoutryTS(string str)
|
|
|
{
|
|
|
//var country = "HTC100,HTC11,HTC13,HTC16,HTC19,HTC26,HTC52,HTC53,HTC55,HTC58,HTC59,HTC61,HTC62,HTC66,HTC67,HTC70,HTC73,HTC75,HTC78,HTC81,HTC82,HTC83,HTC84,HTC85,HTC87,HTC88,HTC93,HTC94,HTC97,HTC99,HTCA12,HTCA13,HTCA5,HTCA9,HTCB10,HTCB2,HTCB7,HTCC0,HTCC1,HTCC3,HTCC7,HTCC8,HTCC9,HTCD0,HTCD2,HTCD4,HTCD5,HTCD6,HTCD7,HTCD8,HTCD9,HTCE0,HTCE1,HTCE5,HTCE6,HTCF2,HTCG0,HTCG1,HTCG5,HTCG6,HTCG8,HTCH2,HTCH4,HTCH5,HTCH6,HTCH7,HTCJ6,HTCK1,HTCK2,HTCK3,HTCK6,HTCL5,HTCM2,HTCM3,HTCS1,HTCS2,HTCT1,HTCT11,HTCT12,HTCW1,HTCY2,HTCZ1,HTCZ10,HTCZ3,HTCZ4,HTCZ5,HTCZ7,HTCZ8";
|
|
|
//if (country.Contains(str))
|
|
|
//{
|
|
|
// return true;
|
|
|
//}
|
|
|
|
|
|
var cou = context.TSysCountryCode.AsNoTracking().FirstOrDefault(c => c.parameterCode == str);
|
|
|
if (cou != null && cou.AutoAudit == "1") //自动审核
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
[HttpGet]
|
|
|
public ActionResult GetlogSta(string id)
|
|
|
{
|
|
|
var back = context.InsuranceBack.Where(p => p.NID == id && p.BackCause == "确认保单").Count();
|
|
|
var sid = context.InsuranceRider.Where(p => p.NID == id && p.RiderState == "确认保单").Count();
|
|
|
if (back > 0 || sid > 0)
|
|
|
{
|
|
|
return Json(new { state = 0 }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
return Json(new { state = 1 }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
|
|
|
#region 上传未出险证明
|
|
|
[HttpPost]
|
|
|
public ActionResult UpWCXZM(string insId)
|
|
|
{
|
|
|
RespCommon resp = new RespCommon();
|
|
|
if (Request.Files.Count == 0)
|
|
|
{
|
|
|
resp.Success = false;
|
|
|
resp.Message = "请选择要上传的文件";
|
|
|
return Json(resp);
|
|
|
}
|
|
|
|
|
|
var ins = context.Insurance.FirstOrDefault(i => i.GID == insId);
|
|
|
if (ins == null)
|
|
|
{
|
|
|
resp.Success = false;
|
|
|
resp.Message = "未找到相关记录";
|
|
|
return Json(resp);
|
|
|
}
|
|
|
|
|
|
var fileId = Guid.NewGuid().ToString();
|
|
|
var saveName = fileId + Path.GetExtension(Request.Files[0].FileName);
|
|
|
var savePathRelative = "~/HuaiTaiInsurance";
|
|
|
var savePathReal = Server.MapPath(savePathRelative);
|
|
|
var saveFileRelative = savePathRelative + "/" + saveName;
|
|
|
var saveFileReal = Server.MapPath(saveFileRelative);
|
|
|
if (!Directory.Exists(savePathReal))
|
|
|
{
|
|
|
Directory.CreateDirectory(savePathReal);
|
|
|
}
|
|
|
|
|
|
Request.Files[0].SaveAs(saveFileReal);
|
|
|
|
|
|
ins.FilePathWeiChuXian = saveFileRelative;
|
|
|
context.SaveChanges();
|
|
|
|
|
|
//发送未出险证明发送
|
|
|
var insuranceSendTo = commonData.ParamSets.AsNoTracking().First(p => p.PARAMNAME == "HuaTaiInsWeiChuXianSendTo").PARAMVALUE;
|
|
|
MailHelper.SendMailService($"{ins.ApplicantName}-{ins.BillNumber}-未出险证明", "", insuranceSendTo, new AttachFileModel { FileName = Request.Files[0].FileName, FilePath = saveFileReal });
|
|
|
|
|
|
resp.Success = true;
|
|
|
resp.Message = "操作成功";
|
|
|
return Json(resp);
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region suggest
|
|
|
|
|
|
//国家suggest
|
|
|
public ActionResult CountrySuggest(string keyword)
|
|
|
{
|
|
|
var coun = context.TSysCountryCode.AsNoTracking().Where(c => c.parameterCode != null && c.parameterCode != "").OrderBy(c => c.CountryCode).Select(c => new { c.CountryCode, c.CountryName }).Distinct().ToList();
|
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
|
{
|
|
|
coun = coun.Where(c => c.CountryName.IndexOf(keyword) > -1 || c.CountryCode.IndexOf(keyword.ToUpper()) > -1 || keyword == $"{c.CountryCode}-{c.CountryName}").ToList();
|
|
|
}
|
|
|
|
|
|
|
|
|
return Json(new { code = 200, value = coun.Select(c => new { showName = $"{c.CountryCode}-{c.CountryName}", c.CountryName }) }, JsonRequestBehavior.AllowGet);
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
//启运地
|
|
|
public ActionResult LoadportSuggest(string keyword)
|
|
|
{
|
|
|
var query = context.CodeLoadport.AsQueryable();
|
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
|
{
|
|
|
query = query.Where(c => c.PORT.StartsWith(keyword));
|
|
|
}
|
|
|
|
|
|
return Json(new { code = 200, value = query.Select(c => new { c.PORT }).ToList() }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
|
|
|
//目的地
|
|
|
public ActionResult DisportSuggest(string keyword)
|
|
|
{
|
|
|
var query = context.CodeDisport.AsQueryable();
|
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
|
{
|
|
|
query = query.Where(c => c.PORT.StartsWith(keyword));
|
|
|
}
|
|
|
|
|
|
return Json(new { code = 200, value = query.Select(c => new { c.PORT }).ToList() }, JsonRequestBehavior.AllowGet);
|
|
|
}
|
|
|
#endregion
|
|
|
}
|
|
|
static class Distinct
|
|
|
{
|
|
|
public static IEnumerable<TSource> DistinctBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
|
|
|
{
|
|
|
HashSet<TKey> seenKeys = new HashSet<TKey>();
|
|
|
foreach (TSource element in source)
|
|
|
{
|
|
|
if (seenKeys.Add(keySelector(element)))
|
|
|
{
|
|
|
yield return element;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
public class UserInfo
|
|
|
{
|
|
|
public string UserName { get; set; }
|
|
|
public string ComName { get; set; }
|
|
|
public string RealName { get; set; }
|
|
|
public string Tel { get; set; }
|
|
|
public string Email { get; set; }
|
|
|
public string FilePathStr { get; set; }
|
|
|
}
|
|
|
public class InsurancePolicyModel
|
|
|
{
|
|
|
public string SerialNumber { get; set; }
|
|
|
public string EmpAccount { get; set; }
|
|
|
public string BusinessNo { get; set; }
|
|
|
public string InsuranceCode { get; set; }
|
|
|
public string InsuranceName { get; set; }
|
|
|
public string OriginalSum { get; set; }
|
|
|
public string HBFlag { get; set; }
|
|
|
public string Sign { get; set; }
|
|
|
public string PackAndQuantity { get; set; }
|
|
|
public string FregihtItem { get; set; }
|
|
|
public string InvoiceNumber { get; set; }
|
|
|
public string BillNumber { get; set; }
|
|
|
public string CargoType { get; set; }
|
|
|
public string InvoiceMoney { get; set; }
|
|
|
public string InvoiceBonus { get; set; }
|
|
|
public string Amt { get; set; }
|
|
|
public string AmtCurrency { get; set; }
|
|
|
public string ExchangeRate { get; set; }
|
|
|
public string ChargeRate { get; set; }
|
|
|
public string Premium { get; set; }
|
|
|
public string PremiumPrit { get; set; }
|
|
|
public string TransportType { get; set; }
|
|
|
public string TransportDetail { get; set; }
|
|
|
public string TrafficNumber { get; set; }
|
|
|
public string FlightsCheduled { get; set; }
|
|
|
public string FromContry { get; set; }
|
|
|
public string FromArea { get; set; }
|
|
|
public string PassPort { get; set; }
|
|
|
public string ToContry { get; set; }
|
|
|
public string ToArea { get; set; }
|
|
|
public string SurveyAdrID { get; set; }
|
|
|
public string SurveyAdr { get; set; }
|
|
|
public string StartTM { get; set; }
|
|
|
public string EndTM { get; set; }
|
|
|
public string DatePritType { get; set; }
|
|
|
public string CreditNO { get; set; }
|
|
|
public string CreditNODesc { get; set; }
|
|
|
public string SpecialAgreement { get; set; }
|
|
|
public string NewSpecialAgreement { get; set; }
|
|
|
public string IndemnityClaim { get; set; }
|
|
|
public string RdrCde { get; set; }
|
|
|
public string RdrName { get; set; }
|
|
|
public string WarIns { get; set; }
|
|
|
public string StrikeIns { get; set; }
|
|
|
public string TheftIns { get; set; }
|
|
|
public string CtoCIns { get; set; }
|
|
|
public string ApplicantName { get; set; }
|
|
|
public string Cell { get; set; }
|
|
|
public string Address { get; set; }
|
|
|
public string Email { get; set; }
|
|
|
public string BInsuredName { get; set; }
|
|
|
public string BIDType { get; set; }
|
|
|
public string BID { get; set; }
|
|
|
public string BCell { get; set; }
|
|
|
public string BAddress { get; set; }
|
|
|
public string BEmail { get; set; }
|
|
|
}
|
|
|
}
|