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

435 lines
16 KiB
C#

3 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;
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
2 years ago
using DSWeb.Areas.Account.DAL.Chfee_Payapplication;
using DSWeb.Areas.Account.Models.Chfee_Payapplication;
3 years ago
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")
{
2 years ago
var list = MsChDuiDAL.GetDataList(0,1,condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request));
3 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)]
3 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)]
3 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)]
3 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)]
3 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)]
3 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) };
}
2 years ago
public ContentResult DelDetail(string data)
3 years ago
{
2 years ago
var bodyList = JsonConvert.Deserialize<List<ChDuiDetailView>>(data);
3 years ago
var modb = new ModelObjectDB();
2 years ago
DBResult result = MsChDuiDAL.DelDetail(bodyList);
3 years ago
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
2 years ago
public ContentResult AddBill(string duino, string duicust, string data, string feesql,string feedetailsql)
3 years ago
{
2 years ago
var bodyList = JsonConvert.Deserialize<List<ChDuiBillView>>(data);
3 years ago
var modb = new ModelObjectDB();
2 years ago
DBResult result = MsChDuiDAL.AddBill(duino, duicust, bodyList, feesql, feedetailsql,Convert.ToString(Session["USERID"]));
3 years ago
//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();
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) };
}
3 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
public ContentResult IsDuiPayStr(string duino)
{
var rst = MsChDuiDAL.IsDuiPayStr(duino);
if (!string.IsNullOrEmpty(rst))
{
2 years ago
var jsonRespose = new JsonResponse { Success = true, Message = rst };
2 years ago
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else
{
var jsonRespose = new JsonResponse { Success = false, Message = "" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
2 years ago
[ValidateInput(false)]
3 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)]
3 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
2 years ago
public ContentResult MakeShen(string duino)
{
var rst = MsChDuiDAL.IsDuiPayStr(duino);
if (!string.IsNullOrEmpty(rst))
{
var jsonRespose2 = new JsonResponse { Success = false, Message = rst };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
var head = MsChDuiDAL.GetData(" DUINO='" + duino + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request));
var headShen = new ChPayapplication();
headShen.GID = Guid.NewGuid().ToString();
headShen.COMPANYID = CookieConfig.GetCookie_CompanyId(Request);
headShen.APPLICANT = CookieConfig.GetCookie_UserId(Request);
headShen.APPLYTIME = DateTime.Now;
headShen.ENTERTIME = DateTime.Now;
headShen.DbOperationType = DbOperationType.DbotIns;
headShen.PAYABLETIME = DateTime.Now.ToString("yyyy-MM-dd");
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='付费申请'", Convert.ToString(Session["COMPANYID"]));
if (billnoset.BILLTYPE != "")
headShen.BILLNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headShen.PAYABLETIME.ToString().Trim(), headShen.APPLYTIME.ToString());
else
headShen.BILLNO = PubSysDAL.GetBillNo("0303");
headShen.CUSTOMERNAME = head.CUSTNAME;
var modb = new ModelObjectDB();
DBResult result = modb.Save(headShen);
var _condition = "";
result = ChpayapplicationDAL.AddBill(headShen.BILLNO, duino, headShen.CUSTOMERNAME, "", " 1=1 ", null, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]), true);
if (result.Success)
{ ChpayapplicationDAL.p_update_Amount(headShen.BILLNO); }
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = headShen.BILLNO
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
3 years ago
#region 参照部分
#endregion
}
}