| | |
| | | WMSTaskDTO taskDTO = new WMSTaskDTO() |
| | | { |
| | | TaskNum = task.TaskNum.Value, |
| | | Grade = 1, |
| | | Grade = task.Grade.Value, |
| | | PalletCode = task.PalletCode, |
| | | RoadWay = task.Roadway, |
| | | SourceAddress = task.SourceAddress, |
| | |
| | | |
| | | private async Task<Dt_Task> CreateInToOutTaskAsync(RequestTaskDto input, Dt_StationManager stationManager) |
| | | { |
| | | //if (stationManager.stationType != 5) throw new Exception("错误的调取"); |
| | | |
| | | input.EquiCodeMOM = "24MEJQ11-1006-1"; |
| | | |
| | | // 创建一个TrayCellsStatusDto对象,并赋值 |
| | | TrayCellsStatusDto trayCells = new TrayCellsStatusDto() |
| | | try |
| | | { |
| | | Software = "WMS", |
| | | TrayBarcode = input.PalletCode, |
| | | //EquipmentCode = "EQ_CWJZ01" |
| | | EquipmentCode = input.EquiCodeMOM |
| | | }; |
| | | //if (stationManager.stationType != 5) throw new Exception("错误的调取"); |
| | | |
| | | // 调用GetTrayCellStatusAsync方法,获取整盘电芯 |
| | | WebResponseContent content = await GetTrayCellStatusAsync(trayCells); |
| | | // 如果状态为false,则返回content |
| | | if (!content.Status) throw new Exception(content.Message); |
| | | input.EquiCodeMOM = "24MEJQ11-1006-1"; |
| | | |
| | | // 添加组盘信息 |
| | | // 将content.Data转换为ResultTrayCellsStatus对象 |
| | | var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString()); |
| | | if (result.SerialNos.Count <= 0) |
| | | { |
| | | ConsoleHelper.WriteErrorLine(result.MOMMessage); |
| | | if (stationManager.stationType != 3) |
| | | // 创建一个TrayCellsStatusDto对象,并赋值 |
| | | TrayCellsStatusDto trayCells = new TrayCellsStatusDto() |
| | | { |
| | | Software = "WMS", |
| | | TrayBarcode = input.PalletCode, |
| | | //EquipmentCode = "EQ_CWJZ01" |
| | | EquipmentCode = input.EquiCodeMOM |
| | | }; |
| | | |
| | | // 调用GetTrayCellStatusAsync方法,获取整盘电芯 |
| | | WebResponseContent content = await GetTrayCellStatusAsync(trayCells); |
| | | // 如果状态为false,则返回content |
| | | if (!content.Status) throw new Exception(content.Message); |
| | | |
| | | // 组盘信息 |
| | | // 将content.Data转换为ResultTrayCellsStatus对象 |
| | | var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString()); |
| | | |
| | | if (!result.Success) |
| | | { |
| | | var taskNG = new Dt_Task |
| | | { |
| | |
| | | }; |
| | | return taskNG; |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | // 处理异常电芯情况 |
| | | var serialNosError = result.SerialNos.Where(x => x.SerialNoStatus != 1).ToList(); |
| | | if (serialNosError.Count > 0) |
| | | { |
| | | if (stationManager.stationType != 3) |
| | | if (result.SerialNos.Count <= 0) |
| | | { |
| | | var taskNG = new Dt_Task |
| | | ConsoleHelper.WriteErrorLine(result.MOMMessage); |
| | | if (stationManager.stationType != 3) |
| | | { |
| | | CurrentAddress = input.Position, |
| | | Grade = 1, |
| | | Roadway = input.Roadways, |
| | | TargetAddress = stationManager.stationNGLocation, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | NextAddress = stationManager.stationNGChildCode, |
| | | OrderNo = null, |
| | | PalletCode = input.PalletCode, |
| | | SourceAddress = stationManager.stationLocation, |
| | | TaskState = (int)TaskInStatusEnum.Line_InFinish, |
| | | TaskType = (int)TaskOutboundTypeEnum.OutNG, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam" |
| | | }; |
| | | return taskNG; |
| | | var taskNG = new Dt_Task |
| | | { |
| | | CurrentAddress = input.Position, |
| | | Grade = 3, |
| | | Roadway = input.Roadways, |
| | | TargetAddress = stationManager.stationNGLocation, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | NextAddress = stationManager.stationNGChildCode, |
| | | OrderNo = null, |
| | | PalletCode = input.PalletCode, |
| | | SourceAddress = stationManager.stationLocation, |
| | | TaskState = (int)TaskInStatusEnum.Line_InFinish, |
| | | TaskType = (int)TaskOutboundTypeEnum.InToOut, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam" |
| | | }; |
| | | return taskNG; |
| | | } |
| | | else |
| | | { |
| | | //无电芯 → 当空框? 还是返回异常? |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | // 处理异常电芯情况 |
| | | var serialNosError = result.SerialNos.Where(x => x.SerialNoStatus != 1 && x.SerialNoStatus != 4).ToList(); |
| | | if (serialNosError.Count > 0) |
| | | { |
| | | if (stationManager.stationType != 3) |
| | | { |
| | | var taskNG = new Dt_Task |
| | | { |
| | | CurrentAddress = input.Position, |
| | | Grade = 1, |
| | | Roadway = input.Roadways, |
| | | TargetAddress = stationManager.stationNGLocation, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | NextAddress = stationManager.stationNGChildCode, |
| | | OrderNo = null, |
| | | PalletCode = input.PalletCode, |
| | | SourceAddress = stationManager.stationLocation, |
| | | TaskState = (int)TaskInStatusEnum.Line_InFinish, |
| | | TaskType = (int)TaskOutboundTypeEnum.InToOut, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam" |
| | | }; |
| | | return taskNG; |
| | | } |
| | | else |
| | | { |
| | | Console.WriteLine($"站台{stationManager.stationChildCode}MOM返回电芯异常:{result.MOMMessage}"); |
| | | return null; |
| | | } |
| | | } |
| | | //else |
| | | //{ |
| | | // throw new Exception($"站台{stationManager.stationChildCode}MOM返回电芯异常:{result.MOMMessage}"); |
| | | //} |
| | | |
| | | var targetStation = _stationManagerRepository.QueryFirst(x => x.stationPLC == stationManager.stationPLC && x.Roadway == stationManager.Roadway && x.stationType == 2); |
| | | |
| | | var task = new Dt_Task |
| | | { |
| | | CurrentAddress = input.Position, |
| | | Grade = 3, |
| | | Roadway = input.Roadways, |
| | | TargetAddress = targetStation.stationLocation, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | NextAddress = input.Roadways, |
| | | OrderNo = null, |
| | | PalletCode = input.PalletCode, |
| | | SourceAddress = stationManager.stationLocation, |
| | | TaskState = (int)TaskInStatusEnum.Line_InFinish, |
| | | TaskType = (int)TaskOutboundTypeEnum.InToOut, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam" |
| | | }; |
| | | return task; |
| | | } |
| | | |
| | | var targetStation = _stationManagerRepository.QueryFirst(x => x.stationPLC == stationManager.stationPLC && x.Roadway == stationManager.Roadway && x.stationType == 2); |
| | | |
| | | var task = new Dt_Task |
| | | catch (Exception ex) |
| | | { |
| | | CurrentAddress = input.Position, |
| | | Grade = 1, |
| | | Roadway = input.Roadways, |
| | | TargetAddress = targetStation.stationLocation, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | NextAddress = input.Roadways, |
| | | OrderNo = null, |
| | | PalletCode = input.PalletCode, |
| | | SourceAddress = stationManager.stationLocation, |
| | | TaskState = (int)TaskInStatusEnum.Line_InFinish, |
| | | TaskType = (int)TaskOutboundTypeEnum.InToOut, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam" |
| | | }; |
| | | |
| | | return task; |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | |
| | | #endregion 直接出库任务 |
| | |
| | | |
| | | if (stationManager.stationType == 1) |
| | | { |
| | | #region |
| | | // 创建一个TrayCellsStatusDto对象,并赋值 |
| | | TrayCellsStatusDto trayCells = new TrayCellsStatusDto() |
| | | { |
| | |
| | | ////// 调用GetProcessResponseAsync方法,获取工艺响应 |
| | | ////var processResponse = await GetProcessResponseAsync(process, input.Position); |
| | | var isBox = await _boxingInfoRepository.AddDataNavAsync(boxing); |
| | | #endregion |
| | | } |
| | | |
| | | var task = new Dt_Task |
| | |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam" |
| | | }; |
| | | ConsoleHelper.WriteSuccessLine($"修改前:" + locationInfo.LocationStatus.ToString()); |
| | | int lastStatus = locationInfo.LocationStatus; |
| | | ConsoleHelper.WriteSuccessLine($"修改前:" + lastStatus.ToString()); |
| | | locationInfo.LocationStatus = (int)LocationEnum.FreeDisable; |
| | | ConsoleHelper.WriteSuccessLine($"修改后:" + locationInfo.LocationStatus.ToString()); |
| | | await UpdateLocationAsync(locationInfo); |
| | | |
| | | _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(locationInfo, lastStatus, (int)StatusChangeTypeEnum.AutomaticStorage, task.TaskNum); |
| | | |
| | | return task; |
| | | } |
| | |
| | | var task = new Dt_Task |
| | | { |
| | | CurrentAddress = input.Position, |
| | | Grade = 1, |
| | | Grade = 2, |
| | | Roadway = input.Roadways, |
| | | TargetAddress = stationManager.stationLocation, |
| | | Dispatchertime = DateTime.Now, |
| | |
| | | { |
| | | //添加历史 |
| | | var taskHty = CreateHistoricalTask(task); |
| | | |
| | | // 添加历史任务 |
| | | var isTaskHtyAdd = await _task_HtyRepository.AddDataAsync(taskHty) > 0; |
| | | //删除任务 |
| | | BaseDal.DeleteData(task); |
| | | |
| | |
| | | var Epmtytask = new Dt_Task |
| | | { |
| | | CurrentAddress = input.Position, |
| | | Grade = 3, //优先处理异常排出口的任务 防止正常需排出异常口的任务堵线 |
| | | Grade = 4, //优先处理异常排出口的任务 防止正常需排出异常口的任务堵线 |
| | | Roadway = input.Roadways, |
| | | TargetAddress = EmptylocationInfo.LocationCode, |
| | | Dispatchertime = DateTime.Now, |
| | |
| | | |
| | | var isBox = await _boxingInfoRepository.AddDataNavAsync(boxing); |
| | | |
| | | ConsoleHelper.WriteSuccessLine($"修改前:" + locationInfo.LocationStatus.ToString()); |
| | | int lastStatus = locationInfo.LocationStatus; |
| | | |
| | | ConsoleHelper.WriteSuccessLine($"修改前:" + lastStatus.ToString()); |
| | | locationInfo.LocationStatus = (int)LocationEnum.FreeDisable; |
| | | ConsoleHelper.WriteSuccessLine($"修改后:" + locationInfo.LocationStatus.ToString()); |
| | | await UpdateLocationAsync(locationInfo); |
| | | |
| | | _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(locationInfo, lastStatus, (int)StatusChangeTypeEnum.AutomaticStorage, task.TaskNum); |
| | | |
| | | return task; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | var content = JsonConvert.DeserializeObject<WebResponseContent>(result); |
| | | if (content.Status) |
| | | { |
| | | int lastStatus = item.LocationInfo.LocationStatus; |
| | | await BaseDal.AddDataAsync(task); |
| | | // 更新库存位置状态为不可用 |
| | | item.LocationInfo.LocationStatus = (int)LocationEnum.InStockDisable; |
| | | await _locationRepository.UpdateDataAsync(item.LocationInfo); |
| | | |
| | | _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(item.LocationInfo, lastStatus, (int)StatusChangeTypeEnum.AutomaticDelivery, task.TaskNum); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | var location = locations.OrderBy(x => x.Layer).ThenBy(x => x.Column).ThenBy(x => x.Row).FirstOrDefault(); |
| | | |
| | | var stockInfo = await QueryStockInfoForEmptyTrayAsync("CWSC1"); |
| | | var stockInfo = await QueryStockInfoForEmptyTrayAsync("CWSC1","10086"); |
| | | |
| | | if (stockInfo != null) |
| | | { |
| | |
| | | WMSTaskDTO wmsTask = CreateTaskDTO(task); |
| | | |
| | | // 更新库存位置状态为不可用 |
| | | int lastStatus = location.LocationStatus; |
| | | stockInfo.LocationInfo.LocationStatus = (int)LocationEnum.InStockDisable; |
| | | location.LocationStatus = (int)LocationEnum.Distribute; |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | |
| | | await _locationRepository.UpdateDataAsync(stockInfo.LocationInfo); |
| | | await _locationRepository.UpdateDataAsync(location); |
| | | }); |
| | | |
| | | _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(location, lastStatus, (int)StatusChangeTypeEnum.AutomaticDelivery, task.TaskNum); |
| | | |
| | | // 返回成功响应 |
| | | return content.OK(data: wmsTask); |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_StationManager station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == json.Position); |
| | | Dt_StationManager station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == json.Position && x.stationType == 12 && x.stationArea == "Call"); |
| | | |
| | | DtStockInfo stockInfo = _stockInfoRepository.QueryFirst(X => X.IsFull && X.AreaCode == "CWSC3" && X.ProductionLine == station.productLine); |
| | | var stockInfo = _stockInfoRepository.Db.Queryable<DtStockInfo>() |
| | | .Includes(x => x.LocationInfo) // 预加载LocationInfo |
| | | .Where(x => x.AreaCode == "CWSC3" && x.IsFull == true) // 过滤条件 |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock) // 过滤条件 |
| | | .OrderBy(x => x.OutboundTime) // 排序 |
| | | .First(); // 获取第一个元素 |
| | | |
| | | //DtStockInfo stockInfo = _stockInfoRepository.QueryFirst(X => X.IsFull && X.AreaCode == "CWSC3" && X.ProductionLine == station.productLine); |
| | | if (stockInfo == null) throw new Exception("库内无满足条件的库存可出库"); |
| | | |
| | | Dt_StationManager OutStation = _stationManagerRepository.QueryFirst(x => x.stationPLC == "1016" && x.stationType == 10); |
| | | DtLocationInfo locationInfo = _locationRepository.QueryFirst(x => x.AreaId == 5 && x.LocationCode == stockInfo.LocationCode); |
| | | |
| | | Dt_StationManager OutStation = _stationManagerRepository.QueryFirst(x => x.stationPLC == "1016" && x.stationType == 10 && x.Roadway == locationInfo.RoadwayNo && x.stationStatus == "1"); |
| | | |
| | | // 创建新任务实例 |
| | | var task = new Dt_Task |
| | | { |
| | | CurrentAddress = stockInfo.LocationInfo.RoadwayNo, |
| | | CurrentAddress = stockInfo.LocationCode, |
| | | Grade = 1, |
| | | Roadway = stockInfo.LocationInfo.RoadwayNo, |
| | | Roadway = locationInfo.RoadwayNo, |
| | | TargetAddress = json.Position, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | |
| | | |
| | | WMSTaskDTO taskDTO = CreateTaskDTO(task); |
| | | |
| | | int lastStatus = locationInfo.LocationStatus; |
| | | |
| | | BaseDal.AddData(task); |
| | | stockInfo.LocationInfo.LocationStatus = (int)LocationEnum.InStockDisable; |
| | | _locationRepository.UpdateData(stockInfo.LocationInfo); |
| | | |
| | | _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(stockInfo.LocationInfo, lastStatus, (int)StatusChangeTypeEnum.AutomaticDelivery, task.TaskNum); |
| | | |
| | | return content.OK(data: taskDTO); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.WriteLine($"CW3至包装出库异常:{ex.ToString()}"); |
| | | return content.Error($"失败:{ex.Message}"); |
| | | } |
| | | } |
| | |
| | | |
| | | if (emergencyTask == null) throw new Exception("火警参数为空"); |
| | | |
| | | DtLocationInfo locationInfo = _locationRepository.QueryFirst(x => x.Row == emergencyTask.row && x.Column == emergencyTask.column && x.Layer == emergencyTask.layer && x.RoadwayNo == emergencyTask.Roadway); |
| | | DtLocationInfo locationInfo = _locationRepository.QueryFirst(x => x.Row == emergencyTask.row && x.Column == emergencyTask.column && x.Layer == emergencyTask.layer && x.AreaId == emergencyTask.zone); |
| | | if (locationInfo == null) |
| | | { |
| | | throw new Exception("未知库位"); |