| | |
| | | 锘縰sing Magicodes.ExporterAndImporter.Core; |
| | | 锘縰sing AutoMapper; |
| | | using Magicodes.ExporterAndImporter.Core; |
| | | using Magicodes.ExporterAndImporter.Excel; |
| | | using SqlSugar; |
| | | using System; |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_IRecordService; |
| | | using WIDESEA_IStockRepository; |
| | | using WIDESEA_IStockService; |
| | | using WIDESEA_ITaskInfoRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_StockService |
| | | { |
| | | public partial class StockInfoDetailService : ServiceBase<Dt_StockInfoDetail, IStockInfoDetailRepository>, IStockInfoDetailService |
| | | { |
| | | |
| | | |
| | | public bool ExistSerialNumber(string SerialNumber) |
| | | { |
| | | return BaseDal.QueryFirst(x => x.SerialNumber == SerialNumber) != null; |
| | |
| | | return BaseDal.QueryFirst(x => SerialNumbers.Contains(x.SerialNumber)) != null; |
| | | } |
| | | |
| | | //瀵煎嚭 |
| | | public override WebResponseContent Export(PageDataOptions options) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string savePath = AppDomain.CurrentDomain.BaseDirectory + $"ExcelExport"; |
| | | IExporter exporter = new ExcelExporter(); |
| | | //娣诲姞鏉′欢 |
| | | string wheres = options.ValidatePageOptions(TProperties); |
| | | //鑾峰彇鎺掑簭瀛楁 |
| | | Dictionary<string, OrderByType> orderbyDic = options.GetPageDataSort(TProperties); |
| | | List<Dt_StockInfoDetail> entities = BaseDal.QueryData(wheres, orderbyDic); |
| | | |
| | | byte[] data = exporter.ExportAsByteArray(entities).Result; |
| | | |
| | | string fileName = "1.xlsx"; |
| | | |
| | | FileHelper.WriteFile(savePath, fileName, data); |
| | | |
| | | content = WebResponseContent.Instance.OK(data: savePath + "\\" + fileName); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | } |
| | | } |