From f80c11c8b2a20c5c12f87607085508c1f596cf7b Mon Sep 17 00:00:00 2001 From: ndbs Date: Mon, 6 Jun 2022 16:33:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=99=E6=9D=90=E5=BA=93=E5=AD=98=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=88=A4=E6=96=AD=E9=87=8D=E5=A4=8D=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/TextbookInOutController.cs | 13 +++++- .../TextbookInOut/TextbookInOutBLL.cs | 23 +++++++++- .../TextbookInOut/TextbookInOutIBLL.cs | 18 +++++++- .../TextbookInOut/TextbookInOutService.cs | 44 +++++++++++++++++++ 4 files changed, 92 insertions(+), 6 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/TextbookInOutController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/TextbookInOutController.cs index 623923401..7f209805e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/TextbookInOutController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/TextbookInOutController.cs @@ -170,8 +170,17 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers entity.UpTime = DateTime.Now; entity.UpUserID = loginUserInfo.userId; } - textbookInOutIBLL.SaveEntity(keyValue, entity); - return Success("保存成功!"); + int RepetitionList = textbookInOutIBLL.GetRepetitions(entity.ID,entity.LessonNo, entity.TextBookNo, entity.TextBookName, entity.PublishNo, entity.Publisher, entity.Edition, entity.Impression); + + if (RepetitionList > 0) + { + return Fail("已存在相同库存单,请使用教材入库功能!"); + } + else + { + textbookInOutIBLL.SaveEntity(keyValue, entity); + return Success("保存成功!"); + } } /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutBLL.cs index 1569dea65..86c8079a2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutBLL.cs @@ -23,7 +23,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// /// 查询参数 /// - public IEnumerable GetList( string queryJson ) + public IEnumerable GetList(string queryJson) { try { @@ -66,7 +66,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } - + /// /// 获取实体数据 /// @@ -210,6 +210,25 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } + + public int GetRepetitions(string keyValue, string LessonNo, string TextBookNo, string TextBookName, string PublishNo, string Publisher, string Edition, string Impression) + { + try + { + return textbookInOutService.GetRepetitions(keyValue, LessonNo, TextBookNo, TextBookName, PublishNo, Publisher, Edition, Impression); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutIBLL.cs index 41509ec3b..5e5d55ea3 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutIBLL.cs @@ -20,7 +20,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// /// 查询参数 /// - IEnumerable GetList( string queryJson ); + IEnumerable GetList(string queryJson); /// /// 获取列表分页数据 /// @@ -66,7 +66,21 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// /// void SubmitEntity(string keyValue); - + + /// + /// 去重 + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + int GetRepetitions(string keyValue, string LessonNo, string TextBookNo, string TextBookName, string PublishNo, string Publisher, string Edition, string Impression); + #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutService.cs index 49055a6e5..890695eb9 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TextbookInOut/TextbookInOutService.cs @@ -309,5 +309,49 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } #endregion + /// + /// 去重 + /// + /// + /// + /// + /// + /// + /// + /// + /// + public int GetRepetitions(string keyValue, string LessonNo, string TextBookNo, string TextBookName, string PublishNo, string Publisher, string Edition, string Impression) + { + try + { + var HistoryList = new List(); + + if (!string.IsNullOrEmpty(keyValue)) + { + HistoryList = BaseRepository("CollegeMIS").FindList( + x => x.ID == keyValue && x.LessonNo == LessonNo && x.TextBookNo == TextBookNo && x.TextBookName == TextBookName && x.PublishNo == PublishNo && + x.Publisher == Publisher && x.Edition == Edition && x.Impression == Impression && x.IsDel == 0).ToList(); + } + else + { + HistoryList = BaseRepository("CollegeMIS").FindList( + x => x.LessonNo == LessonNo && x.TextBookNo == TextBookNo && x.TextBookName == TextBookName && x.PublishNo == PublishNo && + x.Publisher == Publisher && x.Edition == Edition && x.Impression == Impression && x.IsDel == 0).ToList(); + } + + return HistoryList.Count; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } } }