From c00956f6649cc13b094ec83cc3121e7cb0027b3c Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期一, 15 四月 2024 22:15:21 +0800
Subject: [PATCH] 盟祺-查询导出修改

---
 Tiger.Business/WMS/MengQi/Biz.Mq.SNData.cs          |   62 +++++++++++++++++++++++++++++++
 Tiger.Model.Net/Entitys/WMS/MengQi/SNData_His.cs    |    7 +++
 Tiger.IBusiness/WMS/MengQi/IMqSNData.cs             |    2 +
 Tiger.Api/Controllers/WMS/WMSController.MqSNData.cs |   41 ++++++++++++++++++++
 4 files changed, 112 insertions(+), 0 deletions(-)

diff --git a/Tiger.Api/Controllers/WMS/WMSController.MqSNData.cs b/Tiger.Api/Controllers/WMS/WMSController.MqSNData.cs
index 63db929..315e61b 100644
--- a/Tiger.Api/Controllers/WMS/WMSController.MqSNData.cs
+++ b/Tiger.Api/Controllers/WMS/WMSController.MqSNData.cs
@@ -49,5 +49,46 @@
             }
             return Ok(response);
         }
+
+        /// <summary>
+        /// 鑾峰彇鎵�鏈夋潯鐮侊紝鍘熷巶鏉$爜鍜屽鎴锋潯鐮佸垎寮�涓よ锛屾寜鏉′欢
+        /// </summary>
+        /// <param name="action"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [Route("api/[controller]/[action]")]
+        public async Task<IActionResult> GetAllSNData([FromBody] ApiAction<SNDataWhere> action)
+        {
+            ApiAction response = new();
+            try
+            {
+                response = response.GetResponse(await DI.Resolve<IMqSNData>().GetAllSNData(action.Data));
+            }
+            catch (System.Exception ex)
+            {
+                response = response.GetResponse().CatchExceptionWithLog(ex);
+            }
+            return Ok(response);
+        }
+        /// <summary>
+        /// 鑾峰彇鎵�鏈夋潯鐮侊紝鍘熷巶鏉$爜鍜屽鎴锋潯鐮佸湪鍚屼竴琛岋紝鎸夋潯浠�
+        /// </summary>
+        /// <param name="action"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [Route("api/[controller]/[action]")]
+        public async Task<IActionResult> GetAllSNDataHis([FromBody] ApiAction<SNDataWhere> action)
+        {
+            ApiAction response = new();
+            try
+            {
+                response = response.GetResponse(await DI.Resolve<IMqSNData>().GetAllSNDataHis(action.Data));
+            }
+            catch (System.Exception ex)
+            {
+                response = response.GetResponse().CatchExceptionWithLog(ex);
+            }
+            return Ok(response);
+        }
     }
 }
diff --git a/Tiger.Business/WMS/MengQi/Biz.Mq.SNData.cs b/Tiger.Business/WMS/MengQi/Biz.Mq.SNData.cs
index 2dcdbf7..978ab99 100644
--- a/Tiger.Business/WMS/MengQi/Biz.Mq.SNData.cs
+++ b/Tiger.Business/WMS/MengQi/Biz.Mq.SNData.cs
@@ -89,6 +89,68 @@
                 res.Data = pageList;
                 return res;
             }
+
+            /// <summary>
+            /// 鑾峰彇鎵�鏈夋潯鐮侊紝鍘熷巶鏉$爜鍜屽鎴锋潯鐮佸湪鍚屼竴琛岋紝鎸夋潯浠�
+            /// </summary>
+            /// <param name="where"></param>
+            /// <returns></returns>
+            public async Task<ApiAction<List<SNData_His>>> GetAllSNDataHis(SNDataWhere where)
+            {
+                var res = new ApiAction<List<SNData_His>>();
+                List<SNData_His> list = new List<SNData_His>();
+                try
+                {
+                    DateTime StartTime = DateTime.Now;
+                    DateTime EndTime = DateTime.Now;
+                    string[] strTime = where.strStartEnd?.Split(',');
+                    if (!string.IsNullOrEmpty(where.strStartEnd)) { StartTime = Convert.ToDateTime(strTime[0].ToString()); EndTime = strTime.Length == 2 ? Convert.ToDateTime(strTime[1].ToString()) : DateTime.MinValue; }
+                    RefAsync<int> total = 0;
+                    list = await Db.Queryable<SNData_His>()
+                        .WhereIF(!string.IsNullOrEmpty(where.strStartEnd), x => Convert.ToDateTime(x.ScanTime) > StartTime)
+                        .WhereIF(!string.IsNullOrEmpty(where.strStartEnd) && strTime.Length == 2, x => Convert.ToDateTime(x.ScanTime) < EndTime)
+                        .WhereIF(!string.IsNullOrEmpty(where.model), x => x.ModelCode == where.model)
+                        .WhereIF(!string.IsNullOrEmpty(where.customerCode), x => x.CustomerCode.Equals(where.customerCode))
+                        .ToListAsync();
+                }
+                catch (Exception ex)
+                {
+                    res.CatchExceptionWithLog(ex, "鏌ヨ寮傚父");
+                }
+                res.Data = list;
+                return res;
+            }
+
+            /// <summary>
+            /// 鑾峰彇鎵�鏈夋潯鐮侊紝鍘熷巶鏉$爜鍜屽鎴锋潯鐮佸垎寮�涓よ锛屾寜鏉′欢
+            /// </summary>
+            /// <param name="where"></param>
+            /// <returns></returns>
+            public async Task<ApiAction<List<SNData>>> GetAllSNData(SNDataWhere where)
+            {
+                var res = new ApiAction<List<SNData>>();
+                List<SNData> list = new List<SNData>();
+                try
+                {
+                    DateTime StartTime = DateTime.Now;
+                    DateTime EndTime = DateTime.Now;
+                    string[] strTime = where.strStartEnd?.Split(',');
+                    if (!string.IsNullOrEmpty(where.strStartEnd)) { StartTime = Convert.ToDateTime(strTime[0].ToString()); EndTime = strTime.Length == 2 ? Convert.ToDateTime(strTime[1].ToString()) : DateTime.MinValue; }
+                    RefAsync<int> total = 0;
+                    list = await Db.Queryable<SNData>()
+                        .WhereIF(!string.IsNullOrEmpty(where.strStartEnd), x => Convert.ToDateTime(x.CREATE_TIME) > StartTime)
+                        .WhereIF(!string.IsNullOrEmpty(where.strStartEnd) && strTime.Length == 2, x => Convert.ToDateTime(x.CREATE_TIME) < EndTime)
+                        .WhereIF(!string.IsNullOrEmpty(where.model), x => x.ItemCode == where.model)
+                        .WhereIF(!string.IsNullOrEmpty(where.customerCode), x => x.CustomerCode.Equals(where.customerCode))
+                        .ToListAsync();
+                }
+                catch (Exception ex)
+                {
+                    res.CatchExceptionWithLog(ex, "鏌ヨ寮傚父");
+                }
+                res.Data = list;
+                return res;
+            }
         }
     }
 }
diff --git a/Tiger.IBusiness/WMS/MengQi/IMqSNData.cs b/Tiger.IBusiness/WMS/MengQi/IMqSNData.cs
index 16156cc..850a1f7 100644
--- a/Tiger.IBusiness/WMS/MengQi/IMqSNData.cs
+++ b/Tiger.IBusiness/WMS/MengQi/IMqSNData.cs
@@ -13,5 +13,7 @@
     {
         public Task<ApiAction> ReturnSN(string barcode);
         public Task<ApiAction<PageAble<SNData_His>>> GetSNDataHis(PageAble<SNData_His> pageList);
+        public Task<ApiAction<List<SNData_His>>> GetAllSNDataHis(SNDataWhere where);
+        public Task<ApiAction<List<SNData>>> GetAllSNData(SNDataWhere where);
     }
 }
diff --git a/Tiger.Model.Net/Entitys/WMS/MengQi/SNData_His.cs b/Tiger.Model.Net/Entitys/WMS/MengQi/SNData_His.cs
index da510f9..098e54d 100644
--- a/Tiger.Model.Net/Entitys/WMS/MengQi/SNData_His.cs
+++ b/Tiger.Model.Net/Entitys/WMS/MengQi/SNData_His.cs
@@ -105,4 +105,11 @@
             }
         }
     }
+
+    public class SNDataWhere
+    {
+        public string strStartEnd { get; set; }
+        public string model { get; set; }
+        public string customerCode { get; set; }
+    }
 }

--
Gitblit v1.9.3