| | |
| | | using System.ServiceModel; |
| | | using System.IO; |
| | | using NewPdaSqlServer.Dto.Warehouse; |
| | | using NewPdaSqlServer.DB; |
| | | using Newtonsoft.Json; |
| | | |
| | | namespace NewPdaSqlServer.Controllers.AGV; |
| | | |
| | |
| | | [HttpPost("DefineTask_001")] |
| | | public ResponseResult DefineTask_001(DefineTask001Dto dto) |
| | | { |
| | | string _requestJson = string.Empty; |
| | | dynamic _responseData = new System.Dynamic.ExpandoObject(); |
| | | string _executeTimestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | int sendStatus = 0; |
| | | string _logMessage = "【AGV】立库送检"; |
| | | |
| | | try |
| | | { |
| | | var binding = new BasicHttpBinding |
| | |
| | | }; |
| | | |
| | | var endpoint = new EndpointAddress("http://192.168.35.251:8000/MesGet"); |
| | | //var endpoint = new EndpointAddress("http://192.168.32.17:8000/MesGet"); |
| | | var factory = new ChannelFactory<IImesInterface>(binding, endpoint); |
| | | |
| | | var channel = factory.CreateChannel(); |
| | |
| | | |
| | | ((IClientChannel)channel).Close(); |
| | | |
| | | // 记录请求报文 |
| | | _requestJson = JsonConvert.SerializeObject(dto); |
| | | |
| | | _responseData = result; |
| | | sendStatus = 1; |
| | | |
| | | var logService = new LogService(); |
| | | logService.CreateLogI( |
| | | db: null, |
| | | edtUserGuid: Guid.Parse("11111111-1111-1111-1111-111111111111"), |
| | | abtGuid: null, |
| | | abtTable: "AGV_TASK", |
| | | detail: _logMessage, |
| | | orderNo: dto.MesId, |
| | | sendJson: _requestJson, |
| | | rtnJson: JsonConvert.SerializeObject(_responseData), |
| | | xkyBeginTime: null, |
| | | xkyEndTime: null, |
| | | sendStatus: sendStatus, |
| | | executeTime: _executeTimestamp |
| | | ); |
| | | |
| | | return new ResponseResult |
| | | { |
| | | status = 0, |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | var logService = new LogService(); |
| | | logService.CreateLogI( |
| | | db: null, |
| | | edtUserGuid: Guid.Parse("11111111-1111-1111-1111-111111111111"), |
| | | abtGuid: null, |
| | | abtTable: "AGV_TASK", |
| | | detail: _logMessage + $"系统异常:{ex.Message}", |
| | | orderNo: dto.MesId, |
| | | sendJson: _requestJson, |
| | | rtnJson: JsonConvert.SerializeObject(_responseData), |
| | | xkyBeginTime: null, |
| | | xkyEndTime: null, |
| | | sendStatus: 0, |
| | | executeTime: _executeTimestamp |
| | | ); |
| | | return ResponseResult.ResponseError(ex); |
| | | } |
| | | } |
| | |
| | | [HttpPost("DefineTask_002")] |
| | | public ResponseResult DefineTask_002(DefineTask002Dto dto) |
| | | { |
| | | string _requestJson = string.Empty; |
| | | dynamic _responseData = new System.Dynamic.ExpandoObject(); |
| | | string _executeTimestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | int sendStatus = 0; |
| | | string _logMessage = "【AGV】立库检验"; |
| | | |
| | | try |
| | | { |
| | | var binding = new BasicHttpBinding |
| | |
| | | }; |
| | | |
| | | var endpoint = new EndpointAddress("http://192.168.35.251:8000/MesGet"); |
| | | //var endpoint = new EndpointAddress("http://192.168.32.17:8000/MesGet"); |
| | | var factory = new ChannelFactory<IImesInterface>(binding, endpoint); |
| | | |
| | | var channel = factory.CreateChannel(); |
| | |
| | | |
| | | ((IClientChannel)channel).Close(); |
| | | |
| | | // 记录请求报文 |
| | | _requestJson = JsonConvert.SerializeObject(dto); |
| | | |
| | | _responseData = result; |
| | | sendStatus = 1; |
| | | |
| | | var logService = new LogService(); |
| | | logService.CreateLogI( |
| | | db: null, |
| | | edtUserGuid: Guid.Parse("11111111-1111-1111-1111-111111111111"), |
| | | abtGuid: null, |
| | | abtTable: "AGV_TASK", |
| | | detail: _logMessage, |
| | | orderNo: dto.MesId, |
| | | sendJson: _requestJson, |
| | | rtnJson: JsonConvert.SerializeObject(_responseData), |
| | | xkyBeginTime: null, |
| | | xkyEndTime: null, |
| | | sendStatus: sendStatus, |
| | | executeTime: _executeTimestamp |
| | | ); |
| | | |
| | | return new ResponseResult |
| | | { |
| | | status = 0, |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | var logService = new LogService(); |
| | | logService.CreateLogI( |
| | | db: null, |
| | | edtUserGuid: Guid.Parse("11111111-1111-1111-1111-111111111111"), |
| | | abtGuid: null, |
| | | abtTable: "AGV_TASK", |
| | | detail: _logMessage + $"系统异常:{ex.Message}", |
| | | orderNo: dto.MesId, |
| | | sendJson: _requestJson, |
| | | rtnJson: JsonConvert.SerializeObject(_responseData), |
| | | xkyBeginTime: null, |
| | | xkyEndTime: null, |
| | | sendStatus: 0, |
| | | executeTime: _executeTimestamp |
| | | ); |
| | | |
| | | return ResponseResult.ResponseError(ex); |
| | | } |
| | | } |
| | |
| | | [HttpPost("DefineTask_005")] |
| | | public ResponseResult DefineTask_005(DefineTask005Dto dto) |
| | | { |
| | | string _requestJson = string.Empty; |
| | | dynamic _responseData = new System.Dynamic.ExpandoObject(); |
| | | string _executeTimestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | int sendStatus = 0; |
| | | string _logMessage = "【AGV】立库呼叫"; |
| | | try |
| | | { |
| | | var binding = new BasicHttpBinding |
| | |
| | | }; |
| | | |
| | | var endpoint = new EndpointAddress("http://192.168.35.251:8000/MesGet"); |
| | | //var endpoint = new EndpointAddress("http://192.168.32.17:8000/MesGet"); |
| | | var factory = new ChannelFactory<IImesInterface>(binding, endpoint); |
| | | |
| | | var channel = factory.CreateChannel(); |
| | |
| | | string result = channel.DefineTask_005( |
| | | dto.Postition); |
| | | ((IClientChannel)channel).Close(); |
| | | |
| | | // 记录请求报文 |
| | | _requestJson = JsonConvert.SerializeObject(dto); |
| | | |
| | | _responseData = result; |
| | | sendStatus = 1; |
| | | |
| | | var logService = new LogService(); |
| | | logService.CreateLogI( |
| | | db: null, |
| | | edtUserGuid: Guid.Parse("11111111-1111-1111-1111-111111111111"), |
| | | abtGuid: null, |
| | | abtTable: "AGV_TASK", |
| | | detail: _logMessage, |
| | | orderNo: "", |
| | | sendJson: _requestJson, |
| | | rtnJson: JsonConvert.SerializeObject(_responseData), |
| | | xkyBeginTime: null, |
| | | xkyEndTime: null, |
| | | sendStatus: sendStatus, |
| | | executeTime: _executeTimestamp |
| | | ); |
| | | |
| | | |
| | | return new ResponseResult |
| | | { |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | var logService = new LogService(); |
| | | logService.CreateLogI( |
| | | db: null, |
| | | edtUserGuid: Guid.Parse("11111111-1111-1111-1111-111111111111"), |
| | | abtGuid: null, |
| | | abtTable: "AGV_TASK", |
| | | detail: _logMessage + $"系统异常:{ex.Message}", |
| | | orderNo: "", |
| | | sendJson: _requestJson, |
| | | rtnJson: JsonConvert.SerializeObject(_responseData), |
| | | xkyBeginTime: null, |
| | | xkyEndTime: null, |
| | | sendStatus: 0, |
| | | executeTime: _executeTimestamp |
| | | ); |
| | | |
| | | return ResponseResult.ResponseError(ex); |
| | | } |
| | | } |
| | |
| | | [HttpPost("DefineTask_006")] |
| | | public ResponseResult DefineTask_006(DefineTask006Dto dto) |
| | | { |
| | | string _requestJson = string.Empty; |
| | | dynamic _responseData = new System.Dynamic.ExpandoObject(); |
| | | string _executeTimestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | int sendStatus = 0; |
| | | string _logMessage = "【AGV】立库入库"; |
| | | |
| | | try |
| | | { |
| | | var binding = new BasicHttpBinding |
| | |
| | | }; |
| | | |
| | | var endpoint = new EndpointAddress("http://192.168.35.251:8000/MesGet"); |
| | | //var endpoint = new EndpointAddress("http://192.168.32.17:8000/MesGet"); |
| | | var factory = new ChannelFactory<IImesInterface>(binding, endpoint); |
| | | |
| | | var channel = factory.CreateChannel(); |
| | |
| | | dto.Postition); |
| | | ((IClientChannel)channel).Close(); |
| | | |
| | | // 记录请求报文 |
| | | _requestJson = JsonConvert.SerializeObject(dto); |
| | | |
| | | _responseData = result; |
| | | sendStatus = 1; |
| | | |
| | | var logService = new LogService(); |
| | | logService.CreateLogI( |
| | | db: null, |
| | | edtUserGuid: Guid.Parse("11111111-1111-1111-1111-111111111111"), |
| | | abtGuid: null, |
| | | abtTable: "AGV_TASK", |
| | | detail: _logMessage, |
| | | orderNo: dto.MesId, |
| | | sendJson: _requestJson, |
| | | rtnJson: JsonConvert.SerializeObject(_responseData), |
| | | xkyBeginTime: null, |
| | | xkyEndTime: null, |
| | | sendStatus: sendStatus, |
| | | executeTime: _executeTimestamp |
| | | ); |
| | | |
| | | |
| | | return new ResponseResult |
| | | { |
| | | status = 0, |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | var logService = new LogService(); |
| | | logService.CreateLogI( |
| | | db: null, |
| | | edtUserGuid: Guid.Parse("11111111-1111-1111-1111-111111111111"), |
| | | abtGuid: null, |
| | | abtTable: "AGV_TASK", |
| | | detail: _logMessage + $"系统异常:{ex.Message}", |
| | | orderNo: dto.MesId, |
| | | sendJson: _requestJson, |
| | | rtnJson: JsonConvert.SerializeObject(_responseData), |
| | | xkyBeginTime: null, |
| | | xkyEndTime: null, |
| | | sendStatus: 0, |
| | | executeTime: _executeTimestamp |
| | | ); |
| | | return ResponseResult.ResponseError(ex); |
| | | } |
| | | } |