Open DigitalPlatform opened 1 year ago
某用户单位希望创建的索取号为以下形态
分类号/同类书区分号/出版年份
即,在一般的索取号后面增加第三行“出版年份”。
升级 dp2circulation 到最新版,定制“中文图书”的 dp2circulation_marc_autogen.cs 文件,增加下列函数即可:
public override string MergeLines(string strHeadLine, string strClass, string strQufenhao) { string text = base.MergeLines(strHeadLine, strClass, strQufenhao); string strMARC = this.DetailForm.MarcEditor.Marc; var record = new MarcRecord(strMARC); var publish_time = record.select("field[@name='210']/subfield[@name='d']").FirstContent; return text + "/" + GetYear(publish_time); string GetYear(string text) { if (string.IsNullOrEmpty(text)) return ""; int index = text.IndexOf("."); if (index == -1) return text; return text.Substring(0, index).Trim(); } }
定制的原理是,dp2circulation_marc_autogen.cs 代码内的 MyHost 类是从宿主程序的 DetailHost 类派生的一个类,MyHost 类中重载基类的 MergeLines() 函数,这个函数是用来在创建索取号最后一步合成多行的,只需要在基类的此函数合成的字符串基础上追加第三行内容即可。第三行内容是从书目记录 MARC 中取相应字段子字段得到的,用了 MarcQuery 函数来操作 MARC 记录。
某用户单位希望创建的索取号为以下形态
即,在一般的索取号后面增加第三行“出版年份”。
升级 dp2circulation 到最新版,定制“中文图书”的 dp2circulation_marc_autogen.cs 文件,增加下列函数即可:
定制的原理是,dp2circulation_marc_autogen.cs 代码内的 MyHost 类是从宿主程序的 DetailHost 类派生的一个类,MyHost 类中重载基类的 MergeLines() 函数,这个函数是用来在创建索取号最后一步合成多行的,只需要在基类的此函数合成的字符串基础上追加第三行内容即可。第三行内容是从书目记录 MARC 中取相应字段子字段得到的,用了 MarcQuery 函数来操作 MARC 记录。