diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/DTOs/EquipmentDTO.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/DTOs/EquipmentDTO.cs index 58c7c3c04..d6b8b07b6 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/DTOs/EquipmentDTO.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/DTOs/EquipmentDTO.cs @@ -7,7 +7,7 @@ namespace Win_in.Sfs.Basedata.Application.Contracts; using System; using System.Collections.Generic; -[Display(Name = "物品基本信息")] +[Display(Name = "器具基本信息")] public class EquipmentDTO : SfsBaseDataDTOBase, IHasCode { @@ -51,4 +51,11 @@ public class EquipmentDTO : SfsBaseDataDTOBase, IHasCode [Display(Name = "创建时间")] public DateTime CreatTime { get; set; } = DateTime.Now; + + /// + /// 标包数量 + /// + [Display(Name = "标包数")] + public decimal StdQty { get; set; } + } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentEditInput.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentEditInput.cs index aedd223cd..e76aa7b41 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentEditInput.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentEditInput.cs @@ -46,7 +46,11 @@ public class EquipmentEditInput : SfsBaseDataCreateOrUpdateInputBase [Display(Name = "创建时间")] public DateTime CreatTime { get; set; }=DateTime.Now; - + /// + /// 标包数量 + /// + [Display(Name = "标包数")] + public decimal StdQty { get; set; } //#region Base ///// diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentImportInput.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentImportInput.cs index 03373df2f..35db362f6 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentImportInput.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentImportInput.cs @@ -52,5 +52,13 @@ public class EquipmentImportInput : SfsBaseDataImportInputBase [Display(Name = "创建时间")] public DateTime CreatTime { get; set; } = DateTime.Now; + /// + /// 标包数量 + /// + [Display(Name = "标包数")] + public decimal StdQty { get; set; } + + + } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Kittings/KittingAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Kittings/KittingAppService.cs index 81ebf359c..459292482 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Kittings/KittingAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Kittings/KittingAppService.cs @@ -91,27 +91,23 @@ public class KittingAppService : SfsBaseDataWithCodeAppServiceBase UpdateAsync(Guid id, KittingEditInput input) + public override async Task UpdateAsync(Guid id, KittingEditInput input) { var detailquery = _repository.WithDetails(); var first = detailquery.FirstOrDefault(p => p.Id == id); - if (first.Code == input.Code) - { - throw new UserFriendlyException($"已存在编码:{input.Code}的Kitting箱"); - } - var query = from itm in input.Details - join itm1 in first.Details on itm.PartCode equals itm1.PartCode - select itm; - List errors = new List(); - foreach (var itm in query.ToList()) - { - errors.Add(itm.PartCode); - } - if(errors.Count > 0) - { - throw new UserFriendlyException($"零件号${string.Join(",", errors)}已存在"); - } - return base.UpdateAsync(id, input); + + + var entity = ObjectMapper.Map(input); + entity.SetId(id); + entity.Code = first.Code; + await _repository.UpsertAsync(entity).ConfigureAwait(false); + var firstEntity = detailquery.FirstOrDefault(p => p.Id == id); + + + + return ObjectMapper.Map(first); + + } [HttpPost("update")] @@ -133,6 +129,8 @@ public class KittingAppService : SfsBaseDataWithCodeAppServiceBase(input); await _repository.UpsertAsync(entity).ConfigureAwait(false); + + } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain.Shared/Win_in.Sfs.Basedata.Domain.Shared.csproj b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain.Shared/Win_in.Sfs.Basedata.Domain.Shared.csproj index 3221d386c..9d201acdf 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain.Shared/Win_in.Sfs.Basedata.Domain.Shared.csproj +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain.Shared/Win_in.Sfs.Basedata.Domain.Shared.csproj @@ -1,4 +1,4 @@ - + @@ -9,7 +9,7 @@ - + diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/Equipment.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/Equipment.cs index 97fa77973..f4793b6ac 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/Equipment.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/Equipment.cs @@ -47,6 +47,11 @@ public class Equipment : SfsBaseDataAggregateRootBase, IHasCode /// public DateTime CreatTime { get; set; } + /// + /// 标包数量 + /// + public decimal StdQty { get; set; } + diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Kittings/KittingEfCoreRepository.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Kittings/KittingEfCoreRepository.cs index 6687685bd..f4dba107c 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Kittings/KittingEfCoreRepository.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Kittings/KittingEfCoreRepository.cs @@ -15,7 +15,7 @@ public class KittingEfCoreRepository : SfsBaseDataEfCoreRepositoryBase(); var detail=DbContext.Set(); @@ -72,7 +72,7 @@ public class KittingEfCoreRepository : SfsBaseDataEfCoreRepositoryBase + /// 器具编码 + /// + [Display(Name = "器具编码")] + public string EqptCode { get; set; } + /// + /// 条码编号 + /// + [Display(Name = "条码编号")] + public string BarCode { get; set; } + /// + /// 零件号 + /// + [Display(Name = "零件号")] + public string PartCode { get; set; } + /// + /// 批次 + /// + [Display(Name = "批次")] + public string Batch { get; set; } + /// + /// 库位 + /// + [Display(Name = "库位")] + public string LocCode { get; set; } + /// + /// 数量 + /// + [Display(Name = "数量")] + public decimal Qty { get; set; } + /// + /// 状态 + /// + [Display(Name = "状态")] + public int State { get; set; } + /// + /// 记录类型 + /// + [Display(Name = "记录类型")] + public int Type { get; set; } + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Equipments/EquipmentRecordPermissions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Equipments/EquipmentRecordPermissions.cs new file mode 100644 index 000000000..5a8acb04a --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Equipments/EquipmentRecordPermissions.cs @@ -0,0 +1,22 @@ +using Volo.Abp.Authorization.Permissions; +using Win_in.Sfs.Wms.Store.Domain; +using Win_in.Sfs.Wms.Store.Equipments; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public static class EquipmentRecordPermissions +{ + + public const string Default = StorePermissions.GroupName + "." + nameof(PurchaseOrder); + public const string Create = Default + "." + StorePermissions.CreateStr; + public const string Update = Default + "." + StorePermissions.UpdateStr; + public const string Delete = Default + "." + StorePermissions.DeleteStr; + + public static void AddEquipmentRecordPermission(this PermissionGroupDefinition permissionGroup) + { + var purchaseOrderPermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(EquipmentRecord))); + purchaseOrderPermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr)); + purchaseOrderPermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr)); + purchaseOrderPermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr)); + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Equipments/IEquipmentRecordAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Equipments/IEquipmentRecordAppService.cs new file mode 100644 index 000000000..e35ee92f3 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Equipments/IEquipmentRecordAppService.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Win_in.Sfs.Shared.Application.Contracts; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public interface IEquipmentRecordAppService + : + // ,ISfsStoreMasterAppServiceBase + ISfsCheckStatusAppService + , ISfsUpsertAppService +{ + + ///// + ///// 打开订单明细 + ///// + ///// + //Task OpenDetailAsync(Guid id, Guid detailId); + + ///// + ///// 关闭订单明细 + ///// + ///// + //Task CloseDetailAsync(Guid id, Guid detailId); + + ///// + ///// 更新订单明细 + ///// + ///// + ///// + ///// + //Task UpdateDetailsAsync(string number,List input); + + ///// + ///// 【批量创建】到货通知 (收货单) + ///// + ///// + ///// + //Task> CreateManyAsync(List inputs); + + //Task> GetListBySupplierCodeAsync(string supplierCode, string itemCode); + //Task> GetNoPoBillList(List poBillNo); + //Task CreateOrUpdateAsync(PurchaseOrderEditInput input); +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Equipments/Inputs/EquipmentRecordEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Equipments/Inputs/EquipmentRecordEditInput.cs new file mode 100644 index 000000000..de51993b0 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Equipments/Inputs/EquipmentRecordEditInput.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; +[Display(Name = "器具操作")] +public class EquipmentRecordEditInput + : SfsStoreCreateOrUpdateInputBase +{ + /// + /// 器具编码 + /// + [Display(Name = "器具编码")] + public string EqptCode { get; set; } + /// + /// 条码编号 + /// + [Display(Name = "条码编号")] + public string BarCode { get; set; } + /// + /// 零件号 + /// + [Display(Name = "零件号")] + public string PartCode { get; set; } + /// + /// 批次 + /// + [Display(Name = "批次")] + public string Batch { get; set; } + /// + /// 库位 + /// + [Display(Name = "库位")] + public string LocCode { get; set; } + /// + /// 数量 + /// + [Display(Name = "数量")] + public decimal Qty { get; set; } + /// + /// 状态 + /// + [Display(Name = "状态")] + public int State { get; set; } + /// + /// 记录类型 + /// + [Display(Name = "记录类型")] + public int Type { get; set; } + + +} + + diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Equipments/Inputs/EquipmentRecordImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Equipments/Inputs/EquipmentRecordImportInput.cs new file mode 100644 index 000000000..82901aeda --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Equipments/Inputs/EquipmentRecordImportInput.cs @@ -0,0 +1,53 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Application.Contracts; +using Win_in.Sfs.Shared.Application.Contracts.ExportAndImport; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +[Display(Name = "器具操作")] +public class EquipmentRecordImportInput : SfsStoreImportInputBase +{ + /// + /// 器具编码 + /// + [Display(Name = "器具编码")] + public string EqptCode { get; set; } + /// + /// 条码编号 + /// + [Display(Name = "条码编号")] + public string BarCode { get; set; } + /// + /// 零件号 + /// + [Display(Name = "零件号")] + public string PartCode { get; set; } + /// + /// 批次 + /// + [Display(Name = "批次")] + public string Batch { get; set; } + /// + /// 库位 + /// + [Display(Name = "库位")] + public string LocCode { get; set; } + /// + /// 数量 + /// + [Display(Name = "数量")] + public decimal Qty { get; set; } + /// + /// 状态 + /// + [Display(Name = "状态")] + public int State { get; set; } + /// + /// 记录类型 + /// + [Display(Name = "记录类型")] + public int Type { get; set; } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Equipments/EquipmentAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Equipments/EquipmentAppService.cs new file mode 100644 index 000000000..61e562f50 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Equipments/EquipmentAppService.cs @@ -0,0 +1,159 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Castle.Components.DictionaryAdapter; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Volo.Abp; +using Volo.Abp.Domain.Entities; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.ObjectMapping; +using Win_in.Sfs.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; +using Win_in.Sfs.Wms.Store.Domain.Shared; +using Win_in.Sfs.Wms.Store.Equipments; + +namespace Win_in.Sfs.Wms.Store.Application; + +[Authorize] +[Route($"{StoreConsts.RootPath}Equipment")] +public class EquipmentRecordAppService + : SfsStoreAppServiceBase + , IEquipmentRecordAppService + +{ + private readonly IEquipmentRecordManager _manager; + private readonly IEquipmentRecordRepository _repository; + + public EquipmentRecordAppService( + IEquipmentRecordRepository repository, IEquipmentRecordManager manager + ):base(repository) + { + base.CreatePolicyName = EquipmentRecordPermissions.Create; + base.UpdatePolicyName = EquipmentRecordPermissions.Update; + base.DeletePolicyName = EquipmentRecordPermissions.Delete; + + _manager = manager; + _repository = repository; + } + + + public Task CheckStatusAsync(string number) + { + throw new NotImplementedException(); + } + + public Task UpsertAsync(EquipmentRecordEditInput input) + { + throw new NotImplementedException(); + } + + //[HttpGet("by-batchsize")] + //public virtual async Task> GetToBeProcessedListAsync(int batchSize) + //{ + // var entities = await _manager.GetToBeProcessedListAsync(batchSize).ConfigureAwait(false); + // var dtos = ObjectMapper.Map, List>(entities); + // return dtos; + //} + + //[HttpPost("re-send-by-id/{id}")] + //public virtual async Task ReSendByNumberAsync(Guid id) + //{ + // var EquipmentRecordOld = await _repository.GetAsync(id).ConfigureAwait(false); + // if (EquipmentRecordOld == null) + // { + // throw new UserFriendlyException($"未找到ID为【{id.ToString()}】的数据"); + // } + + // EquipmentRecordOld.Status = EnumEquipmentRecordStatus.Error; + + // var EquipmentRecordNew = new ExchangeData() + // { + // DataAction = exchangeDataOld.DataAction, + // DataContent = exchangeDataOld.DataContent, + // DataIdentityCode = exchangeDataOld.DataIdentityCode, + // DataType = exchangeDataOld.DataType, + // DestinationSystem = exchangeDataOld.DestinationSystem, + // EffectiveDate = exchangeDataOld.EffectiveDate, + // Remark = exchangeDataOld.Remark, + // SourceSystem = exchangeDataOld.SourceSystem, + // WriteTime = DateTime.Now, + // Writer = null, + // }; + // var entityNew= await _repository.InsertAsync(exchangeDataNew).ConfigureAwait(false); + + // exchangeDataOld.Remark = $"在【{DateTime.Now}】时,重新生成了新的接口数据:ID为【{entityNew.Id}】"; + // await _repository.UpdateAsync(exchangeDataOld).ConfigureAwait(false); + + // return new ExchangeDataDTO() { Id = entityNew.Id }; + //} + + //[HttpPost("by-batchsize-post")] + //public virtual async Task> GetToBeProcessedListPostAsync(int batchSize) + //{ + // var resultList=new List(); + + // var entities = await + // (await _repository.GetDbSetAsync().ConfigureAwait(false)) + // .Where(p => p.Status == EnumExchangeDataStatus.Unread) + // .OrderBy(p => p.TyrpNumber) + // .Take(batchSize) + // .ToListAsync().ConfigureAwait(false); + + // foreach (var entity in entities) + // { + // entity.Status = EnumExchangeDataStatus.Success; + // entity.ReadTime = Clock.Now; + // entity.Reader = "DataExchange.Agent"; + // resultList.Add(await _repository.UpdateAsync(entity).ConfigureAwait(false)); + // } + + // var dtos = ObjectMapper.Map, List>(resultList); + // return dtos; + //} + + //[HttpPost("by-batchsize-only-read")] + //public virtual async Task> GetToBeProcessedListOnlyReadAsync(int batchSize) + //{ + // var entities = await + // (await _repository.GetDbSetAsync().ConfigureAwait(false)) + // .Where(p => p.Status == EnumExchangeDataStatus.Unread) + // .OrderBy(p => p.TyrpNumber) + // .Take(batchSize) + // .ToListAsync().ConfigureAwait(false); + + // var dtos = ObjectMapper.Map, List>(entities); + // return dtos; + //} + + //[HttpPost("update-status-by-id-list")] + //public virtual async Task> UpdateStatusByIdListAsync(List list) + //{ + // List listExchangeDatas = new EditableList(); + // var resultList = new List(); + + // foreach (var id in list) + // { + // listExchangeDatas.Add(await _repository.GetAsync(id).ConfigureAwait(false)); + // } + + // listExchangeDatas.ForEach(p => + // { + // p.Status = EnumExchangeDataStatus.Success; + // p.ReadTime = Clock.Now; + // p.Reader = "DataExchange.Agent"; + // }); + + // foreach (var entity in listExchangeDatas) + // { + // resultList.Add(await _repository.UpdateAsync(entity).ConfigureAwait(false)); + // } + + // var dtos = ObjectMapper.Map, List>(resultList); + // return dtos; + //} +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Equipments/EquipmentAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Equipments/EquipmentAutoMapperProfile.cs new file mode 100644 index 000000000..bbffa0718 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Equipments/EquipmentAutoMapperProfile.cs @@ -0,0 +1,43 @@ +using AutoMapper; +using Volo.Abp.AutoMapper; +using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Basedata.Domain; +using Win_in.Sfs.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; +using Win_in.Sfs.Wms.Store.Equipments; + +namespace Win_in.Sfs.Wms.Store.Application; + +public partial class StoreApplicationAutoMapperProfile : Profile +{ + private void EquipmentRecordAutoMapperProfile() + { + CreateMap() + .ReverseMap(); + // CreateMap() + // .IgnoreAuditedObjectProperties() + // .Ignore(x => x.ConcurrencyStamp).Ignore(x => x.Id) + // ; + // CreateMap() + // .IgnoreAuditedObjectProperties() + // .Ignore(x => x.Id) ; + // ; + + // CreateMap() + // .IgnoreAuditedObjectProperties() + // .Ignore(x => x.TenantId) + // //.Ignore(x => x.Remark) + // .Ignore(x => x.ExtraProperties) + // .Ignore(x => x.ConcurrencyStamp) + // ; + + // CreateMap() + // .Ignore(x => x.ReportStatus) + // .Ignore(x => x.ReportReason) + // ; + + // CreateMap() + //; + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs index 8dfb70eb6..465605d0d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs @@ -104,6 +104,7 @@ public partial class StoreApplicationAutoMapperProfile : Profile #endregion ExchangeDataAutoMapperProfile(); + EquipmentRecordAutoMapperProfile(); } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Equipments/EquipmentRecord.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Equipments/EquipmentRecord.cs new file mode 100644 index 000000000..7e7dac3f7 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Equipments/EquipmentRecord.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Equipments; + + +public class EquipmentRecord:SfsAggregateRootBase +{ + /// + /// 器具编码 + /// + public string EqptCode { get; set; } + /// + /// 条码编号 + /// + public string BarCode { get; set; } + /// + /// 零件号 + /// + public string PartCode { get; set; } + /// + /// 批次 + /// + public string Batch { get; set; } + /// + /// 库位 + /// + public string LocCode { get; set; } + /// + /// 数量 + /// + public decimal Qty { get; set; } + /// + /// 状态 + /// + public int State { get; set; } + /// + /// 记录类型 + /// + public int Type { get; set;} + + + + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Equipments/EquipmentRecordDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Equipments/EquipmentRecordDetail.cs new file mode 100644 index 000000000..61a8ce19f --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Equipments/EquipmentRecordDetail.cs @@ -0,0 +1,112 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public class EquipmentRecordDetail : SfsStoreDetailWithQtyEntityBase +//, IHasSupplierPack +{ + ///// + ///// 订单行 + ///// + //public string PoLine { get; set; } + + ///// + ///// 供应商计量单位 + ///// + //public string SupplierPackUom { get; set; } + + ///// + ///// 供应商计量单位 + ///// + //public decimal SupplierPackQty { get; set; } + + ///// + ///// 转换率 + ///// + //public decimal ConvertRate { get; set; } + + ///// + ///// 是否寄存订单 + ///// + //public bool IsConsignment { get; set; } + + ///// + ///// 订单行状态 0:无效1:有效 + ///// + //public EnumOrderStatus LineStatus { get; set; } + + ///// + ///// ERP库位 + ///// + //public string LocationErpCode { get; set; } + + ///// + ///// 项目编号 + ///// + //public string ProjectCode { get; set; } + + ///// + ///// 已发货数量 + ///// + //public decimal ShippedQty { get; set; } + + ///// + ///// 已收货数量 + ///// + //public decimal ReceivedQty { get; set; } + + ///// + ///// 已退货数量 + ///// + //public decimal ReturnedQty { get; set; } + + ///// + ///// 已上架数量 + ///// + //public decimal PutAwayQty { get; set; } + + ///// + ///// 筹措员代码 + ///// + //[Display(Name = "明细-筹措员代码")] + //public string PlanUserCode { get; set; } + + ///// + ///// 生产批次 + ///// + //[Display(Name = "明细-生产批次")] + //public string Lot { get; set; } + + ///// + ///// 要求到货时间 + ///// + //[Display(Name = "明细-要求到货时间")] + //public DateTime PlanArriveDate { get; set; } + + ///// + ///// 明细-类型 暂定:备件是B 辅材是F 生产为空 + ///// + //[Display(Name = "明细-类型")] + //public string Ctype { get; set; } + + ///// + ///// 生产时间 + ///// + //[Display(Name = "明细-生产时间")] + //public DateTime ProduceDate { get; set; } + + ///// + ///// 过期时间 + ///// + //[Display(Name = "明细-过期时间")] + //public DateTime ExpireDate { get; set; } + + ///// + ///// 订单备注 + ///// + //[Display(Name = "明细-订单备注")] + //public string OrderRemark { get; set; } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Equipments/EquipmentRecordManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Equipments/EquipmentRecordManager.cs new file mode 100644 index 000000000..2bdf03217 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Equipments/EquipmentRecordManager.cs @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Domain.Services; +using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Wms.Store.Equipments; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public class EquipmentRecordManager : DomainService, IEquipmentRecordManager +{ + private readonly IEquipmentRecordRepository _repository; + //private readonly IPurchaseReceiptNoteManager _purchaseReceiptNoteManager; + //private readonly ISupplierAppService _supplierApp; + //private readonly IWarehouseAppService _warehouseApp; + + public EquipmentRecordManager(IEquipmentRecordRepository repository + //, IPurchaseReceiptNoteManager purchaseReceiptNoteManager + //, ISupplierAppService supplierApp + // , IWarehouseAppService warehouseApp + ) + { + _repository = repository; + //_purchaseReceiptNoteManager = purchaseReceiptNoteManager; + // _supplierApp = supplierApp; + // _warehouseApp = warehouseApp; + } + /// + ///// 打开订单明细 + ///// + ///// + //public virtual async Task CheckIsCloseAsync(string number,string supplierCode, string itemCode) + //{ + // bool result = false; + // var entitys = await _repository.GetListAsync(p =>p.Number==number && p.Details.Any(y => y.ItemCode == itemCode&&y.LineStatus== EnumOrderStatus.Close) && p.SupplierCode == supplierCode, true).ConfigureAwait(false); + // if (entitys.Count!=0) result = true; + // return result; + //} + ///// + ///// 打开订单明细 + ///// + ///// + //public virtual async Task OpenDetailAsync(Guid id, Guid detailId) + //{ + // var entity = await Repository.GetAsync(id).ConfigureAwait(false); + // Check.NotNull(entity, EntityClassName); + // await entity.OpenDetailAsync(detailId).ConfigureAwait(false); + //} + + ///// + ///// 关闭订单明细 + ///// + ///// + //public virtual async Task CloseDetailAsync(Guid id, Guid detailId) + //{ + // var entity = await Repository.GetAsync(id).ConfigureAwait(false); + // Check.NotNull(entity, EntityClassName); + // await entity.CloseDetailAsync(detailId).ConfigureAwait(false); + //} + + //public override async Task CreateAsync(PurchaseOrder purchaseOrder) + //{ + // //接收到新的采购订单时,更新无PO收货单的PoNumber + // //await _purchaseReceiptNoteManager.AppendPoNumberAsync(purchaseOrder).ConfigureAwait(false); + // purchaseOrder.SetIdAndNumberWithDetails(GuidGenerator, purchaseOrder.Number); + // //不要用base.create 要不会把number覆盖 + // purchaseOrder = await Repository.InsertAsync(purchaseOrder).ConfigureAwait(false); + // await PublishCreatedAsync(purchaseOrder).ConfigureAwait(false); + // return purchaseOrder; + + //} + + ///// + ///// 执行导入 + ///// + //public virtual async Task ImportDataAsync(List mergeEntities, List deleteEntities = null) + //{ + // //if (deleteEntities != null && deleteEntities.Count > 0) + // //{ + // // await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false); + // //} + + // //foreach (var entity in mergeEntities) + // //{ + // // entity.SetIdAndNumberWithDetails(GuidGenerator, await GenerateNumberAsync(nameof(PurchaseOrder), entity.OrderDate).ConfigureAwait(false)); + // //} + + // //await _repository.BulkMergeAsync(mergeEntities).ConfigureAwait(false); + + // //var insertDetails = new List(); + + // //foreach (var item in mergeEntities) + // //{ + // // await SetDetailAsync(item.Details).ConfigureAwait(false); + + // // insertDetails.AddRange(item.Details); + // //} + + // // await _repository.BulkInsertAsync(insertDetails).ConfigureAwait(false); + + //} + + public Task ImportDataAsync(List entities, List deleteEntities = null) + { + throw new NotImplementedException(); + } + + private async Task SetDetailAsync(List details) + { + //foreach (var detail in details) + //{ + // var item = await ItemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + // Check.NotNull(item, "物品代码", $"物品 {detail.ItemCode} 不存在"); + + // if (item != null) + // { + // detail.ItemName = item.Name; + // detail.ItemDesc1 = item.Desc1; + // detail.ItemDesc2 = item.Desc2; + // } + //} + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Equipments/IEquipmentRecordManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Equipments/IEquipmentRecordManager.cs new file mode 100644 index 000000000..b3cfa93e3 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Equipments/IEquipmentRecordManager.cs @@ -0,0 +1,13 @@ +using System; +using System.Threading.Tasks; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Wms.Store.Equipments; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public interface IEquipmentRecordManager :IBulkImportService +{ + //Task OpenDetailAsync(Guid id, Guid detailId); + //Task CloseDetailAsync(Guid id, Guid detailId); + //Task CheckIsCloseAsync(string number, string supplierCode, string itemCode); +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Equipments/IEquipmentRecordRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Equipments/IEquipmentRecordRepository.cs new file mode 100644 index 000000000..07d9b3e91 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Equipments/IEquipmentRecordRepository.cs @@ -0,0 +1,10 @@ +using System.Threading.Tasks; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Wms.Store.Equipments; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public interface IEquipmentRecordRepository : ISfsStoreRepositoryBase, ISfsBulkRepositoryBase +{ + Task UpsertAsync(EquipmentRecord newData); +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Equipments/EquipmentRecordDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Equipments/EquipmentRecordDbContextModelCreatingExtensions.cs new file mode 100644 index 000000000..1457d74ad --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Equipments/EquipmentRecordDbContextModelCreatingExtensions.cs @@ -0,0 +1,76 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore.Modeling; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Wms.Store.Domain; +using Win_in.Sfs.Wms.Store.Equipments; + +namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; + +public static class EquipmentRecordDbContextModelCreatingExtensions +{ + public static void ConfigureEquipmentRecord(this ModelBuilder builder, StoreModelBuilderConfigurationOptions options) + { + builder.Entity(b => + { + //Configure table & schema name + b.ToTable(options.TablePrefix + nameof(EquipmentRecord), options.Schema); + //Configure ABP properties + b.ConfigureByConvention(); + //Configure Sfs base properties + b.ConfigureSfsStoreBase(); + + b.Property(q => q.BarCode).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.Batch).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.EqptCode).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.LocCode).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.PartCode).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.Batch).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.CodeLength); + + + + + //Properties + //b.Property(q => q.SupplierCode).HasMaxLength(SfsPropertyConst.NameLength); + //b.Property(q => q.PoType).HasMaxLength(SfsPropertyConst.NameLength); + //b.Property(q => q.OrderStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); + //b.Property(q => q.Version).HasMaxLength(SfsPropertyConst.NameLength); + //b.Property(q => q.IsConsignment).HasDefaultValue(false); + //b.Property(q => q.TaxRate).HasDefaultValue(0); + //b.Property(q => q.ContactName).HasMaxLength(SfsPropertyConst.NameLength); + //b.Property(q => q.ContactPhone).HasMaxLength(SfsPropertyConst.NameLength); + //b.Property(q => q.ContactEmail).HasMaxLength(SfsPropertyConst.NameLength); + + ////Relations + //b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired(); + + ////Indexes + //b.HasIndex(q => new { q.Number }).IsUnique(); + }); + + //builder.Entity(b => + //{ + // //Configure table & schema name + // b.ToTable(options.TablePrefix + nameof(PurchaseOrderDetail), options.Schema); + // //Configure ABP properties + // b.ConfigureByConvention(); + // //Configure Sfs base properties + // b.ConfigureSfsStoreBase(); + // //Configure Sfs store detail properties + // b.ConfigureSfsStoreDetailBase(); + + // //Properties + // b.Property(q => q.PoLine).HasMaxLength(SfsPropertyConst.CodeLength); + // b.Property(q => q.LineStatus).IsRequired().HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); + // b.Property(q => q.ConvertRate).HasDefaultValue(1); + // b.Property(q => q.IsConsignment).HasDefaultValue(false); + // b.Property(q => q.ProjectCode).HasMaxLength(SfsPropertyConst.CodeLength); + // b.Property(q => q.LocationErpCode).HasMaxLength(SfsPropertyConst.CodeLength); + + // //Relations + + // //Indexes + // b.HasIndex(q => new { q.ItemCode, q.Number, q.PoLine }).IsUnique(); + //}); + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Equipments/EquipmentRecordEfCoreRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Equipments/EquipmentRecordEfCoreRepository.cs new file mode 100644 index 000000000..25ab861ad --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Equipments/EquipmentRecordEfCoreRepository.cs @@ -0,0 +1,23 @@ +using System.Linq; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Wms.Store.Domain; +using Win_in.Sfs.Wms.Store.Equipments; + +namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; + +public class EquipmentRecordEfCoreRepository : SfsStoreEfCoreRepositoryBase, IEquipmentRecordRepository, ISfsBulkRepositoryBase +{ + public EquipmentRecordEfCoreRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + + public Task UpsertAsync(EquipmentRecord newData) + { + throw new System.NotImplementedException(); + } + + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs index 9a5dbfa35..12527670d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs @@ -2,6 +2,7 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; using Win_in.Sfs.Wms.Store.Domain; +using Win_in.Sfs.Wms.Store.Equipments; namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; @@ -104,6 +105,7 @@ public class StoreDbContext : AbpDbContext, IStoreDbContext #endregion public DbSet ExchangeDatas { get; set; } + public DbSet EquipmentRecords { get; set; } public StoreDbContext(DbContextOptions options) : base(options) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs index a26ec5dc9..67eb52523 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs @@ -29,6 +29,11 @@ public static class StoreDbContextModelCreatingExtensions builder.ConfigureSaleOrder(options); builder.ConfigureWorkOrder(options); + builder.ConfigureEquipmentRecord(options); + + + + #endregion #region Plans diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Win_in.Sfs.Wms.Store.EntityFrameworkCore.csproj b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Win_in.Sfs.Wms.Store.EntityFrameworkCore.csproj index ad144b5fb..cb0cd0733 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Win_in.Sfs.Wms.Store.EntityFrameworkCore.csproj +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Win_in.Sfs.Wms.Store.EntityFrameworkCore.csproj @@ -38,6 +38,7 @@ +