¶Ô±ÈÐÂÎļþ |
| | |
| | | using Admin.NET.Core.Service; |
| | | using Admin.NET.Application.Entity; |
| | | using Microsoft.AspNetCore.Http; |
| | | using System.Data; |
| | | using System.Web; |
| | | using System.Text; |
| | | using Furion.DatabaseAccessor; |
| | | using Admin.NET.Application.Service.WmsOrder.Mes_BatchOrderUPI_New.Dto; |
| | | |
| | | namespace Admin.NET.Application; |
| | | /// <summary> |
| | | /// ç¬¬ä¸æ¹æ¥å£æå¡ |
| | | /// </summary> |
| | | [ApiDescriptionSettings(ApplicationConst.ThirdInterFaceServiceGroupName, Order = 100)] |
| | | public class ThirdInterFaceService : IDynamicApiController, ITransient |
| | | { |
| | | private readonly SqlSugarRepository<Mes_BatchOrderUPI_New> _rep; |
| | | public ThirdInterFaceService(SqlSugarRepository<Mes_BatchOrderUPI_New> rep) |
| | | { |
| | | _rep = rep; |
| | | } |
| | | |
| | | [HttpPost] |
| | | [ApiDescriptionSettings(Name = "GetBatchOrderUPIList")] |
| | | [UnitOfWork] |
| | | [AllowAnonymous] |
| | | public async Task GetBatchOrderUPIList(List<Mes_BatchOrderUPI_New> input) |
| | | { |
| | | if (input?.Count <= 0) |
| | | { |
| | | throw Oops.Oh($"æ°æ®ä¸è½ä¸ºç©º"); |
| | | } |
| | | //æ ¡éªupiæ¯å¦éå¤ ãEditby shaocx,2022-12-13ã |
| | | var myList = input.Select(x => x.UPI).ToList(); |
| | | var result = myList.GroupBy(x => x) |
| | | .Where(g => g.Count() > 1) |
| | | .ToDictionary(x => x.Key, x => x.Count()); |
| | | if (result != null && result.Count > 0) |
| | | { |
| | | var dit = result.First(); |
| | | throw Oops.Oh("æ¬æ¬¡æéå¤çUPIï¼éå¤å·ä¸º:" + dit.Key + ",é夿¡æ°:" + dit.Value); |
| | | } |
| | | |
| | | List<string> upis = new List<string>(); |
| | | input.ForEach(x => upis.Add(x.UPI));//upisæ¯ä¼ è¿æ¥çupiåæ®µéå |
| | | |
| | | var batchOrderUPIs = await _rep.AsQueryable().Where(x => upis.Contains(x.UPI)).ToListAsync();//batchOrderUPIsæ¯éå¤çupiéå |
| | | //æ¹éå é¤ |
| | | await _rep.DeleteAsync(batchOrderUPIs); |
| | | |
| | | foreach (var item in input) |
| | | { |
| | | item.AreaCode = AreaCodeEnum.æ åºå; |
| | | item.UpiStatus = UpiStatusEnum.åå§; |
| | | } |
| | | await _rep.InsertRangeAsync(input); |
| | | } |
| | | |
| | | } |
| | | |