修改协同物料视图里抽取逻辑

原来根据用户表的FactoryId取,改为根据用户表的FactoryList取
master
Leo 2 years ago
parent d599adc3a8
commit fb7ca76ea9

@ -21,7 +21,7 @@ namespace FactorySystemBll
TUser currUser = null;
FGuaranteePeriod = "";
FStorageConditions = "";
if (byFactory == true) currUser = BaseBll.GetTempModel<TUser>(currUserId, "FFactoryID");
if (byFactory == true) currUser = BaseBll.GetTempModel<TUser>(currUserId, "FFactoryID, FFactoryList");
var db = AppSettingsHelper.GetSqlSugar();
/**
@ -38,7 +38,8 @@ namespace FactorySystemBll
viewList = db.Queryable<TFS_ViewMaterial, TFS_Material>((a, b) =>
new JoinQueryInfos(JoinType.Inner, a.FMaterialID == b.FID))
.Where((a, b) => a.FTeamID == teamId)
.WhereIF(currUser != null, (a, b) => a.FFactoryID == currUser.FFactoryID)
//.WhereIF(currUser != null, (a, b) => a.FFactoryID == currUser.FFactoryID)
.WhereIF(currUser != null, (a, b) => currUser.FFactoryList.Contains(a.FFactoryID.ToString()))
.WhereIF(viewType > 0, (a, b) => a.FViewType == viewType)
.Select<object>("distinct a.*,b.FTypeID1,b.FTypeID2,b.FK3Code,b.FK3Name,b.FK3ShortCode,b.FTestCode,b.FRelationCode,b.FRelationName,b.FSAPCode,b.FSAPDescription,b.FMaterialGroup,b.FMaterialType,b.FCustomerCode,b.FStoreHouse," +
"b.FBomEntry,b.FLineHouse,b.FProductDesc,b.FWorkCenter,b.FCraftExplain,b.FIidentifier,b.FGuaranteePeriod,b.FBStorageConditions,b.FSafetyStock,b.FTriggerRatio,b.FMinAmount,b.FMaxAmount,b.FYield,b.FFixedLoss,b.FTheoryYield," +
@ -49,7 +50,8 @@ namespace FactorySystemBll
viewList = db.Queryable<TFS_ViewMaterial, TFS_Material>((a, b) =>
new JoinQueryInfos(JoinType.Inner, a.FMaterialID == b.FID))
.Where((a, b) => a.FTeamID == teamId)
.WhereIF(currUser != null, (a, b) => a.FFactoryID == currUser.FFactoryID)
//.WhereIF(currUser != null, (a, b) => a.FFactoryID == currUser.FFactoryID)
.WhereIF(currUser != null, (a, b) => currUser.FFactoryList.Contains(a.FFactoryID.ToString()))
.Select<object>("distinct a.*,b.FTypeID1,b.FTypeID2,b.FK3Code,b.FK3Name,b.FK3ShortCode,b.FTestCode,b.FRelationCode,b.FRelationName,b.FSAPCode,b.FSAPDescription,b.FMaterialGroup,b.FMaterialType,b.FCustomerCode,b.FStoreHouse," +
"b.FBomEntry,b.FLineHouse,b.FProductDesc,b.FWorkCenter,b.FCraftExplain,b.FIidentifier,b.FGuaranteePeriod,b.FBStorageConditions,b.FSafetyStock,b.FTriggerRatio,b.FMinAmount,b.FMaxAmount,b.FYield,b.FFixedLoss,b.FTheoryYield," +
"b.FQualityTest1,b.FQualityTest2").ToDictionaryList();
@ -80,7 +82,8 @@ namespace FactorySystemBll
viewList = db.Queryable<TFS_ViewMaterial, TFS_Material>((a, b) =>
new JoinQueryInfos(JoinType.Inner, a.FMaterialID == b.FID))
.Where((a, b) => a.FTeamID == teamId)
.WhereIF(currUser != null, (a, b) => a.FFactoryID == currUser.FFactoryID)
//.WhereIF(currUser != null, (a, b) => a.FFactoryID == currUser.FFactoryID)
.WhereIF(currUser != null, (a, b) => currUser.FFactoryList.Contains(a.FFactoryID.ToString()))
.WhereIF(viewType > 0, (a, b) => a.FViewType == 1)
.Select<object>("distinct a.*,b.FTypeID1,b.FTypeID2,b.FK3Code,b.FK3Name,b.FK3ShortCode,b.FTestCode,b.FRelationCode,b.FRelationName,b.FSAPCode,b.FSAPDescription,b.FMaterialGroup,b.FMaterialType,b.FCustomerCode,b.FStoreHouse," +
"b.FBomEntry,b.FLineHouse,b.FProductDesc,b.FWorkCenter,b.FCraftExplain,b.FIidentifier,b.FGuaranteePeriod,b.FBStorageConditions,b.FSafetyStock,b.FTriggerRatio,b.FMinAmount,b.FMaxAmount,b.FYield,b.FFixedLoss,b.FTheoryYield," +
@ -231,7 +234,7 @@ namespace FactorySystemBll
TUser currUser = null;
FGuaranteePeriod = "";
FStorageConditions = "";
if (byFactory == true) currUser = BaseBll.GetTempModel<TUser>(currUserId, "FFactoryID");
if (byFactory == true) currUser = BaseBll.GetTempModel<TUser>(currUserId, "FFactoryID, FFactoryList");
var db = AppSettingsHelper.GetSqlSugar();
List<Dictionary<string, object>> viewList = new List<Dictionary<string, object>>();
@ -242,7 +245,8 @@ namespace FactorySystemBll
new JoinQueryInfos(JoinType.Left, a.FMaterialID == b.FID))
.Where((a, b) => a.FTeamID == teamId)
.Where((a, b) => a.FTeamType == teamType)
.WhereIF(currUser != null, (a, b) => a.FFactoryID == currUser.FFactoryID)
//.WhereIF(currUser != null, (a, b) => a.FFactoryID == currUser.FFactoryID)
.WhereIF(currUser != null, (a, b) => currUser.FFactoryList.Contains(a.FFactoryID.ToString()))
.Select<object>("distinct a.*,b.FTypeID1,b.FTypeID2,b.FK3Code,b.FK3Name,b.FK3ShortCode,b.FTestCode,b.FRelationCode,b.FRelationName,b.FSAPCode,b.FSAPDescription,b.FMaterialGroup,b.FMaterialType,b.FCustomerCode,b.FStoreHouse," +
"b.FBomEntry,b.FLineHouse,b.FProductDesc,b.FWorkCenter,b.FCraftExplain,b.FIidentifier,b.FGuaranteePeriod,b.FBStorageConditions,b.FSafetyStock,b.FTriggerRatio,b.FMinAmount,b.FMaxAmount,b.FYield,b.FFixedLoss,b.FTheoryYield," +
"b.FQualityTest1,b.FQualityTest2").ToDictionaryList();
@ -253,7 +257,8 @@ namespace FactorySystemBll
new JoinQueryInfos(JoinType.Left, a.FMaterialID == b.FID))
.Where((a, b) => a.FTeamID == teamId)
.Where((a, b) => a.FTeamType == teamType)
.WhereIF(currUser != null, (a, b) => a.FFactoryID == currUser.FFactoryID)
//.WhereIF(currUser != null, (a, b) => a.FFactoryID == currUser.FFactoryID)
.WhereIF(currUser != null, (a, b) => currUser.FFactoryList.Contains(a.FFactoryID.ToString()))
.WhereIF(viewType > 0, (a, b) => a.FViewType == viewType)
.Select<object>("distinct a.*,b.FTypeID1,b.FTypeID2,b.FK3Code,b.FK3Name,b.FK3ShortCode,b.FTestCode,b.FRelationCode,b.FRelationName,b.FSAPCode,b.FSAPDescription,b.FMaterialGroup,b.FMaterialType,b.FCustomerCode,b.FStoreHouse," +
"b.FBomEntry,b.FLineHouse,b.FProductDesc,b.FWorkCenter,b.FCraftExplain,b.FIidentifier,b.FGuaranteePeriod,b.FBStorageConditions,b.FSafetyStock,b.FTriggerRatio,b.FMinAmount,b.FMaxAmount,b.FYield,b.FFixedLoss,b.FTheoryYield," +

Loading…
Cancel
Save