| | |
| | | using AutoMapper; |
| | | using Magicodes.ExporterAndImporter.Core; |
| | | using Magicodes.ExporterAndImporter.Excel; |
| | | using MailKit.Search; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using SqlSugar; |
| | |
| | | using WIDESEA_ITaskInfoService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_TaskInfoRepository; |
| | | using OrderByType = SqlSugar.OrderByType; |
| | | |
| | | namespace WIDESEA_TaskInfoService; |
| | | |
| | |
| | | CreateDate = task.CreateDate, |
| | | ModifyDate = DateTime.Now, |
| | | Modifier = task.Modifier, |
| | | Remark = task.Remark |
| | | Remark = task.Remark, |
| | | PLCTo=task.PLCTo, |
| | | PalletCodequantity=task.PalletCodequantity, |
| | | MaterialType = task.MaterialType |
| | | }; |
| | | BaseDal.AddData(task_Hty); |
| | | return content; |
| | | } |
| | | |
| | | //å¯¼åº |
| | | 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_Task_Hty> entities = BaseDal.QueryData(wheres, orderbyDic); |
| | | var stockdct = entities |
| | | .GroupBy(x => new { x.TaskType,x.MaterialType }) |
| | | .Select(g => new Dt_Task_Htyt |
| | | { |
| | | MaterialType = g.Key.MaterialType.ToString() == "0" ? "åææ" : "æå", // è¿éèµå¼ç» MaterielCode |
| | | TaskType= g.Key.TaskType.ToString() == "100" ? "åºåº" : "å
¥åº", |
| | | PalletCodequantity = g.Count(), |
| | | }) |
| | | .ToList(); |
| | | |
| | | byte[] data = exporter.ExportAsByteArray(stockdct).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; |
| | | } |
| | | |
| | | public class Dt_Task_Htyt |
| | | { |
| | | [ExporterHeader(DisplayName = "ç©æç±»å")] |
| | | public string MaterialType { get; set;} |
| | | [ExporterHeader(DisplayName = "ä»»å¡ç±»å")] |
| | | public string TaskType { get; set; } |
| | | [ExporterHeader(DisplayName = "æ°é")] |
| | | public int PalletCodequantity { get; set; } |
| | | } |
| | | } |