|  |  |  | @ -188,148 +188,140 @@ namespace FactorySystemApi.Controllers | 
			
		
	
		
			
				
					|  |  |  |  |             { | 
			
		
	
		
			
				
					|  |  |  |  |                 //对接获取 | 
			
		
	
		
			
				
					|  |  |  |  |                 //inParam.Add("FMdmCode", GetMdmCode(inParam)); | 
			
		
	
		
			
				
					|  |  |  |  |                 var ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0); | 
			
		
	
		
			
				
					|  |  |  |  |                 inParam.Add("FMdmCode", ts.TotalSeconds.ToString("F0")); | 
			
		
	
		
			
				
					|  |  |  |  |                 if (!inParam.ContainsKey("FMdmCode") || string.IsNullOrEmpty(inParam["FMdmCode"].ToString().Trim())) | 
			
		
	
		
			
				
					|  |  |  |  |                 //var ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0); | 
			
		
	
		
			
				
					|  |  |  |  |                 //inParam.Add("FMdmCode", ts.TotalSeconds.ToString("F0")); | 
			
		
	
		
			
				
					|  |  |  |  |                 try | 
			
		
	
		
			
				
					|  |  |  |  |                 { | 
			
		
	
		
			
				
					|  |  |  |  |                     apiResult.Error("获取MDM失败"); | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |                 else | 
			
		
	
		
			
				
					|  |  |  |  |                 { | 
			
		
	
		
			
				
					|  |  |  |  |                     try | 
			
		
	
		
			
				
					|  |  |  |  |                     inParam.TryGetValue("FState", out object state); | 
			
		
	
		
			
				
					|  |  |  |  |                     if (null == state) | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         inParam.TryGetValue("FState", out object state); | 
			
		
	
		
			
				
					|  |  |  |  |                         if (null == state) | 
			
		
	
		
			
				
					|  |  |  |  |                         { | 
			
		
	
		
			
				
					|  |  |  |  |                             inParam["FState"] = state = 1; | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                         inParam.Remove("FID"); | 
			
		
	
		
			
				
					|  |  |  |  |                         ApiAuthInfo user = Request.Properties["token"] as ApiAuthInfo; | 
			
		
	
		
			
				
					|  |  |  |  |                         if (inParam.ContainsKey("FAddUser")) | 
			
		
	
		
			
				
					|  |  |  |  |                         { | 
			
		
	
		
			
				
					|  |  |  |  |                             inParam["FAddUser"] = user.FID; | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                         else | 
			
		
	
		
			
				
					|  |  |  |  |                         { | 
			
		
	
		
			
				
					|  |  |  |  |                             inParam.Add("FAddUser", user.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                         if (inParam.ContainsKey("FEditUser")) | 
			
		
	
		
			
				
					|  |  |  |  |                         { | 
			
		
	
		
			
				
					|  |  |  |  |                             inParam["FEditUser"] = user.FID; | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                         else | 
			
		
	
		
			
				
					|  |  |  |  |                         { | 
			
		
	
		
			
				
					|  |  |  |  |                             inParam.Add("FEditUser", user.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                         if (inParam.ContainsKey("FEditDate")) | 
			
		
	
		
			
				
					|  |  |  |  |                         { | 
			
		
	
		
			
				
					|  |  |  |  |                             inParam["FEditDate"] = DateTime.Now; | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                         else | 
			
		
	
		
			
				
					|  |  |  |  |                         { | 
			
		
	
		
			
				
					|  |  |  |  |                             inParam.Add("FEditDate", DateTime.Now); | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                         inParam["FState"] = state = 1; | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     inParam.Remove("FID"); | 
			
		
	
		
			
				
					|  |  |  |  |                     ApiAuthInfo user = Request.Properties["token"] as ApiAuthInfo; | 
			
		
	
		
			
				
					|  |  |  |  |                     if (inParam.ContainsKey("FAddUser")) | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         inParam["FAddUser"] = user.FID; | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     else | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         inParam.Add("FAddUser", user.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     if (inParam.ContainsKey("FEditUser")) | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         inParam["FEditUser"] = user.FID; | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     else | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         inParam.Add("FEditUser", user.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     if (inParam.ContainsKey("FEditDate")) | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         inParam["FEditDate"] = DateTime.Now; | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     else | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         inParam.Add("FEditDate", DateTime.Now); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                         //TUser tUser = BaseBll.GetTempModel<TUser>(user.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                         TFS_Factory factory = BaseBll.GetTempModel<TFS_Factory>(int.Parse(inParam["FCreateFactoryID"].ToString())); | 
			
		
	
		
			
				
					|  |  |  |  |                         if (inParam.ContainsKey("FCreateFactoryID")) | 
			
		
	
		
			
				
					|  |  |  |  |                         { | 
			
		
	
		
			
				
					|  |  |  |  |                             inParam.Remove("FCreateFactoryID"); | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                         inParam.Add("FCreateFactoryID", factory.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                         inParam.Add("FCreateFactoryCode", factory.FCode); | 
			
		
	
		
			
				
					|  |  |  |  |                         inParam.Add("FCreateFactoryType", factory.FType); | 
			
		
	
		
			
				
					|  |  |  |  |                         if (factory.FType != (int)Constant.FactoryType.单工厂) | 
			
		
	
		
			
				
					|  |  |  |  |                         { | 
			
		
	
		
			
				
					|  |  |  |  |                             factory = BaseBll.GetTempModel<TFS_Factory>(factory.FFactoryID); | 
			
		
	
		
			
				
					|  |  |  |  |                             inParam.Add("FProdFactoryID", factory.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                             inParam.Add("FProdFactoryCode", factory.FCode); | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                         else | 
			
		
	
		
			
				
					|  |  |  |  |                         { | 
			
		
	
		
			
				
					|  |  |  |  |                             inParam.Add("FProdFactoryID", factory.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                             inParam.Add("FProdFactoryCode", factory.FCode); | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                         if (!inParam.ContainsKey("FSaleCode"))  | 
			
		
	
		
			
				
					|  |  |  |  |                         { | 
			
		
	
		
			
				
					|  |  |  |  |                             inParam.Add("FSaleCode", ""); | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                     //TUser tUser = BaseBll.GetTempModel<TUser>(user.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                     TFS_Factory factory = BaseBll.GetTempModel<TFS_Factory>(int.Parse(inParam["FCreateFactoryID"].ToString())); | 
			
		
	
		
			
				
					|  |  |  |  |                     if (inParam.ContainsKey("FCreateFactoryID")) | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         inParam.Remove("FCreateFactoryID"); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     inParam.Add("FCreateFactoryID", factory.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                     inParam.Add("FCreateFactoryCode", factory.FCode); | 
			
		
	
		
			
				
					|  |  |  |  |                     inParam.Add("FCreateFactoryType", factory.FType); | 
			
		
	
		
			
				
					|  |  |  |  |                     if (factory.FType != (int)Constant.FactoryType.单工厂) | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         factory = BaseBll.GetTempModel<TFS_Factory>(factory.FFactoryID); | 
			
		
	
		
			
				
					|  |  |  |  |                         inParam.Add("FProdFactoryID", factory.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                         inParam.Add("FProdFactoryCode", factory.FCode); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     else | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         inParam.Add("FProdFactoryID", factory.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                         inParam.Add("FProdFactoryCode", factory.FCode); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     if (!inParam.ContainsKey("FSaleCode")) | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         inParam.Add("FSaleCode", ""); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                         //创建 TFS_FTeamwork  | 
			
		
	
		
			
				
					|  |  |  |  |                         int teamId = BaseBll.InsertDataModel(inParam, "TFS_HalfMaterialFTeamwork"); | 
			
		
	
		
			
				
					|  |  |  |  |                     //创建 TFS_FTeamwork  | 
			
		
	
		
			
				
					|  |  |  |  |                     int teamId = BaseBll.InsertDataModel(inParam, "TFS_HalfMaterialFTeamwork"); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                         List<TFS_Material> editMaterialList = MaterialTeamworkBll.UpdateFormula(inParam["FTestCode"].ToString(), inParam["FNewTestCode"].ToString(), teamId, factory.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                         ids = editMaterialList.Select(m => m.FID).Distinct().ToList(); | 
			
		
	
		
			
				
					|  |  |  |  |                     List<TFS_Material> editMaterialList = MaterialTeamworkBll.UpdateFormula(inParam["FTestCode"].ToString(), inParam["FNewTestCode"].ToString(), teamId, factory.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                     ids = editMaterialList.Select(m => m.FID).Distinct().ToList(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                         apiResult.Data = teamId; | 
			
		
	
		
			
				
					|  |  |  |  |                         if (teamId > 0) | 
			
		
	
		
			
				
					|  |  |  |  |                     apiResult.Data = teamId; | 
			
		
	
		
			
				
					|  |  |  |  |                     if (teamId > 0) | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         inParam.Add("FID", teamId); | 
			
		
	
		
			
				
					|  |  |  |  |                         //创建流程 | 
			
		
	
		
			
				
					|  |  |  |  |                         int resultProcessCreate = MaterialTeamworkBll.CreateProcessData(teamId, user.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                         if (resultProcessCreate > 0) | 
			
		
	
		
			
				
					|  |  |  |  |                         { | 
			
		
	
		
			
				
					|  |  |  |  |                             inParam.Add("FID", teamId); | 
			
		
	
		
			
				
					|  |  |  |  |                             //创建流程 | 
			
		
	
		
			
				
					|  |  |  |  |                             int resultProcessCreate = MaterialTeamworkBll.CreateProcessData(teamId, user.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                             if (resultProcessCreate > 0) | 
			
		
	
		
			
				
					|  |  |  |  |                             //直接走下一步 | 
			
		
	
		
			
				
					|  |  |  |  |                             if (state.ToString().Contains("1")) | 
			
		
	
		
			
				
					|  |  |  |  |                             { | 
			
		
	
		
			
				
					|  |  |  |  |                                 //直接走下一步 | 
			
		
	
		
			
				
					|  |  |  |  |                                 if (state.ToString().Contains("1")) | 
			
		
	
		
			
				
					|  |  |  |  |                                 TFS_HalfMaterialFTeamwork teamwork = BaseBll.GetTempModel<TFS_HalfMaterialFTeamwork>(teamId); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                                 //if (editMaterialList.Count() == 0)  | 
			
		
	
		
			
				
					|  |  |  |  |                                 //{ | 
			
		
	
		
			
				
					|  |  |  |  |                                 //    MaterialTeamworkBll.CreateProductView(teamwork, null, user.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                                 //} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                                 //if (editMaterialList.Count() == 0) | 
			
		
	
		
			
				
					|  |  |  |  |                                 //{ | 
			
		
	
		
			
				
					|  |  |  |  |                                 //    //MaterialTeamworkBll.CreateProductView(teamwork, null, user.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                                 //    TFS_Material material = editMaterialList.Find(s => s.FType == "20");//默认取第一个20的,没找到取第一个 | 
			
		
	
		
			
				
					|  |  |  |  |                                 //    if (material == null) material = editMaterialList.FirstOrDefault(); | 
			
		
	
		
			
				
					|  |  |  |  |                                 //    db.Updateable<TFS_HalfMaterialFTeamwork>(new { FMaterialHalfIDs = material.FID }).Where(s => s.FID == teamwork.FID).ExecuteCommand(); | 
			
		
	
		
			
				
					|  |  |  |  |                                 //} | 
			
		
	
		
			
				
					|  |  |  |  |                                 //else | 
			
		
	
		
			
				
					|  |  |  |  |                                 //{ | 
			
		
	
		
			
				
					|  |  |  |  |                                 //    //MaterialTeamworkBll.CreateProductView(teamwork, editMaterialList, user.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                                 //} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                                 //开始BOM下载 | 
			
		
	
		
			
				
					|  |  |  |  |                                 int dow = DockGetBomData(teamwork.FID, user.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                                 if (dow > 0 || editMaterialList.Count() > 0) | 
			
		
	
		
			
				
					|  |  |  |  |                                 { | 
			
		
	
		
			
				
					|  |  |  |  |                                     TFS_HalfMaterialFTeamwork teamwork = BaseBll.GetTempModel<TFS_HalfMaterialFTeamwork>(teamId); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                                     //if (editMaterialList.Count() == 0)  | 
			
		
	
		
			
				
					|  |  |  |  |                                     //{ | 
			
		
	
		
			
				
					|  |  |  |  |                                     //    MaterialTeamworkBll.CreateProductView(teamwork, null, user.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                                     //} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                                     //if (editMaterialList.Count() == 0) | 
			
		
	
		
			
				
					|  |  |  |  |                                     //{ | 
			
		
	
		
			
				
					|  |  |  |  |                                     //    //MaterialTeamworkBll.CreateProductView(teamwork, null, user.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                                     //    TFS_Material material = editMaterialList.Find(s => s.FType == "20");//默认取第一个20的,没找到取第一个 | 
			
		
	
		
			
				
					|  |  |  |  |                                     //    if (material == null) material = editMaterialList.FirstOrDefault(); | 
			
		
	
		
			
				
					|  |  |  |  |                                     //    db.Updateable<TFS_HalfMaterialFTeamwork>(new { FMaterialHalfIDs = material.FID }).Where(s => s.FID == teamwork.FID).ExecuteCommand(); | 
			
		
	
		
			
				
					|  |  |  |  |                                     //} | 
			
		
	
		
			
				
					|  |  |  |  |                                     //else | 
			
		
	
		
			
				
					|  |  |  |  |                                     //{ | 
			
		
	
		
			
				
					|  |  |  |  |                                     //    //MaterialTeamworkBll.CreateProductView(teamwork, editMaterialList, user.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                                     //} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                                     //开始BOM下载 | 
			
		
	
		
			
				
					|  |  |  |  |                                     int dow= DockGetBomData(teamwork.FID, user.FID); | 
			
		
	
		
			
				
					|  |  |  |  |                                     if (dow > 0 || editMaterialList.Count()>0) | 
			
		
	
		
			
				
					|  |  |  |  |                                     { | 
			
		
	
		
			
				
					|  |  |  |  |                                         MaterialTeamworkBll.HasMaterialTestCode(teamwork); | 
			
		
	
		
			
				
					|  |  |  |  |                                         BaseBll.CreateTaskData2(teamwork.FID, user.FID, "1"); //新增物料分类事项 | 
			
		
	
		
			
				
					|  |  |  |  |                                         BaseBll.UpdateTeamProcess2(teamId, (int)Constant.HalfMaterialProcessType.物料分类, 2, 1); // 更新物料分类流程 | 
			
		
	
		
			
				
					|  |  |  |  |                                     } | 
			
		
	
		
			
				
					|  |  |  |  |                                     else | 
			
		
	
		
			
				
					|  |  |  |  |                                     { | 
			
		
	
		
			
				
					|  |  |  |  |                                         BaseBll.DeleteDataById(teamId, "TFS_HalfMaterialFTeamwork", true); | 
			
		
	
		
			
				
					|  |  |  |  |                                         apiResult.Error("未能找到物料"); | 
			
		
	
		
			
				
					|  |  |  |  |                                         //BaseBll.CreateTaskData2(teamId, user.FID, ((int)Constant.HalfMaterialTask.BOM下载).ToString()); | 
			
		
	
		
			
				
					|  |  |  |  |                                         //BaseBll.UpdateTeamProcess2(teamId, (int)Constant.HalfMaterialTask.物料分类, 1, 1); | 
			
		
	
		
			
				
					|  |  |  |  |                                     } | 
			
		
	
		
			
				
					|  |  |  |  |                                    | 
			
		
	
		
			
				
					|  |  |  |  |                                     MaterialTeamworkBll.HasMaterialTestCode(teamwork); | 
			
		
	
		
			
				
					|  |  |  |  |                                     BaseBll.CreateTaskData2(teamwork.FID, user.FID, "1"); //新增物料分类事项 | 
			
		
	
		
			
				
					|  |  |  |  |                                     BaseBll.UpdateTeamProcess2(teamId, (int)Constant.HalfMaterialProcessType.物料分类, 2, 1); // 更新物料分类流程 | 
			
		
	
		
			
				
					|  |  |  |  |                                 } | 
			
		
	
		
			
				
					|  |  |  |  |                                 else | 
			
		
	
		
			
				
					|  |  |  |  |                                 { | 
			
		
	
		
			
				
					|  |  |  |  |                                     BaseBll.CreateTaskData2(teamId, user.FID, ((int)Constant.HalfMaterialTask.BOM下载).ToString()); | 
			
		
	
		
			
				
					|  |  |  |  |                                     BaseBll.UpdateTeamProcess2(teamId, (int)Constant.HalfMaterialTask.BOM下载, 1, 1); | 
			
		
	
		
			
				
					|  |  |  |  |                                     BaseBll.DeleteDataById(teamId, "TFS_HalfMaterialFTeamwork", true); | 
			
		
	
		
			
				
					|  |  |  |  |                                     apiResult.Error("未能找到物料"); | 
			
		
	
		
			
				
					|  |  |  |  |                                     //BaseBll.CreateTaskData2(teamId, user.FID, ((int)Constant.HalfMaterialTask.BOM下载).ToString()); | 
			
		
	
		
			
				
					|  |  |  |  |                                     //BaseBll.UpdateTeamProcess2(teamId, (int)Constant.HalfMaterialTask.物料分类, 1, 1); | 
			
		
	
		
			
				
					|  |  |  |  |                                 } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                             } | 
			
		
	
		
			
				
					|  |  |  |  |                             else | 
			
		
	
		
			
				
					|  |  |  |  |                             { | 
			
		
	
		
			
				
					|  |  |  |  |                                 BaseBll.DeleteDataById(teamId, "TFS_HalfMaterialFTeamwork", true); | 
			
		
	
		
			
				
					|  |  |  |  |                                 apiResult.Error("流程创建失败,请稍后重试"); | 
			
		
	
		
			
				
					|  |  |  |  |                                 BaseBll.CreateTaskData2(teamId, user.FID, ((int)Constant.HalfMaterialTask.BOM下载).ToString()); | 
			
		
	
		
			
				
					|  |  |  |  |                                 BaseBll.UpdateTeamProcess2(teamId, (int)Constant.HalfMaterialTask.BOM下载, 1, 1); | 
			
		
	
		
			
				
					|  |  |  |  |                             } | 
			
		
	
		
			
				
					|  |  |  |  |                             HalfMaterialTeamworkBll.ChangeTeamProcess(teamId); | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                         else | 
			
		
	
		
			
				
					|  |  |  |  |                         { | 
			
		
	
		
			
				
					|  |  |  |  |                             BaseBll.DeleteDataById(teamId, "TFS_HalfMaterialFTeamwork", true); | 
			
		
	
		
			
				
					|  |  |  |  |                             apiResult.Error("流程创建失败,请稍后重试"); | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                         HalfMaterialTeamworkBll.ChangeTeamProcess(teamId); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     catch (Exception ex) | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |  |                         //失败则把修改的更新回去 | 
			
		
	
		
			
				
					|  |  |  |  |                         MaterialTeamworkBll.UpdateFormula(inParam["FTestCode"].ToString(), inParam["FNewTestCode"].ToString(),0,0,string.Join(",",ids)); | 
			
		
	
		
			
				
					|  |  |  |  |                         throw; | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |              | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |                 catch (Exception ex) | 
			
		
	
		
			
				
					|  |  |  |  |                 { | 
			
		
	
		
			
				
					|  |  |  |  |                     //失败则把修改的更新回去 | 
			
		
	
		
			
				
					|  |  |  |  |                     MaterialTeamworkBll.UpdateFormula(inParam["FTestCode"].ToString(), inParam["FNewTestCode"].ToString(), 0, 0, string.Join(",", ids)); | 
			
		
	
		
			
				
					|  |  |  |  |                     throw; | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |             }, apiResult, Request, inParam); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
	
		
			
				
					|  |  |  | @ -613,6 +605,10 @@ namespace FactorySystemApi.Controllers | 
			
		
	
		
			
				
					|  |  |  |  |                 OAService oAService = new OAService(); | 
			
		
	
		
			
				
					|  |  |  |  |                 specifList[0].Code = formula.FTestCode; | 
			
		
	
		
			
				
					|  |  |  |  |                 specifList[0].Version = formula.FVersionCode; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 specifList[0].SP = formula.FPlmCode; | 
			
		
	
		
			
				
					|  |  |  |  |                 specifList[0].SP_Version = formula.FVersionCode; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 RestResult restResult = oAService.GetSpecificationsList(specifList.ToArray()); | 
			
		
	
		
			
				
					|  |  |  |  |                 string bomStr = restResult.data == null ? "[]" : restResult.data.ToString(); | 
			
		
	
		
			
				
					|  |  |  |  |                 ExceptionHelper.AddSystemJournal(Request, specifList[0], restResult,user.FID, "DockGetBomData"); | 
			
		
	
	
		
			
				
					|  |  |  | @ -683,6 +679,11 @@ namespace FactorySystemApi.Controllers | 
			
		
	
		
			
				
					|  |  |  |  |                 OAService oAService = new OAService(); | 
			
		
	
		
			
				
					|  |  |  |  |                 specifList[0].Code = teamwork.FNewTestCode; | 
			
		
	
		
			
				
					|  |  |  |  |                 specifList[0].Version = formula.FVersionCode; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 specifList[0].SP = formula.FPlmCode; | 
			
		
	
		
			
				
					|  |  |  |  |                 specifList[0].SP_Version = formula.FVersionCode; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 RestResult restResult = oAService.GetSpecificationsList(specifList.ToArray()); | 
			
		
	
		
			
				
					|  |  |  |  |                 string bomStr = restResult.data == null ? "[]" : restResult.data.ToString(); | 
			
		
	
		
			
				
					|  |  |  |  |                 ExceptionHelper.AddSystemJournal(Request, specifList[0], restResult, userId, "DockGetBomData"); | 
			
		
	
	
		
			
				
					|  |  |  | @ -1152,7 +1153,7 @@ namespace FactorySystemApi.Controllers | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |                 else | 
			
		
	
		
			
				
					|  |  |  |  |                 { | 
			
		
	
		
			
				
					|  |  |  |  |                     dataList = MaterialTeamworkBll.GetTeamworkViewData(selectSql.Trim(','), whereSql, joinSql); | 
			
		
	
		
			
				
					|  |  |  |  |                     dataList = MaterialTeamworkBll.GetHalfMaterialTeamworkViewData(selectSql.Trim(','), whereSql, joinSql); | 
			
		
	
		
			
				
					|  |  |  |  |                     dataList.Columns.Remove("FMaterialID"); | 
			
		
	
		
			
				
					|  |  |  |  |                     if (intType == (int)Constant.TeamViewType.生产版本视图) | 
			
		
	
		
			
				
					|  |  |  |  |                     { | 
			
		
	
	
		
			
				
					|  |  |  | 
 |