From b57a0b5d5f2712417d5777e01f8615f670d22584 Mon Sep 17 00:00:00 2001
From: payne <bzrlw2012@163.com>
Date: 周四, 25 4月 2024 11:21:33 +0800
Subject: [PATCH] 控制规则明细调整
---
iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsControlRuleDetail/WmsControlRuleDetailService.cs | 78 ++++++++++++++++-----------------------
iWare_RawMaterialWarehouse_Wms/Admin.NET.Web.Entry/wwwroot/ExcelTemplateFile/WmsControlRuleDetailImport.xlsx | 0
iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsControlRuleDetail/Dto/WmsControlRuleDetailOutput.cs | 5 ++
iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsControlRuleDetail/Dto/WmsControlRuleDetailInput.cs | 16 ++++++-
iWare_RawMaterialWarehouse_Wms/Admin.NET.Core/Entity/WmsBase/WmsControlRuleDetail.cs | 9 ++++
5 files changed, 58 insertions(+), 50 deletions(-)
diff --git a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsControlRuleDetail/Dto/WmsControlRuleDetailInput.cs b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsControlRuleDetail/Dto/WmsControlRuleDetailInput.cs
index e1f020b..c32a470 100644
--- a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsControlRuleDetail/Dto/WmsControlRuleDetailInput.cs
+++ b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsControlRuleDetail/Dto/WmsControlRuleDetailInput.cs
@@ -16,6 +16,11 @@
public virtual string RuleCode { get; set; }
/// <summary>
+ /// 鎺у埗灞炴�ц鍒欏悕绉�
+ /// </summary>
+ public virtual string RuleName { get; set; }
+
+ /// <summary>
/// 鏈�楂樺簱瀛�
/// </summary>
public virtual decimal? MaxImumqty { get; set; }
@@ -88,6 +93,11 @@
public virtual string RuleCode { get; set; }
/// <summary>
+ /// 鎺у埗灞炴�ц鍒欏悕绉�
+ /// </summary>
+ public virtual string RuleName { get; set; }
+
+ /// <summary>
/// 鏈�楂樺簱瀛�
/// </summary>
public virtual decimal? MaxImumqty { get; set; }
@@ -155,10 +165,10 @@
public class WmsControlRuleDetailInput
{
/// <summary>
- /// 鎺у埗灞炴�ц鍒欑紪鍙�
+ /// 鎺у埗灞炴�ц鍒欏悕绉�
/// </summary>
- [Required(ErrorMessage = "鎺у埗灞炴�ц鍒欑紪鍙蜂笉鑳戒负绌�")]
- public virtual string RuleCode { get; set; }
+ [Required(ErrorMessage = "鎺у埗灞炴�ц鍒欏悕绉颁笉鑳戒负绌�")]
+ public virtual string RuleName { get; set; }
/// <summary>
/// 鏈�楂樺簱瀛�
diff --git a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsControlRuleDetail/Dto/WmsControlRuleDetailOutput.cs b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsControlRuleDetail/Dto/WmsControlRuleDetailOutput.cs
index d47a984..4a0476d 100644
--- a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsControlRuleDetail/Dto/WmsControlRuleDetailOutput.cs
+++ b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsControlRuleDetail/Dto/WmsControlRuleDetailOutput.cs
@@ -14,6 +14,11 @@
public string RuleCode { get; set; }
/// <summary>
+ /// 鎺у埗灞炴�ц鍒欏悕绉�
+ /// </summary>
+ public string RuleName { get; set; }
+
+ /// <summary>
/// 鏈�楂樺簱瀛�
/// </summary>
public decimal? MaxImumqty { get; set; }
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 7671ce4..5f4405c 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
@@ -51,6 +51,7 @@
{
var wmsControlRuleDetails = await _wmsControlRuleDetailRep.DetachedEntities
.Where(!string.IsNullOrEmpty(input.RuleCode), u => u.RuleCode == input.RuleCode)
+ .Where(!string.IsNullOrEmpty(input.RuleName), u => u.RuleName == input.RuleName)
.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)
@@ -78,6 +79,7 @@
public async Task<List<WmsControlRuleDetailOutput>> ListNonPageAsync([FromQuery] WmsControlRuleDetailSearchNonPage input)
{
var pRuleCode = input.RuleCode?.Trim() ?? "";
+ var pRuleName = input.RuleName?.Trim() ?? "";
var pMaxImumqty = input.MaxImumqty;
var pMinImumqty = input.MinImumqty;
var pSafeImumqty = input.SafeImumqty;
@@ -92,6 +94,7 @@
var pUpdatedUserName = input.UpdatedUserName?.Trim() ?? "";
var wmsControlRuleDetails = await _wmsControlRuleDetailRep.DetachedEntities
.Where(!string.IsNullOrEmpty(pRuleCode), u => u.RuleCode == pRuleCode)
+ .Where(!string.IsNullOrEmpty(pRuleName), u => u.RuleName == pRuleName)
.Where(pMaxImumqty != null, u => u.MaxImumqty == pMaxImumqty)
.Where(pMinImumqty != null, u => u.MinImumqty == pMinImumqty)
.Where(pSafeImumqty != null, u => u.SafeImumqty == pSafeImumqty)
@@ -143,7 +146,8 @@
public async Task Add(AddWmsControlRuleDetailInput input)
{
var wmsControlRuleDetail = input.Adapt<WmsControlRuleDetail>();
- //楠岃瘉
+ wmsControlRuleDetail.RuleCode = Yitter.IdGenerator.YitIdHelper.NextId().ToString();//TODO 瑕佽皟鐢ㄧ敓鎴� 缂栧彿鐨勬柟娉� 鍏堢敤闆姳ID
+ //楠岃瘉
await CheckExisit(wmsControlRuleDetail);
wmsControlRuleDetail.CreatedUserId = wmsControlRuleDetail.UpdatedUserId = SysHelper.GetUserId();
@@ -240,7 +244,7 @@
UpdatedUserName = SysHelper.GetUserName()
};
#region 瀹氫箟鍙橀噺
- var _RuleCode = "";//鎺у埗灞炴�ц鍒欑紪鍙�
+ var _RuleName = "";//鎺у埗灞炴�ц鍒欏悕绉�
var _MaxImumqty = "";//鏈�楂樺簱瀛�
var _MinImumqty = "";//鏈�浣庡簱瀛�
var _SafeImumqty = "";//瀹夊叏搴撳瓨
@@ -249,12 +253,11 @@
var _IsNotChek = "";//鏄惁鍏嶆
var _ShelfLifeDays = "";//淇濊川鏈熷ぉ鏁�
var _IsDisabled = "";//鏄惁绂佺敤
- var _Id = "";//Id涓婚敭
#endregion
#region 鍙栧��
- _RuleCode = row["鎺у埗灞炴�ц鍒欑紪鍙�"]?.ToString() ;
+ _RuleName = row["鎺у埗灞炴�ц鍒欏悕绉�"]?.ToString() ;
_MaxImumqty = row["鏈�楂樺簱瀛�"]?.ToString() ;
_MinImumqty = row["鏈�浣庡簱瀛�"]?.ToString() ;
_SafeImumqty = row["瀹夊叏搴撳瓨"]?.ToString() ;
@@ -263,20 +266,20 @@
_IsNotChek = row["鏄惁鍏嶆"]?.ToString() ;
_ShelfLifeDays = row["淇濊川鏈熷ぉ鏁�"]?.ToString() ;
_IsDisabled = row["鏄惁绂佺敤"]?.ToString() ;
- _Id = row["Id涓婚敭"]?.ToString() ;
- #endregion
-
-
- #region 楠岃瘉
-
- if (string.IsNullOrEmpty(_RuleCode))
+
+ #endregion
+
+
+ #region 楠岃瘉
+
+ if (string.IsNullOrEmpty(_RuleName))
{
- throw Oops.Oh($"绗瑊index}琛孾鎺у埗灞炴�ц鍒欑紪鍙穄{_RuleCode}涓嶈兘涓虹┖锛�");
+ throw Oops.Oh($"绗瑊index}琛孾鎺у埗灞炴�ц鍒欏悕绉癩{_RuleName}涓嶈兘涓虹┖锛�");
}
- if(!string.IsNullOrEmpty(_RuleCode))
+ if(!string.IsNullOrEmpty(_RuleName))
{
- addItem.RuleCode = (string)_RuleCode;
+ addItem.RuleName = (string)_RuleName;
}
if(!string.IsNullOrEmpty(_MaxImumqty))
{
@@ -369,7 +372,7 @@
bool outIsNotChek = _IsNotChek.Equals("鏄�") ? true : false;
addItem.IsNotChek = outIsNotChek;
}
- }
+ }
if(!string.IsNullOrEmpty(_ShelfLifeDays))
{
@@ -399,27 +402,12 @@
addItem.IsDisabled = outIsDisabled;
}
}
-
- if(!string.IsNullOrEmpty(_Id))
- {
- if (!long.TryParse(_Id, out long outId)&&!string.IsNullOrEmpty(_Id))
- {
- throw Oops.Oh($"绗瑊index}琛孾Id涓婚敭]{_Id}鍊间笉姝g‘锛�");
- }
- if (outId <= 0&&!string.IsNullOrEmpty(_Id))
- {
- throw Oops.Oh($"绗瑊index}琛孾Id涓婚敭]{_Id}鍊间笉鑳藉皬浜庣瓑浜�0锛�");
- }
- else
- {
- addItem.Id = outId;
- }
-
- }
- #endregion
-
-
+
+ #endregion
+
+
+ addItem.RuleCode = Yitter.IdGenerator.YitIdHelper.NextId().ToString();//TODO 瑕佽皟鐢ㄧ敓鎴� 缂栧彿鐨勬柟娉� 鍏堢敤闆姳ID
details.Add(addItem);
}
//楠岄噸
@@ -461,7 +449,7 @@
{
//鏁版嵁鏄惁瀛樺湪閲嶅
isExist = await _wmsControlRuleDetailRep.AnyAsync(u =>
- u.RuleCode.Equals(input.RuleCode)
+ u.RuleName.Equals(input.RuleName)
,false);
}
else//缂栬緫
@@ -472,7 +460,7 @@
//褰撳墠缂栬緫鏁版嵁浠ュ鏄惁瀛樺湪閲嶅
isExist = await _wmsControlRuleDetailRep.AnyAsync(u =>
u.Id != input.Id
- &&u.RuleCode.Equals(input.RuleCode)
+ &&u.RuleName.Equals(input.RuleName)
,false);
}
@@ -495,17 +483,16 @@
}
//鏁版嵁鏄惁閲嶅
var existExcelItem = inputs.GroupBy(g => new {
- g.RuleCode
+ g.RuleName
})
.Where(g => g.Count() > 1)
.Select(s => new {
- s.Key.RuleCode
+ s.Key.RuleName
}).FirstOrDefault();
if (existExcelItem != null)
{
- var wmsControlRuleDetail = existExcelItem.Adapt<WmsControlRuleDetail>();
var item= existExcelItem.Adapt<WmsControlRuleDetail>();
- throw Oops.Oh($"瀵煎叆鐨勮〃鏍间腑,鎺у埗灞炴�ц鍒欑紪鍙穂{item.RuleCode}]宸插瓨鍦�");
+ throw Oops.Oh($"瀵煎叆鐨勮〃鏍间腑,鎺у埗灞炴�ц鍒欏悕绉癧{item.RuleName}]宸插瓨鍦�");
}
@@ -514,16 +501,15 @@
//鏍规嵁鑱斿悎涓婚敭楠岃瘉鏁版嵁搴撲腑鏄惁宸插瓨鍦ㄧ浉鍚屾暟鎹�
var existDBItem = await _wmsControlRuleDetailRep.DetachedEntities.FirstOrDefaultAsync(w=>
inputs.Select(s=>""
- +s.RuleCode
+ +s.RuleName
)
.Contains(""
- +w.RuleCode
+ +w.RuleName
));
if (existDBItem != null)
{
- var wmsControlRuleDetail = existExcelItem.Adapt<WmsControlRuleDetail>();
- var item= existExcelItem.Adapt<WmsControlRuleDetail>();
- throw Oops.Oh($"绯荤粺涓�,鎺у埗灞炴�ц鍒欑紪鍙穂{item.RuleCode}]宸插瓨鍦�");
+ var item= existDBItem.Adapt<WmsControlRuleDetail>();
+ throw Oops.Oh($"绯荤粺涓�,鎺у埗灞炴�ц鍒欏悕绉癧{item.RuleName}]宸插瓨鍦�");
}
}
diff --git a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Core/Entity/WmsBase/WmsControlRuleDetail.cs b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Core/Entity/WmsBase/WmsControlRuleDetail.cs
index 79a2af2..89903e4 100644
--- a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Core/Entity/WmsBase/WmsControlRuleDetail.cs
+++ b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Core/Entity/WmsBase/WmsControlRuleDetail.cs
@@ -26,6 +26,13 @@
[MaxLength(50)]
public string RuleCode { get; set; }
+ /// <summary>
+ /// 鎺у埗灞炴�ц鍒欏悕绉�
+ /// </summary>
+ [Comment("鎺у埗灞炴�ц鍒欏悕绉�")]
+ [Required]
+ [MaxLength(50)]
+ public string RuleName { get; set; }
/// <summary>
/// 鏈�楂樺簱瀛�
@@ -77,7 +84,7 @@
/// </summary>
[Comment("鏄惁鍏嶆")]
- public bool? IsNotChek { get; set; }
+ public bool IsNotChek { get; set; }
/// <summary>
diff --git a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Web.Entry/wwwroot/ExcelTemplateFile/WmsControlRuleDetailImport.xlsx b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Web.Entry/wwwroot/ExcelTemplateFile/WmsControlRuleDetailImport.xlsx
index 7dc82f5..a7e7374 100644
--- a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Web.Entry/wwwroot/ExcelTemplateFile/WmsControlRuleDetailImport.xlsx
+++ b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Web.Entry/wwwroot/ExcelTemplateFile/WmsControlRuleDetailImport.xlsx
Binary files differ
--
Gitblit v1.9.3