From bb90d131805bf0edec18f02324aaa7340de77a4d Mon Sep 17 00:00:00 2001
From: leo <10200039@qq.com>
Date: Mon, 17 Apr 2023 12:10:00 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=89=A9=E6=96=99=E8=B7=AF?=
=?UTF-8?q?=E7=BA=BF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/MaterialTaskController.cs | 44 ++++
.../Controllers/MaterialTeamworkController.cs | 231 ++++++++++++++++++
.../Controllers/ViewController.cs | 27 ++
FactorySystemApi/FactorySystemApi.csproj | 2 +
FactorySystemBll/BaseBll.cs | 52 ++++
FactorySystemBll/FactorySystemBll.csproj | 2 +
FactorySystemBll/MaterialBll.cs | 13 +-
FactorySystemBll/MaterialTaskBll.cs | 38 +++
FactorySystemBll/MaterialTeamworkBll.cs | 38 +++
FactorySystemBll/ViewBll.cs | 45 ++++
FactorySystemModel/FactorySystemModel.csproj | 6 +
.../RequestModel/MaterialTaskQuery.cs | 30 +++
.../RequestModel/MaterialTeamworkQuery.cs | 31 +++
.../ResponseModel/MaterialTaskRow.cs | 35 +++
.../ResponseModel/MaterialTeamworkRow.cs | 13 +
.../SqlSugarModel/TFS_FMaterialTask.cs | 120 +++++++++
.../SqlSugarModel/TFS_FMaterialTeamwork.cs | 179 ++++++++++++++
17 files changed, 905 insertions(+), 1 deletion(-)
create mode 100644 FactorySystemApi/Controllers/MaterialTaskController.cs
create mode 100644 FactorySystemApi/Controllers/MaterialTeamworkController.cs
create mode 100644 FactorySystemBll/MaterialTaskBll.cs
create mode 100644 FactorySystemBll/MaterialTeamworkBll.cs
create mode 100644 FactorySystemModel/RequestModel/MaterialTaskQuery.cs
create mode 100644 FactorySystemModel/RequestModel/MaterialTeamworkQuery.cs
create mode 100644 FactorySystemModel/ResponseModel/MaterialTaskRow.cs
create mode 100644 FactorySystemModel/ResponseModel/MaterialTeamworkRow.cs
create mode 100644 FactorySystemModel/SqlSugarModel/TFS_FMaterialTask.cs
create mode 100644 FactorySystemModel/SqlSugarModel/TFS_FMaterialTeamwork.cs
diff --git a/FactorySystemApi/Controllers/MaterialTaskController.cs b/FactorySystemApi/Controllers/MaterialTaskController.cs
new file mode 100644
index 0000000..441a955
--- /dev/null
+++ b/FactorySystemApi/Controllers/MaterialTaskController.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Web.Http;
+using FactorySystemApi.Sap_Group;
+using FactorySystemBll;
+using FactorySystemCommon;
+using FactorySystemModel.BusinessModel;
+using FactorySystemModel.EnumModel;
+using FactorySystemModel.RequestModel;
+using FactorySystemModel.ResponseModel;
+using FactorySystemModel.SqlSugarModel;
+
+namespace FactorySystemApi.Controllers
+{
+ ///
+ /// 任务
+ ///
+ [UserLoginFilter]
+ public class MaterialTaskController : ApiController
+ {
+ private readonly MaterialTaskBll _taskBll = new MaterialTaskBll();
+
+ ///
+ /// 根据当前用户获取任务列表
+ ///
+ [HttpPost]
+ public ApiResult GetPageList(MaterialTaskQuery mtq)
+ {
+ ApiResult apiResult = new ApiResult();
+ return ExceptionHelper.TryReturnException(() =>
+ {
+ if (mtq.FIsUser && Request.Properties["token"] is ApiAuthInfo user)
+ {
+ mtq.FUserID = user.FID.ToString();
+ }
+ apiResult.Data = new
+ {
+ List = _taskBll.GetList(mtq, out var totalNumber),
+ Total = totalNumber
+ };
+ }, apiResult, Request);
+ }
+ }
+}
diff --git a/FactorySystemApi/Controllers/MaterialTeamworkController.cs b/FactorySystemApi/Controllers/MaterialTeamworkController.cs
new file mode 100644
index 0000000..50c28f9
--- /dev/null
+++ b/FactorySystemApi/Controllers/MaterialTeamworkController.cs
@@ -0,0 +1,231 @@
+using FactorySystemBll;
+using FactorySystemCommon;
+using FactorySystemModel.BusinessModel;
+using FactorySystemModel.EnumModel;
+using FactorySystemModel.ResponseModel;
+using FactorySystemModel.SqlSugarModel;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Web.Http;
+using System.Data;
+using System.IO;
+using Newtonsoft.Json.Linq;
+using FactorySystemApi.Plm_Formula;
+using System.Linq;
+using SqlSugar;
+using FactorySystemModel.RequestModel;
+
+namespace FactorySystemApi.Controllers
+{
+ ///
+ /// 协同接口
+ ///
+ [UserLoginFilter]
+ public class MaterialTeamworkController : ApiController
+ {
+ ///
+ /// 数据处理层
+ ///
+ public readonly BaseBll BaseBll = new BaseBll();
+ ///
+ /// 数据处理层-物料处理
+ ///
+ public readonly MaterialBll MaterialBll = new MaterialBll();
+ ///
+ /// 数据处理层-视图处理
+ ///
+ public readonly ViewBll ViewBll = new ViewBll();
+ ///
+ /// 数据处理层-路线处理
+ ///
+ private readonly MaterialTeamworkBll _taskBll = new MaterialTeamworkBll();
+ ///
+ /// 事项操作日志
+ ///
+ public readonly OperateLogBll OperateLogBll = new OperateLogBll();
+ ///
+ /// 初始化
+ ///
+ public MaterialTeamworkController()
+ {
+ }
+
+ ///
+ /// 新增物料路线
+ ///
+ [HttpPost]
+ public ApiResult InsertDataModel(Dictionary inParam)
+ {
+ ApiResult apiResult = new ApiResult();
+ return ExceptionHelper.TryReturnException(() =>
+ {
+ ApiAuthInfo user = Request.Properties["token"] as ApiAuthInfo;
+ TFS_Factory factory = BaseBll.GetTempModel(int.Parse(inParam["FCreateFactoryID"].ToString()));
+ Dictionary result = new Dictionary();
+
+ //inParam.Add("FMdmCode", GetMdmCode(inParam));
+ inParam.Remove("FID");
+
+ string materialName = inParam["FMaterialName"].ToString();
+
+ inParam.TryGetValue("FState", out object state);
+ if (null == state)
+ {
+ inParam["FState"] = state = 1;
+ }
+
+ if (inParam.ContainsKey("FAddUser"))
+ {
+ inParam["FAddUser"] = user.FID;
+ }
+ else
+ {
+ inParam.Add("FAddUser", user.FID);
+ }
+
+ if (inParam.ContainsKey("FAddDate"))
+ {
+ inParam["FAddDate"] = DateTime.Now;
+ }
+ else
+ {
+ inParam.Add("FEditDate", DateTime.Now);
+ }
+
+ 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);
+ }
+
+ 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.单工厂)
+ {
+ TFS_Factory prodFactory = BaseBll.GetTempModel(factory.FFactoryID);
+ inParam.Add("FProdFactoryID", prodFactory.FID);
+ inParam.Add("FProdFactoryCode", prodFactory.FCode);
+ }
+ else
+ {
+ inParam.Add("FProdFactoryID", factory.FID);
+ inParam.Add("FProdFactoryCode", factory.FCode);
+ }
+
+ inParam.Add("FTeamworkType", 1);
+
+ int teamId = BaseBll.InsertDataModel(inParam, "TFS_FMaterialTeamwork");
+ result.Add("TeamId", teamId);
+
+ if (teamId > 0)
+ {
+ inParam.Add("FID", teamId);
+
+ if (state.ToString().Contains("1"))
+ {
+ TFS_FMaterialTeamwork teamwork = BaseBll.GetTempModel(teamId);
+
+ // 创建物料和物料视图
+ Dictionary materialInfo = CreateMaterial(inParam, factory, teamwork);
+ foreach(string key in materialInfo.Keys)
+ {
+ result.Add(key, materialInfo[key]);
+ }
+
+ // 创建物料分类任务
+ int taskId = BaseBll.CreateMaterialTask(teamId, user.FID, 15, factory.FID);
+ result.Add("TaskId", taskId);
+ }
+ }
+
+ apiResult.Data = result;
+ }, apiResult, Request, inParam);
+ }
+
+ ///
+ /// 查询物料路线
+ ///
+ [HttpPost]
+ public ApiResult GetPageList(MaterialTeamworkQuery mtq)
+ {
+ ApiResult apiResult = new ApiResult();
+ return ExceptionHelper.TryReturnException(() =>
+ {
+ if (mtq.FIsUser && Request.Properties["token"] is ApiAuthInfo user)
+ {
+ mtq.FUserID = user.FID;
+ }
+ apiResult.Data = new
+ {
+ List = _taskBll.GetList(mtq, out var totalNumber),
+ Total = totalNumber
+ };
+ }, apiResult, Request);
+ }
+
+ private Dictionary CreateMaterial(Dictionary inParam, TFS_Factory factory, TFS_FMaterialTeamwork teamwork)
+ {
+ Dictionary result = new Dictionary();
+ // 创建物料(物料表新增数据)
+ TFS_Material material = new TFS_Material();
+ material.FName = inParam["FMaterialName"].ToString(); // 物料名称
+ material.FDesc = inParam["FMaterialName"].ToString(); // 物料描述
+ material.FMaterialGroup = inParam["FMaterialGroup"].ToString(); // 物料组
+ material.FBaseUnit = inParam["FWeightUnit"].ToString(); // 计量单位
+ material.FFactoryID = factory.FFactoryID; // 工厂
+ material.FFactoryCode = factory.FCode; // 工厂标识
+ material.FTestCode = inParam["FTestCode"].ToString(); // 试验号
+
+ int materialId = MaterialBll.InsertMaterial(material);
+
+ result.Add("MaterialId", materialId);
+
+ // 创建物料视图
+ TFS_ViewMaterial viewMaterial = new TFS_ViewMaterial();
+ viewMaterial.FTeamID = teamwork.FID; // 路线ID
+ viewMaterial.FMaterialID = materialId; // 物料ID
+ viewMaterial.FFactoryID = teamwork.FCreateFactoryID; // 工厂ID
+ viewMaterial.FFactoryCode = teamwork.FCreateFactoryCode; // 工厂Code
+ viewMaterial.FAddDate = DateTime.Now; // 创建日期
+ viewMaterial.FTeamType = 1; // 路线类型
+
+ int vmId = ViewBll.InsertMaterialView(viewMaterial);
+ result.Add("ViewId", vmId);
+
+ // 创建委托工厂视图
+ if (!teamwork.FCreateFactoryID.Equals(teamwork.FProdFactoryID))
+ {
+ viewMaterial = new TFS_ViewMaterial();
+ viewMaterial.FTeamID = teamwork.FID; // 路线ID
+ viewMaterial.FMaterialID = materialId; // 物料ID
+ viewMaterial.FFactoryID = teamwork.FProdFactoryID; // 工厂ID
+ viewMaterial.FFactoryCode = teamwork.FProdFactoryCode; // 工厂Code
+ viewMaterial.FAddDate = DateTime.Now; // 创建日期
+ viewMaterial.FTeamType = 1; // 路线类型
+
+ int prodVmId = ViewBll.InsertMaterialView(viewMaterial);
+ result.Add("ProdViewId", prodVmId);
+ }
+
+ return result;
+ }
+ }
+}
diff --git a/FactorySystemApi/Controllers/ViewController.cs b/FactorySystemApi/Controllers/ViewController.cs
index ca7e973..b3d7c94 100644
--- a/FactorySystemApi/Controllers/ViewController.cs
+++ b/FactorySystemApi/Controllers/ViewController.cs
@@ -57,6 +57,33 @@ namespace FactorySystemApi.Controllers
}, apiResult, Request);
}
+ ///
+ /// 根据物料路线ID获取物料视图
+ ///
+ [HttpPost]
+ public ApiResult GetMaterialViewsByTeamId(Dictionary inParam)
+ {
+ var apiResult = new ApiResult();
+ return ExceptionHelper.TryReturnException(() =>
+ {
+ if (Request.Properties["token"] is ApiAuthInfo user)
+ {
+ int teamId = int.Parse(inParam["teamId"].ToString());
+ int viewType = int.Parse(inParam["viewType"].ToString());
+ int teamType = int.Parse(inParam["teamType"].ToString());
+
+ apiResult.Data = new
+ {
+ columns = _viewBll.GetColumns(),
+ rows = _viewBll.GetMaterialViewsByTeamId(teamId, viewType, teamType, user.FID, out List materialId, out string FGuaranteePeriod, out string FStorageConditions, !inParam.ContainsKey("FAllView")),
+ infos = _viewBll.GetMaterialInfoList(materialId, FGuaranteePeriod, FStorageConditions, user.FID),
+ types = _viewBll.GetMaterialTypeList()
+ };
+
+ }
+ }, apiResult, Request);
+ }
+
///
/// 根据协同ID获取基础表集合
///
diff --git a/FactorySystemApi/FactorySystemApi.csproj b/FactorySystemApi/FactorySystemApi.csproj
index 0d56cf8..c9c47a4 100644
--- a/FactorySystemApi/FactorySystemApi.csproj
+++ b/FactorySystemApi/FactorySystemApi.csproj
@@ -190,7 +190,9 @@
+
+
diff --git a/FactorySystemBll/BaseBll.cs b/FactorySystemBll/BaseBll.cs
index 6119d24..8b7d1a2 100644
--- a/FactorySystemBll/BaseBll.cs
+++ b/FactorySystemBll/BaseBll.cs
@@ -376,6 +376,58 @@ namespace FactorySystemBll
}
}
+
+ public static int CreateMaterialTask(int teamId, int userId, int type, int factoryId)
+ {
+ SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
+ int funcType = (int)Constant.RoleType.物料视图编辑;
+ string tType = "10";
+ int taskId = -1;
+
+ try
+ {
+ List funcVal = db.Queryable().Where(s => s.FType == (int)Constant.BasicCode.物料视图编辑 && s.F1 == tType && s.FState == 1).Select(s => s.FValue).ToList();
+ List users = db.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.FRoleID == b.FRoleID))
+ .Where((a, b) => a.FState == 1 && a.FDeleted != 1 && b.FType == funcType && funcVal.Contains(b.FFunctionID.ToString()))
+ .Where(string.Format("a.FFactoryID in({0})", factoryId))
+ .GroupBy("a.FID,a.FFactoryID,a.FName,a.FUser").Select("a.FID,a.FFactoryID,a.FName,a.FUser").ToList();
+
+ if (users.Count > 0) {
+
+ TFS_FMaterialTask materialTask = new TFS_FMaterialTask();
+ materialTask.FMaterialTeamID = teamId;
+ materialTask.FType = type;
+ materialTask.FFactoryID = factoryId;
+ materialTask.FCanEdit = 1;
+ materialTask.FAddUser = userId;
+ materialTask.FAddDate = DateTime.Now;
+ materialTask.FState = 1;
+
+ if (type == 15)
+ {
+ materialTask.FName = "物料分类";
+ materialTask.FDesc = "物料分类选择";
+ }
+ else
+ {
+ materialTask.FName = "物料视图";
+ materialTask.FDesc = "物料视图编辑";
+ }
+
+ materialTask.FUserID = string.Join(",", users.GroupBy(ss => ss.FID).Select(sss => sss.Key));
+ materialTask.FUserName = string.Join("、", users.GroupBy(ss => ss.FName).Select(sss => sss.Key));
+
+ taskId = db.Insertable(materialTask).IgnoreColumns(true).ExecuteReturnIdentity();
+ }
+ }
+ catch (Exception ex)
+ {
+ taskId = -1;
+ }
+
+ return taskId;
+ }
+
///
/// 发送微信消息
///
diff --git a/FactorySystemBll/FactorySystemBll.csproj b/FactorySystemBll/FactorySystemBll.csproj
index 61867fc..65ee984 100644
--- a/FactorySystemBll/FactorySystemBll.csproj
+++ b/FactorySystemBll/FactorySystemBll.csproj
@@ -51,6 +51,8 @@
+
+
diff --git a/FactorySystemBll/MaterialBll.cs b/FactorySystemBll/MaterialBll.cs
index 2a70ea1..727162c 100644
--- a/FactorySystemBll/MaterialBll.cs
+++ b/FactorySystemBll/MaterialBll.cs
@@ -106,7 +106,6 @@ namespace FactorySystemBll
.Where((a, b) => b.FTeamID == tempId).Select((a, b) => a).ToList();
}
-
///
/// 物料子数据比对
///
@@ -1329,6 +1328,18 @@ namespace FactorySystemBll
return db.Ado.ExecuteCommand(sql);
}
+ public List GetMaterialByFName(string fname)
+ {
+ SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
+ List mainsList = db.Queryable().Where(s => s.FDeleted != (int)Constant.DeleteCode.已删除 && s.FName.Equals(fname)).ToList();
+
+ return mainsList;
+ }
+ public int InsertMaterial(TFS_Material material)
+ {
+ SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
+ return db.Insertable(material).IgnoreColumns(true).ExecuteReturnIdentity();
+ }
}
}
\ No newline at end of file
diff --git a/FactorySystemBll/MaterialTaskBll.cs b/FactorySystemBll/MaterialTaskBll.cs
new file mode 100644
index 0000000..f32779d
--- /dev/null
+++ b/FactorySystemBll/MaterialTaskBll.cs
@@ -0,0 +1,38 @@
+using FactorySystemCommon;
+using FactorySystemModel.RequestModel;
+using FactorySystemModel.ResponseModel;
+using FactorySystemModel.SqlSugarModel;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+
+namespace FactorySystemBll
+{
+ public class MaterialTaskBll
+ {
+ ///
+ /// 获取任务列表
+ ///
+ public List GetList(MaterialTaskQuery mtq, out int totalNumber)
+ {
+ totalNumber = 0;
+ var db = AppSettingsHelper.GetSqlSugar();
+ return db.Queryable((a, b) => new JoinQueryInfos(JoinType.Inner, a.FMaterialTeamID == b.FID))
+ // 事项状态
+ .WhereIF(mtq.FState > 0 && mtq.FState != 99, (a, b) => a.FState == mtq.FState)
+ // 物料号
+ .WhereIF(!string.IsNullOrEmpty(mtq.FMaterialCode), (a, b) => b.FMaterialCode.Equals(mtq.FMaterialCode))
+ // 类型
+ .WhereIF(mtq.FTeamworkType > 0, (a, b) => b.FTeamworkType == mtq.FTeamworkType)
+ // 发起时间
+ .WhereIF(mtq.FDateRange != null && mtq.FDateRange[0] != "", (a, b) => a.FAddDate >= DateTime.Parse(mtq.FDateRange[0]))
+ .WhereIF(mtq.FDateRange != null && mtq.FDateRange[1] != "", (a, b) => a.FAddDate <= DateTime.Parse(mtq.FDateRange[1]))
+ // 责任人
+ //.WhereIF(mtq.FUserID != null, (a, b) => (',' + a.FUserID + ',').Contains(',' + mtq.FUserID + ',') || a.FAddUser.Equals(mtq.FUserID))
+ //// 协同
+ //.WhereIF(mtq.FMaterialTeamID > 0, (a, b) => a.FMaterialTeamID == mtq.FMaterialTeamID).OrderBy((a, b) => a.FID, OrderByType.Desc)
+ .Select("a.*,b.FMaterialName,b.FMaterialCode,b.FTestCode,b.FMaterialType")
+ .ToPageList(mtq.FPageIndex, mtq.FPageSize, ref totalNumber);
+ }
+ }
+}
diff --git a/FactorySystemBll/MaterialTeamworkBll.cs b/FactorySystemBll/MaterialTeamworkBll.cs
new file mode 100644
index 0000000..6971d4c
--- /dev/null
+++ b/FactorySystemBll/MaterialTeamworkBll.cs
@@ -0,0 +1,38 @@
+using FactorySystemCommon;
+using FactorySystemModel.RequestModel;
+using FactorySystemModel.ResponseModel;
+using FactorySystemModel.SqlSugarModel;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+
+namespace FactorySystemBll
+{
+ public class MaterialTeamworkBll
+ {
+ ///
+ /// 获取路线列表
+ ///
+ public List GetList(MaterialTeamworkQuery mtq, out int totalNumber)
+ {
+ totalNumber = 0;
+ var db = AppSettingsHelper.GetSqlSugar();
+ return db.Queryable()
+ // 事项状态
+ .WhereIF(mtq.FState > 0 && mtq.FState != 99, a => a.FState == mtq.FState)
+ // 物料号
+ .WhereIF(!string.IsNullOrEmpty(mtq.FMaterialCode), a => a.FMaterialCode.Equals(mtq.FMaterialCode))
+ // 类型
+ .WhereIF(mtq.FTeamworkType > 0, a => a.FTeamworkType == mtq.FTeamworkType)
+ // 发起时间
+ .WhereIF(mtq.FDateRange != null && mtq.FDateRange[0] != "",a => a.FAddDate >= DateTime.Parse(mtq.FDateRange[0]))
+ .WhereIF(mtq.FDateRange != null && mtq.FDateRange[1] != "", a => a.FAddDate <= DateTime.Parse(mtq.FDateRange[1]))
+ // 责任人
+ //.WhereIF(mtq.FUserID != null, (a, b) => (',' + a.FUserID + ',').Contains(',' + mtq.FUserID + ',') || a.FAddUser.Equals(mtq.FUserID))
+ //// 协同
+ //.WhereIF(mtq.FMaterialTeamID > 0, (a, b) => a.FMaterialTeamID == mtq.FMaterialTeamID).OrderBy((a, b) => a.FID, OrderByType.Desc)
+ .Select()
+ .ToPageList(mtq.FPageIndex, mtq.FPageSize, ref totalNumber);
+ }
+ }
+}
diff --git a/FactorySystemBll/ViewBll.cs b/FactorySystemBll/ViewBll.cs
index cb3b502..0e0d6bc 100644
--- a/FactorySystemBll/ViewBll.cs
+++ b/FactorySystemBll/ViewBll.cs
@@ -93,6 +93,45 @@ namespace FactorySystemBll
return viewList;
}
+ ///
+ /// 根据协同ID获取物料视图
+ ///
+ public List> GetMaterialViewsByTeamId(int teamId, int viewType, int teamType, int currUserId, out List materialId, out string FGuaranteePeriod, out string FStorageConditions, bool byFactory = true)
+ {
+ TUser currUser = null;
+ FGuaranteePeriod = "";
+ FStorageConditions = "";
+ if (byFactory == true) currUser = BaseBll.GetTempModel(currUserId, "FFactoryID");
+ var db = AppSettingsHelper.GetSqlSugar();
+
+ List> viewList = new List>();
+
+ if (viewType == 10)
+ {
+ viewList = db.Queryable((a, b) =>
+ new JoinQueryInfos(JoinType.Inner, 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)
+ .Select