IInventoryApp.cs
1.65 KB
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
using System;
using System.Collections.Generic;
using Infrastructure;
using WebRepository;
namespace WebApp
{
    /// <summary>
    /// 库存查询接口App
    /// </summary>
    public partial class IInventoryApp : ApiApp
    {
        public IInventoryApp(IUnitWork unitWork, IAuth auth, BaseDBContext context) : base(unitWork, auth, context)
        {
        }
        public Response<List<InventoryModel>> GetCurrentStock(InventoryModel inventoryModel)
        {
            Response<List<InventoryModel>> Response = new Response<List<InventoryModel>>();
            if (!CheckLogin())
            {
                Response.Code = 500;
                Response.Status = false;
                Response.Message = "请先登录!";
                return Response;
            }
            try
            {
                Inventory inventory = new Inventory
                {
                    WarehouseType = inventoryModel.WarehouseType,
                    LocationCode = inventoryModel.LocationCode,
                    ContainerCode = inventoryModel.ContainerCode,
                    MaterialCode = inventoryModel.MaterialCode,
                    Lot = inventoryModel.Lot,
                    Status = inventoryModel.Status,
                    Qty = null,
                };
                Response.Result = _unitWork.Find(EntityToExpression<Inventory>.GetExpressions(inventory)).MapToList<InventoryModel>();
            }
            catch (Exception ex)
            {
                Response.Code = 500;
                Response.Status = false;
                Response.Message = ex.Message;
            }
            return Response;
        }
    }
}