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.
DS7/DSWeb/Areas/MvcShipping/Controllers/RptWmsSettlementList_GuiGe.cs

209 lines
12 KiB
C#

2 years ago
using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.DAL.RptWmsSettlementList_GuiGeDAL;
using DSWeb.MvcShipping.Models.RptWmsSettlementList_GuiGeEntity;
using DSWeb.MvcShipping.Models.RptWmsSettlementList_GuiGeViewEntity;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Comm.Cookie;
using DSWeb.Areas.CommMng.DAL;
using System.Collections.Generic;
using HcUtility.Comm;
using HcUtility.Core;
namespace DSWeb.MvcShipping.Controllers
{
[JsonRequestBehavior]
public class RptWmsSettlementList_GuiGeController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult Edit()
{
return View();
}
#region 查询
// Wms_Settlement_List主表加载
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
var dataList = RptWmsSettlementList_GuiGeDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request), sort);
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)
{
RptWmsSettlementList_GuiGeEntity head = null;
if (handle == "edit")
{
var list = RptWmsSettlementList_GuiGeDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request), null);
if (list.Count > 0)
head = list[0];
}
if (head == null)
{
head = new RptWmsSettlementList_GuiGeEntity();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
//仓储结算清单明细查询表(wms_settlement_detail_temp)
public ContentResult GetBLListData(int start, int limit, string sort, string condition, string condition2, string condition3, string condition4,string strSTARTBILLINGDATE, string strENDBILLINGDATE)
{
if (condition.Trim() == "edit")
{
var dataList = RptWmsSettlementList_GuiGeDAL.GetDataDetailListEdit(condition2, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]), sort);
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 };
}
else
{
var dataList = RptWmsSettlementList_GuiGeDAL.GetFeeDataList(condition, condition2, condition3, condition4, strSTARTBILLINGDATE, strENDBILLINGDATE, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), CookieConfig.GetCookie_OrgCode(Request), sort);
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 GetMblnoDetailList(string condition, string condition2, string sort)
{
if (condition2.Trim() == "edit")
{
var dataList = RptWmsSettlementList_GuiGeDAL.GetMblnoDetailListEdit(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]), sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
else
{
var dataList = RptWmsSettlementList_GuiGeDAL.GetMblnoDetailList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]), sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
}
#endregion
#region 保存
public ContentResult Save(string condition, string opstatus, string data)
{
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
{
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
//
DBResult result = RptWmsSettlementList_GuiGeDAL.Save(opstatus, data, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
//
RptWmsSettlementList_GuiGeEntity head = null;
var list = RptWmsSettlementList_GuiGeDAL.GetDataList("", Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request), null);
if (list.Count > 0)
{
head = list[0];
}
if (head == null)
{
head = new RptWmsSettlementList_GuiGeEntity();
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = head
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
#region 获取List合计数
public ContentResult GetDataListSum(string condition, string opstatus, string hjname)
{
string tablename = "";
if (opstatus == "add")
{
tablename = "wms_settlement_detail_temp";
condition += " AND CREATEUSER='" + Convert.ToString(Session["USERID"]) + "'";
}
else
{
tablename = "wms_settlement_detail";
}
var dataList = RptWmsSettlementList_GuiGeDAL.GetDataListSum(tablename, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]), hjname);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
#endregion
#region 删除主表
public ContentResult Delete_Main(string gids)
{
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
{
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
//
DBResult result = RptWmsSettlementList_GuiGeDAL.Delete_Main(gids, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
#region 删除明细表
public ContentResult Delete_Detail(string DUIGID, string strBLNOs, string data)
{
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
{
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
//
var model = JsonConvert.Deserialize<RptWmsSettlementDetailEntity>(data);
DBResult result = RptWmsSettlementList_GuiGeDAL.Delete_Detail(model, DUIGID, strBLNOs, Convert.ToString(Session["USERID"]));
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
#region 业务入账
public ContentResult setislock(string gids)
{
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
{
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
//
DBResult result = RptWmsSettlementList_GuiGeDAL.setislock(gids, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["DEPTNAME"]), Convert.ToString(Session["SHOWNAME"]).ToString().Trim());
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
#region 取消入账
public ContentResult setnotlock(string gids)
{
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
{
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
//
DBResult result = RptWmsSettlementList_GuiGeDAL.setnotlock(gids, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["DEPTNAME"]));
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
}
}