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, 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 GetInventoryBatch(string materielCode) { List 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 inventoryInfos = _inventoryInfoRepository.QueryData(x => x.BatchNo == batchNo); inventoryInfos.ForEach(x => { x.ProductStatus = productStatus; }); _inventoryInfoRepository.UpdateData(inventoryInfos); return base.UpdateData(saveModel); } } }