|  |  |  | @ -11,6 +11,7 @@ using System.Reflection; | 
			
		
	
		
			
				
					|  |  |  |  | using System.Web.Http; | 
			
		
	
		
			
				
					|  |  |  |  | using FactorySystemModel.EnumModel; | 
			
		
	
		
			
				
					|  |  |  |  | using FactorySystemModel.RequestModel; | 
			
		
	
		
			
				
					|  |  |  |  | using FactorySystemApi.Plm_Formula; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | namespace FactorySystemApi.Controllers | 
			
		
	
		
			
				
					|  |  |  |  | { | 
			
		
	
	
		
			
				
					|  |  |  | @ -248,6 +249,135 @@ namespace FactorySystemApi.Controllers | 
			
		
	
		
			
				
					|  |  |  |  |             }, apiResult, Request, null); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         /// <summary> | 
			
		
	
		
			
				
					|  |  |  |  |         /// 获取用户是否具备申请查询配方权限 | 
			
		
	
		
			
				
					|  |  |  |  |         /// </summary> | 
			
		
	
		
			
				
					|  |  |  |  |         /// <returns></returns> | 
			
		
	
		
			
				
					|  |  |  |  |         [HttpPost] | 
			
		
	
		
			
				
					|  |  |  |  |         public ApiResult GetApplyBomPower() | 
			
		
	
		
			
				
					|  |  |  |  |         { | 
			
		
	
		
			
				
					|  |  |  |  |             ApiResult apiResult = new ApiResult(); | 
			
		
	
		
			
				
					|  |  |  |  |             return ExceptionHelper.TryReturnException(() => | 
			
		
	
		
			
				
					|  |  |  |  |             { | 
			
		
	
		
			
				
					|  |  |  |  |                 bool hasPower = false; | 
			
		
	
		
			
				
					|  |  |  |  |                 ApiAuthInfo user = Request.Properties["token"] as ApiAuthInfo; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 List<object> powerList = FormulaBll.GetTaskPower(user.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                 List<object> applyBomPowers = powerList.FindAll(p => ((IDictionary<string, object>)p)["FFunctionID"].ToString().Equals("12")).ToList(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 if (applyBomPowers.Count > 0) | 
			
		
	
		
			
				
					|  |  |  |  |                 { | 
			
		
	
		
			
				
					|  |  |  |  |                     hasPower = true; | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 apiResult.Data = hasPower; | 
			
		
	
		
			
				
					|  |  |  |  |             }, apiResult, Request); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         /// <summary> | 
			
		
	
		
			
				
					|  |  |  |  |         /// 获取用户是否具备申请查询配方权限 | 
			
		
	
		
			
				
					|  |  |  |  |         /// </summary> | 
			
		
	
		
			
				
					|  |  |  |  |         /// <param name="inParam"></param> | 
			
		
	
		
			
				
					|  |  |  |  |         /// <returns></returns> | 
			
		
	
		
			
				
					|  |  |  |  |         [HttpPost] | 
			
		
	
		
			
				
					|  |  |  |  |         public ApiResult GetFormulaByTestCode(Dictionary<string, object> inParam) | 
			
		
	
		
			
				
					|  |  |  |  |         { | 
			
		
	
		
			
				
					|  |  |  |  |             ApiResult apiResult = new ApiResult(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             return ExceptionHelper.TryReturnException(() => | 
			
		
	
		
			
				
					|  |  |  |  |             { | 
			
		
	
		
			
				
					|  |  |  |  |                 SearchFormulaQuery searchFormulaQuery = new SearchFormulaQuery(); | 
			
		
	
		
			
				
					|  |  |  |  |                 string testCode = inParam["FTestCode"] == null ? "" : inParam["FTestCode"].ToString(); | 
			
		
	
		
			
				
					|  |  |  |  |                 string pageIndex = inParam["FPageIndex"] == null ? "0" : inParam["FPageIndex"].ToString(); | 
			
		
	
		
			
				
					|  |  |  |  |                 string pageSize = inParam["FPageSize"] == null ? "5" : inParam["FPageSize"].ToString(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 int nPageIndex = 0; | 
			
		
	
		
			
				
					|  |  |  |  |                 int nPageSize = 0; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 int.TryParse(pageIndex, out nPageIndex); | 
			
		
	
		
			
				
					|  |  |  |  |                 int.TryParse(pageSize, out nPageSize); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 searchFormulaQuery.FTestCode = testCode; | 
			
		
	
		
			
				
					|  |  |  |  |                 searchFormulaQuery.FPageIndex = nPageIndex; | 
			
		
	
		
			
				
					|  |  |  |  |                 searchFormulaQuery.FPageSize = nPageSize; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 apiResult.Data = new | 
			
		
	
		
			
				
					|  |  |  |  |                 { | 
			
		
	
		
			
				
					|  |  |  |  |                     List = FormulaBll.GetListByTestCode(searchFormulaQuery, out var totalNumber), | 
			
		
	
		
			
				
					|  |  |  |  |                     Total = totalNumber | 
			
		
	
		
			
				
					|  |  |  |  |                 }; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             }, apiResult, Request); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         /// <summary> | 
			
		
	
		
			
				
					|  |  |  |  |         /// 获取配方清单 | 
			
		
	
		
			
				
					|  |  |  |  |         /// </summary> | 
			
		
	
		
			
				
					|  |  |  |  |         /// <param name="inParam"></param> | 
			
		
	
		
			
				
					|  |  |  |  |         /// <returns></returns> | 
			
		
	
		
			
				
					|  |  |  |  |         [HttpPost] | 
			
		
	
		
			
				
					|  |  |  |  |         public ApiResult GetBomList(Dictionary<string, object> inParam) | 
			
		
	
		
			
				
					|  |  |  |  |         { | 
			
		
	
		
			
				
					|  |  |  |  |             ApiResult apiResult = new ApiResult(); | 
			
		
	
		
			
				
					|  |  |  |  |             ApiAuthInfo user = Request.Properties["token"] as ApiAuthInfo; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             return ExceptionHelper.TryReturnException(() => | 
			
		
	
		
			
				
					|  |  |  |  |             { | 
			
		
	
		
			
				
					|  |  |  |  |                 string fid = inParam["FID"] == null ? "" : inParam["FID"].ToString(); | 
			
		
	
		
			
				
					|  |  |  |  |                 int nFid = 0; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 int.TryParse(fid, out nFid); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 List<TFS_Formula> formulas = FormulaBll.GetFormulaListById(nFid); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 if (formulas != null && formulas.Count > 0) | 
			
		
	
		
			
				
					|  |  |  |  |                 { | 
			
		
	
		
			
				
					|  |  |  |  |                     TFS_Formula formula = formulas[0]; | 
			
		
	
		
			
				
					|  |  |  |  |                     OAService oAService = new OAService(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                     List<Specifications> specifList = new List<Specifications>() { new Specifications() }; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                     specifList[0].SP = formula.FPlmCode; | 
			
		
	
		
			
				
					|  |  |  |  |                     specifList[0].SP_Version = formula.FVersionCode; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                     InputSpecifications oaParam = new InputSpecifications(); | 
			
		
	
		
			
				
					|  |  |  |  |                     oaParam.USERNAME = AppSettingsHelper.GetAppSettingVal("Plm_Formula_Username"); | 
			
		
	
		
			
				
					|  |  |  |  |                     oaParam.PASSWORD = AppSettingsHelper.GetAppSettingVal("Plm_Formula_Password"); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                     oaParam.Specifications = specifList.ToArray(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                     RestResult restResult = oAService.GetSpecificationsList(oaParam); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                     apiResult.Data = restResult.data; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                     if (restResult.data != null) | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         FormulaBll.AddFormulaApplyHistroy(formula, user.FName, user.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |             }, apiResult, Request); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         /// <summary> | 
			
		
	
		
			
				
					|  |  |  |  |         /// 根据物料号列表获取物料列表 | 
			
		
	
		
			
				
					|  |  |  |  |         /// </summary> | 
			
		
	
		
			
				
					|  |  |  |  |         /// <param name="inParam"></param> | 
			
		
	
		
			
				
					|  |  |  |  |         /// <returns></returns> | 
			
		
	
		
			
				
					|  |  |  |  |         [HttpPost] | 
			
		
	
		
			
				
					|  |  |  |  |         public ApiResult GetMaterialList(Dictionary<string, object> inParam) | 
			
		
	
		
			
				
					|  |  |  |  |         { | 
			
		
	
		
			
				
					|  |  |  |  |             ApiResult apiResult = new ApiResult(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             return ExceptionHelper.TryReturnException(() => | 
			
		
	
		
			
				
					|  |  |  |  |             { | 
			
		
	
		
			
				
					|  |  |  |  |                 string materialCodes = inParam["materialCodes"] == null ? "" : inParam["materialCodes"].ToString(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 List<object> materialList = FormulaBll.GetMaterialList(materialCodes); | 
			
		
	
		
			
				
					|  |  |  |  |                 apiResult.Data = materialList; | 
			
		
	
		
			
				
					|  |  |  |  |             }, apiResult, Request); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         #region 内部方法 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         /// <summary> | 
			
		
	
	
		
			
				
					|  |  |  | 
 |