| | |
| | | using HslCommunication.WebSocket; |
| | | using HslCommunication.WebSocket; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using SqlSugar; |
| | |
| | | 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> |
| | | /// æ¥è¯¢è´§ä½å¯¹åºçRFIDååºåä¿¡æ¯ |
| | | /// </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) |
| | | { |
| | | // æ¥è¯¢åæåºDt_StockInfo表ï¼è·åRFIDååºåä¿¡æ¯ |
| | | var rawMaterialRfidList = _stockInfoRepository.QueryData() |
| | | .Where(x => locationCodes.Contains(x.LocationCode)) |
| | | .Select(x => new { |
| | | locationCode = x.LocationCode, |
| | | rfidCode = x.RfidCode, |
| | | paperRoll = x.MaterielName, // 纸å·åç§° |
| | | width = x.MaterielWide, // é¨å¹
ï¼å¹
å®½ï¼ |
| | | barcode = x.PalletCode, // çº¸å·æ¡ç |
| | | status = x.StockStatus, // ç¶æ |
| | | inDate = x.CreateDate // å
¥åºæ¶é´ï¼å建æ¶é´ï¼ |
| | | }) |
| | | .ToList(); |
| | | |
| | | // è¿åç»æ |
| | | return WebResponseContent.Instance.OK(data: rawMaterialRfidList); |
| | | } |
| | | |
| | | if (warehouseId == 2) |
| | | { |
| | | // æ¿æ¢åæç .Select(x => new { ... Detail = x.proStockInfoDetails?.FirstOrDefault() ... }) 代ç å |
| | | var finishedProductRfidList = _proStockInfoRepository.Db.Queryable<Dt_ProStockInfo>() |
| | | .Includes(x => x.proStockInfoDetails) |
| | | .Where(x => locationCodes.Contains(x.LocationCode)) |
| | | .ToList() |
| | | .Select(x => new |
| | | { |
| | | locationCode = x.LocationCode, |
| | | rfidCode = x.PalletCode, |
| | | paperRoll = (x.proStockInfoDetails != null && x.proStockInfoDetails.Count > 0) ? x.proStockInfoDetails[0].ProductName : string.Empty, |
| | | productName = (x.proStockInfoDetails != null && x.proStockInfoDetails.Count > 0) ? x.proStockInfoDetails[0].ProductName : string.Empty, |
| | | width = (x.proStockInfoDetails != null && x.proStockInfoDetails.Count > 0) ? x.proStockInfoDetails[0].StockQty : 0, |
| | | quantity = (x.proStockInfoDetails != null && x.proStockInfoDetails.Count > 0) ? x.proStockInfoDetails[0].StockQty : 0, |
| | | barcode = x.PalletCode, |
| | | status = x.StockStatus, |
| | | inDate = x.CreateDate |
| | | }) |
| | | .ToList(); |
| | | |
| | | // è¿åç»æ |
| | | return WebResponseContent.Instance.OK(data: finishedProductRfidList); |
| | | } |
| | | // å¦ææ²¡æå¹é
çä»åºIDï¼è¿å空å表 |
| | | return WebResponseContent.Instance.OK(data: new List<object>()); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.WriteLine($"GetRfid å¼å¸¸: {ex.Message}"); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | Dt_LocationInfo locationInfo = new Dt_LocationInfo() |
| | | { |
| | | WarehouseId = 0, |
| | | Column = j + 1, |
| | | Columns = j + 1, |
| | | EnableStatus = EnableStatusEnum.Normal.ObjToInt(), |
| | | Layer = k + 1, |
| | | LocationStatus = LocationStatusEnum.Free.ObjToInt(), |
| | |
| | | Row = i + 1, |
| | | Depth = depth, |
| | | }; |
| | | locationInfo.LocationCode = $"{locationInfo.RoadwayNo}-{locationInfo.Row.ToString().PadLeft(3, '0')}-{locationInfo.Column.ToString().PadLeft(3, '0')}-{locationInfo.Layer.ToString().PadLeft(3, '0')}-{locationInfo.Depth.ToString().PadLeft(2, '0')}"; |
| | | locationInfo.LocationName = $"{locationInfo.RoadwayNo}å··é{locationInfo.Row.ToString().PadLeft(3, '0')}è¡{locationInfo.Column.ToString().PadLeft(3, '0')}å{locationInfo.Layer.ToString().PadLeft(3, '0')}å±{locationInfo.Depth.ToString().PadLeft(2, '0')}æ·±"; |
| | | locationInfo.LocationCode = $"{locationInfo.RoadwayNo}-{locationInfo.Row.ToString().PadLeft(3, '0')}-{locationInfo.Columns.ToString().PadLeft(3, '0')}-{locationInfo.Layer.ToString().PadLeft(3, '0')}-{locationInfo.Depth.ToString().PadLeft(2, '0')}"; |
| | | locationInfo.LocationName = $"{locationInfo.RoadwayNo}å··é{locationInfo.Row.ToString().PadLeft(3, '0')}è¡{locationInfo.Columns.ToString().PadLeft(3, '0')}å{locationInfo.Layer.ToString().PadLeft(3, '0')}å±{locationInfo.Depth.ToString().PadLeft(2, '0')}æ·±"; |
| | | locationInfos.Add(locationInfo); |
| | | } |
| | | } |