using Dm.filter;
using MailKit.Search;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using WIDESEA_Common.CommonEnum;
using WIDESEA_Common.LocationEnum;
using WIDESEA_Common.OrderEnum;
using WIDESEA_Common.StockEnum;
using WIDESEA_Common.TaskEnum;
using WIDESEA_Core;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
using WIDESEA_DTO.Allocate;
using WIDESEA_DTO.Basic;
using WIDESEA_DTO.Inbound;
using WIDESEA_DTO.Outbound;
using WIDESEA_IAllocateService;
using WIDESEA_IBasicService;
using WIDESEA_IOutboundService;
using WIDESEA_IStockService;
using WIDESEA_Model.Models;
namespace WIDESEA_OutboundService
{
///
///
///
public class OutboundPickingService : ServiceBase>, IOutboundPickingService
{
private readonly IUnitOfWorkManage _unitOfWorkManage;
public IRepository Repository => BaseDal;
private readonly IStockInfoService _stockInfoService;
private readonly IStockService _stockService;
private readonly IOutStockLockInfoService _outStockLockInfoService;
private readonly IStockInfoDetailService _stockInfoDetailService;
private readonly ILocationInfoService _locationInfoService;
private readonly IOutboundOrderDetailService _outboundOrderDetailService;
private readonly IOutboundOrderService _outboundOrderService;
private readonly ISplitPackageService _splitPackageService;
private readonly IRepository _taskRepository;
private readonly IESSApiService _eSSApiService;
private readonly IInvokeMESService _invokeMESService;
private readonly IDailySequenceService _dailySequenceService;
private readonly IAllocateService _allocateService;
private readonly ILogger _logger;
private Dictionary stations = new Dictionary
{
{"2-1","2-9" },
{"3-1","3-9" },
};
private Dictionary movestations = new Dictionary
{
{"2-1","2-5" },
{"3-1","3-5" },
};
public OutboundPickingService(IRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IStockService stockService,
IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, ILocationInfoService locationInfoService,
IOutboundOrderDetailService outboundOrderDetailService, ISplitPackageService splitPackageService, IOutboundOrderService outboundOrderService,
IRepository taskRepository, IESSApiService eSSApiService, ILogger logger, IInvokeMESService invokeMESService, IDailySequenceService dailySequenceService, IAllocateService allocateService) : base(BaseDal)
{
_unitOfWorkManage = unitOfWorkManage;
_stockInfoService = stockInfoService;
_stockService = stockService;
_outStockLockInfoService = outStockLockInfoService;
_stockInfoDetailService = stockInfoDetailService;
_locationInfoService = locationInfoService;
_outboundOrderDetailService = outboundOrderDetailService;
_splitPackageService = splitPackageService;
_outboundOrderService = outboundOrderService;
_taskRepository = taskRepository;
_eSSApiService = eSSApiService;
_logger = logger;
_invokeMESService = invokeMESService;
_dailySequenceService = dailySequenceService;
_allocateService = allocateService;
}
#region 查询方法
// 获取未拣选列表
public async Task> GetUnpickedList(string orderNo, string palletCode)
{
var list = await _outStockLockInfoService.Db.Queryable()
.Where(x => x.OrderNo == orderNo &&
x.PalletCode == palletCode &&
x.Status == 1)
.ToListAsync();
return list.Where(x => x.RemainQuantity > 0).ToList();
}
// 获取已拣选列表
public async Task> GetPickedList(string orderNo, string palletCode)
{
var list = await _outStockLockInfoService.Db.Queryable()
.Where(x => x.OrderNo == orderNo &&
x.PalletCode == palletCode &&
x.Status == 6)
.ToListAsync();
return list;
}
// 获取拣选汇总
public async Task