|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsChDui;
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsChDui;
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsChDuiView;
|
|
|
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
|
|
using DSWeb.MvcShipping.Comm.Cookie;
|
|
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using HcUtility.Comm;
|
|
|
|
|
using HcUtility.Core;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsSysBillNoSet;
|
|
|
|
|
using DSWeb.Areas.MvcShipping.DAL.Disports;
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsCodeGoods;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsCodeGoods;
|
|
|
|
|
using DSWeb.Areas.MvcShipping.Models.Disport;
|
|
|
|
|
using DSWeb.MvcShipping.Models.CodeCtnEdi;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsCodeCtnEdi;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
|
|
|
{
|
|
|
|
|
[JsonRequestBehavior]
|
|
|
|
|
public class MsCodeDisportSetController : Controller
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// GET:
|
|
|
|
|
public ActionResult Index()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET: /
|
|
|
|
|
public ActionResult Edit()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET:
|
|
|
|
|
public ContentResult GetDataList(int start, int limit, string condition, string sort)
|
|
|
|
|
{
|
|
|
|
|
//string a = string.Empty;
|
|
|
|
|
//string b = "";
|
|
|
|
|
//string c = "";
|
|
|
|
|
//if (!string.IsNullOrEmpty(Request.QueryString["ename"]))
|
|
|
|
|
//{
|
|
|
|
|
// a = Request.QueryString["ename"].ToString();
|
|
|
|
|
//}
|
|
|
|
|
//if (!string.IsNullOrEmpty(Request.QueryString["cname"]))
|
|
|
|
|
//{
|
|
|
|
|
// b = Request.QueryString["cname"].ToString();
|
|
|
|
|
//}
|
|
|
|
|
//if (!string.IsNullOrEmpty(Request.QueryString["cname"]))
|
|
|
|
|
//{
|
|
|
|
|
// c = Request.QueryString["cname"].ToString();
|
|
|
|
|
//}
|
|
|
|
|
var dataList = DisportsDal.GetDisportList(condition);
|
|
|
|
|
var list = dataList.Skip(start).Take(limit);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
public ContentResult GetData(string handle, string condition)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DisportModel head = null;
|
|
|
|
|
|
|
|
|
|
if (handle == "edit")
|
|
|
|
|
{
|
|
|
|
|
var list = DisportsDal.GetDisportListByID(condition);
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
|
head = list[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (head == null)
|
|
|
|
|
{
|
|
|
|
|
head = new DisportModel();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult GetBodyList(int start, int limit, string sort, string condition)//
|
|
|
|
|
{
|
|
|
|
|
var dataList = MsCodeGoodsDAL.GetBodyList(condition, sort);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetGoodsType(int start, int limit, string sort, string condition)//jj
|
|
|
|
|
{
|
|
|
|
|
var dataList = MsCodeGoodsDAL.GetGoodsType(condition, sort);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 获取国家列表
|
|
|
|
|
public ContentResult GetCountryType(int start, int limit, string sort, string condition)
|
|
|
|
|
{
|
|
|
|
|
var dataList = DisportsDal.GetCountrytList();
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 获取航线列表
|
|
|
|
|
public ContentResult GetLineType(int start, int limit, string sort, string condition)
|
|
|
|
|
{
|
|
|
|
|
var dataList = DisportsDal.GetLaneList();
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
public ContentResult Save(string opstatus, string data, string body)
|
|
|
|
|
{
|
|
|
|
|
var headData = JsonConvert.Deserialize<DisportModel>(data);
|
|
|
|
|
var bodyList = JsonConvert.Deserialize<List<CodeCtnEdi>>(body);
|
|
|
|
|
var copybodylist = new List<CodeCtnEdi>();
|
|
|
|
|
var ismost = false;
|
|
|
|
|
if (bodyList != null && bodyList.Count != 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var PORTEDI in bodyList)
|
|
|
|
|
{
|
|
|
|
|
var addbody = copybodylist.Find(x => x.EDINAME == PORTEDI.EDINAME);
|
|
|
|
|
if (addbody != null)
|
|
|
|
|
{
|
|
|
|
|
ismost = true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
var newbody = new CodeCtnEdi();
|
|
|
|
|
newbody.EDINAME = PORTEDI.EDINAME;
|
|
|
|
|
copybodylist.Add(newbody);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ismost) {
|
|
|
|
|
var jsonRespose = new JsonResponse { Success =false, Message ="EDI代码设置不允许重复!" };
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (opstatus == "add")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
//headData.ModelUIStatus = "E";
|
|
|
|
|
//DBResult re = DisportsDal.InsertDetail(headData);
|
|
|
|
|
//if (re.Success==false)
|
|
|
|
|
//{
|
|
|
|
|
// var jsonRespose = new JsonResponse { Success = re.Success, Message =re.Message };
|
|
|
|
|
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
else if (opstatus == "edit")
|
|
|
|
|
{
|
|
|
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
|
|
|
headData.ModelUIStatus = "E";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
|
|
|
}
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
|
|
DBResult result = modb.Save(headData);
|
|
|
|
|
var GID = headData.PORTID;
|
|
|
|
|
var PORTLIST = DisportsDal.GetDisportListByID(GID);
|
|
|
|
|
DisportModel head = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result.Success)
|
|
|
|
|
{
|
|
|
|
|
if (PORTLIST.Count > 0)
|
|
|
|
|
head = PORTLIST[0];
|
|
|
|
|
|
|
|
|
|
if (head == null)
|
|
|
|
|
{
|
|
|
|
|
head = new DisportModel();
|
|
|
|
|
}
|
|
|
|
|
if (bodyList != null && bodyList.Count!=0) {
|
|
|
|
|
foreach (var PORTEDI in bodyList) {
|
|
|
|
|
PORTEDI.PORTID = head.EDICODE;
|
|
|
|
|
PORTEDI.CTN = head.PORT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MsCodeCtnEdiDAL.SavePORTDISCHARGEDetail(bodyList, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]).ToString().Trim());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var jRespose = new JsonResponse
|
|
|
|
|
{
|
|
|
|
|
Success = result.Success,
|
|
|
|
|
Message = result.Message,
|
|
|
|
|
Data= head
|
|
|
|
|
//
|
|
|
|
|
};
|
|
|
|
|
//BasicDataRefDAL.PubStore_SetNew("CODE_DISPORT");
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jRespose) };
|
|
|
|
|
}
|
|
|
|
|
public ContentResult Delete(string data)
|
|
|
|
|
{
|
|
|
|
|
var headData = JsonConvert.Deserialize<DisportModel>(data);
|
|
|
|
|
|
|
|
|
|
DBResult result = DisportsDal.DeleteDetail(headData);
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
#region 参照部分
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|