From 81b3c30ab5e042c3a740e4e5077c1d85013b6482 Mon Sep 17 00:00:00 2001 From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com> Date: 星期日, 31 八月 2025 10:27:56 +0800 Subject: [PATCH] 代码提交 --- 项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService.cs | 176 +--------------------------------------------------------- 1 files changed, 5 insertions(+), 171 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService.cs" index 8805d0a..ac1956f 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService.cs" @@ -34,7 +34,6 @@ using WIDESEA_Core.Helper; using WIDESEA_DTO; using WIDESEA_DTO.Inbound; -using WIDESEA_DTO.MES; using WIDESEA_DTO.Stock; using WIDESEA_DTO.Task; using WIDESEA_External.ERPService; @@ -63,6 +62,7 @@ private readonly IApiInfoRepository _apiInfoRepository; private readonly IInvokeERPService _invokeERPService; private readonly IPalletTypeInfoRepository _palletTypeInfoRepository; + private readonly IAGVStationInfoRepository _agvStationInfoRepository; public ITaskRepository Repository => BaseDal; private Dictionary<string, OrderByType> _taskOrderBy = new() @@ -71,11 +71,11 @@ {nameof(Dt_Task.CreateDate),OrderByType.Asc}, }; - public List<int> TaskTypes => typeof(TaskTypeEnum).GetEnumIndexList(); + public List<int> TaskInboundTypes => typeof(TaskTypeEnum).GetEnumIndexList().Where(x => x >= 500 && x < 900).ToList(); - public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList(); + public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList().Where(x => x >= 100 && x < 500).ToList(); - public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IStockRepository stockRepository, IBasicService basicService, IRecordService recordService, IStockService stockService, IBasicRepository basicRepository, IApiInfoRepository apiInfoRepository, IInvokeERPService invokeERPService, IPalletTypeInfoRepository palletTypeInfoRepository) : base(BaseDal) + public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IStockRepository stockRepository, IBasicService basicService, IRecordService recordService, IStockService stockService, IBasicRepository basicRepository, IApiInfoRepository apiInfoRepository, IInvokeERPService invokeERPService, IPalletTypeInfoRepository palletTypeInfoRepository, IAGVStationInfoRepository agvStationInfoRepository) : base(BaseDal) { _mapper = mapper; _unitOfWorkManage = unitOfWorkManage; @@ -87,6 +87,7 @@ _apiInfoRepository = apiInfoRepository; _invokeERPService = invokeERPService; _palletTypeInfoRepository = palletTypeInfoRepository; + _agvStationInfoRepository = agvStationInfoRepository; } /// <summary> @@ -138,173 +139,6 @@ { return WebResponseContent.Instance.Error(ex.Message); } - } - - public WebResponseContent AGVTasks(SaveModel saveModel) - { - try - { - var palletCode = saveModel.MainData["barcode"].ToString(); - var stationCode = saveModel.MainData["address"].ToString(); - var warehouseId = saveModel.MainData["warehouseId"].ObjToInt(); - Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == warehouseId); - if (warehouse == null) - { - return WebResponseContent.Instance.Error("鏈壘鍒板簱鍖�"); - } - - Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode && x.WarehouseId == warehouseId); - if (task != null) - { - return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡鐢熸垚浠诲姟"); - } - if (Repository.QueryFirst(x => x.SourceAddress == stationCode && x.TaskStatus == TaskStatusEnum.New.ObjToInt()) != null && warehouse.WarehouseCode != WarehouseEnum.HA58.ToString()) - { - return WebResponseContent.Instance.Error($"璇ョ珯鐐瑰凡鏈夋湭鎵ц鐨勪换鍔�"); - } - Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First(); - if (stockInfo == null) - { - return WebResponseContent.Instance.Error($"鏈壘鍒扮粍鐩樹俊鎭�"); - } - if (stockInfo.StockStatus != StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt()) - { - return WebResponseContent.Instance.Error($"璇ユ墭鐩樼姸鎬佷笉姝g‘"); - } - if (warehouseId != stockInfo.WarehouseId) - { - return WebResponseContent.Instance.Error($"浠撳簱涓嶆纭�"); - } - Dt_Task newTask = new Dt_Task() - { - CurrentAddress = stationCode, - Grade = 0, - NextAddress = "", - PalletCode = palletCode, - Roadway = warehouse.Remark,//鏌ヨ瀵瑰簲绾胯竟浠撳湴鍧�宸烽亾鍙� - SourceAddress = stationCode, - TargetAddress = "", - TaskType = TaskTypeEnum.OutAllocate.ObjToInt(), - TaskStatus = TaskStatusEnum.New.ObjToInt(), - WarehouseId = stockInfo.WarehouseId, - PalletType = stockInfo.PalletType, - MaterielCode = stockInfo.Details.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode, - Quantity = (float)stockInfo.Details.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.StockQuantity, - }; - _unitOfWorkManage.BeginTran(); - BaseDal.AddData(newTask); - PushTasksToWCS(new List<Dt_Task> { newTask }); - _unitOfWorkManage.CommitTran(); - return WebResponseContent.Instance.OK(); - } - catch (Exception ex) - { - _unitOfWorkManage.RollbackTran(); - return WebResponseContent.Instance.Error(ex.Message); - } - } - - /// <summary> - /// 鎴愬搧浠撳叆搴撲换鍔″畬鎴� - /// </summary> - public WebResponseContent InProductCompleted(Dt_Task task) - { - WebResponseContent content=new WebResponseContent(); - try - { - switch (task.TaskType) - { - case (int)TaskTypeEnum.EmptyProductBack: - content = EmptyProBackCompleted(task); - break; - case (int)TaskTypeEnum.InProductBack: - content = InProBackCompleted(task); - break; - default: - content.Error("鏈煡浠诲姟绫诲瀷"); - break; - } - } - catch (Exception ex) - { - _unitOfWorkManage.RollbackTran(); - content.Error(ex.Message); - } - return content; - } - public WebResponseContent EmptyProBackCompleted(Dt_Task task) - { - WebResponseContent content = new WebResponseContent(); - try - { - //鏇存柊鍏ュ簱鐘舵�� - task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); - _unitOfWorkManage.BeginTran(); - BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.浜哄伐瀹屾垚 : OperateTypeEnum.鑷姩瀹屾垚); - _unitOfWorkManage.CommitTran(); - content.OK(); - } - catch (Exception ex) - { - _unitOfWorkManage.RollbackTran(); - content.Error(ex.Message); - } - return content; - } - /// <summary> - /// 鎴愬搧浣欐枡閫�搴撲换鍔″畬鎴� - /// </summary> - /// <param name="task"></param> - /// <returns></returns> - public WebResponseContent InProBackCompleted(Dt_Task task) - { - WebResponseContent content = new WebResponseContent(); - try - { - //鑾峰彇缁勭洏淇℃伅 - Dt_ProStockInfo proStockInfo = _stockRepository.ProStockInfoRepository.Db.Queryable<Dt_ProStockInfo>().Where(x => x.PalletCode == task.PalletCode).Includes(x => x.proStockInfoDetails).First(); - if (proStockInfo == null) - { - return content.Error($"鏈壘鍒拌兌妗嗕负{task.PalletCode}缁勭洏淇℃伅"); - } - Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); - if (locationInfo == null) - { - return content.Error($"鏈壘鍒扮洰鏍囪揣浣嶄俊鎭�"); - } - if (locationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt()) - { - return content.Error($"璐т綅鐘舵�佷笉姝g‘"); - } - if (proStockInfo.StockStatus!=StockStatusEmun.鎴愬搧浣欐枡鍥炲簱.ObjToInt()) - { - return content.Error($"鑳舵{proStockInfo.PalletCode}搴撳瓨鐘舵�佷笉姝g‘"); - } - LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; - locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); - proStockInfo.LocationCode = locationInfo.LocationCode; - proStockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt(); - proStockInfo.proStockInfoDetails.ForEach(x => - { - x.ProOutDetailStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt(); - }); - //鏇存柊鍏ュ簱鐘舵�� - task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); - _unitOfWorkManage.BeginTran(); - BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.浜哄伐瀹屾垚 : OperateTypeEnum.鑷姩瀹屾垚); - _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, proStockInfo.PalletType, LocationStatusEnum.InStock, locationInfo.WarehouseId); - _stockRepository.ProStockInfoRepository.UpdateData(proStockInfo); - _stockRepository.ProStockInfoDetailRepository.UpdateData(proStockInfo.proStockInfoDetails); - _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.InStock, LocationChangeType.InboundCompleted); - _unitOfWorkManage.CommitTran(); - content.OK(); - } - catch (Exception ex) - { - _unitOfWorkManage.RollbackTran(); - content.Error(ex.Message); - } - return content; } } } -- Gitblit v1.9.3