From 35fac8d74d298c51f9c22596ebcc51e2943b3f28 Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期二, 31 十二月 2024 15:07:16 +0800
Subject: [PATCH] 增加条码类型实体

---
 Tiger.Api/Controllers/Test/TestController.R.cs |  115 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 105 insertions(+), 10 deletions(-)

diff --git a/Tiger.Api/Controllers/Test/TestController.R.cs b/Tiger.Api/Controllers/Test/TestController.R.cs
index 80cdd05..33e9ae2 100644
--- a/Tiger.Api/Controllers/Test/TestController.R.cs
+++ b/Tiger.Api/Controllers/Test/TestController.R.cs
@@ -25,6 +25,8 @@
 using Microsoft.CodeAnalysis.Options;
 using System.IO;
 using System.Runtime.Loader;
+using MailKit.Search;
+using Tiger.Model.DigitalTwin;
 
 namespace Tiger.Api.Controllers.Test
 {
@@ -235,6 +237,37 @@
         [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()
@@ -310,17 +343,18 @@
         [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]
@@ -336,6 +370,67 @@
             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鍗曠矇瑁盰F鍔犲己杩囧搼鑶� 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)
         {

--
Gitblit v1.9.3