From 823e5cae379ee1a259f79060ca0015d381c61f79 Mon Sep 17 00:00:00 2001
From: xwt <2740516069@qq.com>
Date: 星期六, 16 八月 2025 08:32:11 +0800
Subject: [PATCH] 入库检,来料检显示权限
---
StandardInterface/MES.Service/service/CgthSqManager.cs | 38 ++++++++++++++++++++++++++++++++++++--
1 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/StandardInterface/MES.Service/service/CgthSqManager.cs b/StandardInterface/MES.Service/service/CgthSqManager.cs
index ec617f7..59e979c 100644
--- a/StandardInterface/MES.Service/service/CgthSqManager.cs
+++ b/StandardInterface/MES.Service/service/CgthSqManager.cs
@@ -115,14 +115,48 @@
private bool UpdateData(SqlSugarScope db, CgthSq mesWomCgth,
List<CgthSqDetail> mesWomcabs)
{
- var decimals = mesWomcabs.Select(s => s.Id).ToArray();
+ //var decimals = mesWomcabs.Select(s => s.Id).ToArray();
+
+ //鎵爜涓嶅厑璁稿垹闄�
+ var hasMaterialOut = db.Queryable<MesInvItemOuts>()
+ .Any(x => x.WorkNo == mesWomCgth.BillNo);
+
+ if (hasMaterialOut)
+ {
+ throw new Exception($"MES鏈夐鏂欒褰曪紝鍗曞彿锛歿mesWomCgth.BillNo}锛屼笉鑳藉垹闄わ紒");
+ }
+ /*
var update = base.DeleteById(mesWomCgth.Id);
var insertOrUpdate = db
.Deleteable<CgthSqDetail>().In(decimals)
.ExecuteCommand() > 0;
- if (update && insertOrUpdate) return true;
+ if (update && insertOrUpdate) return true;*/
+ // throw new NotImplementedException("鏇存柊澶辫触");
+
+ var decimals = mesWomcabs
+ ?.Where(x => x.Id.HasValue)
+ .Select(x => x.Id.Value)
+ .ToArray() ?? new decimal[0];
+ var update = true;
+ if (mesWomCgth != null)
+ {
+ if (mesWomCgth.Id != null)
+ {
+ update = base.DeleteById(mesWomCgth.Id);
+ }
+ }
+ var insertOrUpdate = true;
+ if (decimals != null && decimals.Length > 0)
+ {
+ insertOrUpdate = db.Deleteable<CgthSqDetail>().In(decimals).ExecuteCommand() > 0;
+ }
+
+ if (update && insertOrUpdate)
+ {
+ return true;
+ }
throw new NotImplementedException("鏇存柊澶辫触");
}
private bool SaveOrUpdateData(SqlSugarScope db, CgthSq mesWomcaa,
--
Gitblit v1.9.3