From 86e443e42c4bee972c5b795def4917e02f98ce40 Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期五, 11 七月 2025 16:45:08 +0800
Subject: [PATCH] 修改问题

---
 Wms/WMS.BLL/LogServer/LogWorkShopServer.cs |   77 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 77 insertions(+), 0 deletions(-)

diff --git a/Wms/WMS.BLL/LogServer/LogWorkShopServer.cs b/Wms/WMS.BLL/LogServer/LogWorkShopServer.cs
new file mode 100644
index 0000000..c6ad64c
--- /dev/null
+++ b/Wms/WMS.BLL/LogServer/LogWorkShopServer.cs
@@ -0,0 +1,77 @@
+锘縰sing Model.ModelDto.LogDto;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using WMS.DAL;
+using WMS.Entity.Context;
+using WMS.Entity.DataEntity;
+using WMS.Entity.LogEntity;
+using WMS.IBLL.IBllCheckServer;
+using WMS.IBLL.ILogServer;
+
+namespace WMS.BLL.LogServer
+{
+    public class LogWorkShopServer : DbHelper<LogWorkShop>, ILogWorkShopServer
+    {
+        private static readonly SqlSugarScope Db = DataContext.Db;
+        public LogWorkShopServer() : base(Db)
+        {
+        }
+
+        public List<LogWorkShopDto> GetLogWorkShopList(string type, string palletNo,string lotNo,string skuNo,string skuName,int page, int limit, out int count)
+        {
+            try
+            {
+                string sqlString = string.Empty;
+                string sqlCount = string.Empty;
+                string sqlPub = string.Empty;
+                sqlCount += "SELECT COUNT(tb1.ID) FROM LogWorkShop AS tb1 ";
+                sqlString += $@"select
+                                    tb1.Type,tb1.PalletNo,tb1.LotNo,tb1.SkuNo,tb1.SkuName,tb1.CreateUser,tb1.CreateTime,SUM(tb1.Qty) as Qty,tb2.RealName as CreateUserName 
+                                from LogWorkShop as tb1 
+                                left join SysUserInfor as tb2 on tb1.CreateUser=tb2.Id ";
+                sqlPub += $"where 1=1 ";
+
+                if (!string.IsNullOrEmpty(type))
+                {
+                    sqlPub += $"AND tb1.Type = '{type}' ";
+                }
+                if (!string.IsNullOrEmpty(palletNo))
+                {
+                    sqlPub += $"AND tb1.PalletNo like '%{palletNo.Trim()}%' ";
+                }
+                if (!string.IsNullOrEmpty(lotNo))
+                {
+                    sqlPub += $"AND tb1.LotNo like '%{lotNo.Trim()}%' ";
+                }
+                if (!string.IsNullOrEmpty(skuNo))
+                {
+                    sqlPub += $"AND tb1.SkuNo like '%{skuNo.Trim()}%' ";
+                }
+                if (!string.IsNullOrEmpty(skuName))
+                {
+                    sqlPub += $"AND tb1.SkuName like '%{skuName.Trim()}%' ";
+                }
+                sqlPub += " group by tb1.Type,tb1.PalletNo,tb1.LotNo,tb1.SkuNo,tb1.SkuName,tb1.CreateUser,tb1.CreateTime ";
+                sqlCount += sqlPub;
+                if (page == 0)
+                {
+                    page = 1;
+                }
+                sqlString += sqlPub + $" offset {((page - 1) * limit)} rows fetch next {limit} rows only;";
+
+                var com = new Common();
+                count = com.GetRowCount(sqlCount);
+
+                var modelList = Db.Ado.SqlQuery<LogWorkShopDto>(sqlString);
+
+                return modelList;
+            }
+            catch (Exception e)
+            {
+                throw new Exception(e.Message);
+            }
+        }
+    }
+}

--
Gitblit v1.8.0