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.
178 lines
9.8 KiB
C#
178 lines
9.8 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using DSWeb.MvcShipping.DAL.RptCwPLDAL;
|
|
using DSWeb.MvcShipping.Models.RptCwPLEntity;
|
|
using DSWeb.MvcShipping.Helper;
|
|
using DSWeb.MvcShipping.Comm.Cookie;
|
|
using DSWeb.Areas.CommMng.Models;
|
|
using HcUtility.Comm;
|
|
using HcUtility.Core;
|
|
using System.Collections.Generic;
|
|
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
|
|
using DSWeb.EntityDA;
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
using DSWeb.SoftMng.Filter;
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
{
|
|
[JsonRequestBehavior]
|
|
public class RptCwPLController : Controller
|
|
{
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult Edit()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
//查询
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
public ContentResult GetDataList(int start, int limit, string sort, string TEMPLATE, string ACCDATE)
|
|
{
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
//
|
|
var dataList = RptCwPLDAL.GetDataList(TEMPLATE, ACCDATE, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), 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 };
|
|
}
|
|
|
|
//打印
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
public ContentResult GetDataListStr(string TEMPLATE, string ACCDATE)
|
|
{
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
//
|
|
var dataListStr = RptCwPLDAL.GetDataListStr(TEMPLATE, ACCDATE, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]).Trim());
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
//导出
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
public ContentResult GetDataListSQL(string TEMPLATE, string ACCDATE)
|
|
{
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
//
|
|
var dataListStr = RptCwPLDAL.GetDataListSQL(TEMPLATE, ACCDATE, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
public ContentResult GetDetailList(string ACCDATE, string condition)
|
|
{
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
//
|
|
var dataList = RptCwPLDAL.GetDetailList(ACCDATE, condition, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]).Trim());
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
#region 明细表保存
|
|
public ContentResult SaveEdit(string data, string LINKGID, string ACCDATE)
|
|
{
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
//
|
|
var headData = JsonConvert.Deserialize<RptCwPLDetailEntity>(data);
|
|
string strCondition = "LINKGID='" + LINKGID + "'";
|
|
var isPost = true;
|
|
|
|
#region add
|
|
headData.GID = Guid.NewGuid().ToString();
|
|
headData.LINKGID = LINKGID;
|
|
headData.ACCGID = headData.ACCNAME.ToString();
|
|
headData.QTYLASTBLC = 0;//期末余额
|
|
headData.QTYBLC = 0;//年初余额
|
|
headData.MODIFIEDUSER = Convert.ToString(Session["USERID"]);//更改操作人gid
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
#endregion
|
|
|
|
if (isPost)
|
|
{
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
if (result.Message.ToString().IndexOf("重复") > -1)
|
|
{
|
|
var jsonRespose1 = new JsonResponse { Success = false, Message = "抱歉,不允许保存重复数据!请重新录入" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose1) };
|
|
}
|
|
if (result.Success)
|
|
{
|
|
//RptCwPLDAL.SaveRowDetail(ACCDATE, strCondition);
|
|
}
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = RptCwPLDAL.GetDetailList(ACCDATE, strCondition, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]).Trim())
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
else
|
|
{
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "重复,不允许保存!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 明细表删除
|
|
public ContentResult DeleteDetail(string data)
|
|
{
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
//
|
|
var head = JsonConvert.Deserialize<RptCwPLDetailEntity>(data);
|
|
//var modb = new ModelObjectDB();
|
|
//DBResult result = modb.Delete(head);
|
|
DBResult result = RptCwPLDAL.DeleteDetail(head);
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
#endregion
|
|
|
|
#region 重新计算
|
|
public ContentResult GetRecount(string TEMPLATE, string ACCDATE)
|
|
{
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
//
|
|
RptCwPLDAL.GetRecount(TEMPLATE, ACCDATE, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "操作成功!", data = "" });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
#endregion
|
|
//
|
|
}
|
|
}
|
|
|