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

1505 lines
76 KiB
C#

3 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;
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 = "")
{
var dataList = Chfee_AuditDAL.GetDataList(bsno, type, optype, isAll, condition,Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), worktype);
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)
{
var dataList = Chfee_AuditDAL.GetBillDataList(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 = 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"]));
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"]));
if (list.Count > 0)
head = list[0];
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";
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 = "")
{
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="")
{
DBResult result = Chfee_AuditDAL.SubmitAudit(optype, Convert.ToString(Session["USERID"]), GidStr, bsno,"", Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SubmitAuditAmend(string GidStr, string optype, string bsno = "")
{
//var workflowstr="";
//var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
//if (AMENDSELFWORK.PARAMVALUE == "1") workflowstr = "AmendFeefyAudit";
3 years ago
//DBResult result = Chfee_AuditDAL.SubmitAudit(optype, Convert.ToString(Session["USERID"]), GidStr, bsno, workflowstr, Convert.ToString(Session["COMPANYID"]));
3 years ago
//var json = JsonConvert.Serialize(result);
//return new ContentResult() { Content = json };
return SubmitAuditAmend_Object(GidStr, optype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]), bsno);
}
public ContentResult SubmitAuditAmend_Object(string GidStr, string optype,string USERID,string COMPANYID, string bsno = "")
{
var workflowstr = "";
var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
if (AMENDSELFWORK.PARAMVALUE == "1") workflowstr = "AmendFeefyAudit";
DBResult result = Chfee_AuditDAL.SubmitAudit(optype, USERID, GidStr, bsno, workflowstr, COMPANYID);
3 years ago
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="")
{
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"]));
3 years ago
if (billData != null&&bsno!="")
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var custstr = "";
foreach (var enumValue in billData)
{
1 year ago
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 + "')");
3 years ago
if (BLCOUNT2 == "0")
{
if (custstr == "") custstr = enumValue.CustomerName;
else custstr = custstr + "," + enumValue.CustomerName;
}
2 years ago
if (FEESUBMITSYNCEXCHANGE.PARAMVALUE == "1") {
if (enumValue.Currency != "RMB") {
var MsFeeCurr = MsFeeCurrList.Find(x=>x.CURR== enumValue.Currency);
if (MsFeeCurr != null) {
if (enumValue.FeeType == 1)
enumValue.ExChangerate = MsFeeCurr.DEFRATE;
else {
if (MsFeeCurr.CRDEFRATE!=0) enumValue.ExChangerate = MsFeeCurr.CRDEFRATE;
else enumValue.ExChangerate = MsFeeCurr.DEFRATE;
}
}
}
}
3 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)
{
1 year ago
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 + "')");
3 years ago
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="")
{
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);
if (billData != null && bsno != "")
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var custstr = "";
foreach (var enumValue in billData)
{
1 year ago
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 + "')");
3 years ago
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"]));
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 };
}
public ContentResult SubmitAuditBL(string feebody, string optype,string bsno="")
{
#region 2018年5月24日14:26:34 李进举 存在为0的费用弹出提示不允许提交
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")
{
var billlist = Chfee_AuditDAL.GetBillDataList("MASTERNO='" + bsno + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), null, true);
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 };
}
}
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 };
}
#endregion
var ISSALEWORK = CookieConfig.GetCookie_ISSALEWORK(Request);
#region 2018年2月5日 李进举 鼎世
T_ALL_DA T_ALL_DA = new T_ALL_DA();
//费用未更改的时候点击整票提交时触发以下操作(2018年2月28日17:50:58李进举 不加此限制)
//①根据系统参数判断是否进行费用锁定(2018年3月1日15:35:45 李进举 该参数不影响整票状态的操作)
//②发送消息
//③op_seae新增字段BillFeeStatus整票状态的值设置为1整票提交
try
{
if (bsno!=null&&bsno!="")
{
//if (feebody == "" || feebody == null)
if (true)
{
//更新【BillFeeStatus整票提交】的状态
string blUpSQL0 = "UPDATE " + optype + " SET BillFeeStatus=1 WHERE BSNO='" + bsno + "'";
bool bl0 = T_ALL_DA.GetExecuteSqlCommand(blUpSQL0);
//根据参数判断是否执行【锁定】操作
var SUBMITFEEBLBSLOCK = MsSysParamSetDAL.GetData("PARAMNAME='SUBMITFEEBLBSLOCK'");
if (SUBMITFEEBLFEELOCK.PARAMVALUE == "1"|| SUBMITFEEBLBSLOCK.PARAMVALUE == "1")
{
if (SUBMITFEEBLFEELOCK.PARAMVALUE == "1" && SUBMITFEEBLBSLOCK.PARAMVALUE == "1") {
string blUpSQL = "UPDATE " + optype + " SET BSSTATUS=1,FEESTATUS=1 WHERE BSNO='" + bsno + "'";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
} else if ( SUBMITFEEBLBSLOCK.PARAMVALUE == "1")
{
string blUpSQL = "UPDATE " + optype + " SET BSSTATUS=1 WHERE BSNO='" + bsno + "'";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
}
if (SUBMITFEEBLFEELOCK.PARAMVALUE == "1")
{
string blUpSQL = "UPDATE " + optype + " SET FEESTATUS=1 WHERE BSNO='" + bsno + "'";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
}
#region 发送消息
DataSet dsFenDan = T_ALL_DA.GetAllSQL("select top 1 MBLNO,(select top 1 GID from [user] where SHOWNAME=b.SALE) SALEID,(select top 1 GID from [user] where SHOWNAME=b.CUSTSERVICE) CUSTSERVICEID from v_op_bill b where bsno='" + bsno+ "'");
if (dsFenDan != null)
{
if (dsFenDan.Tables[0].Rows.Count > 0)
{
var mblno = dsFenDan.Tables[0].Rows[0]["MBLNO"].ToString();
var SALEID = dsFenDan.Tables[0].Rows[0]["SALEID"].ToString();
var CUSTSERVICEID = dsFenDan.Tables[0].Rows[0]["CUSTSERVICEID"].ToString();
string uname = CookieConfig.GetCookie_UserName(Request);
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "SubmitAudit";
Msgdata.DESCRIPTION = uname + "提交费用审核";
Msgdata.MESSAGECONTENT = uname + "提交费用审核," + " 提单号:" + mblno;
Msgdata.RECEIVER = SALEID;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID =bsno;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "SubmitAudit";
Msgdata.DESCRIPTION = uname + "提交费用审核";
Msgdata.MESSAGECONTENT = uname + "提交费用审核," + " 提单号:" + mblno;
Msgdata.RECEIVER = CUSTSERVICEID;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = bsno;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
Msgmodb.Save(Msgdata);
}
}
#endregion
//DBResult result1 = new DBResult();
//result1.Success = bl;
//result1.Message = bl?"业务提交成功":"业务提交失败";
//var json1 = JsonConvert.Serialize(result1);
//return new ContentResult() { Content = json1 };
}
else
{
//整票提交锁定费用参数为0时只发送消息
#region 发送消息
DataSet dsFenDan = T_ALL_DA.GetAllSQL("select top 1 MBLNO,(select top 1 GID from [user] where SHOWNAME=b.SALE) SALEID,(select top 1 GID from [user] where SHOWNAME=b.CUSTSERVICE) CUSTSERVICEID from v_op_bill b where bsno='" + bsno + "'");
if (dsFenDan != null)
{
if (dsFenDan.Tables[0].Rows.Count > 0)
{
var mblno = dsFenDan.Tables[0].Rows[0]["MBLNO"].ToString();
var SALEID = dsFenDan.Tables[0].Rows[0]["SALEID"].ToString();
var CUSTSERVICEID = dsFenDan.Tables[0].Rows[0]["CUSTSERVICEID"].ToString();
string uname = CookieConfig.GetCookie_UserName(Request);
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "SubmitAudit";
Msgdata.DESCRIPTION = uname + "提交费用审核";
Msgdata.MESSAGECONTENT = uname + "提交费用审核," + " 提单号:" + mblno;
Msgdata.RECEIVER = SALEID;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = bsno;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "SubmitAudit";
Msgdata.DESCRIPTION = uname + "提交费用审核";
Msgdata.MESSAGECONTENT = uname + "提交费用审核," + " 提单号:" + mblno;
Msgdata.RECEIVER = CUSTSERVICEID;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = bsno;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
Msgmodb.Save(Msgdata);
}
}
//DBResult result1 = new DBResult();
//result1.Success = true;
//result1.Message = "业务提交成功";
//var json1 = JsonConvert.Serialize(result1);
//return new ContentResult() { Content = json1 };
#endregion
}
}
}
}
catch (Exception)
{
}
#endregion
var billData = JsonConvert.Deserialize<List<MsChFee>>(feebody);
var USEBLFeeAudit = MsSysParamSetDAL.GetData("PARAMNAME='USEBLFeeAudit'");
var WorkFlowName = "";
if (USEBLFeeAudit.PARAMVALUE == "1")
{
WorkFlowName = "BLFeeAudit";
}
DBResult result = Chfee_AuditDAL.SubmitAuditNew(optype, Convert.ToString(Session["USERID"]), billData, true, WorkFlowName, ISSALEWORK, Convert.ToString(Session["COMPANYID"]));
if (result.Success)
{
#region 运踪相关
try
{
MsOpStatusNewDAL mdal = new MsOpStatusNewDAL();
string uname = CookieConfig.GetCookie_UserName(Request);
mdal.UpdateMainStatus(billData[0].BsNo, 5, uname);
}
catch (Exception)
{
}
#endregion
var SUBMITFEEBLBSLOCK = MsSysParamSetDAL.GetData("PARAMNAME='SUBMITFEEBLBSLOCK'");
if (SUBMITFEEBLFEELOCK.PARAMVALUE == "1" || SUBMITFEEBLBSLOCK.PARAMVALUE == "1")
{
if (SUBMITFEEBLFEELOCK.PARAMVALUE == "1" && SUBMITFEEBLBSLOCK.PARAMVALUE == "1")
{
string blUpSQL = "UPDATE " + optype + " SET BSSTATUS=1,FEESTATUS=1,BillFeeStatus=1 WHERE BSNO='" + bsno + "'";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
}
else if (SUBMITFEEBLBSLOCK.PARAMVALUE == "1")
{
string blUpSQL = "UPDATE " + optype + " SET BSSTATUS=1,BillFeeStatus=1 WHERE BSNO='" + bsno + "'";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
}
if (SUBMITFEEBLFEELOCK.PARAMVALUE == "1")
{
string blUpSQL = "UPDATE " + optype + " SET FEESTATUS=1,BillFeeStatus=1 WHERE BSNO='" + bsno + "'";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
}
//2018年2月7日 李进举 鼎世 增加 BillFeeStatus字段更新
//string blUpSQL = "UPDATE " + optype + " SET FEESTATUS=1 WHERE BSNO='" + billData[0].BsNo + "'";
//string blUpSQL = "UPDATE " + optype + " SET FEESTATUS=1,BillFeeStatus=1 WHERE BSNO='" + billData[0].BsNo + "'";
//bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
DataSet dsFenDan = T_ALL_DA.GetAllSQL("select top 1 MBLNO,(select top 1 GID from [user] where SHOWNAME=b.SALE) SALEID,(select top 1 GID from [user] where SHOWNAME=b.CUSTSERVICE) CUSTSERVICEID,CUSTOMERNAME,BSSOURCE from v_op_bill b where bsno='" + billData[0].BsNo + "'");
if (dsFenDan != null)
{
if (dsFenDan.Tables[0].Rows.Count > 0)
{
var mblno = dsFenDan.Tables[0].Rows[0]["MBLNO"].ToString();
var SALEID = dsFenDan.Tables[0].Rows[0]["SALEID"].ToString();
var CUSTSERVICEID = dsFenDan.Tables[0].Rows[0]["CUSTSERVICEID"].ToString();
string uname = CookieConfig.GetCookie_UserName(Request);
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "SubmitAudit";
Msgdata.DESCRIPTION = uname + "提交费用审核";
Msgdata.MESSAGECONTENT = uname + "提交费用审核," + " 提单号:" + mblno + " 客户:" + dsFenDan.Tables[0].Rows[0]["CUSTOMERNAME"].ToString() + " 业务来源:" + dsFenDan.Tables[0].Rows[0]["BSSOURCE"].ToString();
Msgdata.RECEIVER = SALEID;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = billData[0].BsNo;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.ISSEND = "0";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "SubmitAudit";
Msgdata.DESCRIPTION = uname + "提交费用审核";
Msgdata.MESSAGECONTENT = uname + "提交费用审核," + " 提单号:" + mblno + " 客户:" + dsFenDan.Tables[0].Rows[0]["CUSTOMERNAME"].ToString() + " 业务来源:" + dsFenDan.Tables[0].Rows[0]["BSSOURCE"].ToString();
Msgdata.RECEIVER = CUSTSERVICEID;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = billData[0].BsNo;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.ISSEND = "0";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
Msgmodb.Save(Msgdata);
}
}
}
else
{
//2018年2月5日11:20:26 李进举 鼎世 整票提交锁定参数为0时也发送消息
//2018年2月7日09:30:56 李进举 鼎世 整条提交锁定参数为0时仍然修改BillFeeStatus
string blUpSQL2 = "UPDATE " + optype + " SET BillFeeStatus=1 WHERE BSNO='" + bsno + "'";
bool bl2 = T_ALL_DA.GetExecuteSqlCommand(blUpSQL2);
DataSet dsFenDan = T_ALL_DA.GetAllSQL("select top 1 MBLNO,(select top 1 GID from [user] where SHOWNAME=b.SALE) SALEID,(select top 1 GID from [user] where SHOWNAME=b.CUSTSERVICE) CUSTSERVICEID,CUSTOMERNAME,BSSOURCE from v_op_bill b where bsno='" + billData[0].BsNo + "'");
if (dsFenDan != null)
{
if (dsFenDan.Tables[0].Rows.Count > 0)
{
var mblno = dsFenDan.Tables[0].Rows[0]["MBLNO"].ToString();
var SALEID = dsFenDan.Tables[0].Rows[0]["SALEID"].ToString();
var CUSTSERVICEID = dsFenDan.Tables[0].Rows[0]["CUSTSERVICEID"].ToString();
string uname = CookieConfig.GetCookie_UserName(Request);
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "SubmitAudit";
Msgdata.DESCRIPTION = uname + "提交费用审核";
Msgdata.MESSAGECONTENT = uname + "提交费用审核," + " 提单号:" + mblno+" 客户:"+ dsFenDan.Tables[0].Rows[0]["CUSTOMERNAME"].ToString()+" 业务来源:"+ dsFenDan.Tables[0].Rows[0]["BSSOURCE"].ToString();
Msgdata.RECEIVER = SALEID;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = billData[0].BsNo;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.ISSEND = "0";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "SubmitAudit";
Msgdata.DESCRIPTION = uname + "提交费用审核";
Msgdata.MESSAGECONTENT = uname + "提交费用审核," + " 提单号:" + mblno + " 客户:" + dsFenDan.Tables[0].Rows[0]["CUSTOMERNAME"].ToString() + " 业务来源:" + dsFenDan.Tables[0].Rows[0]["BSSOURCE"].ToString();
Msgdata.RECEIVER = CUSTSERVICEID;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = billData[0].BsNo;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.ISSEND = "0";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
Msgmodb.Save(Msgdata);
}
}
}
}
//解决整票状态更新成功,但引无提交数据的报错
result.Success = true;
result.Message = "提交数据处理异常!";
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SubmitAuditBLAmend(string feebody, string optype,string bsno="")
{
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")
{
var billlist = Chfee_AuditDAL.GetBillDataList("BSNO='" + bsno + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), null, true);
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 };
}
public ContentResult CancelAuditBL(string bsno)
{
var billlist = Chfee_AuditDAL.GetBillDataList("BSNO='" + bsno + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), null, true);
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!="更改单") {
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);
}
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="")
{
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!="更改单")
{
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);
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 + ")";
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")
{
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="")
{
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);
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) {
if (AuditAutoLock.PARAMVALUE== "1")
{
Chfee_AuditDAL.UpLock(enumValue.BSNO, enumValue.OPLB);
}
}
}
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"]),"");
}
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);
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"]));
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"]),"");
}
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
#region 参照部分
#endregion
}
}