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.
293 lines
12 KiB
C#
293 lines
12 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using DSWeb.Areas.MvcShipping.DAL.MsChFeeAgentDcDAL;
|
|
using DSWeb.MvcShipping.Models.MsChFeeAgent;
|
|
using DSWeb.MvcShipping.Helper;
|
|
using DSWeb.MvcShipping.Comm.Cookie;
|
|
using HcUtility.Comm;
|
|
using HcUtility.Core;
|
|
using System.Collections.Generic;
|
|
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
|
|
using DSWeb.EntityDA;
|
|
using DSWeb.Models;
|
|
using DSWeb.MvcShipping.Models.MsSysBillNoSet;
|
|
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
|
|
using DSWeb.MvcShipping.Models.MsCodeServiceFeeTemplate;
|
|
using System.IO;
|
|
using System.Data;
|
|
using System.Data.OleDb;
|
|
using DSWeb.MvcShipping.DAL.MsInfoClient;
|
|
using DSWeb.MvcShipping.DAL.MsSysParamSet;
|
|
using System.Web.Configuration;
|
|
using DSWeb.MvcShipping.DAL.MsOpSeaeDAL;
|
|
using DSWeb.MvcShipping.DAL.MsChFeeDAL;
|
|
using DSWeb.Areas.MvcShipping.DAL;
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
{
|
|
[JsonRequestBehavior]
|
|
public class MsChFeeAgentDcController : Controller
|
|
{
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult Edit()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ContentResult GetDCList(int start, int limit, string sort, string condition)
|
|
{
|
|
var dataList = MsChFeeAgentDcDAL.GetDataList(condition);
|
|
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)
|
|
{
|
|
ChFeeAgentDC head = null;
|
|
if (handle == "edit")
|
|
{
|
|
head = MsChFeeAgentDcDAL.GetData(condition);
|
|
}
|
|
if (head == null)
|
|
{
|
|
head = new ChFeeAgentDC();
|
|
head.CREATEUSER = Convert.ToString(Session["USERID"]).ToString().Trim();
|
|
head.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
head.ISCREATEFEE = false;
|
|
head.EXCHANGERATE = 1;
|
|
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult SaveAgentDC(string opstatus, string data, string body)
|
|
{
|
|
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 headData = JsonConvert.Deserialize<ChFeeAgentDC>(data);
|
|
var bodyList = JsonConvert.Deserialize<List<ChFeeAgentDcDetail>>(body);
|
|
var isPost = true;
|
|
var errorstr = "";
|
|
|
|
|
|
#region 编号规则
|
|
if (headData.DCNO == "")
|
|
{
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='代理账单'", Convert.ToString(Session["COMPANYID"]));
|
|
if (billnoset.BILLTYPE != "")
|
|
{
|
|
|
|
headData.DCNO = MsSysBillNoSetDAL.GetBillNo(billnoset, DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM"), "", "", "");
|
|
}
|
|
else
|
|
{
|
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "请设置代理账单编号规则!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
}
|
|
}
|
|
if (opstatus == "add")
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
}
|
|
else if (opstatus == "edit")
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
headData.ModelUIStatus = "E";
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
//
|
|
if (isPost)
|
|
{
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
var GID = headData.GID;
|
|
if (result.Success == true)
|
|
{
|
|
result = MsChFeeAgentDcDAL.SaveDetail(headData, bodyList, Convert.ToString(Session["USERID"]));
|
|
}
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsChFeeAgentDcDAL.GetData("GID='" + GID + "'")
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
else {
|
|
var jsonRespose = new JsonResponse { Success = false, Message =errorstr };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
}
|
|
|
|
|
|
public ContentResult CreateFee(string opstatus, string data, string body)
|
|
{
|
|
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 headData = JsonConvert.Deserialize<ChFeeAgentDC>(data);
|
|
var bodyList = JsonConvert.Deserialize<List<ChFeeAgentDcDetail>>(body);
|
|
var isPost = true;
|
|
var errorstr = "";
|
|
|
|
|
|
#region 编号规则
|
|
if (headData.DCNO == "")
|
|
{
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='代理账单'", Convert.ToString(Session["COMPANYID"]));
|
|
if (billnoset.BILLTYPE != "")
|
|
{
|
|
|
|
headData.DCNO = MsSysBillNoSetDAL.GetBillNo(billnoset, DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM"), "", "", "");
|
|
}
|
|
else
|
|
{
|
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "请设置代理账单编号规则!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
}
|
|
}
|
|
if (opstatus == "add")
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
}
|
|
else if (opstatus == "edit")
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
headData.ModelUIStatus = "E";
|
|
}
|
|
var bsno = "";
|
|
var opseae= MsOpBillDAL.GetData("BSNO='"+headData.BSNO+"'");
|
|
if (opseae.FEESTATUS)
|
|
{
|
|
var dataList = MsChFeeDAL.GetAmendList("PARENTID='" + headData.BSNO + "'");
|
|
foreach (var enums in dataList)
|
|
{
|
|
if (!enums.FEESTATUS)
|
|
{
|
|
bsno = enums.BSNO;
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
|
|
bsno = opseae.BSNO;
|
|
}
|
|
if (bsno == "") {
|
|
var jsonRespose = new JsonResponse { Success = false, Message ="业务已费用锁定,请添加更改单后再生成费用!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
//
|
|
if (isPost)
|
|
{
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
var GID = headData.GID;
|
|
if (result.Success == true)
|
|
{
|
|
result = MsChFeeAgentDcDAL.SaveDetail(headData, bodyList, Convert.ToString(Session["USERID"]));
|
|
if (result.Success == true)
|
|
{
|
|
result = MsChFeeAgentDcDAL.CreateFeeBl(headData,bsno,Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]));
|
|
}
|
|
}
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsChFeeAgentDcDAL.GetData("GID='" + GID + "'")
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
else
|
|
{
|
|
var jsonRespose = new JsonResponse { Success = false, Message = errorstr };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
}
|
|
|
|
public ContentResult Delete(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 head = JsonConvert.Deserialize<ChFeeAgentDC>(data);
|
|
var isfee = MsChFeeAgentDcDAL.GetFeeCount(head);
|
|
if (isfee)
|
|
{
|
|
var jsonRespose = new JsonResponse { Success = false, Message ="此票业务存在费用,请先删除费用才能删除此票业务!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
else {
|
|
var BSNO = head.BSNO;
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Delete(head);
|
|
|
|
if (result.Success == true) { MsChFeeAgentDcDAL.DeleteDetail(head); }
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public ContentResult GetDCDetailList(int start, int limit, string sort, string condition)
|
|
{
|
|
var dataList = MsChFeeAgentDcDAL.GetBodyList(condition);
|
|
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 DeleteDetailList(string data)
|
|
{
|
|
var head = JsonConvert.Deserialize<List<ChFeeAgentDcDetail>>(data);
|
|
|
|
DBResult result = MsChFeeAgentDcDAL.DeleteDetailList(head);
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
//
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|