From b88cbdbc97735732fe6406fbe5aa3228eaa1b551 Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期一, 20 十月 2025 13:13:44 +0800
Subject: [PATCH] 修改包装管理,包装可输入小数
---
Wms/WMS.BLL/LogServer/LogWorkShopServer.cs | 76 ++++++++++++++++----------------------
1 files changed, 32 insertions(+), 44 deletions(-)
diff --git a/Wms/WMS.BLL/LogServer/LogWorkShopServer.cs b/Wms/WMS.BLL/LogServer/LogWorkShopServer.cs
index c6ad64c..4225d22 100644
--- a/Wms/WMS.BLL/LogServer/LogWorkShopServer.cs
+++ b/Wms/WMS.BLL/LogServer/LogWorkShopServer.cs
@@ -2,11 +2,14 @@
using SqlSugar;
using System;
using System.Collections.Generic;
+using System.Linq.Expressions;
using System.Text;
+using System.Threading.Tasks;
using WMS.DAL;
using WMS.Entity.Context;
using WMS.Entity.DataEntity;
using WMS.Entity.LogEntity;
+using WMS.Entity.SysEntity;
using WMS.IBLL.IBllCheckServer;
using WMS.IBLL.ILogServer;
@@ -19,54 +22,39 @@
{
}
- public List<LogWorkShopDto> GetLogWorkShopList(string type, string palletNo,string lotNo,string skuNo,string skuName,int page, int limit, out int count)
+ public List<LogWorkShopDto> GetLogWorkShopList(string type, string palletNo,string lotNo,string skuNo,string skuName,string boxNo,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 ";
+ Expression<Func<LogWorkShop, bool>> item = Expressionable.Create<LogWorkShop>()
+ .AndIF(!string.IsNullOrWhiteSpace(type), it => it.Type == type)
+ .AndIF(!string.IsNullOrWhiteSpace(palletNo), it => it.PalletNo.Contains(palletNo.Trim()))
+ .AndIF(!string.IsNullOrWhiteSpace(lotNo), it => it.LotNo.Contains(lotNo.Trim()))
+ .AndIF(!string.IsNullOrWhiteSpace(skuNo), it => it.SkuNo.Contains(skuNo.Trim()))
+ .AndIF(!string.IsNullOrWhiteSpace(skuName), it => it.SkuName.Contains(skuName.Trim()))
+ .AndIF(!string.IsNullOrWhiteSpace(boxNo), it => it.BoxNo.Contains(boxNo.Trim()))
+ .ToExpression();//娉ㄦ剰 杩欎竴鍙� 涓嶈兘灏�
- 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;
+ var total = 0;
+ var data = GetAllWhereAsync(item)
+ .LeftJoin<SysUserInfor>((a, b) => a.CreateUser == b.Id)
+ .Select((a, b) => new LogWorkShopDto()
+ {
+ PalletNo = a.PalletNo,
+ SkuNo = a.SkuNo,
+ SkuName = a.SkuName,
+ LotNo = a.LotNo,
+ Qty = a.Qty,
+ Type = a.Type,
+ BoxNo = a.BoxNo,
+ CreateUserName = b.RealName,
+ CreateTime = a.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")
+ })
+ .OrderByDescending(a => a.CreateTime)
+ .ToOffsetPage(page, limit, ref total);
+ count = total;
+
+ return data;
}
catch (Exception e)
{
--
Gitblit v1.8.0