| | |
| | | using LogLibrary.Log; |
| | | using MailKit; |
| | | using MailKit.Search; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using SixLabors.ImageSharp; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | private IStockService _stockService; |
| | | private readonly IRepository<Dt_AllocateMaterialInfo> _allocateMaterialInfo; |
| | | private readonly HttpClientHelper _httpClientHelper; |
| | | public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository,IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, HttpClientHelper httpClientHelper) |
| | | private readonly IRepository<Dt_MesReturnRecord> _mesReturnRecord; |
| | | public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository,IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, HttpClientHelper httpClientHelper, IRepository<Dt_MesReturnRecord> mesReturnRecord) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | InboundOrderDetailService = inboundOrderDetailService; |
| | |
| | | _taskRepository = taskRepository; |
| | | _allocateMaterialInfo = allocateMaterialInfo; |
| | | _httpClientHelper = httpClientHelper; |
| | | _mesReturnRecord = mesReturnRecord; |
| | | } |
| | | |
| | | public async Task<WebResponseContent> GroupPallet(GroupPalletDto palletDto) |
| | |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent BatchInOrderFeedbackToMes(string OrderNo) |
| | | public WebResponseContent BatchInOrderFeedbackToMes(int id) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>() |
| | | .Where(x => x.InboundOrderNo == OrderNo) |
| | | .Where(x => x.Id == id) |
| | | .First(); |
| | | |
| | | List<Dt_MesReturnRecord> returnRecords = _mesReturnRecord.QueryData(x => x.OrderNo == inboundOrder.InboundOrderNo && x.OrderId == inboundOrder.Id && x.ReturnStatus == 2); |
| | | foreach (var item in returnRecords) |
| | | { |
| | | HttpResponseResult<MesResponseDTO> httpResponse = _httpClientHelper.Post<MesResponseDTO>(item.ApiUrl, item.RequestData); |
| | | item.ReturnCount += 1; |
| | | bool success = httpResponse.IsSuccess && httpResponse.Data.Code == "200"; |
| | | item.ReturnStatus = success ? 1 : 2; |
| | | item.HttpStatusCode = httpResponse.StatusCode.ObjToInt(); |
| | | item.LastReturnTime = DateTime.Now; |
| | | item.ResponseData = httpResponse.Content; |
| | | item.SuccessTime = httpResponse.IsSuccess ? DateTime.Now : null; |
| | | |
| | | //List<Dt_InboundOrderDetail> details=new List<Dt_InboundOrderDetail>(); |
| | | //foreach (var y in item.DetailsId.Split(',')) |
| | | //{ |
| | | // details.Add( _inboundOrderDetailRepository.QueryFirst(x => x.Id == Convert.ToInt32(y))); |
| | | //} |
| | | } |
| | | _mesReturnRecord.UpdateData(returnRecords); |
| | | |
| | | var inboundOrderDetail = _inboundOrderRepository.Db.Queryable<Dt_InboundOrderDetail>() |
| | | .Where(x => x.OrderId == inboundOrder.Id && x.OrderDetailStatus==(int)OrderDetailStatusEnum.Over && x.ReturnToMESStatus == 0) |
| | | .ToList(); |
| | | |
| | | var stocks = _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.StockStatus == 6) |
| | | .Where(it => SqlFunc.Subqueryable<Dt_StockInfoDetail>().Where(s => s.StockId == it.Id && s.OrderNo == OrderNo).Any()) |
| | | .Where(it => SqlFunc.Subqueryable<Dt_StockInfoDetail>().Where(s => s.StockId == it.Id && s.OrderNo == inboundOrder.InboundOrderNo).Any()) |
| | | .ToList(); |
| | | |
| | | var stockIds = stocks.Select(s => s.Id).ToList(); |