| | |
| | | return outStocks; |
| | | } |
| | | |
| | | |
| | | //å¯¼åº |
| | | 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_StockInfo> entities = BaseDal.QueryData(wheres, orderbyDic); |
| | | List<Dt_StockInfoDetail> detdata = _stockInfoDetail.QueryData(); |
| | | List<Dt_StockInfodt> stolist= new List<Dt_StockInfodt>(); |
| | | for (int i = 0; i < entities.Count; i++) |
| | | { |
| | | Dt_StockInfoDetail dt_StockIndet = detdata.Where(x => x.StockId == entities[i].Id).FirstOrDefault(); |
| | | string MaterialTypet = "åææ"; |
| | | if (entities[i].MaterialType == (int)InventoryMaterialType.æå) |
| | | { |
| | | MaterialTypet = "æå"; |
| | | } |
| | | else if(entities[i].MaterialType == (int)InventoryMaterialType.空æ) |
| | | { |
| | | MaterialTypet = "空æ"; |
| | | } |
| | | |
| | | string Wlstatust = "å¾
æ£"; |
| | | if (entities[i].Wlstatus== (int)InventoryMaterialStatus.åæ ¼) |
| | | { |
| | | Wlstatust = "åæ ¼"; |
| | | } |
| | | else if (entities[i].Wlstatus == (int)InventoryMaterialStatus.ä¸åæ ¼) |
| | | { |
| | | Wlstatust = "ä¸åæ ¼"; |
| | | } |
| | | else if (entities[i].Wlstatus == (int)InventoryMaterialStatus.空æ) |
| | | { |
| | | Wlstatust = "空æ"; |
| | | } |
| | | else if (entities[i].Wlstatus == (int)InventoryMaterialStatus.éè´§) |
| | | { |
| | | Wlstatust = "éè´§"; |
| | | } |
| | | else if (entities[i].Wlstatus == (int)InventoryMaterialStatus.è¿å·¥) |
| | | { |
| | | Wlstatust = "è¿å·¥"; |
| | | } |
| | | else if (entities[i].Wlstatus == (int)InventoryMaterialStatus.ç¹é) |
| | | { |
| | | Wlstatust = "ç¹é"; |
| | | } |
| | | |
| | | Dt_StockInfodt dt_ = new Dt_StockInfodt() |
| | | { |
| | | PalletCode= entities[i].PalletCode, |
| | | MaterialType = MaterialTypet, |
| | | LocationCode = entities[i].LocationCode, |
| | | Wlstatus = Wlstatust, |
| | | MaterielCode=dt_StockIndet.MaterielCode, |
| | | MaterielName = dt_StockIndet.MaterielName, |
| | | OrderNo = dt_StockIndet.OrderNo, |
| | | BatchNo = dt_StockIndet.BatchNo, |
| | | SerialNumber = dt_StockIndet.SerialNumber, |
| | | StockQuantity = dt_StockIndet.StockQuantity, |
| | | BatchNoName = dt_StockIndet.BatchNoName, |
| | | CreateDate = dt_StockIndet.CreateDate, |
| | | Remark = entities[i].Remark, |
| | | }; |
| | | stolist.Add(dt_); |
| | | } |
| | | |
| | | byte[] data = exporter.ExportAsByteArray(stolist).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_StockInfodt: Dt_StockInfoDetail |
| | | { |
| | | [ExporterHeader(DisplayName = "æçç¼å·")] |
| | | public string PalletCode { get; set; } |
| | | |
| | | [ExporterHeader(DisplayName = "ç±»å")] |
| | | public string MaterialType { get; set; } |
| | | |
| | | [ExporterHeader(DisplayName = "è´§ä½ç¼å·")] |
| | | public string LocationCode { get; set; } |
| | | |
| | | [ExporterHeader(DisplayName = "ç©æç¶æ")] |
| | | public string Wlstatus { get; set; } |
| | | } |
| | | } |
| | | } |