bklLiudl
2025-04-07 4e8f58cb41c7b6d570fd1979d80f74ab8a4d00c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
using Model.ModelDto.DataDto;
using Model.ModelDto.SysDto;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;
using WMS.DAL;
using WMS.Entity.Context;
using WMS.Entity.DataEntity;
using WMS.IBLL.IBllCheckServer;
 
namespace WMS.BLL.BllCheckServer
{
    public class WarehouseOutsidePalletsServer : DbHelper<DataStockDetail>, IWarehouseOutsidePalletsServer
    {
        private static readonly SqlSugarScope Db = DataContext.Db;
        public WarehouseOutsidePalletsServer() : base(Db)
        {
        }
 
        /// <summary>
        /// 获取库外托盘信息列表
        /// </summary>
        /// <param name="skuNo">物料号</param>
        /// <param name="skuName">物料名称</param>
        /// <param name="lotNo">批次</param>
        /// <param name="palletNo">托盘号</param>
        /// <returns></returns>
        public List<MateDataStockDto> GetPalletsOutside(string skuNo, string skuName, string lotNo, string palletNo, int page, int limit, out int count)
        {
            string sqlCount = "SELECT DISTINCT COUNT(DataStockDetail.ID) " +
                "FROM DataStockDetail " +
                "where IsDel = 0 and isnull(LocatNo,'') = '' and isnull(WareHouseNo,'') = '' ";
 
            string str = "select Id,LotNo,LotText,SupplierLot,SkuNo,SkuName,Standard,Qty,LockQty,FrozenQty,PalletNo," +
                "Status,InspectMark,BitPalletMark,InspectStatus " +
                "from DataStockDetail " +
                "where IsDel = @isdel and isnull(LocatNo,'') = @locatno and isnull(WareHouseNo,'') = @wareHouseNo";
            //判断物料号是否为空
            if (!string.IsNullOrEmpty(skuNo))
            {
                str += " and SkuNo like @skuno";
            }
            //判断物料名称是否为空
            if (!string.IsNullOrEmpty(skuName))
            {
                str += " and SkuName like @skuname";
            }
            //判断批次是否为空
            if (!string.IsNullOrEmpty(lotNo))
            {
                str += " and LotNo like @lotno";
            }
            //判断托盘号是否为空
            if (!string.IsNullOrEmpty(palletNo))
            {
                str += " and PalletNo like @palletno";
            }
            //排序
            str += " order by LotNo,SkuNo,PalletNo";
            if (page == 0)
            {
                page = 1;
            }
            str += $" offset {((page - 1) * limit)} rows fetch next {limit} rows only;";
            List<MateDataStockDto> mateDataStockDtos = Db.Ado.SqlQuery<MateDataStockDto>(str, new
            {
                isdel = "0", //是否删除
                locatno = "", //储位地址
                wareHouseNo = "", //仓库
                skuno = skuNo, //物料号
                skuname = skuName, // 物料名称
                lotno = lotNo, //批次
                palletno = palletNo //托盘号
            });
            var com = new Common();
            count = com.GetRowCount(sqlCount);
            return mateDataStockDtos;
        }
    }
}