diff --git a/FactorySystemApi/Controllers/HalfMaterialTeamworkController.cs b/FactorySystemApi/Controllers/HalfMaterialTeamworkController.cs index 0272a3d..c95a4f0 100644 --- a/FactorySystemApi/Controllers/HalfMaterialTeamworkController.cs +++ b/FactorySystemApi/Controllers/HalfMaterialTeamworkController.cs @@ -788,6 +788,15 @@ namespace FactorySystemApi.Controllers FTestCode = item.SP_VALUE, FVersionCode = item.SP_Version, FParentID = parentId + + //FID = DateTime.Now.DayOfYear * 10 + dataId, + //FPlmCode = item.Code, + //FName = item.Name, + ////FCode = item.Code, + //FType = item.Type.ToLower(), + //FTestCode = item.TestNO, + //FVersionCode = item.Version, + //FParentID = parentId }; TFS_ViewMaterial view = new TFS_ViewMaterial() diff --git a/FactorySystemBll/HalfMaterialTeamworkBll.cs b/FactorySystemBll/HalfMaterialTeamworkBll.cs index 7ebd7a4..f126ed6 100644 --- a/FactorySystemBll/HalfMaterialTeamworkBll.cs +++ b/FactorySystemBll/HalfMaterialTeamworkBll.cs @@ -782,41 +782,46 @@ namespace FactorySystemBll { SqlSugarClient db = AppSettingsHelper.GetSqlSugar(); List materialList = null; - List factoryList = new List(); - if (factory != null) + + + materialList = db.Queryable().Where(m => m.FTestCode == testCode).ToList(); + List ids = materialList.Select(m => m.FID).ToList(); + //更新配方 + string sql = ""; + + + if (string.IsNullOrWhiteSpace(idList)) { - if (factory.FType != (int)Constant.FactoryType.单工厂) - { - factoryList.Add(factory.FID); - factoryList.Add(factory.FFactoryID); - } - else - { - factoryList.Add(factory.FID); - } + sql = string.Format("update TFS_Material set FTestCode='{0}' WHERE FID in ({1});update TFS_ViewMaterial set FHalfMaterialTeamID={2} WHERE FMaterialID in ({1})", testCode2, string.Join(",", ids), temId); + } + else + { + sql = string.Format("update TFS_Material set FTestCode='{0}' WHERE FID in ({1})", testCode, idList); + } + if (materialList.Count() > 0) + { + db.Ado.ExecuteCommand(sql); + } - materialList = db.Queryable().Where(m => m.FTestCode == testCode&&string.Join(",", factoryList).Contains(m.FFactoryID.ToString())).ToList(); - List ids = materialList.Select(m => m.FID).ToList(); - //更新配方 - string sql = ""; + //List factoryList = new List(); + //if (factory != null) + //{ + // if (factory.FType != (int)Constant.FactoryType.单工厂) + // { + // factoryList.Add(factory.FID); + // factoryList.Add(factory.FFactoryID); + // } + // else + // { + // factoryList.Add(factory.FID); + // } - if (string.IsNullOrWhiteSpace(idList)) - { - sql = string.Format("update TFS_Material set FTestCode='{0}' WHERE FID in ({1});update TFS_ViewMaterial set FHalfMaterialTeamID={2} WHERE FMaterialID in ({1})", testCode2, string.Join(",", ids), temId); - } - else - { - sql = string.Format("update TFS_Material set FTestCode='{0}' WHERE FID in ({1})", testCode, idList); - } - if (materialList.Count() > 0) - { - db.Ado.ExecuteCommand(sql); - } - } - + + //} + diff --git a/FactorySystemBll/ViewBll.cs b/FactorySystemBll/ViewBll.cs index 4f70593..7f89acb 100644 --- a/FactorySystemBll/ViewBll.cs +++ b/FactorySystemBll/ViewBll.cs @@ -772,10 +772,10 @@ namespace FactorySystemBll break; } } - result += db.Updateable(viewList[i]).AS("TFS_ViewMaterial").WhereColumns("FMaterialID").Where(sqlWhere).ExecuteCommand(); + } - + result += db.Updateable(viewList).AS("TFS_ViewMaterial").WhereColumns("FMaterialID").Where(sqlWhere).ExecuteCommand(); result += HalfMaterialUnionModifyData(viewList, "TFS_ViewMaterial", teamId, db, "FMaterialID"); }