From 03626d36cad79f629616dc40a0a099f0631a4672 Mon Sep 17 00:00:00 2001 From: yxj <yxj@hz-kingdee.com> Date: 星期五, 03 一月 2025 15:35:59 +0800 Subject: [PATCH] 1 --- WebAPI/Controllers/WebAPIController.cs | 448 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 446 insertions(+), 2 deletions(-) diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs index 9828e5d..1536146 100644 --- a/WebAPI/Controllers/WebAPIController.cs +++ b/WebAPI/Controllers/WebAPIController.cs @@ -36,6 +36,9 @@ Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); //public static string sUrl = "http://183.129.128.86:9090/WEBS-WMSTest/WebService1.asmx"; // private POInStockBillServices oclscg_poinstockbillmain = new POInStockBillServices(); + + string fileip = System.Configuration.ConfigurationManager.AppSettings["FileIP"]; + /// <summary> /// 閫佽揣鍗曡〃澶翠俊鎭� /// </summary> @@ -384,6 +387,51 @@ return objjson; ; } } + /// <summary> + /// 鐧诲綍鏍规嵁ic鍗¤幏鍙栦俊鎭� + /// </summary> + /// <param name="HBarCode"></param> + /// <returns></returns> + [Route("Web/GetUserByICCard")] + [HttpGet] + public object GetUserByICCard(string HBarCode) + { + try + { + DataSet ds = null; + ClsCN oCnLoc = new ClsCN(); + DAL.ClsUser oUser = new DAL.ClsUser(); + string sql = string.Format(@" select a.* from h_v_Gy_Czygl_Login a + where a.HICNumber = '{0}'", HBarCode); + ds = oCnLoc.RunProcReturn(sql, "h_v_Gy_Czygl_Login"); + + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鏃犳ic鍗″搴斿憳宸ヤ俊鎭紒"; + objjson.data = null; + return objjson; + } + + objjson.code = "1"; + objjson.count = 1; + objjson.Message = "淇℃伅鑾峰彇鎴愬姛锛�"; + objjson.data = ds.Tables[0]; + return objjson; + + } + catch (Exception e) + { + + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鐧诲綍寮傚父锛�" + e.Message; + objjson.data = null; + return objjson; ; + } + } + /// <summary> /// 鑿滃崟鏍� /// </summary> @@ -1493,6 +1541,106 @@ return objjson; } } + + + /// <summary> + /// 鑾峰彇鐝鍒楄〃 + /// </summary> + /// <returns></returns> + [Route("Web/GetGy_ShiftsList_Json")] + [HttpGet] + public object GetGy_ShiftsList_Json(string Shifts) + { + sWhere = " 绂佺敤鏍囪!='Y'"; + if (Shifts != "") + { + sWhere = " Where 绂佺敤鏍囪!='Y' and ( 鐝浠g爜 like '%" + Shifts + "%' or 鐝鍚嶇О like '%" + Shifts + "%' ) "; + } + else + { + sWhere = " Where 绂佺敤鏍囪!='Y' "; + } + try + { + string sql = $"Select * from h_v_Gy_ShiftsList {sWhere} Order by 鐝浠g爜"; + ds = oCN.RunProcReturn(sql, "h_v_Gy_ShiftsList"); + 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 = "0"; + 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; + } + } + + /// <summary> + /// 鑾峰彇寮傚父鍙嶉绫诲瀷鍒楄〃 + /// </summary> + /// <returns></returns> + [Route("Web/GetGy_ErrMsgBackTypeList_Json")] + [HttpGet] + public object GetGy_ErrMsgBackTypeList_Json(string ErrMsg) + { + sWhere = " 绂佺敤鏍囧織 ='鍚�'"; + if (ErrMsg != "") + { + sWhere = " Where 绂佺敤鏍囧織 ='鍚�' and ( 寮傚父鍙嶉绫诲瀷浠g爜 like '%" + ErrMsg + "%' or 寮傚父鍙嶉绫诲瀷鍚嶇О like '%" + ErrMsg + "%' ) "; + } + else + { + sWhere = " Where 绂佺敤鏍囧織 ='鍚�' "; + } + try + { + string sql = $"Select * from h_v_Gy_ErrMsgBackType {sWhere} Order by 寮傚父鍙嶉绫诲瀷浠g爜"; + ds = oCN.RunProcReturn(sql, "h_v_Gy_ErrMsgBackType"); + 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 = "0"; + 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; + } + } + /// <summary> /// 鑾峰彇鐝粍鍒楄〃 @@ -5288,6 +5436,188 @@ objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + /// <summary> + /// 鏂囦欢涓婁紶 + /// </summary> + /// <returns></returns> + [Route("Gy_InspectInstruMent_UploadFile")] + [HttpPost] + public object Gy_InspectInstruMent_UploadFile() + { + + string HBillNo = HttpContext.Current.Request.Params["HBillNo"]; //鍗曟嵁鍙� + string HRemark = HttpContext.Current.Request.Params["HRemark"]; //澶囨敞 + string HUserName = HttpContext.Current.Request.Params["HUserName"]; //鍒涘缓浜� + HttpPostedFile files = HttpContext.Current.Request.Files["file"]; + string path = HttpContext.Current.Server.MapPath("~/../Files/Gy_InspectInstruMent/" + HBillNo); + //string path = @"D:\\Files\\"+ HBillNo; + dynamic dyResult = UpLoadFile(files, path, HBillNo, HRemark, HUserName); + if (dyResult != null && dyResult.result == 1) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "涓婁紶鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = dyResult.returnval; + objJsonResult.data = null; + return objJsonResult; + } + + } + + public dynamic UpLoadFile(HttpPostedFile files, string path, string HBillNo, string HRemark, string HUserName) + { + dynamic Result_Ob = new { result = 1, returnval = "涓婁紶鎴愬姛锛�" }; + string filePath = Path.GetFullPath(files.FileName);//鏂囦欢涓婁紶璺緞 + string fileExtension = Path.GetExtension(files.FileName);// 鏂囦欢鎵╁睍鍚� + string filename = files.FileName;//鏂囦欢鍚� + string fileSavePath = path;// 涓婁紶淇濆瓨璺緞 + int filesize = files.ContentLength;//鑾峰彇涓婁紶鏂囦欢鐨勫ぇ灏忓崟浣嶄负瀛楄妭byte + int Maxsize = 40000 * 1024;//瀹氫箟涓婁紶鏂囦欢鐨勬渶澶х┖闂村ぇ灏忎负40M + try + { + if (files == null || files.ContentLength <= 0) + { + Result_Ob = new { result = 0, returnval = "鏂囦欢涓嶈兘涓虹┖!" }; + return Result_Ob; + } + if (filesize >= Maxsize) + { + Result_Ob = new { result = 0, returnval = "涓婁紶鏂囦欢瓒呰繃40M锛屼笉鑳戒笂浼狅紒" }; + return Result_Ob; + } + + string fileurl = Path.Combine(fileSavePath, filename); + if (Directory.Exists(fileurl) == true) //濡傛灉瀛樺湪閲嶅悕鏂囦欢灏辨彁绀� + { + Result_Ob = new { result = 0, returnval = "瀛樺湪鍚屽悕鏂囦欢锛�" }; + return Result_Ob; + } + //鍒犻櫎鏁版嵁琛ㄦ暟鎹� + ds = oCN.RunProcReturn("delete from MES_AccessoriesList where HSourceBillNo ='" + HBillNo + "' and HFileName='" + filename + "'", "MES_AccessoriesList"); + if (Directory.Exists(path)) + { + File.Delete(fileurl); //鍒犻櫎鎸囧畾鏂囦欢 + files.SaveAs(fileurl); + string StrPath = "/files/Gy_InspectInstruMent/" + HBillNo + "/" + filename; + if (File.Exists(fileurl)) + { + //杩欓噷鍙互鎵ц涓�浜涘叾瀹冪殑鎿嶄綔锛屾瘮濡傛洿鏂版暟鎹簱 + //鍐欏叆鏁版嵁琛� + oCN.RunProc("Insert into MES_AccessoriesList (HFileName,HFilePath,HFilePath_Cus,HFileType" + + ",HLoadMan,HLoadDate,HRemark,HVerNum,HFileSize" + + ",HFileClsID,HSourceBillNo" + + ") values('" + + filename.ToString() + "','" + StrPath.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" + + ",'" + HUserName + "',getdate(),'" + HRemark + "','V1','" + filesize + + "','" + 0 + "','" + HBillNo + + "') "); + } + else + { + Result_Ob = new { result = 0, returnval = "涓婁紶澶辫触锛佹鏂囦欢涓烘伓鎰忔枃浠�" }; + } + } + else + { + Directory.CreateDirectory(fileSavePath); //娣诲姞鏂囦欢澶� + files.SaveAs(fileurl); + string StrPath = "/files/Gy_InspectInstruMent/" + HBillNo + "/" + filename; + if (File.Exists(fileurl)) + { + //杩欓噷鍙互鎵ц涓�浜涘叾瀹冪殑鎿嶄綔锛屾瘮濡傛洿鏂版暟鎹簱 + //鍐欏叆鏁版嵁琛� + oCN.RunProc("Insert into MES_AccessoriesList (HFileName,HFilePath,HFilePath_Cus,HFileType" + + ",HLoadMan,HLoadDate,HRemark,HVerNum,HFileSize" + + ",HFileClsID,HSourceBillNo" + + ") values('" + + filename.ToString() + "','" + StrPath.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" + + ",'" + HUserName + "',getdate(),'" + HRemark + "','V1','" + filesize + + "','" + 0 + "','" + HBillNo + + "') "); + } + else + { + Result_Ob = new { result = 0, returnval = "涓婁紶澶辫触锛佹鏂囦欢涓烘伓鎰忔枃浠�" }; + } + } + + } + catch (Exception e) + { + Result_Ob = new { result = 0, returnval = e.Message }; + } + return Result_Ob; + } + + /// <summary> + /// 鏍规嵁鍗曟嵁鍙锋煡鎵句笂浼犳枃浠跺垪琛� + /// </summary> + /// <param name="sWhere"></param> + /// <returns></returns> + [Route("Gy_InspectInstruMent_Filelist")] + [HttpGet] + public object Gy_InspectInstruMent_Filelist(string HBillNo) + { + var url = fileip + "/files/Gy_InspectInstruMent/" + HBillNo + "/"; + //@"C:\\files\\" + try + { + ds = oCN.RunProcReturn("select *,'" + url + "'+CAST(HFileName as varchar(200))as url from MES_AccessoriesList where HSourceBillNo='" + HBillNo + "'", "MES_AccessoriesList"); + 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; + } + } + + /// <summary> + /// 鏍规嵁ID,鍗曟嵁鍙�,鏂囦欢鍚� 鍒犻櫎鏂囦欢 + /// </summary> + /// <param name="sWhere"></param> + /// <returns></returns> + [Route("Gy_InspectInstruMent_DeleteFilelist")] + [HttpGet] + public object Gy_InspectInstruMent_DeleteFilelist(string HItemID, string HSourceBillNo, string HFileName) + { + try + { + + oCN.RunProc("delete from MES_AccessoriesList where HItemID =" + HItemID); + string fileurl = Path.Combine(HttpContext.Current.Server.MapPath("~/../Files/EquipTechParamFolder/" + HSourceBillNo), HFileName); + File.Delete(fileurl); //鍒犻櫎鎸囧畾鏂囦欢 + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); objJsonResult.data = null; return objJsonResult; } @@ -14794,6 +15124,46 @@ } /// <summary> + /// 鏍规嵁鐗╂枡+宸ュ簭鑾峰彇妫�楠屾柟妗� + /// </summary> + /// <returns></returns> + [Route("Web/GetCheckItemID")] + [HttpGet] + public object GetCheckItemID(string HName,string HProName) + { + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + ds = oCN.RunProcReturn("select top 1 * from h_v_Gy_QCCheckProjectList_Main where 鐗╂枡鍚嶇О='"+HName+ "' and 宸ュ簭鍚嶇О='" + HProName + "' order by 鏃ユ湡 desc ", "h_v_Gy_QCCheckProjectList_Main"); + 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; + } + } + + + /// <summary> /// 鏍规嵁妫�楠屾柟妗堜富鍐呯爜鑾峰彇妫�楠岄」鐩� /// </summary> /// <returns></returns> @@ -15914,8 +16284,15 @@ ds = oCn.RunProcReturn(sql, "Gy_MenuDefineSet"); //鏌ヨ褰撳墠鐢ㄦ埛鐨勮嚜瀹氫箟鑿滃崟鏁版嵁 if (ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0) //鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁鏈夎缃繃鑷畾涔変俊鎭紝鑻ヨ褰曟暟涓�0锛屽垯娌℃湁璁剧疆杩囷紝鍔犺浇鎵�鏈夌殑鑿滃崟淇℃伅 { - sql = "Select * from Gy_Menu_1 where HType = '" + HType + "' Order by HPosition,len(HitemID),HitemID "; - ds = oCn.RunProcReturn(sql, "Gy_Menu"); + string sql1 = "select HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HPicNum from Gy_MenuDefineSet where HMakeName=" + + "(select top 1 c.GroupName from Gy_Czygl a left join System_UserGroupInfo b on a.Czybm = b.UserId " + + "left join System_UserGroup c on b.GroupId = c.GroupID where a.Czymc ='"+HMakeName+"' order by len(c.GroupName ))"; + ds = oCn.RunProcReturn(sql1, "Gy_MenuDefineSet"); //鏌ヨ鐢ㄦ埛缁戝畾鐨勮鑹� 鏄惁璁剧疆鑿滃崟淇℃伅 鍙栬鑹插悕绉版渶鐭殑涓�涓� + if ((ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0)) + { + sql = "Select * from Gy_Menu_1 where HType = '" + HType + "' Order by HPosition,len(HitemID),HitemID "; + ds = oCn.RunProcReturn(sql, "Gy_Menu"); + } } for (int i = 0; i < ds.Tables[0].Rows.Count; i++) //灏嗚彍鍗曠殑鏍硅妭鐐逛繚瀛樺埌鍒楄〃menu涓� @@ -16359,6 +16736,12 @@ string sql = "select a.HSubFuncID, a.HCaption,a.HPicNum,b.Hurl from Xt_UserFastMenu as a join Gy_Menu_1 as b on a.HSubFuncID = b.HItemID where a.HUserID = '" + HMakeName + "' and b.HType = '" + HType + "' Order by a.HItemID"; ds = oCn.RunProcReturn(sql, "Xt_UserFastMenu"); //鑾峰彇Xt_UserFastMenu涓鐢ㄦ埛璁剧疆鐨勮嚜瀹氫箟鑿滃崟淇℃伅锛岀敤浜庡湪鍓嶇鍔犺浇 + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + sql = "select a.HSubFuncID, a.HCaption,a.HPicNum,b.Hurl from Xt_UserFastMenu as a join Gy_Menu_1 as b on a.HSubFuncID = b.HItemID where a.HUserID = 'admin' and b.HType = '" + HType + "' Order by a.HItemID"; + ds = oCn.RunProcReturn(sql, "Xt_UserFastMenu"); //鑾峰彇Xt_UserFastMenu涓鐢ㄦ埛璁剧疆鐨勮嚜瀹氫箟鑿滃崟淇℃伅锛岀敤浜庡湪鍓嶇鍔犺浇 + } + objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "鏌ヨ鎴愬姛锛�"; @@ -16829,6 +17212,67 @@ } } + + /// <summary> + /// 閲戝竻WMS鎺ュ彛 + /// </summary> + /// <returns></returns> + [Route("Web/WMSBarcodeQuery")] + [HttpGet] + public object WMSBarcodeQuery(DateTime dateTime, string UserName, string PassWord) + { + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + //鏉冮檺鍒ゅ畾 + DAL.ClsUser oUser = new DAL.ClsUser(); + DataSet DS; + DS = oCN.RunProcReturn("select * from Gy_Czygl where Czymc='" + UserName.Trim() + "' and Czmm='" + DBUtility.ClsPub.StrToPsd(PassWord.Trim()) + "' ", "Gy_Czygl"); + if (UserName == "" || UserName != "鍞悗鏉$爜鏌ヨ") + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鐢ㄦ埛涓嶅锛�"; + objjson.data = null; + return objjson; + } + if (DS == null || DS.Tables[0].Rows.Count == 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "瀵嗙爜閿欒锛�"; + objjson.data = null; + return objjson; + } + ds = oCN.RunProcReturn("exec h_p_WMSBarcodeQuery '" + dateTime + "'", "h_p_WMSBarcodeQuery"); + + 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