自定义销售出库单下推其它应收单,写的单据转换插件手动下推没有报错,自动下推出错,出错信息如下:
代码如下:
//单据头往来单位赋值
//往来单位
string sql = string.Format(@"select a.FID from T_FIN_OTHERS_L a left outer join T_FIN_OTHERS b on b.FID=a.FID where b.FUSEORGID={1} and b.F_PS_JSFS ={0}", SETTLETYPEID2, SETTLEORGID2);
using (IDataReader dr = DBServiceHelper.ExecuteReader(this.Context, sql))
{
while (dr.Read())
{
//head.DataEntity["CONTACTUNIT_ID"] = Convert.ToInt64(dr[0]);
BaseDataField FCONTACTUNIT = e.TargetBusinessInfo.GetField("FCONTACTUNIT") as BaseDataField;
FieldUtils.SetBaseDataFieldValue(this.Context, FCONTACTUNIT, head.DataEntity, dr[0]);
break;
}
}