From ce376f4060560f729dcd3820b31b202253828264 Mon Sep 17 00:00:00 2001 From: zrg <z18737863051@163.com> Date: 星期三, 15 五月 2024 17:29:02 +0800 Subject: [PATCH] 采购管理 全部模块, 销售管理一半模块 增加 单据保存时、审核时、反审核时、删除时 ,进行 会计期间 结账 的判断和控制 --- WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs | 743 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 732 insertions(+), 11 deletions(-) diff --git a/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs b/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs index a078e77..4c3302f 100644 --- a/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs +++ b/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs @@ -87,12 +87,12 @@ if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("select * from h_v_IF_SeOrderBillList order by hmainid desc", "h_v_IF_SeOrderBillList"); + ds = oCN.RunProcReturn("select * from h_v_IF_SeOrderBillList order by hmainid desc,hsubid asc", "h_v_IF_SeOrderBillList"); } else { string sql1 = "select * from h_v_IF_SeOrderBillList where 1 = 1 "; - string sql = sql1 + sWhere+ " order by hmainid desc"; + string sql = sql1 + sWhere+ " order by hmainid desc,hsubid asc"; ds = oCN.RunProcReturn(sql, "h_v_IF_SeOrderBillList"); } @@ -1153,10 +1153,22 @@ objJsonResult.data = 1; return objJsonResult; } + + string sql = "select count(*) Xs_ExceptiveCheckRequestBillCount from Xs_ExceptiveCheckRequestBillMain where HMainSourceInterID = " + BillOld.omodel.HInterID; + ds = oCN.RunProcReturn(sql, "Xs_ExceptiveCheckRequestBillMain"); + if (ds != null && Int64.Parse(ds.Tables[0].Rows[0]["Xs_ExceptiveCheckRequestBillCount"].ToString()) > 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛屽崟鎹瓨鍦ㄤ笅娓稿崟鎹甗鐗规壒鐢宠鍗昡锛�"; + objJsonResult.data = 1; + return objJsonResult; + } } UserName = oItem.HMaker; //鍒跺崟浜� oItem.HBillType = "1401"; - oItem.HBillSubType = "1401"; + //oItem.HBillSubType = "1401"; + oItem.HSALEORGID = oItem.HOrgID; oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); @@ -1197,9 +1209,23 @@ //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 //oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 - oBill.DetailColl.Add(oItemSub); + if (oItemSub.HMaterID != 0) + { + 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; + } + //淇濆瓨 //淇濆瓨瀹屾瘯鍚庡鐞� bool bResult; @@ -1253,7 +1279,7 @@ try { - ds = oCN.RunProcReturn("select * from h_v_IF_SeOrderBillList where hmainid =" + HInterID, "h_v_IF_SeOrderBillList"); + ds = oCN.RunProcReturn("select * from h_v_IF_SeOrderBillList where hmainid =" + HInterID + " order by hsubid asc", "h_v_IF_SeOrderBillList"); if (ds == null || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; @@ -1328,22 +1354,80 @@ return objJsonResult; } + //鍒犻櫎鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_Xs_SeOrderBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Xs_SeOrderBill_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; + } + //================================================================================== + + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + 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(); oCN.RunProc("delete from Xs_SeOrderBillMain where HInterID = " + HInterID); oCN.RunProc("delete from Xs_SeOrderBillSub where HInterID='" + HInterID + "'"); + //鍒犻櫎鍚庢帶鍒�================================================================================== + string sql2 = "exec h_p_Xs_SeOrderBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_Xs_SeOrderBill_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 = "Sucess锛�"; + objJsonResult.Message = "鎮ㄥ凡鍒犻櫎鍗曟嵁鍙蜂负" + BillOld.omodel.HBillNo + "鐨勯攢鍞鍗曪紒"; objJsonResult.data = null; return objJsonResult; } catch (Exception e) { + oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception锛�" + e.ToString(); @@ -1432,6 +1516,18 @@ objJsonResult.data = null; return objJsonResult; } + + foreach(Model.ClsXs_SeOrderBillSub oSub in oBill.DetailColl) + { + if (oSub.HCloseMan != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓瓨鍦ㄨ鍏抽棴鐨勮褰�!鍙嶅鏍稿け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + } } } else @@ -1447,8 +1543,51 @@ //杩涜闇�瑕佽繘琛岀殑瀹℃牳/鍙嶅鏍告搷浣� if (IsAudit == 0) //瀹℃牳鎻愪氦 { + ds = oCN.RunProcReturn("exec h_p_Kf_CheckSeOrderBill_CrediControl " + oBill.omodel.HInterID, "h_p_Kf_CheckSeOrderBill_CrediControl"); + if(ds.Tables[0].Rows[0]["HBack"].ToString() == "1") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); + objJsonResult.data = null; + return objJsonResult; + } + + //瀹℃牳鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_Xs_SeOrderBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Xs_SeOrderBill_BeforeCheckCtrl"); + 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; + } + //================================================================================== + + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + 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; + } + //瀹℃牳鎻愪氦 - if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Xs_SeOrderBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; @@ -1467,8 +1606,39 @@ } if (IsAudit == 1) //鍙嶅鏍告彁浜� { + //鍙嶅鏍稿墠鎺у埗========================================= + DataSet ds = oCN.RunProcReturn("Exec h_p_Xs_SeOrderBill_BeforeAbandonCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'", "h_p_Xs_SeOrderBill_BeforeAbandonCheckCtrl"); + if (ds == null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + "鍙嶅鏍稿墠鍒ゆ柇澶辫触锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + //========================================================= + + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + 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; + } + //鍙嶅鏍告彁浜bandonCheck - if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Xs_SeOrderBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; @@ -1511,6 +1681,7 @@ { string ModRightNameCheck = "Xs_SeOrderBill_Close"; DBUtility.ClsPub.CurUserName = CurUserName; + string sql = ""; try { //妫�鏌ユ潈闄� @@ -1577,6 +1748,18 @@ objJsonResult.data = null; return objJsonResult; } + + //鍒ゆ柇鍗曟嵁鏄惁涓鸿嚜鍔ㄥ叧闂� + sql = "select * from Xs_SeOrderBillMain where HInterID = " + HInterID; + ds = oCN.RunProcReturn(sql, "Xs_SeOrderBillMain"); + if (ds.Tables[0].Rows[0]["HCloseType"].ToString() == "False") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙嶅叧闂け璐�!鍗曟嵁涓鸿嚜鍔ㄥ叧闂紝涓嶈兘杩涜鎵嬪姩鍙嶅叧闂紒"; + objJsonResult.data = null; + return objJsonResult; + } } } else @@ -1612,6 +1795,15 @@ } if (IsAudit == 1) //鍙嶅叧闂彁浜� { + ds = oCN.RunProcReturn("exec h_p_Kf_CheckSeOrderBill_CrediControl " + oBill.omodel.HInterID, "h_p_Kf_CheckSeOrderBill_CrediControl"); + if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); + objJsonResult.data = null; + return objJsonResult; + } //鍙嶅叧闂彁浜� if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { @@ -1627,6 +1819,195 @@ objJsonResult.count = 0; objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; + return objJsonResult; + } + } + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍏抽棴澶辫触鎴栬�呭弽鍏抽棴澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 閿�鍞鍗� 琛屽叧闂�/琛屽弽鍏抽棴 + /// <summary> + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <param name="IsAudit">鍏抽棴(0),鍙嶅叧闂�(1)</param> + /// <param name="CurUserName">鍏抽棴浜�</param> + /// <returns></returns> + [Route("Xs_SeOrderBill/CloseRowXs_SeOrderBill")] + [HttpGet] + public object CloseRowXs_SeOrderBill(int HInterID,int HEntryID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "Xs_SeOrderBill_Close"; + string SubBillName = "Xs_SeOrderBillSub"; //瀛愯〃琛ㄥ悕 + DBUtility.ClsPub.CurUserName = CurUserName; + DataSet ds = null; + try + { + //妫�鏌ユ潈闄� + if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "琛屽叧闂け璐ワ紒鏃犳潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + //HInterID鏁版嵁鍒ゆ柇 + if (HInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID灏忎簬0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsXs_SeOrderBill oBill = new DAL.ClsXs_SeOrderBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜琛屽叧闂紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HCloseMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘杩涜琛屽叧闂紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜琛屽叧闂紒"; + objJsonResult.data = null; + return objJsonResult; + } + + string sql = "select * from " + SubBillName + " where HInterID = " + HInterID + " and HEntryID = " + HEntryID; + ds = oCN.RunProcReturn(sql, "Xs_SeOrderBillSub"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璇ヨ鏁版嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //琛屽叧闂垽鏂� + { + if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "琛屽凡鍏抽棴!涓嶈兘鍐嶆琛屽叧闂紒"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //琛屽弽鍏抽棴鍒ゆ柇 + { + if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "琛屾湭鍏抽棴!涓嶉渶瑕佸啀琛屽弽鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + //鍒ゆ柇琛屾槸鍚︿负鑷姩鍏抽棴 + string temp = ds.Tables[0].Rows[0]["HCloseType"].ToString(); + if (ds.Tables[0].Rows[0]["HCloseType"].ToString() == "False") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "琛屽弽鍏抽棴澶辫触!琛屼负鑷姩鍏抽棴锛屼笉鑳借繘琛屾墜鍔ㄥ弽鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + + + //杩涜闇�瑕佽繘琛岀殑琛屽叧闂�/琛屽弽鍏抽棴鎿嶄綔 + if (IsAudit == 0) //琛屽叧闂彁浜� + { + //琛屽叧闂彁浜� + if (oBill.CloseRow(lngBillKey,HEntryID,oBill.omodel.HBillNo,CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "琛屽叧闂垚鍔�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "琛屽叧闂け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //琛屽弽鍏抽棴鎻愪氦 + { + oBill.oCn.BeginTran(); + //琛屽弽鍏抽棴鎻愪氦 + if (oBill.CancelRow(lngBillKey, HEntryID, oBill.omodel.HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + ds = oCN.RunProcReturn("exec h_p_Kf_CheckSeOrderBill_CrediControl " + oBill.omodel.HInterID, "h_p_Kf_CheckSeOrderBill_CrediControl"); + if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); + objJsonResult.data = null; + oBill.oCn.RollBack(); + return objJsonResult; + } + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅叧闂垚鍔�"; + objJsonResult.data = null; + oBill.oCn.Commit(); + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + oBill.oCn.RollBack(); return objJsonResult; } } @@ -1845,11 +2226,11 @@ try { string sql = @"select - c.HEmpID + ISNULL(c.HEmpID,0) HEmpID ,e.HName HEmpName - ,c.HDeptID + ,ISNULL(c.HDeptID,0) HDeptID ,d.HName HDeptName - ,d.HEmpID HManagerID + ,ISNULL(d.HEmpID,0) HManagerID ,e1.HName HManagerName from Gy_Czygl as c left join Gy_Employee as e on c.HEmpID = e.HItemID @@ -1885,5 +2266,345 @@ } } #endregion + + #region 閿�鍞鍗� 鏍规嵁鐢ㄦ埛鑾峰彇鐢ㄦ埛鍏宠仈瀹㈡埛杩囨护鏉′欢 + [Route("Xs_SeOrderBill/getCusIDListByUser")] + [HttpGet] + public object getCusIDListByUser(string CurUserID, string CurUserName) + { + string sWhere = ""; + string ModRightNameCheck = "Gy_UserLookAllCus"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //鏉冮檺鍒ゆ柇锛氭槸鍚﹀彲浠ユ煡鐪嬫墍鏈夊鎴� + if (DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) + { + sWhere = ""; + } + else + { + sWhere = " and HCusID in (select hcusid from Gy_UserCustomerRelation Where HUserID = '" + CurUserID + "' union all select 166351 hcusid)"; + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = sWhere; + return objJsonResult; + } + catch (Exception e) + { + sWhere = " and 1=0 "; + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = sWhere; + return objJsonResult; + } + } + #endregion + + #region 閿�鍞鍗� 涓嬫帹鐢熶骇璁㈠崟(鏃犲垪琛�)-鑾峰彇鏁版嵁 + [Route("Xs_SeOrderBill/loadXs_SeOrderBill_InitICMO")] + [HttpGet] + public object loadXs_SeOrderBill_InitICMO(long HInterID,long HEntryID) + { + try + { + string sql = "select * from h_v_IF_SeOrderBillList where hmainid = " + HInterID + " and HSubID = " + HEntryID; + ds = oCN.RunProcReturn(sql, "h_v_IF_SeOrderBillList"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 閿�鍞鍗� 妫�鏌ュ崟鎹槸鍚﹀瓨鍦� + /// <summary> + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <returns></returns> + [Route("Xs_SeOrderBill/CheckSeOrderBill_IsExist")] + [HttpGet] + public object CheckSeOrderBill_IsExist(int HInterID) + { + try + { + //HInterID鏁版嵁鍒ゆ柇 + if (HInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID灏忎簬0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsXs_SeOrderBill oBill = new DAL.ClsXs_SeOrderBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍗曟嵁瀛樺湪"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "绋嬪簭閿欒锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 閿�鍞鍗� 涓嬫煡 + /// <summary> + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <returns></returns> + [Route("Xs_SeOrderBill/SeOrderBill_LookDown")] + [HttpGet] + public object SeOrderBill_LookDown(int HInterID) + { + try + { + List<object> columnNameListSum = new List<object>(); + List<object> columnNameList0 = new List<object>(); + List<object> columnNameList1 = new List<object>(); + List<object> columnNameList2 = new List<object>(); + List<object> columnNameList3 = new List<object>(); + List<object> columnNameList4 = new List<object>(); + + string sql = "exec h_p_Xs_SeOrderBill_lookdown " + HInterID; + ds = oCN.RunProcReturn(sql, "h_p_Xs_SeOrderBill_lookdown"); + + //娣诲姞 閿�鍞鍗曞彉鏇村崟 鍒楀悕 + foreach (DataColumn col in ds.Tables[0].Columns) + { + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList0.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + //娣诲姞 鐢熶骇璁㈠崟 鍒楀悕 + foreach (DataColumn col in ds.Tables[1].Columns) + { + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList1.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + //娣诲姞 鐗规壒鐢宠鍗� 鍒楀悕 + foreach (DataColumn col in ds.Tables[2].Columns) + { + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList2.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + //娣诲姞 閿�鍞嚭搴撳崟 鍒楀悕 + foreach (DataColumn col in ds.Tables[3].Columns) + { + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList3.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + //娣诲姞 宸ュ簭娴佽浆鍗� 鍒楀悕 + foreach (DataColumn col in ds.Tables[4].Columns) + { + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList4.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + columnNameListSum.Add(columnNameList0); + columnNameListSum.Add(columnNameList1); + columnNameListSum.Add(columnNameList2); + columnNameListSum.Add(columnNameList3); + columnNameListSum.Add(columnNameList4); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables; + objJsonResult.list = columnNameListSum; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 閿�鍞鍗� 鏍规嵁涓诲唴鐮佷笌瀛愬唴鐮佽幏鍙栭攢鍞鍗曟暟鎹� + [Route("Xs_SeOrderBill/loadXs_SeOrderBill_Push")] + [HttpGet] + public object loadXs_SeOrderBill_Push(long HInterID,long HSubID) + { + try + { + + ds = oCN.RunProcReturn("select * from h_v_IF_SeOrderBillList where hmainid =" + HInterID + " and hsubid = " + HSubID, "h_v_IF_SeOrderBillList"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏈煡璇㈠埌婧愬崟淇℃伅锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 閿�鍞鍗� 鏍规嵁鑱屽憳鑾峰彇閮ㄩ棬銆佷富绠� + [Route("Xs_SeOrderBill/getEmpInfoByHEmpID")] + [HttpGet] + public object getEmpInfoByHEmpID(long HEmpID) + { + try + { + string sql = "select a.HItemID HEmpID,a.HName HEmpName,ISNULL(a.HDeptID,0) HDeptID,b.HName HDeptName,ISNULL(b.HEmpID,0) HManagerID,c.HName HManagerName " + + " from Gy_Employee as a " + + " left join Gy_Department as b on a.HDeptID = b.HItemID " + + " left join Gy_Employee as c on b.HEmpID = c.HItemID " + + " where a.HItemID = " + HEmpID; + ds = oCN.RunProcReturn(sql, "Gy_Employee"); + + + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏈煡璇㈠埌璇ヨ亴鍛樹俊鎭紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 閿�鍞鍗� 鑾峰彇鎺掑簭鍚庣殑鏁版嵁 + [Route("Xs_SeOrderBill/sortList")] + [HttpGet] + public object sortList(string sWhere, string user) + { + try + { + //鍒ゆ柇鏌ヨ鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Xs_SeOrderBillQuery", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愭煡璇�!"; + objJsonResult.data = null; + return objJsonResult; + } + + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from h_v_IF_SeOrderBillList order by hmainid desc", "h_v_IF_SeOrderBillList"); + } + else + { + string sql1 = "select * from h_v_IF_SeOrderBillList where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_IF_SeOrderBillList"); + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion } } \ No newline at end of file -- Gitblit v1.9.1