dengjunjie
2024-11-14 c827fe7b0c5b3b444d76ba0d96a2649c764630dd
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
//using SqlSugar.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
using WIDESEA_DTO.Stock;
using WIDESEA_IStockRepository;
using WIDESEA_IStockService;
using WIDESEA_Model.Models;
 
namespace WIDESEA_StockService
{
    public partial class StockInfoDetailService : ServiceBase<Dt_StockInfoDetail, IStockInfoDetailRepository>, IStockInfoDetailService
    {
        public bool ExistSerialNumber(string SerialNumber)
        {
            return BaseDal.QueryFirst(x => x.SerialNumber == SerialNumber) != null;
        }
 
        public bool ExistSerialNumbers(List<string> SerialNumbers)
        {
            return BaseDal.QueryFirst(x => SerialNumbers.Contains(x.SerialNumber)) != null;
        }
 
        /// <summary>
        /// 根据批次号和单据号获取库存明细信息
        /// </summary>
        /// <param name="OrderNo">订单号</param>
        /// <param name="BatchNo">批次号</param>
        /// <returns></returns>
        public Dt_StockInfoDetail Get_StockInfoDetail(string OrderNo, string BatchNo = null)
        {
            Dt_StockInfoDetail stockInfoDetail = null;
            if (BatchNo != null)
            {
                stockInfoDetail = BaseDal.QueryFirst(x => x.OrderNo == OrderNo && x.BatchNo == BatchNo && (x.Status == StockStatusEmun.入库中.ObjToInt() || x.Status == StockStatusEmun.已入库.ObjToInt()));
            }
            else
            {
                stockInfoDetail = BaseDal.QueryFirst(x => x.OrderNo == OrderNo && (x.Status == StockStatusEmun.入库中.ObjToInt() || x.Status == StockStatusEmun.已入库.ObjToInt()));
            }
            return stockInfoDetail;
        }
        /// <summary>
        /// 获取指定库存
        /// </summary>
        /// <param name="stockSelectViews"></param>
        /// <returns></returns>
        public List<Dt_StockInfoDetail> GetStockInfosByBatchNoCodes(List<StockSelectViewDTO> stockSelectViews)
        {
            List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>();
            foreach (var item in stockSelectViews)
            {
                var stockSelectView = BaseDal.QueryData(x => x.BatchNo == item.BatchNo && x.MaterielCode == item.MaterielCode);
                if (stockSelectView.Count > 0) stockInfoDetails.AddRange(stockSelectView);
            }
            return stockInfoDetails;
        }
        public List<Dt_StockInfoDetail> GetStockInfosByBatchNoCodes()
        {
            List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>();
 
            return stockInfoDetails;
        }
 
        public List<Dt_StockInfoDetail> Get_StockInfoDetails(string OrderNo, string BatchNo = null)
        {
            List<Dt_StockInfoDetail> stockInfoDetails = null;
            if (BatchNo != null)
            {
                stockInfoDetails = BaseDal.QueryData(x => x.OrderNo == OrderNo && x.BatchNo == BatchNo && (x.Status == StockStatusEmun.入库中.ObjToInt() || x.Status == StockStatusEmun.已入库.ObjToInt()));
            }
            else
            {
                stockInfoDetails = BaseDal.QueryData(x => x.OrderNo == OrderNo && (x.Status == StockStatusEmun.入库中.ObjToInt() || x.Status == StockStatusEmun.已入库.ObjToInt()));
            }
            return stockInfoDetails;
        }
    }
}