From f68100cba5683d6b1579fe1c1a4e524721b7069f Mon Sep 17 00:00:00 2001 From: Yang <903110162@qq.com> Date: Tue, 18 Apr 2023 16:47:27 +0800 Subject: [PATCH] commit by yzf --- .../Controllers/ViewController.cs | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/FactorySystemApi/Controllers/ViewController.cs b/FactorySystemApi/Controllers/ViewController.cs index 82b7acb..d5e5844 100644 --- a/FactorySystemApi/Controllers/ViewController.cs +++ b/FactorySystemApi/Controllers/ViewController.cs @@ -205,6 +205,65 @@ namespace FactorySystemApi.Controllers }, apiResult, Request); } + /// + /// 保存视图编辑的内容 + /// + [HttpPost] + public ApiResult UpdateBatchById3(Dictionary inParam) + { + var apiResult = new ApiResult(); + return ExceptionHelper.TryReturnException(() => + { + if (Request.Properties["token"] is ApiAuthInfo user) + { + inParam.TryGetValue("TFS_ViewMaterial", out object viewObj); + inParam.TryGetValue("TFS_Material", out object materialObj); + inParam.TryGetValue("TFS_MaterialInfo", out object infoObj); + List> viewList = JsonConvert.DeserializeObject>>(JsonConvert.SerializeObject(viewObj)); + List> materialList = JsonConvert.DeserializeObject>>(JsonConvert.SerializeObject(materialObj)); + List> infoList = JsonConvert.DeserializeObject>>(JsonConvert.SerializeObject(infoObj)); + int teamId = int.Parse(inParam["FTeamID"].ToString()); + int viewType = int.Parse(inParam["FViewType"].ToString()); + apiResult.Data = _viewBll.UpdateBatchById3(viewList, materialList, infoList, teamId, viewType, user.FID); + + if (viewType == 10) + { + // 创建物料视图事项 + TFS_HalfMaterialFTeamwork teamwork = BaseBll.GetTempModel(teamId); + List> vml = _viewBll.GetListByTeamId(teamId, viewType, user.FID, out List materialId, out string FGuaranteePeriod, out string FStorageConditions, true); + Dictionary hasNewView = new Dictionary(); + + if (vml != null) + { + foreach (Dictionary row in vml) + { + int materialType = (int)(long)row["FViewType"]; + string factoryId = row["FFactoryID"].ToString(); + + if (materialType == 2 || materialType == 3 || materialType == 4 || materialType == 5) + { + if (hasNewView.ContainsKey(materialType)) + { + hasNewView[materialType] = hasNewView[materialType] + factoryId + ","; + } + else + { + hasNewView.Add(materialType, factoryId + ","); + } + } + } + HalfMaterialTeamworkBll TeamworkBll = new HalfMaterialTeamworkBll(); + TeamworkBll.CreateMaterialTask(hasNewView, teamwork, user.FID); + } + BaseBll.CreateTaskData2(teamId, user.FID, "3"); + + BaseBll.UpdateTeamProcess2(teamwork.FID, (int)Constant.HalfMaterialProcessType.物料分类, 3, 2); + BaseBll.UpdateTeamProcess2(teamwork.FID, (int)Constant.HalfMaterialProcessType.物料编辑, 2, 1); + } + } + }, apiResult, Request); + } + /// /// 保存视图编辑的内容(物料新增条线) ///