11
啊鑫
2024-08-14 e93d2a1c8fdfadf50f9fbf9e30c04ffe73df023a
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
using MES.Service.DB;
using MES.Service.Dto.service;
using MES.Service.Modes;
using SqlSugar;
 
namespace MES.Service.service.Warehouse;
 
public class MesDepotSectionsManager : Repository<MesDepotSections>
{
    //当前类已经继承了 Repository 增、删、查、改的方法
 
    public string GetSectionName(WarehouseQuery query)
    {
        var sectionName = Db.Queryable<MesDepotSections, MesDepots>((a, b) =>
                new JoinQueryInfos(JoinType.Inner, a.DepotId == b.DepotId))
            .Where((a, b) => a.DepotSectionCode == query.sectionCode)
            .Select((a, b) => a.DepotSectionName).Single();
 
        if (sectionName == null)
        {
            throw new Exception("库位编码 " + query.sectionCode + " 不存在,请确认!");
        }
 
        return sectionName;
    }
 
    public MesDepotSections ScanInDepotSectionsName(WarehouseQuery query)
    {
        
        if (string.IsNullOrEmpty(query.sectionCode))
        {
            throw new Exception("请扫库位条码!");
        }
        
        var mesDepotSections = Db.Queryable<MesDepotSections, MesDepots>(
                (a, b) =>
                    new JoinQueryInfos(JoinType.Inner, a.DepotId == b.DepotId))
            .Where((a, b) => a.DepotSectionCode == query.sectionCode)
            .Select((a, b) => new MesDepotSections
            {
                DepotSectionName = a.DepotSectionName,
                DepotCode = b.DepotCode,
                DepotName = b.DepotName
            }).First();
 
        if (mesDepotSections == null)
        {
            throw new Exception("库位编码" + query.sectionCode + " 不存在,请确认!");
        }
 
        return mesDepotSections;
    }
 
    public MesInvItemStocks ScanEditBarcode(WarehouseQuery entity)
    {
        if (string.IsNullOrEmpty(entity.sectionCode))
        {
            throw new Exception("请扫库位条码!");
        }
 
        return null;
    }
}