1
yanjinhui
2025-06-12 10c497ad3b1802e1c8feed8df0a290a407ec72bc
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
using AutoMapper;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseRepository;
using WIDESEAWCS_Core.BaseServices;
using WIDESEAWCS_ISystemServices;
using WIDESEAWCS_Model.Models;
 
namespace WIDESEAWCS_SystemServices
{
    public class dt_batchinfoService : ServiceBase<dt_batchInfo, IRepository<dt_batchInfo>>, Idt_BatchinfoService
    {
        private readonly IMapper _mapper;
        public override PageGridData<dt_batchInfo> GetPageData(PageDataOptions options)
        {
            return base.GetPageData(options);
        }
        /// <summary>
        /// 仓储层(数据库访问)
        /// </summary>
        public IRepository<dt_batchInfo> Repository => BaseDal;
        public dt_batchinfoService(IRepository<dt_batchInfo> BaseDal, IMapper mapper) : base(BaseDal)
        {
            _mapper = mapper;
        }
 
        /// <summary>
        /// 修改入库批次信息
        /// </summary>
        /// <param name="batch"></param>
        /// <returns></returns>
        public WebResponseContent UpdateInBatch(string batch) 
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                var batchibfo = BaseDal.QueryFirst(v=>v.Id==1);
                batchibfo.InBatch = batch;
                BaseDal.UpdateData(batchibfo);
 
                content = WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
            {
                content = WebResponseContent.Instance.Error($"修改入库批次号失败:【{ex.Message}】");
            }
            return content;
        }
 
        /// <summary>
        /// 修改出库批次信息
        /// </summary>
        /// <param name="batch"></param>
        /// <returns></returns>
        public WebResponseContent UpdateOutBatch(string batch)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                var batchibfo = BaseDal.QueryFirst(v => v.Id == 1);
                batchibfo.OutBatch = batch;
                BaseDal.UpdateData(batchibfo);
 
                content = WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
            {
                content = WebResponseContent.Instance.Error($"修改入库批次号失败:【{ex.Message}】");
            }
            return content;
        }
 
        /// <summary>
        /// 修改出库物料信息,需要出外购还是自产
        /// </summary>
        /// <param name="batch"></param>
        /// <returns></returns>
        public WebResponseContent UpdateOutStorageMode(int mode)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                var batchibfo = BaseDal.QueryFirst(v => v.Id == 1);
                batchibfo.materType = mode;
                BaseDal.UpdateData(batchibfo);
 
                content = WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
            {
                content = WebResponseContent.Instance.Error($"修改入库批次号失败:【{ex.Message}】");
            }
            return content;
        }
    }
}