|  |  |  | @ -14,6 +14,7 @@ using FactorySystemModel.RequestModel; | 
			
		
	
		
			
				
					|  |  |  |  | using FactorySystemApi.Plm_Formula; | 
			
		
	
		
			
				
					|  |  |  |  | using System.Web.UI.WebControls; | 
			
		
	
		
			
				
					|  |  |  |  | using Newtonsoft.Json; | 
			
		
	
		
			
				
					|  |  |  |  | using Aspose.Cells; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | namespace FactorySystemApi.Controllers | 
			
		
	
		
			
				
					|  |  |  |  | { | 
			
		
	
	
		
			
				
					|  |  |  | @ -62,7 +63,19 @@ namespace FactorySystemApi.Controllers | 
			
		
	
		
			
				
					|  |  |  |  |                 apiResult.Data = FormulaBll.GetFormulaList(); | 
			
		
	
		
			
				
					|  |  |  |  |             }, apiResult, Request); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         /// <summary> | 
			
		
	
		
			
				
					|  |  |  |  |         /// 获取修改配方集合 | 
			
		
	
		
			
				
					|  |  |  |  |         /// </summary> | 
			
		
	
		
			
				
					|  |  |  |  |         /// <returns></returns> | 
			
		
	
		
			
				
					|  |  |  |  |         [HttpPost] | 
			
		
	
		
			
				
					|  |  |  |  |         public ApiResult GetUpdateFormulaList()  | 
			
		
	
		
			
				
					|  |  |  |  |         { | 
			
		
	
		
			
				
					|  |  |  |  |             ApiResult apiResult = new ApiResult(); | 
			
		
	
		
			
				
					|  |  |  |  |             return ExceptionHelper.TryReturnException(() => | 
			
		
	
		
			
				
					|  |  |  |  |             { | 
			
		
	
		
			
				
					|  |  |  |  |                 apiResult.Data = FormulaBll.GetUpdateFormulaList(); | 
			
		
	
		
			
				
					|  |  |  |  |             }, apiResult, Request); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         /// <summary> | 
			
		
	
		
			
				
					|  |  |  |  |         /// 分业请求 | 
			
		
	
	
		
			
				
					|  |  |  | @ -80,6 +93,65 @@ namespace FactorySystemApi.Controllers | 
			
		
	
		
			
				
					|  |  |  |  |                 }; | 
			
		
	
		
			
				
					|  |  |  |  |             }, apiResult, Request); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         /// <summary> | 
			
		
	
		
			
				
					|  |  |  |  |         /// 获取配方变更列表 | 
			
		
	
		
			
				
					|  |  |  |  |         /// </summary> | 
			
		
	
		
			
				
					|  |  |  |  |         /// <param name="fq"></param> | 
			
		
	
		
			
				
					|  |  |  |  |         /// <returns></returns> | 
			
		
	
		
			
				
					|  |  |  |  |         [HttpPost] | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         public ApiResult GetUpdateFormulaPageList(FormulaQuery fq) | 
			
		
	
		
			
				
					|  |  |  |  |         { | 
			
		
	
		
			
				
					|  |  |  |  |             ApiResult apiResult = new ApiResult(); | 
			
		
	
		
			
				
					|  |  |  |  |             return ExceptionHelper.TryReturnException(() => | 
			
		
	
		
			
				
					|  |  |  |  |             { | 
			
		
	
		
			
				
					|  |  |  |  |                 apiResult.Data = new | 
			
		
	
		
			
				
					|  |  |  |  |                 { | 
			
		
	
		
			
				
					|  |  |  |  |                     List = FormulaBll.GetUpdateFormulaList(fq, out var totalNumber), | 
			
		
	
		
			
				
					|  |  |  |  |                     Total = totalNumber | 
			
		
	
		
			
				
					|  |  |  |  |                 }; | 
			
		
	
		
			
				
					|  |  |  |  |             }, apiResult, Request); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         /// <summary> | 
			
		
	
		
			
				
					|  |  |  |  |         /// 更新修改配方的描述及状态 | 
			
		
	
		
			
				
					|  |  |  |  |         /// </summary> | 
			
		
	
		
			
				
					|  |  |  |  |         /// <param name="inParam"></param> | 
			
		
	
		
			
				
					|  |  |  |  |         /// <returns></returns> | 
			
		
	
		
			
				
					|  |  |  |  |         [HttpPost] | 
			
		
	
		
			
				
					|  |  |  |  |         public ApiResult EditUpdateFormula(Dictionary<string, object> inParam)  | 
			
		
	
		
			
				
					|  |  |  |  |         { | 
			
		
	
		
			
				
					|  |  |  |  |             ApiResult apiResult = new ApiResult(); | 
			
		
	
		
			
				
					|  |  |  |  |             apiResult.Data = 0; | 
			
		
	
		
			
				
					|  |  |  |  |             return ExceptionHelper.TryReturnException(() => | 
			
		
	
		
			
				
					|  |  |  |  |             { | 
			
		
	
		
			
				
					|  |  |  |  |                 if (inParam == null) | 
			
		
	
		
			
				
					|  |  |  |  |                 { | 
			
		
	
		
			
				
					|  |  |  |  |                     apiResult.Error("未接收到参数"); | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |                 if (!inParam.ContainsKey("FID"))  | 
			
		
	
		
			
				
					|  |  |  |  |                 { | 
			
		
	
		
			
				
					|  |  |  |  |                     apiResult.Error("未接收到参数FID"); | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |                 if (!inParam.ContainsKey("Remark")) | 
			
		
	
		
			
				
					|  |  |  |  |                 { | 
			
		
	
		
			
				
					|  |  |  |  |                     apiResult.Error("未填写备注说明"); | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |                 else  | 
			
		
	
		
			
				
					|  |  |  |  |                 { | 
			
		
	
		
			
				
					|  |  |  |  |                     int userId = -1; | 
			
		
	
		
			
				
					|  |  |  |  |                     userId = Request.Properties["token"] is ApiAuthInfo user ? user.FID : userId; | 
			
		
	
		
			
				
					|  |  |  |  |                     int fid = int.Parse(inParam["FID"].ToString()); | 
			
		
	
		
			
				
					|  |  |  |  |                     TFS_UpdateFormula model = FormulaBll.GetUpdateFormulaByFID(fid); | 
			
		
	
		
			
				
					|  |  |  |  |                     model.Update_Time = DateTime.Now.ToString("yyyy/MM/dd HH:mm"); | 
			
		
	
		
			
				
					|  |  |  |  |                     model.Remark = inParam["Remark"].ToString(); | 
			
		
	
		
			
				
					|  |  |  |  |                     model.Status = "已处理"; | 
			
		
	
		
			
				
					|  |  |  |  |                     model.Update_User = userId.ToString(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                     apiResult.Data= FormulaBll.EditUpdateFormula(model); | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |             }, apiResult, Request, inParam); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         /// <summary> | 
			
		
	
		
			
				
					|  |  |  |  |         /// 对接配方数据(对方写入) | 
			
		
	
	
		
			
				
					|  |  |  | @ -171,6 +243,8 @@ namespace FactorySystemApi.Controllers | 
			
		
	
		
			
				
					|  |  |  |  |                         int userId = -1; | 
			
		
	
		
			
				
					|  |  |  |  |                         if (Request.Properties.ContainsKey("token")) | 
			
		
	
		
			
				
					|  |  |  |  |                         { | 
			
		
	
		
			
				
					|  |  |  |  |                           | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                             userId = Request.Properties["token"] is ApiAuthInfo user ? user.FID : userId; | 
			
		
	
		
			
				
					|  |  |  |  |                             apiResult.Data = FormulaBll.DockingRecipeData(new List<TFS_Formula>() { formula }, userId); | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
	
		
			
				
					|  |  |  | @ -183,6 +257,83 @@ namespace FactorySystemApi.Controllers | 
			
		
	
		
			
				
					|  |  |  |  |             }, apiResult, Request, inParam); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         [HttpPost] | 
			
		
	
		
			
				
					|  |  |  |  |         public ApiResult DockingChangeData(Dictionary<string, object> inParam)  | 
			
		
	
		
			
				
					|  |  |  |  |         { | 
			
		
	
		
			
				
					|  |  |  |  |             ApiResult apiResult = new ApiResult(); | 
			
		
	
		
			
				
					|  |  |  |  |             apiResult.Data = 0; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             return ExceptionHelper.TryReturnException(() => | 
			
		
	
		
			
				
					|  |  |  |  |             { | 
			
		
	
		
			
				
					|  |  |  |  |                 if (inParam == null) | 
			
		
	
		
			
				
					|  |  |  |  |                 { | 
			
		
	
		
			
				
					|  |  |  |  |                     apiResult.Error("未接收到参数"); | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |                 else | 
			
		
	
		
			
				
					|  |  |  |  |                 { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                     if (!inParam.ContainsKey("SP")) | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         apiResult.Error("PLM规格内码不能为空"); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     else if (!inParam.ContainsKey("SP_VERSION")) | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         apiResult.Error("版本号不能为空"); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     else if (!inParam.ContainsKey("Name")) | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         apiResult.Error("配方中文名称不能为空"); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     else if (!inParam.ContainsKey("Type")) | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         apiResult.Error("配方类型不能为空"); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     else if (!inParam.ContainsKey("SP_AUTHOR")) | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         apiResult.Error("修改人不能为空"); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     else | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         //int userId = -1; | 
			
		
	
		
			
				
					|  |  |  |  |                         if (Request.Properties.ContainsKey("token")) | 
			
		
	
		
			
				
					|  |  |  |  |                         { | 
			
		
	
		
			
				
					|  |  |  |  |                             string sVersion = inParam["SP_VERSION"].ToString(); | 
			
		
	
		
			
				
					|  |  |  |  |                             double dVersion; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                             bool isVersionNum = double.TryParse(sVersion, out dVersion); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                             if (isVersionNum) | 
			
		
	
		
			
				
					|  |  |  |  |                             { | 
			
		
	
		
			
				
					|  |  |  |  |                                 sVersion = string.Format("{0:F4}", dVersion); | 
			
		
	
		
			
				
					|  |  |  |  |                             } | 
			
		
	
		
			
				
					|  |  |  |  |                             TFS_UpdateFormula tFS_UpdateFormula = new TFS_UpdateFormula() | 
			
		
	
		
			
				
					|  |  |  |  |                             { | 
			
		
	
		
			
				
					|  |  |  |  |                                 SP = inParam["SP"].ToString(), | 
			
		
	
		
			
				
					|  |  |  |  |                                 SP_VERSION = sVersion, | 
			
		
	
		
			
				
					|  |  |  |  |                                 SP_VALUE = inParam["SP_VALUE"].ToString(), | 
			
		
	
		
			
				
					|  |  |  |  |                                 Name = inParam["Name"].ToString(), | 
			
		
	
		
			
				
					|  |  |  |  |                                 Type = inParam["Type"].ToString(), | 
			
		
	
		
			
				
					|  |  |  |  |                                 SP_AUTHOR = inParam["SP_AUTHOR"].ToString(), | 
			
		
	
		
			
				
					|  |  |  |  |                                 //Change_Content = inParam["Change_Content"].ToString(), | 
			
		
	
		
			
				
					|  |  |  |  |                                 Change_Time = DateTime.Now.ToString("yyyy/MM/dd HH:mm"), | 
			
		
	
		
			
				
					|  |  |  |  |                                 Change_Content = inParam.ContainsKey("Change_List")?inParam["Change_List"].ToString():"", | 
			
		
	
		
			
				
					|  |  |  |  |                             }; | 
			
		
	
		
			
				
					|  |  |  |  |                             apiResult.Data = FormulaBll.SevaTFS_UpdateFormula(tFS_UpdateFormula); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                             //userId = Request.Properties["token"] is ApiAuthInfo user ? user.FID : userId; | 
			
		
	
		
			
				
					|  |  |  |  |                             //apiResult.Data = FormulaBll.DockingRecipeData(new List<TFS_Formula>() { formula }, userId); | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                         else | 
			
		
	
		
			
				
					|  |  |  |  |                         { | 
			
		
	
		
			
				
					|  |  |  |  |                             apiResult.Error("token信息不存在"); | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |             }, apiResult, Request, inParam); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         /// <summary> | 
			
		
	
		
			
				
					|  |  |  |  |         /// (对接)SAP配方同步 | 
			
		
	
		
			
				
					|  |  |  |  |         /// </summary> | 
			
		
	
	
		
			
				
					|  |  |  | @ -523,7 +674,7 @@ namespace FactorySystemApi.Controllers | 
			
		
	
		
			
				
					|  |  |  |  |                         FPlmCode = item.Code, | 
			
		
	
		
			
				
					|  |  |  |  |                         FName = item.Name, | 
			
		
	
		
			
				
					|  |  |  |  |                         //FCode = item.Code, | 
			
		
	
		
			
				
					|  |  |  |  |                         FType = item.Type.ToLower(), | 
			
		
	
		
			
				
					|  |  |  |  |                         FType = item.Type!=null? item.Type.ToLower():"", | 
			
		
	
		
			
				
					|  |  |  |  |                         //FTestCode = item.TestNO, | 
			
		
	
		
			
				
					|  |  |  |  |                         FVersionCode = item.Version, | 
			
		
	
		
			
				
					|  |  |  |  |                         FParentID = parentId | 
			
		
	
	
		
			
				
					|  |  |  | @ -539,6 +690,8 @@ namespace FactorySystemApi.Controllers | 
			
		
	
		
			
				
					|  |  |  |  |                         FLevel = materLevel, | 
			
		
	
		
			
				
					|  |  |  |  |                         FBomMaterialID = material.FID | 
			
		
	
		
			
				
					|  |  |  |  |                     }; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                      | 
			
		
	
		
			
				
					|  |  |  |  |                     if (material.FType == "a" || material.FType == "f") | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         material.FType = "20"; | 
			
		
	
	
		
			
				
					|  |  |  | @ -603,13 +756,17 @@ namespace FactorySystemApi.Controllers | 
			
		
	
		
			
				
					|  |  |  |  |                             } | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     if (string.IsNullOrWhiteSpace(item.AMaterialCode))  | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         item.AMaterialCode = "空"; | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     item.ABomType = "kg"; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                     if (item.Name.Contains("@")) | 
			
		
	
		
			
				
					|  |  |  |  |                     if (item.Name!=null&&item.Name.Contains("@")) | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         item.EnName = "甜味"; | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     else if (item.Name.Contains("□")) | 
			
		
	
		
			
				
					|  |  |  |  |                     else if (item.Name != null && item.Name.Contains("□")) | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         item.EnName = "咸味"; | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
	
		
			
				
					|  |  |  | 
 |