1
dengjunjie
2025-09-29 d9c99e0480b4910cdb134778dd5c314b35ec4cf2
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
using AutoMapper;
using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
using WIDESEA_DTO.Stock;
using WIDESEA_IBasicRepository;
using WIDESEA_IRecordRepository;
using WIDESEA_IRecordService;
using WIDESEA_IStockRepository;
using WIDESEA_IStockService;
using WIDESEA_Model.Models;
 
namespace WIDESEA_StockService
{
    public partial class InventoryBatchService : ServiceBase<Dt_Inventory_Batch, IInventoryBatchRepository>, IInventoryBatchService
    {
        private readonly IMapper _mapper;
        public IInventoryBatchRepository Repository => BaseDal;
        public IInventoryInfoRepository _inventoryInfoRepository;
 
        public InventoryBatchService(IInventoryBatchRepository BaseDal, IInventoryInfoRepository inventoryInfoRepository, IMapper mapper) : base(BaseDal)
        {
            _mapper = mapper;
            _inventoryInfoRepository = inventoryInfoRepository;
        }
        public List<Dt_Inventory_Batch> GetInventoryBatch(string materielCode)
        {
            List<Dt_Inventory_Batch> dt_Inventories = BaseDal.QueryData(x => x.MaterielCode == materielCode);
            return dt_Inventories;
        }
 
        public override WebResponseContent UpdateData(SaveModel saveModel)
        {
            var productStatus = saveModel.MainData["productStatus"].ObjToInt();
            var batchNo = saveModel.MainData["batchNo"].ToString();
            List<Dt_InventoryInfo> inventoryInfos = _inventoryInfoRepository.QueryData(x => x.BatchNo == batchNo);
            inventoryInfos.ForEach(x =>
            {
                x.ProductStatus = productStatus;
            });
            _inventoryInfoRepository.UpdateData(inventoryInfos);
            return base.UpdateData(saveModel);
        }
    }
}