You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/Account/Controllers/Chfee_AuditController.cs

1665 lines
75 KiB
C#

2 years ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using DSWeb.TruckMng.Comm.Cookie;
using DSWeb.TruckMng.Helper;
using DSWeb.TruckMng.Helper.Repository;
using HcUtility.Comm;
using DSWeb.MvcShipping.DAL.Chfee_AuditDAL;
using DSWeb.MvcShipping.Models.MsChFee;
using DSWeb.Areas.Account.Models.MsOpBill;
using DSWeb.MvcShipping.DAL.MsSysParamSet;
using DSWeb.MvcContainer.Models.MsOpCtnBsCard;
using DSWeb.MvcContainer.DAL.MsOpCtnBsCard;
using DSWeb.Areas.MvcShipping.DAL;
using DSWeb.EntityDA;
using System.Data;
using DSWeb.Areas.CommMng.Models;
using DSWeb.MvcShipping.DAL.MsOpSeaeDAL;
using DSWeb.MvcShipping.DAL.MsChFeeDAL;
using DSWeb.MvcShipping.DAL.ChMonthCloseDAL;
2 years ago
using DSWeb.MvcShipping.DAL.MsInfoClient;
using DSWeb.MvcShipping.Models.MsInfoClient;
2 years ago
using DSWeb.Account.Models.MsOpAuditDetail;
using DSWeb.MvcShipping.DAL.MsCodeFeeSetList;
2 years ago
namespace DSWeb.Areas.Account.Controllers
{
[JsonRequestBehavior]
public class Chfee_AuditController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult PiLiangSubmit()
{
return View();
}
public ActionResult LRIndex()
{
return View();
}
public ActionResult TruckIndex()
{
return View();
}
public ActionResult BLIndex()
{
return View();
}
public ContentResult GetDataList(string bsno, int type, string optype, string isAll, string condition = "", string worktype = "")
2 years ago
{
var dataList = Chfee_AuditDAL.GetDataList(bsno, type, optype, isAll, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), worktype);
2 years ago
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetBLListData(int start, int limit, string sort, string condition)
2 years ago
{
var dataList = Chfee_AuditDAL.GetBillDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
2 years ago
int count = Chfee_AuditDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
// var list = dataList.Skip(start).Take(limit);
2 years ago
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetBLListDataStr(string sort, string condition)
{
var dataListStr = Chfee_AuditDAL.GetBillDataListStr(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
// int count = Chfee_AuditDAL.getTotalCount(condition, 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 GetBLListData2(int start, int limit, string sort, string condition)
{
var dataList = Chfee_AuditDAL.GetBillDataList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
// int count = Chfee_AuditDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
2 years ago
var list = dataList.Skip(start).Take(limit);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetBLListData3(int start, int limit, string sort, string condition)
{
var dataList = Chfee_AuditDAL.GetBillDataList3(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
//int count = Chfee_AuditDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
var list = dataList.Skip(start).Take(limit);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetTruckBLListData(int start, int limit, string sort, string condition)
{
var dataList = Chfee_AuditDAL.GetTruckBillDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
int count = Chfee_AuditDAL.getTruckTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
// var list = dataList.Skip(start).Take(limit);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetBLData(string condition)
{
MsOpBill head = null;
var list = Chfee_AuditDAL.GetBillDataList(0, 2, condition, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), Convert.ToString(Session["COMPANYID"]));
2 years ago
if (list.Count > 0)
head = list[0];
2 years ago
if (head == null)
{
head = new MsOpBill();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult Audit(String optype, String bill, string mblno = "", string bsno = "", string isamend = "", string worktype = "")
{
var workflowstr = "";
var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
if (AMENDSELFWORK.PARAMVALUE == "1" && isamend == "1") workflowstr = "AmendFeefyAudit";
2 years ago
DBResult result = Chfee_AuditDAL.Audit(optype, Convert.ToString(Session["USERID"]), bill, mblno, bsno, workflowstr);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult AuditList(String optype, string bill, string mblno = "", string bsno = "", string isamend = "", string worktype = "")
{
var workflowstr = "";
var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
if (AMENDSELFWORK.PARAMVALUE == "1" && isamend == "1") workflowstr = "AmendFeefyAudit";
var billData = JsonConvert.Deserialize<List<MsChFee>>(bill);
DBResult result = Chfee_AuditDAL.AuditList(optype, Convert.ToString(Session["USERID"]), billData, mblno, bsno, workflowstr, worktype);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult AuditBack(String optype, String bill, string reasean, string isamend, string worktype = "")
2 years ago
{
var workflowstr = "";
var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
if (AMENDSELFWORK.PARAMVALUE == "1" && isamend == "1") workflowstr = "AmendFeefyAudit";
var billData = JsonConvert.Deserialize<List<MsChFee>>(bill);
DBResult result = Chfee_AuditDAL.AuditBack(optype, Convert.ToString(Session["USERID"]), billData, reasean, workflowstr, Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SubmitAudit(string GidStr, string optype, string bsno = "")
2 years ago
{
DBResult result = Chfee_AuditDAL.SubmitAudit(optype, Convert.ToString(Session["USERID"]), GidStr, bsno, "", Convert.ToString(Session["COMPANYID"]));
2 years ago
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SubmitAuditAmend(string GidStr, string optype, string bsno = "")
{
var workflowstr = "";
2 years ago
var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
if (AMENDSELFWORK.PARAMVALUE == "1") workflowstr = "AmendFeefyAudit";
DBResult result = Chfee_AuditDAL.SubmitAudit(optype, Convert.ToString(Session["USERID"]), GidStr, bsno, workflowstr, Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SubmitAuditYj(string GidStr, string optype, string bsno = "")
{
DBResult result = Chfee_AuditDAL.SubmitAudit(optype, Convert.ToString(Session["USERID"]), GidStr, bsno, "YjFeefyAudit", Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SubmitAuditNew(string feebody, string optype, string bsno = "")
2 years ago
{
var ISSALEWORK = CookieConfig.GetCookie_ISSALEWORK(Request);
var billData = JsonConvert.Deserialize<List<MsChFee>>(feebody);
2 years ago
var MsFeeCurrList = new List<MsFeeCurr>();
var FEESUBMITSYNCEXCHANGE = MsSysParamSetDAL.GetData("PARAMNAME='FEESUBMITSYNCEXCHANGE'");
if (FEESUBMITSYNCEXCHANGE.PARAMVALUE == "1")
MsFeeCurrList = MsChFeeDAL.GetFeeDateCurrList("", bsno, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
2 years ago
var error = "";
if (billData != null && bsno != "")
2 years ago
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var custstr = "";
foreach (var enumValue in billData)
{
var BLCOUNT2 = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from info_client WHERE ISNULL(ISSTOP,0)=0 AND SHORTNAME='" + enumValue.CustomerName + "'");
if (BLCOUNT2 == "0")
{
if (custstr == "") custstr = enumValue.CustomerName;
else custstr = custstr + "," + enumValue.CustomerName;
}
if (FEESUBMITSYNCEXCHANGE.PARAMVALUE == "1")
{
if (enumValue.Currency != "RMB")
{
var MsFeeCurr = MsFeeCurrList.Find(x => x.CURR == enumValue.Currency);
if (MsFeeCurr != null)
{
2 years ago
if (enumValue.FeeType == 1)
enumValue.ExChangerate = MsFeeCurr.DEFRATE;
else
{
if (MsFeeCurr.CRDEFRATE != 0) enumValue.ExChangerate = MsFeeCurr.CRDEFRATE;
2 years ago
else enumValue.ExChangerate = MsFeeCurr.DEFRATE;
}
}
}
}
2 years ago
if (enumValue.UnitPrice == 0)
{
error = error + "<br />费用单价不能为0";
}
if (enumValue.Quantity == 0)
{
error = error + "<br />费用数量不能为0";
}
if (enumValue.ExChangerate == 0)
{
error = error + "<br />费用汇率不能为0";
}
if (enumValue.Amount <= 0)
{
error = error + "<br />费用金额不能小于等于0";
}
if (string.IsNullOrEmpty(enumValue.CustomerName))
{
error = error + "<br />费用客户名称不能为空";
}
if (string.IsNullOrEmpty(enumValue.FeeName))
{
error = error + "<br />费用名称不能为空";
}
if (string.IsNullOrEmpty(enumValue.Unit))
{
error = error + "<br />费用单位标准不能为空";
}
2 years ago
}
2 years ago
if (optype == "op_seae")
{
var MsOpSeae = MsOpSeaeDAL.GetData("BSNO='" + bsno + "'");
error = error+ MsOpSeaeDAL.IsSubmitOpSeae(MsOpSeae);
}
if (!string.IsNullOrEmpty(error))
{
DBResult result3 = new DBResult();
result3.Success = false;
result3.Message = error;
var json3 = JsonConvert.Serialize(result3);
return new ContentResult() { Content = json3 };
}
2 years ago
if (custstr != "")
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "客户名称:" + custstr + " ,系统中不存在,请检查!",
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
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 = "已费用锁定,不允许添加修改费用!",
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
var type = billData[0].FeeType;
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 = "应收费用已锁定,不允许添加修改费用!",
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
else
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "应付费用已锁定,不允许添加修改费用!",
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
}
var iResult = MsChFeeDAL.SaveUpdateFee(billData, bsno, CookieConfig.GetCookie_UserId(Request));
}
DBResult result = Chfee_AuditDAL.SubmitAuditNew(optype, Convert.ToString(Session["USERID"]), billData, false, "", ISSALEWORK, Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SubmitAuditOp(string feebody, string optype, string bsno = "")
{
var workflowstr = "OpFeeAudit";
var billData = JsonConvert.Deserialize<List<MsChFee>>(feebody);
if (billData != null && bsno != "")
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var custstr = "";
foreach (var enumValue in billData)
{
var BLCOUNT2 = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from info_client WHERE ISNULL(ISSTOP,0)=0 AND SHORTNAME='" + enumValue.CustomerName + "'");
if (BLCOUNT2 == "0")
{
if (custstr == "") custstr = enumValue.CustomerName;
else custstr = custstr + "," + enumValue.CustomerName;
}
}
if (custstr != "")
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "客户名称:" + custstr + " ,系统中不存在,请检查!",
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
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 = "已费用锁定,不允许添加修改费用!",
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
var type = billData[0].FeeType;
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 = "应收费用已锁定,不允许添加修改费用!",
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
else
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "应付费用已锁定,不允许添加修改费用!",
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
}
var iResult = MsChFeeDAL.SaveUpdateFee(billData, bsno, CookieConfig.GetCookie_UserId(Request));
}
DBResult result = Chfee_AuditDAL.SubmitAuditNew(optype, Convert.ToString(Session["USERID"]), billData, false, workflowstr, "0", Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SubmitAuditNewAmend(string feebody, string optype, string bsno = "")
2 years ago
{
var ISSALEWORK = CookieConfig.GetCookie_ISSALEWORK(Request);
var workflowstr = "";
2 years ago
var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
if (AMENDSELFWORK.PARAMVALUE == "1") workflowstr = "AmendFeefyAudit";
var billData = JsonConvert.Deserialize<List<MsChFee>>(feebody);
if (billData != null && bsno != "")
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var custstr = "";
foreach (var enumValue in billData)
{
var BLCOUNT2 = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from info_client WHERE ISNULL(ISSTOP,0)=0 AND SHORTNAME='" + enumValue.CustomerName + "'");
if (BLCOUNT2 == "0")
{
if (custstr == "") custstr = enumValue.CustomerName;
else custstr = custstr + "," + enumValue.CustomerName;
}
}
if (custstr != "")
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "客户名称:" + custstr + " ,系统中不存在,请检查!",
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
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 = "已费用锁定,不允许添加修改费用!",
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
var type = billData[0].FeeType;
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 = "应收费用已锁定,不允许添加修改费用!",
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
else
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "应付费用已锁定,不允许添加修改费用!",
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
}
var iResult = MsChFeeDAL.SaveUpdateFee(billData, bsno, CookieConfig.GetCookie_UserId(Request));
}
DBResult result = Chfee_AuditDAL.SubmitAuditNew(optype, Convert.ToString(Session["USERID"]), billData, false, workflowstr, ISSALEWORK, Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SubmitAuditOpAmend(string feebody, string optype)
{
var workflowstr = "OpFeeAudit";
//var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
//if (AMENDSELFWORK.PARAMVALUE == "1") workflowstr = "AmendFeefyAudit";
var billData = JsonConvert.Deserialize<List<MsChFee>>(feebody);
DBResult result = Chfee_AuditDAL.SubmitAuditNew(optype, Convert.ToString(Session["USERID"]), billData, false, workflowstr, "0", Convert.ToString(Session["COMPANYID"]));
2 years ago
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SubmitAuditNewYj(string feebody, string optype)
{
var ISSALEWORK = CookieConfig.GetCookie_ISSALEWORK(Request);
var billData = JsonConvert.Deserialize<List<MsChFee>>(feebody);
DBResult result = Chfee_AuditDAL.SubmitAuditNew(optype, Convert.ToString(Session["USERID"]), billData, false, "YjFeefyAudit", ISSALEWORK, Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
2 years ago
2 years ago
public ContentResult IsSubmitAuditBL(string optype, string bsno = "", string pbsno = "")
2 years ago
{
#region 2018年5月24日14:26:34 李进举 存在为0的费用弹出提示不允许提交
string mblnotemp = "";
2 years ago
var auditlist = new List<MsOpAuditDetail>();
2 years ago
var error = "";
2 years ago
var DrChfeeList = MsChFeeDAL.GetAllDataList("BSNO in (select BSNO FROM V_OP_BILL WHERE PARENTID='" + pbsno + "') AND FEETYPE=1 ");
2 years ago
var CrChfeeList = MsChFeeDAL.GetAllDataList("BSNO in (select BSNO FROM V_OP_BILL WHERE PARENTID='" + pbsno + "') AND FEETYPE=2 ");
2 years ago
if (DrChfeeList != null && DrChfeeList.Count != 0) {
foreach (var fee in DrChfeeList) {
if (fee.UnitPrice == 0) {
error = error + "<br />应收费用单价不能为0";
}
if (fee.Quantity == 0)
{
error = error + "<br />应收费用数量不能为0";
}
if (fee.ExChangerate == 0)
{
error = error + "<br />应收费用汇率不能为0";
}
if (fee.Amount<=0)
{
error = error + "<br />应收费用金额不能小于等于0";
}
if (string.IsNullOrEmpty(fee.CustomerName))
{
error = error + "<br />应收费用客户名称不能为空";
}
if (string.IsNullOrEmpty(fee.FeeName))
{
error = error + "<br />应收费用名称不能为空";
}
if (string.IsNullOrEmpty(fee.Unit))
{
error = error + "<br />应收费用单位标准不能为空";
}
}
}
if (CrChfeeList != null && CrChfeeList.Count != 0)
{
foreach (var fee in CrChfeeList)
{
if (fee.UnitPrice == 0)
{
error = error + "<br />应收费用单价不能为0";
}
if (fee.Quantity == 0)
{
error = error + "<br />应收费用数量不能为0";
}
if (fee.ExChangerate == 0)
{
error = error + "<br />应收费用汇率不能为0";
}
if (fee.Amount <= 0)
{
error = error + "<br />应收费用金额不能小于等于0";
}
if (string.IsNullOrEmpty(fee.CustomerName))
{
error = error + "<br />应收费用客户名称不能为空";
}
if (string.IsNullOrEmpty(fee.FeeName))
{
error = error + "<br />应收费用名称不能为空";
}
if (string.IsNullOrEmpty(fee.Unit))
{
error = error + "<br />应收费用单位标准不能为空";
}
}
}
if (!string.IsNullOrEmpty(error))
{
DBResult result3= new DBResult();
result3.Success = false;
result3.Message = error;
var json3 = JsonConvert.Serialize(result3);
return new ContentResult() { Content = json3 };
}
2 years ago
var feecodelist = MsCodeFeeSetListDAL.GetDataList("", 0, 10000);
2 years ago
optype = optype.ToLower();
var customername = "";
2 years ago
var carrier = "";
var pscust = "";
var saledept = "";
2 years ago
2 years ago
var warningstr = "";
2 years ago
var ismblfrt = false;
2 years ago
var psclientlist = new List<MsClient>();
var _dmb = new STLDATEmb();
//var clientps = new List<ClientPS>();
2 years ago
if (optype == "op_seae")
2 years ago
{
2 years ago
var MsOpSeae = MsOpSeaeDAL.GetData("BSNO='" + pbsno + "'");
2 years ago
error = MsOpSeaeDAL.IsSubmitOpSeae(MsOpSeae);
customername = MsOpSeae.CUSTOMERNAME;
2 years ago
carrier = MsOpSeae.CARRIER;
saledept = MsOpSeae.SALEDEPT;
2 years ago
psclientlist = MsInfoClientDAL.GetDataListAll("PSCUST IN ('" + MsOpSeae.CUSTOMERNAME + "','" + MsOpSeae.CARRIER + "')", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
2 years ago
_dmb = MsInfoClientDAL.GetSTLDATE(MsOpSeae.CUSTOMERNAME, "海运出口", MsOpSeae.ETD, MsOpSeae.SALE,MsOpSeae.CARRIER);
2 years ago
if (MsOpSeae.BLFRT.IndexOf("PREPAID") > 0) ismblfrt = true;
2 years ago
2 years ago
}
if (optype == "op_seai")
{
}
if (optype == "op_aire")
{
}
if (optype == "op_airi")
{
}
if (optype == "op_apply")
{
}
if (optype == "op_bulk")
{
}
if (optype == "op_other" || optype == "tmswlpchead" || optype == "opctnbscard" || optype == "import_main")
{
}
if (optype == "op_railway")
{
}
if (optype.ToLower() == "wms" || optype.ToLower() == "wms_in" || optype.ToLower() == "wms_out")
{
}
2 years ago
var cust = MsInfoClientDAL.GetData("SHORTNAME='" + customername + "'");
2 years ago
2 years ago
var crfeesum = new List<MsChFee>();
var drfeesum = new List<MsChFee>();
2 years ago
var feeCurrlist = MsChFeeDAL.GetFeeDateCurrList(optype, bsno, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
2 years ago
var isps = false;
var iscarrierhyf = false;
var ishps = false;
2 years ago
var sort = 0;
2 years ago
foreach (var crfee in CrChfeeList)
{
2 years ago
if (feeCurrlist.Find(x => x.CURR == crfee.Currency && crfee.ExChangerate != x.CRDEFRATE) != null)
{
error = error + "<br />应付汇率与默认汇率不一致";
2 years ago
}
2 years ago
if (crfee.FeeName == "P/S" || crfee.FeeName == "HP/S")
{
if (crfee.CustomerName != customername && crfee.CustomerName != carrier)
{
if (psclientlist.Find(x => x.SHORTNAME != crfee.CustomerName) == null)
{
error = error + "<br />P/S或者HP/S结算单位不相符";
2 years ago
}
}
2 years ago
if (crfee.Currency == "RMB")
{
error = error + "<br />PS或者HP/S不允许RMB币别";
2 years ago
}
2 years ago
2 years ago
if (crfee.FeeName == "HP/S") ishps = true;
2 years ago
if (crfee.FeeName == "P/S")
{
2 years ago
isps = true;
pscust = crfee.CustomerName;
}
}
2 years ago
2 years ago
var feecode = feecodelist.Find(x => x.NAME == crfee.FeeName);
2 years ago
2 years ago
if (feecode != null && !feecode.ISNOTPR)
2 years ago
{
2 years ago
var feesum = crfeesum.Find(x => x.FeeName == crfee.FeeName && x.Currency == crfee.Currency);
if (feesum == null)
{
var tmpfeesum = new MsChFee();
tmpfeesum.FeeName = crfee.FeeName;
tmpfeesum.Currency = crfee.Currency;
tmpfeesum.Amount = crfee.Amount;
tmpfeesum.ExChangerate = crfee.ExChangerate;
crfeesum.Add(tmpfeesum);
}
else
{
feesum.Amount = feesum.Amount + crfee.Amount;
}
2 years ago
}
2 years ago
if (crfee.FeeName == "海运费" && crfee.CustomerName == carrier)
{
2 years ago
iscarrierhyf = true;
}
2 years ago
}
2 years ago
2 years ago
foreach (var crfee in DrChfeeList)
{
if (feeCurrlist.Find(x => x.CURR == crfee.Currency && crfee.ExChangerate != x.CRDEFRATE) != null)
2 years ago
{
2 years ago
error = error + "<br />应收汇率与默认汇率不一致";
2 years ago
}
2 years ago
var feesum = drfeesum.Find(x => x.FeeName == crfee.FeeName && x.Currency == crfee.Currency);
if (feesum == null)
{
var tmpfeesum = new MsChFee();
tmpfeesum.FeeName = crfee.FeeName;
tmpfeesum.Currency = crfee.Currency;
tmpfeesum.Amount = crfee.Amount;
tmpfeesum.ExChangerate = crfee.ExChangerate;
drfeesum.Add(tmpfeesum);
}
else
{
feesum.Amount = feesum.Amount + crfee.Amount;
}
2 years ago
}
2 years ago
decimal psbl = 0;
2 years ago
2 years ago
if (!string.IsNullOrEmpty(pscust))
2 years ago
{
var clientpslist = MsInfoClientDAL.GetPSDataList("CUSTNAME='" + pscust + "'");
if (clientpslist.Count == 1) { psbl = clientpslist[0].PS; }
2 years ago
else
{
2 years ago
foreach (var clientps in clientpslist)
{
2 years ago
if (!string.IsNullOrEmpty(clientps.SALEDEPT) && clientps.SALEDEPT == saledept)
{
2 years ago
psbl = clientps.PS;
break;
}
2 years ago
}
2 years ago
if (clientpslist.Count > 1 && psbl == 0) psbl = clientpslist[0].PS;
2 years ago
}
2 years ago
2 years ago
}
if (isps && psbl == 0) {
var clientpslist = MsInfoClientDAL.GetPSDataList("CUSTNAME in (select PSCUST from info_client where shortname='" + pscust + "')");
if (clientpslist.Count == 1) { psbl = clientpslist[0].PS; }
else
{
foreach (var clientps in clientpslist)
{
if (!string.IsNullOrEmpty(clientps.SALEDEPT) && clientps.SALEDEPT == saledept)
{
psbl = clientps.PS;
break;
}
}
if (clientpslist.Count > 1 && psbl == 0) psbl = clientpslist[0].PS;
}
2 years ago
}
2 years ago
2 years ago
var isfindhyf = false;
2 years ago
foreach (var crfee in crfeesum)
{
2 years ago
2 years ago
var feesum = drfeesum.Find(x => x.FeeName == crfee.FeeName && x.Currency == crfee.Currency);
2 years ago
if (feesum != null)
{
2 years ago
if (!cust.ISNOTPR)
{
2 years ago
if (feesum.Amount < crfee.Amount)
{
2 years ago
error = error + "<br />费用名称【" + crfee.FeeName + "】应付小于应收";
2 years ago
}
}
2 years ago
if (feesum.FeeName == "海运费" && feesum.Currency == "USD")
{
if (isps && feesum.Amount > crfee.Amount)
{
2 years ago
isfindhyf = true;
}
}
}
2 years ago
else
{
2 years ago
if (!cust.ISNOTPR)
{
2 years ago
error = error + "<br />费用名称【" + crfee.FeeName + "】应付小于应收";
2 years ago
}
}
}
2 years ago
if (isps && !isfindhyf)
{
error = error + "<br />海运费USD利润是0存在PS";
2 years ago
}
2 years ago
2 years ago
if (!string.IsNullOrEmpty(error))
{
2 years ago
DBResult result2 = new DBResult();
result2.Success = false;
result2.Message = error;
var json2 = JsonConvert.Serialize(result2);
return new ContentResult() { Content = json2 };
}
2 years ago
if (ismblfrt &&!iscarrierhyf)
2 years ago
{
sort = sort + 1;
var audit = new MsOpAuditDetail();
audit.SORT = sort;
audit.AUDITDETAILID = "SEA001";
audit.AUDITTYPE = "0";
audit.ERRMSG = "主单付费方式是预付,但不存在付船公司海运费!";
audit.ERRDATA = "";
auditlist.Add(audit);
}
2 years ago
if (ishps)
2 years ago
{
2 years ago
sort = sort + 1;
var audit = new MsOpAuditDetail();
audit.SORT = sort;
audit.AUDITDETAILID = "SEA002";
audit.AUDITTYPE = "0";
audit.ERRMSG = "存在高收退费!";
audit.ERRDATA = "";
auditlist.Add(audit);
}
var profitstatus = "正常";
var feettlsum = MsChFeeDAL.GetttlGainList("BSNO='" + pbsno + "'");
2 years ago
if ((feettlsum.TTLDR - feettlsum.TTLCR)<0M) profitstatus = "为负";
if ((feettlsum.TTLDR - feettlsum.TTLCR)==0M) profitstatus = "为零";
2 years ago
if (feettlsum.TTLDR != 0)
{
2 years ago
if (((feettlsum.TTLDR - feettlsum.TTLCR) / feettlsum.TTLDR) > 0.4M) profitstatus = "过高";
if (((feettlsum.TTLDR - feettlsum.TTLCR) / feettlsum.TTLDR) < 0.02M) profitstatus = "过低";
2 years ago
if (profitstatus != "正常")
{
2 years ago
var audit = new MsOpAuditDetail();
audit.SORT = sort;
audit.AUDITDETAILID = "SEA005";
audit.AUDITTYPE = "0";
2 years ago
audit.ERRMSG = "利润"+profitstatus;
2 years ago
audit.ERRDATA = "";
auditlist.Add(audit);
}
}
2 years ago
if (isps)
{
if ((feettlsum.TTLCR - feettlsum.NOPSTTLCR) > ((feettlsum.TTLDR - feettlsum.NOPSTTLCR) * psbl))
{
2 years ago
if (profitstatus == "正常")
{
sort = sort + 1;
var audit = new MsOpAuditDetail();
audit.SORT = sort;
audit.AUDITDETAILID = "SEA003";
audit.AUDITTYPE = "0";
audit.ERRMSG = "PS分成比例高公司实际分成比例" + psbl;
audit.ERRDATA = "";
auditlist.Add(audit);
}
2 years ago
else
{
2 years ago
profitstatus = profitstatus + "利润分成不成正比,公司实际分成比例" + psbl;
2 years ago
sort = sort + 1;
var audit = new MsOpAuditDetail();
audit.SORT = sort;
audit.AUDITDETAILID = "SEA006";
audit.AUDITTYPE = "0";
audit.ERRMSG = profitstatus;
audit.ERRDATA = "";
auditlist.Add(audit);
}
}
}
2 years ago
if (_dmb.ALLOWAMOUNT != 0)
{
if (feettlsum.TTLDR > _dmb.ALLOWAMOUNT)
{
2 years ago
sort = sort + 1;
var audit = new MsOpAuditDetail();
audit.SORT = sort;
audit.AUDITDETAILID = "SEA004";
audit.AUDITTYPE = "0";
audit.ERRMSG = "单票应收费用超过系统限额RMB请及时收款";
audit.ERRDATA = "";
auditlist.Add(audit);
}
}
2 years ago
2 years ago
Chfee_AuditDAL.SaveUpdateAudit("", bsno, Convert.ToString(Session["SHOWNAME"]), profitstatus);
2 years ago
2 years ago
if (auditlist.Count != 0)
{
DBResult result2 = new DBResult();
result2.Success = false;
result2.Message = "";
result2.Data = auditlist.ToList();
var json2 = JsonConvert.Serialize(result2);
2 years ago
return new ContentResult() { Content = json2 };
}
2 years ago
2 years ago
var SUBMITFEEBLFEELOCK = MsSysParamSetDAL.GetData("PARAMNAME='SUBMITFEEBLFEELOCK'");
var BLAUDITISSEFT = MsSysParamSetDAL.GetData("PARAMNAME='BLAUDITISSEFT'");
if (BLAUDITISSEFT.PARAMVALUE == "1")
{
var billlist = Chfee_AuditDAL.GetBillDataList("MASTERNO='" + bsno + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), null, true);
2 years ago
foreach (var bill in billlist)
{
if (bill.BillFeeStatus == "2" || bill.BillFeeStatus == "1")
{
2 years ago
DBResult result2 = new DBResult();
result2.Success = false;
result2.Message = "当前状态无法提交整票审核!";
var json2 = JsonConvert.Serialize(result2);
return new ContentResult() { Content = json2 };
}
}
2 years ago
DBResult resultbl = Chfee_AuditDAL.SubmitAuditBL(Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), billlist, true, "", "", Convert.ToString(Session["COMPANYID"]),"1");
2 years ago
var jsonbl = JsonConvert.Serialize(resultbl);
return new ContentResult() { Content = jsonbl };
2 years ago
}
2 years ago
#endregion
//解决整票状态更新成功,但引无提交数据的报错
2 years ago
DBResult result = new DBResult();
2 years ago
result.Success = true;
2 years ago
result.Message = "";
2 years ago
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
2 years ago
}
public ContentResult SubmitAuditBL(string feebody, string optype, string bsno = "", string shenremarks = "")
2 years ago
{
var MsOpAuditDetailList = JsonConvert.Deserialize<List<MsOpAuditDetail>>(feebody);
2 years ago
if (MsOpAuditDetailList.Count != 0)
{
Chfee_AuditDAL.SaveUpdateAuditDetail(MsOpAuditDetailList, bsno, Convert.ToString(Session["SHOWNAME"]));
2 years ago
}
Chfee_AuditDAL.SaveUpdateAudit(shenremarks, bsno, Convert.ToString(Session["SHOWNAME"]));
var billlist = Chfee_AuditDAL.GetBillDataList("MASTERNO='" + bsno + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), null, true);
2 years ago
foreach (var bill in billlist)
{
if (bill.BillFeeStatus == "2" || bill.BillFeeStatus == "1")
{
DBResult result2 = new DBResult();
result2.Success = false;
result2.Message = "当前状态无法提交整票审核!";
var json2 = JsonConvert.Serialize(result2);
return new ContentResult() { Content = json2 };
2 years ago
2 years ago
}
2 years ago
}
var SUBMITFEEBLFEELOCK = MsSysParamSetDAL.GetData("PARAMNAME='SUBMITFEEBLFEELOCK'");
DBResult resultbl = Chfee_AuditDAL.SubmitAuditBL(Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), billlist, true, "", "", Convert.ToString(Session["COMPANYID"]), SUBMITFEEBLFEELOCK.PARAMVALUE);
var jsonbl = JsonConvert.Serialize(resultbl);
return new ContentResult() { Content = jsonbl };
2 years ago
}
public ContentResult SubmitAuditBLAmend(string feebody, string optype, string bsno = "")
2 years ago
{
string mblnotemp = "";
var SUBMITBILLFEEISNOTZERO = MsSysParamSetDAL.GetData("PARAMNAME='SUBMITBILLFEEISNOTZERO'");
if (SUBMITBILLFEEISNOTZERO.PARAMVALUE == "1")
{
var FEEMANGERMUSTBE = MsSysParamSetDAL.GetData("PARAMNAME='FEEMANGERMUSTBE'");
bool checkRst = MsOpSeaeDAL.CheckHasZeroFeeWithBsno("'" + bsno + "'", FEEMANGERMUSTBE.PARAMVALUE, out mblnotemp);
if (checkRst)
{
DBResult resultC = new DBResult();
resultC.Success = false;
if (FEEMANGERMUSTBE.PARAMVALUE == "1")
resultC.Message = "存在金额为0的或责任人为空的费用无法整票提交";
else
resultC.Message = "存在金额为0或申请修改、申请删除的费用无法整票提交";
var jsonC = JsonConvert.Serialize(resultC);
return new ContentResult() { Content = jsonC };
}
}
var SUBMITFEEBLFEELOCK = MsSysParamSetDAL.GetData("PARAMNAME='SUBMITFEEBLFEELOCK'");
var BLAUDITISSEFT = MsSysParamSetDAL.GetData("PARAMNAME='BLAUDITISSEFT'");
if (BLAUDITISSEFT.PARAMVALUE == "1")
{
2 years ago
var billlist = Chfee_AuditDAL.GetBillDataList("V_OP_BILL.BSNO='" + bsno + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), null, true);
2 years ago
DBResult resultbl = Chfee_AuditDAL.SubmitAuditBL(Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), billlist, true, "", "", Convert.ToString(Session["COMPANYID"]), SUBMITFEEBLFEELOCK.PARAMVALUE);
var jsonbl = JsonConvert.Serialize(resultbl);
return new ContentResult() { Content = jsonbl };
}
var ISSALEWORK = CookieConfig.GetCookie_ISSALEWORK(Request);
var workflowstr = "";
var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
if (AMENDSELFWORK.PARAMVALUE == "1") workflowstr = "AmendFeefyAudit";
var billData = JsonConvert.Deserialize<List<MsChFee>>(feebody);
DBResult result = Chfee_AuditDAL.SubmitAuditNew(optype, Convert.ToString(Session["USERID"]), billData, true, workflowstr, ISSALEWORK, Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
2 years ago
public ContentResult GetAuditDetailDataList(string condition, string sort)
{
var dataList = Chfee_AuditDAL.GetAuditDetailDataList( condition, sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
2 years ago
public ContentResult CancelAuditBL(string bsno)
{
2 years ago
var billlist = Chfee_AuditDAL.GetBillDataList("V_OP_BILL.BSNO='" + bsno + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), null, true);
2 years ago
DBResult result = Chfee_AuditDAL.CancelAuditBL(Convert.ToString(Session["USERID"]), billlist);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SelAuditBL(string data, string worktype = "")
{
var billData = JsonConvert.Deserialize<List<MsOpBill>>(data);
var billlist = new List<MsOpBill>();
foreach (var items in billData)
{
if (items.BLTYPE.IndexOf("主票") > 0 && items.OPTYPE != "更改单")
{
2 years ago
var fenlist = Chfee_AuditDAL.GetBillDataList("MASTERNO='" + items.BSNO + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), null, true);
foreach (var fen in fenlist)
{
2 years ago
billlist.Add(fen);
}
}
else
billlist.Add(items);
2 years ago
}
DBResult result = null;
result = Chfee_AuditDAL.AuditListBL(Convert.ToString(Session["USERID"]), billlist, Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SelAuditBackBL(string data, string worktype = "", string reason = "", string tz = "")
2 years ago
{
var billData = JsonConvert.Deserialize<List<MsOpBill>>(data);
DBResult result = null;
var billlist = new List<MsOpBill>();
foreach (var items in billData)
{
if (items.BLTYPE.IndexOf("主票") > 0 && items.OPTYPE != "更改单")
2 years ago
{
var fenlist = Chfee_AuditDAL.GetBillDataList("MASTERNO='" + items.BSNO + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), null, true);
foreach (var fen in fenlist)
{
billlist.Add(fen);
}
}
else
billlist.Add(items);
}
result = Chfee_AuditDAL.AuditBackBL(Convert.ToString(Session["USERID"]), billlist, reason, Convert.ToString(Session["SHOWNAME"]), tz);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SubmitAuditBLYj(string feebody, string optype)
{
var ISSALEWORK = CookieConfig.GetCookie_ISSALEWORK(Request);
var billData = JsonConvert.Deserialize<List<MsChFee>>(feebody);
DBResult result = Chfee_AuditDAL.SubmitAuditNew(optype, Convert.ToString(Session["USERID"]), billData, true, "YjFeefyAudit", ISSALEWORK, Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult GetErrorFeeMbl(string bsnos, string optype, int feetype)
{
DBResult result = Chfee_AuditDAL.GetErrorFeeMbl(optype, bsnos, feetype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult PiliangSubmitAudit(string bsnos, string optype, int feetype)
{
var ISSALEWORK = CookieConfig.GetCookie_ISSALEWORK(Request);
DBResult result = Chfee_AuditDAL.piliangSubmitAudit(optype, bsnos, feetype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), ISSALEWORK);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult PiliangSubmitAuditlist(string bsnos1, string bsnos2, string bsnos3, string bsnos4, string bsnos5, string optype, int feetype)
{
DBResult result = null;
var ISSALEWORK = CookieConfig.GetCookie_ISSALEWORK(Request);
2 years ago
if (bsnos1 != "")
{
bsnos1 = " BSNO IN (" + bsnos1 + ")";
result = Chfee_AuditDAL.piliangSubmitAudit(optype, bsnos1, feetype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), ISSALEWORK);
}
if (bsnos2 != "")
{
bsnos2 = " BSNO IN (" + bsnos2 + ")";
result = Chfee_AuditDAL.piliangSubmitAudit(optype, bsnos2, feetype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), ISSALEWORK);
}
if (bsnos3 != "")
{
bsnos3 = " BSNO IN (" + bsnos3 + ")";
2 years ago
result = Chfee_AuditDAL.piliangSubmitAudit(optype, bsnos3, feetype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), ISSALEWORK);
}
if (bsnos4 != "")
{
bsnos4 = " BSNO IN (" + bsnos4 + ")";
result = Chfee_AuditDAL.piliangSubmitAudit(optype, bsnos4, feetype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), ISSALEWORK);
}
if (bsnos5 != "")
{
bsnos5 = " BSNO IN (" + bsnos5 + ")";
result = Chfee_AuditDAL.piliangSubmitAudit(optype, bsnos5, feetype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), ISSALEWORK);
}
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
//public ContentResult PiliangSubmitAuditlist(string bill, string optype, int feetype)
//{
// var billList = JsonConvert.Deserialize<List<MsOpBill>>(bill);
// DBResult result = Chfee_AuditDAL.piliangSubmitAuditlist(optype, billList, feetype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
// var json = JsonConvert.Serialize(result);
// return new ContentResult() { Content = json };
//}
public ContentResult CancelAudit(string GidStr, string optype)
{
var ISSALEWORK = CookieConfig.GetCookie_ISSALEWORK(Request);
//DBResult result = Chfee_AuditDAL.CancelAudit(optype, Convert.ToString(Session["DEPTGID"]), Convert.ToString(Session["USERID"]), GidStr);
DBResult result = Chfee_AuditDAL.CancelAudit(optype, Convert.ToString(Session["USERID"]), GidStr, "", ISSALEWORK);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult CancelAuditAmend(string GidStr, string optype)
{
var ISSALEWORK = CookieConfig.GetCookie_ISSALEWORK(Request);
var workflowstr = "";
var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
if (AMENDSELFWORK.PARAMVALUE == "1") workflowstr = "AmendFeefyAudit";
DBResult result = Chfee_AuditDAL.CancelAudit(optype, Convert.ToString(Session["USERID"]), GidStr, workflowstr, ISSALEWORK);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult CancelAuditYj(string GidStr, string optype)
{
var ISSALEWORK = CookieConfig.GetCookie_ISSALEWORK(Request);
DBResult result = Chfee_AuditDAL.CancelAudit(optype, Convert.ToString(Session["USERID"]), GidStr, "YjFeefyAudit", ISSALEWORK);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult ShenModify(string data, string olddata, string optype, string isamend = "", string isyj = "0")
2 years ago
{
var NewFee = JsonConvert.Deserialize<MsChFee>(data);
var OldFee = JsonConvert.Deserialize<MsChFee>(olddata);
var ISSALEWORK = CookieConfig.GetCookie_ISSALEWORK(Request);
var workflowstr = "";
if (isamend == "1")
{
var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
if (AMENDSELFWORK.PARAMVALUE == "1") workflowstr = "AmendFeefyAudit";
}
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var BLCOUNT2 = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from info_client WHERE ISNULL(ISSTOP,0)=0 AND SHORTNAME='" + NewFee.CustomerName + "'");
if (BLCOUNT2 == "0")
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "客户名称:" + NewFee.CustomerName + " ,系统中不可用,请检查!",
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
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='" + NewFee.BsNo + "'");
if (BLCOUNT == "1")
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "已费用锁定,不允许添加修改费用!",
};
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='" + NewFee.BsNo + "'");
if (Convert.ToDateTime(nowperiod + "-01") > Convert.ToDateTime(ACCDATE + "-01"))
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "已月末结转,不允许添加修改费用!",
};
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='" + NewFee.BsNo + "'");
if (BLCOUNT == "1")
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "已费用锁定,不允许添加修改费用!",
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
}
DBResult result = Chfee_AuditDAL.ShenModify(NewFee, OldFee, Convert.ToString(Session["USERID"]), optype, Convert.ToString(Session["COMPANYID"]), workflowstr, ISSALEWORK);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult ShenDelete(string data, string optype, string isamend = "", string isyj = "0")
{
var OldFee = JsonConvert.Deserialize<MsChFee>(data);
var workflowstr = "";
if (isamend == "1")
{
var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
if (AMENDSELFWORK.PARAMVALUE == "1") workflowstr = "AmendFeefyAudit";
}
T_ALL_DA T_ALL_DA = new T_ALL_DA();
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='" + OldFee.BsNo + "'");
if (BLCOUNT == "1")
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "已费用锁定,不允许添加修改费用!",
};
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='" + OldFee.BsNo + "'");
if (Convert.ToDateTime(nowperiod + "-01") > Convert.ToDateTime(ACCDATE + "-01"))
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "已月末结转,不允许添加修改费用!",
};
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='" + OldFee.BsNo + "'");
if (BLCOUNT == "1")
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "已费用锁定,不允许添加修改费用!",
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
}
var ISSALEWORK = CookieConfig.GetCookie_ISSALEWORK(Request);
DBResult result = Chfee_AuditDAL.ShenDelete(OldFee, Convert.ToString(Session["USERID"]), optype, Convert.ToString(Session["COMPANYID"]), workflowstr, ISSALEWORK);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult ShenDeleteList(string data, string feedata, string optype, string isamend = "", string isyj = "0")
{
var OldFee = JsonConvert.Deserialize<MsChFee>(data);
var FeeList = JsonConvert.Deserialize<List<MsChFee>>(feedata);
var workflowstr = "";
if (isamend == "1")
{
var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
if (AMENDSELFWORK.PARAMVALUE == "1") workflowstr = "AmendFeefyAudit";
}
T_ALL_DA T_ALL_DA = new T_ALL_DA();
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='" + OldFee.BsNo + "'");
if (BLCOUNT == "1")
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "已费用锁定,不允许添加修改费用!",
};
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='" + OldFee.BsNo + "'");
if (Convert.ToDateTime(nowperiod + "-01") > Convert.ToDateTime(ACCDATE + "-01"))
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "已月末结转,不允许添加修改费用!",
};
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='" + OldFee.BsNo + "'");
if (BLCOUNT == "1")
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "已费用锁定,不允许添加修改费用!",
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
}
var ISSALEWORK = CookieConfig.GetCookie_ISSALEWORK(Request);
DBResult result = Chfee_AuditDAL.ShenDeleteList(OldFee, FeeList, Convert.ToString(Session["USERID"]), optype, Convert.ToString(Session["COMPANYID"]), workflowstr, ISSALEWORK);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult CancelShen(string Feeid, string optype, string isamend = "", string isopen = "")
2 years ago
{
var workflowstr = "";
if (isamend == "1")
{
var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
if (AMENDSELFWORK.PARAMVALUE == "1") workflowstr = "AmendFeefyAudit";
}
var ISSALEWORK = CookieConfig.GetCookie_ISSALEWORK(Request);
DBResult result = Chfee_AuditDAL.CancelShen(Feeid, optype, Convert.ToString(Session["USERID"]), workflowstr, ISSALEWORK, isopen);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult AuditBackShen(String optype, string bill, string reasean, string isamend = "")
{
var billData = JsonConvert.Deserialize<List<MsChFee>>(bill);
var workflowstr = "";
if (isamend == "1")
{
var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
if (AMENDSELFWORK.PARAMVALUE == "1") workflowstr = "AmendFeefyAudit";
}
DBResult result = Chfee_AuditDAL.AuditBackShen(optype, Convert.ToString(Session["USERID"]), billData, reasean, workflowstr);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult AuditShen(String optype, String bill, int Feestatus, string bsno, string isamend = "")
{
var workflowstr = "";
if (isamend == "1")
{
var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
if (AMENDSELFWORK.PARAMVALUE == "1") workflowstr = "AmendFeefyAudit";
}
DBResult result = Chfee_AuditDAL.AuditShen(optype, Convert.ToString(Session["USERID"]), bill, Feestatus, bsno, workflowstr);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult AuditShenNew(String optype, String bill, string isamend = "")
{
var billData = JsonConvert.Deserialize<List<MsChFee>>(bill);
var workflowstr = "";
if (isamend == "1")
{
var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
if (AMENDSELFWORK.PARAMVALUE == "1") workflowstr = "AmendFeefyAudit";
}
DBResult result = Chfee_AuditDAL.AuditShenNew(optype, Convert.ToString(Session["USERID"]), billData, workflowstr);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult ShenNewCustName(String data, string CustomerName)
{
var billData = JsonConvert.Deserialize<List<MsChFee>>(data);
DBResult result = Chfee_AuditDAL.ShenNewCustName(billData, CustomerName, Convert.ToString(Session["USERID"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult ShenCF(string data, string bodylist)
{
var billData = JsonConvert.Deserialize<List<FeeCF>>(bodylist);
var FeeData = JsonConvert.Deserialize<MsChFee>(data);
DBResult result = Chfee_AuditDAL.ShenCF(FeeData, billData, Convert.ToString(Session["USERID"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult NoIvoice(String bill)
{
DBResult result = Chfee_AuditDAL.NoIvoice(bill);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SetIsOpen(string GidStr)
{
DBResult result = Chfee_AuditDAL.SetIsOpen(GidStr, true);
2 years ago
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult UpLock(string bsno, string optype)
{
var AuditAutoLock = MsSysParamSetDAL.GetData("PARAMNAME='AuditAutoLock'");
if (AuditAutoLock.PARAMVALUE != "1")
{
var jsonRespose = new JsonResponse
{
Success = true
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else
{
DBResult result = Chfee_AuditDAL.UpLock(bsno, optype);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
}
public ContentResult CancelNoIvoice(String bill)
{
DBResult result = Chfee_AuditDAL.CancelNoIvoice(bill);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SelAudit(string data, string worktype = "", string feesql = "")
{
var AuditAutoLock = MsSysParamSetDAL.GetData("PARAMNAME='AuditAutoLock'");
var workflowstr = "";
var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
if (AMENDSELFWORK.PARAMVALUE == "1") workflowstr = "AmendFeefyAudit";
var billData = JsonConvert.Deserialize<List<MsOpBill>>(data);
DBResult result = null;
foreach (var enumValue in billData)
{
if (enumValue.OPTYPE == "更改单" && AMENDSELFWORK.PARAMVALUE == "1") workflowstr = "AmendFeefyAudit"; else workflowstr = "";
result = Chfee_AuditDAL.PiliangAudit(enumValue.OPLB, enumValue.BSNO, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), workflowstr, worktype, enumValue.MBLNO, feesql);
if (result.Success == true)
{
2 years ago
if (AuditAutoLock.PARAMVALUE == "1")
2 years ago
{
Chfee_AuditDAL.UpLock(enumValue.BSNO, enumValue.OPLB);
}
}
}
2 years ago
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SelCtnBsCardAudit(string data)
{
var billData = JsonConvert.Deserialize<List<OpCtnBsCard>>(data);
DBResult result = null;
foreach (var enumValue in billData)
{
result = Chfee_AuditDAL.PiliangAudit("罐箱业务卡", enumValue.GID, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), "");
2 years ago
}
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult AllAudit(string condition, string worktype = "", string feesql = "")
{
var AuditAutoLock = MsSysParamSetDAL.GetData("PARAMNAME='AuditAutoLock'");
var workflowstr = "";
var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
if (AMENDSELFWORK.PARAMVALUE == "1") workflowstr = "AmendFeefyAudit";
var billData = Chfee_AuditDAL.GetBillDataList(0, 10000, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), null, true);
2 years ago
DBResult result = null;
foreach (var enumValue in billData)
{
if (enumValue.OPTYPE == "更改单" && AMENDSELFWORK.PARAMVALUE == "1") workflowstr = "AmendFeefyAudit"; else workflowstr = "";
result = Chfee_AuditDAL.PiliangAudit(enumValue.OPLB, enumValue.BSNO, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), workflowstr, worktype, feesql);
if (result.Success == true)
{
if (AuditAutoLock.PARAMVALUE == "1")
{
Chfee_AuditDAL.UpLock(enumValue.BSNO, enumValue.OPLB);
}
}
}
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult AllCtnBscardAudit(string condition)
{
var billData = MsOpCtnBsCardDAL.GetDataAllList(condition, "index", Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]));
2 years ago
DBResult result = null;
foreach (var enumValue in billData)
{
result = Chfee_AuditDAL.PiliangAudit("罐箱业务卡", enumValue.GID, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), "");
2 years ago
}
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
#region 参照部分
#endregion
}
}