| | |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEA_DTO.Inbound; |
| | | using WIDESEA_DTO.Outbound; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_IOutboundService; |
| | |
| | | private readonly ISplitPackageService _splitPackageService; |
| | | private readonly IRepository<Dt_Task> _taskRepository; |
| | | private readonly IESSApiService _eSSApiService; |
| | | |
| | | private readonly IInvokeMESService _invokeMESService; |
| | | |
| | | private readonly ILogger<OutboundPickingService> _logger; |
| | | |
| | |
| | | |
| | | }; |
| | | |
| | | public OutboundPickingService(IRepository<Dt_PickingRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IStockService stockService, IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, ILocationInfoService locationInfoService, IOutboundOrderDetailService outboundOrderDetailService, ISplitPackageService splitPackageService, IOutboundOrderService outboundOrderService, IRepository<Dt_Task> taskRepository, IESSApiService eSSApiService, ILogger<OutboundPickingService> logger) : base(BaseDal) |
| | | public OutboundPickingService(IRepository<Dt_PickingRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IStockService stockService, IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, ILocationInfoService locationInfoService, IOutboundOrderDetailService outboundOrderDetailService, ISplitPackageService splitPackageService, IOutboundOrderService outboundOrderService, IRepository<Dt_Task> taskRepository, IESSApiService eSSApiService, ILogger<OutboundPickingService> logger, IInvokeMESService invokeMESService) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _stockInfoService = stockInfoService; |
| | |
| | | _taskRepository = taskRepository; |
| | | _eSSApiService = eSSApiService; |
| | | _logger = logger; |
| | | _invokeMESService = invokeMESService; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | if (allCompleted) |
| | | { |
| | | await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>() |
| | | .SetColumns(x => x.OrderStatus == 2) // 已宿 |
| | | .Where(x => x.OrderNo == orderNo) |
| | | .ExecuteCommandAsync(); |
| | | try |
| | | { |
| | | await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>() |
| | | .SetColumns(x => x.OrderStatus == 2) // 已宿 |
| | | .Where(x => x.OrderNo == orderNo) |
| | | .ExecuteCommandAsync(); |
| | | |
| | | //åä¼ MES |
| | | var outboundOrder = _stockInfoService.Db.Queryable<Dt_OutboundOrder>().First(x => x.OrderNo == orderNo); |
| | | |
| | | |
| | | if (outboundOrder != null && outboundOrder.OrderStatus == OutOrderStatusEnum.åºåºå®æ.ObjToInt()) |
| | | { |
| | | |
| | | if (outboundOrder.OrderType == OutOrderTypeEnum.Allocate.ObjToInt().ObjToInt())//è°æ¨åºåº |
| | | { |
| | | |
| | | } |
| | | else if (outboundOrder.OrderType == OutOrderTypeEnum.ReCheck.ObjToInt()) //鿣åºåº |
| | | { |
| | | |
| | | } |
| | | else |
| | | { |
| | | var feedmodel = new FeedbackOutboundRequestModel |
| | | { |
| | | reqCode = Guid.NewGuid().ToString(), |
| | | reqTime = DateTime.Now.ToString(), |
| | | business_type = outboundOrder.BusinessType, |
| | | factoryArea = outboundOrder.FactoryArea, |
| | | operationType = 1, |
| | | Operator = outboundOrder.Operator, |
| | | orderNo = outboundOrder.UpperOrderNo, |
| | | status = outboundOrder.OrderStatus, |
| | | details = new List<FeedbackOutboundDetailsModel>() |
| | | |
| | | }; |
| | | var lists = _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>().Where(x => x.OrderNo == orderNo).ToList(); |
| | | |
| | | var groupedData = lists.GroupBy(item => new { item.MaterielCode, item.lineNo, item.Unit, item.WarehouseCode }) |
| | | .Select(group => new FeedbackOutboundDetailsModel |
| | | { |
| | | materialCode = group.Key.MaterielCode, |
| | | lineNo = group.Key.lineNo, |
| | | warehouseCode = group.Key.WarehouseCode, |
| | | currentDeliveryQty = group.Sum(x => x.OrderQuantity), |
| | | // warehouseCode= "1072", |
| | | unit = group.Key.Unit, |
| | | barcodes = group.Select(row => new WIDESEA_DTO.Outbound.BarcodesModel |
| | | { |
| | | barcode = row.CurrentBarcode, |
| | | supplyCode = row.SupplyCode, |
| | | batchNo = row.BatchNo, |
| | | unit = row.Unit, |
| | | qty = row.AssignQuantity |
| | | }).ToList() |
| | | }).ToList(); |
| | | feedmodel.details = groupedData; |
| | | |
| | | _invokeMESService.FeedbackOutbound(feedmodel); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) { |
| | | _logger.LogError(" OutboundPickingService FeedbackOutbound : " + ex.Message); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | /// <summary> |
| | | /// ååºæä½ |
| | | /// </summary> |
| | | |
| | | |
| | | public async Task<WebResponseContent> ReturnRemaining(string orderNo, string palletCode, string reason) |
| | | { |
| | | try |
| | |
| | | |
| | | // æ£æ¥æç䏿¯å¦æå
¶ä»éåºåºè´§ç©ï¼åºåè´§ç©ï¼ |
| | | var palletStockGoods = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>() |
| | | .Where(it => it.StockId == stockinfo.Id &&( it.Status == StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt() || it.Status == StockStatusEmun.å
¥åºå®æ.ObjToInt())) |
| | | .Where(it => it.StockId == stockinfo.Id && (it.Status == StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt() || it.Status == StockStatusEmun.å
¥åºå®æ.ObjToInt() || it.Status == StockStatusEmun.åºåºéå®.ObjToInt())) |
| | | .Where(it => it.OutboundQuantity == 0 || it.OutboundQuantity < it.StockQuantity) // æªå®å
¨åºåºç |
| | | .ToListAsync(); |
| | | |
| | |
| | | return WebResponseContent.Instance.Error("没æéè¦ååºçå©ä½è´§ç©"); |
| | | } |
| | | |
| | | |
| | | |
| | | var firstlocation = _locationInfoService.Db.Queryable<Dt_LocationInfo>().First(x => x.LocationCode == task.SourceAddress); |
| | | decimal totalReturnQty = 0; |
| | | var hasRemainingLocks = remainingLocks.Any(x => x.PalletCode == palletCode); |
| | |
| | | totalReturnQty = palletStockGoods.Sum(x => x.StockQuantity - x.OutboundQuantity); |
| | | } |
| | | |
| | | // ä¿åä»»å¡ |
| | | // ä¿åä»»å¡ ç»ESSä¸åä»»å¡ |
| | | if (tasks.Any()) |
| | | { |
| | | try |