´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/×躸²Ö/GroundStationJob_ZH.cs
@@ -71,8 +71,8 @@ ////夿AGVä»»å¡å®æï¼ååç»å°é¢ç«åè´§å®æ //device.SetValue(GroundStationDBName.W_TakeRequest, false, item.StationCode); //device.SetValue(GroundStationDBName.W_TakeFinish, false, item.StationCode); Dt_Task task = _taskRepository.QueryFirst(x => x.DeviceCode == item.StackerCraneCode && x.TaskState == TaskStatusEnum.New.ObjToInt() && x.NextAddress==item.StationCode); Dt_Task? taskOther = _taskRepository.QueryFirst(x => x.Roadway == item.StackerCraneCode && (x.TaskState == TaskStatusEnum.SC_Executing.ObjToInt() || x.TaskState == TaskStatusEnum.SC_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.AGV_Executing.ObjToInt() || x.TaskState == TaskStatusEnum.AGV_WaitToExecute.ObjToInt() || x.TaskState == TaskStatusEnum.Exception.ObjToInt())); Dt_Task task = _taskRepository.QueryFirst(x => x.DeviceCode == item.StackerCraneCode && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.TaskState == TaskStatusEnum.New.ObjToInt() && x.NextAddress==item.StationCode); Dt_Task? taskOther = _taskRepository.QueryFirst(x => x.Roadway == item.StackerCraneCode && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && (x.TaskState == TaskStatusEnum.SC_Executing.ObjToInt() || x.TaskState == TaskStatusEnum.SC_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.AGV_Executing.ObjToInt() || x.TaskState == TaskStatusEnum.AGV_WaitToExecute.ObjToInt() || x.TaskState == TaskStatusEnum.Exception.ObjToInt())); if (task != null && isCanPut && !isCanTake && !putRequest && !putFinish && !takeRequest && !takeFinish && taskOther == null) { _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, nextAddress: item.StackerCraneStationCode); ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/×躸²Ö/StackerCraneJob_ZH.cs
@@ -21,6 +21,12 @@ using WIDESEAWCS_Tasks.StackerCraneJob; using WIDESEAWCS_Tasks; using WIDESEAWCS_Core; using Newtonsoft.Json; using WIDESEAWCS_Common.APIEnum; using WIDESEAWCS_Core.Helper; using WIDESEAWCS_DTO.TaskInfo; using WIDESEAWCS_Core.Caches; using AutoMapper; namespace WIDESEAWCS_Tasks { @@ -32,14 +38,32 @@ private readonly ITaskRepository _taskRepository; private readonly IRouterService _routerService; private readonly IStationMangerRepository _stationMangerRepository; private readonly ICacheService _cacheService; private readonly IMapper _mapper; private List<Dt_ApiInfo> apiInfos; public StackerCraneJob_ZH(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository) public StackerCraneJob_ZH(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository,ICacheService cacheService, IMapper mapper) { _taskService = taskService; _taskExecuteDetailService = taskExecuteDetailService; _taskRepository = taskRepository; _routerService = routerService; _stationMangerRepository = stationMangerRepository; _cacheService = cacheService; _mapper = mapper; string? apiInfoStr = _cacheService.Get("apiInfos"); if (!string.IsNullOrEmpty(apiInfoStr)) { List<Dt_ApiInfo>? infos = JsonConvert.DeserializeObject<List<Dt_ApiInfo>>(apiInfoStr); if (infos == null || infos.Count == 0) { apiInfos = new List<Dt_ApiInfo>(); } else { apiInfos = infos; } } } public Task Execute(IJobExecutionContext context) @@ -183,22 +207,89 @@ if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { if (OutTaskStationIsOccupied(task) != null || true) if (OutTaskStationIsOccupied(task) == null) { return task; } else { bool flag = false; List<string> otherOutStaionCodes = _routerService.QueryNextRoutes(commonStackerCrane.DeviceCode, task.NextAddress, task.TaskType).Select(x => x.ChildPosi).ToList(); List<Dt_Task> tasks = _taskService.QueryStackerCraneOutTasks(commonStackerCrane.DeviceCode, otherOutStaionCodes); foreach (var item in tasks) { if (OutTaskStationIsOccupied(task) != null) { return task; flag = true; break; } } task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); if (!flag) { task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); } } } if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.WMSIsReloaction.ToString())?.ApiAddress; if (string.IsNullOrEmpty(url)) { _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"æªæ¾å°WMSç§»åºå¤ææ¥å£"); WriteError(commonStackerCrane.DeviceCode, $"æªæ¾å°WMSç§»åºå¤ææ¥å£"); _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°WMSç§»åºå¤ææ¥å£"); return null; } string response = HttpHelper.Post($"{url}?taskNum={task.TaskNum}&locationCode={task.CurrentAddress}", "");//todo è°ç¨WMSä»»å¡å®ææ¹æ³ if (string.IsNullOrEmpty(response)) { _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"ç§»åºæ¥å£è°ç¨é误"); WriteError(commonStackerCrane.DeviceCode, $"ç§»åºæ¥å£è°ç¨é误"); _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"ç§»åºæ¥å£è°ç¨é误"); return null; } WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(response); if (responseContent == null || !responseContent.Status) { _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"ç§»åºæ¥å£è°ç¨é误"); WriteError(commonStackerCrane.DeviceCode, $"ç§»åºæ¥å£è°ç¨é误"); _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"ç§»åºæ¥å£è°ç¨é误"); return null; } WMSTaskDTO? taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(responseContent.Data.Serialize()); if (taskDTO == null) { _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"ç§»åºæ¥å£è°ç¨é误"); WriteError(commonStackerCrane.DeviceCode, $"ç§»åºæ¥å£è°ç¨é误"); _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"ç§»åºæ¥å£è°ç¨é误"); return null; } if (task.TaskNum == taskDTO.TaskNum) { return task; } else { Dt_Task reloTask = _mapper.Map<Dt_Task>(taskDTO); //å¤æç§»åºè´§ä½ä»»å¡æ¯å¦å·²åå¨ï¼å¦åå¨å æ§è¡ Dt_Task existTask = _taskService.QueryStackerExistTask(reloTask.PalletCode, reloTask.SourceAddress); if (existTask != null && existTask.TaskState == (int)TaskStatusEnum.SC_Execute) { return existTask; } else if (existTask != null && existTask.TaskState != (int)TaskStatusEnum.SC_Execute) { return null; } else { reloTask.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); reloTask.CurrentAddress = taskDTO.SourceAddress; reloTask.NextAddress = taskDTO.TargetAddress; reloTask.DeviceCode = task.DeviceCode; reloTask.TaskType = TaskTypeEnum.Relocation.ObjToInt(); int taskId = _taskRepository.AddData(reloTask); reloTask.TaskId = taskId; } return reloTask; } } ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ProOutOrderService.cs
@@ -95,7 +95,7 @@ } else if (outOrderDTO.OType==2) { warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA101.ToString()); warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA71.ToString()); } List<Dt_ProOutOrderDetail> proOutOrderDetails = new List<Dt_ProOutOrderDetail>(); Dictionary<string,string> keyValuePairs =new Dictionary<string, string>(); ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/ProStockInfoRepository.cs
@@ -56,7 +56,7 @@ .Any(v => v.ProductCode == proOutOrderDetail.PCode && v.ProductVersion.StartsWith(proOutOrderDetail.PVer.Substring(0,1)) && (isCanLot ? isCanLot : v.BagNo == proOutOrderDetail.PLot) && (isCanLot ? isCanLot : v.ProductCode == proOutOrderDetail.PLot) && (isCanDate ? isCanDate : v.DateCode == proOutOrderDetail.DateCode) )) .ToList(); ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_StockService/ProStockInfoService.cs
@@ -128,7 +128,7 @@ bool isCanLot = string.IsNullOrEmpty(outOrderDetail.PLot); bool isCanDate = string.IsNullOrEmpty(outOrderDetail.DateCode); float stockTotalQuantity = stockInfos.Select(x => x.proStockInfoDetails.Where(x => x.ProductCode == outOrderDetail.PCode && x.ProductVersion.StartsWith(outOrderDetail.PVer.Substring(0, 1)) && (isCanLot ? isCanLot : x.BagNo == outOrderDetail.PLot) && (isCanLot ? isCanLot : x.ProductCode == outOrderDetail.PLot) && (isCanDate ? isCanDate : x.DateCode == outOrderDetail.DateCode)) .Sum(v => v.StockPcsQty - v.OutboundQuantity)).Sum(x => x); //stockInfos = stockInfos.OrderBy(x => x.Id).ToList(); @@ -141,13 +141,13 @@ Dt_ProStockInfo stockInfo = stockInfos[index]; float useableStockQuantity = stockInfo.proStockInfoDetails .Where(x => x.ProductCode == outOrderDetail.PCode && x.ProductVersion.StartsWith(outOrderDetail.PVer.Substring(0,1)) && (isCanLot ? isCanLot : x.BagNo == outOrderDetail.PLot) && (isCanLot ? isCanLot : x.ProductCode == outOrderDetail.PLot) && (isCanDate ? isCanDate : x.DateCode == outOrderDetail.DateCode)) .Sum(x => x.StockPcsQty - x.OutboundQuantity); if (useableStockQuantity < needQuantity && useableStockQuantity >0) { stockInfo.proStockInfoDetails.Where(x => x.ProductCode == outOrderDetail.PCode && x.ProductVersion.StartsWith(outOrderDetail.PVer.Substring(0, 1)) && (isCanLot ? isCanLot : x.BagNo == outOrderDetail.PLot) && (isCanLot ? isCanLot : x.ProductCode == outOrderDetail.PLot) && (isCanDate ? isCanDate : x.DateCode == outOrderDetail.DateCode)).ToList().ForEach(x => x.OutboundQuantity = x.StockPcsQty); needQuantity -= useableStockQuantity; } @@ -158,7 +158,7 @@ //满足æ¡ä»¶è¿è¡åé if ((x.StockPcsQty > x.OutboundQuantity) && x.ProductCode == outOrderDetail.PCode && x.ProductVersion.StartsWith(outOrderDetail.PVer.Substring(0, 1)) && (isCanLot ? isCanLot : x.BagNo == outOrderDetail.PLot) && (isCanLot ? isCanLot : x.ProductCode == outOrderDetail.PLot) && (isCanDate ? isCanDate : x.DateCode == outOrderDetail.DateCode)) { if (x.StockPcsQty - x.OutboundQuantity >= needQuantity) @@ -375,11 +375,14 @@ { try { List<Dt_ProStockInfo> proStockInfo = BaseDal.QueryData(x => x.WarehouseId == warehouseId); List<int> proStockId = proStockInfo.Select(x => x.Id).ToList(); List<Dt_ProStockInfoDetail> proStockInfoDetails = BaseDal.Db.Queryable<Dt_ProStockInfoDetail>().Where(x => proStockId.Contains(x.OutDetailId)).ToList(); List<string> proCode = proStockInfoDetails.Select(x => x.ProductCode).ToList(); return WebResponseContent.Instance.OK(data: proCode); //è·åææåºååå· List<Dt_ProStockInfoDetail> proStockInfoDetails = _stockRepository.ProStockInfoRepository.Db.Queryable<Dt_ProStockInfo, Dt_ProStockInfoDetail>((master, detail) => master.Id == detail.ProStockId) .Where((master, detail) => master.WarehouseId == warehouseId) .Select((master, detail) => detail) .ToList(); //è¿æ»¤éå¤ List<string> proCode = proStockInfoDetails.Select(x => x.ProductCode).Distinct().ToList(); return WebResponseContent.Instance.OK("æå",data: proCode); } catch (Exception ex) { @@ -391,11 +394,14 @@ { try { List<Dt_ProStockInfo> proStockInfo = BaseDal.QueryData(x => x.WarehouseId == warehouseId); List<int> proStockId = proStockInfo.Select(x => x.Id).ToList(); List<Dt_ProStockInfoDetail> proStockInfoDetails = BaseDal.Db.Queryable<Dt_ProStockInfoDetail>().Where(x => scrapProCode.Contains(x.ProductCode) && proStockId.Contains(x.OutDetailId)).ToList(); List<string> productVersion = proStockInfoDetails.Select(x => x.ProductVersion).ToList(); return WebResponseContent.Instance.OK(data: productVersion); //è·åæå®äº§ååºåçæ¬ List<Dt_ProStockInfoDetail> proStockInfoDetails = _stockRepository.ProStockInfoRepository.Db.Queryable<Dt_ProStockInfo, Dt_ProStockInfoDetail>((master, detail) => master.Id == detail.ProStockId) .Where((master, detail) => master.WarehouseId == warehouseId && detail.ProductCode== scrapProCode) .Select((master, detail) => detail) .ToList(); //è¿æ»¤éå¤ List<string> productVersion = proStockInfoDetails.Select(x => x.ProductVersion).Distinct().ToList(); return WebResponseContent.Instance.OK("æå",data: productVersion); } catch (Exception ex) { @@ -407,11 +413,14 @@ { try { List<Dt_ProStockInfo> proStockInfo = BaseDal.QueryData(x => x.WarehouseId == warehouseId); List<int> proStockId = proStockInfo.Select(x => x.Id).ToList(); List<Dt_ProStockInfoDetail> proStockInfoDetails = BaseDal.Db.Queryable<Dt_ProStockInfoDetail>().Where(x => scrapProCode.Contains(x.ProductCode) && proStockId.Contains(x.OutDetailId)).ToList(); List<string> lotNumber = proStockInfoDetails.Select(x => x.LotNumber).ToList(); return WebResponseContent.Instance.OK(data: lotNumber); //è·åæå®äº§ååºåæ¹æ¬¡ List<Dt_ProStockInfoDetail> proStockInfoDetails = _stockRepository.ProStockInfoRepository.Db.Queryable<Dt_ProStockInfo, Dt_ProStockInfoDetail>((master, detail) => master.Id == detail.ProStockId) .Where((master, detail) => master.WarehouseId == warehouseId && detail.ProductCode == scrapProCode) .Select((master, detail) => detail) .ToList(); //è¿æ»¤éå¤ List<string> lotNumber = proStockInfoDetails.Select(x => x.LotNumber).Distinct().ToList(); return WebResponseContent.Instance.OK("æå", data: lotNumber); } catch (Exception ex) { ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesProductService.cs
@@ -663,6 +663,7 @@ throw new Exception("忥MESåºåæ¿åºåºå¤±è´¥,é误:" + responseContent.Message); } _unitOfWorkManage.CommitTran(); PushTasksToWCS(tasks); } return content.OK($"æä¾è¿åºåæ¥æ¶æå,ReceiveDown:{model.ReceiveDown}"); } ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -824,6 +824,7 @@ switch (task.TaskType) { case (int)TaskTypeEnum.OutProduct: case (int)TaskTypeEnum.OutSendProduct: content = OutProductCompleted(task); break; case (int)TaskTypeEnum.OutMesRworkProduct: @@ -935,9 +936,12 @@ BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); _unitOfWorkManage.CommitTran(); //MESæååºåºåæ¥ MesShipmentOrderSync shipmentOrderSync = MesOutSync(outProStockInfo, proOutOrderDetail, proStockInfoDetails); ShipmentOrderSync(shipmentOrderSync); ShipmentOrderMESSync(shipmentOrderSync); if (task.TaskType!= TaskTypeEnum.OutSendProduct.ObjToInt()) { MesShipmentOrderSync shipmentOrderSync = MesOutSync(outProStockInfo, proOutOrderDetail, proStockInfoDetails); ShipmentOrderSync(shipmentOrderSync); ShipmentOrderMESSync(shipmentOrderSync); } content.OK(); } catch (Exception ex) ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs
@@ -1024,6 +1024,7 @@ StockQuantity -=(decimal)assignAmount; OrderDetail.OverOutQuantity += assignAmount; OrderDetail.LockQuantity += assignAmount; v.StockQuantity = (float)Math.Round(StockQuantity,3); upstockDetails.Add(v); } else