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.

211 lines
12 KiB
C#

9 months ago
using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.DAL.RptWmsSettleDAL;
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.Models.RptWmsSettleListEntity;
using DSWeb.MvcShipping.Models.RptWmsSettleListViewEntity;
namespace DSWeb.MvcShipping.Controllers
{
[JsonRequestBehavior]
public class RptWmsSettleController : Controller
{
public ActionResult RptWmsSettleIndex()
{
return View();
}
public ActionResult RptWmsSettleEdit()
{
return View();
}
// Wms_Settlement_List主表加载
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
var dataList = RptWmsSettleDAL.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)
{
RptWmsSettleListEntity head = null;
if (handle == "edit")
{
var list = RptWmsSettleDAL.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 RptWmsSettleListEntity();
}
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,string strFeeType)
{
if (condition.Trim() == "edit")
{
var dataList = RptWmsSettleDAL.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 = RptWmsSettleDAL.GetFeeDataList(condition, condition2, condition3, condition4, strSTARTBILLINGDATE, strENDBILLINGDATE,strFeeType, 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 = RptWmsSettleDAL.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 = RptWmsSettleDAL.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 };
}
}
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 = RptWmsSettleDAL.Save(opstatus, data, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
//
RptWmsSettleListEntity head = null;
var list = RptWmsSettleDAL.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 RptWmsSettleListEntity();
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = head
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
//删除主表
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 = RptWmsSettleDAL.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) };
}
//删除明细表
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<RptWmsSettleDetailEntity>(data);
DBResult result = RptWmsSettleDAL.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) };
}
/// <summary>
/// 删除
/// </summary>
/// <param name="DUIGID"></param>
/// <param name="strBLNOs"></param>
/// <param name="data"></param>
/// <returns></returns>
public ContentResult Delete_Detail_Detail(string GID)
{
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 = RptWmsSettleDAL.Delete_Detail_Detail(GID);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
//费用入账
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 = RptWmsSettleDAL.setislock(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) };
}
//取消入账
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 = RptWmsSettleDAL.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) };
}
//
}
}