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/MsChDuiController.cs

374 lines
14 KiB
C#

2 years ago
using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.DAL.MsChDui;
using DSWeb.MvcShipping.Models.MsChDui;
using DSWeb.MvcShipping.Models.MsChDuiView;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Comm.Cookie;
using DSWeb.Areas.CommMng.DAL;
using System.Collections.Generic;
using HcUtility.Comm;
using HcUtility.Core;
2 years ago
using DSWeb.EntityDA;
2 years ago
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
namespace DSWeb.MvcShipping.Controllers
{
[JsonRequestBehavior]
public class MsChDuiController : Controller
{
//
// GET:
public ActionResult Index()
{
return View();
}
//
// GET: /
public ActionResult Edit()
{
return View();
}
//
// GET
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
1 year ago
string LAN = Convert.ToString(Session["LANGUAGES"]);
var dataList = MsChDuiDAL.GetDataList(start, limit,condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request),sort, LAN);
2 years ago
int count = MsChDuiDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request));
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetDataListStr(string sort, string condition)
{
var dataListStr = MsChDuiDAL.GetDataListStr(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request), sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
return new ContentResult() { Content = json };
}
//
// GET/TruckMng/MsWlTyreAcc/GetData/
public ContentResult GetData(string handle, string condition)
{
ChDui head = null;
if (handle == "edit")
{
2 years ago
var list = MsChDuiDAL.GetDataList(0,1,condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request));
2 years ago
if (list.Count > 0)
head = list[0];
}
if (head == null)
{
head = new ChDui();
head.OP = Convert.ToString(Session["SHOWNAME"]);
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
2 years ago
[ValidateInput(false)]
2 years ago
public ContentResult GetBillList(int start, int limit, string condition, string sort)
{
var dataList = MsChDuiDAL.GetBillList(start, limit, condition,sort);
int count = MsChDuiDAL.getDetailTotalCount(condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
2 years ago
[ValidateInput(false)]
2 years ago
public ContentResult GetDetailList(string condition)
{
var dataList = MsChDuiDAL.GetDetailList(condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
2 years ago
[ValidateInput(false)]
2 years ago
public ContentResult GetBLListData(int start, int limit, string sort, string condition, string duicondition, string isdebit)
{
var dataList = MsChDuiDAL.GetFeeDataList(condition, duicondition, isdebit, 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 = dataList.ToList() });
return new ContentResult() { Content = json };
}
2 years ago
[ValidateInput(false)]
2 years ago
public ContentResult GetAddBillList(int start, int limit, string sort, string condition, string duicondition, string isdebit)
{
var dataList = MsChDuiDAL.GetAddBillList(condition, duicondition, isdebit, 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 = dataList.ToList() });
return new ContentResult() { Content = json };
}
2 years ago
[ValidateInput(false)]
2 years ago
public ContentResult GetFeeDetailList(string condition, string isdebit)
{
var dataList = MsChDuiDAL.GetFeeDetailList(condition,isdebit, Convert.ToString(Session["USERID"]));
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetSelectSum(string duino, string duistr, string feesql)
{
var dataList = MsChDuiDAL.GetSelectSum(feesql, duistr,duino);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult Save(string opstatus, string data)
{
var headData = JsonConvert.Deserialize<ChDui>(data);
if (opstatus == "add")
{
headData.DUIDATE = DateTime.Now.ToString("yyyy-MM-dd");
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='客户对账'", Convert.ToString(Session["COMPANYID"]));
if (billnoset.BILLTYPE != "")
headData.DUINO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.DUIDATE.ToString().Trim(), headData.DUIDATE.ToString().Trim());
else
headData.DUINO = PubSysDAL.GetBillNo("0301");
headData.OP = CookieConfig.GetCookie_UserName(Request);
headData.DbOperationType = DbOperationType.DbotIns;
}
else if (opstatus == "edit")
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
}
else
{
headData.DbOperationType = DbOperationType.DbotDel;
}
var DUINO = headData.DUINO;
var modb = new ModelObjectDB();
DBResult result=modb.Save(headData);
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsChDuiDAL.GetData(" DUINO='" + DUINO + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult AddDetail(string duino, string data,string isdebit)
{
var bodyList = JsonConvert.Deserialize<List<ChDuiDetailView>>(data);
var modb = new ModelObjectDB();
DBResult result = MsChDuiDAL.AddDetail(duino,bodyList,isdebit);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult DelDetail(string feesql, string duisql)
{
var modb = new ModelObjectDB();
DBResult result = MsChDuiDAL.DelDetail(feesql, duisql);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult AddBill(string duino, string duicust, string data,string feesql)
{
var bodyList = JsonConvert.Deserialize<List<MsOpDuiBill>>(data);
var modb = new ModelObjectDB();
DBResult result = MsChDuiDAL.AddBill(duino, duicust, bodyList,feesql, Convert.ToString(Session["USERID"]));
//if (result.Success == true)
// MsChDuiDAL.UpdateBill(duino);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult DelBill(string duino, string feesql)
{
DBResult result = MsChDuiDAL.DelBill(duino, feesql);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
//
2 years ago
public ContentResult DeleteList(string data)
{
var headList = JsonConvert.Deserialize<List<ChDui>>(data);
DBResult result = new DBResult();
2 years ago
T_ALL_DA T_ALL_DA = new T_ALL_DA();
2 years ago
if (headList != null){
foreach (var head in headList) {
result = MsChDuiDAL.DelBill(head.DUINO,"1=1");
if (result.Success == true)
{
var modb = new ModelObjectDB();
modb.Delete(head);
MsSysBillNoSetDAL.DeleteBsNo(head.DUINO);
2 years ago
var blUpSQL = " insert into sys_log(GID,NAME,LOGTYPE,LOGTIME,LOGCONTENT,CREATEUSER) values(NEWID(),'" + head.DUINO+ "','删除对帐','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + head.DUINO + '(' + head.CUSTNAME + ')' + "','" + Convert.ToString(Session["USERID"]) + "')";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
2 years ago
}
}
}
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
2 years ago
public ContentResult Delete(string duino, string feesql,string data)
{
var headData = JsonConvert.Deserialize<ChDui>(data);
DBResult result = MsChDuiDAL.DelBill(duino, feesql);
if (result.Success == true)
{
var modb = new ModelObjectDB();
modb.Delete(headData);
MsSysBillNoSetDAL.DeleteBsNo(headData.DUINO);
}
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
2 years ago
[ValidateInput(false)]
2 years ago
public ContentResult GetPrintStr(string data)
{
var headData = JsonConvert.Deserialize<ChDui>(data);
var jsonRespose = new JsonResponse
{
Success = true,
Message = "完成",
Data = MsChDuiDAL.GetPrintStr(headData)
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
2 years ago
[ValidateInput(false)]
2 years ago
public ContentResult GetNoTaxPrintStr(string data)
{
var headData = JsonConvert.Deserialize<ChDui>(data);
var jsonRespose = new JsonResponse
{
Success = true,
Message = "完成",
Data = MsChDuiDAL.GetNoTaxPrintStr(headData)
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#region 锁定和撤销锁定
public ContentResult Lock(string bill)
{
DBResult result = MsChDuiDAL.Lock(bill);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult UnLock(string bill)
{
DBResult result = MsChDuiDAL.UnLock(bill);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult LockList(string bills)
{
DBResult result = MsChDuiDAL.LockList(bills);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult UnLockList(string bills)
{
DBResult result = MsChDuiDAL.UnLockList(bills);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SubmitFee(string bill)
{
DBResult result = MsChDuiDAL.SubmitFee(bill, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SubmitFeeList(string bills)
{
DBResult result = MsChDuiDAL.SubmitFeeList(bills, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
#endregion
#region 参照部分
#endregion
}
}