Excel导入获取数据包行数错误
金蝶云社区-云社区用户5kC73565
云社区用户5kC73565
1人赞赏了该文章 1,073次浏览 未经作者许可,禁止转载编辑于2015年12月07日 18:31:37

Excel导入获取数据包行数错误

Excel导出有4行数据,导入获取数据包行数是3行,如果手工加一个空行,就可以获取4行

Excel导出是导出到单据提(标准单据体导出功能),导入是在单据上配置一个引入功能

public override void BeforeImportData(BeforeImportDataArgs e)
{
base.BeforeImportData(e);
if(e.DataSource.Tables.Count <=0)
return;
System.Data.DataTable dataTable = e.DataSource.Tables[0];
if (dataTable.Rows.Count <= 0)
return;
this.View.Model.ClearNoDataRow();
this.View.Model.BatchCreateNewEntryRow("FEntity", dataTable.Rows.Count);
for (int row = 0; row < dataTable.Rows.Count; row++)
{
this.View.Model.SetItemValueByNumber("F_Ho_MaterialId", dataTable.Rows[row].GetValue("物料编码"), row);
this.View.Model.SetItemValueByNumber("F_Ho_UnitId", dataTable.Rows[row].GetValue("单位代码"), row);
this.View.Model.SetItemValueByNumber("F_Ho_SupplyId", dataTable.Rows[row].GetValue("供应商代码"), row);
this.View.Model.SetItemValueByNumber("F_Ho_StockId", dataTable.Rows[row].GetValue("仓库代码"), row);
this.View.Model.SetValue("F_Ho_Date", dataTable.Rows[row].GetValue("交货日期(1)"), row);
this.View.Model.SetValue("F_Ho_Qty", dataTable.Rows[row].GetValue("交货数量(1)"), row);
this.View.Model.SetValue("F_Ho_Date1", dataTable.Rows[row].GetValue("交货日期(2)"), row);
this.View.Model.SetValue("F_Ho_Qty1", dataTable.Rows[row].GetValue("交货数量(2)"), row);
this.View.Model.SetValue("F_Ho_Date2", dataTable.Rows[row].GetValue("交货日期(3)"), row);
this.View.Model.SetValue("F_Ho_Qty2", dataTable.Rows[row].GetValue("交货数量(3)"), row);
this.View.Model.SetValue("F_Ho_Date3", dataTable.Rows[row].GetValue("交货日期(4)"), row);
this.View.Model.SetValue("F_Ho_Qty3", dataTable.Rows[row].GetValue("交货数量(4)"), row);
this.View.Model.SetValue("F_Ho_SupplyStockQty", dataTable.Rows[row].GetValue("供应商备库存数量"), row);
this.View.Model.SetValue("F_Ho_Memo", dataTable.Rows[row].GetValue("备注"), row);
}
this.View.Model.Save();
}