| | |
| | | Locationtype = 10; |
| | | } |
| | | |
| | | if (dt_StockInfo.MaterialType == (int)InventoryMaterialType.æå) |
| | | { |
| | | string[] targetCodes = dt_StockInfo.PalletCode.Split("*"); |
| | | Dt_InboundOrder dt_Inbound = _inboundService.InbounOrderService.Repository.QueryFirst(x => x.OrderName == targetCodes[0]); |
| | | if (dt_Inbound.Startingcolumn != 0 || dt_Inbound.Terminationcolumn != 0) |
| | | { |
| | | newLocation = _basicService.LocationInfoService.GetLocation2(newSourceAddress.RoadwayNo, Locationtype, dt_Inbound.Startingcolumn, dt_Inbound.Terminationcolumn); |
| | | |
| | | |
| | | WriteLog.GetLog("åºä½è·åæ¥å¿ï¼GetLocation").Write($"åææå
¥åºè·ååºä½ï¼ä¼ å
¥å¼,RoadwayNo:{newSourceAddress.RoadwayNo},ç±»åï¼{Locationtype}ï¼åºé´ä¸ºï¼{dt_Inbound.Startingcolumn}ä¸{dt_Inbound.Terminationcolumn}=============è·åå°çåºä½ä¸ºï¼{newLocation.LocationCode}", $"åºä½è·åæ¥å¿ï¼GetLocation2"); |
| | | |
| | | int maxRetries = 20; |
| | | int retryCount = 0; |
| | | bool needRetry; |
| | | |
| | | do |
| | | { |
| | | needRetry = false; // é»è®¤ä¸éè¦éè¯ |
| | | retryCount++; |
| | | |
| | | |
| | | if (dt_StockInfo.MaterialType == (int)InventoryMaterialType.æå) |
| | | { |
| | | string[] targetCodes = dt_StockInfo.PalletCode.Split("*"); |
| | | Dt_InboundOrder dt_Inbound = _inboundService.InbounOrderService.Repository.QueryFirst(x => x.OrderName == targetCodes[0]); |
| | | if (dt_Inbound.Startingcolumn != 0 || dt_Inbound.Terminationcolumn != 0) |
| | | { |
| | | newLocation = _basicService.LocationInfoService.GetLocation2(newSourceAddress.RoadwayNo, Locationtype, dt_Inbound.Startingcolumn, dt_Inbound.Terminationcolumn); |
| | | } |
| | | else |
| | | { |
| | | newLocation = _basicService.LocationInfoService.GetLocation(newSourceAddress.RoadwayNo, Locationtype); |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | newLocation = _basicService.LocationInfoService.GetLocation(newSourceAddress.RoadwayNo, Locationtype); |
| | | WriteLog.GetLog("åºä½è·åæ¥å¿ï¼GetLocation").Write($"åææå
¥åºè·ååºä½ï¼ä¼ å
¥å¼,RoadwayNo:{newSourceAddress.RoadwayNo},ç±»åï¼{Locationtype}ï¼=============è·åå°çåºä½ä¸ºï¼{newLocation.LocationCode}", $"åºä½è·åæ¥å¿ï¼GetLocation,æåæ¥å£éé¢"); |
| | | } |
| | | |
| | | } |
| | | else |
| | | |
| | | |
| | | if (newLocation == null) |
| | | { |
| | | return WebResponseContent.Instance.Error("æ æ³è·ååºä½"); |
| | | } |
| | | |
| | | // 2. æ£æ¥åºå |
| | | if (_stockService.StockInfoService.Repository.QueryFirst(x => x.LocationCode == newLocation.LocationCode) !=null) |
| | | { |
| | | needRetry = true; |
| | | continue; // ç´æ¥è¿å
¥ä¸ä¸æ¬¡å¾ªç¯ï¼éè¯ï¼ |
| | | } |
| | | |
| | | // 3. æ£æ¥ä»»å¡ |
| | | if (BaseDal.QueryFirst(x => x.TargetAddress == newLocation.LocationCode) != null) |
| | | { |
| | | needRetry = true; |
| | | continue; |
| | | } |
| | | |
| | | // 4. æ£æ¥åå²ä»»å¡ |
| | | if (_taskHtyService.CrueeTaskHty(newLocation.LocationCode)) |
| | | { |
| | | needRetry = true; |
| | | continue; |
| | | } |
| | | |
| | | } while (needRetry && retryCount < maxRetries); |
| | | |
| | | // æ£æ¥æ¯å¦è¶
è¿æå¤§éè¯æ¬¡æ° |
| | | if (retryCount >= maxRetries) |
| | | { |
| | | newLocation = _basicService.LocationInfoService.GetLocation(newSourceAddress.RoadwayNo, Locationtype); |
| | | WriteLog.GetLog("åºä½è·åæ¥å¿ï¼GetLocation").Write($"åææå
¥åºè·ååºä½ï¼ä¼ å
¥å¼,RoadwayNo:{newSourceAddress.RoadwayNo},ç±»åï¼{Locationtype}ï¼=============è·åå°çåºä½ä¸ºï¼{newLocation.LocationCode}", $"åºä½è·åæ¥å¿ï¼GetLocation"); |
| | | return WebResponseContent.Instance.Error($"æ æ³æ¾å°å¯ç¨åºä½ï¼å·²å°è¯ {retryCount} 次ï¼"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //string[] Pallet = PalletCode.Split("-"); |
| | | if (newLocation != null && newSourceAddress != null) |
| | | { |
| | |
| | | { |
| | | newLocation.LocationStatus = newSourceAddress.LocationType == (int)LocationTypeEnum.EmptyOut ? LocationStatusEnum.PalletLock.ObjToInt() : LocationStatusEnum.Lock.ObjToInt(); |
| | | } |
| | | BaseDal.AddData(dt_Task); |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"该åºä½{newSourceAddress.LocationCode}çè´§ä½ç¶æå¼å¸¸ï¼ä¸å¯é"); |
| | | } |
| | | _basicService.LocationInfoService.UpdateData(newLocation); |
| | | BaseDal.AddData(dt_Task); |
| | | |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return content = WebResponseContent.Instance.Error($"çæå
¥åºä»»å¡åºéï¼åºéä¿¡æ¯:{ex.Message}"); |
| | | throw; |
| | | } |