diff --git a/DSWeb/Areas/Account/Controllers/Chfee_lockController.cs b/DSWeb/Areas/Account/Controllers/Chfee_lockController.cs index c7a61275..0e36b231 100644 --- a/DSWeb/Areas/Account/Controllers/Chfee_lockController.cs +++ b/DSWeb/Areas/Account/Controllers/Chfee_lockController.cs @@ -25,15 +25,19 @@ using DSWeb.SoftMng.Filter; using DSWeb.MvcShipping.Models.MsOpBillYj; using DSWeb.MvcShipping.DAL.MsChFeeDAL; using DSWeb.MvcShipping.DAL.MsCurrencyExchange; +using DSWeb.SoftMng.Filter; +using DSWeb.Common.DB; namespace DSWeb.Areas.Account.Controllers { + /// /// 业务费用封帐 /// [JsonRequestBehavior] public class Chfee_lockController : Controller { + const string 提交锁定 = "提交锁定"; // // GET: //[ModuleAuthFilter(Name = "modBsLockBig")]//权限过滤器 @@ -65,11 +69,12 @@ namespace DSWeb.Areas.Account.Controllers // // GET: + [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 + + public ContentResult BsListData(int start, int limit, string condition, string sort, string type, string printstr) - public ContentResult BsListData(int start, int limit, string condition,string sort,string type,string printstr) - { - var strDa = GetRangDAStr("index",type, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"])); + var strDa = GetRangDAStr("index", type, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"])); if (!string.IsNullOrEmpty(strDa)) { @@ -122,7 +127,7 @@ namespace DSWeb.Areas.Account.Controllers strSql.Append(",case B.ETD when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar(100), B.ETD,23) end as ETD,B.ETA"); strSql.Append(",case B.OPDATE when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar(100), B.OPDATE,23) end as OPDATE,B.ENTERP"); strSql.Append(",case B.CUSTOMDATE when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar(100), B.CUSTOMDATE,23) end as CUSTOMDATE,B.CARGOID,B.DCLASS"); - strSql.Append(",B.CUSTSERVICE,B.FRCUSTSERVICE, B.PORTLOAD, B.PORTDISCHARGE, B.DESTINATION,B.CUSTOMNO, B.ACCDATE,B.CARRIER, B.BSSOURCE,B.BSSOURCEDETAIL, B.LANE, B.FORWARDER,B.NETWEIGHT,B.KGS,B.TEU,B.CNTRTOTAL,B.CORPID"); + strSql.Append(",B.CUSTSERVICE,B.FRCUSTSERVICE, B.PORTLOAD, B.PORTDISCHARGE, B.DESTINATION,B.CUSTOMNO, B.ACCDATE,B.CARRIER,B.AGENTID, B.BSSOURCE,B.BSSOURCEDETAIL, B.LANE, B.FORWARDER,B.NETWEIGHT,B.KGS,B.TEU,B.CNTRTOTAL,B.CORPID"); strSql.Append(",B.CNTR1,B.CNTR2,B.CNTR3,B.CNTR4,B.CNTR5,B.CNTR6,B.CNTR7,B.CNTR8,B.CNTR9,B.CNTR10,B.OTCNTR,B.TRADETYPE,B.GOODSNAME,B.ISPRINTPR,B.REMARK,B.REMARK2,B.YARD,B.SALEDEPT"); @@ -133,7 +138,7 @@ namespace DSWeb.Areas.Account.Controllers strSql.Append(", (CASE WHEN (G.TTLDR)= 0 THEN '无法计算' ELSE ltrim(str((G.TTLDR-G.TTLCR) / (G.TTLDR) * 100, 10, 2)) + '%' END) AS PROFITRATE"); } else - strSql.Append(", (CASE WHEN (G.TTLCR)= 0 THEN '无法计算' ELSE ltrim(str((G.TTLDR-G.TTLCR) / (G.TTLCR) * 100, 10, 2)) + '%' END) AS PROFITRATE"); + strSql.Append(", (CASE WHEN (G.TTLCR)= 0 THEN '无法计算' ELSE ltrim(str((G.TTLDR-G.TTLCR) / (G.TTLCR) * 100, 10, 2)) + '%' END) AS PROFITRATE"); strSql.Append(",(SELECT TOP 1 STATUS FROM OP_STATUS WHERE BSNO=B.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS "); @@ -144,7 +149,10 @@ namespace DSWeb.Areas.Account.Controllers strSql.Append(",case ISNULL(C.DRCLOSE,0) when 1 then '已锁定' else '未锁定' end as DRCLOSEREF"); strSql.Append(",case ISNULL(C.CRCLOSE,0) when 1 then '已锁定' else '未锁定' end as CRCLOSEREF"); strSql.Append(",(select [NAME] from [company] where GID=B.SALECORPID) as SALECORP"); - strSql.Append(",BN.UNCLOSETIME BSUNCLOSETIME,BN.UNCLOSEOP BSUNCLOSEOP,FN.UNCLOSETIME FEEUNCLOSETIME,FN.UNCLOSEOP FEEUNCLOSEOP"); + strSql.Append(",BN.UNCLOSETIME BSUNCLOSETIME,BN.UNCLOSEOP BSUNCLOSEOP,FN.UNCLOSETIME FEEUNCLOSETIME,FN.UNCLOSEOP FEEUNCLOSEOP,B.REASON"); + + //20240925 增加的提交锁定逻辑 + strSql.Append(" ,isnull(L.PROPVALUE,'') SUBMITSTATUS "); strSql.Append(" FROM V_OP_BILL B "); strSql.Append(" LEFT JOIN (SELECT BSNO,isnull(SUM(CASE FEETYPE WHEN 1 THEN(CASE CURRENCY WHEN 'RMB' THEN ISNULL(AMOUNT, 0) ELSE 0 END) ELSE 0 END), 0) AS RMBDR,"); @@ -172,16 +180,17 @@ namespace DSWeb.Areas.Account.Controllers strSql.Append("isnull(SUM(CASE FEETYPE WHEN 1 THEN(CASE CURRENCY WHEN 'USD' THEN 0 ELSE(CASE CURRENCY WHEN 'RMB' THEN 0 ELSE ISNULL(NOTAXAMOUNT, 0) END) END) ELSE 0 END), 0) AS NOTAXOTDR,"); strSql.Append("isnull(SUM(CASE FEETYPE WHEN 2 THEN(CASE CURRENCY WHEN 'USD' THEN 0 ELSE(CASE CURRENCY WHEN 'RMB' THEN 0 ELSE ISNULL(NOTAXAMOUNT, 0) END) END) ELSE 0 END), 0) AS NOTAXOTCR,"); strSql.Append("cast(round(isnull(SUM(CASE FEETYPE WHEN 1 THEN ISNULL(NOTAXAMOUNT, 0) * ISNULL(EXCHANGERATE, 0) ELSE 0 END), 0), 2) as numeric(20, 2)) AS NOTAXTTLDR,"); - strSql.Append("cast(round(isnull(SUM(CASE FEETYPE WHEN 2 THEN ISNULL(NOTAXAMOUNT, 0) * ISNULL(EXCHANGERATE, 0) ELSE 0 END), 0), 2) as numeric(20, 2)) AS NOTAXTTLCR"); - strSql.Append(",isnull(SUM(CASE FEETYPE WHEN 1 THEN ISNULL(INVOICE,0) * ISNULL(EXCHANGERATE,0) ELSE 0 END),0) AS TTLINVDR"); - strSql.Append(",cast(round(isnull(SUM(CASE WHEN FEETYPE=1 AND ISNULL(ISDEBIT,0)=1 THEN ISNULL(AMOUNT,0) * ISNULL(EXCHANGERATE,0) ELSE 0 END),0), 2) as numeric(20, 2)) AS TTLDUIDR"); + strSql.Append("cast(round(isnull(SUM(CASE FEETYPE WHEN 2 THEN ISNULL(NOTAXAMOUNT, 0) * ISNULL(EXCHANGERATE, 0) ELSE 0 END), 0), 2) as numeric(20, 2)) AS NOTAXTTLCR,"); + strSql.Append("cast(round(isnull(SUM(CASE FEETYPE WHEN 1 THEN ISNULL(INVOICE, 0) * ISNULL(EXCHANGERATE, 0) ELSE 0 END), 0), 2) as numeric(20, 2)) AS TTLINVDR,"); + + strSql.Append("cast(round(isnull(SUM(CASE WHEN FEETYPE=1 AND ISNULL(ISDEBIT,0)=1 THEN ISNULL(AMOUNT,0) * ISNULL(EXCHANGERATE,0) ELSE 0 END),0), 2) as numeric(20, 2)) AS TTLDUIDR"); if (!string.IsNullOrEmpty(isopenstr)) - strSql.Append(" FROM ch_fee where FEESTATUS<>1 and "+isopenstr+" GROUP BY BSNO) G ON (G.BSNO=B.BSNO) "); + strSql.Append(" FROM ch_fee where FEESTATUS<>1 and " + isopenstr + " GROUP BY BSNO) G ON (G.BSNO=B.BSNO) "); else strSql.Append(" FROM ch_fee where FEESTATUS<> 1 GROUP BY BSNO) G ON (G.BSNO=B.BSNO) "); strSql.Append("LEFT JOIN op_close c ON (c.BSNO=B.BSNO) "); strSql.Append("LEFT JOIN V_UNCLOSE BN ON (BN.BSNO=B.BSNO AND BN.UNCLOSETYPE='1') "); strSql.Append("LEFT JOIN V_UNCLOSE FN ON (FN.BSNO=B.BSNO AND FN.UNCLOSETYPE='1') "); - + strSql.Append("LEFT JOIN OP_LOGICINFO L on L.PROPNAME='提交锁定' and L.BSNO=B.BSNO "); if (!string.IsNullOrEmpty(condition)) { strSql.Append(" Where " + condition); @@ -191,10 +200,11 @@ namespace DSWeb.Areas.Account.Controllers { strSql.Append(" order by " + sortstring); } - else { + else + { strSql.Append(" order by B.CUSTOMERNAME,B.OPLB,B.CREATETIME DESC"); - + } @@ -227,8 +237,10 @@ namespace DSWeb.Areas.Account.Controllers var json = RptHelper.GetRptJsonResult(start, limit, dbRptResult, "Result_Set", true); return new ContentResult() { Content = json }; } - } + + [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 + public ContentResult BsYjListData(int start, int limit, string condition, string sort, string type, string printstr) { var strDa = GetRangDAStr("index", type, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"])); @@ -420,12 +432,12 @@ namespace DSWeb.Areas.Account.Controllers var bodyList = JsonConvert.Deserialize>(data); - DBResult result = AuditYj(bodyList, Convert.ToString(Session["SHOWNAME"]),Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"])); + DBResult result = AuditYj(bodyList, Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"])); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } - public static DBResult AuditYj(List boday, String USERNAME,string userid,string companyid) + public static DBResult AuditYj(List boday, String USERNAME, string userid, string companyid) { var result = new DBResult(); @@ -457,73 +469,74 @@ namespace DSWeb.Areas.Account.Controllers @TAXRATE,@NOTAXAMOUNT,@ACCTAXRATE,@LINENUM,@TAXUNITPRICE,@MODIFIEDUSER,@MODIFIEDTIME,@WMSOUTBSNO,@PREAMOUNT,@ISINVOICE,@INPUTMODE,@LOCALCURR,@MANAGER,@ISACC,@AUDITOPERATOR,@AUDITDATE) "); var YJFEENAME = MsSysParamSetDAL.GetData("PARAMNAME='YJFEENAME'").PARAMVALUE; - + foreach (var enumValue in boday) { db.AddInParameter(cmdInsert, "@BSNO", DbType.String, enumValue.BSNO); db.AddInParameter(cmdInsert, "@AMOUNT", DbType.Decimal, enumValue.AMOUNT); - db.AddInParameter(cmdInsert, "@YJSTATUS", DbType.String,"审核通过"); + db.AddInParameter(cmdInsert, "@YJSTATUS", DbType.String, "审核通过"); db.AddInParameter(cmdInsert, "@AUDITDATE", DbType.DateTime, DateTime.Now); db.AddInParameter(cmdInsert, "@AUDITBY", DbType.String, USERNAME); db.ExecuteNonQuery(cmdInsert, tran); - cmdInsertFee.Parameters.Clear(); - db.AddInParameter(cmdInsertFee, "@GID", DbType.String, Guid.NewGuid().ToString()); - db.AddInParameter(cmdInsertFee, "@BSNO", DbType.String, enumValue.BSNO); - db.AddInParameter(cmdInsertFee, "@FEETYPE", DbType.Int16, 2); - db.AddInParameter(cmdInsertFee, "@UNITPRICE", DbType.Decimal, enumValue.AMOUNT); - db.AddInParameter(cmdInsertFee, "@AMOUNT", DbType.Decimal, enumValue.AMOUNT); - db.AddInParameter(cmdInsertFee, "@NOTAXAMOUNT", DbType.Decimal, enumValue.AMOUNT); - db.AddInParameter(cmdInsertFee, "@TAXUNITPRICE", DbType.Decimal, enumValue.AMOUNT); - db.AddInParameter(cmdInsertFee, "@FEENAME", DbType.String, YJFEENAME); - db.AddInParameter(cmdInsertFee, "@FEEDESCRIPTION", DbType.String, ""); - db.AddInParameter(cmdInsertFee, "@CUSTOMERTYPE", DbType.String, "代理"); - db.AddInParameter(cmdInsertFee, "@CUSTOMERNAME", DbType.String, enumValue.CUSTNAME); - db.AddInParameter(cmdInsertFee, "@UNIT", DbType.String, "票"); - db.AddInParameter(cmdInsertFee, "@QUANTITY", DbType.Decimal, 1); - db.AddInParameter(cmdInsertFee, "@CURRENCY", DbType.String, enumValue.CURRENCY); + cmdInsertFee.Parameters.Clear(); + db.AddInParameter(cmdInsertFee, "@GID", DbType.String, Guid.NewGuid().ToString()); + db.AddInParameter(cmdInsertFee, "@BSNO", DbType.String, enumValue.BSNO); + db.AddInParameter(cmdInsertFee, "@FEETYPE", DbType.Int16, 2); + db.AddInParameter(cmdInsertFee, "@UNITPRICE", DbType.Decimal, enumValue.AMOUNT); + db.AddInParameter(cmdInsertFee, "@AMOUNT", DbType.Decimal, enumValue.AMOUNT); + db.AddInParameter(cmdInsertFee, "@NOTAXAMOUNT", DbType.Decimal, enumValue.AMOUNT); + db.AddInParameter(cmdInsertFee, "@TAXUNITPRICE", DbType.Decimal, enumValue.AMOUNT); + db.AddInParameter(cmdInsertFee, "@FEENAME", DbType.String, YJFEENAME); + db.AddInParameter(cmdInsertFee, "@FEEDESCRIPTION", DbType.String, ""); + db.AddInParameter(cmdInsertFee, "@CUSTOMERTYPE", DbType.String, "代理"); + db.AddInParameter(cmdInsertFee, "@CUSTOMERNAME", DbType.String, enumValue.CUSTNAME); + db.AddInParameter(cmdInsertFee, "@UNIT", DbType.String, "票"); + db.AddInParameter(cmdInsertFee, "@QUANTITY", DbType.Decimal, 1); + db.AddInParameter(cmdInsertFee, "@CURRENCY", DbType.String, enumValue.CURRENCY); if (enumValue.CURRENCY == "RMB") { - db.AddInParameter(cmdInsertFee, "@EXCHANGERATE", DbType.Decimal,1); + db.AddInParameter(cmdInsertFee, "@EXCHANGERATE", DbType.Decimal, 1); } - else { - var FeecurrList = MsChFeeDAL.GetFeeDateCurrList("",enumValue.BSNO,userid,companyid); + else + { + var FeecurrList = MsChFeeDAL.GetFeeDateCurrList("", enumValue.BSNO, userid, companyid); var feecurr = FeecurrList.Find(x => x.CURR == enumValue.CURRENCY); - if (feecurr.CRDEFRATE!=0) db.AddInParameter(cmdInsertFee, "@EXCHANGERATE", DbType.Decimal, feecurr.CRDEFRATE); + if (feecurr.CRDEFRATE != 0) db.AddInParameter(cmdInsertFee, "@EXCHANGERATE", DbType.Decimal, feecurr.CRDEFRATE); else db.AddInParameter(cmdInsertFee, "@EXCHANGERATE", DbType.Decimal, feecurr.DEFRATE); } - - db.AddInParameter(cmdInsertFee, "@REASON", DbType.String, ""); - db.AddInParameter(cmdInsertFee, "@REMARK", DbType.String, ""); - db.AddInParameter(cmdInsertFee, "@COMMISSIONRATE", DbType.Decimal, 0); - db.AddInParameter(cmdInsertFee, "@ENTEROPERATOR", DbType.String, userid); - db.AddInParameter(cmdInsertFee, "@ENTERDATE", DbType.String, DateTime.Now.ToString()); - db.AddInParameter(cmdInsertFee, "@ISOPEN", DbType.Boolean, true); - db.AddInParameter(cmdInsertFee, "@ISADVANCEDPAY", DbType.Boolean, false); - db.AddInParameter(cmdInsertFee, "@SORT", DbType.Int16, 1); - db.AddInParameter(cmdInsertFee, "@FEESTATUS", DbType.Int16, 0); - db.AddInParameter(cmdInsertFee, "@FEEFRT", DbType.String, "PP"); - db.AddInParameter(cmdInsertFee, "@CARGO_GID", DbType.String,""); - db.AddInParameter(cmdInsertFee, "@TAXRATE", DbType.Decimal, 0); - db.AddInParameter(cmdInsertFee, "@ACCTAXRATE", DbType.Decimal, 0); - db.AddInParameter(cmdInsertFee, "@LINENUM", DbType.Int16, 1); - db.AddInParameter(cmdInsertFee, "@MODIFIEDUSER", DbType.String, userid); - db.AddInParameter(cmdInsertFee, "@MODIFIEDTIME", DbType.String, DateTime.Now.ToString()); - - db.AddInParameter(cmdInsertFee, "@WMSOUTBSNO", DbType.String, ""); - db.AddInParameter(cmdInsertFee, "@PREAMOUNT", DbType.Decimal, 0); - db.AddInParameter(cmdInsertFee, "@ISINVOICE", DbType.Boolean, false); - db.AddInParameter(cmdInsertFee, "@INPUTMODE", DbType.String, ""); - db.AddInParameter(cmdInsertFee, "@LOCALCURR", DbType.String, "RMB"); - db.AddInParameter(cmdInsertFee, "@MANAGER", DbType.String, ""); - db.AddInParameter(cmdInsertFee, "@ISACC", DbType.Boolean, false); - db.AddInParameter(cmdInsertFee, "@AUDITOPERATOR", DbType.String, userid); - db.AddInParameter(cmdInsertFee, "@AUDITDATE", DbType.String, DateTime.Now.ToString()); + + db.AddInParameter(cmdInsertFee, "@REASON", DbType.String, ""); + db.AddInParameter(cmdInsertFee, "@REMARK", DbType.String, ""); + db.AddInParameter(cmdInsertFee, "@COMMISSIONRATE", DbType.Decimal, 0); + db.AddInParameter(cmdInsertFee, "@ENTEROPERATOR", DbType.String, userid); + db.AddInParameter(cmdInsertFee, "@ENTERDATE", DbType.String, DateTime.Now.ToString()); + db.AddInParameter(cmdInsertFee, "@ISOPEN", DbType.Boolean, true); + db.AddInParameter(cmdInsertFee, "@ISADVANCEDPAY", DbType.Boolean, false); + db.AddInParameter(cmdInsertFee, "@SORT", DbType.Int16, 1); + db.AddInParameter(cmdInsertFee, "@FEESTATUS", DbType.Int16, 0); + db.AddInParameter(cmdInsertFee, "@FEEFRT", DbType.String, "PP"); + db.AddInParameter(cmdInsertFee, "@CARGO_GID", DbType.String, ""); + db.AddInParameter(cmdInsertFee, "@TAXRATE", DbType.Decimal, 0); + db.AddInParameter(cmdInsertFee, "@ACCTAXRATE", DbType.Decimal, 0); + db.AddInParameter(cmdInsertFee, "@LINENUM", DbType.Int16, 1); + db.AddInParameter(cmdInsertFee, "@MODIFIEDUSER", DbType.String, userid); + db.AddInParameter(cmdInsertFee, "@MODIFIEDTIME", DbType.String, DateTime.Now.ToString()); + + db.AddInParameter(cmdInsertFee, "@WMSOUTBSNO", DbType.String, ""); + db.AddInParameter(cmdInsertFee, "@PREAMOUNT", DbType.Decimal, 0); + db.AddInParameter(cmdInsertFee, "@ISINVOICE", DbType.Boolean, false); + db.AddInParameter(cmdInsertFee, "@INPUTMODE", DbType.String, ""); + db.AddInParameter(cmdInsertFee, "@LOCALCURR", DbType.String, "RMB"); + db.AddInParameter(cmdInsertFee, "@MANAGER", DbType.String, ""); + db.AddInParameter(cmdInsertFee, "@ISACC", DbType.Boolean, false); + db.AddInParameter(cmdInsertFee, "@AUDITOPERATOR", DbType.String, userid); + db.AddInParameter(cmdInsertFee, "@AUDITDATE", DbType.String, DateTime.Now.ToString()); db.ExecuteNonQuery(cmdInsertFee, tran); - + @@ -542,7 +555,7 @@ namespace DSWeb.Areas.Account.Controllers tran.Rollback(); result.Success = false; - result.Message = "设置出现错误,请重试或联系系统管理员"+e.Message; + result.Message = "设置出现错误,请重试或联系系统管理员" + e.Message; return result; } @@ -556,7 +569,7 @@ namespace DSWeb.Areas.Account.Controllers - public static string GetRangDAStr(string tb,string type, string userid, string usercode, string companyid) + public static string GetRangDAStr(string tb, string type, string userid, string usercode, string companyid) { string str = ""; var strSql = new StringBuilder(); @@ -580,7 +593,7 @@ namespace DSWeb.Areas.Account.Controllers else if (type == "YJFEE") { var YJFeeConnectOPSeae = MsSysParamSetDAL.GetData("PARAMNAME='YJFeeConnectOPSeae'"); - if (YJFeeConnectOPSeae.PARAMVALUE=="0") + if (YJFeeConnectOPSeae.PARAMVALUE == "0") { strSql.Append(" where [NAME]='modYJFEE' and USERID='" + userid + "' and ISDELETE=0"); } @@ -588,20 +601,20 @@ namespace DSWeb.Areas.Account.Controllers { strSql.Append(" where [NAME]='modOrderManagement' and USERID='" + userid + "' and ISDELETE=0"); } - + } - + string visiblerange = "4"; string operaterange = "4"; string AUTHORITYID = ""; string VSSQL = ""; Database db = DatabaseFactory.CreateDatabase(); - + using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString())) { - + while (reader.Read()) { visiblerange = Convert.ToString(reader["VISIBLERANGE"]); @@ -619,8 +632,8 @@ namespace DSWeb.Areas.Account.Controllers else if (visiblerange == "3") { - // str = " (B.OP='" + usercode + "' OR B.SALE='" + usercode + "')"; - str = " (B.OP='" + usercode + "' OR B.SALE='" + usercode + "' OR B.CUSTSERVICE = '"+usercode+"')"; + // str = " (B.OP='" + usercode + "' OR B.SALE='" + usercode + "')"; + str = " (B.OP='" + usercode + "' OR B.SALE='" + usercode + "' OR B.CUSTSERVICE = '" + usercode + "')"; } else if (visiblerange == "2") { @@ -645,7 +658,7 @@ namespace DSWeb.Areas.Account.Controllers str = str + " or B.OP='" + Convert.ToString(reader["SHOWNAME"]) + "' OR B.SALE='" + Convert.ToString(reader["SHOWNAME"]) + "'"; }; } - str =str+ ")"; + str = str + ")"; reader.Close(); } } @@ -735,6 +748,7 @@ namespace DSWeb.Areas.Account.Controllers public ContentResult SelBsLock(string data, string type) { + var billData = JsonConvert.Deserialize>(data); var json = JsonConvert.Serialize(new { Success = true, Message = "锁定成功" }); Database db = DatabaseFactory.CreateDatabase(); @@ -750,7 +764,7 @@ namespace DSWeb.Areas.Account.Controllers foreach (var enumValue in billData) { - if (type =="ETD") + if (type == "ETD") { var cmdUpdate = db.GetSqlStringCommand( @"if (select bsno from op_close where bsno='" + enumValue.BSNO + "') is null insert into op_close values(newid(),'" + enumValue.BSNO + "',null,null,null,null,1" @@ -759,7 +773,7 @@ namespace DSWeb.Areas.Account.Controllers db.ExecuteNonQuery(cmdUpdate, tran); } - else if (type =="应收") + else if (type == "应收") { var FeeCount = db.ExecuteScalar(CommandType.Text, "SELECT COUNT(GID) as FeeCount from ch_fee where FEETYPE=1 AND FEESTATUS NOT IN (0,8,9) and BSNO='" + enumValue.BSNO + "'"); var IntFeeCount = Convert.ToInt16(FeeCount); @@ -808,7 +822,7 @@ namespace DSWeb.Areas.Account.Controllers public ContentResult BsLockAll(string billsql, string type) { - var billData = GetFeeDataList(billsql, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]),"BS"); + var billData = GetFeeDataList(billsql, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), "BS"); var json = JsonConvert.Serialize(new { Success = true, Message = "锁定成功" }); Database db = DatabaseFactory.CreateDatabase(); var i = 0; @@ -935,11 +949,12 @@ namespace DSWeb.Areas.Account.Controllers return new ContentResult() { Content = json }; } + [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 public ContentResult BsLockUnAll(string billsql, string type) { - var billData = GetFeeDataList(billsql, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]),"BS"); + var billData = GetFeeDataList(billsql, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), "BS"); var json = JsonConvert.Serialize(new { Success = true, Message = "锁定成功" }); Database db = DatabaseFactory.CreateDatabase(); var i = 0; @@ -967,7 +982,7 @@ namespace DSWeb.Areas.Account.Controllers updateUnclose(enumValue.BSNO, type.ToString()); } } - else if (type == "应收"&& enumValue.DRCLOSEREF == "已锁定") + else if (type == "应收" && enumValue.DRCLOSEREF == "已锁定") { var cmdUpdate = db.GetSqlStringCommand( @" update op_close set DRCLOSE=0" @@ -1004,8 +1019,54 @@ namespace DSWeb.Areas.Account.Controllers #endregion - public ContentResult SelLock(string data,int type) + + #region 提交与撤回 + + + + public ContentResult SubmitLock(string BSNOS, int type) + { + var result = new DBResult(); + + var cdc = new CommonDataContext(); + + var bsnolist = BasicDataRefDAL.getStringArray(BSNOS); + + + var bslist = cdc.v_op_bs.Where(x => bsnolist.Contains(x.BSNO)).ToList(); + + var status = type == 1 ? "已提交" : ""; + + if (type == 1) { + foreach (var bsno in bsnolist) { + BasicDataRefDAL.SaveLogicSingleInfo(bsno, 提交锁定, status); + } + result.OK("提交完成"); + } + if (type == 2) + { + if (bslist != null && bslist.Count > 0) + { + foreach (var bs in bslist) + { + if (bs.BSSTATUS != 1 && bs.FEESTATUS != 1) + { + BasicDataRefDAL.SaveLogicSingleInfo(bs.BSNO, 提交锁定, status); + } + } + result.OK("撤回完成"); + } + } + + + return BasicDataRefDAL.GetContentResult(result); + } + + #endregion + public ContentResult SelLock(string data, int type, string AccDate = "", string isAccDate = "0") { + var accdatesqlstr = ""; + if (isAccDate == "1") accdatesqlstr = ",ACCDATE='" + AccDate + "'"; var FEELOCKUPDATEEXCHANGE = MsSysParamSetDAL.GetData("PARAMNAME='FEELOCKUPDATEEXCHANGE'"); var billData = JsonConvert.Deserialize>(data); var json = JsonConvert.Serialize(new { Success = true, Message = "锁定成功" }); @@ -1024,21 +1085,94 @@ namespace DSWeb.Areas.Account.Controllers { if (type == 2) { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET BSSTATUS=1 WHERE BSNO=@BSNO "); + //2017年4月10日16:50:29 需求编号:SR2017041000009 //Start if (enumValue.OPLB.Equals("tMsWlPcHead")) { - cmdUpdate = db.GetSqlStringCommand( + var cmdUpdate = db.GetSqlStringCommand( @"UPDATE " + enumValue.OPLB + " SET BillStatus=1 WHERE gid=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + } + else if (enumValue.OPLB == "OP_WMS_FEEDUI") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_FEEDUI_STORAGE SET BillLock=1 WHERE WMSDUIID in(select MASTERNO from v_op_bs where BSNO=@BSNO) "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_MOVE") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_MOVE SET BillLock=1 WHERE WMSDOID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_TRANSFERGOODS") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_TRANSFERGOODS SET BillLock=1 WHERE WMSTRANSFERGOODSID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_IN_DO") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_IN_DO SET BillLock=1 WHERE WMSDOID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_OUT_DO") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_OUT_DO SET BillLock=1 WHERE WMSDOID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "VW_OP_WMS_OUT_PLAN") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_OUT_PLAN SET BillLock=1 WHERE WMSPLANID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_IN_PLAN") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_IN_PLAN SET BillLock=1 WHERE WMSPLANID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + enumValue.OPLB + " SET BSSTATUS=1 " + accdatesqlstr + " WHERE BSNO=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); } //End - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); + //cmdUpdate.Parameters.Clear(); + //db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + //db.ExecuteNonQuery(cmdUpdate, tran); - updateclose(enumValue.BSNO,type); + updateclose(enumValue.BSNO, type); i = i + 1; } else if (type == 1) @@ -1047,15 +1181,16 @@ namespace DSWeb.Areas.Account.Controllers var IntFeeCount = Convert.ToInt16(FeeCount); if (IntFeeCount == 0) { - if (enumValue.OPLB=="tMsWlPcHead") + if (enumValue.OPLB == "tMsWlPcHead") { var cmdUpdate = db.GetSqlStringCommand( @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1 WHERE GID=@BSNO "); cmdUpdate.Parameters.Clear(); db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); db.ExecuteNonQuery(cmdUpdate, tran); - - } else if (enumValue.OPLB == "WMS") + + } + else if (enumValue.OPLB == "WMS") { var cmdUpdate = db.GetSqlStringCommand( @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1,ISLOCK2=1 WHERE GID=@BSNO "); @@ -1082,12 +1217,76 @@ namespace DSWeb.Areas.Account.Controllers db.ExecuteNonQuery(cmdUpdate, tran); } - else { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1 WHERE BSNO=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); + else if (enumValue.OPLB == "OP_WMS_FEEDUI") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_FEEDUI_STORAGE SET BillLock=1 WHERE WMSDUIID in(select MASTERNO from v_op_bs where BSNO=@BSNO) "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_MOVE") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_MOVE SET BillLock=1 WHERE WMSDOID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_TRANSFERGOODS") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_TRANSFERGOODS SET BillLock=1 WHERE WMSTRANSFERGOODSID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_IN_DO") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_IN_DO SET BillLock=1 WHERE WMSDOID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_OUT_DO") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_OUT_DO SET BillLock=1 WHERE WMSDOID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "VW_OP_WMS_OUT_PLAN") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_OUT_PLAN SET BillLock=1 WHERE WMSPLANID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_IN_PLAN") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_IN_PLAN SET BillLock=1 WHERE WMSPLANID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1 WHERE BSNO=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); } var cmdUpdateamend = db.GetSqlStringCommand( @@ -1098,14 +1297,15 @@ namespace DSWeb.Areas.Account.Controllers i = i + 1; updateclose(enumValue.BSNO, type); - if (FEELOCKUPDATEEXCHANGE.PARAMVALUE == "1") { + if (FEELOCKUPDATEEXCHANGE.PARAMVALUE == "1") + { updateexchange(enumValue.BSNO, enumValue.ACCDATE); } } else { j = j + 1; } - + } } var msg = ""; @@ -1133,7 +1333,7 @@ namespace DSWeb.Areas.Account.Controllers return new ContentResult() { Content = json }; } - public ContentResult SelFeeLock(string data, string isAccDate, string AccDate,string isbslock="0") + public ContentResult SelFeeLock(string data, string isAccDate, string AccDate, string isbslock = "0") { var FEELOCKUPDATEEXCHANGE = MsSysParamSetDAL.GetData("PARAMNAME='FEELOCKUPDATEEXCHANGE'"); var billData = JsonConvert.Deserialize>(data); @@ -1146,13 +1346,17 @@ namespace DSWeb.Areas.Account.Controllers var sqlstr = ""; var pcsqlstr = ""; var wmssqlstr = ""; + var OPwmssqlstr = ""; + var selectbsno = ""; - if (isAccDate == "1") accdatesqlstr = ",ACCDATE='"+AccDate+"'"; + if (isAccDate == "1") accdatesqlstr = ",ACCDATE='" + AccDate + "'"; if (isbslock == "1") { pcsqlstr = ",BillStatus=1 "; wmssqlstr = ",ISLOCK=1 "; sqlstr = ",BSSTATUS=1 "; + + OPwmssqlstr = ",BillLock=1 "; } using (var conn = db.CreateConnection()) @@ -1165,88 +1369,152 @@ namespace DSWeb.Areas.Account.Controllers foreach (var enumValue in billData) { - - var FeeCount = db.ExecuteScalar(CommandType.Text, "SELECT COUNT(GID) as FeeCount from ch_fee where FEESTATUS NOT IN (0,8,9) and BSNO='" + enumValue.BSNO + "'"); - var IntFeeCount = Convert.ToInt16(FeeCount); - if (IntFeeCount == 0) - { - //if (isAccDate == "1") - //{ - // var cmdUpdate = db.GetSqlStringCommand( - // @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1,ACCDATE=@ACCDATE WHERE BSNO=@BSNO "); - // cmdUpdate.Parameters.Clear(); - // db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - // db.AddInParameter(cmdUpdate, "@ACCDATE", DbType.String,AccDate); - // db.ExecuteNonQuery(cmdUpdate, tran); - // var cmdUpdateamend = db.GetSqlStringCommand( - // @"UPDATE OP_AMEND SET FEESTATUS=1,ACCDATE=@ACCDATE WHERE BSNO=@BSNO "); - // cmdUpdateamend.Parameters.Clear(); - // db.AddInParameter(cmdUpdateamend, "@BSNO", DbType.String, enumValue.BSNO); - // db.AddInParameter(cmdUpdateamend, "@ACCDATE", DbType.String, AccDate); - // db.ExecuteNonQuery(cmdUpdateamend, tran); - // updateclose(enumValue.BSNO,1); - - //} - //else - //{ - - - - - if (enumValue.OPLB == "tMsWlPcHead") - { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1 "+ accdatesqlstr + pcsqlstr + " WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); - - } - else if (enumValue.OPLB == "WMS") - { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1,ISLOCK2=1 " + accdatesqlstr + wmssqlstr + " WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); + selectbsno = enumValue.BSNO; + var FeeCount = db.ExecuteScalar(CommandType.Text, "SELECT COUNT(GID) as FeeCount from ch_fee where FEESTATUS NOT IN (0,8,9) and BSNO='" + enumValue.BSNO + "'"); + var IntFeeCount = Convert.ToInt16(FeeCount); + if (IntFeeCount == 0) + { + //if (isAccDate == "1") + //{ + // var cmdUpdate = db.GetSqlStringCommand( + // @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1,ACCDATE=@ACCDATE WHERE BSNO=@BSNO "); + // cmdUpdate.Parameters.Clear(); + // db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + // db.AddInParameter(cmdUpdate, "@ACCDATE", DbType.String,AccDate); + // db.ExecuteNonQuery(cmdUpdate, tran); + // var cmdUpdateamend = db.GetSqlStringCommand( + // @"UPDATE OP_AMEND SET FEESTATUS=1,ACCDATE=@ACCDATE WHERE BSNO=@BSNO "); + // cmdUpdateamend.Parameters.Clear(); + // db.AddInParameter(cmdUpdateamend, "@BSNO", DbType.String, enumValue.BSNO); + // db.AddInParameter(cmdUpdateamend, "@ACCDATE", DbType.String, AccDate); + // db.ExecuteNonQuery(cmdUpdateamend, tran); + // updateclose(enumValue.BSNO,1); - } - else if (enumValue.OPLB == "WMS_IN") - { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE WMS SET FEESTATUS=1,ISLOCK2=1 " + accdatesqlstr + wmssqlstr + " WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); + //} + //else + //{ - } - else if (enumValue.OPLB == "WMS_OUT") - { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1 " + accdatesqlstr + wmssqlstr + " WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); - } - else - { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1 " + accdatesqlstr + sqlstr + " WHERE BSNO=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); - } - var cmdUpdateamend = db.GetSqlStringCommand( - @"UPDATE OP_AMEND SET FEESTATUS=1 " + accdatesqlstr +" WHERE BSNO=@BSNO "); - cmdUpdateamend.Parameters.Clear(); - db.AddInParameter(cmdUpdateamend, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdateamend, tran); - if (isbslock == "1") + if (enumValue.OPLB == "tMsWlPcHead") { - updateclose(enumValue.BSNO, 3); + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1 " + accdatesqlstr + pcsqlstr + " WHERE GID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "WMS") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1,ISLOCK2=1 " + accdatesqlstr + wmssqlstr + " WHERE GID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "WMS_IN") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE WMS SET FEESTATUS=1,ISLOCK2=1 " + accdatesqlstr + wmssqlstr + " WHERE GID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + + else if (enumValue.OPLB == "WMS_OUT") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1 " + accdatesqlstr + wmssqlstr + " WHERE GID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + + else if (enumValue.OPLB == "OP_WMS_FEEDUI") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_FEEDUI_STORAGE SET FEESTATUS=1 " + accdatesqlstr + OPwmssqlstr + " WHERE WMSDUIID in(select MASTERNO from v_op_bs where BSNO=@BSNO) "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_MOVE") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_MOVE SET FEESTATUS=1 " + accdatesqlstr + OPwmssqlstr + " WHERE WMSDOID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_TRANSFERGOODS") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_TRANSFERGOODS SET FEESTATUS=1 " + accdatesqlstr + OPwmssqlstr + " WHERE WMSTRANSFERGOODSID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_IN_DO") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_IN_DO SET FEESTATUS=1 " + accdatesqlstr + OPwmssqlstr + " WHERE WMSDOID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_OUT_DO") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_OUT_DO SET FEESTATUS=1 " + accdatesqlstr + OPwmssqlstr + " WHERE WMSDOID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "VW_OP_WMS_OUT_PLAN") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_OUT_PLAN SET FEESTATUS=1 " + accdatesqlstr + OPwmssqlstr + " WHERE WMSPLANID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_IN_PLAN") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_IN_PLAN SET FEESTATUS=1 " + accdatesqlstr + OPwmssqlstr + " WHERE WMSPLANID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1 " + accdatesqlstr + sqlstr + " WHERE BSNO=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + } + + var cmdUpdateamend = db.GetSqlStringCommand( + @"UPDATE OP_AMEND SET FEESTATUS=1 " + accdatesqlstr + " WHERE BSNO=@BSNO "); + cmdUpdateamend.Parameters.Clear(); + db.AddInParameter(cmdUpdateamend, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdateamend, tran); + if (isbslock == "1") + { + updateclose(enumValue.BSNO, 3); } else updateclose(enumValue.BSNO, 1); @@ -1261,20 +1529,34 @@ namespace DSWeb.Areas.Account.Controllers //} i = i + 1; - } - else { j = j + 1; } + } + else { j = j + 1; } } var msg = ""; - msg = "成功锁定" + i.ToString() + "票业务费用锁定," + j.ToString() + "票业务未锁定!"; + msg = "成功锁定" + i.ToString() + "票业务费用锁定 "; + if (j != 0) + { + msg = msg + "未锁定" + j.ToString() + "票 "; + } + if (i == 1) + { + T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA(); + var BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select COUNT(*) BLCOUNT from v_op_gain_sum where (TTLDR注意此票未负利润! "; + } + + } json = JsonConvert.Serialize(new { Success = true, Message = msg }); tran.Commit(); } - catch (Exception) + catch (Exception e) { tran.Rollback(); json = JsonConvert.Serialize(new { Success = false, Message = "锁定失败" }); @@ -1285,7 +1567,7 @@ namespace DSWeb.Areas.Account.Controllers } public ContentResult SelDownMonth(string data, string AccDate) { - var newDate = Convert.ToDateTime(AccDate+"-01"); + var newDate = Convert.ToDateTime(AccDate + "-01"); var nextmonth = newDate.AddMonths(1); var newperiod = nextmonth.ToString("yyyy-MM"); var billData = JsonConvert.Deserialize>(data); @@ -1303,42 +1585,42 @@ namespace DSWeb.Areas.Account.Controllers { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET ACCDATE=@ACCDATE WHERE BSNO=@BSNO "); - if (enumValue.OPLB.Equals("tMsWlPcHead")) - { - cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET ACCDATE=@ACCDATE WHERE gid=@BSNO "); - } - if (enumValue.OPLB == "WMS") - { - cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET ACCDATE=@ACCDATE WHERE ASSOCIATEDNO=@BSNO "); - } - else if (enumValue.OPLB == "WMS_IN") - { - cmdUpdate = db.GetSqlStringCommand( - @"UPDATE WMS SET ACCDATE=@ACCDATE WHERE GID=@BSNO "); - } - else if (enumValue.OPLB == "WMS_OUT") - { - cmdUpdate = db.GetSqlStringCommand( - @"UPDATE WMS_OUT SET ACCDATE=@ACCDATE WHERE GID=@BSNO "); - } + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + enumValue.OPLB + " SET ACCDATE=@ACCDATE WHERE BSNO=@BSNO "); + if (enumValue.OPLB.Equals("tMsWlPcHead")) + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + enumValue.OPLB + " SET ACCDATE=@ACCDATE WHERE gid=@BSNO "); + } + if (enumValue.OPLB == "WMS") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + enumValue.OPLB + " SET ACCDATE=@ACCDATE WHERE ASSOCIATEDNO=@BSNO "); + } + else if (enumValue.OPLB == "WMS_IN") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE WMS SET ACCDATE=@ACCDATE WHERE GID=@BSNO "); + } + else if (enumValue.OPLB == "WMS_OUT") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE WMS_OUT SET ACCDATE=@ACCDATE WHERE GID=@BSNO "); + } - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.AddInParameter(cmdUpdate, "@ACCDATE", DbType.String, newperiod); - db.ExecuteNonQuery(cmdUpdate, tran); - var cmdUpdateamend = db.GetSqlStringCommand( - @"UPDATE OP_AMEND SET ACCDATE=@ACCDATE WHERE BSNO=@BSNO "); - cmdUpdateamend.Parameters.Clear(); - db.AddInParameter(cmdUpdateamend, "@BSNO", DbType.String, enumValue.BSNO); - db.AddInParameter(cmdUpdateamend, "@ACCDATE", DbType.String, newperiod); - db.ExecuteNonQuery(cmdUpdateamend, tran); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.AddInParameter(cmdUpdate, "@ACCDATE", DbType.String, newperiod); + db.ExecuteNonQuery(cmdUpdate, tran); + var cmdUpdateamend = db.GetSqlStringCommand( + @"UPDATE OP_AMEND SET ACCDATE=@ACCDATE WHERE BSNO=@BSNO "); + cmdUpdateamend.Parameters.Clear(); + db.AddInParameter(cmdUpdateamend, "@BSNO", DbType.String, enumValue.BSNO); + db.AddInParameter(cmdUpdateamend, "@ACCDATE", DbType.String, newperiod); + db.ExecuteNonQuery(cmdUpdateamend, tran); - i = i + 1; + i = i + 1; } @@ -1362,7 +1644,7 @@ namespace DSWeb.Areas.Account.Controllers } - public ContentResult SelLockBsNo(string bsno, int type,string oplb) + public ContentResult SelLockBsNo(string bsno, int type, string oplb) { var json = JsonConvert.Serialize(new { Success = true, Message = "锁定成功" }); @@ -1377,78 +1659,78 @@ namespace DSWeb.Areas.Account.Controllers { - if (type == 2) - { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + oplb + " SET BSSTATUS=1 WHERE BSNO=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); - db.ExecuteNonQuery(cmdUpdate, tran); - i = i + 1; - updateclose(bsno, type); + if (type == 2) + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + oplb + " SET BSSTATUS=1 WHERE BSNO=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); + db.ExecuteNonQuery(cmdUpdate, tran); + i = i + 1; + updateclose(bsno, type); - } - else if (type == 1) + } + else if (type == 1) + { + var FeeCount = db.ExecuteScalar(CommandType.Text, "SELECT COUNT(GID) as FeeCount from ch_fee where FEESTATUS NOT IN (0,8,9) and BSNO='" + bsno + "'"); + var IntFeeCount = Convert.ToInt16(FeeCount); + if (IntFeeCount == 0) { - var FeeCount = db.ExecuteScalar(CommandType.Text, "SELECT COUNT(GID) as FeeCount from ch_fee where FEESTATUS NOT IN (0,8,9) and BSNO='" +bsno+ "'"); - var IntFeeCount = Convert.ToInt16(FeeCount); - if (IntFeeCount == 0) + if (oplb == "tMsWlPcHead") { - if (oplb == "tMsWlPcHead") - { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + oplb + " SET FEESTATUS=1 WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); - db.ExecuteNonQuery(cmdUpdate, tran); + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + oplb + " SET FEESTATUS=1 WHERE GID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); + db.ExecuteNonQuery(cmdUpdate, tran); - } + } else if (oplb == "WMS") { var cmdUpdate = db.GetSqlStringCommand( @"UPDATE " + oplb + " SET FEESTATUS=1,ISLOCK2=1 WHERE GID=@BSNO "); cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String,bsno); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); db.ExecuteNonQuery(cmdUpdate, tran); } else if (oplb == "WMS_IN") - { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE WMS SET FEESTATUS=1,ISLOCK2=1 WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); - db.ExecuteNonQuery(cmdUpdate, tran); + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE WMS SET FEESTATUS=1,ISLOCK2=1 WHERE GID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); + db.ExecuteNonQuery(cmdUpdate, tran); - } + } else if (oplb == "WMS_OUT") { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + oplb + " SET FEESTATUS=1 WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); - db.ExecuteNonQuery(cmdUpdate, tran); + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + oplb + " SET FEESTATUS=1 WHERE GID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); + db.ExecuteNonQuery(cmdUpdate, tran); } else - { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + oplb + " SET FEESTATUS=1 WHERE BSNO=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); - db.ExecuteNonQuery(cmdUpdate, tran); - } + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + oplb + " SET FEESTATUS=1 WHERE BSNO=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); + db.ExecuteNonQuery(cmdUpdate, tran); + } - var cmdUpdateamend = db.GetSqlStringCommand( - @"UPDATE OP_AMEND SET FEESTATUS=1 WHERE BSNO=@BSNO "); - cmdUpdateamend.Parameters.Clear(); - db.AddInParameter(cmdUpdateamend, "@BSNO", DbType.String, bsno); - db.ExecuteNonQuery(cmdUpdateamend, tran); - i = i + 1; - updateclose(bsno, type); + var cmdUpdateamend = db.GetSqlStringCommand( + @"UPDATE OP_AMEND SET FEESTATUS=1 WHERE BSNO=@BSNO "); + cmdUpdateamend.Parameters.Clear(); + db.AddInParameter(cmdUpdateamend, "@BSNO", DbType.String, bsno); + db.ExecuteNonQuery(cmdUpdateamend, tran); + i = i + 1; + updateclose(bsno, type); - } - else { j = j + 1; } + } + else { j = j + 1; } } @@ -1460,7 +1742,12 @@ namespace DSWeb.Areas.Account.Controllers } else if (type == 1) { - msg = "成功锁定" + i.ToString() + "票业务费用锁定," + j.ToString() + "票业务未锁定!"; + msg = "成功锁定" + i.ToString() + "票业务费用锁定 "; + if (j != 0) + { + msg = msg + "未锁定" + j.ToString() + "票 "; + } + } @@ -1477,7 +1764,7 @@ namespace DSWeb.Areas.Account.Controllers return new ContentResult() { Content = json }; } - public ContentResult SelFeeLockBsNo(string bsno, string isAccDate, string AccDate,string oplb, string isbslock = "0") + public ContentResult SelFeeLockBsNo(string bsno, string isAccDate, string AccDate, string oplb, string isbslock = "0") { var json = JsonConvert.Serialize(new { Success = true, Message = "锁定成功" }); @@ -1495,19 +1782,21 @@ namespace DSWeb.Areas.Account.Controllers var pcsqlstr = ""; var wmssqlstr = ""; + if (isAccDate == "1") accdatesqlstr = ",ACCDATE='" + AccDate + "'"; if (isbslock == "1") { pcsqlstr = ",BillStatus=1 "; wmssqlstr = ",ISLOCK=1 "; sqlstr = ",BSSTATUS=1 "; + //OPwmssqlstr = ",BillLock=1 "; } - var FeeCount = db.ExecuteScalar(CommandType.Text, "SELECT COUNT(GID) as FeeCount from ch_fee where FEESTATUS NOT IN (0,8,9) and BSNO='" +bsno+ "'"); - var IntFeeCount = Convert.ToInt16(FeeCount); - if (IntFeeCount == 0) - { + var FeeCount = db.ExecuteScalar(CommandType.Text, "SELECT COUNT(GID) as FeeCount from ch_fee where FEESTATUS NOT IN (0,8,9) and BSNO='" + bsno + "'"); + var IntFeeCount = Convert.ToInt16(FeeCount); + if (IntFeeCount == 0) + { //if (isAccDate == "1") //{ // var cmdUpdate = db.GetSqlStringCommand( @@ -1589,13 +1878,18 @@ namespace DSWeb.Areas.Account.Controllers //} i = i + 1; - } - else { j = j + 1; } + } + else { j = j + 1; } var msg = ""; - msg = "成功锁定" + i.ToString() + "票业务费用锁定," + j.ToString() + "票业务未锁定!"; + msg = "成功锁定" + i.ToString() + "票业务费用锁定 "; + if (j != 0) + { + msg = msg + "未锁定" + j.ToString() + "票 "; + } + json = JsonConvert.Serialize(new { Success = true, Message = msg }); @@ -1611,10 +1905,13 @@ namespace DSWeb.Areas.Account.Controllers return new ContentResult() { Content = json }; } - public ContentResult AllLock(string billsql, int type) + public ContentResult AllLock(string billsql, int type, string AccDate = "", string isAccDate = "0") { + + var accdatesqlstr = ""; + if (isAccDate == "1") accdatesqlstr = ",ACCDATE='" + AccDate + "'"; var FEELOCKUPDATEEXCHANGE = MsSysParamSetDAL.GetData("PARAMNAME='FEELOCKUPDATEEXCHANGE'"); - var billData=GetFeeDataList(billsql,Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]),"BS"); + var billData = GetFeeDataList(billsql, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), "BS"); var json = JsonConvert.Serialize(new { Success = true, Message = "锁定成功" }); Database db = DatabaseFactory.CreateDatabase(); var i = 0; @@ -1630,20 +1927,55 @@ namespace DSWeb.Areas.Account.Controllers foreach (var enumValue in billData) { - if (type == 2&& !enumValue.BSSTATUS) + if (type == 2 && !enumValue.BSSTATUS) { var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET BSSTATUS=1 WHERE BSNO=@BSNO "); + @"UPDATE " + enumValue.OPLB + " SET BSSTATUS=1 " + accdatesqlstr + " WHERE BSNO=@BSNO "); if (enumValue.OPLB.Equals("tMsWlPcHead")) { cmdUpdate = db.GetSqlStringCommand( @"UPDATE " + enumValue.OPLB + " SET BillStatus=1 WHERE gid=@BSNO "); } + else if (enumValue.OPLB == "OP_WMS_FEEDUI") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_FEEDUI_STORAGE SET BillLock=1 WHERE WMSDUIID in(select MASTERNO from v_op_bs where BSNO=@BSNO) "); + } + else if (enumValue.OPLB == "OP_WMS_MOVE") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_MOVE SET BillLock=1 WHERE WMSDOID=@BSNO "); + } + else if (enumValue.OPLB == "OP_WMS_TRANSFERGOODS") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_TRANSFERGOODS SET BillLock=1 WHERE WMSTRANSFERGOODSID=@BSNO "); + } + else if (enumValue.OPLB == "OP_WMS_IN_DO") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_IN_DO SET BillLock=1 WHERE WMSDOID=@BSNO "); + } + else if (enumValue.OPLB == "OP_WMS_OUT_DO") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_OUT_DO SET BillLock=1 WHERE WMSDOID=@BSNO "); + } + else if (enumValue.OPLB == "VW_OP_WMS_OUT_PLAN") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_OUT_PLAN SET BillLock=1 WHERE WMSPLANID=@BSNO "); + } + else if (enumValue.OPLB == "OP_WMS_IN_PLAN") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_IN_PLAN SET BillLock=1 WHERE WMSPLANID=@BSNO "); + } cmdUpdate.Parameters.Clear(); db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); db.ExecuteNonQuery(cmdUpdate, tran); - + //var cmdUpdateamend = db.GetSqlStringCommand( // @"UPDATE OP_AMEND SET BSSTATUS=1 WHERE BSNO=@BSNO "); @@ -1660,50 +1992,73 @@ namespace DSWeb.Areas.Account.Controllers var IntFeeCount = Convert.ToInt16(FeeCount); if (IntFeeCount == 0) { + var cmdUpdate = db.GetSqlStringCommand(@"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1 WHERE BSNO=@BSNO "); + + if (enumValue.OPLB == "tMsWlPcHead") { - var cmdUpdate = db.GetSqlStringCommand( + cmdUpdate = db.GetSqlStringCommand( @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1 WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); - } else if (enumValue.OPLB == "WMS") { - var cmdUpdate = db.GetSqlStringCommand( + cmdUpdate = db.GetSqlStringCommand( @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1,ISLOCK2=1 WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); - } else if (enumValue.OPLB == "WMS_IN") { - var cmdUpdate = db.GetSqlStringCommand( + cmdUpdate = db.GetSqlStringCommand( @"UPDATE WMS SET FEESTATUS=1,ISLOCK2=1 WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); } else if (enumValue.OPLB == "WMS_OUT") { - var cmdUpdate = db.GetSqlStringCommand( + cmdUpdate = db.GetSqlStringCommand( @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1 WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); } + else if (enumValue.OPLB == "OP_WMS_FEEDUI") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_FEEDUI_STORAGE SET BillLock=1 WHERE WMSDUIID in(select MASTERNO from v_op_bs where BSNO=@BSNO) "); + } + else if (enumValue.OPLB == "OP_WMS_MOVE") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_MOVE SET BillLock=1 WHERE WMSDOID=@BSNO "); + } + else if (enumValue.OPLB == "OP_WMS_TRANSFERGOODS") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_TRANSFERGOODS SET FEESTATUS=1 WHERE WMSTRANSFERGOODSID=@BSNO "); + } + else if (enumValue.OPLB == "OP_WMS_IN_DO") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_IN_DO SET FEESTATUS=1 WHERE WMSDOID=@BSNO "); + } + else if (enumValue.OPLB == "OP_WMS_OUT_DO") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_OUT_DO SET FEESTATUS=1 WHERE WMSDOID=@BSNO "); + } + else if (enumValue.OPLB == "VW_OP_WMS_OUT_PLAN") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_OUT_PLAN SET FEESTATUS=1 WHERE WMSPLANID=@BSNO "); + } + else if (enumValue.OPLB == "OP_WMS_IN_PLAN") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_IN_PLAN SET FEESTATUS=1 WHERE WMSPLANID=@BSNO "); + } else { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1 WHERE BSNO=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); + } + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); var cmdUpdateamend = db.GetSqlStringCommand( @"UPDATE OP_AMEND SET FEESTATUS=1 WHERE BSNO=@BSNO "); @@ -1723,17 +2078,22 @@ namespace DSWeb.Areas.Account.Controllers } } - if (type == 2) + if (type == 2) + { + msg = "成功锁定" + i.ToString() + "票业务!"; + } + else if (type == 1) + { + msg = "成功锁定" + i.ToString() + "票业务费用锁定 "; + if (j != 0) { - msg = "成功锁定" + i.ToString() + "票业务!"; + msg = msg + "未锁定" + j.ToString() + "票 "; } - else if (type == 1) - { - msg = "成功锁定" + i.ToString() + "票业务费用锁定," + j.ToString() + "票业务未锁定!"; - } - json = JsonConvert.Serialize(new { Success = true, Message = msg }); + } + + json = JsonConvert.Serialize(new { Success = true, Message = msg }); tran.Commit(); } catch (Exception) @@ -1745,11 +2105,12 @@ namespace DSWeb.Areas.Account.Controllers return new ContentResult() { Content = json }; } + [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 public ContentResult onFeeLockAll(string billsql, string isAccDate, string AccDate, string isbslock = "0") { var FEELOCKUPDATEEXCHANGE = MsSysParamSetDAL.GetData("PARAMNAME='FEELOCKUPDATEEXCHANGE'"); - var billData = GetFeeDataList(billsql, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]),"FEE"); + var billData = GetFeeDataList(billsql, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), "FEE"); var json = JsonConvert.Serialize(new { Success = true, Message = "锁定成功" }); Database db = DatabaseFactory.CreateDatabase(); var i = 0; @@ -1766,6 +2127,7 @@ namespace DSWeb.Areas.Account.Controllers var sqlstr = ""; var pcsqlstr = ""; var wmssqlstr = ""; + var Opwmssqlstr = ""; if (isAccDate == "1") accdatesqlstr = ",ACCDATE='" + AccDate + "'"; if (isbslock == "1") @@ -1773,81 +2135,101 @@ namespace DSWeb.Areas.Account.Controllers pcsqlstr = ",BillStatus=1 "; wmssqlstr = ",ISLOCK=1 "; sqlstr = ",BSSTATUS=1 "; + Opwmssqlstr = ",BillLock=1"; } foreach (var enumValue in billData) { - if (!enumValue.FEESTATUS) { - var FeeCount = db.ExecuteScalar(CommandType.Text, "SELECT COUNT(GID) as FeeCount from ch_fee where FEESTATUS NOT IN (0,8,9) and BSNO='" + enumValue.BSNO + "'"); - var IntFeeCount = Convert.ToInt16(FeeCount); - if (IntFeeCount == 0) + if (!enumValue.FEESTATUS) { + var FeeCount = db.ExecuteScalar(CommandType.Text, "SELECT COUNT(GID) as FeeCount from ch_fee where FEESTATUS NOT IN (0,8,9) and BSNO='" + enumValue.BSNO + "'"); + var IntFeeCount = Convert.ToInt16(FeeCount); + if (IntFeeCount == 0) + { - //if (isAccDate == "1") - //{ - // var cmdUpdate = db.GetSqlStringCommand( - // @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1,ACCDATE=@ACCDATE WHERE BSNO=@BSNO "); - // cmdUpdate.Parameters.Clear(); - // db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - // db.AddInParameter(cmdUpdate, "@ACCDATE", DbType.String, AccDate); - // db.ExecuteNonQuery(cmdUpdate, tran); + //if (isAccDate == "1") + //{ + // var cmdUpdate = db.GetSqlStringCommand( + // @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1,ACCDATE=@ACCDATE WHERE BSNO=@BSNO "); + // cmdUpdate.Parameters.Clear(); + // db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + // db.AddInParameter(cmdUpdate, "@ACCDATE", DbType.String, AccDate); + // db.ExecuteNonQuery(cmdUpdate, tran); - // var cmdUpdateamend = db.GetSqlStringCommand( - // @"UPDATE OP_AMEND SET FEESTATUS=1,ACCDATE=@ACCDATE WHERE BSNO=@BSNO "); - // cmdUpdateamend.Parameters.Clear(); - // db.AddInParameter(cmdUpdateamend, "@BSNO", DbType.String, enumValue.BSNO); - // db.AddInParameter(cmdUpdateamend, "@ACCDATE", DbType.String, AccDate); - // db.ExecuteNonQuery(cmdUpdateamend, tran); - // updateclose(enumValue.BSNO, 1); + // var cmdUpdateamend = db.GetSqlStringCommand( + // @"UPDATE OP_AMEND SET FEESTATUS=1,ACCDATE=@ACCDATE WHERE BSNO=@BSNO "); + // cmdUpdateamend.Parameters.Clear(); + // db.AddInParameter(cmdUpdateamend, "@BSNO", DbType.String, enumValue.BSNO); + // db.AddInParameter(cmdUpdateamend, "@ACCDATE", DbType.String, AccDate); + // db.ExecuteNonQuery(cmdUpdateamend, tran); + // updateclose(enumValue.BSNO, 1); + + + //} + //else + //{ + var cmdUpdate = db.GetSqlStringCommand(@"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1" + accdatesqlstr + sqlstr + " WHERE BSNO=@BSNO "); - //} - //else - //{ if (enumValue.OPLB == "tMsWlPcHead") { - var cmdUpdate = db.GetSqlStringCommand( + cmdUpdate = db.GetSqlStringCommand( @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1 " + accdatesqlstr + pcsqlstr + " WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); - - } - else if (enumValue.OPLB == "WMS") - { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1,ISLOCK2=1 " + accdatesqlstr + wmssqlstr + " WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); - - } + } + else if (enumValue.OPLB == "WMS") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1,ISLOCK2=1 " + accdatesqlstr + wmssqlstr + " WHERE GID=@BSNO "); + } else if (enumValue.OPLB == "WMS_IN") { - var cmdUpdate = db.GetSqlStringCommand( + cmdUpdate = db.GetSqlStringCommand( @"UPDATE WMS SET FEESTATUS=1,ISLOCK2=1" + accdatesqlstr + wmssqlstr + " WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); - } - else if (enumValue.OPLB == "WMS_OUT") + else if (enumValue.OPLB == "WMS_OUT") { - var cmdUpdate = db.GetSqlStringCommand( + cmdUpdate = db.GetSqlStringCommand( @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1" + accdatesqlstr + wmssqlstr + " WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); - } - else + else if (enumValue.OPLB == "OP_WMS_FEEDUI") { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1" + accdatesqlstr + sqlstr + " WHERE BSNO=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_FEEDUI_STORAGE SET FEESTATUS=1 " + Opwmssqlstr + " WHERE WMSDUIID in(select MASTERNO from v_op_bs where BSNO=@BSNO) "); + } + else if (enumValue.OPLB == "OP_WMS_MOVE") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_MOVE SET FEESTATUS=1 " + Opwmssqlstr + " WHERE WMSDOID=@BSNO "); + } + else if (enumValue.OPLB == "OP_WMS_TRANSFERGOODS") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_TRANSFERGOODS SET FEESTATUS=1 " + Opwmssqlstr + " WHERE WMSTRANSFERGOODSID=@BSNO "); + } + else if (enumValue.OPLB == "OP_WMS_IN_DO") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_IN_DO SET FEESTATUS=1 " + Opwmssqlstr + " WHERE WMSDOID=@BSNO "); + } + else if (enumValue.OPLB == "OP_WMS_OUT_DO") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_OUT_DO SET FEESTATUS=1 " + Opwmssqlstr + " WHERE WMSDOID=@BSNO "); + } + else if (enumValue.OPLB == "VW_OP_WMS_OUT_PLAN") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_OUT_PLAN SET FEESTATUS=1 " + Opwmssqlstr + " WHERE WMSPLANID=@BSNO "); + } + else if (enumValue.OPLB == "OP_WMS_IN_PLAN") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_IN_PLAN SET FEESTATUS=1 " + Opwmssqlstr + " WHERE WMSPLANID=@BSNO "); } + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + var cmdUpdateamend = db.GetSqlStringCommand( @"UPDATE OP_AMEND SET FEESTATUS=1" + accdatesqlstr + " WHERE BSNO=@BSNO "); @@ -1857,7 +2239,8 @@ namespace DSWeb.Areas.Account.Controllers if (isbslock == "1") { updateclose(enumValue.BSNO, 3); - } else + } + else updateclose(enumValue.BSNO, 1); if (FEELOCKUPDATEEXCHANGE.PARAMVALUE == "1") { @@ -1868,14 +2251,19 @@ namespace DSWeb.Areas.Account.Controllers } //} i = i + 1; + } + else { j = j + 1; } } - else { j = j + 1; } - } } - msg = "成功锁定" + i.ToString() + "票业务费用锁定," + j.ToString() + "票业务未锁定!"; + msg = "成功锁定" + i.ToString() + "票业务费用锁定 "; + if (j != 0) + { + msg = msg + "未锁定" + j.ToString() + "票 "; + } + json = JsonConvert.Serialize(new { Success = true, Message = msg }); @@ -1891,18 +2279,20 @@ namespace DSWeb.Areas.Account.Controllers return new ContentResult() { Content = json }; } - - public ContentResult SelUnLock(string data, int type,string bsunclose="0") + //业务解锁 + public ContentResult SelUnLock(string data, int type, string bsunclose = "0", string feedrcrunclose = "0") { var bsunclosestr = ""; var pcunclosestr = ""; var wmssqlstr = ""; + var opwmssqlstr = ""; if (bsunclose == "1") { bsunclosestr = ",BSSTATUS=0"; pcunclosestr = ",BillStatus=0"; wmssqlstr = ",ISLOCK=0 "; + opwmssqlstr = ",BillLock=0 "; } var billData = JsonConvert.Deserialize>(data); @@ -1921,21 +2311,93 @@ namespace DSWeb.Areas.Account.Controllers if (type == 2) { updateUnclose(enumValue.BSNO, type.ToString()); - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET BSSTATUS=0 WHERE BSNO=@BSNO "); + //var cmdUpdate = db.GetSqlStringCommand( + // @"UPDATE " + enumValue.OPLB + " SET BSSTATUS=0 WHERE BSNO=@BSNO "); //2017年4月10日17:26:51 需求编号:SR2017041000009 //Start if (enumValue.OPLB.Equals("tMsWlPcHead")) { - cmdUpdate = db.GetSqlStringCommand( + var cmdUpdate = db.GetSqlStringCommand( @"UPDATE " + enumValue.OPLB + " SET BillStatus=0 WHERE gid=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + } + else if (enumValue.OPLB == "OP_WMS_FEEDUI") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_FEEDUI_STORAGE SET BillLock=0 WHERE WMSDUIID in(select MASTERNO from v_op_bs where BSNO=@BSNO) "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_MOVE") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_MOVE SET BillLock=0 WHERE WMSDOID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_TRANSFERGOODS") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_TRANSFERGOODS SET BillLock=0 WHERE WMSTRANSFERGOODSID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_IN_DO") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_IN_DO SET BillLock=0 WHERE WMSDOID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_OUT_DO") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_OUT_DO SET BillLock=0 WHERE WMSDOID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "VW_OP_WMS_OUT_PLAN") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_OUT_PLAN SET BillLock=0 WHERE WMSPLANID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_IN_PLAN") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_IN_PLAN SET BillLock=0 WHERE WMSPLANID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + enumValue.OPLB + " SET BSSTATUS=0 WHERE BSNO=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); } //End - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); + } else if (type == 1) @@ -1944,7 +2406,7 @@ namespace DSWeb.Areas.Account.Controllers if (enumValue.OPLB == "tMsWlPcHead") { var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=0"+ pcunclosestr + " WHERE GID=@BSNO "); + @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=0" + pcunclosestr + " WHERE GID=@BSNO "); cmdUpdate.Parameters.Clear(); db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); db.ExecuteNonQuery(cmdUpdate, tran); @@ -1953,7 +2415,7 @@ namespace DSWeb.Areas.Account.Controllers else if (enumValue.OPLB == "WMS") { var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=0,ISLOCK2=0"+ wmssqlstr + " WHERE GID=@BSNO "); + @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=0,ISLOCK2=0" + wmssqlstr + " WHERE GID=@BSNO "); cmdUpdate.Parameters.Clear(); db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); db.ExecuteNonQuery(cmdUpdate, tran); @@ -1962,7 +2424,7 @@ namespace DSWeb.Areas.Account.Controllers else if (enumValue.OPLB == "WMS_IN") { var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE WMS SET FEESTATUS=0,ISLOCK2=0"+ wmssqlstr + " WHERE GID=@BSNO "); + @"UPDATE WMS SET FEESTATUS=0,ISLOCK2=0" + wmssqlstr + " WHERE GID=@BSNO "); cmdUpdate.Parameters.Clear(); db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); db.ExecuteNonQuery(cmdUpdate, tran); @@ -1971,7 +2433,71 @@ namespace DSWeb.Areas.Account.Controllers else if (enumValue.OPLB == "WMS_OUT") { var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=0"+ wmssqlstr + " WHERE GID=@BSNO "); + @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=0" + wmssqlstr + " WHERE GID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + + else if (enumValue.OPLB == "OP_WMS_FEEDUI") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_FEEDUI_STORAGE SET FEESTATUS=0 " + opwmssqlstr + " WHERE WMSDUIID in(select MASTERNO from v_op_bs where BSNO=@BSNO) "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_MOVE") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_MOVE SET FEESTATUS=0 " + opwmssqlstr + " WHERE WMSDOID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_TRANSFERGOODS") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_TRANSFERGOODS SET FEESTATUS=0 " + opwmssqlstr + " WHERE WMSTRANSFERGOODSID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_IN_DO") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_IN_DO SET FEESTATUS=0 " + opwmssqlstr + " WHERE WMSDOID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_OUT_DO") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_OUT_DO SET FEESTATUS=0 " + opwmssqlstr + " WHERE WMSDOID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "VW_OP_WMS_OUT_PLAN") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_OUT_PLAN SET FEESTATUS=0 " + opwmssqlstr + " WHERE WMSPLANID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); + + } + else if (enumValue.OPLB == "OP_WMS_IN_PLAN") + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_IN_PLAN SET FEESTATUS=0 " + opwmssqlstr + " WHERE WMSPLANID=@BSNO "); cmdUpdate.Parameters.Clear(); db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); db.ExecuteNonQuery(cmdUpdate, tran); @@ -1980,7 +2506,7 @@ namespace DSWeb.Areas.Account.Controllers else { var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=0"+ bsunclosestr + " WHERE BSNO=@BSNO "); + @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=0" + bsunclosestr + " WHERE BSNO=@BSNO "); cmdUpdate.Parameters.Clear(); db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); db.ExecuteNonQuery(cmdUpdate, tran); @@ -1991,6 +2517,23 @@ namespace DSWeb.Areas.Account.Controllers db.AddInParameter(cmdUpdateamend, "@BSNO", DbType.String, enumValue.BSNO); db.ExecuteNonQuery(cmdUpdateamend, tran); + if (feedrcrunclose == "1") + { + + var cmdUpdate = db.GetSqlStringCommand( + @" update op_close set DRCLOSE=0" + + " where BSNO='" + enumValue.BSNO + "' "); + + db.ExecuteNonQuery(cmdUpdate, tran); + + var cmdUpdatecr = db.GetSqlStringCommand( + @" update op_close set CRCLOSE=0" + + " where BSNO='" + enumValue.BSNO + "' "); + + db.ExecuteNonQuery(cmdUpdatecr, tran); + + } + } } @@ -1998,7 +2541,7 @@ namespace DSWeb.Areas.Account.Controllers tran.Commit(); } - catch (Exception) + catch (Exception e) { tran.Rollback(); json = JsonConvert.Serialize(new { Success = false, Message = "撤销锁定失败" }); @@ -2008,7 +2551,7 @@ namespace DSWeb.Areas.Account.Controllers return new ContentResult() { Content = json }; } - public ContentResult SelUnLockBsNo(string bsno, int type,string oplb) + public ContentResult SelUnLockBsNo(string bsno, int type, string oplb) { var json = JsonConvert.Serialize(new { Success = true, Message = "撤销锁定成功" }); @@ -2022,28 +2565,28 @@ namespace DSWeb.Areas.Account.Controllers - if (type == 2) - { + if (type == 2) + { updateUnclose(bsno, type.ToString()); var cmdUpdate = db.GetSqlStringCommand( @"UPDATE " + oplb + " SET BSSTATUS=0 WHERE BSNO=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); - db.ExecuteNonQuery(cmdUpdate, tran); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); + db.ExecuteNonQuery(cmdUpdate, tran); - } - else if (type == 1) - { + } + else if (type == 1) + { updateUnclose(bsno, type.ToString()); if (oplb == "tMsWlPcHead") - { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + oplb + " SET FEESTATUS=0 WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String,bsno); - db.ExecuteNonQuery(cmdUpdate, tran); + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + oplb + " SET FEESTATUS=0 WHERE GID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); + db.ExecuteNonQuery(cmdUpdate, tran); } else if (oplb == "WMS") @@ -2051,45 +2594,45 @@ namespace DSWeb.Areas.Account.Controllers var cmdUpdate = db.GetSqlStringCommand( @"UPDATE " + oplb + " SET FEESTATUS=0,ISLOCK2=0 WHERE GID=@BSNO "); cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String,bsno); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); db.ExecuteNonQuery(cmdUpdate, tran); } else if (oplb == "WMS_IN") - { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE WMS SET FEESTATUS=0,ISLOCK2=0 WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); - db.ExecuteNonQuery(cmdUpdate, tran); + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE WMS SET FEESTATUS=0,ISLOCK2=0 WHERE GID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); + db.ExecuteNonQuery(cmdUpdate, tran); } else if (oplb == "WMS_OUT") - { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + oplb + " SET FEESTATUS=0 WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); - db.ExecuteNonQuery(cmdUpdate, tran); + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + oplb + " SET FEESTATUS=0 WHERE GID=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); + db.ExecuteNonQuery(cmdUpdate, tran); - } + } else - { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + oplb + " SET FEESTATUS=0 WHERE BSNO=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); - db.ExecuteNonQuery(cmdUpdate, tran); - } + { + var cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + oplb + " SET FEESTATUS=0 WHERE BSNO=@BSNO "); + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno); + db.ExecuteNonQuery(cmdUpdate, tran); + } - var cmdUpdateamend = db.GetSqlStringCommand( - @"UPDATE OP_AMEND SET FEESTATUS=0 WHERE BSNO=@BSNO "); - cmdUpdateamend.Parameters.Clear(); - db.AddInParameter(cmdUpdateamend, "@BSNO", DbType.String, bsno); - db.ExecuteNonQuery(cmdUpdateamend, tran); + var cmdUpdateamend = db.GetSqlStringCommand( + @"UPDATE OP_AMEND SET FEESTATUS=0 WHERE BSNO=@BSNO "); + cmdUpdateamend.Parameters.Clear(); + db.AddInParameter(cmdUpdateamend, "@BSNO", DbType.String, bsno); + db.ExecuteNonQuery(cmdUpdateamend, tran); - } + } @@ -2104,31 +2647,34 @@ namespace DSWeb.Areas.Account.Controllers return new ContentResult() { Content = json }; } + [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 - public ContentResult AllUnLock(string billsql, int type, string bsunclose = "0") + public ContentResult AllUnLock(string billsql, int type, string bsunclose = "0", string feedrcrunclose = "0") { var period = ChMonthCloseDAL.GetData("1=1", Convert.ToString(Session["COMPANYID"])); var bsunclosestr = ""; var pcunclosestr = ""; var wmssqlstr = ""; + var OPwmssqlstr = ""; if (bsunclose == "1") { bsunclosestr = ",BSSTATUS=0"; pcunclosestr = ",BillStatus=0"; wmssqlstr = ",ISLOCK=0 "; + OPwmssqlstr = ",BillLock=0 "; } if (!string.IsNullOrEmpty(billsql)) { - billsql = billsql + " and ACCDATE>='"+period.PERIOD+"'" ; + billsql = billsql + " and ACCDATE>='" + period.PERIOD + "'"; } else { - billsql = " and ACCDATE>='" + period.PERIOD + "'"; + billsql = " ACCDATE>='" + period.PERIOD + "'"; } var typestr = "BS"; - if (type==1) typestr = "FEE"; + if (type == 1) typestr = "FEE"; var billData = GetFeeDataList(billsql, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), typestr); var json = JsonConvert.Serialize(new { Success = true, Message = "锁定成功" }); @@ -2159,7 +2705,43 @@ namespace DSWeb.Areas.Account.Controllers { cmdUpdate = db.GetSqlStringCommand( @"UPDATE " + enumValue.OPLB + " SET BillStatus=0 WHERE gid=@BSNO "); - } + } + else if (enumValue.OPLB == "OP_WMS_FEEDUI") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_FEEDUI_STORAGE SET BillLock=0 WHERE WMSDUIID in(select MASTERNO from v_op_bs where BSNO=@BSNO) "); + } + else if (enumValue.OPLB == "OP_WMS_MOVE") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_MOVE SET BillLock=0 WHERE WMSDOID=@BSNO "); + } + else if (enumValue.OPLB == "OP_WMS_TRANSFERGOODS") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_TRANSFERGOODS SET BillLock=0 WHERE WMSTRANSFERGOODSID=@BSNO "); + } + else if (enumValue.OPLB == "OP_WMS_IN_DO") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_IN_DO SET BillLock=0 WHERE WMSDOID=@BSNO "); + } + else if (enumValue.OPLB == "OP_WMS_OUT_DO") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_OUT_DO SET BillLock=0 WHERE WMSDOID=@BSNO "); + } + else if (enumValue.OPLB == "VW_OP_WMS_OUT_PLAN") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_OUT_PLAN SET BillLock=0 WHERE WMSPLANID=@BSNO "); + } + else if (enumValue.OPLB == "OP_WMS_IN_PLAN") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_IN_PLAN SET BillLock=0 WHERE WMSPLANID=@BSNO "); + } + //End cmdUpdate.Parameters.Clear(); db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); @@ -2175,50 +2757,68 @@ namespace DSWeb.Areas.Account.Controllers } else updateUnclose(enumValue.BSNO, type.ToString()); + var cmdUpdate = db.GetSqlStringCommand(@"UPDATE " + enumValue.OPLB + " SET FEESTATUS=0" + bsunclosestr + " WHERE BSNO=@BSNO "); + if (enumValue.OPLB == "tMsWlPcHead") { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1"+ pcunclosestr + " WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); - + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=1" + pcunclosestr + " WHERE GID=@BSNO "); } else if (enumValue.OPLB == "WMS") { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=0,ISLOCK2=0"+ wmssqlstr + " WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); - + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=0,ISLOCK2=0" + wmssqlstr + " WHERE GID=@BSNO "); } else if (enumValue.OPLB == "WMS_IN") { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE WMS SET FEESTATUS=0,ISLOCK2=0"+ wmssqlstr + " WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); - + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE WMS SET FEESTATUS=0,ISLOCK2=0" + wmssqlstr + " WHERE GID=@BSNO "); } else if (enumValue.OPLB == "WMS_OUT") { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=0"+ wmssqlstr + " WHERE GID=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); - + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=0" + wmssqlstr + " WHERE GID=@BSNO "); } - else + else if (enumValue.OPLB == "OP_WMS_FEEDUI") { - var cmdUpdate = db.GetSqlStringCommand( - @"UPDATE " + enumValue.OPLB + " SET FEESTATUS=0"+ bsunclosestr + " WHERE BSNO=@BSNO "); - cmdUpdate.Parameters.Clear(); - db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); - db.ExecuteNonQuery(cmdUpdate, tran); + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_FEEDUI_STORAGE SET FEESTATUS=0 " + OPwmssqlstr + " WHERE WMSDUIID in(select MASTERNO from v_op_bs where BSNO=@BSNO) "); + } + else if (enumValue.OPLB == "OP_WMS_MOVE") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_MOVE SET FEESTATUS=0 " + OPwmssqlstr + " WHERE WMSDOID=@BSNO "); + } + else if (enumValue.OPLB == "OP_WMS_TRANSFERGOODS") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_TRANSFERGOODS SET FEESTATUS=0 " + OPwmssqlstr + " WHERE WMSTRANSFERGOODSID=@BSNO "); } + else if (enumValue.OPLB == "OP_WMS_IN_DO") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_IN_DO SET FEESTATUS=0 " + OPwmssqlstr + " WHERE WMSDOID=@BSNO "); + } + else if (enumValue.OPLB == "OP_WMS_OUT_DO") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_OUT_DO SET FEESTATUS=0 " + OPwmssqlstr + " WHERE WMSDOID=@BSNO "); + } + else if (enumValue.OPLB == "VW_OP_WMS_OUT_PLAN") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_OUT_PLAN SET FEESTATUS=0 " + OPwmssqlstr + " WHERE WMSPLANID=@BSNO "); + } + else if (enumValue.OPLB == "OP_WMS_IN_PLAN") + { + cmdUpdate = db.GetSqlStringCommand( + @"UPDATE OP_WMS_IN_PLAN SET FEESTATUS=0 " + OPwmssqlstr + " WHERE WMSPLANID=@BSNO "); + } + + + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, enumValue.BSNO); + db.ExecuteNonQuery(cmdUpdate, tran); var cmdUpdateamend = db.GetSqlStringCommand( @"UPDATE OP_AMEND SET FEESTATUS=0 WHERE BSNO=@BSNO "); @@ -2227,6 +2827,21 @@ namespace DSWeb.Areas.Account.Controllers db.ExecuteNonQuery(cmdUpdateamend, tran); + if (feedrcrunclose == "1") + { + + var cmdUpdate2 = db.GetSqlStringCommand( + @" update op_close set DRCLOSE=0" + + " where BSNO='" + enumValue.BSNO + "' "); + + db.ExecuteNonQuery(cmdUpdate2, tran); + + var cmdUpdatecr = db.GetSqlStringCommand( + @" update op_close set CRCLOSE=0" + + " where BSNO='" + enumValue.BSNO + "' "); + db.ExecuteNonQuery(cmdUpdatecr, tran); + } + } } @@ -2251,7 +2866,7 @@ namespace DSWeb.Areas.Account.Controllers Database db = DatabaseFactory.CreateDatabase(); using (var conn = db.CreateConnection()) { - + conn.Open(); var tran = conn.BeginTransaction(); try @@ -2264,7 +2879,7 @@ namespace DSWeb.Areas.Account.Controllers var cmdUpdate = db.GetSqlStringCommand( @"if (select bsno from op_close where bsno='" + bsno + "') is null insert into op_close values(newid(),'" + bsno + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + Convert.ToString(Session["SHOWNAME"]) + "',null,'',0,0,0) else update op_close set BSCLOSETIME='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") - + "',BSCLOSEOP='" + Convert.ToString(Session["SHOWNAME"]) + "' where BSNO='"+bsno+"' "); + + "',BSCLOSEOP='" + Convert.ToString(Session["SHOWNAME"]) + "' where BSNO='" + bsno + "' "); db.ExecuteNonQuery(cmdUpdate, tran); } @@ -2280,8 +2895,8 @@ namespace DSWeb.Areas.Account.Controllers else if (type == 3) { var cmdUpdate = db.GetSqlStringCommand( - @"if (select bsno from op_close where bsno='" + bsno + "') is null insert into op_close values(newid(),'" + bsno + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")+ "','" + Convert.ToString(Session["SHOWNAME"]) + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") - + "','" + Convert.ToString(Session["SHOWNAME"]) + "',0,0,0) else update op_close set BSCLOSETIME='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")+"',FEECLOSETIME ='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + @"if (select bsno from op_close where bsno='" + bsno + "') is null insert into op_close values(newid(),'" + bsno + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + Convert.ToString(Session["SHOWNAME"]) + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + + "','" + Convert.ToString(Session["SHOWNAME"]) + "',0,0,0) else update op_close set BSCLOSETIME='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',FEECLOSETIME ='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',BSCLOSEOP='" + Convert.ToString(Session["SHOWNAME"]) + "',FEECLOSEOP='" + Convert.ToString(Session["SHOWNAME"]) + "' where BSNO='" + bsno + "' "); db.ExecuteNonQuery(cmdUpdate, tran); @@ -2353,9 +2968,10 @@ namespace DSWeb.Areas.Account.Controllers + "','" + Convert.ToString(Session["SHOWNAME"]) + "') "); db.ExecuteNonQuery(cmdUpdate3, tran); } - else { + else + { var cmdUpdate2 = db.GetSqlStringCommand( - @"insert into op_unclose values(newid(),'" + bsno + "','"+type+"','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + @"insert into op_unclose values(newid(),'" + bsno + "','" + type + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + Convert.ToString(Session["SHOWNAME"]) + "') "); db.ExecuteNonQuery(cmdUpdate2, tran); @@ -2380,9 +2996,10 @@ namespace DSWeb.Areas.Account.Controllers public bool updateexchange(string bsno, string accdate) { var result = true; - var curexlist = MsCurrencyExchangeDAL.GetDataList("STARTTIME<='"+ accdate+ "-01' and ENDTIME>='"+ accdate + "-01'", Convert.ToString(Session["COMPANYID"])); - if (curexlist != null && curexlist.Count!= 0) { - + var curexlist = MsCurrencyExchangeDAL.GetDataList("STARTTIME<='" + accdate + "-01' and ENDTIME>='" + accdate + "-01'", Convert.ToString(Session["COMPANYID"])); + if (curexlist != null && curexlist.Count != 0) + { + Database db = DatabaseFactory.CreateDatabase(); using (var conn = db.CreateConnection()) { @@ -2398,7 +3015,7 @@ namespace DSWeb.Areas.Account.Controllers var cmdUpdate = db.GetSqlStringCommand( - @"update ch_fee set EXCHANGERATE=@EXCHANGERATE where CURRENCY=@CURRENCY and feetype=1 and BSNO='"+bsno+"'"); + @"update ch_fee set EXCHANGERATE=@EXCHANGERATE where CURRENCY=@CURRENCY and feetype=1 and BSNO='" + bsno + "'"); var cmdUpdateCr = db.GetSqlStringCommand( @@ -2490,53 +3107,53 @@ namespace DSWeb.Areas.Account.Controllers //其他常用科目设置 支出USD sSQL = "SELECT top 1 * from cw_accitems where ACCID='" + ds.Tables[0].Rows[0]["TMSFC"].ToString().Trim() + "'"; DataSet ds11 = T_ALL_DA.GetAllSQL(sSQL); - foreach (var enumValue in billData) + foreach (var enumValue in billData) + { + + var strEXPLAN = ""; + sSQL = "select *"; + sSQL += ", FAPCODE=(select top 1 FAPCODE from info_client where SHORTNAME=v_op_bill.CUSTOMERNAME)"; + sSQL += ", FARCODE=(select top 1 FARCODE from info_client where SHORTNAME=v_op_bill.CUSTOMERNAME)"; + sSQL += ", DEPTID=(select top 1 FINANCESOFTCODE from sys_dept where DEPTNAME=v_op_bill.SALEDEPT and LINKID='" + Convert.ToString(Session["COMPANYID"]) + "')"; + sSQL += ", EMPLID=(select top 1 FINANCESOFTCODE from user_baseinfo where USERID in (select gid from [user] where ISDELETED=0 and SHOWNAME=v_op_bill.SALE) and COMPANYNAME=(select [NAME] from [company] where GID='" + Convert.ToString(Session["COMPANYID"]) + "'))"; + sSQL += " from v_op_bill where ISNULL(ISVOU,0)=0 AND bsno in ('" + enumValue.BSNO + "')"; + DataSet ds5 = T_ALL_DA.GetAllSQL(sSQL); + if (ds5 != null) + { + if (ds.Tables[0].Rows[0]["ISCLIENTNAME"].ToString().Trim() == "True") + { + strEXPLAN += " " + ds5.Tables[0].Rows[0]["CUSTOMERNAME"].ToString().Trim(); + } + if (ds.Tables[0].Rows[0]["ISCUSTNO"].ToString().Trim() == "True") + { + strEXPLAN += " " + ds5.Tables[0].Rows[0]["CUSTNO"].ToString().Trim(); + } + if (ds.Tables[0].Rows[0]["ISMBLNO"].ToString().Trim() == "True") + { + strEXPLAN += " " + ds5.Tables[0].Rows[0]["MBLNO"].ToString().Trim(); + } + if (ds.Tables[0].Rows[0]["ISVESSEL"].ToString().Trim() == "True") + { + strEXPLAN += " " + ds5.Tables[0].Rows[0]["VESSEL"].ToString().Trim(); + } + if (ds.Tables[0].Rows[0]["ISVOYNO"].ToString().Trim() == "True") { + strEXPLAN += " " + ds5.Tables[0].Rows[0]["VOYNO"].ToString().Trim(); + } + iResult = getSCHxt(ds, "'" + enumValue.BSNO + "'", "", strEXPLAN, ds5.Tables[0].Rows[0]["DEPTID"].ToString().Trim(), ds5.Tables[0].Rows[0]["EMPLID"].ToString().Trim(), ds5.Tables[0].Rows[0]["SALE"].ToString().Trim(), ds5.Tables[0].Rows[0]["MBLNO"].ToString().Trim(), ds2, ds3, ds6, ds7, ds8, ds9, ds10, ds11, Convert.ToString(Session["USERID"]), ISRATE, tbRATE, strVOUDATE, strPREPARED); - var strEXPLAN = ""; - sSQL = "select *"; - sSQL += ", FAPCODE=(select top 1 FAPCODE from info_client where SHORTNAME=v_op_bill.CUSTOMERNAME)"; - sSQL += ", FARCODE=(select top 1 FARCODE from info_client where SHORTNAME=v_op_bill.CUSTOMERNAME)"; - sSQL += ", DEPTID=(select top 1 FINANCESOFTCODE from sys_dept where DEPTNAME=v_op_bill.SALEDEPT and LINKID='" + Convert.ToString(Session["COMPANYID"]) + "')"; - sSQL += ", EMPLID=(select top 1 FINANCESOFTCODE from user_baseinfo where USERID in (select gid from [user] where ISDELETED=0 and SHOWNAME=v_op_bill.SALE) and COMPANYNAME=(select [NAME] from [company] where GID='" +Convert.ToString(Session["COMPANYID"])+ "'))"; - sSQL += " from v_op_bill where ISNULL(ISVOU,0)=0 AND bsno in ('" + enumValue.BSNO + "')"; - DataSet ds5 = T_ALL_DA.GetAllSQL(sSQL); - if (ds5 != null) - { - if (ds.Tables[0].Rows[0]["ISCLIENTNAME"].ToString().Trim() == "True") - { - strEXPLAN += " " + ds5.Tables[0].Rows[0]["CUSTOMERNAME"].ToString().Trim(); - } - if (ds.Tables[0].Rows[0]["ISCUSTNO"].ToString().Trim() == "True") - { - strEXPLAN += " " + ds5.Tables[0].Rows[0]["CUSTNO"].ToString().Trim(); - } - if (ds.Tables[0].Rows[0]["ISMBLNO"].ToString().Trim() == "True") - { - strEXPLAN += " " + ds5.Tables[0].Rows[0]["MBLNO"].ToString().Trim(); - } - if (ds.Tables[0].Rows[0]["ISVESSEL"].ToString().Trim() == "True") - { - strEXPLAN += " " + ds5.Tables[0].Rows[0]["VESSEL"].ToString().Trim(); - } - if (ds.Tables[0].Rows[0]["ISVOYNO"].ToString().Trim() == "True") - { - strEXPLAN += " " + ds5.Tables[0].Rows[0]["VOYNO"].ToString().Trim(); - } - iResult = getSCHxt(ds,"'"+enumValue.BSNO+"'", "", strEXPLAN, ds5.Tables[0].Rows[0]["DEPTID"].ToString().Trim(), ds5.Tables[0].Rows[0]["EMPLID"].ToString().Trim(), ds5.Tables[0].Rows[0]["SALE"].ToString().Trim(), ds5.Tables[0].Rows[0]["MBLNO"].ToString().Trim(), ds2, ds3, ds6, ds7, ds8, ds9, ds10, ds11, Convert.ToString(Session["USERID"]),ISRATE,tbRATE,strVOUDATE,strPREPARED); + } - } + } + var msg = ""; - } - var msg = ""; - - msg = "成功生成凭证" + i.ToString() + "票业务!"; + msg = "成功生成凭证" + i.ToString() + "票业务!"; - json = JsonConvert.Serialize(new { Success = true, Message = msg }); - return new ContentResult() { Content = json }; + json = JsonConvert.Serialize(new { Success = true, Message = msg }); + return new ContentResult() { Content = json }; } public ContentResult CreateVouAll(string billsql, bool ISRATE, string tbRATE, string strVOUDATE, string strPREPARED) @@ -2635,6 +3252,7 @@ namespace DSWeb.Areas.Account.Controllers return new ContentResult() { Content = json }; } + [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 public static int getSCHxt(DataSet ds, string sGids, string strVESSEL, string strEXPLAN, string strDEPTID, string strEMPLID, string strSALE, string strBLNO, DataSet ds2, DataSet ds3, DataSet ds6, DataSet ds7, DataSet ds8, DataSet ds9, DataSet ds10, DataSet ds11, string strUserID, bool ISRATE, string tbRATE, string strVOUDATE, string strPREPARED) { @@ -2689,1155 +3307,1155 @@ namespace DSWeb.Areas.Account.Controllers #endregion - string strORDNO = getBSNO(); - CwVouchersDA CwVouchersDA = new CwVouchersDA(); - IList CwVouitemsEntities = new List(); - - #region 基本语句 - // - //(CASE WHEN FEETYPE = 1 THEN '应收账款' ELSE '应付账款' END) as 类型 - //,CUSTOMERNAME 客户名称 - //,EXCHANGERATE 汇率 - //,CURRENCY 币别` - //,ISADVANCEDPAY 是否垫付 - //,SUM(AMOUNT) AS 金额 - //,SUM(AMOUNT*EXCHANGERATE) AS 合计金额 - if (ISRATE == true) - { + string strORDNO = getBSNO(); + CwVouchersDA CwVouchersDA = new CwVouchersDA(); + IList CwVouitemsEntities = new List(); - if (ds.Tables[0].Rows[0]["AR"].ToString().Trim() == ds.Tables[0].Rows[0]["ARFC"].ToString().Trim()) - { + #region 基本语句 + // + //(CASE WHEN FEETYPE = 1 THEN '应收账款' ELSE '应付账款' END) as 类型 + //,CUSTOMERNAME 客户名称 + //,EXCHANGERATE 汇率 + //,CURRENCY 币别` + //,ISADVANCEDPAY 是否垫付 + //,SUM(AMOUNT) AS 金额 + //,SUM(AMOUNT*EXCHANGERATE) AS 合计金额 + if (ISRATE == true) + { + if (ds.Tables[0].Rows[0]["AR"].ToString().Trim() == ds.Tables[0].Rows[0]["ARFC"].ToString().Trim()) + { - sSQL = "SELECT (CASE WHEN FEETYPE = 1 THEN '应收账款' ELSE '应付账款' END) as FEETYPE"; - sSQL += ", FAPCODE=(select top 1 FAPCODE from info_client where SHORTNAME=VW_ch_fee_op.CUSTOMERNAME)"; - sSQL += ", FARCODE=(select top 1 FARCODE from info_client where SHORTNAME=VW_ch_fee_op.CUSTOMERNAME)"; - sSQL += ",CUSTOMERNAME,1 EXCHANGERATE,'RMB' CURRENCY,ISADVANCEDPAY,SUM(AMOUNT*EXCHANGERATE) AS je,SUM(AMOUNT*EXCHANGERATE) AS hj " + strISEXPLAN; - sSQL += " From VW_ch_fee_op WHERE 1=1 and bsno in (select BSNO from v_op_bill where isnull(isvou,0)=0 and bsno in(" + sGids.Trim() + ") " + strVESSEL + ")"; - sSQL += " GROUP BY FEETYPE,CUSTOMERNAME,ISADVANCEDPAY" + strISEXPLAN; - sSQL += " ORDER BY FEETYPE desc,CUSTOMERNAME" + strISEXPLAN; - } - else - { - sSQL = "SELECT (CASE WHEN FEETYPE = 1 THEN '应收账款' ELSE '应付账款' END) as FEETYPE"; - sSQL += ", FAPCODE=(select top 1 FAPCODE from info_client where SHORTNAME=VW_ch_fee_op.CUSTOMERNAME)"; - sSQL += ", FARCODE=(select top 1 FARCODE from info_client where SHORTNAME=VW_ch_fee_op.CUSTOMERNAME)"; - sSQL += ",CUSTOMERNAME,EXCHANGERATE,CURRENCY,ISADVANCEDPAY,SUM(AMOUNT) AS je,SUM(AMOUNT*EXCHANGERATE) AS hj " + strISEXPLAN; - sSQL += " From VW_ch_fee_op WHERE 1=1 and bsno in (select BSNO from v_op_bill where isnull(isvou,0)=0 and bsno in(" + sGids.Trim() + ") " + strVESSEL + ")"; - sSQL += " GROUP BY FEETYPE,CUSTOMERNAME,EXCHANGERATE,CURRENCY,ISADVANCEDPAY" + strISEXPLAN; - sSQL += " ORDER BY FEETYPE desc,CURRENCY,CUSTOMERNAME" + strISEXPLAN; - } + sSQL = "SELECT (CASE WHEN FEETYPE = 1 THEN '应收账款' ELSE '应付账款' END) as FEETYPE"; + sSQL += ", FAPCODE=(select top 1 FAPCODE from info_client where SHORTNAME=VW_ch_fee_op.CUSTOMERNAME)"; + sSQL += ", FARCODE=(select top 1 FARCODE from info_client where SHORTNAME=VW_ch_fee_op.CUSTOMERNAME)"; + sSQL += ",CUSTOMERNAME,1 EXCHANGERATE,'RMB' CURRENCY,ISADVANCEDPAY,SUM(AMOUNT*EXCHANGERATE) AS je,SUM(AMOUNT*EXCHANGERATE) AS hj " + strISEXPLAN; + sSQL += " From VW_ch_fee_op WHERE 1=1 and bsno in (select BSNO from v_op_bill where isnull(isvou,0)=0 and bsno in(" + sGids.Trim() + ") " + strVESSEL + ")"; + sSQL += " GROUP BY FEETYPE,CUSTOMERNAME,ISADVANCEDPAY" + strISEXPLAN; + sSQL += " ORDER BY FEETYPE desc,CUSTOMERNAME" + strISEXPLAN; + } else { sSQL = "SELECT (CASE WHEN FEETYPE = 1 THEN '应收账款' ELSE '应付账款' END) as FEETYPE"; sSQL += ", FAPCODE=(select top 1 FAPCODE from info_client where SHORTNAME=VW_ch_fee_op.CUSTOMERNAME)"; sSQL += ", FARCODE=(select top 1 FARCODE from info_client where SHORTNAME=VW_ch_fee_op.CUSTOMERNAME)"; - sSQL += ",CUSTOMERNAME,EXCHANGERATE,CURRENCY,ISADVANCEDPAY,SUM(AMOUNT) AS je,SUM(AMOUNT*" + tbRATE.Trim() + ") AS hj " + strISEXPLAN; + sSQL += ",CUSTOMERNAME,EXCHANGERATE,CURRENCY,ISADVANCEDPAY,SUM(AMOUNT) AS je,SUM(AMOUNT*EXCHANGERATE) AS hj " + strISEXPLAN; sSQL += " From VW_ch_fee_op WHERE 1=1 and bsno in (select BSNO from v_op_bill where isnull(isvou,0)=0 and bsno in(" + sGids.Trim() + ") " + strVESSEL + ")"; sSQL += " GROUP BY FEETYPE,CUSTOMERNAME,EXCHANGERATE,CURRENCY,ISADVANCEDPAY" + strISEXPLAN; sSQL += " ORDER BY FEETYPE desc,CURRENCY,CUSTOMERNAME" + strISEXPLAN; } - #endregion - DataSet ds1 = T_ALL_DA.GetAllSQL(sSQL); - if (ds1 != null) + } + else + { + sSQL = "SELECT (CASE WHEN FEETYPE = 1 THEN '应收账款' ELSE '应付账款' END) as FEETYPE"; + sSQL += ", FAPCODE=(select top 1 FAPCODE from info_client where SHORTNAME=VW_ch_fee_op.CUSTOMERNAME)"; + sSQL += ", FARCODE=(select top 1 FARCODE from info_client where SHORTNAME=VW_ch_fee_op.CUSTOMERNAME)"; + sSQL += ",CUSTOMERNAME,EXCHANGERATE,CURRENCY,ISADVANCEDPAY,SUM(AMOUNT) AS je,SUM(AMOUNT*" + tbRATE.Trim() + ") AS hj " + strISEXPLAN; + sSQL += " From VW_ch_fee_op WHERE 1=1 and bsno in (select BSNO from v_op_bill where isnull(isvou,0)=0 and bsno in(" + sGids.Trim() + ") " + strVESSEL + ")"; + sSQL += " GROUP BY FEETYPE,CUSTOMERNAME,EXCHANGERATE,CURRENCY,ISADVANCEDPAY" + strISEXPLAN; + sSQL += " ORDER BY FEETYPE desc,CURRENCY,CUSTOMERNAME" + strISEXPLAN; + } + #endregion + DataSet ds1 = T_ALL_DA.GetAllSQL(sSQL); + if (ds1 != null) + { + #region 应收、应付账款 + for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) { - #region 应收、应付账款 - for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) + n = i;// +1; + if (Math.Round(Decimal.Parse(ds1.Tables[0].Rows[i]["hj"].ToString().Trim()), 2, MidpointRounding.AwayFromZero) != 0) { - n = i;// +1; - if (Math.Round(Decimal.Parse(ds1.Tables[0].Rows[i]["hj"].ToString().Trim()), 2, MidpointRounding.AwayFromZero) != 0) - { - CwVouitemsEntity CwVouitemsEntity = new CwVouitemsEntity(); - //CwVouitemsEntity.GID 唯一编码 newid() - CwVouitemsEntity.ORDNO = strORDNO.Trim(); - CwVouitemsEntity.ITEMNO = n;// 行号 - CwVouitemsEntity.PACCID = "";//父级科目贷码 - CwVouitemsEntity.PROPERTY = 0;//科目属性 - CwVouitemsEntity.GRADE = 0;//科目级别 - if (ds1.Tables[0].Rows[i]["FEETYPE"].ToString().Trim() == "应收账款") - { - #region 应收账款 - iAMTDR = iAMTDR + Math.Round(Decimal.Parse(ds1.Tables[0].Rows[i]["hj"].ToString().Trim()), 2, MidpointRounding.AwayFromZero); - // - if (ds1.Tables[0].Rows[i]["CURRENCY"].ToString().Trim() == "RMB") + CwVouitemsEntity CwVouitemsEntity = new CwVouitemsEntity(); + //CwVouitemsEntity.GID 唯一编码 newid() + CwVouitemsEntity.ORDNO = strORDNO.Trim(); + CwVouitemsEntity.ITEMNO = n;// 行号 + CwVouitemsEntity.PACCID = "";//父级科目贷码 + CwVouitemsEntity.PROPERTY = 0;//科目属性 + CwVouitemsEntity.GRADE = 0;//科目级别 + if (ds1.Tables[0].Rows[i]["FEETYPE"].ToString().Trim() == "应收账款") + { + #region 应收账款 + iAMTDR = iAMTDR + Math.Round(Decimal.Parse(ds1.Tables[0].Rows[i]["hj"].ToString().Trim()), 2, MidpointRounding.AwayFromZero); + // + if (ds1.Tables[0].Rows[i]["CURRENCY"].ToString().Trim() == "RMB") + { + #region RMB + CwVouitemsEntity.ACCID = ds.Tables[0].Rows[0]["AR"].ToString().Trim();//应收账款科目贷码 + CwVouitemsEntity.AMTDR = Math.Round(Decimal.Parse(ds1.Tables[0].Rows[i]["hj"].ToString().Trim()), 2, MidpointRounding.AwayFromZero);//本位币借方金额(互斥) + CwVouitemsEntity.AMTCR = 0;//本位币贷方金额(互斥) + CwVouitemsEntity.ISFCY = false;//是否外币 + CwVouitemsEntity.FCYNO = "RMB";//外币编号usd + CwVouitemsEntity.FCYDR = 0;//外币借方金额 + CwVouitemsEntity.FCYCR = 0;//外币贷方金额 + dRMBS += Math.Round(Decimal.Parse(ds1.Tables[0].Rows[i]["hj"].ToString().Trim()), 2, MidpointRounding.AwayFromZero);//本位币借方金额(互斥) + if (ds2 == null) { - #region RMB - CwVouitemsEntity.ACCID = ds.Tables[0].Rows[0]["AR"].ToString().Trim();//应收账款科目贷码 - CwVouitemsEntity.AMTDR = Math.Round(Decimal.Parse(ds1.Tables[0].Rows[i]["hj"].ToString().Trim()), 2, MidpointRounding.AwayFromZero);//本位币借方金额(互斥) - CwVouitemsEntity.AMTCR = 0;//本位币贷方金额(互斥) - CwVouitemsEntity.ISFCY = false;//是否外币 - CwVouitemsEntity.FCYNO = "RMB";//外币编号usd - CwVouitemsEntity.FCYDR = 0;//外币借方金额 - CwVouitemsEntity.FCYCR = 0;//外币贷方金额 - dRMBS += Math.Round(Decimal.Parse(ds1.Tables[0].Rows[i]["hj"].ToString().Trim()),2, MidpointRounding.AwayFromZero);//本位币借方金额(互斥) - if (ds2 == null) - { - CwVouitemsEntity.ACCNAME = "";//科目名称 - CwVouitemsEntity.ISDEPTACC = false;//核算部门,按规则设置生成 - CwVouitemsEntity.ISEMPLACC = false;//核算人员,按规则设置生成 - CwVouitemsEntity.ISCORPACC = false;//核算客户,按规则设置生成 - CwVouitemsEntity.ISITEMACC = false;//核算项目,按规则设置生成 - CwVouitemsEntity.DC = "D";//借方向 - } - else - { - CwVouitemsEntity.ACCNAME = ds2.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 - CwVouitemsEntity.ISDEPTACC = Boolean.Parse(ds2.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 - CwVouitemsEntity.ISEMPLACC = Boolean.Parse(ds2.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 - CwVouitemsEntity.ISCORPACC = Boolean.Parse(ds2.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 - CwVouitemsEntity.ISITEMACC = Boolean.Parse(ds2.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 - if (ds2.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") - { - CwVouitemsEntity.DC = "D";//借方向 - } - else - { - CwVouitemsEntity.DC = "C";//贷方向 - } - } - #endregion + CwVouitemsEntity.ACCNAME = "";//科目名称 + CwVouitemsEntity.ISDEPTACC = false;//核算部门,按规则设置生成 + CwVouitemsEntity.ISEMPLACC = false;//核算人员,按规则设置生成 + CwVouitemsEntity.ISCORPACC = false;//核算客户,按规则设置生成 + CwVouitemsEntity.ISITEMACC = false;//核算项目,按规则设置生成 + CwVouitemsEntity.DC = "D";//借方向 } - else if (ds1.Tables[0].Rows[i]["CURRENCY"].ToString().Trim() != "RMB") + else { - #region 外币 - CwVouitemsEntity.ACCID = ds.Tables[0].Rows[0]["ARFC"].ToString().Trim();//应收账款外币科目贷码 - CwVouitemsEntity.AMTDR = Math.Round(Decimal.Parse(ds1.Tables[0].Rows[i]["hj"].ToString().Trim()), 2, MidpointRounding.AwayFromZero);//本位币借方金额(互斥) - CwVouitemsEntity.AMTCR = 0;//本位币贷方金额(互斥) - CwVouitemsEntity.ISFCY = true;//是否外币 - CwVouitemsEntity.FCYNO = "USD";//外币编号usd - CwVouitemsEntity.FCYDR = Decimal.Parse(ds1.Tables[0].Rows[i]["je"].ToString().Trim());//外币借方金额 - CwVouitemsEntity.FCYCR = 0;//外币贷方金额 - dUSDS += Decimal.Parse(ds1.Tables[0].Rows[i]["je"].ToString().Trim());//本位币借方金额(互斥) - if (ds6 == null) + CwVouitemsEntity.ACCNAME = ds2.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 + CwVouitemsEntity.ISDEPTACC = Boolean.Parse(ds2.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 + CwVouitemsEntity.ISEMPLACC = Boolean.Parse(ds2.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 + CwVouitemsEntity.ISCORPACC = Boolean.Parse(ds2.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 + CwVouitemsEntity.ISITEMACC = Boolean.Parse(ds2.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 + if (ds2.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") { - CwVouitemsEntity.ACCNAME = "";//科目名称 - CwVouitemsEntity.ISDEPTACC = false;//核算部门,按规则设置生成 - CwVouitemsEntity.ISEMPLACC = false;//核算人员,按规则设置生成 - CwVouitemsEntity.ISCORPACC = false;//核算客户,按规则设置生成 - CwVouitemsEntity.ISITEMACC = false;//核算项目,按规则设置生成 CwVouitemsEntity.DC = "D";//借方向 } else { - CwVouitemsEntity.ACCNAME = ds6.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 - CwVouitemsEntity.ISDEPTACC = Boolean.Parse(ds6.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 - CwVouitemsEntity.ISEMPLACC = Boolean.Parse(ds6.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 - CwVouitemsEntity.ISCORPACC = Boolean.Parse(ds6.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 - CwVouitemsEntity.ISITEMACC = Boolean.Parse(ds6.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 - if (ds6.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") - { - CwVouitemsEntity.DC = "D";//借方向 - } - else - { - CwVouitemsEntity.DC = "C";//贷方向 - } + CwVouitemsEntity.DC = "C";//贷方向 } - usdRATES = Decimal.Parse(ds1.Tables[0].Rows[i]["EXCHANGERATE"].ToString().Trim());//汇率 - #endregion - } - - if (ds2.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim() == "True") - { - CwVouitemsEntity.CORPID = ds1.Tables[0].Rows[i]["FAPCODE"].ToString().Trim();//客户(系统) - CwVouitemsEntity.CUSTOMERNAME = ds1.Tables[0].Rows[i]["CUSTOMERNAME"].ToString().Trim();//客户(系统) - } - else - { - CwVouitemsEntity.CORPID = "";//客户(系统) - CwVouitemsEntity.CUSTOMERNAME = "";//客户(系统) } #endregion } - else if (ds1.Tables[0].Rows[i]["FEETYPE"].ToString().Trim() == "应付账款") + else if (ds1.Tables[0].Rows[i]["CURRENCY"].ToString().Trim() != "RMB") { - #region 应付账款 - iAMTCR = iAMTCR + Math.Round(Decimal.Parse(ds1.Tables[0].Rows[i]["hj"].ToString().Trim()), 2, MidpointRounding.AwayFromZero); - // - if (ds1.Tables[0].Rows[i]["CURRENCY"].ToString().Trim() == "RMB") + #region 外币 + CwVouitemsEntity.ACCID = ds.Tables[0].Rows[0]["ARFC"].ToString().Trim();//应收账款外币科目贷码 + CwVouitemsEntity.AMTDR = Math.Round(Decimal.Parse(ds1.Tables[0].Rows[i]["hj"].ToString().Trim()), 2, MidpointRounding.AwayFromZero);//本位币借方金额(互斥) + CwVouitemsEntity.AMTCR = 0;//本位币贷方金额(互斥) + CwVouitemsEntity.ISFCY = true;//是否外币 + CwVouitemsEntity.FCYNO = "USD";//外币编号usd + CwVouitemsEntity.FCYDR = Decimal.Parse(ds1.Tables[0].Rows[i]["je"].ToString().Trim());//外币借方金额 + CwVouitemsEntity.FCYCR = 0;//外币贷方金额 + dUSDS += Decimal.Parse(ds1.Tables[0].Rows[i]["je"].ToString().Trim());//本位币借方金额(互斥) + if (ds6 == null) { - #region RMB - CwVouitemsEntity.ACCID = ds.Tables[0].Rows[0]["AP"].ToString().Trim();//应付账款科目贷码 - CwVouitemsEntity.AMTDR = 0;//本位币借方金额(互斥) - CwVouitemsEntity.AMTCR = Math.Round(Decimal.Parse(ds1.Tables[0].Rows[i]["je"].ToString().Trim()), 2, MidpointRounding.AwayFromZero);//本位币贷方金额(互斥) - CwVouitemsEntity.ISFCY = false;//是否外币 - CwVouitemsEntity.FCYNO = "RMB";//外币编号usd - CwVouitemsEntity.FCYDR = 0;//外币借方金额 - CwVouitemsEntity.FCYCR = 0;//外币贷方金额 - dRMBF += Math.Round(Decimal.Parse(ds1.Tables[0].Rows[i]["je"].ToString().Trim()), 2, MidpointRounding.AwayFromZero);//本位币贷方金额(互斥) - if (ds3 == null) - { - CwVouitemsEntity.ACCNAME = "";//科目名称 - CwVouitemsEntity.ISDEPTACC = false;//核算部门,按规则设置生成 - CwVouitemsEntity.ISEMPLACC = false;//核算人员,按规则设置生成 - CwVouitemsEntity.ISCORPACC = false;//核算客户,按规则设置生成 - CwVouitemsEntity.ISITEMACC = false;//核算项目,按规则设置生成 - CwVouitemsEntity.DC = "C";//贷方向 - } - else - { - CwVouitemsEntity.ACCNAME = ds3.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 - CwVouitemsEntity.ISDEPTACC = Boolean.Parse(ds3.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 - CwVouitemsEntity.ISEMPLACC = Boolean.Parse(ds3.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 - CwVouitemsEntity.ISCORPACC = Boolean.Parse(ds3.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 - CwVouitemsEntity.ISITEMACC = Boolean.Parse(ds3.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 - if (ds3.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") - { - CwVouitemsEntity.DC = "D";//借方向 - } - else - { - CwVouitemsEntity.DC = "C";//贷方向 - } - } - #endregion + CwVouitemsEntity.ACCNAME = "";//科目名称 + CwVouitemsEntity.ISDEPTACC = false;//核算部门,按规则设置生成 + CwVouitemsEntity.ISEMPLACC = false;//核算人员,按规则设置生成 + CwVouitemsEntity.ISCORPACC = false;//核算客户,按规则设置生成 + CwVouitemsEntity.ISITEMACC = false;//核算项目,按规则设置生成 + CwVouitemsEntity.DC = "D";//借方向 } - else if (ds1.Tables[0].Rows[i]["CURRENCY"].ToString().Trim() != "RMB") + else { - #region 外币 - CwVouitemsEntity.ACCID = ds.Tables[0].Rows[0]["APFC"].ToString().Trim();//应付账款外币科目贷码 - CwVouitemsEntity.AMTDR = 0;//本位币借方金额(互斥) - CwVouitemsEntity.AMTCR = Math.Round(Decimal.Parse(ds1.Tables[0].Rows[i]["hj"].ToString().Trim()), 2, MidpointRounding.AwayFromZero);//本位币贷方金额(互斥) - CwVouitemsEntity.ISFCY = true;//是否外币 - CwVouitemsEntity.FCYNO = "USD";//外币编号usd - CwVouitemsEntity.FCYDR = 0;//外币借方金额 - CwVouitemsEntity.FCYCR = Decimal.Parse(ds1.Tables[0].Rows[i]["je"].ToString().Trim());//外币贷方金额 - dUSDF += Decimal.Parse(ds1.Tables[0].Rows[i]["je"].ToString().Trim());//本位币贷方金额(互斥) - if (ds7 == null) + CwVouitemsEntity.ACCNAME = ds6.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 + CwVouitemsEntity.ISDEPTACC = Boolean.Parse(ds6.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 + CwVouitemsEntity.ISEMPLACC = Boolean.Parse(ds6.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 + CwVouitemsEntity.ISCORPACC = Boolean.Parse(ds6.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 + CwVouitemsEntity.ISITEMACC = Boolean.Parse(ds6.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 + if (ds6.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") { - CwVouitemsEntity.ACCNAME = "";//科目名称 - CwVouitemsEntity.ISDEPTACC = false;//核算部门,按规则设置生成 - CwVouitemsEntity.ISEMPLACC = false;//核算人员,按规则设置生成 - CwVouitemsEntity.ISCORPACC = false;//核算客户,按规则设置生成 - CwVouitemsEntity.ISITEMACC = false;//核算项目,按规则设置生成 - CwVouitemsEntity.DC = "C";//贷方向 + CwVouitemsEntity.DC = "D";//借方向 } else { - CwVouitemsEntity.ACCNAME = ds7.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 - CwVouitemsEntity.ISDEPTACC = Boolean.Parse(ds7.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 - CwVouitemsEntity.ISEMPLACC = Boolean.Parse(ds7.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 - CwVouitemsEntity.ISCORPACC = Boolean.Parse(ds7.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 - CwVouitemsEntity.ISITEMACC = Boolean.Parse(ds7.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 - if (ds7.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") - { - CwVouitemsEntity.DC = "D";//借方向 - } - else - { - CwVouitemsEntity.DC = "C";//贷方向 - } + CwVouitemsEntity.DC = "C";//贷方向 } - usdRATEF = Decimal.Parse(ds1.Tables[0].Rows[i]["EXCHANGERATE"].ToString().Trim());//汇率 - #endregion - } - - if (ds3.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim() == "True") - { - CwVouitemsEntity.CORPID = ds1.Tables[0].Rows[i]["FAPCODE"].ToString().Trim();//客户(系统) - CwVouitemsEntity.CUSTOMERNAME = ds1.Tables[0].Rows[i]["CUSTOMERNAME"].ToString().Trim();//客户(系统) - } - else - { - CwVouitemsEntity.CORPID = "";//客户(系统) - CwVouitemsEntity.CUSTOMERNAME = "";//客户(系统) } + usdRATES = Decimal.Parse(ds1.Tables[0].Rows[i]["EXCHANGERATE"].ToString().Trim());//汇率 #endregion } - - - - CwVouitemsEntity.FCYEXRATE = Decimal.Parse(ds1.Tables[0].Rows[i]["EXCHANGERATE"].ToString().Trim());//汇率 - CwVouitemsEntity.QTYUNIT = "";//数量包装单位 - CwVouitemsEntity.QTYDR = 0;//借方数量 - CwVouitemsEntity.QTYCR = 0;//贷方数量 - CwVouitemsEntity.EXPLAN = strEXPLAN + " " + ds1.Tables[0].Rows[i]["CUSTOMERNAME"].ToString().Trim();//摘要,规则生成 "转运费" + - CwVouitemsEntity.DEPTID = strDEPTID;//部门(系统) - CwVouitemsEntity.EMPLID = strEMPLID;//人员(系统) - CwVouitemsEntity.SALE = strSALE;//人员名称 - CwVouitemsEntity.PITEMID = 0;//父级项目编号 - CwVouitemsEntity.ITEMID = "0";//项目编号 - CwVouitemsEntity.FIELD1 = "";//预留字段1 - CwVouitemsEntity.FIELD2 = "";//预留字段2 - CwVouitemsEntity.FIELD3 = "";//预留字段3 - CwVouitemsEntity.FIELD4 = "";//预留字段4 - CwVouitemsEntity.FIELD5 = "";//预留字段5 - CwVouitemsEntity.FIELD6 = "";//预留字段6 - CwVouitemsEntity.FIELD7 = "";//预留字段7 - CwVouitemsEntity.FIELD8 = "";//预留字段8 - CwVouitemsEntity.FIELD9 = "";//预留字段9 - CwVouitemsEntity.FIELD10 = "";//预留字段10 - if (ds.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True") + if (ds2.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim() == "True") { - CwVouitemsEntity.ISSYS = false;//是否手动录入 + CwVouitemsEntity.CORPID = ds1.Tables[0].Rows[i]["FAPCODE"].ToString().Trim();//客户(系统) + CwVouitemsEntity.CUSTOMERNAME = ds1.Tables[0].Rows[i]["CUSTOMERNAME"].ToString().Trim();//客户(系统) } else { - CwVouitemsEntity.ISSYS = true;//是否手动录入 - } - CwVouitemsEntity.FSETTLCODE = "";//结算方式 - CwVouitemsEntity.FSETTLENO = "";//财务辅助编号 - CwVouitemsEntity.MODIFIEDUSER = strUserID;//最后一次更新操作人 - CwVouitemsEntity.BLNO = strBLNO;// - if (strBLNO.Trim() == "") - { - if (ds.Tables[0].Rows[0]["ISMBLNO"].ToString().Trim() == "True") - { - CwVouitemsEntity.BLNO = ds1.Tables[0].Rows[i]["mblno"].ToString().Trim();// - } + CwVouitemsEntity.CORPID = "";//客户(系统) + CwVouitemsEntity.CUSTOMERNAME = "";//客户(系统) } - CwVouitemsEntities.Add(CwVouitemsEntity); + #endregion } - } - #endregion - - #region 收入\成本 生成 全额\差额 - Decimal dRMB = dRMBS - dRMBF; - Decimal dUSD = dUSDS - dUSDF; - //收入\成本 生成 全额\差额 - Decimal strJie = dRMBS + Math.Round(dUSDS * usdRATES, 2, MidpointRounding.AwayFromZero); - Decimal strDai = dRMBF + Math.Round(dUSDF * usdRATEF, 2, MidpointRounding.AwayFromZero); - if (ds.Tables[0].Rows[0]["ISTCOIIED"].ToString().Trim() == "True")//是否核算外币 - { - if (ds.Tables[0].Rows[0]["AMCODE"].ToString().Trim() == "1")//全额 + else if (ds1.Tables[0].Rows[i]["FEETYPE"].ToString().Trim() == "应付账款") { - //for (int j = 0; j < ds1.Tables[0].Rows.Count; j++) - //{ - #region 全额 - - #endregion - //} - - #region 全额 - Decimal dlSR = dRMBS; - if (dlSR != 0) - { - #region 收入RMB - n = n + 1; - CwVouitemsEntity CwVouitemsEntity2 = new CwVouitemsEntity(); - //CwVouitemsEntity2.GID 唯一编码 newid() - CwVouitemsEntity2.ORDNO = strORDNO.Trim(); - CwVouitemsEntity2.ITEMNO = n;// 行号 - CwVouitemsEntity2.PACCID = "";//父级科目贷码 - CwVouitemsEntity2.PROPERTY = 0;//科目属性 - CwVouitemsEntity2.GRADE = 0;//科目级别 - CwVouitemsEntity2.ACCID = ds.Tables[0].Rows[0]["MBINCOME"].ToString().Trim();//主营业务收入科目贷码 - CwVouitemsEntity2.AMTDR = 0;//本位币借方金额(互斥) - CwVouitemsEntity2.AMTCR = dRMBS;//本位币贷方金额(互斥) - strDai = strDai + dRMBS; - CwVouitemsEntity2.ISFCY = false;//是否外币 - CwVouitemsEntity2.FCYNO = "RMB";//外币编号usd - CwVouitemsEntity2.FCYDR = 0;//外币借方金额 - CwVouitemsEntity2.FCYCR = 0;//外币贷方金额 - if (ds8 == null) - { - CwVouitemsEntity2.ACCNAME = "";//科目名称 - CwVouitemsEntity2.ISDEPTACC = false;//核算部门,按规则设置生成 - CwVouitemsEntity2.ISEMPLACC = false;//核算人员,按规则设置生成 - CwVouitemsEntity2.ISCORPACC = false;//核算客户,按规则设置生成 - CwVouitemsEntity2.ISITEMACC = false;//核算项目,按规则设置生成 - CwVouitemsEntity2.DC = "C";//贷方向 - } - else - { - CwVouitemsEntity2.ACCNAME = ds8.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 - CwVouitemsEntity2.ISDEPTACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 - CwVouitemsEntity2.ISEMPLACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 - CwVouitemsEntity2.ISCORPACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 - CwVouitemsEntity2.ISITEMACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 - if (ds8.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") - { - CwVouitemsEntity2.DC = "D";//借方向 - } - else - { - CwVouitemsEntity2.DC = "C";//贷方向 - } - } - CwVouitemsEntity2.CORPID = "";// strEMPLID;//人员(系统)本来应该放客户 - CwVouitemsEntity2.CUSTOMERNAME = "";// strSALE;//人员(系统)本来应该放客户 - CwVouitemsEntity2.FCYEXRATE = 1;//汇率 - //dEXCHANGERATE = Decimal.Parse(ds1.Tables[0].Rows[j]["EXCHANGERATE"].ToString().Trim());//汇率 - CwVouitemsEntity2.QTYUNIT = "";//数量包装单位 - CwVouitemsEntity2.QTYDR = 0;//借方数量 - CwVouitemsEntity2.QTYCR = 0;//贷方数量 - CwVouitemsEntity2.EXPLAN = strEXPLAN;//摘要,规则生成 "转运费" + - CwVouitemsEntity2.DEPTID = strDEPTID;//部门(系统) - CwVouitemsEntity2.EMPLID = strEMPLID;//人员(系统) - CwVouitemsEntity2.SALE = strSALE;//人员名称 - CwVouitemsEntity2.PITEMID = 0;//父级项目编号 - CwVouitemsEntity2.ITEMID = "0";//项目编号 - CwVouitemsEntity2.FIELD1 = "";//预留字段1 - CwVouitemsEntity2.FIELD2 = "";//预留字段2 - CwVouitemsEntity2.FIELD3 = "";//预留字段3 - CwVouitemsEntity2.FIELD4 = "";//预留字段4 - CwVouitemsEntity2.FIELD5 = "";//预留字段5 - CwVouitemsEntity2.FIELD6 = "";//预留字段6 - CwVouitemsEntity2.FIELD7 = "";//预留字段7 - CwVouitemsEntity2.FIELD8 = "";//预留字段8 - CwVouitemsEntity2.FIELD9 = "";//预留字段9 - CwVouitemsEntity2.FIELD10 = "";//预留字段10 - if (ds.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True") - { - CwVouitemsEntity2.ISSYS = false;//是否手动录入 - } - else - { - CwVouitemsEntity2.ISSYS = true;//是否手动录入 - } - CwVouitemsEntity2.FSETTLCODE = "";//结算方式 - CwVouitemsEntity2.FSETTLENO = "";//财务辅助编号 - CwVouitemsEntity2.MODIFIEDUSER = strUserID;//最后一次更新操作人 - CwVouitemsEntity2.BLNO = strBLNO;// - #endregion - CwVouitemsEntities.Add(CwVouitemsEntity2); - } - - dlSR = dUSDS * usdRATES; - if (dlSR != 0) - { - #region 收入USD - n = n + 1; - CwVouitemsEntity CwVouitemsEntity2 = new CwVouitemsEntity(); - //CwVouitemsEntity2.GID 唯一编码 newid() - CwVouitemsEntity2.ORDNO = strORDNO.Trim(); - CwVouitemsEntity2.ITEMNO = n;// 行号 - CwVouitemsEntity2.PACCID = "";//父级科目贷码 - CwVouitemsEntity2.PROPERTY = 0;//科目属性 - CwVouitemsEntity2.GRADE = 0;//科目级别 - CwVouitemsEntity2.ACCID = ds.Tables[0].Rows[0]["MBINCOME"].ToString().Trim();//主营业务收入科目贷码 - CwVouitemsEntity2.AMTDR = 0;//本位币借方金额(互斥) - CwVouitemsEntity2.AMTCR = Math.Round((dUSDS * usdRATES), 2, MidpointRounding.AwayFromZero);//本位币贷方金额(互斥) - strDai = strDai + Math.Round((dUSDS * usdRATES), 2, MidpointRounding.AwayFromZero); - CwVouitemsEntity2.ISFCY = true;//是否外币 - CwVouitemsEntity2.FCYNO = "USD";//外币编号usd - CwVouitemsEntity2.FCYDR = 0;//外币借方金额 - CwVouitemsEntity2.FCYCR = dUSDS;//外币贷方金额 - CwVouitemsEntity2.FCYEXRATE = usdRATES;//汇率 - if (ds8 == null) - { - CwVouitemsEntity2.ACCNAME = "";//科目名称 - CwVouitemsEntity2.ISDEPTACC = false;//核算部门,按规则设置生成 - CwVouitemsEntity2.ISEMPLACC = false;//核算人员,按规则设置生成 - CwVouitemsEntity2.ISCORPACC = false;//核算客户,按规则设置生成 - CwVouitemsEntity2.ISITEMACC = false;//核算项目,按规则设置生成 - CwVouitemsEntity2.DC = "C";//贷方向 - } - else - { - CwVouitemsEntity2.ACCNAME = ds8.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 - CwVouitemsEntity2.ISDEPTACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 - CwVouitemsEntity2.ISEMPLACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 - CwVouitemsEntity2.ISCORPACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 - CwVouitemsEntity2.ISITEMACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 - if (ds8.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") - { - CwVouitemsEntity2.DC = "D";//借方向 - } - else - { - CwVouitemsEntity2.DC = "C";//贷方向 - } - } - CwVouitemsEntity2.CORPID = "";// strEMPLID;//人员(系统)本来应该放客户 - CwVouitemsEntity2.CUSTOMERNAME = "";// strSALE;//人员(系统)本来应该放客户 - //dEXCHANGERATE = Decimal.Parse(ds1.Tables[0].Rows[j]["EXCHANGERATE"].ToString().Trim());//汇率 - CwVouitemsEntity2.QTYUNIT = "";//数量包装单位 - CwVouitemsEntity2.QTYDR = 0;//借方数量 - CwVouitemsEntity2.QTYCR = 0;//贷方数量 - CwVouitemsEntity2.EXPLAN = strEXPLAN;//摘要,规则生成 "转运费" + - CwVouitemsEntity2.DEPTID = strDEPTID;//部门(系统) - CwVouitemsEntity2.EMPLID = strEMPLID;//人员(系统) - CwVouitemsEntity2.SALE = strSALE;//人员名称 - CwVouitemsEntity2.PITEMID = 0;//父级项目编号 - CwVouitemsEntity2.ITEMID = "0";//项目编号 - CwVouitemsEntity2.FIELD1 = "";//预留字段1 - CwVouitemsEntity2.FIELD2 = "";//预留字段2 - CwVouitemsEntity2.FIELD3 = "";//预留字段3 - CwVouitemsEntity2.FIELD4 = "";//预留字段4 - CwVouitemsEntity2.FIELD5 = "";//预留字段5 - CwVouitemsEntity2.FIELD6 = "";//预留字段6 - CwVouitemsEntity2.FIELD7 = "";//预留字段7 - CwVouitemsEntity2.FIELD8 = "";//预留字段8 - CwVouitemsEntity2.FIELD9 = "";//预留字段9 - CwVouitemsEntity2.FIELD10 = "";//预留字段10 - if (ds.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True") - { - CwVouitemsEntity2.ISSYS = false;//是否手动录入 - } - else - { - CwVouitemsEntity2.ISSYS = true;//是否手动录入 - } - CwVouitemsEntity2.FSETTLCODE = "";//结算方式 - CwVouitemsEntity2.FSETTLENO = "";//财务辅助编号 - CwVouitemsEntity2.MODIFIEDUSER = strUserID;//最后一次更新操作人 - CwVouitemsEntity2.BLNO = strBLNO;// - #endregion - CwVouitemsEntities.Add(CwVouitemsEntity2); - } - - Decimal dlZC = dRMBF; - if (dlZC != 0) - { - #region 支出RMB - n = n + 1; - CwVouitemsEntity CwVouitemsEntity4 = new CwVouitemsEntity(); - //CwVouitemsEntity4.GID 唯一编码 newid() - CwVouitemsEntity4.ORDNO = strORDNO.Trim(); - CwVouitemsEntity4.ITEMNO = n;// 行号 - CwVouitemsEntity4.PACCID = "";//父级科目贷码 - CwVouitemsEntity4.PROPERTY = 0;//科目属性 - CwVouitemsEntity4.GRADE = 0;//科目级别 - CwVouitemsEntity4.ACCID = ds.Tables[0].Rows[0]["MBSPENDING"].ToString().Trim();//主营业务支出科目贷码 - CwVouitemsEntity4.AMTDR = dRMBF;//本位币借方金额(互斥) - strJie = strJie + dRMBF; - CwVouitemsEntity4.AMTCR = 0;//本位币贷方金额(互斥) - CwVouitemsEntity4.ISFCY = false;//是否外币 - CwVouitemsEntity4.FCYNO = "RMB";//外币编号usd - CwVouitemsEntity4.FCYDR = 0;//外币借方金额 - CwVouitemsEntity4.FCYCR = 0;//外币贷方金额 - if (ds9 == null) + #region 应付账款 + iAMTCR = iAMTCR + Math.Round(Decimal.Parse(ds1.Tables[0].Rows[i]["hj"].ToString().Trim()), 2, MidpointRounding.AwayFromZero); + // + if (ds1.Tables[0].Rows[i]["CURRENCY"].ToString().Trim() == "RMB") + { + #region RMB + CwVouitemsEntity.ACCID = ds.Tables[0].Rows[0]["AP"].ToString().Trim();//应付账款科目贷码 + CwVouitemsEntity.AMTDR = 0;//本位币借方金额(互斥) + CwVouitemsEntity.AMTCR = Math.Round(Decimal.Parse(ds1.Tables[0].Rows[i]["je"].ToString().Trim()), 2, MidpointRounding.AwayFromZero);//本位币贷方金额(互斥) + CwVouitemsEntity.ISFCY = false;//是否外币 + CwVouitemsEntity.FCYNO = "RMB";//外币编号usd + CwVouitemsEntity.FCYDR = 0;//外币借方金额 + CwVouitemsEntity.FCYCR = 0;//外币贷方金额 + dRMBF += Math.Round(Decimal.Parse(ds1.Tables[0].Rows[i]["je"].ToString().Trim()), 2, MidpointRounding.AwayFromZero);//本位币贷方金额(互斥) + if (ds3 == null) { - CwVouitemsEntity4.ACCNAME = "";//科目名称 - CwVouitemsEntity4.ISDEPTACC = false;//核算部门,按规则设置生成 - CwVouitemsEntity4.ISEMPLACC = false;//核算人员,按规则设置生成 - CwVouitemsEntity4.ISCORPACC = false;//核算客户,按规则设置生成 - CwVouitemsEntity4.ISITEMACC = false;//核算项目,按规则设置生成 - CwVouitemsEntity4.DC = "D";//借方向 + CwVouitemsEntity.ACCNAME = "";//科目名称 + CwVouitemsEntity.ISDEPTACC = false;//核算部门,按规则设置生成 + CwVouitemsEntity.ISEMPLACC = false;//核算人员,按规则设置生成 + CwVouitemsEntity.ISCORPACC = false;//核算客户,按规则设置生成 + CwVouitemsEntity.ISITEMACC = false;//核算项目,按规则设置生成 + CwVouitemsEntity.DC = "C";//贷方向 } else { - CwVouitemsEntity4.ACCNAME = ds9.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 - CwVouitemsEntity4.ISDEPTACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 - CwVouitemsEntity4.ISEMPLACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 - CwVouitemsEntity4.ISCORPACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 - CwVouitemsEntity4.ISITEMACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 - if (ds9.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") + CwVouitemsEntity.ACCNAME = ds3.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 + CwVouitemsEntity.ISDEPTACC = Boolean.Parse(ds3.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 + CwVouitemsEntity.ISEMPLACC = Boolean.Parse(ds3.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 + CwVouitemsEntity.ISCORPACC = Boolean.Parse(ds3.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 + CwVouitemsEntity.ISITEMACC = Boolean.Parse(ds3.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 + if (ds3.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") { - CwVouitemsEntity4.DC = "D";//借方向 + CwVouitemsEntity.DC = "D";//借方向 } else { - CwVouitemsEntity4.DC = "C";//贷方向 + CwVouitemsEntity.DC = "C";//贷方向 } } - CwVouitemsEntity4.CORPID = "";// strEMPLID;//人员(系统)本来应该放客户 - CwVouitemsEntity4.CUSTOMERNAME = "";// strSALE;//人员(系统)本来应该放客户 - CwVouitemsEntity4.FCYEXRATE = 1;//汇率 - //dEXCHANGERATE = Decimal.Parse(ds1.Tables[0].Rows[j]["EXCHANGERATE"].ToString().Trim());//汇率 - CwVouitemsEntity4.QTYUNIT = "";//数量包装单位 - CwVouitemsEntity4.QTYDR = 0;//借方数量 - CwVouitemsEntity4.QTYCR = 0;//贷方数量 - CwVouitemsEntity4.EXPLAN = strEXPLAN;//摘要,规则生成 "转运费" + - CwVouitemsEntity4.DEPTID = strDEPTID;//部门(系统) - CwVouitemsEntity4.EMPLID = strEMPLID;//人员(系统) - CwVouitemsEntity4.SALE = strSALE;//人员名称 - CwVouitemsEntity4.PITEMID = 0;//父级项目编号 - CwVouitemsEntity4.ITEMID = "0";//项目编号 - CwVouitemsEntity4.FIELD1 = "";//预留字段1 - CwVouitemsEntity4.FIELD2 = "";//预留字段2 - CwVouitemsEntity4.FIELD3 = "";//预留字段3 - CwVouitemsEntity4.FIELD4 = "";//预留字段4 - CwVouitemsEntity4.FIELD5 = "";//预留字段5 - CwVouitemsEntity4.FIELD6 = "";//预留字段6 - CwVouitemsEntity4.FIELD7 = "";//预留字段7 - CwVouitemsEntity4.FIELD8 = "";//预留字段8 - CwVouitemsEntity4.FIELD9 = "";//预留字段9 - CwVouitemsEntity4.FIELD10 = "";//预留字段10 - if (ds.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True") - { - CwVouitemsEntity4.ISSYS = false;//是否手动录入 - } - else - { - CwVouitemsEntity4.ISSYS = true;//是否手动录入 - } - CwVouitemsEntity4.FSETTLCODE = "";//结算方式 - CwVouitemsEntity4.FSETTLENO = "";//财务辅助编号 - CwVouitemsEntity4.MODIFIEDUSER = strUserID;//最后一次更新操作人 - CwVouitemsEntity4.BLNO = strBLNO;// #endregion - CwVouitemsEntities.Add(CwVouitemsEntity4); - } - - - dlZC = dUSDF * usdRATEF; - if (dlZC != 0) - { - #region 支出USD - n = n + 1; - CwVouitemsEntity CwVouitemsEntity4 = new CwVouitemsEntity(); - //CwVouitemsEntity4.GID 唯一编码 newid() - CwVouitemsEntity4.ORDNO = strORDNO.Trim(); - CwVouitemsEntity4.ITEMNO = n;// 行号 - CwVouitemsEntity4.PACCID = "";//父级科目贷码 - CwVouitemsEntity4.PROPERTY = 0;//科目属性 - CwVouitemsEntity4.GRADE = 0;//科目级别 - CwVouitemsEntity4.ACCID = ds.Tables[0].Rows[0]["MBSPENDING"].ToString().Trim();//主营业务支出科目贷码 - CwVouitemsEntity4.AMTDR = Math.Round((dUSDF * usdRATEF), 2, MidpointRounding.AwayFromZero);//本位币借方金额(互斥) - strJie = strJie + Math.Round((dUSDF * usdRATEF), 2, MidpointRounding.AwayFromZero); - CwVouitemsEntity4.AMTCR = 0;//本位币贷方金额(互斥) - CwVouitemsEntity4.ISFCY = true;//是否外币 - CwVouitemsEntity4.FCYNO = "USD";//外币编号usd - CwVouitemsEntity4.FCYDR = dUSDF;//外币借方金额 - CwVouitemsEntity4.FCYCR = 0;//外币贷方金额 - CwVouitemsEntity4.FCYEXRATE = usdRATEF;//汇率 - if (ds9 == null) + } + else if (ds1.Tables[0].Rows[i]["CURRENCY"].ToString().Trim() != "RMB") + { + #region 外币 + CwVouitemsEntity.ACCID = ds.Tables[0].Rows[0]["APFC"].ToString().Trim();//应付账款外币科目贷码 + CwVouitemsEntity.AMTDR = 0;//本位币借方金额(互斥) + CwVouitemsEntity.AMTCR = Math.Round(Decimal.Parse(ds1.Tables[0].Rows[i]["hj"].ToString().Trim()), 2, MidpointRounding.AwayFromZero);//本位币贷方金额(互斥) + CwVouitemsEntity.ISFCY = true;//是否外币 + CwVouitemsEntity.FCYNO = "USD";//外币编号usd + CwVouitemsEntity.FCYDR = 0;//外币借方金额 + CwVouitemsEntity.FCYCR = Decimal.Parse(ds1.Tables[0].Rows[i]["je"].ToString().Trim());//外币贷方金额 + dUSDF += Decimal.Parse(ds1.Tables[0].Rows[i]["je"].ToString().Trim());//本位币贷方金额(互斥) + if (ds7 == null) { - CwVouitemsEntity4.ACCNAME = "";//科目名称 - CwVouitemsEntity4.ISDEPTACC = false;//核算部门,按规则设置生成 - CwVouitemsEntity4.ISEMPLACC = false;//核算人员,按规则设置生成 - CwVouitemsEntity4.ISCORPACC = false;//核算客户,按规则设置生成 - CwVouitemsEntity4.ISITEMACC = false;//核算项目,按规则设置生成 - CwVouitemsEntity4.DC = "D";//借方向 + CwVouitemsEntity.ACCNAME = "";//科目名称 + CwVouitemsEntity.ISDEPTACC = false;//核算部门,按规则设置生成 + CwVouitemsEntity.ISEMPLACC = false;//核算人员,按规则设置生成 + CwVouitemsEntity.ISCORPACC = false;//核算客户,按规则设置生成 + CwVouitemsEntity.ISITEMACC = false;//核算项目,按规则设置生成 + CwVouitemsEntity.DC = "C";//贷方向 } else { - CwVouitemsEntity4.ACCNAME = ds9.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 - CwVouitemsEntity4.ISDEPTACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 - CwVouitemsEntity4.ISEMPLACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 - CwVouitemsEntity4.ISCORPACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 - CwVouitemsEntity4.ISITEMACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 - if (ds9.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") + CwVouitemsEntity.ACCNAME = ds7.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 + CwVouitemsEntity.ISDEPTACC = Boolean.Parse(ds7.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 + CwVouitemsEntity.ISEMPLACC = Boolean.Parse(ds7.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 + CwVouitemsEntity.ISCORPACC = Boolean.Parse(ds7.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 + CwVouitemsEntity.ISITEMACC = Boolean.Parse(ds7.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 + if (ds7.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") { - CwVouitemsEntity4.DC = "D";//借方向 + CwVouitemsEntity.DC = "D";//借方向 } else { - CwVouitemsEntity4.DC = "C";//贷方向 + CwVouitemsEntity.DC = "C";//贷方向 } } - CwVouitemsEntity4.CORPID = "";// strEMPLID;//人员(系统)本来应该放客户 - CwVouitemsEntity4.CUSTOMERNAME = "";// strSALE;//人员(系统)本来应该放客户 - //dEXCHANGERATE = Decimal.Parse(ds1.Tables[0].Rows[j]["EXCHANGERATE"].ToString().Trim());//汇率 - CwVouitemsEntity4.QTYUNIT = "";//数量包装单位 - CwVouitemsEntity4.QTYDR = 0;//借方数量 - CwVouitemsEntity4.QTYCR = 0;//贷方数量 - CwVouitemsEntity4.EXPLAN = strEXPLAN;//摘要,规则生成 "转运费" + - CwVouitemsEntity4.DEPTID = strDEPTID;//部门(系统) - CwVouitemsEntity4.EMPLID = strEMPLID;//人员(系统) - CwVouitemsEntity4.SALE = strSALE;//人员名称 - CwVouitemsEntity4.PITEMID = 0;//父级项目编号 - CwVouitemsEntity4.ITEMID = "0";//项目编号 - CwVouitemsEntity4.FIELD1 = "";//预留字段1 - CwVouitemsEntity4.FIELD2 = "";//预留字段2 - CwVouitemsEntity4.FIELD3 = "";//预留字段3 - CwVouitemsEntity4.FIELD4 = "";//预留字段4 - CwVouitemsEntity4.FIELD5 = "";//预留字段5 - CwVouitemsEntity4.FIELD6 = "";//预留字段6 - CwVouitemsEntity4.FIELD7 = "";//预留字段7 - CwVouitemsEntity4.FIELD8 = "";//预留字段8 - CwVouitemsEntity4.FIELD9 = "";//预留字段9 - CwVouitemsEntity4.FIELD10 = "";//预留字段10 - if (ds.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True") - { - CwVouitemsEntity4.ISSYS = false;//是否手动录入 - } - else - { - CwVouitemsEntity4.ISSYS = true;//是否手动录入 - } - CwVouitemsEntity4.FSETTLCODE = "";//结算方式 - CwVouitemsEntity4.FSETTLENO = "";//财务辅助编号 - CwVouitemsEntity4.MODIFIEDUSER = strUserID;//最后一次更新操作人 - CwVouitemsEntity4.BLNO = strBLNO;// + usdRATEF = Decimal.Parse(ds1.Tables[0].Rows[i]["EXCHANGERATE"].ToString().Trim());//汇率 #endregion - CwVouitemsEntities.Add(CwVouitemsEntity4); + } + + if (ds3.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim() == "True") + { + CwVouitemsEntity.CORPID = ds1.Tables[0].Rows[i]["FAPCODE"].ToString().Trim();//客户(系统) + CwVouitemsEntity.CUSTOMERNAME = ds1.Tables[0].Rows[i]["CUSTOMERNAME"].ToString().Trim();//客户(系统) + } + else + { + CwVouitemsEntity.CORPID = "";//客户(系统) + CwVouitemsEntity.CUSTOMERNAME = "";//客户(系统) } #endregion } - else if (ds.Tables[0].Rows[0]["AMCODE"].ToString().Trim() == "2")//差额 + + + + + CwVouitemsEntity.FCYEXRATE = Decimal.Parse(ds1.Tables[0].Rows[i]["EXCHANGERATE"].ToString().Trim());//汇率 + CwVouitemsEntity.QTYUNIT = "";//数量包装单位 + CwVouitemsEntity.QTYDR = 0;//借方数量 + CwVouitemsEntity.QTYCR = 0;//贷方数量 + CwVouitemsEntity.EXPLAN = strEXPLAN + " " + ds1.Tables[0].Rows[i]["CUSTOMERNAME"].ToString().Trim();//摘要,规则生成 "转运费" + + CwVouitemsEntity.DEPTID = strDEPTID;//部门(系统) + CwVouitemsEntity.EMPLID = strEMPLID;//人员(系统) + CwVouitemsEntity.SALE = strSALE;//人员名称 + CwVouitemsEntity.PITEMID = 0;//父级项目编号 + CwVouitemsEntity.ITEMID = "0";//项目编号 + CwVouitemsEntity.FIELD1 = "";//预留字段1 + CwVouitemsEntity.FIELD2 = "";//预留字段2 + CwVouitemsEntity.FIELD3 = "";//预留字段3 + CwVouitemsEntity.FIELD4 = "";//预留字段4 + CwVouitemsEntity.FIELD5 = "";//预留字段5 + CwVouitemsEntity.FIELD6 = "";//预留字段6 + CwVouitemsEntity.FIELD7 = "";//预留字段7 + CwVouitemsEntity.FIELD8 = "";//预留字段8 + CwVouitemsEntity.FIELD9 = "";//预留字段9 + CwVouitemsEntity.FIELD10 = "";//预留字段10 + if (ds.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True") + { + CwVouitemsEntity.ISSYS = false;//是否手动录入 + } + else { - #region 差额 - if (dRMB != 0) - { - #region dRMB != 0 - CwVouitemsEntity CwVouitemsEntity1 = new CwVouitemsEntity(); - //CwVouitemsEntity1.GID 唯一编码 newid() - CwVouitemsEntity1.ORDNO = strORDNO.Trim(); - n = n + 1; - CwVouitemsEntity1.ITEMNO = n;// 行号 - CwVouitemsEntity1.PACCID = "";//父级科目贷码 - CwVouitemsEntity1.PROPERTY = 0;//科目属性 - CwVouitemsEntity1.GRADE = 0;//科目级别 - CwVouitemsEntity1.ACCID = ds.Tables[0].Rows[0]["MBINCOME"].ToString().Trim();//主营业务收入科目贷码 - CwVouitemsEntity1.AMTDR = 0;//本位币借方金额(互斥) - CwVouitemsEntity1.AMTCR = Decimal.Parse(dRMB.ToString().Trim());//本位币贷方金额(互斥) - strDai = strDai + Decimal.Parse(dRMB.ToString().Trim()); - CwVouitemsEntity1.ISFCY = false;//是否外币 - CwVouitemsEntity1.FCYNO = "RMB";//外币编号usd - CwVouitemsEntity1.FCYDR = 0;//外币借方金额 - CwVouitemsEntity1.FCYCR = 0;//外币贷方金额 - - if (ds8 == null) + CwVouitemsEntity.ISSYS = true;//是否手动录入 + } + CwVouitemsEntity.FSETTLCODE = "";//结算方式 + CwVouitemsEntity.FSETTLENO = "";//财务辅助编号 + CwVouitemsEntity.MODIFIEDUSER = strUserID;//最后一次更新操作人 + CwVouitemsEntity.BLNO = strBLNO;// + if (strBLNO.Trim() == "") + { + if (ds.Tables[0].Rows[0]["ISMBLNO"].ToString().Trim() == "True") + { + CwVouitemsEntity.BLNO = ds1.Tables[0].Rows[i]["mblno"].ToString().Trim();// + } + } + CwVouitemsEntities.Add(CwVouitemsEntity); + } + } + #endregion + + #region 收入\成本 生成 全额\差额 + Decimal dRMB = dRMBS - dRMBF; + Decimal dUSD = dUSDS - dUSDF; + //收入\成本 生成 全额\差额 + Decimal strJie = dRMBS + Math.Round(dUSDS * usdRATES, 2, MidpointRounding.AwayFromZero); + Decimal strDai = dRMBF + Math.Round(dUSDF * usdRATEF, 2, MidpointRounding.AwayFromZero); + if (ds.Tables[0].Rows[0]["ISTCOIIED"].ToString().Trim() == "True")//是否核算外币 + { + if (ds.Tables[0].Rows[0]["AMCODE"].ToString().Trim() == "1")//全额 + { + //for (int j = 0; j < ds1.Tables[0].Rows.Count; j++) + //{ + #region 全额 + + #endregion + //} + + #region 全额 + Decimal dlSR = dRMBS; + if (dlSR != 0) + { + #region 收入RMB + n = n + 1; + CwVouitemsEntity CwVouitemsEntity2 = new CwVouitemsEntity(); + //CwVouitemsEntity2.GID 唯一编码 newid() + CwVouitemsEntity2.ORDNO = strORDNO.Trim(); + CwVouitemsEntity2.ITEMNO = n;// 行号 + CwVouitemsEntity2.PACCID = "";//父级科目贷码 + CwVouitemsEntity2.PROPERTY = 0;//科目属性 + CwVouitemsEntity2.GRADE = 0;//科目级别 + CwVouitemsEntity2.ACCID = ds.Tables[0].Rows[0]["MBINCOME"].ToString().Trim();//主营业务收入科目贷码 + CwVouitemsEntity2.AMTDR = 0;//本位币借方金额(互斥) + CwVouitemsEntity2.AMTCR = dRMBS;//本位币贷方金额(互斥) + strDai = strDai + dRMBS; + CwVouitemsEntity2.ISFCY = false;//是否外币 + CwVouitemsEntity2.FCYNO = "RMB";//外币编号usd + CwVouitemsEntity2.FCYDR = 0;//外币借方金额 + CwVouitemsEntity2.FCYCR = 0;//外币贷方金额 + if (ds8 == null) + { + CwVouitemsEntity2.ACCNAME = "";//科目名称 + CwVouitemsEntity2.ISDEPTACC = false;//核算部门,按规则设置生成 + CwVouitemsEntity2.ISEMPLACC = false;//核算人员,按规则设置生成 + CwVouitemsEntity2.ISCORPACC = false;//核算客户,按规则设置生成 + CwVouitemsEntity2.ISITEMACC = false;//核算项目,按规则设置生成 + CwVouitemsEntity2.DC = "C";//贷方向 + } + else + { + CwVouitemsEntity2.ACCNAME = ds8.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 + CwVouitemsEntity2.ISDEPTACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 + CwVouitemsEntity2.ISEMPLACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 + CwVouitemsEntity2.ISCORPACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 + CwVouitemsEntity2.ISITEMACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 + if (ds8.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") { - CwVouitemsEntity1.ACCNAME = "";//科目名称 - CwVouitemsEntity1.ISDEPTACC = false;//核算部门,按规则设置生成 - CwVouitemsEntity1.ISEMPLACC = false;//核算人员,按规则设置生成 - CwVouitemsEntity1.ISCORPACC = false;//核算客户,按规则设置生成 - CwVouitemsEntity1.ISITEMACC = false;//核算项目,按规则设置生成 - CwVouitemsEntity1.DC = "C";//贷方向 + CwVouitemsEntity2.DC = "D";//借方向 } else { - CwVouitemsEntity1.ACCNAME = ds8.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 - CwVouitemsEntity1.ISDEPTACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 - CwVouitemsEntity1.ISEMPLACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 - CwVouitemsEntity1.ISCORPACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 - CwVouitemsEntity1.ISITEMACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 - if (ds8.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") - { - CwVouitemsEntity1.DC = "D";//借方向 - } - else - { - CwVouitemsEntity1.DC = "C";//贷方向 - } + CwVouitemsEntity2.DC = "C";//贷方向 } - CwVouitemsEntity1.CORPID = "";// strEMPLID;//人员(系统)本来应该放客户 - CwVouitemsEntity1.CUSTOMERNAME = "";// strSALE;//人员(系统)本来应该放客户 - CwVouitemsEntity1.FCYEXRATE = 1;//汇率 - CwVouitemsEntity1.QTYUNIT = "";//数量包装单位 - CwVouitemsEntity1.QTYDR = 0;//借方数量 - CwVouitemsEntity1.QTYCR = 0;//贷方数量 - CwVouitemsEntity1.EXPLAN = strEXPLAN;//摘要,规则生成 "转运费" + - CwVouitemsEntity1.DEPTID = strDEPTID;//部门(系统) - CwVouitemsEntity1.EMPLID = strEMPLID;//人员(系统) - CwVouitemsEntity1.SALE = strSALE;//人员名称 - CwVouitemsEntity1.PITEMID = 0;//父级项目编号 - CwVouitemsEntity1.ITEMID = "0";//项目编号 - CwVouitemsEntity1.FIELD1 = "";//预留字段1 - CwVouitemsEntity1.FIELD2 = "";//预留字段2 - CwVouitemsEntity1.FIELD3 = "";//预留字段3 - CwVouitemsEntity1.FIELD4 = "";//预留字段4 - CwVouitemsEntity1.FIELD5 = "";//预留字段5 - CwVouitemsEntity1.FIELD6 = "";//预留字段6 - CwVouitemsEntity1.FIELD7 = "";//预留字段7 - CwVouitemsEntity1.FIELD8 = "";//预留字段8 - CwVouitemsEntity1.FIELD9 = "";//预留字段9 - CwVouitemsEntity1.FIELD10 = "";//预留字段10 - if (ds.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True") + } + CwVouitemsEntity2.CORPID = "";// strEMPLID;//人员(系统)本来应该放客户 + CwVouitemsEntity2.CUSTOMERNAME = "";// strSALE;//人员(系统)本来应该放客户 + CwVouitemsEntity2.FCYEXRATE = 1;//汇率 + //dEXCHANGERATE = Decimal.Parse(ds1.Tables[0].Rows[j]["EXCHANGERATE"].ToString().Trim());//汇率 + CwVouitemsEntity2.QTYUNIT = "";//数量包装单位 + CwVouitemsEntity2.QTYDR = 0;//借方数量 + CwVouitemsEntity2.QTYCR = 0;//贷方数量 + CwVouitemsEntity2.EXPLAN = strEXPLAN;//摘要,规则生成 "转运费" + + CwVouitemsEntity2.DEPTID = strDEPTID;//部门(系统) + CwVouitemsEntity2.EMPLID = strEMPLID;//人员(系统) + CwVouitemsEntity2.SALE = strSALE;//人员名称 + CwVouitemsEntity2.PITEMID = 0;//父级项目编号 + CwVouitemsEntity2.ITEMID = "0";//项目编号 + CwVouitemsEntity2.FIELD1 = "";//预留字段1 + CwVouitemsEntity2.FIELD2 = "";//预留字段2 + CwVouitemsEntity2.FIELD3 = "";//预留字段3 + CwVouitemsEntity2.FIELD4 = "";//预留字段4 + CwVouitemsEntity2.FIELD5 = "";//预留字段5 + CwVouitemsEntity2.FIELD6 = "";//预留字段6 + CwVouitemsEntity2.FIELD7 = "";//预留字段7 + CwVouitemsEntity2.FIELD8 = "";//预留字段8 + CwVouitemsEntity2.FIELD9 = "";//预留字段9 + CwVouitemsEntity2.FIELD10 = "";//预留字段10 + if (ds.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True") + { + CwVouitemsEntity2.ISSYS = false;//是否手动录入 + } + else + { + CwVouitemsEntity2.ISSYS = true;//是否手动录入 + } + CwVouitemsEntity2.FSETTLCODE = "";//结算方式 + CwVouitemsEntity2.FSETTLENO = "";//财务辅助编号 + CwVouitemsEntity2.MODIFIEDUSER = strUserID;//最后一次更新操作人 + CwVouitemsEntity2.BLNO = strBLNO;// + #endregion + CwVouitemsEntities.Add(CwVouitemsEntity2); + } + + dlSR = dUSDS * usdRATES; + if (dlSR != 0) + { + #region 收入USD + n = n + 1; + CwVouitemsEntity CwVouitemsEntity2 = new CwVouitemsEntity(); + //CwVouitemsEntity2.GID 唯一编码 newid() + CwVouitemsEntity2.ORDNO = strORDNO.Trim(); + CwVouitemsEntity2.ITEMNO = n;// 行号 + CwVouitemsEntity2.PACCID = "";//父级科目贷码 + CwVouitemsEntity2.PROPERTY = 0;//科目属性 + CwVouitemsEntity2.GRADE = 0;//科目级别 + CwVouitemsEntity2.ACCID = ds.Tables[0].Rows[0]["MBINCOME"].ToString().Trim();//主营业务收入科目贷码 + CwVouitemsEntity2.AMTDR = 0;//本位币借方金额(互斥) + CwVouitemsEntity2.AMTCR = Math.Round((dUSDS * usdRATES), 2, MidpointRounding.AwayFromZero);//本位币贷方金额(互斥) + strDai = strDai + Math.Round((dUSDS * usdRATES), 2, MidpointRounding.AwayFromZero); + CwVouitemsEntity2.ISFCY = true;//是否外币 + CwVouitemsEntity2.FCYNO = "USD";//外币编号usd + CwVouitemsEntity2.FCYDR = 0;//外币借方金额 + CwVouitemsEntity2.FCYCR = dUSDS;//外币贷方金额 + CwVouitemsEntity2.FCYEXRATE = usdRATES;//汇率 + if (ds8 == null) + { + CwVouitemsEntity2.ACCNAME = "";//科目名称 + CwVouitemsEntity2.ISDEPTACC = false;//核算部门,按规则设置生成 + CwVouitemsEntity2.ISEMPLACC = false;//核算人员,按规则设置生成 + CwVouitemsEntity2.ISCORPACC = false;//核算客户,按规则设置生成 + CwVouitemsEntity2.ISITEMACC = false;//核算项目,按规则设置生成 + CwVouitemsEntity2.DC = "C";//贷方向 + } + else + { + CwVouitemsEntity2.ACCNAME = ds8.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 + CwVouitemsEntity2.ISDEPTACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 + CwVouitemsEntity2.ISEMPLACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 + CwVouitemsEntity2.ISCORPACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 + CwVouitemsEntity2.ISITEMACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 + if (ds8.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") { - CwVouitemsEntity1.ISSYS = false;//是否手动录入 + CwVouitemsEntity2.DC = "D";//借方向 } else { - CwVouitemsEntity1.ISSYS = true;//是否手动录入 + CwVouitemsEntity2.DC = "C";//贷方向 } - CwVouitemsEntity1.FSETTLCODE = "";//结算方式 - CwVouitemsEntity1.FSETTLENO = "";//财务辅助编号 - CwVouitemsEntity1.MODIFIEDUSER = strUserID;//最后一次更新操作人 - CwVouitemsEntity1.BLNO = strBLNO;// - #endregion - CwVouitemsEntities.Add(CwVouitemsEntity1); - } - - if (dUSD != 0) - { - #region dUSD != 0 - CwVouitemsEntity CwVouitemsEntity3 = new CwVouitemsEntity(); - CwVouitemsEntity3.ORDNO = strORDNO.Trim(); - n = n + 1; - CwVouitemsEntity3.ITEMNO = n;// 行号 - CwVouitemsEntity3.PACCID = "";//父级科目贷码 - CwVouitemsEntity3.PROPERTY = 0;//科目属性 - CwVouitemsEntity3.GRADE = 0;//科目级别 - CwVouitemsEntity3.ACCID = ds.Tables[0].Rows[0]["TMFCI"].ToString().Trim();//应收账款外币科目贷码 - CwVouitemsEntity3.AMTDR = 0;//本位币借方金额(互斥) - CwVouitemsEntity3.AMTCR = Math.Round(Decimal.Parse(dUSD.ToString().Trim()) * (usdRATEF == 0 ? usdRATES : usdRATEF), 2, MidpointRounding.AwayFromZero);//本位币贷方金额(互斥) - strDai = strDai + Math.Round(Decimal.Parse(dUSD.ToString().Trim()) * (usdRATEF == 0 ? usdRATES : usdRATEF), 2, MidpointRounding.AwayFromZero); - CwVouitemsEntity3.ISFCY = true;//是否外币 - CwVouitemsEntity3.FCYNO = "USD";//外币编号usd - CwVouitemsEntity3.FCYDR = 0;//外币借方金额 - CwVouitemsEntity3.FCYCR = Decimal.Parse(dUSD.ToString().Trim());//外币贷方金额 - - if (ds10 == null) + } + CwVouitemsEntity2.CORPID = "";// strEMPLID;//人员(系统)本来应该放客户 + CwVouitemsEntity2.CUSTOMERNAME = "";// strSALE;//人员(系统)本来应该放客户 + //dEXCHANGERATE = Decimal.Parse(ds1.Tables[0].Rows[j]["EXCHANGERATE"].ToString().Trim());//汇率 + CwVouitemsEntity2.QTYUNIT = "";//数量包装单位 + CwVouitemsEntity2.QTYDR = 0;//借方数量 + CwVouitemsEntity2.QTYCR = 0;//贷方数量 + CwVouitemsEntity2.EXPLAN = strEXPLAN;//摘要,规则生成 "转运费" + + CwVouitemsEntity2.DEPTID = strDEPTID;//部门(系统) + CwVouitemsEntity2.EMPLID = strEMPLID;//人员(系统) + CwVouitemsEntity2.SALE = strSALE;//人员名称 + CwVouitemsEntity2.PITEMID = 0;//父级项目编号 + CwVouitemsEntity2.ITEMID = "0";//项目编号 + CwVouitemsEntity2.FIELD1 = "";//预留字段1 + CwVouitemsEntity2.FIELD2 = "";//预留字段2 + CwVouitemsEntity2.FIELD3 = "";//预留字段3 + CwVouitemsEntity2.FIELD4 = "";//预留字段4 + CwVouitemsEntity2.FIELD5 = "";//预留字段5 + CwVouitemsEntity2.FIELD6 = "";//预留字段6 + CwVouitemsEntity2.FIELD7 = "";//预留字段7 + CwVouitemsEntity2.FIELD8 = "";//预留字段8 + CwVouitemsEntity2.FIELD9 = "";//预留字段9 + CwVouitemsEntity2.FIELD10 = "";//预留字段10 + if (ds.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True") + { + CwVouitemsEntity2.ISSYS = false;//是否手动录入 + } + else + { + CwVouitemsEntity2.ISSYS = true;//是否手动录入 + } + CwVouitemsEntity2.FSETTLCODE = "";//结算方式 + CwVouitemsEntity2.FSETTLENO = "";//财务辅助编号 + CwVouitemsEntity2.MODIFIEDUSER = strUserID;//最后一次更新操作人 + CwVouitemsEntity2.BLNO = strBLNO;// + #endregion + CwVouitemsEntities.Add(CwVouitemsEntity2); + } + + Decimal dlZC = dRMBF; + if (dlZC != 0) + { + #region 支出RMB + n = n + 1; + CwVouitemsEntity CwVouitemsEntity4 = new CwVouitemsEntity(); + //CwVouitemsEntity4.GID 唯一编码 newid() + CwVouitemsEntity4.ORDNO = strORDNO.Trim(); + CwVouitemsEntity4.ITEMNO = n;// 行号 + CwVouitemsEntity4.PACCID = "";//父级科目贷码 + CwVouitemsEntity4.PROPERTY = 0;//科目属性 + CwVouitemsEntity4.GRADE = 0;//科目级别 + CwVouitemsEntity4.ACCID = ds.Tables[0].Rows[0]["MBSPENDING"].ToString().Trim();//主营业务支出科目贷码 + CwVouitemsEntity4.AMTDR = dRMBF;//本位币借方金额(互斥) + strJie = strJie + dRMBF; + CwVouitemsEntity4.AMTCR = 0;//本位币贷方金额(互斥) + CwVouitemsEntity4.ISFCY = false;//是否外币 + CwVouitemsEntity4.FCYNO = "RMB";//外币编号usd + CwVouitemsEntity4.FCYDR = 0;//外币借方金额 + CwVouitemsEntity4.FCYCR = 0;//外币贷方金额 + if (ds9 == null) + { + CwVouitemsEntity4.ACCNAME = "";//科目名称 + CwVouitemsEntity4.ISDEPTACC = false;//核算部门,按规则设置生成 + CwVouitemsEntity4.ISEMPLACC = false;//核算人员,按规则设置生成 + CwVouitemsEntity4.ISCORPACC = false;//核算客户,按规则设置生成 + CwVouitemsEntity4.ISITEMACC = false;//核算项目,按规则设置生成 + CwVouitemsEntity4.DC = "D";//借方向 + } + else + { + CwVouitemsEntity4.ACCNAME = ds9.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 + CwVouitemsEntity4.ISDEPTACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 + CwVouitemsEntity4.ISEMPLACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 + CwVouitemsEntity4.ISCORPACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 + CwVouitemsEntity4.ISITEMACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 + if (ds9.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") { - CwVouitemsEntity3.ACCNAME = "";//科目名称 - CwVouitemsEntity3.ISDEPTACC = false;//核算部门,按规则设置生成 - CwVouitemsEntity3.ISEMPLACC = false;//核算人员,按规则设置生成 - CwVouitemsEntity3.ISCORPACC = false;//核算客户,按规则设置生成 - CwVouitemsEntity3.ISITEMACC = false;//核算项目,按规则设置生成 - CwVouitemsEntity3.DC = "C";//贷方向 + CwVouitemsEntity4.DC = "D";//借方向 } else { - CwVouitemsEntity3.ACCNAME = ds10.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 - CwVouitemsEntity3.ISDEPTACC = Boolean.Parse(ds10.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 - CwVouitemsEntity3.ISEMPLACC = Boolean.Parse(ds10.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 - CwVouitemsEntity3.ISCORPACC = Boolean.Parse(ds10.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 - CwVouitemsEntity3.ISITEMACC = Boolean.Parse(ds10.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 - if (ds10.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") - { - CwVouitemsEntity3.DC = "D";//借方向 - } - else - { - CwVouitemsEntity3.DC = "C";//贷方向 - } + CwVouitemsEntity4.DC = "C";//贷方向 } - CwVouitemsEntity3.CORPID = "";// strEMPLID;//人员(系统)本来应该放客户 - CwVouitemsEntity3.CUSTOMERNAME = "";// strSALE;//人员(系统)本来应该放客户 - CwVouitemsEntity3.FCYEXRATE = (usdRATEF == 0 ? usdRATES : usdRATEF);//汇率 - CwVouitemsEntity3.QTYUNIT = "";//数量包装单位 - CwVouitemsEntity3.QTYDR = 0;//借方数量 - CwVouitemsEntity3.QTYCR = 0;//贷方数量 - CwVouitemsEntity3.EXPLAN = strEXPLAN;//摘要,规则生成 "转运费" + - CwVouitemsEntity3.DEPTID = strDEPTID;//部门(系统) - CwVouitemsEntity3.EMPLID = strEMPLID;//人员(系统) - CwVouitemsEntity3.SALE = strSALE;//人员名称 - CwVouitemsEntity3.PITEMID = 0;//父级项目编号 - CwVouitemsEntity3.ITEMID = "0";//项目编号 - CwVouitemsEntity3.FIELD1 = "";//预留字段1 - CwVouitemsEntity3.FIELD2 = "";//预留字段2 - CwVouitemsEntity3.FIELD3 = "";//预留字段3 - CwVouitemsEntity3.FIELD4 = "";//预留字段4 - CwVouitemsEntity3.FIELD5 = "";//预留字段5 - CwVouitemsEntity3.FIELD6 = "";//预留字段6 - CwVouitemsEntity3.FIELD7 = "";//预留字段7 - CwVouitemsEntity3.FIELD8 = "";//预留字段8 - CwVouitemsEntity3.FIELD9 = "";//预留字段9 - CwVouitemsEntity3.FIELD10 = "";//预留字段10 - if (ds.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True") + } + CwVouitemsEntity4.CORPID = "";// strEMPLID;//人员(系统)本来应该放客户 + CwVouitemsEntity4.CUSTOMERNAME = "";// strSALE;//人员(系统)本来应该放客户 + CwVouitemsEntity4.FCYEXRATE = 1;//汇率 + //dEXCHANGERATE = Decimal.Parse(ds1.Tables[0].Rows[j]["EXCHANGERATE"].ToString().Trim());//汇率 + CwVouitemsEntity4.QTYUNIT = "";//数量包装单位 + CwVouitemsEntity4.QTYDR = 0;//借方数量 + CwVouitemsEntity4.QTYCR = 0;//贷方数量 + CwVouitemsEntity4.EXPLAN = strEXPLAN;//摘要,规则生成 "转运费" + + CwVouitemsEntity4.DEPTID = strDEPTID;//部门(系统) + CwVouitemsEntity4.EMPLID = strEMPLID;//人员(系统) + CwVouitemsEntity4.SALE = strSALE;//人员名称 + CwVouitemsEntity4.PITEMID = 0;//父级项目编号 + CwVouitemsEntity4.ITEMID = "0";//项目编号 + CwVouitemsEntity4.FIELD1 = "";//预留字段1 + CwVouitemsEntity4.FIELD2 = "";//预留字段2 + CwVouitemsEntity4.FIELD3 = "";//预留字段3 + CwVouitemsEntity4.FIELD4 = "";//预留字段4 + CwVouitemsEntity4.FIELD5 = "";//预留字段5 + CwVouitemsEntity4.FIELD6 = "";//预留字段6 + CwVouitemsEntity4.FIELD7 = "";//预留字段7 + CwVouitemsEntity4.FIELD8 = "";//预留字段8 + CwVouitemsEntity4.FIELD9 = "";//预留字段9 + CwVouitemsEntity4.FIELD10 = "";//预留字段10 + if (ds.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True") + { + CwVouitemsEntity4.ISSYS = false;//是否手动录入 + } + else + { + CwVouitemsEntity4.ISSYS = true;//是否手动录入 + } + CwVouitemsEntity4.FSETTLCODE = "";//结算方式 + CwVouitemsEntity4.FSETTLENO = "";//财务辅助编号 + CwVouitemsEntity4.MODIFIEDUSER = strUserID;//最后一次更新操作人 + CwVouitemsEntity4.BLNO = strBLNO;// + #endregion + CwVouitemsEntities.Add(CwVouitemsEntity4); + } + + + dlZC = dUSDF * usdRATEF; + if (dlZC != 0) + { + #region 支出USD + n = n + 1; + CwVouitemsEntity CwVouitemsEntity4 = new CwVouitemsEntity(); + //CwVouitemsEntity4.GID 唯一编码 newid() + CwVouitemsEntity4.ORDNO = strORDNO.Trim(); + CwVouitemsEntity4.ITEMNO = n;// 行号 + CwVouitemsEntity4.PACCID = "";//父级科目贷码 + CwVouitemsEntity4.PROPERTY = 0;//科目属性 + CwVouitemsEntity4.GRADE = 0;//科目级别 + CwVouitemsEntity4.ACCID = ds.Tables[0].Rows[0]["MBSPENDING"].ToString().Trim();//主营业务支出科目贷码 + CwVouitemsEntity4.AMTDR = Math.Round((dUSDF * usdRATEF), 2, MidpointRounding.AwayFromZero);//本位币借方金额(互斥) + strJie = strJie + Math.Round((dUSDF * usdRATEF), 2, MidpointRounding.AwayFromZero); + CwVouitemsEntity4.AMTCR = 0;//本位币贷方金额(互斥) + CwVouitemsEntity4.ISFCY = true;//是否外币 + CwVouitemsEntity4.FCYNO = "USD";//外币编号usd + CwVouitemsEntity4.FCYDR = dUSDF;//外币借方金额 + CwVouitemsEntity4.FCYCR = 0;//外币贷方金额 + CwVouitemsEntity4.FCYEXRATE = usdRATEF;//汇率 + if (ds9 == null) + { + CwVouitemsEntity4.ACCNAME = "";//科目名称 + CwVouitemsEntity4.ISDEPTACC = false;//核算部门,按规则设置生成 + CwVouitemsEntity4.ISEMPLACC = false;//核算人员,按规则设置生成 + CwVouitemsEntity4.ISCORPACC = false;//核算客户,按规则设置生成 + CwVouitemsEntity4.ISITEMACC = false;//核算项目,按规则设置生成 + CwVouitemsEntity4.DC = "D";//借方向 + } + else + { + CwVouitemsEntity4.ACCNAME = ds9.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 + CwVouitemsEntity4.ISDEPTACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 + CwVouitemsEntity4.ISEMPLACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 + CwVouitemsEntity4.ISCORPACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 + CwVouitemsEntity4.ISITEMACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 + if (ds9.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") { - CwVouitemsEntity3.ISSYS = false;//是否手动录入 + CwVouitemsEntity4.DC = "D";//借方向 } else { - CwVouitemsEntity3.ISSYS = true;//是否手动录入 + CwVouitemsEntity4.DC = "C";//贷方向 } - CwVouitemsEntity3.FSETTLCODE = "";//结算方式 - CwVouitemsEntity3.FSETTLENO = "";//财务辅助编号 - CwVouitemsEntity3.MODIFIEDUSER = strUserID;//最后一次更新操作人 - CwVouitemsEntity3.BLNO = strBLNO;// - #endregion - CwVouitemsEntities.Add(CwVouitemsEntity3); } + CwVouitemsEntity4.CORPID = "";// strEMPLID;//人员(系统)本来应该放客户 + CwVouitemsEntity4.CUSTOMERNAME = "";// strSALE;//人员(系统)本来应该放客户 + //dEXCHANGERATE = Decimal.Parse(ds1.Tables[0].Rows[j]["EXCHANGERATE"].ToString().Trim());//汇率 + CwVouitemsEntity4.QTYUNIT = "";//数量包装单位 + CwVouitemsEntity4.QTYDR = 0;//借方数量 + CwVouitemsEntity4.QTYCR = 0;//贷方数量 + CwVouitemsEntity4.EXPLAN = strEXPLAN;//摘要,规则生成 "转运费" + + CwVouitemsEntity4.DEPTID = strDEPTID;//部门(系统) + CwVouitemsEntity4.EMPLID = strEMPLID;//人员(系统) + CwVouitemsEntity4.SALE = strSALE;//人员名称 + CwVouitemsEntity4.PITEMID = 0;//父级项目编号 + CwVouitemsEntity4.ITEMID = "0";//项目编号 + CwVouitemsEntity4.FIELD1 = "";//预留字段1 + CwVouitemsEntity4.FIELD2 = "";//预留字段2 + CwVouitemsEntity4.FIELD3 = "";//预留字段3 + CwVouitemsEntity4.FIELD4 = "";//预留字段4 + CwVouitemsEntity4.FIELD5 = "";//预留字段5 + CwVouitemsEntity4.FIELD6 = "";//预留字段6 + CwVouitemsEntity4.FIELD7 = "";//预留字段7 + CwVouitemsEntity4.FIELD8 = "";//预留字段8 + CwVouitemsEntity4.FIELD9 = "";//预留字段9 + CwVouitemsEntity4.FIELD10 = "";//预留字段10 + if (ds.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True") + { + CwVouitemsEntity4.ISSYS = false;//是否手动录入 + } + else + { + CwVouitemsEntity4.ISSYS = true;//是否手动录入 + } + CwVouitemsEntity4.FSETTLCODE = "";//结算方式 + CwVouitemsEntity4.FSETTLENO = "";//财务辅助编号 + CwVouitemsEntity4.MODIFIEDUSER = strUserID;//最后一次更新操作人 + CwVouitemsEntity4.BLNO = strBLNO;// #endregion + CwVouitemsEntities.Add(CwVouitemsEntity4); } + #endregion } - else + else if (ds.Tables[0].Rows[0]["AMCODE"].ToString().Trim() == "2")//差额 { - if (ds.Tables[0].Rows[0]["AMCODE"].ToString().Trim() == "1")//全额 + #region 差额 + if (dRMB != 0) { - #region 全额 - // Decimal dlSR = dRMBS + (dUSDS * usdRATES); - Decimal dlSR = iAMTDR; - - if (dlSR != 0) - { - #region 收入 - n = n + 1; - CwVouitemsEntity CwVouitemsEntity2 = new CwVouitemsEntity(); - //CwVouitemsEntity2.GID 唯一编码 newid() - CwVouitemsEntity2.ORDNO = strORDNO.Trim(); - CwVouitemsEntity2.ITEMNO = n;// 行号 - CwVouitemsEntity2.PACCID = "";//父级科目贷码 - CwVouitemsEntity2.PROPERTY = 0;//科目属性 - CwVouitemsEntity2.GRADE = 0;//科目级别 - CwVouitemsEntity2.ACCID = ds.Tables[0].Rows[0]["MBINCOME"].ToString().Trim();//主营业务收入科目贷码 - CwVouitemsEntity2.AMTDR = 0;//本位币借方金额(互斥) - //CwVouitemsEntity2.AMTCR = dRMBS + (dUSDS * usdRATES);//本位币贷方金额(互斥) - //strDai = strDai + dRMBS + (dUSDS * usdRATES); - CwVouitemsEntity2.AMTCR = iAMTDR;//本位币贷方金额(互斥) - strDai = strDai + iAMTDR; - - CwVouitemsEntity2.ISFCY = false;//是否外币 - CwVouitemsEntity2.FCYNO = "RMB";//外币编号usd - CwVouitemsEntity2.FCYDR = 0;//外币借方金额 - CwVouitemsEntity2.FCYCR = 0;//外币贷方金额 - if (ds8 == null) - { - CwVouitemsEntity2.ACCNAME = "";//科目名称 - CwVouitemsEntity2.ISDEPTACC = false;//核算部门,按规则设置生成 - CwVouitemsEntity2.ISEMPLACC = false;//核算人员,按规则设置生成 - CwVouitemsEntity2.ISCORPACC = false;//核算客户,按规则设置生成 - CwVouitemsEntity2.ISITEMACC = false;//核算项目,按规则设置生成 - CwVouitemsEntity2.DC = "C";//贷方向 - } - else - { - CwVouitemsEntity2.ACCNAME = ds8.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 - CwVouitemsEntity2.ISDEPTACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 - CwVouitemsEntity2.ISEMPLACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 - CwVouitemsEntity2.ISCORPACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 - CwVouitemsEntity2.ISITEMACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 - if (ds8.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") - { - CwVouitemsEntity2.DC = "D";//借方向 - } - else - { - CwVouitemsEntity2.DC = "C";//贷方向 - } - } - CwVouitemsEntity2.CORPID = "";// strEMPLID;//人员(系统)本来应该放客户 - CwVouitemsEntity2.CUSTOMERNAME = "";// strSALE;//人员(系统)本来应该放客户 - CwVouitemsEntity2.FCYEXRATE = 1;//汇率 - //dEXCHANGERATE = Decimal.Parse(ds1.Tables[0].Rows[j]["EXCHANGERATE"].ToString().Trim());//汇率 - CwVouitemsEntity2.QTYUNIT = "";//数量包装单位 - CwVouitemsEntity2.QTYDR = 0;//借方数量 - CwVouitemsEntity2.QTYCR = 0;//贷方数量 - CwVouitemsEntity2.EXPLAN = strEXPLAN;//摘要,规则生成 "转运费" + - CwVouitemsEntity2.DEPTID = strDEPTID;//部门(系统) - CwVouitemsEntity2.EMPLID = strEMPLID;//人员(系统) - CwVouitemsEntity2.SALE = strSALE;//人员名称 - CwVouitemsEntity2.PITEMID = 0;//父级项目编号 - CwVouitemsEntity2.ITEMID = "0";//项目编号 - CwVouitemsEntity2.FIELD1 = "";//预留字段1 - CwVouitemsEntity2.FIELD2 = "";//预留字段2 - CwVouitemsEntity2.FIELD3 = "";//预留字段3 - CwVouitemsEntity2.FIELD4 = "";//预留字段4 - CwVouitemsEntity2.FIELD5 = "";//预留字段5 - CwVouitemsEntity2.FIELD6 = "";//预留字段6 - CwVouitemsEntity2.FIELD7 = "";//预留字段7 - CwVouitemsEntity2.FIELD8 = "";//预留字段8 - CwVouitemsEntity2.FIELD9 = "";//预留字段9 - CwVouitemsEntity2.FIELD10 = "";//预留字段10 - if (ds.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True") + #region dRMB != 0 + CwVouitemsEntity CwVouitemsEntity1 = new CwVouitemsEntity(); + //CwVouitemsEntity1.GID 唯一编码 newid() + CwVouitemsEntity1.ORDNO = strORDNO.Trim(); + n = n + 1; + CwVouitemsEntity1.ITEMNO = n;// 行号 + CwVouitemsEntity1.PACCID = "";//父级科目贷码 + CwVouitemsEntity1.PROPERTY = 0;//科目属性 + CwVouitemsEntity1.GRADE = 0;//科目级别 + CwVouitemsEntity1.ACCID = ds.Tables[0].Rows[0]["MBINCOME"].ToString().Trim();//主营业务收入科目贷码 + CwVouitemsEntity1.AMTDR = 0;//本位币借方金额(互斥) + CwVouitemsEntity1.AMTCR = Decimal.Parse(dRMB.ToString().Trim());//本位币贷方金额(互斥) + strDai = strDai + Decimal.Parse(dRMB.ToString().Trim()); + CwVouitemsEntity1.ISFCY = false;//是否外币 + CwVouitemsEntity1.FCYNO = "RMB";//外币编号usd + CwVouitemsEntity1.FCYDR = 0;//外币借方金额 + CwVouitemsEntity1.FCYCR = 0;//外币贷方金额 + + if (ds8 == null) + { + CwVouitemsEntity1.ACCNAME = "";//科目名称 + CwVouitemsEntity1.ISDEPTACC = false;//核算部门,按规则设置生成 + CwVouitemsEntity1.ISEMPLACC = false;//核算人员,按规则设置生成 + CwVouitemsEntity1.ISCORPACC = false;//核算客户,按规则设置生成 + CwVouitemsEntity1.ISITEMACC = false;//核算项目,按规则设置生成 + CwVouitemsEntity1.DC = "C";//贷方向 + } + else + { + CwVouitemsEntity1.ACCNAME = ds8.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 + CwVouitemsEntity1.ISDEPTACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 + CwVouitemsEntity1.ISEMPLACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 + CwVouitemsEntity1.ISCORPACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 + CwVouitemsEntity1.ISITEMACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 + if (ds8.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") { - CwVouitemsEntity2.ISSYS = false;//是否手动录入 + CwVouitemsEntity1.DC = "D";//借方向 } else { - CwVouitemsEntity2.ISSYS = true;//是否手动录入 + CwVouitemsEntity1.DC = "C";//贷方向 } - CwVouitemsEntity2.FSETTLCODE = "";//结算方式 - CwVouitemsEntity2.FSETTLENO = "";//财务辅助编号 - CwVouitemsEntity2.MODIFIEDUSER = strUserID;//最后一次更新操作人 - CwVouitemsEntity2.BLNO = strBLNO;// - #endregion - CwVouitemsEntities.Add(CwVouitemsEntity2); - } - - Decimal dlZC = dRMBF + Math.Round((dUSDF * usdRATEF), 2, MidpointRounding.AwayFromZero); - if (dlZC != 0) - { - #region 支出 - n = n + 1; - CwVouitemsEntity CwVouitemsEntity4 = new CwVouitemsEntity(); - //CwVouitemsEntity4.GID 唯一编码 newid() - CwVouitemsEntity4.ORDNO = strORDNO.Trim(); - CwVouitemsEntity4.ITEMNO = n;// 行号 - CwVouitemsEntity4.PACCID = "";//父级科目贷码 - CwVouitemsEntity4.PROPERTY = 0;//科目属性 - CwVouitemsEntity4.GRADE = 0;//科目级别 - CwVouitemsEntity4.ACCID = ds.Tables[0].Rows[0]["MBSPENDING"].ToString().Trim();//主营业务支出科目贷码 - //CwVouitemsEntity4.AMTDR = dRMBF + (dUSDF * usdRATEF);//本位币借方金额(互斥) - //strJie = strJie + dRMBF + (dUSDF * usdRATEF); - CwVouitemsEntity4.AMTDR = iAMTCR;//本位币借方金额(互斥) - strJie = strJie + iAMTCR; - CwVouitemsEntity4.AMTCR = 0;//本位币贷方金额(互斥) - CwVouitemsEntity4.ISFCY = false;//是否外币 - CwVouitemsEntity4.FCYNO = "RMB";//外币编号usd - CwVouitemsEntity4.FCYDR = 0;//外币借方金额 - CwVouitemsEntity4.FCYCR = 0;//外币贷方金额 - if (ds9 == null) + } + CwVouitemsEntity1.CORPID = "";// strEMPLID;//人员(系统)本来应该放客户 + CwVouitemsEntity1.CUSTOMERNAME = "";// strSALE;//人员(系统)本来应该放客户 + CwVouitemsEntity1.FCYEXRATE = 1;//汇率 + CwVouitemsEntity1.QTYUNIT = "";//数量包装单位 + CwVouitemsEntity1.QTYDR = 0;//借方数量 + CwVouitemsEntity1.QTYCR = 0;//贷方数量 + CwVouitemsEntity1.EXPLAN = strEXPLAN;//摘要,规则生成 "转运费" + + CwVouitemsEntity1.DEPTID = strDEPTID;//部门(系统) + CwVouitemsEntity1.EMPLID = strEMPLID;//人员(系统) + CwVouitemsEntity1.SALE = strSALE;//人员名称 + CwVouitemsEntity1.PITEMID = 0;//父级项目编号 + CwVouitemsEntity1.ITEMID = "0";//项目编号 + CwVouitemsEntity1.FIELD1 = "";//预留字段1 + CwVouitemsEntity1.FIELD2 = "";//预留字段2 + CwVouitemsEntity1.FIELD3 = "";//预留字段3 + CwVouitemsEntity1.FIELD4 = "";//预留字段4 + CwVouitemsEntity1.FIELD5 = "";//预留字段5 + CwVouitemsEntity1.FIELD6 = "";//预留字段6 + CwVouitemsEntity1.FIELD7 = "";//预留字段7 + CwVouitemsEntity1.FIELD8 = "";//预留字段8 + CwVouitemsEntity1.FIELD9 = "";//预留字段9 + CwVouitemsEntity1.FIELD10 = "";//预留字段10 + if (ds.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True") + { + CwVouitemsEntity1.ISSYS = false;//是否手动录入 + } + else + { + CwVouitemsEntity1.ISSYS = true;//是否手动录入 + } + CwVouitemsEntity1.FSETTLCODE = "";//结算方式 + CwVouitemsEntity1.FSETTLENO = "";//财务辅助编号 + CwVouitemsEntity1.MODIFIEDUSER = strUserID;//最后一次更新操作人 + CwVouitemsEntity1.BLNO = strBLNO;// + #endregion + CwVouitemsEntities.Add(CwVouitemsEntity1); + } + + if (dUSD != 0) + { + #region dUSD != 0 + CwVouitemsEntity CwVouitemsEntity3 = new CwVouitemsEntity(); + CwVouitemsEntity3.ORDNO = strORDNO.Trim(); + n = n + 1; + CwVouitemsEntity3.ITEMNO = n;// 行号 + CwVouitemsEntity3.PACCID = "";//父级科目贷码 + CwVouitemsEntity3.PROPERTY = 0;//科目属性 + CwVouitemsEntity3.GRADE = 0;//科目级别 + CwVouitemsEntity3.ACCID = ds.Tables[0].Rows[0]["TMFCI"].ToString().Trim();//应收账款外币科目贷码 + CwVouitemsEntity3.AMTDR = 0;//本位币借方金额(互斥) + CwVouitemsEntity3.AMTCR = Math.Round(Decimal.Parse(dUSD.ToString().Trim()) * (usdRATEF == 0 ? usdRATES : usdRATEF), 2, MidpointRounding.AwayFromZero);//本位币贷方金额(互斥) + strDai = strDai + Math.Round(Decimal.Parse(dUSD.ToString().Trim()) * (usdRATEF == 0 ? usdRATES : usdRATEF), 2, MidpointRounding.AwayFromZero); + CwVouitemsEntity3.ISFCY = true;//是否外币 + CwVouitemsEntity3.FCYNO = "USD";//外币编号usd + CwVouitemsEntity3.FCYDR = 0;//外币借方金额 + CwVouitemsEntity3.FCYCR = Decimal.Parse(dUSD.ToString().Trim());//外币贷方金额 + + if (ds10 == null) + { + CwVouitemsEntity3.ACCNAME = "";//科目名称 + CwVouitemsEntity3.ISDEPTACC = false;//核算部门,按规则设置生成 + CwVouitemsEntity3.ISEMPLACC = false;//核算人员,按规则设置生成 + CwVouitemsEntity3.ISCORPACC = false;//核算客户,按规则设置生成 + CwVouitemsEntity3.ISITEMACC = false;//核算项目,按规则设置生成 + CwVouitemsEntity3.DC = "C";//贷方向 + } + else + { + CwVouitemsEntity3.ACCNAME = ds10.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 + CwVouitemsEntity3.ISDEPTACC = Boolean.Parse(ds10.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 + CwVouitemsEntity3.ISEMPLACC = Boolean.Parse(ds10.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 + CwVouitemsEntity3.ISCORPACC = Boolean.Parse(ds10.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 + CwVouitemsEntity3.ISITEMACC = Boolean.Parse(ds10.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 + if (ds10.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") { - CwVouitemsEntity4.ACCNAME = "";//科目名称 - CwVouitemsEntity4.ISDEPTACC = false;//核算部门,按规则设置生成 - CwVouitemsEntity4.ISEMPLACC = false;//核算人员,按规则设置生成 - CwVouitemsEntity4.ISCORPACC = false;//核算客户,按规则设置生成 - CwVouitemsEntity4.ISITEMACC = false;//核算项目,按规则设置生成 - CwVouitemsEntity4.DC = "D";//借方向 + CwVouitemsEntity3.DC = "D";//借方向 } else { - CwVouitemsEntity4.ACCNAME = ds9.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 - CwVouitemsEntity4.ISDEPTACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 - CwVouitemsEntity4.ISEMPLACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 - CwVouitemsEntity4.ISCORPACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 - CwVouitemsEntity4.ISITEMACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 - if (ds9.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") - { - CwVouitemsEntity4.DC = "D";//借方向 - } - else - { - CwVouitemsEntity4.DC = "C";//贷方向 - } + CwVouitemsEntity3.DC = "C";//贷方向 } - CwVouitemsEntity4.CORPID = "";// strEMPLID;//人员(系统)本来应该放客户 - CwVouitemsEntity4.CUSTOMERNAME = "";// strSALE;//人员(系统)本来应该放客户 - CwVouitemsEntity4.FCYEXRATE = 1;//汇率 - //dEXCHANGERATE = Decimal.Parse(ds1.Tables[0].Rows[j]["EXCHANGERATE"].ToString().Trim());//汇率 - CwVouitemsEntity4.QTYUNIT = "";//数量包装单位 - CwVouitemsEntity4.QTYDR = 0;//借方数量 - CwVouitemsEntity4.QTYCR = 0;//贷方数量 - CwVouitemsEntity4.EXPLAN = strEXPLAN;//摘要,规则生成 "转运费" + - CwVouitemsEntity4.DEPTID = strDEPTID;//部门(系统) - CwVouitemsEntity4.EMPLID = strEMPLID;//人员(系统) - CwVouitemsEntity4.SALE = strSALE;//人员名称 - CwVouitemsEntity4.PITEMID = 0;//父级项目编号 - CwVouitemsEntity4.ITEMID = "0";//项目编号 - CwVouitemsEntity4.FIELD1 = "";//预留字段1 - CwVouitemsEntity4.FIELD2 = "";//预留字段2 - CwVouitemsEntity4.FIELD3 = "";//预留字段3 - CwVouitemsEntity4.FIELD4 = "";//预留字段4 - CwVouitemsEntity4.FIELD5 = "";//预留字段5 - CwVouitemsEntity4.FIELD6 = "";//预留字段6 - CwVouitemsEntity4.FIELD7 = "";//预留字段7 - CwVouitemsEntity4.FIELD8 = "";//预留字段8 - CwVouitemsEntity4.FIELD9 = "";//预留字段9 - CwVouitemsEntity4.FIELD10 = "";//预留字段10 - if (ds.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True") + } + CwVouitemsEntity3.CORPID = "";// strEMPLID;//人员(系统)本来应该放客户 + CwVouitemsEntity3.CUSTOMERNAME = "";// strSALE;//人员(系统)本来应该放客户 + CwVouitemsEntity3.FCYEXRATE = (usdRATEF == 0 ? usdRATES : usdRATEF);//汇率 + CwVouitemsEntity3.QTYUNIT = "";//数量包装单位 + CwVouitemsEntity3.QTYDR = 0;//借方数量 + CwVouitemsEntity3.QTYCR = 0;//贷方数量 + CwVouitemsEntity3.EXPLAN = strEXPLAN;//摘要,规则生成 "转运费" + + CwVouitemsEntity3.DEPTID = strDEPTID;//部门(系统) + CwVouitemsEntity3.EMPLID = strEMPLID;//人员(系统) + CwVouitemsEntity3.SALE = strSALE;//人员名称 + CwVouitemsEntity3.PITEMID = 0;//父级项目编号 + CwVouitemsEntity3.ITEMID = "0";//项目编号 + CwVouitemsEntity3.FIELD1 = "";//预留字段1 + CwVouitemsEntity3.FIELD2 = "";//预留字段2 + CwVouitemsEntity3.FIELD3 = "";//预留字段3 + CwVouitemsEntity3.FIELD4 = "";//预留字段4 + CwVouitemsEntity3.FIELD5 = "";//预留字段5 + CwVouitemsEntity3.FIELD6 = "";//预留字段6 + CwVouitemsEntity3.FIELD7 = "";//预留字段7 + CwVouitemsEntity3.FIELD8 = "";//预留字段8 + CwVouitemsEntity3.FIELD9 = "";//预留字段9 + CwVouitemsEntity3.FIELD10 = "";//预留字段10 + if (ds.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True") + { + CwVouitemsEntity3.ISSYS = false;//是否手动录入 + } + else + { + CwVouitemsEntity3.ISSYS = true;//是否手动录入 + } + CwVouitemsEntity3.FSETTLCODE = "";//结算方式 + CwVouitemsEntity3.FSETTLENO = "";//财务辅助编号 + CwVouitemsEntity3.MODIFIEDUSER = strUserID;//最后一次更新操作人 + CwVouitemsEntity3.BLNO = strBLNO;// + #endregion + CwVouitemsEntities.Add(CwVouitemsEntity3); + } + #endregion + } + } + else + { + if (ds.Tables[0].Rows[0]["AMCODE"].ToString().Trim() == "1")//全额 + { + #region 全额 + // Decimal dlSR = dRMBS + (dUSDS * usdRATES); + Decimal dlSR = iAMTDR; + + if (dlSR != 0) + { + #region 收入 + n = n + 1; + CwVouitemsEntity CwVouitemsEntity2 = new CwVouitemsEntity(); + //CwVouitemsEntity2.GID 唯一编码 newid() + CwVouitemsEntity2.ORDNO = strORDNO.Trim(); + CwVouitemsEntity2.ITEMNO = n;// 行号 + CwVouitemsEntity2.PACCID = "";//父级科目贷码 + CwVouitemsEntity2.PROPERTY = 0;//科目属性 + CwVouitemsEntity2.GRADE = 0;//科目级别 + CwVouitemsEntity2.ACCID = ds.Tables[0].Rows[0]["MBINCOME"].ToString().Trim();//主营业务收入科目贷码 + CwVouitemsEntity2.AMTDR = 0;//本位币借方金额(互斥) + //CwVouitemsEntity2.AMTCR = dRMBS + (dUSDS * usdRATES);//本位币贷方金额(互斥) + //strDai = strDai + dRMBS + (dUSDS * usdRATES); + CwVouitemsEntity2.AMTCR = iAMTDR;//本位币贷方金额(互斥) + strDai = strDai + iAMTDR; + + CwVouitemsEntity2.ISFCY = false;//是否外币 + CwVouitemsEntity2.FCYNO = "RMB";//外币编号usd + CwVouitemsEntity2.FCYDR = 0;//外币借方金额 + CwVouitemsEntity2.FCYCR = 0;//外币贷方金额 + if (ds8 == null) + { + CwVouitemsEntity2.ACCNAME = "";//科目名称 + CwVouitemsEntity2.ISDEPTACC = false;//核算部门,按规则设置生成 + CwVouitemsEntity2.ISEMPLACC = false;//核算人员,按规则设置生成 + CwVouitemsEntity2.ISCORPACC = false;//核算客户,按规则设置生成 + CwVouitemsEntity2.ISITEMACC = false;//核算项目,按规则设置生成 + CwVouitemsEntity2.DC = "C";//贷方向 + } + else + { + CwVouitemsEntity2.ACCNAME = ds8.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 + CwVouitemsEntity2.ISDEPTACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 + CwVouitemsEntity2.ISEMPLACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 + CwVouitemsEntity2.ISCORPACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 + CwVouitemsEntity2.ISITEMACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 + if (ds8.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") { - CwVouitemsEntity4.ISSYS = false;//是否手动录入 + CwVouitemsEntity2.DC = "D";//借方向 } else { - CwVouitemsEntity4.ISSYS = true;//是否手动录入 + CwVouitemsEntity2.DC = "C";//贷方向 } - CwVouitemsEntity4.FSETTLCODE = "";//结算方式 - CwVouitemsEntity4.FSETTLENO = "";//财务辅助编号 - CwVouitemsEntity4.MODIFIEDUSER = strUserID;//最后一次更新操作人 - CwVouitemsEntity4.BLNO = strBLNO;// - #endregion - CwVouitemsEntities.Add(CwVouitemsEntity4); } + CwVouitemsEntity2.CORPID = "";// strEMPLID;//人员(系统)本来应该放客户 + CwVouitemsEntity2.CUSTOMERNAME = "";// strSALE;//人员(系统)本来应该放客户 + CwVouitemsEntity2.FCYEXRATE = 1;//汇率 + //dEXCHANGERATE = Decimal.Parse(ds1.Tables[0].Rows[j]["EXCHANGERATE"].ToString().Trim());//汇率 + CwVouitemsEntity2.QTYUNIT = "";//数量包装单位 + CwVouitemsEntity2.QTYDR = 0;//借方数量 + CwVouitemsEntity2.QTYCR = 0;//贷方数量 + CwVouitemsEntity2.EXPLAN = strEXPLAN;//摘要,规则生成 "转运费" + + CwVouitemsEntity2.DEPTID = strDEPTID;//部门(系统) + CwVouitemsEntity2.EMPLID = strEMPLID;//人员(系统) + CwVouitemsEntity2.SALE = strSALE;//人员名称 + CwVouitemsEntity2.PITEMID = 0;//父级项目编号 + CwVouitemsEntity2.ITEMID = "0";//项目编号 + CwVouitemsEntity2.FIELD1 = "";//预留字段1 + CwVouitemsEntity2.FIELD2 = "";//预留字段2 + CwVouitemsEntity2.FIELD3 = "";//预留字段3 + CwVouitemsEntity2.FIELD4 = "";//预留字段4 + CwVouitemsEntity2.FIELD5 = "";//预留字段5 + CwVouitemsEntity2.FIELD6 = "";//预留字段6 + CwVouitemsEntity2.FIELD7 = "";//预留字段7 + CwVouitemsEntity2.FIELD8 = "";//预留字段8 + CwVouitemsEntity2.FIELD9 = "";//预留字段9 + CwVouitemsEntity2.FIELD10 = "";//预留字段10 + if (ds.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True") + { + CwVouitemsEntity2.ISSYS = false;//是否手动录入 + } + else + { + CwVouitemsEntity2.ISSYS = true;//是否手动录入 + } + CwVouitemsEntity2.FSETTLCODE = "";//结算方式 + CwVouitemsEntity2.FSETTLENO = "";//财务辅助编号 + CwVouitemsEntity2.MODIFIEDUSER = strUserID;//最后一次更新操作人 + CwVouitemsEntity2.BLNO = strBLNO;// #endregion + CwVouitemsEntities.Add(CwVouitemsEntity2); } - else if (ds.Tables[0].Rows[0]["AMCODE"].ToString().Trim() == "2")//差额 + + Decimal dlZC = dRMBF + Math.Round((dUSDF * usdRATEF), 2, MidpointRounding.AwayFromZero); + if (dlZC != 0) { - if (dRMB != 0 || dUSD != 0) - { - #region 差额 - CwVouitemsEntity CwVouitemsEntity1 = new CwVouitemsEntity(); - //CwVouitemsEntity1.GID 唯一编码 newid() - CwVouitemsEntity1.ORDNO = strORDNO.Trim(); - n = n + 1; - CwVouitemsEntity1.ITEMNO = n;// 行号 - CwVouitemsEntity1.PACCID = "";//父级科目贷码 - CwVouitemsEntity1.PROPERTY = 0;//科目属性 - CwVouitemsEntity1.GRADE = 0;//科目级别 - CwVouitemsEntity1.ACCID = ds.Tables[0].Rows[0]["MBINCOME"].ToString().Trim();//主营业务收入科目贷码 - CwVouitemsEntity1.AMTDR = 0;//本位币借方金额(互斥) - CwVouitemsEntity1.AMTCR = Decimal.Parse(dRMB.ToString().Trim()) + Math.Round((Decimal.Parse(dUSD.ToString().Trim()) * (usdRATEF == 0 ? usdRATES : usdRATEF)), 2, MidpointRounding.AwayFromZero);//本位币贷方金额(互斥) - strDai = strDai + Decimal.Parse(dRMB.ToString().Trim()) + Math.Round((Decimal.Parse(dUSD.ToString().Trim()) * (usdRATEF == 0 ? usdRATES : usdRATEF)), 2, MidpointRounding.AwayFromZero); - CwVouitemsEntity1.ISFCY = false;//是否外币 - CwVouitemsEntity1.FCYNO = "RMB";//外币编号usd - CwVouitemsEntity1.FCYDR = 0;//外币借方金额 - CwVouitemsEntity1.FCYCR = 0;//外币贷方金额 - - if (ds8 == null) + #region 支出 + n = n + 1; + CwVouitemsEntity CwVouitemsEntity4 = new CwVouitemsEntity(); + //CwVouitemsEntity4.GID 唯一编码 newid() + CwVouitemsEntity4.ORDNO = strORDNO.Trim(); + CwVouitemsEntity4.ITEMNO = n;// 行号 + CwVouitemsEntity4.PACCID = "";//父级科目贷码 + CwVouitemsEntity4.PROPERTY = 0;//科目属性 + CwVouitemsEntity4.GRADE = 0;//科目级别 + CwVouitemsEntity4.ACCID = ds.Tables[0].Rows[0]["MBSPENDING"].ToString().Trim();//主营业务支出科目贷码 + //CwVouitemsEntity4.AMTDR = dRMBF + (dUSDF * usdRATEF);//本位币借方金额(互斥) + //strJie = strJie + dRMBF + (dUSDF * usdRATEF); + CwVouitemsEntity4.AMTDR = iAMTCR;//本位币借方金额(互斥) + strJie = strJie + iAMTCR; + CwVouitemsEntity4.AMTCR = 0;//本位币贷方金额(互斥) + CwVouitemsEntity4.ISFCY = false;//是否外币 + CwVouitemsEntity4.FCYNO = "RMB";//外币编号usd + CwVouitemsEntity4.FCYDR = 0;//外币借方金额 + CwVouitemsEntity4.FCYCR = 0;//外币贷方金额 + if (ds9 == null) + { + CwVouitemsEntity4.ACCNAME = "";//科目名称 + CwVouitemsEntity4.ISDEPTACC = false;//核算部门,按规则设置生成 + CwVouitemsEntity4.ISEMPLACC = false;//核算人员,按规则设置生成 + CwVouitemsEntity4.ISCORPACC = false;//核算客户,按规则设置生成 + CwVouitemsEntity4.ISITEMACC = false;//核算项目,按规则设置生成 + CwVouitemsEntity4.DC = "D";//借方向 + } + else + { + CwVouitemsEntity4.ACCNAME = ds9.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 + CwVouitemsEntity4.ISDEPTACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 + CwVouitemsEntity4.ISEMPLACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 + CwVouitemsEntity4.ISCORPACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 + CwVouitemsEntity4.ISITEMACC = Boolean.Parse(ds9.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 + if (ds9.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") { - CwVouitemsEntity1.ACCNAME = "";//科目名称 - CwVouitemsEntity1.ISDEPTACC = false;//核算部门,按规则设置生成 - CwVouitemsEntity1.ISEMPLACC = false;//核算人员,按规则设置生成 - CwVouitemsEntity1.ISCORPACC = false;//核算客户,按规则设置生成 - CwVouitemsEntity1.ISITEMACC = false;//核算项目,按规则设置生成 - CwVouitemsEntity1.DC = "C";//贷方向 + CwVouitemsEntity4.DC = "D";//借方向 } else { - CwVouitemsEntity1.ACCNAME = ds8.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 - CwVouitemsEntity1.ISDEPTACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 - CwVouitemsEntity1.ISEMPLACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 - CwVouitemsEntity1.ISCORPACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 - CwVouitemsEntity1.ISITEMACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 - if (ds8.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") - { - CwVouitemsEntity1.DC = "D";//借方向 - } - else - { - CwVouitemsEntity1.DC = "C";//贷方向 - } + CwVouitemsEntity4.DC = "C";//贷方向 } - CwVouitemsEntity1.CORPID = "";// strEMPLID;//人员(系统)本来应该放客户 - CwVouitemsEntity1.CUSTOMERNAME = "";// strSALE;//人员(系统)本来应该放客户 - CwVouitemsEntity1.FCYEXRATE = 1;//汇率 - CwVouitemsEntity1.QTYUNIT = "";//数量包装单位 - CwVouitemsEntity1.QTYDR = 0;//借方数量 - CwVouitemsEntity1.QTYCR = 0;//贷方数量 - CwVouitemsEntity1.EXPLAN = strEXPLAN;//摘要,规则生成 "转运费" + - CwVouitemsEntity1.DEPTID = strDEPTID;//部门(系统) - CwVouitemsEntity1.EMPLID = strEMPLID;//人员(系统) - CwVouitemsEntity1.SALE = strSALE;//人员名称 - CwVouitemsEntity1.PITEMID = 0;//父级项目编号 - CwVouitemsEntity1.ITEMID = "0";//项目编号 - CwVouitemsEntity1.FIELD1 = "";//预留字段1 - CwVouitemsEntity1.FIELD2 = "";//预留字段2 - CwVouitemsEntity1.FIELD3 = "";//预留字段3 - CwVouitemsEntity1.FIELD4 = "";//预留字段4 - CwVouitemsEntity1.FIELD5 = "";//预留字段5 - CwVouitemsEntity1.FIELD6 = "";//预留字段6 - CwVouitemsEntity1.FIELD7 = "";//预留字段7 - CwVouitemsEntity1.FIELD8 = "";//预留字段8 - CwVouitemsEntity1.FIELD9 = "";//预留字段9 - CwVouitemsEntity1.FIELD10 = "";//预留字段10 - if (ds.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True") + } + CwVouitemsEntity4.CORPID = "";// strEMPLID;//人员(系统)本来应该放客户 + CwVouitemsEntity4.CUSTOMERNAME = "";// strSALE;//人员(系统)本来应该放客户 + CwVouitemsEntity4.FCYEXRATE = 1;//汇率 + //dEXCHANGERATE = Decimal.Parse(ds1.Tables[0].Rows[j]["EXCHANGERATE"].ToString().Trim());//汇率 + CwVouitemsEntity4.QTYUNIT = "";//数量包装单位 + CwVouitemsEntity4.QTYDR = 0;//借方数量 + CwVouitemsEntity4.QTYCR = 0;//贷方数量 + CwVouitemsEntity4.EXPLAN = strEXPLAN;//摘要,规则生成 "转运费" + + CwVouitemsEntity4.DEPTID = strDEPTID;//部门(系统) + CwVouitemsEntity4.EMPLID = strEMPLID;//人员(系统) + CwVouitemsEntity4.SALE = strSALE;//人员名称 + CwVouitemsEntity4.PITEMID = 0;//父级项目编号 + CwVouitemsEntity4.ITEMID = "0";//项目编号 + CwVouitemsEntity4.FIELD1 = "";//预留字段1 + CwVouitemsEntity4.FIELD2 = "";//预留字段2 + CwVouitemsEntity4.FIELD3 = "";//预留字段3 + CwVouitemsEntity4.FIELD4 = "";//预留字段4 + CwVouitemsEntity4.FIELD5 = "";//预留字段5 + CwVouitemsEntity4.FIELD6 = "";//预留字段6 + CwVouitemsEntity4.FIELD7 = "";//预留字段7 + CwVouitemsEntity4.FIELD8 = "";//预留字段8 + CwVouitemsEntity4.FIELD9 = "";//预留字段9 + CwVouitemsEntity4.FIELD10 = "";//预留字段10 + if (ds.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True") + { + CwVouitemsEntity4.ISSYS = false;//是否手动录入 + } + else + { + CwVouitemsEntity4.ISSYS = true;//是否手动录入 + } + CwVouitemsEntity4.FSETTLCODE = "";//结算方式 + CwVouitemsEntity4.FSETTLENO = "";//财务辅助编号 + CwVouitemsEntity4.MODIFIEDUSER = strUserID;//最后一次更新操作人 + CwVouitemsEntity4.BLNO = strBLNO;// + #endregion + CwVouitemsEntities.Add(CwVouitemsEntity4); + } + #endregion + } + else if (ds.Tables[0].Rows[0]["AMCODE"].ToString().Trim() == "2")//差额 + { + if (dRMB != 0 || dUSD != 0) + { + #region 差额 + CwVouitemsEntity CwVouitemsEntity1 = new CwVouitemsEntity(); + //CwVouitemsEntity1.GID 唯一编码 newid() + CwVouitemsEntity1.ORDNO = strORDNO.Trim(); + n = n + 1; + CwVouitemsEntity1.ITEMNO = n;// 行号 + CwVouitemsEntity1.PACCID = "";//父级科目贷码 + CwVouitemsEntity1.PROPERTY = 0;//科目属性 + CwVouitemsEntity1.GRADE = 0;//科目级别 + CwVouitemsEntity1.ACCID = ds.Tables[0].Rows[0]["MBINCOME"].ToString().Trim();//主营业务收入科目贷码 + CwVouitemsEntity1.AMTDR = 0;//本位币借方金额(互斥) + CwVouitemsEntity1.AMTCR = Decimal.Parse(dRMB.ToString().Trim()) + Math.Round((Decimal.Parse(dUSD.ToString().Trim()) * (usdRATEF == 0 ? usdRATES : usdRATEF)), 2, MidpointRounding.AwayFromZero);//本位币贷方金额(互斥) + strDai = strDai + Decimal.Parse(dRMB.ToString().Trim()) + Math.Round((Decimal.Parse(dUSD.ToString().Trim()) * (usdRATEF == 0 ? usdRATES : usdRATEF)), 2, MidpointRounding.AwayFromZero); + CwVouitemsEntity1.ISFCY = false;//是否外币 + CwVouitemsEntity1.FCYNO = "RMB";//外币编号usd + CwVouitemsEntity1.FCYDR = 0;//外币借方金额 + CwVouitemsEntity1.FCYCR = 0;//外币贷方金额 + + if (ds8 == null) + { + CwVouitemsEntity1.ACCNAME = "";//科目名称 + CwVouitemsEntity1.ISDEPTACC = false;//核算部门,按规则设置生成 + CwVouitemsEntity1.ISEMPLACC = false;//核算人员,按规则设置生成 + CwVouitemsEntity1.ISCORPACC = false;//核算客户,按规则设置生成 + CwVouitemsEntity1.ISITEMACC = false;//核算项目,按规则设置生成 + CwVouitemsEntity1.DC = "C";//贷方向 + } + else + { + CwVouitemsEntity1.ACCNAME = ds8.Tables[0].Rows[0]["ACCNAME"].ToString().Trim();//科目名称 + CwVouitemsEntity1.ISDEPTACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISDEPTACC"].ToString().Trim());//核算部门,按规则设置生成 + CwVouitemsEntity1.ISEMPLACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISEMPLACC"].ToString().Trim());//核算人员,按规则设置生成 + CwVouitemsEntity1.ISCORPACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISCORPACC"].ToString().Trim());//核算客户,按规则设置生成 + CwVouitemsEntity1.ISITEMACC = Boolean.Parse(ds8.Tables[0].Rows[0]["ISITEMACC"].ToString().Trim());//核算项目,按规则设置生成 + if (ds8.Tables[0].Rows[0]["DC"].ToString().Trim() == "借") { - CwVouitemsEntity1.ISSYS = false;//是否手动录入 + CwVouitemsEntity1.DC = "D";//借方向 } else { - CwVouitemsEntity1.ISSYS = true;//是否手动录入 + CwVouitemsEntity1.DC = "C";//贷方向 } - CwVouitemsEntity1.FSETTLCODE = "";//结算方式 - CwVouitemsEntity1.FSETTLENO = "";//财务辅助编号 - CwVouitemsEntity1.MODIFIEDUSER = strUserID;//最后一次更新操作人 - CwVouitemsEntity1.BLNO = strBLNO;// - #endregion - CwVouitemsEntities.Add(CwVouitemsEntity1); } + CwVouitemsEntity1.CORPID = "";// strEMPLID;//人员(系统)本来应该放客户 + CwVouitemsEntity1.CUSTOMERNAME = "";// strSALE;//人员(系统)本来应该放客户 + CwVouitemsEntity1.FCYEXRATE = 1;//汇率 + CwVouitemsEntity1.QTYUNIT = "";//数量包装单位 + CwVouitemsEntity1.QTYDR = 0;//借方数量 + CwVouitemsEntity1.QTYCR = 0;//贷方数量 + CwVouitemsEntity1.EXPLAN = strEXPLAN;//摘要,规则生成 "转运费" + + CwVouitemsEntity1.DEPTID = strDEPTID;//部门(系统) + CwVouitemsEntity1.EMPLID = strEMPLID;//人员(系统) + CwVouitemsEntity1.SALE = strSALE;//人员名称 + CwVouitemsEntity1.PITEMID = 0;//父级项目编号 + CwVouitemsEntity1.ITEMID = "0";//项目编号 + CwVouitemsEntity1.FIELD1 = "";//预留字段1 + CwVouitemsEntity1.FIELD2 = "";//预留字段2 + CwVouitemsEntity1.FIELD3 = "";//预留字段3 + CwVouitemsEntity1.FIELD4 = "";//预留字段4 + CwVouitemsEntity1.FIELD5 = "";//预留字段5 + CwVouitemsEntity1.FIELD6 = "";//预留字段6 + CwVouitemsEntity1.FIELD7 = "";//预留字段7 + CwVouitemsEntity1.FIELD8 = "";//预留字段8 + CwVouitemsEntity1.FIELD9 = "";//预留字段9 + CwVouitemsEntity1.FIELD10 = "";//预留字段10 + if (ds.Tables[0].Rows[0]["ISVBM"].ToString().Trim() == "True") + { + CwVouitemsEntity1.ISSYS = false;//是否手动录入 + } + else + { + CwVouitemsEntity1.ISSYS = true;//是否手动录入 + } + CwVouitemsEntity1.FSETTLCODE = "";//结算方式 + CwVouitemsEntity1.FSETTLENO = "";//财务辅助编号 + CwVouitemsEntity1.MODIFIEDUSER = strUserID;//最后一次更新操作人 + CwVouitemsEntity1.BLNO = strBLNO;// + #endregion + CwVouitemsEntities.Add(CwVouitemsEntity1); } } - #endregion + } + #endregion - #region 插入主表 - string rq = strVOUDATE; - CwVouchersEntity CwVouchersEntity = new CwVouchersEntity(); - CwVouchersEntity.ORDNO = strORDNO.Trim();//唯一编码 newid() varchar (36) - CwVouchersEntity.VOUDATE = DateTime.Parse(rq.Trim());//凭证日期="";//datetime="";//  - CwVouchersEntity.ACCYEAR = rq.Trim().Substring(0, 4);//年="";//int="";//  - int iM1 = rq.Trim().IndexOf("-") + 1; - int iM2 = rq.Trim().LastIndexOf("-"); - CwVouchersEntity.ACCMONTH = rq.Trim().Substring(iM1, iM2 - iM1);//月="";//int="";//  - string strVOUNO = getVOUNO(rq.Trim().Substring(0, 4), rq.Trim().Substring(iM1, iM2 - iM1)); - CwVouchersEntity.VOUNO = strVOUNO;//月初清零 varchar (16) - if (iM2 - iM1 == 1) - { - strVOUNO = rq.Trim().Substring(0, 4) + "0" + rq.Trim().Substring(iM1, iM2 - iM1) + strVOUNO; - } - else - { - strVOUNO = rq.Trim().Substring(0, 4) + rq.Trim().Substring(iM1, iM2 - iM1) + strVOUNO; - } - CwVouchersEntity.VOUALLNO = ds.Tables[0].Rows[0]["TVW"].ToString().Trim()+strVOUNO;//月初清零 varchar (16) - CwVouchersEntity.VKNO = ds.Tables[0].Rows[0]["TVW"].ToString().Trim();//凭证字="";//varchar="";//(8) - CwVouchersEntity.ATTACHS = int.Parse(ds.Tables[0].Rows[0]["AFFIXNO"].ToString().Trim());//附件(单据)数="";//int="";//  - CwVouchersEntity.AMTDR = strJie;// iAMTDR;//本位币借方="";//numeric(18, 2)="";//  - CwVouchersEntity.AMTCR = strDai;//iAMTDR;// iAMTCR;//本位币贷方="";//numeric(18, 2)="";//  - CwVouchersEntity.FCY = "";//是否含有外币科目="";//varchar="";//(1) - CwVouchersEntity.QTY = "";//是否含有数量科目="";//varchar="";//(1) - CwVouchersEntity.VOUPROP = "";//凭证属性="";//varchar="";//(1) - //CwVouchersEntity.PREPARED = T_ALL_DA.GetStrSQL("FINANCESOFTCODE", "select top 1 FINANCESOFTCODE from user_baseinfo where USERID in (select top 1 gid from [user] where SHOWNAME='" + this.hd_comboPREPARED.Value.Trim() + "' and ISDELETED=0)");//制单人="";//varchar="";//(10) - CwVouchersEntity.PREPARED = strPREPARED;//制单人="";//varchar="";//(10) - CwVouchersEntity.CHECKED = "";//审核人="";//varchar="";//(10) - CwVouchersEntity.ENTERED = "";//记账人="";//varchar="";//(10) - CwVouchersEntity.ERRMSG = "";//错误信息="";//varchar="";//(6) - CwVouchersEntity.ISDELETE = false;//是否废除="";//bit="";//Y - CwVouchersEntity.DELETEUSER = "";//废除操作人="";//Varchar(36)="";//Y - //CwVouchersEntity.DELETETIME="";//废除时间="";//Datetime="";//Y - #endregion + #region 插入主表 + string rq = strVOUDATE; + CwVouchersEntity CwVouchersEntity = new CwVouchersEntity(); + CwVouchersEntity.ORDNO = strORDNO.Trim();//唯一编码 newid() varchar (36) + CwVouchersEntity.VOUDATE = DateTime.Parse(rq.Trim());//凭证日期="";//datetime="";//  + CwVouchersEntity.ACCYEAR = rq.Trim().Substring(0, 4);//年="";//int="";//  + int iM1 = rq.Trim().IndexOf("-") + 1; + int iM2 = rq.Trim().LastIndexOf("-"); + CwVouchersEntity.ACCMONTH = rq.Trim().Substring(iM1, iM2 - iM1);//月="";//int="";//  + string strVOUNO = getVOUNO(rq.Trim().Substring(0, 4), rq.Trim().Substring(iM1, iM2 - iM1)); + CwVouchersEntity.VOUNO = strVOUNO;//月初清零 varchar (16) + if (iM2 - iM1 == 1) + { + strVOUNO = rq.Trim().Substring(0, 4) + "0" + rq.Trim().Substring(iM1, iM2 - iM1) + strVOUNO; + } + else + { + strVOUNO = rq.Trim().Substring(0, 4) + rq.Trim().Substring(iM1, iM2 - iM1) + strVOUNO; + } + CwVouchersEntity.VOUALLNO = ds.Tables[0].Rows[0]["TVW"].ToString().Trim() + strVOUNO;//月初清零 varchar (16) + CwVouchersEntity.VKNO = ds.Tables[0].Rows[0]["TVW"].ToString().Trim();//凭证字="";//varchar="";//(8) + CwVouchersEntity.ATTACHS = int.Parse(ds.Tables[0].Rows[0]["AFFIXNO"].ToString().Trim());//附件(单据)数="";//int="";//  + CwVouchersEntity.AMTDR = strJie;// iAMTDR;//本位币借方="";//numeric(18, 2)="";//  + CwVouchersEntity.AMTCR = strDai;//iAMTDR;// iAMTCR;//本位币贷方="";//numeric(18, 2)="";//  + CwVouchersEntity.FCY = "";//是否含有外币科目="";//varchar="";//(1) + CwVouchersEntity.QTY = "";//是否含有数量科目="";//varchar="";//(1) + CwVouchersEntity.VOUPROP = "";//凭证属性="";//varchar="";//(1) + //CwVouchersEntity.PREPARED = T_ALL_DA.GetStrSQL("FINANCESOFTCODE", "select top 1 FINANCESOFTCODE from user_baseinfo where USERID in (select top 1 gid from [user] where SHOWNAME='" + this.hd_comboPREPARED.Value.Trim() + "' and ISDELETED=0)");//制单人="";//varchar="";//(10) + CwVouchersEntity.PREPARED = strPREPARED;//制单人="";//varchar="";//(10) + CwVouchersEntity.CHECKED = "";//审核人="";//varchar="";//(10) + CwVouchersEntity.ENTERED = "";//记账人="";//varchar="";//(10) + CwVouchersEntity.ERRMSG = "";//错误信息="";//varchar="";//(6) + CwVouchersEntity.ISDELETE = false;//是否废除="";//bit="";//Y + CwVouchersEntity.DELETEUSER = "";//废除操作人="";//Varchar(36)="";//Y + //CwVouchersEntity.DELETETIME="";//废除时间="";//Datetime="";//Y + #endregion - //生成入库 - string strSel = " and bsno in(" + sGids + ") " + strVESSEL; - if (CwVouitemsEntities.Count == 0) - { - iResult = 2; - } - else - iResult = CwVouchersDA.setInsertAll(CwVouchersEntity, CwVouitemsEntities,"v_op_bill", ds.Tables[0].Rows[0]["TVW"].ToString().Trim() + strVOUNO, strSel, strUserID, 1); + //生成入库 + string strSel = " and bsno in(" + sGids + ") " + strVESSEL; + if (CwVouitemsEntities.Count == 0) + { + iResult = 2; } - + else + iResult = CwVouchersDA.setInsertAll(CwVouchersEntity, CwVouitemsEntities, "v_op_bill", ds.Tables[0].Rows[0]["TVW"].ToString().Trim() + strVOUNO, strSel, strUserID, 1); + } + return iResult; } @@ -3869,6 +4487,7 @@ namespace DSWeb.Areas.Account.Controllers } return strVOUNO; } + [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 static public List GetVouDataList(string condition, string userid, string username, string companyid) { @@ -3923,11 +4542,12 @@ namespace DSWeb.Areas.Account.Controllers return SetFeeData(strSql); } + [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 - static public List GetFeeDataList(string strCondition,string userid,string username,string companyid,string type) + static public List GetFeeDataList(string strCondition, string userid, string username, string companyid, string type) { - var rangstr = GetRangDAStr("index", type, userid,username,companyid); + var rangstr = GetRangDAStr("index", type, userid, username, companyid); if (!string.IsNullOrEmpty(rangstr)) { @@ -3996,7 +4616,7 @@ namespace DSWeb.Areas.Account.Controllers strSql.Append(" where " + strCondition); } - strSql.Append(" order by BsNo"); + strSql.Append(" order by BsNo"); return SetFeeData(strSql); @@ -4031,9 +4651,10 @@ namespace DSWeb.Areas.Account.Controllers data.CUSTSERVICE = Convert.ToString(reader["CUSTSERVICE"]); data.DOC = Convert.ToString(reader["DOC"]); data.SALE = Convert.ToString(reader["SALE"]); - - data.BSSTATUS = Convert.ToBoolean(reader["BSSTATUS"]); - data.FEESTATUS = Convert.ToBoolean(reader["FEESTATUS"]); + if (reader["BSSTATUS"] != DBNull.Value) + data.BSSTATUS = Convert.ToBoolean(reader["BSSTATUS"]); + if (reader["FEESTATUS"] != DBNull.Value) + data.FEESTATUS = Convert.ToBoolean(reader["FEESTATUS"]); if (reader["ETDCLOSE"] != DBNull.Value) data.ETDCLOSE = Convert.ToBoolean(reader["ETDCLOSE"]); if (reader["DRCLOSE"] != DBNull.Value) @@ -4044,7 +4665,7 @@ namespace DSWeb.Areas.Account.Controllers data.DRCLOSEREF = Convert.ToString(reader["DRCLOSEREF"]); data.CRCLOSEREF = Convert.ToString(reader["CRCLOSEREF"]); if (reader["CLOSEETDDAY"] != DBNull.Value) - data.CLOSEETDDAY = Convert.ToDateTime(reader["CLOSEETDDAY"]).ToString("yyyy-MM-dd"); + data.CLOSEETDDAY = Convert.ToDateTime(reader["CLOSEETDDAY"]).ToString("yyyy-MM-dd"); #endregion headList.Add(data); @@ -4090,6 +4711,8 @@ namespace DSWeb.Areas.Account.Controllers } #region 判断是否允许费用全部解锁,并返回出错问题的委托单号 + [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 + public ContentResult isAllUnLock(string billsql, int type) { string sError = ""; @@ -4134,12 +4757,13 @@ namespace DSWeb.Areas.Account.Controllers sError = sError.Substring(1); sError = "已经生成总账凭证的数据不允许解锁费用,委托编号:" + sError + "!"; json = JsonConvert.Serialize(new { Success = false, Message = sError }); - } + } return new ContentResult() { Content = json }; } #endregion #region 判断是否允许费用选中解锁,并返回出错问题的委托单号 + public ContentResult isSelUnLock(string strGids) { string sError = ""; @@ -4148,12 +4772,13 @@ namespace DSWeb.Areas.Account.Controllers // if (!string.IsNullOrEmpty(strGids)) { - strGids = " and bsno in('" + strGids.Replace(",","','") + "')"; + strGids = " and bsno in('" + strGids.Replace(",", "','") + "')"; } var head = ChMonthCloseDAL.GetData("", Convert.ToString(Session["COMPANYID"])); + // - string sSQL = "SELECT * from v_op_bill as b where accdate<'"+head.PERIOD+"'" + strGids; + string sSQL = "SELECT * from v_op_bill as b where accdate<'" + head.PERIOD + "'" + strGids; DataSet ds = T_ALL_DA.GetAllSQL(sSQL); if (ds != null) { @@ -4183,24 +4808,25 @@ namespace DSWeb.Areas.Account.Controllers /// /// 1:费用解锁 2:业务解锁 3费用锁定 4业务锁定 /// - public ContentResult CheckAuthority (int autype) { + public ContentResult CheckAuthority(int autype) + { T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA(); var cookies = new Cookies(); var auid = "04B61245-C3A8-46D4-9FE4-746A805244B5";//费用解锁权限id - if (autype==2) + if (autype == 2) { auid = "04B61145-C3A8-46D4-9FE4-746A805244B5";//业务解锁权限id } - else if (autype==4) + else if (autype == 4) { auid = "04B61145-C3A8-46D4-9FE4-746A805244A1";//业务锁定权限id } - else if (autype==3) + else if (autype == 3) { auid = "04B61245-C3A8-46D4-9FE4-746A805244A2";//费用锁定权限id } var uid = cookies.getCookie(DSWeb.TruckMng.Comm.Cookie.CookieConstant.UserId);//登录组织 - string sSQL = "select * from user_action where USERID = '" + uid + "' AND ACTIONID ='"+auid+"'"; + string sSQL = "select * from user_action where USERID = '" + uid + "' AND ACTIONID ='" + auid + "'"; DataSet ds = T_ALL_DA.GetAllSQL(sSQL); int rstCnt = 0; if (ds != null) @@ -4208,7 +4834,7 @@ namespace DSWeb.Areas.Account.Controllers rstCnt = ds.Tables[0].Rows.Count; } var json = JsonConvert.Serialize(new { Success = true, Message = "有操作权限" }); - if (rstCnt<=0) + if (rstCnt <= 0) { json = JsonConvert.Serialize(new { Success = false, Message = "无操作权限" }); } @@ -4221,5 +4847,5 @@ namespace DSWeb.Areas.Account.Controllers } - + diff --git a/DSWeb/Areas/Account/Models/ChFee_do_Sum/BSNOLB.cs b/DSWeb/Areas/Account/Models/ChFee_do_Sum/BSNOLB.cs index c74d9abd..342089a3 100644 --- a/DSWeb/Areas/Account/Models/ChFee_do_Sum/BSNOLB.cs +++ b/DSWeb/Areas/Account/Models/ChFee_do_Sum/BSNOLB.cs @@ -41,6 +41,7 @@ namespace DSWeb.Areas.Account.Models.BSNOLB } public string ACCDATE { get; set; } + public string MASTERNO { get; set; } #endregion diff --git a/DSWeb/Areas/Account/Viewsjs/Chfee_lock/Chfee_lock.js b/DSWeb/Areas/Account/Viewsjs/Chfee_lock/Chfee_lock.js index 5c6a813f..e94f1f07 100644 --- a/DSWeb/Areas/Account/Viewsjs/Chfee_lock/Chfee_lock.js +++ b/DSWeb/Areas/Account/Viewsjs/Chfee_lock/Chfee_lock.js @@ -147,7 +147,8 @@ Ext.extend(Shipping.MsChfeelock, Ext.Panel, { { name: 'TTLINVDR', type: 'number' }, { name: 'TTLDUIDR', type: 'number' }, { name: 'PROFITRATE', type: 'string' }, - { name: 'BillFeeStatus', type: 'string' } + { name: 'BillFeeStatus', type: 'string' }, + { name: 'SUBMITSTATUS', type: 'string' } ], remoteSort: true, @@ -1042,6 +1043,11 @@ Ext.extend(Shipping.MsChfeelock, Ext.Panel, { dataIndex: 'PROFITRATE', header: '利润率', width: 80 + }, { + sortable: true, + dataIndex: 'SUBMITSTATUS', + header: '提交状态', + width: 70 } ]; @@ -1289,6 +1295,33 @@ Ext.extend(Shipping.MsChfeelock, Ext.Panel, { } }); + this.StoreSubmit = Ext.create('Ext.data.Store', { + fields: ['SUBMITSTATUS'] + }); + this.StoreSubmit.add({ "SUBMITSTATUS": "" }); + this.StoreSubmit.add({ "SUBMITSTATUS": "全部" }); + this.StoreSubmit.add({ "SUBMITSTATUS": "已提交" }); + this.StoreSubmit.add({ "SUBMITSTATUS": "未提交" }); + + this.comboxSubmit = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: '显示已提交', + store: this.StoreSubmit, + forceSelection: true, + // flex: 0.5, + //labelWidth: 60, + name: 'SUBMITSTATUS', + valueField: 'SUBMITSTATUS', + displayField: 'SUBMITSTATUS', + enableKeyEvents: true, + listeners: { + keyup: function (field, e) { + if (e.getKey() == e.ENTER) { + _this.onRefreshClick(); + } + } + } + }); + this.StoreIsVou = Ext.create('Ext.data.Store', { fields: ['OpLb'] @@ -1430,7 +1463,8 @@ Ext.extend(Shipping.MsChfeelock, Ext.Panel, { defaults: { anchor: '100%' }, - items: [{ + items: [ + { xtype: 'container', layout: 'hbox', defaultType: 'textfield', @@ -1485,7 +1519,9 @@ Ext.extend(Shipping.MsChfeelock, Ext.Panel, { , this.comboxOp, this.comboxBillFeeStatus, this.comboxFSTATUS ] - }, { + } + + , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', @@ -1517,7 +1553,9 @@ Ext.extend(Shipping.MsChfeelock, Ext.Panel, { } }, this.comboxOpLock, this.comboxFeeLock ] - }, { + } + + , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', @@ -1573,7 +1611,25 @@ Ext.extend(Shipping.MsChfeelock, Ext.Panel, { } }, this.comboxIsVou, this.comboxOPTYPE ] - } + } + + , { + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [this.comboxSubmit + , { xtype: "hiddenfield" } + , { xtype: "hiddenfield" } + , { xtype: "hiddenfield" } + , { xtype: "hiddenfield" } + , { xtype: "hiddenfield" } + , { xtype: "hiddenfield" } + ] + } + + + //comboxSubmit + ]//end items(fieldset 1) }//end fieldset 1 ]//end root items @@ -1623,6 +1679,22 @@ Ext.extend(Shipping.MsChfeelock, Ext.Panel, { this.onRefreshClick(button, event); }, scope: this + }, { + text: "业务提交", + id: "btnBsLockSubmit", + menu: [ + { + text: "所选业务提交", + handler: function (menu, event) { + _this.onSubmitLockClick(menu,1); + } + }, { + text: "所选业务撤回", + handler: function (menu, event) { + _this.onSubmitLockClick(menu,2); + } + }], + scope: this }, '-', { text: "生成凭证", id: "btnCreateVoucher", @@ -1988,7 +2060,7 @@ Ext.extend(Shipping.MsChfeelock, Ext.Panel, { this.panelSearch = new Ext.Panel({ layout: "border", region: "north", - height: 96, + height: 122, items: [this.formSearch] }); @@ -3225,6 +3297,85 @@ Ext.extend(Shipping.MsChfeelock, Ext.Panel, { }, + + onSubmitLockClick: function (menu, type) { + //1 提交 2撤回 + _this = this; + + var GidStr = ''; + var records = _this.GridCheckBoxModel.selected.items; + if (records.length == 0) { + Ext.Msg.show({ title: '提示', msg: '请先选择要提交的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + } + var bodyAddDatas = []; + for (var i = 0; i < records.length; i++) { + var rec = records[i]; + var Gid = rec.data.BSNO; + //var status = rec.data.BSSTATUS; + //if (type == 2) + // status = rec.data.BSSTATUS + //else status = rec.data.FEESTATUS + + //if (status != true) { + // bodyAddDatas.push(rec); + //} + if (GidStr != "") GidStr += ","; + + GidStr += "" + Gid + ""; + } + + //if (bodyAddDatas.length == 0) { + // Ext.Msg.show({ title: '提示', msg: '没有要锁定的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + // return; + + //} else { + + var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); + Ext.Ajax.request({ + waitMsg: '正在提交...', + url: '/Account/Chfee_lock/SubmitLock', + timeout: 120000, + params: { + BSNOS: GidStr, + type: type + }, + callback: function (options, success, response) { + if (success) { + var result = Ext.JSON.decode(response.responseText); + if (!result.Success) { + Ext.Msg.show({ + title: '提示', + msg: result.Message, + icon: Ext.MessageBox.ERROR, + buttons: Ext.Msg.OK + }); + return; + } else { + + //Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + MsgTip("提示", result.Message, 3000); + _this.onDsQuery(); + + } + + } else { + Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); + } + }, + scope: this + }); + //} + + + + + + + + }, + + onCreateVoucherSel: function () { var records = _this.GridCheckBoxModel.selected.items; @@ -3487,6 +3638,14 @@ Ext.extend(Shipping.MsChfeelock, Ext.Panel, { sql = sql + getAndConSql(sql, PS_ISVOU, " ISNULL(B.ISVOU,0)=0"); + var SUBMITSTATUS = form.findField('SUBMITSTATUS').getValue(); + if (SUBMITSTATUS == '已提交') + sql = sql + getAndConSql(sql, SUBMITSTATUS, " isnull(L.PROPVALUE,'')='已提交' "); + else if (SUBMITSTATUS == '未提交') + sql = sql + getAndConSql(sql, SUBMITSTATUS, " isnull(L.PROPVALUE,'')='' "); + + + var BillFeeStatus = form.findField('BillFeeStatus').getValue(); sql = sql + getAndConSql(sql, BillFeeStatus, "BillFeeStatus='" + BillFeeStatus + "'"); diff --git a/DSWeb/Areas/CommMng/Controllers/BasicDataRefController.cs b/DSWeb/Areas/CommMng/Controllers/BasicDataRefController.cs index cd4dab70..b0663a25 100644 --- a/DSWeb/Areas/CommMng/Controllers/BasicDataRefController.cs +++ b/DSWeb/Areas/CommMng/Controllers/BasicDataRefController.cs @@ -8,6 +8,7 @@ using DSWeb.Areas.RptMng.Comm; using DSWeb.Common.DB; using DSWeb.Dispatch.DAL; using DSWeb.EntityDA; +using DSWeb.MvcShipping.DAL.MsBaseInfoDAL; using DSWeb.MvcShipping.DAL.MsSysParamSet; using DSWeb.SoftMng.BLL; using DSWeb.SoftMng.Model; @@ -2427,5 +2428,82 @@ namespace DSWeb.Areas.CommMng.Controllers return BasicDataRefDAL.GetContentResult(result); } + #region 逻辑信息值 + public JsonResult GetLogicInfo(string BSNO, string PROPNAME) + { + + var dic = BasicDataRefDAL.GetLogicInfo(BSNO, PROPNAME); + if (dic.Count == 0) + { + return Json(new { Success = false }); + } + else + { + return Json(new { Success = true, Data = dic }); + } + } + + public JsonResult GetLogicInfoList(string BSNOListStr, string PROPNAME) + { + + var DataList = BasicDataRefDAL.GetLogicInfoList(BSNOListStr, PROPNAME); + if (DataList.Count == 0) + { + return Json(new { Success = false }); + } + else + { + return Json(new { Success = true, Data = DataList }); + } + } + + + public JsonResult SetLogicInfo(string BSNO, string PROPNAME, string NAME, string VALUE) + { + Dictionary dic = new Dictionary(); + dic.Add(NAME, VALUE); + + try + { + BasicDataRefDAL.SaveLogicInfo(BSNO, PROPNAME, dic); + return Json(new { success = true }); + } + catch (Exception e) + { + return Json(new { success = false, data = e.Message }); + } + } + + public JsonResult SaveLogicSingleValue(string BSNO, string PROPNAME, string VALUE) + { + try + { + BasicDataRefDAL.SaveLogicSingleInfo(BSNO, PROPNAME, VALUE); + return Json(new { success = true }); + } + catch (Exception e) + { + return Json(new { success = false, data = e.Message }); + } + } + public JsonResult GetLogicSingleValue(string BSNO, string PROPNAME) + { + var result = BasicDataRefDAL.GetLogicSingleInfo(BSNO, PROPNAME); + + return Json(new { Success = true, Data = result }); + } + #endregion + + public ContentResult GetUserModuleEnable(string modename) + { + var _r = MsBaseInfoDAL.GetUserModuleEnable(modename, Convert.ToString(Session["USERID"])); + + var result = new DBResult(); + + if (_r == true) result.OK(); + if (_r == false) result.SetErrorInfo("无此权限"); + + return BasicDataRefDAL.GetContentResult(result); + } } } diff --git a/DSWeb/Areas/CommMng/DAL/BasicDataRefDAL.cs b/DSWeb/Areas/CommMng/DAL/BasicDataRefDAL.cs index afb58b40..2807f30c 100644 --- a/DSWeb/Areas/CommMng/DAL/BasicDataRefDAL.cs +++ b/DSWeb/Areas/CommMng/DAL/BasicDataRefDAL.cs @@ -4965,6 +4965,7 @@ namespace DSWeb.Areas.CommMng.DAL } #endregion + #region 逻辑信息子表操作 #region 将一个dictionary转化为用;;和::隔开的文本 @@ -5023,6 +5024,17 @@ namespace DSWeb.Areas.CommMng.DAL return result; } + public static List GetLogicInfoList(string BSNOListStr, string PROPNAME) + { + + Common.DB.CommonDataContext cdc = new Common.DB.CommonDataContext(); + + List BSNOList = BSNOListStr.Split(',').ToList(); + + var infoList = cdc.OP_LOGICINFO.Where(x => BSNOList.Contains(x.BSNO) && x.PROPNAME == PROPNAME).ToList(); + + return infoList; + } public static void SaveLogicInfo(string BSNO, string PROPNAME, Dictionary InfoDic = null) { @@ -5052,6 +5064,42 @@ namespace DSWeb.Areas.CommMng.DAL } } + public static void SaveLogicInfo(string BSNO, string PROPNAME, string NAME, string VALUE) + { + + var dic = new Dictionary(); + dic.Add(NAME, VALUE); + SaveLogicInfo(BSNO, PROPNAME, dic); + } + + public static void SaveLogicSingleInfo(string BSNO, string PROPNAME, string VALUE) + { + CommonDataContext cdc = new CommonDataContext(); + + var result = new Dictionary(); + + var infoList = cdc.OP_LOGICINFO.Where(x => x.BSNO == BSNO && x.PROPNAME == PROPNAME).ToList(); + + if (infoList != null && infoList.Count > 0) + { + + var updrec = infoList[0]; + updrec.PROPVALUE = VALUE; + cdc.OP_LOGICINFO.AddOrUpdate(updrec); + cdc.SaveChanges(); + } + else + { + var newinfo = new OP_LOGICINFO_md(); + newinfo.GID = Guid.NewGuid(); + newinfo.BSNO = BSNO; + newinfo.PROPNAME = PROPNAME; + newinfo.PROPVALUE = VALUE; + cdc.OP_LOGICINFO.Add(newinfo); + cdc.SaveChanges(); + } + } + public static Dictionary GetLogicHaveValue(string PROPNAME, string fieldname, string fieldvalue) { @@ -5063,9 +5111,11 @@ namespace DSWeb.Areas.CommMng.DAL if (infoList != null && infoList.Count > 0) { - foreach (var item in infoList) { + foreach (var item in infoList) + { var lv = StrToDic(infoList[0].PROPVALUE); - if (lv[fieldname] == fieldvalue) { + if (lv[fieldname] == fieldvalue) + { result = lv; result.Add("BSNO", item.BSNO); return result; @@ -5098,8 +5148,52 @@ namespace DSWeb.Areas.CommMng.DAL return result; } + public static string GetLogicSingleInfo(string BSNO, string PROPNAME) + { + + CommonDataContext cdc = new CommonDataContext(); + + var result = ""; + + var infoList = cdc.OP_LOGICINFO.Where(x => x.BSNO == BSNO && x.PROPNAME == PROPNAME).ToList(); + + if (infoList != null && infoList.Count > 0) + { + result = infoList[0].PROPVALUE; + } + + return result; + } - public static void SaveLogicDicInfo(string BSNO, string PROPNAME, Dictionary paramdic ,string savevalue) + /// + /// 某模块 的fieldname字段取value值时 ,另一个recfield字段取recvalue值 + /// 用于存储逻辑上关联的字段的最近一次取值 + /// 例如:op_other(陆运模块) customername='往来单位A' 时: transtype运输类型='海运进口' + /// + /// + /// + /// + /// + public static void 存储模块字段值最近对应取值(string formname, string fieldname, string value, string recfield, string recvalue) + { + var dic = new Dictionary(); + dic.Add("fieldname", fieldname); + dic.Add("fieldvalue", value); + dic.Add("recfield", recfield); + //dic.Add("recvalue", recvalue); + SaveLogicDicInfo("模块字段值最近取值", formname, dic, recvalue); + } + + public static string 获取模块字段值最近取值(string formname, string fieldname, string value, string recfield) + { + var dic = new Dictionary(); + dic.Add("fieldname", fieldname); + dic.Add("fieldvalue", value); + dic.Add("recfield", recfield); + return GetLogicDicValue(formname, "模块字段值最近取值", dic, "recvalue"); + } + + public static void SaveLogicDicInfo(string BSNO, string PROPNAME, Dictionary paramdic, string savevalue) { CommonDataContext cdc = new CommonDataContext(); @@ -5153,7 +5247,7 @@ namespace DSWeb.Areas.CommMng.DAL if (值匹配) { - + } else { @@ -5175,14 +5269,14 @@ namespace DSWeb.Areas.CommMng.DAL } - public static string GetLogicDicValue(string PROPNAME, string bsno, Dictionary paramdic,string fieldname) + public static string GetLogicDicValue(string PROPNAME, string bsno, Dictionary paramdic, string fieldname) { CommonDataContext cdc = new CommonDataContext(); var result = ""; - var infoList = cdc.OP_LOGICINFO.Where(x =>x.BSNO==bsno && x.PROPNAME == PROPNAME ).ToList(); + var infoList = cdc.OP_LOGICINFO.Where(x => x.BSNO == bsno && x.PROPNAME == PROPNAME).ToList(); var resultdic = new List>(); @@ -5193,7 +5287,8 @@ namespace DSWeb.Areas.CommMng.DAL var lv = StrToDic(item.PROPVALUE); var 值匹配 = true; - foreach (var ParamDicItem in paramdic) { + foreach (var ParamDicItem in paramdic) + { if (lv.ContainsKey(ParamDicItem.Key)) { if (lv[ParamDicItem.Key] == ParamDicItem.Value) @@ -5205,49 +5300,23 @@ namespace DSWeb.Areas.CommMng.DAL 值匹配 = false; } } - else { + else + { 值匹配 = false; } } - if(值匹配) + if (值匹配) resultdic.Add(lv); } } - if (resultdic.Count > 0) { + if (resultdic.Count > 0) + { result = resultdic[0][fieldname]; } return result; } - - /// - /// 某模块 的fieldname字段取value值时 ,另一个recfield字段取recvalue值 - /// 用于存储逻辑上关联的字段的最近一次取值 - /// 例如:op_other(陆运模块) customername='往来单位A' 时: transtype运输类型='海运进口' - /// - /// - /// - /// - /// - public static void 存储模块字段值最近对应取值(string formname, string fieldname, string value, string recfield, string recvalue) - { - var dic = new Dictionary(); - dic.Add("fieldname", fieldname); - dic.Add("fieldvalue", value); - dic.Add("recfield", recfield); - //dic.Add("recvalue", recvalue); - SaveLogicDicInfo("模块字段值最近取值", formname, dic, recvalue); - } - - public static string 获取模块字段值最近取值(string formname, string fieldname, string value, string recfield) - { - var dic = new Dictionary(); - dic.Add("fieldname", fieldname); - dic.Add("fieldvalue", value); - dic.Add("recfield", recfield); - return GetLogicDicValue(formname, "模块字段值最近取值", dic, "recvalue"); - } #endregion #region SaveLog diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/Comm/DsComm.js b/DSWeb/Areas/MvcShipping/Viewsjs/Comm/DsComm.js index 628dcf33..83aaa85a 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/Comm/DsComm.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/Comm/DsComm.js @@ -1557,4 +1557,57 @@ GetRecentFormFieldValue = function (formfielditem, formname, fieldname, value, }); } -//#endregion \ No newline at end of file +//#endregion + + +SaveLogic = function (BSNO, PROPNAME, NAME, VALUE) { + Ext.Ajax.request({ + url: '/CommMng/BasicDataRef/SetLogicInfo', + cors: true, + params: { + BSNO: BSNO,//值 + PROPNAME: PROPNAME, + NAME: NAME, + VALUE: VALUE + }, + + //method: 'post', + success: function (response) { + var resultData = eval('(' + response.responseText + ')');//JSON字符串=>JSON对象 + if (!resultData.success) { + //失败 + alert(resultData); + } + else { + alert(resultData); + } + + } + }); +} + + +SaveLogicSingle = function (BSNO, PROPNAME, VALUE) { + Ext.Ajax.request({ + url: '/CommMng/BasicDataRef/SaveLogicSingleValue', + cors: true, + params: { + BSNO: BSNO,//值 + PROPNAME: PROPNAME, + VALUE: VALUE + }, + + //method: 'post', + success: function (response) { + var resultData = eval('(' + response.responseText + ')');//JSON字符串=>JSON对象 + if (!resultData.success) { + //失败 + alert(resultData); + } + else { + alert(resultData); + } + + } + }); +} diff --git a/DSWeb/Areas/RptMng/Comm/RptHelper.cs b/DSWeb/Areas/RptMng/Comm/RptHelper.cs index 3a2a4768..3fc651a9 100644 --- a/DSWeb/Areas/RptMng/Comm/RptHelper.cs +++ b/DSWeb/Areas/RptMng/Comm/RptHelper.cs @@ -24,7 +24,7 @@ namespace DSWeb.Areas.RptMng.Comm return GetRptJsonResult(0, 0, dbRptResult, tableName, false); } - public static string GetRptJsonResult(int start, int limit, DBDataSetResult dbRptResult, string tableName, bool page,DatasetSort datasetsort=null,string filterstr="") + public static string GetRptJsonResult(int start, int limit, DBDataSetResult dbRptResult, string tableName, bool page,DatasetSort datasetsort=null,string filterstr="",int totalcount=0) { var json = string.Empty; List> jsonSetData = null; @@ -54,14 +54,28 @@ namespace DSWeb.Areas.RptMng.Comm { listjson = jsonSetData.AsEnumerable(); } - - json = JsonConvert.Serialize(new { success = dbRptResult.Success, message = dbRptResult.Message, totalCount = jsonSetData.Count, data = listjson.ToArray() }); + + var _count = jsonSetData.Count; + + if (totalcount > 0) { + _count= totalcount; + } + + + json = JsonConvert.Serialize(new { success = dbRptResult.Success, message = dbRptResult.Message, totalCount = _count, data = listjson.ToArray() }); } else { jsonSetData = new List>(); - - json = JsonConvert.Serialize(new { success = dbRptResult.Success, message = dbRptResult.Message, totalCount = jsonSetData.Count, data = jsonSetData.ToArray() }); + + var _count = jsonSetData.Count; + + if (totalcount > 0) + { + _count = totalcount; + } + + json = JsonConvert.Serialize(new { success = dbRptResult.Success, message = dbRptResult.Message, totalCount = _count, data = jsonSetData.ToArray() }); } return json; diff --git a/DSWeb/Areas/TruckMng/Controllers/MsWlTruckController.cs b/DSWeb/Areas/TruckMng/Controllers/MsWlTruckController.cs index 6752499b..36b468aa 100644 --- a/DSWeb/Areas/TruckMng/Controllers/MsWlTruckController.cs +++ b/DSWeb/Areas/TruckMng/Controllers/MsWlTruckController.cs @@ -15,6 +15,7 @@ using System.Web; using System.IO; using System.Globalization; using System.Web.Script.Serialization; +using DSWeb.Areas.CommMng.DAL; namespace DSWeb.Areas.TruckMng.Controllers { @@ -200,6 +201,17 @@ namespace DSWeb.Areas.TruckMng.Controllers var imgFile = Request.Files["file"]; var truckNo = Request.Form["TruckNo"].ToString().Trim(); var Cert_Type = Request.Form["Cert_Type"].ToString().Trim(); + + string name = Request.Files[0].FileName; + string ext = Path.GetExtension(name).ToLower(); + string[] allowExt = new string[] { ".jpg", ".jpeg", ".png", ".gif", ".bmp", ".pdf" }; + if (!allowExt.Contains(ext)) + { + var result = new DBResult(); + result.SetErrorInfo("不允许上传此类文件"); + return BasicDataRefDAL.GetContentResult(result); + } + String strPath = "/Areas/TruckMng/CertImages/"+truckNo+"/"; String dirPath = System.Web.HttpContext.Current.Server.MapPath(strPath); if (!Directory.Exists(dirPath)) diff --git a/Job_DSWMS_REPORT/Job_DSWMS_REPORT_1.cs b/Job_DSWMS_REPORT/Job_DSWMS_REPORT_1.cs index 9801f26a..a2d346dc 100644 --- a/Job_DSWMS_REPORT/Job_DSWMS_REPORT_1.cs +++ b/Job_DSWMS_REPORT/Job_DSWMS_REPORT_1.cs @@ -222,9 +222,10 @@ namespace Job_DSWMS_REPORT private string USERCODE = ""; private string PWD = ""; private string SERVERUrl = ""; - private string SERVERPORTUrl = ""; + //private string SERVERPORTUrl = ""; private string SERVERPORTUrl2 = ""; private string FilePath = ""; + private string DAYS = "-1"; public void Execute(IJobExecutionContext context) { @@ -240,9 +241,7 @@ namespace Job_DSWMS_REPORT SERVERPORTUrl2 = context.JobDetail.JobDataMap.GetString("SERVERPORTUrl2"); - //1:调用URL指定的接口 得到返回数据 取得其中的文件名 - - //2:从URL+文件名中取得文件,保存至指定文件夹 + DAYS = context.JobDetail.JobDataMap.GetString("DAYS"); try { @@ -265,20 +264,20 @@ namespace Job_DSWMS_REPORT } - private string getFileName() - { - string strBuff = ""; + //private string getFileName() + //{ + // string strBuff = ""; - var url = SERVERPORTUrl + "?USERCODE=" + USERCODE + "&PWD=" + PWD; + // var url = SERVERPORTUrl + "?USERCODE=" + USERCODE + "&PWD=" + PWD; - var rtn = DoGet(url); + // var rtn = DoGet(url); - //"{\"status\":true,\"code\":null,\"message\":\"\",\"data\":\"Upload/FLJG/2021_07_06_YLDY_StockApply.FLJGRX\"}" + // //"{\"status\":true,\"code\":null,\"message\":\"\",\"data\":\"Upload/FLJG/2021_07_06_YLDY_StockApply.FLJGRX\"}" - var jsonObj = JsonConvert.DeserializeObject(rtn); + // var jsonObj = JsonConvert.DeserializeObject(rtn); - return jsonObj.data; - } + // return jsonObj.data; + //} public static string DoPost(string url, string json, int timeout = 10000) { @@ -372,7 +371,7 @@ namespace Job_DSWMS_REPORT { string strBuff = ""; - var url = SERVERPORTUrl2 + "?USERCODE=" + USERCODE + "&PWD=" + PWD; + var url = SERVERPORTUrl2 + "?USERCODE=" + USERCODE + "&PWD=" + PWD + "&DAYS=" + DAYS; var rtn = DoGet(url); diff --git a/Job_DSWMS_REPORT/bin/Debug/quartz_jobs.xml b/Job_DSWMS_REPORT/bin/Debug/quartz_jobs.xml index 6e5fd964..14366928 100644 --- a/Job_DSWMS_REPORT/bin/Debug/quartz_jobs.xml +++ b/Job_DSWMS_REPORT/bin/Debug/quartz_jobs.xml @@ -1,61 +1,124 @@  - - true - - - - - - Job_DSWMS_REPORT_1 - Job_DSWMS_REPORT_1 - DSWMS分公司定时上报库存 - Job_DSWMS_REPORT.Job_DSWMS_REPORT_1,Job_DSWMS_REPORT - true - false - - - SERVERUrl - http://123.234.180.6/:9991/ - - - SERVERPORTUrl - http://123.234.180.6/:9991/api/VW_OP_WMS_AREAGOODS/GetWMSXML - - - - USERCODE - fxq - - - - PWD - 123456 - - - - FilePath - C:\FTP - - - - - - - - - TriggerJob_DSWMS_REPORT - Job_DSWMS_REPORT_1 - 报文下载解析 - Job_DSWMS_REPORT_1 - Job_DSWMS_REPORT_1 - 1 - 3000 - - - - - - - + + true + + + + + + Job_DSWMS_REPORT_1 + Job_DSWMS_REPORT_1 + DSWMS分公司定时上报库存 + Job_DSWMS_REPORT.Job_DSWMS_REPORT_1,Job_DSWMS_REPORT + true + false + + + SERVERUrl + http://127.0.0.1:9991/ + + + SERVERPORTUrl + http://127.0.0.1:9991/api/VW_OP_WMS_AREAGOODS/GetWMSXML + + + SERVERPORTUrl2 + http://127.0.0.1:9991/api/VW_OP_WMS_AREAGOODS/SetDailyWmsFeeCalandar + + + USERCODE + fxq + + + + PWD + 123456 + + + + FilePath + C:\FTP + + + DAYS + -1 + + + + + + + + TriggerJob_DSWMS_REPORT + Job_DSWMS_REPORT_1 + 报文下载解析 + Job_DSWMS_REPORT_1 + Job_DSWMS_REPORT_1 + 1 + 3000 + + + + + + Job_DSWMS_SaveDailyAmount + Job_DSWMS_SaveDailyAmount + DSWMS定时触发库存和仓储费计算 + Job_DSWMS_REPORT.Job_DSWMS_SaveDailyAmount,Job_DSWMS_REPORT + true + false + + + SERVERUrl + http://127.0.0.1:9991/ + + + SERVERPORTUrl + http://127.0.0.1:9991/api/VW_OP_WMS_AREAGOODS/GetWMSXML + + + SERVERPORTUrl2 + http://127.0.0.1:9991/api/VW_OP_WMS_AREAGOODS/SetDailyWmsFeeCalandar + + + USERCODE + admin + + + + PWD + 123456 + + + + + + + + + + + TriggerDSWMS_SaveDailyAmount + Job_DSWMS_SaveDailyAmount + DSWMS定时触发库存和仓储费计算 + Job_DSWMS_SaveDailyAmount + Job_DSWMS_SaveDailyAmount + 0 35 0 * * ? + + + + + + \ No newline at end of file diff --git a/Job_DSWMS_REPORT/quartz_jobs.xml b/Job_DSWMS_REPORT/quartz_jobs.xml index ac3e81eb..14366928 100644 --- a/Job_DSWMS_REPORT/quartz_jobs.xml +++ b/Job_DSWMS_REPORT/quartz_jobs.xml @@ -40,7 +40,10 @@ FilePath C:\FTP - + + DAYS + -1 +