From 8998fbc262a06b2f3dc2a7a1d54790c00753dab4 Mon Sep 17 00:00:00 2001 From: hanxuntao <641739520@qq.com> Date: Mon, 9 Jan 2023 09:21:22 +0800 Subject: [PATCH] 1 --- .../Chfee_PayapplicationDAL.cs | 70 +++++---- .../Controllers/MsChFeeController.cs | 33 +++- .../MvcShipping/DAL/MsChFee/MsChFeeDAL.cs | 143 +++++++++++------- 3 files changed, 159 insertions(+), 87 deletions(-) diff --git a/DSWeb/Areas/Account/DAL/Chfee_payapplication/Chfee_PayapplicationDAL.cs b/DSWeb/Areas/Account/DAL/Chfee_payapplication/Chfee_PayapplicationDAL.cs index f6351eec..f6079b84 100644 --- a/DSWeb/Areas/Account/DAL/Chfee_payapplication/Chfee_PayapplicationDAL.cs +++ b/DSWeb/Areas/Account/DAL/Chfee_payapplication/Chfee_PayapplicationDAL.cs @@ -2445,23 +2445,27 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication if (result.Success) { - var _r = FanWeiOA_Submit(headdata, USERID, usercode, companyid); - - if (!_r.Success) + if (ConfigurationManager.AppSettings["FanWeiOAAPI"] == "true") { - tran.Rollback(); - result.Success = false; - result.Message = $"提交审核错误[{_r.Message}],请重试或联系系统管理员"; + var _r = FanWeiOA_Submit(headdata, USERID, usercode, companyid); - return result; - } - else { - var requestid = result.Data.ToString(); + if (!_r.Success) + { + tran.Rollback(); + result.Success = false; + result.Message = $"提交审核错误[{_r.Message}],请重试或联系系统管理员"; - var cmdupdate = db.GetSqlStringCommand("update ch_fee_payapplication set PAYAPPID='"+ requestid + "' where BILLNO=@BILLNO"); - cmdupdate.Parameters.Clear(); - db.AddInParameter(cmdupdate, "@BILLNO", DbType.String, bill); - db.ExecuteNonQuery(cmdupdate, tran); + return result; + } + else + { + var requestid = result.Data.ToString(); + + var cmdupdate = db.GetSqlStringCommand("update ch_fee_payapplication set PAYAPPID='" + requestid + "' where BILLNO=@BILLNO"); + cmdupdate.Parameters.Clear(); + db.AddInParameter(cmdupdate, "@BILLNO", DbType.String, bill); + db.ExecuteNonQuery(cmdupdate, tran); + } } } tran.Commit(); @@ -2619,26 +2623,32 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication } } } - - foreach (var headdata in oacommitList) { - var _r =FanWeiOA_Submit(headdata, USERID, usercode, companyid); + if (ConfigurationManager.AppSettings["FanWeiOAAPI"] == "true") + { + foreach (var headdata in oacommitList) + { - if (!_r.Success) { - tran.Rollback(); - result.Success = false; - result.Message = $"提交审核错误[{_r.Message}],请重试或联系系统管理员"; - return result; - } - else - { - var requestid = _r.Data.ToString(); + var _r = FanWeiOA_Submit(headdata, USERID, usercode, companyid); - var cmdupdate = db.GetSqlStringCommand("update ch_fee_payapplication set PAYAPPID='" + requestid + "' where BILLNO=@BILLNO"); - cmdupdate.Parameters.Clear(); - db.AddInParameter(cmdupdate, "@BILLNO", DbType.String, headdata.BILLNO); - db.ExecuteNonQuery(cmdupdate, tran); + if (!_r.Success) + { + tran.Rollback(); + result.Success = false; + result.Message = $"提交审核错误[{_r.Message}],请重试或联系系统管理员"; + + return result; + } + else + { + var requestid = _r.Data.ToString(); + + var cmdupdate = db.GetSqlStringCommand("update ch_fee_payapplication set PAYAPPID='" + requestid + "' where BILLNO=@BILLNO"); + cmdupdate.Parameters.Clear(); + db.AddInParameter(cmdupdate, "@BILLNO", DbType.String, headdata.BILLNO); + db.ExecuteNonQuery(cmdupdate, tran); + } } } diff --git a/DSWeb/Areas/MvcShipping/Controllers/MsChFeeController.cs b/DSWeb/Areas/MvcShipping/Controllers/MsChFeeController.cs index c9dce52a..1b662bd6 100644 --- a/DSWeb/Areas/MvcShipping/Controllers/MsChFeeController.cs +++ b/DSWeb/Areas/MvcShipping/Controllers/MsChFeeController.cs @@ -365,12 +365,13 @@ namespace DSWeb.MvcShipping.Controllers var bodyList = JsonConvert.Deserialize>(chfeebody); var result =new DBResult(); T_ALL_DA T_ALL_DA = new T_ALL_DA(); - + decimal feetype = 0; var custstr = ""; if (bodyList != null) { foreach (var enumValue in bodyList) { + feetype = enumValue.FeeType; var BLCOUNT2 = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from info_client WHERE ISNULL(ISSTOP,0)=0 AND SHORTNAME='" + enumValue.CustomerName + "'"); if (BLCOUNT2 == "0") { @@ -389,9 +390,37 @@ namespace DSWeb.MvcShipping.Controllers } var FEESAVENOTSAMEAMOUNT = MsSysParamSetDAL.GetData("PARAMNAME='FEESAVENOTSAMEAMOUNT'"); - if (FEESAVENOTSAMEAMOUNT.PARAMVALUE == "1") + if (FEESAVENOTSAMEAMOUNT.PARAMVALUE == "1"&& feetype==2) { + var oldfeelist = MsChFeeDAL.GetAllDataList("BSNO='" + bsno + "' AND FEETYPE=2"); var findlist = new List(); + foreach (var fee in oldfeelist) + { + var newfee = bodyList.Find(X => X.GId == fee.GId); + if (newfee == null&&fee.FeeType == 2) + { + var newinvlink = findlist.Find(X => X.Currency == fee.Currency && X.CustomerName == fee.CustomerName && X.Amount == fee.Amount); + if (newinvlink == null) + { + var InvLink = new MsChFee(); + InvLink.Currency = fee.Currency; + InvLink.CustomerName = fee.CustomerName; + InvLink.Amount = fee.Amount; + findlist.Add(InvLink); + } + else + { + var jsonRespose3 = new JsonResponse + { + Success = false, + Message = "客户名称,金额,币别 ,相同,不允许保存,请调整!", + }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose3) }; + + } + } + } + foreach (var fee in bodyList) { if (fee.FeeType == 2) diff --git a/DSWeb/Areas/MvcShipping/DAL/MsChFee/MsChFeeDAL.cs b/DSWeb/Areas/MvcShipping/DAL/MsChFee/MsChFeeDAL.cs index 8c50aa2f..cca20a32 100644 --- a/DSWeb/Areas/MvcShipping/DAL/MsChFee/MsChFeeDAL.cs +++ b/DSWeb/Areas/MvcShipping/DAL/MsChFee/MsChFeeDAL.cs @@ -1276,46 +1276,44 @@ namespace DSWeb.MvcShipping.DAL.MsChFeeDAL else { rangstr = GetSumRangDAStr(userid, username, companyid); - var nopowerOpen = MsSysParamSetDAL.GetData("PARAMNAME='FeeSumIsContentNotOpen'"); - var isopen = MsBaseInfoDAL.MsBaseInfoDAL.GetUserModuleEnable("modFeenotopen", userid); - var isopenstr = ""; - if (isopen == false) - { - #region 2018年2月7日15:54:52 李进举 鼎世 - if (nopowerOpen.PARAMVALUE == "0") - { - //配置否,则走正常机密费用逻辑 - isopenstr = " ( ENTEROPERATOR='" + userid + "' OR ( ENTEROPERATOR<>'" + userid + "' AND (ISOPEN=0 OR ISOPEN IS NULL))) "; + } + var nopowerOpen = MsSysParamSetDAL.GetData("PARAMNAME='FeeSumIsContentNotOpen'"); + var isopen = MsBaseInfoDAL.MsBaseInfoDAL.GetUserModuleEnable("modFeenotopen", userid); + var isopenstr = ""; + if (isopen == false) + { + + #region 2018年2月7日15:54:52 李进举 鼎世 + if (nopowerOpen.PARAMVALUE == "0") + { + //配置否,则走正常机密费用逻辑 + isopenstr = " ( ENTEROPERATOR='" + userid + "' OR ( ENTEROPERATOR<>'" + userid + "' AND (ISOPEN=0 OR ISOPEN IS NULL))) "; if (!string.IsNullOrEmpty(rangstr)) rangstr = rangstr + " and " + isopenstr; else rangstr = isopenstr; - } - else - { - //配置是,则不走机密费用逻辑 - rangstr = " 1 = 1 "; - } - #endregion } - - var isacc = MsBaseInfoDAL.MsBaseInfoDAL.GetUserModuleEnable("modISWACC", userid); - var isaccstr = ""; - if (isacc == false) + else { - isaccstr = " ISNULL(ISACC,0)=0 "; - if (!string.IsNullOrEmpty(rangstr)) - rangstr = rangstr + " and " + isaccstr; - else - rangstr = isaccstr; + //配置是,则不走机密费用逻辑 + rangstr = " 1 = 1 "; } + #endregion + } + var isacc = MsBaseInfoDAL.MsBaseInfoDAL.GetUserModuleEnable("modISWACC", userid); + var isaccstr = ""; + if (isacc == false) + { + isaccstr = " ISNULL(ISACC,0)=0 "; + if (!string.IsNullOrEmpty(rangstr)) + rangstr = rangstr + " and " + isaccstr; + else + rangstr = isaccstr; + } - - - } var FeenotPr = MsBaseInfoDAL.MsBaseInfoDAL.GetUserModuleEnable("modFeenotPr", userid); if (!string.IsNullOrEmpty(rangstr)) @@ -1385,40 +1383,75 @@ namespace DSWeb.MvcShipping.DAL.MsChFeeDAL else { rangstr = GetSumRangDAStr(userid, username, companyid); - var nopowerOpen = MsSysParamSetDAL.GetData("PARAMNAME='FeeSumIsContentNotOpen'"); - var isopen = MsBaseInfoDAL.MsBaseInfoDAL.GetUserModuleEnable("modFeenotopen", userid); - var isopenstr = ""; - if (isopen == false) - { + //var nopowerOpen = MsSysParamSetDAL.GetData("PARAMNAME='FeeSumIsContentNotOpen'"); + //var isopen = MsBaseInfoDAL.MsBaseInfoDAL.GetUserModuleEnable("modFeenotopen", userid); + //var isopenstr = ""; + //if (isopen == false) + //{ + + // #region 2018年2月7日15:54:52 李进举 鼎世 + // if (nopowerOpen.PARAMVALUE == "0") + // { + // //配置否,则走正常机密费用逻辑 + // isopenstr = " ( ENTEROPERATOR='" + userid + "' OR ( ENTEROPERATOR<>'" + userid + "' AND (ISOPEN=0 OR ISOPEN IS NULL))) "; + // if (!string.IsNullOrEmpty(rangstr)) + // rangstr = rangstr + " and " + isopenstr; + // else + // rangstr = isopenstr; + // } + // else + // { + // //配置是,则不走机密费用逻辑 + // rangstr = " 1 = 1 "; + // } + // #endregion + //} + + //var isacc = MsBaseInfoDAL.MsBaseInfoDAL.GetUserModuleEnable("modISWACC", userid); + //var isaccstr = ""; + //if (isacc == false) + //{ + // isaccstr = " ISNULL(ISACC,0)=0 "; + // if (!string.IsNullOrEmpty(rangstr)) + // rangstr = rangstr + " and " + isaccstr; + // else + // rangstr = isaccstr; + //} + } - #region 2018年2月7日15:54:52 李进举 鼎世 - if (nopowerOpen.PARAMVALUE == "0") - { - //配置否,则走正常机密费用逻辑 - isopenstr = " ( ENTEROPERATOR='" + userid + "' OR ( ENTEROPERATOR<>'" + userid + "' AND (ISOPEN=0 OR ISOPEN IS NULL))) "; + var nopowerOpen = MsSysParamSetDAL.GetData("PARAMNAME='FeeSumIsContentNotOpen'"); + var isopen = MsBaseInfoDAL.MsBaseInfoDAL.GetUserModuleEnable("modFeenotopen", userid); + var isopenstr = ""; + if (isopen == false) + { + + #region 2018年2月7日15:54:52 李进举 鼎世 + if (nopowerOpen.PARAMVALUE == "0") + { + //配置否,则走正常机密费用逻辑 + isopenstr = " ( ENTEROPERATOR='" + userid + "' OR ( ENTEROPERATOR<>'" + userid + "' AND (ISOPEN=0 OR ISOPEN IS NULL))) "; if (!string.IsNullOrEmpty(rangstr)) rangstr = rangstr + " and " + isopenstr; else rangstr = isopenstr; - } - else - { - //配置是,则不走机密费用逻辑 - rangstr = " 1 = 1 "; - } - #endregion } - - var isacc = MsBaseInfoDAL.MsBaseInfoDAL.GetUserModuleEnable("modISWACC", userid); - var isaccstr = ""; - if (isacc == false) + else { - isaccstr = " ISNULL(ISACC,0)=0 "; - if (!string.IsNullOrEmpty(rangstr)) - rangstr = rangstr + " and " + isaccstr; - else - rangstr = isaccstr; + //配置是,则不走机密费用逻辑 + rangstr = " 1 = 1 "; } + #endregion + } + + var isacc = MsBaseInfoDAL.MsBaseInfoDAL.GetUserModuleEnable("modISWACC", userid); + var isaccstr = ""; + if (isacc == false) + { + isaccstr = " ISNULL(ISACC,0)=0 "; + if (!string.IsNullOrEmpty(rangstr)) + rangstr = rangstr + " and " + isaccstr; + else + rangstr = isaccstr; }