From d3b0e7b80f8940562147a81772905a96eb467e82 Mon Sep 17 00:00:00 2001
From: Yang <903110162@qq.com>
Date: Sat, 6 May 2023 13:09:26 +0800
Subject: [PATCH] commit by yzf
---
.../Controllers/MaterialController.cs | 26 +++++++++++++++++++
.../Controllers/ViewController.cs | 11 +++++++-
FactorySystemBll/HalfMaterialTeamworkBll.cs | 4 +--
FactorySystemBll/MaterialBll.cs | 6 +++++
FactorySystemBll/TeamworkBll.cs | 2 +-
FactorySystemBll/ViewBll.cs | 14 +++++++---
6 files changed, 56 insertions(+), 7 deletions(-)
diff --git a/FactorySystemApi/Controllers/MaterialController.cs b/FactorySystemApi/Controllers/MaterialController.cs
index 773cb28..6a667fa 100644
--- a/FactorySystemApi/Controllers/MaterialController.cs
+++ b/FactorySystemApi/Controllers/MaterialController.cs
@@ -171,6 +171,30 @@ namespace FactorySystemApi.Controllers
}, apiResult, Request, inParam);
}
+ ///
+ /// 查询物料
+ ///
+ [HttpPost]
+ public ApiResult GetMaterialById(Dictionary inParam)
+ {
+ ApiResult apiResult = new ApiResult();
+ return ExceptionHelper.TryReturnException(() =>
+ {
+ if (inParam == null || inParam.Count < 0)
+ {
+ apiResult.Error("未接收到参数");
+ }
+ else if (inParam.ContainsKey("ID"))
+ {
+ apiResult.Data = MaterialBll.GetMaterialById(int.Parse(inParam["ID"].ToString()));
+ }
+ else
+ {
+ apiResult.Error("缺少查询参数");
+ }
+ }, apiResult, Request, inParam);
+ }
+
///
/// 物料查询接口(对方查询)
///
@@ -255,6 +279,8 @@ namespace FactorySystemApi.Controllers
}
+
+
///
/// 导出SAP视图
diff --git a/FactorySystemApi/Controllers/ViewController.cs b/FactorySystemApi/Controllers/ViewController.cs
index d1ee45d..74bdeb6 100644
--- a/FactorySystemApi/Controllers/ViewController.cs
+++ b/FactorySystemApi/Controllers/ViewController.cs
@@ -129,7 +129,16 @@ namespace FactorySystemApi.Controllers
return ExceptionHelper.TryReturnException(() => {
if (!string.IsNullOrWhiteSpace(inParam["tempId"].ToString()))
{
- apiResult.Data = _viewBll.EexcSql(int.Parse(inParam["tempId"].ToString()));
+
+ var data = _viewBll.EexcSql(int.Parse(inParam["tempId"].ToString()));
+ if (data != null)
+ {
+ apiResult.Data = data;
+ }
+ else
+ {
+ apiResult.Error("未找到物料");
+ }
}
else
{
diff --git a/FactorySystemBll/HalfMaterialTeamworkBll.cs b/FactorySystemBll/HalfMaterialTeamworkBll.cs
index b313b1d..8b92476 100644
--- a/FactorySystemBll/HalfMaterialTeamworkBll.cs
+++ b/FactorySystemBll/HalfMaterialTeamworkBll.cs
@@ -408,8 +408,8 @@ namespace FactorySystemBll
int oldId = mItem.FID, oldParent = mItem.FParentID;
Expression> expression;
- if (string.IsNullOrEmpty(mItem.FCode)) expression = s => s.FPlmCode == mItem.FPlmCode && s.FVersionCode == mItem.FVersionCode;
- else expression = s => s.FCode == mItem.FCode && s.FVersionCode == mItem.FVersionCode;
+ if (string.IsNullOrEmpty(mItem.FCode)) expression = s => s.FPlmCode == mItem.FPlmCode && s.FVersionCode == mItem.FVersionCode&&s.FID==mItem.FID;
+ else expression = s => s.FCode == mItem.FCode && s.FVersionCode == mItem.FVersionCode && s.FID == mItem.FID;
TFS_Material mData = db.Queryable().Where(expression).First();
if (mData == null)//没物料新增物料
diff --git a/FactorySystemBll/MaterialBll.cs b/FactorySystemBll/MaterialBll.cs
index 927b52f..a0db5d8 100644
--- a/FactorySystemBll/MaterialBll.cs
+++ b/FactorySystemBll/MaterialBll.cs
@@ -106,6 +106,12 @@ namespace FactorySystemBll
.Where((a, b) => b.FTeamID == tempId).Select((a, b) => a).ToList();
}
+ public TFS_Material GetMaterialById(int id)
+ {
+ return BaseBll.GetTempModel("FID=" + id);
+ }
+
+
///
/// 物料子数据比对
///
diff --git a/FactorySystemBll/TeamworkBll.cs b/FactorySystemBll/TeamworkBll.cs
index 0592d00..c666922 100644
--- a/FactorySystemBll/TeamworkBll.cs
+++ b/FactorySystemBll/TeamworkBll.cs
@@ -79,7 +79,7 @@ namespace FactorySystemBll
}
}
string searchKey = "a.FID,a.FSaleCode,a.FTestCode,a.FViewType,a.FMdmCode,a.FFormulaID,a.FWeightUnit,a.FBomState,a.FProgress," +
- "a.FDeleted,a.FAddUser,a.FAddDate,a.FEditDate,b.FName FAddUserName,a.FFormulaName,a.FFormulaTestCode,a.FMaterialHalfIDs";
+ "a.FDeleted,a.FAddUser,a.FAddDate,a.FEditDate,b.FName FAddUserName,a.FFormulaName,a.FFormulaTestCode,a.FMaterialHalfIDs,a.FCreateFactoryID";
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
var temp = db.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.FAddUser == b.FID)).Select(searchKey);
List resultList = db.Queryable(temp).Where(string.Join(" and ", paramName), paramVal)
diff --git a/FactorySystemBll/ViewBll.cs b/FactorySystemBll/ViewBll.cs
index 54f1661..0a2773b 100644
--- a/FactorySystemBll/ViewBll.cs
+++ b/FactorySystemBll/ViewBll.cs
@@ -81,7 +81,7 @@ namespace FactorySystemBll
new JoinQueryInfos(JoinType.Inner, a.FMaterialID == b.FID))
.Where((a, b) => a.FTeamID == teamId)
.WhereIF(currUser != null, (a, b) => a.FFactoryID == currUser.FFactoryID)
- .WhereIF(viewType > 0, (a, b) => a.FViewType == 2)
+ .WhereIF(viewType > 0, (a, b) => a.FViewType == 1)
.Select