public virtual void UpdateRollingForecast(RollingForecast entity) { Update(entity); }
public IList<RollingForecast> ReadRollingForecastFromXls(Stream inputStream, User user) { if (inputStream.Length == 0) { throw new BusinessErrorException("Import.Stream.Empty"); } HSSFWorkbook workbook = new HSSFWorkbook(inputStream); Sheet sheet = workbook.GetSheetAt(0); IEnumerator rows = sheet.GetRowEnumerator(); ImportHelper.JumpRows(rows, 11); #region 列定义 int colSupplier = 1;//供应商代码 int colItem = 2;//物料代码 int colDate = 3;//日期 int colQty = 4;//数量 #endregion IList<RollingForecast> rollingForecastList = new List<RollingForecast>(); while (rows.MoveNext()) { Row row = (HSSFRow)rows.Current; if (!this.CheckValidDataRow(row, 1, 4)) { break;//边界 } string supplierCode = string.Empty; string itemCode = string.Empty; DateTime date = DateTime.Now; decimal qty = 0; #region 读取数据 #region 读取供应商和物料代码 supplierCode = row.GetCell(colSupplier) != null ? row.GetCell(colSupplier).StringCellValue : string.Empty; if (supplierCode == null || supplierCode.Trim() == string.Empty) this.ThrowCommonError(row.RowNum, colSupplier, row.GetCell(colSupplier)); itemCode = row.GetCell(colItem) != null ? row.GetCell(colItem).StringCellValue : string.Empty; if (itemCode == null || itemCode.Trim() == string.Empty) this.ThrowCommonError(row.RowNum, colItem, row.GetCell(colItem)); #endregion #region 读取日期和数量 try { date = Convert.ToDateTime(row.GetCell(colDate).StringCellValue); } catch { this.ThrowCommonError(row.RowNum, colDate, row.GetCell(colDate)); } try { qty = Convert.ToDecimal(row.GetCell(colQty).NumericCellValue); } catch { this.ThrowCommonError(row.RowNum, colQty, row.GetCell(colQty)); } #endregion #endregion #region 填充数据 Item item = itemMgr.CheckAndLoadItem(itemCode); Supplier supplier = supplierMgr.CheckAndLoadSupplier(supplierCode); if (date.DayOfWeek.ToString() != "Monday") { throw new BusinessErrorException("Date is not Monday", row.GetCell(colDate).ToString()); } RollingForecast rollingForecast = new RollingForecast(); rollingForecast.Supplier = supplier; rollingForecast.Item = item; rollingForecast.Qty = qty; rollingForecast.CreateDate = DateTime.Now; rollingForecast.Date = date; rollingForecast.CreateUser = user; rollingForecastList.Add(rollingForecast); #endregion } if (rollingForecastList.Count == 0) throw new BusinessErrorException("Import.Result.Error.ImportNothing"); return rollingForecastList; }
public virtual void DeleteRollingForecast(RollingForecast entity) { Delete(entity); }
public virtual void CreateRollingForecast(RollingForecast entity) { Create(entity); }
public virtual void UpdateRollingForecast(RollingForecast entity) { entityDao.UpdateRollingForecast(entity); }
public virtual void DeleteRollingForecast(RollingForecast entity) { entityDao.DeleteRollingForecast(entity); }
public virtual void CreateRollingForecast(RollingForecast entity) { entityDao.CreateRollingForecast(entity); }