|
|
|
|
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;
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsSysBillNoSet;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsChFeeYsAutoDui;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsChFeeYsAutoDui;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsSysParamSet;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
|
|
|
{
|
|
|
|
|
[JsonRequestBehavior]
|
|
|
|
|
public class MsChFeeYsAutoDuiController : 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, string optype,string dMainId,string maindata)
|
|
|
|
|
{
|
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
|
|
if (optype=="create")
|
|
|
|
|
{
|
|
|
|
|
string usershowname = Convert.ToString(Session["SHOWNAME"]);
|
|
|
|
|
string comid= Convert.ToString(Session["COMPANYID"]);
|
|
|
|
|
bool rst = MsChFeeYsAutoDuiDAL.CreateAndUpdateDui(condition, dMainId, comid, usershowname);
|
|
|
|
|
if (rst)
|
|
|
|
|
{
|
|
|
|
|
string wheresql = " AND CD.DuiNo in (select duino from ch_dui_main_dui where dMainId = '" + dMainId + "') ";
|
|
|
|
|
var dataList = MsChFeeYsAutoDuiDAL.GetDataList(wheresql, start, limit, out count, sort);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "操作成功", totalCount = count, data = dataList.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "操作异常", totalCount = 0 });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var dataList = MsChFeeYsAutoDuiDAL.GetDataList(condition, start, limit, out count, sort);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetMainDataList(int start, int limit, string sort, string condition)
|
|
|
|
|
{
|
|
|
|
|
int count = 0;
|
|
|
|
|
var dataList = MsChFeeYsAutoDuiDAL.GetMainDataList(condition, start, limit,Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request),out count, sort);
|
|
|
|
|
var timeStamp = DateTime.Now.ToShortDateString();
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList(), timeStamp = timeStamp });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetMainData(string condition, string opStatus)
|
|
|
|
|
{
|
|
|
|
|
if (opStatus == "add")
|
|
|
|
|
{
|
|
|
|
|
MsChFeeYsAutoDuiMainModel data = new MsChFeeYsAutoDuiMainModel();
|
|
|
|
|
data.mainDuiNo = "MDUI" + DateTime.Now.ToString("yyyyMMddhhmmssfff");
|
|
|
|
|
data.duiDate = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
|
|
data.ShouFuFangXiang = "1";
|
|
|
|
|
data.JieFeiLeiXing = "全部";
|
|
|
|
|
data.ShiFouYiKaiPiao = "0";
|
|
|
|
|
data.FeiYongZhuangTai = "1";
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = data });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int count = 0;
|
|
|
|
|
var dataList = MsChFeeYsAutoDuiDAL.GetMainDataList(condition, 0, 100, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request), out count, "");
|
|
|
|
|
var data = dataList.Count > 0 ? dataList[0] : null;
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = data });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetDetailsList(int start, int limit, string sort, string condition)
|
|
|
|
|
{
|
|
|
|
|
var dataList = MsChFeeYsAutoDuiDAL.GetDetailsList(condition);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataList.ToList(), });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ValidateInput(false)]
|
|
|
|
|
public ContentResult SendExcel(string data,string sign,string cc,string ISZHIQI="0",decimal EXCHANGERATE=1, string ISCHAOQI = "0")
|
|
|
|
|
{
|
|
|
|
|
string userid = Session["USERID"] == null ? "" : Session["USERID"].ToString();
|
|
|
|
|
string comid = Session["COMPANYID"] == null ? "" : Session["COMPANYID"].ToString();
|
|
|
|
|
string username = Session["SHOWNAME"] == null ? "" : Session["SHOWNAME"].ToString();
|
|
|
|
|
|
|
|
|
|
string msg0 = "";
|
|
|
|
|
MsChFeeYsAutoDuiDAL.SaveSign(userid, sign,out msg0);
|
|
|
|
|
var dataList = JsonConvert.Deserialize<List<MsChFeeYsAutoDuiModel>>(data);
|
|
|
|
|
var path = Server.MapPath("../../AutoDuiFiles/Excels");
|
|
|
|
|
string dataPath = "";
|
|
|
|
|
DSWeb.SoftMng.BLL.EmailConfigBLL bll = new SoftMng.BLL.EmailConfigBLL();
|
|
|
|
|
if (bll == null) {
|
|
|
|
|
var json2 = JsonConvert.Serialize(new { Success = false, Message = "请先配置发送邮箱", data = dataList.ToList(), });
|
|
|
|
|
return new ContentResult() { Content = json2 };
|
|
|
|
|
}
|
|
|
|
|
var CUSTAUTODUIUSDDUINAME = MsSysParamSetDAL.GetData("PARAMNAME='CUSTAUTODUIUSDDUINAME'").PARAMVALUE;
|
|
|
|
|
|
|
|
|
|
var result = MsChFeeYsAutoDuiDAL.SendExcel(dataList, path, userid, comid, cc, out dataPath, bll.GetModel(), username, CUSTAUTODUIUSDDUINAME, ISZHIQI,EXCHANGERATE,ISCHAOQI);
|
|
|
|
|
var timeStamp = DateTime.Now.ToShortDateString();
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = result.Success, Message = result.Message, Data = dataPath });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult GetExcel( string data,string condition, string ISZHIQI = "0", decimal EXCHANGERATE = 1, string ISCHAOQI = "0")
|
|
|
|
|
{
|
|
|
|
|
string userid = Session["USERID"] == null ? "" : Session["USERID"].ToString();
|
|
|
|
|
string comid = Session["COMPANYID"] == null ? "" : Session["COMPANYID"].ToString();
|
|
|
|
|
var dataList = JsonConvert.Deserialize<List<MsChFeeYsAutoDuiModel>>(data);
|
|
|
|
|
string timeStr = DateTime.Now.ToString("yyyyMMdd-HHmmss");
|
|
|
|
|
var path = Server.MapPath("../../AutoDuiFiles/" + timeStr+"/");
|
|
|
|
|
var CUSTAUTODUIUSDDUINAME = MsSysParamSetDAL.GetData("PARAMNAME='CUSTAUTODUIUSDDUINAME'").PARAMVALUE;
|
|
|
|
|
string html = MsChFeeYsAutoDuiDAL.GetExcelUrls(dataList, path, userid, comid, timeStr, condition, CUSTAUTODUIUSDDUINAME, ISZHIQI, EXCHANGERATE, ISCHAOQI);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, data = html });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult SaveMain(string data,string detailsdata)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
string userid = Session["USERID"] == null ? "" : Session["USERID"].ToString();
|
|
|
|
|
string comid = Session["COMPANYID"] == null ? "" : Session["COMPANYID"].ToString();
|
|
|
|
|
string showname = Session["SHOWNAME"] == null ? "" : Session["SHOWNAME"].ToString();
|
|
|
|
|
string dMainId = "";
|
|
|
|
|
MsChFeeYsAutoDuiMainModel md = JsonConvert.Deserialize<MsChFeeYsAutoDuiMainModel>(data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
md.duiOp = showname;
|
|
|
|
|
bool rst = MsChFeeYsAutoDuiDAL.SaveDuiMain(md,out dMainId);
|
|
|
|
|
if (rst)
|
|
|
|
|
{
|
|
|
|
|
if (detailsdata != "[]" && detailsdata != "" && detailsdata != null)
|
|
|
|
|
{
|
|
|
|
|
List<MsChFeeYsAutoDuiModel> dd = JsonConvert.Deserialize<List<MsChFeeYsAutoDuiModel>>(detailsdata);
|
|
|
|
|
MsChFeeYsAutoDuiDAL.UpdateReMarks(dd);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = rst, Message = rst?"保存成功!":"保存失败!" ,dMainId=dMainId});
|
|
|
|
|
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult CancelDui(string data)
|
|
|
|
|
{
|
|
|
|
|
string userid = Session["USERID"] == null ? "" : Session["USERID"].ToString();
|
|
|
|
|
string comid = Session["COMPANYID"] == null ? "" : Session["COMPANYID"].ToString();
|
|
|
|
|
var dataList = JsonConvert.Deserialize<List<MsChFeeYsAutoDuiModel>>(data);
|
|
|
|
|
string msg = "";
|
|
|
|
|
bool rst = MsChFeeYsAutoDuiDAL.CancelDui(dataList,out msg);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = rst, Message = msg });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//DeleteMain
|
|
|
|
|
public ContentResult DeleteMain(string data)
|
|
|
|
|
{
|
|
|
|
|
var dataList = JsonConvert.Deserialize<List<MsChFeeYsAutoDuiMainModel>>(data);
|
|
|
|
|
string msg = "";
|
|
|
|
|
bool rst = MsChFeeYsAutoDuiDAL.DeleteMain(dataList,out msg);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = rst, Message = msg});
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetSign()
|
|
|
|
|
{
|
|
|
|
|
string userid = Session["USERID"] == null ? "" : Session["USERID"].ToString();
|
|
|
|
|
if (userid==null || userid=="")
|
|
|
|
|
{
|
|
|
|
|
var json0 = JsonConvert.Serialize(new { Success = false, Message = "用户登录失效" });
|
|
|
|
|
return new ContentResult() { Content = json0 };
|
|
|
|
|
}
|
|
|
|
|
string sign = MsChFeeYsAutoDuiDAL.GetSign(userid);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Data = sign });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult SaveSign(string sign)
|
|
|
|
|
{
|
|
|
|
|
string userid = Session["USERID"] == null ? "" : Session["USERID"].ToString();
|
|
|
|
|
if (userid == null || userid == "")
|
|
|
|
|
{
|
|
|
|
|
var json0 = JsonConvert.Serialize(new { Success = false, Message = "用户登录失效" });
|
|
|
|
|
return new ContentResult() { Content = json0 };
|
|
|
|
|
}
|
|
|
|
|
string msg = "";
|
|
|
|
|
bool rst = MsChFeeYsAutoDuiDAL.SaveSign(userid,sign,out msg);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = rst, Message = msg });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|