Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn
# Conflicts:
# 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/TestToolModel.cs
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_DTO.Agv; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.APIEnum; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | |
| | | List<Dt_WarehouseDevice> warehouseDevices = Db.Queryable<Dt_WarehouseDevice>().ToList(); |
| | | |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | |
| | | bool flag = false; |
| | | |
| | | foreach (var item in taskDTOs) |
| | | { |
| | | if (BaseDal.QueryFirst(x => x.TaskNum == item.TaskNum || x.PalletCode == item.PalletCode) != null) |
| | | { |
| | | flag = true; |
| | | continue; |
| | | } |
| | | Dt_Task task = _mapper.Map<Dt_Task>(item); |
| | |
| | | |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(tasks.Select(x => x.TaskNum).ToList(), "æ¥æ¶WMSä»»å¡"); |
| | | |
| | | content = tasks.Count > 0 ? WebResponseContent.Instance.OK("æå") : WebResponseContent.Instance.Error("失败"); |
| | | content = (tasks.Count > 0 || flag) ? WebResponseContent.Instance.OK("æå") : WebResponseContent.Instance.Error("失败"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | /// <returns></returns> |
| | | public string? RequestAssignLocation(int taskNum, string roadwayNo) |
| | | { |
| | | string responseStr = HttpHelper.Get($"http://127.0.0.1:9283/api/Task/AssignInboundTaskLocation?taskNum={taskNum}&roadwayNo={roadwayNo}"); |
| | | string responseStr = HttpHelper.Get($"http://127.0.0.1:9293/api/Task/AssignInboundTaskLocation?taskNum={taskNum}&roadwayNo={roadwayNo}"); |
| | | |
| | | WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); |
| | | if (responseContent != null && responseContent.Status && responseContent.Data != null) |
| | |
| | | WebResponseContent content = _taskService.RequestWMSTask(conveyorLineInfoRead.Barcode, item.StationCode); |
| | | if (content.Status) |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.ACK, true); |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | } |
| | | } |
| | | } |
| | | else if (!conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && conveyorLineSignalWrite.ACK) |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.ACK, false); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.PalletCode == conveyorLineInfoRead.Barcode && x.DeviceCode == item.StationDeviceCode); |
| | | if (task != null) |
| | | { |
| | | task.CurrentAddress = item.StackerCraneStationCode; |
| | | task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); |
| | | task.DeviceCode = item.StackerCraneCode; |
| | | _taskRepository.UpdateData(task); |
| | | } |
| | | |
| | | device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode); |
| | | } |
| | | |
| | | } |
| | | else if (item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt()) |
| | | { |
| | | if(!conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && !conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.STB && !conveyorLineSignalWrite.ACK) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && string.IsNullOrEmpty(x.NextAddress)); |
| | | if(task != null) |
| | | { |
| | | string oldAddress = task.NextAddress; |
| | | int oldStatus = task.TaskState; |
| | | task.NextAddress = item.StationCode; |
| | | task.DeviceCode = item.StackerCraneCode; |
| | | task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); |
| | | task.TargetAddress = item.StationCode; |
| | | _taskRepository.UpdateData(task); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"ç³»ç»èªå¨æµç¨,ç®æ å°åç±{oldAddress}åæ´ä¸º{task.NextAddress},ä»»å¡ç¶æç±{oldStatus}åæ´ä¸º{task.TaskState}"); |
| | | } |
| | | } |
| | | |
| | | if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK)//å
¥åº |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.NextAddress == item.StackerCraneCode); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNum && x.NextAddress == item.StationCode); |
| | | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode); |
| | |
| | | |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"ç³»ç»èªå¨æµç¨,ç®æ å°åç±{oldAddress}åæ´ä¸º{task.NextAddress},ä»»å¡ç¶æç±{oldStatus}åæ´ä¸º{task.TaskState}"); |
| | | |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt()); |
| | | device.SetValue(W_ConveyorLineDB.ACK, true); |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | } |
| | | } |
| | | else if (!conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && conveyorLineSignalWrite.ACK) |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.ACK, false); |
| | | device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode); |
| | | } |
| | | else |
| | | { |
| | | if (!conveyorLineSignalWrite.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Goods) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt()); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() && x.DeviceCode == item.StationDeviceCode); |
| | | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode); |
| | |
| | | |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"ç³»ç»èªå¨æµç¨,ç®æ å°åç±{oldAddress}åæ´ä¸º{task.NextAddress},ä»»å¡ç¶æç±{oldStatus}åæ´ä¸º{task.TaskState}"); |
| | | |
| | | device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum); |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress); |
| | | device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress); |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt()); |
| | | device.SetValue(W_ConveyorLineDB.STB, true); |
| | | device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt(), item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.STB, true, item.StationCode); |
| | | } |
| | | } |
| | | else if (conveyorLineSignalWrite.STB && conveyorLineSignalRead.ACK && conveyorLineStatus.Goods) |
| | | { |
| | | _taskService.TaskCompleted(conveyorLineInfoRead.TaskNum); |
| | | device.SetValue(W_ConveyorLineDB.STB, false); |
| | | device.SetValue(W_ConveyorLineDB.STB, false, item.StationCode); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"ç³»ç»èªå¨æµç¨,ç®æ å°åç±{oldAddress}åæ´ä¸º{task.NextAddress},ä»»å¡ç¶æç±{oldStatus}åæ´ä¸º{task.TaskState}"); |
| | | |
| | | device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum); |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt()); |
| | | device.SetValue(W_ConveyorLineDB.STB, true); |
| | | device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.STB, true, item.StationCode); |
| | | } |
| | | } |
| | | } |
| | | else if (conveyorLineSignalWrite.STB && conveyorLineSignalRead.ACK && !conveyorLineStatus.Alarm) |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.STB, false); |
| | | device.SetValue(W_ConveyorLineDB.STB, false, item.StationCode); |
| | | } |
| | | else if (!conveyorLineSignalRead.STB && conveyorLineSignalWrite.ACK && !conveyorLineStatus.Alarm) |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.ACK, false); |
| | | device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode); |
| | | } |
| | | } |
| | | } |
| | |
| | | using WIDESEAWCS_Tasks.HoisterJob; |
| | | using WIDESEAWCS_Tasks.StackerCraneJob; |
| | | using WIDESEAWCS_Core.Caches; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using WIDESEAWCS_QuartzJob.Repository; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly IRouterService _routerService; |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | private readonly IRouterRepository _routerRepository; |
| | | private List<Dt_ApiInfo> apiInfos; |
| | | |
| | | public StackerCraneJob_GM(ITaskService taskService, ICacheService cacheService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository) |
| | | public StackerCraneJob_GM(ITaskService taskService, ICacheService cacheService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository) |
| | | { |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | |
| | | _routerService = routerService; |
| | | _stationMangerRepository = stationMangerRepository; |
| | | _cacheService = cacheService; |
| | | _routerRepository = routerRepository; |
| | | |
| | | string? apiInfoStr = _cacheService.Get("apiInfos"); |
| | | if (!string.IsNullOrEmpty(apiInfoStr)) |
| | |
| | | task.ExceptionMessage = ""; |
| | | _taskRepository.UpdateData(task); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"ç³»ç»èªå¨æµç¨ï¼ä»»å¡ç¶æä»ã{oldState}ã转å°ã{task.TaskState}ã"); |
| | | |
| | | commonStackerCrane.Communicator.Write("DB105.54", (short)1); |
| | | } |
| | | } |
| | | } |
| | |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneStationCode == task.NextAddress); |
| | | if (stationManger == null) |
| | | { |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"AGVç«ç¹æªé
ç½®,{task.NextAddress}"); |
| | | _taskService.UpdateTaskExceptionMessage(taskNum, $"AGVç«ç¹æªé
ç½®,{task.NextAddress}"); |
| | | return WebResponseContent.Instance.Error($"AGVç«ç¹æªé
ç½®,{task.NextAddress}"); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"è¾é线åºåºç«ç¹æªé
ç½®,{task.NextAddress}"); |
| | | _taskService.UpdateTaskExceptionMessage(taskNum, $"è¾é线åºåºç«ç¹æªé
ç½®,{task.NextAddress}"); |
| | | return WebResponseContent.Instance.Error($"è¾é线åºåºç«ç¹æªé
ç½®,{task.NextAddress}"); |
| | | } |
| | | |
| | | int oldStatus = task.TaskState; |
| | | task.DeviceCode = "AGV_CSJ"; |
| | | task.TaskState = TaskStatusEnum.AGV_Execute.ObjToInt(); |
| | | task.CurrentAddress = stationManger.AGVStationCode; |
| | | task.NextAddress = task.TargetAddress; |
| | | task.DeviceCode = "CL01_GM"; |
| | | task.TaskState = TaskStatusEnum.Line_Execute.ObjToInt(); |
| | | task.CurrentAddress = stationManger.StationCode; |
| | | _taskRepository.UpdateData(task); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"ç³»ç»èªå¨æµç¨,ï¼ä»»å¡ç¶æä»ã{oldStatus}ã转å°ã{task.TaskState}ã"); |
| | | //todo 宿 |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup || task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) |
| | | { |
| | |
| | | if (device != null) |
| | | { |
| | | OtherDevice client = (OtherDevice)device; |
| | | if (client.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanPut, stationManger.StationCode))//åºåºç«å°æªè¢«å ç¨ |
| | | if (!client.GetValue<R_ConveyorLineDB, bool>(R_ConveyorLineDB.Goods, stationManger.StationCode))//åºåºç«å°æªè¢«å ç¨ |
| | | { |
| | | task.NextAddress = stationManger.StackerCraneStationCode; |
| | | _taskRepository.UpdateData(task); |
| | | client.SetValue(GroundStationDBName.R_IsCanPut, true, stationManger.StationCode); |
| | | return task; |
| | | } |
| | | } |
| | |
| | | WebResponseContent content = _taskService.RequestWMSTask(conveyorLineInfoRead.Barcode, item.StationCode); |
| | | if (content.Status) |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.ACK, true); |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | } |
| | | } |
| | | } |
| | | else if (!conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && conveyorLineSignalWrite.ACK) |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.ACK, false); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.PalletCode == conveyorLineInfoRead.Barcode && x.DeviceCode == item.StationDeviceCode); |
| | | if (task != null) |
| | | { |
| | | task.CurrentAddress = item.StackerCraneStationCode; |
| | | task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); |
| | | task.DeviceCode = item.StackerCraneCode; |
| | | _taskRepository.UpdateData(task); |
| | | } |
| | | |
| | | device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode); |
| | | } |
| | | |
| | | } |
| | | else if (item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt()) |
| | | { |
| | | if (!conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && !conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.STB && !conveyorLineSignalWrite.ACK) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && string.IsNullOrEmpty(x.NextAddress)); |
| | | if (task != null) |
| | | { |
| | | string oldAddress = task.NextAddress; |
| | | int oldStatus = task.TaskState; |
| | | task.NextAddress = item.StationCode; |
| | | task.DeviceCode = item.StackerCraneCode; |
| | | task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); |
| | | task.TargetAddress = item.StationCode; |
| | | _taskRepository.UpdateData(task); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"ç³»ç»èªå¨æµç¨,ç®æ å°åç±{oldAddress}åæ´ä¸º{task.NextAddress},ä»»å¡ç¶æç±{oldStatus}åæ´ä¸º{task.TaskState}"); |
| | | } |
| | | } |
| | | |
| | | if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK)//å
¥åº |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.NextAddress == item.StackerCraneCode); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNum && x.NextAddress == item.StationCode); |
| | | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode); |
| | |
| | | |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"ç³»ç»èªå¨æµç¨,ç®æ å°åç±{oldAddress}åæ´ä¸º{task.NextAddress},ä»»å¡ç¶æç±{oldStatus}åæ´ä¸º{task.TaskState}"); |
| | | |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt()); |
| | | device.SetValue(W_ConveyorLineDB.ACK, true); |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | } |
| | | } |
| | | else if (!conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && conveyorLineSignalWrite.ACK) |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.ACK, false); |
| | | device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode); |
| | | } |
| | | else |
| | | { |
| | | if (!conveyorLineSignalWrite.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Goods) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt()); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() && x.DeviceCode == item.StationDeviceCode); |
| | | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode); |
| | |
| | | |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"ç³»ç»èªå¨æµç¨,ç®æ å°åç±{oldAddress}åæ´ä¸º{task.NextAddress},ä»»å¡ç¶æç±{oldStatus}åæ´ä¸º{task.TaskState}"); |
| | | |
| | | device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum); |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress); |
| | | device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress); |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt()); |
| | | device.SetValue(W_ConveyorLineDB.STB, true); |
| | | device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt(), item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.STB, true, item.StationCode); |
| | | } |
| | | } |
| | | else if (conveyorLineSignalWrite.STB && conveyorLineSignalRead.ACK && conveyorLineStatus.Goods) |
| | | { |
| | | _taskService.TaskCompleted(conveyorLineInfoRead.TaskNum); |
| | | device.SetValue(W_ConveyorLineDB.STB, false); |
| | | device.SetValue(W_ConveyorLineDB.STB, false, item.StationCode); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | if (!conveyorLineSignalWrite.STB && !conveyorLineSignalWrite.ACK && !conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && x.SourceAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType)); |
| | | if (task != null) |
| | | Dt_Task outTask = _taskRepository.QueryFirst(x => _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskState != TaskStatusEnum.New.ObjToInt() && x.TaskState != TaskStatusEnum.SC_Execute.ObjToInt() && x.TargetAddress == item.StationCode); |
| | | if (outTask == null) |
| | | { |
| | | //todo è¾éçº¿å·¥ä½æ¨¡å¼éè¦å¤æ |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt()); |
| | | device.SetValue(W_ConveyorLineDB.STB, true); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && x.SourceAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType)); |
| | | if (task != null) |
| | | { |
| | | //todo è¾éçº¿å·¥ä½æ¨¡å¼éè¦å¤æ |
| | | |
| | | string oldAddress = task.NextAddress; |
| | | int oldStatus = task.TaskState; |
| | | task.TaskState = TaskStatusEnum.Line_Execute.ObjToInt(); |
| | | _taskRepository.UpdateData(task); |
| | | |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"ç³»ç»èªå¨æµç¨,ç®æ å°åç±{oldAddress}åæ´ä¸º{task.NextAddress},ä»»å¡ç¶æç±{oldStatus}åæ´ä¸º{task.TaskState}"); |
| | | |
| | | device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.STB, true, item.StationCode); |
| | | } |
| | | } |
| | | } |
| | | else if (conveyorLineSignalWrite.STB && conveyorLineSignalRead.ACK && !conveyorLineStatus.Alarm) |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.STB, false); |
| | | device.SetValue(W_ConveyorLineDB.STB, false, item.StationCode); |
| | | } |
| | | else if (!conveyorLineSignalRead.STB && conveyorLineSignalWrite.ACK && !conveyorLineStatus.Alarm) |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.ACK, false); |
| | | device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | | public void OnlyInboundStationFunc() |
| | | { |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | public IWarehouseRepository WarehouseRepository { get; } |
| | | |
| | | public BasicRepository(ILocationInfoRepository locationInfoRepository, IMaterielInfoRepository materielInfoRepository, IWarehouseRepository warehouseRepository) |
| | | public IPalletTypeInfoRepository PalletTypeInfoRepository { get; } |
| | | |
| | | public BasicRepository(ILocationInfoRepository locationInfoRepository, IMaterielInfoRepository materielInfoRepository, IWarehouseRepository warehouseRepository, IPalletTypeInfoRepository palletTypeInfoRepository) |
| | | { |
| | | LocationInfoRepository = locationInfoRepository; |
| | | MaterielInfoRepository = materielInfoRepository; |
| | | WarehouseRepository = warehouseRepository; |
| | | PalletTypeInfoRepository = palletTypeInfoRepository; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_BasicRepository |
| | | { |
| | | public class PalletTypeInfoRepository : RepositoryBase<Dt_PalletTypeInfo>, IPalletTypeInfoRepository |
| | | { |
| | | public PalletTypeInfoRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage) |
| | | { |
| | | } |
| | | } |
| | | } |
| | |
| | | /// æçç±»å |
| | | /// </param> |
| | | /// <returns></returns> |
| | | public Dt_LocationInfo? AssignLocation_BC(string roadwayNo, PalletTypeEnum palletType, string beRelocationCode = "") |
| | | public Dt_LocationInfo? AssignLocation_BC(string roadwayNo, int palletType, Dt_PalletTypeInfo palletTypeInfo, string beRelocationCode = "") |
| | | { |
| | | lock (_locker_BC) |
| | | { |
| | |
| | | |
| | | if ((locationInfos.Count * weightValue_BC >= definedTypeLocations.Count && undefinedTypeEmptyLocations.Any()) || !definedTypeEmptyLocations.Any())//妿已å®ä¹ç±»åè´§ä½æªè¶
è¿æ¯ä¾ï¼ä¸ææªå®ä¹ç±»åçè´§ä½ |
| | | { |
| | | if (palletType == PalletTypeEnum.LargePallet || palletType == PalletTypeEnum.LargestPallet) |
| | | if (palletTypeInfo.LocaitonCount == 2) |
| | | { |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Column % 2 == 1).ToList(); |
| | | if (palletTypeInfo.IsOdd) |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Column % 2 == 1).ToList(); |
| | | else |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Column % 2 == 0).ToList(); |
| | | } |
| | | for (int i = 0; i < undefinedTypeEmptyLocations.Count; i++) |
| | | { |
| | | Dt_LocationInfo undefinedTypeEmptyLocation = undefinedTypeEmptyLocations[i]; |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_BC(locationInfos, undefinedTypeEmptyLocation, palletType); |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_BC(locationInfos, undefinedTypeEmptyLocation, palletType, palletTypeInfo); |
| | | if (locationInfo != null) |
| | | { |
| | | locationCaches_BC.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); |
| | |
| | | for (int i = 0; i < definedTypeEmptyLocations.Count; i++) |
| | | { |
| | | Dt_LocationInfo definedTypeEmptyLocation = definedTypeEmptyLocations[i]; |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_BC(locationInfos, definedTypeEmptyLocation, palletType); |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_BC(locationInfos, definedTypeEmptyLocation, palletType, palletTypeInfo); |
| | | if (locationInfo != null) |
| | | { |
| | | locationCaches_BC.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); |
| | |
| | | /// <param name="emptyLocation"></param> |
| | | /// <param name="palletType"></param> |
| | | /// <returns></returns> |
| | | private Dt_LocationInfo? GetUsableLocation_BC(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, PalletTypeEnum palletType) |
| | | private Dt_LocationInfo? GetUsableLocation_BC(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, int palletType, Dt_PalletTypeInfo palletTypeInfo) |
| | | { |
| | | switch (palletType) |
| | | |
| | | if (palletTypeInfo.LocaitonCount == 2) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | if (emptyLocation.Column % 2 == 0) |
| | | if (palletTypeInfo.IsOdd && emptyLocation.Column % 2 != 1 || !palletTypeInfo.IsOdd && emptyLocation.Column % 2 != 0) |
| | | return null; |
| | | |
| | | Dt_LocationInfo? nearLocation = locationInfos.FirstOrDefault(x => x.Row == emptyLocation.Row && x.Layer == emptyLocation.Layer && x.Depth == emptyLocation.Depth && x.Column == emptyLocation.Column + 1); |
| | | if (nearLocation != null && DepthLocationIsEmpty_BC(locationInfos, nearLocation) != null) |
| | | { |
| | | Dt_LocationInfo? locationInfo = DepthLocationIsEmpty_BC(locationInfos, emptyLocation); |
| | | if (locationInfo != null) |
| | | { |
| | | return null; |
| | | return locationInfo; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | Dt_LocationInfo? locationInfo = DepthLocationIsEmpty_BC(locationInfos, emptyLocation, palletType); |
| | | if (locationInfo != null) |
| | | |
| | | else |
| | | { |
| | | return locationInfo; |
| | | Dt_LocationInfo? locationInfo = DepthLocationIsEmpty_BC(locationInfos, emptyLocation); |
| | | if (locationInfo != null) |
| | | { |
| | | return locationInfo; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | |
| | | /// <param name="locationInfos"></param> |
| | | /// <param name="emptyLocation"></param> |
| | | /// <returns></returns> |
| | | private Dt_LocationInfo? DepthLocationIsEmpty_BC(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, PalletTypeEnum palletType) |
| | | private Dt_LocationInfo? DepthLocationIsEmpty_BC(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation) |
| | | { |
| | | List<Dt_LocationInfo> locations = GetGroupLocations(locationInfos, emptyLocation); |
| | | |
| | | bool moreDepthFlag = false; |
| | | bool littleDepthFlag = false; |
| | | |
| | | switch (palletType) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); |
| | | moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && x.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt()) == null;//æ¥è¯¢å¤§äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºæè´§çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæ·±è´§ä½ææªè¢«ä½¿ç¨çæ
åµ |
| | | List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); |
| | | moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())) == null;//æ¥è¯¢å¤§äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºæè´§çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæ·±è´§ä½ææªè¢«ä½¿ç¨çæ
åµ |
| | | |
| | | List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList(); |
| | | littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.OnlyIn.ObjToInt() && x.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå
¥çè´§ä½ï¼å¦ææ¯trueï¼å表示æµ
è´§ä½è¢«ä½¿ç¨æè
被ç¦ç¨çæ
åµ |
| | | break; |
| | | } |
| | | List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList(); |
| | | littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå
¥çè´§ä½ï¼å¦ææ¯trueï¼å表示æµ
è´§ä½è¢«ä½¿ç¨æè
被ç¦ç¨çæ
åµ |
| | | |
| | | if (moreDepthFlag && littleDepthFlag) |
| | | { |
| | |
| | | /// 4ï¼ç¹é¿ |
| | | /// </param> |
| | | /// <returns></returns> |
| | | public Dt_LocationInfo? AssignLocation_CSJ(string roadwayNo, PalletTypeEnum palletType, string beRelocationCode = "") |
| | | public Dt_LocationInfo? AssignLocation_CSJ(string roadwayNo, int palletType, Dt_PalletTypeInfo palletTypeInfo, string beRelocationCode = "") |
| | | { |
| | | lock (_locker_CSJ) |
| | | { |
| | |
| | | |
| | | if ((locationInfos.Count * weightValue_CSJ >= definedTypeLocations.Count && undefinedTypeEmptyLocations.Any()) || !definedTypeEmptyLocations.Any())//妿已å®ä¹ç±»åè´§ä½æªè¶
è¿æ¯ä¾ï¼ä¸ææªå®ä¹ç±»åçè´§ä½ |
| | | { |
| | | if (palletType == PalletTypeEnum.LargePallet || palletType == PalletTypeEnum.LargestPallet) |
| | | if (palletType == 3 || palletType == 4) |
| | | { |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Depth % 2 == 1).ToList(); |
| | | } |
| | |
| | | /// <param name="emptyLocation"></param> |
| | | /// <param name="palletType"></param> |
| | | /// <returns></returns> |
| | | private Dt_LocationInfo? GetUsableLocation_CSJ(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, PalletTypeEnum palletType) |
| | | private Dt_LocationInfo? GetUsableLocation_CSJ(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, int palletType) |
| | | { |
| | | switch (palletType) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | case 3: |
| | | case 4: |
| | | if (emptyLocation.Depth % 2 == 0) |
| | | { |
| | | return null; |
| | |
| | | return null; |
| | | } |
| | | |
| | | private bool LittleDepthLocationIsEmpty_CSJ(Dt_LocationInfo locationInfo, PalletTypeEnum palletType) |
| | | private bool LittleDepthLocationIsEmpty_CSJ(Dt_LocationInfo locationInfo, int palletType) |
| | | { |
| | | List<Dt_LocationInfo> locations = GetGroupLocations(locationInfo); |
| | | |
| | | switch (palletType) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | case 4: |
| | | case 3: |
| | | { |
| | | List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= locationInfo.Depth).ToList(); |
| | | return littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.OnlyIn.ObjToInt() && x.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå
¥çè´§ä½ï¼å¦ææ¯trueï¼å表示æµ
è´§ä½è¢«ä½¿ç¨æè
被ç¦ç¨çæ
åµ |
| | | } |
| | | case PalletTypeEnum.MediumPallet: |
| | | case PalletTypeEnum.SmallPallet: |
| | | case 1: |
| | | case 2: |
| | | { |
| | | List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= locationInfo.Depth).ToList(); |
| | | return littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.OnlyIn.ObjToInt() && x.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå
¥çè´§ä½ï¼å¦ææ¯trueï¼å表示æµ
è´§ä½è¢«ä½¿ç¨æè
被ç¦ç¨çæ
åµ |
| | |
| | | /// <param name="locationInfos"></param> |
| | | /// <param name="emptyLocation"></param> |
| | | /// <returns></returns> |
| | | private Dt_LocationInfo? DepthLocationIsEmpty_CSJ(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, PalletTypeEnum palletType) |
| | | private Dt_LocationInfo? DepthLocationIsEmpty_CSJ(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, int palletType) |
| | | { |
| | | List<Dt_LocationInfo> locations = GetGroupLocations(locationInfos, emptyLocation); |
| | | |
| | |
| | | |
| | | switch (palletType) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | case 3: |
| | | case 4: |
| | | { |
| | | List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); |
| | | moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && x.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())) == null;//æ¥è¯¢å¤§äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºæè´§çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæ·±è´§ä½ææªè¢«ä½¿ç¨çæ
åµ |
| | |
| | | littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå
¥çè´§ä½ï¼å¦ææ¯trueï¼å表示æµ
è´§ä½è¢«ä½¿ç¨æè
被ç¦ç¨çæ
åµ |
| | | } |
| | | break; |
| | | case PalletTypeEnum.MediumPallet: |
| | | case PalletTypeEnum.SmallPallet: |
| | | case 1: |
| | | case 2: |
| | | { |
| | | List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); |
| | | moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())) == null;//æ¥è¯¢å¤§äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºæè´§çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæ·±è´§ä½ææªè¢«ä½¿ç¨çæ
åµ |
| | |
| | | /// æçç±»å |
| | | /// </param> |
| | | /// <returns></returns> |
| | | public Dt_LocationInfo? AssignLocation_GM(string roadwayNo, PalletTypeEnum palletType, string beRelocationCode = "") |
| | | public Dt_LocationInfo? AssignLocation_GM(string roadwayNo, int palletType, Dt_PalletTypeInfo palletTypeInfo, string beRelocationCode = "") |
| | | { |
| | | lock (_locker_GM) |
| | | { |
| | |
| | | |
| | | if ((locationInfos.Count * weightValue_GM >= definedTypeLocations.Count && undefinedTypeEmptyLocations.Any()) || !definedTypeEmptyLocations.Any())//妿已å®ä¹ç±»åè´§ä½æªè¶
è¿æ¯ä¾ï¼ä¸ææªå®ä¹ç±»åçè´§ä½ |
| | | { |
| | | if (palletType == PalletTypeEnum.LargePallet || palletType == PalletTypeEnum.LargestPallet) |
| | | if (palletTypeInfo.LocaitonCount == 2) |
| | | { |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Column % 2 == 1).ToList(); |
| | | if (palletTypeInfo.IsOdd) |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Column % 2 == 1).ToList(); |
| | | else |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Column % 2 == 0).ToList(); |
| | | } |
| | | for (int i = 0; i < undefinedTypeEmptyLocations.Count; i++) |
| | | { |
| | | Dt_LocationInfo undefinedTypeEmptyLocation = undefinedTypeEmptyLocations[i]; |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_GM(locationInfos, undefinedTypeEmptyLocation, palletType); |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_GM(locationInfos, undefinedTypeEmptyLocation, palletType, palletTypeInfo); |
| | | if (locationInfo != null) |
| | | { |
| | | locationCaches_GM.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); |
| | |
| | | for (int i = 0; i < definedTypeEmptyLocations.Count; i++) |
| | | { |
| | | Dt_LocationInfo definedTypeEmptyLocation = definedTypeEmptyLocations[i]; |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_GM(locationInfos, definedTypeEmptyLocation, palletType); |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_GM(locationInfos, definedTypeEmptyLocation, palletType, palletTypeInfo); |
| | | if (locationInfo != null) |
| | | { |
| | | locationCaches_GM.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); |
| | |
| | | /// <param name="emptyLocation"></param> |
| | | /// <param name="palletType"></param> |
| | | /// <returns></returns> |
| | | private Dt_LocationInfo? GetUsableLocation_GM(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, PalletTypeEnum palletType) |
| | | private Dt_LocationInfo? GetUsableLocation_GM(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, int palletType, Dt_PalletTypeInfo palletTypeInfo) |
| | | { |
| | | switch (palletType) |
| | | if (palletTypeInfo.LocaitonCount == 2) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | if (emptyLocation.Column % 2 == 0) |
| | | if (palletTypeInfo.IsOdd && emptyLocation.Column % 2 != 1 || !palletTypeInfo.IsOdd && emptyLocation.Column % 2 != 0) |
| | | return null; |
| | | |
| | | Dt_LocationInfo? nearLocation = locationInfos.FirstOrDefault(x => x.Row == emptyLocation.Row && x.Layer == emptyLocation.Layer && x.Depth == emptyLocation.Depth && x.Column == emptyLocation.Column + 1); |
| | | if (nearLocation != null && DepthLocationIsEmpty_BC(locationInfos, nearLocation) != null) |
| | | { |
| | | Dt_LocationInfo? locationInfo = DepthLocationIsEmpty_BC(locationInfos, emptyLocation); |
| | | if (locationInfo != null) |
| | | { |
| | | return null; |
| | | return locationInfo; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | Dt_LocationInfo? locationInfo = DepthLocationIsEmpty_GM(locationInfos, emptyLocation, palletType); |
| | | if (locationInfo != null) |
| | | else |
| | | { |
| | | return locationInfo; |
| | | Dt_LocationInfo? locationInfo = DepthLocationIsEmpty_BC(locationInfos, emptyLocation); |
| | | if (locationInfo != null) |
| | | { |
| | | return locationInfo; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 夿ä¸å深度çåç»è´§ä½ç¶ææ¯å¦ä¸ºç©ºé²ç©ºä½(æµè¯æ¶ä») |
| | |
| | | /// <param name="locationInfos"></param> |
| | | /// <param name="emptyLocation"></param> |
| | | /// <returns></returns> |
| | | private Dt_LocationInfo? DepthLocationIsEmpty_GM(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, PalletTypeEnum palletType) |
| | | private Dt_LocationInfo? DepthLocationIsEmpty_GM(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation) |
| | | { |
| | | List<Dt_LocationInfo> locations = GetGroupLocations(locationInfos, emptyLocation); |
| | | |
| | | bool moreDepthFlag = false; |
| | | bool littleDepthFlag = false; |
| | | |
| | | switch (palletType) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); |
| | | moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && x.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt()) == null;//æ¥è¯¢å¤§äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºæè´§çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæ·±è´§ä½ææªè¢«ä½¿ç¨çæ
åµ |
| | | List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); |
| | | moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())) == null;//æ¥è¯¢å¤§äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºæè´§çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæ·±è´§ä½ææªè¢«ä½¿ç¨çæ
åµ |
| | | |
| | | List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList(); |
| | | littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.OnlyIn.ObjToInt() && x.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå
¥çè´§ä½ï¼å¦ææ¯trueï¼å表示æµ
è´§ä½è¢«ä½¿ç¨æè
被ç¦ç¨çæ
åµ |
| | | break; |
| | | } |
| | | List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList(); |
| | | littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå
¥çè´§ä½ï¼å¦ææ¯trueï¼å表示æµ
è´§ä½è¢«ä½¿ç¨æè
被ç¦ç¨çæ
åµ |
| | | |
| | | if (moreDepthFlag && littleDepthFlag) |
| | | { |
| | |
| | | /// æçç±»å |
| | | /// </param> |
| | | /// <returns></returns> |
| | | public Dt_LocationInfo? AssignLocation_PP(string roadwayNo, PalletTypeEnum palletType, string beRelocationCode = "") |
| | | public Dt_LocationInfo? AssignLocation_PP(string roadwayNo, int palletType, Dt_PalletTypeInfo palletTypeInfo, string beRelocationCode = "") |
| | | { |
| | | lock (_locker_PP) |
| | | { |
| | |
| | | |
| | | if ((locationInfos.Count * weightValue_PP >= definedTypeLocations.Count && undefinedTypeEmptyLocations.Any()) || !definedTypeEmptyLocations.Any())//妿已å®ä¹ç±»åè´§ä½æªè¶
è¿æ¯ä¾ï¼ä¸ææªå®ä¹ç±»åçè´§ä½ |
| | | { |
| | | if (palletType == PalletTypeEnum.LargePallet || palletType == PalletTypeEnum.LargestPallet) |
| | | { |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Column % 2 == 1).ToList(); |
| | | } |
| | | for (int i = 0; i < undefinedTypeEmptyLocations.Count; i++) |
| | | { |
| | | Dt_LocationInfo undefinedTypeEmptyLocation = undefinedTypeEmptyLocations[i]; |
| | |
| | | /// <param name="emptyLocation"></param> |
| | | /// <param name="palletType"></param> |
| | | /// <returns></returns> |
| | | private Dt_LocationInfo? GetUsableLocation_PP(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, PalletTypeEnum palletType) |
| | | private Dt_LocationInfo? GetUsableLocation_PP(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, int palletType) |
| | | { |
| | | switch (palletType) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | if (emptyLocation.Column % 2 == 0) |
| | | { |
| | | return null; |
| | | } |
| | | break; |
| | | } |
| | | Dt_LocationInfo? locationInfo = DepthLocationIsEmpty_PP(locationInfos, emptyLocation, palletType); |
| | | if (locationInfo != null) |
| | | { |
| | |
| | | /// <param name="locationInfos"></param> |
| | | /// <param name="emptyLocation"></param> |
| | | /// <returns></returns> |
| | | private Dt_LocationInfo? DepthLocationIsEmpty_PP(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, PalletTypeEnum palletType) |
| | | private Dt_LocationInfo? DepthLocationIsEmpty_PP(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, int palletType) |
| | | { |
| | | List<Dt_LocationInfo> locations = GetGroupLocations(locationInfos, emptyLocation); |
| | | |
| | | bool moreDepthFlag = false; |
| | | bool littleDepthFlag = false; |
| | | List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); |
| | | moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && x.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt()) == null;//æ¥è¯¢å¤§äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºæè´§çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæ·±è´§ä½ææªè¢«ä½¿ç¨çæ
åµ |
| | | |
| | | switch (palletType) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); |
| | | moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && x.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt()) == null;//æ¥è¯¢å¤§äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºæè´§çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæ·±è´§ä½ææªè¢«ä½¿ç¨çæ
åµ |
| | | |
| | | List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList(); |
| | | littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.OnlyIn.ObjToInt() && x.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå
¥çè´§ä½ï¼å¦ææ¯trueï¼å表示æµ
è´§ä½è¢«ä½¿ç¨æè
被ç¦ç¨çæ
åµ |
| | | break; |
| | | } |
| | | |
| | | List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList(); |
| | | littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.OnlyIn.ObjToInt() && x.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå
¥çè´§ä½ï¼å¦ææ¯trueï¼å表示æµ
è´§ä½è¢«ä½¿ç¨æè
被ç¦ç¨çæ
åµ |
| | | if (moreDepthFlag && littleDepthFlag) |
| | | { |
| | | return emptyLocation; |
| | |
| | | /// æçç±»å |
| | | /// </param> |
| | | /// <returns></returns> |
| | | public Dt_LocationInfo? AssignLocation_ZH(string roadwayNo, PalletTypeEnum palletType, string beRelocationCode = "") |
| | | public Dt_LocationInfo? AssignLocation_ZH(string roadwayNo, int palletType, Dt_PalletTypeInfo palletTypeInfo, string beRelocationCode = "") |
| | | { |
| | | lock (_locker_ZH) |
| | | { |
| | |
| | | |
| | | if ((locationInfos.Count * weightValue_ZH >= definedTypeLocations.Count && undefinedTypeEmptyLocations.Any()) || !definedTypeEmptyLocations.Any())//妿已å®ä¹ç±»åè´§ä½æªè¶
è¿æ¯ä¾ï¼ä¸ææªå®ä¹ç±»åçè´§ä½ |
| | | { |
| | | if (palletType == PalletTypeEnum.LargePallet || palletType == PalletTypeEnum.LargestPallet) |
| | | if (palletType == 3 || palletType == 4) |
| | | { |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Column % 2 == 0).ToList(); |
| | | } |
| | |
| | | /// <param name="emptyLocation"></param> |
| | | /// <param name="palletType"></param> |
| | | /// <returns></returns> |
| | | private Dt_LocationInfo? GetUsableLocation_ZH(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, PalletTypeEnum palletType) |
| | | private Dt_LocationInfo? GetUsableLocation_ZH(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, int palletType) |
| | | { |
| | | switch (palletType) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | case 4: |
| | | case 3: |
| | | if (emptyLocation.Column % 2 != 0) |
| | | { |
| | | return null; |
| | |
| | | /// <param name="locationInfos"></param> |
| | | /// <param name="emptyLocation"></param> |
| | | /// <returns></returns> |
| | | private Dt_LocationInfo? DepthLocationIsEmpty_ZH(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, PalletTypeEnum palletType) |
| | | private Dt_LocationInfo? DepthLocationIsEmpty_ZH(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, int palletType) |
| | | { |
| | | List<Dt_LocationInfo> locations = GetGroupLocations(locationInfos, emptyLocation); |
| | | |
| | | bool moreDepthFlag = false; |
| | | bool littleDepthFlag = false; |
| | | |
| | | switch (palletType) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); |
| | | moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && x.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt()) == null;//æ¥è¯¢å¤§äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºæè´§çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæ·±è´§ä½ææªè¢«ä½¿ç¨çæ
åµ |
| | | List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); |
| | | moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && x.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt()) == null;//æ¥è¯¢å¤§äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºæè´§çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæ·±è´§ä½ææªè¢«ä½¿ç¨çæ
åµ |
| | | |
| | | List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList(); |
| | | littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.OnlyIn.ObjToInt() && x.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå
¥çè´§ä½ï¼å¦ææ¯trueï¼å表示æµ
è´§ä½è¢«ä½¿ç¨æè
被ç¦ç¨çæ
åµ |
| | | break; |
| | | } |
| | | List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList(); |
| | | littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.OnlyIn.ObjToInt() && x.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå
¥çè´§ä½ï¼å¦ææ¯trueï¼å表示æµ
è´§ä½è¢«ä½¿ç¨æè
被ç¦ç¨çæ
åµ |
| | | |
| | | if (moreDepthFlag && littleDepthFlag) |
| | | { |
| | |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.TaskEnum; |
| | | |
| | | namespace WIDESEA_BasicService |
| | | { |
| | | public partial class LocationInfoService |
| | | { |
| | | public Dt_LocationInfo? AssignLocation(string roadwayNo, PalletTypeEnum palletType, int warehouseId) |
| | | |
| | | public Dt_LocationInfo? AssignLocation(string roadwayNo, int palletType, int warehouseId) |
| | | { |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == warehouseId); |
| | | if (warehouse == null) |
| | |
| | | throw new Exception($"æªæ¾å°ä»åºä¿¡æ¯"); |
| | | } |
| | | |
| | | return warehouse.WarehouseName switch |
| | | Dt_PalletTypeInfo palletTypeInfo = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.PalletType == palletType && x.WarehouseId == warehouse.WarehouseId); |
| | | if (palletTypeInfo == null) |
| | | { |
| | | "æ¿æä»" => AssignLocation_BC(roadwayNo, palletType), |
| | | "PPä»" => AssignLocation_PP(roadwayNo, palletType), |
| | | "å¹²èä»" => AssignLocation_GM(roadwayNo, palletType), |
| | | "æµè¯æ¶ä»" => AssignLocation_CSJ(roadwayNo, palletType), |
| | | "é»çä»" => AssignLocation_ZH(roadwayNo, palletType), |
| | | "油墨ä»" => AssignLocation(roadwayNo), |
| | | "æåä»" => AssignLocation(roadwayNo), |
| | | "è¾
æä»" => AssignLocation(roadwayNo), |
| | | throw new Exception($"请é
ç½®æçç±»åä¿¡æ¯"); |
| | | } |
| | | |
| | | return warehouse.WarehouseCode switch |
| | | { |
| | | "HA57" => AssignLocation_BC(roadwayNo, palletType, palletTypeInfo), |
| | | "HA58" => AssignLocation_PP(roadwayNo, palletType, palletTypeInfo), |
| | | "HA152" => AssignLocation_GM(roadwayNo, palletType, palletTypeInfo), |
| | | "HA64" => AssignLocation_CSJ(roadwayNo, palletType, palletTypeInfo), |
| | | "é»çä»" => AssignLocation_ZH(roadwayNo, palletType, palletTypeInfo), |
| | | "HA153" => AssignLocation(roadwayNo), |
| | | "HA71" => AssignLocation(roadwayNo), |
| | | "HA60" => AssignLocation(roadwayNo), |
| | | _ => throw new Exception($"æªæ¾å°ä»åºè´§ä½åé
æ¹æ³") |
| | | }; |
| | | } |
| | |
| | | /// <param name="locationCode">è´§ä½ç¼å·</param> |
| | | /// <param name="palletType">æçç±»å</param> |
| | | /// <param name="locationStatus">è´§ä½ç¶æ</param> |
| | | public void UpdateLocationStatus(string locationCode, PalletTypeEnum palletType, LocationStatusEnum locationStatus, int warehousId) |
| | | public void UpdateLocationStatus(string locationCode, int palletType, LocationStatusEnum locationStatus, int warehousId) |
| | | { |
| | | Dt_LocationInfo location = Repository.QueryFirst(x => x.LocationCode == locationCode); |
| | | if (location == null) |
| | |
| | | /// <param name="location">è´§ä½å¯¹è±¡</param> |
| | | /// <param name="palletType">æçç±»å</param> |
| | | /// <param name="locationStatus">è´§ä½ç¶æ</param> |
| | | public void UpdateLocationStatus(Dt_LocationInfo location, PalletTypeEnum palletType, LocationStatusEnum locationStatus, int warehousId) |
| | | public void UpdateLocationStatus2(Dt_LocationInfo location, int palletType, LocationStatusEnum locationStatus, int warehousId) |
| | | { |
| | | List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => x.RoadwayNo == location.RoadwayNo); |
| | | |
| | |
| | | nearLocations[i].LocationStatus = LocationStatusEnum.FreeLock.ObjToInt(); |
| | | } |
| | | } |
| | | else if (locationStatus == LocationStatusEnum.Free || locationStatus == LocationStatusEnum.InStock) |
| | | else if (locationStatus == LocationStatusEnum.InStock) |
| | | { |
| | | if (nearLocations[i].LocationStatus == LocationStatusEnum.InStockLock.ObjToInt()) |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (locations.Where(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt()).Count() == locations.Count && locationStatus == LocationStatusEnum.Free) |
| | | { |
| | | locations.ForEach(x => |
| | | { |
| | | x.LocationType = 0; |
| | | }); |
| | | } |
| | | |
| | | Repository.UpdateData(locations); |
| | | } |
| | | |
| | | public void UpdateLocationStatus(Dt_LocationInfo location, int palletType, LocationStatusEnum locationStatus, int warehousId) |
| | | { |
| | | List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => x.RoadwayNo == location.RoadwayNo); |
| | | |
| | | List<Dt_PalletTypeInfo> palletTypeInfos = _basicRepository.PalletTypeInfoRepository.QueryData(x => x.WarehouseId == warehousId); |
| | | |
| | | Dt_PalletTypeInfo? palletTypeInfo = palletTypeInfos.FirstOrDefault(x => x.PalletType == palletType && x.WarehouseId == warehousId); |
| | | if (palletTypeInfo == null) |
| | | { |
| | | throw new Exception($"请é
ç½®æçç±»åä¿¡æ¯"); |
| | | } |
| | | List<Dt_LocationInfo> locations = GetGroupLocations(locationInfos, location); |
| | | if (locationInfos.Max(x => x.Depth) < 3) |
| | | { |
| | | for (int i = 0; i < locations.Count; i++) |
| | | { |
| | | if (locations[i].LocationType != palletType) |
| | | { |
| | | locations[i].LocationType = palletType; |
| | | } |
| | | |
| | | if (locations[i].LocationCode == location.LocationCode) |
| | | { |
| | | locations[i].LocationStatus = locationStatus.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | if (locationStatus == LocationStatusEnum.Lock) |
| | | { |
| | | if (locations[i].LocationStatus == LocationStatusEnum.InStock.ObjToInt()) |
| | | { |
| | | locations[i].LocationStatus = LocationStatusEnum.InStockLock.ObjToInt(); |
| | | } |
| | | else if (locations[i].LocationStatus == LocationStatusEnum.Free.ObjToInt()) |
| | | { |
| | | locations[i].LocationStatus = LocationStatusEnum.FreeLock.ObjToInt(); |
| | | } |
| | | } |
| | | else if (locationStatus == LocationStatusEnum.Free || locationStatus == LocationStatusEnum.InStock) |
| | | { |
| | | if (locations[i].LocationStatus == LocationStatusEnum.InStockLock.ObjToInt()) |
| | | { |
| | | locations[i].LocationStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | } |
| | | else if (locations[i].LocationStatus == LocationStatusEnum.FreeLock.ObjToInt()) |
| | | { |
| | | locations[i].LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (palletTypeInfos.FirstOrDefault(x => x.LocaitonCount == 2) != null) |
| | | { |
| | | Dt_LocationInfo? nearLocation; |
| | | if (palletTypeInfo.IsOdd) |
| | | { |
| | | nearLocation = locationInfos.FirstOrDefault(x => x.Row == location.Row && x.Layer == location.Layer && x.Depth == location.Depth && x.Column == location.Column + 1); |
| | | } |
| | | else |
| | | { |
| | | nearLocation = locationInfos.FirstOrDefault(x => x.Row == location.Row && x.Layer == location.Layer && x.Depth == location.Depth && x.Column == location.Column - 1); |
| | | } |
| | | |
| | | if (nearLocation != null) |
| | | { |
| | | List<Dt_LocationInfo> nearLocations = GetGroupLocations(locationInfos, nearLocation); |
| | | for (int i = 0; i < nearLocations.Count; i++) |
| | | { |
| | | if (nearLocations[i].LocationType != palletType) |
| | | { |
| | | nearLocations[i].LocationType = palletType; |
| | | } |
| | | |
| | | if (locationStatus == LocationStatusEnum.Lock) |
| | | { |
| | | if (nearLocations[i].LocationStatus == LocationStatusEnum.InStock.ObjToInt()) |
| | | { |
| | | nearLocations[i].LocationStatus = LocationStatusEnum.InStockLock.ObjToInt(); |
| | | } |
| | | else if (nearLocations[i].LocationStatus == LocationStatusEnum.Free.ObjToInt()) |
| | | { |
| | | nearLocations[i].LocationStatus = LocationStatusEnum.FreeLock.ObjToInt(); |
| | | } |
| | | } |
| | | else if (locationStatus == LocationStatusEnum.Free || locationStatus == LocationStatusEnum.InStock) |
| | | { |
| | | if (nearLocations[i].LocationStatus == LocationStatusEnum.InStockLock.ObjToInt()) |
| | | { |
| | | nearLocations[i].LocationStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | } |
| | | else if (nearLocations[i].LocationStatus == LocationStatusEnum.FreeLock.ObjToInt()) |
| | | { |
| | | nearLocations[i].LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | locations.AddRange(nearLocations); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | | for (int i = 0; i < locations.Count; i++) |
| | | { |
| | | if (locations[i].LocationCode == location.LocationCode) |
| | | { |
| | | locations[i].LocationStatus = locationStatus.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | if (locationStatus == LocationStatusEnum.Lock) |
| | | { |
| | | if (locations[i].LocationStatus == LocationStatusEnum.InStock.ObjToInt()) |
| | | { |
| | | locations[i].LocationStatus = LocationStatusEnum.InStockLock.ObjToInt(); |
| | | } |
| | | else if (locations[i].LocationStatus == LocationStatusEnum.Free.ObjToInt()) |
| | | { |
| | | locations[i].LocationStatus = LocationStatusEnum.FreeLock.ObjToInt(); |
| | | } |
| | | } |
| | | else if (locationStatus == LocationStatusEnum.Free || locationStatus == LocationStatusEnum.InStock) |
| | | { |
| | | if (locations[i].LocationStatus == LocationStatusEnum.InStockLock.ObjToInt()) |
| | | { |
| | | locations[i].LocationStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | } |
| | | else if (locations[i].LocationStatus == LocationStatusEnum.FreeLock.ObjToInt()) |
| | | { |
| | | locations[i].LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | } |
| | | } |
| | | } |
| | | if (locations[i].LocationType != palletType.ObjToInt()) |
| | | { |
| | | locations[i].LocationType = palletType.ObjToInt(); |
| | | } |
| | | } |
| | | } |
| | | Repository.UpdateData(locations); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åä¸å深度çåç»è´§ä½ä¿¡æ¯ |
| | |
| | | /// </summary> |
| | | [Description("è´¨æ£åºåº")] |
| | | OutQuality = 130, |
| | | |
| | | /// <summary> |
| | | /// MESåºåº |
| | | /// </summary> |
| | | [Description("MESåºåº")] |
| | | MesOutbound = 200, |
| | | /// <summary> |
| | | /// éè´å
¥åº |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | [Description("è´¨æ£å
¥åº")] |
| | | InQuality = 540, |
| | | |
| | | /// <summary> |
| | | /// çäº§éæ |
| | | /// </summary> |
| | | [Description("ç产éæ")] |
| | | ProductionReturn = 550, |
| | | |
| | | /// <summary> |
| | | /// MESéæ |
| | | /// </summary> |
| | | [Description("MESéæ")] |
| | | MesMatReturn = 560, |
| | | |
| | | /// <summary> |
| | | /// å··éå
ç§»åº |
| | | /// </summary> |
| | |
| | | CodeRuleAttribute? codeRuleAttribute = propertyInfo.GetCustomAttribute<CodeRuleAttribute>(); |
| | | if (codeRuleAttribute != null) |
| | | { |
| | | SqlSugarClient sugarClient = new SqlSugarClient(new ConnectionConfig |
| | | if (propertyInfo.GetValue(entityInfo.EntityValue) == null) |
| | | { |
| | | ConfigId = MainDb.CurrentDbConnId, |
| | | ConnectionString = DBContext.GetMainConnectionDb().Connection, |
| | | IsAutoCloseConnection = true, |
| | | DbType = MainDb.DbType, |
| | | }); |
| | | dynamic ruleConfig = sugarClient.Queryable(MainDb.CodeRuleConfig, "x").Where(nameof(CodeRuleAttribute.RuleCode), "=", codeRuleAttribute.RuleCode.ToString()).First(); |
| | | if (ruleConfig != null) |
| | | { |
| | | string code = CreateCodeByRule(ruleConfig, sugarClient); |
| | | propertyInfo.SetValue(entityInfo.EntityValue, code, null); |
| | | SqlSugarClient sugarClient = new SqlSugarClient(new ConnectionConfig |
| | | { |
| | | ConfigId = MainDb.CurrentDbConnId, |
| | | ConnectionString = DBContext.GetMainConnectionDb().Connection, |
| | | IsAutoCloseConnection = true, |
| | | DbType = MainDb.DbType, |
| | | }); |
| | | dynamic ruleConfig = sugarClient.Queryable(MainDb.CodeRuleConfig, "x").Where(nameof(CodeRuleAttribute.RuleCode), "=", codeRuleAttribute.RuleCode.ToString()).First(); |
| | | if (ruleConfig != null) |
| | | { |
| | | string code = CreateCodeByRule(ruleConfig, sugarClient); |
| | | propertyInfo.SetValue(entityInfo.EntityValue, code, null); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | namespace WIDESEA_DTO.Basic |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [AnalysisRule, ModelValidate] |
| | | public class MatSerNumAnalysisModel |
| | | { |
| | |
| | | |
| | | public T Content { get; set; } |
| | | } |
| | | /// <summary> |
| | | ///æµè¯æ¶åæ¥ |
| | | /// </summary> |
| | | public class TestToolSynInfo |
| | | { |
| | | /// <summary> |
| | | /// æµè¯æ¶æ¹æ¬¡å· |
| | | /// </summary> |
| | | public string ToolCode { get; set; } |
| | | /// <summary> |
| | | /// æµè¯æ¶ç©æåç§° |
| | | /// </summary> |
| | | public string MaterialName { get; set; } |
| | | /// <summary> |
| | | /// åå§å¯¿å½ |
| | | /// </summary> |
| | | public int Life { get; set; } |
| | | |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEA_DTO.MES |
| | | { |
| | | /// <summary> |
| | | /// ç©æåºåºï¼WMS忥åºåºç©ææ¹æ¬¡è³MES |
| | | /// </summary> |
| | | public class MesMaterialLotaAceptModel |
| | | { |
| | | /// <summary> |
| | | /// ç©æç¼ç |
| | | /// </summary> |
| | | public string MaterialCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æåç§° |
| | | /// </summary> |
| | | public string MaterialName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åå§ç©ææ¹æ¬¡ ä¾åºåæ¹æ¬¡(MESæç©æç¼ç +â,â+ç©ææ¹æ¬¡æ¼æ¥) |
| | | /// </summary> |
| | | public string MaterialLot { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°é |
| | | /// </summary> |
| | | public float Quantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 线边åºåº |
| | | /// </summary> |
| | | public string WarehouseArea { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 线边åºä½ |
| | | /// </summary> |
| | | public string WarehouseLocation { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¾åºå |
| | | /// </summary> |
| | | public string Supplier { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è½½å
·ç¼ç |
| | | /// </summary> |
| | | public string CarrierCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡åå· |
| | | /// </summary> |
| | | public string TaskNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºåºç±»å |
| | | /// </summary> |
| | | public int Type { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æææ |
| | | /// </summary> |
| | | public string ExpirationDate { get; set; } |
| | | |
| | | /// <summary> |
| | | /// çäº§æ¥æ |
| | | /// </summary> |
| | | public string ProductionDate { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©ææ ç¾ |
| | | /// </summary> |
| | | public string MaterialBarCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è£ååå· |
| | | /// </summary> |
| | | public string CutedType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// PP宽度 |
| | | /// </summary> |
| | | public float PPWidth { get; set; } |
| | | } |
| | | } |
| | |
| | | [PropertyValidate("æµè¯æ¶æ¹æ¬¡å·", NotNullAndEmpty = true)] |
| | | public string TestToolCode { get; set; } |
| | | } |
| | | |
| | | /// <summary> |
| | | ///æµè¯æ¶åæ¥ |
| | | /// </summary> |
| | | public class TestToolSynInfo |
| | | { |
| | | /// <summary> |
| | | /// æµè¯æ¶æ¹æ¬¡å· |
| | | /// </summary> |
| | | public string ToolCode { get; set; } |
| | | /// <summary> |
| | | /// æµè¯æ¶ç©æåç§° |
| | | /// </summary> |
| | | public string MaterialName { get; set; } |
| | | /// <summary> |
| | | /// åå§å¯¿å½ |
| | | /// </summary> |
| | | public int Life { get; set; } |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | IWarehouseRepository WarehouseRepository { get; } |
| | | |
| | | IPalletTypeInfoRepository PalletTypeInfoRepository { get; } |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_IBasicRepository |
| | | { |
| | | public interface IPalletTypeInfoRepository : IRepository<Dt_PalletTypeInfo> |
| | | { |
| | | } |
| | | } |
| | |
| | | /// <param name="roadwayNo">å··éå·</param> |
| | | /// <param name="palletType">æçç±»å</param> |
| | | /// <returns></returns> |
| | | Dt_LocationInfo? AssignLocation(string roadwayNo, PalletTypeEnum palletType, int warehouseId); |
| | | Dt_LocationInfo? AssignLocation(string roadwayNo, int palletType, int warehouseId); |
| | | |
| | | /// <summary> |
| | | /// ä¿®æ¹è´§ä½ç¶æåç±»å |
| | |
| | | /// <param name="locationCode">è´§ä½ç¼å·</param> |
| | | /// <param name="palletType">æçç±»å</param> |
| | | /// <param name="locationStatus">è´§ä½ç¶æ</param> |
| | | void UpdateLocationStatus(string locationCode, PalletTypeEnum palletType, LocationStatusEnum locationStatus, int warehousId); |
| | | void UpdateLocationStatus(string locationCode, int palletType, LocationStatusEnum locationStatus, int warehousId); |
| | | |
| | | /// <summary> |
| | | /// ä¿®æ¹è´§ä½ç¶æåç±»å |
| | |
| | | /// <param name="location">è´§ä½å¯¹è±¡</param> |
| | | /// <param name="palletType">æçç±»å</param> |
| | | /// <param name="locationStatus">è´§ä½ç¶æ</param> |
| | | void UpdateLocationStatus(Dt_LocationInfo location, PalletTypeEnum palletType, LocationStatusEnum locationStatus, int warehousId); |
| | | void UpdateLocationStatus(Dt_LocationInfo location, int palletType, LocationStatusEnum locationStatus, int warehousId); |
| | | |
| | | /// <summary> |
| | | /// è·åä¸å深度çåç»è´§ä½ä¿¡æ¯ |
| | |
| | | using WIDESEA_DTO.MES; |
| | | using WIDESEA_DTO; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_IOutboundRepository; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Core; |
| | | |
| | | namespace WIDESEA_IOutboundService |
| | | { |
| | | public interface IMesOutboundOrderService : IService<Dt_MesOutboundOrder> |
| | | { |
| | | MesResponseContent SubstrateOut(SubstrateOutModel model); |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | IMesOutboundOrderRepository Repository { get; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="mesOutboundOrder"></param> |
| | | /// <returns></returns> |
| | | (List<Dt_StockInfo>, Dt_MesOutboundOrder, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(Dt_MesOutboundOrder mesOutboundOrder); |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="stockInfos"></param> |
| | | /// <param name="outStockLockInfos"></param> |
| | | /// <param name="locationInfos"></param> |
| | | /// <param name="locationStatus"></param> |
| | | /// <param name="tasks"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent LockOutboundStockDataUpdate(List<Dt_StockInfo> stockInfos, List<Dt_OutStockLockInfo> outStockLockInfos, List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus = LocationStatusEnum.Lock, List<Dt_Task>? tasks = null); |
| | | } |
| | | } |
| | |
| | | { |
| | | public interface IOutStockLockInfoService : IService<Dt_OutStockLockInfo> |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | IOutStockLockInfoRepository Repository { get; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="outboundOrder"></param> |
| | | /// <param name="outboundOrderDetail"></param> |
| | | /// <param name="outStocks"></param> |
| | | /// <param name="taskNum"></param> |
| | | /// <returns></returns> |
| | | List<Dt_OutStockLockInfo> GetOutStockLockInfos(Dt_OutboundOrder outboundOrder, Dt_OutboundOrderDetail outboundOrderDetail, List<Dt_StockInfo> outStocks, int? taskNum = null); |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="outboundOrder"></param> |
| | | /// <param name="outboundOrderDetail"></param> |
| | | /// <param name="outStock"></param> |
| | | /// <param name="assignQuantity"></param> |
| | | /// <param name="taskNum"></param> |
| | | /// <returns></returns> |
| | | Dt_OutStockLockInfo GetOutStockLockInfo(Dt_OutboundOrder outboundOrder, Dt_OutboundOrderDetail outboundOrderDetail, Dt_StockInfo outStock, float assignQuantity, int? taskNum = null); |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="mesOutboundOrder"></param> |
| | | /// <param name="outStock"></param> |
| | | /// <param name="assignQuantity"></param> |
| | | /// <param name="taskNum"></param> |
| | | /// <returns></returns> |
| | | Dt_OutStockLockInfo GetOutStockLockInfo(Dt_MesOutboundOrder mesOutboundOrder, Dt_StockInfo outStock, float assignQuantity, int? taskNum = null); |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="orderDetailId"></param> |
| | | /// <param name="outStockStatus"></param> |
| | | /// <returns></returns> |
| | | List<Dt_OutStockLockInfo> GetByOrderDetailId(int orderDetailId, OutLockStockStatusEnum outStockStatus); |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="saveModel"></param> |
| | | /// <returns></returns> |
| | | List<Dt_OutStockLockInfo> GetStockOutboundOrder(SaveModel saveModel); |
| | | |
| | | /// <summary> |
| | |
| | | IStockInfoDetailRepository StockInfoDetailRepository { get; } |
| | | |
| | | IStockInfoRepository StockInfoRepository { get; } |
| | | |
| | | IStockInfoDetail_HtyRepository StockInfoDetail_HtyRepository { get; } |
| | | |
| | | IStockInfo_HtyRepository StockInfo_HtyRepository { get; } |
| | | } |
| | | } |
| | |
| | | { |
| | | ITaskRepository Repository { get; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="tasks"></param> |
| | | /// <param name="agvDescription"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent PushTasksToWCS(List<Dt_Task> tasks, string agvDescription = ""); |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <param name="agvDescription"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent PushTasksToWCSSingle(int taskNum, string agvDescription = ""); |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | WebResponseContent AssignInboundTaskLocation(int taskNum, string roadwayNo); |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent TaskCompleted(int taskNum); |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="locationCode">å
¥åºæåºåºçè´§ä½å·</param> |
| | | /// <returns></returns> |
| | | MesResponseContent TestToolBack(TestToolBackModel backModel); |
| | | |
| | | /// <summary> |
| | | /// æµè¯æ¶æ¥åº |
| | | /// </summary> |
| | | /// <param name="toolScrap"></param> |
| | | /// <returns></returns> |
| | | MesResponseContent TestScrap(TestToolScrap toolScraps); |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <param name="locationCode"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent IsRelocation(int taskNum, string locationCode); |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="toolSynInfo"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent TestSynStock(TestToolSynInfo toolSynInfo); |
| | | |
| | | /// <summary> |
| | | /// éæ©åºåçæåºåºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent Outbound(int id); |
| | | |
| | | /// <summary> |
| | | /// ç©æåºåºï¼WMS忥åºåºç©ææ¹æ¬¡è³MES |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent UploadMesMaterialLotaAcept(MesMaterialLotaAceptModel model); |
| | | |
| | | /// <summary> |
| | | /// åºæ¿åºåº |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | MesResponseContent SubstrateOut(SubstrateOutModel model); |
| | | |
| | | /// <summary> |
| | | /// åºæ¿ä½æéåº |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | MesResponseContent SubstrateBack(SubstrateBackModel model); |
| | | } |
| | | } |
| | |
| | | private readonly IRecordService _recordService; |
| | | private readonly IInvokeERPService _invokeERPService; |
| | | private readonly IWarehouseService _warehouseService; |
| | | private readonly IPalletTypeInfoRepository _palletTypeInfoRepository; |
| | | |
| | | public IInboundOrderRepository Repository => BaseDal; |
| | | |
| | | public InboundOrderService(IInboundOrderRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IInboundRepository inboundRepository, IBasicRepository basicRepository, IStockRepository stockRepository, IRecordService recordService, IInvokeERPService invokeERPService, IWarehouseService warehouseService) : base(BaseDal) |
| | | public InboundOrderService(IInboundOrderRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IInboundRepository inboundRepository, IBasicRepository basicRepository, IStockRepository stockRepository, IRecordService recordService, IInvokeERPService invokeERPService, IWarehouseService warehouseService, IPalletTypeInfoRepository palletTypeInfoRepository) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | |
| | | _recordService = recordService; |
| | | _invokeERPService = invokeERPService; |
| | | _warehouseService = warehouseService; |
| | | _palletTypeInfoRepository = palletTypeInfoRepository; |
| | | } |
| | | /// <summary> |
| | | /// å
¶ä»å
¥åºåå建 |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥ä»åºä¿¡æ¯"); |
| | | } |
| | | |
| | | |
| | | Dt_InboundOrder inboundOrder = BaseDal.Db.Queryable<Dt_InboundOrder>().Where(x => x.InboundOrderNo == orderNo && x.WarehouseId == warehouse.WarehouseId).Includes(x => x.Details).First(); |
| | | if (inboundOrder == null) |
| | | { |
| | |
| | | PalletCode = palletCode, |
| | | StockStatus = StockStatusEmun.ç»çæå.ObjToInt(), |
| | | WarehouseId = inboundOrder.WarehouseId, |
| | | PalletType = PalletTypeEnum.SmallPallet.ObjToInt(), |
| | | PalletType = GetPalletType(warehouse, palletCode, materielInfo), |
| | | Details = new List<Dt_StockInfoDetail>() |
| | | }; |
| | | } |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"{batchNo}æµè¯æ¶å·²åå¨"); |
| | | } |
| | | if (models.Count>=2) |
| | | if (models.Count >= 2) |
| | | { |
| | | return WebResponseContent.Instance.Error($"ç»çæç»ä¸å¯ä¸"); |
| | | } |
| | |
| | | float beforeQuantity = 0; |
| | | |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First(); |
| | | |
| | | |
| | | if (stockInfo == null) |
| | | { |
| | | stockInfo = new Dt_StockInfo() |
| | |
| | | PalletCode = palletCode, |
| | | StockStatus = StockStatusEmun.æå¨ç»çæå.ObjToInt(), |
| | | WarehouseId = warehouse.WarehouseId, |
| | | PalletType = PalletTypeEnum.SmallPallet.ObjToInt(), |
| | | PalletType = GetPalletType(warehouse, palletCode, materielInfo), |
| | | Details = new List<Dt_StockInfoDetail>() |
| | | }; |
| | | } |
| | |
| | | SerialNumber = model.SerialNumber, |
| | | StockQuantity = model.Quantity, |
| | | OutboundQuantity = 0, |
| | | Unit= materielInfo.MaterielUnit, |
| | | Unit = materielInfo.MaterielUnit, |
| | | Status = StockStatusEmun.ç»çæå.ObjToInt(), |
| | | ProductionDate = model.ProductionDate, |
| | | EffectiveDate = model.EffectiveDate, |
| | |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <returns></returns> |
| | | //public WebResponseContent FeedbackInboundOrder(int id) |
| | | //{ |
| | | // try |
| | | // { |
| | | // Dt_InboundOrder inboundOrder = Db.Queryable<Dt_InboundOrder>().Where(x => x.Id == id).Includes(x => x.Details).First(); |
| | | // if (inboundOrder == null) |
| | | // { |
| | | // return WebResponseContent.Instance.Error($"æªæ¾å°å
¥åºåä¿¡æ¯"); |
| | | // } |
| | | // if (inboundOrder.Details == null || inboundOrder.Details.Count == 0) |
| | | // { |
| | | // return WebResponseContent.Instance.Error($"æªæ¾å°å
¥åºåæç»ä¿¡æ¯"); |
| | | // } |
| | | // if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | // { |
| | | // return WebResponseContent.Instance.Error($"å
¥åºåæ®å·²å®æ"); |
| | | // } |
| | | public WebResponseContent FeedbackInboundOrder(int id) |
| | | { |
| | | try |
| | | { |
| | | Dt_InboundOrder inboundOrder = Db.Queryable<Dt_InboundOrder>().Where(x => x.Id == id).Includes(x => x.Details).First(); |
| | | if (inboundOrder == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°å
¥åºåä¿¡æ¯"); |
| | | } |
| | | if (inboundOrder.Details == null || inboundOrder.Details.Count == 0) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°å
¥åºåæç»ä¿¡æ¯"); |
| | | } |
| | | if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"å
¥åºåæ®å·²å®æ"); |
| | | } |
| | | |
| | | // List<Dt_StockInfo> stockInfos = Db.Queryable<Dt_StockInfo>().Where(x => x.Details.Any(v => v.OrderNo == inboundOrder.InboundOrderNo)).Includes(x => x.Details).ToList(); |
| | | // List<Dt_Warehouse> warehouses = Db.Queryable<Dt_Warehouse>().ToList(); |
| | | List<Dt_StockInfo> stockInfos = Db.Queryable<Dt_StockInfo>().Where(x => x.Details.Any(v => v.OrderNo == inboundOrder.InboundOrderNo)).Includes(x => x.Details).ToList(); |
| | | List<Dt_Warehouse> warehouses = Db.Queryable<Dt_Warehouse>().ToList(); |
| | | |
| | | // List<ERPInboundDetailModel> detailModels = new List<ERPInboundDetailModel>(); |
| | | // foreach (var item in inboundOrder.Details) |
| | | // { |
| | | // Dt_StockInfo? stockInfo = stockInfos.FirstOrDefault(x => x.Details.Any(v => v.InboundOrderRowNo == item.RowNo && v.MaterielCode == item.MaterielCode)); |
| | | // if (stockInfo == null) |
| | | // { |
| | | // return WebResponseContent.Instance.Error($"æªæ¾å°åºåä¿¡æ¯"); |
| | | // } |
| | | List<ERPInboundDetailModel> detailModels = new List<ERPInboundDetailModel>(); |
| | | foreach (var item in inboundOrder.Details) |
| | | { |
| | | Dt_StockInfo? stockInfo = stockInfos.FirstOrDefault(x => x.Details.Any(v => v.InboundOrderRowNo == item.RowNo && v.MaterielCode == item.MaterielCode)); |
| | | if (stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°åºåä¿¡æ¯"); |
| | | } |
| | | |
| | | // Dt_Warehouse? warehouse = warehouses.FirstOrDefault(x => x.WarehouseId == stockInfo.WarehouseId); |
| | | // if (warehouse == null) |
| | | // { |
| | | // return WebResponseContent.Instance.Error($"æªæ¾å°ä»åºä¿¡æ¯"); |
| | | // } |
| | | Dt_Warehouse? warehouse = warehouses.FirstOrDefault(x => x.WarehouseId == stockInfo.WarehouseId); |
| | | if (warehouse == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ä»åºä¿¡æ¯"); |
| | | } |
| | | |
| | | // ERPInboundDetailModel detailModel = new ERPInboundDetailModel() |
| | | // { |
| | | // ExpiryDate = stockInfo.Details.FirstOrDefault()?.EffectiveDate ?? "", |
| | | // LocationCode = warehouse.WarehouseCode, |
| | | // MaterialsCode = item.MaterielCode, |
| | | // MfgDate = stockInfo.Details.FirstOrDefault()?.ProductionDate ?? "", |
| | | // QtyCustoms = "0", |
| | | // Quantity = stockInfo.Details.Sum(x => x.StockQuantity).ToString(), |
| | | // Rack = stockInfo.LocationCode, |
| | | // ReceiptCode = inboundOrder.UpperOrderNo, |
| | | // ReceiptSerNo = item.RowNo.ToString() |
| | | // }; |
| | | // detailModels.Add(detailModel); |
| | | // } |
| | | // Dt_Warehouse? warehouse2 = warehouses.FirstOrDefault(x => x.WarehouseId == inboundOrder.WarehouseId); |
| | | // if (warehouse2 == null) |
| | | // { |
| | | // return WebResponseContent.Instance.Error($"æªæ¾å°ä»åºä¿¡æ¯"); |
| | | // } |
| | | // ERPInboundModel model = new ERPInboundModel() |
| | | // { |
| | | // Code = inboundOrder.InboundOrderNo, |
| | | // CreatorCode = inboundOrder.Creater,//æµè¯ |
| | | // EntDate = inboundOrder.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | // StockDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | // SuppliersId = inboundOrder.SupplierId, |
| | | // Type = "S", |
| | | // UniqueTag = inboundOrder.Id.ToString(), |
| | | // WarehouseCode = warehouse2.WarehouseCode, |
| | | // Way = 1, |
| | | // Details = detailModels |
| | | // }; |
| | | // //æµè¯æ³¨é |
| | | // _invokeERPService.InvokeInboundOrderApi(model); |
| | | // return WebResponseContent.Instance.OK(); |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // return WebResponseContent.Instance.Error(ex.Message); |
| | | // } |
| | | //} |
| | | ERPInboundDetailModel detailModel = new ERPInboundDetailModel() |
| | | { |
| | | ExpiryDate = stockInfo.Details.FirstOrDefault()?.EffectiveDate ?? "", |
| | | LocationCode = warehouse.WarehouseCode, |
| | | MaterialsCode = item.MaterielCode, |
| | | MfgDate = stockInfo.Details.FirstOrDefault()?.ProductionDate ?? "", |
| | | QtyCustoms = "0", |
| | | Quantity = stockInfo.Details.Sum(x => x.StockQuantity).ToString(), |
| | | Rack = stockInfo.LocationCode, |
| | | ReceiptCode = inboundOrder.UpperOrderNo, |
| | | ReceiptSerNo = item.RowNo.ToString() |
| | | }; |
| | | detailModels.Add(detailModel); |
| | | } |
| | | Dt_Warehouse? warehouse2 = warehouses.FirstOrDefault(x => x.WarehouseId == inboundOrder.WarehouseId); |
| | | if (warehouse2 == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ä»åºä¿¡æ¯"); |
| | | } |
| | | ERPInboundModel model = new ERPInboundModel() |
| | | { |
| | | Code = inboundOrder.InboundOrderNo, |
| | | CreatorCode = inboundOrder.Creater,//æµè¯ |
| | | EntDate = inboundOrder.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | StockDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | SuppliersId = inboundOrder.SupplierId, |
| | | Type = "S", |
| | | UniqueTag = inboundOrder.Id.ToString(), |
| | | WarehouseCode = warehouse2.WarehouseCode, |
| | | Way = 1, |
| | | Details = detailModels |
| | | }; |
| | | //æµè¯æ³¨é |
| | | _invokeERPService.InvokeInboundOrderApi(model); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public int GetPalletType(Dt_Warehouse warehouse, string palletCode, Dt_MaterielInfo materielInfo) |
| | | { |
| | | if (warehouse.WarehouseCode == WarehouseEnum.HA64.ToString()) |
| | | { |
| | | if (palletCode.Substring(0, 1) == "6") |
| | | { |
| | | return PalletTypeEnum.MediumPallet.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | return PalletTypeEnum.LargestPallet.ObjToInt(); |
| | | } |
| | | } |
| | | else if (warehouse.WarehouseCode == WarehouseEnum.HA152.ObjToString()) |
| | | { |
| | | Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 2)); |
| | | if (palletTypeInfo == null) |
| | | { |
| | | throw new Exception($"æçå·é误"); |
| | | } |
| | | return palletTypeInfo.PalletType; |
| | | } |
| | | return -1; |
| | | } |
| | | } |
| | | } |
| | |
| | | public int PalletType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æçå·èµ·å§å符串 |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "æçå·èµ·å§å符串")] |
| | | public string CodeStartStr { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æçç±»ååç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "æçç±»ååç§°")] |
| | |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "æå±å±")] |
| | | public string SortNum { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å ç¨è´§ä½æ° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "å ç¨è´§ä½æ°")] |
| | | public int LocaitonCount { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 大æçæ¯å¦æ¾å¥æ°å |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "大æçæ¯å¦æ¾å¥æ°å")] |
| | | public bool IsOdd { get; set; } |
| | | } |
| | | } |
| | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_MesOutboundOrder))] |
| | | public class Dt_MesOutboundOrder : BaseEntity |
| | | { |
| | | /// <summary> |
| | |
| | | public float OrderQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// é宿°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "é宿°é", DefaultValue = "0")] |
| | | public float LockQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å·²åºæ°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "å·²åºæ°é", DefaultValue = "0")] |
| | |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_Common.WareHouseEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_IStockService; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_IRecordService; |
| | | |
| | | namespace WIDESEA_OutboundService |
| | | { |
| | | public class MesOutboundOrderService : ServiceBase<Dt_MesOutboundOrder, IMesOutboundOrderRepository>, IMesOutboundOrderService |
| | | { |
| | | private readonly IBasicRepository _basicRepository; |
| | | private readonly IStockService _stockService; |
| | | private readonly IOutStockLockInfoService _outStockLockInfoService; |
| | | private readonly IBasicService _basicService; |
| | | private readonly IRecordService _recordService; |
| | | |
| | | public MesOutboundOrderService(IMesOutboundOrderRepository BaseDal, IBasicRepository basicRepository) : base(BaseDal) |
| | | public IMesOutboundOrderRepository Repository => BaseDal; |
| | | |
| | | public MesOutboundOrderService(IMesOutboundOrderRepository BaseDal, IBasicRepository basicRepository, IStockService stockService, IOutStockLockInfoService outStockLockInfoService, IBasicService basicService, IRecordService recordService) : base(BaseDal) |
| | | { |
| | | _basicRepository = basicRepository; |
| | | _stockService = stockService; |
| | | _outStockLockInfoService = outStockLockInfoService; |
| | | _basicService = basicService; |
| | | _recordService = recordService; |
| | | } |
| | | |
| | | public MesResponseContent SubstrateOut(SubstrateOutModel model) |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="mesOutboundOrder"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public (List<Dt_StockInfo>, Dt_MesOutboundOrder, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(Dt_MesOutboundOrder mesOutboundOrder) |
| | | { |
| | | List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>(); |
| | | |
| | | List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | |
| | | float originalNeedQuantity = mesOutboundOrder.OrderQuantity; |
| | | |
| | | float needQuantity = originalNeedQuantity; |
| | | |
| | | List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(mesOutboundOrder.MaterialCode, "", mesOutboundOrder.WarehouseId); |
| | | if (!stockInfos.Any()) |
| | | { |
| | | throw new Exception($"æªæ¾å°å¯åé
åºå"); |
| | | } |
| | | List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, mesOutboundOrder.MaterialCode, needQuantity, out float residueQuantity); |
| | | mesOutboundOrder.LockQuantity += needQuantity - residueQuantity; |
| | | outStocks.AddRange(autoAssignStocks); |
| | | float assignQuantity = needQuantity - residueQuantity; |
| | | |
| | | float orderQuantity = mesOutboundOrder.OrderQuantity; |
| | | for (int j = 0; j < autoAssignStocks.Count; j++) |
| | | { |
| | | float detailAssignQuantity = outStockLockInfos.Where(x => x.MaterielCode == mesOutboundOrder.MaterialCode).Sum(x => x.AssignQuantity);//åºåºè®¢åæç»å·²åé
æ°é |
| | | |
| | | float palletAssignQuantity = outStockLockInfos.Where(x => x.MaterielCode == mesOutboundOrder.MaterialCode && x.PalletCode == autoAssignStocks[j].PalletCode).Sum(x => x.AssignQuantity);//åºåºè¯¦æ
å·²åé
æ°é |
| | | |
| | | float palletOutboundQuantity = autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity); |
| | | if (palletAssignQuantity < palletOutboundQuantity)//妿åºåºè¯¦æ
å·²åé
æ°éå°äºæçå·²åé
æ°éï¼åå¯ä»¥ç»§ç»æ·»å 该æçåºåºä¿¡æ¯ |
| | | { |
| | | float orderDetailNeedQuantity = mesOutboundOrder.OrderQuantity - detailAssignQuantity; |
| | | if (orderDetailNeedQuantity > autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity) - palletAssignQuantity) |
| | | { |
| | | mesOutboundOrder.LockQuantity += autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity) - palletAssignQuantity; |
| | | Dt_OutStockLockInfo outStockLockInfo = _outStockLockInfoService.GetOutStockLockInfo(mesOutboundOrder, autoAssignStocks[j], autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity) - palletAssignQuantity); |
| | | outStockLockInfos.Add(outStockLockInfo); |
| | | } |
| | | else |
| | | { |
| | | Dt_OutStockLockInfo outStockLockInfo = _outStockLockInfoService.GetOutStockLockInfo(mesOutboundOrder, autoAssignStocks[j], mesOutboundOrder.OrderQuantity - mesOutboundOrder.LockQuantity); |
| | | outStockLockInfos.Add(outStockLockInfo); |
| | | mesOutboundOrder.LockQuantity = mesOutboundOrder.OrderQuantity; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | locationInfos.AddRange(_basicService.LocationInfoService.Repository.GetLocationInfos(outStocks.Select(x => x.LocationCode).ToList())); |
| | | |
| | | return (outStocks, mesOutboundOrder, outStockLockInfos, locationInfos); |
| | | } |
| | | |
| | | public WebResponseContent LockOutboundStockDataUpdate(List<Dt_StockInfo> stockInfos, List<Dt_OutStockLockInfo> outStockLockInfos, List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus = LocationStatusEnum.Lock, List<Dt_Task>? tasks = null) |
| | | { |
| | | try |
| | | { |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA57.ToString()); |
| | | if (warehouse == null) |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfos); |
| | | List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>(); |
| | | foreach (var item in stockInfos) |
| | | { |
| | | return MesResponseContent.Instance.Error($"ä»åºåºç¡ä¿¡æ¯æªé
ç½®"); |
| | | stockInfoDetails.AddRange(item.Details); |
| | | } |
| | | _stockService.StockInfoDetailService.Repository.UpdateData(stockInfoDetails); |
| | | |
| | | List<Dt_OutStockLockInfo> addOutStockLockInfos = outStockLockInfos.Where(x => x.Id == 0).ToList(); |
| | | if (addOutStockLockInfos != null && addOutStockLockInfos.Any()) |
| | | { |
| | | if (tasks != null) |
| | | { |
| | | addOutStockLockInfos.ForEach(x => |
| | | { |
| | | x.TaskNum = tasks.FirstOrDefault(v => v.PalletCode == x.PalletCode)?.TaskNum; |
| | | }); |
| | | } |
| | | |
| | | _outStockLockInfoService.Repository.AddData(addOutStockLockInfos); |
| | | } |
| | | List<Dt_OutStockLockInfo> updateOutStockLockInfos = outStockLockInfos.Where(x => x.Id > 0).ToList(); |
| | | if (updateOutStockLockInfos != null && updateOutStockLockInfos.Any()) |
| | | { |
| | | _outStockLockInfoService.Repository.UpdateData(updateOutStockLockInfos); |
| | | } |
| | | |
| | | Dt_MaterielInfo materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterielCode == model.MaterialCode); |
| | | if (materielInfo == null) |
| | | { |
| | | return MesResponseContent.Instance.Error($"æªæ¾å°è¯¥ç©æä¿¡æ¯"); |
| | | } |
| | | |
| | | Dt_MesOutboundOrder mesOutboundOrder = new Dt_MesOutboundOrder() |
| | | { |
| | | CreateType = OrderCreateTypeEnum.UpperSystemPush.ObjToInt(), |
| | | Line = model.Line, |
| | | MaterialCode = model.MaterialCode, |
| | | MaterialName = model.MaterialName, |
| | | OrderQuantity = model.RequiredQuantity, |
| | | TaskNo = model.TaskNo, |
| | | Unit = model.Unit, |
| | | OrderType = MesOutboundOrderTypeEnum.SubstrateOut.ObjToInt(), |
| | | OrderStatus = OutOrderStatusEnum.æªå¼å§.ObjToInt(), |
| | | WarehouseId = warehouse.WarehouseId |
| | | }; |
| | | |
| | | BaseDal.AddData(mesOutboundOrder); |
| | | |
| | | return MesResponseContent.Instance.OK(); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfos, locationStatus, LocationChangeType.OutboundAssignLocation, "", tasks?.Select(x => x.TaskNum).ToList()); |
| | | _basicService.LocationInfoService.Repository.UpdateLocationStatus(locationInfos, locationStatus); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return MesResponseContent.Instance.Error(ex.Message); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | |
| | | return outStockLockInfo; |
| | | } |
| | | |
| | | public Dt_OutStockLockInfo GetOutStockLockInfo(Dt_MesOutboundOrder mesOutboundOrder, Dt_StockInfo outStock, float assignQuantity, int? taskNum = null) |
| | | { |
| | | |
| | | Dt_OutStockLockInfo outStockLockInfo = new Dt_OutStockLockInfo() |
| | | { |
| | | PalletCode = outStock.PalletCode, |
| | | AssignQuantity = assignQuantity, |
| | | MaterielCode = mesOutboundOrder.MaterialCode, |
| | | BatchNo = outStock.Details.FirstOrDefault()?.BatchNo ?? "", |
| | | LocationCode = outStock.LocationCode, |
| | | MaterielName = mesOutboundOrder.MaterialName, |
| | | OrderDetailId = mesOutboundOrder.Id, |
| | | OrderNo = mesOutboundOrder.OrderNo, |
| | | OrderType = mesOutboundOrder.OrderType, |
| | | OriginalQuantity = outStock.Details.Where(x => x.MaterielCode == mesOutboundOrder.MaterialCode).Sum(x => x.StockQuantity), |
| | | Status = taskNum == null ? OutLockStockStatusEnum.å·²åé
.ObjToInt() : OutLockStockStatusEnum.åºåºä¸.ObjToInt(), |
| | | StockId = outStock.Id, |
| | | TaskNum = taskNum, |
| | | OrderQuantity = mesOutboundOrder.OrderQuantity |
| | | }; |
| | | |
| | | return outStockLockInfo; |
| | | } |
| | | |
| | | public List<Dt_OutStockLockInfo> GetByOrderDetailId(int orderDetailId, OutLockStockStatusEnum outStockStatus) |
| | | { |
| | | return BaseDal.QueryData(x => x.OrderDetailId == orderDetailId && x.Status == outStockStatus.ObjToInt()); |
| | |
| | | { |
| | | throw new Exception($"æªæ¾å°åºå详æ
"); |
| | | } |
| | | List<Dt_OutStockLockInfo> stockLockInfos = BaseDal.QueryData(x => x.StockId == stockInfo.Id&&x.Status< OutLockStockStatusEnum.åºåºå®æ.ObjToInt()); |
| | | List<Dt_OutStockLockInfo> stockLockInfos = BaseDal.QueryData(x => x.StockId == stockInfo.Id && x.Status < OutLockStockStatusEnum.åºåºå®æ.ObjToInt()); |
| | | return stockLockInfos; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | locationInfos.AddRange(_basicService.LocationInfoService.Repository.GetLocationInfos(outStocks.Select(x => x.LocationCode).ToList())); |
| | | } |
| | | |
| | | |
| | | |
| | | return (outStocks, outboundOrderDetails, outStockLockInfos, locationInfos); |
| | | } |
| | | |
| | |
| | | List<Dt_OutStockLockInfo> addOutStockLockInfos = outStockLockInfos.Where(x => x.Id == 0).ToList(); |
| | | if (addOutStockLockInfos != null && addOutStockLockInfos.Any()) |
| | | { |
| | | if(tasks != null) |
| | | if (tasks != null) |
| | | { |
| | | addOutStockLockInfos.ForEach(x => |
| | | { |
| | | x.TaskNum = tasks.FirstOrDefault(v => v.PalletCode == x.PalletCode)?.TaskNum; |
| | | }); |
| | | } |
| | | |
| | | |
| | | _outStockLockInfoService.Repository.AddData(addOutStockLockInfos); |
| | | } |
| | | List<Dt_OutStockLockInfo> updateOutStockLockInfos = outStockLockInfos.Where(x => x.Id > 0).ToList(); |
| | |
| | | |
| | | public IStockInfoRepository StockInfoRepository { get; } |
| | | |
| | | public StockRepository(IStockInfoDetailRepository stockInfoDetailRepository, IStockInfoRepository stockInfoRepository) |
| | | public IStockInfoDetail_HtyRepository StockInfoDetail_HtyRepository { get; } |
| | | |
| | | public IStockInfo_HtyRepository StockInfo_HtyRepository { get; } |
| | | |
| | | public StockRepository(IStockInfoDetailRepository stockInfoDetailRepository, IStockInfoRepository stockInfoRepository, IStockInfoDetail_HtyRepository stockInfoDetail_HtyRepository,IStockInfo_HtyRepository stockInfo_HtyRepository) |
| | | { |
| | | StockInfoDetailRepository = stockInfoDetailRepository; |
| | | StockInfoRepository = stockInfoRepository; |
| | | StockInfoDetail_HtyRepository = stockInfoDetail_HtyRepository; |
| | | StockInfo_HtyRepository = stockInfo_HtyRepository; |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | } |
| | | |
| | | static object lock_taskNum = new object(); |
| | | public int GetTaskNum(string sequenceName) |
| | | { |
| | | return Db.Ado.GetScalar($"SELECT NEXT VALUE FOR {sequenceName}").ObjToInt(); |
| | | lock (lock_taskNum) |
| | | { |
| | | return Db.Ado.GetScalar($"SELECT NEXT VALUE FOR {sequenceName}").ObjToInt(); |
| | | } |
| | | } |
| | | |
| | | public override int AddData(Dt_Task entity) |
| | |
| | | using WIDESEA_ITaskInfoRepository; |
| | | using WIDESEA_ITaskInfoService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Common.OrderEnum; |
| | | |
| | | namespace WIDESEA_TaskInfoService |
| | | { |
| | |
| | | try |
| | | { |
| | | Dt_Task exsit = Repository.QueryFirst(x => x.TargetAddress == model.TargetAddressCode); |
| | | if(exsit != null) |
| | | if (exsit != null) |
| | | { |
| | | return responseContent.Error($"ç®æ å°åéå¤"); |
| | | } |
| | |
| | | //æ´æ°åºåç¶æ |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | //æ´æ°è´§ä½ç¶æ |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)stockInfo.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, stockInfo.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId); |
| | | //æ°å»ºä»»å¡ |
| | | BaseDal.AddData(taskOut); |
| | | //å å
¥è´§ä½åå¨è®°å½ |
| | |
| | | //æ¸
é¤åºåä¿¡æ¯ |
| | | _unitOfWorkManage.BeginTran(); |
| | | _stockRepository.StockInfoRepository.DeleteAndMoveIntoHty(stockInfoUpdates, OperateTypeEnum.èªå¨å é¤); |
| | | _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(stockInfoDetails,OperateTypeEnum.èªå¨å é¤); |
| | | _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(stockInfoDetails, OperateTypeEnum.èªå¨å é¤); |
| | | _unitOfWorkManage.CommitTran(); |
| | | responseContent.OK($"æ¥åºæå"); |
| | | } |
| | |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç©æåºåºï¼WMS忥åºåºç©ææ¹æ¬¡è³MES |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent UploadMesMaterialLotaAcept(MesMaterialLotaAceptModel model) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMS_MES_TestToolSync.ToString()); |
| | | MESRoot<MesMaterialLotaAceptModel> root = new MESRoot<MesMaterialLotaAceptModel>() |
| | | { |
| | | From = "WMS", |
| | | DateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Content = model |
| | | }; |
| | | JsonSerializerSettings settings = new JsonSerializerSettings |
| | | { |
| | | ContractResolver = new CamelCasePropertyNamesContractResolver() |
| | | }; |
| | | string request = JsonConvert.SerializeObject(root, settings); |
| | | string response = HttpMesHelper.Post(apiInfo.ApiAddress, request); |
| | | MesResponseContent mesResponseContent = response.DeserializeObject<MesResponseContent>(); |
| | | //è°ç¨æ¥å£ |
| | | if (mesResponseContent.BSucc == true) |
| | | { |
| | | content.OK(mesResponseContent.StrMsg); |
| | | } |
| | | else |
| | | { |
| | | content.Error(mesResponseContent.StrMsg); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="stockInfo"></param> |
| | | /// <param name="stockInfoDetail"></param> |
| | | /// <param name="taskNo"></param> |
| | | /// <param name="warehouseCode"></param> |
| | | /// <param name="quantity"></param> |
| | | /// <param name="cutedType"></param> |
| | | /// <param name="ppWidth"></param> |
| | | /// <returns></returns> |
| | | public MesMaterialLotaAceptModel GetMesMaterialLotaAceptModel(Dt_StockInfo stockInfo, Dt_StockInfoDetail stockInfoDetail, string taskNo, string warehouseCode, float quantity, string cutedType = "", float ppWidth = 0) |
| | | { |
| | | MesMaterialLotaAceptModel model = new MesMaterialLotaAceptModel() |
| | | { |
| | | CarrierCode = stockInfo.PalletCode, |
| | | CutedType = cutedType, |
| | | ExpirationDate = stockInfoDetail.EffectiveDate, |
| | | MaterialBarCode = stockInfoDetail.SerialNumber, |
| | | MaterialCode = stockInfoDetail.MaterielCode, |
| | | MaterialLot = stockInfoDetail.MaterielCode + "," + stockInfoDetail.BatchNo, |
| | | MaterialName = stockInfoDetail.MaterielName, |
| | | PPWidth = ppWidth, |
| | | ProductionDate = stockInfoDetail.ProductionDate, |
| | | Quantity = quantity, |
| | | Supplier = "", |
| | | TaskNo = taskNo, |
| | | Type = 1, |
| | | WarehouseArea = warehouseCode, |
| | | WarehouseLocation = warehouseCode |
| | | }; |
| | | |
| | | return model; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åºæ¿åºåº |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public MesResponseContent SubstrateOut(SubstrateOutModel model) |
| | | { |
| | | try |
| | | { |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA57.ToString()); |
| | | if (warehouse == null) |
| | | { |
| | | return MesResponseContent.Instance.Error($"ä»åºåºç¡ä¿¡æ¯æªé
ç½®"); |
| | | } |
| | | |
| | | Dt_MaterielInfo materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterielCode == model.MaterialCode); |
| | | if (materielInfo == null) |
| | | { |
| | | return MesResponseContent.Instance.Error($"æªæ¾å°è¯¥ç©æä¿¡æ¯"); |
| | | } |
| | | |
| | | Dt_MesOutboundOrder mesOutboundOrder = new Dt_MesOutboundOrder() |
| | | { |
| | | CreateType = OrderCreateTypeEnum.UpperSystemPush.ObjToInt(), |
| | | Line = model.Line, |
| | | MaterialCode = model.MaterialCode, |
| | | MaterialName = model.MaterialName, |
| | | OrderQuantity = model.RequiredQuantity, |
| | | TaskNo = model.TaskNo, |
| | | Unit = model.Unit, |
| | | OrderType = MesOutboundOrderTypeEnum.SubstrateOut.ObjToInt(), |
| | | OrderStatus = OutOrderStatusEnum.æªå¼å§.ObjToInt(), |
| | | WarehouseId = warehouse.WarehouseId |
| | | }; |
| | | |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | |
| | | List<Dt_StockInfo>? stockInfos = null; |
| | | List<Dt_OutStockLockInfo>? outStockLockInfos = null; |
| | | List<Dt_LocationInfo>? locationInfos = null; |
| | | { |
| | | (List<Dt_StockInfo>, Dt_MesOutboundOrder, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.MesOutboundOrderService.AssignStockOutbound(mesOutboundOrder); |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | tasks = GetTasks(result.Item1, TaskTypeEnum.MesOutbound); |
| | | result.Item2.OrderStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | | result.Item3.ForEach(x => |
| | | { |
| | | x.Status = OutLockStockStatusEnum.åºåºä¸.ObjToInt(); |
| | | }); |
| | | |
| | | stockInfos = result.Item1; |
| | | mesOutboundOrder = result.Item2; |
| | | outStockLockInfos = result.Item3; |
| | | locationInfos = result.Item4; |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("æ åºå"); |
| | | } |
| | | } |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | | int id = BaseDal.AddData(tasks); |
| | | outStockLockInfos.ForEach(x => |
| | | { |
| | | x.OrderNo = mesOutboundOrder.TaskNo; |
| | | x.OrderDetailId = id; |
| | | }); |
| | | _outboundService.MesOutboundOrderService.Repository.AddData(mesOutboundOrder); |
| | | if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0) |
| | | { |
| | | WebResponseContent content = _outboundService.MesOutboundOrderService.LockOutboundStockDataUpdate(stockInfos, outStockLockInfos, locationInfos, tasks: tasks); |
| | | |
| | | if (!content.Status) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return MesResponseContent.Instance.Error(content.Message); |
| | | } |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | PushTasksToWCS(tasks); |
| | | |
| | | |
| | | return MesResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return MesResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åºæ¿ä½æéåº |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public MesResponseContent SubstrateBack(SubstrateBackModel model) |
| | | { |
| | | try |
| | | { |
| | | Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => model.CarrierCode.Contains(x.CodeStartStr)); |
| | | if (palletTypeInfo == null) |
| | | { |
| | | return MesResponseContent.Instance.Error($"æªè¯å«è¯¥æçç±»åï¼è¯·ç¡®è®¤æçå·"); |
| | | } |
| | | |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x=>x.WarehouseCode == WarehouseEnum.HA57.ToString()); |
| | | |
| | | Dt_StockInfo stockInfo = new Dt_StockInfo() |
| | | { |
| | | PalletCode = model.CarrierCode, |
| | | PalletType = palletTypeInfo.PalletType, |
| | | WarehouseId = warehouse.WarehouseId, |
| | | StockStatus = StockStatusEmun.ç»çæå.ObjToInt() |
| | | }; |
| | | |
| | | Dt_StockInfoDetail_Hty stockInfoDetail_Hty = _stockRepository.StockInfoDetail_HtyRepository.QueryFirst(x => x.BatchNo == model.MaterialLot && x.MaterielCode == model.MaterialCode); |
| | | |
| | | Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail() |
| | | { |
| | | BatchNo = stockInfoDetail_Hty?.BatchNo ?? "", |
| | | EffectiveDate = model.ExpirationDate, |
| | | MaterielCode = model.MaterialCode, |
| | | InboundOrderRowNo = stockInfoDetail_Hty?.InboundOrderRowNo ?? 0, |
| | | MaterielName = model.MaterialCode, |
| | | ProductionDate = model.ProductionDate, |
| | | OrderNo = stockInfoDetail_Hty?.OrderNo ?? "", |
| | | OutboundQuantity = 0, |
| | | SerialNumber = stockInfoDetail_Hty?.SerialNumber ?? "0", |
| | | StockQuantity = model.Quantity, |
| | | Status = StockStatusEmun.ç»çæå.ObjToInt(), |
| | | Unit = model.Unit |
| | | }; |
| | | |
| | | Dt_Task task = new Dt_Task() |
| | | { |
| | | PalletCode = stockInfo.PalletCode, |
| | | CurrentAddress = "", |
| | | NextAddress = "", |
| | | PalletType = stockInfo.PalletType, |
| | | Roadway = "", |
| | | SourceAddress = "", |
| | | TargetAddress = "", |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | TaskType = TaskTypeEnum.MesMatReturn.ObjToInt(), |
| | | WarehouseId = warehouse.WarehouseId |
| | | }; |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | Db.InsertNav(stockInfo).Include(x => x.Details).ExecuteCommand(); |
| | | BaseDal.AddData(task); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | return MesResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return MesResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | private readonly IInvokeERPService _invokeERPService; |
| | | private readonly IInboundRepository _inboundRepository; |
| | | private readonly IInboundOrderService _inboundOrderService; |
| | | private readonly IPalletTypeInfoRepository _palletTypeInfoRepository; |
| | | |
| | | public ITaskRepository Repository => BaseDal; |
| | | |
| | |
| | | |
| | | 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, IInboundRepository inboundRepository, IInboundOrderService inboundOrderService) : 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, IInboundOrderService inboundOrderService, IPalletTypeInfoRepository palletTypeInfoRepository) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | |
| | | _invokeERPService = invokeERPService; |
| | | _inboundRepository = inboundRepository; |
| | | _inboundOrderService = inboundOrderService; |
| | | _palletTypeInfoRepository = palletTypeInfoRepository; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | task.TaskStatus = (int)TaskStatusEnum.Finish; |
| | | _unitOfWorkManage.BeginTran(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.äººå·¥å®æ : OperateTypeEnum.èªå¨å®æ); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId); |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | _stockRepository.StockInfoDetailRepository.UpdateData(stockInfo.Details); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.InStock, LocationChangeType.InboundCompleted); |
| | |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == task.WarehouseId); |
| | | List<Dt_OutStockLockInfo> outStockLockInfos = _outboundService.OutboundStockLockInfoService.Repository.QueryData(x => x.TaskNum == taskNum); |
| | | List<Dt_OutboundOrderDetail> outboundOrderDetails = new List<Dt_OutboundOrderDetail>(); |
| | | List<Dt_MesOutboundOrder> mesOutboundOrders = new List<Dt_MesOutboundOrder>(); |
| | | |
| | | if ((outStockLockInfos == null || outStockLockInfos.Count == 0) && warehouse.WarehouseCode != WarehouseEnum.HA64.ToString()) |
| | | { |
| | |
| | | { |
| | | foreach (var item in outStockLockInfos) |
| | | { |
| | | Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.Id == item.OrderDetailId); |
| | | if (outboundOrderDetail != null) |
| | | if (task.TaskType == TaskTypeEnum.MesOutbound.ObjToInt()) |
| | | { |
| | | outboundOrderDetail.OverOutQuantity = item.AssignQuantity; |
| | | if (outboundOrderDetail.OverOutQuantity == outboundOrderDetail.OrderQuantity) |
| | | Dt_MesOutboundOrder mesOutboundOrder = _outboundService.MesOutboundOrderService.Repository.QueryFirst(x => x.Id == item.OrderDetailId); |
| | | if (mesOutboundOrder != null) |
| | | { |
| | | outboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt(); |
| | | mesOutboundOrder.OverOutQuantity = item.AssignQuantity; |
| | | if (mesOutboundOrder.OverOutQuantity == mesOutboundOrder.OrderQuantity) |
| | | { |
| | | mesOutboundOrder.OrderStatus = OrderDetailStatusEnum.Over.ObjToInt(); |
| | | } |
| | | mesOutboundOrders.Add(mesOutboundOrder); |
| | | } |
| | | outboundOrderDetails.Add(outboundOrderDetail); |
| | | } |
| | | else |
| | | { |
| | | Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.Id == item.OrderDetailId); |
| | | if (outboundOrderDetail != null) |
| | | { |
| | | outboundOrderDetail.OverOutQuantity = item.AssignQuantity; |
| | | if (outboundOrderDetail.OverOutQuantity == outboundOrderDetail.OrderQuantity) |
| | | { |
| | | outboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt(); |
| | | } |
| | | outboundOrderDetails.Add(outboundOrderDetail); |
| | | } |
| | | } |
| | | item.Status = OutLockStockStatusEnum.åºåºå®æ.ObjToInt(); |
| | | } |
| | | } |
| | | |
| | | task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | if (outboundOrderDetails.Count > 0) |
| | | |
| | | if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) |
| | | { |
| | | _outboundService.OutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails); |
| | | if (outboundOrderDetails.Count > 0) |
| | | { |
| | | _outboundService.OutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails); |
| | | } |
| | | |
| | | stockInfo.LocationCode = ""; |
| | | stockInfo.StockStatus = StockStatusEmun.åºåºå®æ.ObjToInt(); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | } |
| | | stockInfo.LocationCode = ""; |
| | | stockInfo.StockStatus = StockStatusEmun.åºåºå®æ.ObjToInt(); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | else if (task.TaskType == TaskTypeEnum.MesOutbound.ObjToInt()) |
| | | { |
| | | _outboundService.MesOutboundOrderService.Repository.UpdateData(mesOutboundOrders); |
| | | _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(stockInfo.Details, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | } |
| | | _outboundService.OutboundStockLockInfoService.Repository.UpdateData(outStockLockInfos); |
| | | |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)stockInfo.PalletType, LocationStatusEnum.Free, stockInfo.WarehouseId); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, stockInfo.PalletType, LocationStatusEnum.Free, stockInfo.WarehouseId); |
| | | |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, (LocationStatusEnum)beforeStatus, LocationStatusEnum.Free, LocationChangeType.OutboundCompleted, stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); |
| | | _unitOfWorkManage.CommitTran(); |
| | | if (warehouse.WarehouseCode != WarehouseEnum.HA64.ToString()) |
| | | |
| | | if (warehouse.WarehouseCode != WarehouseEnum.HA64.ToString() && task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) |
| | | { |
| | | _outboundService.OutboundOrderService.TestOutUpload(outboundOrderDetails.FirstOrDefault().Id, outStockLockInfos); |
| | | } |
| | | if (task.TaskType == TaskTypeEnum.MesOutbound.ObjToInt()) |
| | | { |
| | | MesMaterialLotaAceptModel model = GetMesMaterialLotaAceptModel(stockInfo, stockInfo.Details.FirstOrDefault(), mesOutboundOrders.FirstOrDefault().TaskNo, warehouse.WarehouseCode, mesOutboundOrders.FirstOrDefault().OrderQuantity); |
| | | |
| | | UploadMesMaterialLotaAcept(model); |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | return WebResponseContent.Instance.Error($"该æçå·²ç»å®è´§ä½"); |
| | | } |
| | | |
| | | Dt_LocationInfo? locationInfo = _basicService.LocationInfoService.AssignLocation(roadwayNo, (PalletTypeEnum)stockInfo.PalletType, stockInfo.WarehouseId); |
| | | Dt_LocationInfo? locationInfo = _basicService.LocationInfoService.AssignLocation(roadwayNo, stockInfo.PalletType, stockInfo.WarehouseId); |
| | | if (locationInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"è´§ä½åé
失败,æªæ¾å°å¯åé
è´§ä½"); |
| | |
| | | LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; |
| | | _unitOfWorkManage.BeginTran(); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.Lock, LocationChangeType.InboundAssignLocation); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)newTask.PalletType, LocationStatusEnum.Lock, newTask.WarehouseId); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, newTask.PalletType, LocationStatusEnum.Lock, newTask.WarehouseId); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | |
| | | return WebResponseContent.Instance.OK(data: task.TargetAddress); |
| | | } |
| | | |
| | | Dt_LocationInfo? locationInfo = _basicService.LocationInfoService.AssignLocation(roadwayNo, (PalletTypeEnum)task.PalletType, task.WarehouseId); |
| | | Dt_LocationInfo? locationInfo = _basicService.LocationInfoService.AssignLocation(roadwayNo, task.PalletType, task.WarehouseId); |
| | | if (locationInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"è´§ä½åé
失败,æªæ¾å°å¯åé
è´§ä½"); |
| | |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.Lock, LocationChangeType.InboundAssignLocation); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)task.PalletType, LocationStatusEnum.Lock, task.WarehouseId); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, task.PalletType, LocationStatusEnum.Lock, task.WarehouseId); |
| | | BaseDal.UpdateData(task); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(data: locationInfo.LocationCode); |
| | |
| | | Dt_LocationInfo locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode); |
| | | if (locationInfo!=null && (locationInfo.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || locationInfo.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && locationInfo.LocationStatus==LocationStatusEnum.InStock.ObjToInt() && stockInfo.StockStatus==StockStatusEmun.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | List<Dt_Task> tasks = GetTasks(new List<Dt_StockInfo>() { stockInfo }); |
| | | List<Dt_Task> tasks = GetTasks(new List<Dt_StockInfo>() { stockInfo }, TaskTypeEnum.Outbound); |
| | | if (tasks == null || tasks.Count <= 0) |
| | | { |
| | | return content.Error($"çæä»»å¡å¤±è´¥"); |
| | |
| | | //æ´æ°åºåç¶æ |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | //æ´æ°è´§ä½ç¶æ |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)stockInfo.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, stockInfo.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId); |
| | | //æ°å»ºä»»å¡ |
| | | BaseDal.AddData(tasks); |
| | | //å å
¥è´§ä½åå¨è®°å½ |
| | |
| | | /// </summary> |
| | | /// <param name="stockInfos"></param> |
| | | /// <returns></returns> |
| | | public List<Dt_Task> GetTasks(List<Dt_StockInfo> stockInfos) |
| | | public List<Dt_Task> GetTasks(List<Dt_StockInfo> stockInfos, TaskTypeEnum taskType) |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | for (int i = 0; i < stockInfos.Count; i++) |
| | |
| | | SourceAddress = stockInfo.LocationCode, |
| | | TargetAddress = "", |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | TaskType = TaskTypeEnum.Outbound.ObjToInt(), |
| | | TaskType = taskType.ObjToInt(), |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | PalletType = stockInfo.PalletType, |
| | | WarehouseId = stockInfo.WarehouseId, |
| | |
| | | (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutboundOrderDetailService.AssignStockOutbound(outboundOrderDetail, stockSelectViews); |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | tasks = GetTasks(result.Item1); |
| | | tasks = GetTasks(result.Item1, TaskTypeEnum.Outbound); |
| | | result.Item2.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | | result.Item3.ForEach(x => |
| | | { |
| | |
| | | if (stockLockInfos != null && stockLockInfos.Count > 0) |
| | | { |
| | | List<Dt_StockInfo> stocks = _stockService.StockInfoService.Repository.GetStockInfosByPalletCodes(stockLockInfos.Select(x => x.PalletCode).Distinct().ToList()); |
| | | tasks = GetTasks(stocks); |
| | | tasks = GetTasks(stocks, TaskTypeEnum.Outbound); |
| | | } |
| | | } |
| | | |
| | |
| | | (List<Dt_StockInfo>, List<Dt_OutboundOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutboundOrderDetailService.AssignStockOutbound(outboundOrderDetails); |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | tasks = GetTasks(result.Item1); |
| | | tasks = GetTasks(result.Item1, TaskTypeEnum.Outbound); |
| | | result.Item2.ForEach(x => |
| | | { |
| | | x.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | |
| | | return WebResponseContent.Instance.OK(data: _mapper.Map<WMSTaskDTO>(taskTemp)); |
| | | } |
| | | |
| | | Dt_LocationInfo? newLocation = _basicService.LocationInfoService.AssignLocation(needRelocationItem.RoadwayNo, (PalletTypeEnum)task.PalletType, task.WarehouseId); |
| | | Dt_LocationInfo? newLocation = _basicService.LocationInfoService.AssignLocation(needRelocationItem.RoadwayNo, task.PalletType, task.WarehouseId); |
| | | if (newLocation != null) |
| | | { |
| | | Dt_Task newTask = new Dt_Task() |
| | |
| | | Repository.AddData(newTask); |
| | | { |
| | | LocationStatusEnum lastStatus = (LocationStatusEnum)newLocation.LocationStatus; |
| | | _basicService.LocationInfoService.UpdateLocationStatus(newLocation, (PalletTypeEnum)task.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(newLocation, task.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(newLocation, lastStatus, LocationStatusEnum.Lock, LocationChangeType.RelocationAssignLocation, taskNum: newTask.TaskNum); |
| | | } |
| | | { |
| | | LocationStatusEnum lastStatus = (LocationStatusEnum)needRelocationItem.LocationStatus; |
| | | _basicService.LocationInfoService.UpdateLocationStatus(needRelocationItem, (PalletTypeEnum)task.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(needRelocationItem, task.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(needRelocationItem, lastStatus, LocationStatusEnum.Lock, LocationChangeType.RelocationAssignLocation, taskNum: newTask.TaskNum); |
| | | } |
| | | stockInfo.StockStatus = StockStatusEmun.ç§»åºéå®.ObjToInt(); |
| | |
| | | _unitOfWorkManage.BeginTran(); |
| | | stockInfo.LocationCode = locationInfoEnd.LocationCode; |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfoStart, (PalletTypeEnum)stockInfo.PalletType, LocationStatusEnum.Free, stockInfo.WarehouseId); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfoEnd, (PalletTypeEnum)stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfoStart, stockInfo.PalletType, LocationStatusEnum.Free, stockInfo.WarehouseId); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfoEnd, stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? WIDESEA_Core.Enums.OperateTypeEnum.äººå·¥å®æ : WIDESEA_Core.Enums.OperateTypeEnum.èªå¨å®æ); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | |
| | | /// <param name="palletType"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("AssignLocation"), AllowAnonymous] |
| | | public Dt_LocationInfo? AssignLocation(string roadwayNo, PalletTypeEnum palletType, int warehouseId) |
| | | public Dt_LocationInfo? AssignLocation(string roadwayNo, int palletType, int warehouseId) |
| | | { |
| | | return Service.AssignLocation(roadwayNo, palletType, warehouseId); |
| | | } |
| | |
| | | } |
| | | |
| | | [HttpPost, Route("UpdateLocationStatus"), AllowAnonymous] |
| | | public WebResponseContent UpdateLocationStatus(string locationCode, PalletTypeEnum palletType, LocationStatusEnum locationStatus, int warehousId) |
| | | public WebResponseContent UpdateLocationStatus(string locationCode, int palletType, LocationStatusEnum locationStatus, int warehousId) |
| | | { |
| | | try |
| | | { |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// åºæ¿åºåº |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("SubstrateOut"), AllowAnonymous] |
| | | public MesResponseContent SubstrateOut([FromBody] Root<SubstrateOutModel> model) |
| | | { |
| | | return _outboundService.MesOutboundOrderService.SubstrateOut(model.Content); |
| | | return _taskService.SubstrateOut(model.Content); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åºæ¿ä½æéåº |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("SubstrateBack"), AllowAnonymous] |
| | | public MesResponseContent SubstrateBack([FromBody] Root<SubstrateBackModel> model) |
| | | { |
| | | return _taskService.SubstrateBack(model.Content); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç©æåºåºï¼WMS忥åºåºç©ææ¹æ¬¡è³MES |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent UploadMesMaterialLotaAcept([FromBody] MesMaterialLotaAceptModel model) |
| | | { |
| | | return _taskService.UploadMesMaterialLotaAcept(model); |
| | | } |
| | | } |
| | | } |