using System.Collections; using System.Data; using Estsh.Core.Model.ExcelModel; using Estsh.Core.Models; using Estsh.Core.Repository.IRepositories; using Estsh.Core.Services.IServices; using Estsh.Core.Util; /*************************************************************************************************** * * 更新人:sitong.dong * 描述:库存调整模块Service层 * 修改时间:2022.06.22 * 修改日志:系统迭代升级 * **************************************************************************************************/ namespace Estsh.Core.Services { public class StockAdjustDefineService : BaseService, IStockAdjustDefineService { private readonly IStockAdjustDefineRepository repository; public StockAdjustDefineService(IStockAdjustDefineRepository _repository) : base(_repository) { repository = _repository; } public List GetAllData(string _where) { return repository.GetAllData(_where); } /// /// 将记录插入到历史库存表 /// /// 编号 /// public bool MoveStock(string LotNo) { return repository.MoveStock(LotNo); } /// /// 判断箱号是否存在 /// /// 箱号 /// ture 不存在 false 存在 public bool IsExist(string carton_no) { return repository.IsExist(carton_no); } /// /// 判断库存表中该库位信息是否存在 /// /// 库位ID /// ture 不存在 false 存在 public bool Exist(string locateID) { return repository.Exist(locateID); } /// /// 更新库位是否为空的状态 /// /// 库位编号 public void UpdateLocateEmpty(string locateID) { repository.UpdateLocateEmpty(locateID); } /// /// 批量调整库存 /// /// 需要调整的数据集 /// public string AdjustStock(List dt, int userID) { return repository.AdjustStock(dt,userID); } /// /// 变更事务状态 /// /// /// public bool TransType(string lotNo, ref DataTable dt) { return repository.TransType(lotNo); } /// /// 更新 /// /// 数量 /// 箱号 /// public bool update(string qty, string lot_no) { return repository.update(qty, lot_no); } /// /// 更新至数据库 /// /// 文件全路径 /// 登录用户信息 public Hashtable ReadExcelFile(List inputStream, int userId) { Hashtable result = new Hashtable(); try { string message = ""; Hashtable resault = new Hashtable(); Hashtable Cache = new Hashtable(); if (inputStream == null || inputStream.Count == 0) { message = "没有需要调整的数据"; resault.Add("message", message); return resault; } if (AdjustStock(inputStream, userId) == "OK") { message = "调整完成!"; resault.Add("message", message); return resault; } else { message = "调整失败!"; resault.Add("message", message); return resault; } } catch (Exception ex) { result.Add("message", "导入失败"); result.Add("flag", "error"); return result; } } } }