From 0f2bdefca1bcfada65aafe33234e5e4d69522ce7 Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期三, 25 九月 2024 09:45:12 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs | 208 +++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 148 insertions(+), 60 deletions(-) diff --git a/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs b/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs index 53ab7da..5e7fab5 100644 --- a/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs +++ b/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs @@ -25,6 +25,17 @@ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; + public class ClsYS_ReceiveOtherBillSubs + { + + public Int64 HProjectMoneyIDSub;// int //璐圭敤椤圭洰 + public string HTypeSub;// varchar(20) --鍙戠エ绫诲瀷 + public double HMoneySub;// dec(18,8) //鍗曟嵁閲戦 + public double HTaxRateSub;// dec(18,8) //绋庣巼 + public double HSumMoneySub;// dec(18,8) //鎬婚噾棰� + } + + #region 鍏朵粬搴旀敹鍗曞垪琛� 鏌ヨ /// <summary> /// 杩斿洖椤圭洰闃舵鍒楄〃 @@ -93,9 +104,10 @@ var _value = msg["msg"].ToString(); string msg1 = _value.ToString(); string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); - string msg2 = sArray[0].ToString(); //琛ㄥご鏁版嵁 - string refSav = sArray[1].ToString(); //鎿嶄綔鏂瑰紡 - string msg4 = sArray[2].ToString(); //鐢ㄦ埛 + string msg2 = sArray[0].ToString(); + string msg3 = sArray[1].ToString(); //瀛愯〃 + string refSav = sArray[2].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗 + string msg4 = sArray[3].ToString();//鐢ㄦ埛鍚� DBUtility.ClsPub.CurUserName = msg4; @@ -187,6 +199,36 @@ } oBill.omodel = oItem; } + // 琛ㄤ綋鏁版嵁 + //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆� + msg3 = msg3.Substring(1, msg3.Length - 2); + msg3 = msg3.Replace("\\", ""); + msg3 = msg3.Replace("\n", ""); //\n + List<Model.ClsYS_ReceiveOtherBillSub> ls = new List<Model.ClsYS_ReceiveOtherBillSub>(); + ls = oListModels.getObjectByJson_YS_ReceiveOtherBillSub(msg3); + int i = 0; + foreach (Model.ClsYS_ReceiveOtherBillSub oItemSub in ls) + { + i++; + oItemSub.HEntryID = i; + + + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + + oBill.DetailColl.Add(oItemSub); + + } + + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } //淇濆瓨 //淇濆瓨瀹屾瘯鍚庡鐞� @@ -239,7 +281,11 @@ { try { - ds = oCN.RunProcReturn("select * from h_v_YS_ReceiveOtherBillMainList where hmainid=" + HInterID, "h_v_YS_ReceiveOtherBillMainList"); + List<DataTable> tableList = new List<DataTable>(); + + ds = oCN.RunProcReturn("exec h_p_YS_ReceiveOtherBillMain_Edit " + HInterID, "h_p_YS_ReceiveOtherBillMain_Edit"); + tableList.Add(ds.Tables[0]); + tableList.Add(ds.Tables[1]); if (ds == null || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; @@ -253,7 +299,7 @@ objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess锛�"; - objJsonResult.data = ds.Tables[0]; + objJsonResult.data = tableList; return objJsonResult; } } @@ -308,7 +354,7 @@ objJsonResult.data = 1; return objJsonResult; } - //鍒ゆ柇鏄惁鍙紪杈� + //鍒ゆ柇鏄惁鍙垹闄� if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null) { objJsonResult.code = "0"; @@ -317,68 +363,89 @@ objJsonResult.data = 1; return objJsonResult; } - - //鍒犻櫎鍓嶆帶鍒�========================================= - string sql1 = "exec h_p_YS_ReceiveOtherBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; - ds = oCN.RunProcReturn(sql1, "h_p_YS_ReceiveOtherBill_BeforeDelCtrl"); - if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + //鍒ゆ柇鏄惁鏄垱寤虹姸鎬佽繘琛屽垹闄� + if (int.Parse(BillOld.omodel.HBillStatus.ToString()) <= 1) { - objJsonResult.code = "0"; + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } + + //鍒犻櫎鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_YS_ReceiveOtherBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_YS_ReceiveOtherBill_BeforeDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //================================================================================== + + + + oCN.BeginTran(); + + oCN.RunProc("delete from YS_ReceiveOtherBillMain where HInterID = " + HInterID); + oCN.RunProc("delete from YS_ReceiveOtherBillSub where HInterID= " + HInterID); + + //鍒犻櫎鍚庢帶鍒�================================================================================== + string sql2 = "exec h_p_YS_ReceiveOtherBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_YS_ReceiveOtherBill_AfterDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + s = "鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + s = ds.Tables[0].Rows[0]["HRemark"].ToString(); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //============================================================================================== + + oCN.Commit(); + + objJsonResult.code = "1"; objJsonResult.count = 1; - objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.Message = "鍒犻櫎鎴愬姛"; objJsonResult.data = null; return objJsonResult; } - - if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + else { objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; - objJsonResult.data = null; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹笉鏄垱寤虹姸鎬侊紝涓嶅厑璁稿垹闄わ紒"; + objJsonResult.data = 1; return objJsonResult; } - //================================================================================== - - - - oCN.BeginTran(); - - oCN.RunProc("delete from YS_ReceiveOtherBillMain where HInterID = " + HInterID); - oCN.RunProc("delete from YS_ReceiveOtherBillSub where HInterID= " + HInterID); - - //鍒犻櫎鍚庢帶鍒�================================================================================== - string sql2 = "exec h_p_YS_ReceiveOtherBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; - ds = oCN.RunProcReturn(sql2, "h_p_YS_ReceiveOtherBill_AfterDelCtrl"); - if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) - { - s = "鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s; - objJsonResult.data = null; - oCN.RollBack(); - return objJsonResult; - } - if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") - { - s = ds.Tables[0].Rows[0]["HRemark"].ToString(); - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s; - objJsonResult.data = null; - oCN.RollBack(); - return objJsonResult; - } - //============================================================================================== - - oCN.Commit(); - - objJsonResult.code = "1"; - objJsonResult.count = 1; - objJsonResult.Message = "鍒犻櫎鎴愬姛"; - objJsonResult.data = null; - return objJsonResult; } catch (Exception e) { @@ -486,6 +553,17 @@ //杩涜闇�瑕佽繘琛岀殑瀹℃牳/鍙嶅鏍告搷浣� if (IsAudit == 0) //瀹℃牳鎻愪氦 { + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + string s = ""; + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } + oCN.BeginTran(); //璁板綍杩斿洖淇℃伅 @@ -550,7 +628,17 @@ } if (IsAudit == 1) //鍙嶅鏍告彁浜� { - + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + string s = ""; + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } + //鍙嶅鏍稿墠鎺у埗========================================= string sql1 = "exec h_p_YS_ReceiveOtherBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; ds = oCN.RunProcReturn(sql1, "h_p_YS_ReceiveOtherBill_BeforeUnCheckCtrl"); -- Gitblit v1.9.1