| | |
| | | *ç¨æ·ä¿¡æ¯ãæéãè§è²ç使ç¨UserContext.Currentæä½ |
| | | *Dt_boxing_headService对å¢ãå ãæ¹æ¥ã导å
¥ã导åºãå®¡æ ¸ä¸å¡ä»£ç æ©å±åç
§ServiceFunFilter |
| | | */ |
| | | using WIDESEA.Core.BaseProvider; |
| | | using WIDESEA.Core.Extensions.AutofacManager; |
| | | using WIDESEA.Entity.DomainModels; |
| | | using System.Linq; |
| | | using WIDESEA.Core.Utilities; |
| | | using System.Linq.Expressions; |
| | | using WIDESEA.Core.Extensions; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.EntityFrameworkCore; |
| | | using Microsoft.Extensions.DependencyInjection; |
| | | using Microsoft.AspNetCore.Http; |
| | | using WIDESEA.Services.IRepositories; |
| | | using Newtonsoft.Json; |
| | | using System.Text; |
| | | using System.Net; |
| | | using System.IO; |
| | | using System; |
| | | using WIDESEA.Services.Repositories; |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Linq.Expressions; |
| | | using System.Net; |
| | | using System.Text; |
| | | using System.Threading; |
| | | using WIDESEA.Common; |
| | | using WIDESEA_Services; |
| | | using WIDESEA.Core.Services; |
| | | using WIDESEA.Core.BaseProvider; |
| | | using WIDESEA.Core.Enums; |
| | | using WIDESEA.Core.Extensions; |
| | | using WIDESEA.Core.Extensions.AutofacManager; |
| | | using WIDESEA.Core.ManageUser; |
| | | using System.Collections.Generic; |
| | | using WIDESEA.Core.Services; |
| | | using WIDESEA.Core.Utilities; |
| | | using WIDESEA.Entity.DomainModels; |
| | | using WIDESEA.Services.IRepositories; |
| | | using WIDESEA.Services.Repositories; |
| | | using WIDESEA.Services.Services.ToMes; |
| | | using WIDESEA_Common.LogEnum; |
| | | using WIDESEA_Services; |
| | | |
| | | namespace WIDESEA.Services.Services |
| | | { |
| | |
| | | |
| | | //newBoxDetail.boxdtl_text1 = |
| | | |
| | | |
| | | //è·åç©ºè´§ä½ |
| | | Dt_locationinfo emptyLocation; |
| | | |
| | | int maxRetries = 20; |
| | | int retryCount = 0; |
| | | bool needRetry; |
| | | do |
| | | { |
| | | needRetry = false; // é»è®¤ä¸éè¦éè¯ |
| | | retryCount++; |
| | | |
| | | //è·åç©ºè´§ä½ |
| | | emptyLocation = CommonFunction.GetEmptyLocationAction(1); |
| | | if (emptyLocation == null) |
| | | { |
| | | return content.Error("æ æ³è·ååºä½"); |
| | | } |
| | | |
| | | // 2. æ£æ¥åºå |
| | | if (IsEmptyPalletLocation(emptyLocation.location_id)) |
| | | { |
| | | needRetry = true; |
| | | continue; // ç´æ¥è¿å
¥ä¸ä¸æ¬¡å¾ªç¯ï¼éè¯ï¼ |
| | | } |
| | | |
| | | // 3. æ£æ¥ä»»å¡ |
| | | if (Dt_taskinfoRepository.Instance.Find(x => x.task_endstation == emptyLocation.location_id).FirstOrDefault() != null) |
| | | { |
| | | needRetry = true; |
| | | continue; |
| | | } |
| | | |
| | | } while (needRetry && retryCount < maxRetries); |
| | | // æ£æ¥æ¯å¦è¶
è¿æå¤§éè¯æ¬¡æ° |
| | | if (retryCount >= maxRetries) |
| | | { |
| | | return content.Error($"æ æ³æ¾å°å¯ç¨åºä½ï¼å·²å°è¯ {retryCount} 次ï¼"); |
| | | } |
| | | LogRecord.WriteLog((int)LogEnum.InBound, $"æçæ¡ç ï¼{rfid},åé
çè´§ä½å·{emptyLocation.location_id}ï¼è´§ä½ç¶æï¼{emptyLocation.location_state}"); |
| | | |
| | | |
| | | Dt_boxing_headRepository.Instance.Add(newBoxHead, true); |
| | | Dt_boxing_detailRepository.Instance.Add(newBoxDetail, true); |
| | | |
| | | //è·åç©ºè´§ä½ |
| | | Dt_locationinfo emptyLocation = CommonFunction.GetEmptyLocationAction(); |
| | | //è·åä»»å¡ |
| | | Dt_taskinfo tmpTaskInfo = CommonFunction.AddWMSTask_BoxPalletIn(emptyLocation, |
| | | rfid, mesInfo.mesInfo_carType, mesInfo.mesInfo_qrCode,""); |
| | |
| | | } |
| | | Logger.AddLog(LoggerType.Add, saveModel, content, content); |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ£æ¥æå®è´§ä½æ¯å¦ä¸ºç©ºæçè´§ä½ |
| | | /// </summary> |
| | | /// <param name="locationId">è´§ä½ID</param> |
| | | /// <returns>true: æ¯ç©ºæçè´§ä½, false: 䏿¯ç©ºæçè´§ä½</returns> |
| | | public bool IsEmptyPalletLocation(string locationId) |
| | | { |
| | | try |
| | | { |
| | | // æ¥è¯¢ç©ºæçè´§ä½ä¿¡æ¯ |
| | | var emptyPalletLocation = VV_ContainerInfo_EmptyPalletRepository.Instance |
| | | .Find(x => x.location_id == locationId).FirstOrDefault(); |
| | | |
| | | // æ¥è¯¢è´§ä½ä¸ç容å¨ä¿¡æ¯ |
| | | var containerInfo = VV_ContainerInfoRepository.Instance |
| | | .Find(x => x.location_id == locationId).FirstOrDefault(); |
| | | |
| | | bool isEmptyPallet = emptyPalletLocation != null || containerInfo != null; |
| | | |
| | | return isEmptyPallet; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogRecord.WriteLog((int)LogEnum.Errer, $"æ£æ¥ç©ºæçè´§ä½å¤±è´¥ï¼è´§ä½IDï¼{locationId}ï¼é误ï¼{ex.Message}"); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | VV_ContainerInfo_EmptyPallet emptyCon = VV_ContainerInfo_EmptyPalletRepository.Instance.FindFirst(x => x.containerhead_barcode == barcode); |
| | | if (emptyCon != null) |
| | | throw new Exception($"åºåä¸å卿çå·ï¼ã{barcode}ãçã空æãåºåï¼è¯·äººå·¥æ ¸å®ï¼æå¨è´§ä½ï¼{emptyCon.location_id}"); |
| | | //è·åç©ºè´§ä½ |
| | | Dt_locationinfo emptyLocation; |
| | | |
| | | //è¯´ææ¯ç©ºæå
¥åº |
| | | Dt_locationinfo emptyLocation = CommonFunction.GetEmptyLocationAction(); |
| | | int maxRetries = 20; |
| | | int retryCount = 0; |
| | | bool needRetry; |
| | | do |
| | | { |
| | | needRetry = false; // é»è®¤ä¸éè¦éè¯ |
| | | retryCount++; |
| | | |
| | | //è·åç©ºè´§ä½ |
| | | emptyLocation = CommonFunction.GetEmptyLocationAction(1); |
| | | if (emptyLocation == null) |
| | | { |
| | | return content.Error("æ æ³è·ååºä½"); |
| | | } |
| | | |
| | | // 2. æ£æ¥åºå |
| | | if (IsEmptyPalletLocation(emptyLocation.location_id)) |
| | | { |
| | | needRetry = true; |
| | | continue; // ç´æ¥è¿å
¥ä¸ä¸æ¬¡å¾ªç¯ï¼éè¯ï¼ |
| | | } |
| | | |
| | | // 3. æ£æ¥ä»»å¡ |
| | | if (Dt_taskinfoRepository.Instance.Find(x => x.task_endstation == emptyLocation.location_id).FirstOrDefault() != null) |
| | | { |
| | | needRetry = true; |
| | | continue; |
| | | } |
| | | |
| | | } while (needRetry && retryCount < maxRetries); |
| | | // æ£æ¥æ¯å¦è¶
è¿æå¤§éè¯æ¬¡æ° |
| | | if (retryCount >= maxRetries) |
| | | { |
| | | return content.Error($"æ æ³æ¾å°å¯ç¨åºä½ï¼å·²å°è¯ {retryCount} 次ï¼"); |
| | | } |
| | | |
| | | LogRecord.WriteLog((int)LogEnum.InBound, $"æçæ¡ç ï¼{barcode},åé
çè´§ä½å·{emptyLocation.location_id}ï¼è´§ä½ç¶æï¼{emptyLocation.location_state}"); |
| | | |
| | | |
| | | VV_ContainerInfo_EmptyPallet SelectLocation = VV_ContainerInfo_EmptyPalletRepository.Instance.FindFirst(x => x.location_id == emptyLocation.location_id); |
| | | VV_ContainerInfo conInfohw = VV_ContainerInfoRepository.Instance.FindFirst(x => x.location_id == emptyLocation.location_id); |
| | | if (SelectLocation != null || conInfohw != null) |
| | | { |
| | | LogRecord.WriteLog((int)LogEnum.InBound, $"åé
çè´§ä½å·²æè´§,è´§ä½å·{emptyLocation.location_id}"); |
| | | throw new Exception($"åé
çè´§ä½å·²æè´§,è´§ä½å·{SelectLocation.location_id}"); |
| | | } |
| | | |
| | | //卿¤å¤çæWMSä»»å¡åä¸åWCSä»»å¡---------空æå
¥åº |
| | | Dt_taskinfo tmpTaskInfo = null; |
| | | content = Dt_taskinfoRepository.Instance.DbContextBeginTransaction(() => |