11
啊鑫
2025-07-15 5dc3cc86f5835369cd830f2a83318b9a8d69cf69
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
using Masuit.Tools;
using MES.Service.DB;
using MES.Service.Dto.service;
using MES.Service.Modes;
using MES.Service.util;
using Microsoft.CSharp.RuntimeBinder;
using SqlSugar;
 
namespace MES.Service.service.QC;
 
public class MesOqcItemsDetect02Manager : Repository<MesOqcItemsDetect02>
{
    public (List<MesOqcItemsDetect02> item, int TotalCount) GetPage(
        XJPageResult queryObj)
    {
        if (queryObj == null)
            throw new ArgumentNullException(nameof(queryObj));
 
        if (string.IsNullOrEmpty(queryObj.createUser))
            return (new List<MesOqcItemsDetect02>(), 0);
 
        if (queryObj.createUser.IsNullOrEmpty()) return ([], 0);
 
        var db = Db;
 
        //安全的类型转换
        if (!decimal.TryParse(queryObj.id, out var id))
            id = 0;
 
        var totalCount = 0;
 
        //var itemIds = GetQaItem(db, queryObj.createUser);
 
        // var pageList = db.Queryable<LtsLlj>()
        //     .WhereIF(
        //         StringUtil.IsNotNullOrEmpty(queryObj.result) &&
        //         "未完成".Equals(queryObj.result),
        //         a => a.FcheckResu == null)
        //     .WhereIF(
        //         StringUtil.IsNotNullOrEmpty(queryObj.result) &&
        //         !"未完成".Equals(queryObj.result),
        //         a => a.FcheckResu != null)
        //     .WhereIF(id > 0, a => a.Id == id)
 
        //加筛选条件,根据供应商,物料编码,物料名称搜索
        //.WhereIF(queryObj.SearchValue!=null && queryObj.SearchValue!="", (a) => a.SuppName == queryObj.SearchValue|| a.ItemName == queryObj.SearchValue || a.ItemNo == queryObj.SearchValue )
        // .WhereIF(
        //     queryObj.SelectedIndex == "0" &&
        //     !string.IsNullOrEmpty(queryObj.SearchValue),
        //     a => (a.ItemNo.ToLower()
        //         .Contains(queryObj.SearchValue.ToLower())))
        // .WhereIF(
        //     queryObj.SelectedIndex == "1" &&
        //     !string.IsNullOrEmpty(queryObj.SearchValue),
        //     a => (a.ItemName.ToLower()
        //         .Contains(queryObj.SearchValue.ToLower())))
        // .WhereIF(
        //     queryObj.SelectedIndex == "2" &&
        //     !string.IsNullOrEmpty(queryObj.SearchValue),
        //     a => (a.SuppName.ToLower()
        //         .Contains(queryObj.SearchValue.ToLower())))
        // .WhereIF(queryObj.result == "已完成",
        //     a => (a.IqcDate >= queryObj.startDate.ToDateTime() &&
        //           a.IqcDate <= queryObj.endDate.ToDateTime().AddDays(1)))
        // .WhereIF(queryObj.result == "已完成" && queryObj.state != "所有状态",
        //     a => a.FcheckResu == queryObj.state)
        //     .OrderByDescending(a => a.Id)
        //     .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount);
        // return (pageList, totalCount);
        return (new List<MesOqcItemsDetect02>(), totalCount);
    }
 
    public MesInvItemStocks GetItemBarCode(XJPageResult queryObj)
    {
        if (queryObj.ItemCode.IsNullOrEmpty())
        {
            throw new NotImplementedException("请扫描条码");
        }
 
        var mesInvItemStocks = Db.Queryable<MesInvItemStocks>()
            .Where(a => a.ItemBarcode == queryObj.ItemCode)
            .First();
 
        if (mesInvItemStocks == null)
        {
            throw new NotImplementedException("条码不存在于库存中");
        }
 
        var mesDepots = Db.Queryable<MesDepots>()
            .Where(s => s.DepotId == 121163).First();
 
        if (!mesDepots.DepotCode.Equals(mesInvItemStocks.DepotsCode))
        {
            throw new NotImplementedException("只能扫描" + mesDepots.DepotCode +
                                              "仓库的码");
        }
        
        if (mesInvItemStocks.ItemId is null or 0)
        {
            throw new NotImplementedException("物料是非法的");
        }
 
        var mesItems = Db.Queryable<MesItems>()
            .Where(b=>b.Id == mesInvItemStocks.ItemId)
            .First();
        
        // mesInvItemStocks.ItemName = mesItems.ItemName;
        // mesInvItemStocks.ItemModel = mesItems.ItemModel;
 
        return mesInvItemStocks;
    }
    
    
}