| | |
| | | using Microsoft.CodeAnalysis.Options; |
| | | using System.IO; |
| | | using System.Runtime.Loader; |
| | | using MailKit.Search; |
| | | using Tiger.Model.DigitalTwin; |
| | | |
| | | namespace Tiger.Api.Controllers.Test |
| | | { |
| | |
| | | [HttpGet] |
| | | public async Task<IActionResult> D1Async(string param) |
| | | { |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=01"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 01 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=02"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 02 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=03"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 03 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=04"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 04 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=05"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 05 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=06"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 06 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=07"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 07 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=08"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 08 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=09"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 09 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=10"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 10 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=11"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 11 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=12"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 12 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=13"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 13 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=14"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 14 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=15"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 15 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=16"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 16 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=17"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 17 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=18"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 18 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=19"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 19 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=20"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 20 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=21"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 21 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=22"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 22 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=23"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 23 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=24"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 24 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=25"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 25 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=26"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 26 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=27"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 27 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=28"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 28 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=29"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 29 Finished", ConsoleColor.Blue); }); |
| | | Work.DoAsync(() => { HttpHelper.GetAsync("http://172.16.80.40:9529/api/_Test/DoSomething?duration=10&code=30"); ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - 30 Finished", ConsoleColor.Blue); }); |
| | | ConsoleExt.WriteLine($"{DateTime.Now:HH:mm:ss.fff} - Send Finished", ConsoleColor.Blue); |
| | | //Logger.Scheduler.Info("这是一次成功的测试"); |
| | | //var data = iBiz.Biz.Db.Queryable<BAS_CODE_RULE>() |
| | | // .IncludesAllFirstLayer() |
| | |
| | | [HttpGet] |
| | | public async Task<IActionResult> DoSomething(int duration, string code) |
| | | { |
| | | Barcode b = new("asdasd"); |
| | | var begin = DateTime.Now; |
| | | while ((DateTime.Now - begin).TotalSeconds <= duration) |
| | | { |
| | | Thread.Sleep(1000); |
| | | var total = (DateTime.Now - begin).TotalSeconds; |
| | | var percent = total / duration; |
| | | ConsoleExt.WriteLine($"Working {begin:mmssfff} ... {(percent > 1 ? 1 : percent):P0} ...", ConsoleColor.Green); |
| | | } |
| | | Logger.Default.Info($"{begin:mmssfff} completed"); |
| | | return Ok($"{begin:mmssfff} completed {b.DateCode}"); |
| | | Work.Do(() => { |
| | | while ((DateTime.Now - begin).TotalSeconds <= duration) |
| | | { |
| | | //Thread.Sleep(1000); |
| | | var total = (DateTime.Now - begin).TotalSeconds; |
| | | var percent = total / duration; |
| | | //ConsoleExt.WriteLine($"Working {begin:mmssfff} ... {(percent > 1 ? 1 : percent):P0} ...", ConsoleColor.Green); |
| | | } |
| | | Logger.Default.Info($"{begin:mmssfff} completed"); |
| | | }); |
| | | return Ok($"{code.IsNullOrEmpty("", code + ": ")}{begin:mmssfff} completed"); |
| | | } |
| | | |
| | | [HttpPost] |
| | |
| | | return Ok(result?.ToJson()); |
| | | } |
| | | |
| | | [HttpPost] |
| | | public async Task<IActionResult> InterfaceAsync([FromBody] ApiAction action) |
| | | { |
| | | var data = action.Data; |
| | | |
| | | //var json = new { |
| | | // SN = "V025720241120000161", |
| | | // ItemCode = "160305330", |
| | | // Qty = 1700, |
| | | // Unit = "PCS", |
| | | // Supplier = "V0381", |
| | | // DeliveryDate = DateTime.Now, |
| | | // ProdDate = DateTime.Now, |
| | | // BatchNo = "20241120", |
| | | // ValidityDays = 365, |
| | | // SerialNo = 161, |
| | | // ItemName = "L-CW1323GA 两个装彩盒 隔板 材质300g单粉裱YF加强过哑膜 105 mm 85 mm 3 mm 南泰 ", |
| | | // Warehouse = "W0001", |
| | | // ItemModel = "材料 零件 商品", |
| | | //}; |
| | | //var result = action.GetResponse("GetSnInfo success.", json, true); |
| | | |
| | | //var json = new List<object> |
| | | //{ |
| | | // new { |
| | | // OrderNo = "RE202404308721", |
| | | // Warehouse = "", |
| | | // Details = new List<object> |
| | | // { |
| | | // new { ItemCode = "442500010", ItemName = "长椭圆形卡针 35 x7.3 x0.9mm SUS304H 斯络泰", Qty = 1000 }, |
| | | // new { ItemCode = "442500011", ItemName = "短椭圆形卡针 35 x7.3 x0.9mm SUS304H 斯络泰", Qty = 500 } |
| | | // }, |
| | | // SnDetails = new List<object> |
| | | // { |
| | | // new { SN = "V029720240427000069", ItemCode = "442500010", Qty = 500, Carton = "CV029720240427000001", Pallet = "PV029720240427000001" }, |
| | | // new { SN = "V029720240427000070", ItemCode = "442500010", Qty = 500, Carton = "CV029720240427000001", Pallet = "PV029720240427000001" }, |
| | | // new { SN = "V029720240427000071", ItemCode = "442500011", Qty = 500, Carton = "CV029720240427000002", Pallet = "PV029720240427000001" }, |
| | | // }, |
| | | // } |
| | | //}; |
| | | //var result = action.GetResponse("GetInOrder success.", json, true); |
| | | |
| | | //var json = new List<object> |
| | | //{ |
| | | // new { |
| | | // OrderNo = "XC5406-231014306", |
| | | // Warehouse = "XC003", |
| | | // Details = new List<object> |
| | | // { |
| | | // new { ItemCode = "250100420", ItemName = "IC SMD DC-DC 0.6V 单路 1A 1.5MHZ SOT563 TLV62568DRL TI", Qty = 1000 }, |
| | | // new { ItemCode = "200203670", ItemName = "CAP SMD X5R 0402 6.3V 4.7uF±20%", Qty = 1500 } |
| | | // }, |
| | | // } |
| | | //}; |
| | | //var result = action.GetResponse("GetOutOrder success.", json, true); |
| | | |
| | | var result = action.GetResponse("OutTask success.", true); |
| | | |
| | | return Ok(new { result.Timestamp, result.IsSuccessed, result.Message, result.Data }); |
| | | } |
| | | |
| | | [HttpGet] |
| | | public async Task<IActionResult> RefreashPlugin(string path) |
| | | { |