| | |
| | | using AngleSharp.Io; |
| | | using AngleSharp.Dom; |
| | | using AngleSharp.Io; |
| | | using Mapster; |
| | | using Masuit.Tools; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using SqlSugar; |
| | | using System.Net.NetworkInformation; |
| | | using System.Reflection; |
| | |
| | | using WIDESEA_StorageSocketServices; |
| | | using WIDESEA_StorageTaskRepository; |
| | | using WIDESEAWCS_BasicInfoRepository; |
| | | using WIDESEAWCS_BasicInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | |
| | | namespace WIDESEA_StorageTaskServices; |
| | |
| | | private readonly LogFactory LogFactory = new LogFactory(); |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | private readonly IStockInfoRepository _stockInfoRepository; |
| | | private readonly IDt_StationManagerRepository _stationManagerRepository; |
| | | private readonly IDt_StationManagerService _stationManagerService; |
| | | private readonly IDt_Task_HtyRepository _task_HtyRepository; |
| | | private readonly IMapper _mapper; |
| | | private readonly ILocationInfoRepository _locationRepository; |
| | | |
| | | private readonly IDt_HandAutomaticRepository _handAutomaticRepository; |
| | | |
| | | public Dt_TaskService(IDt_TaskRepository BaseDal, |
| | | IUnitOfWorkManage unitOfWorkManage, |
| | | IStockInfoRepository stockInfoRepository, |
| | | IDt_Task_HtyRepository task_HtyRepository, |
| | | IMapper mapper, |
| | | ILocationInfoRepository locationRepository, |
| | | IStockInfoDetailRepository stockInfoDetailRepository) : base(BaseDal) |
| | | IStockInfoDetailRepository stockInfoDetailRepository, |
| | | IDt_StationManagerRepository stationManagerRepository, |
| | | IDt_HandAutomaticRepository handAutomaticRepository, |
| | | IDt_StationManagerService stationManagerService) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _stockInfoRepository = stockInfoRepository; |
| | | _task_HtyRepository = task_HtyRepository; |
| | | _mapper = mapper; |
| | | _locationRepository = locationRepository; |
| | | _stationManagerRepository = stationManagerRepository; |
| | | _handAutomaticRepository = handAutomaticRepository; |
| | | _stationManagerService = stationManagerService; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | #region å¤é¨æ¥å£æ¹æ³ |
| | | public WebResponseContent InboundTask(TaskDTO taskDTO) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var HandAutomatic = _handAutomaticRepository.QueryFirst(x => true && x.HandAutomatic == "Automatic"); |
| | | if (HandAutomatic != null) |
| | | { |
| | | return content.Error("å½å䏿¯æå¨æ¨¡å¼"); |
| | | } |
| | | var station = _stationManagerRepository.QueryFirst(x => x.HostName == taskDTO.SourceAddress && x.stationType == 1); |
| | | if (station == null) |
| | | { |
| | | return content.Error("æªæ¾å°å
¥åºç«å°ä¿¡æ¯"); |
| | | } |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.PalletCode == taskDTO.PalletCode); |
| | | if (task != null) |
| | | { |
| | | return content.Error("该æçå·²åå¨ä»»å¡"); |
| | | } |
| | | var location = GetLocation(); |
| | | Dt_Task taskNew = new Dt_Task() |
| | | { |
| | | TaskNum = BaseDal.GetTaskNo().Result, |
| | | PalletCode = taskDTO.PalletCode, |
| | | Dispatchertime = DateTime.Now, |
| | | Grade = 1, |
| | | SeqNo = Convert.ToInt32(0), |
| | | CommandID = Convert.ToInt32(0), |
| | | SourceAddress = station.stationName, |
| | | TargetAddress = location.LocationCode, |
| | | CurrentAddress = station.stationName, |
| | | NextAddress = location.LocationCode, |
| | | TaskType = (int)TaskInboundTypeEnum.Inbound, |
| | | TaskState = (int)TaskInStatusEnum.InNew, |
| | | Roadway = "PDA", |
| | | }; |
| | | task_call task_Call = new task_call() |
| | | { |
| | | d_task_type = "16" , |
| | | d_floor = "1", |
| | | d_involed1 = taskNew.SourceAddress, |
| | | d_involed2 = InsertHyphenEveryTwoChars(taskNew.TargetAddress), |
| | | d_involed5 = taskNew.TaskNum.ToString(), |
| | | }; |
| | | location.LocationStatus = (int)LocationEnum.Lock; |
| | | _locationRepository.UpdateData(location); |
| | | BaseDal.AddData(taskNew); |
| | | SqlSugarHelper.DbAGV.Insertable(task_Call).ExecuteCommand(); |
| | | return content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent SamplingInboundTask(TaskDTO taskDTO) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var HandAutomatic = _handAutomaticRepository.QueryFirst(x => true && x.HandAutomatic == "Automatic"); |
| | | if (HandAutomatic != null) |
| | | { |
| | | return content.Error("å½å䏿¯æå¨æ¨¡å¼"); |
| | | } |
| | | var station = _stationManagerRepository.QueryFirst(x => x.HostName == taskDTO.SourceAddress && x.stationType == 1); |
| | | if (station == null) |
| | | { |
| | | return content.Error("æªæ¾å°å
¥åºç«å°ä¿¡æ¯"); |
| | | } |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.PalletCode == taskDTO.PalletCode); |
| | | if (task != null) |
| | | { |
| | | return content.Error("该æçå·²åå¨ä»»å¡"); |
| | | } |
| | | var stock = _stockInfoRepository.QueryFirst(x => x.PalletCode == taskDTO.PalletCode); |
| | | if (stock == null) |
| | | { |
| | | return content.Error("该æçåºåä¸åå¨"); |
| | | } |
| | | var location = _locationRepository.QueryFirst(x => x.LocationCode == stock.LocationCode); |
| | | |
| | | Dt_Task taskNew = new Dt_Task() |
| | | { |
| | | TaskNum = BaseDal.GetTaskNo().Result, |
| | | PalletCode = taskDTO.PalletCode, |
| | | Dispatchertime = DateTime.Now, |
| | | Grade = 1, |
| | | SeqNo = Convert.ToInt32(0), |
| | | CommandID = Convert.ToInt32(0), |
| | | SourceAddress = station.stationName, |
| | | TargetAddress = stock.LocationCode, |
| | | CurrentAddress = station.stationName, |
| | | NextAddress = stock.LocationCode, |
| | | TaskType = (int)TaskInboundTypeEnum.InQuality, |
| | | TaskState = (int)TaskInStatusEnum.InNew, |
| | | Roadway = "PDA", |
| | | }; |
| | | task_call task_Call = new task_call() |
| | | { |
| | | d_task_type = "16", |
| | | d_floor = "1", |
| | | d_involed1 = taskNew.SourceAddress, |
| | | d_involed2 = InsertHyphenEveryTwoChars(taskNew.TargetAddress), |
| | | d_involed5 = taskNew.TaskNum.ToString(), |
| | | }; |
| | | location.LocationStatus = (int)LocationEnum.Lock; |
| | | _locationRepository.UpdateData(location); |
| | | BaseDal.AddData(taskNew); |
| | | SqlSugarHelper.DbAGV.Insertable(task_Call).ExecuteCommand(); |
| | | return content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | public WebResponseContent OutboundTask(TaskDTO taskDTO) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var HandAutomatic = _handAutomaticRepository.QueryFirst(x => true && x.HandAutomatic == "Automatic"); |
| | | if (HandAutomatic != null) |
| | | { |
| | | return content.Error("å½å䏿¯æå¨æ¨¡å¼"); |
| | | } |
| | | StationStatus stationOut = _stationManagerService.GetStationStatus("B001"); |
| | | if (stationOut == null) |
| | | { |
| | | return content.Error("è·ååºåºç«å°ä¿¡æ¯å¤±è´¥ï¼è¯·éæ°åºåº"); |
| | | } |
| | | Dt_StationManager station; |
| | | if (stationOut.WorkstationO == "0") |
| | | { |
| | | station = _stationManagerRepository.QueryFirst(x => x.stationName == "B001::1" && x.stationType == 2); |
| | | } |
| | | else if (stationOut.WorkstationT == "0") |
| | | { |
| | | station = _stationManagerRepository.QueryFirst(x => x.stationName == "B001::2" && x.stationType == 2); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("åºåºç«å°ç¶æä¸æ¯ç©ºé²ï¼è¯·ç¡®è®¤åä¸ååºåºä»»å¡"); |
| | | } |
| | | if (station == null) |
| | | { |
| | | return content.Error("æªæ¾å°åºåºç«å°ä¿¡æ¯"); |
| | | } |
| | | var stock = _stockInfoRepository.QueryFirst(x => x.LocationCode == taskDTO.SourceAddress); |
| | | if (stock == null) |
| | | { |
| | | return content.Error("该æçåºåä¸åå¨"); |
| | | } |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.PalletCode == stock.PalletCode); |
| | | if (task != null) |
| | | { |
| | | return content.Error("该æçå·²åå¨ä»»å¡"); |
| | | } |
| | | |
| | | var location = _locationRepository.QueryFirst(x => x.LocationCode == stock.LocationCode); |
| | | if (location.LocationStatus != (int)LocationEnum.InStock) |
| | | { |
| | | return content.Error("该åºä½ä¸æ¯æè´§ç¶æï¼è¯·ç¡®è®¤ç¶æåä¸åä»»å¡ï¼"); |
| | | } |
| | | |
| | | Dt_Task taskNew = new Dt_Task() |
| | | { |
| | | TaskNum = BaseDal.GetTaskNo().Result, |
| | | PalletCode = taskDTO.PalletCode, |
| | | Dispatchertime = DateTime.Now, |
| | | Grade = 1, |
| | | SeqNo = Convert.ToInt32(0), |
| | | CommandID = Convert.ToInt32(0), |
| | | SourceAddress = station.stationName, |
| | | TargetAddress = stock.LocationCode, |
| | | CurrentAddress = station.stationName, |
| | | NextAddress = stock.LocationCode, |
| | | TaskType = (int)TaskOutboundTypeEnum.Outbound, |
| | | TaskState = (int)TaskOutStatusEnum.OutNew, |
| | | Roadway = "PDA", |
| | | }; |
| | | task_call task_Call = new task_call() |
| | | { |
| | | d_task_type = "32", |
| | | d_floor = "1", |
| | | d_involed1 = InsertHyphenEveryTwoChars(taskNew.SourceAddress), |
| | | d_involed2 = taskNew.TargetAddress, |
| | | d_involed5 = taskNew.TaskNum.ToString(), |
| | | }; |
| | | location.LocationStatus = (int)LocationEnum.Lock; |
| | | _locationRepository.UpdateData(location); |
| | | BaseDal.AddData(taskNew); |
| | | SqlSugarHelper.DbAGV.Insertable(task_Call).ExecuteCommand(); |
| | | return content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | public WebResponseContent SamplingOutboundTask(TaskDTO taskDTO) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var HandAutomatic = _handAutomaticRepository.QueryFirst(x => true && x.HandAutomatic == "Automatic"); |
| | | if (HandAutomatic != null) |
| | | { |
| | | return content.Error("å½å䏿¯æå¨æ¨¡å¼"); |
| | | } |
| | | StationStatus stationOut = _stationManagerService.GetStationStatus("B002"); |
| | | if (stationOut == null) |
| | | { |
| | | return content.Error("è·ååºåºç«å°ä¿¡æ¯å¤±è´¥ï¼è¯·éæ°åºåº"); |
| | | } |
| | | Dt_StationManager station; |
| | | if (stationOut.WorkstationO == "0") |
| | | { |
| | | station = _stationManagerRepository.QueryFirst(x => x.stationName == "B002::1" && x.stationType == 1); |
| | | } |
| | | else if (stationOut.WorkstationT == "0") |
| | | { |
| | | station = _stationManagerRepository.QueryFirst(x => x.stationName == "B002::2" && x.stationType == 1); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("åºåºç«å°ç¶æä¸æ¯ç©ºé²ï¼è¯·ç¡®è®¤åä¸ååºåºä»»å¡"); |
| | | } |
| | | if (station == null) |
| | | { |
| | | return content.Error("æªæ¾å°åºåºç«å°ä¿¡æ¯"); |
| | | } |
| | | var stock = _stockInfoRepository.QueryFirst(x => x.LocationCode == taskDTO.SourceAddress); |
| | | if (stock == null) |
| | | { |
| | | return content.Error("该åºä½åºåä¸åå¨"); |
| | | } |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.PalletCode == stock.PalletCode); |
| | | if (task != null) |
| | | { |
| | | return content.Error("该æçå·²åå¨ä»»å¡"); |
| | | } |
| | | |
| | | var location = _locationRepository.QueryFirst(x => x.LocationCode == stock.LocationCode); |
| | | if (location.LocationStatus != (int)LocationEnum.InStock) |
| | | { |
| | | return content.Error("该åºä½ä¸æ¯æè´§ç¶æï¼è¯·ç¡®è®¤ç¶æåä¸åä»»å¡ï¼"); |
| | | } |
| | | |
| | | Dt_Task taskNew = new Dt_Task() |
| | | { |
| | | TaskNum = BaseDal.GetTaskNo().Result, |
| | | PalletCode = taskDTO.PalletCode, |
| | | Dispatchertime = DateTime.Now, |
| | | Grade = 1, |
| | | SeqNo = Convert.ToInt32(0), |
| | | CommandID = Convert.ToInt32(0), |
| | | SourceAddress = station.stationName, |
| | | TargetAddress = stock.LocationCode, |
| | | CurrentAddress = station.stationName, |
| | | NextAddress = stock.LocationCode, |
| | | TaskType = (int)TaskOutboundTypeEnum.OutQuality, |
| | | TaskState = (int)TaskOutStatusEnum.OutNew, |
| | | Roadway = "PDA", |
| | | }; |
| | | task_call task_Call = new task_call() |
| | | { |
| | | d_task_type = "32", |
| | | d_floor = "1", |
| | | d_involed1 = InsertHyphenEveryTwoChars(taskNew.SourceAddress), |
| | | d_involed2 = taskNew.TargetAddress, |
| | | d_involed5 = taskNew.TaskNum.ToString(), |
| | | }; |
| | | location.LocationStatus = (int)LocationEnum.Lock; |
| | | _locationRepository.UpdateData(location); |
| | | BaseDal.AddData(taskNew); |
| | | SqlSugarHelper.DbAGV.Insertable(task_Call).ExecuteCommand(); |
| | | return content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public string InsertHyphenEveryTwoChars(string input) |
| | | { |
| | | if (string.IsNullOrEmpty(input)) |
| | | { |
| | | return input; |
| | | } |
| | | |
| | | StringBuilder result = new StringBuilder(); |
| | | |
| | | for (int i = 0; i < input.Length; i += 2) |
| | | { |
| | | // æ·»å 两个å符 |
| | | result.Append(input.Substring(i, 2)); |
| | | |
| | | // 妿䏿¯æå两个åç¬¦ï¼æ·»å ä¸ä¸ªè¿å符 |
| | | if (i + 2 < input.Length) |
| | | { |
| | | result.Append('-'); |
| | | } |
| | | } |
| | | |
| | | return result.ToString(); |
| | | } |
| | | |
| | | public DtLocationInfo GetLocation() |
| | | { |
| | | List<DtLocationInfo> locations = _locationRepository.QueryData(x => x.LocationStatus == (int)LocationEnum.Free); |
| | | return locations.OrderBy(x => x.Layer).ThenBy(x => x.Column).ThenBy(x => x.Row).FirstOrDefault(); |
| | | } |
| | | |
| | | public WebResponseContent TaskComplete(int? TaskNum) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var task = BaseDal.QueryFirst(x => x.TaskNum == TaskNum); |
| | | if (task != null) |
| | | { |
| | | switch (task.TaskType) |
| | | { |
| | | case (int)TaskInboundTypeEnum.Inbound: |
| | | LogFactory.GetLog("ä»»å¡å®æ").InfoFormat(true, "å
¥åºä»»å¡", ""); |
| | | return CompleteInboundTask(task); |
| | | |
| | | case (int)TaskOutboundTypeEnum.Outbound: |
| | | //case (int)TaskStationTypeEnum..: |
| | | |
| | | LogFactory.GetLog("ä»»å¡å®æ").InfoFormat(true, "åºåºä»»å¡", ""); |
| | | return CompleteOutboundTask(task); |
| | | |
| | | case (int)TaskRelocationTypeEnum.Relocation: |
| | | return CompleteRelocationboundTask(task); |
| | | |
| | | case (int)TaskOutboundTypeEnum.OutQuality: |
| | | return CompleteSamplingOutboundTask(task); |
| | | |
| | | case (int)TaskInboundTypeEnum.InQuality: |
| | | return CompleteSamplingInboundTask(task); |
| | | |
| | | default: |
| | | return content.Error("ä»»å¡ç±»åä¸åå¨"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return content.Error("æªæ¾å°ä»»å¡"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | public WebResponseContent TaskStatus(Dt_Task task) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | if (task != null) |
| | | { |
| | | switch (task.TaskType) |
| | | { |
| | | case (int)TaskInboundTypeEnum.Inbound: |
| | | case (int)TaskInboundTypeEnum.InQuality: |
| | | task.TaskState = (int)TaskInStatusEnum.AGV_InExecuting; |
| | | BaseDal.Update(task); |
| | | break; |
| | | |
| | | case (int)TaskOutboundTypeEnum.Outbound: |
| | | case (int)TaskOutboundTypeEnum.OutQuality: |
| | | task.TaskState = (int)TaskInStatusEnum.AGV_InExecuting; |
| | | BaseDal.Update(task); |
| | | break; |
| | | |
| | | case (int)TaskRelocationTypeEnum.Relocation: |
| | | task.TaskState = (int)TaskInStatusEnum.AGV_InExecuting; |
| | | BaseDal.Update(task); |
| | | break; |
| | | default: |
| | | return content.Error("ä»»å¡ç±»åä¸åå¨"); |
| | | } |
| | | return content.OK(); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("æªæ¾å°ä»»å¡"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent CompleteInboundTask(Dt_Task task) |
| | | { |
| | |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | task.TaskState = 215; |
| | | var locationInf = _locationRepository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | locationInf.LocationStatus = (int)LocationEnum.InStock; |
| | | locationInf.LocationStatus = 2; |
| | | var stock = new DtStockInfo() |
| | | { |
| | | PalletCode = task.PalletCode, |
| | |
| | | _locationRepository.UpdateData(locationInf); |
| | | TaskMoveHty(task); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | LogFactory.GetLog("å
¥åºä»»å¡å®æ").InfoFormat(true, $"请æ±åæ°ï¼{JsonConvert.SerializeObject(task)}", ""); |
| | | return content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | |
| | | LogFactory.GetLog("å
¥åºä»»å¡å®æ").InfoFormat(true, $"请æ±åæ°ï¼{JsonConvert.SerializeObject(ex.Message)}", ""); |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent CompleteSamplingInboundTask(Dt_Task task) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | task.TaskState = 215; |
| | | var locationInf = _locationRepository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | locationInf.LocationStatus = (int)LocationEnum.InStock; |
| | | _locationRepository.UpdateData(locationInf); |
| | | TaskMoveHty(task); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | LogFactory.GetLog("æ½æ£å
¥åºä»»å¡å®æ").InfoFormat(true, $"请æ±åæ°ï¼{JsonConvert.SerializeObject(task)}", ""); |
| | | return content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | LogFactory.GetLog("æ½æ£å
¥åºä»»å¡å®æ").InfoFormat(true, $"请æ±åæ°ï¼{JsonConvert.SerializeObject(ex.Message)}", ""); |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | var locationInf = _locationRepository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | locationInf.LocationStatus = (int)LocationEnum.Free; |
| | | var stock = _stockInfoRepository.QueryFirst(x=>x.PalletCode == task.PalletCode); |
| | | task.TaskState = 135; |
| | | var locationInf = _locationRepository.QueryFirst(x => x.LocationCode == task.SourceAddress); |
| | | locationInf.LocationStatus = 0; |
| | | var stock = _stockInfoRepository.QueryFirst(x => x.PalletCode == task.PalletCode); |
| | | if(stock!=null) |
| | | { |
| | | DtStockInfo_Hty stockInfo_Hty = stock.Adapt<DtStockInfo_Hty>(); |
| | | stockInfo_Hty.ModifyDate = DateTime.Now; |
| | | |
| | | DtStockInfo_Hty stockInfo_Hty = stock.Adapt<DtStockInfo_Hty>(); |
| | | stockInfo_Hty.ModifyDate = DateTime.Now; |
| | | AddStockInfoHty(stockInfo_Hty); |
| | | |
| | | AddStockInfoHty(stockInfo_Hty); |
| | | |
| | | _stockInfoRepository.DeleteData(stock); |
| | | _stockInfoRepository.DeleteData(stock); |
| | | } |
| | | _locationRepository.UpdateData(locationInf); |
| | | |
| | | TaskMoveHty(task); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | LogFactory.GetLog("åºåºä»»å¡å®æ").InfoFormat(true, $"请æ±åæ°ï¼{JsonConvert.SerializeObject(task)}", ""); |
| | | return content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | LogFactory.GetLog("åºåºä»»å¡å®æ").InfoFormat(true, $"请æ±åæ°ï¼{JsonConvert.SerializeObject(ex.Message)}", ""); |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public WebResponseContent CompleteSamplingOutboundTask(Dt_Task task) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | | task.TaskState = 135; |
| | | TaskMoveHty(task); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | LogFactory.GetLog("æ½æ£åºåºä»»å¡å®æ").InfoFormat(true, $"请æ±åæ°ï¼{JsonConvert.SerializeObject(task)}", ""); |
| | | return content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | LogFactory.GetLog("æ½æ£åºåºä»»å¡å®æ").InfoFormat(true, $"请æ±åæ°ï¼{JsonConvert.SerializeObject(ex.Message)}", ""); |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | task.TaskState = 315; |
| | | var locationInf = _locationRepository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | var location = _locationRepository.QueryFirst(x => x.LocationCode == task.SourceAddress); |
| | | locationInf.LocationStatus = (int)LocationEnum.InStock; |
| | | location.LocationStatus = (int)LocationEnum.Free; |
| | | locationInf.LocationStatus = 2; |
| | | location.LocationStatus = 0; |
| | | |
| | | var stock = _stockInfoRepository.QueryFirst(x => x.PalletCode == task.PalletCode); |
| | | |
| | |
| | | _locationRepository.UpdateData(location); |
| | | TaskMoveHty(task); |
| | | _unitOfWorkManage.CommitTran(); |
| | | LogFactory.GetLog("ç§»åºä»»å¡å®æ").InfoFormat(true, $"请æ±åæ°ï¼{JsonConvert.SerializeObject(task)}", ""); |
| | | return content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | LogFactory.GetLog("ç§»åºä»»å¡å®æ").InfoFormat(true, $"请æ±åæ°ï¼{JsonConvert.SerializeObject(ex.Message)}", ""); |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | var taskHtyNG = CreateHistoricalTask(task); |
| | | |
| | | var taskNum = task.TaskNum.ToString(); |
| | | var isTaskHtyAdd = _task_HtyRepository.AddData(taskHtyNG) > 0; |
| | | var isTaskDelete = Delete(task.TaskId); |
| | | var AgvTask = SqlSugarHelper.DbAGV.Queryable<task_call>().Where(x => x.d_involed5 == task.TaskNum).First(); |
| | | if(AgvTask != null) |
| | | var AgvTask = SqlSugarHelper.DbAGV.Queryable<task_call>().Where(x => x.d_involed5 == taskNum).First(); |
| | | if (AgvTask != null) |
| | | { |
| | | SqlSugarHelper.DbAGV.Deleteable(AgvTask).ExecuteCommand(); |
| | | } |
| | |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | LogFactory.GetLog("å é¤ä»»å¡").InfoFormat(true, $"请æ±åæ°ï¼{JsonConvert.SerializeObject(ex.Message)}", ""); |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | |
| | | /// <returns>æ¯å¦å 餿å</returns> |
| | | public bool Delete(int id) |
| | | { |
| | | return BaseDal.Delete(id); |
| | | return BaseDal.Delete(id); |
| | | } |
| | | private void AddStockInfoHty(DtStockInfo_Hty dtStock) |
| | | private void AddStockInfoHty(DtStockInfo_Hty dtStock) |
| | | { |
| | | var isStockAdd = SqlSugarHelper.DbWMS.InsertNav(dtStock).IncludesAllFirstLayer().ExecuteCommand(); |
| | | if (!isStockAdd) |