From abf59bc386d65013b4782eb0b3af463457dbe968 Mon Sep 17 00:00:00 2001 From: yusijie <ysj@hz-kingdee.com> Date: 星期二, 12 三月 2024 09:23:29 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/Controllers/WebAPIController.cs | 474 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 466 insertions(+), 8 deletions(-) diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs index c46c1ae..d6ccfb0 100644 --- a/WebAPI/Controllers/WebAPIController.cs +++ b/WebAPI/Controllers/WebAPIController.cs @@ -143,6 +143,56 @@ } } + /// <summary> + /// 鑷姩鑾峰彇鍩虹璧勬枡 娴佹按鍙� 灏辨槸浠g爜 + /// </summary> + /// <param name="HBillType"></param> + /// <returns></returns> + [Route("Web/GetMAXNumber")] + [HttpGet] + public object GetMAXNumber(string HBillType,string HName,string TableName) + { + try + { + string HNumber = ""; + HNumber = DBUtility.ClsPub.CreateHNumber(HBillType,HName, TableName, ref DBUtility.ClsPub.sExeReturnInfo, true); + //----------鍒涘缓铏氳〃------------------------ + DataTable dt_Main = new DataTable("Json"); + dt_Main.Columns.Add("HNumber", typeof(string)); + + //---------鍒涘缓鏂拌------------------------ + DataRow dr_main = dt_Main.NewRow();//鍒涘缓鏂拌 + dt_Main.Rows.Add(dr_main);//灏嗘柊琛屽姞鍏ュ埌琛ㄤ腑 + dr_main["HNumber"] = DBUtility.ClsPub.isStrNull(HNumber); + + + if (HNumber == null) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触"; + objjson.data = null; + return objjson; + } + else + { + objjson.code = "0"; + objjson.count = 1; + objjson.Message = "鑾峰彇鎴愬姛"; + objjson.data = dt_Main; + return objjson; + } + } + catch (Exception e) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + e.ToString(); + objjson.data = null; + return objjson; + } + } + //[Route("Web/Get_MaxBillNoAndID")] //[HttpGet] @@ -7859,6 +7909,307 @@ } #endregion + #region 椤圭洰璐圭敤 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 + /// <summary> + /// 椤圭洰璐圭敤 淇濆瓨 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_ProjectMoneyList")] + [HttpPost] + public object SaveGy_ProjectMoneyList([FromBody] JObject msg) + { + DataSet ds; + var _value = msg["msg"].ToString(); + string msg3 = _value.ToString(); + string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg1 = sArray[0].ToString(); + string msg2 = sArray[1].ToString(); + + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_ProjectMoney_Edit", 1, false, msg2)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + Int64 HItemID = 0; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + //鑾峰彇鏈�澶D鍊艰祴鍊� + DataSet Maxds = oCN.RunProcReturn("select isNull(MAX(HItemID),0) HItemID from Gy_ProjectMoney ", "Gy_ProjectMoney"); + if (Maxds != null || Maxds.Tables[0].Rows.Count > 0) + { + //HItemID= Maxds.Tables[0].Rows[0]["HItemID"] + var maxid = Convert.ToInt32(Maxds.Tables[0].Rows[0]["HItemID"]); + maxid += 1; + HItemID = maxid; + } + ListModels oListModels = new ListModels(); + try + { + + WebAPI.DLL.ClsGy_ProjectMoney_Ctl oBill = new WebAPI.DLL.ClsGy_ProjectMoney_Ctl(); + List<Model.ClsGy_ProjectMoney_Model> lsmain = new List<Model.ClsGy_ProjectMoney_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); + lsmain = oListModels.getObjectByJson_Gy_ProjectMoney(msg1); + foreach (Model.ClsGy_ProjectMoney_Model oItem in lsmain) + { + if (oItem.HNumber.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷笉鑳戒负绌猴紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (oItem.HName.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佸悕绉颁笉鑳戒负绌猴紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim())) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷腑涓嶈兘鍑虹幇杩炵画鈥�.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮� + + ds = oCN.RunProcReturn("select * from Gy_ProjectMoney where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_ProjectMoney"); + if (oItem.HNumber.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷负绌猴紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鏂板鏃跺垽鏂� + if (oItem.HItemID == 0) + { + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦� + string sParent; + sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); + if (sParent.Trim() == "") + { + oBill.oModel.HParentID = 0; + } + else + { + if (oBill.HavParentCode(sParent.Trim(), HItemID)) + { + oBill.oModel.HParentID = oBill.oModel.HItemID; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + } + } + else//缂栬緫鏃跺垽鏂� + { + //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦� + string sParent; + sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); + if (sParent.Trim() == "") + { + oBill.oModel.HParentID = 0; + } + else + { + if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID)) + { + oBill.oModel.HParentID = oBill.oModel.HItemID; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + } + } + //寰楀埌鐭唬鐮� + string sShortNumber; + sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); + if (sShortNumber.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oItem.HShortNumber = sShortNumber;//鐭唬鐮� + oItem.HEndFlag = true;//鏈骇鏍囧織 + oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //绛夌骇 + oItem.HMakeEmp = msg2; //鍒涘缓浜� + + oBill.oModel = oItem; + } + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.oModel.HItemID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddNew(); + } + else + { + bResult = oBill.ModifyByID(oBill.oModel.HItemID); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + objJsonResult.data = 1; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = 1; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + return objJsonResult; + } + } + + /// <summary> + /// 椤圭洰璐圭敤 鑾峰彇淇℃伅 + /// </summary> + /// <returns></returns> + [Route("GetGy_ProjectMoneyDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_ProjectMoneyDetail(string HID) + { + var model = LuBaoSevice.GetGy_ProjectMoneyDetail(HID); + return model; + } + + /// <summary> + /// 椤圭洰璐圭敤 鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_ProjectMoney")] + [HttpGet] + public object DeltetGy_ProjectMoney(string HItemID, string user) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_ProjectMoney_Drop", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (string.IsNullOrWhiteSpace(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HItemID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + oCN.BeginTran();//寮�濮嬩簨鍔� + + ds = oCN.RunProcReturn("select * from Gy_ProjectMoney where HItemID=" + HItemID, "Gy_ProjectMoney"); + if (ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!"; + objJsonResult.data = null; + return objJsonResult; + } + + + oCN.RunProc("delete Gy_ProjectMoney where HItemID=" + HItemID); + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + /// <summary> /// 鐢ㄥ叧鑱斿伐搴忚幏鍙栦俊鎭� @@ -7972,6 +8323,31 @@ var model = LuBaoSevice.Gy_UserByUserEdit(HID); return model; } + + /// <summary> + /// 鐢ㄦ埛鍏宠仈鐝粍鑾峰彇淇℃伅 + /// </summary> + /// <returns></returns> + [Route("GetGy_UserGroupDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_UserGroupDetail(string HID) + { + var model = LuBaoSevice.GetGy_UserGroupBillDetail(HID); + return model; + } + + /// <summary> + /// 鐢ㄦ埛鍏宠仈渚涘簲鍟嗚幏鍙栦俊鎭� + /// </summary> + /// <returns></returns> + [Route("GetGy_UserSupplierDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_UserSupplierDetail(string HID) + { + var model = LuBaoSevice.GetGy_UserSupplierBillDetail(HID); + return model; + } + /// <summary> /// 鎶ュ簾鍘熷洜 @@ -8645,11 +9021,11 @@ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("Select HInterID,HEquipFileNumber,HName from Gy_EquipFileBillMain where 0=0 Order by HInterID ", "Gy_EquipFileBillMain"); + ds = oCN.RunProcReturn("Select HInterID,HEquipFileNumber,HName,HModel2 from Gy_EquipFileBillMain where 0=0 Order by HInterID ", "Gy_EquipFileBillMain"); } else { - string sql1 = "Select HInterID,HEquipFileNumber,HName from Gy_EquipFileBillMain where 0=0 "; + string sql1 = "Select HInterID,HEquipFileNumber,HName,HModel2 from Gy_EquipFileBillMain where 0=0 "; string sql = sql1 + sWhere; ds = oCN.RunProcReturn(sql, "Gy_EquipFileBillMain"); } @@ -9071,11 +9447,11 @@ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("Select HItemID,HNumber 浠g爜,HName 鍚嶇О ,HQCCheckClassID 妫�楠岄」鐩被鍒� from Gy_QCCheckItem where HStopflag=0 Order by HItemID ", "Gy_QCCheckItem"); + ds = oCN.RunProcReturn("Select HItemID,HNumber 浠g爜,HName 鍚嶇О ,HQCCheckClassID 妫�楠岄」鐩被鍒�,HDefaultResult 榛樿缁撹 from Gy_QCCheckItem where HStopflag=0 Order by HItemID ", "Gy_QCCheckItem"); } else { - string sql = "Select HItemID,HNumber 浠g爜,HName 鍚嶇О ,HQCCheckClassID 妫�楠岄」鐩被鍒� from Gy_QCCheckItem where HStopflag=0 " + sWhere + "Order by HItemID "; + string sql = "Select HItemID,HNumber 浠g爜,HName 鍚嶇О ,HQCCheckClassID 妫�楠岄」鐩被鍒�,HDefaultResult 榛樿缁撹 from Gy_QCCheckItem where HStopflag=0 " + sWhere + "Order by HItemID "; ds = oCN.RunProcReturn(sql, "Gy_QCCheckItem"); } if (ds == null || ds.Tables[0].Rows.Count <= 0) @@ -9678,7 +10054,7 @@ /// <returns></returns> [Route("Web/GetItemByEquipFile")] [HttpGet] - public object GetItemByEquipFile(int EquipProjectID,string Type) + public object GetItemByEquipFile(int EquipProjectID,string Type,string HDate) { if (EquipProjectID <= 0) { @@ -9708,7 +10084,8 @@ } SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); - string sql = string.Format(@"select * from " + HView + " where HInterID = " + EquipProjectID); + //string sql = string.Format(@"select * from " + HView + " where HInterID = " + EquipProjectID); + string sql = string.Format(@"Exec h_p_Sb_GetCheckItem_PDA '" + EquipProjectID + "','" + Type + "','" + HDate + "'"); ds = oCN.RunProcReturn(sql, HView); if (ds == null || ds.Tables[0].Rows.Count <= 0) { @@ -9743,7 +10120,7 @@ /// <returns></returns> [Route("Web/GetEquipmentBillsList")] [HttpGet] - public object GetEquipmentBillsList(string sWhere, string Type) + public object GetEquipmentBillsList(string sWhere, string Type,string user) { try { @@ -9758,7 +10135,7 @@ HView = "h_v_Sb_EquipMaintainBillList"; break; case "WX": - HView = "h_v_Sb_EquipRepairCheckBillList"; + HView = "h_v_Sb_EquipRepairWorkBillList"; break; case "GZ": HView = "h_v_Sb_EquipConkBookBillList"; @@ -9775,6 +10152,15 @@ } SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + ds = oCN.RunProcReturn("select ManagerFlag from gy_czygl where czymc='" + user.Trim() + "'", "gy_czygl"); + if (!(bool)ds.Tables[0].Rows[0]["ManagerFlag"]) //鏄惁绠$悊鍛� + { + //涓嶆槸绠$悊鍛� + sWhere += " and 鍒跺崟浜� = '" + user + "'"; + } + + string sql = string.Format(@"select * from " + HView + " where 1 = 1 " + sWhere); ds = oCN.RunProcReturn(sql, HView); //娣诲姞鍒楀悕 @@ -10023,6 +10409,37 @@ } } + + /// <summary> + /// 鑾峰彇閫夊崟鍙风殑婧愬崟绫诲瀷 + /// </summary> + /// <returns></returns> + [Route("Web/GetHSourceBillName")] + [HttpGet] + public object GetHSourceBillName(string HBillType) + { + try + { + ClsCN oCn = new ClsCN(); + DataSet oDs = new DataSet(); + //========== + oDs = oCn.RunProcReturn("select * from xt_BillType where HNumber='" + HBillType + "'", "xt_BillType"); + objjson.code = "1"; + objjson.count = 1; + objjson.Message = "鑾峰彇鎴愬姛锛�"; + objjson.data = oDs.Tables[0]; + return objjson; ; + } + catch (Exception e) + { + + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触锛佸紓甯�" + e.ToString(); + objjson.data = null; + return objjson; ; + } + } #region [浠庢暟鎹簱鍔犺浇鑿滃崟] public class MenuLoad @@ -10925,6 +11342,47 @@ } } + /// <summary> + /// 鑾峰彇鍗曟嵁妯″潡鍚嶇О + /// </summary> + /// <returns></returns> + [Route("Web/GetModuleName")] + [HttpGet] + public object GetModuleName(string HModuleType) + { + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + ds = oCN.RunProcReturn("Select * from Xt_BillType where HNumber = '" + HModuleType + "'", "Xt_BillType"); + + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo; + objjson.data = null; + return objjson; + } + else + { + objjson.code = "1"; + objjson.count = 1; + objjson.Message = "鑾峰彇鎴愬姛!"; + objjson.data = ds.Tables[0]; + return objjson; + } + } + catch (Exception ex) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + ex.ToString(); + objjson.data = null; + return objjson; + } + } + } } -- Gitblit v1.9.1