| | |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_DTO.MOM; |
| | | using WIDESEAWCS_DTO.TaskInfo; |
| | | using WIDESEAWCS_DTO.WMS; |
| | | using WIDESEAWCS_Model.Models; |
| | |
| | | { |
| | | if (command.ConveyorLineBarcode != "NoRead") |
| | | { |
| | | var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); |
| | | var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.MOMIP_BASE)?.ConfigValue; |
| | | var ipAddress = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.TrayCellsStatus)?.ConfigValue; |
| | | if (wmsBase == null || ipAddress == null) |
| | | { |
| | | throw new InvalidOperationException("MOM IP 未配置"); |
| | | } |
| | | var stationManager=_stationManagerRepository.QueryFirst(x=>x.stationChildCode == childDeviceCode); |
| | | TrayCellsStatusDto trayCells = new TrayCellsStatusDto() |
| | | { |
| | | Software = "WMS", |
| | | TrayBarcode = command.ConveyorLineBarcode, |
| | | EquipmentCode = stationManager.stationEquipMOM, |
| | | SessionId = Guid.NewGuid().ToString(), |
| | | EmployeeNo = "MITest", |
| | | SceneType = "4", |
| | | RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ") |
| | | }; |
| | | |
| | | var MOMIpAddress = wmsBase + ipAddress; |
| | | |
| | | var result = HttpHelper.PostAsync(MOMIpAddress, trayCells.ToJsonString()).Result; |
| | | WriteInfo("入站校验", $"【{stationManager.stationChildCode}】入站校验请求参数【{trayCells.ToJsonString()}】"); |
| | | WriteInfo("入站校验", ""); |
| | | WriteInfo("入站校验", $"【{stationManager.stationChildCode}】入站校验返回参数【{result}】"); |
| | | ResultTrayCellsStatus result1 = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(result); |
| | | |
| | | if (result1.Success) |
| | | { |
| | | var serialNosError = result1.SerialNos.Where(x => x.SerialNoStatus != 1 && x.SerialNoStatus != 4).ToList(); |
| | | if (serialNosError.Count > 0) |
| | | { |
| | | if (result1.ProcessCode == "AG01") |
| | | { |
| | | var strings = new List<string>() { "2234", "2226", "2218" }; |
| | | foreach (var item in strings) |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.productLine == result1.ProductionLine && x.stationChildCode == item); |
| | | if(station != null) |
| | | { |
| | | //发送到分容 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var taskDTO = CreateEmptyTrayTaskDto(command.ConveyorLineBarcode, childDeviceCode); |
| | | |
| | | if (_taskRepository.QueryFirst(x => x.PalletCode == taskDTO.PalletCode) != null) |
| | |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | ConsoleHelper.WriteErrorLine(result1.MOMMessage); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //var taskDTO = CreateEmptyTrayTaskDto(command.ConveyorLineBarcode, childDeviceCode); |
| | | |
| | | //if (_taskRepository.QueryFirst(x => x.PalletCode == taskDTO.PalletCode) != null) |
| | | //{ |
| | | // WriteInfo(conveyorLine.DeviceName, "当前托盘存在任务"); |
| | | // return; |
| | | //} |
| | | |
| | | //var content = CreateAndSendTask(taskDTO); |
| | | //if (content.Status) |
| | | //{ |
| | | // var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode); |
| | | // if (task != null) |
| | | // { |
| | | // var taskCommand = MapTaskCommand(task, command); |
| | | // conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | // _taskService.UpdateTaskStatusToNext(task); |
| | | // } |
| | | //} |
| | | //} |
| | | } |
| | | } |