You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
718 lines
29 KiB
C#
718 lines
29 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Web.Mvc;
|
|
using DSWeb.MvcShipping.Helper;
|
|
using DSWeb.MvcShipping.Comm.Cookie;
|
|
using HcUtility.Comm;
|
|
using HcUtility.Core;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Data;
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
using DSWeb.TruckMng.Helper.Repository;
|
|
using DSWeb.Areas.MvcShipping.DAL.MsOp_InternalTrade;
|
|
using DSWeb.MvcShipping.Models.MsOp_InternalTrade;
|
|
|
|
using DSWeb.Areas.OA.Models.WorkFlow;
|
|
|
|
using DSWeb.EntityDA;
|
|
using DSWeb.MvcShipping.DAL.MsSysParamSet;
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
|
|
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;//编码规则
|
|
|
|
using DSWeb.Areas.SysMng.DAL.SysTask;
|
|
|
|
using DSWeb.MvcShipping.DAL.MsOpSeaiDAL;
|
|
using DSWeb.MvcShipping.Models.MsOpSeai;//海运进口业务
|
|
|
|
using DSWeb.Areas.Import.Models.Comm;//用于生成费用
|
|
using DSWeb.Areas.CommMng.Models;
|
|
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;//查询OP权限
|
|
using DSWeb.MvcShipping.DAL.MsCodeOpDef;
|
|
using DSWeb.MvcShipping.DAL.MsInfoClient;
|
|
using DSWeb.MvcShipping.DAL.MsOpSeaeDAL;
|
|
using DSWeb.Common.DB;
|
|
using DSWeb.SoftMng.DAL.SoftSysTable;
|
|
using Newtonsoft.Json.Linq;
|
|
using System.Data.Entity.Migrations;
|
|
using DSWeb.Areas.MvcShipping.DAL.DJYORDER_CONTRACTNO;
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 大简云订舱相关信息 合约信息
|
|
/// 20240419
|
|
/// </summary>
|
|
[JsonRequestBehavior]
|
|
public class DJYORDER_CONTRACTNOController : Controller
|
|
{
|
|
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult Edit()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
|
|
public ContentResult GetDataList(int start, int limit, string sort, string condition)
|
|
{
|
|
|
|
var count = 0;
|
|
|
|
var uid = Session["USERID"].ToString();
|
|
CommonDataContext cdc = new CommonDataContext();
|
|
var _user = cdc.VW_user.AsNoTracking().FirstOrDefault(u => u.USERID == uid);
|
|
|
|
//if (userid != "1BEC90E1-9780-472F-90C2-0C6390C044A4") {
|
|
|
|
//}
|
|
|
|
|
|
|
|
var dataList = DJYORDER_CONTRACTNODAL.GetDataList(start, limit, sort, condition, _user, ref count);
|
|
|
|
|
|
|
|
//var dataList = MsChDuiDAL.GetDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request), sort);
|
|
//int count = MsChDuiDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request));
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetDataListStr(string condition)
|
|
{
|
|
|
|
var count = 0;
|
|
|
|
var uid = Session["USERID"].ToString();
|
|
CommonDataContext cdc = new CommonDataContext();
|
|
var _user = cdc.VW_user.AsNoTracking().FirstOrDefault(u => u.USERID == uid);
|
|
|
|
//if (userid != "1BEC90E1-9780-472F-90C2-0C6390C044A4") {
|
|
|
|
//}
|
|
|
|
|
|
|
|
var SqlStr = DJYORDER_CONTRACTNODAL.GetDataListStr(condition, _user);
|
|
|
|
|
|
|
|
//var dataList = MsChDuiDAL.GetDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request), sort);
|
|
//int count = MsChDuiDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request));
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = SqlStr });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetEditData(string handle, string condition)
|
|
{
|
|
var result = new DJYORDER_CONTRACTNO_md();
|
|
var userid = Session["USERID"].ToString();
|
|
CommonDataContext cdc = new CommonDataContext();
|
|
var _user = cdc.VW_user.AsNoTracking().FirstOrDefault(u => u.USERID == userid);
|
|
var count = 0;
|
|
|
|
if (handle == "add")
|
|
{
|
|
//新建 返回默认值
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
var resultlist = DJYORDER_CONTRACTNODAL.GetDataList(0, 1, "", condition, _user, ref count);
|
|
if (resultlist != null && resultlist.Count > 0)
|
|
{
|
|
result = resultlist[0];
|
|
}
|
|
}
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = result });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
|
|
public ContentResult GetData(string BSNO)
|
|
{
|
|
var result = new DJYORDER_CONTRACTNO_md();
|
|
var userid = Session["USERID"].ToString();
|
|
CommonDataContext cdc = new CommonDataContext();
|
|
var _user = cdc.VW_user.AsNoTracking().FirstOrDefault(u => u.USERID == userid);
|
|
var count = 0;
|
|
if (string.IsNullOrWhiteSpace(BSNO))
|
|
{
|
|
//新建 返回默认值
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
var resultlist = DJYORDER_CONTRACTNODAL.GetDataList(0, 1, "", $" BSNO='{BSNO}'", _user, ref count);
|
|
if (resultlist != null && resultlist.Count > 0)
|
|
{
|
|
result = resultlist[0];
|
|
}
|
|
}
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = result });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
|
|
public ContentResult Save(string opstatus, string data)
|
|
{
|
|
var result = new DBResult();
|
|
JObject ParamObject = JsonConvert.Deserialize<JObject>(data);
|
|
|
|
data = data.Replace("❥", "<");
|
|
//var headData = JsonConvert.Deserialize<OP_SERVICEBILL_md>(data.Replace("}", ",") + data2.Replace("{", ""));
|
|
var headData = JsonConvert.Deserialize<DJYORDER_CONTRACTNO_md>(data);
|
|
//var bodyList = JsonConvert.Deserialize<List<INFO_CLIENT_CONTACT>>(body);
|
|
|
|
var oldheaddata = new DJYORDER_CONTRACTNO_md();
|
|
|
|
//var checksettinginfo = DJYORDER_CONTRACTNODAL.CheckSetting(headData);
|
|
//if (!checksettinginfo.Success)
|
|
//{
|
|
// return BasicDataRefDAL.GetContentResult(checksettinginfo);
|
|
//}
|
|
|
|
var isPost = true;
|
|
var errorstr = "";
|
|
|
|
var userid = Session["USERID"].ToString();
|
|
CommonDataContext cdc = new CommonDataContext();
|
|
var _user = cdc.VW_user.AsNoTracking().FirstOrDefault(u => u.USERID == userid);
|
|
|
|
//20240411 判断
|
|
|
|
#region 判断字段长度
|
|
if (isPost)
|
|
{
|
|
var seaefield = MsSoftSysTableDAL.GetDefTableDetailList("info_client");
|
|
foreach (var enumValue in seaefield)
|
|
{
|
|
if (enumValue.FIELDNAME == "CARRIER" && headData.CARRIER.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "船公司超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
|
if (enumValue.FIELDNAME == "CONTRACTNO" && headData.CONTRACTNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "合约号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
|
if (enumValue.FIELDNAME == "ShipperName" && headData.ShipperName.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "发货人名称超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
|
if (enumValue.FIELDNAME == "ShipperAddress" && headData.ShipperAddress.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "发货人地址超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
|
if (enumValue.FIELDNAME == "ShipperCountry" && headData.ShipperCountry.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "国家超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
if (enumValue.FIELDNAME == "ShipperProvince" && headData.ShipperProvince.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "省超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
if (enumValue.FIELDNAME == "ShipperCity" && headData.ShipperCity.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "市超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
if (enumValue.FIELDNAME == "ShipperCounty" && headData.ShipperCounty.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "区超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
if (enumValue.FIELDNAME == "ShipperPostCode" && headData.ShipperPostCode.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "邮编超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
if (enumValue.FIELDNAME == "ShipperFirstName" && headData.ShipperFirstName.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "姓超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
if (enumValue.FIELDNAME == "ShipperLastName" && headData.ShipperLastName.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = " 名超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
if (enumValue.FIELDNAME == "ShipperPhoneCountryCode" && headData.ShipperPhoneCountryCode.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "国家区号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
if (enumValue.FIELDNAME == "ShipperPhoneCode" && headData.ShipperPhoneCode.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "市区号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
if (enumValue.FIELDNAME == "ShipperPhone" && headData.ShipperPhone.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "电话号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
if (enumValue.FIELDNAME == "REMARK" && headData.REMARK.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "备注超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
|
|
if (isPost)
|
|
{
|
|
try
|
|
{
|
|
|
|
if (opstatus == "add" || string.IsNullOrWhiteSpace(headData.GID))
|
|
{
|
|
var uid = Session["USERID"].ToString();
|
|
|
|
headData.GID = Guid.NewGuid().ToString();
|
|
|
|
cdc.DJYORDER_CONTRACTNO.Add(headData);
|
|
cdc.SaveChanges();
|
|
result.OK("保存成功", headData);
|
|
}
|
|
else
|
|
{
|
|
|
|
oldheaddata = cdc.DJYORDER_CONTRACTNO.First(x => x.GID == headData.GID);
|
|
|
|
//var canchange = CanChange(oldheaddata);
|
|
|
|
//if (!canchange.Success) {
|
|
// return BasicDataRefDAL.GetContentResult(canchange);
|
|
//}
|
|
|
|
BasicDataRefDAL.CopyProperties(headData, oldheaddata);
|
|
|
|
|
|
cdc.DJYORDER_CONTRACTNO.AddOrUpdate(oldheaddata);
|
|
cdc.SaveChanges();
|
|
result.OK("保存成功", oldheaddata);
|
|
}
|
|
|
|
|
|
}
|
|
catch (Exception e) {
|
|
result.SetErrorInfo(JsonConvert.Serialize(e));
|
|
}
|
|
|
|
return BasicDataRefDAL.GetContentResult(result);
|
|
}
|
|
else
|
|
{
|
|
var jsonRespose = new JsonResponse { Success = false, Message = errorstr };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public JsonResult GetCarrierContractnoStore(string CARRIER)
|
|
{
|
|
//select distinct bankname2 as GVALUE,'' as GID from sys_bank
|
|
|
|
var cdc = new Common.DB.CommonDataContext();
|
|
|
|
var USERID = Convert.ToString(Session["USERID"]);
|
|
|
|
//var condition = $" CARRIER='{CARRIER}' ";
|
|
|
|
//var evList = BasicDataRefDAL.GeneralSelect("DJYORDER_CONTRACTNO", "CONTRACTNO", "CONTRACTNO", condition);
|
|
|
|
var evList = cdc.DJYORDER_CONTRACTNO.Where(x => x.CARRIER == CARRIER).ToList();
|
|
|
|
if (evList.Count == 0)
|
|
{
|
|
return Json(new { success = false });
|
|
}
|
|
else
|
|
{
|
|
var blankrec = new DJYORDER_CONTRACTNO_md();
|
|
evList.Add(blankrec);
|
|
return Json(new { success = true, data = evList.ToList() });
|
|
}
|
|
}
|
|
|
|
public JsonResult GetLASTConsignee(string ConsigneeName,string CARRIER)
|
|
{
|
|
var canlogin = BasicDataRefDAL.CheckLogin(Session);
|
|
if (!canlogin.Success)
|
|
{
|
|
return Json(new { success = false });
|
|
}
|
|
|
|
List<VW_DJYORDER_LASTConsignee_2_md> evList = DJYORDER_CONTRACTNODAL.GetLASTConsignee(ConsigneeName);
|
|
|
|
if (evList.Count == 0)
|
|
{
|
|
return Json(new { success = false });
|
|
}
|
|
else
|
|
{
|
|
return Json(new { success = true, data = evList.ToList() });
|
|
}
|
|
}
|
|
public JsonResult GetLASTConsignee_COSCO(string ConsigneeName)
|
|
{
|
|
return GetLASTConsignee(ConsigneeName, "COSCO");
|
|
}
|
|
public JsonResult GetLASTConsignee_EMC(string ConsigneeName)
|
|
{
|
|
return GetLASTConsignee(ConsigneeName, "EMC");
|
|
}
|
|
public JsonResult GetLASTConsignee_ONE(string ConsigneeName)
|
|
{
|
|
return GetLASTConsignee(ConsigneeName, "ONE");
|
|
}
|
|
|
|
|
|
public JsonResult GetLASTNotifypart(string NotifypartName,string CARRIER)
|
|
{
|
|
var canlogin = BasicDataRefDAL.CheckLogin(Session);
|
|
if (!canlogin.Success)
|
|
{
|
|
return Json(new { success = false });
|
|
}
|
|
|
|
List<VW_DJYORDER_LASTNotifypart_2_md> evList = DJYORDER_CONTRACTNODAL.GetLASTNotifypart(NotifypartName,CARRIER);
|
|
|
|
if (evList.Count == 0)
|
|
{
|
|
return Json(new { success = false });
|
|
}
|
|
else
|
|
{
|
|
return Json(new { success = true, data = evList.ToList() });
|
|
}
|
|
}
|
|
public JsonResult GetLASTNotifypart_COSCO(string NotifypartName)
|
|
{
|
|
return GetLASTNotifypart(NotifypartName, "COSCO");
|
|
}
|
|
public JsonResult GetLASTNotifypart_EMC(string NotifypartName)
|
|
{
|
|
return GetLASTNotifypart(NotifypartName, "EMC");
|
|
}
|
|
public JsonResult GetLASTNotifypart_ONE(string NotifypartName)
|
|
{
|
|
return GetLASTNotifypart(NotifypartName, "ONE");
|
|
}
|
|
|
|
public JsonResult GetLASTShipper(string ShipperName,string CARRIER)
|
|
{
|
|
var canlogin = BasicDataRefDAL.CheckLogin(Session);
|
|
if (!canlogin.Success)
|
|
{
|
|
return Json(new { success = false });
|
|
}
|
|
|
|
List<VW_DJYORDER_LASTShipper_2_md> evList = DJYORDER_CONTRACTNODAL.GetLASTShipper(ShipperName);
|
|
|
|
if (evList.Count == 0)
|
|
{
|
|
return Json(new { success = false });
|
|
}
|
|
else
|
|
{
|
|
return Json(new { success = true, data = evList.ToList() });
|
|
}
|
|
}
|
|
public JsonResult GetLASTShipper_COSCO(string NotifypartName)
|
|
{
|
|
return GetLASTShipper(NotifypartName, "COSCO");
|
|
}
|
|
public JsonResult GetLASTShipper_EMC(string NotifypartName)
|
|
{
|
|
return GetLASTShipper(NotifypartName, "EMC");
|
|
}
|
|
public JsonResult GetLASTShipper_ONE(string NotifypartName)
|
|
{
|
|
return GetLASTShipper(NotifypartName, "ONE");
|
|
}
|
|
public ContentResult DelHead(string GID)
|
|
{
|
|
var canlogin = BasicDataRefDAL.CheckLogin(Session);
|
|
if (!canlogin.Success)
|
|
{
|
|
return (ContentResult)canlogin.Data;
|
|
}
|
|
|
|
|
|
CommonDataContext cdc = new CommonDataContext();
|
|
|
|
var delrec=cdc.DJYORDER_CONTRACTNO.FirstOrDefault(x => x.GID == GID);
|
|
cdc.DJYORDER_CONTRACTNO.Remove(delrec);
|
|
cdc.SaveChangesAsync();
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "删除成功" });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 大简云订舱相关信息 合约信息
|
|
/// 20240419
|
|
/// </summary>
|
|
[JsonRequestBehavior]
|
|
public class DJYORDER_ACCOUNTINFOController : Controller
|
|
{
|
|
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult Edit()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
|
|
public ContentResult GetDataList(int start, int limit, string sort, string condition)
|
|
{
|
|
|
|
var count = 0;
|
|
|
|
var uid = Session["USERID"].ToString();
|
|
CommonDataContext cdc = new CommonDataContext();
|
|
var _user = cdc.VW_user.AsNoTracking().FirstOrDefault(u => u.USERID == uid);
|
|
|
|
//if (userid != "1BEC90E1-9780-472F-90C2-0C6390C044A4") {
|
|
|
|
//}
|
|
|
|
|
|
|
|
var dataList = DJYORDER_ACCOUNTINFODAL.GetDataList(start, limit, sort, condition, _user, ref count);
|
|
|
|
|
|
|
|
//var dataList = MsChDuiDAL.GetDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request), sort);
|
|
//int count = MsChDuiDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request));
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetDataListStr(string condition)
|
|
{
|
|
|
|
var count = 0;
|
|
|
|
var uid = Session["USERID"].ToString();
|
|
CommonDataContext cdc = new CommonDataContext();
|
|
var _user = cdc.VW_user.AsNoTracking().FirstOrDefault(u => u.USERID == uid);
|
|
|
|
//if (userid != "1BEC90E1-9780-472F-90C2-0C6390C044A4") {
|
|
|
|
//}
|
|
|
|
|
|
|
|
var SqlStr = DJYORDER_ACCOUNTINFODAL.GetDataListStr(condition, _user);
|
|
|
|
|
|
|
|
//var dataList = MsChDuiDAL.GetDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request), sort);
|
|
//int count = MsChDuiDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request));
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = SqlStr });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetEditData(string handle, string condition)
|
|
{
|
|
var result = new DJYORDER_ACCOUNTINFO_md();
|
|
var userid = Session["USERID"].ToString();
|
|
CommonDataContext cdc = new CommonDataContext();
|
|
var _user = cdc.VW_user.AsNoTracking().FirstOrDefault(u => u.USERID == userid);
|
|
var count = 0;
|
|
|
|
if (handle == "add")
|
|
{
|
|
//新建 返回默认值
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
var resultlist = DJYORDER_ACCOUNTINFODAL.GetDataList(0, 1, "", condition, _user, ref count);
|
|
if (resultlist != null && resultlist.Count > 0)
|
|
{
|
|
result = resultlist[0];
|
|
}
|
|
}
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = result });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
|
|
public ContentResult GetData(string BSNO)
|
|
{
|
|
var result = new DJYORDER_ACCOUNTINFO_md();
|
|
var userid = Session["USERID"].ToString();
|
|
CommonDataContext cdc = new CommonDataContext();
|
|
var _user = cdc.VW_user.AsNoTracking().FirstOrDefault(u => u.USERID == userid);
|
|
var count = 0;
|
|
if (string.IsNullOrWhiteSpace(BSNO))
|
|
{
|
|
//新建 返回默认值
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
var resultlist = DJYORDER_ACCOUNTINFODAL.GetDataList(0, 1, "", $" BSNO='{BSNO}'", _user, ref count);
|
|
if (resultlist != null && resultlist.Count > 0)
|
|
{
|
|
result = resultlist[0];
|
|
}
|
|
}
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = result });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
|
|
public ContentResult Save(string opstatus, string data)
|
|
{
|
|
var result = new DBResult();
|
|
JObject ParamObject = JsonConvert.Deserialize<JObject>(data);
|
|
|
|
data = data.Replace("❥", "<");
|
|
//var headData = JsonConvert.Deserialize<OP_SERVICEBILL_md>(data.Replace("}", ",") + data2.Replace("{", ""));
|
|
var headData = JsonConvert.Deserialize<DJYORDER_ACCOUNTINFO_md>(data);
|
|
//var bodyList = JsonConvert.Deserialize<List<INFO_CLIENT_CONTACT>>(body);
|
|
|
|
var oldheaddata = new DJYORDER_ACCOUNTINFO_md();
|
|
|
|
//var checksettinginfo = DJYORDER_CONTRACTNODAL.CheckSetting(headData);
|
|
//if (!checksettinginfo.Success)
|
|
//{
|
|
// return BasicDataRefDAL.GetContentResult(checksettinginfo);
|
|
//}
|
|
|
|
var isPost = true;
|
|
var errorstr = "";
|
|
|
|
var userid = Session["USERID"].ToString();
|
|
CommonDataContext cdc = new CommonDataContext();
|
|
var _user = cdc.VW_user.AsNoTracking().FirstOrDefault(u => u.USERID == userid);
|
|
|
|
//20240411 判断
|
|
|
|
#region 判断字段长度
|
|
if (isPost)
|
|
{
|
|
var seaefield = MsSoftSysTableDAL.GetDefTableDetailList("info_client");
|
|
foreach (var enumValue in seaefield)
|
|
{
|
|
if (enumValue.FIELDNAME == "CARRIER" && headData.CARRIER.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "船公司超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
|
if (enumValue.FIELDNAME == "ACCOUNT" && headData.ACCOUNT.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "账号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
|
if (enumValue.FIELDNAME == "ACCOUNTPSW" && headData.ACCOUNTPSW.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "密码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
|
if (enumValue.FIELDNAME == "BookingName" && headData.BookingName.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "订舱方名称超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
|
if (enumValue.FIELDNAME == "BookingAddress" && headData.BookingAddress.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "订舱方地址超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
|
if (enumValue.FIELDNAME == "BookingCountry" && headData.BookingCountry.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "国家超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
if (enumValue.FIELDNAME == "BookingProvince" && headData.BookingProvince.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "省超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
if (enumValue.FIELDNAME == "BookingCity" && headData.BookingCity.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "市超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
if (enumValue.FIELDNAME == "BookingCounty" && headData.BookingCounty.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "区超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
if (enumValue.FIELDNAME == "BookingPostCode" && headData.BookingPostCode.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "邮编超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
if (enumValue.FIELDNAME == "BookingFirstName" && headData.BookingFirstName.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "姓超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
if (enumValue.FIELDNAME == "BookingLastName" && headData.BookingLastName.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = " 名超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
if (enumValue.FIELDNAME == "BookingPhoneCountryCode" && headData.BookingPhoneCountryCode.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "国家区号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
if (enumValue.FIELDNAME == "BookingPhoneCode" && headData.BookingPhoneCode.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "市区号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
if (enumValue.FIELDNAME == "BookingPhone" && headData.BookingPhone.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "电话号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
if (enumValue.FIELDNAME == "REMARK" && headData.REMARK.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "备注超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
|
|
if (isPost)
|
|
{
|
|
try
|
|
{
|
|
|
|
if (opstatus == "add" || string.IsNullOrWhiteSpace(headData.GID))
|
|
{
|
|
var uid = Session["USERID"].ToString();
|
|
|
|
headData.GID = Guid.NewGuid().ToString();
|
|
|
|
cdc.DJYORDER_ACCOUNTINFO.Add(headData);
|
|
cdc.SaveChanges();
|
|
result.OK("保存成功", headData);
|
|
}
|
|
else
|
|
{
|
|
|
|
oldheaddata = cdc.DJYORDER_ACCOUNTINFO.First(x => x.GID == headData.GID);
|
|
|
|
//var canchange = CanChange(oldheaddata);
|
|
|
|
//if (!canchange.Success) {
|
|
// return BasicDataRefDAL.GetContentResult(canchange);
|
|
//}
|
|
|
|
BasicDataRefDAL.CopyProperties(headData, oldheaddata);
|
|
|
|
|
|
cdc.DJYORDER_ACCOUNTINFO.AddOrUpdate(oldheaddata);
|
|
cdc.SaveChanges();
|
|
result.OK("保存成功", oldheaddata);
|
|
}
|
|
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
result.SetErrorInfo(JsonConvert.Serialize(e));
|
|
}
|
|
|
|
return BasicDataRefDAL.GetContentResult(result);
|
|
}
|
|
else
|
|
{
|
|
var jsonRespose = new JsonResponse { Success = false, Message = errorstr };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public JsonResult GetAccStore(string CARRIER)
|
|
{
|
|
//select distinct bankname2 as GVALUE,'' as GID from sys_bank
|
|
|
|
var cdc = new Common.DB.CommonDataContext();
|
|
|
|
var USERID = Convert.ToString(Session["USERID"]);
|
|
|
|
//var condition = $" CARRIER='{CARRIER}' ";
|
|
|
|
var evList = cdc.DJYORDER_ACCOUNTINFO.Where(x => x.CARRIER == CARRIER).ToList();
|
|
|
|
var condition = $" USERID='{USERID}' and THIRDPARTY='{"大简云订舱船公司账号"}' and CUSTOMERNAME='{CARRIER}' ";
|
|
|
|
var thirdpartyaccount = BasicDataRefDAL.GeneralSelect("sys_thidparty_account", "ACCOUNT", "ACCOUNTPSW", condition);
|
|
|
|
|
|
|
|
|
|
if (evList.Count == 0)
|
|
{
|
|
return Json(new { success = false });
|
|
}
|
|
else
|
|
{
|
|
|
|
var resultlist = new List<DJYORDER_ACCOUNTINFO_md>();
|
|
|
|
if (thirdpartyaccount != null && thirdpartyaccount.Count > 0) {
|
|
foreach (var item in thirdpartyaccount) {
|
|
if(evList.Exists(x => x.ACCOUNT == item.GID))
|
|
{
|
|
foreach (var acc in evList.Where(x => x.ACCOUNT == item.GID)) {
|
|
acc.ACCOUNTPSW = item.GVALUE;
|
|
resultlist.Add(acc);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
resultlist = resultlist.OrderBy(s => s.ACCOUNT).ToList();
|
|
var blankrec = new DJYORDER_ACCOUNTINFO_md();
|
|
resultlist.Add(blankrec);
|
|
|
|
return Json(new { success = true, data = resultlist.ToList() });
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|