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.
218 lines
8.4 KiB
C#
218 lines
8.4 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.MsOpSeaeTD;
|
|
using DSWeb.MvcShipping.DAL.MsOpSeaeTD;
|
|
using System.Collections.Generic;
|
|
using DSWeb.MvcShipping.DAL.MsOpSeaeBJ;
|
|
using DSWeb.Areas.MvcShipping.Models.MsOpSeaeBJ;
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
{
|
|
[JsonRequestBehavior]
|
|
public class MsOpSeaeBJController : Controller
|
|
{
|
|
//
|
|
// GET:
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult Edit()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult Xj()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult test()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult test2()
|
|
{
|
|
return View();
|
|
}
|
|
public ContentResult Save(string opstatus, string data)
|
|
{
|
|
//string userid = "1BEC90E1-9780-472F-90C2-0C6390C044A4";
|
|
string userid = Convert.ToString(Session["USERID"]);
|
|
var headData = JsonConvert.Deserialize<MsOpSeaeTDModel>(data);
|
|
if (opstatus == "a")
|
|
{
|
|
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
|
|
headData.INPUTBYID = userid;
|
|
headData.INPUTDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
headData.XJNO = MsOpSeaeTDDAL.CreateXJNO(userid);
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
}
|
|
else if (opstatus == "e")
|
|
{
|
|
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
|
|
headData.INPUTBYID = userid;
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
}
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = null
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
}
|
|
|
|
public ContentResult GetDataList(string condition, int currPage, int limit, string sort)
|
|
{
|
|
//string userid = "1BEC90E1-9780-472F-90C2-0C6390C044A4";
|
|
string userid = Convert.ToString(Session["USERID"]);
|
|
//string comname = MsOpSeaeTDDAL.GetComnameWithUserid(userid);
|
|
int start = (currPage - 1) * limit + 1;
|
|
int totalCount = 0;
|
|
// condition += " t0.hdcomname = '"+ comname + "' and t0.HDXSID = '"+userid+"'";
|
|
var dataList = MsOpSeaeBJDAL.GetDataList(condition, userid, start, limit, out totalCount);
|
|
//分页信息
|
|
var pager = MsOpSeaeTDDAL.GetPagerHTML(totalCount, currPage, limit);
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", data = dataList, pager = pager });
|
|
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 = MsOpSeaeTDDAL.GetData_XJ(condition, userid);
|
|
List<MsOpSeaeTDXJHDModel> bodyList = null;
|
|
if (head == null)
|
|
{
|
|
head = new MsOpSeaeTDXJModel();
|
|
head.GID = "*";
|
|
}
|
|
else
|
|
{
|
|
string comname = MsOpSeaeTDDAL.GetComnameWithUserid(userid);
|
|
bodyList = MsOpSeaeBJDAL.GetDataList_XJ_HD("t0.xjid = '" + head.GID + "' ", userid);
|
|
}
|
|
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", data1 = head, data2 = 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 = MsOpSeaeTDDAL.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 = MsOpSeaeTDDAL.GetData_XJ(condition, userid);
|
|
List<MsOpSeaeTDXJHDModel> bodyList =null;
|
|
if (head==null)
|
|
{
|
|
head = new MsOpSeaeTDXJModel();
|
|
head.GID = "*";
|
|
}
|
|
else
|
|
{
|
|
bodyList = MsOpSeaeTDDAL.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 SendBJ(string data1, string data2)
|
|
{
|
|
//string userid = "1BEC90E1-9780-472F-90C2-0C6390C044A4";
|
|
string userid = Convert.ToString(Session["USERID"]);
|
|
string comname = MsOpSeaeTDDAL.GetComnameWithUserid(userid);
|
|
var headData = JsonConvert.Deserialize<MsOpSeaeTDXJModel>(data1);
|
|
List<MsOpSeaeHDBJModel> hdDataA = JsonConvert.Deserialize<List<MsOpSeaeHDBJModel>>(data2);
|
|
List<MsOpSeaeHDBJModel> hdData = new List<MsOpSeaeHDBJModel>();
|
|
foreach (var item in hdDataA)
|
|
{
|
|
if (item.GID!=null)
|
|
{
|
|
hdData.Add(item);
|
|
}
|
|
}
|
|
if (headData.GID=="*")
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
headData.GID = Guid.NewGuid().ToString();
|
|
}
|
|
else if(headData.GID!="*")
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
}
|
|
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
if (result.Success)
|
|
{
|
|
result = MsOpSeaeBJDAL.SaveBJDetail(headData,hdData,userid, comname);
|
|
}
|
|
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 = MsOpSeaeBJDAL.GetXJFeeList(xjid);
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", data = list });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
}
|
|
}
|
|
|