zhanghonglin
2026-04-10 8f9b9411ca279670bd85fcfa7763987295ed9abf
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
using WIDESEA_IStockService;
using WIDESEA_Model.Models.Basic;
using WIDESEA_Model.Models.Outbound;
using WIDESEA_Model.Models.Stock;
using WIDESEAWCS_Model.Models.TaskInfo;
 
namespace WIDESEA_StockService
{
    public class OutstockinfoService : ServiceBase<Dt_Outstockinfo, IRepository<Dt_Outstockinfo>>, IOutstockinfoService
    {
 
        private readonly IRepository<Dt_Warehouse> _WarehouseRepository;
        public OutstockinfoService(IRepository<Dt_Outstockinfo> BaseDal,IRepository<Dt_Warehouse> WarehouseRepository) : base(BaseDal)
        {
            _WarehouseRepository = WarehouseRepository;
        }
 
        public IRepository<Dt_Outstockinfo> Repository => BaseDal;
 
        //空桶入库设置
        public WebResponseContent EmptyOutSet(string Code)
        {
            WebResponseContent content = new WebResponseContent();
 
            if (Code !=null && !Code.Equals(""))
            {
                Dt_Warehouse Warehouse = _WarehouseRepository.QueryFirst(x => x.MateriaCode == Code);
                if (Warehouse == null)
                {
                    Dt_Outstockinfo Outstockinfo = selectOutstockinfo();
                    Outstockinfo.EmptyOutSet = Code;
                    BaseDal.UpdateData(Outstockinfo);
                }
                else
                {
                    content.Message = "无此类型的空桶";
                }
            }
            else
            {
                content.Message = "输入的值格式错误";
            }
 
            return content;
        }
 
        //刷新首页设置
        public Dt_Outstockinfo Refresh()
        {
            Dt_Outstockinfo Outstockinfo = new Dt_Outstockinfo();
            Outstockinfo = selectOutstockinfo();
            return Outstockinfo;
        }
 
        //查询设置数据
        public Dt_Outstockinfo selectOutstockinfo()
        {
            Dt_Outstockinfo Outstockinfo = new Dt_Outstockinfo();
            Outstockinfo = BaseDal.QueryFirst(x => x.Id == 1);
            return Outstockinfo;
        }
 
        //修改首页设置
        public WebResponseContent UpdateOutstockinfo(int num)
        {
            WebResponseContent content = new WebResponseContent();
            Dt_Outstockinfo Outstockinfo = selectOutstockinfo();
 
            //出库优先
            if (num == 1)
            {
                if (Outstockinfo.BigOrLittle == 0)
                {
                    Outstockinfo.BigOrLittle = 1;
                }
                else
                {
                    Outstockinfo.BigOrLittle = 0;
                }
            }
            //入库模式切换
            else if (num == 2)
            {
                if (Outstockinfo.OutMode == 0)
                {
                    Outstockinfo.OutMode = 1;
                }
                else
                {
                    Outstockinfo.OutMode = 0;
                }
            }
            BaseDal.UpdateData(Outstockinfo);
            return content;
        }
    }
}