From 73e52dd9e61cabc5c05da94e7f4c024078f0be31 Mon Sep 17 00:00:00 2001 From: payne <bzrlw2012@163.com> Date: 周四, 25 4月 2024 20:12:45 +0800 Subject: [PATCH] 1 --- DBScript/02_DML/01_InitData.sql | 10 +- iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsPlace/Dto/WmsPlaceInput.cs | 1 iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsContainerPackaging/Dto/WmsContainerPackagingInput.cs | 3 - iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsContainerPackaging/WmsContainerPackagingService.cs | 79 +++++++++++++++++--------- iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsPlace/addForm.vue | 4 iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsPlace/editForm.vue | 4 iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsPlace/WmsPlaceService.cs | 51 +--------------- 7 files changed, 65 insertions(+), 87 deletions(-) diff --git a/DBScript/02_DML/01_InitData.sql b/DBScript/02_DML/01_InitData.sql index a1a8cf6..fc7829d 100644 --- a/DBScript/02_DML/01_InitData.sql +++ b/DBScript/02_DML/01_InitData.sql @@ -71,17 +71,17 @@ INSERT INTO dbo.Base_SerialRuleDetail (Id, SerialRuleNo, SerialType, ItemNo, SourceType, SerialLength, SearchStart, DecimalType, UserDefine, SerialCodeFlag, Description, SerialTypeNo, GetData, PadLeft, IssueStatus, CreatedTime, UpdatedTime, CreatedUserId, CreatedUserName, UpdatedUserId, UpdatedUserName, IsDeleted) -VALUES(40, N'1', 40, 1, N'UD', 15, 0, 1, N'BC_', 0, N'瀹㈡埛缂栧彿-鍓嶇紑', NULL, 1, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); +VALUES(40, N'1', 40, 1, N'UD', 15, 0, 1, N'PL_', 0, N'搴撲綅缂栧彿-鍓嶇紑', NULL, 1, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); INSERT INTO dbo.Base_SerialRuleDetail (Id, SerialRuleNo, SerialType, ItemNo, SourceType, SerialLength, SearchStart, DecimalType, UserDefine, SerialCodeFlag, Description, SerialTypeNo, GetData, PadLeft, IssueStatus, CreatedTime, UpdatedTime, CreatedUserId, CreatedUserName, UpdatedUserId, UpdatedUserName, IsDeleted) -VALUES(41, N'1', 40, 2, N'Y4', 4, 0, 1, NULL, 0, N'瀹㈡埛缂栧彿-骞翠唤', NULL, 1, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); +VALUES(41, N'1', 40, 2, N'Y4', 4, 0, 1, NULL, 0, N'搴撲綅缂栧彿-骞翠唤', NULL, 1, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); INSERT INTO dbo.Base_SerialRuleDetail (Id, SerialRuleNo, SerialType, ItemNo, SourceType, SerialLength, SearchStart, DecimalType, UserDefine, SerialCodeFlag, Description, SerialTypeNo, GetData, PadLeft, IssueStatus, CreatedTime, UpdatedTime, CreatedUserId, CreatedUserName, UpdatedUserId, UpdatedUserName, IsDeleted) -VALUES(42, N'1', 40, 3, N'M2', 4, 0, 1, NULL, 0, N'瀹㈡埛缂栧彿-鏈堜唤', NULL, 1, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); +VALUES(42, N'1', 40, 3, N'M2', 4, 0, 1, NULL, 0, N'搴撲綅缂栧彿-鏈堜唤', NULL, 1, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); INSERT INTO dbo.Base_SerialRuleDetail (Id, SerialRuleNo, SerialType, ItemNo, SourceType, SerialLength, SearchStart, DecimalType, UserDefine, SerialCodeFlag, Description, SerialTypeNo, GetData, PadLeft, IssueStatus, CreatedTime, UpdatedTime, CreatedUserId, CreatedUserName, UpdatedUserId, UpdatedUserName, IsDeleted) -VALUES(43, N'1', 40, 4, N'D2', 4, 0, 1, NULL, 0, N'瀹㈡埛缂栧彿-鏃�', NULL, 1, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); +VALUES(43, N'1', 40, 4, N'D2', 4, 0, 1, NULL, 0, N'搴撲綅缂栧彿-鏃�', NULL, 1, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); INSERT INTO dbo.Base_SerialRuleDetail (Id, SerialRuleNo, SerialType, ItemNo, SourceType, SerialLength, SearchStart, DecimalType, UserDefine, SerialCodeFlag, Description, SerialTypeNo, GetData, PadLeft, IssueStatus, CreatedTime, UpdatedTime, CreatedUserId, CreatedUserName, UpdatedUserId, UpdatedUserName, IsDeleted) -VALUES(44, N'1', 40, 5, N'SN', 3, 0, 1, NULL, 0, N'瀹㈡埛缂栧彿-娴佹按鍙�', NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); +VALUES(44, N'1', 40, 5, N'SN', 3, 0, 1, NULL, 0, N'搴撲綅缂栧彿-娴佹按鍙�', NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); diff --git a/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsPlace/addForm.vue b/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsPlace/addForm.vue index 4588196..bfea8f9 100644 --- a/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsPlace/addForm.vue +++ b/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsPlace/addForm.vue @@ -3,10 +3,10 @@ @cancel="handleCancel"> <a-spin :spinning="confirmLoading"> <a-form :form="form"> - <!-- <a-form-item label="搴撲綅缂栫爜" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> + <a-form-item label="搴撲綅缂栫爜" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> <a-input placeholder="璇疯緭鍏ュ簱浣嶇紪鐮�" v-decorator="['placeCode', { rules: [{ required: true, message: '璇疯緭鍏ュ簱浣嶇紪鐮侊紒' }] }]" /> - </a-form-item> --> + </a-form-item> <a-form-item label="搴撲綅鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> <a-input placeholder="璇疯緭鍏ュ簱浣嶅悕绉�" v-decorator="['placeName', { rules: [{ required: true, message: '璇疯緭鍏ュ簱浣嶅悕绉帮紒' }] }]" /> diff --git a/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsPlace/editForm.vue b/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsPlace/editForm.vue index 0d53342..c616771 100644 --- a/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsPlace/editForm.vue +++ b/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsPlace/editForm.vue @@ -3,10 +3,10 @@ @cancel="handleCancel"> <a-spin :spinning="confirmLoading"> <a-form :form="form"> - <!-- <a-form-item label="搴撲綅缂栫爜" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> + <a-form-item label="搴撲綅缂栫爜" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> <a-input placeholder="璇疯緭鍏ュ簱浣嶇紪鐮�" v-decorator="['placeCode', { rules: [{ required: true, message: '璇疯緭鍏ュ簱浣嶇紪鐮侊紒' }] }]" /> - </a-form-item> --> + </a-form-item> <a-form-item label="搴撲綅鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> <a-input placeholder="璇疯緭鍏ュ簱浣嶅悕绉�" v-decorator="['placeName', { rules: [{ required: true, message: '璇疯緭鍏ュ簱浣嶅悕绉帮紒' }] }]" /> diff --git a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsContainerPackaging/Dto/WmsContainerPackagingInput.cs b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsContainerPackaging/Dto/WmsContainerPackagingInput.cs index 98befd3..4fcd46e 100644 --- a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsContainerPackaging/Dto/WmsContainerPackagingInput.cs +++ b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsContainerPackaging/Dto/WmsContainerPackagingInput.cs @@ -133,7 +133,6 @@ /// <summary> /// 瀹瑰櫒绫诲瀷鍚嶇О /// </summary> - [Required(ErrorMessage = "瀹瑰櫒绫诲瀷鍚嶇О涓嶈兘涓虹┖")] public virtual string ContainerTypeName { get; set; } /// <summary> @@ -145,13 +144,11 @@ /// <summary> /// 鐗╂枡绫诲瀷缂栧彿 /// </summary> - [Required(ErrorMessage = "鐗╂枡绫诲瀷缂栧彿涓嶈兘涓虹┖")] public virtual string MaterialTypeCode { get; set; } /// <summary> /// 鐗╂枡绫诲瀷鍚嶇О /// </summary> - [Required(ErrorMessage = "鐗╂枡绫诲瀷鍚嶇О涓嶈兘涓虹┖")] public virtual string MaterialTypeName { get; set; } /// <summary> diff --git a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsContainerPackaging/WmsContainerPackagingService.cs b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsContainerPackaging/WmsContainerPackagingService.cs index 3b36ac6..958d0a1 100644 --- a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsContainerPackaging/WmsContainerPackagingService.cs +++ b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsContainerPackaging/WmsContainerPackagingService.cs @@ -13,6 +13,8 @@ using System.Web; using System.ComponentModel; using System.Data; +using NetTopologySuite.Algorithm; +using Pipelines.Sockets.Unofficial.Arenas; namespace Admin.NET.Application { /// <summary> @@ -27,18 +29,23 @@ private readonly IRepository<SysDictData, MasterDbContextLocator> _sysDictDataRep; private readonly ISysExcelTemplateService _sysExcelTemplateService; private readonly static object _lock = new(); - + private readonly IRepository<WmsMaterialType, MasterDbContextLocator> _wmsMaterialTypeRep; + private readonly IRepository<WmsContainerType, MasterDbContextLocator> _wmsContainerTypeRep; public WmsContainerPackagingService( IRepository<WmsContainerPackaging,MasterDbContextLocator> wmsContainerPackagingRep ,IRepository<SysDictType, MasterDbContextLocator> sysDictTypeRep ,IRepository<SysDictData, MasterDbContextLocator> sysDictDataRep ,ISysExcelTemplateService sysExcelTemplateService + , IRepository<WmsMaterialType, MasterDbContextLocator> wmsMaterialTypeRep + , IRepository<WmsContainerType, MasterDbContextLocator> wmsContainerTypeRep ) { _wmsContainerPackagingRep = wmsContainerPackagingRep; _sysDictTypeRep = sysDictTypeRep; _sysDictDataRep = sysDictDataRep; _sysExcelTemplateService = sysExcelTemplateService; + _wmsMaterialTypeRep = wmsMaterialTypeRep; + _wmsContainerTypeRep = wmsContainerTypeRep; } /// <summary> @@ -134,7 +141,29 @@ public async Task Add(AddWmsContainerPackagingInput input) { var wmsContainerPackaging = input.Adapt<WmsContainerPackaging>(); - //楠岃瘉 + + var wmsMaterialType=(await _wmsMaterialTypeRep.DetachedEntities.FirstOrDefaultAsync(u => u.Id == input.MaterialTypeId&&u.IsDeleted==false)).Adapt<WmsMaterialTypeOutput>(); + if (wmsMaterialType == null) + { + throw Oops.Oh($"鐗╂枡绫诲瀷涓嶅瓨鍦�"); + } + if (wmsMaterialType.IsDisabled == true) + { + throw Oops.Oh($"鐗╂枡绫诲瀷宸茬鐢�"); + } + var wmsContainerType=(await _wmsContainerTypeRep.DetachedEntities.FirstOrDefaultAsync(u => u.Id == input.ContainerTypeId&& u.IsDeleted == false)).Adapt<WmsContainerTypeOutput>(); + if (wmsContainerType == null) + { + throw Oops.Oh($"瀹瑰櫒绫诲瀷涓嶅瓨鍦�"); + } + if (wmsContainerType.IsDisabled == true) + { + throw Oops.Oh($"瀹瑰櫒绫诲瀷宸茬鐢�"); + } + wmsContainerPackaging.ContainerTypeName = wmsContainerType.TypeName; + wmsContainerPackaging.MaterialTypeName= wmsMaterialType.MaterialTypeName; + wmsContainerPackaging.MaterialTypeCode = wmsMaterialType.MaterialTypeCode; + //楠岃瘉 await CheckExisit(wmsContainerPackaging); wmsContainerPackaging.CreatedUserId = wmsContainerPackaging.UpdatedUserId = SysHelper.GetUserId(); @@ -237,7 +266,6 @@ var _MaterialTypeCode = "";//鐗╂枡绫诲瀷缂栧彿 var _MaterialTypeName = "";//鐗╂枡绫诲瀷鍚嶇О var _BoxQty = "";//鐗╂枡瀹瑰櫒瀹归噺 - var _Id = "";//Id涓婚敭 #endregion @@ -248,7 +276,6 @@ _MaterialTypeCode = row["鐗╂枡绫诲瀷缂栧彿"]?.ToString() ; _MaterialTypeName = row["鐗╂枡绫诲瀷鍚嶇О"]?.ToString() ; _BoxQty = row["鐗╂枡瀹瑰櫒瀹归噺"]?.ToString() ; - _Id = row["Id涓婚敭"]?.ToString() ; #endregion @@ -349,22 +376,7 @@ } } - 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 @@ -402,17 +414,23 @@ /// <returns></returns> private async Task CheckExisit( WmsContainerPackaging input,bool isEdit=false) { - - - bool isExist = false; + + string erorMsg = string.Empty; + bool isExist = false; if (!isEdit)//鏂板 { //鏁版嵁鏄惁瀛樺湪閲嶅 isExist = await _wmsContainerPackagingRep.AnyAsync(u => u.ContainerTypeId.Equals(input.ContainerTypeId) + &&u.MaterialTypeId.Equals(input.MaterialTypeId) ,false); - } + if (isExist) + { + erorMsg = $"绯荤粺涓�,瀹瑰櫒绫诲瀷[{input.ContainerTypeName}]-鐗╂枡绫诲瀷[{input.MaterialTypeName}]鍏崇郴宸插瓨鍦�"; + throw Oops.Oh(erorMsg); + } + } else//缂栬緫 { @@ -421,13 +439,18 @@ //褰撳墠缂栬緫鏁版嵁浠ュ鏄惁瀛樺湪閲嶅 isExist = await _wmsContainerPackagingRep.AnyAsync(u => u.Id != input.Id - &&u.ContainerTypeId.Equals(input.ContainerTypeId) - ,false); - } + &&u.ContainerTypeId.Equals(input.ContainerTypeId) + && u.MaterialTypeId.Equals(input.MaterialTypeId) + , false); + if (isExist) + { + erorMsg = $"绯荤粺涓�,瀹瑰櫒绫诲瀷[{input.ContainerTypeName}]-鐗╂枡绫诲瀷[{input.MaterialTypeName}]鍏崇郴宸插瓨鍦�"; + throw Oops.Oh(erorMsg); + } + } - if (isExist) throw Oops.Oh(ErrorCode.E0001); } /// <summary> diff --git a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsPlace/Dto/WmsPlaceInput.cs b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsPlace/Dto/WmsPlaceInput.cs index 71d8155..fb70725 100644 --- a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsPlace/Dto/WmsPlaceInput.cs +++ b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsPlace/Dto/WmsPlaceInput.cs @@ -351,6 +351,7 @@ /// <summary> /// 搴撲綅缂栫爜 /// </summary> + [Required(ErrorMessage = "搴撲綅缂栫爜涓嶈兘涓虹┖")] public virtual string PlaceCode { get; set; } /// <summary> diff --git a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsPlace/WmsPlaceService.cs b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsPlace/WmsPlaceService.cs index 5ff149b..1239e93 100644 --- a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsPlace/WmsPlaceService.cs +++ b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsPlace/WmsPlaceService.cs @@ -199,8 +199,6 @@ public async Task Add(AddWmsPlaceInput input) { var wmsPlace = input.Adapt<WmsPlace>(); - wmsPlace.PlaceCode =await SerialUtil.GetSerial(EnumSerialType.搴撲綅缂栧彿); - var area = (await _wmsAreaRep.DetachedEntities.FirstOrDefaultAsync(u => u.Id == input.AreaId&&u.IsDeleted==false)).Adapt<WmsAreaOutput>(); if (area == null) { @@ -358,7 +356,6 @@ var _OutSequence = "";//鍑哄簱椤哄簭 var _IsVirtually = "";//鏄惁铏氭嫙 var _IsDisabled = "";//鏄惁绂佺敤 - var _Id = "";//Id涓婚敭 #endregion @@ -367,20 +364,12 @@ _PlaceName = row["搴撲綅鍚嶇О"]?.ToString() ; _PlaceAlias = row["搴撲綅鍒悕"]?.ToString() ; _PlaceType = row["搴撲綅绫诲瀷"]?.ToString() ; - _PlaceTypeName = row["搴撲綅绫诲瀷鍚嶇О"]?.ToString() ; _PlaceStatus = row["搴撲綅灞炴��"]?.ToString() ; - _IsSrmPlace = row["鏄惁鍫嗗灈鏈哄簱浣�"]?.ToString() ; - _SrmPlaceNo = row["鍫嗗灈鏈哄簱浣嶅彿"]?.ToString() ; - _IsRgvPlace = row["鏄惁RGV搴撲綅"]?.ToString() ; - _RgvPlaceNo = row["RGV搴撲綅鍙�"]?.ToString() ; - _IsAgvPlace = row["鏄惁AGV搴撲綅"]?.ToString() ; - _AgvPlaceNo = row["AGV搴撲綅鍙�"]?.ToString() ; - _IsTransPlace = row["鏄惁杈撻�佺嚎搴撲綅"]?.ToString() ; - _TransPlaceNo = row["杈撻�佺嚎搴撲綅鍙�"]?.ToString() ; + _IsActivateWCS = row["鏄惁婵�娲讳笌浠诲姟璋冨害"]?.ToString() ; _Environment = row["搴撳瓨鐜"]?.ToString() ; _AreaCode = row["搴撳尯缂栧彿"]?.ToString() ; - _AreaId = row["鎵�鍦ㄥ簱鍖�"]?.ToString() ; + //_AreaId = row["鎵�鍦ㄥ簱鍖�"]?.ToString() ; _AreaName = row["搴撳尯鍚嶇О"]?.ToString() ; _VerificationCode = row["妫�楠岀爜"]?.ToString() ; _RowNo = row["鎺�"]?.ToString() ; @@ -398,7 +387,6 @@ _OutSequence = row["鍑哄簱椤哄簭"]?.ToString() ; _IsVirtually = row["鏄惁铏氭嫙"]?.ToString() ; _IsDisabled = row["鏄惁绂佺敤"]?.ToString() ; - _Id = row["Id涓婚敭"]?.ToString() ; #endregion @@ -505,22 +493,7 @@ throw Oops.Oh($"绗瑊index}琛孾鎵�鍦ㄥ簱鍖篯{_AreaId}涓嶈兘涓虹┖锛�"); } - if(!string.IsNullOrEmpty(_AreaId)) - { - if (!long.TryParse(_AreaId, out long outAreaId)&&!string.IsNullOrEmpty(_AreaId)) - { - throw Oops.Oh($"绗瑊index}琛孾鎵�鍦ㄥ簱鍖篯{_AreaId}鍊间笉姝g‘锛�"); - } - if (outAreaId <= 0&&!string.IsNullOrEmpty(_AreaId)) - { - throw Oops.Oh($"绗瑊index}琛孾鎵�鍦ㄥ簱鍖篯{_AreaId}鍊间笉鑳藉皬浜庣瓑浜�0锛�"); - } - else - { - addItem.AreaId = outAreaId; - } - - } + if(!string.IsNullOrEmpty(_AreaName)) { addItem.AreaName = (string)_AreaName; @@ -726,23 +699,7 @@ 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 -- Gitblit v1.9.3