diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/PostionLocations/DTOs/PostionLocationDTO.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/PostionLocations/DTOs/PostionLocationDTO.cs index 59a8cad02..837c1f9e2 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/PostionLocations/DTOs/PostionLocationDTO.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/PostionLocations/DTOs/PostionLocationDTO.cs @@ -20,6 +20,20 @@ public class PostionLocationDTO : SfsBaseDataDTOBase, IHasCode, IHasName [Display(Name = "名称")] public string Name { get; set; } + /// + /// WMS库位 + /// + [Display(Name = "库位")] + [Required(ErrorMessage = "{0}是必填项")] + public string LocationCode { get; set; } +} +public class PostionLocationAgvDTO +{ + [Display(Name = "工作站编号")] + [Required(ErrorMessage = "{0}是必填项")] + public string Code { get; set; } + + /// /// WMS库位 /// diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PostionLocations/PostionLocationAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PostionLocations/PostionLocationAppService.cs index 83ca0dc0e..9d5dbe37a 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PostionLocations/PostionLocationAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PostionLocations/PostionLocationAppService.cs @@ -186,13 +186,37 @@ public class PostionLocationAppService return ObjectMapper.Map, List>(result); } + [HttpPost("get-loc-by-codes")] + public async Task> GetLocationByCodesAsync(List codes) + { + var ls = await base.GetByCodesAsync(codes).ConfigureAwait(false); + List list = new List(); + foreach (var code in ls) + { + PostionLocationAgvDTO dto = new PostionLocationAgvDTO(); + dto.Code = code.Code; + dto.LocationCode = code.LocationCode; + list.Add(dto); + } + return list; + } - [HttpGet("get-all-list")] - public async Task> GetAllListAsync() + + + [HttpPost("get-all-list")] + public async Task> GetAllListAsync() { - var result =await base.GetAllListByFilterAsync(new SfsBaseDataRequestInputBase() ).ConfigureAwait(false); - return result; + var result =await base.GetAllListByFilterAsync(new SfsBaseDataRequestInputBase()).ConfigureAwait(false); + List list = new List(); + foreach (var item in result) + { + PostionLocationAgvDTO dto = new PostionLocationAgvDTO(); + dto.LocationCode = item.LocationCode; + dto.Code= item.Code; + list.Add(dto); + } + return list; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/AgvJobs/AgvJobOutputService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/AgvJobs/AgvJobOutputService.cs index 0a4fa332a..63908b2f6 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/AgvJobs/AgvJobOutputService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/AgvJobs/AgvJobOutputService.cs @@ -38,13 +38,7 @@ public class AgvJobOutputService : ApplicationService private readonly IHttpClientFactory _httpClientFactory; private readonly IOptions _options; private readonly ILogger _logger; - private readonly AssembleIssueJobAppService _assembleIssueJobAppService; - private readonly CoatingIssueJobAppService _coatingIssueJobAppService; - private readonly InjectionIssueJobAppService _injectionIssueJobAppService; - private readonly KittingIssueJobAppService _kittingIssueJobAppService; - private readonly SparePartIssueJobAppService _sparePartIssueJobAppService; - private readonly UnplannedIssueJobAppService _unplannedIssueJobAppService; - private readonly UnplannedReceiptJobAppService _unplannedReceiptJobAppService; + private readonly IOptions _agvOptions; @@ -53,29 +47,18 @@ public class AgvJobOutputService : ApplicationService IHttpClientFactory httpClientFactory, IOptions options, ILogger logger, - AssembleIssueJobAppService assembleIssueJobAppService, - CoatingIssueJobAppService coatingIssueJobAppService, - InjectionIssueJobAppService injectionIssueJobAppService, - KittingIssueJobAppService kittingIssueJobAppService, - SparePartIssueJobAppService sparePartIssueJobAppService, - UnplannedIssueJobAppService unplannedIssueJobAppService, - UnplannedReceiptJobAppService unplannedReceiptJobAppService + IOptions agvOptions ) { - _assembleIssueJobAppService = assembleIssueJobAppService; - _coatingIssueJobAppService = coatingIssueJobAppService; - _injectionIssueJobAppService = injectionIssueJobAppService; - _kittingIssueJobAppService = kittingIssueJobAppService; - _sparePartIssueJobAppService = sparePartIssueJobAppService; - _unplannedIssueJobAppService = unplannedIssueJobAppService; - _unplannedReceiptJobAppService = unplannedReceiptJobAppService; + _logger = logger; _unitOfWorkManager = unitOfWorkManager; _httpClientFactory = httpClientFactory; _options = options; + _agvOptions = agvOptions; } [HttpPost("test-callagv-Coating")] diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CustomerProductionReturnNotes/CustomerProductionReturnNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CustomerProductionReturnNotes/CustomerProductionReturnNoteAppService.cs index 2af06fcc7..71d460828 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CustomerProductionReturnNotes/CustomerProductionReturnNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CustomerProductionReturnNotes/CustomerProductionReturnNoteAppService.cs @@ -96,33 +96,35 @@ public class CustomerProductionReturnNoteAppService : throw new UserFriendlyException($"未{entity.CustomerCode}查到客户信息!"); } + var parts= input.Details.Select(itm => itm.ItemCode).Distinct(); + + var custitmDetail = await _customerItemAppService.GetListByPartsAsync(parts.ToList()).ConfigureAwait(false); + + #region 20241230修改 + var query = from itm in custitmDetail + join itm1 in custitmDetail on itm.ItemCode equals itm1.ItemCode + where itm.CustomerCode != itm1.CustomerCode + select itm; + var diff= query.ToList(); + if (diff.Count > 0) + { + var diffparts=diff.Select(p => p.ItemCode).Distinct().ToList(); + throw new UserFriendlyException($"零件编号{string.Join(",",diffparts)},对应多个客户不能进行退货,请查看客户零件关系表!"); + } + #endregion + #region 20241230修改 - /// - /// 客户名称 - /// - - var parts= input.Details.Select(itm => itm.ItemCode).Distinct(); - //var ls=await IsExistCustomerItemPrice(parts.ToList(),input.CustomerCode).ConfigureAwait(false); + #endregion - //if (ls.Count > 0) - //{ - // throw new UserFriendlyException($"销售价格表中没有查到客户为{input.CustomerCode}零件号为{string.Join(",", ls.ToArray())}的零件关系和价格"); - //} - //var errlist= await CheckCustomerItem(parts.ToList(), input.CustomerCode).ConfigureAwait(false); - // if (errlist.Count > 0) - // { - // throw new UserFriendlyException($"客户零件关系表中没有查到客户为{input.CustomerCode}零件号为{string.Join(",", ls.ToArray())}的零件关系"); - // } - var custitmDetail = await _customerItemAppService.GetListByPartsAsync(parts.ToList()).ConfigureAwait(false); - var checkPart= from itm in entity.Details.ToList() + var checkPart = from itm in entity.Details.ToList() join itm1 in custitmDetail on itm.ItemCode equals itm1.ItemCode into temp diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs index 124ba207e..8120df6a9 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Org.BouncyCastle.Asn1.Ocsp; using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Entities; @@ -15,6 +16,7 @@ using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.ObjectMapping; using Win_in.Sfs.Basedata.Application; using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Basedata.Domain; using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; @@ -37,20 +39,35 @@ public class DeliverRequestAppService : private readonly ICustomerAppService _customerApp; private readonly ICustomerAddressAppService _customerAddressApp; private readonly IItemBasicAppService _itemBasicAppService; + private readonly ICustomerItemAppService _customerItemAppService; + private readonly ISalePriceSheetRepository _salePriceSheetRepository; + + + + public DeliverRequestAppService( IDeliverRequestRepository repository , IDeliverRequestManager deliverRequestManager , IAreaAppService areaApp , ICustomerAppService customerApp - , ICustomerAddressAppService customerAddressApp, -IItemBasicAppService itemBasicAppService) + , ICustomerAddressAppService customerAddressApp + , IItemBasicAppService itemBasicAppService, + ICustomerItemAppService customerItemAppService, + + ISalePriceSheetRepository salePriceSheetRepository + + ) : base(repository, deliverRequestManager) { + _customerItemAppService = customerItemAppService; + _deliverRequestManager = deliverRequestManager; _areaApp = areaApp; _customerApp = customerApp; _customerAddressApp = customerAddressApp; _itemBasicAppService = itemBasicAppService; + _customerItemAppService = customerItemAppService; + _salePriceSheetRepository = salePriceSheetRepository; } protected override async Task> ImportProcessingEntityAsync(Dictionary dictionary) @@ -76,8 +93,12 @@ IItemBasicAppService itemBasicAppService) { request.DeliverPlanNumber = request.Details.First().MesDeliveryPlan; } + + await CheckCustomerItem(request).ConfigureAwait(false); + foreach (var detail in request.Details) { + var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); CheckItemBasic(itemBasicDto, detail.ItemCode); detail.ItemDesc1 = itemBasicDto.Desc1; @@ -90,6 +111,68 @@ IItemBasicAppService itemBasicAppService) return dictionary; } + /// + /// 成品发运价格校验 + /// + /// + /// + /// + /// + [HttpPost("check-sale-price")] + public async Task> CheckSalePriceAsync(List ids, string truckNumber) + { + if (string.IsNullOrEmpty(truckNumber)) + { + throw new UserFriendlyException($"车牌号不能为空"); + } + + var entitys = await _repository.GetListAsync(r => ids.Contains(r.Id), true).ConfigureAwait(false); + if (entitys.Select(r => r.CustomerCode).Distinct().Count() > 1) + { + throw new UserFriendlyException($"所选申请涉及多个客户不能创建为一个发货单,请重新选择!"); + } + //一车发运车牌号相同 + entitys.ForEach(r => { r.MesTruckNumber = truckNumber; }); + Check.NotNull(entitys, typeof(DeliverRequest).Name); + List errors=new List(); + foreach (var request in entitys) + { + foreach (var itm in request.Details) + { + var price = await _salePriceSheetRepository.FindAsync(p => p.ItemCode == itm.ItemCode && p.CustomerCode == request.CustomerCode).ConfigureAwait(false); + if (price == null) + { + errors.Add($"请求单号:{request.Number}零件编号:{itm.ItemCode}客户编号:{request.CustomerCode}"); + } + } + } + return errors; + } + + private async Task CheckCustomerItem(DeliverRequest request) + { + List errors= new List(); + foreach (var detail in request.Details) + { + + var entity = await _customerItemAppService.GetByCustomerAndItemAsync(detail.ItemCode, request.CustomerCode).ConfigureAwait(false); + if (entity == null) + { + errors.Add($"零件编号:{detail.ItemCode}客户编号:{request.CustomerCode}|"); + } + } + + if (errors.Count > 0) + { + throw new UserFriendlyException(string.Format(",",errors.ToArray())+ "在客户零件关系表里不存在!"); + } + + + + } + + + protected override async Task SaveImportAsync(Dictionary dict) { var addList = dict.Where(p => p.Value == EntityState.Added).Select(p => p.Key).ToList(); @@ -182,6 +265,10 @@ IItemBasicAppService itemBasicAppService) entitys.ForEach(r => { r.MesTruckNumber = truckNumber; }); Check.NotNull(entitys, typeof(DeliverRequest).Name); + + + + var result = await _deliverRequestManager.HandleListAsync(entitys).ConfigureAwait(false); var dtos = ObjectMapper.Map, List>(entitys); return dtos; @@ -209,6 +296,10 @@ IItemBasicAppService itemBasicAppService) { var entity = ObjectMapper.Map(input); await SetRequestAutoPropertiesAsync(entity).ConfigureAwait(false); + + + await CheckCustomerItem(entity).ConfigureAwait(false); + await _deliverRequestManager.CreateAsync(entity).ConfigureAwait(false); var dto = ObjectMapper.Map(entity);