From 659b0ed98c87b164b96ac43b3c0c8a7d2f975bf2 Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期五, 28 二月 2025 10:51:20 +0800 Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 73 ++++++++++++++++++++++++++++++++++-- 1 files changed, 68 insertions(+), 5 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 beea70e..d0cb670 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" @@ -50,6 +50,7 @@ using WIDESEA_ITaskInfoRepository; using WIDESEA_ITaskInfoService; using WIDESEA_Model.Models; +using WIDESEA_Model.Models.Outbound; using WIDESEA_TaskInfoRepository; namespace WIDESEA_TaskInfoService @@ -150,6 +151,68 @@ } } + 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 + }; + _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> @@ -209,7 +272,7 @@ stockInfo.LocationCode = locationInfo.LocationCode; #region 绌虹鍏ュ簱/鎷i�夊洖搴�/鐢熶骇閫�鏂� - if (task.TaskType == TaskTypeEnum.InEmpty.ObjToInt() || task.TaskType == TaskTypeEnum.InPick.ObjToInt() || (task.TaskType==TaskTypeEnum.ProductionReturn.ObjToInt() && warehouse.WarehouseCode==WarehouseEnum.HA64.ToString())) + if (task.TaskType == TaskTypeEnum.InEmpty.ObjToInt() || task.TaskType == TaskTypeEnum.InPick.ObjToInt() || (task.TaskType == TaskTypeEnum.ProductionReturn.ObjToInt() && warehouse.WarehouseCode == WarehouseEnum.HA64.ToString())) { stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt(); task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); @@ -261,10 +324,10 @@ if (inboundOrder.OrderType == InOrderTypeEnum.Return.ObjToInt()) { returnOrder = _inboundRepository.ReturnOrderRepository.Db.Queryable<Dt_ReturnOrder>().Where(x => x.OrderNo == inboundOrder.UpperOrderNo).Includes(x => x.Details).First(); - returnOrder.ReturnOrderStatus=ReturnOrderStatusEnum.Returned.ObjToInt(); + returnOrder.ReturnOrderStatus = ReturnOrderStatusEnum.Returned.ObjToInt(); foreach (var item in inboundOrder.Details) { - Dt_ReturnOrderDetail returnOrderDetail = returnOrder.Details?.FirstOrDefault(x=>x.MCode==item.MaterielCode); + Dt_ReturnOrderDetail returnOrderDetail = returnOrder.Details?.FirstOrDefault(x => x.MCode == item.MaterielCode); if (returnOrderDetail != null) { returnOrderDetail.OverReturnQty = item.OverInQuantity; @@ -312,7 +375,7 @@ _inboundRepository.InboundOrderRepository.UpdateData(inboundOrder); _inboundRepository.InboundOrderDetailRepository.UpdateData(inboundOrderDetail); } - if (returnOrder!=null) + if (returnOrder != null) { _inboundRepository.ReturnOrderRepository.UpdateData(returnOrder); _inboundRepository.ReturnOrderDetailRepository.UpdateData(returnOrder.Details); @@ -411,7 +474,7 @@ task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); _unitOfWorkManage.BeginTran(); - if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()|| task.TaskType == TaskTypeEnum.OutAllocate.ObjToInt() || task.TaskType == TaskTypeEnum.MesHandPickOutbound.ObjToInt() || task.TaskType == TaskTypeEnum.MesHandOutbound.ObjToInt()) + if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt() || task.TaskType == TaskTypeEnum.OutAllocate.ObjToInt() || task.TaskType == TaskTypeEnum.MesHandPickOutbound.ObjToInt() || task.TaskType == TaskTypeEnum.MesHandOutbound.ObjToInt()) { //澶勭悊鍑哄簱璇︽儏 if (outboundOrderDetails.Count > 0) -- Gitblit v1.9.3