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.

262 lines
14 KiB
C#

using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL;
using DSWeb.MvcShipping.Models.RptWmsSettlementListEntity;
using DSWeb.MvcShipping.Models.RptWmsSettlementListViewEntity;
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 RptWmsController : Controller
{
public ActionResult RptWmsSettlementListIndex()
{
return View();
}
public ActionResult RptWmsSettlementListEdit()
{
return View();
}
// Wms_Settlement_List主表加载
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
var dataList = RptWmsSettlementListDAL.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)
{
RptWmsSettlementListEntity head = null;
if (handle == "edit")
{
var list = RptWmsSettlementListDAL.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 RptWmsSettlementListEntity();
}
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 = RptWmsSettlementListDAL.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 = RptWmsSettlementListDAL.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 = RptWmsSettlementListDAL.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 = RptWmsSettlementListDAL.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 GetFeeDetailList(string condition)
{
var dataList = RptWmsSettlementListDAL.GetFeeDetailList(condition);
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 = RptWmsSettlementListDAL.Save(opstatus, data, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
//
RptWmsSettlementListEntity head = null;
var list = RptWmsSettlementListDAL.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 RptWmsSettlementListEntity();
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = head
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult Save2(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) };
}
//
var model = JsonConvert.Deserialize<RptWmsSettlementListEntity>(data);
if (opstatus == "add")
{
model.GID = "WMSD" + Guid.NewGuid().ToString().Replace("-", "");
model.DUINO = PubSysDAL.GetBillNo("0302");//生成编号
model.CREATEUSER = Convert.ToString(Session["USERID"]);
model.CREATETIME = DateTime.Now;
model.DbOperationType = DbOperationType.DbotIns;
}
else if (opstatus == "edit")
{
model.DbOperationType = DbOperationType.DbotUpd;
}
else
{
model.DbOperationType = DbOperationType.DbotDel;
}
DBResult result = RptWmsSettlementListDAL.Save(model, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
//
RptWmsSettlementListEntity head = null;
var list = RptWmsSettlementListDAL.GetDataList(" DUINO='" + model.DUINO.ToString().Trim() + "'", 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 RptWmsSettlementListEntity();
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = head
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#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 = RptWmsSettlementListDAL.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
//删除主表
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 = RptWmsSettlementListDAL.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<RptWmsSettlementDetailEntity>(data);
DBResult result = RptWmsSettlementListDAL.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>
/// 根据对账单信息生成chfee
/// </summary>
/// <param name="gids"></param>
/// <returns></returns>
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 = RptWmsSettlementListDAL.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 = RptWmsSettlementListDAL.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) };
}
//
}
}