|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Web;
|
|
|
using System.Web.Mvc;
|
|
|
using DSWeb.MvcShipping.DAL.MsChFeeDAL;
|
|
|
using DSWeb.MvcShipping.Models.MsChFee;
|
|
|
using DSWeb.MvcShipping.Models.MsOpAmend;
|
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
using HcUtility.Comm;
|
|
|
using HcUtility.Core;
|
|
|
using DSWeb.TruckMng.Comm.Cookie;
|
|
|
using DSWeb.TruckMng.Helper.Repository;
|
|
|
using DSWeb.EntityDA;
|
|
|
using DSWeb.MvcShipping.DAL.MsSysParamSet;
|
|
|
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
|
|
|
using DSWeb.MvcShipping.DAL.ChMonthCloseDAL;
|
|
|
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
|
|
|
using System.IO;
|
|
|
using System.Data.OleDb;
|
|
|
using System.Data;
|
|
|
using System.Data.Odbc;
|
|
|
using DSWeb.TruckMng.DAL.MsOpTruckBulkDAL;
|
|
|
using System.Web.Configuration;
|
|
|
using DSWeb.Areas.Account.Models.MsOpBill;
|
|
|
using DSWeb.MvcShipping.DAL.Chfee_AuditDAL;
|
|
|
using DSWeb.Areas.MvcShipping.DAL;
|
|
|
using DSWeb.MvcShipping.Models.MsOpBill;
|
|
|
using MsOpBill = DSWeb.Areas.Account.Models.MsOpBill.MsOpBill;
|
|
|
using DSWeb.MvcShipping.DAL.MsOpSeaeDAL;
|
|
|
using DSWeb.Areas.Account.Models.BSNOLB;
|
|
|
using DSWeb.Areas.MvcShipping.Comm;
|
|
|
using DSWeb.Common.DB;
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
using DSWeb.Areas.MvcShipping.Helper;
|
|
|
using DSWeb.Areas.MvcShipping.Models.Message.VGM;
|
|
|
using Quartz.Util;
|
|
|
using DSWeb.MvcShipping.Models.MsSysBillNoSet;
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
using Colo.Web.admin.about;
|
|
|
using DSWeb.MvcShipping.DAL.MsInfoClient;
|
|
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
|
{
|
|
|
[JsonRequestBehavior]
|
|
|
public class MsChFeeController : Controller
|
|
|
{
|
|
|
//
|
|
|
// GET: /MvcShipping/MsChFee/GetDataList
|
|
|
|
|
|
public ActionResult TemplateAddIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult YJFeeEditIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult HistryIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult QuotationList()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult MsFeeSortEdit()
|
|
|
{
|
|
|
return View();
|
|
|
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
public ContentResult GetDataList(string billno, int type, string optype)
|
|
|
{
|
|
|
var dataList = MsChFeeDAL.GetDataList("BsNo='" + billno + "' and FeeType=" + type,type,optype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}*/
|
|
|
|
|
|
public ContentResult GetDataList(string billno, int type, string optype, string condition, string SaleFee="")
|
|
|
{
|
|
|
string LAN = Convert.ToString(Session["LANGUAGES"]);
|
|
|
|
|
|
var fieldcomm = "";
|
|
|
if (condition != null && condition.Trim() != "")
|
|
|
{
|
|
|
var dataList = MsChFeeDAL.GetDataList(condition, type, optype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), LAN);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var dataList = MsChFeeDAL.GetDataList("BsNo='" + billno + "' and FeeType=" + type + fieldcomm, type, optype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), LAN);
|
|
|
|
|
|
var istrue = MsBaseInfoDAL.GetUserModuleEnable("YJFADDTOHYF", Convert.ToString(Session["USERID"]));
|
|
|
if (type == 2 && istrue)
|
|
|
{
|
|
|
var YJFEENAME = MsSysParamSetDAL.GetData("PARAMNAME='YJFEENAME'");
|
|
|
dataList = MsChFeeDAL.SetYjData(dataList, YJFEENAME.PARAMVALUE);
|
|
|
//if (YJFADDTOHYFOP.PARAMVALUE == "1" && SaleFee != "1")
|
|
|
//{
|
|
|
// var YJFEENAME = MsSysParamSetDAL.GetData("PARAMNAME='YJFEENAME'");
|
|
|
// dataList = MsChFeeDAL.SetYjData(dataList, YJFEENAME.PARAMVALUE);
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// var YJFADDTOHYF = MsSysParamSetDAL.GetData("PARAMNAME='YJFADDTOHYF'");
|
|
|
// if (YJFADDTOHYF.PARAMVALUE == "1")
|
|
|
// {
|
|
|
// var YJFEENAME = MsSysParamSetDAL.GetData("PARAMNAME='YJFEENAME'");
|
|
|
// dataList = MsChFeeDAL.SetYjData(dataList, YJFEENAME.PARAMVALUE);
|
|
|
// }
|
|
|
//}
|
|
|
}
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 用于给仓储app查询,通过dswms后台调用,参数中包含userid等
|
|
|
/// </summary>
|
|
|
/// <param name="billno"></param>
|
|
|
/// <param name="type"></param>
|
|
|
/// <param name="optype"></param>
|
|
|
/// <param name="condition"></param>
|
|
|
/// <param name="userid"></param>
|
|
|
/// <param name="username"></param>
|
|
|
/// <param name="companyid"></param>
|
|
|
/// <param name="SaleFee"></param>
|
|
|
/// <returns></returns>
|
|
|
public ContentResult GetDataListAPP(string condition, string oplbname, string userid, string username, string companyid, string SaleFee = "")
|
|
|
{
|
|
|
string LAN = "zh-cn";
|
|
|
|
|
|
var bstype = oplbname;
|
|
|
var oplb = "op_other";
|
|
|
var oplbdrOp = "modOtherRecvFeeManagement";
|
|
|
var oplbCrOp = "modOtherPayFeeManagement";
|
|
|
|
|
|
if (bstype == "海运出口")
|
|
|
{
|
|
|
oplb = "op_Seae";
|
|
|
oplbdrOp = "modRecvFeeManagement";
|
|
|
oplbCrOp = "modPayFeeManagement";
|
|
|
|
|
|
}
|
|
|
|
|
|
if (bstype == "海运进口")
|
|
|
{
|
|
|
oplb = "op_Seai";
|
|
|
oplbdrOp = "modSeaiRecvFeeManagement";
|
|
|
oplbCrOp = "modSeaiPayFeeManagement";
|
|
|
|
|
|
}
|
|
|
|
|
|
if (bstype == "综合业务")
|
|
|
{
|
|
|
oplb = "op_other";
|
|
|
oplbdrOp = "modOtherRecvFeeManagement";
|
|
|
oplbCrOp = "modOtherPayFeeManagement";
|
|
|
|
|
|
}
|
|
|
|
|
|
if (bstype == "大宗散货")
|
|
|
{
|
|
|
oplb = "op_Bulk";
|
|
|
oplbdrOp = "modBulkRecvFeeManagement";
|
|
|
oplbCrOp = "modBulkPayFeeManagement";
|
|
|
|
|
|
}
|
|
|
if (bstype == "报关业务")
|
|
|
{
|
|
|
oplb = "op_Apply";
|
|
|
oplbdrOp = "modApplyRecvFeeManagement";
|
|
|
oplbCrOp = "modApplyPayFeeManagement";
|
|
|
|
|
|
}
|
|
|
if (bstype == "铁路运输")
|
|
|
{
|
|
|
oplb = "op_railway";
|
|
|
oplbdrOp = "modRailwayRecvFeeManagement";
|
|
|
oplbCrOp = "modRailwayPayFeeManagement";
|
|
|
|
|
|
}
|
|
|
if (bstype == "空运出口")
|
|
|
{
|
|
|
oplb = "op_Aire";
|
|
|
oplbdrOp = "modRailwayRecvFeeManagement";
|
|
|
oplbCrOp = "modRailwayPayFeeManagement";
|
|
|
|
|
|
}
|
|
|
if (bstype == "空运进口")
|
|
|
{
|
|
|
oplb = "op_Airi";
|
|
|
oplbdrOp = "modAiriRecvFeeManagement";
|
|
|
oplbCrOp = "modAiriPayFeeManagement";
|
|
|
|
|
|
}
|
|
|
|
|
|
int type = 1;
|
|
|
|
|
|
var dataList_1 = MsChFeeDAL.GetDataList(" FeeType=" + type + " and " + condition, type, oplb, userid, username, companyid, LAN);
|
|
|
|
|
|
type = 2;
|
|
|
var dataList_2 = MsChFeeDAL.GetDataList(" FeeType=" + type + " and " + condition, type, oplb, userid, username, companyid, LAN);
|
|
|
|
|
|
var istrue = MsBaseInfoDAL.GetUserModuleEnable("YJFADDTOHYF", userid);
|
|
|
if (type == 2 && istrue)
|
|
|
{
|
|
|
var YJFEENAME = MsSysParamSetDAL.GetData("PARAMNAME='YJFEENAME'");
|
|
|
dataList_2 = MsChFeeDAL.SetYjData(dataList_2, YJFEENAME.PARAMVALUE);
|
|
|
}
|
|
|
|
|
|
var resultList = new List<MsChFee>();
|
|
|
if (dataList_1 != null && dataList_1.Count > 0) resultList.AddRange(dataList_1);
|
|
|
if (dataList_2 != null && dataList_2.Count > 0) resultList.AddRange(dataList_2);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = resultList.Count, data = resultList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult GetDataListStr(string billno, int type, string optype, string condition, string SaleFee = "")
|
|
|
{
|
|
|
var fieldcomm = "";
|
|
|
if (condition != null && condition.Trim() != "")
|
|
|
{
|
|
|
var dataListStr = MsChFeeDAL.GetDataListStr(condition, type, optype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var dataListStr = MsChFeeDAL.GetDataListStr("BsNo='" + billno + "' and FeeType=" + type + fieldcomm, type, optype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功",data = dataListStr });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
}
|
|
|
public ContentResult GetRangDAStr(int type, string optype)
|
|
|
{
|
|
|
var rangstr = MsChFeeDAL.GetFeeRangeSqlStr(type, optype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
//var isopen = MsBaseInfoDAL.GetUserModuleEnable("modFeenotopen", Convert.ToString(Session["USERID"]));
|
|
|
// var isopenstr = "";
|
|
|
// if (isopen == false)
|
|
|
// {
|
|
|
// isopenstr = " ( ENTEROPERATOR='" + Convert.ToString(Session["USERID"]) + "' OR ( ENTEROPERATOR<>'" + Convert.ToString(Session["USERID"]) + "' AND (ISOPEN=0 OR ISOPEN IS NULL))) ";
|
|
|
// if (!string.IsNullOrEmpty(rangstr))
|
|
|
// rangstr = rangstr + " and " + isopenstr;
|
|
|
// else
|
|
|
// rangstr = isopenstr;
|
|
|
// }
|
|
|
|
|
|
// var isacc = MsBaseInfoDAL.GetUserModuleEnable("modISWACC", Convert.ToString(Session["USERID"]));
|
|
|
// var isaccstr = "";
|
|
|
// if (isacc == false)
|
|
|
// {
|
|
|
// isaccstr = " ISNULL(ISACC,0)=0 ";
|
|
|
// if (!string.IsNullOrEmpty(rangstr))
|
|
|
// rangstr = rangstr + " and " + isaccstr;
|
|
|
// else
|
|
|
// rangstr = isaccstr;
|
|
|
// }
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = rangstr });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetSaleDataList(string billno, int type, string optype, string condition)
|
|
|
{
|
|
|
var fieldcomm = "";
|
|
|
if (condition != null && condition.Trim() != "")
|
|
|
{
|
|
|
var dataList = MsChFeeDAL.GetDataList(condition, type, optype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
var YJFADDTOHYF = MsSysParamSetDAL.GetData("PARAMNAME='YJFADDTOHYF'");
|
|
|
if (YJFADDTOHYF.PARAMVALUE == "1") {
|
|
|
var YJFEENAME = MsSysParamSetDAL.GetData("PARAMNAME='YJFEENAME'");
|
|
|
dataList = MsChFeeDAL.SetYjData(dataList, YJFEENAME.PARAMVALUE);
|
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var dataList = MsChFeeDAL.GetDataList("BsNo='" + billno + "' and FeeType=" + type + fieldcomm, type, optype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
var YJFADDTOHYF = MsSysParamSetDAL.GetData("PARAMNAME='YJFADDTOHYF'");
|
|
|
if (YJFADDTOHYF.PARAMVALUE == "1")
|
|
|
{
|
|
|
var YJFEENAME = MsSysParamSetDAL.GetData("PARAMNAME='YJFEENAME'");
|
|
|
dataList = MsChFeeDAL.SetYjData(dataList, YJFEENAME.PARAMVALUE);
|
|
|
}
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult GetImportDataList ( string billno, int type, string optype, List<string> Fields, List<string> Values )
|
|
|
{
|
|
|
var fieldcomm = "";
|
|
|
if (Fields != null)
|
|
|
{
|
|
|
if (Fields.Count != Values.Count)
|
|
|
{
|
|
|
var json2 = JsonConvert.Serialize(new { Success = false, Message = "错误,字段和数值数量不相等", totalCount = 0, data = "" });
|
|
|
return new ContentResult() { Content = json2 };
|
|
|
}
|
|
|
else
|
|
|
for (int _i = 0; _i < Fields.Count; _i++)
|
|
|
{
|
|
|
fieldcomm += " and " + Fields[_i] + " = '" + Values[_i] + "' ";
|
|
|
}
|
|
|
}
|
|
|
var dataList = MsChFeeDAL.GetImportDataList("BsNo='" + billno + "' and FeeType=" + type + fieldcomm, type, optype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetGainData(string bsno,string bltype="",string optype="")
|
|
|
{
|
|
|
var dataList = new List<MsChFeeGain>();
|
|
|
|
|
|
var FEEEDITTOTALADDAMEND = MsSysParamSetDAL.GetData("PARAMNAME='FEEEDITTOTALADDAMEND'");
|
|
|
if (FEEEDITTOTALADDAMEND.PARAMVALUE != "1")
|
|
|
{
|
|
|
if (bltype == "合票主票" || bltype == "拼箱主票" || bltype == "派车主票")
|
|
|
dataList = MsChFeeDAL.GetDataGainList("BsNo in (select bsno from v_op_bill where MASTERNO='" + bsno + "')", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]),optype);
|
|
|
else
|
|
|
dataList = MsChFeeDAL.GetDataGainList("BsNo='" + bsno + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), optype);
|
|
|
}
|
|
|
else {
|
|
|
|
|
|
dataList = MsChFeeDAL.GetDataGainTTLList("B.PARENTID='" + bsno + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), optype);
|
|
|
}
|
|
|
|
|
|
if (dataList.Count == 0) {
|
|
|
var bodyList = new List<MsChFeeGain>();
|
|
|
MsChFeeGain data = new MsChFeeGain();
|
|
|
bodyList.Add(data);
|
|
|
dataList = bodyList;
|
|
|
|
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetGainData2(string bsno,string USERID, string SHOWNAME, string COMPANYID, string bltype = "", string optype = "")
|
|
|
{
|
|
|
var dataList = new List<MsChFeeGain>();
|
|
|
|
|
|
var FEEEDITTOTALADDAMEND = MsSysParamSetDAL.GetData("PARAMNAME='FEEEDITTOTALADDAMEND'");
|
|
|
if (FEEEDITTOTALADDAMEND.PARAMVALUE != "1")
|
|
|
{
|
|
|
if (bltype == "合票主票" || bltype == "拼箱主票")
|
|
|
dataList = MsChFeeDAL.GetDataGainList("BsNo in (select bsno from v_op_bill where MASTERNO='" + bsno + "')", USERID, SHOWNAME, COMPANYID, optype);
|
|
|
else
|
|
|
dataList = MsChFeeDAL.GetDataGainList("BsNo='" + bsno + "'", USERID, SHOWNAME, COMPANYID, optype);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
dataList = MsChFeeDAL.GetDataGainTTLList("B.PARENTID='" + bsno + "'", USERID, SHOWNAME, COMPANYID, optype);
|
|
|
}
|
|
|
|
|
|
if (dataList.Count == 0)
|
|
|
{
|
|
|
var bodyList = new List<MsChFeeGain>();
|
|
|
MsChFeeGain data = new MsChFeeGain();
|
|
|
bodyList.Add(data);
|
|
|
dataList = bodyList;
|
|
|
|
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetFeeLock(string bsno)
|
|
|
{
|
|
|
var result = MsChFeeDAL.GetFeeLock(bsno);
|
|
|
var json = JsonConvert.Serialize(new { Success = result.Success});
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetAmendGainData(string bsno,string bltype="")
|
|
|
{
|
|
|
var dataList = new List<MsChFeeGain>();
|
|
|
string LAN = Convert.ToString(Session["LANGUAGES"]);
|
|
|
if (bltype == "合票主票" || bltype == "拼箱主票")
|
|
|
dataList = MsChFeeDAL.GetDataAmendGainList("B.MASTERNO='" + bsno + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), LAN);
|
|
|
else
|
|
|
dataList = MsChFeeDAL.GetDataAmendGainList("B.PARENTID='" + bsno + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), LAN);
|
|
|
|
|
|
if (dataList.Count == 0)
|
|
|
{
|
|
|
var bodyList = new List<MsChFeeGain>();
|
|
|
MsChFeeGain data = new MsChFeeGain();
|
|
|
bodyList.Add(data);
|
|
|
dataList = bodyList;
|
|
|
|
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetMasterGainData(string bsno)
|
|
|
{
|
|
|
var dataList = MsChFeeDAL.GetDataMasterGainList("B.MASTERNO='" + bsno + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
if (dataList.Count == 0)
|
|
|
{
|
|
|
var bodyList = new List<MsChFeeGain>();
|
|
|
MsChFeeGain data = new MsChFeeGain();
|
|
|
bodyList.Add(data);
|
|
|
dataList = bodyList;
|
|
|
|
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetBLFeeList(string bsno,string bltype,string optype)
|
|
|
{
|
|
|
var dataList = new List<MsBLChFee>();
|
|
|
if ((bltype=="合票主票"|| bltype == "拼箱主票")&&(optype!="更改单"))
|
|
|
dataList = MsChFeeDAL.GetBLMasterFeeList(bsno);
|
|
|
else
|
|
|
dataList = MsChFeeDAL.GetBLFeeList(bsno);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetModifyData(string FeeID, string ApplyType)
|
|
|
{
|
|
|
var dataList = MsChFeeDAL.GetModifyData(FeeID,ApplyType);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetModifyList(string FeeID)
|
|
|
{
|
|
|
var dataList = MsChFeeDAL.GetModifyData(FeeID);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetModifyAllData(string FeeID, string ApplyType)
|
|
|
{
|
|
|
var dataList = MsChFeeDAL.GetModifyAllData(FeeID, ApplyType);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetOPGainList(string bsno, string bltype="",string optype="普通货",string oplb="")
|
|
|
{
|
|
|
var LOCALCURR = CookieConfig.GetCookie_LocalCurr(Request);
|
|
|
string LAN = Convert.ToString(Session["LANGUAGES"]);
|
|
|
var dataList = new List<MsOpGain>();
|
|
|
var FEEEDITTOTALADDAMEND = MsSysParamSetDAL.GetData("PARAMNAME='FEEEDITTOTALADDAMEND'");
|
|
|
if (FEEEDITTOTALADDAMEND.PARAMVALUE == "1")
|
|
|
{
|
|
|
dataList = MsChFeeDAL.GetOPGainAMENDList("B.PARENTID in (select '" + bsno + "' union all select PARENTID from v_op_bill where bsno='" + bsno + "')", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), LOCALCURR);
|
|
|
}
|
|
|
else {
|
|
|
if (((bltype == "合票主票" || bltype == "拼箱主票") &&(optype== "普通货"))|| bltype == " 派车主票")
|
|
|
dataList = MsChFeeDAL.GetOPGainList("BsNo in (select bsno from v_op_bill where MASTERNO='" + bsno + "') ", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), LOCALCURR,oplb, LAN);
|
|
|
else
|
|
|
dataList = MsChFeeDAL.GetOPGainList("BsNo='" + bsno + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), LOCALCURR, oplb, LAN);
|
|
|
}
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetMBLGainList(string condition)
|
|
|
{
|
|
|
|
|
|
var dataList = MsChFeeDAL.GetMBLGainList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetAmendList(string billno,string bstype)
|
|
|
{
|
|
|
var dataList = MsChFeeDAL.GetAmendList("PARENTID='" + billno + "'", bstype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult Save(string bsno, string chfeebody,string isyj="0")
|
|
|
{
|
|
|
string LAN = Convert.ToString(Session["LANGUAGES"]);
|
|
|
var custnamestr = "客户名称:";
|
|
|
var xitongbucunzai = "系统中不存在,请检查";
|
|
|
var yifeiyongsuoding = "已费用锁定,不允许添加修改费用!";
|
|
|
var yiyuemojiezhuan = "已月末结转,不允许添加修改费用!";
|
|
|
var yiDRfeiyongsuoding = "应收费用已锁定,不允许添加修改费用!";
|
|
|
var yiCRfeiyongsuoding = "应付费用已锁定,不允许添加修改费用!";
|
|
|
var feename = "费用名称";
|
|
|
var notempty = "核算单位不能为空!";
|
|
|
var blackname = "此客户为黑名单客户,请联系管理员!";
|
|
|
if (LAN == "en-us") {
|
|
|
custnamestr = "Customer Name:";
|
|
|
xitongbucunzai = "Not present in the system, please check";
|
|
|
yifeiyongsuoding = "Fee locked, adding or modifying fees not allowed!";
|
|
|
yiyuemojiezhuan = "Carried forward at the end of the month, adding or modifying fees is not allowed!";
|
|
|
yiDRfeiyongsuoding = "DR are locked and cannot be added or modified!";
|
|
|
yiCRfeiyongsuoding = "CR are locked and cannot be added or modified!";
|
|
|
feename = "Fee Name";
|
|
|
notempty = " Sale Corp Can not Empty!";
|
|
|
blackname = "This customer is on the blacklist. Please contact the administrator!";
|
|
|
}
|
|
|
var FEEMUSTBESALECORP= MsSysParamSetDAL.GetData("PARAMNAME='FEEMUSTBESALECORP'");
|
|
|
|
|
|
int iResult = 0;
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsChFee>>(chfeebody);
|
|
|
var result =new DBResult();
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
decimal feetype = 0;
|
|
|
var custstr = "";
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
feetype = enumValue.FeeType;
|
|
|
var BLCOUNT2 = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from info_client WHERE ISNULL(ISSTOP,0)=0 AND (SHORTNAME='" + enumValue.CustomerName + "' OR ESHORTNAME='" + enumValue.CustomerName + "')");
|
|
|
if (BLCOUNT2 == "0")
|
|
|
{
|
|
|
if (custstr == "") custstr = enumValue.CustomerName;
|
|
|
else custstr = custstr + "," + enumValue.CustomerName;
|
|
|
}
|
|
|
if (string.IsNullOrEmpty(enumValue.SALECORP) && FEEMUSTBESALECORP.PARAMVALUE == "1") {
|
|
|
var jsonRespose2 = new JsonResponse
|
|
|
{
|
|
|
Success = false,
|
|
|
Message = feename + enumValue.FeeName + " " + notempty
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
|
|
|
var resultblack = MsInfoClientDAL.GetClientBlackRdCount(enumValue.CustomerName,bsno);
|
|
|
if (resultblack) {
|
|
|
var jsonRespose2 = new JsonResponse
|
|
|
{
|
|
|
Success = false,
|
|
|
Message = enumValue.CustomerName + ": " + blackname
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
if (custstr != "") {
|
|
|
var jsonRespose2 = new JsonResponse
|
|
|
{
|
|
|
Success =false,
|
|
|
Message = custnamestr + custstr+" ,"+ xitongbucunzai,
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
|
|
|
// var FEESAVENOTSAMEAMOUNT = MsSysParamSetDAL.GetData("PARAMNAME='FEESAVENOTSAMEAMOUNT'");
|
|
|
// if (FEESAVENOTSAMEAMOUNT.PARAMVALUE == "1"&& feetype==2)
|
|
|
// {
|
|
|
// var oldfeelist = MsChFeeDAL.GetAllDataList("BSNO='" + bsno + "' AND FEETYPE=2");
|
|
|
// var findlist = new List<MsChFee>();
|
|
|
// foreach (var fee in oldfeelist)
|
|
|
// {
|
|
|
// var newfee = bodyList.Find(X => X.GId == fee.GId);
|
|
|
// if (newfee == null&&fee.FeeType == 2)
|
|
|
// {
|
|
|
// var newinvlink = findlist.Find(X => X.Currency == fee.Currency && X.CustomerName == fee.CustomerName && X.Amount == fee.Amount);
|
|
|
// if (newinvlink == null)
|
|
|
// {
|
|
|
// var InvLink = new MsChFee();
|
|
|
// InvLink.Currency = fee.Currency;
|
|
|
// InvLink.CustomerName = fee.CustomerName;
|
|
|
// InvLink.Amount = fee.Amount;
|
|
|
// findlist.Add(InvLink);
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// var jsonRespose3 = new JsonResponse
|
|
|
// {
|
|
|
// Success = false,
|
|
|
// Message = "客户名称,金额,币别 ,相同,不允许保存,请调整!",
|
|
|
// };
|
|
|
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose3) };
|
|
|
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
// foreach (var fee in bodyList)
|
|
|
// {
|
|
|
// if (fee.FeeType == 2)
|
|
|
// {
|
|
|
// var newinvlink = findlist.Find(X => X.Currency == fee.Currency && X.CustomerName == fee.CustomerName && X.Amount == fee.Amount);
|
|
|
// if (newinvlink == null)
|
|
|
// {
|
|
|
// var InvLink = new MsChFee();
|
|
|
// InvLink.Currency = fee.Currency;
|
|
|
// InvLink.CustomerName = fee.CustomerName;
|
|
|
// InvLink.Amount = fee.Amount;
|
|
|
// findlist.Add(InvLink);
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// var jsonRespose3 = new JsonResponse
|
|
|
// {
|
|
|
// Success = false,
|
|
|
// Message = "客户名称,金额,币别 ,相同,不允许保存,请调整!",
|
|
|
// };
|
|
|
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose3) };
|
|
|
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
if (isyj == "1")
|
|
|
{
|
|
|
|
|
|
var YJMUSTBEFEECLOSE = MsSysParamSetDAL.GetData("PARAMNAME='YJMUSTBEFEECLOSE'");
|
|
|
if (YJMUSTBEFEECLOSE.PARAMVALUE == "1")
|
|
|
{
|
|
|
var BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from v_op_bill WHERE FEESTATUS=1 AND BSNO='" + bsno + "'");
|
|
|
if (BLCOUNT == "1")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse
|
|
|
{
|
|
|
Success = false,
|
|
|
Message = yifeiyongsuoding,
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else {
|
|
|
|
|
|
var nowperiod = ChMonthCloseDAL.GetData("", Convert.ToString(Session["COMPANYID"]));
|
|
|
var ACCDATE = T_ALL_DA.GetStrSQL("ACCDATE", "select ACCDATE from v_op_bill WHERE BSNO='" + bsno + "'");
|
|
|
if (Convert.ToDateTime(nowperiod.PERIOD + "-01") > Convert.ToDateTime(ACCDATE + "-01")) {
|
|
|
var jsonRespose2 = new JsonResponse
|
|
|
{
|
|
|
Success = false,
|
|
|
Message = yiyuemojiezhuan,
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from v_op_bill WHERE FEESTATUS=1 AND BSNO='" + bsno + "'");
|
|
|
if (BLCOUNT == "1")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse
|
|
|
{
|
|
|
Success = false,
|
|
|
Message = yifeiyongsuoding,
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
var type = bodyList[0].FeeType;
|
|
|
|
|
|
var BLCOUNT = "";
|
|
|
if (type == 1)
|
|
|
BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from op_close WHERE DRCLOSE=1 AND BSNO='" + bsno + "'");
|
|
|
else BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from op_close WHERE CRCLOSE=1 AND BSNO='" + bsno + "'");
|
|
|
if (BLCOUNT == "1")
|
|
|
{
|
|
|
|
|
|
if (type == 1) {
|
|
|
var jsonRespose2 = new JsonResponse
|
|
|
{
|
|
|
Success = false,
|
|
|
Message = yiDRfeiyongsuoding,
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
else {
|
|
|
var jsonRespose2 = new JsonResponse
|
|
|
{
|
|
|
Success = false,
|
|
|
Message = yiCRfeiyongsuoding,
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
iResult = MsChFeeDAL.SaveUpdateFee(bodyList, bsno, CookieConfig.GetCookie_UserId(Request));
|
|
|
}
|
|
|
if (iResult == 1) {
|
|
|
result.Success=true;
|
|
|
result.Message = "更新成功!";
|
|
|
MsChFeeDAL.p_op_gain(bsno, CookieConfig.GetCookie_UserId(Request));//Convert.ToString(Session["USERID"]));
|
|
|
}
|
|
|
else if (iResult == 0)
|
|
|
{
|
|
|
result.Success = true;
|
|
|
result.Message = "更新成功!";
|
|
|
}
|
|
|
else if (iResult == -1)
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "有异常,插入失败!";
|
|
|
}
|
|
|
else if (iResult == -2)
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "插入异常,事务已回滚成功!";
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
// Data = MsChFeeDAL.GetDataList(headData.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request))
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult SavePiLiang(string bslist, string chfeebody, string optype)
|
|
|
{
|
|
|
int iResult = 0;
|
|
|
var bodyList = new List<MsChFee>();
|
|
|
var bsList = JsonConvert.Deserialize<List<MsOpBill>>(bslist);
|
|
|
var fee = JsonConvert.Deserialize<MsChFee>(chfeebody);
|
|
|
bodyList.Add(fee);
|
|
|
var result = new DBResult();
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
|
|
|
var custstr = "";
|
|
|
if (bsList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bsList)
|
|
|
{
|
|
|
var BLCOUNT = T_ALL_DA.GetStrSQL("FEESTATUS", "select FEESTATUS from v_op_bill WHERE BSNO='" + enumValue.BSNO+ "'");
|
|
|
if (BLCOUNT != "0")
|
|
|
{
|
|
|
if (custstr == "") custstr = enumValue.MBLNO;
|
|
|
else custstr = custstr + "," + enumValue.MBLNO;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (custstr != "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse
|
|
|
{
|
|
|
Success = false,
|
|
|
Message = "提单号:" + custstr + " ,系统已费用锁定,不允许添加费用!",
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
|
|
|
if (bsList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bsList)
|
|
|
{
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var enumValueFEE in bodyList)
|
|
|
{
|
|
|
enumValueFEE.GId = Guid.NewGuid().ToString();
|
|
|
enumValueFEE.BsNo ="*";
|
|
|
if (enumValueFEE.MANAGER == null) enumValueFEE.MANAGER = "";
|
|
|
if (enumValueFEE.SALECORP == null) enumValueFEE.SALECORP = "";
|
|
|
if (enumValueFEE.FEEGROUP== null) enumValueFEE.FEEGROUP = "";
|
|
|
enumValueFEE.EnteroPerator = Convert.ToString(Session["USERID"]);
|
|
|
enumValueFEE.EnterDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
if (enumValueFEE.ISCTN=="1") {
|
|
|
var ctnlist = MsOpSeaeDAL.GetBodyListSum("BSNO='"+ enumValue.BSNO + "'");
|
|
|
var isfind = false;
|
|
|
ctnlist.ForEach(i =>
|
|
|
{
|
|
|
if (i.CTNALL == enumValueFEE.Unit)
|
|
|
{
|
|
|
isfind = true;
|
|
|
enumValueFEE.Quantity = i.CTNNUM;
|
|
|
var taxrate = enumValueFEE.TaxRate;
|
|
|
var taxrateb = Math.Round(1 + (taxrate / 100), 4, MidpointRounding.AwayFromZero);
|
|
|
enumValueFEE.TaxUnitPrice = Math.Round(enumValueFEE.UnitPrice * taxrateb, 4, MidpointRounding.AwayFromZero);
|
|
|
enumValueFEE.Amount = Math.Round(enumValueFEE.TaxUnitPrice * enumValueFEE.Quantity, 2, MidpointRounding.AwayFromZero);
|
|
|
decimal notaxamount = 0;
|
|
|
if (enumValueFEE.Amount > 0)
|
|
|
{
|
|
|
enumValueFEE.NoTaxAmount= Math.Round(enumValueFEE.Amount / taxrateb, 2, MidpointRounding.AwayFromZero);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
enumValueFEE.NoTaxAmount = -Math.Round(Math.Abs(enumValueFEE.Amount) / taxrateb, 2, MidpointRounding.AwayFromZero);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
if (!isfind) {
|
|
|
enumValueFEE.BsNo = "1111";
|
|
|
}
|
|
|
}
|
|
|
if (string.IsNullOrEmpty(enumValueFEE.CustomerName)) {
|
|
|
if (enumValueFEE.CustomerType == "CUSTOMERNAME") enumValueFEE.CustomerName = enumValue.CUSTOMERNAME;
|
|
|
if (enumValueFEE.CustomerType == "CARRIER") enumValueFEE.CustomerName = enumValue.CARRIER;
|
|
|
if (enumValueFEE.CustomerType == "FORWARDER") enumValueFEE.CustomerName = enumValue.FORWARDER;
|
|
|
if (enumValueFEE.CustomerType == "YARD") enumValueFEE.CustomerName = enumValue.YARD;
|
|
|
if (enumValueFEE.CustomerType == "AGENTID") enumValueFEE.CustomerName = enumValue.AGENTID;
|
|
|
if (enumValueFEE.CustomerType == "CUSTOMSER") enumValueFEE.CustomerName = enumValue.CUSTOMSER;
|
|
|
if (enumValueFEE.CustomerType == "SHIPAGENCY") enumValueFEE.CustomerName = enumValue.SHIPAGENCY;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
iResult = MsChFeeDAL.SaveUpdateFee(bodyList, enumValue.BSNO, CookieConfig.GetCookie_UserId(Request));
|
|
|
}
|
|
|
if (fee.FeeStatus == 2)
|
|
|
{
|
|
|
foreach (var enumValueFEE in bodyList)
|
|
|
{
|
|
|
enumValueFEE.BsNo = enumValue.BSNO;
|
|
|
}
|
|
|
var ISSALEWORK = CookieConfig.GetCookie_ISSALEWORK(Request);
|
|
|
Chfee_AuditDAL.SubmitAuditNew(optype, Convert.ToString(Session["USERID"]), bodyList, false, "", ISSALEWORK, Convert.ToString(Session["COMPANYID"]));
|
|
|
}
|
|
|
|
|
|
|
|
|
if (iResult == 1)
|
|
|
{
|
|
|
MsChFeeDAL.p_op_gain(enumValue.BSNO, CookieConfig.GetCookie_UserId(Request));//Convert.ToString(Session["USERID"]));
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
result.Success = true;
|
|
|
result.Message = "更新成功!";
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
else if (iResult == 0)
|
|
|
{
|
|
|
result.Success = true;
|
|
|
result.Message = "更新成功!";
|
|
|
}
|
|
|
else if (iResult == -1)
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "有异常,插入失败!";
|
|
|
}
|
|
|
else if (iResult == -2)
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "插入异常,事务已回滚成功!";
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
// Data = MsChFeeDAL.GetDataList(headData.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request))
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult Delete(string bsno,string data)
|
|
|
{
|
|
|
|
|
|
string LAN = Convert.ToString(Session["LANGUAGES"]);
|
|
|
var shanchuchenggong = "删除成功!";
|
|
|
|
|
|
if (LAN == "en-us")
|
|
|
{
|
|
|
shanchuchenggong = "Successfully deleted!";
|
|
|
|
|
|
}
|
|
|
|
|
|
int iResult = 0;
|
|
|
var bodyList = data;
|
|
|
var result = new DBResult();
|
|
|
|
|
|
if (bodyList !="" ||bodyList != null)
|
|
|
{
|
|
|
iResult = MsChFeeDAL.DeleteFee(bodyList,bsno, Convert.ToString(Session["USERID"]));
|
|
|
MsChFeeDAL.p_op_gain(bsno, Convert.ToString(Session["USERID"]));
|
|
|
|
|
|
}
|
|
|
if (iResult == 1)
|
|
|
{
|
|
|
result.Success = true;
|
|
|
result.Message = shanchuchenggong;
|
|
|
|
|
|
|
|
|
}
|
|
|
else if (iResult == 0)
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "出现错误,未删除!";
|
|
|
}
|
|
|
else if (iResult == -1)
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "有异常,删除失败!";
|
|
|
}
|
|
|
else if (iResult == -2)
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "删除异常,事务已回滚成功!";
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
// Data = MsChFeeDAL.GetDataList(headData.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request))
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult DeleteCtn(string bsno, string data)
|
|
|
{
|
|
|
int iResult = 0;
|
|
|
var bodyList = data;
|
|
|
string LAN = Convert.ToString(Session["LANGUAGES"]);
|
|
|
var shanchuchenggong = "删除成功!";
|
|
|
|
|
|
if (LAN == "en-us")
|
|
|
{
|
|
|
shanchuchenggong = "Successfully deleted!";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
if (bodyList != "" || bodyList != null)
|
|
|
{
|
|
|
iResult = MsChFeeDAL.DeleteFee(bodyList,bsno, Convert.ToString(Session["USERID"]));
|
|
|
MsChFeeDAL.p_op_gain(bsno, Convert.ToString(Session["USERID"]));
|
|
|
|
|
|
}
|
|
|
if (iResult == 1)
|
|
|
{
|
|
|
result.Success = true;
|
|
|
result.Message = shanchuchenggong;
|
|
|
|
|
|
}
|
|
|
else if (iResult == 0)
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "出现错误,未删除!";
|
|
|
}
|
|
|
else if (iResult == -1)
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "有异常,删除失败!";
|
|
|
}
|
|
|
else if (iResult == -2)
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "删除异常,事务已回滚成功!";
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
// Data = MsChFeeDAL.GetDataList(headData.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request))
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult DeleteAmend(string data)
|
|
|
{
|
|
|
var head = JsonConvert.Deserialize<MsOpAmend>(data);
|
|
|
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
string LAN = Convert.ToString(Session["LANGUAGES"]);
|
|
|
var genggaidancunzaifeiyong = "更改单存在费用,不允许删除!";
|
|
|
|
|
|
if (LAN == "en-us")
|
|
|
{
|
|
|
genggaidancunzaifeiyong = "fees and deletion is not allowed!";
|
|
|
|
|
|
}
|
|
|
|
|
|
var BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from ch_fee WHERE BSNO='" + head.BSNO + "'");
|
|
|
if (BLCOUNT == "0")
|
|
|
{
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Delete(head);
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else {
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = genggaidancunzaifeiyong };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult GetAmendData(string handle, string condition)
|
|
|
{
|
|
|
MsOpAmend head = null;
|
|
|
if (handle == "edit" || handle == "copyadd")
|
|
|
{
|
|
|
var headlist = MsChFeeDAL.GetAmendList(condition);
|
|
|
if (headlist.Count > 0)
|
|
|
head=headlist[0];
|
|
|
else
|
|
|
head = new MsOpAmend();
|
|
|
}
|
|
|
if (head == null)
|
|
|
{
|
|
|
head = new MsOpAmend();
|
|
|
head.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
head.CREATEUSER = Convert.ToString(Session["SHOWNAME"]);
|
|
|
|
|
|
var period = ChMonthCloseDAL.GetData("", Convert.ToString(Session["COMPANYID"]));
|
|
|
if (Convert.ToDateTime(period.FDAY) > DateTime.Now)
|
|
|
{
|
|
|
head.ACCDATE = period.PERIOD;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult SaveAmendData(string opstatus,string data,string bsno)
|
|
|
{
|
|
|
var head = JsonConvert.Deserialize<MsOpAmend>(data);
|
|
|
head.PARENTID = bsno;
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
head.ACCDATE = head.ACCDATE.Substring(0, 7);
|
|
|
var bsclose = ChMonthCloseDAL.GetData("", Convert.ToString(Session["COMPANYID"]));
|
|
|
if (Convert.ToDateTime(head.ACCDATE + "-01") < Convert.ToDateTime(bsclose.PERIOD + "-01"))
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "会计期间" + head.ACCDATE + "已结转,不允许修改添加更改单!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
if (opstatus == "add")
|
|
|
{
|
|
|
|
|
|
head.GID = Guid.NewGuid().ToString();
|
|
|
head.BSNO = Guid.NewGuid().ToString();
|
|
|
head.PARENTID = bsno;
|
|
|
head.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
head.CREATEUSER = Convert.ToString(Session["SHOWNAME"]);
|
|
|
head.DbOperationType = DbOperationType.DbotIns;
|
|
|
if (string.IsNullOrEmpty(head.AMENDNO))
|
|
|
{
|
|
|
var AMENDNO = "";
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
var custno = T_ALL_DA.GetStrSQL("custno", "select TOP 1 isnull(custno,'') custno from v_op_bs where bsno='" + head.PARENTID + "' and isnull(custno,'')<>'' ");
|
|
|
|
|
|
AMENDNO = T_ALL_DA.GetStrSQL("AMENDNO", "select TOP 1 isnull(AMENDNO,'') AMENDNO from op_amend where PARENTID='"+ head.PARENTID + "' and isnull(AMENDNO,'')<>'' order by convert(int, REPLACE(REPLACE(isnull(AMENDNO,'0'),'" + custno + "',''),'-','')) desc");
|
|
|
if (AMENDNO == "") AMENDNO = custno + "-1";
|
|
|
else
|
|
|
{
|
|
|
var subcode = AMENDNO.Substring(AMENDNO.Length - 2, 1);
|
|
|
var subcode2 = AMENDNO.Substring(AMENDNO.Length - 3, 1);
|
|
|
if (subcode == "-" || subcode2 == "-")
|
|
|
{
|
|
|
var subnum = "";
|
|
|
if (subcode == "-")
|
|
|
subnum = AMENDNO.Substring(AMENDNO.Length - 1, 1);
|
|
|
if (subcode2 == "-")
|
|
|
subnum = AMENDNO.Substring(AMENDNO.Length - 2, 2);
|
|
|
try
|
|
|
{
|
|
|
var num = Convert.ToInt16(subnum) + 1;
|
|
|
if (subcode == "-")
|
|
|
AMENDNO = AMENDNO.Substring(0, AMENDNO.Length - 1) + num.ToString();
|
|
|
if (subcode2 == "-")
|
|
|
AMENDNO = AMENDNO.Substring(0, AMENDNO.Length - 2) + num.ToString();
|
|
|
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
AMENDNO = AMENDNO + "-2";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
head.AMENDNO = AMENDNO;
|
|
|
|
|
|
//var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='更改单'", Convert.ToString(Session["COMPANYID"]));
|
|
|
//if (billnoset.BILLTYPE != "")
|
|
|
// head.AMENDNO = MsSysBillNoSetDAL.GetBillNo(billnoset, DateTime.Now.ToString("yyyy-MM-dd"), head.ACCDATE.ToString().Trim(),"", head.CREATEUSER);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
head.DbOperationType = DbOperationType.DbotUpd;
|
|
|
}
|
|
|
if (head.SALE == "") {
|
|
|
var opbill= MsOpBillDAL.GetData("BSNO='"+ bsno + "'");
|
|
|
head.SALE = opbill.SALE;
|
|
|
}
|
|
|
|
|
|
|
|
|
DBResult result = modb.Save(head);
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
Data = MsChFeeDAL.GetAmendData("BSNO='" + head.BSNO + "'")
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
public ContentResult SaveAmend(string bsno, string data, string chdrfeebody, string chcrfeebody)
|
|
|
{
|
|
|
|
|
|
var head = JsonConvert.Deserialize<MsOpAmend>(data);
|
|
|
var bodyListdr = JsonConvert.Deserialize<List<MsChFee>>(chdrfeebody);
|
|
|
var bodyListcr = JsonConvert.Deserialize<List<MsChFee>>(chcrfeebody);
|
|
|
|
|
|
return SaveAmend_Object(bsno, head, bodyListdr, bodyListcr, Session["USERID"].ToString(), Session["SHOWNAME"].ToString(), Session["COMPANYID"].ToString());
|
|
|
}
|
|
|
public ContentResult SaveAmend_Object(string bsno, MsOpAmend head, List<MsChFee> bodyListdr, List<MsChFee> bodyListcr,string USERID,string SHOWNAME,string COMPANYID)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
int iResult = 1;
|
|
|
|
|
|
var result = new DBResult();
|
|
|
var billno = head.BSNO;
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
head.ACCDATE = head.ACCDATE.Substring(0, 7);
|
|
|
var bsclose = ChMonthCloseDAL.GetData("", COMPANYID);
|
|
|
if (Convert.ToDateTime(head.ACCDATE + "-01") < Convert.ToDateTime(bsclose.PERIOD + "-01"))
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "会计期间" + head.ACCDATE + "已结转,不允许添加更改单!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
|
|
|
if (head.CREATETIME == "")
|
|
|
{
|
|
|
|
|
|
head.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
head.CREATEUSER = SHOWNAME;
|
|
|
head.DbOperationType = DbOperationType.DbotIns;
|
|
|
if (string.IsNullOrEmpty(head.AMENDNO))
|
|
|
{
|
|
|
var AMENDNO = "";
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
var custno = T_ALL_DA.GetStrSQL("custno", "select TOP 1 isnull(custno,'') custno from v_op_bs where bsno='" + head.PARENTID + "' and isnull(custno,'')<>'' ");
|
|
|
|
|
|
AMENDNO = T_ALL_DA.GetStrSQL("AMENDNO", "select TOP 1 isnull(AMENDNO,'') AMENDNO from op_amend where PARENTID='" + head.PARENTID + "' and isnull(AMENDNO,'')<>'' order by convert(int, REPLACE(REPLACE(isnull(AMENDNO,'0'),'" + custno + "',''),'-','')) desc");
|
|
|
|
|
|
if (AMENDNO == "") AMENDNO = custno + "-1";
|
|
|
else
|
|
|
{
|
|
|
var subcode = AMENDNO.Substring(AMENDNO.Length - 2, 1);
|
|
|
var subcode2 = AMENDNO.Substring(AMENDNO.Length - 3, 1);
|
|
|
if (subcode == "-" || subcode2 == "-")
|
|
|
{
|
|
|
var subnum = "";
|
|
|
if (subcode == "-")
|
|
|
subnum = AMENDNO.Substring(AMENDNO.Length - 1, 1);
|
|
|
if (subcode2 == "-")
|
|
|
subnum = AMENDNO.Substring(AMENDNO.Length - 2, 2);
|
|
|
try
|
|
|
{
|
|
|
var num = Convert.ToInt16(subnum) + 1;
|
|
|
if (subcode == "-")
|
|
|
AMENDNO = AMENDNO.Substring(0, AMENDNO.Length - 1) + num.ToString();
|
|
|
if (subcode2 == "-")
|
|
|
AMENDNO = AMENDNO.Substring(0, AMENDNO.Length - 2) + num.ToString();
|
|
|
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
AMENDNO = AMENDNO + "-2";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
head.AMENDNO = AMENDNO;
|
|
|
|
|
|
//var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='更改单'", Convert.ToString(Session["COMPANYID"]));
|
|
|
//if (billnoset.BILLTYPE != "")
|
|
|
// head.AMENDNO = MsSysBillNoSetDAL.GetBillNo(billnoset, DateTime.Now.ToString("yyyy-MM-dd"), head.ACCDATE.ToString().Trim(),"", head.CREATEUSER);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
head.DbOperationType = DbOperationType.DbotUpd;
|
|
|
}
|
|
|
|
|
|
modb.Save(head);
|
|
|
if (head.FEESTATUS)
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "已费用锁定不允许在此更改单添加修改费用!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
if (bodyListdr != null)
|
|
|
{
|
|
|
iResult = MsChFeeDAL.SaveUpdateFee(bodyListdr, bsno, USERID);
|
|
|
}
|
|
|
if (bodyListcr != null)
|
|
|
{
|
|
|
iResult = MsChFeeDAL.SaveUpdateFee(bodyListcr, bsno, USERID);
|
|
|
}
|
|
|
if (iResult == 1)
|
|
|
{
|
|
|
result.Success = true;
|
|
|
result.Message = "更新成功!";
|
|
|
MsChFeeDAL.p_op_gain(bsno, USERID);
|
|
|
|
|
|
}
|
|
|
else if (iResult == 0)
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "出现错误,未更新!";
|
|
|
}
|
|
|
else if (iResult == -1)
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "有异常,插入失败!";
|
|
|
}
|
|
|
else if (iResult == -2)
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "插入异常,事务已回滚成功!";
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
Data = MsChFeeDAL.GetAmendList("BSNO='" + billno + "'")
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}catch(Exception ex) {
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = false,
|
|
|
Message = ex.Message
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
public ContentResult DeleteAmendList(string data)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<List<MsOpAmend>>(data);
|
|
|
return DeleteAmendList_Object(headData);
|
|
|
}
|
|
|
public ContentResult DeleteAmendList_Object(List<MsOpAmend> headData)
|
|
|
{
|
|
|
//var headData = JsonConvert.Deserialize<List<MsOpAmend>>(data);
|
|
|
var errstr = "";
|
|
|
string LAN = Convert.ToString(Session["LANGUAGES"]);
|
|
|
var shanchuchenggong = "删除成功!";
|
|
|
var cunzaifeiyong = "存在费用,请先删除费用才能删除此票更改单!";
|
|
|
|
|
|
if (LAN == "en-us")
|
|
|
{
|
|
|
shanchuchenggong = "Successfully deleted!";
|
|
|
cunzaifeiyong = "There are fees, please delete the fees first before deleting this amend!";
|
|
|
|
|
|
}
|
|
|
|
|
|
if (headData != null)
|
|
|
{
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
foreach (var enumValue in headData)
|
|
|
{
|
|
|
|
|
|
var BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from ch_fee WHERE BSNO='" + enumValue.BSNO + "'");
|
|
|
if (BLCOUNT == "0"){
|
|
|
string blUpSQL = "delete from op_amend where BSNO='" + enumValue.BSNO + "'";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (errstr == "")
|
|
|
errstr = enumValue.BSNO;
|
|
|
else
|
|
|
errstr = errstr + "," + enumValue.BSNO;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (errstr == "") errstr = shanchuchenggong;
|
|
|
else errstr = cunzaifeiyong;
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = true, Message = errstr };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
public ContentResult GetAuditDataList(string billno)
|
|
|
{
|
|
|
var dataList = MsChFeeDAL.GetDataList("BsNo='" + billno + "' and (FeeStatus<>1 and FeeStatus<>6)");
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult Audit(int newStatus, string list)
|
|
|
{
|
|
|
var chfeeList = JsonConvert.Deserialize<List<MsChFee>>(list);
|
|
|
|
|
|
DBResult result = MsChFeeDAL.Audit(newStatus, chfeeList);
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetCtnUnitList(string bsno,string bstype)
|
|
|
{
|
|
|
string LAN = Convert.ToString(Session["LANGUAGES"]);
|
|
|
var list = MsChFeeDAL.GetCtnUnitList(bsno,bstype,LAN);
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = list.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 币别和默认汇率
|
|
|
/// </summary>
|
|
|
/// <param name="condition"></param>
|
|
|
/// <returns></returns>
|
|
|
public ContentResult GetFeeCurrList(string condition)
|
|
|
{
|
|
|
var list = MsChFeeDAL.GetFeeCurrList();
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = list.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public JsonResult GetFeeTypeRefList(string condition)
|
|
|
{
|
|
|
string LAN = Convert.ToString(Session["LANGUAGES"]);
|
|
|
|
|
|
|
|
|
List<FeeTypeRefModel> evList = MsChFeeDAL.GetFeeTypeRefList(condition);
|
|
|
|
|
|
if (evList.Count == 0)
|
|
|
{
|
|
|
return Json(new { success = false });
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return Json(new { success = true, data = evList.ToList() });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public JsonResult GetFeeTypeRefListNew(string Name)
|
|
|
{
|
|
|
string LAN = Convert.ToString(Session["LANGUAGES"]);
|
|
|
var ISFEENAMESAME = CookieConfig.GetCookie_ISFEENAMESAME(Request);
|
|
|
var condition = "";
|
|
|
|
|
|
if (Name== "")
|
|
|
{
|
|
|
}
|
|
|
else
|
|
|
condition = " (FeeCode like '%" + Name + "%' or Name like '%" + Name + "%' or DESCRIPTION like '%"+ Name + "%') ";
|
|
|
List<FeeTypeRefModel> evList = MsChFeeDAL.GetFeeTypeRefList(condition, LAN, ISFEENAMESAME);
|
|
|
|
|
|
if (evList.Count == 0)
|
|
|
{
|
|
|
return Json(new { success = false });
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return Json(new { success = true, data = evList.ToList() });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public ContentResult GetFeeOpRang(string optype)
|
|
|
{
|
|
|
var list = MsChFeeDAL.GetFeeOpRang(optype, Convert.ToString(Session["USERID"]));
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = list.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult GetFeeDateCurrList(string optype,string bsno)
|
|
|
{
|
|
|
var list = MsChFeeDAL.GetFeeDateCurrList(optype, bsno, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = list.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetFeeNowCurrList()
|
|
|
{
|
|
|
var COMPANYID = Convert.ToString(Session["COMPANYID"]);
|
|
|
var list = MsChFeeDAL.GetFeeNowCurrList(COMPANYID);
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = list.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetFeeNowInvCurrList()
|
|
|
{
|
|
|
var COMPANYID = Convert.ToString(Session["COMPANYID"]);
|
|
|
var list = MsChFeeDAL.GetFeeNowInvCurrList();
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = list.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据Session的分公司 和 当前时间 查询日期区间汇率
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ContentResult GetCurrList()
|
|
|
{
|
|
|
var COMPANYID = Convert.ToString(Session["COMPANYID"]);
|
|
|
var list = MsChFeeDAL.GetFeeNowCurrList2(COMPANYID);
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = list.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetFeeDefaultUnit( string BSNO,string FEENAME)
|
|
|
{
|
|
|
FeeDefaultUnitmb head = null;
|
|
|
|
|
|
var list = MsChFeeDAL.GetFeeDefaultUnitList(BSNO, FEENAME);
|
|
|
if (list.Count > 0)
|
|
|
head = list[0];
|
|
|
|
|
|
if (head == null)
|
|
|
{ head = new FeeDefaultUnitmb(); }
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetGainPrint(string bsno, string oplb)
|
|
|
{
|
|
|
|
|
|
DBResult result = MsChFeeDAL.GetGainPrint(bsno, oplb, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]));
|
|
|
|
|
|
if (result.Success) {
|
|
|
var isopen = MsBaseInfoDAL.GetUserModuleEnable("modFeenotopen", Convert.ToString(Session["USERID"]));
|
|
|
result.Data = MsChFeeDAL.GetFeeSumRangeSqlStr(isopen,Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
result.Message = MsChFeeDAL.GetFeeDrCrRangeSqlStr(1,oplb,isopen,Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
result.Message2 = MsChFeeDAL.GetFeeDrCrRangeSqlStr(2, oplb, isopen, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Message2 = result.Message2, Data = result.Data };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
public ContentResult GetGainPrintAmend(string bsno,string pbsno,string oplb)
|
|
|
{
|
|
|
|
|
|
DBResult result = MsChFeeDAL.GetGainPrintAmend(bsno,pbsno,oplb, Convert.ToString(Session["SHOWNAME"]));
|
|
|
|
|
|
if (result.Success)
|
|
|
{
|
|
|
var isopen = MsBaseInfoDAL.GetUserModuleEnable("modFeenotopen", Convert.ToString(Session["USERID"]));
|
|
|
result.Data = MsChFeeDAL.GetFeeSumRangeSqlStr(isopen, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
result.Message = MsChFeeDAL.GetFeeDrCrRangeSqlStr(1, oplb, isopen, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
result.Message2 = MsChFeeDAL.GetFeeDrCrRangeSqlStr(2, oplb, isopen, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Message2 = result.Message2, Data = result.Data };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
public ContentResult GetCarrierInv(string bsno)
|
|
|
{
|
|
|
|
|
|
DBResult result = MsChFeeDAL.GetCarrierInvInterfaceList(bsno, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = result.Data };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult UpdateFeeCustNo(string body, string custno)
|
|
|
{
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsChFee>>(body);
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var bill in bodyList)
|
|
|
{
|
|
|
string blUpSQL = " update ch_fee set WMSOUTBSNO='" + custno + "' where GID='"+bill.GId+"'";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result.Success = true;
|
|
|
result.Message = "更新成功!";
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
// Data = MsChFeeDAL.GetDataList(headData.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request))
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetFeeBalAmount(string condition)
|
|
|
{
|
|
|
var feeBal = MsChFeeDAL.GetFeeBalAmount(condition);
|
|
|
var jsonRespose = new JsonResponse { Success = true, Message = "", Data = feeBal };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
#region 销售订舱费用
|
|
|
public ContentResult GetOrderDataList(string billno, int type, string optype)
|
|
|
{
|
|
|
var dataList = MsChFeeDAL.GetOrderDataList("BsNo='" + billno + "' and FeeType=" + type);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetOrderDataList2(string billno)
|
|
|
{
|
|
|
var dataList = MsChFeeDAL.GetOrderDataList("BsNo='" + billno + "' ");
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetOrderFeeList(string condition)
|
|
|
{
|
|
|
var dataList = MsChFeeDAL.GetOrderDataList(condition);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult OrderDelete(string bsno, string data)
|
|
|
{
|
|
|
int iResult = 0;
|
|
|
var bodyList = data;
|
|
|
var result = new DBResult();
|
|
|
|
|
|
if (bodyList != "" || bodyList != null)
|
|
|
{
|
|
|
iResult = MsChFeeDAL.DeleteOrderFee(bodyList);
|
|
|
// MsChFeeDAL.p_op_gain(bsno, Convert.ToString(Session["USERID"]));
|
|
|
|
|
|
}
|
|
|
if (iResult == 1)
|
|
|
{
|
|
|
result.Success = true;
|
|
|
result.Message = "删除成功!";
|
|
|
|
|
|
}
|
|
|
else if (iResult == 0)
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "出现错误,未删除!";
|
|
|
}
|
|
|
else if (iResult == -1)
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "有异常,删除失败!";
|
|
|
}
|
|
|
else if (iResult == -2)
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "删除异常,事务已回滚成功!";
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
// Data = MsChFeeDAL.GetDataList(headData.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request))
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetOrderGainList(string bsno)
|
|
|
{
|
|
|
var dataList = MsChFeeDAL.GetOrderGainList("BsNo='" + bsno + "'");
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult SaveOrderFee ( string bsno, string type, string OrderFeeBody )
|
|
|
{
|
|
|
var chfeeBodyList = JsonConvert.Deserialize<List<MsOrderFee>>(OrderFeeBody);
|
|
|
var chfeeDelBodyList = JsonConvert.Deserialize<List<MsOrderFee>>("");
|
|
|
|
|
|
var modb = new ModelObjectRepository();
|
|
|
DBResult result = modb.SaveComm("BsNo", bsno,
|
|
|
ModelObjectConvert<MsOrderFee>.ToModelObjectList(chfeeBodyList),
|
|
|
ModelObjectConvert<MsOrderFee>.ToModelObjectList(chfeeDelBodyList)
|
|
|
);
|
|
|
|
|
|
//刷新父窗口上的父节点
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
public ContentResult ShenNewSaleCorp(String data, string SaleCorp)
|
|
|
{
|
|
|
var billData = JsonConvert.Deserialize<List<MsChFee>>(data);
|
|
|
|
|
|
DBResult result = MsChFeeDAL.ShenNewSALECORP(billData, SaleCorp, Convert.ToString(Session["USERID"]));
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult CreateDui(string list)
|
|
|
{
|
|
|
var chfeeList = JsonConvert.Deserialize<List<MsChFee>>(list);
|
|
|
var duino = "";
|
|
|
var gidstr = "";
|
|
|
decimal feetype = 1;
|
|
|
if (chfeeList != null)
|
|
|
{
|
|
|
foreach (var enumValue in chfeeList)
|
|
|
{
|
|
|
//if (enumValue.DebitNo!=""&& enumValue.DebitNo!=null)
|
|
|
// duino = enumValue.DebitNo;
|
|
|
if (gidstr == "")
|
|
|
gidstr = "'" + enumValue.GId + "'";
|
|
|
else gidstr = gidstr + ",'" + enumValue.GId + "'";
|
|
|
feetype = enumValue.FeeType;
|
|
|
}
|
|
|
}
|
|
|
if (gidstr != "") {
|
|
|
gidstr = "(" + gidstr + ")";
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
var STATEMENTNO = T_ALL_DA.GetStrSQL("STATEMENTNO", "select top 1 STATEMENTNO from CH_FEE where STATEMENTNO<>'' AND GID IN "+ gidstr);
|
|
|
if (!string.IsNullOrEmpty(STATEMENTNO)) {
|
|
|
duino = STATEMENTNO;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (duino != "") {
|
|
|
var jsonRespose = new JsonResponse { Success =true,Data=duino,Message = "已存在账单号!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var FEEDEBITINVISMUST = MsSysParamSetDAL.GetData("PARAMNAME='FEEDEBITINVISMUST'");
|
|
|
if (FEEDEBITINVISMUST.PARAMVALUE == "1")
|
|
|
{
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
var INVNO = T_ALL_DA.GetStrSQL("INVNO", "select top 1 INVNO from v_op_bs where BSNO='" + chfeeList[0].BsNo + "'");
|
|
|
if (INVNO == "")
|
|
|
{
|
|
|
var billnoset2 = new Models.MsSysBillNoSet.SysBillNoSet();
|
|
|
if (feetype == 2)
|
|
|
billnoset2=MsSysBillNoSetDAL.GetData("OPLBNAME='费用单票应付账单'", Convert.ToString(Session["COMPANYID"]));
|
|
|
if (feetype != 2|| string.IsNullOrEmpty(billnoset2.OPLBNAME))
|
|
|
billnoset2 = MsSysBillNoSetDAL.GetData("OPLBNAME='费用单票账单'", Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
duino = MsSysBillNoSetDAL.GetBillNo(billnoset2, DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM"));
|
|
|
|
|
|
MsChFeeDAL.CreateDui(duino, chfeeList);
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "发票号空!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
//var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='费用单票账单'", Convert.ToString(Session["COMPANYID"]));
|
|
|
var billnoset = new Models.MsSysBillNoSet.SysBillNoSet();
|
|
|
if (feetype == 2)
|
|
|
billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='费用单票应付账单'", Convert.ToString(Session["COMPANYID"]));
|
|
|
if (feetype != 2 || string.IsNullOrEmpty(billnoset.OPLBNAME))
|
|
|
billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='费用单票账单'", Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
|
|
|
|
|
|
duino = MsSysBillNoSetDAL.GetBillNo(billnoset, DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM"));
|
|
|
|
|
|
|
|
|
|
|
|
if (duino=="")
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "账单号规则未设置,无法生存账单!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
DBResult result = MsChFeeDAL.CreateDui(duino,chfeeList);
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult SaveSort(string chfeebody,string bsno)
|
|
|
{
|
|
|
var chfeeList = JsonConvert.Deserialize<List<MsChFee>>(chfeebody);
|
|
|
|
|
|
DBResult result = MsChFeeDAL.SaveFeeSort(chfeeList);
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult CreateDjyInvFee(string bsno, string feebody)
|
|
|
{
|
|
|
|
|
|
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 bodyList = JsonConvert.Deserialize<List<MsChFee>>(feebody);
|
|
|
var result = new DBResult();
|
|
|
if (bodyList == null || bodyList.Count == 0)
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "没有要生成的费用明细!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
|
|
|
var bsnolist = new List<BSNOLB>();
|
|
|
var bsnols = new BSNOLB();
|
|
|
bsnols.BSNO = bsno;
|
|
|
bsnolist.Add(bsnols);
|
|
|
|
|
|
result = MsChFeeDAL.SendToDJYINV(bsnolist, bodyList, Convert.ToString(Session["COMPANYID"]).ToString().Trim(), Convert.ToString(Session["USERID"]).ToString().Trim());
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
Data=result.Data
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult CancelCreateDjyInvFee(string bsno, string feebody)
|
|
|
{
|
|
|
|
|
|
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 bodyList = JsonConvert.Deserialize<List<MsChFee>>(feebody);
|
|
|
var result = new DBResult();
|
|
|
if (bodyList == null || bodyList.Count == 0)
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "没有要生成的费用明细!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
try
|
|
|
{
|
|
|
var DJYINVURL = MsSysParamSetDAL.GetData("PARAMNAME='DJYINVURL'");
|
|
|
if (string.IsNullOrEmpty(DJYINVURL.PARAMVALUE))
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "请先配置参数设置【大简云自助开票接口地址】";
|
|
|
var jsonRespose2 = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
var bsnolist = new List<BSNOLB>();
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
foreach (var item in bodyList)
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(item.INVLINKGID)) {
|
|
|
if (bsnolist.Find(x => x.BSNO == item.INVLINKGID) == null) {
|
|
|
var bsnols = new BSNOLB();
|
|
|
bsnols.BSNO = item.INVLINKGID;
|
|
|
bsnolist.Add(bsnols);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
var errstr = "";
|
|
|
if (bsnolist != null && bsnolist.Count != 0) {
|
|
|
var reqUrl = DJYINVURL.PARAMVALUE.Replace("getlink", "cancelLink");
|
|
|
foreach (var item in bsnolist)
|
|
|
{
|
|
|
Dictionary<string, string> dicData = new Dictionary<string, string>();
|
|
|
dicData.Add("linkId", item.BSNO);
|
|
|
string rtn = WebRequestHelper.DoPost(reqUrl, dicData);
|
|
|
var objRtn = Newtonsoft.Json.JsonConvert.DeserializeAnonymousType(rtn, new { code = "", msg = "" });
|
|
|
if (objRtn.code == "200")
|
|
|
{
|
|
|
var blUpSQL = "update ch_fee set INVLINKGID='' where INVLINKGID='" + item.BSNO + "' ";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
}
|
|
|
else {
|
|
|
errstr = errstr +" "+ objRtn.msg;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(errstr)) {
|
|
|
result.Success = false;
|
|
|
result.Message = errstr;
|
|
|
var jsonRespose2 = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
|
|
|
}
|
|
|
catch (Exception e){
|
|
|
result.Success = false;
|
|
|
result.Message = e.Message;
|
|
|
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
// Data = MsChFeeDAL.GetDataList(headData.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request))
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult CreateDjyFee(string bsno, string feebody)
|
|
|
{
|
|
|
|
|
|
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 bodyList = JsonConvert.Deserialize<List<MsChFee>>(feebody);
|
|
|
var result = new DBResult();
|
|
|
if (bodyList == null || bodyList.Count == 0) {
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "没有要生成的费用明细!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
|
|
|
result = MsChFeeDAL.SendToDJY(bsno, bodyList, Convert.ToString(Session["COMPANYID"]).ToString().Trim(), Convert.ToString(Session["USERID"]).ToString().Trim());
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
if (result.Success) {
|
|
|
foreach (var item in bodyList) {
|
|
|
var blUpSQL = "update ch_fee set ISDJY=1 where GID='" + item.GId+"' ";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
// Data = MsChFeeDAL.GetDataList(headData.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request))
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult CreateTruckOrderFee(string bsno, string feebody)
|
|
|
{
|
|
|
int iResult = 0;
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsChFee>>(feebody);
|
|
|
var result = new DBResult();
|
|
|
|
|
|
var truckbsno = "";
|
|
|
var TRUCKBULK = MsOpTruckBulkDAL.GetData(" isnull(op_truck_bulk.FEESTATUS,0)=0 and op_truck_bulk.bsno in (select linkbsno from op_truck_bulk_pc_detail where bsno='" + bsno + "')");
|
|
|
truckbsno = TRUCKBULK.BSNO;
|
|
|
if (truckbsno == "")
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "没有符合要生成费用的订单!";
|
|
|
var jsonRespose2 = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
var newfeelist = new List<MsChFee>();
|
|
|
foreach (var enumValueBody in bodyList)
|
|
|
{
|
|
|
enumValueBody.GId = Guid.NewGuid().ToString();
|
|
|
enumValueBody.BsNo = "*";
|
|
|
enumValueBody.CustomerName = TRUCKBULK.CUSTOMERNAME;
|
|
|
enumValueBody.CustomerType = "委托单位";
|
|
|
enumValueBody.FeeStatus = 1;
|
|
|
enumValueBody.FeeType = 1;
|
|
|
newfeelist.Add(enumValueBody);
|
|
|
}
|
|
|
|
|
|
|
|
|
iResult = MsChFeeDAL.SaveUpdateFee(newfeelist, truckbsno, CookieConfig.GetCookie_UserId(Request));
|
|
|
}
|
|
|
if (iResult == 1)
|
|
|
{
|
|
|
result.Success = true;
|
|
|
result.Message = "更新成功!";
|
|
|
MsChFeeDAL.p_op_gain(truckbsno, CookieConfig.GetCookie_UserId(Request));//Convert.ToString(Session["USERID"]));
|
|
|
}
|
|
|
else if (iResult == 0)
|
|
|
{
|
|
|
result.Success = true;
|
|
|
result.Message = "更新成功!";
|
|
|
}
|
|
|
else if (iResult == -1)
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "有异常,插入失败!";
|
|
|
}
|
|
|
else if (iResult == -2)
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "插入异常,事务已回滚成功!";
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
// Data = MsChFeeDAL.GetDataList(headData.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request))
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult CreateAgentFcFee(string bsno, string feebody, string fcbl)
|
|
|
{
|
|
|
|
|
|
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 bodyList = JsonConvert.Deserialize<List<MsChFee>>(feebody);
|
|
|
var result = new DBResult();
|
|
|
if (bodyList == null || bodyList.Count == 0)
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "没有要生成的费用明细!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
|
|
|
result = MsChFeeDAL.CreateAgentFcFee(bsno, bodyList, fcbl,Convert.ToString(Session["COMPANYID"]).ToString().Trim(), Convert.ToString(Session["USERID"]).ToString().Trim());
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
// Data = MsChFeeDAL.GetDataList(headData.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request))
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
#region
|
|
|
[HttpPost]
|
|
|
public ContentResult ImportFee()
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "" };
|
|
|
|
|
|
if (Request.Files.Count != 1)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "请选择要上传的文件!";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var file = Request.Files["LoadExcel"];
|
|
|
if (file == null)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "File is Error,Pls Upload Again";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
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) };
|
|
|
}
|
|
|
string ext = Path.GetExtension(file.FileName).ToLower();
|
|
|
if (ext == ".asp" || ext == ".aspx")
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "不允许上传ASP或ASPX文件";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
var path = Server.MapPath("../../UploadFiles/SeaFee");
|
|
|
|
|
|
if (!Directory.Exists(path))
|
|
|
{
|
|
|
Directory.CreateDirectory(path);
|
|
|
}
|
|
|
|
|
|
var size = file.ContentLength;
|
|
|
var name = Path.GetFileName(file.FileName);
|
|
|
var bsno = Request.Form["bsno"];
|
|
|
|
|
|
|
|
|
var usercode = CookieConfig.GetCookie_UserCode(Request);
|
|
|
string csvfilename = usercode + DateTime.Now.ToString("yyyyMMddHHmmssfff") + name;
|
|
|
string filename = path + "\\" + csvfilename;
|
|
|
|
|
|
if (System.IO.File.Exists(filename))
|
|
|
{
|
|
|
System.IO.File.Delete(filename);
|
|
|
}
|
|
|
file.SaveAs(filename);
|
|
|
|
|
|
if (!System.IO.File.Exists(filename))
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据01";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
filename = filename.Replace("//", "/");
|
|
|
var ExcelExt = "";
|
|
|
try
|
|
|
{
|
|
|
ExcelExt = WebConfigurationManager.AppSettings["ExcelExt"].ToString();
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
|
|
|
}
|
|
|
if (ExcelExt == "" || ExcelExt == null) ExcelExt = "Excel 8.0;HDR=Yes;IMEX=1";
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
string excelConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename +
|
|
|
";Extended Properties="+ ExcelExt;
|
|
|
|
|
|
if (filename.ToLower().IndexOf(".xlsx") > 0)
|
|
|
{
|
|
|
excelConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filename +
|
|
|
";Extended Properties='Excel 12.0 Xml;HDR=Yes;IMEX=1'";
|
|
|
|
|
|
}
|
|
|
DataSet ds = new DataSet();
|
|
|
if (filename.ToLower().IndexOf(".csv") > 0)
|
|
|
{
|
|
|
excelConn = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + path + ";Extensions=asc,csv,tab,txt";
|
|
|
|
|
|
using (OdbcConnection odbccon = new OdbcConnection(excelConn)) { odbccon.Open(); OdbcCommand odbccom = new OdbcCommand(); odbccom.Connection = odbccon; odbccom.CommandText = "select * from [" + csvfilename + "]"; OdbcDataAdapter odbcda = new OdbcDataAdapter(odbccom); odbcda.Fill(ds); odbccon.Close(); }
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
List<string> sheets = ExcelSheetName(filename, ExcelExt);
|
|
|
var sheetname = sheets[0];
|
|
|
|
|
|
OleDbDataAdapter oada = new OleDbDataAdapter("select * from [" + sheetname + "A1:N]", excelConn);
|
|
|
|
|
|
oada.Fill(ds);
|
|
|
}
|
|
|
|
|
|
if (ds.Tables.Count == 0)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据03";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var table = ds.Tables[0];
|
|
|
//if (table.Rows.Count == 0 || table.Rows.Count == 1)
|
|
|
//{
|
|
|
// jsonRespose.Success = false;
|
|
|
// jsonRespose.Message = "上传的Excel不包含数据04";
|
|
|
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
//}
|
|
|
var updatetype = "";
|
|
|
|
|
|
|
|
|
var message = string.Empty;
|
|
|
|
|
|
|
|
|
bool isSucess = true;
|
|
|
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
|
|
|
var USERID = Convert.ToString(Session["USERID"]).ToString();
|
|
|
|
|
|
//新增更改单Helper 新增更改单Helper = new 新增更改单Helper(USERID, Convert.ToString(Session["SHOWNAME"]).ToString(), Convert.ToString(Session["COMPANYID"]).ToString());
|
|
|
|
|
|
|
|
|
var cdc = new CommonDataContext();
|
|
|
///首先判断 是否有没对应上的业务 如有则提示并退出逻辑
|
|
|
var ErrorMblno = "";
|
|
|
foreach (DataRow row in table.Rows)
|
|
|
{
|
|
|
var MBLNO = Convert.ToString(row["主提单号"]);
|
|
|
if (MBLNO != null && MBLNO != "")
|
|
|
{
|
|
|
MBLNO = MBLNO.Trim();
|
|
|
var vopbs = cdc.v_op_bs.Where(x => x.MBLNO == MBLNO).ToList();
|
|
|
if (vopbs == null || vopbs.Count == 0)
|
|
|
{
|
|
|
if (ErrorMblno != "") ErrorMblno += ",";
|
|
|
ErrorMblno += MBLNO;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (ErrorMblno != "")
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "下列提单号未能与业务对应:" + ErrorMblno;
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
foreach (DataRow row in table.Rows) {
|
|
|
|
|
|
var MBLNO = Convert.ToString(row["主提单号"]);
|
|
|
if (MBLNO != "")
|
|
|
{
|
|
|
var BSNO = T_ALL_DA.GetStrSQL("BSNO", "select BSNO from V_OP_BS where FEESTATUS=1 AND MBLNO='" + MBLNO + "'");
|
|
|
//20221202 如果该业务已费用锁定【feestatus=1】 采用生成费用更改单的方式生成费用
|
|
|
if (string.IsNullOrWhiteSpace(BSNO)) continue;
|
|
|
//如否 则仍按原逻辑生成费用
|
|
|
|
|
|
//判断业务是否已费用锁定
|
|
|
var head = cdc.v_op_bs.FirstOrDefault(x => x.BSNO == BSNO);
|
|
|
|
|
|
if (head.FEESTATUS == 1)
|
|
|
{
|
|
|
|
|
|
message = message + " 提单号:" + MBLNO + " 无法导入,请确认提单号正确并未费用封账!";
|
|
|
break;
|
|
|
//建立一个费用更改单
|
|
|
|
|
|
//新增更改单Helper.AddHead(head, USERID, filename + "佣金导入");
|
|
|
|
|
|
|
|
|
//var mblno=Convert.ToString(row["主提单号"]);
|
|
|
//var DRCRStr = Convert.ToString(row["收/付"]);
|
|
|
////var DRCR = DRCRStr == "收" ? 1 : 2;
|
|
|
//var FEENAME = Convert.ToString(row["费用名称"]).Trim();
|
|
|
|
|
|
//var CUSTNAME = Convert.ToString(row["结算对象"]).Trim();
|
|
|
//var BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select COUNT(*) BLCOUNT from info_client where SHORTNAME='" + CUSTNAME + "'");
|
|
|
//if (BLCOUNT == "0")
|
|
|
//{
|
|
|
// isSucess = false;
|
|
|
// message = message + " 提单号:" + MBLNO + " 无法导入,请确认客户名称:" + CUSTNAME + ",是否正确!";
|
|
|
// //jsonRespose.Success = false;
|
|
|
// //jsonRespose.Message = message;
|
|
|
// //return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
//}
|
|
|
//BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select COUNT(*) BLCOUNT from code_fee where [NAME]='" + FEENAME + "'");
|
|
|
//if (BLCOUNT == "0")
|
|
|
//{
|
|
|
// isSucess = false;
|
|
|
// //if (i != 0) message = "已导入" + i.ToString() + "条费用。";
|
|
|
// message = message + " 提单号:" + MBLNO + " 无法导入,请确认费用名称:" + FEENAME + ",是否正确!";
|
|
|
// break;
|
|
|
|
|
|
//}
|
|
|
|
|
|
//var AMOUNTSTR = Convert.ToString(row["金额"]);
|
|
|
//var EXRATESTR = Convert.ToString(row["汇率"]);
|
|
|
//var CURR = Convert.ToString(row["币种"]);
|
|
|
//var ISOPEN = Convert.ToString(row["是否机密"]);
|
|
|
//decimal amount = 0M;
|
|
|
//decimal exrate = 0M;
|
|
|
//try {
|
|
|
// amount = Convert.ToDecimal(AMOUNTSTR);
|
|
|
// exrate = Convert.ToDecimal(EXRATESTR);
|
|
|
//}
|
|
|
//catch (Exception e) {
|
|
|
|
|
|
//}
|
|
|
|
|
|
//新增更改单Helper.AddFee(mblno, DRCRStr, FEENAME, CUSTNAME, amount,exrate,CURR, ISOPEN);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (!isSucess)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = message;
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else {
|
|
|
//新增更改单Helper.DoSave();
|
|
|
}
|
|
|
|
|
|
var i = 0;
|
|
|
foreach (DataRow row in table.Rows)
|
|
|
{
|
|
|
var MBLNO = Convert.ToString(row["主提单号"]);
|
|
|
if (MBLNO != "")
|
|
|
{
|
|
|
var BSNO = T_ALL_DA.GetStrSQL("BSNO", "select BSNO from V_OP_BS where isnull(FEESTATUS,0)=0 AND MBLNO='" + MBLNO + "'");
|
|
|
|
|
|
var AmendBSNO = T_ALL_DA.GetStrSQL("BSNO", "select BSNO from V_OP_BS where isnull(FEESTATUS,0)=1 AND MBLNO='" + MBLNO + "'");
|
|
|
|
|
|
if ( string.IsNullOrWhiteSpace(BSNO) && string.IsNullOrWhiteSpace(AmendBSNO) ) {
|
|
|
isSucess = false;
|
|
|
if (i != 0) message = "已导入"+i.ToString()+"条费用。";
|
|
|
message = message+" 提单号:"+MBLNO+" 无法导入,请确认提单号正确并未费用封账!";
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
var CUSTNAME = Convert.ToString(row["结算对象"]).Trim();
|
|
|
var FEENAME = Convert.ToString(row["费用名称"]).Trim();
|
|
|
var BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select COUNT(*) BLCOUNT from code_fee where [NAME]='" + FEENAME + "'");
|
|
|
if (BLCOUNT == "0")
|
|
|
{
|
|
|
isSucess = false;
|
|
|
if (i != 0) message = "已导入" + i.ToString() + "条费用。";
|
|
|
message = message + " 提单号:" + MBLNO + " 无法导入,请确认费用名称:" + FEENAME+",是否正确!";
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select COUNT(*) BLCOUNT from info_client where SHORTNAME='" + CUSTNAME + "'");
|
|
|
if (BLCOUNT == "0")
|
|
|
{
|
|
|
isSucess = false;
|
|
|
if (i != 0) message = "已导入" + i.ToString() + "条费用。";
|
|
|
message = message + " 提单号:" + MBLNO + " 无法导入,请确认客户名称:" + CUSTNAME + ",是否正确!";
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
var DRCR = Convert.ToString(row["收/付"]);
|
|
|
var AMOUNTSTR = Convert.ToString(row["金额"]);
|
|
|
var EXRATESTR = Convert.ToString(row["汇率"]);
|
|
|
var CURR = Convert.ToString(row["币种"]);
|
|
|
var ISOPEN = Convert.ToString(row["是否机密"]);
|
|
|
if (DRCR == "付") DRCR = "2"; else DRCR = "1";
|
|
|
if (ISOPEN == "是") ISOPEN = "1"; else ISOPEN = "0";
|
|
|
if (CURR == "RMB") EXRATESTR = "1";
|
|
|
try
|
|
|
{
|
|
|
var amount = Convert.ToDecimal(AMOUNTSTR);
|
|
|
if (CURR != "RMB")
|
|
|
{
|
|
|
var exrate = Convert.ToDecimal(EXRATESTR);
|
|
|
}
|
|
|
}
|
|
|
catch (Exception exception)
|
|
|
{
|
|
|
isSucess = false;
|
|
|
if (i != 0) message = "已导入" + i.ToString() + "条费用。";
|
|
|
message = message + " 提单号:" + MBLNO + " 无法导入,请确认金额是否正确!";
|
|
|
break;
|
|
|
}
|
|
|
var userid = CookieConfig.GetCookie_UserId(Request);
|
|
|
var datestr = DateTime.Now.ToString();
|
|
|
|
|
|
|
|
|
#region 托单数据生成
|
|
|
|
|
|
var blUpSQL = " INSERT INTO ch_fee(GID, BSNO, FEETYPE, FEENAME, FEEDESCRIPTION, CUSTOMERTYPE, CUSTOMERNAME, UNIT, UNITPRICE, QUANTITY, AMOUNT, CURRENCY, "
|
|
|
+ " EXCHANGERATE, REASON, REMARK, COMMISSIONRATE,ENTEROPERATOR, ENTERDATE,ISOPEN, ISADVANCEDPAY, SORT, FEESTATUS, FEEFRT, "
|
|
|
+ " TAXRATE,NOTAXAMOUNT,ACCTAXRATE,LINENUM,TAXUNITPRICE,MODIFIEDUSER,MODIFIEDTIME,WMSOUTBSNO,PREAMOUNT,ISINVOICE,INPUTMODE,LOCALCURR,MANAGER,ISACC) "
|
|
|
+ " VALUES "
|
|
|
+ " (NEWID(),'" + BSNO + "'," + DRCR + ",'" + FEENAME + "','','','" + CUSTNAME + "','票'," + AMOUNTSTR + ",1," + AMOUNTSTR + ",'" + CURR + "', "
|
|
|
+ EXRATESTR + " ,'','',0,'" + userid + "','" + datestr + "'," + ISOPEN + ",0,50,0,'PP', "
|
|
|
+ " 0," + AMOUNTSTR + ",0,50," + AMOUNTSTR + ",'" + userid + "','" + datestr + "','',0,0,'','RMB','',0)";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
}
|
|
|
i = i + 1;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!isSucess)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = message;
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "上传成功,共生成"+i.ToString()+"条费用!" });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = e.Message;
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<string> ExcelSheetName(string filepath,string ExcelExt)
|
|
|
{
|
|
|
var al = new List<string>();
|
|
|
|
|
|
//try
|
|
|
//{
|
|
|
string strConn;
|
|
|
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filepath + ";Extended Properties="+ ExcelExt;
|
|
|
if (filepath.ToLower().IndexOf(".xlsx") > 0)
|
|
|
{
|
|
|
strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filepath +
|
|
|
";Extended Properties=\"Excel 12.0 Xml;HDR=Yes\"";
|
|
|
|
|
|
}
|
|
|
if (filepath.ToLower().IndexOf(".csv") > 0)
|
|
|
{
|
|
|
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filepath + ";Extended Properties==\"text;HDR=Yes;FMT=Delimited\"";
|
|
|
|
|
|
}
|
|
|
|
|
|
OleDbConnection conn = new OleDbConnection(strConn);
|
|
|
conn.Open();
|
|
|
DataTable sheetNames = conn.GetOleDbSchemaTable
|
|
|
(System.Data.OleDb.OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });
|
|
|
conn.Close();
|
|
|
|
|
|
foreach (DataRow dr in sheetNames.Rows)
|
|
|
{
|
|
|
al.Add(dr[2].ToString());
|
|
|
}
|
|
|
//}
|
|
|
//catch (Exception)
|
|
|
//{
|
|
|
// return new List<string>();
|
|
|
//}
|
|
|
|
|
|
return al;
|
|
|
}
|
|
|
public ContentResult GetEdiDataList(string condition)
|
|
|
{
|
|
|
var dataList = MsChFeeDAL.GetEdiDataList(condition);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult CreateZnj(string data,string FeeName,string ZNJ)
|
|
|
{
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpBillZnj>>(data);
|
|
|
|
|
|
if (bodyList != null && bodyList.Count > 0)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
MsChFeeDAL.CreateZnjFee(enumValue,FeeName,ZNJ,Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = true, Message = "查询成功", Data = "" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult CreateDzlxFee(string data, string FeeName, string ZNJ,string FeeType)
|
|
|
{
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpBillZnj>>(data);
|
|
|
DBResult result = new DBResult();
|
|
|
if (bodyList != null && bodyList.Count > 0)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
result=MsChFeeDAL.CreateDzlxFee(enumValue, FeeName, ZNJ, FeeType, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = "" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
/// <summary>
|
|
|
/// 用于从前台直接调用来产生费用
|
|
|
/// 目前仅用于内贸空运前台生成费用的计算
|
|
|
/// FeeType, _CustomerName, BSNO, Currency, Exchangerate, FeeName, price, Quantity, Remark, FeeDescription, feedate
|
|
|
/// </summary>
|
|
|
/// <param name="Feetype"></param>
|
|
|
/// <param name="CUSTOMERNAME"></param>
|
|
|
/// <param name="BSNO"></param>
|
|
|
/// <param name="CURRENCY"></param>
|
|
|
/// <param name=""></param>
|
|
|
/// <returns></returns>
|
|
|
public ContentResult AddFee(int FeeType, string CUSTOMERNAME, string BSNO, string Currency, string Exchangerate, string FeeName, string price, string Quantity, string Remark)
|
|
|
{
|
|
|
|
|
|
var canlogin = BasicDataRefDAL.CheckLogin(Session);
|
|
|
if (!canlogin.Success)
|
|
|
{
|
|
|
return (ContentResult)canlogin.Data;
|
|
|
}
|
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
|
var cdc = new CommonDataContext();
|
|
|
var bslist = cdc.v_op_bs.Where(x => x.BSNO == BSNO).ToList();
|
|
|
|
|
|
if (bslist == null || bslist.Count == 0) {
|
|
|
result.SetErrorInfo("未找到业务");
|
|
|
return BasicDataRefDAL.GetContentResult(result);
|
|
|
}
|
|
|
|
|
|
var bs = bslist[0];
|
|
|
var enter = MsOpSeaeDAL.getUserId(" SHOWNAME='自动化'", "");
|
|
|
result = MsChFeeDAL.MakeNewFee(enter, BSNO, CUSTOMERNAME, "其它", FeeType, FeeName, Convert.ToDecimal( price) * Convert.ToDecimal(Quantity), "单票", Convert.ToDecimal(Quantity), bs.SALE, Remark, Currency);
|
|
|
|
|
|
return BasicDataRefDAL.GetContentResult(result);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class 新增更改单Helper
|
|
|
{
|
|
|
private List<v_op_bs_mb> vopbsList { get; set; }
|
|
|
private List<新增更改单> HeadList { get; set; }
|
|
|
|
|
|
private string USERID { get; set; }
|
|
|
private string SHOWNAME { get; set; }
|
|
|
private string COMPANYID { get; set; }
|
|
|
|
|
|
public 新增更改单Helper(string USERID,string SHOWNAME, string COMPANYID) {
|
|
|
this.USERID = USERID;
|
|
|
this.SHOWNAME = SHOWNAME;
|
|
|
this.COMPANYID = COMPANYID;
|
|
|
|
|
|
HeadList = new List<新增更改单>();
|
|
|
vopbsList = new List<v_op_bs_mb>();
|
|
|
}
|
|
|
|
|
|
public void AddHead(v_op_bs_mb vopbs, string USERID, string AMENDREMARK)
|
|
|
{
|
|
|
|
|
|
if (HeadList.Count>0 && HeadList.Exists(x => x.head.PARENTID == vopbs.BSNO))
|
|
|
{
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var newhead = new 新增更改单(vopbs, USERID, AMENDREMARK);
|
|
|
HeadList.Add(newhead);
|
|
|
vopbsList.Add(vopbs);
|
|
|
//this.USERID = USERID;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public void AddFee(string MBLNO, string 应收应付, string FEENAME, string CUSTOMERNAME, decimal AMOUNT, decimal RATE, string CURR,string ISOPEN)
|
|
|
{
|
|
|
//var bsno
|
|
|
int DRCR= ((应收应付=="收")?1 : 2);
|
|
|
var vopbs = vopbsList.First(x => x.MBLNO == MBLNO);
|
|
|
var sale = vopbs.SALE;
|
|
|
var newfee = MsChFeeDAL.getChFee(USERID, "*", CUSTOMERNAME, DRCR, FEENAME, AMOUNT, "单票", 1, sale,"导入佣金");
|
|
|
newfee.EXCHANGERATE = RATE;
|
|
|
newfee.CURRENCY = CURR;
|
|
|
//newfee.setTax();
|
|
|
newfee.FEESTATUS = 0;
|
|
|
|
|
|
var currentHead = HeadList.First(x => x.head.PARENTID == vopbs.BSNO);
|
|
|
currentHead.FeeList.Add(newfee);
|
|
|
//newfee.BSNO = "*";
|
|
|
}
|
|
|
public DBResult DoSave()
|
|
|
{
|
|
|
//执行保存
|
|
|
var result = new DBResult();
|
|
|
|
|
|
if (HeadList != null && HeadList.Count > 0) {
|
|
|
|
|
|
var mschfeecontroller = new DSWeb.MvcShipping.Controllers.MsChFeeController();
|
|
|
|
|
|
foreach (var head in HeadList) {
|
|
|
var savehead = head.head;
|
|
|
savehead.ModelUIStatus = "I";
|
|
|
savehead.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
|
var savelist = head.GetChfeelist(); //AutoMapperHelper.MapToList<ch_fee_md, MsChFee>(head.FeeList);
|
|
|
|
|
|
mschfeecontroller.SaveAmend_Object(head.head.BSNO, head.head, savelist, null, USERID, SHOWNAME, COMPANYID);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
public class 新增更改单
|
|
|
{
|
|
|
public MsOpAmend head { get; set; } = new MsOpAmend();
|
|
|
|
|
|
public List<ch_fee_md> FeeList { get; set; } = new List<ch_fee_md>();
|
|
|
|
|
|
public List<MsChFee> GetChfeelist()
|
|
|
{
|
|
|
if (FeeList != null && FeeList.Count > 0)
|
|
|
{
|
|
|
return AutoMapperHelper.MapToList<ch_fee_md, MsChFee>(FeeList);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return new List<MsChFee>();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public 新增更改单(v_op_bs_mb vopbs, string USERID, string AMENDREMARK)
|
|
|
{
|
|
|
head.BSNO = Guid.NewGuid().ToString();
|
|
|
head.GID = head.BSNO;
|
|
|
head.PARENTID = vopbs.BSNO;
|
|
|
head.FEESTATUS = false;
|
|
|
|
|
|
head.ACCDATE = System.DateTime.Now.ToString("yyyy-MM");
|
|
|
head.SALE = vopbs.SALE;
|
|
|
//head.REMARKS
|
|
|
var cdc = new CommonDataContext();
|
|
|
var _user = cdc.VW_user.FirstOrDefault(x => x.USERID == USERID);
|
|
|
|
|
|
head.CREATETIME = "";
|
|
|
head.REMARKS = AMENDREMARK;
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|