using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; using System.Messaging; using System.Net; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Xml; using System.Xml.Linq; using BLWWS_BLL; using ConsoleApp1; using Newtonsoft.Json; using RestSharp; namespace ConsoleApp1 { public class portinfo { /// /// 名称 /// public string LodgerNmae { get; set; } /// /// 身份证 /// public string IDNumber { get; set; } /// /// 性别 0女 1男 /// public Nullable Sex { get; set; } /// /// 创建时间 /// public Nullable CheckInDate { get; set; } /// /// 消息来源 /// public int Sourcedian { get; set; } /// /// 图片 /// public string picture { get; set; } /// /// 备注 /// public string remark { get; set; } /// /// 图片时间 /// public Nullable pictureDate { get; set; } /// /// 酒店code /// public string HotelCode { get; set; } /// /// 房间号 /// public string roomid { get; set; } /// /// 电话号码 /// public string phonenumber { get; set; } /// /// 开房时间 /// public DateTime CheckTime { get; set; } /// /// 退房时间 /// public DateTime checkOutTime { get; set; } /// /// 密钥 /// public string key { get; set; } public int pmsinfoid { get; set; } } } public class XMSData { public string hotelid { get; set; } /// /// 订单账号(酒店唯一) /// public string accnt { get; set; } public string groupid { get; set; } public string name { get; set; } public Dictionary original { get; set; } public extrasData extras { get; set; } } public class originalData { //public string name { get; set; } //public string mobile { get; set; } //public string roomno { get; set; } //public string type { get; set; } //public string rtc { get; set; } //public string rmnum { get; set; } //public string sta { get; set; } } // "arr":"1750586400000", // "rtc":"CPC", // "sta":"R", // "rmnum":"1", // "roomno":"", // "mobile":"1212345678", // "name":"李二", // "type":"CPC", // "dep":"1750651200000" public class extrasData { public string name { get; set; } public string mobile { get; set; } /// /// 房间号 /// public string roomno { get; set; } public string type { get; set; } public string rtc { get; set; } public string rmnum { get; set; } /// /// 订单状态 ///Q:问询 ///X:取消预订 ///N:noshow ///R:预订 ///I:在住 ///O:本日结账 ///S:挂账退房 ///D:昨日结账 ///H:历史订单 /// public string sta { get; set; } public string arr { get; set; } public string dep { get; set; } } internal class Program { public static long GetCurrentTimeStamp(DateTime dt) { TimeSpan ts = dt - new DateTime(1970, 1, 1, 8, 0, 0, DateTimeKind.Local); long current_timestamp = Convert.ToInt64(ts.TotalSeconds); return current_timestamp; } public class PMSDataBase { public string hotel_code { get; set; } = ""; public string time { get; set; } = ""; public string sign { get; set; } = ""; public string hotel_id { get; set; } = ""; public string order_no { get; set; } = ""; public string room_no { get; set; } = ""; public string check_out_original { get; set; } } static void Main(string[] args) { var DQQQ = File.ReadAllText("1.txt"); // XDocument doc32 = XDocument.Parse(DQQQ); XElement Root1 = doc32.Root; string orderno = Root1.Attribute("orderno")?.Value; string cost = Root1.Attribute("cost")?.Value; //是否有早餐 string breakfast = Root1.Attribute("breakfast")?.Value; //押金 string deposit = Root1.Attribute("deposit")?.Value; var LESuuu = Root1.Elements("item"); var NNNjkl = JsonConvert.DeserializeObject>>(DQQQ); PMSDataBase data = new PMSDataBase() { hotel_code = "2079", time = "1751426235", sign = "a68b2596ce7c1ca970e82a00626c16e3", hotel_id = "1101", order_no = "", room_no = "1102", check_out_original = "" }; string BaseURL = "https://f.blv-oa.com:8099/rcu_pms_api/v1"; var client123 = new RestClient(BaseURL); var request123 = new RestRequest("/order/checkOut", Method.POST); request123.AddJsonBody(data); var Response = client123.Execute(request123).Content; string content12345 = Response; long lllhhh = GetCurrentTimeStamp(DateTime.Now); decimal DDD = Convert.ToDecimal(32432423.34343); decimal lll = DDD / 1024; decimal a = Math.Round(lll, 2); Console.WriteLine("aaaaaaaaaaaa"); string content = ""; string PPP = File.ReadAllText("3.txt"); byte[] photo = Tools.HEXString2ByteArray(PPP); //分辨率 判断 using (var ms = new MemoryStream(photo)) { ms.Write(photo, 0, photo.Length); using (System.Drawing.Image image = System.Drawing.Image.FromStream(ms, false, false)) // 不加载图像数据 { bool bf = image.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Jpeg); Console.WriteLine(image.Height); Console.WriteLine(image.Width); } } try { string sss111 = File.ReadAllText("3.txt"); var OOO = JsonConvert.DeserializeObject(sss111); string Url111 = "http://pms.boonlive-rcu.com:8989"; var client1 = new RestClient(Url111); //var request1 = new RestRequest("api/XMSOrderPush?xrsecret=Ip202rSR132zJGKH", Method.POST); var request1 = new RestRequest("api/XMSOrderPush", Method.POST); request1.AddQueryParameter("xrsecret", "Ip202rSR132zJGKH"); request1.AddJsonBody(OOO); var response = client1.Execute(request1); var content111 = response.Content; ////string url = "http://face.blv-oa.com/Interface/checkinInterface?key=abc&data={"LodgerNmae":"王悦","IDNumber":"1133397752487743488","Sex":0,"picture":"http://pms.boonlive-rcu.com:89/pic/1133397752487743488_1384391.jpg","HotelCode":"2079","roomid":"1906","phonenumber":"19847388255","CheckTime":"2025-06-20 11:19:04","pmsinfoid":1905524}"; //string url = File.ReadAllText("2.txt"); //var NNN1= JsonConvert.DeserializeObject(url); //return; //var client1 = new RestClient(url); //var request1 = new RestRequest(Method.POST); //request1.AddJsonBody(null); //var Response = client1.Execute(request1).Content; //content = Response; //string result = string.Empty; //HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); //req.ContentType = "application/json"; //req.Method = "POST"; ////req.Timeout = 10000;//设置请求超时时间,单位为毫秒 //byte[] data = Encoding.UTF8.GetBytes(""); //req.ContentLength = data.Length; //using (Stream reqStream = req.GetRequestStream()) //{ // reqStream.Write(data, 0, data.Length); //} //HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); //using (Stream stream = resp.GetResponseStream()) //{ // using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) // { // result = reader.ReadToEnd();//获取响应内容 // } //} } catch (Exception ex) { } Console.ReadKey(); string xmlString = File.ReadAllText("1.txt"); XDocument doc1 = XDocument.Parse(xmlString); XElement Root = doc1.Root; string NNN = Root.Attribute("orderno")?.Value; var LES = Root.Elements("item"); foreach (var item in LES) { string customer = item.Attribute("customer").Value; string sex = item.Attribute("sex").Value; } //ServiceReference1.blwwsSoapClient c = new ServiceReference1.blwwsSoapClient(); //c.Test(); //string token = GetToken_G(); //Console.WriteLine(token); //ConcurrentDictionary GlobalData = new ConcurrentDictionary(); //GlobalData.AddOrUpdate("A", token, (k, v) => { return token; }); //GlobalData.AddOrUpdate("A", token, (k, v) => { return token; }); //GlobalData.AddOrUpdate("A", token, (k, v) => { return token; }); //GlobalData.AddOrUpdate("A", token, (k, v) => { return token; }); Console.ReadKey(); } static public string UserCode = "KKJK"; static public string UserKey = "KKJK0428"; static public string BaseUrl = "https://armitage-ipms.shijicloud.com"; public static string GetToken_G() { Dictionary Params = new Dictionary(); Params.Add("userCode", UserCode); Params.Add("key", UserKey); var tokenstr = Send_Http_Request_Params("/iPMSAPI/iPMSApiService/api/applySecurityToken", Params); Console.WriteLine(tokenstr); if (!string.IsNullOrEmpty(tokenstr)) { var dic = JsonConvert.DeserializeObject>(tokenstr); string token = dic["securityToken"]; return token; } return ""; } public static string Send_Http_Request_Params(string Url, Dictionary Params) { var client1 = new RestClient(BaseUrl); var request1 = new RestRequest(Url, Method.POST); foreach (KeyValuePair item in Params) { request1.AddParameter(item.Key, item.Value); } var response = client1.Execute(request1); var content = response.Content; return content; } public static string queueName2 = @".\private$\faceServerToWeb"; public static MessageQueue mq2 = null; /// /// 从消息队列中读取命令,并执行 /// public static void ReceiveCmdLoop() { while (true) { try { //判断队列是否存在 if (MessageQueue.Exists(queueName2)) { mq2 = new MessageQueue(queueName2); } else { //创建队列 mq2 = MessageQueue.Create(queueName2); } //给管理员队列权力 mq2.SetPermissions("Administrator", MessageQueueAccessRights.FullControl); //匿名登录 mq2.SetPermissions("ANONYMOUS LOGON", MessageQueueAccessRights.FullControl); mq2.SetPermissions("Everyone", MessageQueueAccessRights.FullControl); while (true) { Message msgRx = mq2.Receive(); msgRx.Formatter = new XmlMessageFormatter(new Type[] { typeof(string) }); string strRx = msgRx.Body.ToString(); Thread.Sleep(1300); //阻塞当前线程1秒,让其他线程运行 } } catch (Exception ex) { Thread.Sleep(5000); //阻塞当前线程5秒,再重新启动 continue; } } } /// /// 向消息队列中发送消息 /// /// 消息 /// public static string QueueSend(string sendMsg) { try { if (mq2 == null) { if (MessageQueue.Exists(queueName2)) { mq2 = new MessageQueue(queueName2); } else { mq2 = MessageQueue.Create(queueName2); } mq2.SetPermissions("Administrator", MessageQueueAccessRights.FullControl); mq2.SetPermissions("ANONYMOUS LOGON", MessageQueueAccessRights.FullControl); mq2.SetPermissions("Everyone", MessageQueueAccessRights.FullControl); } Message msgTx = new Message { Body = "", Formatter = new XmlMessageFormatter(new Type[] { typeof(string) }) }; mq2.Send(msgTx); return "Succeed push msg to MQ !"; } catch (Exception ex) { mq2 = null; return ex.ToString(); } } }