| | |
| | | var completedLockInfo = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() |
| | | .Where(it => it.CurrentBarcode == barcode && |
| | | (it.Status == (int)OutLockStockStatusEnum.æ£é宿 || |
| | | it.Status == (int)OutLockStockStatusEnum.已鿾 || |
| | | it.Status == (int)OutLockStockStatusEnum.å·²åèµ° || |
| | | it.PickedQty >= it.AssignQuantity)).FirstAsync(); |
| | | |
| | | if (completedLockInfo != null) |
| | | throw new Exception($"æ¡ç {barcode}å·²ç»å®æåæ£ï¼ä¸è½éå¤åæ£"); |
| | | { |
| | | string statusMsg = completedLockInfo.Status switch |
| | | { |
| | | (int)OutLockStockStatusEnum.æ£é宿 => "å·²ç»å®æåæ£", |
| | | (int)OutLockStockStatusEnum.已鿾 => "å·²ç»éæ¾", |
| | | (int)OutLockStockStatusEnum.å·²åèµ° => "å·²ç»åèµ°", |
| | | _ => "å·²ç»å®æåæ£" |
| | | }; |
| | | throw new Exception($"æ¡ç {barcode}{statusMsg}ï¼ä¸è½éå¤åæ£"); |
| | | } |
| | | else |
| | | return null; |
| | | } |
| | |
| | | |
| | | private async Task<bool> CanCancelPicking(Dt_OutStockLockInfo lockInfo, Dt_StockInfoDetail stockDetail) |
| | | { |
| | | if (lockInfo.Status == (int)OutLockStockStatusEnum.已鿾 || lockInfo.Status == (int)OutLockStockStatusEnum.å·²åèµ°) |
| | | return false; |
| | | // éå®ä¿¡æ¯ç¶ææ£æ¥ |
| | | if (lockInfo.Status != (int)OutLockStockStatusEnum.æ£é宿) |
| | | return false; |
| | | |
| | | ////// åºåç¶ææ£æ¥ |
| | | ////if (stockDetail.Status == StockStatusEmun.åºåºå®æ.ObjToInt()) |
| | | //// return false; |
| | | |
| | | |
| | | // å¦ææ¯æå
è®°å½ï¼è¿éè¦æ£æ¥ç¶éå®ä¿¡æ¯ç¶æ |
| | | if (lockInfo.IsSplitted == 1 && lockInfo.ParentLockId.HasValue) |
| | |
| | | var parentLock = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() |
| | | .FirstAsync(x => x.Id == lockInfo.ParentLockId.Value); |
| | | |
| | | if (parentLock == null || parentLock.Status == (int)OutLockStockStatusEnum.ååºä¸) |
| | | if (parentLock == null || parentLock.Status == (int)OutLockStockStatusEnum.ååºä¸ || |
| | | parentLock.Status == (int)OutLockStockStatusEnum.已鿾 || |
| | | parentLock.Status == (int)OutLockStockStatusEnum.å·²åèµ°) |
| | | return false; |
| | | } |
| | | |
| | |
| | | await _outStockLockInfoService.Db.Updateable<Dt_OutStockLockInfo>() |
| | | .SetColumns(it => new Dt_OutStockLockInfo |
| | | { |
| | | Status = (int)OutLockStockStatusEnum.已鿾, // éè¦æ°å¢è¿ä¸ªç¶æ |
| | | // ReleaseTime = DateTime.Now, |
| | | Status = (int)OutLockStockStatusEnum.已鿾, |
| | | |
| | | Operator = App.User.UserName |
| | | }) |
| | | .Where(it => lockIds.Contains(it.Id)) |
| | |
| | | |
| | | _logger.LogInformation($"订åç¶ææ´æ° - OrderNo: {orderNo}, æ§ç¶æ: {outboundOrder.OrderStatus}, æ°ç¶æ: {newStatus}"); |
| | | |
| | | // åªææ£å¸¸åæ£å®ææ¶æåMESåé¦ |
| | | if (allCompleted && newStatus == (int)OutOrderStatusEnum.åºåºå®æ) |
| | | { |
| | | await HandleOrderCompletion(outboundOrder, orderNo); |
| | | } |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | ReqCode = Guid.NewGuid().ToString(), |
| | | ReqTime = DateTime.Now.ToString(), |
| | | BusinessType = "3", |
| | | BusinessType = "2", |
| | | |
| | | FactoryArea = outboundOrder.FactoryArea, |
| | | OperationType = 1, |
| | |
| | | .Where(x => x.OrderNo == orderNo && x.Status == (int)OutLockStockStatusEnum.æ£é宿) |
| | | .ToListAsync(); |
| | | |
| | | var groupedData = lists.GroupBy(item => new { item.MaterielCode, item.lineNo, item.Unit, item.WarehouseCode }) |
| | | var groupedData = lists.GroupBy(item => new { item.MaterielCode, item.lineNo, item.BarcodeUnit, item.WarehouseCode }) |
| | | .Select(group => new AllocateDtoDetail |
| | | { |
| | | MaterialCode = group.Key.MaterielCode, |
| | |
| | | WarehouseCode = group.Key.WarehouseCode, |
| | | Qty = group.Sum(x => x.PickedQty), |
| | | |
| | | Unit = group.Key.Unit, |
| | | Unit = group.Key.BarcodeUnit, |
| | | Barcodes = group.Select(row => new BarcodeInfo |
| | | { |
| | | Barcode = row.CurrentBarcode, |
| | | SupplyCode = row.SupplyCode, |
| | | BatchNo = row.BatchNo, |
| | | Unit = row.Unit, |
| | | Unit = row.BarcodeUnit, |
| | | Qty = row.PickedQty |
| | | }).ToList() |
| | | |
| | |
| | | |
| | | // åªè·åå·²æ£é宿çéå®è®°å½ |
| | | var lists = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() |
| | | .Where(x => x.OrderNo == orderNo && x.Status == (int)OutLockStockStatusEnum.æ£é宿) |
| | | .Where(x => x.OrderNo == orderNo && (x.Status == (int)OutLockStockStatusEnum.æ£é宿 || x.Status == (int)OutLockStockStatusEnum.å·²ååº)) |
| | | .ToListAsync(); |
| | | |
| | | var groupedData = lists.GroupBy(item => new { item.MaterielCode, item.lineNo, item.BarcodeUnit, item.WarehouseCode }) |
| | |
| | | materialCode = group.Key.MaterielCode, |
| | | lineNo = group.Key.lineNo, |
| | | warehouseCode = group.Key.WarehouseCode, |
| | | qty = group.Sum(x => x.BarcodeQty), |
| | | currentDeliveryQty = group.Sum(x => x.BarcodeQty), |
| | | qty = group.Sum(x => x.PickedQty), |
| | | currentDeliveryQty = group.Sum(x => x.PickedQty), |
| | | unit = group.Key.BarcodeUnit, |
| | | barcodes = group.Select(row => new WIDESEA_DTO.Outbound.BarcodesModel |
| | | { |
| | |
| | | supplyCode = row.SupplyCode, |
| | | batchNo = row.BatchNo, |
| | | unit = row.BarcodeUnit, |
| | | qty = row.BarcodeQty |
| | | qty = row.PickedQty |
| | | }).ToList() |
| | | }).ToList(); |
| | | |
| | |
| | | _logger.LogInformation($"订å {orderNo} å·²æ 记为åºåºå®æ"); |
| | | |
| | | // åMESåé¦è®¢å宿ï¼å¦æéè¦ï¼ |
| | | await HandleOrderCompletion(outboundOrder, orderNo); |
| | | //await HandleOrderCompletion(outboundOrder, orderNo); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | outboundOrderDetails.Add(outboundOrderDetail); |
| | | |
| | | var newLockInfo = new Dt_OutStockLockInfo |
| | | { |
| | | OrderNo = outboundOrder.UpperOrderNo, |
| | | OrderDetailId = outboundOrderDetail.Id, |
| | | OutboundBatchNo = outboundOrderDetail.BatchNo, |
| | | MaterielCode = outboundOrderDetail.MaterielCode, |
| | | MaterielName = outboundOrderDetail.MaterielName, |
| | | StockId = 0, |
| | | OrderQuantity = outboundOrderDetail.OrderQuantity, |
| | | AssignQuantity = outboundOrderDetail.OverOutQuantity, |
| | | PickedQty = outboundOrderDetail.NoStockOutQty, |
| | | LocationCode = "空", |
| | | PalletCode = "空", |
| | | TaskNum = 0, |
| | | Status = (int)OutLockStockStatusEnum.æ£é宿, |
| | | Unit = outboundOrderDetail.Unit, |
| | | SupplyCode = outboundOrderDetail.SupplyCode?? "æ ", |
| | | OrderType = outboundOrder.OrderType, |
| | | CurrentBarcode = inboundOrderDetail.Barcode, |
| | | IsSplitted = 1, |
| | | Operator = App.User.UserName, |
| | | lineNo= outboundOrderDetail.lineNo, |
| | | WarehouseCode = outboundOrderDetail.WarehouseCode ?? "æ ", |
| | | BarcodeQty=outboundOrderDetail.NoStockOutQty, |
| | | BarcodeUnit =outboundOrderDetail.BarcodeUnit, |
| | | BatchNo = outboundOrderDetail.BatchNo |
| | | }; |
| | | _outStockLockInfoService.AddData(newLockInfo); |
| | | } |
| | | //夿å
¥åºåæ®æç»æ¯å¦å
¨é¨æ¯å®æç¶æ |
| | | int e = inboundOrder.Details.Count(); |
| | |
| | | _outboundOrderService.UpdateData(outboundOrder); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | //å
¥åºåä¼ MES |
| | | var infeedmodel = new FeedbackInboundRequestModel |
| | | { |
| | | var feedmodel = new FeedbackInboundRequestModel |
| | | reqCode = Guid.NewGuid().ToString(), |
| | | reqTime = DateTime.Now.ToString(), |
| | | business_type = inboundOrder.BusinessType, |
| | | factoryArea = inboundOrder.FactoryArea, |
| | | operationType = 1, |
| | | Operator = App.User.UserName, |
| | | orderNo = inboundOrder.UpperOrderNo, |
| | | status = inboundOrder.OrderStatus, |
| | | details = new List<FeedbackInboundDetailsModel>() |
| | | |
| | | }; |
| | | |
| | | var groupedData = inboundOrderDetails.GroupBy(item => new { item.MaterielCode, item.SupplyCode, item.BatchNo, item.lineNo, item.BarcodeUnit, item.WarehouseCode }) |
| | | .Select(group => new FeedbackInboundDetailsModel |
| | | { |
| | | reqCode = Guid.NewGuid().ToString(), |
| | | reqTime = DateTime.Now.ToString(), |
| | | business_type = inboundOrder.BusinessType, |
| | | factoryArea = inboundOrder.FactoryArea, |
| | | operationType = 1, |
| | | Operator = inboundOrder.Operator, |
| | | orderNo = inboundOrder.UpperOrderNo, |
| | | status = inboundOrder.OrderStatus, |
| | | details = new List<FeedbackInboundDetailsModel>() |
| | | materialCode = group.Key.MaterielCode, |
| | | supplyCode = group.Key.SupplyCode, |
| | | batchNo = group.Key.BatchNo, |
| | | lineNo = group.Key.lineNo, |
| | | warehouseCode = group.Key.WarehouseCode, |
| | | qty = group.Sum(x => x.BarcodeQty), |
| | | // warehouseCode= "1072", |
| | | unit = group.Key.BarcodeUnit, |
| | | barcodes = group.Select(row => new FeedbackBarcodesModel |
| | | { |
| | | barcode = row.Barcode, |
| | | qty = row.BarcodeQty |
| | | }).ToList() |
| | | }).ToList(); |
| | | infeedmodel.details = groupedData; |
| | | |
| | | }; |
| | | |
| | | var groupedData = inboundOrder.Details.GroupBy(item => new { item.MaterielCode, item.SupplyCode, item.BatchNo, item.lineNo, item.BarcodeUnit, item.WarehouseCode }) |
| | | .Select(group => new FeedbackInboundDetailsModel |
| | | { |
| | | materialCode = group.Key.MaterielCode, |
| | | supplyCode = group.Key.SupplyCode, |
| | | batchNo = group.Key.BatchNo, |
| | | lineNo = group.Key.lineNo, |
| | | warehouseCode = group.Key.WarehouseCode, |
| | | qty = group.Sum(x => x.BarcodeQty), |
| | | // warehouseCode= "1072", |
| | | unit = group.Key.BarcodeUnit, |
| | | barcodes = group.Select(row => new FeedbackBarcodesModel |
| | | { |
| | | barcode = row.Barcode, |
| | | qty = row.BarcodeQty |
| | | }).ToList() |
| | | }).ToList(); |
| | | feedmodel.details = groupedData; |
| | | |
| | | var result = await _invokeMESService.FeedbackInbound(feedmodel); |
| | | if (result != null && result.code == 200) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | _inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 }) |
| | | .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | var result1 = await _invokeMESService.FeedbackInbound(infeedmodel); |
| | | if (result1 != null && result1.code == 200) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 }) |
| | | .Where(it => it.Id == inboundOrder.Id).ExecuteCommand(); |
| | | _inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 }) |
| | | .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | if (outboundOrder.OrderStatus == OutOrderStatusEnum.åºåºå®æ.ObjToInt()) |
| | | { |
| | | var feedmodel = new FeedbackOutboundRequestModel |
| | | //åºåºåä¼ MES |
| | | var outfeedmodel = new FeedbackOutboundRequestModel |
| | | { |
| | | reqCode = Guid.NewGuid().ToString(), |
| | | reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | business_type = outboundOrder.BusinessType, |
| | | factoryArea = outboundOrder.FactoryArea, |
| | | operationType = 1, |
| | | Operator = outboundOrder.Operator, |
| | | Operator = App.User.UserName, |
| | | orderNo = outboundOrder.UpperOrderNo, |
| | | documentsNO = outboundOrder.OrderNo, |
| | | status = outboundOrder.OrderStatus, |
| | | details = new List<FeedbackOutboundDetailsModel>() |
| | | }; |
| | | foreach (var detail in outboundOrder.Details) |
| | | { |
| | | // è·å该æç»å¯¹åºçæ¡ç ä¿¡æ¯ï¼ä»éå®è®°å½ï¼ |
| | | var detailLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() |
| | | .Where(x => x.OrderNo == outboundOrder.UpperOrderNo && |
| | | x.OrderDetailId == detail.Id && |
| | | (x.Status == (int)OutLockStockStatusEnum.æ£é宿 || x.Status == (int)OutLockStockStatusEnum.å·²ååº)) |
| | | .ToListAsync(); |
| | | |
| | | var groupdata = detailLocks.GroupBy(item => new { item.MaterielCode, item.lineNo, item.BarcodeUnit, item.WarehouseCode }) |
| | | .Select(group => new FeedbackOutboundDetailsModel |
| | | { |
| | | |
| | | foreach (var detail in outboundOrder.Details) |
| | | { |
| | | // è·å该æç»å¯¹åºçæ¡ç ä¿¡æ¯ï¼ä»éå®è®°å½ï¼ |
| | | var detailLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() |
| | | .Where(x => x.OrderNo == outboundOrder.OrderNo && |
| | | x.OrderDetailId == detail.Id && |
| | | x.Status == (int)OutLockStockStatusEnum.æ£é宿) |
| | | .ToListAsync(); |
| | | |
| | | var detailModel = new FeedbackOutboundDetailsModel |
| | | { |
| | | materialCode = detail.MaterielCode, |
| | | lineNo = detail.lineNo, |
| | | warehouseCode = detail.WarehouseCode, |
| | | qty = detail.BarcodeQty, // 使ç¨è®¢åæç»çå·²åºåºæ°é |
| | | currentDeliveryQty = detail.BarcodeQty, |
| | | unit = detail.BarcodeUnit, |
| | | barcodes = detailLocks.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel |
| | | { |
| | | barcode = lockInfo.CurrentBarcode, |
| | | supplyCode = lockInfo.SupplyCode, |
| | | batchNo = lockInfo.BatchNo, |
| | | unit = lockInfo.BarcodeUnit, |
| | | qty = lockInfo.BarcodeQty // |
| | | }).ToList() |
| | | }; |
| | | |
| | | feedmodel.details.Add(detailModel); |
| | | materialCode = group.Key.MaterielCode, |
| | | lineNo = group.Key.lineNo, |
| | | warehouseCode = group.Key.WarehouseCode, |
| | | qty = group.Sum(x => x.PickedQty), |
| | | currentDeliveryQty = group.Sum(x => x.PickedQty), |
| | | unit = group.Key.BarcodeUnit, |
| | | barcodes = group.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel |
| | | { |
| | | barcode = lockInfo.CurrentBarcode, |
| | | supplyCode = lockInfo.SupplyCode, |
| | | batchNo = lockInfo.BatchNo, |
| | | unit = lockInfo.BarcodeUnit, |
| | | qty = lockInfo.PickedQty |
| | | }).ToList() |
| | | }).ToList(); |
| | | outfeedmodel.details.AddRange(groupdata); |
| | | } |
| | | var result = await _invokeMESService.FeedbackOutbound(feedmodel); |
| | | var result = await _invokeMESService.FeedbackOutbound(outfeedmodel); |
| | | if (result != null && result.code == 200) |
| | | { |
| | | await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>() |
| | |
| | | .Where(x => x.OrderId == outboundOrder.Id) |
| | | .ExecuteCommandAsync(); |
| | | |
| | | await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>() |
| | | .SetColumns(x => x.ReturnToMESStatus == 1) |
| | | .Where(x => x.Id == outboundOrder.Id) |
| | | .ExecuteCommandAsync(); |
| | | } |
| | | await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>() |
| | | .SetColumns(x => x.ReturnToMESStatus == 1) |
| | | .Where(x => x.Id == outboundOrder.Id) |
| | | .ExecuteCommandAsync(); |
| | | } |
| | | |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | if (dborder != null && dborder.SignSeq == 0) |
| | | { |
| | | return content.Error("åªææ¿å°éæ£ç»ææè½å
¥åºï¼"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("æ²¡ææ¾å°éæ£åæ®æ°æ®ã"); |
| | | } |
| | | } |
| | | // Dt_InboundOrder inboundOrder = GetInboundOrder(materielGroupDTO.OrderNo); |