From 2ba495dce3e0c99ed4e59d5ac7b1514e188d4a83 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周四, 25 4月 2024 10:00:19 +0800
Subject: [PATCH] 1
---
iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsControlRuleDetail/WmsControlRuleDetailService.cs | 96 +++++++++---------------------------------------
1 files changed, 18 insertions(+), 78 deletions(-)
diff --git a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsControlRuleDetail/WmsControlRuleDetailService.cs b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsControlRuleDetail/WmsControlRuleDetailService.cs
index 43c03b9..7671ce4 100644
--- a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsControlRuleDetail/WmsControlRuleDetailService.cs
+++ b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsControlRuleDetail/WmsControlRuleDetailService.cs
@@ -50,7 +50,7 @@
public async Task<PageResult<WmsControlRuleDetailOutput>> Page([FromQuery] WmsControlRuleDetailSearch input)
{
var wmsControlRuleDetails = await _wmsControlRuleDetailRep.DetachedEntities
- .Where(input.ControlRuleId != null, u => u.ControlRuleId == input.ControlRuleId)
+ .Where(!string.IsNullOrEmpty(input.RuleCode), u => u.RuleCode == input.RuleCode)
.Where(input.MaxImumqty != null, u => u.MaxImumqty == input.MaxImumqty)
.Where(input.MinImumqty != null, u => u.MinImumqty == input.MinImumqty)
.Where(input.SafeImumqty != null, u => u.SafeImumqty == input.SafeImumqty)
@@ -77,7 +77,7 @@
[HttpGet("WmsControlRuleDetail/listNonPage")]
public async Task<List<WmsControlRuleDetailOutput>> ListNonPageAsync([FromQuery] WmsControlRuleDetailSearchNonPage input)
{
- var pControlRuleId = input.ControlRuleId;
+ var pRuleCode = input.RuleCode?.Trim() ?? "";
var pMaxImumqty = input.MaxImumqty;
var pMinImumqty = input.MinImumqty;
var pSafeImumqty = input.SafeImumqty;
@@ -91,7 +91,7 @@
var pCreatedUserName = input.CreatedUserName?.Trim() ?? "";
var pUpdatedUserName = input.UpdatedUserName?.Trim() ?? "";
var wmsControlRuleDetails = await _wmsControlRuleDetailRep.DetachedEntities
- .Where(pControlRuleId != null, u => u.ControlRuleId == pControlRuleId)
+ .Where(!string.IsNullOrEmpty(pRuleCode), u => u.RuleCode == pRuleCode)
.Where(pMaxImumqty != null, u => u.MaxImumqty == pMaxImumqty)
.Where(pMinImumqty != null, u => u.MinImumqty == pMinImumqty)
.Where(pSafeImumqty != null, u => u.SafeImumqty == pSafeImumqty)
@@ -240,7 +240,7 @@
UpdatedUserName = SysHelper.GetUserName()
};
#region 瀹氫箟鍙橀噺
- var _ControlRuleId = "";//鎺у埗灞炴�ц鍒橧D
+ var _RuleCode = "";//鎺у埗灞炴�ц鍒欑紪鍙�
var _MaxImumqty = "";//鏈�楂樺簱瀛�
var _MinImumqty = "";//鏈�浣庡簱瀛�
var _SafeImumqty = "";//瀹夊叏搴撳瓨
@@ -254,7 +254,7 @@
#region 鍙栧��
- _ControlRuleId = row["鎺у埗灞炴�ц鍒橧D"]?.ToString() ;
+ _RuleCode = row["鎺у埗灞炴�ц鍒欑紪鍙�"]?.ToString() ;
_MaxImumqty = row["鏈�楂樺簱瀛�"]?.ToString() ;
_MinImumqty = row["鏈�浣庡簱瀛�"]?.ToString() ;
_SafeImumqty = row["瀹夊叏搴撳瓨"]?.ToString() ;
@@ -269,33 +269,15 @@
#region 楠岃瘉
- if (string.IsNullOrEmpty(_ControlRuleId))
+ if (string.IsNullOrEmpty(_RuleCode))
{
- throw Oops.Oh($"绗瑊index}琛孾鎺у埗灞炴�ц鍒橧D]{_ControlRuleId}涓嶈兘涓虹┖锛�");
+ throw Oops.Oh($"绗瑊index}琛孾鎺у埗灞炴�ц鍒欑紪鍙穄{_RuleCode}涓嶈兘涓虹┖锛�");
}
- if(!string.IsNullOrEmpty(_ControlRuleId))
+ if(!string.IsNullOrEmpty(_RuleCode))
{
- if (!long.TryParse(_ControlRuleId, out long outControlRuleId)&&!string.IsNullOrEmpty(_ControlRuleId))
- {
- throw Oops.Oh($"绗瑊index}琛孾鎺у埗灞炴�ц鍒橧D]{_ControlRuleId}鍊间笉姝g‘锛�");
- }
- if (outControlRuleId <= 0&&!string.IsNullOrEmpty(_ControlRuleId))
- {
- throw Oops.Oh($"绗瑊index}琛孾鎺у埗灞炴�ц鍒橧D]{_ControlRuleId}鍊间笉鑳藉皬浜庣瓑浜�0锛�");
- }
- else
- {
- addItem.ControlRuleId = outControlRuleId;
- }
-
- }
-
- if (string.IsNullOrEmpty(_MaxImumqty))
- {
- throw Oops.Oh($"绗瑊index}琛孾鏈�楂樺簱瀛榏{_MaxImumqty}涓嶈兘涓虹┖锛�");
- }
-
+ addItem.RuleCode = (string)_RuleCode;
+ }
if(!string.IsNullOrEmpty(_MaxImumqty))
{
if (!decimal.TryParse(_MaxImumqty, out decimal outMaxImumqty)&&!string.IsNullOrEmpty(_MaxImumqty))
@@ -312,12 +294,6 @@
}
}
-
- if (string.IsNullOrEmpty(_MinImumqty))
- {
- throw Oops.Oh($"绗瑊index}琛孾鏈�浣庡簱瀛榏{_MinImumqty}涓嶈兘涓虹┖锛�");
- }
-
if(!string.IsNullOrEmpty(_MinImumqty))
{
if (!decimal.TryParse(_MinImumqty, out decimal outMinImumqty)&&!string.IsNullOrEmpty(_MinImumqty))
@@ -334,12 +310,6 @@
}
}
-
- if (string.IsNullOrEmpty(_SafeImumqty))
- {
- throw Oops.Oh($"绗瑊index}琛孾瀹夊叏搴撳瓨]{_SafeImumqty}涓嶈兘涓虹┖锛�");
- }
-
if(!string.IsNullOrEmpty(_SafeImumqty))
{
if (!decimal.TryParse(_SafeImumqty, out decimal outSafeImumqty)&&!string.IsNullOrEmpty(_SafeImumqty))
@@ -356,12 +326,6 @@
}
}
-
- if (string.IsNullOrEmpty(_MinStorageAge))
- {
- throw Oops.Oh($"绗瑊index}琛孾鏈�灏忓簱榫刔{_MinStorageAge}涓嶈兘涓虹┖锛�");
- }
-
if(!string.IsNullOrEmpty(_MinStorageAge))
{
if (!decimal.TryParse(_MinStorageAge, out decimal outMinStorageAge)&&!string.IsNullOrEmpty(_MinStorageAge))
@@ -378,12 +342,6 @@
}
}
-
- if (string.IsNullOrEmpty(_MaxStorageAge))
- {
- throw Oops.Oh($"绗瑊index}琛孾鏈�澶у簱榫刔{_MaxStorageAge}涓嶈兘涓虹┖锛�");
- }
-
if(!string.IsNullOrEmpty(_MaxStorageAge))
{
if (!decimal.TryParse(_MaxStorageAge, out decimal outMaxStorageAge)&&!string.IsNullOrEmpty(_MaxStorageAge))
@@ -400,12 +358,6 @@
}
}
-
- if (string.IsNullOrEmpty(_IsNotChek))
- {
- throw Oops.Oh($"绗瑊index}琛孾鏄惁鍏嶆]{_IsNotChek}涓嶈兘涓虹┖锛�");
- }
-
if(!string.IsNullOrEmpty(_IsNotChek))
{
if(!_IsNotChek.Equals("鏄�") && !_IsNotChek.Equals("鍚�"))
@@ -418,12 +370,6 @@
addItem.IsNotChek = outIsNotChek;
}
}
-
-
- if (string.IsNullOrEmpty(_ShelfLifeDays))
- {
- throw Oops.Oh($"绗瑊index}琛孾淇濊川鏈熷ぉ鏁癩{_ShelfLifeDays}涓嶈兘涓虹┖锛�");
- }
if(!string.IsNullOrEmpty(_ShelfLifeDays))
{
@@ -441,12 +387,6 @@
}
}
-
- if (string.IsNullOrEmpty(_IsDisabled))
- {
- throw Oops.Oh($"绗瑊index}琛孾鏄惁绂佺敤]{_IsDisabled}涓嶈兘涓虹┖锛�");
- }
-
if(!string.IsNullOrEmpty(_IsDisabled))
{
if(!_IsDisabled.Equals("鏄�") && !_IsDisabled.Equals("鍚�"))
@@ -521,7 +461,7 @@
{
//鏁版嵁鏄惁瀛樺湪閲嶅
isExist = await _wmsControlRuleDetailRep.AnyAsync(u =>
- u.ControlRuleId.Equals(input.ControlRuleId)
+ u.RuleCode.Equals(input.RuleCode)
,false);
}
else//缂栬緫
@@ -532,7 +472,7 @@
//褰撳墠缂栬緫鏁版嵁浠ュ鏄惁瀛樺湪閲嶅
isExist = await _wmsControlRuleDetailRep.AnyAsync(u =>
u.Id != input.Id
- &&u.ControlRuleId.Equals(input.ControlRuleId)
+ &&u.RuleCode.Equals(input.RuleCode)
,false);
}
@@ -555,17 +495,17 @@
}
//鏁版嵁鏄惁閲嶅
var existExcelItem = inputs.GroupBy(g => new {
- g.ControlRuleId
+ g.RuleCode
})
.Where(g => g.Count() > 1)
.Select(s => new {
- s.Key.ControlRuleId
+ s.Key.RuleCode
}).FirstOrDefault();
if (existExcelItem != null)
{
var wmsControlRuleDetail = existExcelItem.Adapt<WmsControlRuleDetail>();
var item= existExcelItem.Adapt<WmsControlRuleDetail>();
- throw Oops.Oh($"瀵煎叆鐨勮〃鏍间腑,鎺у埗灞炴�ц鍒橧D[{item.ControlRuleId}]宸插瓨鍦�");
+ throw Oops.Oh($"瀵煎叆鐨勮〃鏍间腑,鎺у埗灞炴�ц鍒欑紪鍙穂{item.RuleCode}]宸插瓨鍦�");
}
@@ -574,16 +514,16 @@
//鏍规嵁鑱斿悎涓婚敭楠岃瘉鏁版嵁搴撲腑鏄惁宸插瓨鍦ㄧ浉鍚屾暟鎹�
var existDBItem = await _wmsControlRuleDetailRep.DetachedEntities.FirstOrDefaultAsync(w=>
inputs.Select(s=>""
- +s.ControlRuleId
+ +s.RuleCode
)
.Contains(""
- +w.ControlRuleId
+ +w.RuleCode
));
if (existDBItem != null)
{
var wmsControlRuleDetail = existExcelItem.Adapt<WmsControlRuleDetail>();
var item= existExcelItem.Adapt<WmsControlRuleDetail>();
- throw Oops.Oh($"绯荤粺涓�,鎺у埗灞炴�ц鍒橧D[{item.ControlRuleId}]宸插瓨鍦�");
+ throw Oops.Oh($"绯荤粺涓�,鎺у埗灞炴�ц鍒欑紪鍙穂{item.RuleCode}]宸插瓨鍦�");
}
}
--
Gitblit v1.9.3