From ad7bfeb2c3c948a5fc83e4459c51bfbeb0e271a5 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期六, 28 十二月 2024 13:58:30 +0800 Subject: [PATCH] PDA --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 45 ++++++++++++++++++++++++++++----------------- 1 files changed, 28 insertions(+), 17 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" index 00206f2..607c8f4 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" @@ -25,6 +25,7 @@ using WIDESEA_Common.OrderEnum; using WIDESEA_Common.StockEnum; using WIDESEA_Common.TaskEnum; +using WIDESEA_Common.WareHouseEnum; using WIDESEA_Core; using WIDESEA_Core.BaseRepository; using WIDESEA_Core.BaseServices; @@ -36,6 +37,7 @@ using WIDESEA_External.ERPService; using WIDESEA_IBasicRepository; using WIDESEA_IBasicService; +using WIDESEA_IInboundRepository; using WIDESEA_IInboundService; using WIDESEA_IOutboundRepository; using WIDESEA_IOutboundService; @@ -61,6 +63,7 @@ private readonly IBasicRepository _basicRepository; private readonly IApiInfoRepository _apiInfoRepository; private readonly IInvokeERPService _invokeERPService; + private readonly IInboundRepository _inboundRepository; public ITaskRepository Repository => BaseDal; @@ -74,7 +77,7 @@ public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList(); - public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IStockRepository stockRepository, IBasicService basicService, IRecordService recordService, IOutboundService outboundService, IStockService stockService, IBasicRepository basicRepository, IApiInfoRepository apiInfoRepository, IInvokeERPService invokeERPService) : base(BaseDal) + public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IStockRepository stockRepository, IBasicService basicService, IRecordService recordService, IOutboundService outboundService, IStockService stockService, IBasicRepository basicRepository, IApiInfoRepository apiInfoRepository, IInvokeERPService invokeERPService, IInboundRepository inboundRepository) : base(BaseDal) { _mapper = mapper; _unitOfWorkManage = unitOfWorkManage; @@ -86,19 +89,22 @@ _basicRepository = basicRepository; _apiInfoRepository = apiInfoRepository; _invokeERPService = invokeERPService; + _inboundRepository = inboundRepository; } /// <summary> /// 浠诲姟淇℃伅鎺ㄩ�佽嚦WCS /// </summary> /// <returns></returns> - public WebResponseContent PushTasksToWCS() + public WebResponseContent PushTasksToWCS(List<Dt_Task> tasks, string agvDescription = "") { try { - List<Dt_Task> tasks = BaseDal.QueryData(x => (TaskTypes.Contains(x.TaskType) && x.TaskStatus == (int)TaskStatusEnum.New)); List<WMSTaskDTO> taskDTOs = _mapper.Map<List<WMSTaskDTO>>(tasks); - + taskDTOs.ForEach(x => + { + x.AGVArea = agvDescription; + }); string response = HttpHelper.Post("http://127.0.0.1:9291/api/Task/ReceiveTask", taskDTOs.Serialize()); return JsonConvert.DeserializeObject<WebResponseContent>(response) ?? WebResponseContent.Instance.Error("杩斿洖閿欒"); @@ -129,7 +135,7 @@ return WebResponseContent.Instance.Error($"浠诲姟绫诲瀷閿欒"); } - Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode).Includes(x => x.Details).First(); + Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode && x.WarehouseId==task.WarehouseId).Includes(x => x.Details).First(); if (stockInfo == null) { return WebResponseContent.Instance.Error($"鏈壘鍒版墭鐩樺搴旂殑缁勭洏淇℃伅"); @@ -140,7 +146,7 @@ return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡缁戝畾璐т綅"); } - if (stockInfo.Details == null || stockInfo.Details.Count == 0) + if (stockInfo.Details.Count == 0) { return WebResponseContent.Instance.Error($"鏈壘鍒拌鎵樼洏搴撳瓨鏄庣粏淇℃伅"); } @@ -158,27 +164,32 @@ LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); - + Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x=>x.WarehouseId== task.WarehouseId); //娴嬭瘯鏋跺叆搴撳簱瀛樼姸鎬� - if (task.TaskType == TaskTypeEnum.TestInbound.ObjToInt()) + if (task.TaskType == TaskTypeEnum.Inbound.ObjToInt() && warehouse.WarehouseCode==WarehouseEnum.HA64.ToString()) { stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚鏈缓鍑哄簱鍗�.ObjToInt(); - stockInfo.Details.ForEach(x => - { - x.Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt(); - }); } else { stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt(); + } + stockInfo.Details.ForEach(x => + { + x.Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt(); + }); stockInfo.LocationCode = locationInfo.LocationCode; + //鎺ㄩ�佸叆搴撳畬鎴愮粰Erp + //鑾峰彇鍏ュ簱鍗曟洿鏂板叆搴撳崟 + //Dt_InboundOrder inboundOrder = _inboundRepository.InboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x=>x.InboundOrderNo); + if (true) + { + } _unitOfWorkManage.BeginTran(); BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.浜哄伐瀹屾垚 : OperateTypeEnum.鑷姩瀹屾垚); - - _basicService.LocationInfoService.Repository.UpdateData(locationInfo); - + _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId); _stockRepository.StockInfoRepository.UpdateData(stockInfo); _stockRepository.StockInfoDetailRepository.UpdateData(stockInfo.Details); _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationChangeType.InboundCompleted); @@ -250,12 +261,12 @@ int beforeStatus = locationInfo.LocationStatus; locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); - _basicService.LocationInfoService.Repository.UpdateData(locationInfo); + _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)stockInfo.PalletType, LocationStatusEnum.Free, stockInfo.WarehouseId); BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚); _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, (LocationStatusEnum)beforeStatus, LocationChangeType.OutboundCompleted, stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); _unitOfWorkManage.CommitTran(); - + //鎺ㄩ�佸嚭搴撳畬鎴� return WebResponseContent.Instance.OK(); } catch (Exception ex) -- Gitblit v1.9.3