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.

219 lines
8.8 KiB
C#

using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.Helper;
using HcUtility.Comm;
using HcUtility.Core;
using DSWeb.Areas.MvcShipping.Models.MsOpSeaeTDExt;
using System.Collections.Generic;
using DSWeb.Areas.MvcShipping.Models.MsOpSeaeBJ;
using DSWeb.MvcShipping.DAL.MsOpSeaeBJExt;
using DSWeb.MvcShipping.DAL.MsOpSeaeTDExt;
namespace DSWeb.MvcShipping.Controllers
{
[JsonRequestBehavior]
public class MsOpSeaeBJExtController : Controller
{
//
// GET:
public ActionResult Index()
{
return View();
}
public ActionResult Edit()
{
return View();
}
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
//string userid = "1BEC90E1-9780-472F-90C2-0C6390C044A4";
string userid = Convert.ToString(Session["USERID"]);
//string comname = MsOpSeaeTDDAL.GetComnameWithUserid(userid);
int totalCount = 0;
// condition += " t0.hdcomname = '"+ comname + "' and t0.HDXSID = '"+userid+"'";
var dataList = MsOpSeaeBJExtDAL.GetDataList(condition, userid, start, limit, out totalCount);
//分页信息
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = dataList, totalCount = totalCount });
return new ContentResult() { Content = json };
}
public ContentResult GetData(string gid)
{
// string userid = "1BEC90E1-9780-472F-90C2-0C6390C044A4";
string userid = Convert.ToString(Session["USERID"]);
string condition = "t.gid = '" + gid + "'";
if (userid == "" || userid == null)
{
var jsonRespose = new JsonResponse { Success = false, Message = "登陆状态失效,请重新登陆进行操作!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
string INPUTBY = Convert.ToString(Session["SHOWNAME"]);
MsOpSeaeTDXJModel head = MsOpSeaeTDExtDAL.GetData_XJ(condition, userid);
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult GetBodyList(string gid)
{
string userid = Convert.ToString(Session["USERID"]);
string comname = MsOpSeaeTDExtDAL.GetComnameWithUserid(userid);
var bodyList = MsOpSeaeBJExtDAL.GetDataList_XJ_HD("t0.xjid = '" + gid + "' ", userid);
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = bodyList });
return new ContentResult() { Content = json };
}
public ContentResult GetSelDataWithName(string name, string condition = "")
{
// string userid = "1BEC90E1-9780-472F-90C2-0C6390C044A4";
string userid = Convert.ToString(Session["USERID"]);
var dataList = MsOpSeaeTDExtDAL.GetSelDataWithName(name, userid, condition);
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = dataList });
return new ContentResult() { Content = json };
}
public ContentResult GetData_XJ(string tid)
{
//string userid = "1BEC90E1-9780-472F-90C2-0C6390C044A4";
string userid = Convert.ToString(Session["USERID"]);
string condition = "t.tid = '" + tid + "'";
if (userid == "" || userid == null)
{
var jsonRespose = new JsonResponse { Success = false, Message = "登陆状态失效,请重新登陆进行操作!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
string INPUTBY = Convert.ToString(Session["SHOWNAME"]);
MsOpSeaeTDXJModel head = MsOpSeaeTDExtDAL.GetData_XJ(condition, userid);
List<MsOpSeaeTDXJHDModel> bodyList =null;
if (head==null)
{
head = new MsOpSeaeTDXJModel();
head.GID = "*";
}
else
{
bodyList = MsOpSeaeTDExtDAL.GetDataList_XJ_HD("t.xjid = '"+head.GID+"'",userid);
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data1 = head,data2=bodyList });
return new ContentResult() { Content = json };
}
public ContentResult Save(string send,string data, string body)
{
string userid = Convert.ToString(Session["USERID"]);
string comname = MsOpSeaeTDExtDAL.GetComnameWithUserid(userid);
var isSend = false;
if (send == "1")
{
isSend = true;
}
var headData = JsonConvert.Deserialize<MsOpSeaeTDXJModel>(data);
List<MsOpSeaeHDBJModel> hdDataA = JsonConvert.Deserialize<List<MsOpSeaeHDBJModel>>(body);
List<MsOpSeaeHDBJModel> hdData = new List<MsOpSeaeHDBJModel>();
foreach (var item in hdDataA)
{
if (item.GID != null)
{
hdData.Add(item);
}
}
DBResult result = MsOpSeaeBJExtDAL.SaveBJDetail(headData, hdData, userid, comname,isSend);
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SendBJ(string data1, string body)
{
//string userid = "1BEC90E1-9780-472F-90C2-0C6390C044A4";
string userid = Convert.ToString(Session["USERID"]);
string comname = MsOpSeaeTDExtDAL.GetComnameWithUserid(userid);
var headData = JsonConvert.Deserialize<MsOpSeaeTDXJModel>(data1);
List<MsOpSeaeHDBJModel> hdDataA = JsonConvert.Deserialize<List<MsOpSeaeHDBJModel>>(body);
List<MsOpSeaeHDBJModel> hdData = new List<MsOpSeaeHDBJModel>();
foreach (var item in hdDataA)
{
if (item.GID!=null)
{
item.BJSTATUS = 1;
hdData.Add(item);
}
}
DBResult result = MsOpSeaeBJExtDAL.SaveBJDetail(headData,hdData,userid, comname,true);
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult GetXJFeeMod(string xjid)
{
//string userid = "1BEC90E1-9780-472F-90C2-0C6390C044A4";
string userid = Convert.ToString(Session["USERID"]);
if (userid == "" || userid == null)
{
var jsonRespose = new JsonResponse { Success = false, Message = "登陆状态失效,请重新登陆进行操作!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
List<MsOpSeaeBJFEEModel> list = MsOpSeaeBJExtDAL.GetXJFeeList(xjid);
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = list });
return new ContentResult() { Content = json };
}
public ContentResult DeleteDetails(string gids)
{
string userid = Convert.ToString(Session["USERID"]);
if (userid==null)
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "登录失效",
Data = null
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
DBResult result = MsOpSeaeBJExtDAL.DeleteDetails(gids);
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult GetStoreForBJETD()
{
var dataList = MsOpSeaeBJExtDAL.GetStoreForBJETD();
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
}
}