| | |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | private readonly IBasicRepository _basicRepository; |
| | | private readonly IStockInfoRepository _stockInfoRepository; |
| | | private readonly IProStockInfoRepository _proStockInfoRepository; |
| | | public ILocationInfoRepository Repository => BaseDal; |
| | | |
| | | public LocationInfoService(ILocationInfoRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IBasicRepository basicRepository, IStockInfoRepository stockInfoRepository) : base(BaseDal) |
| | | public LocationInfoService(ILocationInfoRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IBasicRepository basicRepository, IStockInfoRepository stockInfoRepository, IProStockInfoRepository proStockInfoRepository) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _basicRepository = basicRepository; |
| | | _stockInfoRepository = stockInfoRepository; |
| | | _proStockInfoRepository = proStockInfoRepository; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 鏌ヨ璐т綅瀵瑰簲鐨凴FID |
| | | /// </summary> |
| | | /// <param name="locationCodes"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent GetRfid(string[] locationCodes, int warehouseId = 0) |
| | | { |
| | | try |
| | | { |
| | | // 鍙傛暟楠岃瘉 |
| | | if (locationCodes == null || locationCodes.Length == 0) |
| | | { |
| | | return WebResponseContent.Instance.Error("璐т綅缂栧彿涓嶈兘涓虹┖"); |
| | | } |
| | | |
| | | if (warehouseId == 1) |
| | | { |
| | | // 鏌ヨ鍘熸枡搴揇t_StockInfo琛紝鑾峰彇RFID淇℃伅 |
| | | var rawMaterialRfidList = _stockInfoRepository.QueryData() |
| | | .Where(x => locationCodes.Contains(x.LocationCode)) |
| | | .Select(x => new { x.LocationCode, x.RfidCode }) |
| | | .ToList(); |
| | | |
| | | var rfidList = rawMaterialRfidList.ToList(); |
| | | // 杩斿洖缁撴灉 |
| | | return WebResponseContent.Instance.OK(data: rfidList); |
| | | } |
| | | |
| | | if (warehouseId == 2) |
| | | { |
| | | // 鏌ヨ鎴愬搧搴揇t_ProStockInfo琛紝鑾峰彇PalletCode淇℃伅 |
| | | var finishedProductRfidList =_proStockInfoRepository.QueryData() |
| | | .Where(x => locationCodes.Contains(x.LocationCode)) |
| | | .Select(x => new { x.LocationCode, RfidCode = x.PalletCode }) |
| | | .ToList(); |
| | | |
| | | var rfidList = finishedProductRfidList.ToList(); |
| | | // 杩斿洖缁撴灉 |
| | | return WebResponseContent.Instance.OK(data: rfidList); |
| | | } |
| | | // 濡傛灉娌℃湁鍖归厤鐨勪粨搴揑D锛岃繑鍥炵┖鍒楄〃 |
| | | return WebResponseContent.Instance.OK(data: new List<object>()); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.WriteLine($"GetRfid 寮傚父: {ex.Message}"); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |