diff --git a/FactorySystemApi/Controllers/FormulaController.cs b/FactorySystemApi/Controllers/FormulaController.cs index 2acfde4..d28761c 100644 --- a/FactorySystemApi/Controllers/FormulaController.cs +++ b/FactorySystemApi/Controllers/FormulaController.cs @@ -308,27 +308,39 @@ namespace FactorySystemApi.Controllers { sVersion = string.Format("{0:F4}", dVersion); } - if (inParam .ContainsKey("Change_List") && inParam["Change_List"] != null&& inParam["Change_List"].ToString() !="") + if (inParam.ContainsKey("Change_List") && inParam["Change_List"] != null && inParam["Change_List"].ToString() != "") { List jsonList = JsonConvert.DeserializeObject>(inParam["Change_List"].ToString()); - foreach (var item in jsonList) + if (jsonList.Count > 0) { - TFS_UpdateFormula tFS_UpdateFormula = new TFS_UpdateFormula() + foreach (var item in jsonList) { - 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 = JsonConvert.SerializeObject(item), - }; - task = FormulaBll.SevaTFS_UpdateFormula(tFS_UpdateFormula); + 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 = JsonConvert.SerializeObject(item), + }; + task = FormulaBll.SevaTFS_UpdateFormula(tFS_UpdateFormula); + } + } + else + { + apiResult.Error("Change_List不能为空!"); } + + } + else + { + apiResult.Error("Change_List不能为空!"); } apiResult.Data = task; @@ -732,19 +744,20 @@ namespace FactorySystemApi.Controllers List viewsByTestCodes = FormulaBll.GetViewByTestCodes(testCodes); MaterialBll materialBll = new MaterialBll(); - TFS_Material tFS_Material = materialBll.GetMaterialListByFTestCode(item.SP_VALUE).LastOrDefault(); + TFS_Material tFS_Material = materialBll.GetMaterialListByFCode(item.SP_VALUE).FirstOrDefault(); + + if (tFS_Material != null) + { + item.ASapCode = tFS_Material.OldCode; + } + else + { + item.ASapCode = ""; + } if ("40".Equals(material.FType)) { item.AMaterialCode = item.SP_VALUE; - if (tFS_Material != null) - { - item.ASapCode = tFS_Material.OldCode; - } - else - { - item.ASapCode = ""; - } } else { @@ -756,15 +769,11 @@ namespace FactorySystemApi.Controllers if (tFS_Material != null) { item.AMaterialCode = tFS_Material.FCode; - item.ASapCode = tFS_Material.OldCode; //item.AMaterialCode = view2.FSaleOldMaterialCode; //item.ASapCode = view2.FBaseMaterialCode; } - else - { - item.ASapCode = ""; - } + } } if (string.IsNullOrWhiteSpace(item.AMaterialCode)) diff --git a/FactorySystemApi/Controllers/UserController.cs b/FactorySystemApi/Controllers/UserController.cs index 06cdd2d..8302082 100644 --- a/FactorySystemApi/Controllers/UserController.cs +++ b/FactorySystemApi/Controllers/UserController.cs @@ -41,6 +41,20 @@ namespace FactorySystemApi.Controllers }, apiResult, Request, inParam); } + /// + /// 获取当前用户 + /// + /// + /// + [HttpPost] + public ApiResult GetUser() + { + ApiResult apiResult = new ApiResult(); + return ExceptionHelper.TryReturnException(() => + { + apiResult.Data = Request.Properties["token"] as ApiAuthInfo; + }, apiResult, Request); + } /// /// 获取角色列表分页 diff --git a/FactorySystemApi/Web.config b/FactorySystemApi/Web.config index 96a188f..91dd930 100644 --- a/FactorySystemApi/Web.config +++ b/FactorySystemApi/Web.config @@ -13,7 +13,7 @@ - + diff --git a/FactorySystemBll/MaterialBll.cs b/FactorySystemBll/MaterialBll.cs index 42bffe8..6cd9ce1 100644 --- a/FactorySystemBll/MaterialBll.cs +++ b/FactorySystemBll/MaterialBll.cs @@ -118,6 +118,17 @@ namespace FactorySystemBll } + /// + /// 更具物料号获取物料 + /// + /// + /// + public List GetMaterialListByFCode(string fCode) + { + return AppSettingsHelper.GetSqlSugar().Queryable().Where(m => m.FCode == fCode).ToList(); + } + + public TFS_Material GetMaterialById(int id) { return BaseBll.GetTempModel("FID=" + id);