|
|
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;
|
|
|
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)
|
|
|
{
|
|
|
var dataList = MsChDuiDAL.GetDataList(start, limit,condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request),sort);
|
|
|
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")
|
|
|
{
|
|
|
var list = MsChDuiDAL.GetDataList(0,1,condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request));
|
|
|
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 };
|
|
|
}
|
|
|
|
|
|
[ValidateInput(false)]
|
|
|
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 };
|
|
|
}
|
|
|
|
|
|
[ValidateInput(false)]
|
|
|
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 };
|
|
|
}
|
|
|
[ValidateInput(false)]
|
|
|
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 };
|
|
|
}
|
|
|
[ValidateInput(false)]
|
|
|
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 };
|
|
|
}
|
|
|
|
|
|
[ValidateInput(false)]
|
|
|
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) };
|
|
|
}
|
|
|
|
|
|
|
|
|
//
|
|
|
public ContentResult DeleteList(string data)
|
|
|
{
|
|
|
var headList = JsonConvert.Deserialize<List<ChDui>>(data);
|
|
|
DBResult result = new DBResult();
|
|
|
|
|
|
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);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
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) };
|
|
|
}
|
|
|
|
|
|
[ValidateInput(false)]
|
|
|
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) };
|
|
|
|
|
|
}
|
|
|
|
|
|
[ValidateInput(false)]
|
|
|
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
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|