From 21ab1cde68e7c22431b2d3c8b21e7718f2e06e47 Mon Sep 17 00:00:00 2001 From: XieTao Date: Sat, 2 Jan 2016 01:45:29 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=80=9F=E9=98=85?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E5=BA=93=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DigitalPlatform.LibraryClient.csproj | 2 +- .../LibraryChannel.cs | 70 ++- ...yClient.localhost.CalenderInfo.datasource} | 4 +- ...t.localhost.ChargingItemWrapper.datasource | 10 + .../Service References/localhost/Reference.cs | 121 +++- .../localhost/metadata1.xsd | 2 +- .../localhost/metadata5.xsd | 17 +- DigitalPlatform.LibraryServer/AppReader.cs | 6 + .../LibraryApplication.cs | 3 +- .../MongoDb/BuildMongoOperDatabase.cs | 7 + .../MongoDb/ChargingOperDatabase.cs | 67 ++- .../MongoDb/MongoDatabase.cs | 9 + .../ILibraryService.cs | 2 +- .../ILibraryServiceREST.cs | 2 +- .../LibraryService.cs | 63 ++- .../OpacApplication.cs | 46 +- .../BiblioSearchControl.cs | 5 +- .../BorrowHistoryControl.cs | 527 +++++++++--------- DigitalPlatform.OPAC.Web/FooterBarControl.cs | 10 +- .../res/BorrowHistoryControl.cs.en-US.resx | 10 +- .../res/BorrowHistoryControl.cs.zh-CN.resx | 10 +- ZipUtil.exe | Bin 9216 -> 9216 bytes .../Charging/ChargingForm.Designer.cs | 56 +- dp2Circulation/Charging/ChargingForm.cs | 14 +- dp2Circulation/Charging/ChargingForm.resx | 53 +- dp2Circulation/Entity/GenerateData.cs | 3 +- .../ItemInfoForm/ItemInfoForm.Designer.cs | 51 +- dp2Circulation/ItemInfoForm/ItemInfoForm.cs | 448 +++++++++++++-- dp2Circulation/ItemInfoForm/ItemInfoForm.resx | 23 +- dp2Circulation/Order/PrintClaimForm.cs | 132 ++--- dp2Circulation/Reader/ChargingHistoryHost.cs | 29 - .../Reader/ReaderInfoForm.Designer.cs | 47 +- dp2Circulation/Reader/ReaderInfoForm.cs | 301 ++++++++-- dp2Circulation/Reader/ReaderInfoForm.resx | 176 +++--- dp2Circulation/dp2Circulation.csproj | 1 - dp2Circulation/userrightsdef.xml | 5 +- dp2HotPoint/ZConnection.cs | 14 + dp2Installer/dp2Installer.csproj | 2 +- dp2Installer/opac_app/BorrowInfo.aspx.cs | 3 + dp2LibraryXE/opac_app/BorrowInfo.aspx.cs | 3 + dp2OPAC/BorrowInfo.aspx.cs | 3 + 41 files changed, 1623 insertions(+), 734 deletions(-) rename DigitalPlatform.LibraryClient/Service References/localhost/{DigitalPlatform.LibraryClient.localhost.ChargingItem.datasource => DigitalPlatform.LibraryClient.localhost.CalenderInfo.datasource} (70%) create mode 100644 DigitalPlatform.LibraryClient/Service References/localhost/DigitalPlatform.LibraryClient.localhost.ChargingItemWrapper.datasource delete mode 100644 dp2Circulation/Reader/ChargingHistoryHost.cs create mode 100644 dp2HotPoint/ZConnection.cs diff --git a/DigitalPlatform.LibraryClient/DigitalPlatform.LibraryClient.csproj b/DigitalPlatform.LibraryClient/DigitalPlatform.LibraryClient.csproj index 8a6bf94c4..9f67ed79a 100644 --- a/DigitalPlatform.LibraryClient/DigitalPlatform.LibraryClient.csproj +++ b/DigitalPlatform.LibraryClient/DigitalPlatform.LibraryClient.csproj @@ -80,7 +80,7 @@ Reference.svcmap - + Reference.svcmap diff --git a/DigitalPlatform.LibraryClient/LibraryChannel.cs b/DigitalPlatform.LibraryClient/LibraryChannel.cs index 4fea62a6e..fc5cb37d3 100644 --- a/DigitalPlatform.LibraryClient/LibraryChannel.cs +++ b/DigitalPlatform.LibraryClient/LibraryChannel.cs @@ -9269,7 +9269,7 @@ public long SearchCharging( string order, long start, long count, - out ChargingItem[] results, + out ChargingItemWrapper[] results, out string strError) { strError = ""; @@ -9330,6 +9330,74 @@ public long SearchCharging( } } + // 获得借阅历史 + // parameters: + // nPageNo 页号 + // nItemsPerPage 每页的事项个数。如果为 -1,表示希望从头获取全部内容 + // return: + // -1 出错 + // 其它 符合条件的事项总数 + public long LoadBorrowHistory( + DigitalPlatform.Stop stop, + string strBarcode, + int nPageNo, + int nItemsPerPage, + out List results, + out string strError) + { + strError = ""; + results = new List(); + + long lHitCount = 0; + + long lLength = 0; + long lStart = 0; + if (nItemsPerPage == -1) + lLength = -1; + else + { + lStart = nPageNo * nItemsPerPage; + lLength = nItemsPerPage; + } + int nGeted = 0; + for (; ; ) + { + ChargingItemWrapper[] temp_results = null; + long lRet = this.SearchCharging( + stop, + strBarcode, + "~", + "return,lost", + "descending", + lStart + nGeted, + lLength, + out temp_results, + out strError); + if (lRet == -1) + return -1; + lHitCount = lRet; + if (temp_results == null || temp_results.Length == 0) + break; + results.AddRange(temp_results); + + // 修正 lLength + if (lLength != -1 && lHitCount < lStart + nGeted + lLength) + lLength -= lStart + nGeted + lLength - lHitCount; + + if (results.Count >= lHitCount - lStart) + break; + + nGeted += temp_results.Length; + if (lLength != -1) + lLength -= temp_results.Length; + + if (lLength <= 0 && lLength != -1) + break; + } + + return lHitCount; + } + public void DoStop() { // 2015/7/30 增加捕获异常语句 diff --git a/DigitalPlatform.LibraryClient/Service References/localhost/DigitalPlatform.LibraryClient.localhost.ChargingItem.datasource b/DigitalPlatform.LibraryClient/Service References/localhost/DigitalPlatform.LibraryClient.localhost.CalenderInfo.datasource similarity index 70% rename from DigitalPlatform.LibraryClient/Service References/localhost/DigitalPlatform.LibraryClient.localhost.ChargingItem.datasource rename to DigitalPlatform.LibraryClient/Service References/localhost/DigitalPlatform.LibraryClient.localhost.CalenderInfo.datasource index e1a2bb2a9..8869d45f3 100644 --- a/DigitalPlatform.LibraryClient/Service References/localhost/DigitalPlatform.LibraryClient.localhost.ChargingItem.datasource +++ b/DigitalPlatform.LibraryClient/Service References/localhost/DigitalPlatform.LibraryClient.localhost.CalenderInfo.datasource @@ -5,6 +5,6 @@ Renaming the file extension or editing the content of this file may cause the file to be unrecognizable by the program. --> - - DigitalPlatform.LibraryClient.localhost.ChargingItem, Service References.localhost.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + DigitalPlatform.LibraryClient.localhost.CalenderInfo, Service References.localhost.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null \ No newline at end of file diff --git a/DigitalPlatform.LibraryClient/Service References/localhost/DigitalPlatform.LibraryClient.localhost.ChargingItemWrapper.datasource b/DigitalPlatform.LibraryClient/Service References/localhost/DigitalPlatform.LibraryClient.localhost.ChargingItemWrapper.datasource new file mode 100644 index 000000000..3da5df065 --- /dev/null +++ b/DigitalPlatform.LibraryClient/Service References/localhost/DigitalPlatform.LibraryClient.localhost.ChargingItemWrapper.datasource @@ -0,0 +1,10 @@ + + + + DigitalPlatform.LibraryClient.localhost.ChargingItemWrapper, Service References.localhost.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/DigitalPlatform.LibraryClient/Service References/localhost/Reference.cs b/DigitalPlatform.LibraryClient/Service References/localhost/Reference.cs index 575231cc9..7ddc057e7 100644 --- a/DigitalPlatform.LibraryClient/Service References/localhost/Reference.cs +++ b/DigitalPlatform.LibraryClient/Service References/localhost/Reference.cs @@ -989,6 +989,67 @@ protected void RaisePropertyChanged(string propertyName) { } } + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] + [System.Runtime.Serialization.DataContractAttribute(Name="ChargingItemWrapper", Namespace="http://dp2003.com/dp2library/")] + [System.SerializableAttribute()] + public partial class ChargingItemWrapper : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { + + [System.NonSerializedAttribute()] + private System.Runtime.Serialization.ExtensionDataObject extensionDataField; + + [System.Runtime.Serialization.OptionalFieldAttribute()] + private DigitalPlatform.LibraryClient.localhost.ChargingItem ItemField; + + [System.Runtime.Serialization.OptionalFieldAttribute()] + private DigitalPlatform.LibraryClient.localhost.ChargingItem RelatedItemField; + + [global::System.ComponentModel.BrowsableAttribute(false)] + public System.Runtime.Serialization.ExtensionDataObject ExtensionData { + get { + return this.extensionDataField; + } + set { + this.extensionDataField = value; + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public DigitalPlatform.LibraryClient.localhost.ChargingItem Item { + get { + return this.ItemField; + } + set { + if ((object.ReferenceEquals(this.ItemField, value) != true)) { + this.ItemField = value; + this.RaisePropertyChanged("Item"); + } + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public DigitalPlatform.LibraryClient.localhost.ChargingItem RelatedItem { + get { + return this.RelatedItemField; + } + set { + if ((object.ReferenceEquals(this.RelatedItemField, value) != true)) { + this.RelatedItemField = value; + this.RaisePropertyChanged("RelatedItem"); + } + } + } + + public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; + + protected void RaisePropertyChanged(string propertyName) { + System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; + if ((propertyChanged != null)) { + propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); + } + } + } + [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] [System.Runtime.Serialization.DataContractAttribute(Name="ChargingItem", Namespace="http://dp2003.com/dp2library/")] @@ -1013,6 +1074,9 @@ public partial class ChargingItem : object, System.Runtime.Serialization.IExtens [System.Runtime.Serialization.OptionalFieldAttribute()] private string LibraryCodeField; + [System.Runtime.Serialization.OptionalFieldAttribute()] + private string NoField; + [System.Runtime.Serialization.OptionalFieldAttribute()] private string OperTimeField; @@ -1025,6 +1089,9 @@ public partial class ChargingItem : object, System.Runtime.Serialization.IExtens [System.Runtime.Serialization.OptionalFieldAttribute()] private string PatronBarcodeField; + [System.Runtime.Serialization.OptionalFieldAttribute()] + private string PeriodField; + [global::System.ComponentModel.BrowsableAttribute(false)] public System.Runtime.Serialization.ExtensionDataObject ExtensionData { get { @@ -1100,6 +1167,19 @@ public string LibraryCode { } } + [System.Runtime.Serialization.DataMemberAttribute()] + public string No { + get { + return this.NoField; + } + set { + if ((object.ReferenceEquals(this.NoField, value) != true)) { + this.NoField = value; + this.RaisePropertyChanged("No"); + } + } + } + [System.Runtime.Serialization.DataMemberAttribute()] public string OperTime { get { @@ -1152,6 +1232,19 @@ public string PatronBarcode { } } + [System.Runtime.Serialization.DataMemberAttribute()] + public string Period { + get { + return this.PeriodField; + } + set { + if ((object.ReferenceEquals(this.PeriodField, value) != true)) { + this.PeriodField = value; + this.RaisePropertyChanged("Period"); + } + } + } + public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; protected void RaisePropertyChanged(string propertyName) { @@ -3145,12 +3238,12 @@ public interface dp2libraryREST { DigitalPlatform.LibraryClient.localhost.LibraryServerResult EndHitCounter(out long Value, System.IAsyncResult result); [System.ServiceModel.OperationContractAttribute(Action="http://dp2003.com/dp2library/rest/dp2libraryREST/SearchCharging", ReplyAction="http://dp2003.com/dp2library/rest/dp2libraryREST/SearchChargingResponse")] - DigitalPlatform.LibraryClient.localhost.LibraryServerResult SearchCharging(out DigitalPlatform.LibraryClient.localhost.ChargingItem[] results, string patronBarcode, string timeRange, string actions, string order, long start, long count); + DigitalPlatform.LibraryClient.localhost.LibraryServerResult SearchCharging(out DigitalPlatform.LibraryClient.localhost.ChargingItemWrapper[] results, string patronBarcode, string timeRange, string actions, string order, long start, long count); [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://dp2003.com/dp2library/rest/dp2libraryREST/SearchCharging", ReplyAction="http://dp2003.com/dp2library/rest/dp2libraryREST/SearchChargingResponse")] System.IAsyncResult BeginSearchCharging(string patronBarcode, string timeRange, string actions, string order, long start, long count, System.AsyncCallback callback, object asyncState); - DigitalPlatform.LibraryClient.localhost.LibraryServerResult EndSearchCharging(out DigitalPlatform.LibraryClient.localhost.ChargingItem[] results, System.IAsyncResult result); + DigitalPlatform.LibraryClient.localhost.LibraryServerResult EndSearchCharging(out DigitalPlatform.LibraryClient.localhost.ChargingItemWrapper[] results, System.IAsyncResult result); [System.ServiceModel.OperationContractAttribute(Action="http://dp2003.com/dp2library/rest/dp2libraryREST/GetVersion", ReplyAction="http://dp2003.com/dp2library/rest/dp2libraryREST/GetVersionResponse")] DigitalPlatform.LibraryClient.localhost.LibraryServerResult GetVersion(out string uid); @@ -4224,10 +4317,10 @@ public SearchChargingCompletedEventArgs(object[] results, System.Exception excep this.results1 = results; } - public DigitalPlatform.LibraryClient.localhost.ChargingItem[] results { + public DigitalPlatform.LibraryClient.localhost.ChargingItemWrapper[] results { get { base.RaiseExceptionIfNecessary(); - return ((DigitalPlatform.LibraryClient.localhost.ChargingItem[])(this.results1[0])); + return ((DigitalPlatform.LibraryClient.localhost.ChargingItemWrapper[])(this.results1[0])); } } @@ -8119,7 +8212,7 @@ public void HitCounterAsync(string strAction, string strName, string strClientAd strClientAddress}, this.onEndHitCounterDelegate, this.onHitCounterCompletedDelegate, userState); } - public DigitalPlatform.LibraryClient.localhost.LibraryServerResult SearchCharging(out DigitalPlatform.LibraryClient.localhost.ChargingItem[] results, string patronBarcode, string timeRange, string actions, string order, long start, long count) { + public DigitalPlatform.LibraryClient.localhost.LibraryServerResult SearchCharging(out DigitalPlatform.LibraryClient.localhost.ChargingItemWrapper[] results, string patronBarcode, string timeRange, string actions, string order, long start, long count) { return base.Channel.SearchCharging(out results, patronBarcode, timeRange, actions, order, start, count); } @@ -8129,7 +8222,7 @@ public System.IAsyncResult BeginSearchCharging(string patronBarcode, string time } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] - public DigitalPlatform.LibraryClient.localhost.LibraryServerResult EndSearchCharging(out DigitalPlatform.LibraryClient.localhost.ChargingItem[] results, System.IAsyncResult result) { + public DigitalPlatform.LibraryClient.localhost.LibraryServerResult EndSearchCharging(out DigitalPlatform.LibraryClient.localhost.ChargingItemWrapper[] results, System.IAsyncResult result) { return base.Channel.EndSearchCharging(out results, result); } @@ -8144,7 +8237,7 @@ private System.IAsyncResult OnBeginSearchCharging(object[] inValues, System.Asyn } private object[] OnEndSearchCharging(System.IAsyncResult result) { - DigitalPlatform.LibraryClient.localhost.ChargingItem[] results = this.GetDefaultValueForInitialization(); + DigitalPlatform.LibraryClient.localhost.ChargingItemWrapper[] results = this.GetDefaultValueForInitialization(); DigitalPlatform.LibraryClient.localhost.LibraryServerResult retVal = this.EndSearchCharging(out results, result); return new object[] { results, @@ -13230,12 +13323,12 @@ public interface dp2library { DigitalPlatform.LibraryClient.localhost.LibraryServerResult EndHitCounter(out long Value, System.IAsyncResult result); [System.ServiceModel.OperationContractAttribute(Action="http://dp2003.com/dp2library/dp2library/SearchCharging", ReplyAction="http://dp2003.com/dp2library/dp2library/SearchChargingResponse")] - DigitalPlatform.LibraryClient.localhost.LibraryServerResult SearchCharging(out DigitalPlatform.LibraryClient.localhost.ChargingItem[] results, string patronBarcode, string timeRange, string actions, string order, long start, long count); + DigitalPlatform.LibraryClient.localhost.LibraryServerResult SearchCharging(out DigitalPlatform.LibraryClient.localhost.ChargingItemWrapper[] results, string patronBarcode, string timeRange, string actions, string order, long start, long count); [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://dp2003.com/dp2library/dp2library/SearchCharging", ReplyAction="http://dp2003.com/dp2library/dp2library/SearchChargingResponse")] System.IAsyncResult BeginSearchCharging(string patronBarcode, string timeRange, string actions, string order, long start, long count, System.AsyncCallback callback, object asyncState); - DigitalPlatform.LibraryClient.localhost.LibraryServerResult EndSearchCharging(out DigitalPlatform.LibraryClient.localhost.ChargingItem[] results, System.IAsyncResult result); + DigitalPlatform.LibraryClient.localhost.LibraryServerResult EndSearchCharging(out DigitalPlatform.LibraryClient.localhost.ChargingItemWrapper[] results, System.IAsyncResult result); [System.ServiceModel.OperationContractAttribute(Action="http://dp2003.com/dp2library/dp2library/GetVersion", ReplyAction="http://dp2003.com/dp2library/dp2library/GetVersionResponse")] DigitalPlatform.LibraryClient.localhost.LibraryServerResult GetVersion(out string uid); @@ -14303,10 +14396,10 @@ public SearchChargingCompletedEventArgs1(object[] results, System.Exception exce this.results1 = results; } - public DigitalPlatform.LibraryClient.localhost.ChargingItem[] results { + public DigitalPlatform.LibraryClient.localhost.ChargingItemWrapper[] results { get { base.RaiseExceptionIfNecessary(); - return ((DigitalPlatform.LibraryClient.localhost.ChargingItem[])(this.results1[0])); + return ((DigitalPlatform.LibraryClient.localhost.ChargingItemWrapper[])(this.results1[0])); } } @@ -18198,7 +18291,7 @@ public void HitCounterAsync(string strAction, string strName, string strClientAd strClientAddress}, this.onEndHitCounterDelegate, this.onHitCounterCompletedDelegate, userState); } - public DigitalPlatform.LibraryClient.localhost.LibraryServerResult SearchCharging(out DigitalPlatform.LibraryClient.localhost.ChargingItem[] results, string patronBarcode, string timeRange, string actions, string order, long start, long count) { + public DigitalPlatform.LibraryClient.localhost.LibraryServerResult SearchCharging(out DigitalPlatform.LibraryClient.localhost.ChargingItemWrapper[] results, string patronBarcode, string timeRange, string actions, string order, long start, long count) { return base.Channel.SearchCharging(out results, patronBarcode, timeRange, actions, order, start, count); } @@ -18208,7 +18301,7 @@ public System.IAsyncResult BeginSearchCharging(string patronBarcode, string time } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] - public DigitalPlatform.LibraryClient.localhost.LibraryServerResult EndSearchCharging(out DigitalPlatform.LibraryClient.localhost.ChargingItem[] results, System.IAsyncResult result) { + public DigitalPlatform.LibraryClient.localhost.LibraryServerResult EndSearchCharging(out DigitalPlatform.LibraryClient.localhost.ChargingItemWrapper[] results, System.IAsyncResult result) { return base.Channel.EndSearchCharging(out results, result); } @@ -18223,7 +18316,7 @@ private System.IAsyncResult OnBeginSearchCharging(object[] inValues, System.Asyn } private object[] OnEndSearchCharging(System.IAsyncResult result) { - DigitalPlatform.LibraryClient.localhost.ChargingItem[] results = this.GetDefaultValueForInitialization(); + DigitalPlatform.LibraryClient.localhost.ChargingItemWrapper[] results = this.GetDefaultValueForInitialization(); DigitalPlatform.LibraryClient.localhost.LibraryServerResult retVal = this.EndSearchCharging(out results, result); return new object[] { results, diff --git a/DigitalPlatform.LibraryClient/Service References/localhost/metadata1.xsd b/DigitalPlatform.LibraryClient/Service References/localhost/metadata1.xsd index 75b4d29c5..ce80ccf0a 100644 --- a/DigitalPlatform.LibraryClient/Service References/localhost/metadata1.xsd +++ b/DigitalPlatform.LibraryClient/Service References/localhost/metadata1.xsd @@ -238,7 +238,7 @@ - + diff --git a/DigitalPlatform.LibraryClient/Service References/localhost/metadata5.xsd b/DigitalPlatform.LibraryClient/Service References/localhost/metadata5.xsd index 35a6ef818..625f6303d 100644 --- a/DigitalPlatform.LibraryClient/Service References/localhost/metadata5.xsd +++ b/DigitalPlatform.LibraryClient/Service References/localhost/metadata5.xsd @@ -328,16 +328,23 @@ - + - + - + - + + + + + + + + @@ -345,10 +352,12 @@ + + diff --git a/DigitalPlatform.LibraryServer/AppReader.cs b/DigitalPlatform.LibraryServer/AppReader.cs index 782674c3f..19365f87e 100644 --- a/DigitalPlatform.LibraryServer/AppReader.cs +++ b/DigitalPlatform.LibraryServer/AppReader.cs @@ -4022,6 +4022,12 @@ int BuildReaderResults( strError = ""; int nRet = 0; + if (string.IsNullOrEmpty(strResultTypeList) == true) + { + results = new string[0]; + return 0; + } + string[] result_types = strResultTypeList.Split(new char[] { ',' }); results = new string[result_types.Length]; diff --git a/DigitalPlatform.LibraryServer/LibraryApplication.cs b/DigitalPlatform.LibraryServer/LibraryApplication.cs index 5fdc8aa67..165a78e2c 100644 --- a/DigitalPlatform.LibraryServer/LibraryApplication.cs +++ b/DigitalPlatform.LibraryServer/LibraryApplication.cs @@ -105,7 +105,8 @@ public partial class LibraryApplication : IDisposable // 2.62 (2015/12/11) Login() API 增加了检查前端最低版本号的功能。如果用户权限中有 checkclientversion,就进行这项检查 // 2.63 (2015/12/12) Return() API,对于超期违约金因子为空的情况,现在不当作出错处理。这种情况交费信息不会写入读者记录的交费信息字段,但会进入操作日志中(便于以后进行统计)。 // 2.64 (2015/12/27) 借书和还书操作信息会自动写入 mongodb 的日志库。增加后台任务 "创建 MongoDB 日志库" - public static string Version = "2.64"; + // 2.65 (2016/1/1) GetSystemParameters() API 增加 circulation/chargingOperDatabase。 + public static string Version = "2.65"; #if NO int m_nRefCount = 0; public int AddRef() diff --git a/DigitalPlatform.LibraryServer/MongoDb/BuildMongoOperDatabase.cs b/DigitalPlatform.LibraryServer/MongoDb/BuildMongoOperDatabase.cs index 48b2bd076..1ba989974 100644 --- a/DigitalPlatform.LibraryServer/MongoDb/BuildMongoOperDatabase.cs +++ b/DigitalPlatform.LibraryServer/MongoDb/BuildMongoOperDatabase.cs @@ -399,6 +399,13 @@ public static int AppendOperationBorrowReturn( "itemBarcode"); item.PatronBarcode = DomUtil.GetElementText(domOperLog.DocumentElement, "readerBarcode"); + if (strOperation == "borrow") + { + item.Period = DomUtil.GetElementText(domOperLog.DocumentElement, + "borrowPeriod"); + item.No = DomUtil.GetElementText(domOperLog.DocumentElement, + "no"); + } item.ClientAddress = DomUtil.GetElementText(domOperLog.DocumentElement, "clientAddress"); item.Operator = DomUtil.GetElementText(domOperLog.DocumentElement, diff --git a/DigitalPlatform.LibraryServer/MongoDb/ChargingOperDatabase.cs b/DigitalPlatform.LibraryServer/MongoDb/ChargingOperDatabase.cs index 4bb65c0a4..32b8597ab 100644 --- a/DigitalPlatform.LibraryServer/MongoDb/ChargingOperDatabase.cs +++ b/DigitalPlatform.LibraryServer/MongoDb/ChargingOperDatabase.cs @@ -23,14 +23,13 @@ public ChargingOperDatabase() public override void CreateIndex() { _collection.CreateIndex(new IndexKeysBuilder().Ascending("OperTime"), - IndexOptions.SetUnique(false)); + IndexOptions.SetUnique(false)); _collection.CreateIndex(new IndexKeysBuilder().Ascending("ItemBarcode"), -IndexOptions.SetUnique(false)); + IndexOptions.SetUnique(false)); _collection.CreateIndex(new IndexKeysBuilder().Ascending("PatronBarcode"), -IndexOptions.SetUnique(false)); - + IndexOptions.SetUnique(false)); } // parameters: @@ -54,7 +53,8 @@ public enum ChargingActionType Lost = 0x10, // 丢失声明 } #endif - + // parameters: + // patronBarcode 读者证条码号。如果 以 "@itemBarcode:" 前缀引导,表示这是册条码号 public IMongoQuery BuildQuery( string patronBarcode, DateTime startTime, @@ -71,10 +71,21 @@ public IMongoQuery BuildQuery( else if (endTime == new DateTime(0)) time_query = Query.GTE("OperTime", startTime); - var patron_query = Query.EQ("PatronBarcode", patronBarcode); + string itemBarcodePrefix = "@itemBarcode:"; + string itemRefIdPrefix = "@itemRefID:"; + + IMongoQuery patron_query = null; + if (patronBarcode != null + && patronBarcode.StartsWith(itemBarcodePrefix) == true) + patron_query = Query.EQ("ItemBarcode", patronBarcode.Substring(itemBarcodePrefix.Length)); + else if (patronBarcode != null + && patronBarcode.StartsWith(itemRefIdPrefix) == true) + patron_query = Query.EQ("ItemBarcode", "@refID:" + patronBarcode.Substring(itemRefIdPrefix.Length)); + else + patron_query = Query.EQ("PatronBarcode", patronBarcode); List action_items = new List(); - string[] types = operTypes.Split(new char[] {','}); + string[] types = operTypes.Split(new char[] { ',' }); foreach (string type in types) { if (type == "borrow") @@ -87,12 +98,49 @@ public IMongoQuery BuildQuery( action_items.Add(Query.EQ("Action", "lost")); } - var type_query = Query.And(Query.Or(Query.EQ("Operation", "borrow"), Query.EQ("Operation","return")), + var type_query = Query.And(Query.Or(Query.EQ("Operation", "borrow"), Query.EQ("Operation", "return")), Query.Or(action_items)); return Query.And(patron_query, time_query, type_query); } +#if NO + static IMongoQuery _rel_type_query = null; // 存储起来,避免每次创建的消耗 + if (_rel_type_query == null) + { + List action_items = new List(); + { + action_items.Add(Query.EQ("Action", "return")); + action_items.Add(Query.EQ("Action", "renew")); + action_items.Add(Query.EQ("Action", "lost")); + } + + _rel_type_query = Query.And(Query.Or(Query.EQ("Operation", "borrow"), Query.EQ("Operation", "return")), + Query.Or(action_items)); + } +#endif + + // 查找和本还书 item 关联的的借书操作 item + public ChargingOperItem FindRelativeBorrowItem(ChargingOperItem return_item) + { + MongoCollection collection = this._collection; + if (collection == null) + return null; + + var query = Query.And( + Query.And(Query.EQ("Operation", "borrow"), Query.EQ("Action", "borrow")), + Query.EQ("PatronBarcode", return_item.PatronBarcode), + Query.EQ("ItemBarcode", return_item.ItemBarcode), + Query.LTE("OperTime", return_item.OperTime)); + // 获得最近的一个 borrow item + MongoCursor cursor = collection.Find(query).SetSortOrder(SortBy.Descending("OperTime")).SetLimit(1); + foreach (ChargingOperItem item in cursor.Take(1)) + { + return item; + } + return null; + } + // parameters: // order 排序方式。ascending/descending 之一。默认 ascending public IEnumerable Find( @@ -163,6 +211,9 @@ public class ChargingOperItem public string ItemBarcode { get; set; } public string PatronBarcode { get; set; } + public string Period { get; set; } // 期限 + public string No { get; set; } // 续借次,序号 + public string ClientAddress { get; set; } // 访问者的IP地址 public string Operator { get; set; } // 操作者(访问者) diff --git a/DigitalPlatform.LibraryServer/MongoDb/MongoDatabase.cs b/DigitalPlatform.LibraryServer/MongoDb/MongoDatabase.cs index 9a757a13b..b95fb2679 100644 --- a/DigitalPlatform.LibraryServer/MongoDb/MongoDatabase.cs +++ b/DigitalPlatform.LibraryServer/MongoDb/MongoDatabase.cs @@ -17,6 +17,15 @@ public class MongoDatabase internal MongoCollection _collection = null; internal string _collectionName = "collection"; + // 数据库是否已经启用 + public bool Enabled + { + get + { + return this._collection != null; + } + } + public string CollectionName { get diff --git a/DigitalPlatform.LibraryService/ILibraryService.cs b/DigitalPlatform.LibraryService/ILibraryService.cs index 1647264a1..46a195dd0 100644 --- a/DigitalPlatform.LibraryService/ILibraryService.cs +++ b/DigitalPlatform.LibraryService/ILibraryService.cs @@ -797,6 +797,6 @@ LibraryServerResult SearchCharging( string order, long start, long count, - out ChargingItem[] results); + out ChargingItemWrapper[] results); } } diff --git a/DigitalPlatform.LibraryService/ILibraryServiceREST.cs b/DigitalPlatform.LibraryService/ILibraryServiceREST.cs index ee390d7d6..6039f45a8 100644 --- a/DigitalPlatform.LibraryService/ILibraryServiceREST.cs +++ b/DigitalPlatform.LibraryService/ILibraryServiceREST.cs @@ -817,6 +817,6 @@ LibraryServerResult SearchCharging( string order, long start, long count, - out ChargingItem[] results); + out ChargingItemWrapper[] results); } } diff --git a/DigitalPlatform.LibraryService/LibraryService.cs b/DigitalPlatform.LibraryService/LibraryService.cs index beb5b2124..ac2fa703e 100644 --- a/DigitalPlatform.LibraryService/LibraryService.cs +++ b/DigitalPlatform.LibraryService/LibraryService.cs @@ -1932,7 +1932,7 @@ public LibraryServerResult SearchCharging( string order, long start, long count, - out ChargingItem[] results) + out ChargingItemWrapper[] results) { results = null; @@ -1980,18 +1980,36 @@ public LibraryServerResult SearchCharging( out totalCount); if (collection == null) { - strError = "Find() error"; - goto ERROR1; + strError = "ChargingOperDatabase 尚未启用"; + result.Value = -1; + result.ErrorInfo = strError; + result.ErrorCode = ErrorCode.NotFound; + return result; + } + if (count == 0) + { + result.Value = totalCount; + return result; } - List infos = new List(); + int MAXITEMS = 100; // 每次最多返回的事项数 + List infos = new List(); long i = 0; foreach (ChargingOperItem item in collection) { + if (i >= MAXITEMS) + break; if (count != -1 && i >= count) break; - ChargingItem info = new ChargingItem(item); - infos.Add(info); + ChargingItemWrapper wrapper = new ChargingItemWrapper(); + wrapper.Item = new ChargingItem(item); + if (item.Operation == "return") + { + ChargingOperItem rel = app.ChargingOperDatabase.FindRelativeBorrowItem(item); + if (rel != null) + wrapper.RelatedItem = new ChargingItem(rel); + } + infos.Add(wrapper); i++; } @@ -9633,7 +9651,6 @@ public LibraryServerResult GetSystemParameter( goto END1; } - // 获得元素下级XML if (strName == "browseformats") { @@ -9672,6 +9689,17 @@ public LibraryServerResult GetSystemParameter( if (strCategory == "circulation") { + // 2016/1/1 + if (strName == "chargingOperDatabase") + { + if (app.ChargingOperDatabase.Enabled == true) + strValue = "enabled"; + else + strValue = ""; + nRet = 1; + goto END1; + } + // 元素内容 // strValue中是OuterXml定义。 if (strName == "clientFineInterface") @@ -14282,6 +14310,18 @@ public LibraryServerResult HitCounter(string strAction, } } + [DataContract(Namespace = "http://dp2003.com/dp2library/")] + public class ChargingItemWrapper + { + // 基本 Item + [DataMember] + public ChargingItem Item { get; set; } + + // 相关的 Item。比如一个 return 动作的 item 就可能具有一个 borrow 动作的 item + [DataMember] + public ChargingItem RelatedItem { get; set; } + } + [DataContract(Namespace = "http://dp2003.com/dp2library/")] public class ChargingItem { @@ -14300,6 +14340,11 @@ public class ChargingItem [DataMember] public string PatronBarcode { get; set; } + [DataMember] + public string Period { get; set; } // 期限 + [DataMember] + public string No { get; set; } // 续借次,序号 + [DataMember] public string ClientAddress { get; set; } // 访问者的IP地址 @@ -14316,9 +14361,11 @@ public ChargingItem(ChargingOperItem item) this.Action = item.Action; this.ItemBarcode = item.ItemBarcode; this.PatronBarcode = item.PatronBarcode; + this.Period = item.Period; + this.No = item.No; this.ClientAddress = item.ClientAddress; this.Operator = item.Operator; - this.OperTime = item.OperTime.ToString("g"); + this.OperTime = item.OperTime.ToString("G"); } } diff --git a/DigitalPlatform.OPAC.Server/OpacApplication.cs b/DigitalPlatform.OPAC.Server/OpacApplication.cs index 7ec85c8f5..b54422038 100644 --- a/DigitalPlatform.OPAC.Server/OpacApplication.cs +++ b/DigitalPlatform.OPAC.Server/OpacApplication.cs @@ -44,6 +44,15 @@ public string SearchLogEnable set; } + /// + /// 借还历史数据库类型。空表示没有启用。其他表示启用了,例如 enabled + /// + public string ChargingHistoryType + { + get; + set; + } + public LibraryChannelPool ChannelPool = new LibraryChannelPool(); public double dp2LibraryVersion = 0; @@ -599,6 +608,15 @@ public int Load( } +#if NO + // chargingHistory + XmlElement nodeCharingHistory = this.OpacCfgDom.DocumentElement.SelectSingleNode("chargingHistory") as XmlElement; + if (nodeCharingHistory != null) + { + this.ChargingHistoryType = nodeCharingHistory.GetAttribute("type"); + } +#endif + // searchLog XmlElement nodeSearchLog = this.OpacCfgDom.DocumentElement.SelectSingleNode("searchLog") as XmlElement; if (nodeSearchLog != null) @@ -1257,6 +1275,17 @@ public int GetXmlDefs( } } + string strValue = ""; + lRet = session.Channel.GetSystemParameter( + null, + "circulation", + "chargingOperDatabase", + out strValue, + out strError); + if (strValue == "enabled") + this.ChargingHistoryType = strValue; + else + this.ChargingHistoryType = ""; // 获取虚拟库定义 string strXml = ""; @@ -1303,7 +1332,6 @@ public int GetXmlDefs( if (bOuputDebugInfo == true) strDebugInfo += "*** system/arrived:\r\n" + strXml + "\r\n"; - XmlNode node_arrived = this.OpacCfgDom.DocumentElement.SelectSingleNode("arrived"); if (node_arrived == null) { @@ -1314,7 +1342,6 @@ public int GetXmlDefs( node_arrived = DomUtil.SetElementOuterXml(node_arrived, strXml); Debug.Assert(node_arrived != null, ""); - // 获取定义 lRet = session.Channel.GetSystemParameter( null, @@ -1341,7 +1368,6 @@ public int GetXmlDefs( node_browseformats.InnerXml = strXml; - // 获取定义 lRet = session.Channel.GetSystemParameter( null, @@ -1359,7 +1385,6 @@ public int GetXmlDefs( if (bOuputDebugInfo == true) strDebugInfo += "*** system/biblioDbGroup:\r\n" + strXml + "\r\n"; - XmlNode node_biblioDbGroup = this.OpacCfgDom.DocumentElement.SelectSingleNode("biblioDbGroup"); if (node_biblioDbGroup == null) { @@ -1390,7 +1415,6 @@ public int GetXmlDefs( if (bOuputDebugInfo == true) strDebugInfo += "*** system/readerDbGroup:\r\n" + strXml + "\r\n"; - XmlNode node_readerDbGroup = this.OpacCfgDom.DocumentElement.SelectSingleNode("readerDbGroup"); if (node_readerDbGroup == null) { @@ -1883,6 +1907,15 @@ public void Save(string strFileName, node.WriteTo(writer); } +#if NO + // + node = this.OpacCfgDom.DocumentElement.SelectSingleNode("chargingHistory"); + if (node != null) + { + node.WriteTo(writer); + } +#endif + // node = this.OpacCfgDom.DocumentElement.SelectSingleNode("searchLog"); if (node != null) @@ -2798,8 +2831,9 @@ public string GetString(string strID) // 语言相关的最新版本 public string GetDisplayTimePeriodStringEx(string strText) { + if (string.IsNullOrEmpty(strText) == true) + return ""; strText = strText.Replace("day", this.GetString("天")); - return strText.Replace("hour", this.GetString("小时")); } diff --git a/DigitalPlatform.OPAC.Web/BiblioSearchControl.cs b/DigitalPlatform.OPAC.Web/BiblioSearchControl.cs index 40620d2f3..6b67be280 100644 --- a/DigitalPlatform.OPAC.Web/BiblioSearchControl.cs +++ b/DigitalPlatform.OPAC.Web/BiblioSearchControl.cs @@ -341,7 +341,6 @@ protected override void CreateChildControls() for (int i = 0; i < this.LineCount; i++) { - PlaceHolder line = new PlaceHolder(); line.ID = "queryline_" + i.ToString(); // id用于render()时定位 this.Controls.Add(line); @@ -1066,13 +1065,13 @@ private int BuildQueryXml( VirtualDatabase temp = app.vdbs[strDbName]; if (temp == null) { - strNotFound += "库名 '"+strDbName+"' 没有找到; "; + strNotFound += "库名 '" + strDbName + "' 没有找到; "; continue; } string strFromCaptions = temp.BuildCaptionListByStyleList(strFrom, this.Lang); if (String.IsNullOrEmpty(strFromCaptions) == true) { - strNotFound += "数据库 '" + strDbName + "' 中不存在检索途径 '"+strFrom+"'; "; + strNotFound += "数据库 '" + strDbName + "' 中不存在检索途径 '" + strFrom + "'; "; continue; } diff --git a/DigitalPlatform.OPAC.Web/BorrowHistoryControl.cs b/DigitalPlatform.OPAC.Web/BorrowHistoryControl.cs index f027a8eae..2e799c910 100644 --- a/DigitalPlatform.OPAC.Web/BorrowHistoryControl.cs +++ b/DigitalPlatform.OPAC.Web/BorrowHistoryControl.cs @@ -15,12 +15,22 @@ using DigitalPlatform.Xml; using DigitalPlatform.OPAC.Server; using DigitalPlatform.IO; +using DigitalPlatform.LibraryClient.localhost; namespace DigitalPlatform.OPAC.Web { [ToolboxData("<{0}:BorrowHistoryControl runat=server>")] public class BorrowHistoryControl : ReaderInfoBase { + /// + /// 是否为借还历史库模式。false 表示不是历史库模式,即要从读者记录中获得借阅历史信息;true 表示为历史库模式,要用 dp2library 的 SearchCharging() API 获得历史信息 + /// + public bool DatabaseMode + { + get; + set; + } + ResourceManager m_rm = null; ResourceManager GetRm() @@ -41,7 +51,6 @@ public string GetString(string strID) // TODO: 如果抛出异常,则要试着取zh-cn的字符串,或者返回一个报错的字符串 try { - string s = GetRm().GetString(strID, ci); if (String.IsNullOrEmpty(s) == true) return strID; @@ -77,25 +86,86 @@ public int ResultCount get { string strError = ""; + int nRet = 0; + if (this.DatabaseMode == false) + { + // return: + // -1 出错 + // 0 成功 + // 1 尚未登录 + nRet = this.LoadReaderXml(out strError); + if (nRet == -1) + return 0; + + if (nRet == 1) + return 0; + + XmlNodeList nodes = ReaderDom.DocumentElement.SelectNodes("borrowHistory/borrow"); + return nodes.Count; + } + + List results = null; + // return: + // -2 尚未登录 + // -1 出错 + // 其它 符合条件的事项总数 + nRet = GetChargingHistory(0, + -1, + out results, + out strError); + if (nRet < 0) + return 0; + return nRet; + } + } + + // 获得历史信息 + // parameters: + // nStart 开始位置。如果为 -1,表示仅获得事项总数 + // return: + // -2 尚未登录 + // -1 出错 + // 其它 符合条件的事项总数 + int GetChargingHistory(int nPageNo, + int nItemsPerPage, + out List results, + out string strError) + { + strError = ""; + results = null; + + // 获得读者证条码号 + string strReaderBarcode = ""; + { // return: // -1 出错 // 0 成功 // 1 尚未登录 int nRet = this.LoadReaderXml(out strError); if (nRet == -1) - { return 0; - } - if (nRet == 1) - { - return 0; - } + return -2; + strReaderBarcode = DomUtil.GetElementText(ReaderDom.DocumentElement, "barcode"); + } - XmlNodeList nodes = ReaderDom.DocumentElement.SelectNodes("borrowHistory/borrow"); + OpacApplication app = (OpacApplication)this.Page.Application["app"]; + SessionInfo sessioninfo = (SessionInfo)this.Page.Session["sessioninfo"]; - return nodes.Count; - } + // 获得借阅历史 + // parameters: + // nPageNo 页号 + // nItemsPerPage 每页的事项个数。如果为 -1,表示希望从头获取全部内容 + // return: + // -1 出错 + // 其它 符合条件的事项总数 + return (int)sessioninfo.Channel.LoadBorrowHistory( + null, + strReaderBarcode, + nPageNo, + nItemsPerPage, + out results, + out strError); } // 计算出页码总数 @@ -152,7 +222,6 @@ public void SetResultInfo(int nResultCount) protected override void CreateChildControls() { - this.Controls.Add(new LiteralControl( this.GetPrefixString( this.GetString("借阅历史"), // "借阅历史" @@ -195,7 +264,6 @@ protected override void CreateChildControls() content.ID = "content"; this.Controls.Add(content); - // 内容行 for (int i = 0; i < this.LineCount; i++) { @@ -210,7 +278,6 @@ protected override void CreateChildControls() // 命令行 CreateCmdLine(); - this.Controls.Add(new LiteralControl( "" + this.GetPostfixString() )); @@ -234,26 +301,22 @@ PlaceHolder NewContentLine(Control content, content.Controls.Add(line); } - // 内容 LiteralControl literal = new LiteralControl(); literal.ID = "line" + Convert.ToString(nLineNo) + "_content"; line.Controls.Add(literal); - /* literal = new LiteralControl(); literal.Text = ""; line.Controls.Add(literal); * */ - return line; } void CreateCmdLine() { - this.Controls.Add(new LiteralControl( "" )); @@ -262,7 +325,6 @@ void CreateCmdLine() ""; - - strResult += ""; - strResult += ""; - strResult += ""; - strResult += ""; - strResult += ""; - strResult += ""; - strResult += ""; - + infos.Add(new LineInfo()); } else { - XmlNode node = nodes[i]; - string strBarcode = DomUtil.GetAttr(node, "barcode"); - string strRecPath = DomUtil.GetAttr(node, "recPath"); - string strBorrowDate = DateTimeUtil.LocalTime(DomUtil.GetAttr(node, "borrowDate")); - string strBorrowPeriod = DomUtil.GetAttr(node, "borrowPeriod"); - string strReturnDate = DateTimeUtil.LocalTime(DomUtil.GetAttr(node, "returnDate")); - string strNo = DomUtil.GetAttr(node, "no"); - string strRenewComment = DomUtil.GetAttr(node, "renewComment"); - string strOperator = DomUtil.GetAttr(node, "operator"); - - string strBarcodeLink = "" + strBarcode + ""; - -#if NO - // 获得摘要 - string strSummary = ""; - string strBiblioRecPath = ""; - - long lRet = sessioninfo.Channel.GetBiblioSummary( - null, - strBarcode, - null, - null, - out strBiblioRecPath, - out strSummary, - out strError); - if (lRet == -1 || lRet == 0) - strSummary = strError; - /* - LibraryServerResult result = app.GetBiblioSummary( - sessioninfo, - strBarcode, - null, - null, - out strBiblioRecPath, - out strSummary); - if (result.Value == -1 || result.Value == 0) - strSummary = result.ErrorInfo; - */ -#endif - - string strTrClass = " class='dark content' "; + infos.Add(new LineInfo(node as XmlElement)); + } + } + } + else + { + List results = null; - if ((i % 2) == 1) - strTrClass = " class='light content' "; + // return: + // -2 尚未登录 + // -1 出错 + // 其它 符合条件的事项总数 + nRet = GetChargingHistory(nPageNo, + this.PageMaxLines, + out results, + out strError); + if (nRet == -1) + { + writer.Write(strError); + return; + } + if (nRet == -2) + { + sessioninfo.LoginCallStack.Push(this.Page.Request.RawUrl); + this.Page.Response.Redirect("login.aspx", true); + return; + } + SetResultInfo(nRet); - strResult += ""; - - strResult += ""; - strResult += ""; - strResult += ""; - - strBorrowPeriod = app.GetDisplayTimePeriodStringEx(strBorrowPeriod); - - strResult += ""; - strResult += ""; - strResult += ""; - strResult += ""; + for (int i = 0; i < this.PageMaxLines; i++) + { + if (i >= results.Count) + { + infos.Add(new LineInfo()); + } + else + { + ChargingItemWrapper wrapper = results[i]; + LineInfo info = new LineInfo(wrapper); + infos.Add(info); } + } + } - PlaceHolder line = (PlaceHolder)this.FindControl("line" + Convert.ToString(i)); - if (line == null) + if (infos.Count != 0) + { + //OpacApplication app = (OpacApplication)this.Page.Application["app"]; + //SessionInfo sessioninfo = (SessionInfo)this.Page.Session["sessioninfo"]; + + // 显示本页中的浏览行 + { + int i = 0; + foreach (LineInfo info in infos) { - PlaceHolder insertpoint = (PlaceHolder)this.FindControl("insertpoint"); - PlaceHolder content = (PlaceHolder)this.FindControl("content"); + StringBuilder text = new StringBuilder(); - line = this.NewContentLine(content, i, insertpoint); - } + string strBarcodeLink = "" + info.strBarcode + ""; - LiteralControl contentcontrol = (LiteralControl)this.FindControl("line" + Convert.ToString(i) + "_content"); + string strTrClass = " class='dark content' "; - contentcontrol.Text = strResult; + if ((i % 2) == 1) + strTrClass = " class='light content' "; - } // end of for + text.Append(""); + + text.Append(""); + text.Append(""); + text.Append(""); + + info.strBorrowPeriod = app.GetDisplayTimePeriodStringEx(info.strBorrowPeriod); + + if (info.IsEmpty() == true) + text.Append(""); + else + { + if (this.DatabaseMode == false) + text.Append(""); + else + text.Append(""); + } + text.Append(""); + + if (this.DatabaseMode == false || info.IsEmpty()) + text.Append(""); + else + text.Append(""); + + text.Append(""); + + PlaceHolder line = (PlaceHolder)this.FindControl("line" + Convert.ToString(i)); + if (line == null) + { + PlaceHolder insertpoint = (PlaceHolder)this.FindControl("insertpoint"); + PlaceHolder content = (PlaceHolder)this.FindControl("content"); + + line = this.NewContentLine(content, i, insertpoint); + } + + LiteralControl contentcontrol = (LiteralControl)this.FindControl("line" + Convert.ToString(i) + "_content"); + contentcontrol.Text = text.ToString(); + i++; + } // end of for + } this.LineCount = Math.Max(this.LineCount, this.PageMaxLines); } @@ -595,114 +711,9 @@ protected override void Render(HtmlTextWriter writer) if (line == null) continue; } - } base.Render(writer); } - - /* - - */ - /* - protected override void RenderContents(HtmlTextWriter output) - { - string strError = ""; - // return: - // -1 出错 - // 0 成功 - // 1 尚未登录 - int nRet = this.LoadReaderXml(out strError); - if (nRet == -1) - { - output.Write(strError); - return; - } - - if (nRet == 1) - { - sessioninfo.LoginCallStack.Push(this.Page.Request.RawUrl); - this.Page.Response.Redirect("login.aspx", true); - return; - } - - string strResult = ""; - - XmlNodeList nodes = ReaderDom.DocumentElement.SelectNodes("borrowHistory/borrow"); - - strResult += this.GetPrefixString("借阅历史", null); - strResult += "
" )); - this.Controls.Add(new LiteralControl( " " )); @@ -271,7 +333,6 @@ void CreateCmdLine() pageswitcher.ID = "pageswitcher"; this.Controls.Add(pageswitcher); - LinkButton firstpage = new LinkButton(); firstpage.ID = "first"; firstpage.Text = this.GetString("首页"); @@ -303,7 +364,6 @@ void CreateCmdLine() " " )); - LinkButton nextpage = new LinkButton(); nextpage.ID = "next"; nextpage.Text = this.GetString("后页"); @@ -337,7 +397,6 @@ void CreateCmdLine() literal.Text = " " + this.GetString("第") + " "; // " 第 " pageswitcher.Controls.Add(literal); - TextBox textbox = new TextBox(); textbox.ID = "gotopageno"; textbox.Width = new Unit("40"); @@ -396,7 +455,6 @@ void lastpage_Click(object sender, EventArgs e) this.StartIndex = (this.ResultCount / this.PageMaxLines) * this.PageMaxLines; else this.StartIndex = Math.Max(0, (this.ResultCount / this.PageMaxLines) * this.PageMaxLines - 1); - } void nextpage_Click(object sender, EventArgs e) @@ -420,169 +478,227 @@ void firstpage_Click(object sender, EventArgs e) this.StartIndex = 0; } - - protected override void Render(HtmlTextWriter writer) + class LineInfo { - int nRet = 0; + public string strBarcode { get; set; } + public string strRecPath { get; set; } + public string strBorrowDate { get; set; } + public string strBorrowPeriod { get; set; } + public string strBorrowOperator { get; set; } // 2016/1/1 + public string strReturnDate { get; set; } + public string strNo { get; set; } + public string strRenewComment { get; set; } + public string strOperator { get; set; } + + public LineInfo() + { - string strError = ""; - // return: - // -1 出错 - // 0 成功 - // 1 尚未登录 - nRet = this.LoadReaderXml(out strError); - if (nRet == -1) + } + + public LineInfo(XmlElement node) { - writer.Write(strError); - return; + this.strBarcode = DomUtil.GetAttr(node, "barcode"); + this.strRecPath = DomUtil.GetAttr(node, "recPath"); + this.strBorrowDate = DateTimeUtil.LocalTime(DomUtil.GetAttr(node, "borrowDate")); + this.strBorrowPeriod = DomUtil.GetAttr(node, "borrowPeriod"); + this.strReturnDate = DateTimeUtil.LocalTime(DomUtil.GetAttr(node, "returnDate")); + this.strNo = DomUtil.GetAttr(node, "no"); + this.strRenewComment = DomUtil.GetAttr(node, "renewComment"); + this.strOperator = DomUtil.GetAttr(node, "operator"); } - if (nRet == 1) + public LineInfo(ChargingItemWrapper wrapper) { - sessioninfo.LoginCallStack.Push(this.Page.Request.RawUrl); - this.Page.Response.Redirect("login.aspx", true); - return; + this.strBarcode = wrapper.Item.ItemBarcode; + this.strRecPath = ""; + this.strBorrowDate = wrapper.RelatedItem == null ? "" : wrapper.RelatedItem.OperTime; + this.strBorrowPeriod = ""; + this.strBorrowOperator = wrapper.RelatedItem == null ? "" : wrapper.RelatedItem.Operator; + this.strReturnDate = wrapper.Item.OperTime; + this.strNo = ""; + this.strRenewComment = ""; + this.strOperator = wrapper.Item.Operator; } - int nPageNo = this.StartIndex / this.PageMaxLines; + public bool IsEmpty() + { + return (string.IsNullOrEmpty(this.strBarcode) == true); + } + } + + protected override void Render(HtmlTextWriter writer) + { + int nRet = 0; - XmlNodeList nodes = ReaderDom.DocumentElement.SelectNodes("borrowHistory/borrow"); + string strError = ""; + List infos = new List(); - SetResultInfo(nodes.Count); + int nPageNo = this.StartIndex / this.PageMaxLines; - if (nodes.Count != 0) + if (this.DatabaseMode == false) { - OpacApplication app = (OpacApplication)this.Page.Application["app"]; - SessionInfo sessioninfo = (SessionInfo)this.Page.Session["sessioninfo"]; + // return: + // -1 出错 + // 0 成功 + // 1 尚未登录 + nRet = this.LoadReaderXml(out strError); + if (nRet == -1) + { + writer.Write(strError); + return; + } + if (nRet == 1) + { + sessioninfo.LoginCallStack.Push(this.Page.Request.RawUrl); + this.Page.Response.Redirect("login.aspx", true); + return; + } + + XmlNodeList nodes = ReaderDom.DocumentElement.SelectNodes("borrowHistory/borrow"); + + SetResultInfo(nodes.Count); - // 显示本页中的浏览行 for (int i = this.StartIndex; i < this.StartIndex + this.PageMaxLines; i++) { - /* - string strBarcode = ""; - string strRecPath = ""; - string strBorrowDate = ""; - string strBorrowPeriod = ""; - string strReturnDate = ""; - string strNo = ""; - string strRenewComment = ""; - string strOperator = ""; - string strBarcodeLink = ""; - string strSummary = ""; - string strBiblioRecPath = ""; - * */ - - string strResult = ""; - if (i >= nodes.Count) { - string strTrClass = " class='dark content blank' "; - - if ((i % 2) == 1) - strTrClass = " class='light content blank' "; - - strResult += "
" + (i + 1).ToString() + "
" + (i + 1).ToString() + "" + strBarcodeLink + "" + strBarcode + "" - + "
" - + this.GetString("续借次") - + " :" + strNo + "
" - + "
" - + this.GetString("借阅日期") - + ":" + strBorrowDate + "
" - + "
" - + this.GetString("期限") - + ": " + strBorrowPeriod + "
" - + "
" - + this.GetString("还书日期") - + ":" + strReturnDate + "
" - + "
" + strRenewComment + "" + strOperator + "
" + (i + 1).ToString() + "" + strBarcodeLink + "" + info.strBarcode + "" + "" + + "
" + + this.GetString("续借次") + + " :" + info.strNo + "
" + + "
" + + this.GetString("借阅日期") + + ":" + info.strBorrowDate + "
" + + "
" + + this.GetString("期限") + + ": " + info.strBorrowPeriod + "
" + + "
" + + this.GetString("还书日期") + + ":" + info.strReturnDate + "
" + + "
" + + "
" + + this.GetString("借阅日期") + + ": " + info.strBorrowDate + "
" + + "
" + + this.GetString("还书日期") + + ": " + info.strReturnDate + "
" + + "
" + info.strRenewComment + "" + info.strOperator + "" + + "
" + + this.GetString("借") + + ": " + info.strBorrowOperator + "
" + + "
" + + this.GetString("还") + + ": " + info.strOperator + "
" + + "
"; - strResult += ""; - - if (nodes.Count == 0) - { - strResult += ""; - strResult += ""; - strResult += ""; - } - - for (int i = 0; i < nodes.Count; i++) - { - XmlNode node = nodes[i]; - string strBarcode = DomUtil.GetAttr(node, "barcode"); - string strRecPath = DomUtil.GetAttr(node, "recPath"); - string strBorrowDate = DateTimeUtil.LocalTime(DomUtil.GetAttr(node, "borrowDate")); - string strBorrowPeriod = DomUtil.GetAttr(node, "borrowPeriod"); - string strReturnDate = DateTimeUtil.LocalTime(DomUtil.GetAttr(node, "returnDate")); - string strNo = DomUtil.GetAttr(node, "no"); - string strRenewComment = DomUtil.GetAttr(node, "renewComment"); - string strOperator = DomUtil.GetAttr(node, "operator"); - - string strBarcodeLink = "" + strBarcode + ""; - - // 获得摘要 - string strSummary = ""; - string strBiblioRecPath = ""; - Result result = app.GetBiblioSummary( - sessioninfo, - strBarcode, - null, - null, - out strBiblioRecPath, - out strSummary); - if (result.Value == -1 || result.Value == 0) - strSummary = result.ErrorInfo; - - - string strTrClass = " class='dark' "; - - if ((i % 2) == 1) - strTrClass = " class='light' "; - - strResult += ""; - strResult += ""; - strResult += ""; - strResult += ""; - strResult += ""; - strResult += ""; - strResult += ""; - - } - - strResult += "
册条码号书目摘要借阅情况续借注操作者
(无违约/交费信息)
" + strBarcodeLink + "" + strSummary + "" - + "
续借次 :" + strNo + "
" - + "
借阅日期:" + strBorrowDate + "
" - + "
期限: " + strBorrowPeriod + "
" - + "
还书日期:" + strReturnDate + "
" - + "
" + strRenewComment + "" + strOperator + "
"; - - strResult += this.GetPostfixString(); - - output.Write(strResult); - } - * */ } } diff --git a/DigitalPlatform.OPAC.Web/FooterBarControl.cs b/DigitalPlatform.OPAC.Web/FooterBarControl.cs index 83b23af92..25955a747 100644 --- a/DigitalPlatform.OPAC.Web/FooterBarControl.cs +++ b/DigitalPlatform.OPAC.Web/FooterBarControl.cs @@ -61,7 +61,6 @@ int GetParentCount() return nCount; } - protected override void RenderContents(HtmlTextWriter output) { int nParentCount = GetParentCount(); @@ -74,7 +73,6 @@ protected override void RenderContents(HtmlTextWriter output) EndIndentor.Write(output); output.Write(""); - // 底部图像表格 开始 NormalIndentor.Write(output); @@ -96,12 +94,20 @@ protected override void RenderContents(HtmlTextWriter output) // 中 NormalIndentor.Write(output); +#if NO output.Write("" + this.GetString("dp2图书馆集成系统") + " V2 - " + this.GetString("版权所有") + " © 2006-2015 " + this.GetString("数字平台(北京)软件有限责任公司") + "" + ""); +#endif + output.Write("" + + this.GetString("dp2 图书馆集成系统") + + " V2 - " + + "开源的图书馆管理系统" + + "" + + ""); // 右 NormalIndentor.Write(output); diff --git a/DigitalPlatform.OPAC.Web/res/BorrowHistoryControl.cs.en-US.resx b/DigitalPlatform.OPAC.Web/res/BorrowHistoryControl.cs.en-US.resx index 14d627fd8..c536da8b7 100644 --- a/DigitalPlatform.OPAC.Web/res/BorrowHistoryControl.cs.en-US.resx +++ b/DigitalPlatform.OPAC.Web/res/BorrowHistoryControl.cs.en-US.resx @@ -112,10 +112,10 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ({0} pages.) @@ -124,6 +124,9 @@ Item Information 栏目标题 + + Loan + Borrow History 面板标题 @@ -186,6 +189,9 @@ Jump to 按钮 + + Return + Return Date 栏目内容小标题 diff --git a/DigitalPlatform.OPAC.Web/res/BorrowHistoryControl.cs.zh-CN.resx b/DigitalPlatform.OPAC.Web/res/BorrowHistoryControl.cs.zh-CN.resx index d5a37d559..bb508d22c 100644 --- a/DigitalPlatform.OPAC.Web/res/BorrowHistoryControl.cs.zh-CN.resx +++ b/DigitalPlatform.OPAC.Web/res/BorrowHistoryControl.cs.zh-CN.resx @@ -112,10 +112,10 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (共 {0} 页) @@ -124,6 +124,9 @@ 书目摘要 栏目标题 + + + 借阅历史 面板标题 @@ -186,6 +189,9 @@ 跳到 按钮 + + + 还书日期 栏目内容小标题 diff --git a/ZipUtil.exe b/ZipUtil.exe index 98a332fcbb8d53931f98f2c1b0b71567c9b14b3f..17467569aa5199567d8c8da8bf05a94769d133ac 100644 GIT binary patch delta 66 zcmZqhXz-ZO!F+K}+s1A~F@gPd3F|xp`yCfc3Owk%R5Wk%8L{nBr$_ V@Y3>_5ZxDh?q|gM%`+r3xB$mM9SHyc delta 66 zcmZqhXz-ZO!Q8#3X=Ascm_T^mDm9K-?LKQJwz!yGWoX@eMr;8SNOp3*q@=(#!3A;u VnpC~_?G^pHA~Rcb^9;!hE&!9d8;<}0 diff --git a/dp2Circulation/Charging/ChargingForm.Designer.cs b/dp2Circulation/Charging/ChargingForm.Designer.cs index d99ed9585..0a7b8cb24 100644 --- a/dp2Circulation/Charging/ChargingForm.Designer.cs +++ b/dp2Circulation/Charging/ChargingForm.Designer.cs @@ -34,6 +34,7 @@ private void InitializeComponent() this.toolStripMenuItem_borrow = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem_return = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem_verifyReturn = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem_renew = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem_verifyRenew = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem_lost = new System.Windows.Forms.ToolStripMenuItem(); this.splitContainer_main = new System.Windows.Forms.SplitContainer(); @@ -74,7 +75,6 @@ private void InitializeComponent() this.contextMenuStrip_verifyReaderPassword = new System.Windows.Forms.ContextMenuStrip(this.components); this.MenuItem_verifyReaderPassword = new System.Windows.Forms.ToolStripMenuItem(); this.panel_main = new System.Windows.Forms.Panel(); - this.toolStripMenuItem_renew = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStrip_selectFunc.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer_main)).BeginInit(); this.splitContainer_main.Panel1.SuspendLayout(); @@ -104,40 +104,47 @@ private void InitializeComponent() this.toolStripMenuItem_verifyRenew, this.toolStripMenuItem_lost}); this.contextMenuStrip_selectFunc.Name = "contextMenuStrip_selectFunc"; - this.contextMenuStrip_selectFunc.Size = new System.Drawing.Size(153, 158); + this.contextMenuStrip_selectFunc.Size = new System.Drawing.Size(125, 136); // // toolStripMenuItem_borrow // this.toolStripMenuItem_borrow.Name = "toolStripMenuItem_borrow"; - this.toolStripMenuItem_borrow.Size = new System.Drawing.Size(152, 22); + this.toolStripMenuItem_borrow.Size = new System.Drawing.Size(124, 22); this.toolStripMenuItem_borrow.Text = ""; this.toolStripMenuItem_borrow.Click += new System.EventHandler(this.toolStripMenuItem_borrow_Click); // // toolStripMenuItem_return // this.toolStripMenuItem_return.Name = "toolStripMenuItem_return"; - this.toolStripMenuItem_return.Size = new System.Drawing.Size(152, 22); + this.toolStripMenuItem_return.Size = new System.Drawing.Size(124, 22); this.toolStripMenuItem_return.Text = ""; this.toolStripMenuItem_return.Click += new System.EventHandler(this.toolStripMenuItem_return_Click); // // toolStripMenuItem_verifyReturn // this.toolStripMenuItem_verifyReturn.Name = "toolStripMenuItem_verifyReturn"; - this.toolStripMenuItem_verifyReturn.Size = new System.Drawing.Size(152, 22); + this.toolStripMenuItem_verifyReturn.Size = new System.Drawing.Size(124, 22); this.toolStripMenuItem_verifyReturn.Text = "֤"; this.toolStripMenuItem_verifyReturn.Click += new System.EventHandler(this.toolStripMenuItem_verifyReturn_Click); // + // toolStripMenuItem_renew + // + this.toolStripMenuItem_renew.Name = "toolStripMenuItem_renew"; + this.toolStripMenuItem_renew.Size = new System.Drawing.Size(124, 22); + this.toolStripMenuItem_renew.Text = ""; + this.toolStripMenuItem_renew.Click += new System.EventHandler(this.toolStripMenuItem_renew_Click); + // // toolStripMenuItem_verifyRenew // this.toolStripMenuItem_verifyRenew.Name = "toolStripMenuItem_verifyRenew"; - this.toolStripMenuItem_verifyRenew.Size = new System.Drawing.Size(152, 22); + this.toolStripMenuItem_verifyRenew.Size = new System.Drawing.Size(124, 22); this.toolStripMenuItem_verifyRenew.Text = "֤"; this.toolStripMenuItem_verifyRenew.Click += new System.EventHandler(this.toolStripMenuItem_verifyRenew_Click); // // toolStripMenuItem_lost // this.toolStripMenuItem_lost.Name = "toolStripMenuItem_lost"; - this.toolStripMenuItem_lost.Size = new System.Drawing.Size(152, 22); + this.toolStripMenuItem_lost.Size = new System.Drawing.Size(124, 22); this.toolStripMenuItem_lost.Text = "ʧ"; this.toolStripMenuItem_lost.Click += new System.EventHandler(this.toolStripMenuItem_lost_Click); // @@ -236,18 +243,18 @@ private void InitializeComponent() this.toolStripDropDownButton_itemBarcodeNavigate.Size = new System.Drawing.Size(29, 22); this.toolStripDropDownButton_itemBarcodeNavigate.ToolTipText = "ſٵ"; // - // ToolStripMenuItem_openEntityForm + // toolStripMenuItem_openEntityForm // this.toolStripMenuItem_openEntityForm.Enabled = false; - this.toolStripMenuItem_openEntityForm.Name = "ToolStripMenuItem_openEntityForm"; + this.toolStripMenuItem_openEntityForm.Name = "toolStripMenuItem_openEntityForm"; this.toolStripMenuItem_openEntityForm.Size = new System.Drawing.Size(112, 22); this.toolStripMenuItem_openEntityForm.Text = "ֲᴰ"; this.toolStripMenuItem_openEntityForm.Click += new System.EventHandler(this.toolStripMenuItem_openEntityForm_Click); // - // ToolStripMenuItem_openItemInfoForm + // toolStripMenuItem_openItemInfoForm // this.toolStripMenuItem_openItemInfoForm.Enabled = false; - this.toolStripMenuItem_openItemInfoForm.Name = "ToolStripMenuItem_openItemInfoForm"; + this.toolStripMenuItem_openItemInfoForm.Name = "toolStripMenuItem_openItemInfoForm"; this.toolStripMenuItem_openItemInfoForm.Size = new System.Drawing.Size(112, 22); this.toolStripMenuItem_openItemInfoForm.Text = "ʵ崰"; this.toolStripMenuItem_openItemInfoForm.Click += new System.EventHandler(this.toolStripMenuItem_openItemInfoForm_Click); @@ -267,42 +274,42 @@ private void InitializeComponent() this.toolStripDropDownButton_readerBarcodeNavigate.Size = new System.Drawing.Size(29, 22); this.toolStripDropDownButton_readerBarcodeNavigate.ToolTipText = "֤ſٵ"; // - // ToolStripMenuItem_naviToAmerceForm + // toolStripMenuItem_naviToAmerceForm // this.toolStripMenuItem_naviToAmerceForm.Enabled = false; - this.toolStripMenuItem_naviToAmerceForm.Name = "ToolStripMenuItem_naviToAmerceForm"; + this.toolStripMenuItem_naviToAmerceForm.Name = "toolStripMenuItem_naviToAmerceForm"; this.toolStripMenuItem_naviToAmerceForm.Size = new System.Drawing.Size(144, 22); this.toolStripMenuItem_naviToAmerceForm.Text = "Ѵ"; this.toolStripMenuItem_naviToAmerceForm.Click += new System.EventHandler(this.toolStripMenuItem_naviToAmerceForm_Click); // - // ToolStripMenuItem_naviToReaderInfoForm + // toolStripMenuItem_naviToReaderInfoForm // this.toolStripMenuItem_naviToReaderInfoForm.Enabled = false; - this.toolStripMenuItem_naviToReaderInfoForm.Name = "ToolStripMenuItem_naviToReaderInfoForm"; + this.toolStripMenuItem_naviToReaderInfoForm.Name = "toolStripMenuItem_naviToReaderInfoForm"; this.toolStripMenuItem_naviToReaderInfoForm.Size = new System.Drawing.Size(144, 22); this.toolStripMenuItem_naviToReaderInfoForm.Text = "ߴ"; this.toolStripMenuItem_naviToReaderInfoForm.Click += new System.EventHandler(this.toolStripMenuItem_naviToReaderInfoForm_Click); // - // ToolStripMenuItem_naviToActivateForm_old + // toolStripMenuItem_naviToActivateForm_old // this.toolStripMenuItem_naviToActivateForm_old.Enabled = false; - this.toolStripMenuItem_naviToActivateForm_old.Name = "ToolStripMenuItem_naviToActivateForm_old"; + this.toolStripMenuItem_naviToActivateForm_old.Name = "toolStripMenuItem_naviToActivateForm_old"; this.toolStripMenuItem_naviToActivateForm_old.Size = new System.Drawing.Size(144, 22); this.toolStripMenuItem_naviToActivateForm_old.Text = "(Դ)"; this.toolStripMenuItem_naviToActivateForm_old.Click += new System.EventHandler(this.toolStripMenuItem_naviToActivateForm_old_Click); // - // ToolStripMenuItem_openReaderManageForm + // toolStripMenuItem_openReaderManageForm // this.toolStripMenuItem_openReaderManageForm.Enabled = false; - this.toolStripMenuItem_openReaderManageForm.Name = "ToolStripMenuItem_openReaderManageForm"; + this.toolStripMenuItem_openReaderManageForm.Name = "toolStripMenuItem_openReaderManageForm"; this.toolStripMenuItem_openReaderManageForm.Size = new System.Drawing.Size(144, 22); this.toolStripMenuItem_openReaderManageForm.Text = "ͣ贰"; this.toolStripMenuItem_openReaderManageForm.Click += new System.EventHandler(this.toolStripMenuItem_openReaderManageForm_Click); // - // ToolStripMenuItem_naviToActivateForm_new + // toolStripMenuItem_naviToActivateForm_new // this.toolStripMenuItem_naviToActivateForm_new.Enabled = false; - this.toolStripMenuItem_naviToActivateForm_new.Name = "ToolStripMenuItem_naviToActivateForm_new"; + this.toolStripMenuItem_naviToActivateForm_new.Name = "toolStripMenuItem_naviToActivateForm_new"; this.toolStripMenuItem_naviToActivateForm_new.Size = new System.Drawing.Size(144, 22); this.toolStripMenuItem_naviToActivateForm_new.Text = "(Ŀ)"; this.toolStripMenuItem_naviToActivateForm_new.Click += new System.EventHandler(this.toolStripMenuItem_naviToActivateForm_new_Click); @@ -652,13 +659,6 @@ private void InitializeComponent() this.panel_main.Size = new System.Drawing.Size(442, 392); this.panel_main.TabIndex = 7; // - // ToolStripMenuItem_renew - // - this.toolStripMenuItem_renew.Name = "ToolStripMenuItem_renew"; - this.toolStripMenuItem_renew.Size = new System.Drawing.Size(152, 22); - this.toolStripMenuItem_renew.Text = ""; - this.toolStripMenuItem_renew.Click += new System.EventHandler(this.toolStripMenuItem_renew_Click); - // // ChargingForm // this.AllowDrop = true; diff --git a/dp2Circulation/Charging/ChargingForm.cs b/dp2Circulation/Charging/ChargingForm.cs index 1816aedf3..7e636d3e6 100644 --- a/dp2Circulation/Charging/ChargingForm.cs +++ b/dp2Circulation/Charging/ChargingForm.cs @@ -168,7 +168,7 @@ public string PatronRenderFormat if (this.DisplayState == DisplayState.TEXT) return "text"; - if (this.NoBorrowHistory == true + if (this.NoBorrowHistory == true && StringUtil.CompareVersion(this.MainForm.ServerVersion, "2.21") >= 0) return "html:noborrowhistory"; @@ -929,7 +929,7 @@ public void Reload() } if (strBarcode != this.textBox_readerBarcode.Text) - this.textBox_readerBarcode.Text = strBarcode; + this.textBox_readerBarcode.Text = strBarcode; } @@ -1090,7 +1090,7 @@ int LoadReaderRecord(ref string strBarcode, stop.SetMessage("正在装入读者记录 " + strBarcode + " ..."); string[] results = null; - byte [] baTimestamp = null; + byte[] baTimestamp = null; string strRecPath = ""; long lRet = Channel.GetReaderInfo( stop, @@ -1948,7 +1948,7 @@ public int DoItemAction() string strFastInputText = ""; string strTemp = this.textBox_itemBarcode.Text; - if ( ( this.UseIsbnBorrow == true && QuickChargingForm.IsISBN(ref strTemp) == true) + if ((this.UseIsbnBorrow == true && QuickChargingForm.IsISBN(ref strTemp) == true) || strTemp.ToLower() == "?b" || string.IsNullOrEmpty(strTemp) == true) { @@ -2095,7 +2095,6 @@ public int DoItemAction() strOperName = "续借"; } - stop.OnStop += new StopEventHandler(this.DoStop); stop.Initial("正在进行" + strOperName + "操作: " + this.textBox_readerBarcode.Text + " " + strOperName + " " + this.textBox_itemBarcode.Text + " ..."); @@ -2161,7 +2160,7 @@ public int DoItemAction() lRet = Channel.Borrow( stop, bRenew, - this.FuncState == dp2Circulation.FuncState.Renew? "" : this.textBox_readerBarcode.Text, + this.FuncState == dp2Circulation.FuncState.Renew ? "" : this.textBox_readerBarcode.Text, this.textBox_itemBarcode.Text, strConfirmItemRecPath, this.Force, @@ -3425,7 +3424,8 @@ public enum FuncState InventoryBook = 10, // 盘点图书 2015/8/16 } - /*public*/ class BarcodeAndTime + /*public*/ + class BarcodeAndTime { public string Barcode = ""; public DateTime Time = DateTime.Now; diff --git a/dp2Circulation/Charging/ChargingForm.resx b/dp2Circulation/Charging/ChargingForm.resx index 27d69c6c9..4fe206650 100644 --- a/dp2Circulation/Charging/ChargingForm.resx +++ b/dp2Circulation/Charging/ChargingForm.resx @@ -123,10 +123,34 @@ 566, 17 + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFJSURBVDhPYwCB8PYH/8Pa7v0HsYObb/0ParwBZsOAd8XZ + /56lp+BiTrkH/jtk70WoAWkObbkLFgBpDqy/hmIASLN78XG4GEizXcZOhBqQ5pDm22ABkGb/2ssoBoA0 + uxYcgYuBNNukbkWoQXY2SLNv1QUUA1wLDv8HORvKZQBptkrehFAD0hwAdTZIM8jPYAkocM5D9bNl0qb/ + 5gnrEGpAmmHORg8wEED3s3nC+v+msasRapCdjR5gIIDuZ5Bm4+gVCDXIzkYPMBBA9zNIs2HEUoQaZGeD + AgzkZ7AEFIA0I/sZpFk/bBFCDbKz0QMMBND9rB+66L9u8HyEGoizD4MFMBIJEKD7GaRZJ3AOQg1yPGMk + EiBA97M2ULOW/ywUNZQBh+w9cNNgoQ3zM8xmkLNBNoPYIKDuMxXOBjsbRKNHFZQJBjg1UwYYGACfxwQX + +x/RKgAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAARCAYAAADUryzEAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFlSURBVDhPY8AFNjcp/0fGUGHiAEjDkwMt/5+dmvn/6dHe + /7s6tP8vLhYhzpC1HXb/9/cZ/7++POj/w52l/48uivsPEiPJgAuTdcGGPFtk8///Zt//L1c4gb0RHRlE + 2BCQAf93h6JioCHHulVJMGC1K1gTGIPYQLyzUZp4A34utoVrBLF/zjb9Xx1NpAEg8KpPE6wJhP9MN/q/ + v0qEOM0ePd7/QbgmjeH/sRoxMN5czPs/sESRsAFOS5z+g3D3/e7/Vdt6/u+/uf//ho3z/1tVWYHFtbK0 + 8BtgMtPkf8rplP/Nt5v/B83O+P/3////PXv6/8fujgWLu2xw+e9d4Y3bEOke6f8xJ2L+Z5/L/g8y7MDT + y2CbQXyQASabTf7Llcvh9kpaWtp/zWma/0MOhYAN0KnXAWsEYevt1mADZBtk8YcFyBDjJGOwTbKpsv9B + rgJhkEaQmEG4AXGxATIIF4YqGTSAgQEAJj8jgyEu8bgAAAAASUVORK5CYII= + + True - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 @@ -169,33 +193,6 @@ SCROJCJ9KhVphjTcNqQg2ZiM2PlYCFdE4K/x4bPuC49Vd7iaXOHU7ewAcDu4JyEDPEQMiSEZkUDCfJQY XSyi9dEQGoQIMfPhb/HDVcs1uM25wVnvDKc2juMr2w63wVVfooDmIOK3hVBIeyjx2/kU/DyY/Dv9yUvj RR4aD+J2c8mly4U4rU5k2LWwraeAU8jFApy/n1yziq0LErEAAAAASUVORK5CYII= - - - - 566, 17 - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFJSURBVDhPYwCB8PYH/8Pa7v0HsYObb/0ParwBZsOAd8XZ - /56lp+BiTrkH/jtk70WoAWkObbkLFgBpDqy/hmIASLN78XG4GEizXcZOhBqQ5pDm22ABkGb/2ssoBoA0 - uxYcgYuBNNukbkWoQXY2SLNv1QUUA1wLDv8HORvKZQBptkrehFAD0hwAdTZIM8jPYAkocM5D9bNl0qb/ - 5gnrEGpAmmHORg8wEED3s3nC+v+msasRapCdjR5gIIDuZ5Bm4+gVCDXIzkYPMBBA9zNIs2HEUoQaZGeD - AgzkZ7AEFIA0I/sZpFk/bBFCDbKz0QMMBND9rB+66L9u8HyEGoizD4MFMBIJEKD7GaRZJ3AOQg1yPGMk - EiBA97M2ULOW/ywUNZQBh+w9cNNgoQ3zM8xmkLNBNoPYIKDuMxXOBjsbRKNHFZQJBjg1UwYYGACfxwQX - +x/RKgAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAARCAYAAADUryzEAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFlSURBVDhPY8AFNjcp/0fGUGHiAEjDkwMt/5+dmvn/6dHe - /7s6tP8vLhYhzpC1HXb/9/cZ/7++POj/w52l/48uivsPEiPJgAuTdcGGPFtk8///Zt//L1c4gb0RHRlE - 2BCQAf93h6JioCHHulVJMGC1K1gTGIPYQLyzUZp4A34utoVrBLF/zjb9Xx1NpAEg8KpPE6wJhP9MN/q/ - v0qEOM0ePd7/QbgmjeH/sRoxMN5czPs/sESRsAFOS5z+g3D3/e7/Vdt6/u+/uf//ho3z/1tVWYHFtbK0 - 8BtgMtPkf8rplP/Nt5v/B83O+P/3////PXv6/8fujgWLu2xw+e9d4Y3bEOke6f8xJ2L+Z5/L/g8y7MDT - y2CbQXyQASabTf7Llcvh9kpaWtp/zWma/0MOhYAN0KnXAWsEYevt1mADZBtk8YcFyBDjJGOwTbKpsv9B - rgJhkEaQmEG4AXGxATIIF4YqGTSAgQEAJj8jgyEu8bgAAAAASUVORK5CYII= diff --git a/dp2Circulation/Entity/GenerateData.cs b/dp2Circulation/Entity/GenerateData.cs index 8c04414f3..ad07858f4 100644 --- a/dp2Circulation/Entity/GenerateData.cs +++ b/dp2Circulation/Entity/GenerateData.cs @@ -629,7 +629,8 @@ public void AutoGenerate(object sender, // TODO: 报错是否要直接显示在 dpTable 中? // MessageBox.Show(this._myForm, strError); DisplayAutoGenMenuWindow(false); - this.m_genDataViewer.DisplayError(strError); + if (this.m_genDataViewer != null) + this.m_genDataViewer.DisplayError(strError); } finally { diff --git a/dp2Circulation/ItemInfoForm/ItemInfoForm.Designer.cs b/dp2Circulation/ItemInfoForm/ItemInfoForm.Designer.cs index aba740f77..42ace94b1 100644 --- a/dp2Circulation/ItemInfoForm/ItemInfoForm.Designer.cs +++ b/dp2Circulation/ItemInfoForm/ItemInfoForm.Designer.cs @@ -45,6 +45,8 @@ private void InitializeComponent() this.toolStripButton_prevRecord = new System.Windows.Forms.ToolStripButton(); this.toolStripLabel_message = new System.Windows.Forms.ToolStripLabel(); this.toolStripButton_addSubject = new System.Windows.Forms.ToolStripButton(); + this.tabPage_borrowHistory = new System.Windows.Forms.TabPage(); + this.webBrowser_borrowHistory = new System.Windows.Forms.WebBrowser(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer_main)).BeginInit(); this.splitContainer_main.Panel1.SuspendLayout(); this.splitContainer_main.Panel2.SuspendLayout(); @@ -53,6 +55,7 @@ private void InitializeComponent() this.tabPage_html.SuspendLayout(); this.tabPage_xml.SuspendLayout(); this.toolStrip1.SuspendLayout(); + this.tabPage_borrowHistory.SuspendLayout(); this.SuspendLayout(); // // splitContainer_main @@ -70,8 +73,8 @@ private void InitializeComponent() // splitContainer_main.Panel2 // this.splitContainer_main.Panel2.Controls.Add(this.webBrowser_biblio); - this.splitContainer_main.Size = new System.Drawing.Size(437, 258); - this.splitContainer_main.SplitterDistance = 160; + this.splitContainer_main.Size = new System.Drawing.Size(513, 258); + this.splitContainer_main.SplitterDistance = 187; this.splitContainer_main.SplitterWidth = 6; this.splitContainer_main.TabIndex = 0; // @@ -79,6 +82,7 @@ private void InitializeComponent() // this.tabControl_item.Appearance = System.Windows.Forms.TabAppearance.FlatButtons; this.tabControl_item.Controls.Add(this.tabPage_html); + this.tabControl_item.Controls.Add(this.tabPage_borrowHistory); this.tabControl_item.Controls.Add(this.tabPage_xml); this.tabControl_item.Dock = System.Windows.Forms.DockStyle.Fill; this.tabControl_item.Location = new System.Drawing.Point(0, 0); @@ -86,8 +90,9 @@ private void InitializeComponent() this.tabControl_item.Name = "tabControl_item"; this.tabControl_item.Padding = new System.Drawing.Point(0, 0); this.tabControl_item.SelectedIndex = 0; - this.tabControl_item.Size = new System.Drawing.Size(160, 258); + this.tabControl_item.Size = new System.Drawing.Size(187, 258); this.tabControl_item.TabIndex = 1; + this.tabControl_item.SelectedIndexChanged += new System.EventHandler(this.tabControl_item_SelectedIndexChanged); // // tabPage_html // @@ -95,9 +100,9 @@ private void InitializeComponent() this.tabPage_html.Location = new System.Drawing.Point(4, 25); this.tabPage_html.Margin = new System.Windows.Forms.Padding(0); this.tabPage_html.Name = "tabPage_html"; - this.tabPage_html.Size = new System.Drawing.Size(152, 229); + this.tabPage_html.Size = new System.Drawing.Size(179, 229); this.tabPage_html.TabIndex = 0; - this.tabPage_html.Text = "HTML"; + this.tabPage_html.Text = ""; this.tabPage_html.UseVisualStyleBackColor = true; // // webBrowser_itemHTML @@ -106,7 +111,7 @@ private void InitializeComponent() this.webBrowser_itemHTML.Location = new System.Drawing.Point(0, 0); this.webBrowser_itemHTML.MinimumSize = new System.Drawing.Size(20, 20); this.webBrowser_itemHTML.Name = "webBrowser_itemHTML"; - this.webBrowser_itemHTML.Size = new System.Drawing.Size(152, 229); + this.webBrowser_itemHTML.Size = new System.Drawing.Size(179, 229); this.webBrowser_itemHTML.TabIndex = 0; // // tabPage_xml @@ -127,7 +132,7 @@ private void InitializeComponent() this.webBrowser_itemXml.Margin = new System.Windows.Forms.Padding(2); this.webBrowser_itemXml.MinimumSize = new System.Drawing.Size(15, 16); this.webBrowser_itemXml.Name = "webBrowser_itemXml"; - this.webBrowser_itemXml.Size = new System.Drawing.Size(154, 235); + this.webBrowser_itemXml.Size = new System.Drawing.Size(152, 229); this.webBrowser_itemXml.TabIndex = 0; // // webBrowser_biblio @@ -136,7 +141,7 @@ private void InitializeComponent() this.webBrowser_biblio.Location = new System.Drawing.Point(0, 0); this.webBrowser_biblio.MinimumSize = new System.Drawing.Size(20, 20); this.webBrowser_biblio.Name = "webBrowser_biblio"; - this.webBrowser_biblio.Size = new System.Drawing.Size(271, 258); + this.webBrowser_biblio.Size = new System.Drawing.Size(320, 258); this.webBrowser_biblio.TabIndex = 0; // // label1 @@ -170,13 +175,13 @@ private void InitializeComponent() this.textBox_queryWord.Location = new System.Drawing.Point(166, 10); this.textBox_queryWord.Margin = new System.Windows.Forms.Padding(2); this.textBox_queryWord.Name = "textBox_queryWord"; - this.textBox_queryWord.Size = new System.Drawing.Size(204, 21); + this.textBox_queryWord.Size = new System.Drawing.Size(280, 21); this.textBox_queryWord.TabIndex = 4; // // button_load // this.button_load.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.button_load.Location = new System.Drawing.Point(374, 10); + this.button_load.Location = new System.Drawing.Point(450, 10); this.button_load.Margin = new System.Windows.Forms.Padding(2); this.button_load.Name = "button_load"; this.button_load.Size = new System.Drawing.Size(63, 22); @@ -198,7 +203,7 @@ private void InitializeComponent() this.toolStripButton_addSubject}); this.toolStrip1.Location = new System.Drawing.Point(0, 298); this.toolStrip1.Name = "toolStrip1"; - this.toolStrip1.Size = new System.Drawing.Size(437, 20); + this.toolStrip1.Size = new System.Drawing.Size(513, 20); this.toolStrip1.TabIndex = 6; this.toolStrip1.Text = "toolStrip1"; // @@ -241,12 +246,31 @@ private void InitializeComponent() this.toolStripButton_addSubject.Visible = false; this.toolStripButton_addSubject.Click += new System.EventHandler(this.toolStripButton_addSubject_Click); // + // tabPage_borrowHistory + // + this.tabPage_borrowHistory.Controls.Add(this.webBrowser_borrowHistory); + this.tabPage_borrowHistory.Location = new System.Drawing.Point(4, 25); + this.tabPage_borrowHistory.Name = "tabPage_borrowHistory"; + this.tabPage_borrowHistory.Size = new System.Drawing.Size(179, 229); + this.tabPage_borrowHistory.TabIndex = 2; + this.tabPage_borrowHistory.Text = "ʷ"; + this.tabPage_borrowHistory.UseVisualStyleBackColor = true; + // + // webBrowser_borrowHistory + // + this.webBrowser_borrowHistory.Dock = System.Windows.Forms.DockStyle.Fill; + this.webBrowser_borrowHistory.Location = new System.Drawing.Point(0, 0); + this.webBrowser_borrowHistory.MinimumSize = new System.Drawing.Size(20, 20); + this.webBrowser_borrowHistory.Name = "webBrowser_borrowHistory"; + this.webBrowser_borrowHistory.Size = new System.Drawing.Size(179, 229); + this.webBrowser_borrowHistory.TabIndex = 0; + // // ItemInfoForm // this.AcceptButton = this.button_load; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(437, 326); + this.ClientSize = new System.Drawing.Size(513, 326); this.Controls.Add(this.toolStrip1); this.Controls.Add(this.button_load); this.Controls.Add(this.textBox_queryWord); @@ -270,6 +294,7 @@ private void InitializeComponent() this.tabPage_xml.ResumeLayout(false); this.toolStrip1.ResumeLayout(false); this.toolStrip1.PerformLayout(); + this.tabPage_borrowHistory.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -293,5 +318,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripButton toolStripButton_nextRecord; private System.Windows.Forms.ToolStripLabel toolStripLabel_message; private System.Windows.Forms.ToolStripButton toolStripButton_addSubject; + private System.Windows.Forms.TabPage tabPage_borrowHistory; + private System.Windows.Forms.WebBrowser webBrowser_borrowHistory; } } \ No newline at end of file diff --git a/dp2Circulation/ItemInfoForm/ItemInfoForm.cs b/dp2Circulation/ItemInfoForm/ItemInfoForm.cs index 1ee2d5f44..833ef71f7 100644 --- a/dp2Circulation/ItemInfoForm/ItemInfoForm.cs +++ b/dp2Circulation/ItemInfoForm/ItemInfoForm.cs @@ -70,6 +70,7 @@ public string DbType Commander commander = null; WebExternalHost m_webExternalHost_item = new WebExternalHost(); + WebExternalHost m_chargingInterface = new WebExternalHost(); WebExternalHost m_webExternalHost_biblio = new WebExternalHost(); #if NO @@ -114,6 +115,10 @@ private void ItemInfoForm_Load(object sender, EventArgs e) this.m_webExternalHost_item.Initial(this.MainForm, this.webBrowser_itemHTML); this.webBrowser_itemHTML.ObjectForScripting = this.m_webExternalHost_item; + this.m_chargingInterface.Initial(this.MainForm, this.webBrowser_borrowHistory); + this.m_chargingInterface.CallFunc += m_chargingInterface_CallFunc; + this.webBrowser_borrowHistory.ObjectForScripting = this.m_chargingInterface; + this.m_webExternalHost_biblio.Initial(this.MainForm, this.webBrowser_biblio); this.webBrowser_biblio.ObjectForScripting = this.m_webExternalHost_biblio; @@ -122,6 +127,8 @@ private void ItemInfoForm_Load(object sender, EventArgs e) this.commander.IsBusy += new IsBusyEventHandler(commander_IsBusy); this.Text = this.DbTypeCaption; + + ClearBorrowHistoryPage(); } void commander_IsBusy(object sender, IsBusyEventArgs e) @@ -153,7 +160,8 @@ private void ItemInfoForm_FormClosed(object sender, FormClosedEventArgs e) this.m_webExternalHost_item.Destroy(); if (this.m_webExternalHost_biblio != null) this.m_webExternalHost_biblio.Destroy(); - + if (this.m_chargingInterface != null) + this.m_chargingInterface.Destroy(); #if NO if (stop != null) // 脱离关联 { @@ -206,26 +214,23 @@ public int LoadRecord(string strItemBarcode) EnableControls(false); stop.OnStop += new StopEventHandler(this.DoStop); - stop.Initial("正在初始化浏览器组件 ..."); + stop.Initial("正在装载册信息 ..."); stop.BeginLoop(); - - this.Update(); - this.MainForm.Update(); - - Global.ClearHtmlPage(this.webBrowser_itemHTML, this.MainForm.DataDir); Global.ClearHtmlPage(this.webBrowser_itemXml, this.MainForm.DataDir); Global.ClearHtmlPage(this.webBrowser_biblio, this.MainForm.DataDir); + + ClearBorrowHistoryPage(); + SetItemRefID(""); + // this.textBox_message.Text = ""; this.toolStripLabel_message.Text = ""; stop.SetMessage("正在装入册记录 " + strItemBarcode + " ..."); - - try { string strItemText = ""; @@ -321,6 +326,8 @@ public int LoadRecord(string strItemBarcode) this.MainForm.DataDir, "xml", strItemText); + + SetItemRefID(strItemText); } } finally @@ -335,6 +342,7 @@ public int LoadRecord(string strItemBarcode) this.textBox_queryWord.Focus(); } + tabControl_item_SelectedIndexChanged(this, new EventArgs()); return 1; ERROR1: MessageBox.Show(this, strError); @@ -401,13 +409,15 @@ public int LoadRecordByRecPath(string strItemRecPath, this.MainForm.DataDir); Global.ClearHtmlPage(this.webBrowser_biblio, this.MainForm.DataDir); + // this.textBox_message.Text = ""; this.toolStripLabel_message.Text = ""; } - stop.SetMessage("正在装入"+this.DbTypeCaption+"记录 " + strItemRecPath + " ..."); - + ClearBorrowHistoryPage(); + SetItemRefID(""); + stop.SetMessage("正在装入" + this.DbTypeCaption + "记录 " + strItemRecPath + " ..."); try { string strItemText = ""; @@ -421,24 +431,24 @@ public int LoadRecordByRecPath(string strItemRecPath, string strBarcode = "@path:" + strRecPath; long lRet = 0; - + if (this.m_strDbType == "item") - lRet = Channel.GetItemInfo( - stop, - strBarcode, - "html", - out strItemText, - out strOutputItemRecPath, - out item_timestamp, - "html", - out strBiblioText, - out strBiblioRecPath, - out strError); + lRet = Channel.GetItemInfo( + stop, + strBarcode, + "html", + out strItemText, + out strOutputItemRecPath, + out item_timestamp, + "html", + out strBiblioText, + out strBiblioRecPath, + out strError); else if (this.m_strDbType == "comment") lRet = Channel.GetCommentInfo( stop, strBarcode, // "@path:" + strItemRecPath, - // "", + // "", "html", out strItemText, out strOutputItemRecPath, @@ -451,7 +461,7 @@ public int LoadRecordByRecPath(string strItemRecPath, lRet = Channel.GetOrderInfo( stop, strBarcode, // "@path:" + strItemRecPath, - // "", + // "", "html", out strItemText, out strOutputItemRecPath, @@ -464,7 +474,7 @@ public int LoadRecordByRecPath(string strItemRecPath, lRet = Channel.GetIssueInfo( stop, strBarcode, // "@path:" + strItemRecPath, - // "", + // "", "html", out strItemText, out strOutputItemRecPath, @@ -476,11 +486,8 @@ public int LoadRecordByRecPath(string strItemRecPath, else throw new Exception("未知的DbType '" + this.m_strDbType + "'"); - if (lRet == -1 || lRet == 0) { - - if (bPrevNext == true && this.Channel.ErrorCode == DigitalPlatform.LibraryClient.localhost.ErrorCode.NotFound) { @@ -532,28 +539,28 @@ public int LoadRecordByRecPath(string strItemRecPath, } // this.textBox_message.Text = "册记录路径: " + strOutputItemRecPath + " ;其从属的种(书目)记录路径: " + strBiblioRecPath; - this.toolStripLabel_message.Text = this.DbTypeCaption+"记录路径: " + strOutputItemRecPath + " ;其从属的种(书目)记录路径: " + strBiblioRecPath; + this.toolStripLabel_message.Text = this.DbTypeCaption + "记录路径: " + strOutputItemRecPath + " ;其从属的种(书目)记录路径: " + strBiblioRecPath; this.textBox_queryWord.Text = this.ItemRecPath; // strItemRecPath; - this.comboBox_from.Text = this.DbTypeCaption+"记录路径"; + this.comboBox_from.Text = this.DbTypeCaption + "记录路径"; // 最后获得item xml if (this.m_strDbType == "item") - lRet = Channel.GetItemInfo( - stop, - "@path:" + strOutputItemRecPath, // strBarcode, - "xml", - out strItemText, - out strItemRecPath, - out item_timestamp, - null, // "html", - out strBiblioText, - out strBiblioRecPath, - out strError); + lRet = Channel.GetItemInfo( + stop, + "@path:" + strOutputItemRecPath, // strBarcode, + "xml", + out strItemText, + out strItemRecPath, + out item_timestamp, + null, // "html", + out strBiblioText, + out strBiblioRecPath, + out strError); else if (this.m_strDbType == "comment") lRet = Channel.GetCommentInfo( stop, "@path:" + strOutputItemRecPath, - // "", + // "", "xml", out strItemText, out strOutputItemRecPath, @@ -566,7 +573,7 @@ public int LoadRecordByRecPath(string strItemRecPath, lRet = Channel.GetOrderInfo( stop, "@path:" + strOutputItemRecPath, - // "", + // "", "xml", out strItemText, out strOutputItemRecPath, @@ -579,7 +586,7 @@ public int LoadRecordByRecPath(string strItemRecPath, lRet = Channel.GetIssueInfo( stop, "@path:" + strOutputItemRecPath, - // "", + // "", "xml", out strItemText, out strOutputItemRecPath, @@ -591,7 +598,6 @@ public int LoadRecordByRecPath(string strItemRecPath, else throw new Exception("未知的DbType '" + this.m_strDbType + "'"); - if (lRet == -1 || lRet == 0) { Global.SetHtmlString(this.webBrowser_itemXml, @@ -609,6 +615,8 @@ public int LoadRecordByRecPath(string strItemRecPath, this.MainForm.DataDir, "xml", strItemText); + + SetItemRefID(strItemText); } } finally @@ -620,12 +628,37 @@ public int LoadRecordByRecPath(string strItemRecPath, EnableControls(true); } + tabControl_item_SelectedIndexChanged(this, new EventArgs()); return 1; ERROR1: MessageBox.Show(this, strError); return -1; } + string _itemBarcode = ""; + string _refID = ""; + + // 设置当前记录的唯一标识 + void SetItemRefID(string strXml) + { + _itemBarcode = ""; + _refID = ""; + + if (string.IsNullOrEmpty(strXml) == true) + return; // 起到清除的作用 + + XmlDocument dom = new XmlDocument(); + try + { + dom.LoadXml(strXml); + _itemBarcode = DomUtil.GetElementText(dom.DocumentElement, "barcode"); + _refID = DomUtil.GetElementText(dom.DocumentElement, "refID"); + } + catch + { + + } + } #if NO void DoStop(object sender, StopEventArgs e) { @@ -774,7 +807,7 @@ private void DoLoadRecord() int nRet = this.textBox_queryWord.Text.IndexOf("/"); if (nRet == -1) { - strError = "您输入的检索词似乎为一个册条码号,而不是"+this.DbTypeCaption+"记录路径"; + strError = "您输入的检索词似乎为一个册条码号,而不是" + this.DbTypeCaption + "记录路径"; MessageBox.Show(this, strError); } @@ -1425,7 +1458,7 @@ int GetExistSubject( out string strBiblioXml, out List reserve_subjects, out List subjects, - out byte [] timestamp, + out byte[] timestamp, out string strError) { strError = ""; @@ -1531,5 +1564,324 @@ public static int GetSubjectInfo(string strMARC, return 0; } + + void m_chargingInterface_CallFunc(object sender, EventArgs e) + { + if (this.DbType != "item") + return; + + string name = sender as string; + this.BeginInvoke(new Action(LoadBorrowHistory), name); + } + + void LoadBorrowHistory(string action) + { + string strError = ""; + int nPageNo = 0; + if (action == "load") + nPageNo = 0; + else if (action == "loadAll") + nPageNo = -1; + else if (action == "prevPage") + { + nPageNo = _currentPageNo - 1; + if (nPageNo < 0) + { + strError = "已经到头"; + goto ERROR1; + } + } + else if (action == "nextPage") + { + nPageNo = _currentPageNo + 1; + if (nPageNo > _pageCount - 1) + { + strError = "已经到尾"; + goto ERROR1; + } + } + else if (action == "firstPage") + nPageNo = 0; + else if (action == "tailPage") + { + if (_pageCount <= 0) + { + strError = "没有尾页"; + goto ERROR1; + } + nPageNo = _pageCount - 1; + } + + string strItemRefID = GetItemRefID(); + + if (string.IsNullOrEmpty(strItemRefID) == true) + { + strError = "strItemRefID 为空"; + goto ERROR1; + } + + int nRet = LoadBorrowHistory(strItemRefID, + nPageNo, + out strError); + if (nRet == -1) + goto ERROR1; + return; + ERROR1: + this.ShowMessage(strError, "red", true); + } + + string GetItemRefID() + { + if (string.IsNullOrEmpty(this._itemBarcode) == false) + return "@itemBarcode:" + this._itemBarcode; + return "@itemRefID:" + this._refID; + } + + static int _itemsPerPage = 10; + + // parameters: + // nPageNo 页号。如果为 -1,表示希望从头获取全部内容 + int LoadBorrowHistory( + string strBarcode, + int nPageNo, + out string strError) + { + strError = ""; + + stop.OnStop += new StopEventHandler(this.DoStop); + stop.Initial("正在装载借阅历史 ..."); + stop.BeginLoop(); + + EnableControls(false); + try + { + long lRet = 0; + List total_results = new List(); + + int nLength = 0; + if (nPageNo == -1) + { + nPageNo = 0; + nLength = -1; + } + else + { + nLength = _itemsPerPage; + } + + this.Channel.Idle += Channel_Idle; // 防止控制权出让给正在获取摘要的读者信息 HTML 页面 + try + { + lRet = this.Channel.LoadBorrowHistory(stop, + strBarcode, + nPageNo, + nLength, + out total_results, + out strError); + if (lRet == -1) + return -1; + + _currentPageNo = nPageNo; + } + finally + { + this.Channel.Idle -= Channel_Idle; + } + + FillBorrowHistoryPage(total_results, nPageNo * _itemsPerPage, (int)lRet); + return 0; + } + finally + { + EnableControls(true); + + stop.EndLoop(); + stop.OnStop -= new StopEventHandler(this.DoStop); + stop.Initial(""); + } + } + + void Channel_Idle(object sender, IdleEventArgs e) + { + e.bDoEvents = false; + } + + void ClearBorrowHistoryPage() + { + ClearHtml(); + + string strItemLink = "" + HttpUtility.HtmlEncode("装载") + ""; + + AppendHtml(""); + AppendHtml(strItemLink); + AppendHtml(""); + + _borrowHistoryLoaded = false; + } + + int _currentPageNo = 0; + int _pageCount = 0; + + static string MakeAnchor(string name, string caption, bool enabled) + { + if (enabled) + return "" + HttpUtility.HtmlEncode(caption) + ""; + return HttpUtility.HtmlEncode(caption); + } + + void FillBorrowHistoryPage(List items, + int nStart, + int nTotalCount) + { + this.ClearMessage(); + + StringBuilder text = new StringBuilder(); + + _currentPageNo = nStart / _itemsPerPage; + _pageCount = nTotalCount / _itemsPerPage; + if ((nTotalCount % _itemsPerPage) > 0) + _pageCount++; + + string strBinDir = Environment.CurrentDirectory; + + string strCssUrl = Path.Combine(this.MainForm.DataDir, "default\\inventory.css"); + string strLink = ""; + string strScriptHead = "" + + "" + + ""; + string strStyle = @""; + + text.Append("" + + strLink + + strScriptHead.Replace("%bindir%", strBinDir) + + strStyle + + ""); + + string strFirstPageLink = MakeAnchor("firstPage", "首页", _currentPageNo > 0); + string strPrevPageLink = MakeAnchor("prevPage", "前页", _currentPageNo > 0); + string strNextPageLink = MakeAnchor("nextPage", "后页", _currentPageNo < _pageCount - 1); + string strTailPageLink = MakeAnchor("tailPage", "末页", _currentPageNo != _pageCount - 1 && _pageCount > 0); + string strLoadAllLink = MakeAnchor("loadAll", "装载全部", _pageCount > 1); + + string strPages = (_currentPageNo + 1) + "/" + _pageCount + " "; + if (items.Count > _itemsPerPage) + strPages = "(全部)"; + + text.Append(strPages + + strFirstPageLink + " " + strPrevPageLink + " " + strNextPageLink + " " + strTailPageLink + "     " + + strLoadAllLink); + + text.Append(""); + text.Append(""); + text.Append(""); + text.Append(""); + text.Append(""); + text.Append(""); + text.Append(""); + text.Append(""); + text.Append(""); + text.Append(""); + text.Append(""); + + foreach (ChargingItemWrapper wrapper in items) + { + ChargingItem item = wrapper.Item; + text.Append(""); + text.Append(""); + + text.Append(""); + text.Append(""); + + string strPeriod = ""; + if (wrapper.RelatedItem != null) + strPeriod = wrapper.RelatedItem.Period; + text.Append(""); + + string strBorrowOperator = ""; + string strBorrowTime = ""; + if (wrapper.RelatedItem != null) + { + strBorrowOperator = wrapper.RelatedItem.Operator; + strBorrowTime = wrapper.RelatedItem.OperTime; + } + + text.Append(""); + text.Append(""); + + text.Append(""); + text.Append(""); + + text.Append(""); + nStart++; + } + text.Append("
序号证条码号姓名期限借阅操作者借阅操作时间还回操作者还回操作时间
" + (nStart + 1).ToString() + "" + HttpUtility.HtmlEncode(item.PatronBarcode) + "P:" + HttpUtility.HtmlEncode(item.PatronBarcode) + "" + HttpUtility.HtmlEncode(strPeriod) + "" + HttpUtility.HtmlEncode(strBorrowOperator) + "" + HttpUtility.HtmlEncode(strBorrowTime) + "" + HttpUtility.HtmlEncode(item.Operator) + "" + HttpUtility.HtmlEncode(item.OperTime) + "
"); + text.Append(""); + + this.m_chargingInterface.SetHtmlString(text.ToString(), + "readerinfoform_charginghis"); + } + + /// + /// 清除已有的 HTML 显示 + /// + public void ClearHtml() + { + string strCssUrl = Path.Combine(this.MainForm.DataDir, "default\\inventory.css"); + string strLink = ""; + string strJs = ""; + + { + HtmlDocument doc = this.webBrowser_borrowHistory.Document; + + if (doc == null) + { + this.webBrowser_borrowHistory.Navigate("about:blank"); + doc = this.webBrowser_borrowHistory.Document; + } + doc = doc.OpenNew(true); + } + + Global.WriteHtml(this.webBrowser_borrowHistory, + "" + strLink + strJs + ""); + } + + /// + /// 向 IE 控件中追加一段 HTML 内容 + /// + /// HTML 内容 + public void AppendHtml(string strText) + { + if (this.InvokeRequired) + { + this.BeginInvoke(new Action(AppendHtml), strText); + return; + } + + Global.WriteHtml(this.webBrowser_borrowHistory, + strText); + + // 因为HTML元素总是没有收尾,其他有些方法可能不奏效 + this.webBrowser_borrowHistory.Document.Window.ScrollTo(0, + this.webBrowser_borrowHistory.Document.Body.ScrollRectangle.Height); + } + + bool _borrowHistoryLoaded = false; + + private void tabControl_item_SelectedIndexChanged(object sender, EventArgs e) + { + if (this.tabControl_item.SelectedTab == this.tabPage_borrowHistory) + { + if (_borrowHistoryLoaded == false) + { + this.BeginInvoke(new Action(LoadBorrowHistory), "load"); + _borrowHistoryLoaded = true; + } + } + } + } } \ No newline at end of file diff --git a/dp2Circulation/ItemInfoForm/ItemInfoForm.resx b/dp2Circulation/ItemInfoForm/ItemInfoForm.resx index fc6cd4949..ff8f963a8 100644 --- a/dp2Circulation/ItemInfoForm/ItemInfoForm.resx +++ b/dp2Circulation/ItemInfoForm/ItemInfoForm.resx @@ -124,29 +124,26 @@ iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADtJREFUSEtjYBgF - oyEwfEPgP9BrxGKSQ4EYg0k2FKYBn+FkG4rPcIoNxWY41QxFNpzqho4aOBoCgzkEAGN4I91pmacrAAAA - AElFTkSuQmCC + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAxSURBVEhLYxgFo2AYg/8kYJIBNkPQMdkAm2EwTDGgiaEw + QBNDYYAmho6CUTB4AQMDAGN4I93EZGL4AAAAAElFTkSuQmCC iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADlJREFUSEtjYBgF - oyEwskLgPy28CzIUhqlmPrKhVDMcm6EUG47PULINJ8ZQsg2nWiSNGjQaAjQOAQAkZiPdUn7QswAAAABJ - RU5ErkJggg== + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA1SURBVEhLYxgFo2CEgf9QmqoAZCgMUw0gG0o1w7EZCsNk + A2yGoWOSATZDcOFRMAqGKWBgAAAkZiPdgt4dxgAAAABJRU5ErkJggg== iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAS1JREFUOE9j/NIl - b8DwnzmF8f//OAYSwH9GxkUMjH/nMHxqU5jyebbdr6/L/f+TgkF6QHoZPrTIfQJp/NjEShIG6QHpZXjb - KIswoJH5/0cc+D8UfF0ZDLYIZABIL8OLeimCBoD0wgwGs6EGgPQyPKmRwGsAsmaQIcgGgPQyPKgQxWvA - z9PTIZpgmkFehLoApJfhTokgTgNgmpENAXsFagBIL8O1An4MA0A2ImvGCFioASC9DJdyeFAMQHYuyBCs - sQI1AKSX4WwWJ9wArAGGLVqhBoD0MpxK58BqALphKC6BGgDSy3AsmRVuACiRwACuBIUciCC9DIcTmd9/ - WeYHDFk2EpIy23+QHpBehgOxjH0POvVJzkwgPSC9DHvjGLT3xTL07Y1h+EQKBusB6gUA2UKDlx1vhEYA - AAAASUVORK5CYII= + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEgSURBVDhPY/jSJW/wpVNpytd2hU+kYJAekF6Gj20KUz7N + tvv1dbn/f1IwSA9IL8OHZtlPIIGPTawkYZAekF6Gtw1IBjQy48Qw8HVlMNwAkF6G5/VSBA0AARQ21ACQ + XobHNRJ4DQBrQOdDDQDpZXhQIYrXgJ+np0M0AdkwGmYASC/DnWIBnAbANCMbAsZQA0B6Ga7m82EYAALI + muEaYRhqAEgvw8VsbhQDQABGY9UMwlADQHoZzmZxwg0AAWSF6Hw4hhoA0stwKp0DqwHIbAwMNQCkl+FY + MivcAFAigQGsGmEYagBIL8PhROb3X5b5AQXZwBLEYbb/ID0gvQwHYhn7HnTokZyZQHpAehn2xjFo74tl + 6NsTzfCJFAzSszeOQRsA3gShNwzhJtYAAAAASUVORK5CYII= diff --git a/dp2Circulation/Order/PrintClaimForm.cs b/dp2Circulation/Order/PrintClaimForm.cs index 94db0710e..2f657eb09 100644 --- a/dp2Circulation/Order/PrintClaimForm.cs +++ b/dp2Circulation/Order/PrintClaimForm.cs @@ -1300,7 +1300,7 @@ int DoLoop(out string strError, { // int nCount = 0; - for (int nRecord=0; ;nRecord++) + for (int nRecord = 0; ; nRecord++) { Application.DoEvents(); // 出让界面控制权 @@ -1518,50 +1518,10 @@ int DoLoop(out string strError, if (nRet == 0) continue; - - /* - // 处理一条书目记录以及其下的订购、期记录 - nRet = host.LoadIssueRecords(strRecPath, - out strError); - if (nRet == -1) - { - strError = "在IssueHost中装入记录 " + strRecPath + " 的下属期记录时发生错误:" + strError; - this.WriteHtml(strError + "\r\n"); - continue; - } - - nRet = host.LoadOrderRecords(strRecPath, - out strError); - if (nRet == -1) - { - strError = "在IssueHost中装入记录 " + strRecPath + " 的下属订购记录时发生错误: " + strError; - this.WriteHtml(strError + "\r\n"); - continue; - } - - nRet = host.CreateIssues(out strError); - if (nRet == -1) - { - strError = "在IssueHost中CreateIssues() " + strRecPath + " error: " + strError; - this.WriteHtml(strError + "\r\n"); - continue; - } - - if (nRet != 0) - { - this.WriteHtml(host.BiblioRecPath + "\r\n" + host.DumpIssue() + "\r\n"); - } - * */ - /* - CONTINUE: - nCount++; - * */ } - } finally { - if (sr != null) sr.Close(); } @@ -2466,49 +2426,49 @@ private void comboBox_source_type_TextChanged(object sender, EventArgs e) // - if (this.comboBox_inputOrderDbName.Items.Count > 0) - { - this.comboBox_inputOrderDbName.Items.Clear(); - } + if (this.comboBox_inputOrderDbName.Items.Count > 0) + { + this.comboBox_inputOrderDbName.Items.Clear(); + } - strText = this.comboBox_inputOrderDbName.Text; + strText = this.comboBox_inputOrderDbName.Text; - // 检查一下当前已经选定的订购库名和出版物类型是否矛盾 - if (this.comboBox_source_type.Text == "图书" - && this.comboBox_inputOrderDbName.Text == "<全部期刊>") - { - this.comboBox_inputOrderDbName.Text = "<全部图书>"; - return; - } - if (this.comboBox_source_type.Text == "连续出版物" + // 检查一下当前已经选定的订购库名和出版物类型是否矛盾 + if (this.comboBox_source_type.Text == "图书" + && this.comboBox_inputOrderDbName.Text == "<全部期刊>") + { + this.comboBox_inputOrderDbName.Text = "<全部图书>"; + return; + } + if (this.comboBox_source_type.Text == "连续出版物" && this.comboBox_inputOrderDbName.Text == "<全部图书>") - { - this.comboBox_inputOrderDbName.Text = "<全部期刊>"; - return; - } - if (this.MainForm.BiblioDbProperties != null) - { - for (int i = 0; i < this.MainForm.BiblioDbProperties.Count; i++) - { - BiblioDbProperty prop = this.MainForm.BiblioDbProperties[i]; + { + this.comboBox_inputOrderDbName.Text = "<全部期刊>"; + return; + } + if (this.MainForm.BiblioDbProperties != null) + { + for (int i = 0; i < this.MainForm.BiblioDbProperties.Count; i++) + { + BiblioDbProperty prop = this.MainForm.BiblioDbProperties[i]; - if (strText == prop.OrderDbName) - { - if (this.comboBox_source_type.Text == "图书" - && String.IsNullOrEmpty(prop.IssueDbName) == false) - { - this.comboBox_inputOrderDbName.Text = ""; - break; - } - else if (this.comboBox_source_type.Text == "连续出版物" - && String.IsNullOrEmpty(prop.IssueDbName) == true) - { - this.comboBox_inputOrderDbName.Text = ""; - break; - } - } - } - } + if (strText == prop.OrderDbName) + { + if (this.comboBox_source_type.Text == "图书" + && String.IsNullOrEmpty(prop.IssueDbName) == false) + { + this.comboBox_inputOrderDbName.Text = ""; + break; + } + else if (this.comboBox_source_type.Text == "连续出版物" + && String.IsNullOrEmpty(prop.IssueDbName) == true) + { + this.comboBox_inputOrderDbName.Text = ""; + break; + } + } + } + } } private void button_next_Click(object sender, EventArgs e) @@ -2876,9 +2836,9 @@ int PrintOneSeller(OneSeller seller, if (String.IsNullOrEmpty((string)macro_table["%selleraddress%"]) == false) strAddressLine = "致:%selleraddress%

"; - string strText = strAddressLine + "尊敬的 %seller%:
我馆在贵处订购的以下"+this.TypeName+" %seriescount% 种,有 " + string strText = strAddressLine + "尊敬的 %seller%:
我馆在贵处订购的以下" + this.TypeName + " %seriescount% 种,有 " + (this.TypeName == "期刊" ? "%issuecount% 期 " : "") - +"共 %missingitemcount% 册至今未到。望尽快补齐为盼。谢谢。

%libraryname%
%date%"; + + "共 %missingitemcount% 册至今未到。望尽快补齐为盼。谢谢。

%libraryname%
%date%"; strText = StringUtil.MacroString(macro_table, strText); @@ -2965,7 +2925,7 @@ static int GetMissingItemCount(OneSeller seller) // 输出一种期刊的信息 void PrintOneSeries(PrintOption option, - Hashtable macro_table, + Hashtable macro_table, OneSeries series, string strFilename) { @@ -3166,7 +3126,7 @@ string GetColumnContent(IssueInfo info, case "出版日期": { string strPublishTime = ""; - + if (string.IsNullOrEmpty(info.PublishTime) == false) strPublishTime = DateTimeUtil.ForcePublishTime8(info.PublishTime); @@ -3209,7 +3169,7 @@ string GetColumnContent(IssueInfo info, } catch { - return null; + return null; } } @@ -3501,7 +3461,7 @@ private void comboBox_inputOrderDbName_DropDown(object sender, EventArgs e) BiblioDbProperty prop = this.MainForm.BiblioDbProperties[i]; if (String.IsNullOrEmpty(prop.OrderDbName) == true) - continue; + continue; if (this.comboBox_source_type.Text == "图书") { diff --git a/dp2Circulation/Reader/ChargingHistoryHost.cs b/dp2Circulation/Reader/ChargingHistoryHost.cs deleted file mode 100644 index 641595314..000000000 --- a/dp2Circulation/Reader/ChargingHistoryHost.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Permissions; -using System.Text; - -namespace dp2Circulation -{ - - /// - /// 用于出纳历史显示 Web 控件的 Script 宿主类 - /// - [PermissionSet(SecurityAction.Demand, Name = "FullTrust")] - [System.Runtime.InteropServices.ComVisibleAttribute(true)] - public class ChargingHistoryHost : IDisposable - { - public event EventHandler ButtonClick = null; - - /// - /// 释放资源 - /// - public void Dispose() - { - } - - - - } -} diff --git a/dp2Circulation/Reader/ReaderInfoForm.Designer.cs b/dp2Circulation/Reader/ReaderInfoForm.Designer.cs index e52917e4a..57c9646e7 100644 --- a/dp2Circulation/Reader/ReaderInfoForm.Designer.cs +++ b/dp2Circulation/Reader/ReaderInfoForm.Designer.cs @@ -34,6 +34,8 @@ private void InitializeComponent() this.webBrowser_readerInfo = new System.Windows.Forms.WebBrowser(); this.tabControl_readerInfo = new System.Windows.Forms.TabControl(); this.tabPage_normal = new System.Windows.Forms.TabPage(); + this.tabPage_borrowHistory = new System.Windows.Forms.TabPage(); + this.webBrowser_borrowHistory = new System.Windows.Forms.WebBrowser(); this.tabPage_xml = new System.Windows.Forms.TabPage(); this.webBrowser_xml = new System.Windows.Forms.WebBrowser(); this.tabPage_objects = new System.Windows.Forms.TabPage(); @@ -80,20 +82,18 @@ private void InitializeComponent() this.toolStripTextBox_barcode = new System.Windows.Forms.ToolStripTextBox(); this.toolStripButton_load = new System.Windows.Forms.ToolStripButton(); this.tableLayoutPanel_main = new System.Windows.Forms.TableLayoutPanel(); - this.tabPage_borrowHistory = new System.Windows.Forms.TabPage(); - this.webBrowser_borrowHistory = new System.Windows.Forms.WebBrowser(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer_normal)).BeginInit(); this.splitContainer_normal.Panel1.SuspendLayout(); this.splitContainer_normal.Panel2.SuspendLayout(); this.splitContainer_normal.SuspendLayout(); this.tabControl_readerInfo.SuspendLayout(); this.tabPage_normal.SuspendLayout(); + this.tabPage_borrowHistory.SuspendLayout(); this.tabPage_xml.SuspendLayout(); this.tabPage_objects.SuspendLayout(); this.toolStrip1.SuspendLayout(); this.toolStrip_load.SuspendLayout(); this.tableLayoutPanel_main.SuspendLayout(); - this.tabPage_borrowHistory.SuspendLayout(); this.SuspendLayout(); // // splitContainer_normal @@ -185,6 +185,7 @@ private void InitializeComponent() this.tabControl_readerInfo.SelectedIndex = 0; this.tabControl_readerInfo.Size = new System.Drawing.Size(606, 283); this.tabControl_readerInfo.TabIndex = 3; + this.tabControl_readerInfo.SelectedIndexChanged += new System.EventHandler(this.tabControl_readerInfo_SelectedIndexChanged); // // tabPage_normal // @@ -198,6 +199,25 @@ private void InitializeComponent() this.tabPage_normal.Text = ""; this.tabPage_normal.UseVisualStyleBackColor = true; // + // tabPage_borrowHistory + // + this.tabPage_borrowHistory.Controls.Add(this.webBrowser_borrowHistory); + this.tabPage_borrowHistory.Location = new System.Drawing.Point(4, 22); + this.tabPage_borrowHistory.Name = "tabPage_borrowHistory"; + this.tabPage_borrowHistory.Size = new System.Drawing.Size(598, 257); + this.tabPage_borrowHistory.TabIndex = 3; + this.tabPage_borrowHistory.Text = "ʷ"; + this.tabPage_borrowHistory.UseVisualStyleBackColor = true; + // + // webBrowser_borrowHistory + // + this.webBrowser_borrowHistory.Dock = System.Windows.Forms.DockStyle.Fill; + this.webBrowser_borrowHistory.Location = new System.Drawing.Point(0, 0); + this.webBrowser_borrowHistory.MinimumSize = new System.Drawing.Size(20, 20); + this.webBrowser_borrowHistory.Name = "webBrowser_borrowHistory"; + this.webBrowser_borrowHistory.Size = new System.Drawing.Size(598, 257); + this.webBrowser_borrowHistory.TabIndex = 0; + // // tabPage_xml // this.tabPage_xml.Controls.Add(this.webBrowser_xml); @@ -648,25 +668,6 @@ private void InitializeComponent() this.tableLayoutPanel_main.Size = new System.Drawing.Size(610, 337); this.tableLayoutPanel_main.TabIndex = 6; // - // tabPage_borrowHistory - // - this.tabPage_borrowHistory.Controls.Add(this.webBrowser_borrowHistory); - this.tabPage_borrowHistory.Location = new System.Drawing.Point(4, 22); - this.tabPage_borrowHistory.Name = "tabPage_borrowHistory"; - this.tabPage_borrowHistory.Size = new System.Drawing.Size(598, 257); - this.tabPage_borrowHistory.TabIndex = 3; - this.tabPage_borrowHistory.Text = "ʷ"; - this.tabPage_borrowHistory.UseVisualStyleBackColor = true; - // - // webBrowser_borrowHistory - // - this.webBrowser_borrowHistory.Dock = System.Windows.Forms.DockStyle.Fill; - this.webBrowser_borrowHistory.Location = new System.Drawing.Point(0, 0); - this.webBrowser_borrowHistory.MinimumSize = new System.Drawing.Size(20, 20); - this.webBrowser_borrowHistory.Name = "webBrowser_borrowHistory"; - this.webBrowser_borrowHistory.Size = new System.Drawing.Size(598, 257); - this.webBrowser_borrowHistory.TabIndex = 0; - // // ReaderInfoForm // this.AllowDrop = true; @@ -693,6 +694,7 @@ private void InitializeComponent() this.splitContainer_normal.ResumeLayout(false); this.tabControl_readerInfo.ResumeLayout(false); this.tabPage_normal.ResumeLayout(false); + this.tabPage_borrowHistory.ResumeLayout(false); this.tabPage_xml.ResumeLayout(false); this.tabPage_objects.ResumeLayout(false); this.toolStrip1.ResumeLayout(false); @@ -701,7 +703,6 @@ private void InitializeComponent() this.toolStrip_load.PerformLayout(); this.tableLayoutPanel_main.ResumeLayout(false); this.tableLayoutPanel_main.PerformLayout(); - this.tabPage_borrowHistory.ResumeLayout(false); this.ResumeLayout(false); } diff --git a/dp2Circulation/Reader/ReaderInfoForm.cs b/dp2Circulation/Reader/ReaderInfoForm.cs index a4eebfc17..313cbddbf 100644 --- a/dp2Circulation/Reader/ReaderInfoForm.cs +++ b/dp2Circulation/Reader/ReaderInfoForm.cs @@ -190,7 +190,7 @@ private void ReaderInfoForm_Load(object sender, EventArgs e) LoadExternalFields(); - FillBorrowHistoryStartPage(); + ClearBorrowHistoryPage(); API.PostMessage(this.Handle, WM_SET_FOCUS, 0, 0); } @@ -540,6 +540,8 @@ public int LoadRecord(string strBarcode, ClearReaderHtmlPage(); this.binaryResControl1.Clear(); + this.ClearBorrowHistoryPage(); + try { byte[] baTimestamp = null; @@ -727,6 +729,7 @@ public int LoadRecord(string strBarcode, this.m_nChannelInUse--; } + tabControl_readerInfo_SelectedIndexChanged(this, new EventArgs()); return 1; ERROR1: MessageBox.Show(this, strError); @@ -743,11 +746,6 @@ void ClearReaderHtmlPage() this.MainForm.DataDir); this.m_chargingInterface.StopPrevious(); - FillBorrowHistoryStartPage(); -#if NO - Global.ClearHtmlPage(this.webBrowser_borrowHistory, - this.MainForm.DataDir); -#endif } void SetReaderHtmlString(string strHtml) @@ -825,9 +823,6 @@ public int LoadRecordByRecPath(string strRecPath, stop.Initial("正在初始化浏览器组件 ..."); stop.BeginLoop(); - this.Update(); - this.MainForm.Update(); - EnableControls(false); // NewExternal(); @@ -844,6 +839,8 @@ public int LoadRecordByRecPath(string strRecPath, this.binaryResControl1.Clear(); } + this.ClearBorrowHistoryPage(); + try { byte[] baTimestamp = null; @@ -969,6 +966,7 @@ public int LoadRecordByRecPath(string strRecPath, this.m_nChannelInUse--; } + tabControl_readerInfo_SelectedIndexChanged(this, new EventArgs()); return 1; ERROR1: MessageBox.Show(this, strError); @@ -5587,16 +5585,58 @@ private void toolStripMenuItem_exportDetailToExcelFile_Click(object sender, Even MessageBox.Show(this, strError); } - void LoadBorrowHistory() + void LoadBorrowHistory(string action) { string strError = ""; + int nPageNo = 0; + if (action == "load") + nPageNo = 0; + else if (action == "loadAll") + nPageNo = -1; + else if (action == "prevPage") + { + nPageNo = _currentPageNo - 1; + if (nPageNo < 0) + { + strError = "已经到头"; + goto ERROR1; + } + } + else if (action == "nextPage") + { + nPageNo = _currentPageNo + 1; + if (nPageNo > _pageCount - 1) + { + strError = "已经到尾"; + goto ERROR1; + } + } + else if (action == "firstPage") + nPageNo = 0; + else if (action == "tailPage") + { + if (_pageCount <= 0) + { + strError = "没有尾页"; + goto ERROR1; + } + nPageNo = _pageCount - 1; + } + int nRet = LoadBorrowHistory(this.toolStripTextBox_barcode.Text, - 0, - out strError); + nPageNo, + out strError); if (nRet == -1) - MessageBox.Show(this, strError); + goto ERROR1; + return; + ERROR1: + this.ShowMessage(strError, "red", true); } + static int _itemsPerPage = 10; + + // parameters: + // nPageNo 页号。如果为 -1,表示希望从头获取全部内容 int LoadBorrowHistory( string strBarcode, int nPageNo, @@ -5611,31 +5651,41 @@ int LoadBorrowHistory( EnableControls(false); try { - ChargingItem[] results = null; - long lStart = nPageNo * 10; + List total_results = new List(); + + int nLength = 0; + if (nPageNo == -1) + { + nPageNo = 0; + nLength = -1; + } + else + { + nLength = _itemsPerPage; + } + long lRet = 0; this.Channel.Idle += Channel_Idle; // 防止控制权出让给正在获取摘要的读者信息 HTML 页面 try { - lRet = this.Channel.SearchCharging( + lRet = this.Channel.LoadBorrowHistory( stop, strBarcode, - "~", - "borrow,return,renew,lost", - "", - lStart, - 10, - out results, + nPageNo, + nLength, + out total_results, out strError); + if (lRet == -1) + return -1; + + _currentPageNo = nPageNo; } finally { this.Channel.Idle -= Channel_Idle; } - if (lRet == -1) - return -1; - FillBorrowHistoryPage(results, (int)lStart, (int)lRet); + FillBorrowHistoryPage(total_results, nPageNo * _itemsPerPage, (int)lRet); return 0; } finally @@ -5648,6 +5698,91 @@ int LoadBorrowHistory( } } +#if NO + // parameters: + // nPageNo 页号。如果为 -1,表示希望从头获取全部内容 + int LoadBorrowHistory( + string strBarcode, + int nPageNo, + out string strError) + { + strError = ""; + + stop.OnStop += new StopEventHandler(this.DoStop); + stop.Initial("正在装载借阅历史 ..."); + stop.BeginLoop(); + + EnableControls(false); + try + { + List total_results = new List(); + long lHitCount = 0; + + long lLength = 0; + long lStart = 0; + if (nPageNo == -1) + lLength = -1; + else + { + lStart = nPageNo * _itemsPerPage; + lLength = _itemsPerPage; + } + int nGeted = 0; + this.Channel.Idle += Channel_Idle; // 防止控制权出让给正在获取摘要的读者信息 HTML 页面 + try + { + for (; ; ) + { + ChargingItemWrapper[] results = null; + long lRet = this.Channel.SearchCharging( + stop, + strBarcode, + "~", + "return,lost", + "descending", + lStart + nGeted, + lLength, + out results, + out strError); + if (lRet == -1) + return -1; + if (results.Length == 0) + break; + total_results.AddRange(results); + lHitCount = lRet; + + // 修正 lLength + if (lLength != -1 && lHitCount < lStart + nGeted + lLength) + lLength -= lStart + nGeted + lLength - lHitCount; + + if (total_results.Count >= lHitCount - lStart) + break; + + nGeted += results.Length; + if (lLength != -1) + lLength -= results.Length; + } + + } + finally + { + this.Channel.Idle -= Channel_Idle; + } + + FillBorrowHistoryPage(total_results, (int)lStart, (int)lHitCount); + return 0; + } + finally + { + EnableControls(true); + + stop.EndLoop(); + stop.OnStop -= new StopEventHandler(this.DoStop); + stop.Initial(""); + } + } +#endif + void Channel_Idle(object sender, IdleEventArgs e) { e.bDoEvents = false; @@ -5656,13 +5791,10 @@ void Channel_Idle(object sender, IdleEventArgs e) void m_chargingInterface_CallFunc(object sender, EventArgs e) { string name = sender as string; - if (name == "load") - { - this.BeginInvoke(new Action(LoadBorrowHistory)); - } + this.BeginInvoke(new Action(LoadBorrowHistory), name); } - void FillBorrowHistoryStartPage() + void ClearBorrowHistoryPage() { ClearHtml(); @@ -5671,14 +5803,33 @@ void FillBorrowHistoryStartPage() AppendHtml(""); AppendHtml(strItemLink); AppendHtml(""); + + _borrowHistoryLoaded = false; } - void FillBorrowHistoryPage(ChargingItem[] items, + int _currentPageNo = 0; + int _pageCount = 0; + + static string MakeAnchor(string name, string caption, bool enabled) + { + if (enabled) + return "" + HttpUtility.HtmlEncode(caption) + ""; + return HttpUtility.HtmlEncode(caption); + } + + void FillBorrowHistoryPage(List items, int nStart, int nTotalCount) { + this.ClearMessage(); + StringBuilder text = new StringBuilder(); + _currentPageNo = nStart / _itemsPerPage; + _pageCount = nTotalCount / _itemsPerPage; + if ((nTotalCount % _itemsPerPage) > 0) + _pageCount++; + string strBinDir = Environment.CurrentDirectory; string strCssUrl = Path.Combine(this.MainForm.DataDir, "default\\inventory.css"); @@ -5686,44 +5837,75 @@ void FillBorrowHistoryPage(ChargingItem[] items, string strScriptHead = "" + "" + ""; + string strStyle = @""; text.Append("" + strLink + strScriptHead.Replace("%bindir%", strBinDir) + + strStyle + ""); -#if NO - string strJs = @""; + string strFirstPageLink = MakeAnchor("firstPage", "首页", _currentPageNo > 0); + string strPrevPageLink = MakeAnchor("prevPage", "前页", _currentPageNo > 0); + string strNextPageLink = MakeAnchor("nextPage", "后页", _currentPageNo < _pageCount - 1); + string strTailPageLink = MakeAnchor("tailPage", "末页", _currentPageNo != _pageCount - 1 && _pageCount > 0); + string strLoadAllLink = MakeAnchor("loadAll", "装载全部", _pageCount > 1); - text.Append(strJs); -#endif - text.Append("

"+nTotalCount+"

"); + string strPages = (_currentPageNo + 1) + "/" + _pageCount + " "; + if (items.Count > _itemsPerPage) + strPages = "(全部)"; + text.Append(strPages + + strFirstPageLink + " " + strPrevPageLink + " " + strNextPageLink + " " + strTailPageLink + "     " + + strLoadAllLink); text.Append(""); text.Append(""); - text.Append(""); - text.Append(""); - text.Append(""); - text.Append(""); - text.Append(""); - text.Append(""); + text.Append(""); + text.Append(""); + text.Append(""); + text.Append(""); + text.Append(""); + text.Append(""); + text.Append(""); + text.Append(""); text.Append(""); - foreach (ChargingItem item in items) + foreach (ChargingItemWrapper wrapper in items) { + ChargingItem item = wrapper.Item; text.Append(""); text.Append(""); - text.Append(""); + // text.Append(""); - text.Append(""); - text.Append(""); + if (string.IsNullOrEmpty(item.ItemBarcode) == false + && item.ItemBarcode.StartsWith("@refID:") == true) + text.Append(""); + else + text.Append(""); + text.Append(""); + + string strPeriod = ""; + if (wrapper.RelatedItem != null) + strPeriod = wrapper.RelatedItem.Period; + text.Append(""); + + string strBorrowOperator = ""; + string strBorrowTime = ""; + if (wrapper.RelatedItem != null) + { + strBorrowOperator = wrapper.RelatedItem.Operator; + strBorrowTime = wrapper.RelatedItem.OperTime; + } + text.Append(""); + text.Append(""); + + text.Append(""); + text.Append(""); - text.Append(""); - text.Append(""); text.Append(""); nStart++; } @@ -5732,7 +5914,6 @@ void FillBorrowHistoryPage(ChargingItem[] items, this.m_chargingInterface.SetHtmlString(text.ToString(), "readerinfoform_charginghis"); - } /// @@ -5778,5 +5959,19 @@ public void AppendHtml(string strText) this.webBrowser_borrowHistory.Document.Window.ScrollTo(0, this.webBrowser_borrowHistory.Document.Body.ScrollRectangle.Height); } + + bool _borrowHistoryLoaded = false; + + private void tabControl_readerInfo_SelectedIndexChanged(object sender, EventArgs e) + { + if (this.tabControl_readerInfo.SelectedTab == this.tabPage_borrowHistory) + { + if (_borrowHistoryLoaded == false) + { + this.BeginInvoke(new Action(LoadBorrowHistory), "load"); + _borrowHistoryLoaded = true; + } + } + } } } \ No newline at end of file diff --git a/dp2Circulation/Reader/ReaderInfoForm.resx b/dp2Circulation/Reader/ReaderInfoForm.resx index a6e1f6c45..02e0847a0 100644 --- a/dp2Circulation/Reader/ReaderInfoForm.resx +++ b/dp2Circulation/Reader/ReaderInfoForm.resx @@ -140,19 +140,19 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAL0SURBVDhPvZNbTNJhGMb/d2110eGizbnaWjctvXE1u2i6 - WnNj4dKVG7WlSyN1rkLNMkxS01QU8YACHlBHpujAAwoCan8UEURB5SAnw9M8zKZpq5vWfALqppsufS6/ - vXu/3/O870scueLi4k4lJydfzmAwoikUyrG/zwSRkJBwhk7PCGOyWDFVdYIkcbcsd0BF1iq0hh6V3qJT - G+eWNKT9x8isGyOWJQyb3KhpFmcRmZk51xecq19Jk+3Qu/0Nro192Nd2sbD8BealbUy7N6FfXMe4bQVj - 8z6ozV4opl0YmHKgqkmcS1RU8974dr7Ds3UA29oeqrUrKNZ8xqRzA0bXBiYda9BalyHuU6OutQscoRj9 - ejukE1awG1oZRFFpRbZ7cx+O9T1wyGVQOry42eZE8bATOvsqyAUfejRTKKtpBLOIjSIOH9LxhWCDEq4w - nXjNKkgPIM/7kZkKD6JFDlwTzoOrWQwia/zIws4B5BVXIiObifxyHmQTNvROOlBYyUsmGFk5SXO+Hcx4 - t/De/+sVvgXhtdOIbzGi3+jCkNEJqdaC/LJaFFY1gtMsQd/koj8DF96WVj8g6BnPEkyeTbTpvIion0VY - jREXK3UILSXx5IMBvTor2ge14HfKwf84AEHXIBolCgwavWAWlN8lEh89vh1IOaVzDpe4BlxgTyCkZAyn - C1SgNpBol2vB5rehoaMfwq4hNHUrIZJqoDT58IpVQiXu0Wg3Aik/FM/gfJkWZ9+N4CRLiRNMOfJ6DP7A - rEG/AWS5wYOh6SUoZ3xQmVfw/CXrFkGlxkcGFqONtOO+SA9KPYnElnEIhs2Q6ezo0//xKxmd8QjauxmS - Ucum2rwKhcG9l5SWFkrExMSEK02B7ot+vza096mHeaIPmV0a8qBf74RAOnYoI827PSqjlsPj3ynjCulp - T7MiY2NjjwdXOCoqKqR3Yv6XzD9XiVz+Uyz/ZGfzmmJrmzuYL/JYVBqNdi5Y+D+lpKZeTUxJj/jnOI5G - BPEbVZ8KOqyRfMgAAAAASUVORK5CYII= + WnNj4dKVG7WlCzN1rkLNMkxS01QUjyjiAWFkiiYeUBDw8EcRARVUBDkZniY6m6atblrzCaibbrr0ufz2 + 7v1+z/O+L3HkiomJOUWn0y+nMRiRFArl2N9ngoiLizuTlJQWwmSxoipqGxLEndLsfiVZI9fou5Q6s1Zl + mFtWk9Yfw7NODJuXMTTtRHWzOINIT8+6vmBf+zpmtBy6t7/BsbkP6/ouFla+wLS8DaPTC93SBsYXVzE6 + 74HK5Ibc6ED/lA0VTeJsoqyK+8az8x2urQMsru+hSrOKQvVnTNo3YXBsYtK2Do1lBeJeFWpbO8Dhi9Gn + s6J7wgJ2fSuDKCguy3R692Hb2AOHXAGlzY2bQjsKh+zQWtdALnjQpZ5CSXUjmAVsFHB46B5fCDQoquSn + Eq9Zeal+5HkfMlPuQqTAhmv8eVSqlwLIah8yv70fOYXlSMtkIreUC+nEInombcgv59IJRkZWwpxnBzPu + Lbz3/XqFZ0ZojRGxLQb0GRwYNNjRrTEjt6QG+RWN4DRL0Du55MvAgbfFVQ+IpLRncdMuL4RaN8LqZhFS + bcDFci2Ci0k8+aBHj9YC0YAGvHYZeB/70dAxgEaJHAMGN5h5pXeJ+EePb/tTTmyfw6VKPS6wJxBUNIrT + eUpQ60mIZBqweULUt/WB3zGIpk4FBN1qKKY9eMUqohL3aLQb/pQfimdwvkSDs++GcZKlwAmmDDldel9g + loBfP7JM78KgcRmKGQ+UplU8f8m6RVCpseH+xRCSVtwX6ECpIxHfMo6GIROkWit6dX/8SkZmXA2iToZk + xOxVmdYg1zv3ElJSgomoqKhQxbS/+5LP7yJEvaohruBDeoeaPOjT2cH7NHIoJU27XUqDhsPl3Smp5Cel + PM0Ij46OPh5Y4YiIiKCeiflfUt9cJTLZT7FszMrmNkXXNLcxX+SwqDQa7Vyg8H9KTE6+Gp+YGvbPcRyN + COI3STAKNGOy9qsAAAAASUVORK5CYII= @@ -207,81 +207,81 @@ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABFrSURBVGhD7VkJUJXnekZv1NzrkpqoaWxuNbHVaFNNXa4x - uYlGTZzodRmuEWJBgo4bUnevQFBAgVMFA7KTI+dwlC1AIGyRxSigwEDYRjYpS4GBAt4RoVBBBJ++z3cO - 3nZyJZk27W1n8s288x8O//I+7/K8z/cfs5/WT+tHXifOnZt89vxna4PCdMFBOl1jQEDAw4jIuFadPipL - G34lOFAbZuvlE/Du2fMX55gu+dMvF41mtsb74oGLwSHpF0NCW+JT0n4fG5fwuKm5Fd09vWjvuIv6hiaU - V1bhxo0bD69evXo/IiGxPfjzz9s/D4+s0l2Ouq67EhXqeNr1gP2xk6s9vb3nmm79P7/O+QTsDA03NOTk - FfQ3t7ZhaPgxHj+GWo/lw9DQMAYHh5Q9ejSMgYFHGOgfRH//AB6Idd69J+AaUVZRiZyb+Y+SUlN7o2IS - OgMCdR3BYeF3grT6myG6cH3wpfDj3v5B686c85nn4uIy1vT4//66GBiY2dzShoz0a8jMvIas69loaGhG - a1s7OjrviuOPFIiBgQH0DwwqAPxucJCfB9H3oB89vX2413Ufd+91oZMmoDrvdqGppRU1tfUoLq1A9s38 - oS+/zOqLiYvrCL50qdM/NKzCJyj0qgAMjI5LPJWQlLI//qvU977++usJJtd+2Aq7HFHLB03/5Rxs2LwV - SSkZcD2rwdETDoiIioEhKg4JySloa+9QgOjcXXHunjja3d2Dvr4HAmxAgSLAvj4jIH7/4MGAOt6X8+7f - 70ZTcxvy8guRk1+krunu7UVDYxPyCguRlJ4OF9czQ97+wXd8AkPTvP0CfTS+flbOGs3fmlz94+vSlSv1 - dM7Gdh9Ou3mgq7sbWp1BlVD45SjU1zci4atklFdUoUuizHPbOzrlSOt4Yh2dnZKBe+i6f185e1+OvQKE - WWIGh4aH1T1NB6SkpiMmPglFpeXo7Pw9UjOuITUtE/GJKci6loN6AVZcWt4T+2VKsqxfmNz97hoB4HDK - HbFycXZ2vkQ+FvlFJYiMiUNjowBITEWiZOaeODVSKmzsdgFBx2ltUnIsu+aWFtTW1QvgSpSWVaKsvBKV - VdXKoabmFgWW2WMWa2prERUdB50hCnqTxScmqWcwuw2NzVLSOYiOSwg0ufvdRQCMbEZmNgoKilBT1yAX - JOF6zk314Gr5u0SiNDTEJjaaMaJDwlA9yiEC6ZbM9SjG6hQQrepYJ9nLl3veLChATl4ecvPyVQnxu5KS - Msluk8qaKsP+fpUxBoZAa6V3qqprkZCUBh8fn36Tu99dBgFAtKzvxqZmRZd0ijepqq5Hnjzsem4ehsVp - ktMTMzHVsNQEH8xa5jWtwmS8PklKhFFmsxcWl6CkrAzF4jQB0IqKSyVDFaiuqVXXtra1oUNAk9FKpOn5 - 3Ny8AtWDnl5+j0zufncZDFENTBmjRgd4s04T+3Ax2qTLP7YIgv9nVnh+U5OArqqB1b4TMBszDdNmL0Jp - eRUqZH4wo3TopjhfUFisslonzvK5tBYBroImgDKlB9KlItgXIWEGaLxHAaA3GBqYbiJnyvn5gVCjsfmG - TK4CAxLJ7u5eNdgYcc6EkcXPI2AKJbLzVlli8fpdMBv757DYdRgFRcXSmNm4KQBkVqgjz6uorBbHW1XG - mP26+gZVtilpWdBHxMAnIBTuGh9oLvg/HUCoPryByJlKHnv7+tSQ4uB6LEONf7NpCY6TmGkvVY1Zo6I2 - +MiYqZHVLs74hidj+qINMDN7DkccXMWhTMlArtR+IQqFHIRd1L14D2aMGWDjV1fXKACJyenw9g2Ch5cv - 3M/74KzG++kAQkJDG4i8Si6mo2woRn9YnGcNszFb2zqMqZdIsnbpwEgdM4q9cs3IYqZaWtsRFpOKEH00 - MrOyESFMUyR9UCQ9INGSfruHdinTZpEqtUISBMAAVojzZULX8Ump8PINhquHN07JTLJx1zwdgJ9fSAMv - JgiWB8uHNc3PnLJl5TJFs3NRJxEaSXNVVRVa5KGkuevZeVIOZaq8Rhb7oUeIgaWSlnldRZ2ZI1FUiIMO - TqfgfNoNhohoXBOaZBDKKqpRIpktEeqNEzqXslHOO7p6wMbN4+kAfPz8GkhXjAInKMuHEWUvtAind3V1 - Kafa29tRI0AbpczYrAWFRXJOh+L+azl5kp0Slbn/uFjn2bn5qJTs8hnMZqRMd7Ox4zFuwmRMnPwCxo57 - Fq4yQCln6HxJaaXQeKIqHcfT7jh56uzoAD7zC6xnVOkwm5PRo45h5JkNDiLbPXth/Yk1du7aDnPzDdDr - tUpSkOpq2TsCPkNKhekfWcxiowBNTE5VWSNJPHjwADp9OCZMnorXXn8Dr8x9TcCMw4frN6lyKi4plzIr - l5KLhZuntwzXszjp5DY6AL/AwHo2Lx1i5BlFUhxTTeqz2GEL7eUvkJJ5E2GGeDh7+uHdNWuwc+fHQoP/ - jByZESyncimBjKzrKiNc1D+t0gtpGVmqtll+fQIg3BCJSVOnYcEbSzBvwUI8M2ESNmwyV+VYJFlk1sIj - Y54AOPF9AAIEAKlMNbBEnE1MTcIHWtnuwuXETFz9phBh4V/A+cx5fLjVFqt/uxdjnnsR9gf3C4hmZAvD - MGvXrgvTCMcPSBZZ78YeyVUN3yjzhQNTF27AlGkzsHDJMixYtAQTJk3Bxk1bVYZIEuwXvSEaZwUAS+jE - KQLwfDqAQO0lAdAu+uS+AkAgjFpaRib2n3BGYlYJtBGJ2HvQQT1YLlE2d7Utxk2ZgquiIrMlUwxCQWEJ - UtKzhNdFH4kkIMNQNiTLVKY0oAbS6sIxdcZMLFn+Nha+sQzPSh8QQK2UGQGwl8L0kaROaWD2gAA4OwoL - BV66VE+a7OrqViXEBiVne5y/gKNn/BAWlwPrg57i9M+eOE8bP+d9TP7r5di2bYs8tFQ1dZ3IkHgRfmxY - ZoBTlSURK6qzVHqKmokApr/0Syx/6x0sWroCE6e8oEqorr5eRZ9TOlTUsJsAcBIAzMKoALQCQGVAlCap - k6WTczMPjs5OOHZBDysnA8wmvylOj4HZuHGw3WENK2trzFyyGe/t+Qzvvv++kghp6RlKkcbGJ6tmZAYI - gDMjRliFlEqmIYAZL7+Ct95erbLAfti42VwyIAA4KwRwsDZcAXB28/xhAEihrOEu0fFtQpd58jBvby9Y - nYnAhFVuMHvFApPmLMdfvjYfv1m3BuvWrcOSjXth65cLSxsbNaTiE5LUZOYQKigslSbuVj1QLhwfE5uo - BlpTczO0YeF4STZPv171AZat+LUAmI5NW7YqpiJYSvAQOWcEwElnltAoPXBJAFDAqSyIqCMIOhQbE4Ut - R85hpnUEXtzij0lv2mLy3Hfxd0vfxPzFK7Bq5znY+t/CJgsLJQkihfoY8biEFHGkQpUj71lVVYvo2ASk - Sm9wChPAzFlzsWrNeimjVZg8dQY2bd1mAmsUfsyAq7sXHCT6Rx1Pw8Z1FBZiBgiAxgbmtpB6JEf6wGbP - bqxyvYZxv5VM7M3FHAtPrLJywFKrM7ALLYPFpzp8snuP7CHqERCsVVOXjlZLw3KGUBcRXLhM3KS0DCmT - RgXg5dnz8N4HG7D87fcw5YUZMP/IUsqrXQ08AggK1avoHxPnD59wgo2N2+gAGgW9cZjdVQDuykzIFPUY - HOCLDbtPYIu2CZNtkrDUIQvvO6XCNrAI+tuPsXDtNjV0CoU9Tp31RLBIX7IIdc7INC8pK4dfUKhsTFIF - WB20Wj1mzjZlwARgq8V2Bba65g8AWDqHjjniwJGTAsBm9BIyqtEatZnhppwrX7g7WyTCHltLbN17HHYR - lTiW0AbfW32IuN2P39i5wdLKVsquGxd8/WG9cz+CQnRKkjD6HGRkomsyB3wDQqSRE5RgDNXqMPNlYw+o - EhIAH1lYqXOVoBMAvgFaFfl9h45hj/3R7wNgqCd1UiKPCC4qUW670mVDweF0xtUJa9a+i4/tHWDn+hk2 - Wlrj4JGjpuGVIzVsiTXrN0sG9ErUcQPEfuK9uL8Oke8NMl0rpJxCBMCMmWShNdLE76gm3ib34yaKQeRe - mlLa7vAJ2Ow7JGY/OgCWkJEBKp7IYzYyQVBWMHKJyRlCg/lITopHcnKi0u7cxKTLwFu/6SOsWrsBH8ox - KiZefU9RyAwwoq7u59VmPSw8Us2HYG2YcQ4IAy1e/hYmPTcN2yyMACg5yESyA5Pon4D1LjtYSWZHBRAY - qK3ng+i8cZCUyIPr1Fx4JDuynt5e6ES/HHM8pUokVugyJFQHu0NH8M7qdXhHnN9obgn7o47qJRajTwC0 - IDnPzdNLRV8nAGqkB4K1Wjw3/SUsXrYCry9eqiax6gHplzLZfhYVlyslusf+GKwEwHbbfbAaDUBAoFZU - cp1yXm24ZddElUlKpMBjU7McGBVGea2UyrqNW1XJbLW0wT550HmfAFV+lCK90kPc1PA+BK0Lj1IBIAhm - OjhUq8pGibn5izB+4hSYb7NEq0xpzgBu/KmDdtkdVc5b7tgt9p8AjBH7mRhfT44xcz7tkkDZWypswdce - as+aX4DruTdVNjiZKQF4jkG0PDcZbh5e8A/WycYjWbGOalyJPPcSfLdK5jkgNewnzUthRudj4hNlL9Es - WdQqOT13/kK8Onc+xo6fiM0yBzgzSiQIBMCys913WIbkHgXAQgCsXLnyGZPjPI432Tgzd0/3gzExCf9U - facONMqAnFvGdziZIo/ThdvJz61Cc513jQqTb+nKK4W1TLODvaLeFw3Lpl4A2Qv1+fgHi3SOlhkQpaSE - EnkiNYKCQzFWJPTsOfMw69W5GPPMBGwy36aCYARQoWbAjt0HYGm9G9sJwGrn0KxZs54Vh38hxnenfzAP - L68F7hrNBRcXl47A4JD2b27ceFhZc0fVs/HFbDm+yb6l9A4lr3prJn3RIzzf3290nKXDcykBTjqdNkXe - +KYtOjZeNvUZipJZ59RCZmMn4OVZrypTALYYAfAVDEvRSbaRVlI+Ftt3qgysXLl6+Hmz56eIw38m9nOT - ERDNuDw8PF53PXPG0dH5VI6AGdBoNPdjvojtuXHjxvAImG8FDMuq8FtpeGl6lg9LjlTp6q5RtUslyYal - RYnzfMHFjVG+qFWyF6X3fNmNEcQEqX8eNzMDUkLcF3MnSAAWrH3rXQJgF5ZYWA+Ji9PFXhSbKkYwk8Se - /iZbAK10/PTTf3RycioWQEO+vr7dycnJg5TFBHNb6Db3Vj7ivkoR/R6haFInR74Y5t+R0XFITElTg4yv - UyiTuafmsKT03rXPDosWL5Md2WSYyxxhD3BXRxlDBbptu62UEVloj2Rg5bC4NFvsFdPxJbGJYj/sd4YL - Fy783MHBedOR48dDHZ0+bfDUnHvo7+//r3q9/lHZ7UrpkTuSjWIVbb3oHkNktGpwDjkyG50vlD0DqZpW - IzRNluPQOunkrDZQJAnOCTIit5JbLHfIHNivJvyvNpgPiBuvi/1K7K/E6DzZ6L+2XFwuPO/g4PDxsePH - o5xPne447+XdHxQU1Hft+o1hTtsKAVRSdluV2y0TADpOhqGpeSOAWVL1siXlmzkCGhGVxxxdYS4UvcME - QMqsSB5L52eJkX1+3OXu7v4XBw8esTty5Pg3v/uda4+ff8DDhMSkh3FfJjxmuVXf4et2DqkytcVkPxSX - linWKS2rQl1dozjeiBbZ8DQ0NYmAc4C5lNAGKS2pkhx5xAYxOv+/s+zsDv+Nnf1Bt4NHjxZ6eGr6L4Xp - B8N0hseUKaRqlhydL/y2DKVCDA3SF9RjLW1tSppTRsydu+zf5FZBYn/6X0P/fseOD3bu3h166NChGiGE - QReXS4NJKWlDeYXfqj3CyO9xnPqkXLOx40vlso/FyDT/t9aCBQvG22y3WfLJ7t329v9wKJI/XvC36CtX - rgy4eGj+RU7xFiPT/P9YK1e6PGtubvPa0qUrlsmfC8V+vJ9gf1o/re9bZmb/DmOf5t4SGOptAAAAAElF + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABFrSURBVGhD7VkJUJXnekZv1NzrkppE09jcamJrok01dbnG + 5CauiRO9LsM1QixI0HFD6u4VCAoocKpgQHZy4JxDZAsQCFtkMQooMBC2kU3KUmCggHdEKFQQwafv852D + t51cSaZNe9uZfDPv/IfDv7zPuzzv8/3H7Kf10/qR18nz56eeu/DpuqBwXXCQTtcUEBDwIDIqvk2nj87W + Gi4HB2rDbb18At49d+HSXNMlf/rlotHM0XhfOngpOCTjUkhoa0Jq+u+/iPvyUXNLG3p6+9DReQcNjc2o + qKrG9evXH1y5cuVeZGJSR/Bnn3V8Zoiq1n0efU13OTrU8YzrQfvjp9Z4envPM936f36d9wnYFWqIaMzN + LxxoaWvH8MgjPHoEtR7Jh+HhEQwNDSt7+HAEg4MPMTgwhIGBQdwX67pzV8A1obyyCrk3Ch4mp6X1Rccm + dgUE6jqDww23g7T6GyE6gz44zHDC2z9o/dnzPq+6uLiMNz3+v78uBQZmtbS2IzPjKrKyriL7Wg4aG1vQ + 1t6Bzq474vhDBWJwcBADg0MKAL8bGuLnIfTfH0BvXz/udt/Dnbvd6KIJqK473WhubUNtXQNKyiqRc6Ng + +Msvs/tj4+M7g8PCuvxDwyt9gkKvCMDAmPik04nJqQcSvkpb/fXXX08yufbDVvjnkXV80IxfzsXGLduQ + nJoJ13MaHDvpgMjoWERExyMxJRXtHZ0KEJ27I87dFUd7enrR339fgA0qUATY328ExO/v3x9Ux3ty3r17 + PWhuaUd+QRFyC4rVNT19fWhsakZ+URGSMzLg4uI27O0ffNsnMDTd2y/QR+PrZ+Ws0fytydU/vsIuX26g + cza2+3HGzQPdPT3Q6iJUCRk+j0ZDQxMSv0pBRWU1uiXKPLejs0uOtM7H1tnVJRm4i+5795Sz9+TYJ0CY + JWZweGRE3dN0QGpaBmITklFcVoGurt8jLfMq0tKzkJCUiuyruWgQYCVlFb1xX6amyPqFyd3vrlEADqfd + EScX5+QUSOTjUFBciqjYeDQ1CYCkNCRJZu6KU6OlwsbuEBB0nNYuJceya2ltRV19gwCuQll5FcorqlBV + XaMcam5pVWCZPWaxtq4O0THx0EVEQ2+yhKRk9Qxmt7GpRUo6FzHxiYEmd7+7CICRzczKQWFhMWrrG+WC + ZFzLvaEeXCN/l0qUhofZxEYzRnRYGKpXOUQgPZK5XsVYXQKiTR3rJXsFcs8bhYXIzc9HXn6BKiF+V1pa + LtltVllTZTgwoDLGwBBonfROdU0dEpPT4ePjM2By97srQgAQLeu7qblF0SWd4k2qaxqQLw+7lpePEXGa + 5PTYTEw1IjXBB7OWeU2bMBmvT5YSYZTZ7EUlpSgtL0eJOE0AtOKSMslQJWpq69S1be3t6BTQZLRSaXo+ + Ny+/UPWgp5ffQ5O7310REdGNTBmjRgd4sy4T+3Ax2qTLP7YIgv9nVnh+c7OArq6F1f6TMBv3PJ6fswhl + FdWolPnBjNKhG+J8YVGJymq9OMvn0loFuAqaAMqSHsiQimBfhIRHQOM9BgB9REQj003kTDk/3xdqNDbf + sMlVYFAi2dPTpwYbI86ZMLr4eRRMkUT21VWWWLxhN8zG/zksdh9BYXGJNGYObggAmRXqyPMqq2rE8TaV + MWa/vqFRlW1qejb0kbHwCQiFu8YHmov+TwYQqjc0EjlTyWNff78aUhxcj2So8W82LcFxEjPtZaoxa1XU + hh4aMzW6OsQZX0MKZizaCDOzZ3DUwVUcypIM5EntF6FIyEHYRd2L92DGmAE2fk1NrQKQlJIBb98geHj5 + wv2CD85pvJ8MICQ0tJHIq+ViOsqGYvRHxHnWMBuzrb3TmHqJJGuXDozWMaPYJ9eMLmaqta0D4bFpCNHH + ICs7B5HCNMXSB8XSAxIt6be76JAybRGpUickQQAMYKU4Xy50nZCcBi/fYLh6eOO0zCQbd82TAfj5hTTy + YoJgebB8WNP8zClbXiFTNCcP9RKh0TRXV1ejVR5KmruWky/lUK7Ka3SxH3qFGFgq6VnXVNSZORJFpTjo + 4HQazmfcEBEZg6tCkwxCeWUNSiWzpUK98ULnUjbKeUdXD9i4eTwZgI+fXyPpilHgBGX5MKLshVbh9O7u + buVUR0cHagVok5QZm7WwqFjO6VTcfzU3X7JTqjL3HxfrPCevAFWSXT6D2YyS6W42fiImTJqKyVOfw/gJ + T8NVBijlDJ0vLasSGk9SpeN4xh2nTp8bG8CnfoENjCodZnMyetQxjDyzwUFku3cfrD+2xq7dO2BuvhF6 + vVZJClJdHXtHwGdKqTD9o4tZbBKgSSlpKmskifv370OnN2DS1Ol47fU38PK81wTMBHywYbMqp5LSCimz + Cim5OLh5estwPYdTTm5jA/ALDGxg89IhRp5RJMUx1aQ+i5220H7+BVKzbiA8IgHOnn54d+1a7Nr1kdDg + PyNXZgTLqUJKIDP7msoIF/VPm/RCema2qm2WX78AMEREYcr057HgjSV4dcFCPDVpCjZuNlflWCxZZNYM + UbGPAZz8PgABAoBUphpYIs4mpibhA61sd+PzpCxc+aYI4YYv4Hz2Aj7YZos1v92Hcc+8APtDBwREC3KE + YZi1q9eEaYTjByWLrHdjj+Sphm+S+cKBqTNEYNrzM7FwyTIsWLQEk6ZMw6bN21SGSBLsF31EDM4JAJbQ + ydME4PlkAIHaMAHQIfrkngJAIIxaemYWDpx0RlJ2KbSRSdh3yEE9WC5RNm+NLSZMm4YroiJzJFMMQmFR + KVIzsoXXRR+JJCDDUDakyFSmNKAG0uoMmD5zFpYsfxsL31iGp6UPCKBOyowA2Evh+ihSpzQwe0AAnBuD + hQLDwhpIk93dPaqE2KDkbI8LF3HsrB/C43NhfchTnP7ZY+dpE+e+h6l/vRzbt2+Vh5appq4XGZIgwo8N + ywxwqrIk4kR1lklPUTMRwIwXf4nlb72DRUtXYPK051QJ1Tc0qOhzSoeKGnYTAE4CgFkYE4BWAKgMiNIk + dbJ0cm/kw9HZCccv6mHlFAGzqW+K0+NgNmECbHdaw8raGrOWbMHqvZ/i3ffeUxIhPSNTKdK4hBTVjMwA + AXBmxAqrkFLJNAQw86WX8dbba1QW2A+btphLBgQAZ4UADtYaFABnN88fBoAUyhruFh3fLnSZLw/z9vaC + 1dlITFrlBrOXLTBl7nL85Wvz8Zv1a7F+/Xos2bQPtn55sLSxUUMqITFZTWYOocKiMmniHtUDFcLxsXFJ + aqA1t7RAG27Ai7J5+vWq97Fsxa8FwAxs3rpNMRXBUoKHyDmjAE45s4TG6IEwAUABp7Igoo4g6FBcbDS2 + Hj2PWdaReGGrP6a8aYup897F3y19E/MXr8CqXedh638Tmy0slCSIEupjxOMTU8WRSlWOvGd1dR1i4hKR + Jr3BKUwAs2bPw6q1G6SMVmHq9JnYvG27CaxR+DEDru5ecJDoH3M8AxvXMViIGSAAGhuY20LqkVzpA5u9 + e7DK9Som/FYysS8Pcy08scrKAUutzsIutBwWn+jw8Z69sodoQECwVk1dOlojDcsZQl1EcAaZuMnpmVIm + TQrAS3Nexer3N2L526sx7bmZMP/QUsqrQw08AggK1avoHxfnj5x0go2N29gAmgS9cZjdUQDuyEzIEvUY + HOCLjXtOYqu2GVNtkrHUIRvvOaXBNrAY+luPsHDddjV0ioQ9Tp/zRLBIX7IIdc7oNC8tr4BfUKhsTNIE + WD20Wj1mzTFlwARgm8UOBbam9g8AWDqHjzvi4NFTAsBm7BIyqtFatZnhppyrQLg7RyTCXltLbNt3AnaR + VTie2A7fm/2IvDWA39i5wdLKVsquBxd9/WG96wCCQnRKkjD6HGRkoqsyB3wDQqSRE5VgDNXqMOslYw+o + EhIAH1pYqXOVoBMAvgFaFfn9h49jr/2x7wMQ0UDqpEQeFVxUotx2ZciGgsPprKsT1q57Fx/ZO8DO9VNs + srTGoaPHTMMrV2rYEms3bJEM6JWo4waI/cR7cX8dIt9HyHStlHIKEQAzZ5GF1koTv6OaeLvcj5soBpF7 + aUppuyMnYbP/sJj92ABYQkYGqHwsj9nIBEFZwcglpWQKDRYgJTkBKSlJSrtzE5MhA2/D5g+xat1GfCDH + 6NgE9T1FITPAiLq6X1Cb9XBDlJoPwdpw4xwQBlq8/C1MeeZ5bLcwAqDkIBPJDkyifxLWu+1gJZkdE0Bg + oLaBD6LzxkFSKg+uV3PhoezIevv6oBP9ctzxtCqROKHLkFAd7A4fxTtr1uMdcX6TuSXsjzmql1iMPgHQ + guQ8N08vFX2dAKiVHgjWavHMjBexeNkKvL54qZrEqgekX8pl+1lcUqGU6F7747ASADts98NqLAABgVpR + yfXKebXhll0TVSYpkQKPTc1yYFQY5XVSKus3bVMls83SBvvlQRd8AlT5UYr0SQ9xU8P7ELTOEK0CQBDM + dHCoVpWNEnPzF2Hi5Gkw326JNpnSnAHc+FMH7bY7ppy33LlH7D8BGCf2MzG+nhxn5nzGJZGyt0zYgq89 + 1J61oBDX8m6obHAyUwLwnAjR8txkuHl4wT9YJxuPFMU6qnEl8txL8N0qmeeg1LCfNC+FGZ2PTUiSvUSL + ZFGr5PS8+Qvxyrz5GD9xMrbIHODMKJUgEADLznb/ERmSexUACwGwcuXKp0yO8zjRZBPM3D3dD8XGJv5T + ze160CgDcm8a3+FkiTzOEG4nP7cJzXXdMSpMvqWrqBLWMs0O9op6XzQim3oBZC/U5+MfLNI5RmZAtJIS + SuSJ1AgKDsV4kdBz5r6K2a/Mw7inJmGz+XYVBCOASjUDdu45CEvrPdhBAFa7hmfPnv20OPwLMb47/YN5 + eHktcNdoLrq4uHQGBod0fHP9+oOq2tuqno0vZivwTc5NpXcoedVbM+mLXuH5gQGj4ywdnksJcMrpjCny + xjdtMXEJsqnPVJTMOqcWMhs/CS/NfkWZArDVCICvYFiKTrKNtJLysdixS2Vg5crVI8+aPTtNHP4zsZ+b + jIBoxuXh4fG669mzjo7Op3MFzKBGo7kX+0Vc7/Xr10dGwXwrYFhWRd9Kw0vTs3xYcqRKV3eNql0qSTYs + LVqc5wsubowKRK2SvSi958tujCAmSf3zuIUZkBLivpg7QQKwYO1b7xYAu7HYwnpYXJwh9oLYdDGCmSL2 + 5DfZAmil4yef/KOTk1OJABr29fXtSUlJGaIsJphbQrd5NwsQ/1Wq6PdIRZM6OfLFMP+OiolHUmq6GmR8 + nUKZzD01hyWl9+79dli0eJnsyKbCXOYIe4C7OsoYKtDtO2yljMhCeyUDK0fEpTliL5uOL4pNFvthvzNc + vHjx5w4OzpuPnjgR6uj0SaOn5vwDf3//f9Xr9Q/Lb1VJj9yWbJSoaOtF90RExagG55Ajs9H5ItkzkKpp + tULTZDkOrVNOzmoDRZLgnCAjciu51XKnzIEDasL/aqP5oLjxutivxP5KjM6Tjf5ry8Xl4rMODg4fHT9x + Itr59JnOC17eA0FBQf1Xr10f4bStFECl5bdUud00AaDjZBiamjcCmCXVIFtSvpkjoFFRedzRFeZC0TtN + AKTMiuWxdH62GNnnx13u7u5/cejQUbujR09887vfufb6+Qc8SExKfhCX8OUjllvNbb5u55AqV1tM9kNJ + WblinbLyatTXN4njTWiVDU9jc7MIOAeYSwltlNKSKsmVR2wUo/P/O8vO7sjf2Nkfcjt07FiRh6dmICxc + PxQWbnhEmUKqZsnR+aJvy1EmxNAofUE91trerqQ5ZcS8ecv+TW4VJPan/zX073fufH/Xnj2hhw8frhVC + GHJxCRtKTk0fzi/6Vu0RRn+P49Qn5ZqNn1gml30kRqb5v7UWLFgw0WaHzZKP9+yxt/+Hw1H88YK/RV++ + fHnQxUPzL3KKtxiZ5v/HWrnS5Wlzc5vXli5dsUz+XCj24/0E+9P6aX3fMjP7d5KD5tGVU6sjAAAAAElF TkSuQmCC diff --git a/dp2Circulation/dp2Circulation.csproj b/dp2Circulation/dp2Circulation.csproj index 9fd4fc496..5d08e0b2d 100644 --- a/dp2Circulation/dp2Circulation.csproj +++ b/dp2Circulation/dp2Circulation.csproj @@ -587,7 +587,6 @@ ChangeStateActionControl.cs - Form diff --git a/dp2Circulation/userrightsdef.xml b/dp2Circulation/userrightsdef.xml index 4da70d180..03c86f86c 100644 --- a/dp2Circulation/userrightsdef.xml +++ b/dp2Circulation/userrightsdef.xml @@ -40,7 +40,10 @@ 获得书目摘要 get biblio summary - + + 检索借阅历史 + search charging history + 检索读者 search reader diff --git a/dp2HotPoint/ZConnection.cs b/dp2HotPoint/ZConnection.cs new file mode 100644 index 000000000..418548ef7 --- /dev/null +++ b/dp2HotPoint/ZConnection.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace dp2HotPoint +{ + /// + /// 一个 Z39.50 连接对象 + /// + public class ZConnection + { + } +} diff --git a/dp2Installer/dp2Installer.csproj b/dp2Installer/dp2Installer.csproj index 00521aee7..ec4e3895f 100644 --- a/dp2Installer/dp2Installer.csproj +++ b/dp2Installer/dp2Installer.csproj @@ -34,7 +34,7 @@ dp2 V2 true publish.htm - 66 + 67 1.1.0.%2a false true diff --git a/dp2Installer/opac_app/BorrowInfo.aspx.cs b/dp2Installer/opac_app/BorrowInfo.aspx.cs index c26d5a9c9..cb7c83b27 100644 --- a/dp2Installer/opac_app/BorrowInfo.aspx.cs +++ b/dp2Installer/opac_app/BorrowInfo.aspx.cs @@ -49,6 +49,9 @@ protected void Page_Init(object sender, EventArgs e) /// this.TitleBarControl1.CurrentColumn = TitleColumn.BorrowInfo; + + if (app != null) + this.BorrowHistoryControl1.DatabaseMode = string.IsNullOrEmpty(app.ChargingHistoryType) == false; } protected void Page_Load(object sender, EventArgs e) diff --git a/dp2LibraryXE/opac_app/BorrowInfo.aspx.cs b/dp2LibraryXE/opac_app/BorrowInfo.aspx.cs index c26d5a9c9..cb7c83b27 100644 --- a/dp2LibraryXE/opac_app/BorrowInfo.aspx.cs +++ b/dp2LibraryXE/opac_app/BorrowInfo.aspx.cs @@ -49,6 +49,9 @@ protected void Page_Init(object sender, EventArgs e) /// this.TitleBarControl1.CurrentColumn = TitleColumn.BorrowInfo; + + if (app != null) + this.BorrowHistoryControl1.DatabaseMode = string.IsNullOrEmpty(app.ChargingHistoryType) == false; } protected void Page_Load(object sender, EventArgs e) diff --git a/dp2OPAC/BorrowInfo.aspx.cs b/dp2OPAC/BorrowInfo.aspx.cs index c26d5a9c9..cb7c83b27 100644 --- a/dp2OPAC/BorrowInfo.aspx.cs +++ b/dp2OPAC/BorrowInfo.aspx.cs @@ -49,6 +49,9 @@ protected void Page_Init(object sender, EventArgs e) /// this.TitleBarControl1.CurrentColumn = TitleColumn.BorrowInfo; + + if (app != null) + this.BorrowHistoryControl1.DatabaseMode = string.IsNullOrEmpty(app.ChargingHistoryType) == false; } protected void Page_Load(object sender, EventArgs e) From 79afd0cc7827cbf5d17554cffba357ace1a4498c Mon Sep 17 00:00:00 2001 From: XieTao Date: Sat, 2 Jan 2016 02:04:07 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E5=BE=AE=E8=B0=83=E5=80=9F=E9=98=85?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E6=98=BE=E7=A4=BA=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BorrowHistoryControl.cs | 48 ++++++++----------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/DigitalPlatform.OPAC.Web/BorrowHistoryControl.cs b/DigitalPlatform.OPAC.Web/BorrowHistoryControl.cs index 2e799c910..c36d705ab 100644 --- a/DigitalPlatform.OPAC.Web/BorrowHistoryControl.cs +++ b/DigitalPlatform.OPAC.Web/BorrowHistoryControl.cs @@ -512,10 +512,13 @@ public LineInfo(ChargingItemWrapper wrapper) this.strBarcode = wrapper.Item.ItemBarcode; this.strRecPath = ""; this.strBorrowDate = wrapper.RelatedItem == null ? "" : wrapper.RelatedItem.OperTime; - this.strBorrowPeriod = ""; + this.strBorrowPeriod = wrapper.RelatedItem == null ? "" : wrapper.RelatedItem.Period; this.strBorrowOperator = wrapper.RelatedItem == null ? "" : wrapper.RelatedItem.Operator; this.strReturnDate = wrapper.Item.OperTime; - this.strNo = ""; + this.strNo = wrapper.RelatedItem == null ? "" : wrapper.RelatedItem.No; + if (this.strNo == "0") + this.strNo = ""; + this.strRenewComment = ""; this.strOperator = wrapper.Item.Operator; } @@ -634,7 +637,7 @@ protected override void Render(HtmlTextWriter writer) text.Append(""); - text.Append(""); + text.Append(""); text.Append(""); text.Append(""); @@ -644,30 +647,21 @@ protected override void Render(HtmlTextWriter writer) text.Append(""); else { - if (this.DatabaseMode == false) - text.Append(""); - else - text.Append(""); + text.Append(""); + } text.Append(""); From 1d26b2824956d0a0a364a41743d69eb1fe31102e Mon Sep 17 00:00:00 2001 From: DigitalPlatform Date: Mon, 4 Jan 2016 11:04:50 +0800 Subject: [PATCH 3/9] Create LICENSE.md --- LICENSE.md | 201 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 000000000..8dada3eda --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From 5ba4e9f1b877acf10c949cd1d49183a4f1be8a3c Mon Sep 17 00:00:00 2001 From: XieTao Date: Thu, 7 Jan 2016 00:33:16 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DateRangeControl.cs | 26 + .../GetDateDlg.Designer.cs | 2 +- .../OrderDesignControl.cs | 290 +++++-- .../KernelService.cs | 3 +- .../ChargingHistoryLoader.cs | 99 +++ .../DigitalPlatform.LibraryClient.csproj | 2 + .../ItemBarcodeLoader.cs | 107 +++ DigitalPlatform.LibraryServer/AppBiblio.cs | 468 +++++++--- DigitalPlatform.LibraryServer/AppEntity.cs | 131 ++- .../LibraryApplication.cs | 151 +++- .../LibraryService.cs | 1 - .../BorrowHistoryControl.cs | 2 +- DigitalPlatform.rms.Client/RmsChannel.cs | 5 - DigitalPlatform.rms.db/KernelApplication.cs | 13 +- DigitalPlatform.rms.db/SessionInfo.cs | 2 - DigitalPlatform.rms.db/SqlDatabase.cs | 34 +- ZipUtil.exe | Bin 9216 -> 9216 bytes dp2Catalog/SaveRecordDlg.Designer.cs | 33 +- dp2Catalog/dp2Catalog.csproj | 2 +- .../{CopyrightDlg.cs => AboutDlg.cs} | 20 +- .../{CopyrightDlg.resx => AboutDlg.resx} | 0 dp2Circulation/BatchTaskForm.cs | 4 +- dp2Circulation/Entity/InventoryForm.cs | 3 +- dp2Circulation/Entity/ItemBarcodeLoader.cs | 8 +- dp2Circulation/EntityForm/EntityForm.cs | 457 +++++----- dp2Circulation/Issue/BindingControl.cs | 17 +- dp2Circulation/Label/LabelPrintForm.cs | 1 + dp2Circulation/MainForm/MainForm.Designer.cs | 26 +- dp2Circulation/MainForm/MainForm.cs | 6 +- dp2Circulation/Monitor/StartLogRecoverDlg.cs | 32 +- .../OperLogStatis/GetOperLogFilenameDlg.cs | 6 +- dp2Circulation/Order/OrderControl.cs | 13 +- dp2Circulation/Order/OrderDesignForm.cs | 7 +- dp2Circulation/Program.cs | 8 + dp2Circulation/Properties/AssemblyInfo.cs | 7 +- .../ExportPatronExcelDialog.Designer.cs | 279 ++++++ .../Reader/ExportPatronExcelDialog.cs | 243 ++++++ .../Reader/ExportPatronExcelDialog.resx | 120 +++ dp2Circulation/Reader/ReaderSearchForm.cs | 809 +++++++++++++++--- .../SearchForms/BiblioSearchForm.cs | 3 +- dp2Circulation/SearchForms/ItemSearchForm.cs | 55 +- .../SearchForms/ItemSearchFormBase.cs | 10 +- dp2Circulation/dp2Circulation.csproj | 17 +- dp2Installer/dp2Installer.csproj | 7 +- dp2LibraryXE/dp2LibraryXE.csproj | 2 +- 45 files changed, 2829 insertions(+), 702 deletions(-) create mode 100644 DigitalPlatform.LibraryClient/ChargingHistoryLoader.cs create mode 100644 DigitalPlatform.LibraryClient/ItemBarcodeLoader.cs rename dp2Circulation/{CopyrightDlg.cs => AboutDlg.cs} (93%) rename dp2Circulation/{CopyrightDlg.resx => AboutDlg.resx} (100%) create mode 100644 dp2Circulation/Reader/ExportPatronExcelDialog.Designer.cs create mode 100644 dp2Circulation/Reader/ExportPatronExcelDialog.cs create mode 100644 dp2Circulation/Reader/ExportPatronExcelDialog.resx diff --git a/DigitalPlatform.CommonControl/DateRangeControl.cs b/DigitalPlatform.CommonControl/DateRangeControl.cs index 6759d22de..bdd9c82c9 100644 --- a/DigitalPlatform.CommonControl/DateRangeControl.cs +++ b/DigitalPlatform.CommonControl/DateRangeControl.cs @@ -33,6 +33,11 @@ public partial class DateRangeControl : UserControl public DateRangeControl() { InitializeComponent(); + + this.dateTimePicker_start.Value = this.dateTimePicker_start.MinDate; + this.dateTimePicker_end.Value = this.dateTimePicker_end.MinDate; + RefreshDisplay(this.dateTimePicker_start); + RefreshDisplay(this.dateTimePicker_end); } public override Size MaximumSize @@ -156,6 +161,8 @@ public static DateTime Long8ToDateTime(string strDate8) private void dateTimePicker_start_ValueChanged(object sender, EventArgs e) { + RefreshDisplay(this.dateTimePicker_start); + if (IngoreTextChange > 0) return; @@ -165,8 +172,18 @@ private void dateTimePicker_start_ValueChanged(object sender, EventArgs e) } } + void RefreshDisplay(DateTimePicker picker) + { + if (picker.Value == picker.MinDate) + picker.CustomFormat = " "; + else + picker.CustomFormat = "yyyy-MM-dd"; + } + private void dateTimePicker_end_ValueChanged(object sender, EventArgs e) { + RefreshDisplay(this.dateTimePicker_end); + if (IngoreTextChange > 0) return; @@ -241,10 +258,19 @@ private void label_start_MouseUp(object sender, MouseEventArgs e) menuItem.MenuItems.Add(subMenuItem); } + menuItem = new MenuItem("清空"); + menuItem.Click += menu_clear_Click; + contextMenu.MenuItems.Add(menuItem); contextMenu.Show(this.label_start, new Point(e.X, e.Y)); } + void menu_clear_Click(object sender, EventArgs e) + { + this.dateTimePicker_start.Value = this.dateTimePicker_start.MinDate; + this.dateTimePicker_end.Value = this.dateTimePicker_end.MinDate; + } + void menu_quickSet_Click(object sender, EventArgs e) { MenuItem menu = (MenuItem)sender; diff --git a/DigitalPlatform.CommonControl/GetDateDlg.Designer.cs b/DigitalPlatform.CommonControl/GetDateDlg.Designer.cs index 58bd9c4da..bbabf8066 100644 --- a/DigitalPlatform.CommonControl/GetDateDlg.Designer.cs +++ b/DigitalPlatform.CommonControl/GetDateDlg.Designer.cs @@ -35,7 +35,7 @@ private void InitializeComponent() // this.monthCalendar1.Dock = System.Windows.Forms.DockStyle.Fill; this.monthCalendar1.Location = new System.Drawing.Point(0, 0); - this.monthCalendar1.Margin = new System.Windows.Forms.Padding(7, 7, 7, 7); + this.monthCalendar1.Margin = new System.Windows.Forms.Padding(7); this.monthCalendar1.Name = "monthCalendar1"; this.monthCalendar1.TabIndex = 0; this.monthCalendar1.DateSelected += new System.Windows.Forms.DateRangeEventHandler(this.monthCalendar1_DateSelected); diff --git a/DigitalPlatform.CommonControl/OrderDesignControl.cs b/DigitalPlatform.CommonControl/OrderDesignControl.cs index 364c08028..aefa546a7 100644 --- a/DigitalPlatform.CommonControl/OrderDesignControl.cs +++ b/DigitalPlatform.CommonControl/OrderDesignControl.cs @@ -480,7 +480,6 @@ public int Check(out string strError) // 2009/11/9 string strTotalPrice = ""; - try { strTotalPrice = item.TotalPrice; @@ -558,11 +557,8 @@ public int Check(out string strError) strError = "第 " + (i + 1).ToString() + " 行: 尚未输入期数"; return 1; } - - } - if (bStrict == true) { if (String.IsNullOrEmpty(item.Source) == true @@ -772,7 +768,7 @@ public int NotOrdering(out string strMessage) { Item cur_element = this.Items[i]; - if (cur_element.StateString == "") + if (String.IsNullOrEmpty(cur_element.StateString) == true) { Debug.Assert(cur_element.location.ReadOnly == true, ""); nNotOrderItemCount++; @@ -1607,6 +1603,19 @@ public void RemoveMultipleZeroCopyItem() } } + // 获得缺省记录 + internal string GetDefaultXml() + { + if (this.GetDefaultRecord != null) + { + GetDefaultRecordEventArgs e = new GetDefaultRecordEventArgs(); + this.GetDefaultRecord(this, e); + + return e.Xml; + } + return ""; + } + public Item AppendNewItem(bool bSetDefaultRecord) { this.DisableUpdate(); // 防止闪动。彻底解决问题。2009/10/13 @@ -1622,31 +1631,24 @@ public Item AppendNewItem(bool bSetDefaultRecord) this.Items.Add(item); - if (this.GetDefaultRecord != null - && bSetDefaultRecord == true) + if (bSetDefaultRecord == true) { - GetDefaultRecordEventArgs e = new GetDefaultRecordEventArgs(); - this.GetDefaultRecord(this, e); - - string strDefaultRecord = e.Xml; - - if (String.IsNullOrEmpty(strDefaultRecord) == true) - goto END1; - - string strError = ""; - // 根据缺省XML订购记录填充必要的字段 - int nRet = SetDefaultRecord(item, - strDefaultRecord, - true, - out strError); - if (nRet == -1) - throw new Exception(strError); + string strDefaultRecord = GetDefaultXml(); + if (String.IsNullOrEmpty(strDefaultRecord) == false) + { + string strError = ""; + // 根据缺省XML订购记录填充必要的字段 + int nRet = SetDefaultRecord(item, + strDefaultRecord, + true, + out strError); + if (nRet == -1) + throw new Exception(strError); + } } - END1: item.State = ItemState.New; - return item; } finally @@ -1655,7 +1657,7 @@ public Item AppendNewItem(bool bSetDefaultRecord) } } - public Item InsertNewItem(int index) + public Item InsertNewItem(int index, string strDefaultRecord = "") { this.DisableUpdate(); // 防止闪动。彻底解决问题。2009/10/13 try @@ -1669,16 +1671,11 @@ public Item InsertNewItem(int index) this.Items.Insert(index, item); - if (this.GetDefaultRecord != null) - { - GetDefaultRecordEventArgs e = new GetDefaultRecordEventArgs(); - this.GetDefaultRecord(this, e); - - string strDefaultRecord = e.Xml; - - if (String.IsNullOrEmpty(strDefaultRecord) == true) - goto END1; + if (string.IsNullOrEmpty(strDefaultRecord) == true) + strDefaultRecord = this.GetDefaultXml(); + if (String.IsNullOrEmpty(strDefaultRecord) == false) + { string strError = ""; // 根据缺省XML订购记录填充必要的字段 int nRet = SetDefaultRecord(item, @@ -1688,7 +1685,6 @@ public Item InsertNewItem(int index) if (nRet == -1) throw new Exception("装载订购记录缺省值时出错: " + strError); } - END1: item.State = ItemState.New; return item; @@ -2245,10 +2241,14 @@ internal void InvalidateLine(Item item) private void tableLayoutPanel_content_Paint(object sender, PaintEventArgs e) { + e.Graphics.SmoothingMode = SmoothingMode.HighQuality; + e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; + e.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; + e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; + using (Brush brushText = new SolidBrush(Color.Black)) using (Pen pen = new Pen(Color.Red)) { - Point p = this.tableLayoutPanel_content.PointToScreen(new Point(0, 0)); // Debug.WriteLine("p x=" + p.X.ToString() + " y=" + p.Y.ToString()); @@ -2318,7 +2318,6 @@ private void tableLayoutPanel_content_Paint(object sender, PaintEventArgs e) } x += fWidth; } - // y += height; } } @@ -2893,7 +2892,6 @@ internal void RemoveFromTable(TableLayoutPanel table, try { - // 移除本行相关的控件 table.Controls.Remove(this.label_color); table.Controls.Remove(this.textBox_catalogNo); @@ -3091,7 +3089,6 @@ internal void InsertToTable(TableLayoutPanel table, AddEvents(true); } - void AddEvents(bool bAdd) { if (bAdd) @@ -3302,8 +3299,6 @@ void dateRange_range_DateTextChanged(object sender, EventArgs e) this.Container.Changed = true; } - - #region events // 2008/9/13 @@ -3683,12 +3678,21 @@ void label_color_MouseUp(object sender, MouseEventArgs e) * */ // - menuItem = new MenuItem("前插(&I)"); + menuItem = new MenuItem("复制新增[后](&A)"); + menuItem.Click += new System.EventHandler(this.menu_appendCopyElement_Click); + contextMenu.MenuItems.Add(menuItem); + + // --- + menuItem = new MenuItem("-"); + contextMenu.MenuItems.Add(menuItem); + + // + menuItem = new MenuItem("新增[前](&I)"); menuItem.Click += new System.EventHandler(this.menu_insertElement_Click); contextMenu.MenuItems.Add(menuItem); // - menuItem = new MenuItem("后插(&A)"); + menuItem = new MenuItem("新增[后](&A)"); menuItem.Click += new System.EventHandler(this.menu_appendElement_Click); contextMenu.MenuItems.Add(menuItem); @@ -3868,6 +3872,61 @@ void menu_appendElement_Click(object sender, EventArgs e) this.Container.InsertNewItem(nPos + 1).EnsureVisible(); } + // 复制新增 + void menu_appendCopyElement_Click(object sender, EventArgs e) + { + int nPos = this.Container.Items.IndexOf(this); + if (nPos == -1) + { + throw new Exception("not found myself"); + } + + string strError = ""; + string strXml = ""; + Item source = this.Container.Items[nPos]; + // 获得表示事项全部内容的XML记录 + int nRet = BuildXml(out strXml, out strError); + if (nRet == -1) + throw new Exception(strError); + + string strBatchNo = ""; + { + string strDefaultXml = this.Container.GetDefaultXml(); + if (string.IsNullOrEmpty(strDefaultXml) == false) + { + XmlDocument dom = new XmlDocument(); + dom.LoadXml(strDefaultXml); + strBatchNo = DomUtil.GetElementText(dom.DocumentElement, "batchNo"); + } + } + + // 修改一些字段 + { + XmlDocument dom = new XmlDocument(); + dom.LoadXml(strXml); + + // 如果单价和总价都有,则要把总价清空 + string strPrice = DomUtil.GetElementText(dom.DocumentElement, "price"); + string strTotalPrice = DomUtil.GetElementText(dom.DocumentElement, "totalPrice"); + if (string.IsNullOrEmpty(strPrice) == false && string.IsNullOrEmpty(strTotalPrice) == false) + DomUtil.SetElementText(dom.DocumentElement, "totalPrice", ""); + + DomUtil.SetElementText(dom.DocumentElement, "state", ""); + DomUtil.SetElementText(dom.DocumentElement, "refID", ""); + DomUtil.SetElementText(dom.DocumentElement, "range", ""); + DomUtil.SetElementText(dom.DocumentElement, "batchNo", strBatchNo); + strXml = dom.DocumentElement.OuterXml; + } + + Item target = this.Container.InsertNewItem(nPos + 1, strXml); +#if NO + target.StateString = ""; + target.RefID = ""; + target.RangeString = ""; // TODO: 可以从上一个事项的时候后面自动计算延展 +#endif + target.EnsureVisible(); + } + // 删除当前元素 void menu_deleteElements_Click(object sender, EventArgs e) { @@ -3920,6 +3979,23 @@ void menu_deleteElements_Click(object sender, EventArgs e) MessageBox.Show(this.Container, "有 " + nNotDeleteCount.ToString() + " 项已订购状态的事项未能删除"); } + void CopyTo(Item item) + { + item.CatalogNo = this.CatalogNo; + item.Seller = this.Seller; + item.Source = this.Source; + item.RangeString = this.RangeString; + item.IssueCountString = this.IssueCountString; + item.CopyString = this.CopyString; + item.OldPrice = this.OldPrice; + item.Price = this.Price; + item.Distribute = this.Distribute; + item.SellerAddressXml = this.SellerAddressXml; + item.Class = this.Class; + // StateString 不要复制 + // item.TotalPrice = this.TotalPrice; + } + #region 外部需要使用的属性 // 书目号 @@ -4287,12 +4363,12 @@ public string Index this.OtherXml = dom.OuterXml; // 会自动刷新显示 - } } +#if NO // 2008/11/12 - string m_strStateString = ""; + // string m_strStateString = ""; public string StateString { @@ -4300,8 +4376,69 @@ public string StateString { return m_strStateString; } + set + { + m_strStateString = value; + } + } +#endif + string GetFieldValue(string strElementName) + { + XmlDocument dom = new XmlDocument(); + if (String.IsNullOrEmpty(this.m_otherXml) == false) + { + try + { + dom.LoadXml(this.m_otherXml); + } + catch (Exception ex) + { + throw new Exception("load other xml error: " + ex.Message); + } + return DomUtil.GetElementText(dom.DocumentElement, + strElementName); + } + else + return ""; + } + + void SetFieldValue(string strElementName, string strValue) + { + XmlDocument dom = new XmlDocument(); + if (String.IsNullOrEmpty(this.m_otherXml) == false) + { + try + { + dom.LoadXml(this.m_otherXml); + } + catch (Exception ex) + { + throw new Exception("load other xml error: " + ex.Message); + } + } + else + dom.LoadXml(""); + + DomUtil.SetElementText(dom.DocumentElement, + strElementName, strValue); + + this.m_otherXml = dom.DocumentElement.OuterXml; + } + + // 可能会抛出异常 + public string StateString + { + get + { + return this.GetFieldValue("state"); + } + set + { + this.SetFieldValue("state", value); + } } + int DisplaySellerAddressXml(string strXml, out string strError) { @@ -4389,7 +4526,7 @@ int DisplayOtherXml(string strXml, string strState = DomUtil.GetElementText(dom.DocumentElement, "state"); - m_strStateString = strState; + ////m_strStateString = strState; string strRange = DomUtil.GetElementText(dom.DocumentElement, "range"); @@ -4425,6 +4562,7 @@ public string TotalPrice { get { +#if NO XmlDocument dom = new XmlDocument(); if (String.IsNullOrEmpty(this.m_otherXml) == false) { @@ -4441,9 +4579,12 @@ public string TotalPrice } else return ""; +#endif + return this.GetFieldValue("totalPrice"); } set { +#if NO XmlDocument dom = new XmlDocument(); if (String.IsNullOrEmpty(this.m_otherXml) == false) { @@ -4463,6 +4604,60 @@ public string TotalPrice "totalPrice", value); this.m_otherXml = dom.DocumentElement.OuterXml; +#endif + this.SetFieldValue("totalPrice", value); + } + } + + // 可能会抛出异常 + public string RefID + { + get + { +#if NO + XmlDocument dom = new XmlDocument(); + if (String.IsNullOrEmpty(this.m_otherXml) == false) + { + try + { + dom.LoadXml(this.m_otherXml); + } + catch (Exception ex) + { + throw new Exception("load other xml error: " + ex.Message); + } + return DomUtil.GetElementText(dom.DocumentElement, + "refID"); + } + else + return ""; +#endif + return this.GetFieldValue("refID"); + } + set + { +#if NO + XmlDocument dom = new XmlDocument(); + if (String.IsNullOrEmpty(this.m_otherXml) == false) + { + try + { + dom.LoadXml(this.m_otherXml); + } + catch (Exception ex) + { + throw new Exception("load other xml error: " + ex.Message); + } + } + else + dom.LoadXml(""); + + DomUtil.SetElementText(dom.DocumentElement, + "refID", value); + + this.m_otherXml = dom.DocumentElement.OuterXml; +#endif + this.SetFieldValue("refID", value); } } @@ -4521,7 +4716,6 @@ public int BuildXml(out string strXml, "class", this.Class); strXml = dom.OuterXml; - return 0; } diff --git a/DigitalPlatform.KernelService/KernelService.cs b/DigitalPlatform.KernelService/KernelService.cs index b1444a5e1..c8610cd0e 100644 --- a/DigitalPlatform.KernelService/KernelService.cs +++ b/DigitalPlatform.KernelService/KernelService.cs @@ -321,11 +321,12 @@ public User GetUser(out string strError) // 2.61 2015/11/8 Search() 和 SearchEx() 中,XML 检索式的 target 元素增加了 hint 属性。如果 hint 属性包含 first 子串,则当 target 元素的 list 属性包含多个数据库时,顺次检索的过程中只要有一次命中,就立即停止检索返回。此方式能提高检索速度,但不保证能检索全命中结果。比较适合用于册条码号等特定的检索途径进行借书还书操作 // 2.62 2015/11/14 GetBrowse() API 允许获得对象记录的 metadata 和 timestamp // 2.63 2015/11/16 WriteRes() API WriteRes() API 允许通过 lTotalLength 为 -1 调用,作用是仅修改 metadata + // 2.64 2016/1/6 MySQL 版本在删除和创建检索点的时候所使用的 SQL 语句多了一个分号。此 Bug 已经排除 public Result GetVersion() { Result result = new Result(); result.Value = 0; - result.ErrorString = "2.63"; + result.ErrorString = "2.64"; return result; } diff --git a/DigitalPlatform.LibraryClient/ChargingHistoryLoader.cs b/DigitalPlatform.LibraryClient/ChargingHistoryLoader.cs new file mode 100644 index 000000000..0293c5508 --- /dev/null +++ b/DigitalPlatform.LibraryClient/ChargingHistoryLoader.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using DigitalPlatform.LibraryClient.localhost; + +namespace DigitalPlatform.LibraryClient +{ + public class ChargingHistoryLoader : IEnumerable + { + public string PatronBarcode {get;set;} + public string TimeRange {get;set;} + public string Actions {get;set;} + public string Order {get;set;} + public long Start = 0; + public long Length = -1; + + public LibraryChannel Channel + { + get; + set; + } + + public Stop Stop + { + get; + set; + } + + // 获得满足条件的事项总数 + public long GetCount() + { + string strError = ""; + ChargingItemWrapper[] temp_results = null; + long lRet = this.Channel.SearchCharging( + this.Stop, + this.PatronBarcode, + this.TimeRange, + this.Actions, + this.Order, + 0, + 0, + out temp_results, + out strError); + if (lRet == -1) + throw new Exception(strError); + return lRet; + } + + public IEnumerator GetEnumerator() + { + long lStart = this.Start; + long lLength = this.Length; + long lHitCount = 0; + + int nGeted = 0; + for (; ; ) + { + string strError = ""; + ChargingItemWrapper[] temp_results = null; + long lRet = this.Channel.SearchCharging( + this.Stop, + this.PatronBarcode, + this.TimeRange, + this.Actions, + this.Order, + lStart + nGeted, + lLength, + out temp_results, + out strError); + if (lRet == -1) + throw new Exception(strError); + lHitCount = lRet; + if (temp_results == null || temp_results.Length == 0) + break; + + foreach(ChargingItemWrapper wrapper in temp_results) + { + yield return wrapper; + } + + // 修正 lLength + if (lLength != -1 && lHitCount < lStart + nGeted + lLength) + lLength -= lStart + nGeted + lLength - lHitCount; + + nGeted += temp_results.Length; + if (nGeted >= lHitCount - lStart) + yield break; + if (lLength != -1) + lLength -= temp_results.Length; + + if (lLength <= 0 && lLength != -1) + yield break; + } + } + } +} diff --git a/DigitalPlatform.LibraryClient/DigitalPlatform.LibraryClient.csproj b/DigitalPlatform.LibraryClient/DigitalPlatform.LibraryClient.csproj index 9f67ed79a..edec127a1 100644 --- a/DigitalPlatform.LibraryClient/DigitalPlatform.LibraryClient.csproj +++ b/DigitalPlatform.LibraryClient/DigitalPlatform.LibraryClient.csproj @@ -45,6 +45,8 @@ + + diff --git a/DigitalPlatform.LibraryClient/ItemBarcodeLoader.cs b/DigitalPlatform.LibraryClient/ItemBarcodeLoader.cs new file mode 100644 index 000000000..c7b8fc027 --- /dev/null +++ b/DigitalPlatform.LibraryClient/ItemBarcodeLoader.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Diagnostics; + +// using DigitalPlatform.Text; + +namespace DigitalPlatform.LibraryClient +{ +#if NO + /// + /// 根据册条码号获得册记录路径的枚举器 + /// + public class ItemBarcodeLoader : IEnumerable + { + List _barcodes = new List(); + + public List Barcodes + { + get + { + return this._barcodes; + } + set + { + this._barcodes = value; + } + } + + public LibraryChannel Channel + { + get; + set; + } + + public Stop Stop + { + get; + set; + } + + public IEnumerator GetEnumerator() + { + string strError = ""; + List barcodes = new List(); + int i = 0; + foreach (string strBarcode in this._barcodes) + { + barcodes.Add(strBarcode); + if (barcodes.Count >= 100 + || (i == this._barcodes.Count - 1 && barcodes.Count > 0)) + { + string strBiblio = ""; + string strResult = ""; + + if (this.Channel == null) + throw new ArgumentException("Channel 成员不应为 null", "Channel"); + + long lRet = this.Channel.GetItemInfo(this.Stop, + "@barcode-list:" + string.Join(",", barcodes), + "get-path-list", + out strResult, + "", // strBiblioType, + out strBiblio, + out strError); + if (lRet == -1) + throw new Exception(strError); + + List recpaths = strResult.Split(new char[] { ',' }).ToList(); + // StringUtil.SplitList(strResult); + + if (recpaths.Count == 0 && barcodes.Count == 1) + recpaths.Add(""); + else + { + Debug.Assert(barcodes.Count == recpaths.Count, ""); + } + + for (int j = 0; j < recpaths.Count; j++) + { + string recpath = recpaths[j]; + ItemBarcodeInfo info = new ItemBarcodeInfo(); + info.RecPath = recpath; + info.ItemBarcode = barcodes[j]; + yield return info; + } + + barcodes.Clear(); + } + + i++; + } + + Debug.Assert(barcodes.Count == 0, ""); + } + } + + public class ItemBarcodeInfo + { + public string ItemBarcode { get; set; } + public string RecPath { get; set; } + public string ErrorInfo { get; set; } + } +#endif +} diff --git a/DigitalPlatform.LibraryServer/AppBiblio.cs b/DigitalPlatform.LibraryServer/AppBiblio.cs index 7f825ea20..710f8413c 100644 --- a/DigitalPlatform.LibraryServer/AppBiblio.cs +++ b/DigitalPlatform.LibraryServer/AppBiblio.cs @@ -113,6 +113,59 @@ public LibraryServerResult GetBiblioInfos( out timestamp); } + int BatchGetBiblioSummary( + SessionInfo sessioninfo, + string strBiblioRecPath, + out List result_strings, + out string strError) + { + strError = ""; + result_strings = new List(); + + RmsChannel channel = sessioninfo.Channels.GetChannel(this.WsUrl); + if (channel == null) + { + strError = "channel == null"; + return -1; + } + + List commands = new List(); + string strText = strBiblioRecPath.Substring("@path-list:".Length); + + commands = StringUtil.SplitList(strText); + // string strErrorText = ""; + foreach (string command in commands) + { + if (string.IsNullOrEmpty(command) == true) + continue; + + string strItemBarcode = command; + + if (strItemBarcode.StartsWith("@itemBarcode:") == true) + strItemBarcode = strItemBarcode.Substring("@itemBarcode:".Length); + else + strItemBarcode = "@bibliorecpath:" + strItemBarcode; + + string strOutputBiblioRecPath = ""; + string strSummary = ""; + LibraryServerResult result = GetBiblioSummary( + sessioninfo, + channel, + strItemBarcode, + "", // strConfirmItemRecPath, + "", // strBiblioRecPathExclude, + out strOutputBiblioRecPath, + out strSummary); + if (result.Value == -1) + { + strError = result.ErrorInfo; + return -1; + } + result_strings.Add(strSummary); + } + return 0; + } + // 获得书目信息 // 可以用多种格式:xml html text @??? summary outputpath // TODO: 将来可以增加在strBiblioRecPath中允许多种检索入口的能力,比方说允许使用itembarcode和itemconfirmpath(甚至和excludebibliopath)结合起来定位种。这样就完全可以取代原有GetBiblioSummary API的功能 @@ -143,6 +196,23 @@ public LibraryServerResult GetBiblioInfos( goto ERROR1; } + if (formats != null && formats.Length == 1 && formats[0] == "summary" + && string.IsNullOrEmpty(strBiblioXmlParam) == true) + { + List temp_results = null; + + nRet = BatchGetBiblioSummary( + sessioninfo, + strBiblioRecPath, + out temp_results, + out strError); + if (nRet == -1) + goto ERROR1; + results = temp_results.ToArray(); + result.Value = 1; + return result; + } + // 检查特定格式的权限 if (formats != null) { @@ -187,6 +257,13 @@ public LibraryServerResult GetBiblioInfos( commands.Add(strBiblioRecPath); } + RmsChannel channel = sessioninfo.Channels.GetChannel(this.WsUrl); + if (channel == null) + { + strError = "channel == null"; + goto ERROR1; + } + int nPackageSize = 0; // 估算通讯包的尺寸 List result_strings = new List(); @@ -212,8 +289,33 @@ public LibraryServerResult GetBiblioInfos( else strCurrentBiblioRecPath = command; + // 2016/1/2 + if (strCurrentBiblioRecPath.StartsWith("@itemBarcode:") == true) + { + string strTemp = ""; + string strItemBarcode = strCurrentBiblioRecPath.Substring("@itemBarcode:".Length); + nRet = GetBiblioRecPathByItemBarcode( + sessioninfo, + channel, + strItemBarcode, + out strTemp, + out strError); + if (nRet == -1) + { + strError = "根据册条码号 '" + strItemBarcode + "' 获取书目记录路径时出错: " + strError; + goto ERROR1; + } + if (nRet == 0) + { + result_strings.AddRange(new string[formats.Length]); + continue; + } + strCurrentBiblioRecPath = strTemp; + } + string strBiblioDbName = ResPath.GetDbName(strCurrentBiblioRecPath); + // TODO: 册条码号和册记录路径也应该允许 if (IsBiblioDbName(strBiblioDbName) == false) { strError = "书目记录路径 '" + strCurrentBiblioRecPath + "' 中包含的数据库名 '" + strBiblioDbName + "' 不是合法的书目库名"; @@ -362,13 +464,6 @@ public LibraryServerResult GetBiblioInfos( } else { - RmsChannel channel = sessioninfo.Channels.GetChannel(this.WsUrl); - if (channel == null) - { - strError = "channel == null"; - goto ERROR1; - } - string strStyle = "timestamp,outputpath"; // "metadata,timestamp,outputpath"; if (formats != null && formats.Length > 0) @@ -598,33 +693,29 @@ int BuildFormats( goto CONTINUE; } - // 获得本地配置文件 - string strLocalPath = ""; - - string strRemotePath = BrowseFormat.CanonicalizeScriptFileName( - ResPath.GetDbName(strCurrentBiblioRecPath), - "./cfgs/summary.fltx"); - - nRet = this.CfgsMap.MapFileToLocal( - // sessioninfo.Channels, - channel, - strRemotePath, - out strLocalPath, - out strError); - if (nRet == -1) + // TODO: 是否要延迟获得书目记录? + SummaryItem summary = GetBiblioSummary(strCurrentBiblioRecPath); + if (summary != null && string.IsNullOrEmpty(summary.Summary) == false) { - // goto ERROR1; - if (String.IsNullOrEmpty(strErrorText) == false) - strErrorText += ";\r\n"; - strErrorText += strError; - goto CONTINUE; + strBiblio = summary.Summary; + { + // 从存储中命中 + if (this.Statis != null) + this.Statis.IncreaseEntryValue( + sessioninfo.LibraryCodeList, + "获取书目摘要", + "存储命中次", + 1); + } } - if (nRet == 0) + else { - // 配置.fltx文件不存在, 再试探.cs文件 - strRemotePath = BrowseFormat.CanonicalizeScriptFileName( - ResPath.GetDbName(strCurrentBiblioRecPath), - "./cfgs/summary.cs"); + // 获得本地配置文件 + string strLocalPath = ""; + + string strRemotePath = BrowseFormat.CanonicalizeScriptFileName( + ResPath.GetDbName(strCurrentBiblioRecPath), + "./cfgs/summary.fltx"); nRet = this.CfgsMap.MapFileToLocal( // sessioninfo.Channels, @@ -642,79 +733,101 @@ int BuildFormats( } if (nRet == 0) { - strError = strRemotePath + "不存在..."; - // goto ERROR1; - if (String.IsNullOrEmpty(strErrorText) == false) - strErrorText += ";\r\n"; - strErrorText += strError; - goto CONTINUE; + // 配置.fltx文件不存在, 再试探.cs文件 + strRemotePath = BrowseFormat.CanonicalizeScriptFileName( + ResPath.GetDbName(strCurrentBiblioRecPath), + "./cfgs/summary.cs"); + + nRet = this.CfgsMap.MapFileToLocal( + // sessioninfo.Channels, + channel, + strRemotePath, + out strLocalPath, + out strError); + if (nRet == -1) + { + // goto ERROR1; + if (String.IsNullOrEmpty(strErrorText) == false) + strErrorText += ";\r\n"; + strErrorText += strError; + goto CONTINUE; + } + if (nRet == 0) + { + strError = strRemotePath + "不存在..."; + // goto ERROR1; + if (String.IsNullOrEmpty(strErrorText) == false) + strErrorText += ";\r\n"; + strErrorText += strError; + goto CONTINUE; + } } - } - bool bFltx = false; - // 如果是一般.cs文件, 还需要获得.cs.ref配置文件 - if (IsCsFileName(strRemotePath) == true) - { - string strTempPath = ""; - nRet = this.CfgsMap.MapFileToLocal( - // sessioninfo.Channels, - channel, - strRemotePath + ".ref", - out strTempPath, - out strError); - if (nRet == -1) + bool bFltx = false; + // 如果是一般.cs文件, 还需要获得.cs.ref配置文件 + if (IsCsFileName(strRemotePath) == true) { - // goto ERROR1; - if (String.IsNullOrEmpty(strErrorText) == false) - strErrorText += ";\r\n"; - strErrorText += strError; - goto CONTINUE; + string strTempPath = ""; + nRet = this.CfgsMap.MapFileToLocal( + // sessioninfo.Channels, + channel, + strRemotePath + ".ref", + out strTempPath, + out strError); + if (nRet == -1) + { + // goto ERROR1; + if (String.IsNullOrEmpty(strErrorText) == false) + strErrorText += ";\r\n"; + strErrorText += strError; + goto CONTINUE; + } + bFltx = false; } - bFltx = false; - } - else - { - bFltx = true; - } - string strSummary = ""; + else + { + bFltx = true; + } + string strSummary = ""; - // 将种记录数据从XML格式转换为HTML格式 - if (string.IsNullOrEmpty(strBiblioXml) == false) - { - if (bFltx == true) + // 将种记录数据从XML格式转换为HTML格式 + if (string.IsNullOrEmpty(strBiblioXml) == false) { - string strFilterFileName = strLocalPath; - nRet = this.ConvertBiblioXmlToHtml( - strFilterFileName, + if (bFltx == true) + { + string strFilterFileName = strLocalPath; + nRet = this.ConvertBiblioXmlToHtml( + strFilterFileName, + strBiblioXml, + null, + strCurrentBiblioRecPath, + out strSummary, + out strError); + } + else + { + nRet = this.ConvertRecordXmlToHtml( + strLocalPath, + strLocalPath + ".ref", strBiblioXml, - null, - strCurrentBiblioRecPath, + strCurrentBiblioRecPath, // 2009/10/18 out strSummary, out strError); + } + if (nRet == -1) + { + // goto ERROR1; + if (String.IsNullOrEmpty(strErrorText) == false) + strErrorText += ";\r\n"; + strErrorText += strError; + goto CONTINUE; + } } else - { - nRet = this.ConvertRecordXmlToHtml( - strLocalPath, - strLocalPath + ".ref", - strBiblioXml, - strCurrentBiblioRecPath, // 2009/10/18 - out strSummary, - out strError); - } - if (nRet == -1) - { - // goto ERROR1; - if (String.IsNullOrEmpty(strErrorText) == false) - strErrorText += ";\r\n"; - strErrorText += strError; - goto CONTINUE; - } - } - else - strSummary = ""; + strSummary = ""; - strBiblio = strSummary; + strBiblio = strSummary; + } } // 目标记录路径 else if (String.Compare(strBiblioType, "targetrecpath", true) == 0) @@ -1149,9 +1262,83 @@ public int GetBiblioSummary(string strItemBarcode, return 0; } + // 根据册条码号获得它所从属的书目记录路径 + int GetBiblioRecPathByItemBarcode(SessionInfo sessioninfo, + RmsChannel channel, + string strItemBarcode, + out string strBiblioRecPath, + out string strError) + { + strBiblioRecPath = ""; + strError = ""; + + string strItemXml = ""; + string strOutputItemPath = ""; + // 获得册记录 + // return: + // -1 error + // 0 not found + // 1 命中1条 + // >1 命中多于1条 + int nRet = this.GetItemRecXml( + channel, + strItemBarcode, + out strItemXml, + out strOutputItemPath, + out strError); + if (nRet == -1) + return -1; + if (nRet == 0) + return 0; + + // 从册记录中获得从属的种id + string strBiblioRecID = ""; + + XmlDocument dom = new XmlDocument(); + try + { + dom.LoadXml(strItemXml); + } + catch (Exception ex) + { + strError = "册记录XML装载到DOM出错:" + ex.Message; + return -1; + } + + strBiblioRecID = DomUtil.GetElementText(dom.DocumentElement, "parent"); // + if (String.IsNullOrEmpty(strBiblioRecID) == true) + { + strError = "种下属记录XML中元素缺乏或者值为空, 因此无法定位种记录"; + return -1; + } + + string strItemDbName = ResPath.GetDbName(strOutputItemPath); + string strBiblioDbName = ""; + + // 根据书目下属库名, 找到对应的书目库名 + // return: + // -1 出错 + // 0 没有找到 + // 1 找到 + nRet = this.GetBiblioDbNameByChildDbName(strItemDbName, + out strBiblioDbName, + out strError); + if (nRet == -1) + return -1; + if (nRet == 0) + { + strError = "下属库名 '" + strItemDbName + "' 没有找到所从属的书目库名"; + return -1; + } + + strBiblioRecPath = strBiblioDbName + "/" + strBiblioRecID; + return 1; + } + // 从册条码号(+册记录路径)获得种记录摘要,或者从订购记录路径、期记录路径、评注记录路径获得种记录摘要 // 权限: 需要具有getbibliosummary权限 // parameters: + // strConfirmItemRecPath 如果 strComfirmItemRecPath 形态为 xxx|xxx,右边部分就是书目记录路径 // strBiblioRecPathExclude 除开列表中的这些种路径, 才返回摘要内容, 否则仅仅返回种路径即可 // 如果包含 "coverimage",表示要在 strSummary 头部包含封面图像的 片段 public LibraryServerResult GetBiblioSummary( @@ -1242,14 +1429,17 @@ public LibraryServerResult GetBiblioSummary( strBiblioRecPath = strRight; goto LOADBIBLIO; } + strConfirmItemRecPath = strLeft; } bool bByRecPath = false; // 是否经过记录路径来获取的? - // TODO: 在获取册记录的时候,可以要求 dp2kernel 只返回 parent 元素 + // 从册记录中获得从属的种id + string strBiblioRecID = ""; if (string.IsNullOrEmpty(strItemBarcode) == false) { +#if NO // 获得册记录 // return: // -1 error @@ -1262,6 +1452,18 @@ public LibraryServerResult GetBiblioSummary( out strItemXml, out strOutputItemPath, out strError); +#endif + // return: + // -1 error + // 0 not found + // 1 命中1条 + // >1 命中多于1条 + nRet = this.GetItemRecParent( + channel, + strItemBarcode, + out strBiblioRecID, + out strOutputItemPath, + out strError); if (nRet == 0) { result.Value = 0; @@ -1288,53 +1490,77 @@ public LibraryServerResult GetBiblioSummary( byte[] item_timestamp = null; +#if NO lRet = channel.GetRes(strConfirmItemRecPath, out strItemXml, out strMetaData, out item_timestamp, out strOutputItemPath, out strError); +#endif + string strValue = ""; + lRet = channel.GetRes(strConfirmItemRecPath + "/xpath/@//parent", + out strValue, + out strMetaData, + out item_timestamp, + out strOutputItemPath, + out strError); if (lRet == -1) { strError = "根据strConfirmItemRecPath '" + strConfirmItemRecPath + "' 获得记录失败: " + strError; goto ERROR1; } + if (string.IsNullOrEmpty(strValue) == true) + { + strError = "根据strConfirmItemRecPath '" + strConfirmItemRecPath + "' 获得记录失败: " + "记录中没有返回有效的 parent 元素"; + goto ERROR1; + } + XmlDocument dom = new XmlDocument(); + try + { + dom.LoadXml(strValue); + } + catch (Exception ex) + { + strError = "strValue 装载到DOM出错:" + ex.Message; + goto ERROR1; + } + strBiblioRecID = dom.DocumentElement.InnerText.Trim(); +#if NO bByRecPath = true; - } - // 从册记录中获得从属的种id - string strBiblioRecID = ""; + XmlDocument dom = new XmlDocument(); + try + { + dom.LoadXml(strItemXml); + } + catch (Exception ex) + { + strError = "册记录XML装载到DOM出错:" + ex.Message; + goto ERROR1; + } - XmlDocument dom = new XmlDocument(); - try - { - dom.LoadXml(strItemXml); - } - catch (Exception ex) - { - strError = "册记录XML装载到DOM出错:" + ex.Message; - goto ERROR1; - } + if (bByRecPath == true + && string.IsNullOrEmpty(strItemBarcode) == false) // 2011/9/6 + { + // 这种情况需要核实册条码号 + string strTempItemBarcode = DomUtil.GetElementText(dom.DocumentElement, + "//barcode"); + if (strTempItemBarcode != strItemBarcode) + { + strError = "通过册条码号 '" + strItemBarcode + "' 获取实体记录发现命中多条,然后自动用记录路径 '" + strConfirmItemRecPath + "' 来获取实体记录,虽然获取成功,但是发现所获取的记录中元素中的册条码号 '" + strTempItemBarcode + "' 不符合要求的册条码号 '" + strItemBarcode + "。(后面)这种情况可能是由于实体记录发生过移动造成的。"; + goto ERROR1; + } + } - if (bByRecPath == true - && string.IsNullOrEmpty(strItemBarcode) == false) // 2011/9/6 - { - // 这种情况需要核实册条码号 - string strTempItemBarcode = DomUtil.GetElementText(dom.DocumentElement, - "//barcode"); - if (strTempItemBarcode != strItemBarcode) + strBiblioRecID = DomUtil.GetElementText(dom.DocumentElement, "parent"); // + if (String.IsNullOrEmpty(strBiblioRecID) == true) { - strError = "通过册条码号 '" + strItemBarcode + "' 获取实体记录发现命中多条,然后自动用记录路径 '" + strConfirmItemRecPath + "' 来获取实体记录,虽然获取成功,但是发现所获取的记录中元素中的册条码号 '" + strTempItemBarcode + "' 不符合要求的册条码号 '" + strItemBarcode + "。(后面)这种情况可能是由于实体记录发生过移动造成的。"; + strError = "种下属记录XML中元素缺乏或者值为空, 因此无法定位种记录"; goto ERROR1; } - } - - strBiblioRecID = DomUtil.GetElementText(dom.DocumentElement, "parent"); // - if (String.IsNullOrEmpty(strBiblioRecID) == true) - { - strError = "种下属记录XML中元素缺乏或者值为空, 因此无法定位种记录"; - goto ERROR1; +#endif } // 从配置文件中获得和实体库对应的书目库名 diff --git a/DigitalPlatform.LibraryServer/AppEntity.cs b/DigitalPlatform.LibraryServer/AppEntity.cs index 203ad5a03..92514ba1a 100644 --- a/DigitalPlatform.LibraryServer/AppEntity.cs +++ b/DigitalPlatform.LibraryServer/AppEntity.cs @@ -145,7 +145,7 @@ public static bool IncludeStateProcessing(string strStateString) // 如果返回值不是0,就中断循环并返回 public delegate int Delegate_checkRecord(string strRecPath, XmlDocument dom, - byte [] baTimestamp, + byte[] baTimestamp, object param, out string strError); @@ -323,9 +323,9 @@ public int SearchChildEntities(RmsChannel channel, if (procCheckRecord != null) { - nRet = procCheckRecord(strOutputPath, - domExist, - timestamp, + nRet = procCheckRecord(strOutputPath, + domExist, + timestamp, param, out strError); if (nRet != 0) @@ -516,7 +516,7 @@ public int CopyBiblioChildEntities(RmsChannel channel, string strParentID = ResPath.GetRecordId(strTargetBiblioRecPath); if (string.IsNullOrEmpty(strParentID) == true) { - strError = "目标书目记录路径 '"+strTargetBiblioRecPath+"' 不正确,无法获得记录号"; + strError = "目标书目记录路径 '" + strTargetBiblioRecPath + "' 不正确,无法获得记录号"; return -1; } @@ -748,7 +748,7 @@ public int CopyBiblioChildRecords(RmsChannel channel, if (entityinfos.Count != target_recpaths.Count) { - strError = "entityinfos.Count (" + entityinfos.Count.ToString() + ") != target_recpaths.Count (" + target_recpaths.Count .ToString()+ ")"; + strError = "entityinfos.Count (" + entityinfos.Count.ToString() + ") != target_recpaths.Count (" + target_recpaths.Count.ToString() + ")"; return -1; } @@ -974,7 +974,7 @@ public int DeleteBiblioChildEntities(RmsChannel channel, } catch (Exception ex) { - strError = "实体记录 '"+info.RecPath+"' XML装载进入DOM时发生错误: " + ex.Message; + strError = "实体记录 '" + info.RecPath + "' XML装载进入DOM时发生错误: " + ex.Message; goto ERROR1; } @@ -987,7 +987,7 @@ public int DeleteBiblioChildEntities(RmsChannel channel, out strDetail); if (bHasCirculationInfo == true) { - strError = "拟删除的册记录 '" + info.RecPath + "' 中包含有流通信息("+strDetail+")(此种情况可能不限于这一条),不能删除。"; + strError = "拟删除的册记录 '" + info.RecPath + "' 中包含有流通信息(" + strDetail + ")(此种情况可能不限于这一条),不能删除。"; goto ERROR1; } @@ -1323,7 +1323,7 @@ static string GetLibraryCodeParam(string strStyle) { string strText = strPart.Trim(); if (StringUtil.HasHead(strText, "librarycode:") == true) - return strText.Substring("librarycode:".Length).Trim().Replace("|",","); + return strText.Substring("librarycode:".Length).Trim().Replace("|", ","); } return null; @@ -1409,7 +1409,7 @@ public LibraryServerResult GetEntities( if (String.IsNullOrEmpty(strItemDbName) == true) { result.Value = -1; - result.ErrorInfo = "书目库 '"+strBiblioDbName+"' 未定义下属的实体库"; + result.ErrorInfo = "书目库 '" + strBiblioDbName + "' 未定义下属的实体库"; result.ErrorCode = ErrorCode.ItemDbNotDef; return result; } @@ -1444,7 +1444,7 @@ public LibraryServerResult GetEntities( + StringUtil.GetXmlStringSimple(strItemDbName + ":" + "父记录+馆藏地点") + "'>" + StringUtil.GetXmlStringSimple(strBiblioRecId + "|" + strCode + "/") - +"left=string-1" + "zh" + ""; + + "left=string-1" + "zh" + ""; if (string.IsNullOrEmpty(strQueryXml) == false) { Debug.Assert(String.IsNullOrEmpty(strQueryXml) == false, ""); @@ -1579,7 +1579,7 @@ public LibraryServerResult GetEntities( entityinfo.NewRecord = ""; entityinfo.NewTimestamp = null; entityinfo.Action = ""; - + goto CONTINUE; } @@ -1997,7 +1997,7 @@ public LibraryServerResult SetEntities( goto ERROR1; // 检查实体库名 2014/9/5 - if (string.IsNullOrEmpty(strBiblioDbName) == false + if (string.IsNullOrEmpty(strBiblioDbName) == false && string.IsNullOrEmpty(strItemDbName) == true) { strError = "书目库 '" + strBiblioDbName + "' 不具备下属的实体库,设置实体记录的操作失败"; @@ -2061,7 +2061,7 @@ public LibraryServerResult SetEntities( StringUtil.SetInList(ref strStyle, "force", true); } - // 2008/10/6 + // 2008/10/6 else if (StringUtil.IsInList("force", info.Style) == true) { bForce = true; @@ -2173,7 +2173,7 @@ public LibraryServerResult SetEntities( { strError = "strAction值为delete时, info.NewTimestamp参数必须为空"; } - // 2008/6/24 + // 2008/6/24 else if (String.IsNullOrEmpty(info.NewRecPath) == false) { if (info.NewRecPath != info.OldRecPath) @@ -3174,13 +3174,13 @@ public int CheckItemBookType(XmlDocument dom, return 0; GetPureValue(ref values); - strError = "图书类型 '"+strBookType+"' 不是合法的值。应为 '"+StringUtil.MakePathList(values)+"' 之一"; + strError = "图书类型 '" + strBookType + "' 不是合法的值。应为 '" + StringUtil.MakePathList(values) + "' 之一"; return 1; } static void GetPureValue(ref List values) { - for(int i = 0;i= nodes.Count) break; - XmlNode current = nodes[i+1]; + XmlNode current = nodes[i + 1]; current.ParentNode.RemoveChild(current); } } @@ -4603,7 +4603,7 @@ int DoEntityOperMove( // 1 不符合要求 nRet = CheckItemLibraryCode(domSourceExist, sessioninfo, - // sessioninfo.LibraryCodeList, + // sessioninfo.LibraryCodeList, out strSourceLibraryCode, out strError); if (nRet == -1) @@ -4723,7 +4723,7 @@ int DoEntityOperMove( // 1 不符合要求 nRet = CheckItemLibraryCode(strNewXml, sessioninfo, - // sessioninfo.LibraryCodeList, + // sessioninfo.LibraryCodeList, out strTargetLibraryCode, out strError); if (nRet == -1) @@ -4938,7 +4938,8 @@ public int GetItemRecPathList( return 1; } #endif - static int IndexOf( + + static int IndexOfFirst( List list, string one, bool bIgnoreCase) @@ -4954,6 +4955,23 @@ static int IndexOf( return -1; } + static List IndexOf( + List list, + string one, + bool bIgnoreCase) + { + List results = new List(); + int index = 0; + foreach (string s in list) + { + if (string.Compare(s, one, bIgnoreCase) == 0) + results.Add(index); + index++; + } + + return results; + } + // 根据册条码号列表,得到记录路径列表 // 如果有条码号没有命中记录,则相应位置返回空字符串;如果有条码号命中多条记录,则相应位置返回字符'!'开头的报错信息 public int GetItemRecPathList( @@ -5012,6 +5030,8 @@ public int GetItemRecPathList( results.Add(""); } +#if NO + // TODO: 如果 word_list 中有重复的 // 按照key归并? foreach (Record record in records) { @@ -5039,6 +5059,41 @@ public int GetItemRecPathList( results[nIndex] = record.Path; } } +#endif + + // 注意 word_list 中可能有重复的 key + // 按照key归并? + foreach (Record record in records) + { + if (record.Keys == null || record.Keys.Length == 0) + { + strError = "record.Keys error"; + return -1; + } + + string strKey = record.Keys[0].Key; + if (record.Keys[0].From == "refID") + strKey = "@refID:" + strKey; // TODO: 前缀用法需要统一。比如前端发来的册条码号也故意指定了前缀怎么办? + + List indices = IndexOf(word_list, strKey, bIgnoreCase); + if (indices.Count == 0) + { + strError = "很奇怪出现了 key '" + strKey + "' 在wordlist '" + strWordList + "' 中没有匹配的项"; + return -1; + } + + foreach (int nIndex in indices) + { + // 是否发生了命中检索词重复? + if (string.IsNullOrEmpty(results[nIndex]) == false) + results[nIndex] = "!" + strFrom + " '" + strKey + "' 检索命中不唯一"; + else + { + Debug.Assert(string.IsNullOrEmpty(record.Path) == false, ""); + results[nIndex] = record.Path; + } + } + } #if TESTING /// @@ -5118,10 +5173,12 @@ public int GetItemRecPathList( Debug.Assert(temp_results.Count == temp_words.Count, ""); - for (int i = 0; i indices = IndexOf(word_list, word, bIgnoreCase); + if (indices.Count == 0) + { + strError = "很奇怪出现了 temp_word '" + word + "' 在wordlist '" + strWordList + "' 中没有匹配的项"; + return -1; + } + + foreach (int nPos in indices) + { + results[nPos] = temp_results[i]; + } } } @@ -5136,11 +5206,8 @@ public int GetItemRecPathList( strResult = StringUtil.MakePathList(results); return 1; } - - } - // 实体信息 public class DeleteEntityInfo { diff --git a/DigitalPlatform.LibraryServer/LibraryApplication.cs b/DigitalPlatform.LibraryServer/LibraryApplication.cs index 165a78e2c..a14f9f900 100644 --- a/DigitalPlatform.LibraryServer/LibraryApplication.cs +++ b/DigitalPlatform.LibraryServer/LibraryApplication.cs @@ -106,7 +106,9 @@ public partial class LibraryApplication : IDisposable // 2.63 (2015/12/12) Return() API,对于超期违约金因子为空的情况,现在不当作出错处理。这种情况交费信息不会写入读者记录的交费信息字段,但会进入操作日志中(便于以后进行统计)。 // 2.64 (2015/12/27) 借书和还书操作信息会自动写入 mongodb 的日志库。增加后台任务 "创建 MongoDB 日志库" // 2.65 (2016/1/1) GetSystemParameters() API 增加 circulation/chargingOperDatabase。 - public static string Version = "2.65"; + // 2.66 (2016/1/2) GetBiblioInfos() API 中当 strBiblioRecPath 参数在使用 @path-list: 引导的时候,其后部允许出现 @itemBarcode:xxxx|@itemBarcode:xxx 这样的内容 + // 2.67 (2016/1/6) GetItemInfo() API 的 @barcode-list:" "get-path-list" 功能允许间杂 @refID:前缀的号码。 + public static string Version = "2.67"; #if NO int m_nRefCount = 0; public int AddRef() @@ -1720,7 +1722,7 @@ public int CheckKernelVersion(RmsChannelCollection Channels, try { Version version = new Version(strVersion); - Version base_version = new Version("2.63"); + Version base_version = new Version("2.64"); if (version.CompareTo(base_version) < 0) { strError = "当前 dp2Library 版本需要和 dp2Kernel " + base_version + " 以上版本配套使用(然而当前 dp2Kernel 版本号为 " + version + ")。请立即升级 dp2Kernel 到最新版本。"; @@ -1745,7 +1747,7 @@ public int CheckKernelVersion(RmsChannelCollection Channels, return 0; } - catch(Exception ex) + catch (Exception ex) { strError = "比较 dp2kernel 版本号的过程发生错误: " + ex.Message; return -1; @@ -6307,10 +6309,10 @@ public int GetItemRecXml( public int GetItemRecXml( RmsChannel channel, - string strBarcode, - out string strXml, - out string strOutputPath, - out string strError) + string strBarcode, + out string strXml, + out string strOutputPath, + out string strError) { byte[] timestamp = null; @@ -6439,6 +6441,42 @@ public int GetItemRecXml( return -1; } #endif + public int GetItemRecParent( + RmsChannel channel, + string strBarcode, + out string strParentID, + out string strOutputPath, + out string strError) + { + byte[] timestamp = null; + + return GetItemRecXml( +channel, +strBarcode, +"parent", +out strParentID, +out strOutputPath, +out timestamp, +out strError); + } + + public int GetItemRecXml( + RmsChannel channel, + string strBarcodeParam, + out string strXml, + out string strOutputPath, + out byte[] timestamp, + out string strError) + { + return GetItemRecXml( + channel, + strBarcodeParam, + "", + out strXml, + out strOutputPath, + out timestamp, + out strError); + } // 2014/9/19 strBarcode 可以包含 @refID: 前缀了 // 2012/1/5 改造为PiggyBack检索 @@ -6453,6 +6491,7 @@ public int GetItemRecXml( public int GetItemRecXml( RmsChannel channel, string strBarcodeParam, + string strStyle, out string strXml, out string strOutputPath, out byte[] timestamp, @@ -6513,6 +6552,9 @@ public int GetItemRecXml( strQueryXml = "" + strQueryXml + ""; } + string strBrowseStyle = "id,xml,timestamp"; + if (strStyle == "parent") + strBrowseStyle = "id,cols,format:@coldef://parent"; Record[] records = null; long lRet = channel.DoSearchEx(strQueryXml, @@ -6520,7 +6562,7 @@ public int GetItemRecXml( "", // strOuputStyle 1, "zh", - "id,xml,timestamp", + strBrowseStyle, // "id,xml,timestamp", out records, out strError); if (lRet == -1) @@ -6541,11 +6583,19 @@ public int GetItemRecXml( return -1; } - Debug.Assert(records[0].RecordBody != null, ""); + if (strStyle == "parent") + { + strOutputPath = records[0].Path; + strXml = records[0].Cols[0]; + } + else + { + Debug.Assert(records[0].RecordBody != null, ""); - strOutputPath = records[0].Path; - strXml = records[0].RecordBody.Xml; - timestamp = records[0].RecordBody.Timestamp; + strOutputPath = records[0].Path; + strXml = records[0].RecordBody.Xml; + timestamp = records[0].RecordBody.Timestamp; + } return (int)lHitCount; ERROR1: @@ -7548,6 +7598,26 @@ public int ListDbFroms(string strDbType, return -1; } + // 将一个检索词列表中的,带有 @refID 的部分检索词拆为另外一个 list + static void SplitWordList(string strWordList, + out string strNormalList, + out string strRefIDList) + { + List refids = new List(); + List normals = new List(); + string[] list = strWordList.Split(new char[] { ',' }); + foreach (string word in list) + { + if (word != null && word.StartsWith("@refID:") == true) + refids.Add(word.Substring("@refID:".Length)); + else + normals.Add(word); + } + + strNormalList = string.Join(",", normals); + strRefIDList = string.Join(",", refids); + } + // 一次检索多个检索词 // "册条码"; // "参考ID"; @@ -7580,6 +7650,18 @@ public int GetItemRec( if (nRet == -1) return -1; + string strRefIDList = ""; + + if (strFrom == "册条码" || strFrom == "册条码号") + { + string strNormalList = ""; + // 将一个检索词列表中的,带有 @refID 的部分检索词拆为另外一个 list + SplitWordList(strWordList, + out strNormalList, + out strRefIDList); + strWordList = strNormalList; + } + // 构造检索式 string strQueryXml = ""; int nDbCount = 0; @@ -7590,20 +7672,39 @@ public int GetItemRec( if (String.IsNullOrEmpty(strDbName) == true) continue; - string strOneDbQuery = "" - + StringUtil.GetXmlStringSimple(strWordList) - + "exactliststring" + nMax.ToString() + "zh"; - - if (nDbCount > 0) + if (string.IsNullOrEmpty(strWordList) == false) { - Debug.Assert(String.IsNullOrEmpty(strQueryXml) == false, ""); - strQueryXml += ""; + string strOneDbQuery = "" + + StringUtil.GetXmlStringSimple(strWordList) + + "exactliststring" + nMax.ToString() + "zh"; + + if (nDbCount > 0) + { + Debug.Assert(String.IsNullOrEmpty(strQueryXml) == false, ""); + strQueryXml += ""; + } + strQueryXml += strOneDbQuery; + nDbCount++; } - strQueryXml += strOneDbQuery; - nDbCount++; + if (string.IsNullOrEmpty(strRefIDList) == false) + { + string strOneDbQuery = "" + + StringUtil.GetXmlStringSimple(strRefIDList) + + "exactliststring" + nMax.ToString() + "zh"; + + if (nDbCount > 0) + { + Debug.Assert(String.IsNullOrEmpty(strQueryXml) == false, ""); + strQueryXml += ""; + } + strQueryXml += strOneDbQuery; + nDbCount++; + } } if (nDbCount > 0) @@ -10279,8 +10380,6 @@ public int GetBiblioRecPath( string strMetaData = ""; // string strTempOutputPath = ""; - - long lRet = channel.GetRes(strItemRecPath, out strItemXml, out strMetaData, @@ -10295,7 +10394,6 @@ public int GetBiblioRecPath( } else // 普通条码号 { - List aPath = null; // 获得册记录 @@ -10592,7 +10690,6 @@ public int GetBiblioRecPathByItemRecPath( strBiblioRecPath = ""; int nRet = 0; - { string strItemDbName0 = ResPath.GetDbName(strItemRecPath); // 需要检查一下数据库名是否在允许的实体库名之列 diff --git a/DigitalPlatform.LibraryService/LibraryService.cs b/DigitalPlatform.LibraryService/LibraryService.cs index ac2fa703e..4f3d14054 100644 --- a/DigitalPlatform.LibraryService/LibraryService.cs +++ b/DigitalPlatform.LibraryService/LibraryService.cs @@ -4167,7 +4167,6 @@ public LibraryServerResult GetItemInfo( string strBiblioDbName1 = ""; XmlDocument item_dom = null; - // 特殊用法 @barcode-list: 获得册记录路径列表 if (StringUtil.HasHead(strBarcode, "@barcode-list:") == true && strResultType == "get-path-list") diff --git a/DigitalPlatform.OPAC.Web/BorrowHistoryControl.cs b/DigitalPlatform.OPAC.Web/BorrowHistoryControl.cs index c36d705ab..f6099b16d 100644 --- a/DigitalPlatform.OPAC.Web/BorrowHistoryControl.cs +++ b/DigitalPlatform.OPAC.Web/BorrowHistoryControl.cs @@ -661,8 +661,8 @@ protected override void Render(HtmlTextWriter writer) + this.GetString("还书日期") + ":" + info.strReturnDate + "" + ""); - } + text.Append(""); if (this.DatabaseMode == false || info.IsEmpty()) diff --git a/DigitalPlatform.rms.Client/RmsChannel.cs b/DigitalPlatform.rms.Client/RmsChannel.cs index d1fd245cc..fd0a8c829 100644 --- a/DigitalPlatform.rms.Client/RmsChannel.cs +++ b/DigitalPlatform.rms.Client/RmsChannel.cs @@ -5071,7 +5071,6 @@ public long GetRes(string strPath, out string strOutputResPath, out string strError) { - strMetaData = ""; strResult = ""; strError = ""; @@ -5105,7 +5104,6 @@ public long GetRes(string strPath, REDO: try { - // string strStyle = "content,data"; IAsyncResult soapresult = this.ws.BeginGetRes(strPath, lStart, @@ -5181,12 +5179,9 @@ public long GetRes(string strPath, return -1; } - - if (StringUtil.IsInList("data", strStyle) != true) break; - baTotal = ByteArray.Add(baTotal, baContent); // bytes.AddRange(baContent); diff --git a/DigitalPlatform.rms.db/KernelApplication.cs b/DigitalPlatform.rms.db/KernelApplication.cs index a697738a7..b0e6b5892 100644 --- a/DigitalPlatform.rms.db/KernelApplication.cs +++ b/DigitalPlatform.rms.db/KernelApplication.cs @@ -17,7 +17,7 @@ namespace DigitalPlatform.rms { // 全局信息 - public partial class KernelApplication + public partial class KernelApplication { // private string m_strLogFileName = ""; //日志文件名称 private string m_strDebugFileName = ""; // @@ -149,7 +149,7 @@ public void ThreadMain() eventFinished.Set(); } - catch(Exception ex) + catch (Exception ex) { this.WriteErrorLog("管理线程异常(线程已退出):" + ExceptionUtil.GetDebugText(ex)); } @@ -287,7 +287,7 @@ void CleanSessionDir(string strSessionDir) } } } - catch(Exception ex) + catch (Exception ex) { this.WriteErrorLog("删除 session 下级目录时出错: " + ExceptionUtil.GetDebugText(ex)); } @@ -332,7 +332,7 @@ public int Initial(string strDataDir, } this.LogDir = strLogDir; - + // this.m_strLogFileName = strLogDir + "\\log.txt"; this.m_strDebugFileName = strLogDir + "\\debug.txt"; @@ -431,7 +431,7 @@ public int Initial(string strDataDir, void CleanResultSetDir(string strResultSetDir) { if (PathUtil.TryClearDir(strResultSetDir) == false) - this.WriteErrorLog("清除 结果集目录 "+strResultSetDir+" 时出错"); + this.WriteErrorLog("清除 结果集目录 " + strResultSetDir + " 时出错"); } // 整数返回值转换为ErrorCode @@ -477,7 +477,6 @@ public string GetCopyRightString() + "\r\n" + myAssembly.FullName; return strResult; - } // 关闭 @@ -668,7 +667,7 @@ public Result() public Result( string strError, - ErrorCodeValue errorcode, + ErrorCodeValue errorcode, int nValue) { this.ErrorCode = errorcode; diff --git a/DigitalPlatform.rms.db/SessionInfo.cs b/DigitalPlatform.rms.db/SessionInfo.cs index 5478df410..e473afbaf 100644 --- a/DigitalPlatform.rms.db/SessionInfo.cs +++ b/DigitalPlatform.rms.db/SessionInfo.cs @@ -587,8 +587,6 @@ public long API_GetRecords( strID = strText; * */ - - if (bHasID == true) { // GetCaptionSafety()函数先找到指定语言的库名; diff --git a/DigitalPlatform.rms.db/SqlDatabase.cs b/DigitalPlatform.rms.db/SqlDatabase.cs index bc8a899c2..7d1767c6b 100644 --- a/DigitalPlatform.rms.db/SqlDatabase.cs +++ b/DigitalPlatform.rms.db/SqlDatabase.cs @@ -6279,7 +6279,6 @@ public override long GetXml(string strRecordID, byte[] baWholeXml = null; byte[] baPreamble = null; - string strXml = null; XmlDocument dom = null; @@ -6449,7 +6448,7 @@ public override long GetXml(string strRecordID, } // if (StringUtil.IsInList("withresmetadata", strStyle) == true) // 通过xpath找片断的情况 - if (strXPath != null && strXPath != "") + if (string.IsNullOrEmpty(strXPath) == false) { if (dom != null) { @@ -6523,7 +6522,7 @@ public override long GetXml(string strRecordID, destBuffer = new byte[0]; } - return 0; + return destBuffer.Length; // 2016/1/3 } // end if (strXPath != null && strXPath != "") if (dom != null) @@ -14944,11 +14943,12 @@ public int ModifyKeys(Connection connection, keynumParam.Value = oneKey.Num; #else + // 2016/1/6 加入 N strCommand.Append(" DELETE FROM " + strKeysTableName - + " WHERE keystring = '" + MySqlHelper.EscapeString(oneKey.Key) - + "' AND fromstring = '" + MySqlHelper.EscapeString(oneKey.FromValue) - + "' AND idstring = '" + MySqlHelper.EscapeString(oneKey.RecordID) - + "' AND keystringnum = '" + MySqlHelper.EscapeString(oneKey.Num) + "' ;\n"); + + " WHERE keystring = N'" + MySqlHelper.EscapeString(oneKey.Key) + + "' AND fromstring = N'" + MySqlHelper.EscapeString(oneKey.FromValue) + + "' AND idstring = N'" + MySqlHelper.EscapeString(oneKey.RecordID) + + "' AND keystringnum = N'" + MySqlHelper.EscapeString(oneKey.Num) + "' ;\n"); #endif @@ -14959,7 +14959,7 @@ public int ModifyKeys(Connection connection, command.CommandText = "use " + this.m_strSqlDbName + " ;\n" + strCommand #if !PARAMETERS - + " ;\n" + // + " ;\n" #endif ; try @@ -15037,21 +15037,23 @@ public int ModifyKeys(Connection connection, if (strCommand.Length == 0 || strKeysTableName != strPrevSqlTableName) { - if (strCommand.Length > 0) + if (strCommand.Length > 0 && i > 0) // 2016/1/6 增加 i>0 限制。否则会多产生一个分号,导致 SQL 语法错误 strCommand.Append(" ; "); + // 2016/1/6 加入 N strCommand.Append(" INSERT INTO " + strKeysTableName + " (keystring,fromstring,idstring,keystringnum) " - + " VALUES ('" + MySqlHelper.EscapeString(oneKey.Key) + "','" - + MySqlHelper.EscapeString(oneKey.FromValue) + "','" - + MySqlHelper.EscapeString(oneKey.RecordID) + "','" + + " VALUES (N'" + MySqlHelper.EscapeString(oneKey.Key) + "',N'" + + MySqlHelper.EscapeString(oneKey.FromValue) + "',N'" + + MySqlHelper.EscapeString(oneKey.RecordID) + "',N'" + MySqlHelper.EscapeString(oneKey.Num) + "') "); } else { - strCommand.Append(", ('" + MySqlHelper.EscapeString(oneKey.Key) + "','" - + MySqlHelper.EscapeString(oneKey.FromValue) + "','" - + MySqlHelper.EscapeString(oneKey.RecordID) + "','" + // 2016/1/6 加入 N + strCommand.Append(", (N'" + MySqlHelper.EscapeString(oneKey.Key) + "',N'" + + MySqlHelper.EscapeString(oneKey.FromValue) + "',N'" + + MySqlHelper.EscapeString(oneKey.RecordID) + "',N'" + MySqlHelper.EscapeString(oneKey.Num) + "') "); } @@ -15074,6 +15076,7 @@ public int ModifyKeys(Connection connection, catch (Exception ex) { strError = "创建检索点出错,偏移 " + (nExecuted).ToString() + ",记录路径'" + this.GetCaption("zh-CN") + "/" + strRecordID + ",原因:" + ex.Message; + this.container.KernelApplication.WriteErrorLog(strError + "\r\n\r\nSQL 语句: " + command.CommandText); return -1; } strCommand.Clear(); @@ -15104,6 +15107,7 @@ public int ModifyKeys(Connection connection, catch (Exception ex) { strError = "创建检索点出错,偏移 " + (nExecuted).ToString() + ",记录路径'" + this.GetCaption("zh-CN") + "/" + strRecordID + ",原因:" + ex.Message; + this.container.KernelApplication.WriteErrorLog(strError + "\r\n\r\nSQL 语句: " + command.CommandText); return -1; } diff --git a/ZipUtil.exe b/ZipUtil.exe index 17467569aa5199567d8c8da8bf05a94769d133ac..97b958e8c1dc77033093eedd4d4cef1ecdedf197 100644 GIT binary patch delta 66 zcmZqhXz-ZO!OW}GyRq9)OhDfDica^7T>n;wg&L=`r+nLdMr;8SNOp3*q@=(ML3Z1( V1wQ`GsR^pT7M`24d4^;L7XVxO8dCrO delta 66 zcmZqhXz-ZO!F+K}+s1A~F@gPd3F|xp`yCfc3Owk%R5Wk%8L{nBr$_ V@Y3>_5ZxDh?q|gM%`+r3xB$mM9SHyc diff --git a/dp2Catalog/SaveRecordDlg.Designer.cs b/dp2Catalog/SaveRecordDlg.Designer.cs index 2f9d754f6..ad8dd8714 100644 --- a/dp2Catalog/SaveRecordDlg.Designer.cs +++ b/dp2Catalog/SaveRecordDlg.Designer.cs @@ -28,6 +28,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SaveRecordDlg)); this.button_OK = new System.Windows.Forms.Button(); this.button_Cancel = new System.Windows.Forms.Button(); @@ -56,6 +57,7 @@ private void InitializeComponent() // // button_OK // + this.button_OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.button_OK.Location = new System.Drawing.Point(284, 238); this.button_OK.Margin = new System.Windows.Forms.Padding(2); this.button_OK.Name = "button_OK"; @@ -67,6 +69,7 @@ private void InitializeComponent() // // button_Cancel // + this.button_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.button_Cancel.Location = new System.Drawing.Point(344, 238); this.button_Cancel.Margin = new System.Windows.Forms.Padding(2); this.button_Cancel.Name = "button_Cancel"; @@ -78,9 +81,9 @@ private void InitializeComponent() // // tabControl_main // - this.tabControl_main.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.tabControl_main.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.tabControl_main.Controls.Add(this.tabPage_DTLP); this.tabControl_main.Controls.Add(this.tabPage_dp2); this.tabControl_main.Controls.Add(this.tabPage_unionCatalog); @@ -132,9 +135,9 @@ private void InitializeComponent() // // dtlpResDirControl1 // - this.dtlpResDirControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.dtlpResDirControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.dtlpResDirControl1.BackColor = System.Drawing.SystemColors.Window; this.dtlpResDirControl1.HideSelection = false; this.dtlpResDirControl1.ImageIndex = 0; @@ -150,8 +153,8 @@ private void InitializeComponent() // // textBox_dtlpRecPath // - this.textBox_dtlpRecPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.textBox_dtlpRecPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.textBox_dtlpRecPath.Location = new System.Drawing.Point(86, 174); this.textBox_dtlpRecPath.Margin = new System.Windows.Forms.Padding(2); this.textBox_dtlpRecPath.Name = "textBox_dtlpRecPath"; @@ -199,9 +202,9 @@ private void InitializeComponent() // // dp2ResTree1 // - this.dp2ResTree1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.dp2ResTree1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.dp2ResTree1.HideSelection = false; this.dp2ResTree1.ImageIndex = 0; this.dp2ResTree1.Location = new System.Drawing.Point(5, 24); @@ -224,8 +227,8 @@ private void InitializeComponent() // // textBox_dp2RecPath // - this.textBox_dp2RecPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.textBox_dp2RecPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.textBox_dp2RecPath.Location = new System.Drawing.Point(86, 174); this.textBox_dp2RecPath.Margin = new System.Windows.Forms.Padding(2); this.textBox_dp2RecPath.Name = "textBox_dp2RecPath"; @@ -270,8 +273,8 @@ private void InitializeComponent() // // textBox_unionCatalogRecPath // - this.textBox_unionCatalogRecPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.textBox_unionCatalogRecPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.textBox_unionCatalogRecPath.Location = new System.Drawing.Point(86, 174); this.textBox_unionCatalogRecPath.Margin = new System.Windows.Forms.Padding(2); this.textBox_unionCatalogRecPath.Name = "textBox_unionCatalogRecPath"; diff --git a/dp2Catalog/dp2Catalog.csproj b/dp2Catalog/dp2Catalog.csproj index f4c0e1350..62c9bea3e 100644 --- a/dp2Catalog/dp2Catalog.csproj +++ b/dp2Catalog/dp2Catalog.csproj @@ -50,7 +50,7 @@ dp2 V2 true publish.htm - 2 + 3 2.5.0.%2a false true diff --git a/dp2Circulation/CopyrightDlg.cs b/dp2Circulation/AboutDlg.cs similarity index 93% rename from dp2Circulation/CopyrightDlg.cs rename to dp2Circulation/AboutDlg.cs index c2b33de27..142c58018 100644 --- a/dp2Circulation/CopyrightDlg.cs +++ b/dp2Circulation/AboutDlg.cs @@ -14,12 +14,14 @@ namespace dp2Circulation /// /// 版权 对话框 /// - internal class CopyrightDlg : System.Windows.Forms.Form + internal class AboutDlg : System.Windows.Forms.Form { +#if NO /// /// 框架窗口 /// public MainForm MainForm = null; +#endif private System.Windows.Forms.Label label1; private System.Windows.Forms.LinkLabel linkLabel1; @@ -31,7 +33,7 @@ internal class CopyrightDlg : System.Windows.Forms.Form /// private System.ComponentModel.Container components = null; - public CopyrightDlg() + public AboutDlg() { // // Required for Windows Form Designer support @@ -67,7 +69,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CopyrightDlg)); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutDlg)); this.label1 = new System.Windows.Forms.Label(); this.label_copyright = new System.Windows.Forms.Label(); this.linkLabel1 = new System.Windows.Forms.LinkLabel(); @@ -84,7 +86,7 @@ private void InitializeComponent() this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(461, 17); this.label1.TabIndex = 0; - this.label1.Text = "dp2内务/流通 dp2Circulation V2.10"; + this.label1.Text = "dp2 内务/流通 dp2Circulation V2.11"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // label_copyright @@ -109,7 +111,7 @@ private void InitializeComponent() this.linkLabel1.Size = new System.Drawing.Size(459, 36); this.linkLabel1.TabIndex = 2; this.linkLabel1.TabStop = true; - this.linkLabel1.Text = "http://www.dp2003.com"; + this.linkLabel1.Text = "https://github.com/DigitalPlatform/dp2"; this.linkLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); // @@ -156,9 +158,9 @@ private void InitializeComponent() this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.MinimizeBox = false; - this.Name = "CopyrightDlg"; + this.Name = "About"; this.ShowInTaskbar = false; - this.Text = "版权 Copyright"; + this.Text = "关于 About"; this.Load += new System.EventHandler(this.CopyrightDlg_Load); this.ResumeLayout(false); this.PerformLayout(); @@ -194,14 +196,14 @@ private void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabe private void CopyrightDlg_Load(object sender, System.EventArgs e) { - label_copyright.Text = "(C) 版权所有 2006-2015 数字平台(北京)软件有限责任公司\r\nDigital Platform (Beijing) Software Corp. Ltd."; + label_copyright.Text = "(C) 版权所有 2006-2015 数字平台(北京)软件有限责任公司\r\n2015 年以 Apache License Version 2.0 方式开源"; Assembly myAssembly = Assembly.GetAssembly(this.GetType()); AssemblyName name = myAssembly.GetName(); textBox_environment.Text = "版本和环境:" + "\r\n本软件: "+name.Name+" " + name.Version.ToString() // .FullName - + "\r\n当前连接的 dp2Library (位于 " + this.MainForm.LibraryServerUrl + "): " + this.MainForm.ServerVersion.ToString() + " UID:" + this.MainForm.ServerUID + + "\r\n当前连接的 dp2Library (位于 " + Program.MainForm.LibraryServerUrl + "): " + Program.MainForm.ServerVersion.ToString() + " UID:" + Program.MainForm.ServerUID + "\r\n本机 .NET Framework 版本: " + myAssembly.ImageRuntimeVersion + "\r\n\r\n本机 MAC 地址: " + StringUtil.MakePathList(SerialCodeForm.GetMacAddress()) + "\r\n是否安装 KB2468871: " + Global.IsKbInstalled("KB2468871") diff --git a/dp2Circulation/CopyrightDlg.resx b/dp2Circulation/AboutDlg.resx similarity index 100% rename from dp2Circulation/CopyrightDlg.resx rename to dp2Circulation/AboutDlg.resx diff --git a/dp2Circulation/BatchTaskForm.cs b/dp2Circulation/BatchTaskForm.cs index 6c2a2ce76..f077a8228 100644 --- a/dp2Circulation/BatchTaskForm.cs +++ b/dp2Circulation/BatchTaskForm.cs @@ -350,6 +350,8 @@ int StartBatchTask(string strTaskName, { StartLogRecoverDlg dlg = new StartLogRecoverDlg(); MainForm.SetControlFont(dlg, this.Font, false); + dlg.Text = "启动 创建 MongoDB 日志库 任务"; + dlg.TaskName = "创建 MongoDB 日志库"; dlg.StartInfo = startinfo; dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) @@ -719,7 +721,6 @@ void DoRefresh() // this.EnableControls(false); try { - string strError = ""; stop.OnStop += new StopEventHandler(this.DoStop); @@ -891,7 +892,6 @@ private void ToolStripMenuItem_progress_Click(object sender, EventArgs e) this.MessageStyle -= MessageStyle.Progress; else this.MessageStyle |= MessageStyle.Progress; - } // 刷新 diff --git a/dp2Circulation/Entity/InventoryForm.cs b/dp2Circulation/Entity/InventoryForm.cs index bca9e84fb..1473d84f7 100644 --- a/dp2Circulation/Entity/InventoryForm.cs +++ b/dp2Circulation/Entity/InventoryForm.cs @@ -3894,7 +3894,8 @@ void menu_loadSelectedBaseListItemsToItemSearchForm_Click(object sender, EventAr ItemSearchForm form = this.MainForm.OpenItemSearchForm("item"); // form.Activate(); int nRet = form.ImportFromRecPathFile(strTempFileName, - out strError); + "clear", + out strError); if (nRet == -1) goto ERROR1; } diff --git a/dp2Circulation/Entity/ItemBarcodeLoader.cs b/dp2Circulation/Entity/ItemBarcodeLoader.cs index b942ac0e9..511a2274f 100644 --- a/dp2Circulation/Entity/ItemBarcodeLoader.cs +++ b/dp2Circulation/Entity/ItemBarcodeLoader.cs @@ -7,15 +7,14 @@ using DigitalPlatform; using DigitalPlatform.Text; -using DigitalPlatform.CirculationClient; -// using DigitalPlatform.LibraryClient.localhost; +// using DigitalPlatform.CirculationClient; using DigitalPlatform.LibraryClient; using DigitalPlatform.LibraryClient.localhost; namespace dp2Circulation { // 通过册条码号获得册记录路径的枚举器 - public class ItemBarcodeLoader : IEnumerable + public class ItemBarcodeLoader : IEnumerable { /// /// 提示框事件 @@ -50,14 +49,13 @@ public Stop Stop public IEnumerator GetEnumerator() { - List batch = new List(); for (int index = 0; index < m_barcodes.Count; index++) { string s = m_barcodes[index]; if (string.IsNullOrEmpty(s) == true) - throw new Exception("册条码号字符串不允许为空 (index="+index.ToString()+")"); + throw new Exception("册条码号字符串不允许为空 (index=" + index.ToString() + ")"); batch.Add(s); diff --git a/dp2Circulation/EntityForm/EntityForm.cs b/dp2Circulation/EntityForm/EntityForm.cs index c640074b8..301716aae 100644 --- a/dp2Circulation/EntityForm/EntityForm.cs +++ b/dp2Circulation/EntityForm/EntityForm.cs @@ -147,7 +147,7 @@ public bool AcceptMode BrowseSearchResultForm browseWindow = null; - int m_nInSearching = 0; + //// int m_nInSearching = 0; // string m_strTempBiblioRecPath = ""; RegisterType m_registerType = RegisterType.Register; @@ -4544,232 +4544,235 @@ public int MaxSearchResultCount private void button_search_Click(object sender, EventArgs e) { string strError = ""; - int nRet = 0; - bool bDisplayClickableError = false; - long lHitCount = 0; - _willCloseBrowseWindow = false; - // _browseWindowSelected = false; + this._processing++; + try + { + int nRet = 0; + bool bDisplayClickableError = false; + long lHitCount = 0; - ActivateBrowseWindow(false); + _willCloseBrowseWindow = false; + // _browseWindowSelected = false; - this.browseWindow.RecordsList.Items.Clear(); + ActivateBrowseWindow(false); - LibraryChannel channel = this.GetChannel(); - - Progress.Style = StopStyle.EnableHalfStop; - Progress.OnStop += new StopEventHandler(this.DoStop); - Progress.Initial("正在检索 ..."); - Progress.BeginLoop(); + this.browseWindow.RecordsList.Items.Clear(); - this.ShowMessage("正在检索 ..."); + LibraryChannel channel = this.GetChannel(); - this.browseWindow.stop = Progress; + Progress.Style = StopStyle.EnableHalfStop; + Progress.OnStop += new StopEventHandler(this.DoStop); + Progress.Initial("正在检索 ..."); + Progress.BeginLoop(); - //this.button_search.Enabled = false; - this.EnableControls(false); + this.ShowMessage("正在检索 ..."); - m_nInSearching++; + this.browseWindow.stop = Progress; - try - { - if (this.comboBox_from.Text == "") - { - strError = "尚未选定检索途径"; - goto ERROR1; - } - string strFromStyle = ""; + //this.button_search.Enabled = false; + this.EnableControls(false); + ////m_nInSearching++; try { - strFromStyle = this.MainForm.GetBiblioFromStyle(this.comboBox_from.Text); - } - catch (Exception ex) - { - strError = "GetBiblioFromStyle() exception:" + ExceptionUtil.GetAutoText(ex); - goto ERROR1; - } - - if (String.IsNullOrEmpty(strFromStyle) == true) - { - strError = "GetFromStyle()没有找到 '" + this.comboBox_from.Text + "' 对应的style字符串"; - goto ERROR1; - } - - string strMatchStyle = BiblioSearchForm.GetCurrentMatchStyle(this.comboBox_matchStyle.Text); - if (this.textBox_queryWord.Text == "") - { - if (strMatchStyle == "null") + if (this.comboBox_from.Text == "") { - this.textBox_queryWord.Text = ""; - - // 专门检索空值 - strMatchStyle = "exact"; + strError = "尚未选定检索途径"; + goto ERROR1; } - else + string strFromStyle = ""; + + try { - // 为了在检索词为空的时候,检索出全部的记录 - strMatchStyle = "left"; + strFromStyle = this.MainForm.GetBiblioFromStyle(this.comboBox_from.Text); } - } - else - { - // 2009/11/5 - if (strMatchStyle == "null") + catch (Exception ex) { - strError = "检索空值的时候,请保持检索词为空"; + strError = "GetBiblioFromStyle() exception:" + ExceptionUtil.GetAutoText(ex); goto ERROR1; } - } - string strQueryWord = GetBiblioQueryString(); + if (String.IsNullOrEmpty(strFromStyle) == true) + { + strError = "GetFromStyle()没有找到 '" + this.comboBox_from.Text + "' 对应的style字符串"; + goto ERROR1; + } - bool bNeedShareSearch = false; - if (this.SearchShareBiblio == true - && this.MainForm != null && this.MainForm.MessageHub != null - && this.MainForm.MessageHub.ShareBiblio == true) - { - bNeedShareSearch = true; - } + string strMatchStyle = BiblioSearchForm.GetCurrentMatchStyle(this.comboBox_matchStyle.Text); + if (this.textBox_queryWord.Text == "") + { + if (strMatchStyle == "null") + { + this.textBox_queryWord.Text = ""; - if (bNeedShareSearch == true) - { - // 开始检索共享书目 - // return: - // -1 出错 - // 0 没有检索目标 - // 1 成功启动检索 - nRet = BeginSearchShareBiblio( - this.textBox_queryWord.Text, - strFromStyle, - strMatchStyle, - out strError); - if (nRet == -1) + // 专门检索空值 + strMatchStyle = "exact"; + } + else + { + // 为了在检索词为空的时候,检索出全部的记录 + strMatchStyle = "left"; + } + } + else { - // 显示错误信息 - this.ShowMessage(strError, "red", true); - bDisplayClickableError = true; + // 2009/11/5 + if (strMatchStyle == "null") + { + strError = "检索空值的时候,请保持检索词为空"; + goto ERROR1; + } } - } - string strQueryXml = ""; - long lRet = channel.SearchBiblio(Progress, - this.checkedComboBox_biblioDbNames.Text, // "<全部>", - strQueryWord, // this.textBox_queryWord.Text, - this.MaxSearchResultCount, // 1000 - strFromStyle, - strMatchStyle, - this.Lang, - null, // strResultSetName - "", // strSearchStyle - "", // strOutputStyle - out strQueryXml, - out strError); - if (lRet == -1) - goto ERROR1; + string strQueryWord = GetBiblioQueryString(); - // TODO: 最多检索1000条的限制,可以作为参数配置?在CfgDlg中 - - lHitCount = lRet; + bool bNeedShareSearch = false; + if (this.SearchShareBiblio == true + && this.MainForm != null && this.MainForm.MessageHub != null + && this.MainForm.MessageHub.ShareBiblio == true) + { + bNeedShareSearch = true; + } - if (lHitCount == 0) - { - // strError = "从途径 '" + strFromStyle + "' 检索 '" + strQueryWord + "' 没有命中"; - // goto ERROR1; - } - else - { - if (Progress != null && Progress.State != 0) + if (bNeedShareSearch == true) { - strError = "用户中断"; - goto ERROR1; + // 开始检索共享书目 + // return: + // -1 出错 + // 0 没有检索目标 + // 1 成功启动检索 + nRet = BeginSearchShareBiblio( + this.textBox_queryWord.Text, + strFromStyle, + strMatchStyle, + out strError); + if (nRet == -1) + { + // 显示错误信息 + this.ShowMessage(strError, "red", true); + bDisplayClickableError = true; + } } - if (lHitCount > 1) - this.ShowBrowseWindow(-1); + string strQueryXml = ""; + long lRet = channel.SearchBiblio(Progress, + this.checkedComboBox_biblioDbNames.Text, // "<全部>", + strQueryWord, // this.textBox_queryWord.Text, + this.MaxSearchResultCount, // 1000 + strFromStyle, + strMatchStyle, + this.Lang, + null, // strResultSetName + "", // strSearchStyle + "", // strOutputStyle + out strQueryXml, + out strError); + if (lRet == -1) + goto ERROR1; - // 从此位置以后,_willCloseBrowseWindow 如果变为 true 则表示要立即终止循环和处理 + // TODO: 最多检索1000条的限制,可以作为参数配置?在CfgDlg中 - long lStart = 0; - long lPerCount = Math.Min(50, lHitCount); - DigitalPlatform.LibraryClient.localhost.Record[] searchresults = null; + lHitCount = lRet; - // 装入浏览格式 - for (; ; ) + if (lHitCount == 0) { - Application.DoEvents(); // 出让界面控制权 - - if ((Progress != null && Progress.State != 0) - || _willCloseBrowseWindow) + // strError = "从途径 '" + strFromStyle + "' 检索 '" + strQueryWord + "' 没有命中"; + // goto ERROR1; + } + else + { + if (Progress != null && Progress.State != 0) { - // MessageBox.Show(this, "用户中断"); - break; // 已经装入的还在 + strError = "用户中断"; + goto ERROR1; } - Progress.SetMessage("正在装入浏览信息 " + (lStart + 1).ToString() + " - " + (lStart + lPerCount).ToString() + " (命中 " + lHitCount.ToString() + " 条记录) ..."); + if (lHitCount > 1) + this.ShowBrowseWindow(-1); - lRet = channel.GetSearchResult( - Progress, - null, // strResultSetName - lStart, - lPerCount, - "id,cols", - this.Lang, - out searchresults, - out strError); - if (lRet == -1) + // 从此位置以后,_willCloseBrowseWindow 如果变为 true 则表示要立即终止循环和处理 + + long lStart = 0; + long lPerCount = Math.Min(50, lHitCount); + DigitalPlatform.LibraryClient.localhost.Record[] searchresults = null; + + // 装入浏览格式 + for (; ; ) { - if (this.browseWindow == null - || (Progress != null && Progress.State != 0) + Application.DoEvents(); // 出让界面控制权 + + if ((Progress != null && Progress.State != 0) || _willCloseBrowseWindow) { // MessageBox.Show(this, "用户中断"); - break; + break; // 已经装入的还在 } - goto ERROR1; - } + Progress.SetMessage("正在装入浏览信息 " + (lStart + 1).ToString() + " - " + (lStart + lPerCount).ToString() + " (命中 " + lHitCount.ToString() + " 条记录) ..."); - if (lRet == 0) - { - MessageBox.Show(this, "未命中"); - return; - } + lRet = channel.GetSearchResult( + Progress, + null, // strResultSetName + lStart, + lPerCount, + "id,cols", + this.Lang, + out searchresults, + out strError); + if (lRet == -1) + { + if (this.browseWindow == null + || (Progress != null && Progress.State != 0) + || _willCloseBrowseWindow) + { + // MessageBox.Show(this, "用户中断"); + break; + } - // 处理浏览结果 - for (int i = 0; i < searchresults.Length; i++) - { - if (this.browseWindow == null) + goto ERROR1; + } + + if (lRet == 0) + { + MessageBox.Show(this, "未命中"); + return; + } + + // 处理浏览结果 + for (int i = 0; i < searchresults.Length; i++) + { + if (this.browseWindow == null) + break; + Global.AppendNewLine( + this.browseWindow.RecordsList, + searchresults[i].Path, + searchresults[i].Cols); + } + + lStart += searchresults.Length; + // lCount -= searchresults.Length; + if (lStart >= lHitCount || lPerCount <= 0) break; - Global.AppendNewLine( - this.browseWindow.RecordsList, - searchresults[i].Path, - searchresults[i].Cols); } - - lStart += searchresults.Length; - // lCount -= searchresults.Length; - if (lStart >= lHitCount || lPerCount <= 0) - break; } - } - if (bNeedShareSearch == true) - { - this.ShowMessage("等待共享检索响应 ..."); - // 结束检索共享书目 - // return: - // -1 出错 - // >=0 命中记录个数 - nRet = EndSearchShareBiblio(out strError); - if (nRet == -1) - { - // 显示错误信息 - this.ShowMessage(strError, "red", true); - bDisplayClickableError = true; - } - else + if (bNeedShareSearch == true) { + this.ShowMessage("等待共享检索响应 ..."); + // 结束检索共享书目 + // return: + // -1 出错 + // >=0 命中记录个数 + nRet = EndSearchShareBiblio(out strError); + if (nRet == -1) + { + // 显示错误信息 + this.ShowMessage(strError, "red", true); + bDisplayClickableError = true; + } + else + { #if NO if (_searchParam._searchCount > 0) { @@ -4777,13 +4780,13 @@ private void button_search_Click(object sender, EventArgs e) this._floatingMessage.DelayClear(new TimeSpan(0, 0, 3)); } #endif - } + } - lHitCount += _searchParam._searchCount; - } + lHitCount += _searchParam._searchCount; + } - if (this.browseWindow == null) - goto END1; + if (this.browseWindow == null) + goto END1; #if NO if ((Progress != null && Progress.State != 0) @@ -4809,63 +4812,69 @@ private void button_search_Click(object sender, EventArgs e) this.label_message.Text = "检索共命中 " + lHitCount.ToString() + " 条书目记录,已全部装入"; #endif - // MessageBox.Show(this, Convert.ToString(lRet) + " : " + strError); - } - finally - { - if (bDisplayClickableError == false - && this._floatingMessage.InDelay() == false) - this.ClearMessage(); + // MessageBox.Show(this, Convert.ToString(lRet) + " : " + strError); + } + finally + { + if (bDisplayClickableError == false + && this._floatingMessage.InDelay() == false) + this.ClearMessage(); - if (this.MainForm.MessageHub != null) - this.MainForm.MessageHub.SearchResponseEvent -= MessageHub_SearchResponseEvent; + if (this.MainForm.MessageHub != null) + this.MainForm.MessageHub.SearchResponseEvent -= MessageHub_SearchResponseEvent; - Progress.EndLoop(); - Progress.OnStop -= new StopEventHandler(this.DoStop); - Progress.Initial(""); - Progress.Style = StopStyle.None; + Progress.EndLoop(); + Progress.OnStop -= new StopEventHandler(this.DoStop); + Progress.Initial(""); + Progress.Style = StopStyle.None; - this.ReturnChannel(channel); + this.ReturnChannel(channel); - // this.button_search.Enabled = true; - this.EnableControls(true); + // this.button_search.Enabled = true; + this.EnableControls(true); - m_nInSearching--; - } + //// m_nInSearching--; + } - if (lHitCount > 1) - this.ShowBrowseWindow(lHitCount); + if (lHitCount > 1) + this.ShowBrowseWindow(lHitCount); - if (lHitCount == 1) - { - this.browseWindow.LoadFirstDetail(true); // 不会触发 closed 事件 - this.CloseBrowseWindow(); - } - else - { - if (lHitCount == 0) + if (lHitCount == 1) { - this.ShowMessage("未命中", "yellow", true); - bDisplayClickableError = true; + this.browseWindow.LoadFirstDetail(true); // 不会触发 closed 事件 + this.CloseBrowseWindow(); + } + else + { + if (lHitCount == 0) + { + this.ShowMessage("未命中", "yellow", true); + bDisplayClickableError = true; + } } - } - if (_willCloseBrowseWindow == true) - CloseBrowseWindow(); + if (_willCloseBrowseWindow == true) + CloseBrowseWindow(); - END1: - this.textBox_queryWord.SelectAll(); + END1: + this.textBox_queryWord.SelectAll(); - // 焦点切换到条码textbox - /* - this.textBox_itemBarcode.SelectAll(); - this.textBox_itemBarcode.Focus(); - * */ - this.SwitchFocus(ITEM_BARCODE); + // 焦点切换到条码textbox + /* + this.textBox_itemBarcode.SelectAll(); + this.textBox_itemBarcode.Focus(); + * */ + this.SwitchFocus(ITEM_BARCODE); + + DoPendingList(); // 2015/11/29 + return; + } + finally + { + this._processing--; + } - DoPendingList(); // 2015/11/29 - return; ERROR1: CloseBrowseWindow(); MessageBox.Show(this, strError); diff --git a/dp2Circulation/Issue/BindingControl.cs b/dp2Circulation/Issue/BindingControl.cs index 17995d72f..b2f4c12c8 100644 --- a/dp2Circulation/Issue/BindingControl.cs +++ b/dp2Circulation/Issue/BindingControl.cs @@ -19,7 +19,6 @@ using DigitalPlatform.Text; using DigitalPlatform.CommonControl; - namespace dp2Circulation { /// @@ -6780,7 +6779,6 @@ void menuItem_newAllIssue_Click(object sender, EventArgs e) ""); * */ - // 插入到合适的位置? InsertIssueToIssues(new_issue); @@ -8370,6 +8368,16 @@ public static string NextPublishTime(string strPublishTime, ref nPreferredDelta); } + // 2016/1/6 + // 获得一年的天数。2016 年为 366 天 + static int GetDaysOfYear(string strYear) + { + DateTime start = DateTimeUtil.Long8ToDateTime(strYear + "0101"); + string strNextYear = (Int32.Parse(strYear) + 1).ToString().PadLeft(4, '0'); + DateTime end = DateTimeUtil.Long8ToDateTime(strNextYear + "0101"); + return (int)((end - start).TotalDays); + } + // 预测下一期的出版时间 // exception: // 可能因strPublishTime为不可能的日期而抛出异常 @@ -8383,6 +8391,9 @@ public static string NextPublishTime(string strPublishTime, { strPublishTime = CanonicalizeLong8TimeString(strPublishTime); + // 计算出一年有多少天。比如 2016 年就是 366 天而不是 365 天 + int nDaysOfYear = GetDaysOfYear(strPublishTime.Substring(0, 4)); + DateTime start = DateTimeUtil.Long8ToDateTime(strPublishTime); int nCount = 0; @@ -8562,7 +8573,7 @@ public static string NextPublishTime(string strPublishTime, } // 一年365期 - else if (nIssueCount > 183 && nIssueCount <= 365) + else if (nIssueCount > 183 && nIssueCount <= nDaysOfYear) { // 1天以后 start += new TimeSpan(1, 0, 0, 0); diff --git a/dp2Circulation/Label/LabelPrintForm.cs b/dp2Circulation/Label/LabelPrintForm.cs index 13ccc2285..2dbfca1b5 100644 --- a/dp2Circulation/Label/LabelPrintForm.cs +++ b/dp2Circulation/Label/LabelPrintForm.cs @@ -2549,6 +2549,7 @@ void menu_importFromRecPathFile_Click(object sender, EventArgs e) string strError = ""; int nRet = ImportFromRecPathFile(null, + "clear", out strError); if (nRet == -1) goto ERROR1; diff --git a/dp2Circulation/MainForm/MainForm.Designer.cs b/dp2Circulation/MainForm/MainForm.Designer.cs index c80744801..e93b5cfb0 100644 --- a/dp2Circulation/MainForm/MainForm.Designer.cs +++ b/dp2Circulation/MainForm/MainForm.Designer.cs @@ -206,11 +206,11 @@ private void InitializeComponent() this.webBrowser_messageHub = new System.Windows.Forms.WebBrowser(); this.toolStrip_messageHub = new System.Windows.Forms.ToolStrip(); this.toolStripButton_messageHub_userManage = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton_messageHub_relogin = new System.Windows.Forms.ToolStripButton(); this.toolStrip_panelFixed = new System.Windows.Forms.ToolStrip(); this.toolStripButton_close = new System.Windows.Forms.ToolStripButton(); this.splitter_fixed = new System.Windows.Forms.Splitter(); this.timer_operHistory = new System.Windows.Forms.Timer(this.components); - this.toolStripButton_messageHub_relogin = new System.Windows.Forms.ToolStripButton(); this.menuStrip_main.SuspendLayout(); this.statusStrip_main.SuspendLayout(); this.toolStrip_main.SuspendLayout(); @@ -1253,8 +1253,8 @@ private void InitializeComponent() // this.MenuItem_copyright.Name = "MenuItem_copyright"; this.MenuItem_copyright.Size = new System.Drawing.Size(196, 22); - this.MenuItem_copyright.Text = "Ȩ(&C)..."; - this.MenuItem_copyright.Click += new System.EventHandler(this.MenuItem_copyright_Click); + this.MenuItem_copyright.Text = "(&A)..."; + this.MenuItem_copyright.Click += new System.EventHandler(this.MenuItem_about_Click); // // statusStrip_main // @@ -1697,6 +1697,16 @@ private void InitializeComponent() this.toolStripButton_messageHub_userManage.Text = "û"; this.toolStripButton_messageHub_userManage.Click += new System.EventHandler(this.toolStripButton_messageHub_userManage_Click); // + // toolStripButton_messageHub_relogin + // + this.toolStripButton_messageHub_relogin.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.toolStripButton_messageHub_relogin.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton_messageHub_relogin.Image"))); + this.toolStripButton_messageHub_relogin.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton_messageHub_relogin.Name = "toolStripButton_messageHub_relogin"; + this.toolStripButton_messageHub_relogin.Size = new System.Drawing.Size(60, 22); + this.toolStripButton_messageHub_relogin.Text = "µ¼"; + this.toolStripButton_messageHub_relogin.Click += new System.EventHandler(this.toolStripButton_messageHub_relogin_Click); + // // toolStrip_panelFixed // this.toolStrip_panelFixed.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; @@ -1729,16 +1739,6 @@ private void InitializeComponent() this.splitter_fixed.TabIndex = 6; this.splitter_fixed.TabStop = false; // - // toolStripButton_messageHub_relogin - // - this.toolStripButton_messageHub_relogin.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - this.toolStripButton_messageHub_relogin.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton_messageHub_relogin.Image"))); - this.toolStripButton_messageHub_relogin.ImageTransparentColor = System.Drawing.Color.Magenta; - this.toolStripButton_messageHub_relogin.Name = "toolStripButton_messageHub_relogin"; - this.toolStripButton_messageHub_relogin.Size = new System.Drawing.Size(60, 22); - this.toolStripButton_messageHub_relogin.Text = "µ¼"; - this.toolStripButton_messageHub_relogin.Click += new System.EventHandler(this.toolStripButton_messageHub_relogin_Click); - // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); diff --git a/dp2Circulation/MainForm/MainForm.cs b/dp2Circulation/MainForm/MainForm.cs index dea177556..38bca022e 100644 --- a/dp2Circulation/MainForm/MainForm.cs +++ b/dp2Circulation/MainForm/MainForm.cs @@ -5190,11 +5190,11 @@ public void SetProgressRange(int nMax) } #endif - private void MenuItem_copyright_Click(object sender, EventArgs e) + private void MenuItem_about_Click(object sender, EventArgs e) { - CopyrightDlg dlg = new CopyrightDlg(); + AboutDlg dlg = new AboutDlg(); MainForm.SetControlFont(dlg, this.Font, false); - dlg.MainForm = this; + // dlg.MainForm = this; dlg.StartPosition = FormStartPosition.CenterScreen; dlg.ShowDialog(this); } diff --git a/dp2Circulation/Monitor/StartLogRecoverDlg.cs b/dp2Circulation/Monitor/StartLogRecoverDlg.cs index 545bc8807..2dd4149db 100644 --- a/dp2Circulation/Monitor/StartLogRecoverDlg.cs +++ b/dp2Circulation/Monitor/StartLogRecoverDlg.cs @@ -19,6 +19,23 @@ namespace dp2Circulation /// internal partial class StartLogRecoverDlg : Form { + string _taskName = "日志恢复"; // 日志恢复/创建 MongoDB 日志库 + public string TaskName + { + get + { + return this._taskName; + } + set + { + this._taskName = value; + if (value == "创建 MongoDB 日志库") + { + this.comboBox_recoverLevel.Visible = false; + } + } + } + /// /// 后台任务启动参数 /// @@ -74,13 +91,13 @@ private void StartLogRecoverDlg_FormClosed(object sender, FormClosedEventArgs e) private void button_OK_Click(object sender, EventArgs e) { - if (this.comboBox_recoverLevel.Text == "") + if (this.comboBox_recoverLevel.Visible == true + && this.comboBox_recoverLevel.Text == "") { MessageBox.Show(this, "尚未指定 恢复级别"); return; } - // 合成参数 if (this.textBox_startFileName.Text == "") this.StartInfo.Start = ""; @@ -111,15 +128,17 @@ private void button_OK_Click(object sender, EventArgs e) XmlDocument dom = new XmlDocument(); dom.LoadXml(""); - DomUtil.SetAttr(dom.DocumentElement, - "recoverLevel", - strRecoverLevel); + if (this.comboBox_recoverLevel.Visible == true) + { + DomUtil.SetAttr(dom.DocumentElement, + "recoverLevel", + strRecoverLevel); + } DomUtil.SetAttr(dom.DocumentElement, "clearFirst", (this.checkBox_clearBefore.Checked == true ? "yes" : "no")); this.StartInfo.Param = dom.OuterXml; - this.DialogResult = DialogResult.OK; this.Close(); } @@ -128,7 +147,6 @@ private void button_Cancel_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; this.Close(); - } // 解析 开始 参数 diff --git a/dp2Circulation/OperLogStatis/GetOperLogFilenameDlg.cs b/dp2Circulation/OperLogStatis/GetOperLogFilenameDlg.cs index 98bc578ff..610537c24 100644 --- a/dp2Circulation/OperLogStatis/GetOperLogFilenameDlg.cs +++ b/dp2Circulation/OperLogStatis/GetOperLogFilenameDlg.cs @@ -66,12 +66,12 @@ private void button_OK_Click(object sender, EventArgs e) OperLogFilenames.Clear(); string strStartDate = ""; - + if (this.dateControl_start.IsValueNull() == false) strStartDate = DateTimeUtil.DateTimeToString8(this.dateControl_start.Value); string strEndDate = ""; - + if (this.dateControl_end.IsValueNull() == false) strEndDate = DateTimeUtil.DateTimeToString8(this.dateControl_end.Value); @@ -117,7 +117,7 @@ private void button_OK_Click(object sender, EventArgs e) this.OperLogFilenames = LogFileNames; - END1: + END1: this.DialogResult = DialogResult.OK; this.Close(); return; diff --git a/dp2Circulation/Order/OrderControl.cs b/dp2Circulation/Order/OrderControl.cs index f4f36751b..f5df25913 100644 --- a/dp2Circulation/Order/OrderControl.cs +++ b/dp2Circulation/Order/OrderControl.cs @@ -3442,6 +3442,16 @@ void menu_modifyOrder_Click(object sender, EventArgs e) MessageBox.Show(ForegroundWindow.Instance, "尚未选择要编辑的事项"); return; } + + bool bAllowModify = StringUtil.IsInList("client_uimodifyorderrecord", + this.MainForm._currentUserRights// this.Rights + ) == true; + if (bAllowModify == false) + { + MessageBox.Show(ForegroundWindow.Instance, "当前用户不具备 client_uimodifyorderrecord 权限"); + return; + } + OrderItem orderitem = (OrderItem)this.listView.SelectedItems[0].Tag; ModifyOrder(orderitem); @@ -3660,7 +3670,8 @@ int MaskDeleteItem(OrderItem orderitem, private void ListView_DoubleClick(object sender, EventArgs e) { - menu_modifyOrder_Click(this, null); + // menu_modifyOrder_Click(this, null); + menu_design_Click(this, new EventArgs()); } #if NO diff --git a/dp2Circulation/Order/OrderDesignForm.cs b/dp2Circulation/Order/OrderDesignForm.cs index 9fa16e601..5a0a0604d 100644 --- a/dp2Circulation/Order/OrderDesignForm.cs +++ b/dp2Circulation/Order/OrderDesignForm.cs @@ -22,7 +22,6 @@ internal partial class OrderDesignForm : Form const int WM_SETCARETPOS = API.WM_USER + 201; - /// /// 框架窗口 /// @@ -44,7 +43,7 @@ internal partial class OrderDesignForm : Form public event VerifyLibraryCodeEventHandler VerifyLibraryCode = null; // 事项数组 - public List Items + public List Items { get { @@ -80,7 +79,7 @@ private void OrderDesignForm_Load(object sender, EventArgs e) // TODO: 需要删除缺省就在里面的copy为0的唯一事项,然后增加一个copy为0的事项。新增加的事项会有批次号等信息。 this.orderDesignControl1.InsertNewItem(0); // this.orderDesignControl1.Items.Count } - catch(Exception ex) + catch (Exception ex) { MessageBox.Show(this, ex.Message); } @@ -130,7 +129,7 @@ public void EnsureCurrentVisible(DateTime? time) { this.orderDesignControl1.EnsureVisible(item); this.orderDesignControl1.SelectItem(item, nCount == 0 ? true : false); - nCount ++; + nCount++; } // TODO: 如果没有精确匹配的,还可以计算出和当前时间距离最近的 // 如果时间范围为空,还可以看订购时间 diff --git a/dp2Circulation/Program.cs b/dp2Circulation/Program.cs index e57f5b804..b397d047b 100644 --- a/dp2Circulation/Program.cs +++ b/dp2Circulation/Program.cs @@ -36,6 +36,14 @@ static class Program // http://stackoverflow.com/questions/17117372/form-activeform-occasionally-works // Form.ActiveForm occasionally works + public static MainForm MainForm + { + get + { + return _mainForm; + } + } + /// /// The main entry point for the application. /// diff --git a/dp2Circulation/Properties/AssemblyInfo.cs b/dp2Circulation/Properties/AssemblyInfo.cs index 537641b46..3a12add7c 100644 --- a/dp2Circulation/Properties/AssemblyInfo.cs +++ b/dp2Circulation/Properties/AssemblyInfo.cs @@ -29,8 +29,8 @@ // Build Number // Revision // -[assembly: AssemblyVersion("2.10.*")] // "2.4.*" -[assembly: AssemblyFileVersion("2.10.0.0")] +[assembly: AssemblyVersion("2.11.*")] // "2.4.*" +[assembly: AssemblyFileVersion("2.11.0.0")] // V2.6 2015/11/7 MainForm BiblioSearchForm ChannelForm 采用 ChannelPool。注意观察有无通讯通道方面的故障 // V2.7 2015/11/30 EntityForm 大幅度改造,采用 ChannelPool。Stop 类的 BeginLoop() 不再允许嵌套,注意观察是否会抛出异常。固定面板区属性页的显示很多已经改造为 PropertyTaskList 实现 @@ -38,4 +38,5 @@ // 启动阶段,框架窗口背景色会体现当前运行的版本,如果是绿色安装版,会显示为深绿色 // V2.9 2015/12/11 调用 dp2library Login() API 的时候发送了 client 参数 // V2.10 2015/12/14 DigitalPlatform.CirculationClient.dll 中剥离部分纯粹通讯功能到 DigitalPlatform.LibraryClient.dll。有可能部分统计方案编译报错,需要修改后发布 -// 2.10.5829.27554 2015/12/17 修改了 DigitalPlatform.Drawing 和 DigitalPlatform 的 AssemblyInfo.cs 文件 \ No newline at end of file +// 2.10.5829.27554 2015/12/17 修改了 DigitalPlatform.Drawing 和 DigitalPlatform 的 AssemblyInfo.cs 文件 +// V2.14 2016/1/4 读者查询窗和读者窗在导出读者详情 Excel 文件时,可以选择输出借阅历史了。“关于”窗口里面标识了开源的情况。 diff --git a/dp2Circulation/Reader/ExportPatronExcelDialog.Designer.cs b/dp2Circulation/Reader/ExportPatronExcelDialog.Designer.cs new file mode 100644 index 000000000..ba6ad5ac0 --- /dev/null +++ b/dp2Circulation/Reader/ExportPatronExcelDialog.Designer.cs @@ -0,0 +1,279 @@ +namespace dp2Circulation +{ + partial class ExportPatronExcelDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button_Cancel = new System.Windows.Forms.Button(); + this.button_OK = new System.Windows.Forms.Button(); + this.tabControl_main = new System.Windows.Forms.TabControl(); + this.tabPage_normal = new System.Windows.Forms.TabPage(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.checkBox_overdueInfo = new System.Windows.Forms.CheckBox(); + this.checkBox_readerInfo = new System.Windows.Forms.CheckBox(); + this.checkBox_borrowInfo = new System.Windows.Forms.CheckBox(); + this.label2 = new System.Windows.Forms.Label(); + this.button_getOutputExcelFileName = new System.Windows.Forms.Button(); + this.textBox_outputExcelFileName = new System.Windows.Forms.TextBox(); + this.tabPage_chargingHistory = new System.Windows.Forms.TabPage(); + this.button_chargingHistory_getDateRange = new System.Windows.Forms.Button(); + this.textBox_chargingHistory_dateRange = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.checkBox_chargingHistory = new System.Windows.Forms.CheckBox(); + this.tabControl_main.SuspendLayout(); + this.tabPage_normal.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.tabPage_chargingHistory.SuspendLayout(); + this.SuspendLayout(); + // + // button_Cancel + // + this.button_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.button_Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.button_Cancel.Location = new System.Drawing.Point(288, 277); + this.button_Cancel.Margin = new System.Windows.Forms.Padding(2); + this.button_Cancel.Name = "button_Cancel"; + this.button_Cancel.Size = new System.Drawing.Size(75, 23); + this.button_Cancel.TabIndex = 9; + this.button_Cancel.Text = "取消"; + this.button_Cancel.UseVisualStyleBackColor = true; + this.button_Cancel.Click += new System.EventHandler(this.button_Cancel_Click); + // + // button_OK + // + this.button_OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.button_OK.Location = new System.Drawing.Point(209, 277); + this.button_OK.Margin = new System.Windows.Forms.Padding(2); + this.button_OK.Name = "button_OK"; + this.button_OK.Size = new System.Drawing.Size(75, 23); + this.button_OK.TabIndex = 8; + this.button_OK.Text = "确定"; + this.button_OK.UseVisualStyleBackColor = true; + this.button_OK.Click += new System.EventHandler(this.button_OK_Click); + // + // tabControl_main + // + this.tabControl_main.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabControl_main.Controls.Add(this.tabPage_normal); + this.tabControl_main.Controls.Add(this.tabPage_chargingHistory); + this.tabControl_main.Location = new System.Drawing.Point(13, 13); + this.tabControl_main.Name = "tabControl_main"; + this.tabControl_main.SelectedIndex = 0; + this.tabControl_main.Size = new System.Drawing.Size(349, 259); + this.tabControl_main.TabIndex = 10; + // + // tabPage_normal + // + this.tabPage_normal.Controls.Add(this.groupBox1); + this.tabPage_normal.Controls.Add(this.label2); + this.tabPage_normal.Controls.Add(this.button_getOutputExcelFileName); + this.tabPage_normal.Controls.Add(this.textBox_outputExcelFileName); + this.tabPage_normal.Location = new System.Drawing.Point(4, 22); + this.tabPage_normal.Name = "tabPage_normal"; + this.tabPage_normal.Padding = new System.Windows.Forms.Padding(3); + this.tabPage_normal.Size = new System.Drawing.Size(341, 233); + this.tabPage_normal.TabIndex = 0; + this.tabPage_normal.Text = "通用"; + this.tabPage_normal.UseVisualStyleBackColor = true; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.checkBox_overdueInfo); + this.groupBox1.Controls.Add(this.checkBox_readerInfo); + this.groupBox1.Controls.Add(this.checkBox_borrowInfo); + this.groupBox1.Location = new System.Drawing.Point(8, 79); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(228, 117); + this.groupBox1.TabIndex = 8; + this.groupBox1.TabStop = false; + this.groupBox1.Text = " 输出 "; + // + // checkBox_overdueInfo + // + this.checkBox_overdueInfo.AutoSize = true; + this.checkBox_overdueInfo.Location = new System.Drawing.Point(27, 77); + this.checkBox_overdueInfo.Name = "checkBox_overdueInfo"; + this.checkBox_overdueInfo.Size = new System.Drawing.Size(72, 16); + this.checkBox_overdueInfo.TabIndex = 2; + this.checkBox_overdueInfo.Text = "违约信息"; + this.checkBox_overdueInfo.UseVisualStyleBackColor = true; + this.checkBox_overdueInfo.CheckedChanged += new System.EventHandler(this.checkBox_readerInfo_CheckedChanged); + // + // checkBox_readerInfo + // + this.checkBox_readerInfo.AutoSize = true; + this.checkBox_readerInfo.Location = new System.Drawing.Point(27, 33); + this.checkBox_readerInfo.Name = "checkBox_readerInfo"; + this.checkBox_readerInfo.Size = new System.Drawing.Size(72, 16); + this.checkBox_readerInfo.TabIndex = 0; + this.checkBox_readerInfo.Text = "基本信息"; + this.checkBox_readerInfo.UseVisualStyleBackColor = true; + this.checkBox_readerInfo.CheckedChanged += new System.EventHandler(this.checkBox_readerInfo_CheckedChanged); + // + // checkBox_borrowInfo + // + this.checkBox_borrowInfo.AutoSize = true; + this.checkBox_borrowInfo.Location = new System.Drawing.Point(27, 55); + this.checkBox_borrowInfo.Name = "checkBox_borrowInfo"; + this.checkBox_borrowInfo.Size = new System.Drawing.Size(72, 16); + this.checkBox_borrowInfo.TabIndex = 1; + this.checkBox_borrowInfo.Text = "在借信息"; + this.checkBox_borrowInfo.UseVisualStyleBackColor = true; + this.checkBox_borrowInfo.CheckedChanged += new System.EventHandler(this.checkBox_readerInfo_CheckedChanged); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(6, 19); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(101, 12); + this.label2.TabIndex = 7; + this.label2.Text = "Excel 文件名(&F):"; + // + // button_getOutputExcelFileName + // + this.button_getOutputExcelFileName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.button_getOutputExcelFileName.Location = new System.Drawing.Point(291, 32); + this.button_getOutputExcelFileName.Name = "button_getOutputExcelFileName"; + this.button_getOutputExcelFileName.Size = new System.Drawing.Size(44, 23); + this.button_getOutputExcelFileName.TabIndex = 6; + this.button_getOutputExcelFileName.Text = "..."; + this.button_getOutputExcelFileName.UseVisualStyleBackColor = true; + this.button_getOutputExcelFileName.Click += new System.EventHandler(this.button_getOutputExcelFileName_Click); + // + // textBox_outputExcelFileName + // + this.textBox_outputExcelFileName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox_outputExcelFileName.Location = new System.Drawing.Point(8, 34); + this.textBox_outputExcelFileName.Name = "textBox_outputExcelFileName"; + this.textBox_outputExcelFileName.Size = new System.Drawing.Size(277, 21); + this.textBox_outputExcelFileName.TabIndex = 5; + // + // tabPage_chargingHistory + // + this.tabPage_chargingHistory.Controls.Add(this.button_chargingHistory_getDateRange); + this.tabPage_chargingHistory.Controls.Add(this.textBox_chargingHistory_dateRange); + this.tabPage_chargingHistory.Controls.Add(this.label1); + this.tabPage_chargingHistory.Controls.Add(this.checkBox_chargingHistory); + this.tabPage_chargingHistory.Location = new System.Drawing.Point(4, 22); + this.tabPage_chargingHistory.Name = "tabPage_chargingHistory"; + this.tabPage_chargingHistory.Padding = new System.Windows.Forms.Padding(3); + this.tabPage_chargingHistory.Size = new System.Drawing.Size(341, 233); + this.tabPage_chargingHistory.TabIndex = 1; + this.tabPage_chargingHistory.Text = "借阅历史"; + this.tabPage_chargingHistory.UseVisualStyleBackColor = true; + // + // button_chargingHistory_getDateRange + // + this.button_chargingHistory_getDateRange.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.button_chargingHistory_getDateRange.Enabled = false; + this.button_chargingHistory_getDateRange.Location = new System.Drawing.Point(292, 69); + this.button_chargingHistory_getDateRange.Name = "button_chargingHistory_getDateRange"; + this.button_chargingHistory_getDateRange.Size = new System.Drawing.Size(44, 23); + this.button_chargingHistory_getDateRange.TabIndex = 4; + this.button_chargingHistory_getDateRange.Text = "..."; + this.button_chargingHistory_getDateRange.UseVisualStyleBackColor = true; + this.button_chargingHistory_getDateRange.Click += new System.EventHandler(this.button_chargingHistory_getDateRange_Click); + // + // textBox_chargingHistory_dateRange + // + this.textBox_chargingHistory_dateRange.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox_chargingHistory_dateRange.Enabled = false; + this.textBox_chargingHistory_dateRange.Location = new System.Drawing.Point(86, 71); + this.textBox_chargingHistory_dateRange.Name = "textBox_chargingHistory_dateRange"; + this.textBox_chargingHistory_dateRange.Size = new System.Drawing.Size(200, 21); + this.textBox_chargingHistory_dateRange.TabIndex = 3; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(5, 74); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(59, 12); + this.label1.TabIndex = 2; + this.label1.Text = "日期范围:"; + // + // checkBox_chargingHistory + // + this.checkBox_chargingHistory.AutoSize = true; + this.checkBox_chargingHistory.Location = new System.Drawing.Point(6, 24); + this.checkBox_chargingHistory.Name = "checkBox_chargingHistory"; + this.checkBox_chargingHistory.Size = new System.Drawing.Size(96, 16); + this.checkBox_chargingHistory.TabIndex = 1; + this.checkBox_chargingHistory.Text = "输出借阅历史"; + this.checkBox_chargingHistory.UseVisualStyleBackColor = true; + this.checkBox_chargingHistory.CheckedChanged += new System.EventHandler(this.checkBox_borrowHistory_CheckedChanged); + // + // ExportPatronExcelDialog + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(374, 311); + this.Controls.Add(this.tabControl_main); + this.Controls.Add(this.button_Cancel); + this.Controls.Add(this.button_OK); + this.Name = "ExportPatronExcelDialog"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.Text = "导出读者详情"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ExportPatronExcelDialog_FormClosed); + this.Load += new System.EventHandler(this.ExportPatronExcelDialog_Load); + this.tabControl_main.ResumeLayout(false); + this.tabPage_normal.ResumeLayout(false); + this.tabPage_normal.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.tabPage_chargingHistory.ResumeLayout(false); + this.tabPage_chargingHistory.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button button_Cancel; + private System.Windows.Forms.Button button_OK; + private System.Windows.Forms.TabControl tabControl_main; + private System.Windows.Forms.TabPage tabPage_normal; + private System.Windows.Forms.TabPage tabPage_chargingHistory; + private System.Windows.Forms.CheckBox checkBox_readerInfo; + private System.Windows.Forms.CheckBox checkBox_borrowInfo; + private System.Windows.Forms.CheckBox checkBox_overdueInfo; + private System.Windows.Forms.CheckBox checkBox_chargingHistory; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button button_chargingHistory_getDateRange; + private System.Windows.Forms.TextBox textBox_chargingHistory_dateRange; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button button_getOutputExcelFileName; + private System.Windows.Forms.TextBox textBox_outputExcelFileName; + private System.Windows.Forms.GroupBox groupBox1; + } +} \ No newline at end of file diff --git a/dp2Circulation/Reader/ExportPatronExcelDialog.cs b/dp2Circulation/Reader/ExportPatronExcelDialog.cs new file mode 100644 index 000000000..f738d5b43 --- /dev/null +++ b/dp2Circulation/Reader/ExportPatronExcelDialog.cs @@ -0,0 +1,243 @@ +using DigitalPlatform.CommonControl; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace dp2Circulation +{ + /// + /// 导出读者详情到 Excel 文件, 的对话框 + /// + public partial class ExportPatronExcelDialog : Form + { + public ExportPatronExcelDialog() + { + InitializeComponent(); + } + + private void ExportPatronExcelDialog_Load(object sender, EventArgs e) + { + + } + + private void ExportPatronExcelDialog_FormClosed(object sender, FormClosedEventArgs e) + { + + } + + private void button_OK_Click(object sender, EventArgs e) + { + string strError = ""; + if (string.IsNullOrEmpty(this.textBox_outputExcelFileName.Text) == true) + { + strError = "尚未指定输出文件名"; + goto ERROR1; + } + + this.DialogResult = System.Windows.Forms.DialogResult.OK; + this.Close(); + return; + ERROR1: + MessageBox.Show(this, strError); + } + + private void button_Cancel_Click(object sender, EventArgs e) + { + this.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.Close(); + } + + private void button_getOutputExcelFileName_Click(object sender, EventArgs e) + { + // 询问文件名 + SaveFileDialog dlg = new SaveFileDialog(); + + dlg.Title = "请指定要输出的 Excel 文件名"; + dlg.CreatePrompt = false; + dlg.OverwritePrompt = true; + dlg.FileName = this.textBox_outputExcelFileName.Text; + // dlg.InitialDirectory = Environment.CurrentDirectory; + dlg.Filter = "Excel 文件 (*.xlsx)|*.xlsx|All files (*.*)|*.*"; + + dlg.RestoreDirectory = true; + + if (dlg.ShowDialog() != DialogResult.OK) + return; + + this.textBox_outputExcelFileName.Text = dlg.FileName; + } + + private void button_chargingHistory_getDateRange_Click(object sender, EventArgs e) + { + string strError = ""; + int nRet = 0; + DateTime start; + DateTime end; + + nRet = Global.ParseTimeRangeString(this.textBox_chargingHistory_dateRange.Text, + false, + out start, + out end, + out strError); + /* + if (nRet == -1) + { + MessageBox.Show(this, strError); + return; + }*/ + + TimeRangeDlg dlg = new TimeRangeDlg(); + MainForm.SetControlFont(dlg, this.Font, false); + + dlg.Text = "借阅历史日期范围"; + dlg.StartDate = start; + dlg.EndDate = end; + dlg.AllowStartDateNull = true; // 允许起点时间为空 + dlg.AllowEndDateNull = true; // 允许终点时间为空 + + dlg.StartPosition = FormStartPosition.CenterScreen; + dlg.ShowDialog(this); + + if (dlg.DialogResult == DialogResult.Cancel) + return; + + this.textBox_chargingHistory_dateRange.Text = Global.MakeTimeRangeString(dlg.StartDate, dlg.EndDate); + } + + public string FileName + { + get + { + return this.textBox_outputExcelFileName.Text; + } + set + { + this.textBox_outputExcelFileName.Text = value; + } + } + + public string ChargingHistoryDateRange + { + get + { + return this.textBox_chargingHistory_dateRange.Text; + } + set + { + this.textBox_chargingHistory_dateRange.Text = value; + } + } + + public bool ExportChargingHistory + { + get + { + return this.checkBox_chargingHistory.Checked; + } + set + { + this.checkBox_chargingHistory.Checked = value; + } + } + + public bool ExportReaderInfo + { + get + { + return this.checkBox_readerInfo.Checked; + } + set + { + this.checkBox_readerInfo.Checked = value; + } + } + + public bool ExportOverdueInfo + { + get + { + return this.checkBox_overdueInfo.Checked; + } + set + { + this.checkBox_overdueInfo.Checked = value; + } + } + + public bool ExportBorrowInfo + { + get + { + return this.checkBox_borrowInfo.Checked; + } + set + { + this.checkBox_borrowInfo.Checked = value; + } + } + + public string UiState + { + get + { + List controls = new List(); + controls.Add(this.tabControl_main); + controls.Add(this.textBox_outputExcelFileName); + // 此处的缺省值会被忽略 + controls.Add(new ControlWrapper(this.checkBox_readerInfo, true)); + controls.Add(new ControlWrapper(this.checkBox_overdueInfo, true)); + controls.Add(new ControlWrapper(this.checkBox_borrowInfo, true)); + controls.Add(new ControlWrapper(this.checkBox_chargingHistory, false)); + + controls.Add(this.textBox_chargingHistory_dateRange); + return GuiState.GetUiState(controls); + } + set + { + List controls = new List(); + controls.Add(this.tabControl_main); + controls.Add(this.textBox_outputExcelFileName); + controls.Add(new ControlWrapper(this.checkBox_readerInfo, true)); + controls.Add(new ControlWrapper(this.checkBox_overdueInfo, true)); + controls.Add(new ControlWrapper(this.checkBox_borrowInfo, true)); + controls.Add(new ControlWrapper(this.checkBox_chargingHistory, false)); + + controls.Add(this.textBox_chargingHistory_dateRange); + GuiState.SetUiState(controls, value); + } + } + + private void checkBox_borrowHistory_CheckedChanged(object sender, EventArgs e) + { + if (this.checkBox_chargingHistory.Checked) + { + this.textBox_chargingHistory_dateRange.Enabled = true; + this.button_chargingHistory_getDateRange.Enabled = true; + } + else + { + this.textBox_chargingHistory_dateRange.Enabled = false; + this.button_chargingHistory_getDateRange.Enabled = false; + } + } + + private void checkBox_readerInfo_CheckedChanged(object sender, EventArgs e) + { + if (this.checkBox_readerInfo.Checked == true + || this.checkBox_overdueInfo.Checked == true + || this.checkBox_borrowInfo.Checked == true) + { + // 在 tabpage 标题上显示一个打勾标记 + } + else + { + // 清除打勾标记 + } + } + } +} diff --git a/dp2Circulation/Reader/ExportPatronExcelDialog.resx b/dp2Circulation/Reader/ExportPatronExcelDialog.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/dp2Circulation/Reader/ExportPatronExcelDialog.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/dp2Circulation/Reader/ReaderSearchForm.cs b/dp2Circulation/Reader/ReaderSearchForm.cs index dc006097a..cb031a83e 100644 --- a/dp2Circulation/Reader/ReaderSearchForm.cs +++ b/dp2Circulation/Reader/ReaderSearchForm.cs @@ -1171,82 +1171,83 @@ private void listView_records_MouseUp(object sender, MouseEventArgs e) menuItem.Enabled = false; contextMenu.MenuItems.Add(menuItem); - // - menuItem = new MenuItem("打开方式(&T)"); - contextMenu.MenuItems.Add(menuItem); - - // 子菜单 + { + // + menuItem = new MenuItem("打开方式(&T)"); + contextMenu.MenuItems.Add(menuItem); - // *** 读者窗 - strOpenStyle = "新开的"; + // 子菜单 - // 记录路径 - MenuItem subMenuItem = new MenuItem("装入" + strOpenStyle + "读者窗,根据记录路径 '" + strRecPath + "'"); - subMenuItem.Click += new System.EventHandler(this.menu_recPath_newly_Click); - if (String.IsNullOrEmpty(strRecPath) == true) - subMenuItem.Enabled = false; - menuItem.MenuItems.Add(subMenuItem); + // *** 读者窗 + strOpenStyle = "新开的"; - // 条码 - subMenuItem = new MenuItem("装入" + strOpenStyle + "读者窗,根据证条码号 '" + strBarcode + "'"); - subMenuItem.Click += new System.EventHandler(this.menu_barcode_newly_Click); - if (String.IsNullOrEmpty(strBarcode) == true) - subMenuItem.Enabled = false; - menuItem.MenuItems.Add(subMenuItem); + // 记录路径 + MenuItem subMenuItem = new MenuItem("装入" + strOpenStyle + "读者窗,根据记录路径 '" + strRecPath + "'"); + subMenuItem.Click += new System.EventHandler(this.menu_recPath_newly_Click); + if (String.IsNullOrEmpty(strRecPath) == true) + subMenuItem.Enabled = false; + menuItem.MenuItems.Add(subMenuItem); - strOpenStyle = "已打开的"; + // 条码 + subMenuItem = new MenuItem("装入" + strOpenStyle + "读者窗,根据证条码号 '" + strBarcode + "'"); + subMenuItem.Click += new System.EventHandler(this.menu_barcode_newly_Click); + if (String.IsNullOrEmpty(strBarcode) == true) + subMenuItem.Enabled = false; + menuItem.MenuItems.Add(subMenuItem); - bool bHasOpendReaderInfoForm = (this.MainForm.GetTopChildWindow() != null); + strOpenStyle = "已打开的"; - // 记录路径 - subMenuItem = new MenuItem("装入" + strOpenStyle + "读者窗,根据记录路径 '" + strRecPath + "'"); - subMenuItem.Click += new System.EventHandler(this.menu_recPath_exist_Click); - if (String.IsNullOrEmpty(strRecPath) == true - || bHasOpendReaderInfoForm == false) - subMenuItem.Enabled = false; - menuItem.MenuItems.Add(subMenuItem); + bool bHasOpendReaderInfoForm = (this.MainForm.GetTopChildWindow() != null); - // 条码 - subMenuItem = new MenuItem("装入" + strOpenStyle + "读者窗,根据证条码号 '" + strBarcode + "'"); - subMenuItem.Click += new System.EventHandler(this.menu_barcode_exist_Click); - if (String.IsNullOrEmpty(strBarcode) == true - || bHasOpendReaderInfoForm == false) - subMenuItem.Enabled = false; - menuItem.MenuItems.Add(subMenuItem); + // 记录路径 + subMenuItem = new MenuItem("装入" + strOpenStyle + "读者窗,根据记录路径 '" + strRecPath + "'"); + subMenuItem.Click += new System.EventHandler(this.menu_recPath_exist_Click); + if (String.IsNullOrEmpty(strRecPath) == true + || bHasOpendReaderInfoForm == false) + subMenuItem.Enabled = false; + menuItem.MenuItems.Add(subMenuItem); - /* - menuItem = new MenuItem("打开 [根据记录路径 '"+strRecPath+"' 装入到读者窗] (&P)"); - menuItem.Click += new System.EventHandler(this.menu_loadReaderInfoByRecPath_Click); - if (String.IsNullOrEmpty(strRecPath) == true) - menuItem.Enabled = false; - contextMenu.MenuItems.Add(menuItem); - * */ + // 条码 + subMenuItem = new MenuItem("装入" + strOpenStyle + "读者窗,根据证条码号 '" + strBarcode + "'"); + subMenuItem.Click += new System.EventHandler(this.menu_barcode_exist_Click); + if (String.IsNullOrEmpty(strBarcode) == true + || bHasOpendReaderInfoForm == false) + subMenuItem.Enabled = false; + menuItem.MenuItems.Add(subMenuItem); - // --- - subMenuItem = new MenuItem("-"); - menuItem.MenuItems.Add(subMenuItem); + /* + menuItem = new MenuItem("打开 [根据记录路径 '"+strRecPath+"' 装入到读者窗] (&P)"); + menuItem.Click += new System.EventHandler(this.menu_loadReaderInfoByRecPath_Click); + if (String.IsNullOrEmpty(strRecPath) == true) + menuItem.Enabled = false; + contextMenu.MenuItems.Add(menuItem); + * */ + // --- + subMenuItem = new MenuItem("-"); + menuItem.MenuItems.Add(subMenuItem); - // *** 交费窗 - strOpenStyle = "新开的"; - // 条码 - subMenuItem = new MenuItem("装入" + strOpenStyle + "交费窗,根据证条码号 '" + strBarcode + "'"); - subMenuItem.Click += new System.EventHandler(this.menu_amerce_by_barcode_newly_Click); - if (String.IsNullOrEmpty(strBarcode) == true) - subMenuItem.Enabled = false; - menuItem.MenuItems.Add(subMenuItem); + // *** 交费窗 + strOpenStyle = "新开的"; - strOpenStyle = "已打开的"; + // 条码 + subMenuItem = new MenuItem("装入" + strOpenStyle + "交费窗,根据证条码号 '" + strBarcode + "'"); + subMenuItem.Click += new System.EventHandler(this.menu_amerce_by_barcode_newly_Click); + if (String.IsNullOrEmpty(strBarcode) == true) + subMenuItem.Enabled = false; + menuItem.MenuItems.Add(subMenuItem); - // 条码 - subMenuItem = new MenuItem("装入" + strOpenStyle + "交费窗,根据证条码号 '" + strBarcode + "'"); - subMenuItem.Click += new System.EventHandler(this.menu_amerce_by_barcode_exist_Click); - if (String.IsNullOrEmpty(strBarcode) == true - || this.MainForm.GetTopChildWindow() == null) - subMenuItem.Enabled = false; - menuItem.MenuItems.Add(subMenuItem); + strOpenStyle = "已打开的"; + // 条码 + subMenuItem = new MenuItem("装入" + strOpenStyle + "交费窗,根据证条码号 '" + strBarcode + "'"); + subMenuItem.Click += new System.EventHandler(this.menu_amerce_by_barcode_exist_Click); + if (String.IsNullOrEmpty(strBarcode) == true + || this.MainForm.GetTopChildWindow() == null) + subMenuItem.Enabled = false; + menuItem.MenuItems.Add(subMenuItem); + } // --- menuItem = new MenuItem("-"); @@ -1273,7 +1274,7 @@ private void listView_records_MouseUp(object sender, MouseEventArgs e) for (int i = 0; i < this.listView_records.Columns.Count; i++) { - subMenuItem = new MenuItem("复制列 '" + this.listView_records.Columns[i].Text + "'"); + MenuItem subMenuItem = new MenuItem("复制列 '" + this.listView_records.Columns[i].Text + "'"); subMenuItem.Tag = i; subMenuItem.Click += new System.EventHandler(this.menu_copySingleColumnToClipboard_Click); menuItem.MenuItems.Add(subMenuItem); @@ -1319,7 +1320,7 @@ private void listView_records_MouseUp(object sender, MouseEventArgs e) menuItem.Enabled = this.textBox_queryWord.Enabled; // 在检索阶段,不允许使用批处理菜单 contextMenu.MenuItems.Add(menuItem); - subMenuItem = new MenuItem("快速修改读者记录 [" + this.listView_records.SelectedItems.Count.ToString() + "] (&Q)"); + MenuItem subMenuItem = new MenuItem("快速修改读者记录 [" + this.listView_records.SelectedItems.Count.ToString() + "] (&Q)"); subMenuItem.Click += new System.EventHandler(this.menu_quickChangeRecords_Click); if (this.listView_records.SelectedItems.Count == 0 || this.InSearching == true) subMenuItem.Enabled = false; @@ -1422,6 +1423,30 @@ private void listView_records_MouseUp(object sender, MouseEventArgs e) menuItem.Enabled = false; contextMenu.MenuItems.Add(menuItem); +#if NO + menuItem = new MenuItem("导出借阅历史到 Excel 文件 [" + this.listView_records.SelectedItems.Count.ToString() + "] (&D)"); + menuItem.Click += new System.EventHandler(this.menu_exportBorrowHistoryToExcelFile_Click); + if (this.listView_records.SelectedItems.Count == 0 + || bSearching == true) + menuItem.Enabled = false; + contextMenu.MenuItems.Add(menuItem); +#endif + + // --- + menuItem = new MenuItem("-"); + contextMenu.MenuItems.Add(menuItem); + + // 装入其它查询窗 + { + menuItem = new MenuItem("装入其它查询窗 [" + this.listView_records.SelectedItems.Count.ToString() + "] (&L)"); + contextMenu.MenuItems.Add(menuItem); + + MenuItem subMenuItem = new MenuItem("借阅历史 --> 实体查询窗"); + subMenuItem.Click += new System.EventHandler(this.menu_exportChargingHistoryToItemSearchForm_Click); + if (this.listView_records.SelectedItems.Count == 0) + subMenuItem.Enabled = false; + menuItem.MenuItems.Add(subMenuItem); + } // --- menuItem = new MenuItem("-"); @@ -1457,6 +1482,32 @@ private void listView_records_MouseUp(object sender, MouseEventArgs e) contextMenu.Show(this.listView_records, new Point(e.X, e.Y)); } + // 借阅历史 --> 实体查询窗 + void menu_exportChargingHistoryToItemSearchForm_Click(object sender, EventArgs e) + { + string strError = ""; + List barcodes = new List(); + foreach (ListViewItem item in this.listView_records.SelectedItems) + { + // TODO: 用 style 来识别列 + barcodes.Add(item.SubItems[1].Text); + } + + // return: + // -1 出错 + // 0 用户中断 + // 1 成功 + int nRet = this.ExportChargingHistoryToItemSearchForm(barcodes, + out strError); + if (nRet != 1) + goto ERROR1; + + // MessageBox.Show(this, "导出完成"); + return; + ERROR1: + MessageBox.Show(this, strError); + } + // 修改宏定义 void menu_macroDef_Click(object sender, EventArgs e) { @@ -4204,7 +4255,7 @@ int AddItems(List items, } catch (Exception ex) { - strError = "针对 " + this.MainForm.FingerprintReaderUrl + " 的 AddItems() 操作失败: " + ex.Message; + strError = "针对 " + this.MainForm.FingerprintReaderUrl + " 的 AddItems() 操作失败: " + ExceptionUtil.GetDebugText(ex); return -1; } @@ -4816,6 +4867,40 @@ public static int CreateReaderDetailExcelFile(List xmls, strError = ""; //int nRet = 0; + ExportPatronExcelDialog dlg = new ExportPatronExcelDialog(); + MainForm.SetControlFont(dlg, Program.MainForm.Font, false); + dlg.UiState = Program.MainForm.AppInfo.GetString( + "ReaderSearchForm", + "ExportPatronExcelDialog_uiState", + ""); + + Program.MainForm.AppInfo.LinkFormState(dlg, "ReaderSearchForm_ExportPatronExcelDialog_uiState_state"); + dlg.ShowDialog(Program.MainForm); + + Program.MainForm.AppInfo.SetString( +"ReaderSearchForm", +"ExportPatronExcelDialog_uiState", +dlg.UiState); + + if (dlg.DialogResult == System.Windows.Forms.DialogResult.Cancel) + { + strError = "放弃操作"; + return 0; + } + + string strTimeRange = ""; + + try + { + strTimeRange = GetTimeRange(dlg.ChargingHistoryDateRange); + } + catch (Exception ex) + { + strError = "日期范围字符串 '" + dlg.ChargingHistoryDateRange + "' 格式不合法: " + ex.Message; + return -1; + } + +#if NO // 询问文件名 SaveFileDialog dlg = new SaveFileDialog(); @@ -4830,6 +4915,7 @@ public static int CreateReaderDetailExcelFile(List xmls, if (dlg.ShowDialog() != DialogResult.OK) return 0; +#endif XLWorkbook doc = null; @@ -4882,28 +4968,78 @@ public static int CreateReaderDetailExcelFile(List xmls, return -1; } + string strBarcode = DomUtil.GetElementText(dom.DocumentElement, "barcode"); + // - // - OutputReaderInfo(sheet, - dom, - nReaderIndex, - ref nRowIndex, - ref column_max_chars); + if (dlg.ExportReaderInfo) + { + OutputReaderInfo(sheet, + dom, + nReaderIndex, + ref nRowIndex, + ref column_max_chars); + } // 输出在借册表格 - OutputBorrows(sheet, - dom, - procGetBiblioSummary, - bAdvanceXml, - ref nRowIndex, - ref column_max_chars); + if (dlg.ExportBorrowInfo) + { + OutputBorrows(sheet, + dom, + procGetBiblioSummary, + bAdvanceXml, + ref nRowIndex, + ref column_max_chars); + } // 输出违约金表格 - OutputOverdues(sheet, - dom, - procGetBiblioSummary, - ref nRowIndex, - ref column_max_chars); + if (dlg.ExportOverdueInfo) + { + OutputOverdues(sheet, + dom, + procGetBiblioSummary, + ref nRowIndex, + ref column_max_chars); + } + + if (dlg.ExportChargingHistory) + { + LibraryChannel channel = Program.MainForm.GetChannel(); + try + { + ChargingHistoryLoader history_loader = new ChargingHistoryLoader(); + history_loader.Channel = channel; + history_loader.Stop = stop; + history_loader.PatronBarcode = strBarcode; + history_loader.TimeRange = strTimeRange; + history_loader.Actions = "return,lost"; + history_loader.Order = "descending"; + + CacheableBiblioLoader summary_loader = new CacheableBiblioLoader(); + summary_loader.Channel = channel; + summary_loader.Stop = stop; + summary_loader.Format = "summary"; + summary_loader.GetBiblioInfoStyle = GetBiblioInfoStyle.None; + // summary_loader.RecPaths = biblio_recpaths; + + // 输出借阅历史表格 + OutputBorrowHistory(sheet, + dom, + history_loader, + // this.MainForm.GetBiblioSummary, + summary_loader, + ref nRowIndex, + ref column_max_chars); + } + catch (Exception ex) + { + strError = "输出借阅历史时出现异常: " + ex.Message; + return -1; + } + finally + { + Program.MainForm.ReturnChannel(channel); + } + } nRowIndex++; // 读者之间的空行 @@ -4969,6 +5105,207 @@ public static int CreateReaderDetailExcelFile(List xmls, return 1; } + + // return: + // -1 出错 + // 0 用户中断 + // 1 成功 + public int ExportChargingHistoryToItemSearchForm(List reader_barcodes, + out string strError) + { + strError = ""; + //int nRet = 0; + + ItemSearchForm form = this.MainForm.OpenItemSearchForm("item"); + form.Enabled = false; + + stop.Style = StopStyle.EnableHalfStop; + stop.OnStop += new StopEventHandler(this.DoStop); + stop.Initial("导出读者借阅历史 ..."); + stop.BeginLoop(); + + EnableControls(false); + this.listView_records.Enabled = false; + try + { + if (stop != null) + stop.SetProgressRange(0, reader_barcodes.Count); + + int nReaderIndex = 0; + foreach (string strBarcode in reader_barcodes) + { + Application.DoEvents(); // 出让界面控制权 + + if (stop != null && stop.State != 0) + { + strError = "用户中断"; + return 0; + } + + if (string.IsNullOrEmpty(strBarcode) == true) + continue; + + // 获得读者记录 + byte[] baTimestamp = null; + string strOutputRecPath = ""; + + stop.SetMessage("正在处理读者记录 " + strBarcode + " ..."); + + string[] results = null; + long lRet = Channel.GetReaderInfo( + stop, + strBarcode, + "advancexml", + out results, + out strOutputRecPath, + out baTimestamp, + out strError); + if (lRet == -1) + return -1; + + if (lRet == 0) + return -1; + + if (lRet > 1) // 不可能发生吧? + { + strError = "读者证条码号 " + strBarcode + " 命中记录 " + lRet.ToString() + " 条,放弃装入读者记录。\r\n\r\n注意这是一个严重错误,请系统管理员尽快排除。"; + return -1; + } + if (results == null || results.Length < 1) + { + strError = "返回的results不正常。"; + return -1; + } + string strXml = results[0]; + + XmlDocument dom = new XmlDocument(); + try + { + dom.LoadXml(strXml); + } + catch (Exception ex) + { + strError = "装载读者记录 XML 到 DOM 时发生错误: " + ex.Message; + return -1; + } + + try + { + ChargingHistoryLoader history_loader = new ChargingHistoryLoader(); + history_loader.Channel = this.Channel; + history_loader.Stop = this.stop; + history_loader.PatronBarcode = strBarcode; + history_loader.TimeRange = "~"; // strTimeRange; + history_loader.Actions = "return,lost"; + history_loader.Order = "descending"; + + ItemBarcodeLoader barcode_loader = new ItemBarcodeLoader(); + barcode_loader.Channel = this.Channel; + barcode_loader.Stop = this.stop; + + // 输出借阅历史表格 + int nRet = OutputBorrowHistory(form, + dom, + history_loader, + barcode_loader, + out strError); + if (nRet == -1) + return -1; + } + catch (Exception ex) + { + strError = "输出借阅历史时出现异常: " + ex.Message; + return -1; + } + + nReaderIndex++; + if (stop != null) + stop.SetProgressValue(nReaderIndex); + } + } + finally + { + EnableControls(true); + this.listView_records.Enabled = true; + + stop.EndLoop(); + stop.OnStop -= new StopEventHandler(this.DoStop); + stop.Initial(""); + stop.HideProgress(); + stop.Style = StopStyle.None; + + form.Enabled = true; + } + return 1; + } + + // 将一个读者的操作历史输出到实体查询窗 + // parameters: + static int OutputBorrowHistory( + ItemSearchForm form, + XmlDocument reader_dom, + ChargingHistoryLoader history_loader, + ItemBarcodeLoader barcode_loader, + out string strError) + { + strError = ""; + + if (StringUtil.CompareVersion(Program.MainForm.ServerVersion, "2.67") < 0) + { + strError = "输出操作历史到实体查询窗要求 dp2library 为 2.67 或以上版本"; + return -1; + } + + List barcodes = new List(); + foreach (ChargingItemWrapper wrapper in history_loader) + { + ChargingItem item = wrapper.Item; + + string strItemBarcode = item.ItemBarcode; +#if NO + ChargingItem rel = wrapper.RelatedItem; + string strBorrowDate = rel == null ? "" : rel.OperTime; + string strBorrowPeriod = GetDisplayTimePeriodString(rel == null ? "" : rel.Period); + string strReturnDate = item.OperTime; +#endif + + barcodes.Add(strItemBarcode); + } + + string strTempFileName = Program.MainForm.GetTempFileName("exphis"); + try + { + int nCount = 0; + using (StreamWriter sw = new StreamWriter(strTempFileName, false, Encoding.UTF8)) + { + barcode_loader.Barcodes = barcodes; + foreach (EntityItem info in barcode_loader) + { + string strRecPath = info.RecPath; + if (string.IsNullOrEmpty(strRecPath) == true) + continue; // TODO: 是否要警告? + sw.WriteLine(strRecPath); + nCount++; + } + } + + if (nCount > 0) + { + int nRet = form.ImportFromRecPathFile(strTempFileName, + "", + out strError); + if (nRet == -1) + return -1; + } + + return 0; + } + finally + { + File.Delete(strTempFileName); + } + } + // return: // -1 出错 // 0 用户中断 @@ -4980,6 +5317,40 @@ public int CreateReaderDetailExcelFile(List reader_barcodes, strError = ""; //int nRet = 0; + ExportPatronExcelDialog dlg = new ExportPatronExcelDialog(); + MainForm.SetControlFont(dlg, this.Font, false); + dlg.UiState = this.MainForm.AppInfo.GetString( + "ReaderSearchForm", + "ExportPatronExcelDialog_uiState", + ""); + + this.MainForm.AppInfo.LinkFormState(dlg, "ReaderSearchForm_ExportPatronExcelDialog_uiState_state"); + dlg.ShowDialog(this); + + this.MainForm.AppInfo.SetString( +"ReaderSearchForm", +"ExportPatronExcelDialog_uiState", +dlg.UiState); + + if (dlg.DialogResult == System.Windows.Forms.DialogResult.Cancel) + { + strError = "放弃操作"; + return 0; + } + + string strTimeRange = ""; + + try + { + strTimeRange = GetTimeRange(dlg.ChargingHistoryDateRange); + } + catch (Exception ex) + { + strError = "日期范围字符串 '" + dlg.ChargingHistoryDateRange + "' 格式不合法: " + ex.Message; + return -1; + } + +#if NO // 询问文件名 SaveFileDialog dlg = new SaveFileDialog(); @@ -4994,9 +5365,9 @@ public int CreateReaderDetailExcelFile(List reader_barcodes, if (dlg.ShowDialog() != DialogResult.OK) return 0; +#endif XLWorkbook doc = null; - try { doc = new XLWorkbook(XLEventTracking.Disabled); @@ -5040,7 +5411,10 @@ public int CreateReaderDetailExcelFile(List reader_barcodes, Application.DoEvents(); // 出让界面控制权 if (stop != null && stop.State != 0) + { + strError = "用户中断"; return 0; + } if (string.IsNullOrEmpty(strBarcode) == true) continue; @@ -5090,27 +5464,70 @@ public int CreateReaderDetailExcelFile(List reader_barcodes, } // - // - OutputReaderInfo(sheet, - dom, - nReaderIndex, - ref nRowIndex, - ref column_max_chars); + if (dlg.ExportReaderInfo) + { + OutputReaderInfo(sheet, + dom, + nReaderIndex, + ref nRowIndex, + ref column_max_chars); + } // 输出在借册表格 - OutputBorrows(sheet, - dom, - this.MainForm.GetBiblioSummary, - true, - ref nRowIndex, - ref column_max_chars); + if (dlg.ExportBorrowInfo) + { + OutputBorrows(sheet, + dom, + this.MainForm.GetBiblioSummary, + true, + ref nRowIndex, + ref column_max_chars); + } // 输出违约金表格 - OutputOverdues(sheet, - dom, - this.MainForm.GetBiblioSummary, - ref nRowIndex, - ref column_max_chars); + if (dlg.ExportOverdueInfo) + { + OutputOverdues(sheet, + dom, + this.MainForm.GetBiblioSummary, + ref nRowIndex, + ref column_max_chars); + } + + if (dlg.ExportChargingHistory) + { + try + { + ChargingHistoryLoader history_loader = new ChargingHistoryLoader(); + history_loader.Channel = this.Channel; + history_loader.Stop = this.stop; + history_loader.PatronBarcode = strBarcode; + history_loader.TimeRange = strTimeRange; + history_loader.Actions = "return,lost"; + history_loader.Order = "descending"; + + CacheableBiblioLoader summary_loader = new CacheableBiblioLoader(); + summary_loader.Channel = this.Channel; + summary_loader.Stop = this.stop; + summary_loader.Format = "summary"; + summary_loader.GetBiblioInfoStyle = GetBiblioInfoStyle.None; + // summary_loader.RecPaths = biblio_recpaths; + + // 输出借阅历史表格 + OutputBorrowHistory(sheet, + dom, + history_loader, + // this.MainForm.GetBiblioSummary, + summary_loader, + ref nRowIndex, + ref column_max_chars); + } + catch (Exception ex) + { + strError = "输出借阅历史时出现异常: " + ex.Message; + return -1; + } + } nRowIndex++; // 读者之间的空行 @@ -5156,7 +5573,6 @@ public int CreateReaderDetailExcelFile(List reader_barcodes, // column.Width = (double)list.Columns[i].Width / char_width; // Math.Min(MAX_CHARS, nChars); } } - } finally { @@ -5191,6 +5607,28 @@ public int CreateReaderDetailExcelFile(List reader_barcodes, return 1; } + // 将 20120101 - 20151231 这样的日期字符串形态转换为 SearchCharging() API 能接受的时间范围字符串形态 + static string GetTimeRange(string strText) + { + string strStart = ""; + string strEnd = ""; + StringUtil.ParseTwoPart(strText, "-", out strStart, out strEnd); + strStart = strStart.Trim(); + strEnd = strEnd.Trim(); + if (string.IsNullOrEmpty(strStart) == false) + { + DateTime time = DateTimeUtil.Long8ToDateTime(strStart); + strStart = time.ToString("G"); + } + if (string.IsNullOrEmpty(strEnd) == false) + { + DateTime time = DateTimeUtil.Long8ToDateTime(strEnd); + strEnd = time.AddDays(1).ToString("G"); // 注意 ~ 后面是 < 的意思,所以要放到第二天的零点 + } + + return strStart + "~" + strEnd; + } + static string GetContactString(XmlDocument dom) { string strTel = DomUtil.GetElementText(dom.DocumentElement, @@ -5336,7 +5774,12 @@ static void OutputReaderInfo(IXLWorksheet sheet, cells.Add(cell); } { - IXLCell cell = sheet.Cell(nRowIndex, nColIndex).SetValue(subcols[line]); + string strText = subcols[line]; + + // 最大字符数 + SetMaxChars(ref column_max_chars, nColIndex - 1, strText.Length); + + IXLCell cell = sheet.Cell(nRowIndex, nColIndex).SetValue(strText); cell.Style.Alignment.WrapText = true; cell.Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; //cell.Style.Font.FontName = strFontName; @@ -5362,8 +5805,6 @@ static void OutputReaderInfo(IXLWorksheet sheet, nRowIndex = nFirstRow; { - - List subtitles = new List(); subtitles.Add("状态"); subtitles.Add("有效期"); @@ -5392,7 +5833,11 @@ static void OutputReaderInfo(IXLWorksheet sheet, cells.Add(cell); } { - IXLCell cell = sheet.Cell(nRowIndex, nColIndex).SetValue(subcols[line]); + string strText = subcols[line]; + // 最大字符数 + SetMaxChars(ref column_max_chars, nColIndex - 1, strText.Length); + + IXLCell cell = sheet.Cell(nRowIndex, nColIndex).SetValue(strText); cell.Style.Alignment.WrapText = true; cell.Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; if (line == 0) @@ -5411,9 +5856,165 @@ static void OutputReaderInfo(IXLWorksheet sheet, nRowIndex++; } } + } + + // parameters: + // bAdvanceXml 是否为 AdvanceXml 情况 + static void OutputBorrowHistory( + IXLWorksheet sheet, + XmlDocument reader_dom, + ChargingHistoryLoader history_loader, + CacheableBiblioLoader summary_loader, + // Delegate_GetBiblioSummary procGetBiblioSummary, + ref int nRowIndex, + ref List column_max_chars) + { + int nStartRow = nRowIndex; + + OutputTitleLine(sheet, +ref nRowIndex, +"--- 借阅历史 --- " + history_loader.GetCount(), +XLColor.DarkGreen, +2, +7); + + List cells = new List(); + + // 册信息若干行的标题 + { + List titles = new List(); + titles.Add("序号"); + titles.Add("册条码号"); + titles.Add("书目摘要"); + titles.Add("借阅时间"); + titles.Add("期限"); + titles.Add("借阅操作者"); + titles.Add("还书时间"); + titles.Add("还书操作者"); + + int nColIndex = 2; + foreach (string s in titles) + { + IXLCell cell = sheet.Cell(nRowIndex, nColIndex).SetValue(s); + cell.Style.Alignment.WrapText = true; + cell.Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + cell.Style.Font.Bold = true; + cell.Style.Font.FontColor = XLColor.DarkGray; + //cell.Style.Font.FontName = strFontName; + //cell.Style.Alignment.Horizontal = alignments[nColIndex - 1]; + nColIndex++; + cells.Add(cell); + } + nRowIndex++; + } + + List item_barcodes = new List(); + List points = new List(); + int nItemIndex = 0; + foreach (ChargingItemWrapper wrapper in history_loader) + { + ChargingItem item = wrapper.Item; + ChargingItem rel = wrapper.RelatedItem; + + string strItemBarcode = item.ItemBarcode; + string strBorrowDate = rel == null ? "" : rel.OperTime; + string strBorrowPeriod = GetDisplayTimePeriodString(rel == null ? "" : rel.Period); + string strReturnDate = item.OperTime; + //string strRecPath = borrow.GetAttribute("recPath"); + //string strIsOverdue = borrow.GetAttribute("isOverdue"); + //bool bIsOverdue = DomUtil.IsBooleanTrue(strIsOverdue, false); + //string strOverdueInfo = borrow.GetAttribute("overdueInfo1"); + + string strSummary = ""; +#if NO + if (string.IsNullOrEmpty(strItemBarcode) == false + && string.IsNullOrEmpty(strSummary) == true) + { + string strError = ""; + int nRet = procGetBiblioSummary(strItemBarcode, + "", // strConfirmItemRecPath, + false, + out strSummary, + out strError); + if (nRet == -1) + strSummary = strError; + } +#endif + item_barcodes.Add("@itemBarcode:" + strItemBarcode); + + List cols = new List(); + cols.Add((nItemIndex + 1).ToString()); + cols.Add(strItemBarcode); + cols.Add(strSummary); + + cols.Add(strBorrowDate); + cols.Add(strBorrowPeriod); + cols.Add(rel == null ? "" : rel.Operator); + + cols.Add(strReturnDate); + cols.Add(item.Operator); + + int nColIndex = 2; + points.Add(new Point(nColIndex + 2, nRowIndex)); + foreach (string s in cols) + { + // 统计最大字符数 + SetMaxChars(ref column_max_chars, nColIndex - 1, GetCharWidth(s)); + + IXLCell cell = null; + if (nColIndex == 2) + { + cell = sheet.Cell(nRowIndex, nColIndex).SetValue(nItemIndex + 1); + cell.Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; + } + else + cell = sheet.Cell(nRowIndex, nColIndex).SetValue(s); + cell.Style.Alignment.WrapText = true; + cell.Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + //cell.Style.Font.FontName = strFontName; + //cell.Style.Alignment.Horizontal = alignments[nColIndex - 1]; + nColIndex++; + cells.Add(cell); + } + +#if NO + // 超期的行为黄色背景 + if (bIsOverdue) + { + var line = sheet.Range(nRowIndex, 2, nRowIndex, 2 + cols.Count - 1); + line.Style.Fill.BackgroundColor = XLColor.Yellow; + } +#endif + + nItemIndex++; + nRowIndex++; + } + + // 加入书目摘要 + summary_loader.RecPaths = item_barcodes; + int i = 0; + foreach (BiblioItem biblio in summary_loader) + { + Point point = points[i]; + int nColIndex = point.X; + // 统计最大字符数 + SetMaxChars(ref column_max_chars, nColIndex - 1, GetCharWidth(biblio.Content)); + + IXLCell cell = null; + cell = sheet.Cell(point.Y, nColIndex).SetValue(biblio.Content); + cell.Style.Alignment.WrapText = true; + cell.Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; + i++; + } + + // 册信息标题下的虚线 + var rngData = sheet.Range(cells[0], cells[cells.Count - 1]); + rngData.FirstRow().Style.Border.TopBorder = XLBorderStyleValues.Dotted; + + sheet.Rows(nStartRow + 1, nRowIndex - 1).Group(); } // TODO: 是否超期列也应能从 returningDate 计算出,以适应非 AdvanceXml 的情况 diff --git a/dp2Circulation/SearchForms/BiblioSearchForm.cs b/dp2Circulation/SearchForms/BiblioSearchForm.cs index e525dd7ea..3f1b65d26 100644 --- a/dp2Circulation/SearchForms/BiblioSearchForm.cs +++ b/dp2Circulation/SearchForms/BiblioSearchForm.cs @@ -4653,7 +4653,8 @@ int ExportToItemSearchForm( ItemSearchForm form = this.MainForm.OpenItemSearchForm(strDbType); nRet = form.ImportFromRecPathFile(strTempFileName, - out strError); + "clear", + out strError); if (nRet == -1) return -1; return 0; diff --git a/dp2Circulation/SearchForms/ItemSearchForm.cs b/dp2Circulation/SearchForms/ItemSearchForm.cs index 6d2fb1055..193d095c4 100644 --- a/dp2Circulation/SearchForms/ItemSearchForm.cs +++ b/dp2Circulation/SearchForms/ItemSearchForm.cs @@ -95,7 +95,7 @@ public ItemSearchForm() prop.GetColumnTitles += new GetColumnTitlesEventHandler(prop_GetColumnTitles); prop.CompareColumn -= new CompareEventHandler(prop_CompareColumn); - prop.CompareColumn += new CompareEventHandler(prop_CompareColumn); + prop.CompareColumn += new CompareEventHandler(prop_CompareColumn); } void prop_CompareColumn(object sender, CompareEventArgs e) @@ -483,7 +483,7 @@ void FillFromList() this.comboBox_from.Items.Add(from); } // this.comboBox_from.Items.AddRange(GetFromList()); - + } private void ItemSearchForm_FormClosing(object sender, FormClosingEventArgs e) @@ -913,7 +913,7 @@ public int DoSearch(bool bOutputKeyCount, this.textBox_queryWord.Text, this.MaxSearchResultCount, this.comboBox_from.Text, - strMatchStyle, + strMatchStyle, this.Lang, null, "", @@ -1297,7 +1297,6 @@ int FillBrowseList( return 0; } } - } finally { @@ -2012,7 +2011,7 @@ private void listView_records_MouseUp(object sender, MouseEventArgs e) menuItem.MenuItems.Add(subMenuItem); // 到种册窗,条码 -// if (this.DbType == "item") + // if (this.DbType == "item") if (string.IsNullOrEmpty(strBarcode) == false) { subMenuItem = new MenuItem("装入" + strOpenStyle + "种册窗,根据册条码号 '" + strBarcode + "'"); @@ -2484,7 +2483,7 @@ void menu_inventory_Click(object sender, EventArgs e) ERROR1: MessageBox.Show(this, strError); } - + // 进行流通操作 int DoCirculation(string strAction, @@ -2516,7 +2515,7 @@ int DoCirculation(string strAction, strOperName = "盘点"; else { - strError = "未知的 strAction 值 '"+strAction+"'"; + strError = "未知的 strAction 值 '" + strAction + "'"; return -1; } @@ -3080,12 +3079,12 @@ void menu_exportToBiblioSearchForm_Click(object sender, EventArgs e) string strText = ""; if (nWarningLineCount > 0) - strText = "有 " + nWarningLineCount.ToString()+ " 行因为相关库浏览格式没有包含父记录 ID 列而被忽略"; + strText = "有 " + nWarningLineCount.ToString() + " 行因为相关库浏览格式没有包含父记录 ID 列而被忽略"; if (nDupCount > 0) { if (string.IsNullOrEmpty(strText) == false) strText += "\r\n\r\n"; - strText += "书目记录有 "+nDupCount.ToString()+" 项重复被忽略"; + strText += "书目记录有 " + nDupCount.ToString() + " 项重复被忽略"; } if (string.IsNullOrEmpty(strText) == false) @@ -3100,7 +3099,7 @@ void menu_exportToBiblioSearchForm_Click(object sender, EventArgs e) void menu_deleteSelectedRecords_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show(this, - "确实要从数据库中删除所选定的 " + this.listView_records.SelectedItems.Count.ToString() + " 个"+this.DbTypeCaption+"记录?\r\n\r\n(OK 删除;Cancel 取消)", + "确实要从数据库中删除所选定的 " + this.listView_records.SelectedItems.Count.ToString() + " 个" + this.DbTypeCaption + "记录?\r\n\r\n(OK 删除;Cancel 取消)", "BiblioSearchForm", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, @@ -3149,7 +3148,7 @@ void menu_deleteSelectedRecords_Click(object sender, EventArgs e) BiblioInfo info = item.BiblioInfo; - Debug.Assert(item.ListViewItem == items[i], ""); + Debug.Assert(item.ListViewItem == items[i], ""); //string strRecPath = ListViewUtil.GetItemText(item, 0); EntityInfo entity = new EntityInfo(); @@ -3169,7 +3168,7 @@ void menu_deleteSelectedRecords_Click(object sender, EventArgs e) entity.RefID = BookItem.GenRefID(); #endif - stop.SetMessage("正在删除"+this.DbTypeCaption+"记录 " + info.RecPath); + stop.SetMessage("正在删除" + this.DbTypeCaption + "记录 " + info.RecPath); string strBiblioRecPath = ""; EntityInfo[] errorinfos = null; @@ -3794,7 +3793,7 @@ void menu_printOrderForm_Click(object sender, EventArgs e) MessageBox.Show(this, strError); } - // 调用打印催询单窗口 + // 调用打印催询单窗口 void menu_printClaimForm_Click(object sender, EventArgs e) { string strError = ""; @@ -3975,10 +3974,10 @@ int ExportToItemRecPathFile( bAppend = false; // 创建文件 - using(StreamWriter sw = new StreamWriter(strFilename, + using (StreamWriter sw = new StreamWriter(strFilename, bAppend, // append System.Text.Encoding.UTF8)) - { + { stop.Style = StopStyle.EnableHalfStop; stop.OnStop += new StopEventHandler(this.DoStop); stop.Initial("正在导出已验收的册记录路径 ..."); @@ -4458,7 +4457,7 @@ void menu_createCallNumber_Click(object sender, EventArgs e) this.EnableControls(true); } - MessageBox.Show(this, "共处理 "+nCount.ToString()+" 个册记录"); + MessageBox.Show(this, "共处理 " + nCount.ToString() + " 个册记录"); return; ERROR1: MessageBox.Show(this, strError); @@ -5043,8 +5042,7 @@ void menu_importFromBarcodeFile_Click(object sender, EventArgs e) this.listView_records.Items.Add(item); - FillLineByBarcode( - strBarcode, item); + FillLineByBarcode(strBarcode, item); items.Add(item); } @@ -5081,14 +5079,13 @@ void menu_importFromBarcodeFile_Click(object sender, EventArgs e) MessageBox.Show(this, strError); } - - // 从记录路径文件中导入 void menu_importFromRecPathFile_Click(object sender, EventArgs e) { string strError = ""; int nRet = ImportFromRecPathFile(null, + "clear", out strError); if (nRet == -1) goto ERROR1; @@ -5839,7 +5836,7 @@ void menu_saveBiblioRecordToMarcFile_Click(object sender, EventArgs e) MessageBox.Show(this, strError); } - // 保存选择的行中的有路径的部分行 到书目库记录路径文件 + // 保存选择的行中的有路径的部分行 到书目库记录路径文件 void menu_saveToBiblioRecordPathFile_Click(object sender, EventArgs e) { string strError = ""; @@ -6085,10 +6082,10 @@ public int ExportToRecPathFile(string strFilename, bAppend = false; // 创建文件 - using(StreamWriter sw = new StreamWriter(strFilename, + using (StreamWriter sw = new StreamWriter(strFilename, bAppend, // append System.Text.Encoding.UTF8)) - { + { stop.Style = StopStyle.EnableHalfStop; stop.OnStop += new StopEventHandler(this.DoStop); stop.Initial("正在导出记录路径 ..."); @@ -6244,10 +6241,10 @@ void menu_exportTextFile_Click(object sender, EventArgs e) bAppend = false; // 创建文件 - using(StreamWriter sw = new StreamWriter(this.ExportTextFilename, + using (StreamWriter sw = new StreamWriter(this.ExportTextFilename, bAppend, // append System.Text.Encoding.UTF8)) - { + { Cursor oldCursor = this.Cursor; this.Cursor = Cursors.WaitCursor; @@ -6415,7 +6412,7 @@ private void ToolStripMenuItem_searchKeys_Click(object sender, EventArgs e) } // 将 ItemQueryParam 中的信息恢复到面板中 - void QueryToPanel(ItemQueryParam query, + void QueryToPanel(ItemQueryParam query, bool bClearList = true) { Cursor oldCursor = this.Cursor; @@ -7119,7 +7116,7 @@ void menu_quickMarcQueryRecords_Click(object sender, EventArgs e) stop.Style = StopStyle.EnableHalfStop; stop.OnStop += new StopEventHandler(this.DoStop); - stop.Initial("正在针对"+this.DbTypeCaption+"记录执行 C# 脚本 ..."); + stop.Initial("正在针对" + this.DbTypeCaption + "记录执行 C# 脚本 ..."); stop.BeginLoop(); this.EnableControls(false); @@ -7610,7 +7607,7 @@ private void dp2QueryControl1_GetList(object sender, GetListEventArgs e) private void dp2QueryControl1_ViewXml(object sender, EventArgs e) { - string strError = ""; + string strError = ""; string strQueryXml = ""; int nRet = dp2QueryControl1.BuildQueryXml( @@ -7643,7 +7640,7 @@ private void dp2QueryControl1_ViewXml(object sender, EventArgs e) private void dp2QueryControl1_AppendMenu(object sender, AppendMenuEventArgs e) { - MenuItem menuItem = null; + MenuItem menuItem = null; menuItem = new MenuItem("检索(&S)"); menuItem.Click += new System.EventHandler(this.menu_logicSearch_Click); diff --git a/dp2Circulation/SearchForms/ItemSearchFormBase.cs b/dp2Circulation/SearchForms/ItemSearchFormBase.cs index 0f00aa830..f31fdc74e 100644 --- a/dp2Circulation/SearchForms/ItemSearchFormBase.cs +++ b/dp2Circulation/SearchForms/ItemSearchFormBase.cs @@ -255,7 +255,7 @@ public int GetColumnText( if (string.IsNullOrEmpty(strItemDbName) == true) { - strError = "从(来自事项第一列的)记录路径 '"+strRecPath+"' 获得库名时出错"; + strError = "从(来自事项第一列的)记录路径 '" + strRecPath + "' 获得库名时出错"; return -1; } @@ -280,9 +280,11 @@ public int GetColumnText( /// 从记录路径文件导入 /// /// 文件名 + /// 风格。"clear" 表示加入新内容前试图清除 list 中已有的内容,会出现对话框警告。如果没有这个值,则追加到现有内容后面 /// 返回出错信息 /// -1: 出错 0: 放弃处理 1:正常结束 public int ImportFromRecPathFile(string strFileName, + string strStyle, out string strError) { strError = ""; @@ -334,7 +336,8 @@ public int ImportFromRecPathFile(string strFileName, List items = new List(); - if (this._listviewRecords.Items.Count > 0) + if (this._listviewRecords.Items.Count > 0 + && StringUtil.IsInList("clear", strStyle) == true) { DialogResult result = MessageBox.Show(this, "导入前是否要清除命中记录列表中的现有的 " + this._listviewRecords.Items.Count.ToString() + " 行?\r\n\r\n(如果不清除,则新导入的行将追加在已有行后面)\r\n(Yes 清除;No 不清除(追加);Cancel 放弃导入)", @@ -767,7 +770,6 @@ internal int _fillBiblioSummaryColumn(List items, biblio_recpaths.Add(strBiblioRecPath); } - CacheableBiblioLoader loader = new CacheableBiblioLoader(); loader.Channel = this.Channel; loader.Stop = this.stop; @@ -1026,8 +1028,6 @@ public virtual int GetBiblioRecPath(ListViewItem item, return 1; } - - internal void FillLineByBarcode( string strBarcode, ListViewItem item) diff --git a/dp2Circulation/dp2Circulation.csproj b/dp2Circulation/dp2Circulation.csproj index 5d08e0b2d..e8a2f2eed 100644 --- a/dp2Circulation/dp2Circulation.csproj +++ b/dp2Circulation/dp2Circulation.csproj @@ -51,7 +51,7 @@ dp2 V2 true publish.htm - 8 + 9 2.10.0.%2a false true @@ -587,6 +587,12 @@ ChangeStateActionControl.cs + + Form + + + ExportPatronExcelDialog.cs + Form @@ -726,7 +732,7 @@ CompareReaderForm.cs - + Form @@ -1644,6 +1650,9 @@ ChangeStateActionControl.cs + + ExportPatronExcelDialog.cs + SelectPatronDialog.cs @@ -1720,8 +1729,8 @@ Designer CompareReaderForm.cs - - CopyrightDlg.cs + + AboutDlg.cs Designer diff --git a/dp2Installer/dp2Installer.csproj b/dp2Installer/dp2Installer.csproj index ec4e3895f..39dd67b9e 100644 --- a/dp2Installer/dp2Installer.csproj +++ b/dp2Installer/dp2Installer.csproj @@ -34,7 +34,7 @@ dp2 V2 true publish.htm - 67 + 74 1.1.0.%2a false true @@ -60,10 +60,10 @@ 4 - E9B4F6909843B92D17E022B28977DA914E4E2598 + 6100BCFAC388EACAF7E22368B140127C1FE348AC - dp2Installer_TemporaryKey.pfx + dp2Installer_1_TemporaryKey.pfx true @@ -137,6 +137,7 @@ + PreserveNewest diff --git a/dp2LibraryXE/dp2LibraryXE.csproj b/dp2LibraryXE/dp2LibraryXE.csproj index 554163a51..2a44598bd 100644 --- a/dp2LibraryXE/dp2LibraryXE.csproj +++ b/dp2LibraryXE/dp2LibraryXE.csproj @@ -36,7 +36,7 @@ dp2 V2 true publish.htm - 53 + 55 1.1.0.%2a false true From 2fae34a12061c43637f005d5d66e0e1d73dfee92 Mon Sep 17 00:00:00 2001 From: XieTao Date: Thu, 7 Jan 2016 21:09:13 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E5=AE=8C=E5=96=84=20dp2library=20Login()?= =?UTF-8?q?=20API=20=E4=B8=AD=E9=AA=8C=E8=AF=81=E5=89=8D=E7=AB=AF=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppCirculation.cs | 1 - .../LibraryApplication.cs | 12 ++++++------ .../LibraryReplication.cs | 1 + .../InstallOpacParamDlg.cs | 8 ++++---- .../BatchTask/BatchTask.cs | 2 +- .../OpacApplication.cs | 13 ++++++++++++- DigitalPlatform.OPAC.Server/SessionInfo.cs | 5 +++-- DigitalPlatform.OPAC.Web/LoginControl.cs | 6 +++--- ZipUtil.exe | Bin 9216 -> 9216 bytes dp2Catalog/MainForm/FirstRunDialog.cs | 3 ++- .../MainForm/FirstRunDialog.designer.cs | 3 ++- dp2Catalog/dp2Catalog.csproj | 2 +- .../MainForm/FirstRunDialog.Designer.cs | 2 +- dp2Circulation/MainForm/FirstRunDialog.cs | 12 +++++------- dp2Circulation/dp2Circulation.csproj | 2 +- dp2Installer/MainForm.cs | 2 ++ dp2Installer/dp2Installer.csproj | 2 +- dp2Installer/opac_app/Login.aspx.cs | 2 +- dp2LibraryConsole/Instance.cs | 2 ++ dp2LibraryXE/MainForm.cs | 1 - dp2LibraryXE/opac_app/Login.aspx.cs | 2 +- dp2OPAC/Login.aspx.cs | 2 +- dp2ZServer/Host.cs | 3 ++- dp2ZServer/Session.cs | 2 +- dp2ZServer/UnionCatalogService.cs | 2 +- 25 files changed, 54 insertions(+), 38 deletions(-) diff --git a/DigitalPlatform.LibraryServer/AppCirculation.cs b/DigitalPlatform.LibraryServer/AppCirculation.cs index d388b3f19..a82c167c3 100644 --- a/DigitalPlatform.LibraryServer/AppCirculation.cs +++ b/DigitalPlatform.LibraryServer/AppCirculation.cs @@ -2402,7 +2402,6 @@ LibraryServerResult GetReaderRecord( } } - nRet = LibraryApplication.LoadToDom(strReaderXml, out readerdom, out strError); diff --git a/DigitalPlatform.LibraryServer/LibraryApplication.cs b/DigitalPlatform.LibraryServer/LibraryApplication.cs index a14f9f900..8d6cc11c8 100644 --- a/DigitalPlatform.LibraryServer/LibraryApplication.cs +++ b/DigitalPlatform.LibraryServer/LibraryApplication.cs @@ -779,25 +779,25 @@ public int LoadCfg( { string strList = DomUtil.GetAttr(node, "patronAdditionalFroms"); if (string.IsNullOrEmpty(strList) == false) - { this.PatronAdditionalFroms = StringUtil.SplitList(strList); - } + else + this.PatronAdditionalFroms = new List(); } { string strList = DomUtil.GetAttr(node, "patronAdditionalFields"); if (string.IsNullOrEmpty(strList) == false) - { this.PatronAdditionalFields = StringUtil.SplitList(strList); - } + else + this.PatronAdditionalFields = new List(); } { string strList = DomUtil.GetAttr(node, "patronReplicationFields"); if (string.IsNullOrEmpty(strList) == false) - { this.PatronReplicationFields = StringUtil.SplitList(strList); - } + else + this.PatronReplicationFields = StringUtil.SplitList(strList); } int v = 0; diff --git a/DigitalPlatform.LibraryServer/LibraryReplication.cs b/DigitalPlatform.LibraryServer/LibraryReplication.cs index 028571a00..54b16130a 100644 --- a/DigitalPlatform.LibraryServer/LibraryReplication.cs +++ b/DigitalPlatform.LibraryServer/LibraryReplication.cs @@ -1089,6 +1089,7 @@ void Channel_BeforeLogin(object sender, BeforeLoginEventArgs e) e.Password = m_strPassword; e.Parameters = ""; + e.Parameters += ",client=dp2library|" + LibraryApplication.Version; e.LibraryServerUrl = m_strUrl; } diff --git a/DigitalPlatform.OPAC.Install/InstallOpacParamDlg.cs b/DigitalPlatform.OPAC.Install/InstallOpacParamDlg.cs index 76c8ce218..1b743e00a 100644 --- a/DigitalPlatform.OPAC.Install/InstallOpacParamDlg.cs +++ b/DigitalPlatform.OPAC.Install/InstallOpacParamDlg.cs @@ -289,7 +289,7 @@ int DetectManageUser(out string strError) channel.Url = this.textBox_dp2LibraryUrl.Text; // Debug.Assert(false, ""); - string strParameters = "location=#setup,type=worker"; + string strParameters = "location=#setup,type=worker,client=dp2OPAC|"; long nRet = channel.Login(this.textBox_manageUserName.Text, this.textBox_managePassword.Text, strParameters, @@ -358,7 +358,7 @@ void channel_BeforeLogin(object sender, BeforeLoginEventArgs e) e.UserName = this.SupervisorUserName; e.Password = this.SupervisorPassword; - e.Parameters = "location=#setup,type=worker"; + e.Parameters = "location=#setup,type=worker,client=dp2OPAC|"; if (String.IsNullOrEmpty(e.UserName) == false) return; // 立即返回, 以便作第一次 不出现 对话框的自动登录 @@ -396,7 +396,7 @@ void channel_BeforeLogin(object sender, BeforeLoginEventArgs e) e.UserName = dlg.UserName; e.Password = dlg.Password; e.SavePasswordShort = dlg.SavePasswordShort; - e.Parameters = "location=#setup,type=worker"; + e.Parameters = "location=#setup,type=worker,client=dp2OPAC|"; e.SavePasswordLong = dlg.SavePasswordLong; e.LibraryServerUrl = dlg.ServerUrl; @@ -657,7 +657,7 @@ int GetLibraryDataDir(out string strDataDir, out string strError) channel.Url = this.textBox_dp2LibraryUrl.Text; // Debug.Assert(false, ""); - string strParameters = "location=#setup,type=worker"; + string strParameters = "location=#setup,type=worker,client=dp2OPAC|"; long nRet = channel.Login(this.textBox_manageUserName.Text, this.textBox_managePassword.Text, strParameters, diff --git a/DigitalPlatform.OPAC.Server/BatchTask/BatchTask.cs b/DigitalPlatform.OPAC.Server/BatchTask/BatchTask.cs index bed2c1f2e..286b4ae42 100644 --- a/DigitalPlatform.OPAC.Server/BatchTask/BatchTask.cs +++ b/DigitalPlatform.OPAC.Server/BatchTask/BatchTask.cs @@ -348,7 +348,7 @@ void Channel_BeforeLogin(object sender, BeforeLoginEventArgs e) e.UserName = this.Dp2UserName; e.Password = this.Dp2Password; - e.Parameters = "location=#opac,type=worker"; + e.Parameters = "location=#opac,type=worker,client=dp2OPAC|" + OpacApplication.ClientVersion; e.LibraryServerUrl = this.App.WsUrl; } diff --git a/DigitalPlatform.OPAC.Server/OpacApplication.cs b/DigitalPlatform.OPAC.Server/OpacApplication.cs index b54422038..e842f5994 100644 --- a/DigitalPlatform.OPAC.Server/OpacApplication.cs +++ b/DigitalPlatform.OPAC.Server/OpacApplication.cs @@ -344,6 +344,11 @@ public bool IsNewStyle } } + /// + /// 前端,也就是 dp2OPAC 的版本号 + /// + public static string ClientVersion { get; set; } + public int Load( bool bReload, string strDataDir, @@ -353,6 +358,8 @@ public int Load( strError = ""; int nRet = 0; + ClientVersion = Assembly.GetAssembly(typeof(OpacApplication)).GetName().Version.ToString(); + this.m_lock.AcquireWriterLock(m_nLockTimeout); try { @@ -682,7 +689,10 @@ public int Load( { // var version = System.Reflection.Assembly.GetAssembly(typeof(OpacApplication)).GetName().Version; - app.WriteErrorLog("opac service 成功启动。版本: " + System.Reflection.Assembly.GetAssembly(typeof(OpacApplication)).GetName().ToString()); + app.WriteErrorLog("opac service 成功启动。版本: " + // + System.Reflection.Assembly.GetAssembly(typeof(OpacApplication)).GetName().ToString() + + ClientVersion + ); // 写入down机检测文件 app.WriteAppDownDetectFile("opac service启动。"); @@ -733,6 +743,7 @@ void ChannelPool_BeforeLogin(object sender, BeforeLoginEventArgs e) { parameters = StringUtil.ParseParameters((string)channel.Param, ',', '='); } + parameters["client"] = "dp2OPAC|" + OpacApplication.ClientVersion; parameters["index"] = "-1"; #if NO if (parameters.ContainsKey("type") == false) diff --git a/DigitalPlatform.OPAC.Server/SessionInfo.cs b/DigitalPlatform.OPAC.Server/SessionInfo.cs index 4d3a86efc..47956af07 100644 --- a/DigitalPlatform.OPAC.Server/SessionInfo.cs +++ b/DigitalPlatform.OPAC.Server/SessionInfo.cs @@ -219,6 +219,7 @@ void Channel_BeforeLogin(object sender, BeforeLoginEventArgs e) parameters["type"] = "reader"; parameters["simulate"] = "yes"; parameters["location"] = "#opac_token@" + this.ClientIP; + parameters["client"] = "dp2OPAC|" + OpacApplication.ClientVersion; e.Parameters = StringUtil.BuildParameterString(parameters, ',', '='); @@ -227,7 +228,7 @@ void Channel_BeforeLogin(object sender, BeforeLoginEventArgs e) } else { - e.Parameters = "location=#opac@" + this.ClientIP; + e.Parameters = "location=#opac@" + this.ClientIP + ",client=dp2OPAC|" + OpacApplication.ClientVersion; if (m_bIsReader == true) e.Parameters += ",type=reader,libraryCode="; // TODO: 可以用一个参数设定馆代码限制范围 } @@ -253,7 +254,7 @@ public LibraryChannel GetChannel(bool bPool, string strParam = "") channel.Param = this.m_strParameters; // 2015/11/20 SSO Login 会这么用 else { - string strParameters = "location=#opac@" + this.ClientIP; + string strParameters = "location=#opac@" + this.ClientIP + ",client=dp2OPAC|" + OpacApplication.ClientVersion; if (m_bIsReader == true) strParameters += ",type=reader,libraryCode="; // TODO: 可以用一个参数设定馆代码限制范围 channel.Param = strParameters; // Tag diff --git a/DigitalPlatform.OPAC.Web/LoginControl.cs b/DigitalPlatform.OPAC.Web/LoginControl.cs index 25d813bb6..066b89a24 100644 --- a/DigitalPlatform.OPAC.Web/LoginControl.cs +++ b/DigitalPlatform.OPAC.Web/LoginControl.cs @@ -1202,7 +1202,7 @@ public int DoAnonymouseLogin(out string strError) // -1 error // 0 登录未成功 // 1 登录成功 - string strParameters = "location=#opac@" + sessioninfo.ClientIP + ",type=worker"; + string strParameters = "location=#opac@" + sessioninfo.ClientIP + ",type=worker,client=dp2OPAC|" + OpacApplication.ClientVersion; long lRet = sessioninfo.Login("public", "", strParameters, @@ -1247,7 +1247,7 @@ public int DoLogin( sessioninfo.Clear(); long lRet = 0; - string strParameters = "location=#opac@" + sessioninfo.ClientIP + ""; + string strParameters = "location=#opac@" + sessioninfo.ClientIP + ",client=dp2OPAC|" + OpacApplication.ClientVersion; if (strUserType == "librarian") { @@ -1501,7 +1501,7 @@ public int DoLogin(string strLibraryCode, } long lRet = 0; - string strParameters = "location=#opac@" + sessioninfo.ClientIP + ""; + string strParameters = "location=#opac@" + sessioninfo.ClientIP + ",client=dp2OPAC|" + OpacApplication.ClientVersion; if (this.ActiveLoginColumn == LoginColumn.ID) { diff --git a/ZipUtil.exe b/ZipUtil.exe index 97b958e8c1dc77033093eedd4d4cef1ecdedf197..17f1bcc3896aae6b754a05f3c315c92c62fdef56 100644 GIT binary patch delta 66 zcmZqhXz-ZO!7QfNx3Sw$OyIBE_D0A2+0N6#Ghz#vK(dqbB_#!}yShGm W(&p~ICL-{K$iM2vn`cO7Z~*|W)*RUY delta 66 zcmZqhXz-ZO!OW}GyRq9)OhDfDica^7T>n;wg&L=`r+nLdMr;8SNOp3*q@=(ML3Z1( V1wQ`GsR^pT7M`24d4^;L7XVxO8dCrO diff --git a/dp2Catalog/MainForm/FirstRunDialog.cs b/dp2Catalog/MainForm/FirstRunDialog.cs index 7dc92c4cb..1ec1bc7b3 100644 --- a/dp2Catalog/MainForm/FirstRunDialog.cs +++ b/dp2Catalog/MainForm/FirstRunDialog.cs @@ -205,6 +205,7 @@ internal void Channel_BeforeLogin(object sender, { e.UserName = this.textBox_server_userName.Text; e.Password = this.textBox_server_password.Text; + e.Parameters += ",client=dp2catalog|" + Program.ClientVersion; if (String.IsNullOrEmpty(e.UserName) == false) return; // 立即返回, 以便作第一次 不出现 对话框的自动登录 @@ -258,7 +259,7 @@ int TouchServer(bool bPrepareSearch, // 1 登录成功 lRet = this.Channel.Login(this.textBox_server_userName.Text, this.textBox_server_password.Text, - "type=worker", + "type=worker,client=dp2catalog|" + Program.ClientVersion, out strError); if (lRet == -1) { diff --git a/dp2Catalog/MainForm/FirstRunDialog.designer.cs b/dp2Catalog/MainForm/FirstRunDialog.designer.cs index 22b1c549d..f0ec80bc6 100644 --- a/dp2Catalog/MainForm/FirstRunDialog.designer.cs +++ b/dp2Catalog/MainForm/FirstRunDialog.designer.cs @@ -127,7 +127,8 @@ private void InitializeComponent() this.label_welcome.Name = "label_welcome"; this.label_welcome.Size = new System.Drawing.Size(435, 201); this.label_welcome.TabIndex = 0; - this.label_welcome.Text = "欢迎使用\r\ndp2 编目 (dp2Catalog)\r\n这是一个图书馆业务前端软件\r\n\r\n(C)2006-2015 版权所有 数字平台(北京)软件有限责任公司"; + this.label_welcome.Text = "欢迎使用\r\ndp2 编目 (dp2Catalog)\r\n这是一个图书馆业务前端软件\r\n\r\n(C)2006-2015 版权所有 数字平台(北京)软件有限责任公司\r\n2" + + "015 年以 Apache License Version 2.0 方式开源"; this.label_welcome.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // tabPage_license diff --git a/dp2Catalog/dp2Catalog.csproj b/dp2Catalog/dp2Catalog.csproj index 62c9bea3e..e9e08da63 100644 --- a/dp2Catalog/dp2Catalog.csproj +++ b/dp2Catalog/dp2Catalog.csproj @@ -50,7 +50,7 @@ dp2 V2 true publish.htm - 3 + 4 2.5.0.%2a false true diff --git a/dp2Circulation/MainForm/FirstRunDialog.Designer.cs b/dp2Circulation/MainForm/FirstRunDialog.Designer.cs index c6496465d..b33e80b4b 100644 --- a/dp2Circulation/MainForm/FirstRunDialog.Designer.cs +++ b/dp2Circulation/MainForm/FirstRunDialog.Designer.cs @@ -128,7 +128,7 @@ private void InitializeComponent() this.label_welcome.Size = new System.Drawing.Size(435, 201); this.label_welcome.TabIndex = 0; this.label_welcome.Text = "欢迎使用\r\ndp2 内务 (dp2Circulation)\r\n这是一个图书馆业务前端软件\r\n\r\n(C)2006-2015 版权所有 数字平台(北京)软件有限责任公" + - "司"; + "司\r\n2015 年以 Apache License Version 2.0 方式开源"; this.label_welcome.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // tabPage_license diff --git a/dp2Circulation/MainForm/FirstRunDialog.cs b/dp2Circulation/MainForm/FirstRunDialog.cs index cde62724e..d87a6af7d 100644 --- a/dp2Circulation/MainForm/FirstRunDialog.cs +++ b/dp2Circulation/MainForm/FirstRunDialog.cs @@ -399,7 +399,7 @@ internal void Channel_BeforeLogin(object sender, { e.UserName = this.textBox_server_userName.Text; e.Password = this.textBox_server_password.Text; - + e.Parameters += ",client=dp2circulation|" + Program.ClientVersion; //bool bIsReader = false; if (String.IsNullOrEmpty(e.UserName) == false) @@ -410,12 +410,10 @@ internal void Channel_BeforeLogin(object sender, return; } - void Channel_AfterLogin(object sender, AfterLoginEventArgs e) { } - int TouchServer(bool bPrepareSearch, out string strError) { @@ -460,7 +458,7 @@ int TouchServer(bool bPrepareSearch, // 1 登录成功 lRet = this.Channel.Login(this.textBox_server_userName.Text, this.textBox_server_password.Text, - "type=worker", + "type=worker,client=dp2circulation|" + Program.ClientVersion, out strError); if (lRet == -1) { @@ -494,7 +492,7 @@ void LoadEula() string strFileName = Path.Combine(this.MainForm.DataDir, "eula.txt"); using (StreamReader sr = new StreamReader(strFileName, true)) { - this.textBox_license.Text = sr.ReadToEnd().Replace("\r\n","\n").Replace("\n","\r\n"); // 两个 Replace() 会将只有 LF 结尾的行处理为 CR LF + this.textBox_license.Text = sr.ReadToEnd().Replace("\r\n", "\n").Replace("\n", "\r\n"); // 两个 Replace() 会将只有 LF 结尾的行处理为 CR LF } } @@ -531,7 +529,7 @@ private void comboBox_server_serverType_SelectedIndexChanged(object sender, Even } else { - MessageBox.Show(this, "未知的服务器类型 '"+this.comboBox_server_serverType.Text+"'"); + MessageBox.Show(this, "未知的服务器类型 '" + this.comboBox_server_serverType.Text + "'"); } } @@ -583,7 +581,7 @@ public string Mode { if (value == "community") // "test" this.radioButton_licenseMode_community.Checked = true; - else + else this.radioButton_licenseMode_standard.Checked = true; } } diff --git a/dp2Circulation/dp2Circulation.csproj b/dp2Circulation/dp2Circulation.csproj index e8a2f2eed..4b3cac67c 100644 --- a/dp2Circulation/dp2Circulation.csproj +++ b/dp2Circulation/dp2Circulation.csproj @@ -51,7 +51,7 @@ dp2 V2 true publish.htm - 9 + 11 2.10.0.%2a false true diff --git a/dp2Installer/MainForm.cs b/dp2Installer/MainForm.cs index 306b959ac..7a895bd13 100644 --- a/dp2Installer/MainForm.cs +++ b/dp2Installer/MainForm.cs @@ -4281,6 +4281,7 @@ internal void Channel_BeforeLogin(object sender, string strLocation = "manager"; e.Parameters = "location=" + strLocation; + e.Parameters += ",client=dp2installer|" + Program.ClientVersion; if (String.IsNullOrEmpty(e.UserName) == false) return; // 立即返回, 以便作第一次 不出现 对话框的自动登录 @@ -4310,6 +4311,7 @@ internal void Channel_BeforeLogin(object sender, e.Password = dlg.Password; e.SavePasswordShort = dlg.SavePasswordShort; e.Parameters = "location=" + dlg.OperLocation; + e.Parameters += ",client=dp2installer|" + Program.ClientVersion; e.SavePasswordLong = dlg.SavePasswordLong; if (e.LibraryServerUrl != dlg.ServerUrl) diff --git a/dp2Installer/dp2Installer.csproj b/dp2Installer/dp2Installer.csproj index 39dd67b9e..620e96c72 100644 --- a/dp2Installer/dp2Installer.csproj +++ b/dp2Installer/dp2Installer.csproj @@ -34,7 +34,7 @@ dp2 V2 true publish.htm - 74 + 75 1.1.0.%2a false true diff --git a/dp2Installer/opac_app/Login.aspx.cs b/dp2Installer/opac_app/Login.aspx.cs index 74452c437..e83f13d64 100644 --- a/dp2Installer/opac_app/Login.aspx.cs +++ b/dp2Installer/opac_app/Login.aspx.cs @@ -778,7 +778,7 @@ int DoSsoLogin(string strLibraryCode, string strType) goto ERROR1; } - string strParameters = "location=#opac_sso@" + sessioninfo.ClientIP + ",index=-1,type=reader,simulate=yes,libraryCode=" + LoginControl.GetLibraryCodeParam(strLibraryCode); + string strParameters = "location=#opac_sso@" + sessioninfo.ClientIP + ",index=-1,type=reader,simulate=yes,libraryCode=" + LoginControl.GetLibraryCodeParam(strLibraryCode) + ",client=dp2OPAC|" + OpacApplication.ClientVersion; string strPassword = app.ManagerUserName + "," + app.ManagerPassword; // simulate登录的需要 // 读者身份登录 // return: diff --git a/dp2LibraryConsole/Instance.cs b/dp2LibraryConsole/Instance.cs index 63f5cf1ba..876e21d10 100644 --- a/dp2LibraryConsole/Instance.cs +++ b/dp2LibraryConsole/Instance.cs @@ -989,6 +989,8 @@ internal void Channel_BeforeLogin(object sender, if (bIsReader == true) e.Parameters += ",type=reader"; + e.Parameters += ",client=dp2libraryconsole|"; + if (String.IsNullOrEmpty(e.UserName) == false) return; // 立即返回, 以便作第一次 不出现 对话框的自动登录 } diff --git a/dp2LibraryXE/MainForm.cs b/dp2LibraryXE/MainForm.cs index 5d5d49c0b..e77f177af 100644 --- a/dp2LibraryXE/MainForm.cs +++ b/dp2LibraryXE/MainForm.cs @@ -2124,7 +2124,6 @@ internal void Channel_BeforeLogin(object sender, if (String.IsNullOrEmpty(e.UserName) == false) return; // 立即返回, 以便作第一次 不出现 对话框的自动登录 - } #if NO diff --git a/dp2LibraryXE/opac_app/Login.aspx.cs b/dp2LibraryXE/opac_app/Login.aspx.cs index 74452c437..e83f13d64 100644 --- a/dp2LibraryXE/opac_app/Login.aspx.cs +++ b/dp2LibraryXE/opac_app/Login.aspx.cs @@ -778,7 +778,7 @@ int DoSsoLogin(string strLibraryCode, string strType) goto ERROR1; } - string strParameters = "location=#opac_sso@" + sessioninfo.ClientIP + ",index=-1,type=reader,simulate=yes,libraryCode=" + LoginControl.GetLibraryCodeParam(strLibraryCode); + string strParameters = "location=#opac_sso@" + sessioninfo.ClientIP + ",index=-1,type=reader,simulate=yes,libraryCode=" + LoginControl.GetLibraryCodeParam(strLibraryCode) + ",client=dp2OPAC|" + OpacApplication.ClientVersion; string strPassword = app.ManagerUserName + "," + app.ManagerPassword; // simulate登录的需要 // 读者身份登录 // return: diff --git a/dp2OPAC/Login.aspx.cs b/dp2OPAC/Login.aspx.cs index 74452c437..e83f13d64 100644 --- a/dp2OPAC/Login.aspx.cs +++ b/dp2OPAC/Login.aspx.cs @@ -778,7 +778,7 @@ int DoSsoLogin(string strLibraryCode, string strType) goto ERROR1; } - string strParameters = "location=#opac_sso@" + sessioninfo.ClientIP + ",index=-1,type=reader,simulate=yes,libraryCode=" + LoginControl.GetLibraryCodeParam(strLibraryCode); + string strParameters = "location=#opac_sso@" + sessioninfo.ClientIP + ",index=-1,type=reader,simulate=yes,libraryCode=" + LoginControl.GetLibraryCodeParam(strLibraryCode) + ",client=dp2OPAC|" + OpacApplication.ClientVersion; string strPassword = app.ManagerUserName + "," + app.ManagerPassword; // simulate登录的需要 // 读者身份登录 // return: diff --git a/dp2ZServer/Host.cs b/dp2ZServer/Host.cs index 4bdb7d3d6..336ea7000 100644 --- a/dp2ZServer/Host.cs +++ b/dp2ZServer/Host.cs @@ -566,7 +566,8 @@ void Channel_BeforeLogin(object sender, BeforeLoginEventArgs e) { e.UserName = this.ManagerUserName; e.Password = this.ManagerPassword; - e.Parameters = "location=z39.50 server manager,type=worker"; + e.Parameters = "location=z39.50 server manager,type=worker,client=dp2ZServer|"; + /* e.IsReader = false; e.Location = "z39.50 server manager"; diff --git a/dp2ZServer/Session.cs b/dp2ZServer/Session.cs index 73f2e6cd6..7d036a64f 100644 --- a/dp2ZServer/Session.cs +++ b/dp2ZServer/Session.cs @@ -98,7 +98,7 @@ void Channel_BeforeLogin(object sender, BeforeLoginEventArgs e) { e.UserName = this.strUserName; e.Password = this.strPassword; - e.Parameters = "location=z39.50 server, type=worker"; + e.Parameters = "location=z39.50 server, type=worker,client=dp2ZServer|"; /* e.IsReader = false; e.Location = "z39.50 server"; diff --git a/dp2ZServer/UnionCatalogService.cs b/dp2ZServer/UnionCatalogService.cs index c5db567a3..718c316ef 100644 --- a/dp2ZServer/UnionCatalogService.cs +++ b/dp2ZServer/UnionCatalogService.cs @@ -150,7 +150,7 @@ public int UpdateRecord( strPassword = strAuthString.Substring(nRet + 1).Trim(); } - string strParameters = "location=#unioncatalog"; + string strParameters = "location=#unioncatalog,client=dp2Catalog|"; LibraryChannel channel = new LibraryChannel(); try From 552d64c23332938d4374434a3b883ac162058b74 Mon Sep 17 00:00:00 2001 From: XieTao Date: Sat, 9 Jan 2016 00:22:17 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E2=80=9C=E8=AF=BB?= =?UTF-8?q?=E8=BF=87=E2=80=9D=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OrderDesignControl.cs | 24 +- DigitalPlatform.EasyMarc/EasyMarcControl.cs | 7 +- .../LibraryChannel.cs | 5 +- .../AppCirculation.cs | 393 +- .../MongoDb/ChargingOperDatabase.cs | 12 +- .../LibraryService.cs | 6 +- .../BorrowHistoryControl.cs | 3 +- DigitalPlatform/ListViewUtil.cs | 46 +- DigitalPlatform/LocationCollection.cs | 6 +- dp2Circulation/Charging/ChargingForm.cs | 5 + dp2Circulation/Charging/ChargingTask.cs | 21 +- .../Charging/QuickChargingForm.Designer.cs | 52 +- dp2Circulation/Charging/QuickChargingForm.cs | 44 +- .../Charging/QuickChargingForm.resx | 6 +- dp2Circulation/EntityForm/EntityForm.cs | 41 +- dp2Circulation/Issue/IssueControl.cs | 2 +- dp2Circulation/ItemInfoForm/ItemInfoForm.cs | 15 +- dp2Circulation/MainForm/InitialExtension.cs | 1 + dp2Circulation/OperHistory/OperHistory.cs | 2 + dp2Circulation/Order/OrderControl.cs | 81 + .../Order/OrderEditControl.Designer.cs | 54 +- dp2Circulation/Order/OrderEditControl.cs | 18 +- dp2Circulation/Order/OrderEditForm.cs | 44 +- dp2Circulation/Reader/ReaderInfoForm.cs | 26 +- .../SearchForms/BiblioSearchForm.cs | 28 +- .../Statis/ConvertReportFormatDialog.cs | 4 +- dp2Circulation/Statis/ReportApplyForm.cs | 22 +- dp2Circulation/Statis/ReportForm.Designer.cs | 15 +- dp2Circulation/Statis/ReportForm.cs | 212 +- dp2Circulation/Statis/ReportForm.resx | 121 +- dp2Circulation/default/charginghistory.css | 47 + dp2Circulation/dp2Circulation.csproj | 6 + dp2Circulation/report_def/9101.xml | 16 + dp2Library/ILibraryService.cs | 764 - dp2Library/ILibraryServiceREST.cs | 781 - dp2Library/LibraryService.cs | 12224 ---------------- dp2Library/dp2Library.csproj | 3 - 37 files changed, 1020 insertions(+), 14137 deletions(-) create mode 100644 dp2Circulation/default/charginghistory.css create mode 100644 dp2Circulation/report_def/9101.xml delete mode 100644 dp2Library/ILibraryService.cs delete mode 100644 dp2Library/ILibraryServiceREST.cs delete mode 100644 dp2Library/LibraryService.cs diff --git a/DigitalPlatform.CommonControl/OrderDesignControl.cs b/DigitalPlatform.CommonControl/OrderDesignControl.cs index aefa546a7..0b0a40cf5 100644 --- a/DigitalPlatform.CommonControl/OrderDesignControl.cs +++ b/DigitalPlatform.CommonControl/OrderDesignControl.cs @@ -474,7 +474,7 @@ public int Check(out string strError) nRet = item.location.Check(out strError); if (nRet != 0) { - strError = "第 " + (i + 1).ToString() + " 行: 去向 格式有问题: " + strError; + strError = "第 " + (i + 1).ToString() + " 行: 馆藏分配去向 格式有问题: " + strError; return 1; } @@ -619,7 +619,7 @@ public int Check(out string strError) nRet = locations.Build(strLocationString, out strError); if (nRet == -1) { - strError = "第 " + (i + 1).ToString() + " 行: 去向字符串 '" + strLocationString + "' 格式错误: " + strError; + strError = "第 " + (i + 1).ToString() + " 行: 馆藏分配去向字符串 '" + strLocationString + "' 格式错误: " + strError; return -1; } string strUsedLibraryCodes = StringUtil.MakePathList(locations.GetUsedLibraryCodes()); @@ -634,7 +634,7 @@ public int Check(out string strError) this.VerifyLibraryCode(this, e); if (string.IsNullOrEmpty(e.ErrorInfo) == false) { - strError = "第 " + (i + 1).ToString() + " 行: 去向错误: " + e.ErrorInfo; + strError = "第 " + (i + 1).ToString() + " 行: 馆藏分配去向错误: " + e.ErrorInfo; return -1; } } @@ -659,7 +659,7 @@ public int Check(out string strError) nRet = temp_locations.Build(strTempLocationString, out strError); if (nRet == -1) { - strError = "第 " + (j + 1).ToString() + " 行: 去向字符串 '" + strTempLocationString + "' 格式错误: " + strError; + strError = "第 " + (j + 1).ToString() + " 行: 馆藏分配去向字符串 '" + strTempLocationString + "' 格式错误: " + strError; return -1; } string strTempUsedLibraryCodes = StringUtil.MakePathList(temp_locations.GetUsedLibraryCodes()); @@ -674,7 +674,7 @@ public int Check(out string strError) && item.Price == temp_item.Price && strUsedLibraryCodes == strTempUsedLibraryCodes) { - strError = "第 " + (i + 1).ToString() + " 行 和 第 " + (j + 1) + " 行之间 渠道/经费来源/价格/去向(中所含的馆代码) 四元组重复,需要将它们合并为一行"; + strError = "第 " + (i + 1).ToString() + " 行 和 第 " + (j + 1) + " 行之间 渠道/经费来源/价格/馆藏分配去向(中所含的馆代码) 四元组重复,需要将它们合并为一行"; return 1; } } @@ -687,7 +687,7 @@ public int Check(out string strError) && item.RangeString == temp_item.RangeString && strUsedLibraryCodes == strTempUsedLibraryCodes) { - strError = "第 " + (i + 1).ToString() + " 行 和 第 " + (j + 1) + " 行之间 渠道/经费来源/时间范围/价格/去向(中所含的馆代码) 五元组重复,需要将它们合并为一行"; + strError = "第 " + (i + 1).ToString() + " 行 和 第 " + (j + 1) + " 行之间 渠道/经费来源/时间范围/价格/馆藏分配去向(中所含的馆代码) 五元组重复,需要将它们合并为一行"; return 1; } } @@ -3911,6 +3911,18 @@ void menu_appendCopyElement_Click(object sender, EventArgs e) if (string.IsNullOrEmpty(strPrice) == false && string.IsNullOrEmpty(strTotalPrice) == false) DomUtil.SetElementText(dom.DocumentElement, "totalPrice", ""); + // 把 location 中的已验收信息清除 + string strDistributeString = DomUtil.GetElementText(dom.DocumentElement, "distribute"); + if (string.IsNullOrEmpty(strDistributeString) == false) + { + LocationCollection locations = new LocationCollection(); + nRet = locations.Build(strDistributeString, out strError); + if (nRet == -1) + throw new Exception("馆藏分配去向字符串 '" + strDistributeString + "' 格式错误: " + strError); + strDistributeString = locations.ToString(false); + DomUtil.SetElementText(dom.DocumentElement, "distribute", strDistributeString); + } + DomUtil.SetElementText(dom.DocumentElement, "state", ""); DomUtil.SetElementText(dom.DocumentElement, "refID", ""); DomUtil.SetElementText(dom.DocumentElement, "range", ""); diff --git a/DigitalPlatform.EasyMarc/EasyMarcControl.cs b/DigitalPlatform.EasyMarc/EasyMarcControl.cs index 938ca9dfb..dc42f5405 100644 --- a/DigitalPlatform.EasyMarc/EasyMarcControl.cs +++ b/DigitalPlatform.EasyMarc/EasyMarcControl.cs @@ -2056,7 +2056,8 @@ void ResetAllTextBoxHeight() { foreach (EasyLine item in this.Items) { - if (item.textBox_content.Visible == true) + if (item != null && item.textBox_content != null + && item.textBox_content.Visible == true) { item.textBox_content.SetHeight(); } @@ -3803,7 +3804,9 @@ 在 System.Windows.Forms.ContainerControl.UpdateFocusedControl() // bSetAll 是否要重设全部颜色?= false 表示仅重设和焦点变化有关的颜色; = true 表示要重设全部颜色,包括和焦点变化无关的那些颜色 public virtual void SetLineColor(bool bSetAll = false) { - if (this.Container == null) + if (this.Container == null + || this.textBox_content == null + || this.label_color == null) return; if (bSetAll == true) diff --git a/DigitalPlatform.LibraryClient/LibraryChannel.cs b/DigitalPlatform.LibraryClient/LibraryChannel.cs index fc5cb37d3..54e0c3c9a 100644 --- a/DigitalPlatform.LibraryClient/LibraryChannel.cs +++ b/DigitalPlatform.LibraryClient/LibraryChannel.cs @@ -9337,9 +9337,10 @@ public long SearchCharging( // return: // -1 出错 // 其它 符合条件的事项总数 - public long LoadBorrowHistory( + public long LoadChargingHistory( DigitalPlatform.Stop stop, string strBarcode, + string strActions, int nPageNo, int nItemsPerPage, out List results, @@ -9367,7 +9368,7 @@ public long LoadBorrowHistory( stop, strBarcode, "~", - "return,lost", + strActions, // "return,lost", "descending", lStart + nGeted, lLength, diff --git a/DigitalPlatform.LibraryServer/AppCirculation.cs b/DigitalPlatform.LibraryServer/AppCirculation.cs index a82c167c3..d62fef084 100644 --- a/DigitalPlatform.LibraryServer/AppCirculation.cs +++ b/DigitalPlatform.LibraryServer/AppCirculation.cs @@ -3612,6 +3612,8 @@ static string GetReturnActionName(string strAction) return "丢失声明"; else if (strAction == "inventory") return "盘点"; + else if (strAction == "read") + return "读过"; else return strAction; } @@ -3619,7 +3621,8 @@ static string GetReturnActionName(string strAction) // API: 还书 // 权限: 工作人员需要return权限,如果是丢失处理需要lost权限;所有读者均不具备还书操作权限。盘点需要 inventory 权限 // parameters: - // strAction return/lost/inventory + // strAction return/lost/inventory/read + // strReaderBarcodeParam 读者证条码号。当 strAction 为 "inventory" 时,这里是批次号 // return: // Result.Value -1 出错 0 操作成功 1 操作成功,但有值得操作人员留意的情况:如有超期情况;发现条码号重复;需要放入预约架 public LibraryServerResult Return( @@ -3701,6 +3704,17 @@ public LibraryServerResult Return( // return result; } } + else if (strAction == "read") + { + // 权限字符串 + if (StringUtil.IsInList("read", sessioninfo.RightsOrigin) == false) + { + result.Value = -1; + result.ErrorInfo = strActionName + " 操作被拒绝。不具备 read 权限。"; + result.ErrorCode = ErrorCode.AccessDenied; + // return result; + } + } else { strError = "无法识别的 strAction 参数值 '" + strAction + "'。"; @@ -4163,41 +4177,43 @@ public LibraryServerResult Return( } string strOutputReaderBarcode = ""; // 返回的借阅者证条码号 - // 在册记录中获得借阅者证条码号 - // return: - // -1 出错 - // 0 该册为未借出状态 - // 1 成功 - nRet = GetBorrowerBarcode(itemdom, - out strOutputReaderBarcode, - out strError); - if (strAction == "inventory") + if (strAction != "read") { - if (nRet == -1) - { - strError = strError + " (册记录路径为 '" + strOutputItemRecPath + "')"; - goto ERROR1; - } - if (string.IsNullOrEmpty(strOutputReaderBarcode) == false) + // 在册记录中获得借阅者证条码号 + // return: + // -1 出错 + // 0 该册为未借出状态 + // 1 成功 + nRet = GetBorrowerBarcode(itemdom, + out strOutputReaderBarcode, + out strError); + if (strAction == "inventory") { - // 该册处于被借阅状态,需要警告前端,建议立即进行还书操作 - strInventoryWarning = "册 " + strItemBarcodeParam + " 当前处于被借阅状态。如确属在架已还图书,建议立即为之补办还书手续。" + " (册记录路径为 '" + strOutputItemRecPath + "')"; + if (nRet == -1) + { + strError = strError + " (册记录路径为 '" + strOutputItemRecPath + "')"; + goto ERROR1; + } + if (string.IsNullOrEmpty(strOutputReaderBarcode) == false) + { + // 该册处于被借阅状态,需要警告前端,建议立即进行还书操作 + strInventoryWarning = "册 " + strItemBarcodeParam + " 当前处于被借阅状态。如确属在架已还图书,建议立即为之补办还书手续。" + " (册记录路径为 '" + strOutputItemRecPath + "')"; + } } - } - else - { - if (nRet == -1 || nRet == 0) + else { - strError = strError + " (册记录路径为 '" + strOutputItemRecPath + "')"; - goto ERROR1; + if (nRet == -1 || nRet == 0) + { + strError = strError + " (册记录路径为 '" + strOutputItemRecPath + "')"; + goto ERROR1; + } } - } - // 如果提供了读者证条码号,则需要核实 - if (String.IsNullOrEmpty(strReaderBarcodeParam) == false) - { - if (strOutputReaderBarcode != strReaderBarcodeParam) + // 如果提供了读者证条码号,则需要核实 + if (String.IsNullOrEmpty(strReaderBarcodeParam) == false) { + if (strOutputReaderBarcode != strReaderBarcodeParam) + { #if NO if (StringUtil.IsIdcardNumber(strReaderBarcodeParam) == true) { @@ -4211,14 +4227,15 @@ public LibraryServerResult Return( goto ERROR1; } #endif - // 暂时不报错,滞后验证 - bDelayVerifyReaderBarcode = true; - strIdcardNumber = strReaderBarcodeParam; + // 暂时不报错,滞后验证 + bDelayVerifyReaderBarcode = true; + strIdcardNumber = strReaderBarcodeParam; + } } - } - if (String.IsNullOrEmpty(strReaderBarcode) == true) - strReaderBarcode = strOutputReaderBarcode; + if (String.IsNullOrEmpty(strReaderBarcode) == true) + strReaderBarcode = strOutputReaderBarcode; + } // *** 如果读者记录在前面没有锁定, 在这里锁定 if (bReaderLocked == false && string.IsNullOrEmpty(strReaderBarcode) == false) @@ -4460,7 +4477,6 @@ public LibraryServerResult Return( goto END3; } - // 看看读者记录所从属的数据库,是否在参与流通的读者库之列 // 2008/6/4 bool bReaderDbInCirculation = true; @@ -4589,18 +4605,7 @@ public LibraryServerResult Return( string strReaderState = DomUtil.GetElementText(readerdom.DocumentElement, "state"); - // 获得相关日历 - Calendar calendar = null; - // return: - // -1 出错 - // 0 没有找到日历 - // 1 找到日历 - nRet = GetReaderCalendar(strReaderType, - strLibraryCode, - out calendar, - out strError); - if (nRet == -1 || nRet == 0) - goto ERROR1; + string strOperTime = this.Clock.GetClock(); string strWarning = ""; @@ -4608,39 +4613,57 @@ public LibraryServerResult Return( // 处理册记录 string strOverdueString = ""; string strLostComment = ""; - // return: - // -1 出错 - // 0 正常 - // 1 超期还书或者丢失处理的情况 - nRet = DoReturnItemXml( - strAction, - sessioninfo, // sessioninfo.Account, - calendar, - strReaderType, - strLibraryCode, - strAccessParameters, - readerdom, // 为了调用GetLost()脚本函数 - ref itemdom, - bForce, - bItemBarcodeDup, // 若条码号足以定位,则不记载实体记录路径 - strOutputItemRecPath, - sessioninfo.UserID, // 还书操作者 - strOperTime, - out strOverdueString, - out strLostComment, - out return_info, - out strWarning, - out strError); - if (nRet == -1) - goto ERROR1; - if (string.IsNullOrEmpty(strWarning) == false) + if (strAction != "read") { - if (String.IsNullOrEmpty(result.ErrorInfo) == false) - result.ErrorInfo += "\r\n"; - result.ErrorInfo += strWarning; - result.Value = 1; + // 获得相关日历 + Calendar calendar = null; + // return: + // -1 出错 + // 0 没有找到日历 + // 1 找到日历 + nRet = GetReaderCalendar(strReaderType, + strLibraryCode, + out calendar, + out strError); + if (nRet == -1 || nRet == 0) + goto ERROR1; + + // return: + // -1 出错 + // 0 正常 + // 1 超期还书或者丢失处理的情况 + nRet = DoReturnItemXml( + strAction, + sessioninfo, // sessioninfo.Account, + calendar, + strReaderType, + strLibraryCode, + strAccessParameters, + readerdom, // 为了调用GetLost()脚本函数 + ref itemdom, + bForce, + bItemBarcodeDup, // 若条码号足以定位,则不记载实体记录路径 + strOutputItemRecPath, + sessioninfo.UserID, // 还书操作者 + strOperTime, + out strOverdueString, + out strLostComment, + out return_info, + out strWarning, + out strError); + if (nRet == -1) + goto ERROR1; + if (string.IsNullOrEmpty(strWarning) == false) + { + if (String.IsNullOrEmpty(result.ErrorInfo) == false) + result.ErrorInfo += "\r\n"; + result.ErrorInfo += strWarning; + result.Value = 1; + } } + else + nRet = 0; string strItemBarcode = DomUtil.GetElementText(itemdom.DocumentElement, "barcode"); @@ -4668,19 +4691,22 @@ public LibraryServerResult Return( // 处理读者记录 // string strNewReaderXml = ""; string strDeletedBorrowFrag = ""; - nRet = DoReturnReaderXml( - strLibraryCode, - ref readerdom, - strItemBarcodeParam, - strItemBarcode, - strOverdueString.StartsWith("!") ? "" : strOverdueString, - sessioninfo.UserID, // 还书操作者 - strOperTime, - sessioninfo.ClientAddress, // 前端触发 - out strDeletedBorrowFrag, - out strError); - if (nRet == -1) - goto ERROR1; + if (strAction != "read") + { + nRet = DoReturnReaderXml( + strLibraryCode, + ref readerdom, + strItemBarcodeParam, + strItemBarcode, + strOverdueString.StartsWith("!") ? "" : strOverdueString, + sessioninfo.UserID, // 还书操作者 + strOperTime, + sessioninfo.ClientAddress, // 前端触发 + out strDeletedBorrowFrag, + out strError); + if (nRet == -1) + goto ERROR1; + } // 创建日志记录 Debug.Assert(string.IsNullOrEmpty(strReaderBarcode) == false, ""); @@ -4691,6 +4717,9 @@ public LibraryServerResult Return( DomUtil.SetElementText(domOperLog.DocumentElement, "operTime", strOperTime); + if (strAction == "read") + goto WRITE_OPERLOG; + WriteTimeUsed( time_lines, start_time_process, @@ -4875,6 +4904,7 @@ public LibraryServerResult Return( start_time_write_item, "Return() 中写回册记录 耗时 "); + WRITE_OPERLOG: DateTime start_time_write_operlog = DateTime.Now; // 写入日志 @@ -4952,7 +4982,7 @@ public LibraryServerResult Return( if (this.Statis != null) this.Statis.IncreaseEntryValue(strLibraryCode, "出纳", - "还册", + strAction == "read" ? "读过册" : "还册", 1); if (strAction == "lost") @@ -5762,6 +5792,185 @@ int DoInventory( return 0; } + // 执行“读过”记载 + int DoRead( + SessionInfo sessioninfo, + string strAccessParameters, + XmlDocument itemdom, + string strItemRecPath, + string strBatchNo, + out string strError) + { + strError = ""; + int nRet = 0; + + string strInventoryDbName = GetInventoryDbName(); + + if (string.IsNullOrEmpty(strInventoryDbName) == true) + { + strError = "当前尚未配置盘点库,无法进行盘点操作"; + return -1; + } + + // 馆藏地点 + string strLocation = DomUtil.GetElementText(itemdom.DocumentElement, "location"); + // 去掉#reservation部分 + strLocation = StringUtil.GetPureLocationString(strLocation); + + // 获得册记录的馆代码,检查是否在当前用户管辖范围内 + + string strLibraryCode = ""; + // 检查一个册记录的馆藏地点是否符合馆代码列表要求 + // parameters: + // strLibraryCodeList 当前用户管辖的馆代码列表 + // strLibraryCode [out]册记录中的馆代码 + // return: + // -1 检查过程出错 + // 0 符合要求 + // 1 不符合要求 + nRet = CheckItemLibraryCode(itemdom, + sessioninfo.LibraryCodeList, + out strLibraryCode, + out strError); + if (nRet == -1) + return -1; + if (nRet == 1) + { + strError = "盘点操作被拒绝: " + strError; + return -1; + } + +#if NO + string strCode = ""; + string strRoom = ""; + { + // 解析 + ParseCalendarName(strLocation, + out strCode, + out strRoom); + if (StringUtil.IsInList(strCode, sessioninfo.LibraryCodeList) == false) + { + strError = "册记录的馆藏地 '" + strLocation + "' 不属于当前用户所在馆代码 '" + sessioninfo.LibraryCodeList + "' 管辖,不允许进行盘点操作。"; + return -1; + } + } +#endif + + // 检查存取定义馆藏地列表 + if (string.IsNullOrEmpty(strAccessParameters) == false && strAccessParameters != "*") + { + string strCode = ""; + string strRoom = ""; + // 解析 + ParseCalendarName(strLocation, + out strCode, + out strRoom); + + bool bFound = false; + List locations = StringUtil.SplitList(strAccessParameters); + foreach (string s in locations) + { + string c = ""; + string r = ""; + ParseCalendarName(s, + out c, + out r); + if (/*string.IsNullOrEmpty(c) == false && */ c != "*") + { + if (c != strLibraryCode) + continue; + } + + if (/*string.IsNullOrEmpty(r) == false && */ r != "*") + { + if (r != strRoom) + continue; + } + + bFound = true; + break; + } + + if (bFound == false) + { + strError = "盘点操作被拒绝。因册记录的馆藏地 '" + strLocation + "' 不在当前用户存取定义规定的盘点操作的馆藏地许可范围 '" + strAccessParameters + "' 之内"; + return -1; + } + } + + string strItemBarcode = DomUtil.GetElementText(itemdom.DocumentElement, "barcode"); + + string strItemRefID = DomUtil.GetElementText(itemdom.DocumentElement, "refID"); + + // 在盘点库中查重 + RmsChannel channel = sessioninfo.Channels.GetChannel(this.WsUrl); + if (channel == null) + { + strError = "get channel error"; + return -1; + } + + List aPath = null; + // 根据馆代码、批次号和册条码号对盘点库进行查重 + // 本函数只负责查重, 并不获得记录体 + // return: + // -1 error + // 其他 命中记录条数(不超过nMax规定的极限) + nRet = SearchInventoryRecDup( + channel, + strLibraryCode, + strBatchNo, + strItemBarcode, + strItemRefID, + 2, + out aPath, + out strError); + if (nRet == -1) + return -1; + if (nRet >= 1) + { + if (string.IsNullOrEmpty(strItemBarcode) == false) + strError = "馆代码 '" + strLibraryCode + "' 批次号 '" + strBatchNo + "' 册条码号 '" + strItemBarcode + "' 的盘点记录已经存在,无法重复创建 ..."; + else + strError = "馆代码 '" + strLibraryCode + "' 批次号 '" + strBatchNo + "' 参考ID '" + strItemRefID + "' 的盘点记录已经存在,无法重复创建 ..."; + return -1; + } + + // 在盘点库中创建一条新记录 + XmlDocument inventory_dom = new XmlDocument(); + inventory_dom.LoadXml(""); + + DomUtil.SetElementText(inventory_dom.DocumentElement, "itemBarcode", strItemBarcode); + DomUtil.SetElementText(inventory_dom.DocumentElement, "itemRefID", strItemRefID); // 册记录的参考 ID + DomUtil.SetElementText(inventory_dom.DocumentElement, "itemRecPath", strItemRecPath); + + DomUtil.SetElementText(inventory_dom.DocumentElement, "batchNo", strBatchNo); + DomUtil.SetElementText(inventory_dom.DocumentElement, "location", strLocation); + DomUtil.SetElementText(inventory_dom.DocumentElement, "libraryCode", strLibraryCode); + DomUtil.SetElementText(inventory_dom.DocumentElement, "refID", Guid.NewGuid().ToString()); // 盘点记录的参考 ID + string strOperTime = this.Clock.GetClock(); + DomUtil.SetElementText(inventory_dom.DocumentElement, "operator", + sessioninfo.UserID); // 操作者 + DomUtil.SetElementText(inventory_dom.DocumentElement, "operTime", + strOperTime); // 操作时间 + + byte[] output_timestamp = null; + string strOutputPath = ""; + + long lRet = channel.DoSaveTextRes(strInventoryDbName + "/?", + inventory_dom.OuterXml, + false, // include preamble? + "content", + null, // info.OldTimestamp, + out output_timestamp, + out strOutputPath, + out strError); + if (lRet == -1) + return -1; + + return 0; + } + #region Return()下级函数 // 看看新旧册记录是否有实质性改变 diff --git a/DigitalPlatform.LibraryServer/MongoDb/ChargingOperDatabase.cs b/DigitalPlatform.LibraryServer/MongoDb/ChargingOperDatabase.cs index 32b8597ab..4b9a5b372 100644 --- a/DigitalPlatform.LibraryServer/MongoDb/ChargingOperDatabase.cs +++ b/DigitalPlatform.LibraryServer/MongoDb/ChargingOperDatabase.cs @@ -43,16 +43,6 @@ public bool Add(ChargingOperItem item) return true; } -#if NO - [Flags] - public enum ChargingActionType - { - Borrow = 0x01, // 普通借书 - Return = 0x02, // 普通还书 - Renew = 0x04, // 续借 - Lost = 0x10, // 丢失声明 - } -#endif // parameters: // patronBarcode 读者证条码号。如果 以 "@itemBarcode:" 前缀引导,表示这是册条码号 public IMongoQuery BuildQuery( @@ -96,6 +86,8 @@ public IMongoQuery BuildQuery( action_items.Add(Query.EQ("Action", "renew")); if (type == "lost") action_items.Add(Query.EQ("Action", "lost")); + if (type == "read") + action_items.Add(Query.EQ("Action", "read")); } var type_query = Query.And(Query.Or(Query.EQ("Operation", "borrow"), Query.EQ("Operation", "return")), diff --git a/DigitalPlatform.LibraryService/LibraryService.cs b/DigitalPlatform.LibraryService/LibraryService.cs index 4f3d14054..59a322505 100644 --- a/DigitalPlatform.LibraryService/LibraryService.cs +++ b/DigitalPlatform.LibraryService/LibraryService.cs @@ -2003,7 +2003,8 @@ public LibraryServerResult SearchCharging( break; ChargingItemWrapper wrapper = new ChargingItemWrapper(); wrapper.Item = new ChargingItem(item); - if (item.Operation == "return") + if (item.Operation == "return" + && item.Action != "read") { ChargingOperItem rel = app.ChargingOperDatabase.FindRelativeBorrowItem(item); if (rel != null) @@ -4973,7 +4974,8 @@ public LibraryServerResult Borrow( // 还书 // paramters: - // strReaderBarcodeParam 读者证条码号 + // strAction 动作。有 return/lost/inventory/read + // strReaderBarcode 读者证条码号 // strItemBarcode 册条码号 // bForce 是否强制执行还书操作。用于某些配置参数和数据结构不正确的特殊情况 // strStyle 风格。"reader" 表示希望返回处理完后的读者记录 diff --git a/DigitalPlatform.OPAC.Web/BorrowHistoryControl.cs b/DigitalPlatform.OPAC.Web/BorrowHistoryControl.cs index f6099b16d..0e8d09aa4 100644 --- a/DigitalPlatform.OPAC.Web/BorrowHistoryControl.cs +++ b/DigitalPlatform.OPAC.Web/BorrowHistoryControl.cs @@ -159,9 +159,10 @@ int GetChargingHistory(int nPageNo, // return: // -1 出错 // 其它 符合条件的事项总数 - return (int)sessioninfo.Channel.LoadBorrowHistory( + return (int)sessioninfo.Channel.LoadChargingHistory( null, strReaderBarcode, + "return,lost,read", nPageNo, nItemsPerPage, out results, diff --git a/DigitalPlatform/ListViewUtil.cs b/DigitalPlatform/ListViewUtil.cs index 1a01ed174..d0e0a1d3b 100644 --- a/DigitalPlatform/ListViewUtil.cs +++ b/DigitalPlatform/ListViewUtil.cs @@ -82,6 +82,33 @@ public static bool MoveItemEnabled( } } + public static bool MoveSelectedUpDown( + ListView list, + bool bUp) + { + if (list.SelectedItems.Count == 0) + return false; + + int index = list.SelectedIndices[0]; + + if (bUp) + { + index--; + if (index < 0) + return false; + } + else + { + index++; + if (index >= list.Items.Count) + return false; + } + + list.SelectedItems.Clear(); + list.Items[index].Selected = true; + return true; + } + // parameters: // indices ƶ漰±λáһԪƶǰλãڶԪƶλ public static int MoveItemUpDown( @@ -210,7 +237,7 @@ public static string GetColumnWidthListStringExt(ListView list) { string strResult = ""; int nEndIndex = list.Columns.Count; - for (int i = list.Columns.Count-1; i >= 0; i--) + for (int i = list.Columns.Count - 1; i >= 0; i--) { ColumnHeader header = list.Columns[i]; if (String.IsNullOrEmpty(header.Text) == false) @@ -235,7 +262,7 @@ public static void SetColumnHeaderWidth(ListView list, string strWidthList, bool bExpandColumnCount) { - string[] parts = strWidthList.Split(new char[] {','}); + string[] parts = strWidthList.Split(new char[] { ',' }); if (bExpandColumnCount == true) EnsureColumns(list, parts.Length, 100); @@ -467,7 +494,7 @@ public static void OnColumnContextMenuClick(ListView list, ToolStripMenuItem menuItem = null; ToolStripMenuItem subMenuItem = null; -// list.Columns[nClickColumn].Text + // list.Columns[nClickColumn].Text menuItem = new ToolStripMenuItem("ʽ"); contextMenu.Items.Add(menuItem); @@ -503,7 +530,7 @@ static string GetSortStyleCaption(ColumnSortStyle style) return "[None]"; // call_number ̬תΪ CallNumber ̬ - string[] parts = strName.Split(new char[] {'_'}, StringSplitOptions.RemoveEmptyEntries); + string[] parts = strName.Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries); StringBuilder text = new StringBuilder(4096); foreach (string s in parts) { @@ -725,7 +752,6 @@ public static void SelectLine(ListViewItem item, { item.Focused = true; } - } } @@ -799,7 +825,7 @@ public ColumnSortStyle GetSortStyle(ListView list, int nColumn) if (this.SortStyles.Count <= nColumn) { } - else + else result = SortStyles[nColumn]; if (result == null || result == ColumnSortStyle.None) @@ -950,7 +976,7 @@ public class ColumnProperty /// public string Convert = ""; // ַת 2015/8/27 - public ColumnProperty(string strTitle, + public ColumnProperty(string strTitle, string strType = "", string strXPath = "", string strConvert = "") @@ -972,8 +998,8 @@ public class ColumnPropertyCollection : List /// /// /// - public void Add(string strTitle, - string strType = "", + public void Add(string strTitle, + string strType = "", string strXPath = "", string strConvert = "") { @@ -1004,7 +1030,7 @@ public int FindColumnByType(string strType) { if (col.Type == strType) return index; - index ++; + index++; } return -1; } diff --git a/DigitalPlatform/LocationCollection.cs b/DigitalPlatform/LocationCollection.cs index 4e8055752..fb5c4650b 100644 --- a/DigitalPlatform/LocationCollection.cs +++ b/DigitalPlatform/LocationCollection.cs @@ -13,7 +13,6 @@ public class Location public class LocationCollection : List { - // 解析馆藏地名字字符串 // 例如“海淀分馆/阅览室”拆分为左右两个部分。“阅览室”会被认为是第二部分;"海淀分馆/"会被人为是第一部分 public static void ParseLocationName(string strName, @@ -143,12 +142,12 @@ public virtual int GetArrivedCopy() public virtual List GetRefIDs() { List results = new List(); - foreach(Location location in this) + foreach (Location location in this) { if (String.IsNullOrEmpty(location.RefID) == true) continue; - string[] parts = location.RefID.Split(new char [] {'|'}); + string[] parts = location.RefID.Split(new char[] { '|' }); results.AddRange(parts); } @@ -241,7 +240,6 @@ public int Build(string value, strLocationString = strSection.Substring(0, nRet).Trim(); string strCount = strSection.Substring(nRet + 1); - nRet = strCount.IndexOf("{"); if (nRet != -1) { diff --git a/dp2Circulation/Charging/ChargingForm.cs b/dp2Circulation/Charging/ChargingForm.cs index 7e636d3e6..41a0d0dd0 100644 --- a/dp2Circulation/Charging/ChargingForm.cs +++ b/dp2Circulation/Charging/ChargingForm.cs @@ -3422,6 +3422,11 @@ public enum FuncState /// 盘点图书 /// InventoryBook = 10, // 盘点图书 2015/8/16 + + /// + /// 读过 + /// + Read = 11, // 读过 2016/1/8 } /*public*/ diff --git a/dp2Circulation/Charging/ChargingTask.cs b/dp2Circulation/Charging/ChargingTask.cs index 54d651255..83a71a09f 100644 --- a/dp2Circulation/Charging/ChargingTask.cs +++ b/dp2Circulation/Charging/ChargingTask.cs @@ -137,6 +137,10 @@ public void RefreshDisplay(DpRow row) { strText = GetOperText("盘点"); } + else if (this.Action == "read") + { + strText = GetOperText("读过"); + } if (string.IsNullOrEmpty(this.ErrorInfo) == false) strText += "\r\n===\r\n" + this.ErrorInfo; @@ -198,7 +202,6 @@ string GetOperText(string strOperName) return this.ReaderBarcode + " " + this.ReaderName + " " + strOperName + " " + this.ItemBarcode + strSummary; else return strOperName + " " + this.ItemBarcode + strSummary; - } // 任务是否完成 @@ -337,7 +340,8 @@ public override void Worker() || task.Action == "verify_return" || task.Action == "lost" || task.Action == "verify_lost" - || task.Action == "inventory") + || task.Action == "inventory" + || task.Action == "read") { Return(task); } @@ -922,6 +926,8 @@ void Return(ChargingTask task) if (task.Action == "inventory") strOperText = task.ReaderBarcode + " 盘点 " + task.ItemBarcode; + else if (task.Action == "read") + strOperText = task.ReaderBarcode + " 读过 " + task.ItemBarcode; else strOperText = task.ReaderBarcode + " 还 " + task.ItemBarcode; @@ -971,6 +977,16 @@ void Return(ChargingTask task) } strAction = "inventory"; } + else if (task.Action == "read") + { + if (string.IsNullOrEmpty(strReaderBarcode) == true) + { + strError = "尚未输入读者证条码号"; + task.ErrorInfo = strError; + goto ERROR1; + } + strAction = "read"; + } else { strReaderBarcode = ""; @@ -1192,7 +1208,6 @@ void Return(ChargingTask task) times.Add(DateTime.Now); LogOperTime("return", times, strOperText); - return; ERROR1: diff --git a/dp2Circulation/Charging/QuickChargingForm.Designer.cs b/dp2Circulation/Charging/QuickChargingForm.Designer.cs index 5f83c6023..38bcd711c 100644 --- a/dp2Circulation/Charging/QuickChargingForm.Designer.cs +++ b/dp2Circulation/Charging/QuickChargingForm.Designer.cs @@ -45,7 +45,7 @@ private void InitializeComponent() this.toolStripMenuItem_verifyLost = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItem_loadPatronInfo = new System.Windows.Forms.ToolStripMenuItem(); - this.ToolStripMenuItem_inventoryBook = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem_inventoryBook = new System.Windows.Forms.ToolStripMenuItem(); this.dpColumn_color = new DigitalPlatform.CommonControl.DpColumn(); this.dpColumn_state = new DigitalPlatform.CommonControl.DpColumn(); this.dpColumn_content = new DigitalPlatform.CommonControl.DpColumn(); @@ -69,6 +69,7 @@ private void InitializeComponent() this.toolStripButton_selectItem = new System.Windows.Forms.ToolStripButton(); this.toolStripDropDownButton1 = new System.Windows.Forms.ToolStripDropDownButton(); this.ToolStripMenuItem_inventoryFromFile = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem_read = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStrip_selectFunc.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer_main)).BeginInit(); this.splitContainer_main.Panel1.SuspendLayout(); @@ -103,100 +104,101 @@ private void InitializeComponent() this.toolStripMenuItem_verifyLost, this.toolStripSeparator4, this.toolStripMenuItem_loadPatronInfo, - this.ToolStripMenuItem_inventoryBook}); + this.toolStripMenuItem_inventoryBook, + this.toolStripMenuItem_read}); this.contextMenuStrip_selectFunc.Name = "contextMenuStrip_selectFunc"; - this.contextMenuStrip_selectFunc.Size = new System.Drawing.Size(149, 248); + this.contextMenuStrip_selectFunc.Size = new System.Drawing.Size(153, 292); this.contextMenuStrip_selectFunc.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip_selectFunc_Opening); // // toolStripMenuItem_borrow // this.toolStripMenuItem_borrow.Name = "toolStripMenuItem_borrow"; - this.toolStripMenuItem_borrow.Size = new System.Drawing.Size(148, 22); + this.toolStripMenuItem_borrow.Size = new System.Drawing.Size(152, 22); this.toolStripMenuItem_borrow.Text = "借"; this.toolStripMenuItem_borrow.Click += new System.EventHandler(this.toolStripMenuItem_borrow_Click); // // toolStripMenuItem_continueBorrow // this.toolStripMenuItem_continueBorrow.Name = "toolStripMenuItem_continueBorrow"; - this.toolStripMenuItem_continueBorrow.Size = new System.Drawing.Size(148, 22); + this.toolStripMenuItem_continueBorrow.Size = new System.Drawing.Size(152, 22); this.toolStripMenuItem_continueBorrow.Text = "同一读者借"; this.toolStripMenuItem_continueBorrow.Click += new System.EventHandler(this.toolStripMenuItem_continueBorrow_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(145, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6); // // toolStripMenuItem_return // this.toolStripMenuItem_return.Name = "toolStripMenuItem_return"; - this.toolStripMenuItem_return.Size = new System.Drawing.Size(148, 22); + this.toolStripMenuItem_return.Size = new System.Drawing.Size(152, 22); this.toolStripMenuItem_return.Text = "还"; this.toolStripMenuItem_return.Click += new System.EventHandler(this.toolStripMenuItem_return_Click); // // toolStripMenuItem_verifyReturn // this.toolStripMenuItem_verifyReturn.Name = "toolStripMenuItem_verifyReturn"; - this.toolStripMenuItem_verifyReturn.Size = new System.Drawing.Size(148, 22); + this.toolStripMenuItem_verifyReturn.Size = new System.Drawing.Size(152, 22); this.toolStripMenuItem_verifyReturn.Text = "验证还"; this.toolStripMenuItem_verifyReturn.Click += new System.EventHandler(this.toolStripMenuItem_verifyReturn_Click); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(145, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(149, 6); // // toolStripMenuItem_renew // this.toolStripMenuItem_renew.Name = "toolStripMenuItem_renew"; - this.toolStripMenuItem_renew.Size = new System.Drawing.Size(148, 22); + this.toolStripMenuItem_renew.Size = new System.Drawing.Size(152, 22); this.toolStripMenuItem_renew.Text = "续借"; this.toolStripMenuItem_renew.Click += new System.EventHandler(this.toolStripMenuItem_renew_Click); // // toolStripMenuItem_verifyRenew // this.toolStripMenuItem_verifyRenew.Name = "toolStripMenuItem_verifyRenew"; - this.toolStripMenuItem_verifyRenew.Size = new System.Drawing.Size(148, 22); + this.toolStripMenuItem_verifyRenew.Size = new System.Drawing.Size(152, 22); this.toolStripMenuItem_verifyRenew.Text = "验证续借"; this.toolStripMenuItem_verifyRenew.Click += new System.EventHandler(this.toolStripMenuItem_verifyRenew_Click); // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(145, 6); + this.toolStripSeparator3.Size = new System.Drawing.Size(149, 6); // // toolStripMenuItem_lost // this.toolStripMenuItem_lost.Name = "toolStripMenuItem_lost"; - this.toolStripMenuItem_lost.Size = new System.Drawing.Size(148, 22); + this.toolStripMenuItem_lost.Size = new System.Drawing.Size(152, 22); this.toolStripMenuItem_lost.Text = "丢失"; this.toolStripMenuItem_lost.Click += new System.EventHandler(this.toolStripMenuItem_lost_Click); // // toolStripMenuItem_verifyLost // this.toolStripMenuItem_verifyLost.Name = "toolStripMenuItem_verifyLost"; - this.toolStripMenuItem_verifyLost.Size = new System.Drawing.Size(148, 22); + this.toolStripMenuItem_verifyLost.Size = new System.Drawing.Size(152, 22); this.toolStripMenuItem_verifyLost.Text = "验证丢失"; this.toolStripMenuItem_verifyLost.Click += new System.EventHandler(this.toolStripMenuItem_verifyLost_Click); // // toolStripSeparator4 // this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(145, 6); + this.toolStripSeparator4.Size = new System.Drawing.Size(149, 6); // // toolStripMenuItem_loadPatronInfo // this.toolStripMenuItem_loadPatronInfo.Name = "toolStripMenuItem_loadPatronInfo"; - this.toolStripMenuItem_loadPatronInfo.Size = new System.Drawing.Size(148, 22); + this.toolStripMenuItem_loadPatronInfo.Size = new System.Drawing.Size(152, 22); this.toolStripMenuItem_loadPatronInfo.Text = "装载读者信息"; this.toolStripMenuItem_loadPatronInfo.Click += new System.EventHandler(this.toolStripMenuItem_loadPatronInfo_Click); // // ToolStripMenuItem_inventoryBook // - this.ToolStripMenuItem_inventoryBook.Name = "ToolStripMenuItem_inventoryBook"; - this.ToolStripMenuItem_inventoryBook.Size = new System.Drawing.Size(148, 22); - this.ToolStripMenuItem_inventoryBook.Text = "盘点图书"; - this.ToolStripMenuItem_inventoryBook.Click += new System.EventHandler(this.ToolStripMenuItem_inventoryBook_Click); + this.toolStripMenuItem_inventoryBook.Name = "ToolStripMenuItem_inventoryBook"; + this.toolStripMenuItem_inventoryBook.Size = new System.Drawing.Size(152, 22); + this.toolStripMenuItem_inventoryBook.Text = "盘点图书"; + this.toolStripMenuItem_inventoryBook.Click += new System.EventHandler(this.ToolStripMenuItem_inventoryBook_Click); // // dpColumn_color // @@ -488,6 +490,13 @@ private void InitializeComponent() this.ToolStripMenuItem_inventoryFromFile.Text = "从文件导入盘点 ..."; this.ToolStripMenuItem_inventoryFromFile.Click += new System.EventHandler(this.ToolStripMenuItem_inventoryFromFile_Click); // + // ToolStripMenuItem_read + // + this.toolStripMenuItem_read.Name = "ToolStripMenuItem_read"; + this.toolStripMenuItem_read.Size = new System.Drawing.Size(152, 22); + this.toolStripMenuItem_read.Text = "读过"; + this.toolStripMenuItem_read.Click += new System.EventHandler(this.ToolStripMenuItem_read_Click); + // // QuickChargingForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -558,8 +567,9 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripButton toolStripButton_selectItem; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem_renew; private System.Windows.Forms.ToolStripButton toolStripButton_upperInput; - private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_inventoryBook; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem_inventoryBook; private System.Windows.Forms.ToolStripDropDownButton toolStripDropDownButton1; private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_inventoryFromFile; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem_read; } } \ No newline at end of file diff --git a/dp2Circulation/Charging/QuickChargingForm.cs b/dp2Circulation/Charging/QuickChargingForm.cs index b3156e3e7..2c77c84ce 100644 --- a/dp2Circulation/Charging/QuickChargingForm.cs +++ b/dp2Circulation/Charging/QuickChargingForm.cs @@ -3,6 +3,7 @@ using System.ComponentModel; using System.Data; using System.Drawing; +using System.Drawing.Drawing2D; using System.Linq; using System.Text; using System.Windows.Forms; @@ -10,16 +11,15 @@ using System.Threading; using System.Diagnostics; using System.Xml; -using System.Drawing.Drawing2D; using DigitalPlatform; +using DigitalPlatform.Xml; +using DigitalPlatform.Script; using DigitalPlatform.CommonControl; using DigitalPlatform.Text; using DigitalPlatform.IO; using DigitalPlatform.CirculationClient; using DigitalPlatform.LibraryClient.localhost; -using DigitalPlatform.Script; -using DigitalPlatform.Xml; namespace dp2Circulation { @@ -504,6 +504,12 @@ internal int SelectOneItem( dlg.FunctionType = "inventory"; dlg.Text = "请选择要盘点的册"; } + else if (func == dp2Circulation.FuncState.Read) + { + dlg.FunctionType = "read"; + dlg.VerifyBorrower = this._taskList.CurrentReaderBarcode; + dlg.Text = "请选择要读过的册"; + } dlg.AutoOperSingleItem = this.AutoOperSingleItem; dlg.AutoSearch = true; @@ -1586,6 +1592,21 @@ void _doAction(FuncState func, task.ItemBarcode = strText; task.Action = "verify_lost"; } + else if (func == dp2Circulation.FuncState.Read) + { + if (string.IsNullOrEmpty(this._taskList.CurrentReaderBarcode) == true) + { + WillLoadReaderInfo = true; + // 提示请输入读者证条码号 + // TODO: 这里直接出现对话框搜集读者证条码号 + MessageBox.Show(this, "请先输入读者证条码号,然后再输入册条码号"); + this.textBox_input.SelectAll(); + return; + } + task.ReaderBarcode = this._taskList.CurrentReaderBarcode; + task.ItemBarcode = strText; + task.Action = "read"; + } this.textBox_input.SelectAll(); @@ -1691,6 +1712,11 @@ private void ToolStripMenuItem_inventoryBook_Click(object sender, EventArgs e) this.FuncState = FuncState.InventoryBook; } + private void ToolStripMenuItem_read_Click(object sender, EventArgs e) + { + this.FuncState = FuncState.Read; + } + #region 各种配置参数 // 加快响应的记忆变量 @@ -1896,7 +1922,8 @@ FuncState FuncState this.toolStripMenuItem_verifyLost.Checked = false; this.toolStripMenuItem_loadPatronInfo.Checked = false; this.toolStripMenuItem_continueBorrow.Checked = false; - this.ToolStripMenuItem_inventoryBook.Checked = false; + this.toolStripMenuItem_inventoryBook.Checked = false; + this.toolStripMenuItem_read.Checked = false; if (this.AutoClearTextbox == true) { @@ -1957,9 +1984,13 @@ FuncState FuncState } else if (_funcstate == FuncState.InventoryBook) { - this.ToolStripMenuItem_inventoryBook.Checked = true; + this.toolStripMenuItem_inventoryBook.Checked = true; WillLoadReaderInfo = false; } + else if (_funcstate == FuncState.Read) + { + this.toolStripMenuItem_read.Checked = true; + } // SetInputMessage(); } } @@ -3234,6 +3265,8 @@ private void pictureBox_action_Paint(object sender, PaintEventArgs e) strText = "自"; else if (_funcstate == FuncState.InventoryBook) strText = "盘"; + else if (_funcstate == FuncState.Read) + strText = "读"; else strText = "?"; @@ -3402,6 +3435,7 @@ public int DoReturn(List barcode_list, return 0; } + } /// diff --git a/dp2Circulation/Charging/QuickChargingForm.resx b/dp2Circulation/Charging/QuickChargingForm.resx index e781aaec0..e69a4d68b 100644 --- a/dp2Circulation/Charging/QuickChargingForm.resx +++ b/dp2Circulation/Charging/QuickChargingForm.resx @@ -125,7 +125,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAC4 - CQAAAk1TRnQBSQFMAgEBAgEAAUwBAAFMAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CQAAAk1TRnQBSQFMAgEBAgEAAVQBAAFUAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -189,7 +189,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAB2 - IQAAAk1TRnQBSQFMAgEBBQEAAUwBAAFMAQABQAEAAUABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + IQAAAk1TRnQBSQFMAgEBBQEAAVQBAAFUAQABQAEAAUABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo BAABAQIAAYADAAEBAQABCAYAAYAYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -342,7 +342,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAs - DwAAAk1TRnQBSQFMAgEBBQEAAUwBAAFMAQABGAEAARgBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + DwAAAk1TRnQBSQFMAgEBBQEAAVQBAAFUAQABGAEAARgBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABYAMAATADAAEBAQABCAYAARIYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/dp2Circulation/EntityForm/EntityForm.cs b/dp2Circulation/EntityForm/EntityForm.cs index 301716aae..1101067a9 100644 --- a/dp2Circulation/EntityForm/EntityForm.cs +++ b/dp2Circulation/EntityForm/EntityForm.cs @@ -9998,13 +9998,48 @@ public void Logout() private void toolStripButton_prev_Click(object sender, EventArgs e) { - // TODO: 可以改进为调用Safe...,这样就不必在意Disable按钮来防止重入了 - this.LoadRecordOld(this.BiblioRecPath, "prev", true); + if (Control.ModifierKeys == Keys.Control) + { + this.ClearMessage(); + string strRecPath = GetPrevNextRecPath("prev"); + if (string.IsNullOrEmpty(strRecPath)) + this.ShowMessage("无法移动", "yellow", true); + else + this.LoadRecordOld(strRecPath, "", true); + } + else + { + // TODO: 可以改进为调用Safe...,这样就不必在意Disable按钮来防止重入了 + this.LoadRecordOld(this.BiblioRecPath, "prev", true); + } } private void toolStripButton_next_Click(object sender, EventArgs e) { - this.LoadRecordOld(this.BiblioRecPath, "next", true); + if (Control.ModifierKeys == Keys.Control) + { + this.ClearMessage(); + string strRecPath = GetPrevNextRecPath("next"); + if (string.IsNullOrEmpty(strRecPath)) + this.ShowMessage("无法移动", "yellow", true); + else + this.LoadRecordOld(strRecPath, "", true); + } + else + { + this.LoadRecordOld(this.BiblioRecPath, "next", true); + } + } + + static string GetPrevNextRecPath(string strStyle) + { + BiblioSearchForm form = Program.MainForm.GetTopChildWindow(); + if (form == null) + return ""; + ListViewItem item = form.MoveSelectedItem(strStyle); + if (item == null) + return ""; + return ListViewUtil.GetItemText(item, 0); } string m_strFocusedPart = ""; diff --git a/dp2Circulation/Issue/IssueControl.cs b/dp2Circulation/Issue/IssueControl.cs index 8e4f6c9d5..4d6b03abb 100644 --- a/dp2Circulation/Issue/IssueControl.cs +++ b/dp2Circulation/Issue/IssueControl.cs @@ -581,7 +581,7 @@ void DoNewIssue(/*string strPublishTime*/) edit.BiblioDbName = Global.GetDbName(this.BiblioRecPath); // 2009/2/15 edit.Text = "新增期"; edit.MainForm = this.MainForm; - // edit.EntityForm = this; + // edit.EntityForm = this; // ??? nRet = edit.InitialForEdit(issueitem, this.Items, out strError); diff --git a/dp2Circulation/ItemInfoForm/ItemInfoForm.cs b/dp2Circulation/ItemInfoForm/ItemInfoForm.cs index 833ef71f7..eb8c2ca8b 100644 --- a/dp2Circulation/ItemInfoForm/ItemInfoForm.cs +++ b/dp2Circulation/ItemInfoForm/ItemInfoForm.cs @@ -1672,8 +1672,9 @@ int LoadBorrowHistory( this.Channel.Idle += Channel_Idle; // 防止控制权出让给正在获取摘要的读者信息 HTML 页面 try { - lRet = this.Channel.LoadBorrowHistory(stop, + lRet = this.Channel.LoadChargingHistory(stop, strBarcode, + "return,lost,read", nPageNo, nLength, out total_results, @@ -1744,15 +1745,13 @@ void FillBorrowHistoryPage(List items, string strBinDir = Environment.CurrentDirectory; - string strCssUrl = Path.Combine(this.MainForm.DataDir, "default\\inventory.css"); + string strCssUrl = Path.Combine(this.MainForm.DataDir, "default\\charginghistory.css"); string strLink = ""; string strScriptHead = "" + "" + ""; string strStyle = @""; text.Append("" @@ -1778,6 +1777,7 @@ void FillBorrowHistoryPage(List items, text.Append("
序号操作类型册条码号书目摘要操作者操作时间序号册条码号书目摘要期限借阅操作者借阅操作时间还回操作者还回操作时间
" + (nStart + 1).ToString() + "" + item.Action + "" + HttpUtility.HtmlEncode(item.Action) + "" + item.ItemBarcode + "BC:" + item.ItemBarcode + "" + HttpUtility.HtmlEncode(item.ItemBarcode) + "" + HttpUtility.HtmlEncode(item.ItemBarcode) + "BC:" + HttpUtility.HtmlEncode(item.ItemBarcode) + "" + HttpUtility.HtmlEncode(strPeriod) + "" + HttpUtility.HtmlEncode(strBorrowOperator) + "" + HttpUtility.HtmlEncode(strBorrowTime) + "" + HttpUtility.HtmlEncode(item.Operator) + "" + HttpUtility.HtmlEncode(item.OperTime) + "" + item.Operator + "" + item.OperTime + "
" + (i + 1).ToString() + "" + (i + this.StartIndex + 1).ToString() + "" + strBarcodeLink + "" + info.strBarcode + "" + "" - + "
" - + this.GetString("续借次") - + " :" + info.strNo + "
" - + "
" - + this.GetString("借阅日期") - + ":" + info.strBorrowDate + "
" - + "
" - + this.GetString("期限") - + ": " + info.strBorrowPeriod + "
" - + "
" - + this.GetString("还书日期") - + ":" + info.strReturnDate + "
" - + "
" - + "
" - + this.GetString("借阅日期") - + ": " + info.strBorrowDate + "
" - + "
" - + this.GetString("还书日期") - + ": " + info.strReturnDate + "
" - + "
" + + "
" + + this.GetString("续借次") + + " :" + info.strNo + "
" + + "
" + + this.GetString("借阅日期") + + ":" + info.strBorrowDate + "
" + + "
" + + this.GetString("期限") + + ": " + info.strBorrowPeriod + "
" + + "
" + + this.GetString("还书日期") + + ":" + info.strReturnDate + "
" + + "
" + info.strRenewComment + "" + info.strRenewComment + "
"); text.Append(""); text.Append(""); + text.Append(""); text.Append(""); text.Append(""); text.Append(""); @@ -1790,8 +1790,9 @@ void FillBorrowHistoryPage(List items, foreach (ChargingItemWrapper wrapper in items) { ChargingItem item = wrapper.Item; - text.Append(""); + text.Append(""); text.Append(""); + text.Append(""); text.Append(""); text.Append(""); @@ -1830,7 +1831,7 @@ void FillBorrowHistoryPage(List items, /// public void ClearHtml() { - string strCssUrl = Path.Combine(this.MainForm.DataDir, "default\\inventory.css"); + string strCssUrl = Path.Combine(this.MainForm.DataDir, "default\\charginghistory.css"); string strLink = ""; string strJs = ""; diff --git a/dp2Circulation/MainForm/InitialExtension.cs b/dp2Circulation/MainForm/InitialExtension.cs index a344de3e7..e879e99c6 100644 --- a/dp2Circulation/MainForm/InitialExtension.cs +++ b/dp2Circulation/MainForm/InitialExtension.cs @@ -1791,6 +1791,7 @@ bool CopyDefaultCfgFiles(out string strError) filenames.Add("objectrights.xml"); filenames.Add("inventory_item_browse.xml"); filenames.Add("inventory.css"); + filenames.Add("charginghistory.css"); filenames.Add("nonephoto.png"); #if NO filenames.Add("comment_change_actions.xml"); diff --git a/dp2Circulation/OperHistory/OperHistory.cs b/dp2Circulation/OperHistory/OperHistory.cs index 6b239951b..8d2de9aab 100644 --- a/dp2Circulation/OperHistory/OperHistory.cs +++ b/dp2Circulation/OperHistory/OperHistory.cs @@ -1272,6 +1272,8 @@ internal void Return( strOperName = "丢失"; else if (strAction == "inventory") strOperName = "盘点"; + else if (strAction == "read") + strOperName = "读过"; string strError = ""; string strSummary = ""; diff --git a/dp2Circulation/Order/OrderControl.cs b/dp2Circulation/Order/OrderControl.cs index f5df25913..f4e830aa8 100644 --- a/dp2Circulation/Order/OrderControl.cs +++ b/dp2Circulation/Order/OrderControl.cs @@ -1695,6 +1695,7 @@ void DoNewOrder(/*string strIndex*/) edit.BiblioDbName = Global.GetDbName(this.BiblioRecPath); // 2009/2/15 edit.Text = "新增订购事项"; edit.MainForm = this.MainForm; + edit.ItemControl = this; // 2016/1/8 nRet = edit.InitialForEdit(orderitem, this.Items, out strError); @@ -3698,6 +3699,86 @@ private void ListView_ColumnClick(object sender, ColumnClickEventArgs e) this.listView.ListViewItemSorter = null; } + // 条码查重 + // return: + // -1 出错 + // 0 不重复 + // 1 重复 + /// + /// 对distribute 中的 refid 查重 + /// + /// 发起查重的 distribute 字符串 + /// 发起查重的对象 + /// 是否要检查当前列表中的(尚未保存的)事项 + /// 是否对数据库进行查重 + /// 返回出错信息 + /// -1: 出错; 0: 不重复; 1: 有重复 + public int CheckDistributeDup( + string strDistribute, + OrderItem myself, + bool bCheckCurrentList, + bool bCheckDb, + out string strError) + { + strError = ""; + int nRet = 0; + + if (string.IsNullOrEmpty(strDistribute) == true) + return 0; + + if (bCheckCurrentList == true) + { + LocationCollection locations = new LocationCollection(); + nRet = locations.Build(strDistribute, out strError); + if (nRet == -1) + { + strError = "待查重的馆藏分配字符串 '" + strDistribute + "' 格式错误: " + strError; + return -1; + } + + List refids = locations.GetRefIDs(); + if (refids.Count == 0) + return 0; + + foreach(OrderItem item in this.Items) + { + if (item == myself) + continue; + string strCurrent = item.Distribute; + if (string.IsNullOrEmpty(strCurrent) == true) + continue; + + LocationCollection current_locations = new LocationCollection(); + nRet = current_locations.Build(strCurrent, out strError); + if (nRet == -1) + { + strError = "列表中某订购记录的馆藏分配字符串 '" + strCurrent + "' 格式错误: " + strError; + return -1; + } + if (current_locations.Count == 0) + continue; + List current_refids = current_locations.GetRefIDs(); + if (current_refids.Count == 0) + continue; + foreach(string s in refids) + { + if (current_refids.IndexOf(s) != -1) + { + strError = "馆藏分配字符串中的参考ID '"+s+"' 和其它订购记录的馆藏分配字符串发生了重复"; + return 1; + } + } + } + } + + // 对所有订购记录进行馆藏分配字符串(refid)查重 + if (bCheckDb == true) + { + } + + return 0; + } + #if NO // 2009/11/23 // 根据订购记录路径 检索出 书目记录 和全部下属订购记录,装入窗口 diff --git a/dp2Circulation/Order/OrderEditControl.Designer.cs b/dp2Circulation/Order/OrderEditControl.Designer.cs index f845873b5..30d40a308 100644 --- a/dp2Circulation/Order/OrderEditControl.Designer.cs +++ b/dp2Circulation/Order/OrderEditControl.Designer.cs @@ -55,7 +55,7 @@ private void InitializeComponent() this.textBox_totalPrice = new System.Windows.Forms.TextBox(); this.label8 = new System.Windows.Forms.Label(); this.label_distribute_color = new System.Windows.Forms.Label(); - this.textBox_distribute = new System.Windows.Forms.TextBox(); + this.textBox_distribute = new DigitalPlatform.CommonControl.AutoHeightTextBox(); this.label9 = new System.Windows.Forms.Label(); this.label_orderTime_color = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); @@ -279,7 +279,7 @@ private void InitializeComponent() // this.label13.AutoSize = true; this.label13.Dock = System.Windows.Forms.DockStyle.Fill; - this.label13.Location = new System.Drawing.Point(15, 382); + this.label13.Location = new System.Drawing.Point(15, 389); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(77, 18); this.label13.TabIndex = 24; @@ -290,7 +290,7 @@ private void InitializeComponent() // this.textBox_batchNo.Anchor = System.Windows.Forms.AnchorStyles.Left; this.textBox_batchNo.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.textBox_batchNo.Location = new System.Drawing.Point(103, 384); + this.textBox_batchNo.Location = new System.Drawing.Point(103, 391); this.textBox_batchNo.Margin = new System.Windows.Forms.Padding(2); this.textBox_batchNo.MinimumSize = new System.Drawing.Size(80, 0); this.textBox_batchNo.Name = "textBox_batchNo"; @@ -365,7 +365,7 @@ private void InitializeComponent() // this.label_batchNo_color.AutoSize = true; this.label_batchNo_color.Dock = System.Windows.Forms.DockStyle.Fill; - this.label_batchNo_color.Location = new System.Drawing.Point(97, 382); + this.label_batchNo_color.Location = new System.Drawing.Point(97, 389); this.label_batchNo_color.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label_batchNo_color.Name = "label_batchNo_color"; this.label_batchNo_color.Size = new System.Drawing.Size(2, 18); @@ -469,7 +469,7 @@ private void InitializeComponent() this.label8.Dock = System.Windows.Forms.DockStyle.Fill; this.label8.Location = new System.Drawing.Point(15, 256); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(77, 18); + this.label8.Size = new System.Drawing.Size(77, 25); this.label8.TabIndex = 48; this.label8.Text = "ݲط"; this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; @@ -481,7 +481,7 @@ private void InitializeComponent() this.label_distribute_color.Location = new System.Drawing.Point(97, 256); this.label_distribute_color.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label_distribute_color.Name = "label_distribute_color"; - this.label_distribute_color.Size = new System.Drawing.Size(2, 18); + this.label_distribute_color.Size = new System.Drawing.Size(2, 25); this.label_distribute_color.TabIndex = 49; // // textBox_distribute @@ -492,8 +492,10 @@ private void InitializeComponent() this.textBox_distribute.Location = new System.Drawing.Point(103, 258); this.textBox_distribute.Margin = new System.Windows.Forms.Padding(2); this.textBox_distribute.MinimumSize = new System.Drawing.Size(180, 0); + this.textBox_distribute.Multiline = true; this.textBox_distribute.Name = "textBox_distribute"; - this.textBox_distribute.Size = new System.Drawing.Size(189, 14); + this.textBox_distribute.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.textBox_distribute.Size = new System.Drawing.Size(189, 21); this.textBox_distribute.TabIndex = 50; // // label9 @@ -554,7 +556,7 @@ private void InitializeComponent() // this.textBox_comment.BorderStyle = System.Windows.Forms.BorderStyle.None; this.textBox_comment.Dock = System.Windows.Forms.DockStyle.Fill; - this.textBox_comment.Location = new System.Drawing.Point(103, 300); + this.textBox_comment.Location = new System.Drawing.Point(103, 307); this.textBox_comment.Margin = new System.Windows.Forms.Padding(2); this.textBox_comment.MinimumSize = new System.Drawing.Size(180, 80); this.textBox_comment.Multiline = true; @@ -567,7 +569,7 @@ private void InitializeComponent() // this.label6.AutoSize = true; this.label6.Dock = System.Windows.Forms.DockStyle.Fill; - this.label6.Location = new System.Drawing.Point(15, 298); + this.label6.Location = new System.Drawing.Point(15, 305); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(77, 84); this.label6.TabIndex = 18; @@ -578,7 +580,7 @@ private void InitializeComponent() // this.label_comment_color.AutoSize = true; this.label_comment_color.Dock = System.Windows.Forms.DockStyle.Fill; - this.label_comment_color.Location = new System.Drawing.Point(97, 298); + this.label_comment_color.Location = new System.Drawing.Point(97, 305); this.label_comment_color.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label_comment_color.Name = "label_comment_color"; this.label_comment_color.Size = new System.Drawing.Size(2, 84); @@ -688,7 +690,7 @@ private void InitializeComponent() // this.label17.AutoSize = true; this.label17.Dock = System.Windows.Forms.DockStyle.Fill; - this.label17.Location = new System.Drawing.Point(15, 274); + this.label17.Location = new System.Drawing.Point(15, 281); this.label17.Name = "label17"; this.label17.Size = new System.Drawing.Size(77, 24); this.label17.TabIndex = 66; @@ -699,7 +701,7 @@ private void InitializeComponent() // this.label_class_color.AutoSize = true; this.label_class_color.Dock = System.Windows.Forms.DockStyle.Fill; - this.label_class_color.Location = new System.Drawing.Point(97, 274); + this.label_class_color.Location = new System.Drawing.Point(97, 281); this.label_class_color.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label_class_color.Name = "label_class_color"; this.label_class_color.Size = new System.Drawing.Size(2, 24); @@ -710,7 +712,7 @@ private void InitializeComponent() this.comboBox_class.Dock = System.Windows.Forms.DockStyle.Fill; this.comboBox_class.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.comboBox_class.FormattingEnabled = true; - this.comboBox_class.Location = new System.Drawing.Point(103, 276); + this.comboBox_class.Location = new System.Drawing.Point(103, 283); this.comboBox_class.Margin = new System.Windows.Forms.Padding(2); this.comboBox_class.MinimumSize = new System.Drawing.Size(90, 0); this.comboBox_class.Name = "comboBox_class"; @@ -723,7 +725,7 @@ private void InitializeComponent() // this.label10.AutoSize = true; this.label10.Dock = System.Windows.Forms.DockStyle.Fill; - this.label10.Location = new System.Drawing.Point(15, 585); + this.label10.Location = new System.Drawing.Point(15, 592); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(77, 18); this.label10.TabIndex = 36; @@ -734,7 +736,7 @@ private void InitializeComponent() // this.label_recPath_color.AutoSize = true; this.label_recPath_color.Dock = System.Windows.Forms.DockStyle.Fill; - this.label_recPath_color.Location = new System.Drawing.Point(97, 585); + this.label_recPath_color.Location = new System.Drawing.Point(97, 592); this.label_recPath_color.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label_recPath_color.Name = "label_recPath_color"; this.label_recPath_color.Size = new System.Drawing.Size(2, 18); @@ -744,7 +746,7 @@ private void InitializeComponent() // this.textBox_recPath.Anchor = System.Windows.Forms.AnchorStyles.Left; this.textBox_recPath.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.textBox_recPath.Location = new System.Drawing.Point(103, 587); + this.textBox_recPath.Location = new System.Drawing.Point(103, 594); this.textBox_recPath.Margin = new System.Windows.Forms.Padding(2); this.textBox_recPath.MinimumSize = new System.Drawing.Size(90, 0); this.textBox_recPath.Name = "textBox_recPath"; @@ -755,7 +757,7 @@ private void InitializeComponent() // this.label18.AutoSize = true; this.label18.Dock = System.Windows.Forms.DockStyle.Fill; - this.label18.Location = new System.Drawing.Point(15, 400); + this.label18.Location = new System.Drawing.Point(15, 407); this.label18.Name = "label18"; this.label18.Size = new System.Drawing.Size(77, 117); this.label18.TabIndex = 69; @@ -766,7 +768,7 @@ private void InitializeComponent() // this.label_sellerAddress_color.AutoSize = true; this.label_sellerAddress_color.Dock = System.Windows.Forms.DockStyle.Fill; - this.label_sellerAddress_color.Location = new System.Drawing.Point(97, 400); + this.label_sellerAddress_color.Location = new System.Drawing.Point(97, 407); this.label_sellerAddress_color.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label_sellerAddress_color.Name = "label_sellerAddress_color"; this.label_sellerAddress_color.Size = new System.Drawing.Size(2, 117); @@ -779,7 +781,7 @@ private void InitializeComponent() this.textBox_sellerAddress.BorderStyle = System.Windows.Forms.BorderStyle.None; this.textBox_sellerAddress.Dock = System.Windows.Forms.DockStyle.Fill; this.textBox_sellerAddress.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.textBox_sellerAddress.Location = new System.Drawing.Point(103, 402); + this.textBox_sellerAddress.Location = new System.Drawing.Point(103, 409); this.textBox_sellerAddress.Margin = new System.Windows.Forms.Padding(2); this.textBox_sellerAddress.MaxLength = 0; this.textBox_sellerAddress.MinimumSize = new System.Drawing.Size(180, 60); @@ -793,7 +795,7 @@ private void InitializeComponent() // this.label19.AutoSize = true; this.label19.Dock = System.Windows.Forms.DockStyle.Fill; - this.label19.Location = new System.Drawing.Point(15, 603); + this.label19.Location = new System.Drawing.Point(15, 610); this.label19.Name = "label19"; this.label19.Size = new System.Drawing.Size(77, 18); this.label19.TabIndex = 72; @@ -804,7 +806,7 @@ private void InitializeComponent() // this.textBox_refID.BorderStyle = System.Windows.Forms.BorderStyle.None; this.textBox_refID.Dock = System.Windows.Forms.DockStyle.Fill; - this.textBox_refID.Location = new System.Drawing.Point(103, 605); + this.textBox_refID.Location = new System.Drawing.Point(103, 612); this.textBox_refID.Margin = new System.Windows.Forms.Padding(2); this.textBox_refID.MinimumSize = new System.Drawing.Size(180, 0); this.textBox_refID.Name = "textBox_refID"; @@ -815,7 +817,7 @@ private void InitializeComponent() // this.label_refID_color.AutoSize = true; this.label_refID_color.Dock = System.Windows.Forms.DockStyle.Fill; - this.label_refID_color.Location = new System.Drawing.Point(97, 603); + this.label_refID_color.Location = new System.Drawing.Point(97, 610); this.label_refID_color.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label_refID_color.Name = "label_refID_color"; this.label_refID_color.Size = new System.Drawing.Size(2, 18); @@ -825,7 +827,7 @@ private void InitializeComponent() // this.textBox_operations.BorderStyle = System.Windows.Forms.BorderStyle.None; this.textBox_operations.Dock = System.Windows.Forms.DockStyle.Fill; - this.textBox_operations.Location = new System.Drawing.Point(103, 519); + this.textBox_operations.Location = new System.Drawing.Point(103, 526); this.textBox_operations.Margin = new System.Windows.Forms.Padding(2); this.textBox_operations.MaxLength = 0; this.textBox_operations.MinimumSize = new System.Drawing.Size(180, 32); @@ -839,7 +841,7 @@ private void InitializeComponent() // this.label_operations_color.AutoSize = true; this.label_operations_color.Dock = System.Windows.Forms.DockStyle.Fill; - this.label_operations_color.Location = new System.Drawing.Point(97, 517); + this.label_operations_color.Location = new System.Drawing.Point(97, 524); this.label_operations_color.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label_operations_color.Name = "label_operations_color"; this.label_operations_color.Size = new System.Drawing.Size(2, 68); @@ -849,7 +851,7 @@ private void InitializeComponent() // this.label20.AutoSize = true; this.label20.Dock = System.Windows.Forms.DockStyle.Fill; - this.label20.Location = new System.Drawing.Point(15, 517); + this.label20.Location = new System.Drawing.Point(15, 524); this.label20.Name = "label20"; this.label20.Size = new System.Drawing.Size(77, 68); this.label20.TabIndex = 77; @@ -920,7 +922,7 @@ private void InitializeComponent() private System.Windows.Forms.TextBox textBox_totalPrice; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label_distribute_color; - private System.Windows.Forms.TextBox textBox_distribute; + private DigitalPlatform.CommonControl.AutoHeightTextBox textBox_distribute; private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label_orderTime_color; private System.Windows.Forms.Label label_orderID_color; diff --git a/dp2Circulation/Order/OrderEditControl.cs b/dp2Circulation/Order/OrderEditControl.cs index 1e4dc8d03..42f034d76 100644 --- a/dp2Circulation/Order/OrderEditControl.cs +++ b/dp2Circulation/Order/OrderEditControl.cs @@ -538,7 +538,6 @@ internal override void DomToMember(string strRecPath) "operations"); this.RecPath = strRecPath; - } /// @@ -923,7 +922,6 @@ public override void SetChangeable() // 防止重入 2009/7/19 int m_nInDropDown = 0; - private void comboBox_state_DropDown(object sender, EventArgs e) { // 防止重入 2009/7/19 @@ -937,8 +935,6 @@ private void comboBox_state_DropDown(object sender, EventArgs e) this.m_nInDropDown++; try { - - if (combobox.Items.Count == 0 /*&& this.GetValueTable != null*/) { @@ -1000,7 +996,6 @@ public override void HighlightDifferences(ItemEditControlBase r) if (this.CatalogNo != refControl.CatalogNo) this.label_catalogNo_color.BackColor = this.ColorDifference; - if (this.Seller != refControl.Seller) this.label_seller_color.BackColor = this.ColorDifference; @@ -1294,7 +1289,18 @@ public int VerifyFields(out string strError) } } - // TODO: 验证馆藏分配字符串 + // 验证馆藏分配字符串 + string strDistribute = this.Distribute; + if (string.IsNullOrEmpty(strDistribute) == false) + { + LocationCollection locations = new LocationCollection(); + nRet = locations.Build(strDistribute, out strError); + if (nRet == -1) + { + strError = "馆藏分配字符串 '" + strDistribute + "' 格式错误: " + strError; + return -1; + } + } return 0; } diff --git a/dp2Circulation/Order/OrderEditForm.cs b/dp2Circulation/Order/OrderEditForm.cs index dfb411126..55a2d3935 100644 --- a/dp2Circulation/Order/OrderEditForm.cs +++ b/dp2Circulation/Order/OrderEditForm.cs @@ -533,6 +533,46 @@ private void OrderEditForm_FormClosed(object sender, FormClosedEventArgs e) * */ } + OrderControl OrderControl + { + get + { + return (OrderControl)this.ItemControl; + } + } + + internal override int RestoreVerify(out string strError) + { + strError = ""; + int nRet = 0; + + // TODO: 是否当这个checkbox为false的时候,至少也要检查本种之类的重复情形? + // 如果这里不检查,可否在提交保存的时候,先查完本种之类的重复,才真正向服务器提交? + if (this.checkBox_autoSearchDup.Checked == true + && this.OrderControl != null + && String.IsNullOrEmpty(this.orderEditControl_editing.Distribute) == false) + { + // Debug.Assert(false, ""); + // distribute 中的 refid 查重 + // return: + // -1 出错 + // 0 不重复 + // 1 重复 + nRet = this.OrderControl.CheckDistributeDup( + this.orderEditControl_editing.Distribute, + this.Item, + true, // bCheckCurrentList, + true, // bCheckDb, + out strError); + if (nRet == -1) + return -1; + if (nRet == 1) + return -1; // 重复 + } + + return 0; + } + /// /// 结束前的校验 /// @@ -666,7 +706,6 @@ private void button_editing_nextRecord_Click(object sender, EventArgs e) EnablePrevNextRecordButtons(); this.EnableControls(true); - } private void orderEditControl_editing_ContentChanged(object sender, ContentChangedEventArgs e) @@ -722,10 +761,9 @@ private void orderEditControl_editing_ControlKeyDown(object sender, ControlKeyEv this.orderEditControl_editing.OrderID = orderitem.OrderID; break; case "Distribute": + // TODO: 复制的时候是否要自动去掉 refid 部分? this.orderEditControl_editing.Distribute = orderitem.Distribute; break; - - case "Comment": this.orderEditControl_editing.Comment = orderitem.Comment; break; diff --git a/dp2Circulation/Reader/ReaderInfoForm.cs b/dp2Circulation/Reader/ReaderInfoForm.cs index 313cbddbf..9150b7342 100644 --- a/dp2Circulation/Reader/ReaderInfoForm.cs +++ b/dp2Circulation/Reader/ReaderInfoForm.cs @@ -5668,9 +5668,10 @@ int LoadBorrowHistory( this.Channel.Idle += Channel_Idle; // 防止控制权出让给正在获取摘要的读者信息 HTML 页面 try { - lRet = this.Channel.LoadBorrowHistory( + lRet = this.Channel.LoadChargingHistory( stop, strBarcode, + "return,lost,read", nPageNo, nLength, out total_results, @@ -5817,6 +5818,17 @@ static string MakeAnchor(string name, string caption, bool enabled) return HttpUtility.HtmlEncode(caption); } + public static string GetOperTypeName(string strAction) + { + if (strAction == "return") + return "借过"; + if (strAction == "lost") + return "借过(丢失)"; + if (strAction == "read") + return "读过"; + return strAction; + } + void FillBorrowHistoryPage(List items, int nStart, int nTotalCount) @@ -5832,15 +5844,12 @@ void FillBorrowHistoryPage(List items, string strBinDir = Environment.CurrentDirectory; - string strCssUrl = Path.Combine(this.MainForm.DataDir, "default\\inventory.css"); + string strCssUrl = Path.Combine(this.MainForm.DataDir, "default\\charginghistory.css"); string strLink = ""; string strScriptHead = "" + "" + ""; string strStyle = @""; text.Append("" + strLink @@ -5865,6 +5874,7 @@ void FillBorrowHistoryPage(List items, text.Append("
序号类型证条码号姓名期限
" + (nStart + 1).ToString() + "" + HttpUtility.HtmlEncode(ReaderInfoForm.GetOperTypeName(item.Action)) + "" + HttpUtility.HtmlEncode(item.PatronBarcode) + "P:" + HttpUtility.HtmlEncode(item.PatronBarcode) + "
"); text.Append(""); text.Append(""); + text.Append(""); text.Append(""); text.Append(""); text.Append(""); @@ -5877,9 +5887,9 @@ void FillBorrowHistoryPage(List items, foreach (ChargingItemWrapper wrapper in items) { ChargingItem item = wrapper.Item; - text.Append(""); + text.Append(""); text.Append(""); - // text.Append(""); + text.Append(""); if (string.IsNullOrEmpty(item.ItemBarcode) == false && item.ItemBarcode.StartsWith("@refID:") == true) @@ -5921,7 +5931,7 @@ void FillBorrowHistoryPage(List items, /// public void ClearHtml() { - string strCssUrl = Path.Combine(this.MainForm.DataDir, "default\\inventory.css"); + string strCssUrl = Path.Combine(this.MainForm.DataDir, "default\\charginghistory.css"); string strLink = ""; string strJs = ""; diff --git a/dp2Circulation/SearchForms/BiblioSearchForm.cs b/dp2Circulation/SearchForms/BiblioSearchForm.cs index 3f1b65d26..2ff49a63e 100644 --- a/dp2Circulation/SearchForms/BiblioSearchForm.cs +++ b/dp2Circulation/SearchForms/BiblioSearchForm.cs @@ -5712,7 +5712,7 @@ void menu_deleteSelectedRecords_Click(object sender, EventArgs e) byte[] baTimestamp = null; string strOutputPath = ""; string[] formats = null; - if (bDeleteSub == false + if (bDeleteSub == false && StringUtil.CompareVersion(this.MainForm.ServerVersion, "2.30") >= 0) { formats = new string[1]; @@ -8093,6 +8093,32 @@ void UpdateMenu() } } + // 前移或后移 Selection Item + public ListViewItem MoveSelectedItem(string strStyle) + { + if (this.listView_records.Items.Count == 0) + return null; + ListViewItem item = null; + if (this.listView_records.SelectedItems.Count == 0) + { + item = this.listView_records.Items[0]; + item.Selected = true; + return item; + } + + item = this.listView_records.SelectedItems[0]; + if (this.listView_records.SelectedItems.Count > 1) + ListViewUtil.SelectLine(item, true); + + string strError = ""; + List indices = null; + bool bRet = ListViewUtil.MoveSelectedUpDown( + this.listView_records, + strStyle == "prev" ? true : false); + if (bRet == false) + return null; + return this.listView_records.SelectedItems[0]; + } } // 为一行存储的书目信息 diff --git a/dp2Circulation/Statis/ConvertReportFormatDialog.cs b/dp2Circulation/Statis/ConvertReportFormatDialog.cs index c67e9dbd0..0e2e91ade 100644 --- a/dp2Circulation/Statis/ConvertReportFormatDialog.cs +++ b/dp2Circulation/Statis/ConvertReportFormatDialog.cs @@ -138,9 +138,9 @@ public string UiState private void button_localReportDir_Click(object sender, EventArgs e) { - string strReportDir = Path.Combine(this.MainForm.UserDir, "reports"); + // string strReportDir = Path.Combine(this.MainForm.UserDir, "reports"); - this.textBox_reportDirectory.Text = strReportDir; + this.textBox_reportDirectory.Text = ReportForm.GetReportDir(); } } } diff --git a/dp2Circulation/Statis/ReportApplyForm.cs b/dp2Circulation/Statis/ReportApplyForm.cs index a3d10a7d5..f235a812f 100644 --- a/dp2Circulation/Statis/ReportApplyForm.cs +++ b/dp2Circulation/Statis/ReportApplyForm.cs @@ -496,7 +496,7 @@ void AutoFillReportName() if (string.IsNullOrEmpty(config.TypeName) == false && config.TypeName.Length > 3) - this.textBox_reportName.Text = config.TypeName.Substring(3).Trim(); + this.textBox_reportName.Text = config.TypeName.Substring(GetNumberPrefix(config.TypeName).Length).Trim(); if (string.IsNullOrEmpty(this.checkedComboBox_createFreq.Text) == true) this.checkedComboBox_createFreq.Text = config.CreateFreq; @@ -506,6 +506,20 @@ void AutoFillReportName() MessageBox.Show(this, strError); } + // 获得一个字符串前面的数字部分。例如 "101 xxxx" "9101 xxxxxxx" + static string GetNumberPrefix(string strText) + { + StringBuilder result = new StringBuilder(); + foreach(char ch in strText) + { + if (char.IsDigit(ch) == false) + return result.ToString(); + result.Append(ch); + } + + return result.ToString(); + } + private void textBox_cfgFileName_TextChanged(object sender, EventArgs e) { } @@ -517,7 +531,11 @@ void FillReportTypeList() string strCfgDir = Path.Combine(this.MainForm.UserDir, "report_def"); DirectoryInfo di = new DirectoryInfo(strCfgDir); - FileInfo[] fis = di.GetFiles("???.xml"); + + List array = new List(); + array.AddRange( di.GetFiles("???.xml")); + array.AddRange( di.GetFiles("????.xml")); + FileInfo[] fis = array.ToArray(); Array.Sort(fis, new FileInfoCompare()); foreach (FileInfo fi in fis) diff --git a/dp2Circulation/Statis/ReportForm.Designer.cs b/dp2Circulation/Statis/ReportForm.Designer.cs index 4888ad79e..2927410f4 100644 --- a/dp2Circulation/Statis/ReportForm.Designer.cs +++ b/dp2Circulation/Statis/ReportForm.Designer.cs @@ -59,6 +59,7 @@ private void InitializeComponent() this.toolStripButton_setReportEndDay = new System.Windows.Forms.ToolStripButton(); this.toolStripButton_convertFormat = new System.Windows.Forms.ToolStripButton(); this.timer_qu = new System.Windows.Forms.Timer(this.components); + this.toolStripButton_openReportFolder = new System.Windows.Forms.ToolStripButton(); this.tabControl1.SuspendLayout(); this.tabPage_start.SuspendLayout(); this.tabPage_libraryConfig.SuspendLayout(); @@ -356,7 +357,8 @@ private void InitializeComponent() this.toolStrip_main.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripButton_printHtml, this.toolStripButton_setReportEndDay, - this.toolStripButton_convertFormat}); + this.toolStripButton_convertFormat, + this.toolStripButton_openReportFolder}); this.toolStrip_main.Location = new System.Drawing.Point(0, 303); this.toolStrip_main.Name = "toolStrip_main"; this.toolStrip_main.Size = new System.Drawing.Size(431, 25); @@ -400,6 +402,16 @@ private void InitializeComponent() this.timer_qu.Interval = 1000; this.timer_qu.Tick += new System.EventHandler(this.timer_qu_Tick); // + // toolStripButton_openReportFolder + // + this.toolStripButton_openReportFolder.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.toolStripButton_openReportFolder.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton_openReportFolder.Image"))); + this.toolStripButton_openReportFolder.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton_openReportFolder.Name = "toolStripButton_openReportFolder"; + this.toolStripButton_openReportFolder.Size = new System.Drawing.Size(96, 22); + this.toolStripButton_openReportFolder.Text = "打开报表文件夹"; + this.toolStripButton_openReportFolder.Click += new System.EventHandler(this.toolStripButton_openReportFolder_Click); + // // ReportForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -470,5 +482,6 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripButton toolStripButton_convertFormat; private System.Windows.Forms.TabPage tabPage_option; private System.Windows.Forms.CheckBox checkBox_option_deleteReportFileAfterUpload; + private System.Windows.Forms.ToolStripButton toolStripButton_openReportFolder; } } \ No newline at end of file diff --git a/dp2Circulation/Statis/ReportForm.cs b/dp2Circulation/Statis/ReportForm.cs index f20e4029c..0d46b2636 100644 --- a/dp2Circulation/Statis/ReportForm.cs +++ b/dp2Circulation/Statis/ReportForm.cs @@ -143,8 +143,8 @@ private void ReportForm_FormClosed(object sender, FormClosedEventArgs e) if (this.MainForm != null && this.MainForm.AppInfo != null) this.MainForm.AppInfo.SetString( - GetReportSection(), - "ui_state", + GetReportSection(), + "ui_state", this.UiState); // 删除所有输出文件 @@ -443,8 +443,8 @@ int BuildItemRecords( if (lRet == -1) return -1; if (lRet == 0) - return 0; - + return 0; + long lHitCount = lRet; AdjustProgressRange(lOldCount, lHitCount); @@ -631,7 +631,7 @@ int BuildItemRecords( if (lines.Count > 0) { Debug.Assert(false, ""); - } + } return 0; } @@ -786,7 +786,7 @@ int BuildReaderRecords( if (lines.Count > 0) { Debug.Assert(false, ""); - } + } return 0; } @@ -970,8 +970,8 @@ int BuildBiblioRecords( if (lines.Count > 0) { Debug.Assert(false, ""); - } - + } + return 0; } } @@ -1168,7 +1168,7 @@ internal int GetClassFromStyles(out List styles, static string GetPureStyle(string strText) { List results = new List(); - string[] parts = strText.Split(new char [] { ',' }, StringSplitOptions.RemoveEmptyEntries); + string[] parts = strText.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string s in parts) { if (s[0] == '_') @@ -1305,7 +1305,7 @@ int BuildClassRecords( stop.SetMessage(strBiblioDbNameParam + " " + strClassFromStyle + " " + lStart.ToString() + "/" + lHitCount.ToString() + " " + GetProgressTimeString(lProgress)); - + if (lStart >= lHitCount || lCount <= 0) break; } @@ -1313,7 +1313,7 @@ int BuildClassRecords( if (lines.Count > 0) { Debug.Assert(false, ""); - } + } return 0; } @@ -2617,7 +2617,7 @@ int Create_102_report(string strLibraryCode, tableDepartment.Sort(strColumnSortStyle); // 观察表格中是否全部行为 0 - for(int i = 0; i < tableDepartment.Count; i++) + for (int i = 0; i < tableDepartment.Count; i++) { Line line = tableDepartment[i]; if (line.GetInt64(0) > 0) @@ -2668,8 +2668,6 @@ int GetReportWriter(string strCfgFile, return 0; } - - // 这是创建到一个子目录(会在子目录中创建很多文件和下级目录),而不是输出到一个文件 // return: // -1 出错 @@ -2767,7 +2765,7 @@ int Create_131_report(string strLibraryCode, } catch (System.ArgumentException ex) { - strError = "文件名字符串 '"+strPureFileName+"' 中有非法字符。" + ex.Message; + strError = "文件名字符串 '" + strPureFileName + "' 中有非法字符。" + ex.Message; return -1; } @@ -2796,17 +2794,17 @@ int Create_131_report(string strLibraryCode, List commands = new List(); - string strCommand = ""; - nRet = CreateReaderReportCommand( - strLibraryCode, - strDateRange, - "131", - strReaderBarcode, - out strCommand, - out strError); - if (nRet == -1) - return -1; - commands.Add(strCommand); + string strCommand = ""; + nRet = CreateReaderReportCommand( + strLibraryCode, + strDateRange, + "131", + strReaderBarcode, + out strCommand, + out strError); + if (nRet == -1) + return -1; + commands.Add(strCommand); nRet = RunQuery( commands, @@ -2886,7 +2884,7 @@ public static string GetValidPathString(string strText, string strReplaceChar = // invalid_chars += "\t"; // 2014/9/19 修改 BUG - char [] invalid_chars = Path.GetInvalidPathChars(); + char[] invalid_chars = Path.GetInvalidPathChars(); StringBuilder result = new StringBuilder(); foreach (char c in strText) { @@ -2961,12 +2959,10 @@ int Create_1XX_report(string strLibraryCode, writer, strOutputFileName, macro_table, - "创建 "+strReportType+" 表时", + "创建 " + strReportType + " 表时", out strError); } - - // return: // -1 出错 // 0 没有创建文件(因为输出的表格为空) @@ -3111,7 +3107,7 @@ int Create_212_report( writer, strOutputFileName, macro_table, - "创建 "+strReportType+" 表时", + "创建 " + strReportType + " 表时", out strError); } @@ -3202,7 +3198,7 @@ static int BuildPrevDateString(string strDateRange, DateTime start = DateTimeUtil.Long8ToDateTime(strStartDate); start -= new TimeSpan(1, 0, 0, 0); // 前一天 - strResult = DateTimeUtil.DateTimeToString8(new DateTime(0)) + "-" +DateTimeUtil.DateTimeToString8(start); + strResult = DateTimeUtil.DateTimeToString8(new DateTime(0)) + "-" + DateTimeUtil.DateTimeToString8(start); return 0; } @@ -3238,8 +3234,8 @@ int Create_301_report( // 存量 string strResult = ""; - // 获得存量需要的时间字符串 - // 20120101-20140101 --> 00010101-20111231 + // 获得存量需要的时间字符串 + // 20120101-20140101 --> 00010101-20111231 nRet = BuildPrevDateString(strDateRange, out strResult, out strError); @@ -3468,10 +3464,10 @@ int Create_4XX_report(string strLibraryCode, writer, strOutputFileName, macro_table, - "创建 "+strType+" 表时", + "创建 " + strType + " 表时", out strError); - + #if NO string strColumnSortStyle = GetColumnSortStyle(strCfgFile); if (string.IsNullOrEmpty(strColumnSortStyle) == true) @@ -3506,7 +3502,7 @@ int Create_4XX_report(string strLibraryCode, #endif } - // return: + // return: // -1 出错 // 0 没有创建文件(因为输出的表格为空) // 1 成功创建文件 @@ -3621,12 +3617,12 @@ static Table MergeCurrency(Table table) // source : operator unit amerce_count amerce_money undo_count undo_money expire_count total_count // target : operator amerce_count amerce_money undo_count undo_money expire_count total_count - static Table MergeCurrency(List table) + static Table MergeCurrency(List table) { Table result_table = new Table(0); // 合并各种货币单位 // operator unit amerce_count amerce_money undo_count undo_money expire_count total_count - foreach (object [] line in table) + foreach (object[] line in table) { string strOperator = (string)line[SOURCE_OPERATOR]; string strUnit = (string)line[SOURCE_UNII]; // unit @@ -3677,7 +3673,7 @@ static string GetCurrencyString(string strUnit, decimal value) return "-" + strUnit + (-value).ToString(); } - static void IncPrice(object [] line, + static void IncPrice(object[] line, string strUnit, int source_column_index, Table result_table, @@ -3736,7 +3732,7 @@ static void IncPrice(Line line, int RunQuery( List commands, -ref List table, +ref List table, out string strError) { strError = ""; @@ -3748,7 +3744,7 @@ int RunQuery( { strError = "command 不应为空"; return -1; - } + } text.Append(command); text.Append("\r\n\r\n"); } @@ -3779,7 +3775,7 @@ int RunQuery( { // string strKey = GetString(dr, 0); - object [] values = new object [dr.FieldCount]; + object[] values = new object[dr.FieldCount]; dr.GetValues(values); table.Add(values); #if NO @@ -3904,7 +3900,7 @@ int RunQuery( { strError = "command 不应为空"; return -1; - } + } text.Append(command); text.Append("\r\n\r\n"); } @@ -3944,7 +3940,7 @@ int RunQuery( } // 创建读者报表,关于流通业务 - // 1) 按照读者自然单位分类的借书册数表 101 + // 1) 按照读者自然单位分类的借书册数表 101 9101 // 2) 按照指定的单位分类的借书册数表 102 // 3) 按照读者类型分类的借书册数表 111 // 4) 按照读者姓名分类的借书册数表 121 @@ -4003,6 +3999,17 @@ int CreateReaderReportCommand( + " AND reader.librarycode = '" + strLibraryCode + "' " + " GROUP BY reader.department ORDER BY borrow DESC, reader.department;"; } + else if (StringUtil.IsInList("9101", strStyle) == true) + { + // 9101 表 按照读者 *自然单位* 分类的阅读册数表 + strCommand = "select reader.department, " + + " count(*) as count1 " + + " FROM operlogcircu left outer JOIN reader ON operlogcircu.readerbarcode <> '' AND operlogcircu.readerbarcode = reader.readerbarcode " + + " WHERE operlogcircu.date >= '" + strStartDate + "' AND operlogcircu.date <= '" + strEndDate + "' " + + " AND operlogcircu.operation = 'return' AND operlogcircu.action = 'read' " + + " AND reader.librarycode = '" + strLibraryCode + "' " + + " GROUP BY reader.department ORDER BY count1 DESC, reader.department;"; + } else if (StringUtil.IsInList("102", strStyle) == true) { // 102 表 按照 *指定的单位* 分类的借书册数表 @@ -4119,7 +4126,7 @@ int CreateReaderReportCommand( } else { - strError = "无法支持的 strStyle '"+strStyle+"'"; + strError = "无法支持的 strStyle '" + strStyle + "'"; return -1; } @@ -4221,7 +4228,7 @@ int CreateBookReportCommand( + " FROM operlogcircu JOIN item ON operlogcircu.itembarcode <> '' AND operlogcircu.itembarcode = item.itembarcode " + " WHERE operlogcircu.operation = 'borrow' and operlogcircu.action = 'borrow' " + " AND operlogcircu.date >= '" + strStartDate + "' AND operlogcircu.date <= '" + strEndDate + "' " - + " AND "+strLocationLike+" ) " + + " AND " + strLocationLike + " ) " + " AND " + strLocationLike // 限定 item 表里面的记录范围为分馆的册 + " AND substr(item.createtime,1,10) <= '" + strEndDate.Insert(6, "-").Insert(4, "-") + "' " // 限定册记录创建的时间在 end 以前 + " GROUP BY item.bibliorecpath ORDER BY item.bibliorecpath;"; @@ -4284,7 +4291,7 @@ int CreateBookReportCommand( } else { - strError = "不支持的 strStyle '"+strStyle+"'"; + strError = "不支持的 strStyle '" + strStyle + "'"; return -1; } @@ -4394,7 +4401,7 @@ group by class1 + " FROM item " + " LEFT OUTER JOIN " + strDistinctClassTableName + " ON item.bibliorecpath <> '' AND " + strDistinctClassTableName + ".bibliorecpath = item.bibliorecpath " + " WHERE " + strLocationLike - + " AND substr(item.createtime,1,10) >= '" + strStartDate +"' " // 限定册记录创建的时间在 start 以后 + + " AND substr(item.createtime,1,10) >= '" + strStartDate + "' " // 限定册记录创建的时间在 start 以后 + " AND substr(item.createtime,1,10) <= '" + strEndDate + "' " // 限定册记录创建的时间在 end 以前 + " GROUP BY path1 " + " ) group by classhead ORDER BY classhead ;"; @@ -4433,9 +4440,9 @@ group by class1 // 302 表 册在架情况 strCommand = // "select substr(" + strDistinctClassTableName + ".class,1,1) as classhead, " "select " + strClassColumn + " as classhead, " - + " count(case when item.borrower <> '' then item.borrower end) as outitems, " + + " count(case when item.borrower <> '' then item.borrower end) as outitems, " + " count(case when item.borrower = '' then item.borrower end) as initems, " - + " count(item.itemrecpath) as icount " + + " count(item.itemrecpath) as icount " // + " printf(\"%.2f%\", 100.0 * count(case when item.borrower <> '' then item.borrower end) / count(item.itemrecpath)) as percent " + " FROM item " + " LEFT OUTER JOIN " + strDistinctClassTableName + " ON item.bibliorecpath <> '' AND " + strDistinctClassTableName + ".bibliorecpath = item.bibliorecpath " @@ -4654,7 +4661,7 @@ public int GetAllReaderDepartments( // 从一个逗号间隔的字符串中析出 3 位数字 static int GetStyleNumber(string strStyle) { - string[] parts = strStyle.Split(new char [] {','}); + string[] parts = strStyle.Split(new char[] { ',' }); foreach (string s in parts) { if (s.Length == 3 && StringUtil.IsPureNumber(s) == true) @@ -4850,7 +4857,7 @@ int CreateWorkerReportCommand( + " operlogcircu.date >= '" + strStartDate + "' AND operlogcircu.date <= '" + strEndDate + "' " + " AND reader.librarycode = '" + strLibraryCode + "' " + " GROUP BY operlogcircu.operator " - +" ORDER BY operlogcircu.operator ;"; + + " ORDER BY operlogcircu.operator ;"; } else if (nNumber == 443) { @@ -4877,7 +4884,7 @@ int CreateWorkerReportCommand( + " left outer JOIN item ON operlogamerce.itembarcode <> '' AND operlogamerce.itembarcode <> '' AND operlogamerce.itembarcode = item.itembarcode " + " left outer JOIN biblio ON item.bibliorecpath <> '' AND item.bibliorecpath = biblio.bibliorecpath " + " left outer JOIN reader ON operlogamerce.readerbarcode <> '' AND operlogamerce.readerbarcode = reader.readerbarcode " - // + " left outer JOIN user ON operlogamerce.operator = user.id " + // + " left outer JOIN user ON operlogamerce.operator = user.id " + " WHERE " + " operlogamerce.date >= '" + strStartDate + "' AND operlogamerce.date <= '" + strEndDate + "' " + " AND reader.librarycode = '" + strLibraryCode + "' " @@ -5245,7 +5252,7 @@ private void listView_libraryConfig_MouseUp(object sender, MouseEventArgs e) } #endif - contextMenu.Show(this.listView_libraryConfig, new Point(e.X, e.Y)); + contextMenu.Show(this.listView_libraryConfig, new Point(e.X, e.Y)); } // 根据配置文件类型,找到配置文件名 @@ -5438,7 +5445,7 @@ void menu_newConfig_Click(object sender, EventArgs e) if (nRet == -1) goto ERROR1; - REDO: + REDO: this.MainForm.AppInfo.LinkFormState(dlg, "LibraryReportConfigForm_state"); dlg.UiState = this.MainForm.AppInfo.GetString(GetReportSection(), "LibraryReportConfigForm_ui_state", ""); dlg.ShowDialog(this); @@ -5498,7 +5505,7 @@ void menu_deleteConfig_Click(object sender, EventArgs e) if (result != DialogResult.Yes) return; - foreach(ListViewItem item in this.listView_libraryConfig.SelectedItems) + foreach (ListViewItem item in this.listView_libraryConfig.SelectedItems) { string strLibraryCode = ListViewUtil.GetItemText(item, 0); strLibraryCode = GetOriginLibraryCode(strLibraryCode); @@ -5585,7 +5592,6 @@ int BuildPlan(string strTypeList, try { - task_dom = new XmlDocument(); task_dom.LoadXml(""); @@ -6800,7 +6806,7 @@ int LoadDailyBreakPoint( strEndDate = DomUtil.GetAttr(dom.DocumentElement, strPrefix + "end_date"); int nRet = DomUtil.GetIntegerParam(dom.DocumentElement, strPrefix + "index", - 0, + 0, out lIndex, out strError); if (nRet == -1) @@ -6815,14 +6821,19 @@ int LoadDailyBreakPoint( } // 获得和当前服务器、用户相关的报表信息本地存储目录 - string GetBaseDirectory() + static string GetBaseDirectory() { // 2015/6/20 将数据库文件存储在和每个 dp2library 服务器和用户名相关的目录中 - string strDirectory = Path.Combine(this.MainForm.ServerCfgDir, ReportForm.GetValidPathString(this.MainForm.GetCurrentUserName())); + string strDirectory = Path.Combine(Program.MainForm.ServerCfgDir, ReportForm.GetValidPathString(Program.MainForm.GetCurrentUserName())); PathUtil.CreateDirIfNeed(strDirectory); return strDirectory; } + public static string GetReportDir() + { + return Path.Combine(GetBaseDirectory(), "reports"); + } + string GetOperlogConnectionString() { // return SQLiteUtil.GetConnectionString(this.MainForm.UserDir, "operlog.bin"); @@ -6886,7 +6897,7 @@ int DoReplication( out strError); if (nRet == -1) return -1; - + _classFromStyles = styles; _updateBiblios.Clear(); @@ -7231,7 +7242,7 @@ int ProcessLogRecord( connection, dom, out strError); - } + } if (nRet == -1) { @@ -7682,7 +7693,7 @@ int CommitUpdateBiblioRecord( keys.Add(DomUtil.GetAttr(node, "k")); } - command_text.Append("delete from class_" + style.Style + " where bibliorecpath = @bibliorecpath" + i +" ;"); + command_text.Append("delete from class_" + style.Style + " where bibliorecpath = @bibliorecpath" + i + " ;"); if (bBiblioRecPathParamSetted == false) { @@ -7700,7 +7711,7 @@ int CommitUpdateBiblioRecord( foreach (string key in keys) { // 把分类号写入分类号表 - command_text.Append("insert into class_" + style.Style + " values (@bibliorecpath"+i+", @class_" + i + "_" + j + ") ;"); + command_text.Append("insert into class_" + style.Style + " values (@bibliorecpath" + i + ", @class_" + i + "_" + j + ") ;"); SQLiteUtil.SetParameter(command, "@class_" + i + "_" + j, @@ -8166,7 +8177,7 @@ public int TraceSetEntity( } string strCreateOperTime = ""; - + if (strAction == "new") strCreateOperTime = DomUtil.GetElementText(domLog.DocumentElement, "operTime"); @@ -9238,7 +9249,7 @@ void menu_createSelectedLibraryReport_Click(object sender, EventArgs e) nRet = this.MainForm.VerifySerialCode("report", false, out strError); if (nRet == -1) { - MessageBox.Show( "创建报表功能尚未被许可"); + MessageBox.Show("创建报表功能尚未被许可"); return; } #endif @@ -9298,6 +9309,7 @@ void menu_createSelectedLibraryReport_Click(object sender, EventArgs e) "daily_report_end_date", "20130101"); + // TODO: 特殊允许当天的也参加统计 string strEndDate = DateTimeUtil.DateTimeToString8(DateTime.Now); string strRealEndDate = ""; @@ -9680,7 +9692,7 @@ private void button_start_dailyReport_Click(object sender, EventArgs e) } catch (Exception ex) { - strError = "装载文件 '"+strTaskFileName+"' 到 XMLDOM 时出错: " +ex.Message; + strError = "装载文件 '" + strTaskFileName + "' 到 XMLDOM 时出错: " + ex.Message; goto ERROR1; } } @@ -10107,7 +10119,7 @@ int DoDailyReportTask( stop.SetProgressValue(i); } - // fileType 没有 html 的时候,不要创建 index.html 文件 + // fileType 没有 html 的时候,不要创建 index.html 文件 if ((this._fileType & FileType.HTML) != 0) { string strOutputDir = GetReportOutputDir(strLibraryCode); @@ -10376,7 +10388,7 @@ public static List TimesFromString(string strText) if (string.IsNullOrEmpty(strText) == true) return results; - string[] segments = strText.Split(new char[] {','}); + string[] segments = strText.Split(new char[] { ',' }); foreach (string strTime in segments) { results.Add(OneTime.FromString(strTime)); @@ -10500,7 +10512,7 @@ int GetTimePoints( // 两个日期都不允许超过今天 if (start >= daily_end) { - strError = "统计时间范围的起点不应晚于 日志同步最后日期 "+strDailyEndDate+" 的前一天"; + strError = "统计时间范围的起点不应晚于 日志同步最后日期 " + strDailyEndDate + " 的前一天"; return -1; } @@ -10611,16 +10623,16 @@ int LoadHtmlTemplate(XmlNode nodeLibrary, string strFileName = Path.Combine(strCssTemplateDir, GetValidPathString(strHtmlTemplate) + ".css"); if (File.Exists(strFileName) == false) { - strError = "CSS 模板文件 '"+strFileName+"' 不存在"; + strError = "CSS 模板文件 '" + strFileName + "' 不存在"; return -1; } Encoding encoding; - // return: - // -1 出错 strError中有返回值 - // 0 文件不存在 strError中有返回值 - // 1 文件存在 - // 2 读入的内容不是全部 + // return: + // -1 出错 strError中有返回值 + // 0 文件不存在 strError中有返回值 + // 1 文件存在 + // 2 读入的内容不是全部 int nRet = FileUtil.ReadTextFileContent(strFileName, -1, out strTemplate, @@ -10941,7 +10953,7 @@ int CreateOneTimeReports( else if (nRet == 1) nAdd = 1; } - else if (strReportType == "101" + else if (strReportType == "101" || strReportType == "9101" || strReportType == "111" || strReportType == "121" || strReportType == "122" @@ -11192,7 +11204,7 @@ int CreateOneTimeReports( out strError); if (nRet == -1) { - strError = "报表类型 '"+strReportType+"' 的名字表定义不合法: " + strError; + strError = "报表类型 '" + strReportType + "' 的名字表定义不合法: " + strError; return -1; } @@ -11545,7 +11557,7 @@ int WriteIndexXml( } catch (DirectoryNotFoundException) { - } + } return 0; } if (index_dom == null) @@ -11879,7 +11891,7 @@ static XmlNode CreateItemNode(XmlNode root, return NewLeafElement(day, strReportName, strReportType); } - throw new ArgumentException("未知的 strTimeType 值 '"+strTimeType+"'", "strTimeType"); + throw new ArgumentException("未知的 strTimeType 值 '" + strTimeType + "'", "strTimeType"); } // 根据 index.xml 文件创建 index.html 文件 @@ -11907,7 +11919,7 @@ int CreateIndexHtmlFile(string strIndexXmlFileName, return -1; } - + StringBuilder text = new StringBuilder(4096); text.Append(""); @@ -12219,7 +12231,7 @@ private void toolStripButton_setReportEndDay_Click(object sender, EventArgs e) "daily_report_end_date", "20130101"); - REDO: + REDO: strLastDate = InputDlg.GetInput( this, "设置报表最末日期", @@ -12233,7 +12245,7 @@ private void toolStripButton_setReportEndDay_Click(object sender, EventArgs e) || strLastDate.Length != 8 || StringUtil.IsNumber(strLastDate) == false) { - MessageBox.Show(this, "所输入的日期字符串 '"+strLastDate+"' 不合法,应该是 8 字符的时间格式。请重新输入"); + MessageBox.Show(this, "所输入的日期字符串 '" + strLastDate + "' 不合法,应该是 8 字符的时间格式。请重新输入"); goto REDO; } @@ -12262,7 +12274,7 @@ long GetPartFileNames(ref List filenames, part_filenames = new List(); long lTotalSize = 0; - for(int i = 0;i 0) this.MainForm.StatusBarMessage += "。文件上传后,本地文件已经被删除"; return; @@ -12560,7 +12572,7 @@ void UploadReportByFtp() { } } - else + else File.SetAttributes(filename, FileAttributes.Normal); i++; @@ -12593,7 +12605,7 @@ void UploadReportByFtp() { // SetUploadButtonState(); BeginUpdateUploadButtonText(); - } + } MessageBox.Show(this, strError); } @@ -12606,7 +12618,7 @@ private void button_start_uploadReport_Click(object sender, EventArgs e) else if (this.comboBox_start_uploadMethod.Text == "FTP") UploadReportByFtp(); else - MessageBox.Show(this, "未知的上传方式 '"+this.comboBox_start_uploadMethod.Text+"'"); + MessageBox.Show(this, "未知的上传方式 '" + this.comboBox_start_uploadMethod.Text + "'"); } // 上传文件到到 dp2lbrary 服务器 @@ -12923,9 +12935,9 @@ static List GetRmlFileNames(string strDataDir) FileInfo[] fis = di.GetFiles(); foreach (FileInfo fi in fis) { - string strExtention = Path.GetExtension(fi.Name).ToLower(); - if (strExtention == ".rml") - result.Add(fi.FullName); + string strExtention = Path.GetExtension(fi.Name).ToLower(); + if (strExtention == ".rml") + result.Add(fi.FullName); } // 处理下级目录,递归 @@ -13129,7 +13141,7 @@ private void listView_query_results_MouseUp(object sender, MouseEventArgs e) contextMenu.MenuItems.Add(menuItem); - contextMenu.Show(this.listView_query_results, new Point(e.X, e.Y)); + contextMenu.Show(this.listView_query_results, new Point(e.X, e.Y)); } @@ -13192,7 +13204,7 @@ void menu_queryResult_saveToExcel_Click(object sender, EventArgs e) foreach (ListViewItem item in this.listView_query_results.SelectedItems) { cells = new List(); - nColIndex = 0; + nColIndex = 0; foreach (ListViewItem.ListViewSubItem subitem in item.SubItems) { cells.Add(new CellData(nColIndex++, subitem.Text)); @@ -13222,6 +13234,18 @@ void menu_queryResult_copyToClipboard_Click(object sender, EventArgs e) { Global.CopyLinesToClipboard(this, this.listView_query_results, false); } + + private void toolStripButton_openReportFolder_Click(object sender, EventArgs e) + { + try + { + System.Diagnostics.Process.Start(GetReportDir()); + } + catch (Exception ex) + { + MessageBox.Show(this, ExceptionUtil.GetAutoText(ex)); + } + } } class FileCounting : ThreadBase diff --git a/dp2Circulation/Statis/ReportForm.resx b/dp2Circulation/Statis/ReportForm.resx index d7195e9a4..e2c725702 100644 --- a/dp2Circulation/Statis/ReportForm.resx +++ b/dp2Circulation/Statis/ReportForm.resx @@ -120,38 +120,44 @@ 127, 17 + + 127, 17 + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAgxJREFUOE+lkvtL - U2EYx+0PEbtpFwnBKPGKiJImGP0gYhIYs1E5GF5gIxkpA00JRSmMEF0ohMh+GaRWYlqabMVcNdS2QpaI - VqiDIYhk397vA6fXhCjyhYdzeM/5fp7vczkAdeL2cwho7v/wWzT1zcN+Pwhr51uY2/y41PQaF+wzKKiZ - QvaN58g0jyLd5KEUcQbg+84P/Cm2tncQjW3j68YWIqubCC3FcOJc478BAuGoZM6zvoRnakXEruEIjhc4 - /g5gZop9c+voGAyLbQIfeBZxLL9BA1jzXvuGbWamuKh+GmmVbswE19A59FEBbmoAG7YbsLtm2mZmiml9 - cvabNDwpz6YB7LYBoMXCumkJr7LOmnnHzBQ/9X2Bo2cOibm1GsBREbAQiYmw/8lnuCeWkVzcgnZlnw1j - 3HV/wuNXK6i/9x5Hc6wawDlTXHbLJ+LZUBQPRyKwdQdxutwl1h+NLXHh5Ht1ewBHsiwawCW57HyDAfWR - dvl0uhZQ1eqX8aVc7EKLqrum651ATLf9OJx5XQM4KmY0xPzZ0hFAiQJnXB0WwME0E3IsL5B17ZlADqWb - NYDrOepdlcysmTWWOrxqbceRWtaLk0VO1XW72D5Vckd2gMBfq8zdpmUG62NJvKM4+XyziDk24xmfWoGE - s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== 312, 17 + + 312, 17 + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAgxJREFUOE+lkvtL - U2EYx+0PEbtpFwnBKPGKiJImGP0gYhIYs1E5GF5gIxkpA00JRSmMEF0ohMh+GaRWYlqabMVcNdS2QpaI - VqiDIYhk397vA6fXhCjyhYdzeM/5fp7vczkAdeL2cwho7v/wWzT1zcN+Pwhr51uY2/y41PQaF+wzKKiZ - QvaN58g0jyLd5KEUcQbg+84P/Cm2tncQjW3j68YWIqubCC3FcOJc478BAuGoZM6zvoRnakXEruEIjhc4 - /g5gZop9c+voGAyLbQIfeBZxLL9BA1jzXvuGbWamuKh+GmmVbswE19A59FEBbmoAG7YbsLtm2mZmiml9 - cvabNDwpz6YB7LYBoMXCumkJr7LOmnnHzBQ/9X2Bo2cOibm1GsBREbAQiYmw/8lnuCeWkVzcgnZlnw1j - 3HV/wuNXK6i/9x5Hc6wawDlTXHbLJ+LZUBQPRyKwdQdxutwl1h+NLXHh5Ht1ewBHsiwawCW57HyDAfWR - dvl0uhZQ1eqX8aVc7EKLqrum651ATLf9OJx5XQM4KmY0xPzZ0hFAiQJnXB0WwME0E3IsL5B17ZlADqWb - NYDrOepdlcysmTWWOrxqbceRWtaLk0VO1XW72D5Vckd2gMBfq8zdpmUG62NJvKM4+XyziDk24xmfWoGE - s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== @@ -160,46 +166,61 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAgxJREFUOE+lkvtL - U2EYx+0PEbtpFwnBKPGKiJImGP0gYhIYs1E5GF5gIxkpA00JRSmMEF0ohMh+GaRWYlqabMVcNdS2QpaI - VqiDIYhk397vA6fXhCjyhYdzeM/5fp7vczkAdeL2cwho7v/wWzT1zcN+Pwhr51uY2/y41PQaF+wzKKiZ - QvaN58g0jyLd5KEUcQbg+84P/Cm2tncQjW3j68YWIqubCC3FcOJc478BAuGoZM6zvoRnakXEruEIjhc4 - /g5gZop9c+voGAyLbQIfeBZxLL9BA1jzXvuGbWamuKh+GmmVbswE19A59FEBbmoAG7YbsLtm2mZmiml9 - cvabNDwpz6YB7LYBoMXCumkJr7LOmnnHzBQ/9X2Bo2cOibm1GsBREbAQiYmw/8lnuCeWkVzcgnZlnw1j - 3HV/wuNXK6i/9x5Hc6wawDlTXHbLJ+LZUBQPRyKwdQdxutwl1h+NLXHh5Ht1ewBHsiwawCW57HyDAfWR - dvl0uhZQ1eqX8aVc7EKLqrum651ATLf9OJx5XQM4KmY0xPzZ0hFAiQJnXB0WwME0E3IsL5B17ZlADqWb - NYDrOepdlcysmTWWOrxqbceRWtaLk0VO1XW72D5Vckd2gMBfq8zdpmUG62NJvKM4+XyziDk24xmfWoGE - s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAgxJREFUOE+lkvtL - U2EYx+0PEbtpFwnBKPGKiJImGP0gYhIYs1E5GF5gIxkpA00JRSmMEF0ohMh+GaRWYlqabMVcNdS2QpaI - VqiDIYhk397vA6fXhCjyhYdzeM/5fp7vczkAdeL2cwho7v/wWzT1zcN+Pwhr51uY2/y41PQaF+wzKKiZ - QvaN58g0jyLd5KEUcQbg+84P/Cm2tncQjW3j68YWIqubCC3FcOJc478BAuGoZM6zvoRnakXEruEIjhc4 - /g5gZop9c+voGAyLbQIfeBZxLL9BA1jzXvuGbWamuKh+GmmVbswE19A59FEBbmoAG7YbsLtm2mZmiml9 - cvabNDwpz6YB7LYBoMXCumkJr7LOmnnHzBQ/9X2Bo2cOibm1GsBREbAQiYmw/8lnuCeWkVzcgnZlnw1j - 3HV/wuNXK6i/9x5Hc6wawDlTXHbLJ+LZUBQPRyKwdQdxutwl1h+NLXHh5Ht1ewBHsiwawCW57HyDAfWR - dvl0uhZQ1eqX8aVc7EKLqrum651ATLf9OJx5XQM4KmY0xPzZ0hFAiQJnXB0WwME0E3IsL5B17ZlADqWb - NYDrOepdlcysmTWWOrxqbceRWtaLk0VO1XW72D5Vckd2gMBfq8zdpmUG62NJvKM4+XyziDk24xmfWoGE - s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAgxJREFUOE+lkvtL - U2EYx+0PEbtpFwnBKPGKiJImGP0gYhIYs1E5GF5gIxkpA00JRSmMEF0ohMh+GaRWYlqabMVcNdS2QpaI - VqiDIYhk397vA6fXhCjyhYdzeM/5fp7vczkAdeL2cwho7v/wWzT1zcN+Pwhr51uY2/y41PQaF+wzKKiZ - QvaN58g0jyLd5KEUcQbg+84P/Cm2tncQjW3j68YWIqubCC3FcOJc478BAuGoZM6zvoRnakXEruEIjhc4 - /g5gZop9c+voGAyLbQIfeBZxLL9BA1jzXvuGbWamuKh+GmmVbswE19A59FEBbmoAG7YbsLtm2mZmiml9 - cvabNDwpz6YB7LYBoMXCumkJr7LOmnnHzBQ/9X2Bo2cOibm1GsBREbAQiYmw/8lnuCeWkVzcgnZlnw1j - 3HV/wuNXK6i/9x5Hc6wawDlTXHbLJ+LZUBQPRyKwdQdxutwl1h+NLXHh5Ht1ewBHsiwawCW57HyDAfWR - dvl0uhZQ1eqX8aVc7EKLqrum651ATLf9OJx5XQM4KmY0xPzZ0hFAiQJnXB0WwME0E3IsL5B17ZlADqWb - NYDrOepdlcysmTWWOrxqbceRWtaLk0VO1XW72D5Vckd2gMBfq8zdpmUG62NJvKM4+XyziDk24xmfWoGE - s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== diff --git a/dp2Circulation/default/charginghistory.css b/dp2Circulation/default/charginghistory.css new file mode 100644 index 000000000..0ba08a547 --- /dev/null +++ b/dp2Circulation/default/charginghistory.css @@ -0,0 +1,47 @@ +body +{ + font-family: Microsoft YaHei, Tahoma, Arial, Helvetica, sans-serif; + font-size: 9pt; + + margin: 0px; + padding: 0px; +} + +TABLE +{ + font-size: 9pt; + width: 100%; + + border-width: 2px; + border-style: solid; + border-collapse:collapse; + border-color: #999999; + +} + +TABLE TD +{ + padding: 4px; + padding-left: 8px; + padding-right: 8px; + + border: 1px; + border-right: 1px; + border-color: #aaaaaa; + border-style: solid; +} + +TD.summary IMG +{ + float:left; + margin-right: 4px; + max-width: 70px; +} + +.nowrap { +white-space: nowrap; +} + +TR.read { +background-color: #aaffaa; +} \ No newline at end of file diff --git a/dp2Circulation/dp2Circulation.csproj b/dp2Circulation/dp2Circulation.csproj index 4b3cac67c..534ac82b6 100644 --- a/dp2Circulation/dp2Circulation.csproj +++ b/dp2Circulation/dp2Circulation.csproj @@ -1340,6 +1340,9 @@ PreserveNewest + + Always + Always Designer @@ -2417,6 +2420,9 @@ UrgentChargingForm.cs + + PreserveNewest + PreserveNewest diff --git a/dp2Circulation/report_def/9101.xml b/dp2Circulation/report_def/9101.xml new file mode 100644 index 000000000..22eca8cd9 --- /dev/null +++ b/dp2Circulation/report_def/9101.xml @@ -0,0 +1,16 @@ + + 阅读排行, 按部门\r%library%\r%daterange% + + + + + + + + + 9101 部门的阅读排行 + + + year,month,day + + \ No newline at end of file diff --git a/dp2Library/ILibraryService.cs b/dp2Library/ILibraryService.cs deleted file mode 100644 index 67779aa63..000000000 --- a/dp2Library/ILibraryService.cs +++ /dev/null @@ -1,764 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.Serialization; -using System.ServiceModel; -// using System.ServiceModel.Web; -using System.Text; - -using System.Net.Security; - -using DigitalPlatform.LibraryServer; -using DigitalPlatform.Message; -using DigitalPlatform.rms.Client.rmsws_localhost; - -#if NO -namespace dp2Library -{ - // 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码和配置文件中的接口名“IService1”。 - [ServiceContract( - Name = "dp2library", - Namespace = "http://dp2003.com/dp2library/", - SessionMode = SessionMode.Required/*, - ProtectionLevel = ProtectionLevel.None*/)] - // [ServiceContract(Session = true)] - public interface ILibraryService - { - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetVersion(); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult Login( - string strUserName, - string strPassword, - string strParameters, - out string strOutputUserName, - out string strRights, - out string strLibraryCode); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult Logout(); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SetLang(string strLang, - out string strOldLang); - - [OperationContract(IsOneWay = true, IsInitiating = false, IsTerminating = false)] - void Stop(); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult VerifyReaderPassword(string strReaderBarcode, - string strReaderPassword); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult ChangeReaderPassword(string strReaderBarcode, - string strReaderOldPassword, - string strReaderNewPassword); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetReaderInfo(string strBarcode, - string strResultTypeList, - out string[] results, - out string strRecPath, - out byte[] baTimestamp); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SetReaderInfo( - string strAction, - string strRecPath, - string strNewXml, - string strOldXml, - byte[] baOldTimestamp, - out string strExistingXml, - out string strSavedXml, - out string strSavedRecPath, - out byte[] baNewTimestamp, - out DigitalPlatform.rms.Client.rmsws_localhost.ErrorCodeValue kernel_errorcode); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult MoveReaderInfo( - string strSourceRecPath, - ref string strTargetRecPath, - out byte[] target_timestamp); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult DevolveReaderInfo( - string strSourceReaderBarcode, - string strTargetReaderBarcode); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SearchReader( - string strReaderDbNames, - string strQueryWord, - int nPerMax, - string strFrom, - string strMatchStyle, - string strLang, - string strResultSetName, - string strOutputStyle); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SearchOneDb( - string strQueryWord, - string strDbName, - string strFrom, - string strMatchStyle, - string strLang, - long lMaxCount, - string strResultSetName, - string strOutputStyle); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult Search( - string strQueryXml, - string strResultSetName, - string strOutputStyle); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetSearchResult( - string strResultSetName, - long lStart, - long lCount, - string strBrowseInfoStyle, - string strLang, - out Record[] searchresults); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetRecord( - string strPath, - out byte[] timestamp, - out string strXml); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetBrowseRecords( - string[] paths, - string strBrowseInfoStyle, - out Record[] searchresults); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult ListBiblioDbFroms( - string strDbType, - string strLang, - out BiblioDbFromInfo[] infos); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SearchBiblio( - string strBiblioDbNames, - string strQueryWord, - int nPerMax, - string strFromStyle, - string strMatchStyle, - string strLang, - string strResultSetName, - string strSearchStyle, - string strOutputStyle, - out string strQueryXml); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SetBiblioInfo( - string strAction, - string strBiblioRecPath, - string strBiblioType, - string strBiblio, - byte[] baTimestamp, - string strComment, - out string strOutputBiblioRecPath, - out byte[] baOutputTimestamp); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult CopyBiblioInfo( - string strAction, - string strBiblioRecPath, - string strBiblioType, - string strBiblio, - byte[] baTimestamp, - string strNewBiblioRecPath, - string strNewBiblio, - out string strOutputBiblioRecPath, - out byte[] baOutputTimestamp); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetBiblioInfo( - string strBiblioRecPath, - string strBiblioXml, - string strBiblioType, - out string strBiblio); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetBiblioInfos( - string strBiblioRecPath, - string strBiblioXml, // 2013/3/6 - string[] formats, - out string[] results, - out byte[] baTimestamp); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SearchItem( - string strItemDbName, // 2007/9/25 - string strQueryWord, - int nPerMax, - string strFrom, - string strMatchStyle, - string strLang, - string strResultSetName, - string strSearchStyle, - string strOutputStyle); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetItemInfo( - string strBarcode, - string strResultType, - out string strResult, - out string strItemRecPath, - out byte[] item_timestamp, - string strBiblioType, - out string strBiblio, - out string strBiblioRecPath); - - - // *** 此API已经废止 *** - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SearchItemDup(string strBarcode, - int nMax, - out string[] paths); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetBiblioSummary( - string strItemBarcode, - string strConfirmItemRecPath, - string strBiblioRecPathExclude, - out string strBiblioRecPath, - out string strSummary); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult Borrow( - bool bRenew, - string strReaderBarcode, - string strItemBarcode, - string strConfirmItemRecPath, - bool bForce, - string[] saBorrowedItemBarcode, - string strStyle, - string strItemFormatList, - out string[] item_records, - string strReaderFormatList, - out string[] reader_records, - string strBiblioFormatList, - out string[] biblio_records, - out BorrowInfo borrow_info, - out string[] aDupPath, - out string strOutputReaderBarcode); - - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult Return( - string strAction, - string strReaderBarcode, - string strItemBarcode, - string strComfirmItemRecPath, - bool bForce, - string strStyle, - string strItemFormatList, - out string[] item_records, - string strReaderFormatList, - out string[] reader_records, - string strBiblioFormatList, - out string[] biblio_records, - out string[] aDupPath, - out string strOutputReaderBarcode, - out ReturnInfo return_info); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult Reservation( - string strFunction, - string strReaderBarcode, - string strItemBarcodeList); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult Amerce( - string strFunction, - string strReaderBarcode, - AmerceItem[] amerce_items, - out AmerceItem[] failed_items, // 2011/6/27 - out string strReaderXml); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetIssues( - string strBiblioRecPath, - long lStart, - long lCount, - string strStyle, - string strLang, - out EntityInfo[] issueinfos); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SetIssues( - string strBiblioRecPath, - EntityInfo[] issueinfos, - out EntityInfo[] errorinfos); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetIssueInfo( - string strRefID, - // string strBiblioRecPath, - string strResultType, - out string strResult, - out string strIssueRecPath, - out byte[] issue_timestamp, - string strBiblioType, - out string strBiblio, - out string strOutputBiblioRecPath); - - // *** 此API已经废止 *** - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SearchIssueDup(string strPublishTime, - string strBiblioRecPath, - int nMax, - out string[] paths); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SearchIssue( - string strIssueDbName, - string strQueryWord, - int nPerMax, - string strFrom, - string strMatchStyle, - string strLang, - string strResultSetName, - string strSearchStyle, - string strOutputStyle); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetEntities( - string strBiblioRecPath, - long lStart, - long lCount, - string strStyle, - string strLang, - out EntityInfo[] entityinfos); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SetEntities( - string strBiblioRecPath, - EntityInfo[] entityinfos, - out EntityInfo[] errorinfos); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetOrders( - string strBiblioRecPath, - long lStart, - long lCount, - string strStyle, - string strLang, - out EntityInfo[] orderinfos); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SetOrders( - string strBiblioRecPath, - EntityInfo[] orderinfos, - out EntityInfo[] errorinfos); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetOrderInfo( - string strRefID, - // string strBiblioRecPath, - string strResultType, - out string strResult, - out string strOrderRecPath, - out byte[] order_timestamp, - string strBiblioType, - out string strBiblio, - out string strOutputBiblioRecPath); - - // *** 此API已经废止 *** - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SearchOrderDup(string strIndex, - string strBiblioRecPath, - int nMax, - out string[] paths); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SearchOrder( - string strOrderDbName, - string strQueryWord, - int nPerMax, - string strFrom, - string strMatchStyle, - string strLang, - string strResultSetName, - string strSearchStyle, - string strOutputStyle); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SetClock(string strTime); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetClock(out string strTime); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult ResetPassword(string strParameters, - string strMessageTemplate); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetValueTable( - string strTableName, - string strDbName, - out string[] values); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetOperLogs( - string strFileName, - long lIndex, - long lHint, - int nCount, - string strStyle, - string strFilter, - out OperLogInfo[] records); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetOperLog( - string strFileName, - long lIndex, - long lHint, - string strStyle, - string strFilter, - out string strXml, - out long lHintNext, - long lAttachmentFragmentStart, - int nAttachmentFragmentLength, - out byte[] attachment_data, - out long lAttachmentTotalLength); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetCalendar( - string strAction, - string strName, - int nStart, - int nCount, - out CalenderInfo[] contents); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SetCalendar( - string strAction, - CalenderInfo info); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult BatchTask( - string strName, - string strAction, - BatchTaskInfo info, - out BatchTaskInfo resultInfo); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult ClearAllDbs(); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult ManageDatabase(string strAction, - string strDatabaseName, - string strDatabaseInfo, - out string strOutputInfo); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetUser( - string strAction, - string strName, - int nStart, - int nCount, - out UserInfo[] contents); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SetUser( - string strAction, - UserInfo info); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetChannelInfo( - string strQuery, - string strStyle, - int nStart, - int nCount, - out ChannelInfo[] contents); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult ManageChannel( - string strAction, - string strStyle, - ChannelInfo[] requests, - out ChannelInfo[] results); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult ChangeUserPassword( - string strUserName, - string strOldPassword, - string strNewPassword); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult VerifyBarcode(string strBarcode); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetSystemParameter( - string strCategory, - string strName, - out string strValue); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SetSystemParameter( - string strCategory, - string strName, - string strValue); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult UrgentRecover( - string strXML); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult RepairBorrowInfo( - string strAction, - string strReaderBarcode, - string strItemBarcode, - string strConfirmItemRecPath, - int nStart, - int nCount, - out int nProcessedBorrowItems, - out int nTotalBorrowItems, - out string strOutputReaderBarcode, - out string[] aDupPath); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult PassGate( - string strReaderBarcode, - string strGateName, - string strResultTypeList, - out string[] results); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult Foregift( - string strAction, - string strReaderBarcode); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult Hire( - string strAction, - string strReaderBarcode); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult Settlement( - string strAction, - string[] ids); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SearchOneClassCallNumber( - string strArrangeGroupName, - string strClass, - string strResultSetName, - out string strQueryXml); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetCallNumberSearchResult( - string strArrangeGroupName, - string strResultSetName, - long lStart, - long lCount, - string strBrowseInfoStyle, - string strLang, - out CallNumberSearchResult[] searchresults); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetOneClassTailNumber( - string strArrangeGroupName, - string strClass, - out string strTailNumber); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SetOneClassTailNumber( - string strAction, - string strArrangeGroupName, - string strClass, - string strTestNumber, - out string strOutputNumber); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SearchUsedZhongcihao( - string strZhongcihaoGroupName, - string strClass, - string strResultSetName, - out string strQueryXml); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetZhongcihaoSearchResult( - string strZhongcihaoGroupName, - string strResultSetName, - long lStart, - long lCount, - string strBrowseInfoStyle, - string strLang, - out ZhongcihaoSearchResult[] searchresults); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetZhongcihaoTailNumber( - string strZhongcihaoGroupName, - string strClass, - out string strTailNumber); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SetZhongcihaoTailNumber( - string strAction, - string strZhongcihaoGroupName, - string strClass, - string strTestNumber, - out string strOutputNumber); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SearchDup( - string strOriginBiblioRecPath, - string strOriginBiblioRecXml, - string strProjectName, - string strStyle, - out string strUsedProjectName); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetDupSearchResult( - long lStart, - long lCount, - string strBrowseInfoStyle, - out DupSearchResult[] searchresults); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult ListDupProjectInfos( - string strOriginBiblioDbName, - out DupProjectInfo[] results); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetUtilInfo( - string strAction, - string strDbName, - string strFrom, - string strKey, - string strValueAttrName, - out string strValue); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SetUtilInfo( - string strAction, - string strDbName, - string strFrom, - string strRootElementName, - string strKeyAttrName, - string strValueAttrName, - string strKey, - string strValue); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetRes(string strResPath, - long nStart, - int nLength, - string strStyle, - out byte[] baContent, - out string strMetadata, - out string strOutputResPath, - out byte[] baOutputTimestamp); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult WriteRes( - string strResPath, - string strRanges, - long lTotalLength, - byte[] baContent, - string strMetadata, - string strStyle, - byte[] baInputTimestamp, - out string strOutputResPath, - out byte[] baOutputTimestamp); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetComments( - string strBiblioRecPath, - long lStart, - long lCount, - string strStyle, - string strLang, - out EntityInfo[] commentinfos); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SetComments( - string strBiblioRecPath, - EntityInfo[] commentinfos, - out EntityInfo[] errorinfos); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetCommentInfo( - string strRefID, - // string strBiblioRecPath, - string strResultType, - out string strResult, - out string strCommentRecPath, - out byte[] comment_timestamp, - string strBiblioType, - out string strBiblio, - out string strOutputBiblioRecPath); - - // *** 此API已经废止 *** - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SearchCommentDup(string strIndex, - string strBiblioRecPath, - int nMax, - out string[] paths); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SearchComment( - string strCommentDbName, - string strQueryWord, - int nPerMax, - string strFrom, - string strMatchStyle, - string strLang, - string strResultSetName, - string strSearchStyle, - string strOutputStyle); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetMessage( - string[] message_ids, - MessageLevel messagelevel, - out List messages); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult ListMessage( - string strStyle, - string strResultsetName, - string strBoxType, - MessageLevel messagelevel, - int nStart, - int nCount, - out int nTotalCount, - out List messages); - - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult SetMessage(string strAction, - string strStyle, - List messages, - out List output_messages); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetStatisInfo(string strDateRangeString, - string strStyle, - out RangeStatisInfo info, - out string strXml); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult ExistStatisInfo(string strDateRangeString, - out List dates); - - [OperationContract(IsInitiating = true, IsTerminating = false)] - LibraryServerResult GetFile( - string strCategory, - string strFileName, - long lStart, - long lLength, - out byte[] baContent, - out string strFileTime); - } -} - -#endif \ No newline at end of file diff --git a/dp2Library/ILibraryServiceREST.cs b/dp2Library/ILibraryServiceREST.cs deleted file mode 100644 index 3dca93124..000000000 --- a/dp2Library/ILibraryServiceREST.cs +++ /dev/null @@ -1,781 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.Serialization; -using System.ServiceModel; -using System.ServiceModel.Web; -using System.Text; - -using System.Net.Security; - -using DigitalPlatform.LibraryServer; -using DigitalPlatform.Message; -using DigitalPlatform.rms.Client.rmsws_localhost; - -#if NO -namespace dp2Library -{ - [ServiceContract( -Name = "dp2libraryREST", -Namespace = "http://dp2003.com/dp2library/rest", -SessionMode = SessionMode.NotAllowed)] - public interface ILibraryServiceREST - { - [OperationContract] - /* - [WebInvoke(Method = "GET", - RequestFormat = WebMessageFormat.Json, - ResponseFormat = WebMessageFormat.Json)] - * */ - LibraryServerResult GetVersion(); - - [OperationContract] - /* - [WebInvoke(Method = "GET", - RequestFormat = WebMessageFormat.Json, - ResponseFormat = WebMessageFormat.Json, - UriTemplate = "login?username={strUserName}&password={strPassword}¶meters={strParameters}")] - * */ - LibraryServerResult Login( - string strUserName, - string strPassword, - string strParameters, - out string strOutputUserName, - out string strRights, - out string strLibraryCode); - - [OperationContract] - /* - [WebInvoke(Method = "GET", - RequestFormat = WebMessageFormat.Json, - ResponseFormat = WebMessageFormat.Json)] - * */ - LibraryServerResult Logout(); - - [OperationContract] - LibraryServerResult SetLang(string strLang, - out string strOldLang); - - [OperationContract(IsOneWay = true)] - void Stop(); - - [OperationContract] - LibraryServerResult VerifyReaderPassword( - string strReaderBarcode, - string strReaderPassword); - - [OperationContract] - LibraryServerResult ChangeReaderPassword( - string strReaderBarcode, - string strReaderOldPassword, - string strReaderNewPassword); - - [OperationContract] - LibraryServerResult GetReaderInfo( - string strBarcode, - string strResultTypeList, - out string[] results, - out string strRecPath, - out byte[] baTimestamp); - - [OperationContract] - LibraryServerResult SetReaderInfo( - string strAction, - string strRecPath, - string strNewXml, - string strOldXml, - byte[] baOldTimestamp, - out string strExistingXml, - out string strSavedXml, - out string strSavedRecPath, - out byte[] baNewTimestamp, - out DigitalPlatform.rms.Client.rmsws_localhost.ErrorCodeValue kernel_errorcode); - - [OperationContract] - LibraryServerResult MoveReaderInfo( - string strSourceRecPath, - ref string strTargetRecPath, - out byte[] target_timestamp); - - [OperationContract] - LibraryServerResult DevolveReaderInfo( - string strSourceReaderBarcode, - string strTargetReaderBarcode); - - [OperationContract] - LibraryServerResult SearchReader( - string strReaderDbNames, - string strQueryWord, - int nPerMax, - string strFrom, - string strMatchStyle, - string strLang, - string strResultSetName, - string strOutputStyle); - - [OperationContract] - LibraryServerResult SearchOneDb( - string strQueryWord, - string strDbName, - string strFrom, - string strMatchStyle, - string strLang, - long lMaxCount, - string strResultSetName, - string strOutputStyle); - - [OperationContract] - LibraryServerResult Search( - string strQueryXml, - string strResultSetName, - string strOutputStyle); - - [OperationContract] - LibraryServerResult GetSearchResult( - string strResultSetName, - long lStart, - long lCount, - string strBrowseInfoStyle, - string strLang, - out Record[] searchresults); - - [OperationContract] - LibraryServerResult GetRecord( - string strPath, - out byte[] timestamp, - out string strXml); - - [OperationContract] - LibraryServerResult GetBrowseRecords( - string[] paths, - string strBrowseInfoStyle, - out Record[] searchresults); - - [OperationContract] - LibraryServerResult ListBiblioDbFroms( - string strDbType, - string strLang, - out BiblioDbFromInfo[] infos); - - [OperationContract] - LibraryServerResult SearchBiblio( - string strBiblioDbNames, - string strQueryWord, - int nPerMax, - string strFromStyle, - string strMatchStyle, - string strLang, - string strResultSetName, - string strSearchStyle, - string strOutputStyle, - out string strQueryXml); - - [OperationContract] - LibraryServerResult SetBiblioInfo( - string strAction, - string strBiblioRecPath, - string strBiblioType, - string strBiblio, - byte[] baTimestamp, - string strComment, - out string strOutputBiblioRecPath, - out byte[] baOutputTimestamp); - - [OperationContract] - LibraryServerResult CopyBiblioInfo( - string strAction, - string strBiblioRecPath, - string strBiblioType, - string strBiblio, - byte[] baTimestamp, - string strNewBiblioRecPath, - string strNewBiblio, - out string strOutputBiblioRecPath, - out byte[] baOutputTimestamp); - - [OperationContract] - LibraryServerResult GetBiblioInfo( - string strBiblioRecPath, - string strBiblioXml, - string strBiblioType, - out string strBiblio); - - [OperationContract] - LibraryServerResult GetBiblioInfos( - string strBiblioRecPath, - string strBiblioXml, // 2013/3/6 - string[] formats, - out string[] results, - out byte[] baTimestamp); - - [OperationContract] - LibraryServerResult SearchItem( - string strItemDbName, // 2007/9/25 - string strQueryWord, - int nPerMax, - string strFrom, - string strMatchStyle, - string strLang, - string strResultSetName, - string strSearchStyle, - string strOutputStyle); - - [OperationContract] - LibraryServerResult GetItemInfo( - string strBarcode, - string strResultType, - out string strResult, - out string strItemRecPath, - out byte[] item_timestamp, - string strBiblioType, - out string strBiblio, - out string strBiblioRecPath); - - - // *** 此API已经废止 *** - [OperationContract] - LibraryServerResult SearchItemDup(string strBarcode, - int nMax, - out string[] paths); - - [OperationContract] - LibraryServerResult GetBiblioSummary( - string strItemBarcode, - string strConfirmItemRecPath, - string strBiblioRecPathExclude, - out string strBiblioRecPath, - out string strSummary); - - [OperationContract] - LibraryServerResult Borrow( - bool bRenew, - string strReaderBarcode, - string strItemBarcode, - string strConfirmItemRecPath, - bool bForce, - string[] saBorrowedItemBarcode, - string strStyle, - string strItemFormatList, - out string[] item_records, - string strReaderFormatList, - out string[] reader_records, - string strBiblioFormatList, - out string[] biblio_records, - out BorrowInfo borrow_info, - out string[] aDupPath, - out string strOutputReaderBarcode); - - - [OperationContract] - LibraryServerResult Return( - string strAction, - string strReaderBarcode, - string strItemBarcode, - string strComfirmItemRecPath, - bool bForce, - string strStyle, - string strItemFormatList, - out string[] item_records, - string strReaderFormatList, - out string[] reader_records, - string strBiblioFormatList, - out string[] biblio_records, - out string[] aDupPath, - out string strOutputReaderBarcode, - out ReturnInfo return_info); - - [OperationContract] - LibraryServerResult Reservation( - string strFunction, - string strReaderBarcode, - string strItemBarcodeList); - - [OperationContract] - LibraryServerResult Amerce( - string strFunction, - string strReaderBarcode, - AmerceItem[] amerce_items, - out AmerceItem[] failed_items, // 2011/6/27 - out string strReaderXml); - - [OperationContract] - LibraryServerResult GetIssues( - string strBiblioRecPath, - long lStart, - long lCount, - string strStyle, - string strLang, - out EntityInfo[] issueinfos); - - [OperationContract] - LibraryServerResult SetIssues( - string strBiblioRecPath, - EntityInfo[] issueinfos, - out EntityInfo[] errorinfos); - - [OperationContract] - LibraryServerResult GetIssueInfo( - string strRefID, - // string strBiblioRecPath, - string strResultType, - out string strResult, - out string strIssueRecPath, - out byte[] issue_timestamp, - string strBiblioType, - out string strBiblio, - out string strOutputBiblioRecPath); - - // *** 此API已经废止 *** - [OperationContract] - LibraryServerResult SearchIssueDup(string strPublishTime, - string strBiblioRecPath, - int nMax, - out string[] paths); - - [OperationContract] - LibraryServerResult SearchIssue( - string strIssueDbName, - string strQueryWord, - int nPerMax, - string strFrom, - string strMatchStyle, - string strLang, - string strResultSetName, - string strSearchStyle, - string strOutputStyle); - - [OperationContract] - LibraryServerResult GetEntities( - string strBiblioRecPath, - long lStart, - long lCount, - string strStyle, - string strLang, - out EntityInfo[] entityinfos); - - [OperationContract] - LibraryServerResult SetEntities( - string strBiblioRecPath, - EntityInfo[] entityinfos, - out EntityInfo[] errorinfos); - - [OperationContract] - LibraryServerResult GetOrders( - string strBiblioRecPath, - long lStart, - long lCount, - string strStyle, - string strLang, - out EntityInfo[] orderinfos); - - [OperationContract] - LibraryServerResult SetOrders( - string strBiblioRecPath, - EntityInfo[] orderinfos, - out EntityInfo[] errorinfos); - - [OperationContract] - LibraryServerResult GetOrderInfo( - string strRefID, - // string strBiblioRecPath, - string strResultType, - out string strResult, - out string strOrderRecPath, - out byte[] order_timestamp, - string strBiblioType, - out string strBiblio, - out string strOutputBiblioRecPath); - - // *** 此API已经废止 *** - [OperationContract] - LibraryServerResult SearchOrderDup(string strIndex, - string strBiblioRecPath, - int nMax, - out string[] paths); - - [OperationContract] - LibraryServerResult SearchOrder( - string strOrderDbName, - string strQueryWord, - int nPerMax, - string strFrom, - string strMatchStyle, - string strLang, - string strResultSetName, - string strSearchStyle, - string strOutputStyle); - - [OperationContract] - LibraryServerResult SetClock(string strTime); - - [OperationContract] - LibraryServerResult GetClock(out string strTime); - - [OperationContract] - LibraryServerResult ResetPassword(string strParameters, - string strMessageTemplate); - - [OperationContract] - LibraryServerResult GetValueTable( - string strTableName, - string strDbName, - out string[] values); - - [OperationContract] - LibraryServerResult GetOperLogs( - string strFileName, - long lIndex, - long lHint, - int nCount, - string strStyle, - string strFilter, - out OperLogInfo[] records); - - [OperationContract] - LibraryServerResult GetOperLog( - string strFileName, - long lIndex, - long lHint, - string strStyle, - string strFilter, - out string strXml, - out long lHintNext, - long lAttachmentFragmentStart, - int nAttachmentFragmentLength, - out byte[] attachment_data, - out long lAttachmentTotalLength); - - [OperationContract] - LibraryServerResult GetCalendar( - string strAction, - string strName, - int nStart, - int nCount, - out CalenderInfo[] contents); - - [OperationContract] - LibraryServerResult SetCalendar( - string strAction, - CalenderInfo info); - - [OperationContract] - LibraryServerResult BatchTask( - string strName, - string strAction, - BatchTaskInfo info, - out BatchTaskInfo resultInfo); - - [OperationContract] - LibraryServerResult ClearAllDbs(); - - [OperationContract] - LibraryServerResult ManageDatabase(string strAction, - string strDatabaseName, - string strDatabaseInfo, - out string strOutputInfo); - - [OperationContract] - LibraryServerResult GetUser( - string strAction, - string strName, - int nStart, - int nCount, - out UserInfo[] contents); - - [OperationContract] - LibraryServerResult SetUser( - string strAction, - UserInfo info); - - [OperationContract] - LibraryServerResult GetChannelInfo( - string strQuery, - string strStyle, - int nStart, - int nCount, - out ChannelInfo[] contents); - - [OperationContract] - LibraryServerResult ManageChannel( - string strAction, - string strStyle, - ChannelInfo[] requests, - out ChannelInfo[] results); - - [OperationContract] - LibraryServerResult ChangeUserPassword( - string strUserName, - string strOldPassword, - string strNewPassword); - - [OperationContract] - LibraryServerResult VerifyBarcode(string strBarcode); - - [OperationContract] - LibraryServerResult GetSystemParameter( - string strCategory, - string strName, - out string strValue); - - [OperationContract] - LibraryServerResult SetSystemParameter( - string strCategory, - string strName, - string strValue); - - [OperationContract] - LibraryServerResult UrgentRecover( - string strXML); - - [OperationContract] - LibraryServerResult RepairBorrowInfo( - string strAction, - string strReaderBarcode, - string strItemBarcode, - string strConfirmItemRecPath, - int nStart, - int nCount, - out int nProcessedBorrowItems, - out int nTotalBorrowItems, - out string strOutputReaderBarcode, - out string[] aDupPath); - - [OperationContract] - LibraryServerResult PassGate( - string strReaderBarcode, - string strGateName, - string strResultTypeList, - out string[] results); - - [OperationContract] - LibraryServerResult Foregift( - string strAction, - string strReaderBarcode); - - [OperationContract] - LibraryServerResult Hire( - string strAction, - string strReaderBarcode); - - [OperationContract] - LibraryServerResult Settlement( - string strAction, - string[] ids); - - [OperationContract] - LibraryServerResult SearchOneClassCallNumber( - string strArrangeGroupName, - string strClass, - string strResultSetName, - out string strQueryXml); - - [OperationContract] - LibraryServerResult GetCallNumberSearchResult( - string strArrangeGroupName, - string strResultSetName, - long lStart, - long lCount, - string strBrowseInfoStyle, - string strLang, - out CallNumberSearchResult[] searchresults); - - [OperationContract] - LibraryServerResult GetOneClassTailNumber( - string strArrangeGroupName, - string strClass, - out string strTailNumber); - - [OperationContract] - LibraryServerResult SetOneClassTailNumber( - string strAction, - string strArrangeGroupName, - string strClass, - string strTestNumber, - out string strOutputNumber); - - [OperationContract] - LibraryServerResult SearchUsedZhongcihao( - string strZhongcihaoGroupName, - string strClass, - string strResultSetName, - out string strQueryXml); - - [OperationContract] - LibraryServerResult GetZhongcihaoSearchResult( - string strZhongcihaoGroupName, - string strResultSetName, - long lStart, - long lCount, - string strBrowseInfoStyle, - string strLang, - out ZhongcihaoSearchResult[] searchresults); - - [OperationContract] - LibraryServerResult GetZhongcihaoTailNumber( - string strZhongcihaoGroupName, - string strClass, - out string strTailNumber); - - [OperationContract] - LibraryServerResult SetZhongcihaoTailNumber( - string strAction, - string strZhongcihaoGroupName, - string strClass, - string strTestNumber, - out string strOutputNumber); - - [OperationContract] - LibraryServerResult SearchDup( - string strOriginBiblioRecPath, - string strOriginBiblioRecXml, - string strProjectName, - string strStyle, - out string strUsedProjectName); - - [OperationContract] - LibraryServerResult GetDupSearchResult( - long lStart, - long lCount, - string strBrowseInfoStyle, - out DupSearchResult[] searchresults); - - [OperationContract] - LibraryServerResult ListDupProjectInfos( - string strOriginBiblioDbName, - out DupProjectInfo[] results); - - [OperationContract] - LibraryServerResult GetUtilInfo( - string strAction, - string strDbName, - string strFrom, - string strKey, - string strValueAttrName, - out string strValue); - - [OperationContract] - LibraryServerResult SetUtilInfo( - string strAction, - string strDbName, - string strFrom, - string strRootElementName, - string strKeyAttrName, - string strValueAttrName, - string strKey, - string strValue); - - [OperationContract] - LibraryServerResult GetRes(string strResPath, - long nStart, - int nLength, - string strStyle, - out byte[] baContent, - out string strMetadata, - out string strOutputResPath, - out byte[] baOutputTimestamp); - - [OperationContract] - LibraryServerResult WriteRes( - string strResPath, - string strRanges, - long lTotalLength, - byte[] baContent, - string strMetadata, - string strStyle, - byte[] baInputTimestamp, - out string strOutputResPath, - out byte[] baOutputTimestamp); - - [OperationContract] - LibraryServerResult GetComments( - string strBiblioRecPath, - long lStart, - long lCount, - string strStyle, - string strLang, - out EntityInfo[] commentinfos); - - [OperationContract] - LibraryServerResult SetComments( - string strBiblioRecPath, - EntityInfo[] commentinfos, - out EntityInfo[] errorinfos); - - [OperationContract] - LibraryServerResult GetCommentInfo( - string strRefID, - // string strBiblioRecPath, - string strResultType, - out string strResult, - out string strCommentRecPath, - out byte[] comment_timestamp, - string strBiblioType, - out string strBiblio, - out string strOutputBiblioRecPath); - - // *** 此API已经废止 *** - [OperationContract] - LibraryServerResult SearchCommentDup(string strIndex, - string strBiblioRecPath, - int nMax, - out string[] paths); - - [OperationContract] - LibraryServerResult SearchComment( - string strCommentDbName, - string strQueryWord, - int nPerMax, - string strFrom, - string strMatchStyle, - string strLang, - string strResultSetName, - string strSearchStyle, - string strOutputStyle); - - [OperationContract] - LibraryServerResult GetMessage( - string[] message_ids, - MessageLevel messagelevel, - out List messages); - - [OperationContract] - LibraryServerResult ListMessage( - string strStyle, - string strResultsetName, - string strBoxType, - MessageLevel messagelevel, - int nStart, - int nCount, - out int nTotalCount, - out List messages); - - - [OperationContract] - LibraryServerResult SetMessage(string strAction, - string strStyle, - List messages, - out List output_messages); - - [OperationContract] - LibraryServerResult GetStatisInfo(string strDateRangeString, - string strStyle, - out RangeStatisInfo info, - out string strXml); - - [OperationContract] - LibraryServerResult ExistStatisInfo(string strDateRangeString, - out List dates); - - [OperationContract] - LibraryServerResult GetFile( - string strCategory, - string strFileName, - long lStart, - long lLength, - out byte[] baContent, - out string strFileTime); - - } -} - -#endif \ No newline at end of file diff --git a/dp2Library/LibraryService.cs b/dp2Library/LibraryService.cs deleted file mode 100644 index c4556c49d..000000000 --- a/dp2Library/LibraryService.cs +++ /dev/null @@ -1,12224 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.Serialization; -using System.ServiceModel; -using System.ServiceModel.Web; -using System.Text; -using System.Xml; -using System.IO; -using System.Diagnostics; -using System.Threading; -using System.Globalization; - -using DigitalPlatform; -using DigitalPlatform.LibraryServer; -using DigitalPlatform.IO; -using DigitalPlatform.Xml; -using DigitalPlatform.Text; -using DigitalPlatform.Message; - -using DigitalPlatform.rms.Client; -using DigitalPlatform.rms.Client.rmsws_localhost; -using System.ServiceModel.Channels; - -#if NO - -namespace dp2Library -{ - /* - public static class GlobalVars - { - public static LibraryApplication LibraryApplication = null; - public static object LockObject = new object(); - } - * */ - - [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, - Namespace = "http://dp2003.com/dp2library/")] - public class LibraryService : ILibraryService, ILibraryServiceREST, IDisposable - { - LibraryApplication app = null; - SessionInfo sessioninfo = null; - bool RestMode = false; - - int m_nStop = 0; // 0 没有中断 1 提出中断 2 已经进行了中断 - - string _ip = ""; // 没有 sessioninfo 的通道,记载 ip,便于最后释放计数 - - public void Dispose() - { -#if NO - if (this.RestMode == false && this.sessioninfo != null) - { - this.sessioninfo.CloseSession(); - } -#endif - if (this.RestMode == false) - { - if (this.sessioninfo != null) - { - this.app.SessionTable.DeleteSession(sessioninfo); - this.sessioninfo = null; - } - else if (string.IsNullOrEmpty(this._ip) == false) - { - // 减量,以便管理配额 - this.app.SessionTable.IncNullIpCount(this._ip, -1); - this._ip = null; - } - } - } - - #region 基础函数 - - public int InitialApplication(out string strError) - { - strError = ""; - - if (this.app != null) - return 0; // 已经初始化 - - HostInfo info = OperationContext.Current.Host.Extensions.Find(); - if (info.App != null) - { - this.app = info.App; - return 0; - } - - string strBinDir = System.Reflection.Assembly.GetExecutingAssembly().Location; // Environment.CurrentDirectory; - strBinDir = PathUtil.PathPart(strBinDir); - - string strDataDir = info.DataDir; - - // 兼容以前的习惯。从执行文件目录中取得start.xml - if (String.IsNullOrEmpty(strDataDir) == true) - { - // 从start.xml文件查找数据目录 - string strStartFileName = PathUtil.MergePath(strBinDir, "start.xml"); - - XmlDocument dom = new XmlDocument(); - try - { - dom.Load(strStartFileName); - } - catch (FileNotFoundException) - { - // 文件没有找到。把执行目录的下级data目录当作数据目录 - strDataDir = PathUtil.MergePath(strBinDir, "data"); - goto START; - } - catch (Exception ex) - { - strError = "文件 '" + strStartFileName + "' 装载到XMLDOM时出错, 原因:" + ex.Message; - return -1; - } - strDataDir = DomUtil.GetAttr(dom.DocumentElement, "datadir"); - } - - - START: - lock (info.LockObject) - { - info.App = new LibraryApplication(); - // parameter: - // strDataDir data目录 - // strError out参数,返回出错信息 - // return: - // -1 出错 - // 0 成功 - // 线: 安全的 - int nRet = info.App.LoadCfg( - false, - strDataDir, - strBinDir, - out strError); - if (nRet == -1) - return -1; - nRet = info.App.Verify(out strError); - if (nRet == -1) - return -1; - } - - this.app = info.App; - return 0; - } - - - public static void GetClientAddress(out string strIP, out string strVia) - { - strIP = ""; - MessageProperties prop = OperationContext.Current.IncomingMessageProperties; - - strVia = prop.Via.ToString(); - - if (prop.Via.Scheme == "net.pipe") - { - // 没有 IP - strIP = "localhost"; - return; - } - try - { - RemoteEndpointMessageProperty endpoint = prop[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty; - strIP = endpoint.Address; - } - catch - { - } - strVia = prop.Via.ToString(); - } - - // return: - // -2 达到通道配额上限 - // -1 一般错误 - // 0 成功 - int InitialSession(out string strError) - { - strError = ""; - - try - { - string strIP = ""; - string strVia = ""; - GetClientAddress(out strIP, out strVia); - - // sessioninfo = new SessionInfo(app, GetClientAddress()); - this.sessioninfo = this.app.SessionTable.PrepareSession(this.app, - OperationContext.Current.SessionId, - strIP, - strVia); - } - catch (OutofSessionException ex) - { - // OperationContext.Current.InstanceContext.ReleaseServiceInstance(); - - // 为了防止攻击,需要立即切断通道。否则 1000 个通道很快会被耗尽 - try - { - OperationContext.Current.Channel.Close(new TimeSpan(0, 0, 1)); // 一秒 - } - catch - { - // TimeoutException - } - strError = ex.Message; - return -2; - } - catch (Exception ex) - { - strError = ex.Message; - return -1; - } - - return 0; - } - - // 准备Application和SessionInfo环境 - // return: - // Value == 0 正常 - // Value == -1 不正常 - LibraryServerResult PrepareEnvironment(bool bPrepareSessionInfo, - bool bCheckLogin = false, - bool bCheckHangup = false) - { -#if DEBUG - if (bPrepareSessionInfo == false) - { - Debug.Assert(bCheckLogin == false, "bPrepareSessionInfo为false时, bCheckLogin必须为false"); - } -#endif - LibraryServerResult result = new LibraryServerResult(); - - string strError = ""; - int nRet = 0; - - if (this.sessioninfo != null) - { - // Session 如果曾经被释放过 - if (this.sessioninfo.Closed == true) - { - // TODO: 其实也可以不报错,直接开辟新的通道继续操作 - - this._ip = ""; - this.sessioninfo = null; - OperationContext.Current.InstanceContext.ReleaseServiceInstance(); - result.Value = -1; - result.ErrorInfo = "通道先前已经被释放,本次操作失败。请重试操作"; - result.ErrorCode = ErrorCode.ChannelReleased; - return result; - } - } - - if (this.app == null) - { - nRet = InitialApplication(out strError); - if (nRet == -1) - { - result.Value = -1; - result.ErrorInfo = "InitialApplication fail: " + strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - Debug.Assert(this.app != null, ""); - } - - if (bPrepareSessionInfo == true - && this.sessioninfo == null) - { - if (OperationContext.Current.SessionId == null) - { - this.RestMode = true; - - string strCookie = WebOperationContext.Current.IncomingRequest.Headers["Cookie"]; - Hashtable table = StringUtil.ParseParameters(strCookie, ';', '='); - string strSessionID = (string)table["sessionid"]; - if (string.IsNullOrEmpty(strSessionID) == true) - { - strSessionID = Guid.NewGuid().ToString(); - table["sessionid"] = strSessionID; - table["path"] = "/"; - WebOperationContext.Current.OutgoingResponse.Headers.Add("Set-Cookie", StringUtil.BuildParameterString(table, ';', '=')); // "sessionid=" + strSessionID + "; path=/" - } - - // TODO: 需要按照前端 IP 地址对 sessionid 个数进行管理。如果超过一定数目则限制这个 IP 创建新的 sessionid,但不影响到其他 IP 创建新的 sessionid - - try - { - string strIP = ""; - string strVia = ""; - GetClientAddress(out strIP, out strVia); - this.sessioninfo = this.app.SessionTable.PrepareSession(this.app, - strSessionID, - strIP, - strVia); - } -#if NO - catch (OutofSessionException ex) - { - OperationContext.Current.InstanceContext.ReleaseServiceInstance(); - result.Value = -1; - result.ErrorInfo = "InitialSession fail: " + ex.Message; - result.ErrorCode = ErrorCode.SystemError; - return result; - } -#endif - catch (Exception ex) - { - result.Value = -1; - result.ErrorInfo = "dp2Library 初始化通道失败: " + ex.Message; - if (ex is OutofSessionException) - { - result.ErrorCode = ErrorCode.OutofSession; - // OperationContext.Current.InstanceContext.ReleaseServiceInstance(); - - // 为了防止攻击,需要立即切断通道。否则 1000 个通道很快会被耗尽 - try - { - OperationContext.Current.Channel.Close(new TimeSpan(0, 0, 1)); // 一秒 - } - catch - { - // TimeoutException - } - } - else - result.ErrorCode = ErrorCode.SystemError; - return result; - } - } - else - { - // return: - // -2 达到通道配额上限 - // -1 一般错误 - // 0 成功 - nRet = InitialSession(out strError); - if (nRet < 0) - { - result.Value = -1; - result.ErrorInfo = "dp2Library 初始化通道失败: " + strError; - if (nRet == -2) - result.ErrorCode = ErrorCode.OutofSession; - else - result.ErrorCode = ErrorCode.SystemError; - return result; - } - this.sessioninfo.NeedAutoClean = false; // WCF 自己管理这些通道,不需要主动清理 - } - - Debug.Assert(this.sessioninfo != null, ""); - } - - // 2011/1/27 - if (sessioninfo != null) - { - this.sessioninfo.CallCount++; - - SetLang(sessioninfo.Lang); - } - - if (bPrepareSessionInfo == false && this.sessioninfo == null) - { - // 增量 NullIpTable,以便管理配额 - - string strIP = ""; - string strVia = ""; - GetClientAddress(out strIP, out strVia); - this._ip = strIP; - this.app.SessionTable.IncNullIpCount(strIP, 1); - } - - if (bCheckHangup == true) - { - if (app.HangupReason != HangupReason.None) - { - result.Value = -1; - result.ErrorCode = ErrorCode.Hangup; - result.ErrorInfo = "因系统处于维护状态 " + app.HangupReason.ToString() + ",本功能暂时不能使用"; - return result; - } - } - - if (bCheckLogin == true) - { - Debug.Assert(sessioninfo != null, ""); - if (sessioninfo != null && sessioninfo.UserID == "") - { - result.Value = -1; - result.ErrorInfo = "尚未登录"; - result.ErrorCode = ErrorCode.NotLogin; - return result; - } - } - - return result; - } - - #endregion - - // 2012/4/15 - // 获得版本号 - public LibraryServerResult GetVersion() - { - LibraryServerResult result = new LibraryServerResult(); - result.Value = 0; - result.ErrorInfo = LibraryApplication.Version; // "2.18"; - return result; - } - - // 登录 - // parameters: - // strUserName 用户名 - // strPassword 密码 - // strParamaters 登录参数 location=???,index=???,type=reader - // 如果是public登录,type应该是worker,不能是reader。因为reader会被程序把strUserName当成条码号来登录。public登录成功后,身份还是reader - // bReader 身份是否为读者 - // return: result.Value: - // -1 error - // 0 user not found, or password error - // 1 succeed - public LibraryServerResult Login(string strUserName, - string strPassword, - string strParameters, - out string strOutputUserName, - out string strRights, - out string strLibraryCode) - { - strRights = ""; - strOutputUserName = ""; - strLibraryCode = ""; - /* - string strCookie = WebOperationContext.Current.IncomingRequest.Headers["Cookie"]; - WebOperationContext.Current.OutgoingResponse.Headers.Add("Set-Cookie", "name=value"); - * */ - - LibraryServerResult result = this.PrepareEnvironment(true); - if (result.Value == -1) - return result; - - try - { - string strError = ""; - int nRet = 0; - - if (String.IsNullOrEmpty(strParameters) == false - && strParameters.IndexOf("=") == -1) - { - strError = "strParameters参数应该采用新的用法: location=???,index=???"; - goto ERROR1; - } - - // 避免有安全漏洞 - if (strPassword == null) - strPassword = ""; - - Hashtable parameters = StringUtil.ParseParameters(strParameters, ',', '='); - string strLocation = (string)parameters["location"]; - string strLibraryCodeList = (string)parameters["libraryCode"]; - if (string.IsNullOrEmpty(strLibraryCodeList) == false) - strLibraryCodeList = strLibraryCodeList.Replace("|", ","); - - // 2013/12/24 - string strLang = (string)parameters["lang"]; - SetLang(strLang); - - // TODO: 图书馆代码列表需要和当前 sessioninfo 的馆代码列表交叉,排除可能多余的部分 - - bool bReader = false; - string strType = (string)parameters["type"]; - if (strType == null) - strType = ""; - if (strType.ToLower() == "reader") - bReader = true; - - bool bSimulateLogin = false; - string strSimulate = (string)parameters["simulate"]; - if (strSimulate == null) - strSimulate = ""; - strSimulate = strSimulate.ToLower(); - if (strSimulate == "yes" || strSimulate == "on" - || strSimulate == "1" || strSimulate == "true") - bSimulateLogin = true; - - if (bReader == false) - { - if (bSimulateLogin == true) - { - strError = "strParameters中type子参数值为reader以外类型时,不允许进行simulate方式的登录"; - goto ERROR1; - } - // 工作人员登录 - nRet = sessioninfo.Login(strUserName, - strPassword, - strLocation, - strLocation == "#web" ? true : false, - out strRights, - out strLibraryCode, - out strError); - strOutputUserName = strUserName; - } - else - { - if (bSimulateLogin == true) - { - string strManagerUserName = ""; - string strManagerPassword = ""; - - if (String.IsNullOrEmpty(strPassword) == true) - { - strError = "simulate状态下登录时,strPassword参数不能为空"; - goto ERROR1; - } - nRet = strPassword.IndexOf(","); - if (nRet == -1) - strManagerUserName = strPassword; - else - { - strManagerUserName = strPassword.Substring(0, nRet); - strManagerPassword = strPassword.Substring(nRet + 1); - } - - // 令第二阶段部进行密码判断 - strPassword = null; - - // 第一阶段:先用manager用户名和密码验证 - try - { - string strTemp = ""; - // 工作人员登录 - nRet = sessioninfo.Login(strManagerUserName, - strManagerPassword, - "#simulate", - false, - out strRights, - out strTemp, - out strError); - if (nRet != 1) - { - strError = "simulate登录时第一阶段利用管理员帐户验证登录失败: " + strError; - goto ERROR1; - } - } - finally - { - // 防止出现漏洞 - sessioninfo.Account = null; - } - - // 第二阶段: - } - - string strIndex = (string)parameters["index"]; - int nIndex = -1; - if (String.IsNullOrEmpty(strIndex) == false) - { - if (Int32.TryParse(strIndex, out nIndex) == false) - { - strError = "strParameters参数中的index子参数值 '" + strIndex + "' 格式不正确,应当为整数字符串"; - goto ERROR1; - } - } - - // 读者身份登录 - nRet = app.LoginForReader(sessioninfo, - strUserName, - strPassword, - strLocation, - strLibraryCodeList, - nIndex, // -1, - out strOutputUserName, - out strRights, - out strLibraryCode, - out strError); - } - - // END1: - result.Value = nRet; - result.ErrorInfo = strError; - if (nRet == 0) - result.ErrorCode = ErrorCode.NotFound; - if (nRet == -1) - result.ErrorCode = ErrorCode.SystemError; - - return result; - ERROR1: - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library Login() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 登出 - public LibraryServerResult Logout() - { - LibraryServerResult result = this.PrepareEnvironment(true); - if (result.Value == -1) - return result; - - try - { - sessioninfo.Account = null; - - if (OperationContext.Current.SessionId == null) - { - // REST 情形下 - // Session.Abandon(); - this.app.SessionTable.DeleteSession(sessioninfo); - } - else - { - // 其他具有Session的binding情形下 - OperationContext.Current.InstanceContext.ReleaseServiceInstance(); - } - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library Logout() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - public LibraryServerResult SetLang(string strLang, - out string strOldLang) - { - strOldLang = ""; - LibraryServerResult result = this.PrepareEnvironment(true); - if (result.Value == -1) - return result; - - strOldLang = sessioninfo.Lang; - if (String.IsNullOrEmpty(strLang) == false) - sessioninfo.Lang = strLang; - - // END1: - result.Value = 0; - result.ErrorInfo = ""; - return result; - /* - ERROR1: - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - * */ - } - - object m_nInSearching = 0; - - public int InSearching - { - get - { - return (int)m_nInSearching; - } - set - { - m_nInSearching = value; - } - } - - public int BeginSearch() - { - this.m_nStop = 0; - lock (this.m_nInSearching) - { - int v = (int)m_nInSearching; - m_nInSearching = v + 1; - return v; - } - } - - public void EndSearch() - { - lock (this.m_nInSearching) - { - int v = (int)m_nInSearching; - m_nInSearching = v - 1; - } - this.m_nStop = 1; - } - - public void Stop() - { - /* - LibraryServerResult result = this.PrepareEnvironment(true); - if (result.Value == -1) - return; - * */ - - if (this.InSearching > 0) - { - this.m_nStop = 1; - - WriteDebugInfo("因后一个stop的到来,前一个search不得不中断 "); - } - } - - // 验证读者密码 - // parameters: - // strReaderBarcode 读者证条码号。 - // 如果为 "!getpatrontempid:" 开头,表示希望返回一个二维码的读者证号,这个操作需要具有 getpatrontempid 权限才行 - // Result.Value -1出错 0密码不正确 1密码正确 - // 权限: - // 工作人员或者读者,必须有verifyreaderpassword权限 - // 如果为读者, 附加限制还只能验证属于自己的密码 - public LibraryServerResult VerifyReaderPassword(string strReaderBarcode, - string strReaderPassword) - { - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - string strCommand = ""; - if (string.IsNullOrEmpty(strReaderBarcode) == false - && StringUtil.HasHead(strReaderBarcode, "!getpatrontempid:") == true) - { - // 命令方式 - strCommand = "getpatrontempid"; - strReaderBarcode = strReaderBarcode.Substring("!getpatrontempid:".Length); - } - - // 权限判断 - - // 权限字符串 - if (strCommand == "getpatrontempid") - { - if (StringUtil.IsInList("getpatrontempid", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "获得读者证号二维码被拒绝。不具备 getpatrontempid 权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - } - else - { - if (StringUtil.IsInList("verifyreaderpassword", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "验证读者密码被拒绝。不具备 verifyreaderpassword 权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - } - - try - { - // 对读者身份的附加判断 - if (sessioninfo.UserType == "reader") - { - if (sessioninfo.Account != null - && strReaderBarcode != sessioninfo.Account.Barcode) - { - result.Value = -1; - if (strCommand == "getpatrontempid") - result.ErrorInfo = "获得读者证号二维码被拒绝。作为读者只能获得自己的读者证号二维码"; - else - result.ErrorInfo = "验证读者密码被拒绝。作为读者只能验证自己的密码"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - } - - string strXml = ""; - string strError = ""; - string strOutputPath = ""; - - // 获得读者记录 - // return: - // -1 error - // 0 not found - // 1 命中1条 - // >1 命中多于1条 - int nRet = app.GetReaderRecXml( - sessioninfo.Channels, - strReaderBarcode, - out strXml, - out strOutputPath, - out strError); - if (nRet == 0) - { - strError = "证条码号为 '" + strReaderBarcode + "' 的读者不存在"; - goto ERROR1; - } - if (nRet == -1) - { - strError = "获得证条码号为 '" + strReaderBarcode + "' 的读者记录时出错: " + strError; - goto ERROR1; - } - - if (nRet > 1) - { - strError = "系统错误: 证条码号为 '" + strReaderBarcode + "' 的读者记录多于一个"; - goto ERROR1; - } - - // 看看读者记录所从属的读者库的馆代码,是否被当前用户管辖 - if (String.IsNullOrEmpty(strOutputPath) == false) - { - if (app.IsCurrentChangeableReaderPath(strOutputPath, - sessioninfo.LibraryCodeList) == false) - { - strError = "读者记录路径 '" + strOutputPath + "' 从属的读者库不在当前用户管辖范围内"; - goto ERROR1; - } - } - - if (strCommand == "getpatrontempid") - { - result.Value = 1; - result.ErrorInfo = LibraryApplication.BuildQrCode(strReaderBarcode, app.UID); - return result; - } - - XmlDocument readerdom = null; - nRet = LibraryApplication.LoadToDom(strXml, - out readerdom, - out strError); - if (nRet == -1) - { - strError = "装载读者记录进入XML DOM时发生错误: " + strError; - goto ERROR1; - } - - // 验证读者密码 - // return: - // -1 error - // 0 密码不正确 - // 1 密码正确 - nRet = LibraryApplication.VerifyReaderPassword( - readerdom, - strReaderPassword, - app.Clock.Now, - out strError); - if (nRet == -1) - goto ERROR1; - - if (nRet == 0) - { - result.Value = 0; - result.ErrorInfo = strError; - } - else - { - result.Value = 1; - } - - return result; - ERROR1: - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library VerifyReaderPassword() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 修改读者密码 - // 工作人员或者读者,必须有changereaderpassword权限 - // 如果为读者, 附加限制还只能修改属于自己的密码 - // Result.Value -1出错 0旧密码不正确 1旧密码正确,已修改为新密码 - // 权限: - // 工作人员或者读者,必须有changereaderpassword权限 - // 如果为读者, 附加限制还只能修改属于自己的密码 - // 日志: - // 要产生日志 - public LibraryServerResult ChangeReaderPassword(string strReaderBarcode, - string strReaderOldPassword, - string strReaderNewPassword) - { - LibraryServerResult result = this.PrepareEnvironment(true, true, true); - if (result.Value == -1) - return result; - - try - { - return app.ChangeReaderPassword( - sessioninfo, - strReaderBarcode, - strReaderOldPassword, - strReaderNewPassword); - } - catch (Exception ex) - { - string strErrorText = "dp2Library ChangeReaderPassword() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - - } - - void SetLang(string strLang) - { - if (String.IsNullOrEmpty(strLang) == true) - return; - - Thread.CurrentThread.CurrentCulture = - CultureInfo.CreateSpecificCulture(strLang); - Thread.CurrentThread.CurrentUICulture = new - CultureInfo(strLang); - } - - - // 获得读者信息 - // parameters: - // strBarcode 读者证条码号。如果前方引导以"@path:",则表示读者记录路径。在@path引导下,路径后面还可以跟随 "$prev"或"$next"表示方向 - // strResultTypeList 结果类型数组 xml/html/text/calendar/advancexml/recpaths/summary - // 其中calendar表示获得读者所关联的日历名;advancexml表示经过运算了的提供了丰富附加信息的xml,例如具有超期和停借期附加信息 - // Result.Value -1出错 0没有找到 1找到 >1命中多于1条 - // 权限: - // 工作人员或者读者,必须有getreaderinfo权限 - // 如果为读者, 附加限制还只能看属于自己的读者信息 - public LibraryServerResult GetReaderInfo( - string strBarcode, - string strResultTypeList, - out string[] results, - out string strRecPath, - out byte[] baTimestamp) - { - results = null; - baTimestamp = null; - strRecPath = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - return app.GetReaderInfo( - sessioninfo, - strBarcode, - strResultTypeList, - out results, - out strRecPath, - out baTimestamp); - } - catch (Exception ex) - { - string strErrorText = "dp2Library GetReaderInfo() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - - // 修改读者记录 - // 需要一并发来旧记录的原因, 是为了和数据库中当前可能已经变化了的记录进行比较, - // 如果SetReaderInfo能覆盖的部分字段,这一部分没有发生实质性变化,整条记录仅仅是 - // 流通实时信息发生了变化,本函数就能仍适当合并后保存记录,而不会返回错误,增加 - // 了API的可用性。如果实际运用中不允许发回旧记录,可发来空字符串,就会牺牲上述 - // 可用性,变成,不论数据库中当前记录的改变具体在那些字段范围,都只能报错返回了。 - // paramters: - // strOperation 操作。new change delete - // strRecPath 希望保存到的记录路径。可以为空。 - // strNewXml 希望保存的记录体 - // strOldXml 原先获得的旧记录体。可以为空。 - // baOldTimestamp 原先获得旧记录的时间戳。可以为空。 - // strExistringXml 覆盖操作失败时,返回数据库中已经存在的记录,供前端参考 - // strSavedXml 实际保存的新记录。内容可能和strNewXml有所差异。 - // strSavedRecPath 实际保存的记录路径 - // baNewTimestamp 实际保存后的新时间戳 - // return: - // result -1失败 0 正常 1部分字段被拒绝 - // 权限: - // 读者不能修改任何人的读者记录,包括他自己的。 - // 工作人员则要看 setreaderinfo权限是否具备 - // 日志: - // 要产生日志 - public LibraryServerResult SetReaderInfo( - string strAction, - string strRecPath, - string strNewXml, - string strOldXml, - byte[] baOldTimestamp, - out string strExistingXml, - out string strSavedXml, - out string strSavedRecPath, - out byte[] baNewTimestamp, - out DigitalPlatform.rms.Client.rmsws_localhost.ErrorCodeValue kernel_errorcode) - { - strExistingXml = ""; - strSavedXml = ""; - strSavedRecPath = ""; - baNewTimestamp = null; - kernel_errorcode = DigitalPlatform.rms.Client.rmsws_localhost.ErrorCodeValue.NoError; - - LibraryServerResult result = this.PrepareEnvironment(true, true , true); - if (result.Value == -1) - return result; - - try - { - return app.SetReaderInfo(sessioninfo, - strAction, - strRecPath, - strNewXml, - strOldXml, - baOldTimestamp, - out strExistingXml, - out strSavedXml, - out strSavedRecPath, - out baNewTimestamp, - out kernel_errorcode); - } - catch (Exception ex) - { - string strErrorText = "dp2Library SetReaderInfo() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 2012/1/11 - // 移动读者记录 - // return: - // result.Value: - // -1 error - // 0 已经成功移动 - // 权限: - // 需要movereaderinfo权限 - // 日志: - // 要产生日志 - public LibraryServerResult MoveReaderInfo( - string strSourceRecPath, - ref string strTargetRecPath, - out byte[] target_timestamp) - { - target_timestamp = null; - - LibraryServerResult result = this.PrepareEnvironment(true, true, true); - if (result.Value == -1) - return result; - - try - { - // 转移借阅信息 - // result.Value: - // -1 error - // 0 已经成功移动 - return app.MoveReaderInfo( - sessioninfo, - strSourceRecPath, - ref strTargetRecPath, - out target_timestamp); - } - catch (Exception ex) - { - string strErrorText = "dp2Library MoveReaderInfo() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 转移借阅信息 - // return: - // result.Value: - // -1 error - // 0 没有必要转移。即源读者记录中没有需要转移的借阅信息 - // 1 已经成功转移 - // 权限: - // 需要devolvereaderinfo权限 - // 日志: - // 要产生日志 - public LibraryServerResult DevolveReaderInfo( - string strSourceReaderBarcode, - string strTargetReaderBarcode) - { - LibraryServerResult result = this.PrepareEnvironment(true, true, true); - if (result.Value == -1) - return result; - - try - { - // 转移借阅信息 - // result.Value: - // -1 error - // 0 没有必要转移。即源读者记录中没有需要转移的借阅信息 - // 1 已经成功转移 - return app.DevolveReaderInfo( - sessioninfo, - strSourceReaderBarcode, - strTargetReaderBarcode); - } - catch (Exception ex) - { - string strErrorText = "dp2Library DevolveReaderInfo() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } -#if NOO - // 下级函数 - // 合并新旧读者xml记录 - // 进一步增强: - // 这里可以加入保护功能,限定根下只有那些元素读者才有覆盖的权力 - // 另外,barcode等要害字段,即便工作人员也不能简单覆盖,要考虑查重问题 - /* - * - * 作为读者身份只能修改这些字段: - name - gender - birthDate(birthday) - idCardNumber - department - post - address - tel - email* - */ - // parameters: - // bPartDenied 是否有某些元素的修改被拒绝。如果 == true,strError中将返回被拒绝的元素名列表 - static int MergOldNewReaderInfo( - SessionInfo sessioninfo, - string strOldXml, - string strNewXml, - out string strResultXml, - out bool bPartDenied, - out string strError) - { - strResultXml = ""; - strError = ""; - - bPartDenied = false; // 是否有局部字段的修改被拒绝? - string strDeniedElementNames = ""; - - XmlDocument olddom = new XmlDocument(); - try - { - olddom.LoadXml(strOldXml); - } - catch (Exception ex) - { - strError = "装载旧记录XML到DOM时发生错误: " + ex.Message; - return -1; - } - - XmlDocument newdom = new XmlDocument(); - try - { - newdom.LoadXml(strNewXml); - } - catch (Exception ex) - { - strError = "装载新记录XML到DOM时发生错误: " + ex.Message; - return -1; - } - - Hashtable names = new Hashtable(); - - // 遍历新记录所有根级对象,替换到旧记录中 - for (int i = 0; i < newdom.DocumentElement.ChildNodes.Count; i++) - { - XmlNode node = newdom.DocumentElement.ChildNodes[i]; - if (node.NodeType != XmlNodeType.Element) - continue; - - if (names[node.Name] != null - && (int)names[node.Name] == 1) - { - strError = "新记录中根下出现重复的元素名 '" + node.Name + "',这是不允许的..."; - return -1; - } - - - - XmlNodeList matchnodes = olddom.DocumentElement.SelectNodes(node.Name); - if (matchnodes.Count == 0) - { - // 对读者的附加限制 - if (sessioninfo.Account.Type == "reader") - { - // 只有少量元素让修改 - if (node.Name != "name" - && node.Name != "gender" - && node.Name != "birthday" - && node.Name != "idCardNumber" - && node.Name != "department" - && node.Name != "post" - && node.Name != "address" - && node.Name != "tel" - && node.Name != "email") - { - if (strDeniedElementNames != "") - strDeniedElementNames = ","; - strDeniedElementNames += node.Name; - - bPartDenied = true; - continue; - } - } - - // 插入到旧记录末尾 - XmlDocumentFragment fragment = olddom.CreateDocumentFragment(); - fragment.InnerXml = node.OuterXml; - - olddom.DocumentElement.AppendChild(fragment); - } - else - { - XmlNode pos = matchnodes[0]; - - // 如果新旧内容完全相同,则不必修改了 - if (pos.OuterXml == node.OuterXml) - continue; - - // 对读者的附加限制 - if (sessioninfo.Account.Type == "reader") - { - // 只有少量元素让修改 - if (node.Name != "name" - && node.Name != "gender" - && node.Name != "birthday" - && node.Name != "idCardNumber" - && node.Name != "department" - && node.Name != "post" - && node.Name != "address" - && node.Name != "tel" - && node.Name != "email") - { - if (strDeniedElementNames != "") - strDeniedElementNames = ","; - strDeniedElementNames += node.Name; - - bPartDenied = true; - continue; - } - } - - // 替换旧记录已经存在的元素 - XmlDocumentFragment fragment = olddom.CreateDocumentFragment(); - fragment.InnerXml = node.OuterXml; - - pos.ParentNode.InsertBefore(fragment, pos); - pos.ParentNode.RemoveChild(pos); - } - - names[node.Name] = 1; - } - - strResultXml = olddom.OuterXml; - - if (strDeniedElementNames != "") - strError = strDeniedElementNames; - - return 0; - } -#endif - - // 检索读者信息 - // parameters: - // strReaderDbNames 读者库名。可以为单个库名,也可以是逗号(半角)分割的读者库名列表。还可以为 <全部>/ 之一,表示全部读者库。 - // strQueryWord 检索词 - // nPerMax 一次命中结果的最大数。如果为-1,表示不限制。 - // strFrom 检索途径 - // strMathStyle 匹配方式 exact left right middle - // strLang 语言代码。一般为"zh" - // strResultSetName 结果集名。 - // rights: - // 读者不能检索任何人的读者记录,包括他自己的; - // 工作人员需要 searchreader 权限 - // return: - // result.Value 命中结果总数。如果为-1,则表示检索出错 - public LibraryServerResult SearchReader( - string strReaderDbNames, - string strQueryWord, - int nPerMax, - string strFrom, - string strMatchStyle, - string strLang, - string strResultSetName, - string strOutputStyle) - { - string strError = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限判断 - - // 权限字符串 - if (StringUtil.IsInList("searchreader", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "检索读者信息被拒绝。不具备searchreader权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - // 对读者身份的附加判断 - if (sessioninfo.UserType == "reader") - { - result.Value = -1; - result.ErrorInfo = "检索读者信息被拒绝。作为读者不能检索任何读者信息"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - List dbnames = new List(); - - if (String.IsNullOrEmpty(strReaderDbNames) == true - || strReaderDbNames == "<全部>" - || strReaderDbNames.ToLower() == "") - { -#if NO - for (int i = 0; i < app.ReaderDbs.Count; i++) - { - string strDbName = app.ReaderDbs[i].DbName; - if (String.IsNullOrEmpty(strDbName) == true) - continue; - - if (string.IsNullOrEmpty(sessioninfo.LibraryCode) == false) - { - string strLibraryCode = app.ReaderDbs[i].LibraryCode; - // 匹配图书馆代码 - // parameters: - // strSingle 单个图书馆代码。空的总是不能匹配 - // strList 图书馆代码列表,例如"第一个,第二个",或者"*"。空表示都匹配 - // return: - // false 没有匹配上 - // true 匹配上 - if (LibraryApplication.MatchLibraryCode(strLibraryCode, sessioninfo.LibraryCode) == false) - continue; - } - - dbnames.Add(strDbName); - } -#endif - dbnames = app.GetCurrentReaderDbNameList(sessioninfo.LibraryCodeList); - - } - else - { - List notmatches = new List(); - string[] splitted = strReaderDbNames.Split(new char[] { ',' }); - for (int i = 0; i < splitted.Length; i++) - { - string strDbName = splitted[i]; - if (String.IsNullOrEmpty(strDbName) == true) - continue; - - string strLibraryCode = ""; - if (app.IsReaderDbName(strDbName, out strLibraryCode) == false) - { - strError = "库名 '" + strDbName + "' 不是合法的读者库名"; - goto ERROR1; - } - - if (string.IsNullOrEmpty(sessioninfo.LibraryCodeList) == false) - { - // 匹配图书馆代码 - // parameters: - // strSingle 单个图书馆代码。空的总是匹配 - // strList 图书馆代码列表,例如"第一个,第二个",或者"*"。空表示都匹配 - // return: - // false 没有匹配上 - // true 匹配上 - if (LibraryApplication.MatchLibraryCode(strLibraryCode, sessioninfo.LibraryCodeList) == false) - { - notmatches.Add(strDbName); - continue; - } - } - - dbnames.Add(strDbName); - } - - if (notmatches.Count > 0) - { - strError = "读者库 " + StringUtil.MakePathList(notmatches) + " 因为馆代码限制,不允许当前用户检索"; - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - } - - if (dbnames.Count == 0) - { - strError = "读者库名 '" + strReaderDbNames + "' 没有匹配上任何读者库"; - goto ERROR1; - } - - // 构造检索式 - string strQueryXml = ""; - for (int i = 0; i < dbnames.Count; i++) - { - string strDbName = dbnames[i]; - - Debug.Assert(String.IsNullOrEmpty(strDbName) == false, ""); - - string strRelation = "="; - string strDataType = "string"; - - if (strFrom == "__id") - { - // 如果为范围式 - if (String.IsNullOrEmpty(strQueryWord) == false // 2013/3/25 - && strQueryWord.IndexOf("-") != -1) - { - strRelation = "range"; - strDataType = "number"; - - // 2012/3/29 - strMatchStyle = "exact"; - } - else if (String.IsNullOrEmpty(strQueryWord) == false) - { - strDataType = "number"; - - // 2012/3/29 - strMatchStyle = "exact"; - } - } - else if (strFrom == "失效日期") - { - // 如果为范围式 - if (strQueryWord.IndexOf("~") != -1) - { - strRelation = "range"; - strDataType = "number"; - } - else - { - strDataType = "number"; - - // 2012/3/29 - // 如果检索词为空,并且匹配方式为前方一致、中间一致、后方一致,那么认为这是意图要命中全部记录 - // 注意:如果检索词为空,并且匹配方式为精确一致,则需要认为是获取空值,也就是不存在对应检索点的记录 - if (strMatchStyle != "exact" && string.IsNullOrEmpty(strQueryWord) == true) - { - strMatchStyle = "exact"; - strRelation = "range"; - strQueryWord = "~"; - } - } - // 最后统一修改为exact。不能在一开始修改,因为strMatchStyle值还有帮助判断的作用 - strMatchStyle = "exact"; - } - - // 2007/4/5 改造 加上了 GetXmlStringSimple() - string strOneDbQuery = ""; - - if (i > 0) - { - Debug.Assert(String.IsNullOrEmpty(strQueryXml) == false, ""); - strQueryXml += ""; - } - - strQueryXml += strOneDbQuery; - } - - if (dbnames.Count > 0) - { - strQueryXml = "" + strQueryXml + ""; - } - - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - result.Value = -1; - result.ErrorInfo = "get channel error"; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - - BeginSearch(); - channel.Idle += new IdleEventHandler(channel_IdleEvent); - try - { - WriteDebugInfo("begin search " + strQueryXml); - long lRet = channel.DoSearch(strQueryXml, - strResultSetName, // "default", - strOutputStyle, - out strError); - WriteDebugInfo("end search lRet=" + lRet.ToString() + " " + strQueryXml); - if (lRet == -1) - { - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - - if (lRet == 0) - { - result.Value = 0; - result.ErrorInfo = "not found"; - return result; - } - - result.Value = lRet; - result.ErrorInfo = ""; - } - finally - { - channel.Idle -= new IdleEventHandler(channel_IdleEvent); - EndSearch(); - } - - return result; - ERROR1: - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library SearchReader() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 如果通讯中断,则也切断和dp2Kernel的通讯。 - void channel_IdleEvent(object sender, IdleEventArgs e) - { - if (this.m_nStop == 1) - { - RmsChannel channel = (RmsChannel)sender; - channel.Abort(); - this.m_nStop = 2; - WriteDebugInfo("channel call abort"); - } - else if (this.m_nStop == 2) - { - // 已经实施了中断,但是还没有来得及生效 - Thread.Sleep(10); - } - - e.bDoEvents = false; - } - - // 检索任意数据库 - public LibraryServerResult SearchOneDb( - string strQueryWord, - string strDbName, - string strFrom, - string strMatchStyle, - string strLang, - long lMaxCount, - string strResultSetName, - string strOutputStyle) - { - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限判断 - - // 权限字符串 - if (StringUtil.IsInList("searchonedb", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "检索任意数据库信息被拒绝。不具备searchonedb权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - // 对读者身份的附加判断 - if (sessioninfo.UserType == "reader") - { - result.Value = -1; - result.ErrorInfo = "检索 任意数据库 被拒绝。作为读者不能检索任意数据库"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - // 需要限制检索读者库为当前管辖的范围 - { - string strLibraryCode = ""; - bool bReaderDbInCirculation = true; - if (app.IsReaderDbName(strDbName, - out bReaderDbInCirculation, - out strLibraryCode) == true) - { - // 检查当前操作者是否管辖这个读者库 - // 观察一个读者记录路径,看看是不是在当前用户管辖的读者库范围内? - if (app.IsCurrentChangeableReaderPath(strDbName + "/?", - sessioninfo.LibraryCodeList) == false) - { - result.Value = -1; - result.ErrorInfo = "读者库 '"+strDbName+"' 不在当前用户管辖范围内"; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - } - } - - // 构造检索式 - string strQueryXml = ""; - - // 2007/4/5 改造 加上了 GetXmlStringSimple() - string strOneDbQuery = "" - + StringUtil.GetXmlStringSimple(strQueryWord) - + "" + strMatchStyle + "=string" + lMaxCount.ToString() + "" + strLang + ""; - - - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - result.Value = -1; - result.ErrorInfo = "get channel error"; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - - string strError = ""; - - BeginSearch(); - channel.Idle += new IdleEventHandler(channel_IdleEvent); - try - { - WriteDebugInfo("begin search " + strQueryXml); - long lRet = channel.DoSearch(strQueryXml, - strResultSetName, // "default", - strOutputStyle, - out strError); - WriteDebugInfo("end search lRet=" + lRet.ToString() + " " + strQueryXml); - if (lRet == -1) - { - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - - if (lRet == 0) - { - result.Value = 0; - result.ErrorInfo = "not found"; - return result; - } - - result.Value = lRet; - result.ErrorInfo = ""; - - } - finally - { - channel.Idle -= new IdleEventHandler(channel_IdleEvent); - EndSearch(); - } - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library SearchOneDb() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // TODO: 对于读者,限定他们检索里面定义的数据库(以及书目库下属的实体库、评注库)就可以了 - // 检索任意数据库 - public LibraryServerResult Search( - string strQueryXml, - string strResultSetName, - string strOutputStyle) - { - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - - // 权限判断 - - // 权限字符串 - if (StringUtil.IsInList("search", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "检索任意数据库信息被拒绝。不具备search权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - string strError = ""; - int nRet = 0; - - // 对读者身份的附加判断 - if (sessioninfo.UserType == "reader") - { - // 检查检索式内有没有超越规定读者检索的数据库 - // return: - // -1 error - // 0 没有超越要求 - // 1 超越了要求 - nRet = app.CheckReaderOnlyXmlQuery(strQueryXml, - out strError); - if (nRet == -1) - goto ERROR1; - - if (nRet == 1) - { - result.Value = -1; - result.ErrorInfo = "检索被拒绝。" + strError; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - } - else - { - // 2012/9/15 - // 检查检索式内有没有超越当前用户管辖的读者库范围的读者库 - // return: - // -1 error - // 0 没有超越要求 - // 1 超越了要求 - nRet = app.CheckReaderDbXmlQuery(strQueryXml, - sessioninfo.LibraryCodeList, - out strError); - if (nRet == -1) - goto ERROR1; - - if (nRet == 1) - { - result.Value = -1; - result.ErrorInfo = "检索被拒绝。" + strError; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - } - - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - result.Value = -1; - result.ErrorInfo = "get channel error"; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - - string strTargetQueryXml = ""; - - /* - // TODO: 把这个初始化放在正规的初始化中? - nRet = app.InitialVdbs(sessioninfo.Channels, - out strError); - if (nRet == -1) - { - strError = "InitialVdbs error : " + strError; - goto ERROR1; - } - * */ - if (app.vdbs == null) - { - app.ActivateManagerThreadForLoad(); - strError = "app.vdbs == null。故障原因请检查dp2Library日志"; - goto ERROR1; - } - - // 将包含虚拟库要求的XML检索式变换为内核能够理解的实在库XML检索式 - // return: - // -1 error - // 0 没有发生变化 - // 1 发生了变化 - nRet = app.KernelizeXmlQuery(strQueryXml, - out strTargetQueryXml, - out strError); - if (nRet == -1) - goto ERROR1; - - BeginSearch(); - channel.Idle += new IdleEventHandler(channel_IdleEvent); - try - { - WriteDebugInfo("begin search " + strQueryXml); - long lRet = channel.DoSearch(strTargetQueryXml, - strResultSetName, // "default", - strOutputStyle, - out strError); - WriteDebugInfo("end search lRet=" + lRet.ToString() + " " + strQueryXml); - if (lRet == -1) - goto ERROR1; - - - if (lRet == 0) - { - result.Value = 0; - result.ErrorInfo = "not found"; - return result; - } - - result.Value = lRet; - result.ErrorInfo = ""; - - } - finally - { - channel.Idle -= new IdleEventHandler(channel_IdleEvent); - EndSearch(); - } - return result; - ERROR1: - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library Search() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 获得检索命中的结果集信息 - // (注: 本方法基本上是内核对应功能GetRecords()的浅包装) - // parameters: - // strResultSetName 结果集名。如果为空,表示使用当前缺省结果集"default" - // lStart 要获取的开始位置。从0开始计数 - // lCount 要获取的个数 - // strBrowseInfoStyle 所返回的SearchResult中包含哪些信息。为逗号分隔的字符串列表值,取值可为 id/cols 之一。例如,"id,cols"表示同时获取id和浏览信息各列,而"id"表示仅取得id列。 - // strLang 语言代码。一般为"zh" - // searchresults 返回包含记录信息的SearchResult对象数组 - // rights: - // 没有限制 - // return: - // result.Value -1 出错;>=0 结果集内记录的总数(注意,并不是本批返回的记录数) - public LibraryServerResult GetSearchResult( - string strResultSetName, - long lStart, - long lCount, - string strBrowseInfoStyle, - string strLang, - out Record[] searchresults) - { - searchresults = null; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - result.Value = -1; - result.ErrorInfo = "get channel error"; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - - string strError = ""; - - if (String.IsNullOrEmpty(strResultSetName) == true) - strResultSetName = "default"; - - long lRet = channel.DoGetSearchResult( - strResultSetName, - lStart, - lCount, - strBrowseInfoStyle, - strLang, - null, - out searchresults, - out strError); - if (lRet == -1) - { - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - - result.Value = lRet; - result.ErrorInfo = strError; - - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library GetSearchResult() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 获得数据库记录 - // parameters: - // - // 权限:读者不能获取任何数据库记录。 - // 工作人员则要看 getrecord 权限是否具备 - public LibraryServerResult GetRecord( - string strPath, - out byte[] timestamp, - out string strXml) - { - timestamp = null; - strXml = ""; - string strError = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限判断 - - // 权限字符串 - if (StringUtil.IsInList("getrecord", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "获取数据库记录被拒绝。不具备getrecord权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - string strDbName = ""; - - // 对读者身份的附加判断 - if (sessioninfo.UserType == "reader") - { - result.Value = -1; - result.ErrorInfo = "获取数据库记录。作为读者不能获取任何数据库记录"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - else - { - // 需要限制检索读者库为当前管辖的范围 - string strLibraryCode = ""; - strDbName = ResPath.GetDbName(strPath); - bool bReaderDbInCirculation = true; - if (app.IsReaderDbName(strDbName, - out bReaderDbInCirculation, - out strLibraryCode) == true) - { - // 检查当前操作者是否管辖这个读者库 - // 观察一个读者记录路径,看看是不是在当前用户管辖的读者库范围内? - if (app.IsCurrentChangeableReaderPath(strDbName + "/?", - sessioninfo.LibraryCodeList) == false) - { - result.Value = -1; - result.ErrorInfo = "读者库 '" + strDbName + "' 不在当前用户管辖范围内"; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - } - } - - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - result.Value = -1; - result.ErrorInfo = "get channel error"; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - - string strMetaData = ""; - string strOutputPath = ""; - - long lRet = channel.GetRes(strPath, - out strXml, - out strMetaData, - out timestamp, - out strOutputPath, - out strError); - if (lRet == -1) - { - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - - // 当前用户只能获取和管辖的馆代码关联的违约金记录 - if (strDbName == app.AmerceDbName - && sessioninfo.GlobalUser == false) - { - XmlDocument dom = new XmlDocument(); - try - { - dom.LoadXml(strXml); - } - catch (Exception ex) - { - strError = "违约金记录 '" + strPath + "' 装入XMLDOM时出错: " + ex.Message; - goto ERROR1; - } - string strLibraryCode = DomUtil.GetElementText(dom.DocumentElement, "libraryCode"); - if (StringUtil.IsInList(strLibraryCode, sessioninfo.LibraryCodeList) == false) - { - result.Value = -1; - result.ErrorInfo = "违约金记录 '" + strPath + "' 超出当前用户管辖范围,无法获取"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - } - - result.Value = lRet; - result.ErrorInfo = strError; - - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library GetRecord() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - - ERROR1: - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - - // 获得指定记录的浏览信息 - // (注: 本方法基本上是内核对应功能GetBrowse()的浅包装) - // parameters: - // searchresults 返回包含记录信息的SearchResult对象数组 - // rights: - // 没有限制 - // return: - // result.Value -1 出错;>=0 结果集内记录的总数(注意,并不是本批返回的记录数) - public LibraryServerResult GetBrowseRecords( - string[] paths, - string strBrowseInfoStyle, - out Record[] searchresults) - { - searchresults = null; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - result.Value = -1; - result.ErrorInfo = "get channel error"; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - - string strError = ""; - - long lRet = channel.GetBrowseRecords(paths, - strBrowseInfoStyle, - out searchresults, - out strError); - if (lRet == -1) - { - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - - if (searchresults != null) - { - // 如果当前身份是读者,或者没有getreaderinfo权限,则要过滤掉属于读者库的记录 - // TODO: 今后对书目库、各种功能库的访问也要加以限制 - bool bIsReader = sessioninfo.UserType == "reader"; - bool bHasGetReaderInfoRight = StringUtil.IsInList("getreaderinfo", sessioninfo.RightsOrigin); - if (bIsReader == true || bHasGetReaderInfoRight == false) - { - foreach (Record record in searchresults) - { - string strDbName = ResPath.GetDbName(record.Path); - bool bIsReaderRecord = app.IsReaderDbName(strDbName); - if ( (bIsReader == true || bHasGetReaderInfoRight == false) - && bIsReaderRecord == true ) - { - record.Path = ""; - record.Cols = null; - record.RecordBody = null; - } - } - } - else if (sessioninfo.GlobalUser == false && bIsReader == false) - { - // 2012/9/15 - Hashtable table = new Hashtable(); // 加快运算速度 - // 读者库的管辖范围 - foreach (Record record in searchresults) - { - string strDbName = ResPath.GetDbName(record.Path); - bool bChangeable = true; - - object o = table[strDbName]; - if (o == null) - { - string strLibraryCode = ""; - bool bReaderDbInCirculation = true; - if (app.IsReaderDbName(strDbName, - out bReaderDbInCirculation, - out strLibraryCode) == true) - { - // 检查当前操作者是否管辖这个读者库 - // 观察一个读者记录路径,看看是不是在当前用户管辖的读者库范围内? - bChangeable = app.IsCurrentChangeableReaderPath(strDbName + "/?", - sessioninfo.LibraryCodeList); - } - table[strDbName] = bChangeable; // 记忆 - } - else - bChangeable = (bool)o; - - if (bChangeable == false) - { - record.Path = ""; - record.Cols = null; - record.RecordBody = null; - } - } - } - } - - result.Value = lRet; - result.ErrorInfo = strError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library GetBrowseRecords() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 列出 书目库/读者库/订购库/期库/评注库/发票库/违约金库 检索途径信息 - // parameters: - // strLang 语言代码。一般为"zh" - // infos 返回检索途径信息数组 - // rights: - // 需要 listbibliodbfroms 或 listdbfroms 或 order 权限 - // return: - // result.Value -1 出错;0 当前系统中没有定义此类数据库; 1: 成功(有至少一个此类数据库) - public LibraryServerResult ListBiblioDbFroms( - string strDbType, - string strLang, - out BiblioDbFromInfo[] infos) - { - infos = null; - - string strError = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限判断 - - // 权限字符串 - if (StringUtil.IsInList("listbibliodbfroms", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("listdbfroms", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("order", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "列出书目库检索途径 被拒绝。不具备order或listbibliodbfroms或listdbfroms权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - /* - // 2011/12/17 - if (app.kdbs == null) - { - app.ActivateManagerThreadForLoad(); - strError = "app.kdbs == null。故障原因请检查dp2Library日志"; - goto ERROR1; - } - * */ - - strError = EnsureKdbs(false); - if (strError != null) - goto ERROR1; - - if (string.IsNullOrEmpty(strDbType) == true) - strDbType = "biblio"; - - // long lRet = 0; - - List dbnames = null; - if (strDbType == "reader") - { - dbnames = app.GetCurrentReaderDbNameList(sessioninfo.LibraryCodeList); - } - else - { - int nRet = app.GetDbNames( - strDbType, - out dbnames, - out strError); - if (nRet == -1) - goto ERROR1; - } - -#if NO - List dbnames = new List(); - - string strDbTypeName = ""; - - if (strDbType == "biblio") - { - strDbTypeName = "书目"; - for (int i = 0; i < app.ItemDbs.Count; i++) - { - // 实体库对应的书目库名 - string strBiblioDbName = app.ItemDbs[i].BiblioDbName; - - if (String.IsNullOrEmpty(strBiblioDbName) == false) - dbnames.Add(strBiblioDbName); - } - } - else if (strDbType == "reader") - { - strDbTypeName = "读者"; - dbnames = app.GetCurrentReaderDbNameList(sessioninfo.LibraryCodeList); - } - else if (strDbType == "item") // 2012/5/5 - { - strDbTypeName = "实体"; - for (int i = 0; i < app.ItemDbs.Count; i++) - { - // 实体库名 - string strItemDbName = app.ItemDbs[i].DbName; - - if (String.IsNullOrEmpty(strItemDbName) == false) - dbnames.Add(strItemDbName); - } - } - else if (strDbType == "issue") // 2012/5/5 - { - strDbTypeName = "期"; - for (int i = 0; i < app.ItemDbs.Count; i++) - { - // 期库名 - string strIssueDbName = app.ItemDbs[i].IssueDbName; - - if (String.IsNullOrEmpty(strIssueDbName) == false) - dbnames.Add(strIssueDbName); - } - } - else if (strDbType == "order") // 2012/5/5 - { - strDbTypeName = "订购"; - for (int i = 0; i < app.ItemDbs.Count; i++) - { - // 订购库名 - string strOrderDbName = app.ItemDbs[i].OrderDbName; - - if (String.IsNullOrEmpty(strOrderDbName) == false) - dbnames.Add(strOrderDbName); - } - } - else if (strDbType == "comment") // 2012/5/5 - { - strDbTypeName = "评注"; - for (int i = 0; i < app.ItemDbs.Count; i++) - { - // 实体库名 - string strCommentDbName = app.ItemDbs[i].CommentDbName; - - if (String.IsNullOrEmpty(strCommentDbName) == false) - dbnames.Add(strCommentDbName); - } - } - else if (strDbType == "invoice") - { - strDbTypeName = "发票"; - if (string.IsNullOrEmpty(app.InvoiceDbName) == false) - dbnames.Add(app.InvoiceDbName); - } - else if (strDbType == "amerce") - { - strDbTypeName = "违约金"; - if (string.IsNullOrEmpty(app.AmerceDbName) == false) - dbnames.Add(app.AmerceDbName); - } - else - { - strError = "未知的数据库类型 '"+strDbType+"'。应为biblio reader item issue order comment invoice amerce之一"; - goto ERROR1; - } -#endif - - StringUtil.RemoveDupNoSort(ref dbnames); - - if (dbnames.Count == 0) - { - result.Value = 0; - result.ErrorInfo = "当前系统中没有定义此类数据库,所以无法获知其检索途径信息"; - - return result; - } - - // 可以当时现列出,并不存储? - // 不存储的缺点是,等到发出检索式的时候,就不知道哪个库有哪些style值了。 - // 后退一步:caption可以现列出,但是style值需要预先初始化和存储起来,供检索时构造检索式用 - List froms = new List(); - - for (int i = 0; i < dbnames.Count; i++) - { - string strDbName = dbnames[i]; - - if (String.IsNullOrEmpty(strDbName) == true) - { - Debug.Assert(false, ""); - continue; - } - - /* - // 2011/12/17 - if (app.kdbs == null) - { - app.ActivateManagerThreadForLoad(); - strError = "app.kdbs == null。故障原因请检查dp2Library日志"; - goto ERROR1; - } - * */ - - KernelDbInfo db = app.kdbs.FindDb(strDbName); - - if (db == null) - { - strError = "kdbs中没有关于"+LibraryApplication.GetDbTypeName(strDbType)+"数据库 '" + strDbName + "' 的信息"; - goto ERROR1; - } - - // 把所有库的from累加起来 - froms.AddRange(db.Froms); - } - - // 根据style值去重 - if (dbnames.Count > 1) - { - if (strDbType != "biblio") - KernelDbInfoCollection.RemoveDupByCaption(ref froms, - strLang); - else - KernelDbInfoCollection.RemoveDupByStyle(ref froms); - } - - List info_list = new List(); - - int nIndexOfID = -1; // __id途径所在的下标 - - for (int i = 0; i < froms.Count; i++) - { - From from = froms[i]; - - Caption caption = from.GetCaption(strLang); - if (caption == null) - { - caption = from.GetCaption(null); - if (caption == null) - { - strError = "有一个from事项的captions不正常"; - goto ERROR1; - } - } - - if (caption.Value == "__id") - nIndexOfID = i; - - BiblioDbFromInfo info = new BiblioDbFromInfo(); - info.Caption = caption.Value; - info.Style = from.Styles; - - info_list.Add(info); - } - - // 如果曾经出现过 __id caption - if (nIndexOfID != -1) - { - BiblioDbFromInfo temp = info_list[nIndexOfID]; - info_list.RemoveAt(nIndexOfID); - info_list.Add(temp); - } - - infos = new BiblioDbFromInfo[info_list.Count]; - info_list.CopyTo(infos); - - result.Value = 1; - result.ErrorInfo = ""; - - return result; - /* - ERROR1: - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - * */ - } - catch (Exception ex) - { - string strErrorText = "dp2Library ListBiblioDbFroms() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - ERROR1: - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - - void WriteDebugInfo(string strTitle) - { - /* - if (app.DebugMode == false) - return; - StreamUtil.WriteText(app.LogDir + "\\debug.txt", "-- " + DateTime.Now.ToString("u") + " " + strTitle + "\r\n"); - * */ - app.WriteDebugInfo(strTitle); - } - - // 检索书目信息 - // parameters: - // strBiblioDbNames 书目库名。可以为单个库名,也可以是逗号(半角)分割的读者库名列表。还可以为 <全部>/ 之一,表示全部书目库。 - // strQueryWord 检索词 - // nPerMax 一次命中结果的最大数。如果为-1,表示不限制。 - // strFromStyle 检索途径角色值。 - // strMathStyle 匹配方式 exact left right middle - // strLang 语言代码。一般为"zh" - // strResultSetName 结果集名。 - // strQueryXml 返回数据库内核层所使用的XML检索式,便于进行调试 - // strSearchStyle 可以包含 desc,表示命中结果按照降序排列 - // strOutputStyle 如果为"keycount",表示输出key+count形式 - // rights: - // 需要 searchbiblio 权限 - // return: - // result.Value 命中结果总数。如果为-1,则表示检索出错 - public LibraryServerResult SearchBiblio( - string strBiblioDbNames, - string strQueryWord, - int nPerMax, - string strFromStyle, - string strMatchStyle, - string strLang, - string strResultSetName, - string strSearchStyle, - string strOutputStyle, - out string strQueryXml) - { - strQueryXml = ""; - string strError = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限判断 - - // 权限字符串 - if (StringUtil.IsInList("searchbiblio", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("order", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "检索书目信息被拒绝。不具备order或searchbiblio权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - List dbnames = new List(); - - if (String.IsNullOrEmpty(strBiblioDbNames) == true - || strBiblioDbNames == "<全部>" - || strBiblioDbNames.ToLower() == "") - { - for (int i = 0; i < app.ItemDbs.Count; i++) - { - string strDbName = app.ItemDbs[i].BiblioDbName; - - // 2008/10/16 - if (String.IsNullOrEmpty(strDbName) == true) - continue; - - dbnames.Add(strDbName); - } - } - else if (strBiblioDbNames == "<全部图书>" - || strBiblioDbNames.ToLower() == "") - { - for (int i = 0; i < app.ItemDbs.Count; i++) - { - ItemDbCfg cfg = app.ItemDbs[i]; - if (String.IsNullOrEmpty(cfg.IssueDbName) == false) - continue; - string strDbName = cfg.BiblioDbName; - - if (String.IsNullOrEmpty(strDbName) == true) - continue; - - dbnames.Add(strDbName); - } - } - else if (strBiblioDbNames == "<全部期刊>" - || strBiblioDbNames.ToLower() == "") - { - for (int i = 0; i < app.ItemDbs.Count; i++) - { - ItemDbCfg cfg = app.ItemDbs[i]; - if (String.IsNullOrEmpty(cfg.IssueDbName) == true) - continue; - string strDbName = cfg.BiblioDbName; - - if (String.IsNullOrEmpty(strDbName) == true) - continue; - - dbnames.Add(strDbName); - } - } - else - { - string[] splitted = strBiblioDbNames.Split(new char[] { ',' }); - for (int i = 0; i < splitted.Length; i++) - { - string strDbName = splitted[i]; - if (String.IsNullOrEmpty(strDbName) == true) - continue; - - if (app.IsBiblioDbName(strDbName) == false) - { - strError = "库名 '" + strDbName + "' 不是合法的书目库名"; - goto ERROR1; - } - - dbnames.Add(strDbName); - } - - } - - bool bDesc = StringUtil.IsInList("desc", strSearchStyle); - - - // 构造检索式 - string strFromList = ""; - string strUsedFromCaptions = ""; - for (int i = 0; i < dbnames.Count; i++) - { - string strDbName = dbnames[i]; - - Debug.Assert(String.IsNullOrEmpty(strDbName) == false, ""); - - strError = EnsureKdbs(false); - if (strError != null) - goto ERROR1; - - - string strFromCaptions = app.kdbs.BuildCaptionListByStyleList(strDbName, strFromStyle, strLang); - - if (String.IsNullOrEmpty(strFromCaptions) == true) - { - continue; - } - - strUsedFromCaptions = strFromCaptions; - - if (String.IsNullOrEmpty(strFromList) == false) - strFromList += ";"; - strFromList += strDbName + ":" + strFromCaptions; - } - - if (String.IsNullOrEmpty(strFromList) == true) - { - strError = "在数据库 '" + StringUtil.MakePathList(dbnames) + "' 中没有找到匹配风格 '" + strFromStyle + "' 的From Caption"; - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.FromNotFound; - return result; - } - - string strRelation = "="; - string strDataType = "string"; - - if (strUsedFromCaptions == "__id") - { - // 如果为范围式 - if (String.IsNullOrEmpty(strQueryWord) == false // 2013/3/25 - && strQueryWord.IndexOf("-") != -1) - { - strRelation = "range"; - strDataType = "number"; - // 2012/3/29 - strMatchStyle = "exact"; - } - else if (String.IsNullOrEmpty(strQueryWord) == false) - { - // 2008/3/9 - strDataType = "number"; - // 2012/3/29 - strMatchStyle = "exact"; - } - } - /* - else if (strUsedFromCaptions == "操作时间" - || strUsedFromCaptions == "出版时间") * */ - else if (StringUtil.IsInList("_time", strFromStyle) == true) - { - // 如果为范围式 - if (strQueryWord.IndexOf("~") != -1) - { - strRelation = "range"; - strDataType = "number"; - } - else - { - strDataType = "number"; - - // 2012/3/29 - // 如果检索词为空,并且匹配方式为前方一致、中间一致、后方一致,那么认为这是意图要命中全部记录 - // 注意:如果检索词为空,并且匹配方式为精确一致,则需要认为是获取空值,也就是不存在对应检索点的记录 - if (strMatchStyle != "exact" && string.IsNullOrEmpty(strQueryWord) == true) - { - strMatchStyle = "exact"; - strRelation = "range"; - strQueryWord = "~"; - } - } - - // 最后统一修改为exact。不能在一开始修改,因为strMatchStyle值还有帮助判断的作用 - strMatchStyle = "exact"; - } - - strQueryXml = ""; - strQueryXml = ""; - - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - result.Value = -1; - result.ErrorInfo = "get channel error"; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - - BeginSearch(); - channel.Idle += new IdleEventHandler(channel_IdleEvent); - try - { - WriteDebugInfo("begin search " + strQueryXml); - long lRet = channel.DoSearch(strQueryXml, - strResultSetName, // "default", - strOutputStyle, - out strError); - WriteDebugInfo("end search lRet=" + lRet.ToString() + " " + strQueryXml); - if (lRet == -1) - { - result.Value = -1; - result.ErrorInfo = strError; - if (channel.ErrorCode == ChannelErrorCode.RequestCanceled) - result.ErrorCode = ErrorCode.RequestCanceled; - else - result.ErrorCode = ErrorCode.SystemError; - return result; - } - - if (lRet == 0) - { - result.Value = 0; - result.ErrorInfo = "not found"; - return result; - } - - result.Value = lRet; - result.ErrorInfo = ""; - } - finally - { - channel.Idle -= new IdleEventHandler(channel_IdleEvent); - EndSearch(); - } - - return result; - ERROR1: - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library SearchBiblio() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 设置书目信息(目前只能xml一种格式) - // 权限: 需要具有setbiblioinfo权限 - // parameters: - // strAction 动作。为"new" "change" "delete" "onlydeletebiblio"之一。"delete"在删除书目记录的同时,会自动删除下属的实体记录。不过要求实体均未被借出才能删除。 - // strBiblioType 目前只允许xml一种 - // baTimestamp 时间戳。如果为新创建记录,可以为null - // strOutputBiblioRecPath 输出的书目记录路径。当strBiblioRecPath中末级为问号,表示追加保存书目记录的时候,本参数返回实际保存的书目记录路径 - // baOutputTimestamp 操作完成后,新的时间戳 - // Result.Value -1出错 0成功 - public LibraryServerResult SetBiblioInfo( - string strAction, - string strBiblioRecPath, - string strBiblioType, - string strBiblio, - byte[] baTimestamp, - string strComment, - out string strOutputBiblioRecPath, - out byte[] baOutputTimestamp) - { - strOutputBiblioRecPath = ""; - baOutputTimestamp = null; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - if (strAction == "notifynewbook") - { - // 权限字符串 - if (StringUtil.IsInList("setbiblioinfo", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("order", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "通知读者新书到达被拒绝。不具备order或setbiblioinfo权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - return app.NotifyNewBook( - sessioninfo, - strBiblioRecPath, - strBiblioType); - } - - /* - // 权限字符串 - if (StringUtil.IsInList("setbiblioinfo", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("order", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "设置书目信息被拒绝。不具备order或setbiblioinfo权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - * */ - - return app.SetBiblioInfo( - sessioninfo, - strAction, - strBiblioRecPath, - strBiblioType, - strBiblio, - baTimestamp, - strComment, - out strOutputBiblioRecPath, - out baOutputTimestamp); - } - catch (Exception ex) - { - string strErrorText = "dp2Library SetBiblioInfo() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 2009/10/31 - // 复制或者移动书目信息(目前只能xml一种格式) - // 权限: 需要具有setbiblioinfo权限 - // parameters: - // strAction 动作。为"onlycopybiblio" "onlymovebiblio"之一。增加 copy / move - // strBiblioType 目前只允许xml一种 - // strBiblio 源书目记录。目前需要用null调用 - // baTimestamp 源记录的时间戳 - // strNewBiblio 需要在目标记录中更新的内容。如果 == null,表示不特意更新 - // strOutputBiblioRecPath 输出的书目记录路径。当strBiblioRecPath中末级为问号,表示追加保存书目记录的时候,本参数返回实际保存的书目记录路径 - // baOutputTimestamp 操作完成后,新的时间戳 - // result.Value: - // -1 出错 - // 0 成功,没有警告信息。 - // 1 成功,有警告信息。警告信息在 result.ErrorInfo 中 - public LibraryServerResult CopyBiblioInfo( - string strAction, - string strBiblioRecPath, - string strBiblioType, - string strBiblio, - byte[] baTimestamp, - string strNewBiblioRecPath, - string strNewBiblio, - out string strOutputBiblioRecPath, - out byte[] baOutputTimestamp) - { - strOutputBiblioRecPath = ""; - baOutputTimestamp = null; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限字符串 - if (StringUtil.IsInList("setbiblioinfo", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("order", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "复制书目信息被拒绝。不具备order或setbiblioinfo权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - return app.CopyBiblioInfo( - sessioninfo, - strAction, - strBiblioRecPath, - strBiblioType, - strBiblio, - baTimestamp, - strNewBiblioRecPath, - strNewBiblio, - out strOutputBiblioRecPath, - out baOutputTimestamp); - } - catch (Exception ex) - { - string strErrorText = "dp2Library CopyBiblioInfo() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 获得书目信息 - // parameters: - // strBiblioRecPath 书目记录路径。 - // strBiblioXml 如果不为空,表示前端发送过来的一条XML格式的记录,就不用从数据库中去取了 - // strBiblioType xml targetrecpath html text @... - // Result.Value -1出错 0没有找到 1找到 - // 权限: 需要具有getbiblioinfo权限 - public LibraryServerResult GetBiblioInfo( - string strBiblioRecPath, - string strBiblioXml, - string strBiblioType, - out string strBiblio) - { - strBiblio = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - string[] results = null; - byte[] baTimestamp = null; - - string[] formats = new string[1]; - formats[0] = strBiblioType; - result = app.GetBiblioInfos( - sessioninfo, - strBiblioRecPath, - strBiblioXml, - formats, - out results, - out baTimestamp); - if (results != null && results.Length > 0) - strBiblio = results[0]; - - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library GetBiblioInfo() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - -#if NO - // 获得书目信息(可以用html或xml两种格式之一) 2006/9/18 - // parameters: - // strBiblioRecPath 书目记录路径。 - // strBiblioXml 如果不为空,表示前端发送过来的一条XML格式的记录,就不用从数据库中去取了 - // strBiblioType xml targetrecpath html text @... - // Result.Value -1出错 0没有找到 1找到 - // 权限: 需要具有getbiblioinfo权限 - public LibraryServerResult GetBiblioInfo( - string strBiblioRecPath, - string strBiblioXml, - string strBiblioType, - out string strBiblio) - { - strBiblio = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - int nRet = 0; - long lRet = 0; - - // string strXml = ""; - string strError = ""; - string strOutputPath = ""; - - if (String.IsNullOrEmpty(strBiblioType) == true) - { - strError = "strBiblioType参数不能为空"; - goto ERROR1; - } - - // 检查数据库路径,看看是不是已经正规定义的编目库? - if (String.IsNullOrEmpty(strBiblioRecPath) == true) - { - strError = "strBiblioRecPath参数不能为空"; - goto ERROR1; - } - - string strBiblioDbName = ResPath.GetDbName(strBiblioRecPath); - - if (app.IsBiblioDbName(strBiblioDbName) == false) - { - strError = "书目记录路径 '" + strBiblioRecPath + "' 中包含的数据库名 '" + strBiblioDbName + "' 不是合法的书目库名"; - goto ERROR1; - } - - bool bRightVerified = false; - - // 检查存取权限 - if (String.IsNullOrEmpty(sessioninfo.Access) == false) - { - string strAction = "*"; - - string strActionList = LibraryApplication.GetDbOperRights(sessioninfo.Access, - strBiblioDbName, - "getbiblioinfo"); - if (String.IsNullOrEmpty(strActionList) == true) - { - strError = "当前用户 '" + sessioninfo.UserID + "' 不具备 针对数据库 '" + strBiblioDbName + "' 执行 getbiblioinfo 操作的存取权限"; - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - if (strActionList == "*") - { - // 通配 - } - else - { - if (StringUtil.IsInList(strAction, strActionList) == false) - { - strError = "当前用户 '" + sessioninfo.UserID + "' 不具备 针对数据库 '" + strBiblioDbName + "' 执行 getbiblioinfo 操作的存取权限"; - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - } - bRightVerified = true; - } - - if (bRightVerified == false) - { - // 权限字符串 - if (StringUtil.IsInList("getbiblioinfo", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("order", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "获取书目信息被拒绝。不具备order或getbiblioinfo权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - } - - // string strBiblioXml = ""; - - if (String.IsNullOrEmpty(strBiblioXml) == false) - { - // 前端已经发送过来一条记录 - - } - else - { - // 从数据库中获取 - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - strError = "channel == null"; - goto ERROR1; - } - string strMetaData = ""; - byte[] timestamp = null; - lRet = channel.GetRes(strBiblioRecPath, - out strBiblioXml, - out strMetaData, - out timestamp, - out strOutputPath, - out strError); - if (lRet == -1) - { - if (channel.ErrorCode == ChannelErrorCode.NotFound) - { - result.Value = 0; - return result; - } - strError = "获得书目记录 '" + strBiblioRecPath + "' 时出错: " + strError; - goto ERROR1; - } - } - - // 表明只需获取局部数据 - if (strBiblioType[0] == '@') - { - string strPartName = strBiblioType.Substring(1); - - XmlDocument bibliodom = new XmlDocument(); - - try - { - bibliodom.LoadXml(strBiblioXml); - } - catch (Exception ex) - { - strError = "将XML装入DOM时失败: " + ex.Message; - goto ERROR1; - } - int nResultValue = 0; - - // 执行脚本函数GetBiblioPart - // parameters: - // return: - // -2 not found script - // -1 出错 - // 0 成功 - nRet = app.DoGetBiblioPartScriptFunction( - bibliodom, - strPartName, - out nResultValue, - out strBiblio, - out strError); - if (nRet == -1 || nRet == -2) - { - strError = "获得书目记录 '" + strBiblioRecPath + "' 的局部 " + strBiblioType + " 时出错: " + strError; - goto ERROR1; - } - - result.Value = nResultValue; - return result; - } - - // 如果只需要种记录的XML格式 - if (String.Compare(strBiblioType, "xml", true) == 0) - { - strBiblio = strBiblioXml; - } - // 目标记录路径 - else if (String.Compare(strBiblioType, "targetrecpath", true) == 0) - { - // 获得目标记录路径。998$t - // return: - // -1 error - // 0 OK - nRet = LibraryApplication.GetTargetRecPath(strBiblioXml, - out strBiblio, - out strError); - if (nRet == -1) - { - goto ERROR1; - } - } - else if (String.Compare(strBiblioType, "html", true) == 0) - { - // string strBiblioDbName = ResPath.GetDbName(strBiblioRecPath); - // 是否需要检查这个数据库名确实为书目库名? - - // 需要从内核映射过来文件 - string strLocalPath = ""; - nRet = app.MapKernelScriptFile( - sessioninfo, - strBiblioDbName, - "./cfgs/loan_biblio.fltx", - out strLocalPath, - out strError); - if (nRet == -1) - goto ERROR1; - - - // 将种记录数据从XML格式转换为HTML格式 - string strFilterFileName = strLocalPath; // app.CfgDir + "\\biblio.fltx"; - - if (string.IsNullOrEmpty(strBiblioXml) == false) - { - nRet = app.ConvertBiblioXmlToHtml( - strFilterFileName, - strBiblioXml, - strBiblioRecPath, - out strBiblio, - out strError); - if (nRet == -1) - goto ERROR1; - } - else - strBiblio = ""; - } - else if (String.Compare(strBiblioType, "text", true) == 0) - { - // string strBiblioDbName = ResPath.GetDbName(strBiblioRecPath); - // 是否需要检查这个数据库名确实为书目库名? - - // 需要从内核映射过来文件 - string strLocalPath = ""; - nRet = app.MapKernelScriptFile( - sessioninfo, - strBiblioDbName, - "./cfgs/loan_biblio_text.fltx", - out strLocalPath, - out strError); - if (nRet == -1) - goto ERROR1; - - - // 将种记录数据从XML格式转换为text格式 - string strFilterFileName = strLocalPath; // app.CfgDir + "\\biblio.fltx"; - - if (string.IsNullOrEmpty(strBiblioXml) == false) - { - nRet = app.ConvertBiblioXmlToHtml( - strFilterFileName, - strBiblioXml, - strBiblioRecPath, - out strBiblio, - out strError); - if (nRet == -1) - goto ERROR1; - } - else - strBiblio = ""; - } - else - { - strError = "未知的书目格式 '" + strBiblioType + "'"; - goto ERROR1; - } - - result.Value = 1; - - return result; - ERROR1: - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library GetBiblioInfo() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - -#endif - - // 获得书目记录信息(一次可以获得多种) - // parameters: - // strBiblioRecPath 书目记录的路径 - // formats 格式列表。可以用后列的多种格式:xml html text @??? summary - // results 返回的结果字符串数组 - // baTimestamp 返回的记录时间戳 - // rights: - // 需要 getbiblioinfo 权限 - // 如果formats中包含了"summary"格式,还需要 getbibliosummary 权限 - // return: - // result.Value -1出错; 0 没有找到; 1 找到 - public LibraryServerResult GetBiblioInfos( - string strBiblioRecPath, - string strBiblioXml, // 2013/3/6 - string[] formats, - out string[] results, - out byte[] baTimestamp) - { - results = null; - baTimestamp = null; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - /* - // 权限字符串 - if (StringUtil.IsInList("getbiblioinfo", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("order", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "获取书目信息被拒绝。不具备order或getbiblioinfo权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - * */ - - return app.GetBiblioInfos( - sessioninfo, - strBiblioRecPath, - strBiblioXml, - formats, - out results, - out baTimestamp); - } - catch (Exception ex) - { - string strErrorText = "dp2Library GetBiblioInfos() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 检索册信息 - // parameters: - // strQueryWord 检索词 - // strFrom 检索途径 - // strMathStyle 匹配方式 exact left right middle - // strOutputStyle 特殊用法, 如果包含 __buildqueryxml,则在result.ErrorInfo中返回XML检索式,但不进行检索 - // 权限: - // 需要 searchitem 权限 - // return: - // result.Value 命中结果总数。如果为-1,则表示检索出错 - public LibraryServerResult SearchItem( - string strItemDbName, // 2007/9/25 - string strQueryWord, - int nPerMax, - string strFrom, - string strMatchStyle, - string strLang, - string strResultSetName, - string strSearchStyle, - string strOutputStyle) - { - string strError = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限判断 - - // 权限字符串 - if (StringUtil.IsInList("searchitem", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("order", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "检索实体信息被拒绝。不具备order、searchitem权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - List dbnames = new List(); - - if (String.IsNullOrEmpty(strItemDbName) == true - || strItemDbName == "<全部>" - || strItemDbName.ToLower() == "") - { - for (int i = 0; i < app.ItemDbs.Count; i++) - { - string strDbName = app.ItemDbs[i].DbName; - if (String.IsNullOrEmpty(strDbName) == true) - continue; - dbnames.Add(strDbName); - } - - if (dbnames.Count == 0) - { - strError = "没有发现任何实体库"; - goto ERROR1; - } - - } - else if (strItemDbName == "<全部期刊>" - || strItemDbName.ToLower() == "") - { - // 2009/2/2 - for (int i = 0; i < app.ItemDbs.Count; i++) - { - string strCurrentItemDbName = app.ItemDbs[i].DbName; - string strCurrentIssueDbName = app.ItemDbs[i].IssueDbName; - - if (String.IsNullOrEmpty(strCurrentItemDbName) == true) - continue; - - if (String.IsNullOrEmpty(strCurrentIssueDbName) == true) - continue; - - dbnames.Add(strCurrentItemDbName); - } - - if (dbnames.Count == 0) - { - strError = "没有发现任何期刊实体库"; - goto ERROR1; - } - } - else if (strItemDbName == "<全部图书>" - || strItemDbName.ToLower() == "") - { - // 2009/2/2 - for (int i = 0; i < app.ItemDbs.Count; i++) - { - string strCurrentItemDbName = app.ItemDbs[i].DbName; - string strCurrentIssueDbName = app.ItemDbs[i].IssueDbName; - - if (String.IsNullOrEmpty(strCurrentItemDbName) == true) - continue; - - // 大书目库中必须不包含期库,说明才是图书用途 - if (String.IsNullOrEmpty(strCurrentIssueDbName) == false) - continue; - - dbnames.Add(strCurrentItemDbName); - } - - if (dbnames.Count == 0) - { - strError = "没有发现任何图书实体库"; - goto ERROR1; - } - } - else - { - string[] splitted = strItemDbName.Split(new char[] { ',' }); - for (int i = 0; i < splitted.Length; i++) - { - string strDbName = splitted[i]; - if (String.IsNullOrEmpty(strDbName) == true) - continue; - - if (app.IsItemDbName(strDbName) == false) - { - strError = "库名 '" + strDbName + "' 不是合法的实体库名"; - goto ERROR1; - } - - dbnames.Add(strDbName); - } - - } - - bool bDesc = StringUtil.IsInList("desc", strSearchStyle); - - // 构造检索式 - string strQueryXml = ""; - for (int i = 0; i < dbnames.Count; i++) - { - string strDbName = dbnames[i]; - - Debug.Assert(String.IsNullOrEmpty(strDbName) == false, ""); - - string strRelation = "="; - string strDataType = "string"; - - if (strFrom == "__id") - { - // 如果为范围式 - if (String.IsNullOrEmpty(strQueryWord) == false // 2013/3/25 - && strQueryWord.IndexOf("-") != -1) - { - strRelation = "range"; - strDataType = "number"; - // 2012/3/29 - strMatchStyle = "exact"; - } - else if (String.IsNullOrEmpty(strQueryWord) == false) - { - strDataType = "number"; - // 2012/3/29 - strMatchStyle = "exact"; - } - } - - - // 2007/4/5 改造 加上了 GetXmlStringSimple() - string strOneDbQuery = "" - + (bDesc == true ? "DESC" : "") - + "" - + StringUtil.GetXmlStringSimple(strQueryWord) - + "" + strMatchStyle + ""+strRelation+""+strDataType+"" + nPerMax.ToString() + "" + strLang + ""; - - if (i > 0) - { - Debug.Assert(String.IsNullOrEmpty(strQueryXml) == false, ""); - strQueryXml += ""; - } - - strQueryXml += strOneDbQuery; - } - - if (dbnames.Count > 0) - { - strQueryXml = "" + strQueryXml + ""; - } - - if (StringUtil.IsInList("__buildqueryxml", strOutputStyle) == true) - { - result.Value = 0; - result.ErrorInfo = strQueryXml; - return result; - } - - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - strError = "get channel error"; - goto ERROR1; - } - - BeginSearch(); - channel.Idle += new IdleEventHandler(channel_IdleEvent); - try - { - WriteDebugInfo("begin search " + strQueryXml); - long lRet = channel.DoSearch(strQueryXml, - strResultSetName, // "default", - strOutputStyle, - out strError); - WriteDebugInfo("end search lRet=" + lRet.ToString() + " " + strQueryXml); - if (lRet == -1) - { - goto ERROR1; - } - - if (lRet == 0) - { - result.Value = 0; - result.ErrorInfo = "not found"; - return result; - } - - result.Value = lRet; - result.ErrorInfo = ""; - } - finally - { - channel.Idle -= new IdleEventHandler(channel_IdleEvent); - EndSearch(); - } - - return result; - - ERROR1: - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library SearchItem() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - - } - - // 获得册信息 - // TODO: 需要改进为,如果册记录存在,但是书目记录不存在,也能够适当返回 - // parameters: - // strBarcode 册条码号。特殊情况下,可以使用"@path:"引导的册记录路径(只需要库名和id两个部分)作为检索入口。在@path引导下,路径后面还可以跟随 "$prev"或"$next"表示方向 - // strResultType 指定需要在strResult参数中返回的数据格式。为"xml" "html"之一。 - // 如果为空,则表示strResult参数中不返回任何数据。无论这个参数为什么值,strItemRecPath中都回返回册记录路径(如果命中了的话) - // strItemRecPath 返回册记录路径。可能为逗号间隔的列表,包含多个路径 - // strBiblioType 指定需要在strBiblio参数中返回的数据格式。为"xml" "html"之一。 - // 如果为空,则表示strBiblio参数中不返回任何数据,strBilbioRecPath中也不返回路径。 - // 如果要仅仅在strBiblioRecPath中返回路径,请使用"recpath"作为strBiblioType参数的值。 - // 如果为"html"或"xml"之一,则会在strBiblioRecPath中返回路径。 - // 之所以要这样设计,主要是为了效率考虑。用""调用时,甚至不需要返回书目记录路径,这会更多地省去一些关于种的操作。 - // strBiblioRecPath 返回书目记录路径 - // return: - // Result.Value -1出错 0册记录没有找到 1册记录找到 >1册记录命中多于1条 - // 权限: 需要具有getiteminfo权限 - public LibraryServerResult GetItemInfo( - string strBarcode, - string strResultType, - out string strResult, - out string strItemRecPath, - out byte[] item_timestamp, - string strBiblioType, - out string strBiblio, - out string strBiblioRecPath) - { - strResult = ""; - strBiblio = ""; - strItemRecPath = ""; - strBiblioRecPath = ""; - item_timestamp = null; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限字符串 - if (StringUtil.IsInList("getiteminfo", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("getentities", sessioninfo.RightsOrigin) == false // 2009/10/18 - && StringUtil.IsInList("order", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "获取实体信息被拒绝。不具备order、getiteminfo或getentities权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - int nRet = 0; - long lRet = 0; - - string strXml = ""; - string strError = ""; - // string strOutputPath = ""; - - if (String.IsNullOrEmpty(strBarcode) == true) - { - strError = "strBarcode参数不能为空"; - goto ERROR1; - } - - // 特殊用法 @barcode-list: 获得册记录路径列表 - if (StringUtil.HasHead(strBarcode, "@barcode-list:") == true - && strResultType == "get-path-list") - { - nRet = app.GetItemRecPathList( - sessioninfo.Channels, - "item", - "册条码", // "册条码号"? - strBarcode.Substring("@barcode-list:".Length), - true, - out strResult, - out strError); - if (nRet == -1) - goto ERROR1; - result.ErrorInfo = ""; - result.Value = 1; - return result; - } - - // 特殊用法 @refid-list: 获得册记录路径列表 - if (StringUtil.HasHead(strBarcode, "@refid-list:") == true - && strResultType == "get-path-list") - { - nRet = app.GetItemRecPathList( - sessioninfo.Channels, - "item", - "参考ID", // "册条码号"? - strBarcode.Substring("@refid-list:".Length), - true, - out strResult, - out strError); - if (nRet == -1) - goto ERROR1; - result.ErrorInfo = ""; - result.Value = 1; - return result; - } - - // 命令状态 - if (strBarcode[0] == '@') - { - // 获得册记录,通过册记录路径 - - string strLeadPath = "@path:"; - string strLeadRefID = "@refID:"; - - /* - if (strBarcode.Length <= strLeadPath.Length) - { - strError = "错误的检索词格式: '" + strBarcode + "'"; - goto ERROR1; - } - string strPart = strBarcode.Substring(0, strLeadPath.Length); - * */ - - - if (StringUtil.HasHead(strBarcode, strLeadPath) == true) - { - strItemRecPath = strBarcode.Substring(strLeadPath.Length); - - // 2009/10/18 - // 继续分离出(方向)命令部分 - string strCommand = ""; - nRet = strItemRecPath.IndexOf("$"); - if (nRet != -1) - { - strCommand = strItemRecPath.Substring(nRet + 1); - strItemRecPath = strItemRecPath.Substring(0, nRet); - } - - string strItemDbName = ResPath.GetDbName(strItemRecPath); - // 需要检查一下数据库名是否在允许的实体库名之列 - if (app.IsItemDbName(strItemDbName) == false) - { - strError = "册记录路径 '" + strItemRecPath + "' 中的数据库名 '" + strItemDbName + "' 不在配置的实体库名之列,因此拒绝操作。"; - goto ERROR1; - } - - string strMetaData = ""; - // byte[] timestamp = null; - string strTempOutputPath = ""; - - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - strError = "get channel error"; - goto ERROR1; - } - - // 2009/10/18 - string strStyle = "content,data,metadata,timestamp,outputpath"; - - // 为了便于处理对象资源 - strStyle += ",withresmetadata"; - - if (String.IsNullOrEmpty(strCommand) == false - && (strCommand == "prev" || strCommand == "next")) - { - strStyle += "," + strCommand; - } - - /* - lRet = channel.GetRes(strItemRecPath, - out strXml, - out strMetaData, - out item_timestamp, - out strTempOutputPath, - out strError); - * */ - - lRet = channel.GetRes(strItemRecPath, - strStyle, - out strXml, - out strMetaData, - out item_timestamp, - out strTempOutputPath, - out strError); - if (lRet == -1) - { - if (channel.ErrorCode == ChannelErrorCode.NotFound) - { - result.Value = 0; - if (strCommand == "prev") - result.ErrorInfo = "到头"; - else if (strCommand == "next") - result.ErrorInfo = "到尾"; - else - result.ErrorInfo = "没有找到"; - result.ErrorCode = ErrorCode.NotFound; - return result; - } - goto ERROR1; - } - - strItemRecPath = strTempOutputPath; - - result.ErrorInfo = ""; - result.Value = 1; - goto GET_OTHERINFO; - } - else if (StringUtil.HasHead(strBarcode, strLeadRefID) == true) - { - // 继续向后处理 - } - else - { - strError = "不支持的检索词格式: '" + strBarcode + "'。目前仅支持'@path:'和'@refID:'引导的检索词"; - goto ERROR1; - } - } - - - { - List PathList = null; - // byte[] timestamp = null; - // 获得册记录 - // 本函数可获得超过1条以上的路径 - // return: - // -1 error - // 0 not found - // 1 命中1条 - // >1 命中多于1条 - nRet = app.GetItemRecXml( - sessioninfo.Channels, - strBarcode, - "withresmetadata", - out strXml, - 100, - out PathList, - out item_timestamp, - out strError); - if (nRet == 0) - { - result.Value = 0; - result.ErrorInfo = "没有找到"; - result.ErrorCode = ErrorCode.NotFound; - return result; - } - - if (nRet == -1) - goto ERROR1; - - - /* - Debug.Assert(PathList != null, ""); - // 构造路径字符串。逗号间隔 - string[] paths = new string[PathList.Count]; - PathList.CopyTo(paths); - - strItemRecPath = String.Join(",", paths); - * */ - strItemRecPath = StringUtil.MakePathList(PathList); - - result.ErrorInfo = strError; - result.Value = nRet; // 可能会多于1条 - } - - GET_OTHERINFO: - - // 过滤元素 - XmlDocument itemdom = null; - - // 修改 - if (sessioninfo.GlobalUser == false) // 分馆用户必须要过滤,因为要修改 - { - nRet = LibraryApplication.LoadToDom(strXml, - out itemdom, - out strError); - if (nRet == -1) - goto ERROR1; - - { - string strLibraryCode = ""; - // 检查一个册记录的馆藏地点是否符合当前用户管辖的馆代码列表要求 - // return: - // -1 检查过程出错 - // 0 符合要求 - // 1 不符合要求 - nRet = app.CheckItemLibraryCode(itemdom, - sessioninfo.LibraryCodeList, - out strLibraryCode, - out strError); - if (nRet == -1) - goto ERROR1; - - if (nRet == 1) - { - // 把借阅人的证条码号覆盖 - string strBorrower = DomUtil.GetElementText(itemdom.DocumentElement, - "borrower"); - if (string.IsNullOrEmpty(strBorrower) == false) - DomUtil.SetElementText(itemdom.DocumentElement, - "borrower", new string('*', strBorrower.Length)); - strXml = itemdom.DocumentElement.OuterXml; - } - } - } - - // 取得册信息 - if (String.IsNullOrEmpty(strResultType) == true - || String.Compare(strResultType, "recpath", true) == 0) - { - strResult = ""; // 不返回任何结果 - } - else if (String.Compare(strResultType, "xml", true) == 0) - { - strResult = strXml; - } - else if (String.Compare(strResultType, "html", true) == 0) - { - // 将册记录数据从XML格式转换为HTML格式 - nRet = app.ConvertItemXmlToHtml( - app.CfgDir + "\\itemxml2html.cs", - app.CfgDir + "\\itemxml2html.cs.ref", - strXml, - strItemRecPath, // 2009/10/18 - out strResult, - out strError); - if (nRet == -1) - goto ERROR1; - } - else if (String.Compare(strResultType, "text", true) == 0) - { - // 将册记录数据从XML格式转换为text格式 - nRet = app.ConvertItemXmlToHtml( - app.CfgDir + "\\itemxml2text.cs", - app.CfgDir + "\\itemxml2text.cs.ref", - strXml, - strItemRecPath, // 2009/10/18 - out strResult, - out strError); - if (nRet == -1) - goto ERROR1; - } - else - { - strError = "未知的册记录结果类型 '" + strResultType + "'"; - goto ERROR1; - } - - // 若需要同时取得种记录 - if (String.IsNullOrEmpty(strBiblioType) == false) - { - string strItemDbName = ResPath.GetDbName(strItemRecPath); - string strBiblioDbName = ""; - - // 根据实体库名, 找到对应的书目库名 - // return: - // -1 出错 - // 0 没有找到 - // 1 找到 - nRet = app.GetBiblioDbNameByItemDbName(strItemDbName, - out strBiblioDbName, - out strError); - if (nRet == -1) - goto ERROR1; - if (nRet == 0) - { - strError = "实体库名 '" + strItemDbName + "' 没有找到对应的书目库名"; - goto ERROR1; - } - - string strBiblioRecID = ""; - - if (itemdom == null) - { - itemdom = new XmlDocument(); - try - { - itemdom.LoadXml(strXml); - } - catch (Exception ex) - { - strError = "册记录XML装载到DOM出错:" + ex.Message; - goto ERROR1; - } - } - - strBiblioRecID = DomUtil.GetElementText(itemdom.DocumentElement, "parent"); // - if (String.IsNullOrEmpty(strBiblioRecID) == true) - { - strError = "册记录XML中元素缺乏或者值为空, 因此无法定位种记录"; - goto ERROR1; - } - - string strBiblioXml = ""; - strBiblioRecPath = strBiblioDbName + "/" + strBiblioRecID; - - if (String.Compare(strBiblioType, "recpath", true) == 0) - { - // 如果仅仅需要获得书目记录recpath,则不需要获得书目记录 - goto END1; - } - - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - strError = "channel == null"; - goto ERROR1; - } - string strMetaData = ""; - byte[] timestamp = null; - string strTempOutputPath = ""; - lRet = channel.GetRes(strBiblioRecPath, - out strBiblioXml, - out strMetaData, - out timestamp, - out strTempOutputPath, - out strError); - if (lRet == -1) - { - if (channel.ErrorCode == ChannelErrorCode.NotFound) - { - result.ErrorInfo = "书目记录 " + strBiblioRecPath + " 不存在"; - return result; - } - - strError = "获得种记录 '" + strBiblioRecPath + "' 时出错: " + strError; - goto ERROR1; - } - - // 如果只需要种记录的XML格式 - if (String.Compare(strBiblioType, "xml", true) == 0) - { - strBiblio = strBiblioXml; - goto END1; - } - - - // 需要从内核映射过来文件 - string strLocalPath = ""; - - if (String.Compare(strBiblioType, "html", true) == 0) - { - nRet = app.MapKernelScriptFile( - sessioninfo, - strBiblioDbName, - "./cfgs/loan_biblio.fltx", - out strLocalPath, - out strError); - } - else if (String.Compare(strBiblioType, "text", true) == 0) - { - nRet = app.MapKernelScriptFile( - sessioninfo, - strBiblioDbName, - "./cfgs/loan_biblio_text.fltx", - out strLocalPath, - out strError); - } - else - { - strError = "不能识别的strBiblioType类型 '" + strBiblioType + "'"; - goto ERROR1; - } - - if (nRet == -1) - goto ERROR1; - - // 将种记录数据从XML格式转换为HTML格式 - string strFilterFileName = strLocalPath; // app.CfgDir + "\\biblio.fltx"; - if (string.IsNullOrEmpty(strBiblioXml) == false) - { - nRet = app.ConvertBiblioXmlToHtml( - strFilterFileName, - strBiblioXml, - strBiblioRecPath, - out strBiblio, - out strError); - if (nRet == -1) - goto ERROR1; - } - else - strBiblio = ""; - } - - END1: - return result; - ERROR1: - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library GetItemInfo() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - - // *** 此API已经废止 *** - // 对册条码号进行查重 - // 2006/9/22 新增API - // Result.Value -1出错 0没有找到 1找到 >1命中多于1条 - // 权限: 需要具有searchitemdup权限 - public LibraryServerResult SearchItemDup(string strBarcode, - int nMax, - out string[] paths) - { - paths = null; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限字符串 - if (StringUtil.IsInList("searchitem", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("order", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "册条码号查重被拒绝。不具备order或searchitem权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - int nRet = 0; - - List aPath = null; - string strError = ""; - - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - strError = "get channel error"; - goto ERROR1; - } - - BeginSearch(); - channel.Idle += new IdleEventHandler(channel_IdleEvent); - try - { - - // 根据册条码号对实体库进行查重 - // 本函数只负责查重, 并不获得记录体 - // return: - // -1 error - // 其他 命中记录条数(不超过nMax规定的极限) - nRet = app.SearchItemRecDup( - // sessioninfo.Channels, - channel, - strBarcode, - nMax, - out aPath, - out strError); - } - finally - { - channel.Idle -= new IdleEventHandler(channel_IdleEvent); - EndSearch(); - } - - if (nRet == -1) - goto ERROR1; - - if (nRet == 0) - { - paths = new string[0]; - result.Value = 0; - result.ErrorInfo = "没有找到"; - result.ErrorCode = ErrorCode.NotFound; - return result; - } - - // 复制到结果中 - paths = new string[aPath.Count]; - for (int i = 0; i < aPath.Count; i++) - { - paths[i] = aPath[i]; - } - - result.Value = paths.Length; - return result; - ERROR1: - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library SearchItemDup() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 从册条码号(+册记录路径)获得种记录摘要,或者从订购记录路径、期记录路径、评注记录路径获得种记录摘要 - // Result.Value -1出错 0没有找到 1找到 - // 权限: 需要具备getbibliosummary权限 - public LibraryServerResult GetBiblioSummary( - string strItemBarcode, - string strConfirmItemRecPath, - string strBiblioRecPathExclude, - out string strBiblioRecPath, - out string strSummary) - { - strBiblioRecPath = ""; - strSummary = ""; - string strError = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - strError = "get channel error"; - goto ERROR1; - } - - BeginSearch(); - channel.Idle += new IdleEventHandler(channel_IdleEvent); - - try - { - - // parameters: - // strBiblioRecPathExclude 除开列表中的这些种路径, 才返回摘要内容, 否则仅仅返回种路径即可 - return app.GetBiblioSummary( - sessioninfo, - channel, - strItemBarcode, - strConfirmItemRecPath, - strBiblioRecPathExclude, - out strBiblioRecPath, - out strSummary); - } - catch (Exception ex) - { - string strErrorText = "dp2Library GetBiblioSummary() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - finally - { - channel.Idle -= new IdleEventHandler(channel_IdleEvent); - EndSearch(); - } - ERROR1: - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - - - // 借书 - // parameters: - // strReaderBarcode 读者证条码 - // strItemBarcode 册条码号 - // strConfirmItemRecPath 册记录路径。在册条码号重复的情况下,才需要使用这个参数,平时为null即可 - // saBorrowedItemBarcode 同一读者先前已经借阅成功的册条码号集合。用于在返回的读者html中显示出特定的颜色而已。 - // strStyle 操作风格。"item"表示将返回册记录;"reader"表示将返回读者记录 - // strItemFormat 规定strItemRecord参数所返回的数据格式 - // strItemRecord 返回册记录 - // strReaderFormat 规定strReaderRecord参数所返回的数据格式 - // strReaderRecord 返回读者记录 - // aDupPath 如果发生条码号重复,这里返回了相关册记录的路径 - // 权限:无论工作人员还是读者,首先应具备borrow或renew权限。 - // 对于读者,还需要他进行的借阅(续借)操作是针对自己的,即strReaderBarcode必须和账户信息中的证条码号一致。 - // 也就是说,读者不允许替他人借阅(续借)图书,这样规定是为了防止读者捣乱。 - // 日志: - // 要产生日志 - public LibraryServerResult Borrow( - bool bRenew, - string strReaderBarcode, - string strItemBarcode, - string strConfirmItemRecPath, - bool bForce, - string[] saBorrowedItemBarcode, - string strStyle, - string strItemFormatList, - out string[] item_records, - string strReaderFormatList, - out string[] reader_records, - string strBiblioFormatList, - out string[] biblio_records, - out BorrowInfo borrow_info, - out string[] aDupPath, - out string strOutputReaderBarcode) - { - item_records = null; - reader_records = null; - biblio_records = null; - aDupPath = null; - strOutputReaderBarcode = ""; - borrow_info = new BorrowInfo(); - - LibraryServerResult result = this.PrepareEnvironment(true, true, true); - if (result.Value == -1) - return result; - - try - { - result = app.Borrow( - sessioninfo, - bRenew, - strReaderBarcode, - strItemBarcode, - strConfirmItemRecPath, - bForce, - saBorrowedItemBarcode, - strStyle, - - strItemFormatList, - out item_records, - - strReaderFormatList, - out reader_records, - - strBiblioFormatList, - out biblio_records, - - out aDupPath, - out strOutputReaderBarcode, - out borrow_info); - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library Borrow() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 还书 - // paramters: - // strReaderBarcodeParam 读者证条码号 - // strItemBarcode 册条码号 - // bForce 是否强制执行还书操作。用于某些配置参数和数据结构不正确的特殊情况 - // strStyle 风格。"reader" 表示希望返回处理完后的读者记录 - // strReaderFormat 指明strReaderRecord参数中所返回的读者记录格式。为"xml"或"html" - // strReaderFormat 读者记录 - // return: - // Result.Value -1 出错 0 操作成功 1 操作成功,并且有值得留意的情况:如有超期情况;发现条码号重复;需要放入预约架 - // 日志: - // 要产生日志 - public LibraryServerResult Return( - string strAction, - string strReaderBarcode, - string strItemBarcode, - string strComfirmItemRecPath, - bool bForce, - string strStyle, - string strItemFormatList, - out string[] item_records, - string strReaderFormatList, - out string[] reader_records, - string strBiblioFormatList, - out string[] biblio_records, - out string[] aDupPath, - out string strOutputReaderBarcode, - out ReturnInfo return_info) - { - item_records = null; - reader_records = null; - biblio_records = null; - aDupPath = null; - strOutputReaderBarcode = ""; - return_info = new ReturnInfo(); - - LibraryServerResult result = this.PrepareEnvironment(true, true, true); - if (result.Value == -1) - return result; - - try - { - return app.Return(sessioninfo, - strAction, - strReaderBarcode, - strItemBarcode, - strComfirmItemRecPath, - bForce, - strStyle, - - strItemFormatList, - out item_records, - - strReaderFormatList, - out reader_records, - - strBiblioFormatList, - out biblio_records, - - out aDupPath, - out strOutputReaderBarcode, - out return_info); - } - catch (Exception ex) - { - string strErrorText = "dp2Library Return() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 预约 - // parameters: - // strItemBarcodeList 册条码号列表,逗号间隔 - // 权限:需要有reservation权限 - // 日志: - // 要产生日志。等待编写。 - public LibraryServerResult Reservation( - string strFunction, - string strReaderBarcode, - string strItemBarcodeList) - { - LibraryServerResult result = this.PrepareEnvironment(true, true, true); - if (result.Value == -1) - return result; - - try - { - return app.Reservation(sessioninfo, - strFunction, - strReaderBarcode, - strItemBarcodeList); - } - catch (Exception ex) - { - string strErrorText = "dp2Library Reservation() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 交违约金 - // parameters: - // 权限:需要有amerce/amercemodifyprice/amerceundo/amercemodifycomment等权限 - // 日志: - // 要产生日志 - // return: - // result.Value 0 成功;1 部分成功(result.ErrorInfo中有信息) - public LibraryServerResult Amerce( - string strFunction, - string strReaderBarcode, - AmerceItem[] amerce_items, - out AmerceItem[] failed_items, // 2011/6/27 - out string strReaderXml) - { - strReaderXml = ""; - failed_items = null; - - LibraryServerResult result = this.PrepareEnvironment(true, true, true); - if (result.Value == -1) - return result; - - try - { - return app.Amerce(sessioninfo, - strFunction, - strReaderBarcode, - amerce_items, - out failed_items, - out strReaderXml); - } - catch (Exception ex) - { - string strErrorText = "dp2Library Amerce() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - - // - // 获得期信息 - // parameters: - // strBiblioRecPath 书目记录路径,仅包含库名和id部分 - // lStart 返回从第几个开始 - // lCount 总共返回几个。0和-1都表示全部返回(0是为了兼容旧API) - // strStyle "onlygetpath" 仅返回每个路径(OldRecPath) - // "getfirstxml" 是对onlygetpath的补充,仅获得第一个元素的XML记录,其余的依然只返回路径 - // issueinfos 返回的期信息数组 - // 权限:需要有getissueinfo权限(兼容getissues权限) - public LibraryServerResult GetIssues( - string strBiblioRecPath, - long lStart, - long lCount, - string strStyle, - string strLang, - out EntityInfo[] issueinfos) - { - issueinfos = null; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限字符串 - if (StringUtil.IsInList("getissues", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("getissueinfo", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("order", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "获得期信息 操作被拒绝。不具备order、getissueinfo或getissues权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - return app.IssueItemDatabase.GetItems(sessioninfo, - strBiblioRecPath, - lStart, - lCount, - strStyle, - strLang, - out issueinfos); - } - catch (Exception ex) - { - string strErrorText = "dp2Library GetIssues() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 设置/保存期信息 - // parameters: - // strBiblioRecPath 书目记录路径,仅包含库名和id部分 - // issueinfos 要提交的的期信息数组 - // 权限:需要有setissueinfo权限(兼容setissues权限) - // 日志: - // 要产生日志 - public LibraryServerResult SetIssues( - string strBiblioRecPath, - EntityInfo[] issueinfos, - out EntityInfo[] errorinfos) - { - errorinfos = null; - - LibraryServerResult result = this.PrepareEnvironment(true, true, true); - if (result.Value == -1) - return result; - - try - { - // 权限字符串 - if (StringUtil.IsInList("setissues", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("setissueinfo", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "保存期信息 操作被拒绝。不具备setissueinfo或setissues权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - - return app.IssueItemDatabase.SetItems(sessioninfo, - strBiblioRecPath, - issueinfos, - out errorinfos); - } - catch (Exception ex) - { - string strErrorText = "dp2Library SetIssues() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - - // TODO: 建议主体移动到ItemDatabase中,可以节省多种类的代码 - // 获得期信息 - // parameters: - // strRefID 参考ID。特殊情况下,可以使用"@path:"引导的期记录路径(只需要库名和id两个部分)作为检索入口。在@path引导下,路径后面还可以跟随 "$prev"或"$next"表示方向 - // strBiblioRecPath 指定书目记录路径 - // strResultType 指定需要在strResult参数中返回的数据格式。为"xml" "html"之一。 - // 如果为空,则表示strResult参数中不返回任何数据。无论这个参数为什么值,strItemRecPath中都回返回册记录路径(如果命中了的话) - // strItemRecPath 返回册记录路径。可能为逗号间隔的列表,包含多个路径 - // strBiblioType 指定需要在strBiblio参数中返回的数据格式。为"xml" "html"之一。 - // 如果为空,则表示strBiblio参数中不返回任何数据。 - // return: - // Result.Value -1出错 0没有找到 1找到 >1命中多于1条 - // 权限: 需要具有getissueinfo权限 - public LibraryServerResult GetIssueInfo( - string strRefID, - // string strBiblioRecPath, - string strResultType, - out string strResult, - out string strIssueRecPath, - out byte[] issue_timestamp, - string strBiblioType, - out string strBiblio, - out string strOutputBiblioRecPath) - { - strResult = ""; - strBiblio = ""; - strIssueRecPath = ""; - issue_timestamp = null; - strOutputBiblioRecPath = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限字符串 - if (StringUtil.IsInList("getissueinfo", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("order", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "获取期信息被拒绝。不具备order或getissueinfo权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - - int nRet = 0; - long lRet = 0; - - string strXml = ""; - string strError = ""; - // string strOutputPath = ""; - - if (String.IsNullOrEmpty(strRefID) == true) - { - strError = "strPublishTime参数不能为空"; - goto ERROR1; - } - - string strBiblioDbName = ""; - // string strIssueDbName = ""; - string strParentID = ""; - - // 特殊用法 @barcode-list: 获得册记录路径列表 - if (StringUtil.HasHead(strRefID, "@item-refid-list:") == true - && strResultType == "get-path-list") - { - nRet = app.GetItemRecPathList( - sessioninfo.Channels, - "issue", - "册参考ID", - strRefID.Substring("@item-refid-list:".Length), - true, - out strResult, - out strError); - if (nRet == -1) - goto ERROR1; - result.ErrorInfo = ""; - result.Value = 1; - return result; - } - - // 命令状态 - if (strRefID[0] == '@') - { - - // TODO: refid - - // 获得期记录,通过期记录路径 - - string strLead = "@path:"; - if (strRefID.Length <= strLead.Length) - { - strError = "错误的检索词格式: '" + strRefID + "'"; - goto ERROR1; - } - string strPart = strRefID.Substring(0, strLead.Length); - - if (strPart != strLead) - { - strError = "不支持的检索词格式: '" + strRefID + "'。目前仅支持'@path:'引导的检索词"; - goto ERROR1; - } - - strIssueRecPath = strRefID.Substring(strLead.Length); - - // 继续分离出(方向)命令部分 - string strCommand = ""; - nRet = strIssueRecPath.IndexOf("$"); - if (nRet != -1) - { - strCommand = strIssueRecPath.Substring(nRet + 1); - strIssueRecPath = strIssueRecPath.Substring(0, nRet); - } - - string strCurrentIssueDbName = ResPath.GetDbName(strIssueRecPath); - // 需要检查一下数据库名是否在允许的期库名之列 - if (app.IsIssueDbName(strCurrentIssueDbName) == false) - { - strError = "期记录路径 '" + strIssueRecPath + "' 中的数据库名 '" + strCurrentIssueDbName + "' 不在配置的期库名之列,因此拒绝操作。"; - goto ERROR1; - } - - string strMetaData = ""; - string strTempOutputPath = ""; - - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - strError = "get channel error"; - goto ERROR1; - } - - string strStyle = "content,data,metadata,timestamp,outputpath"; - - // 为了便于处理对象资源 - strStyle += ",withresmetadata"; - - if (String.IsNullOrEmpty(strCommand) == false - && (strCommand == "prev" || strCommand == "next")) - { - strStyle += "," + strCommand; - } - - /* - lRet = channel.GetRes(strIssueRecPath, - out strXml, - out strMetaData, - out issue_timestamp, - out strTempOutputPath, - out strError); - if (lRet == -1) - goto ERROR1; - * */ - lRet = channel.GetRes(strIssueRecPath, - strStyle, - out strXml, - out strMetaData, - out issue_timestamp, - out strTempOutputPath, - out strError); - if (lRet == -1) - { - if (channel.ErrorCode == ChannelErrorCode.NotFound) - { - result.Value = 0; - if (strCommand == "prev") - result.ErrorInfo = "到头"; - else if (strCommand == "next") - result.ErrorInfo = "到尾"; - else - result.ErrorInfo = "没有找到"; - result.ErrorCode = ErrorCode.NotFound; - return result; - } - goto ERROR1; - } - - strIssueRecPath = strTempOutputPath; - - - // - - if (true) // 是否有节省运算的办法? - { - - // 从期记录元素中取得书目记录的id,然后拼装成书目记录路径放入strOutputBiblioRecPath - XmlDocument dom = new XmlDocument(); - try - { - dom.LoadXml(strXml); - } - catch (Exception ex) - { - strError = "记录 " + strIssueRecPath + " 的XML装入DOM时出错: " + ex.Message; - goto ERROR1; - } - - // 根据期库名, 找到对应的书目库名 - // return: - // -1 出错 - // 0 没有找到 - // 1 找到 - nRet = app.GetBiblioDbNameByIssueDbName(strCurrentIssueDbName, - out strBiblioDbName, - out strError); - if (nRet == -1 || nRet == 0) - goto ERROR1; - - strParentID = DomUtil.GetElementText(dom.DocumentElement, - "parent"); - if (String.IsNullOrEmpty(strParentID) == true) - { - strError = "期记录 " + strIssueRecPath + " 中没有元素值,因此无法定位其从属的书目记录"; - goto ERROR1; - } - string strBiblioRecPath = strBiblioDbName + "/" + strParentID; - strOutputBiblioRecPath = strBiblioRecPath; - } - - // - - result.ErrorInfo = ""; - result.Value = 1; - } - else - { -#if NO - // - strOutputBiblioRecPath = strBiblioRecPath; - - strBiblioDbName = ResPath.GetDbName(strBiblioRecPath); - - // 根据书目库名, 找到对应的期库名 - // return: - // -1 出错 - // 0 没有找到(书目库) - // 1 找到 - nRet = app.GetIssueDbName(strBiblioDbName, - out strIssueDbName, - out strError); - if (nRet == -1) - goto ERROR1; - if (nRet == 0) - { - strError = "书目库 '" + strBiblioDbName + "' 没有找到"; - goto ERROR1; - } - strParentID = ResPath.GetRecordId(strBiblioRecPath); - - // - List locateParam = new List(); - //locateParam.Add(strIssueDbName); - //locateParam.Add(strParentID); - locateParam.Add(strPublishTime); -#endif - List locateParam = null; - - nRet = app.IssueItemDatabase.BuildLocateParam( - // strBiblioRecPath, - strRefID, - out locateParam, - out strError); - if (nRet == -1) - goto ERROR1; - - List PathList = null; - - // byte[] timestamp = null; - // 获得册记录 - // 本函数可获得超过1条以上的路径 - // return: - // -1 error - // 0 not found - // 1 命中1条 - // >1 命中多于1条 - /* - nRet = app.GetIssueRecXml( - sessioninfo.Channels, - strIssueDbName, - strParentID, - strPublishTime, - out strXml, - 100, - out PathList, - out issue_timestamp, - out strError); - * */ - - nRet = app.IssueItemDatabase.GetItemRecXml( - sessioninfo.Channels, - locateParam, - "withresmetadata", - out strXml, - 100, - out PathList, - out issue_timestamp, - out strError); - - if (nRet == 0) - { - result.Value = 0; - result.ErrorInfo = "没有找到"; - result.ErrorCode = ErrorCode.NotFound; - return result; - } - - if (nRet == -1) - goto ERROR1; - - /* - Debug.Assert(PathList != null, ""); - // 构造路径字符串。逗号间隔 - string[] paths = new string[PathList.Count]; - PathList.CopyTo(paths); - - strIssueRecPath = String.Join(",", paths); - * */ - strIssueRecPath = StringUtil.MakePathList(PathList); - - result.ErrorInfo = strError; - result.Value = nRet; // 可能会多于1条 - } - - // 若需要同时取得种记录 - if (String.IsNullOrEmpty(strBiblioType) == false) - { - string strBiblioRecID = ""; - - XmlDocument dom = new XmlDocument(); - try - { - dom.LoadXml(strXml); - } - catch (Exception ex) - { - strError = "期记录XML装载到DOM出错:" + ex.Message; - goto ERROR1; - } - - strBiblioRecID = DomUtil.GetElementText(dom.DocumentElement, "parent"); // - if (String.IsNullOrEmpty(strBiblioRecID) == true) - { - strError = "期记录XML中元素缺乏或者值为空, 因此无法定位种记录"; - goto ERROR1; - } - - strOutputBiblioRecPath = strBiblioDbName + "/" + strBiblioRecID; - - string strBiblioXml = ""; - - if (String.Compare(strBiblioType, "recpath", true) == 0) - { - // 如果仅仅需要获得书目记录recpath,则不需要获得书目记录 - goto DOISSUE; - } - - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - strError = "channel == null"; - goto ERROR1; - } - string strMetaData = ""; - byte[] timestamp = null; - string strTempOutputPath = ""; - lRet = channel.GetRes(strOutputBiblioRecPath, - out strBiblioXml, - out strMetaData, - out timestamp, - out strTempOutputPath, - out strError); - if (lRet == -1) - { - strError = "获得种记录 '" + strOutputBiblioRecPath + "' 时出错: " + strError; - goto ERROR1; - } - - // 如果只需要种记录的XML格式 - if (String.Compare(strBiblioType, "xml", true) == 0) - { - strBiblio = strBiblioXml; - goto DOISSUE; - } - - - // 需要从内核映射过来文件 - string strLocalPath = ""; - - if (String.Compare(strBiblioType, "html", true) == 0) - { - nRet = app.MapKernelScriptFile( - sessioninfo, - strBiblioDbName, - "./cfgs/loan_biblio.fltx", - out strLocalPath, - out strError); - } - else if (String.Compare(strBiblioType, "text", true) == 0) - { - nRet = app.MapKernelScriptFile( - sessioninfo, - strBiblioDbName, - "./cfgs/loan_biblio_text.fltx", - out strLocalPath, - out strError); - } - else - { - strError = "不能识别的strBiblioType类型 '" + strBiblioType + "'"; - goto ERROR1; - } - - if (nRet == -1) - goto ERROR1; - - // 将种记录数据从XML格式转换为HTML格式 - string strFilterFileName = strLocalPath; // app.CfgDir + "\\biblio.fltx"; - if (string.IsNullOrEmpty(strBiblioXml) == false) - { - nRet = app.ConvertBiblioXmlToHtml( - strFilterFileName, - strBiblioXml, - strOutputBiblioRecPath, - out strBiblio, - out strError); - if (nRet == -1) - goto ERROR1; - } - else - strBiblio = ""; - } - - DOISSUE: - // 取得期信息 - if (String.IsNullOrEmpty(strResultType) == true - || String.Compare(strResultType, "recpath", true) == 0) - { - strResult = ""; // 不返回任何结果 - } - else if (String.Compare(strResultType, "xml", true) == 0) - { - strResult = strXml; - } - else if (String.Compare(strResultType, "html", true) == 0) - { - // 将期记录数据从XML格式转换为HTML格式 - nRet = app.ConvertItemXmlToHtml( - app.CfgDir + "\\issuexml2html.cs", - app.CfgDir + "\\issuexml2html.cs.ref", - strXml, - strIssueRecPath, // 2009/10/18 - out strResult, - out strError); - if (nRet == -1) - goto ERROR1; - } - else if (String.Compare(strResultType, "text", true) == 0) - { - // 将期记录数据从XML格式转换为text格式 - nRet = app.ConvertItemXmlToHtml( - app.CfgDir + "\\issuexml2text.cs", - app.CfgDir + "\\issuexml2text.cs.ref", - strXml, - strIssueRecPath, // 2009/10/18 - out strResult, - out strError); - if (nRet == -1) - goto ERROR1; - } - else - { - strError = "未知的册记录结果类型 '" + strResultType + "'"; - goto ERROR1; - } - - return result; - ERROR1: - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library GetIssueInfo() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // *** 此API已经废止 *** - // 对(期)出版日期进行查重 - // 2007/10/19 新增API - // parameters: - // strPublishTime 实际上要在这里使用参考ID。2012/4/6 - // Result.Value -1出错 0没有找到 1找到 >1命中多于1条 - // 权限: 需要具有searchissuedup权限 - public LibraryServerResult SearchIssueDup(string strPublishTime, - string strBiblioRecPath, - int nMax, - out string[] paths) - { - paths = null; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - - // 权限字符串 - if (StringUtil.IsInList("searchissue", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("order", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "对期记录的参考ID查重被拒绝。不具备order或searchissue权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - int nRet = 0; - string strError = ""; - - List locateParam = null; - - nRet = app.IssueItemDatabase.BuildLocateParam( - // strBiblioRecPath, - strPublishTime, - out locateParam, - out strError); - if (nRet == -1) - goto ERROR1; - - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - strError = "get channel error"; - goto ERROR1; - } - BeginSearch(); - channel.Idle += new IdleEventHandler(channel_IdleEvent); - try - { - return app.IssueItemDatabase.SearchItemDup( - // sessioninfo.Channels, - channel, - locateParam, - nMax, - out paths); - } - finally - { - channel.Idle -= new IdleEventHandler(channel_IdleEvent); - EndSearch(); - } - ERROR1: - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library SearchIssueDup() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 检索期信息 - // parameters: - // strQueryWord 检索词 - // strFrom 检索途径 - // strMathStyle 匹配方式 exact left right middle - // 权限: - // 需要 searchissue 权限 - // return: - // result.Value 命中结果总数。如果为-1,则表示检索出错 - public LibraryServerResult SearchIssue( - string strIssueDbName, - string strQueryWord, - int nPerMax, - string strFrom, - string strMatchStyle, - string strLang, - string strResultSetName, - string strSearchStyle, - string strOutputStyle) - { - string strError = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限判断 - - // 权限字符串 - if (StringUtil.IsInList("searchissue", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "检索期信息被拒绝。不具备searchissue权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - List dbnames = new List(); - - if (String.IsNullOrEmpty(strIssueDbName) == true - || strIssueDbName == "<全部>" - || strIssueDbName.ToLower() == "" - || strIssueDbName == "<全部期刊>" - || strIssueDbName.ToLower() == "") - { - for (int i = 0; i < app.ItemDbs.Count; i++) - { - string strDbName = app.ItemDbs[i].IssueDbName; - if (String.IsNullOrEmpty(strDbName) == true) - continue; - dbnames.Add(strDbName); - } - - if (dbnames.Count == 0) - { - strError = "没有发现任何期库"; - goto ERROR1; - } - } - else if (strIssueDbName == "<全部图书>" - || strIssueDbName.ToLower() == "") - { - strError = "SearchIssue() API中不能使用库名 '" + strIssueDbName + "'"; - goto ERROR1; - } - else - { - string[] splitted = strIssueDbName.Split(new char[] { ',' }); - for (int i = 0; i < splitted.Length; i++) - { - string strDbName = splitted[i]; - if (String.IsNullOrEmpty(strDbName) == true) - continue; - - if (app.IsIssueDbName(strDbName) == false) - { - strError = "库名 '" + strDbName + "' 不是合法的期库名"; - goto ERROR1; - } - - dbnames.Add(strDbName); - } - - } - - bool bDesc = StringUtil.IsInList("desc", strSearchStyle); - - // 构造检索式 - string strQueryXml = ""; - for (int i = 0; i < dbnames.Count; i++) - { - string strDbName = dbnames[i]; - - Debug.Assert(String.IsNullOrEmpty(strDbName) == false, ""); - - string strRelation = "="; - string strDataType = "string"; - - if (strFrom == "__id") - { - // 如果为范围式 - if (String.IsNullOrEmpty(strQueryWord) == false // 2013/3/25 - && strQueryWord.IndexOf("-") != -1) - { - strRelation = "range"; - strDataType = "number"; - } - else if (String.IsNullOrEmpty(strQueryWord) == false) - { - strDataType = "number"; - } - } - - string strOneDbQuery = "" - + (bDesc == true ? "DESC" : "") - + "" - + StringUtil.GetXmlStringSimple(strQueryWord) - + "" + strMatchStyle + ""+strRelation+""+strDataType+"" + nPerMax.ToString() + "" + strLang + ""; - - if (i > 0) - { - Debug.Assert(String.IsNullOrEmpty(strQueryXml) == false, ""); - strQueryXml += ""; - } - - strQueryXml += strOneDbQuery; - } - - if (dbnames.Count > 0) - { - strQueryXml = "" + strQueryXml + ""; - } - - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - strError = "get channel error"; - goto ERROR1; - } - - BeginSearch(); - channel.Idle += new IdleEventHandler(channel_IdleEvent); - try - { - WriteDebugInfo("begin search " + strQueryXml); - long lRet = channel.DoSearch(strQueryXml, - strResultSetName, - strOutputStyle, - out strError); - WriteDebugInfo("end search lRet=" + lRet.ToString() + " " + strQueryXml); - if (lRet == -1) - { - goto ERROR1; - } - - if (lRet == 0) - { - result.Value = 0; - result.ErrorInfo = "not found"; - return result; - } - - result.Value = lRet; - result.ErrorInfo = ""; - } - finally - { - channel.Idle -= new IdleEventHandler(channel_IdleEvent); - EndSearch(); - } - - return result; - - ERROR1: - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library SearchIssue() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // - - // 获得册信息 - // parameters: - // strBiblioRecPath 书目记录路径,仅包含库名和id部分 - // lStart 返回从第几个开始 2009/6/7 add - // lCount 总共返回几个。0和-1都表示全部返回(0是为了兼容旧API) - // strStyle "opac" 把实体记录按照OPAC要求进行加工,增补一些元素 - // "onlygetpath" 仅返回每个路径 - // "getfirstxml" 是对onlygetpath的补充,仅获得第一个元素的XML记录,其余的依然只返回路径 - // "getotherlibraryitem" 返回全部分馆的记录的详情。这个用法只对分馆用户有用。因为分馆用户如果不用这个style,则只获得属于自己管辖分馆的册记录的详情 - // entityinfos 返回的实体信息数组 - // Result.Value -1出错 0没有找到 其他 总的实体记录的个数(本次返回的,可以通过entities.Count得到) - // 权限:需要有getiteminfo或order权限(兼容getentities权限) - public LibraryServerResult GetEntities( - string strBiblioRecPath, - long lStart, - long lCount, - string strStyle, // 2011/1/21 - string strLang, // 2011/1/21 - out EntityInfo[] entityinfos) - { - entityinfos = null; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - return app.GetEntities(sessioninfo, - strBiblioRecPath, - lStart, - lCount, - strStyle, // 2011/1/21 - strLang, // 2011/1/21 - out entityinfos); - } - catch (Exception ex) - { - string strErrorText = "dp2Library GetEntities() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 设置/保存册信息 - // parameters: - // strBiblioRecPath 书目记录路径,仅包含库名和id部分 - // entityinfos 要提交的的实体信息数组 - // 权限:需要有setiteminfo权限(兼容setentities权限) - // 日志: - // 要产生日志 - public LibraryServerResult SetEntities( - string strBiblioRecPath, - EntityInfo[] entityinfos, - out EntityInfo[] errorinfos) - { - errorinfos = null; - - LibraryServerResult result = this.PrepareEnvironment(true, true, true); - if (result.Value == -1) - return result; - - try - { - return app.SetEntities(sessioninfo, - strBiblioRecPath, - entityinfos, - out errorinfos); - } - catch (Exception ex) - { - string strErrorText = "dp2Library SetEntities() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - /// *** 订购相关功能 - /// - - - // 获得订购信息 - // parameters: - // strBiblioRecPath 书目记录路径,仅包含库名和id部分 - // lStart 返回从第几个开始 - // lCount 总共返回几个。0和-1都表示全部返回(0是为了兼容旧API) - // strStyle "onlygetpath" 仅返回每个路径(OldRecPath) - // "getfirstxml" 是对onlygetpath的补充,仅获得第一个元素的XML记录,其余的依然只返回路径 - // orderinfos 返回的订购信息数组 - // 权限:需要有getorderinfo权限(兼容以前的getorders权限) - public LibraryServerResult GetOrders( - string strBiblioRecPath, - long lStart, - long lCount, - string strStyle, - string strLang, - out EntityInfo[] orderinfos) - { - orderinfos = null; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限字符串 - if (StringUtil.IsInList("getorders", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("getorderinfo", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("order", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "获得订购信息 操作被拒绝。不具备order、getorderinfo或getorders权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - return app.OrderItemDatabase.GetItems(sessioninfo, - strBiblioRecPath, - lStart, - lCount, - strStyle, - strLang, - out orderinfos); - } - catch (Exception ex) - { - string strErrorText = "dp2Library GetOrders() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 设置/保存订购信息 - // parameters: - // strBiblioRecPath 书目记录路径,仅包含库名和id部分 - // orderinfos 要提交的的订购信息数组 - // 权限:需要有setorderinfo权限(兼容setorders权限) - // 日志: - // 要产生日志 - public LibraryServerResult SetOrders( - string strBiblioRecPath, - EntityInfo[] orderinfos, - out EntityInfo[] errorinfos) - { - errorinfos = null; - - LibraryServerResult result = this.PrepareEnvironment(true, true, true); - if (result.Value == -1) - return result; - - try - { - // 权限字符串 - if (StringUtil.IsInList("setorders", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("setorderinfo", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("order", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "保存订购信息 操作被拒绝。不具备order、setorderinfo或setorders权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - - return app.OrderItemDatabase.SetItems(sessioninfo, - strBiblioRecPath, - orderinfos, - out errorinfos); - } - catch (Exception ex) - { - string strErrorText = "dp2Library SetOrders() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // TODO: 建议主体移动到ItemDatabase中,可以节省多种类的代码 - // 获得订购信息 - // parameters: - // strRefID 参考ID。特殊情况下,可以使用"@path:"引导的订购记录路径(只需要库名和id两个部分)作为检索入口。在@path引导下,路径后面还可以跟随 "$prev"或"$next"表示方向 - // strBiblioRecPath 指定书目记录路径 - // strResultType 指定需要在strResult参数中返回的数据格式。为"xml" "html"之一。 - // 如果为空,则表示strResult参数中不返回任何数据。无论这个参数为什么值,strItemRecPath中都回返回册记录路径(如果命中了的话) - // strItemRecPath 返回册记录路径。可能为逗号间隔的列表,包含多个路径 - // strBiblioType 指定需要在strBiblio参数中返回的数据格式。为"xml" "html"之一。 - // 如果为空,则表示strBiblio参数中不返回任何数据。 - // strOutputBiblioRecPath 输出的书目记录路径。当strIndex的第一字符为'@'时,strBiblioRecPath必须为空,函数返回后,strOutputBiblioRecPath中会包含从属的书目记录路径 - // return: - // Result.Value -1出错 0没有找到 1找到 >1命中多于1条 - // 权限: 需要具有getorderinfo权限 - public LibraryServerResult GetOrderInfo( - string strRefID, - // string strBiblioRecPath, - string strResultType, - out string strResult, - out string strOrderRecPath, - out byte[] order_timestamp, - string strBiblioType, - out string strBiblio, - out string strOutputBiblioRecPath) - { - strResult = ""; - strBiblio = ""; - strOrderRecPath = ""; - order_timestamp = null; - strOutputBiblioRecPath = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限字符串 - if (StringUtil.IsInList("getorderinfo", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("order", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "获取订购信息被拒绝。不具备order或getorderinfo权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - - int nRet = 0; - long lRet = 0; - - string strXml = ""; - string strError = ""; - - if (String.IsNullOrEmpty(strRefID) == true) - { - strError = "strIndex参数不能为空"; - goto ERROR1; - } - - string strBiblioDbName = ""; - string strOrderDbName = ""; - string strParentID = ""; - - // 特殊用法 @barcode-list: 获得册记录路径列表 - if (StringUtil.HasHead(strRefID, "@item-refid-list:") == true - && strResultType == "get-path-list") - { - nRet = app.GetItemRecPathList( - sessioninfo.Channels, - "order", - "册参考ID", - strRefID.Substring("@item-refid-list:".Length), - true, - out strResult, - out strError); - if (nRet == -1) - goto ERROR1; - result.ErrorInfo = ""; - result.Value = 1; - return result; - } - - // 命令状态 - if (strRefID[0] == '@') - { -#if NO - if (String.IsNullOrEmpty(strBiblioRecPath) == false) - { - strError = "当strIndex参数为'@'引导的命令形态时,strBiblioRecPath参数必须为空"; - goto ERROR1; - } -#endif - - // TODO: "@refID:"; - - // 获得订购记录,通过订购记录路径 - - string strLead = "@path:"; - if (strRefID.Length <= strLead.Length) - { - strError = "错误的检索词格式: '" + strRefID + "'"; - goto ERROR1; - } - string strPart = strRefID.Substring(0, strLead.Length); - - if (strPart != strLead) - { - strError = "不支持的检索词格式: '" + strRefID + "'。目前仅支持'@path:'引导的检索词"; - goto ERROR1; - } - - strOrderRecPath = strRefID.Substring(strLead.Length); - - // 继续分离出(方向)命令部分 - string strCommand = ""; - nRet = strOrderRecPath.IndexOf("$"); - if (nRet != -1) - { - strCommand = strOrderRecPath.Substring(nRet + 1); - strOrderRecPath = strOrderRecPath.Substring(0, nRet); - } - - - strOrderDbName = ResPath.GetDbName(strOrderRecPath); - // 需要检查一下数据库名是否在允许的订购库名之列 - if (app.IsOrderDbName(strOrderDbName) == false) - { - strError = "订购记录路径 '" + strOrderRecPath + "' 中的数据库名 '" + strOrderDbName + "' 不在配置的订购库名之列,因此拒绝操作。"; - goto ERROR1; - } - - string strMetaData = ""; - string strTempOutputPath = ""; - - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - strError = "get channel error"; - goto ERROR1; - } - - string strStyle = "content,data,metadata,timestamp,outputpath"; - - // 为了便于处理对象资源 - strStyle += ",withresmetadata"; - - if (String.IsNullOrEmpty(strCommand) == false - && (strCommand == "prev" || strCommand == "next")) - { - strStyle += "," + strCommand; - } - - /* - lRet = channel.GetRes(strOrderRecPath, - out strXml, - out strMetaData, - out order_timestamp, - out strTempOutputPath, - out strError); - if (lRet == -1) - goto ERROR1; - * * */ - lRet = channel.GetRes(strOrderRecPath, - strStyle, - out strXml, - out strMetaData, - out order_timestamp, - out strTempOutputPath, - out strError); - if (lRet == -1) - { - if (channel.ErrorCode == ChannelErrorCode.NotFound) - { - result.Value = 0; - if (strCommand == "prev") - result.ErrorInfo = "到头"; - else if (strCommand == "next") - result.ErrorInfo = "到尾"; - else - result.ErrorInfo = "没有找到"; - result.ErrorCode = ErrorCode.NotFound; - return result; - } - goto ERROR1; - } - - strOrderRecPath = strTempOutputPath; - - // 从订购记录元素中取得书目记录的id,然后拼装成书目记录路径放入strOutputBiblioRecPath - XmlDocument dom = new XmlDocument(); - try - { - dom.LoadXml(strXml); - } - catch (Exception ex) - { - strError = "记录 " + strOrderRecPath + " 的XML装入DOM时出错: " + ex.Message; - goto ERROR1; - } - - // 根据订购库名, 找到对应的书目库名 - // return: - // -1 出错 - // 0 没有找到 - // 1 找到 - nRet = app.GetBiblioDbNameByOrderDbName(strOrderDbName, - out strBiblioDbName, - out strError); - if (nRet == -1 || nRet == 0) - goto ERROR1; - - strParentID = DomUtil.GetElementText(dom.DocumentElement, - "parent"); - if (String.IsNullOrEmpty(strParentID) == true) - { - strError = "订购记录 " + strOrderRecPath + " 中没有元素值,因此无法定位其从属的书目记录"; - goto ERROR1; - } - string strBiblioRecPath = strBiblioDbName + "/" + strParentID; - strOutputBiblioRecPath = strBiblioRecPath; - - result.ErrorInfo = ""; - result.Value = 1; - } - else - { -#if NO - strOutputBiblioRecPath = strBiblioRecPath; - - strBiblioDbName = ResPath.GetDbName(strBiblioRecPath); - // 根据书目库名, 找到对应的订购名 - // return: - // -1 出错 - // 0 没有找到(书目库) - // 1 找到 - nRet = app.GetOrderDbName(strBiblioDbName, - out strOrderDbName, - out strError); - if (nRet == -1) - goto ERROR1; - if (nRet == 0) - { - strError = "书目库 '" + strBiblioDbName + "' 没有找到"; - goto ERROR1; - } - strParentID = ResPath.GetRecordId(strBiblioRecPath); - - - - List locateParam = new List(); - // locateParam.Add(strOrderDbName); - // locateParam.Add(strParentID); - locateParam.Add(strIndex); -#endif - List PathList = null; - - List locateParam = null; - - nRet = app.OrderItemDatabase.BuildLocateParam( - // strBiblioRecPath, - strRefID, - out locateParam, - out strError); - if (nRet == -1) - goto ERROR1; - - // byte[] timestamp = null; - // 获得册记录 - // 本函数可获得超过1条以上的路径 - // return: - // -1 error - // 0 not found - // 1 命中1条 - // >1 命中多于1条 - nRet = app.OrderItemDatabase.GetItemRecXml( - sessioninfo.Channels, - locateParam, - "withresmetadata", - out strXml, - 100, - out PathList, - out order_timestamp, - out strError); - - if (nRet == 0) - { - result.Value = 0; - result.ErrorInfo = "没有找到"; - result.ErrorCode = ErrorCode.NotFound; - return result; - } - - if (nRet == -1) - goto ERROR1; - - /* - Debug.Assert(PathList != null, ""); - // 构造路径字符串。逗号间隔 - string[] paths = new string[PathList.Count]; - PathList.CopyTo(paths); - - strOrderRecPath = String.Join(",", paths); - * */ - strOrderRecPath = StringUtil.MakePathList(PathList); - - result.ErrorInfo = strError; - result.Value = nRet; // 可能会多于1条 - } - - // 若需要同时取得种记录 - if (String.IsNullOrEmpty(strBiblioType) == false) - { - string strBiblioRecID = ""; - - XmlDocument dom = new XmlDocument(); - try - { - dom.LoadXml(strXml); - } - catch (Exception ex) - { - strError = "订购记录XML装载到DOM出错:" + ex.Message; - goto ERROR1; - } - - strBiblioRecID = DomUtil.GetElementText(dom.DocumentElement, "parent"); // - if (String.IsNullOrEmpty(strBiblioRecID) == true) - { - strError = "订购记录XML中元素缺乏或者值为空, 因此无法定位种记录"; - goto ERROR1; - } - - strOutputBiblioRecPath = strBiblioDbName + "/" + strBiblioRecID; - - - - string strBiblioXml = ""; - - if (String.Compare(strBiblioType, "recpath", true) == 0) - { - // 如果仅仅需要获得书目记录recpath,则不需要获得书目记录 - goto DOORDER; - } - - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - strError = "channel == null"; - goto ERROR1; - } - string strMetaData = ""; - byte[] timestamp = null; - string strTempOutputPath = ""; - lRet = channel.GetRes(strOutputBiblioRecPath, - out strBiblioXml, - out strMetaData, - out timestamp, - out strTempOutputPath, - out strError); - if (lRet == -1) - { - strError = "获得种记录 '" + strOutputBiblioRecPath + "' 时出错: " + strError; - goto ERROR1; - } - - // 如果只需要种记录的XML格式 - if (String.Compare(strBiblioType, "xml", true) == 0) - { - strBiblio = strBiblioXml; - goto DOORDER; - } - - // 需要从内核映射过来文件 - string strLocalPath = ""; - - if (String.Compare(strBiblioType, "html", true) == 0) - { - nRet = app.MapKernelScriptFile( - sessioninfo, - strBiblioDbName, - "./cfgs/loan_biblio.fltx", - out strLocalPath, - out strError); - } - else if (String.Compare(strBiblioType, "text", true) == 0) - { - nRet = app.MapKernelScriptFile( - sessioninfo, - strBiblioDbName, - "./cfgs/loan_biblio_text.fltx", - out strLocalPath, - out strError); - } - else - { - strError = "不能识别的strBiblioType类型 '" + strBiblioType + "'"; - goto ERROR1; - } - - if (nRet == -1) - goto ERROR1; - - // 将种记录数据从XML格式转换为HTML格式 - string strFilterFileName = strLocalPath; // app.CfgDir + "\\biblio.fltx"; - - if (string.IsNullOrEmpty(strBiblioXml) == false) - { - nRet = app.ConvertBiblioXmlToHtml( - strFilterFileName, - strBiblioXml, - strOutputBiblioRecPath, - out strBiblio, - out strError); - if (nRet == -1) - goto ERROR1; - } - else - strBiblio = ""; - } - - DOORDER: - // 取得订购信息 - if (String.IsNullOrEmpty(strResultType) == true - || String.Compare(strResultType, "recpath", true) == 0) - { - strResult = ""; // 不返回任何结果 - } - else if (String.Compare(strResultType, "xml", true) == 0) - { - strResult = strXml; - } - else if (String.Compare(strResultType, "html", true) == 0) - { - // 将订购记录数据从XML格式转换为HTML格式 - nRet = app.ConvertItemXmlToHtml( - app.CfgDir + "\\orderxml2html.cs", - app.CfgDir + "\\orderxml2html.cs.ref", - strXml, - strOrderRecPath, // 2009/10/18 - out strResult, - out strError); - if (nRet == -1) - goto ERROR1; - } - else if (String.Compare(strResultType, "text", true) == 0) - { - // 将订购记录数据从XML格式转换为text格式 - nRet = app.ConvertItemXmlToHtml( - app.CfgDir + "\\orderxml2text.cs", - app.CfgDir + "\\orderxml2text.cs.ref", - strXml, - strOrderRecPath, // 2009/10/18 - out strResult, - out strError); - if (nRet == -1) - goto ERROR1; - } - else - { - strError = "未知的订购记录结果类型 '" + strResultType + "'"; - goto ERROR1; - } - - return result; - ERROR1: - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library GetOrderInfo() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // *** 此API已经废止 *** - // 对(订购)编号进行查重 - // parameters: - // strIndex 实际上要在这里使用参考ID。2012/4/6 - // Result.Value -1出错 0没有找到 1找到 >1命中多于1条 - // 权限: 需要具有searchorderdup权限 - public LibraryServerResult SearchOrderDup(string strIndex, - string strBiblioRecPath, - int nMax, - out string[] paths) - { - paths = null; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限字符串 - if (StringUtil.IsInList("searchorder", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "编号查重被拒绝。不具备searchorder权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - int nRet = 0; - string strError = ""; - - List locateParam = null; - - nRet = app.OrderItemDatabase.BuildLocateParam( - // strBiblioRecPath, - strIndex, - out locateParam, - out strError); - if (nRet == -1) - goto ERROR1; - - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - strError = "get channel error"; - goto ERROR1; - } - BeginSearch(); - channel.Idle += new IdleEventHandler(channel_IdleEvent); - try - { - return app.OrderItemDatabase.SearchItemDup( - // sessioninfo.Channels, - channel, - locateParam, - nMax, - out paths); - } - finally - { - channel.Idle -= new IdleEventHandler(channel_IdleEvent); - EndSearch(); - } - ERROR1: - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library SearchOrderDup() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 检索订购信息 - // parameters: - // strQueryWord 检索词 - // strFrom 检索途径 - // strMathStyle 匹配方式 exact left right middle - // 权限: - // 需要 searchorder 权限 - // return: - // result.Value 命中结果总数。如果为-1,则表示检索出错 - public LibraryServerResult SearchOrder( - string strOrderDbName, - string strQueryWord, - int nPerMax, - string strFrom, - string strMatchStyle, - string strLang, - string strResultSetName, - string strSearchStyle, - string strOutputStyle) - { - string strError = ""; - - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限判断 - - // 权限字符串 - if (StringUtil.IsInList("searchorder", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("order", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "检索订购信息被拒绝。不具备order、searchorder权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - List dbnames = new List(); - - if (String.IsNullOrEmpty(strOrderDbName) == true - || strOrderDbName == "<全部>" - || strOrderDbName.ToLower() == "") - { - for (int i = 0; i < app.ItemDbs.Count; i++) - { - string strDbName = app.ItemDbs[i].OrderDbName; - if (String.IsNullOrEmpty(strDbName) == true) - continue; - dbnames.Add(strDbName); - } - - if (dbnames.Count == 0) - { - strError = "没有发现任何订购库"; - goto ERROR1; - } - } - else if (strOrderDbName == "<全部期刊>" - || strOrderDbName.ToLower() == "") - { - for (int i = 0; i < app.ItemDbs.Count; i++) - { - string strCurrentOrderDbName = app.ItemDbs[i].OrderDbName; - string strCurrentIssueDbName = app.ItemDbs[i].IssueDbName; - - if (String.IsNullOrEmpty(strCurrentOrderDbName) == true) - continue; - - if (String.IsNullOrEmpty(strCurrentIssueDbName) == true) - continue; - - dbnames.Add(strCurrentOrderDbName); - } - - if (dbnames.Count == 0) - { - strError = "没有发现任何期刊订购库"; - goto ERROR1; - } - } - else if (strOrderDbName == "<全部图书>" - || strOrderDbName.ToLower() == "") - { - for (int i = 0; i < app.ItemDbs.Count; i++) - { - string strCurrentOrderDbName = app.ItemDbs[i].OrderDbName; - string strCurrentIssueDbName = app.ItemDbs[i].IssueDbName; - - if (String.IsNullOrEmpty(strCurrentOrderDbName) == true) - continue; - - // 大书目库中必须不包含期库,说明才是图书用途 - if (String.IsNullOrEmpty(strCurrentIssueDbName) == false) - continue; - - dbnames.Add(strCurrentOrderDbName); - } - - if (dbnames.Count == 0) - { - strError = "没有发现任何图书订购库"; - goto ERROR1; - } - } - else - { - string[] splitted = strOrderDbName.Split(new char[] { ',' }); - for (int i = 0; i < splitted.Length; i++) - { - string strDbName = splitted[i]; - if (String.IsNullOrEmpty(strDbName) == true) - continue; - - if (app.IsOrderDbName(strDbName) == false) - { - strError = "库名 '" + strDbName + "' 不是合法的订购库名"; - goto ERROR1; - } - - dbnames.Add(strDbName); - } - - } - - bool bDesc = StringUtil.IsInList("desc", strSearchStyle); - - // 构造检索式 - string strQueryXml = ""; - for (int i = 0; i < dbnames.Count; i++) - { - string strDbName = dbnames[i]; - - Debug.Assert(String.IsNullOrEmpty(strDbName) == false, ""); - - string strRelation = "="; - string strDataType = "string"; - - if (strFrom == "__id") - { - // 如果为范围式 - if (String.IsNullOrEmpty(strQueryWord) == false // 2013/3/25 - && strQueryWord.IndexOf("-") != -1) - { - strRelation = "range"; - strDataType = "number"; - } - else if (String.IsNullOrEmpty(strQueryWord) == false) - { - strDataType = "number"; - - // 2012/8/20 - strMatchStyle = "exact"; - } - } - else if (strFrom == "订购时间") - { - // 如果为范围式 - if (strQueryWord.IndexOf("~") != -1) - { - strRelation = "range"; - strDataType = "number"; - } - else - { - strDataType = "number"; - - // 如果检索词为空,并且匹配方式为前方一致、中间一致、后方一致,那么认为这是意图要命中全部记录 - // 注意:如果检索词为空,并且匹配方式为精确一致,则需要认为是获取空值,也就是不存在对应检索点的记录 - if (strMatchStyle != "exact" && string.IsNullOrEmpty(strQueryWord) == true) - { - strMatchStyle = "exact"; - strRelation = "range"; - strQueryWord = "~"; - } - } - // 最后统一修改为exact。不能在一开始修改,因为strMatchStyle值还有帮助判断的作用 - strMatchStyle = "exact"; - } - - string strOneDbQuery = "" - + (bDesc == true ? "DESC" : "") - + "" - + StringUtil.GetXmlStringSimple(strQueryWord) - + "" + strMatchStyle + ""+strRelation+""+strDataType+"" + nPerMax.ToString() + "" + strLang + ""; - - if (i > 0) - { - Debug.Assert(String.IsNullOrEmpty(strQueryXml) == false, ""); - strQueryXml += ""; - } - - strQueryXml += strOneDbQuery; - } - - if (dbnames.Count > 0) - { - strQueryXml = "" + strQueryXml + ""; - } - - RmsChannel channel = sessioninfo.Channels.GetChannel(app.WsUrl); - if (channel == null) - { - strError = "get channel error"; - goto ERROR1; - } - - BeginSearch(); - channel.Idle += new IdleEventHandler(channel_IdleEvent); - try - { - WriteDebugInfo("begin search " + strQueryXml); - long lRet = channel.DoSearch(strQueryXml, - strResultSetName, - strOutputStyle, - out strError); - WriteDebugInfo("end search lRet=" + lRet.ToString() + " " + strQueryXml); - if (lRet == -1) - { - goto ERROR1; - } - - if (lRet == 0) - { - result.Value = 0; - result.ErrorInfo = "not found"; - return result; - } - - result.Value = lRet; - result.ErrorInfo = ""; - } - finally - { - channel.Idle -= new IdleEventHandler(channel_IdleEvent); - EndSearch(); - } - - return result; - - ERROR1: - result.Value = -1; - result.ErrorInfo = strError; - result.ErrorCode = ErrorCode.SystemError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library SearchOrder() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 设置流通时钟 - // parameters: - // strTime RFC1123时间格式。如果为空,表示还原为服务器机器时钟 - // 权限:作为工作人员,应当有setclock权限。读者不能设置时钟。 - public LibraryServerResult SetClock(string strTime) - { - LibraryServerResult result = this.PrepareEnvironment(true, true, true); - if (result.Value == -1) - return result; - - try - { - // 权限判断 - - if (sessioninfo.GlobalUser == false) - { - result.Value = -1; - result.ErrorInfo = "设置时钟被拒绝。全局用户才能进行此操作。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - // 权限字符串 - if (StringUtil.IsInList("setclock", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "设置时钟被拒绝。不具备setclock权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - // 对读者身份的附加判断 - if (sessioninfo.UserType == "reader") - { - result.Value = -1; - result.ErrorInfo = "设置时钟被拒绝。作为读者不能设置时钟。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - string strError = ""; - int nRet = app.Clock.SetClock(strTime, out strError); - if (nRet == -1) - { - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strError; - return result; - } - - app.Changed = true; - - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library SetClock() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 获得流通时钟 - // parameters: - // strTime 返回的时间为RFC1123时间格式。 - // 权限:暂时不需要任何权限 - public LibraryServerResult GetClock(out string strTime) - { - strTime = ""; - - LibraryServerResult result = this.PrepareEnvironment(false); - if (result.Value == -1) - return result; - - // 不需要登录? - strTime = app.Clock.GetClock(); - - return result; - } - - // 读者找回密码 - // parameters: - // strParameters 参数列表。 - // tel=?????,barcode=?????,name=????? - // email=?????,barcode=??????,name=?????? - // strMessageTempate 消息文字模板。其中可以使用 %name% %barcode% %temppassword% %expiretime% %period% 等宏 - public LibraryServerResult ResetPassword(string strParameters, - string strMessageTemplate) - { - LibraryServerResult result = this.PrepareEnvironment(false); - if (result.Value == -1) - return result; - - string strError = ""; - // 不需要登录 - // return: - // -1 出错 - // 0 因为条件不具备功能没有成功执行 - // 1 功能成功执行 - int nRet = app.ResetPassword( - sessioninfo.LibraryCodeList, - strParameters, - strMessageTemplate, - out strError); - result.Value = nRet; - result.ErrorInfo = strError; - return result; - } - - // 获得值列表 - // parameters: - // values 返回值列表。 - // 权限:暂时不需要任何权限 - public LibraryServerResult GetValueTable( - string strTableName, - string strDbName, - out string[] values) - { - values = null; - - LibraryServerResult result = this.PrepareEnvironment(true, true); // false - if (result.Value == -1) - return result; - try - { - values = app.GetValueTable( - sessioninfo.LibraryCodeList, - strTableName, - strDbName); - - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library GetValueTable() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 成批获得日志记录 - // parameters: - // nCount 本次希望获取的记录数。如果==-1,表示希望尽可能多地获取 - // return: - // result.Value - // -1 error - // 0 file not found - // 1 succeed - // 2 超过范围,本次调用无效 - public LibraryServerResult GetOperLogs( - string strFileName, - long lIndex, - long lHint, - int nCount, - string strStyle, - string strFilter, - out OperLogInfo[] records) - { - records = null; - - string strError = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限判断 - - // 权限字符串 - if (sessioninfo.RightsOriginList.IsInList("getoperlog") == false) - { - result.Value = -1; - result.ErrorInfo = "获得日志记录被拒绝。不具备getoperlog权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - // return: - // -1 error - // 0 file not found - // 1 succeed - // 2 超过范围 - int nRet = app.OperLog.GetOperLogs( - sessioninfo.LibraryCodeList, - strFileName, - lIndex, - lHint, - nCount, - strStyle, - strFilter, - out records, - out strError); - if (nRet == -1) - goto ERROR1; - - result.Value = nRet; - result.ErrorInfo = strError; - return result; - ERROR1: - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library GetOperLogs() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - - } - - // 获得日志记录 - // parameters: - // strFileName 纯文件名,不含路径部分。但要包括".log"部分。 - // lIndex 记录序号。从0开始计数。lIndex为-1时调用本函数,表示希望获得整个文件尺寸值,将返回在lHintNext中。 - // lHint 记录位置暗示性参数。这是一个只有服务器才能明白含义的值,对于前端来说是不透明的。 - // 目前的含义是记录起始位置。 - // 权限:需要getoperlog权限 - // return: - // result.Value - // -1 error - // 0 file not found - // 1 succeed - // 2 超过范围 - public LibraryServerResult GetOperLog( - string strFileName, - long lIndex, - long lHint, - string strStyle, - string strFilter, - out string strXml, - out long lHintNext, - long lAttachmentFragmentStart, - int nAttachmentFragmentLength, - out byte[] attachment_data, - out long lAttachmentTotalLength) - { - strXml = ""; - lHintNext = -1; - attachment_data = null; - lAttachmentTotalLength = 0; - - string strError = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限判断 - - // 权限字符串 - if (sessioninfo.RightsOriginList.IsInList("getoperlog") == false) - { - result.Value = -1; - result.ErrorInfo = "获得日志记录被拒绝。不具备getoperlog权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - // return: - // -1 error - // 0 file not found - // 1 succeed - // 2 超过范围 - int nRet = app.OperLog.GetOperLog( - sessioninfo.LibraryCodeList, - strFileName, - lIndex, - lHint, - strStyle, - strFilter, - out lHintNext, - out strXml, - out lAttachmentTotalLength, - out strError); - if (nRet == -1) - goto ERROR1; - - result.Value = nRet; - result.ErrorInfo = strError; - - if (nRet == 1 && lAttachmentTotalLength > 0 && nAttachmentFragmentLength > 0) - { - // 读出attachment片断 - // attachment.Seek(0, SeekOrigin.Begin); // 不必要了 - - if (lAttachmentFragmentStart > lAttachmentTotalLength) - { - strError = "lAttachmentFragmentStart参数的值超过附件的尺寸"; - goto ERROR1; - } - - long lTemp = 0; - // return: - // -1 error - // 0 file not found - // 1 succeed - // 2 超过范围 - nRet = app.OperLog.GetOperLogAttachment( - sessioninfo.LibraryCodeList, - strFileName, - lIndex, - lHint, - lAttachmentFragmentStart, - nAttachmentFragmentLength, - out attachment_data, - out lTemp, - out strError); - if (nRet == -1) - goto ERROR1; - } - - return result; - ERROR1: - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library GetOperLog() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 获得日历 - // return: - // result.Value -1 错误; 其他 返回总结果数量 - public LibraryServerResult GetCalendar( - string strAction, - string strName, - int nStart, - int nCount, - out CalenderInfo[] contents) - { - contents = null; - - string strError = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限判断 - - // 权限字符串 - if (StringUtil.IsInList("getcalendar", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "获得日历操作被拒绝。不具备getcalendar权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - List result_contents = null; - int nRet = app.GetCalendar(strAction, - sessioninfo.LibraryCodeList, - strName, - nStart, - nCount, - out result_contents, - out strError); - if (nRet == -1) - goto ERROR1; - - if (result_contents != null) - { - contents = new CalenderInfo[result_contents.Count]; - result_contents.CopyTo(contents); - } - - result.Value = nRet; - return result; - ERROR1: - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library GetCalendar() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 修改日历 - // return: - // result.Value -1 错误 - public LibraryServerResult SetCalendar( - string strAction, - CalenderInfo info) - { - string strError = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true, true); - if (result.Value == -1) - return result; - - try - { - // 权限判断 - - // 权限字符串 - if (strAction == "new") - { - if (StringUtil.IsInList("newcalendar", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "创建新日历的操作被拒绝。不具备newcalendar权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - } - if (strAction == "delete") - { - if (StringUtil.IsInList("deletecalendar", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "删除日历的操作被拒绝。不具备deletecalendar权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - } - if (strAction == "change") - { - if (StringUtil.IsInList("changecalendar", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "修改日历的操作被拒绝。不具备changecalendar权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - } - if (strAction == "overwrite") - { - if (StringUtil.IsInList("changecalendar", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "覆盖日历的操作被拒绝。不具备changecalendar权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - if (StringUtil.IsInList("newcalendar", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "覆盖日历的操作被拒绝。不具备newcalendar权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - } - - int nRet = app.SetCalendar(strAction, - sessioninfo.LibraryCodeList, - info, - out strError); - if (nRet == -1) - goto ERROR1; - - // 2013/12/25 - // 促使立即写入 library.xml - if (app.Changed == true) - app.ActivateManagerThread(); - - result.Value = nRet; - return result; - ERROR1: - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library SetCalendar() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 操作一个批处理任务 - public LibraryServerResult BatchTask( - string strName, - string strAction, - BatchTaskInfo info, - out BatchTaskInfo resultInfo) - { - string strError = ""; - resultInfo = null; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限判断 - if (sessioninfo.GlobalUser == false) - { - result.Value = -1; - result.ErrorInfo = "操作批处理任务 被拒绝。只有全局用户才能进行这样的操作"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - if (StringUtil.IsInList("batchtask", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "操作批处理任务 被拒绝。不具备batchtask权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - int nRet = 0; - - if (strAction == "start") - { - nRet = app.StartBatchTask(strName, - info, - out resultInfo, - out strError); - } - else if (strAction == "stop") - { - nRet = app.StopBatchTask(strName, - info, - out resultInfo, - out strError); - } - else if (strAction == "continue") - { - nRet = app.StartBatchTask("!continue", - null, - out resultInfo, - out strError); - } - else if (strAction == "pause") - { - nRet = app.StopBatchTask("!pause", - null, - out resultInfo, - out strError); - } - else if (strAction == "getinfo") - { - nRet = app.GetBatchTaskInfo(strName, - info, - out resultInfo, - out strError); - } - else - { - strError = "不能识别的strAction参数 '" + strAction + "'"; - goto ERROR1; - } - - if (nRet == -1) - goto ERROR1; - - result.Value = nRet; - return result; - ERROR1: - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library BatchTask() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 清除所有数据库内数据 - // return: - // result.Value -1 错误 - public LibraryServerResult ClearAllDbs() - { - string strError = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true, true); - if (result.Value == -1) - return result; - - try - { - // 权限判断 - if (StringUtil.IsInList("clearalldbs", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "清除所有数据库内数据的操作被拒绝。不具备clearalldbs权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - int nRet = app.ClearAllDbs(sessioninfo.Channels, - out strError); - if (nRet == -1) - goto ERROR1; - - result.Value = nRet; - return result; - ERROR1: - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library ClearAllDbs() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - - // 管理数据库 - // parameters: - // strAction 动作。create delete initialize backup getinfo - // return: - // result.Value -1 错误 - public LibraryServerResult ManageDatabase(string strAction, - string strDatabaseName, - string strDatabaseInfo, - out string strOutputInfo) - { - string strError = ""; - strOutputInfo = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true, true); - if (result.Value == -1) - return result; - - try - { - // getinfo 动作 权限单独判断 2013/1/27 - if (strAction == "getinfo") - { - if (StringUtil.IsInList("managedatabase", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("getsystemparameter", sessioninfo.RightsOrigin) == false - && StringUtil.IsInList("order", sessioninfo.RightsOrigin) == false) // 2013/10/13 - { - result.Value = -1; - result.ErrorInfo = "管理数据库的操作 '" + strAction + "' 被拒绝。不具备 getsystemparameter 或 order 或 managedatabase 权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - } - else - { - // 权限判断 - if (StringUtil.IsInList("managedatabase", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "管理数据库的操作 '" + strAction + "' 被拒绝。不具备managedatabase权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - } - - int nRet = app.ManageDatabase(sessioninfo.Channels, - sessioninfo.LibraryCodeList, - strAction, - strDatabaseName, - strDatabaseInfo, - out strOutputInfo, - out strError); - if (nRet == -1) - goto ERROR1; - - result.Value = nRet; - return result; - ERROR1: - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library ManageDatabase() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 获得用户 - // return: - // result.Value -1 错误; 其他 返回总结果数量 - public LibraryServerResult GetUser( - string strAction, - string strName, - int nStart, - int nCount, - out UserInfo[] contents) - { - contents = null; - - string strError = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限判断 - - // 权限字符串 - if (StringUtil.IsInList("getuser", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "获得用户操作被拒绝。不具备getuser权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - int nRet = app.ListUsers( - sessioninfo.LibraryCodeList, - strName, - nStart, - nCount, - out contents, - out strError); - if (nRet == -1) - goto ERROR1; - - /* - if (result_contents != null) - { - contents = new UserInfo[result_contents.Count]; - result_contents.CopyTo(contents); - }*/ - - result.Value = nRet; - return result; - ERROR1: - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library GetUser() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 修改用户 - // parameters: - // strAction new delete change resetpassword - // 当action为"change"时,如果要在修改其他信息的同时修改密码,info.SetPassword必须为true; - // 而当action为"resetpassword"时,则info.ResetPassword状态不起作用,无论怎样都要修改密码。resetpassword并不修改其他信息,也就是说info中除了Password/UserName以外其他成员的值无效。 - // return: - // result.Value -1 错误 - public LibraryServerResult SetUser( - string strAction, - UserInfo info) - { - string strError = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true, true); - if (result.Value == -1) - return result; - - try - { - // 权限判断 - - // 权限字符串 - if (strAction == "new") - { - if (StringUtil.IsInList("newuser", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "创建新用户的操作被拒绝。不具备newuser权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - } - if (strAction == "delete") - { - if (StringUtil.IsInList("deleteuser", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "删除用户的操作被拒绝。不具备deleteuser权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - } - if (strAction == "change") - { - if (StringUtil.IsInList("changeuser", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "修改用户的操作被拒绝。不具备changeuser权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - if (info.SetPassword == true) - { - // 这是指强制修改他人的密码的操作。这是一个系统管理员才能进行的高级操作。 - if (StringUtil.IsInList("changeuserpassword", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "强制修改(其他)用户密码的操作被拒绝。不具备changeuserpassword权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - } - } - - if (strAction == "resetpassword") - { - // 这是指强制修改他人的密码的操作。这是一个系统管理员才能进行的高级操作。 - if (StringUtil.IsInList("changeuserpassword", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "修改用户密码的操作被拒绝。不具备changeuserpassword权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - } - - int nRet = app.SetUser( - sessioninfo.LibraryCodeList, - strAction, - sessioninfo.UserID, - info, - sessioninfo.ClientAddress, - out strError); - if (nRet == -1) - goto ERROR1; - - // 2013/3/6 - // 促使立即写入 library.xml - if (app.Changed == true) - app.ActivateManagerThread(); - - result.Value = nRet; - return result; - ERROR1: - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library SetUser() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 获得通道信息 - // return: - // result.Value -1 错误; 其他 返回总结果数量 - public LibraryServerResult GetChannelInfo( - string strQuery, - string strStyle, - int nStart, - int nCount, - out ChannelInfo[] contents) - { - contents = null; - - string strError = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限判断 - - // 权限字符串 - if (StringUtil.IsInList("getchannelinfo", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "获得通道信息被拒绝。不具备 getchannelinfo 权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - int nRet = app.ListChannels( - strQuery, - strStyle, - nStart, - nCount, - out contents, - out strError); - if (nRet == -1) - goto ERROR1; - - result.Value = nRet; - return result; - ERROR1: - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library GetChannelInfo() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 管理通道 - // return: - // result.Value -1 错误; 其他 返回总结果数量 - public LibraryServerResult ManageChannel( - string strAction, - string strStyle, - ChannelInfo[] requests, - out ChannelInfo[] results) - { - results = null; - - string strError = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true); - if (result.Value == -1) - return result; - - try - { - // 权限判断 - - // 权限字符串 - if (StringUtil.IsInList("managechannel", sessioninfo.RightsOrigin) == false) - { - result.Value = -1; - result.ErrorInfo = "获得用户操作被拒绝。不具备 managechannel 权限。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - int nRet = app.ManageChannel( - strAction, - strStyle, - requests, - out results, - out strError); - if (nRet == -1) - goto ERROR1; - - result.Value = nRet; - return result; - ERROR1: - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library ManageChannel() API 出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 修改用户自己的密码 - // 只能用本API修改自己的密码。如果要强制修改别人的密码,请使用SetUser() API - // return: - // result.Value -1 错误 - public LibraryServerResult ChangeUserPassword( - string strUserName, - string strOldPassword, - string strNewPassword) - { - string strError = ""; - - LibraryServerResult result = this.PrepareEnvironment(true, true, true); - if (result.Value == -1) - return result; - - try - { - // 权限判断 - - // 只能自己修改自己的密码 - if (sessioninfo.UserID != strUserName) - { - result.Value = -1; - result.ErrorInfo = "当前登录用户 " + sessioninfo.UserID + " 只能修改自己的密码,不能修改别人(" + strUserName + ")的密码。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - if (StringUtil.IsInList("denychangemypassword", sessioninfo.RightsOrigin) == true) - { - result.Value = -1; - result.ErrorInfo = "当前登录用户 " + sessioninfo.UserID + " 因被设定了 denychangemypassword 权限,不能修改自己的密码。"; - result.ErrorCode = ErrorCode.AccessDenied; - return result; - } - - - int nRet = app.ChangeUserPassword( - sessioninfo.LibraryCodeList, - strUserName, - strOldPassword, - strNewPassword, - out strError); - if (nRet == -1) - goto ERROR1; - - result.Value = nRet; - return result; - ERROR1: - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strError; - return result; - } - catch (Exception ex) - { - string strErrorText = "dp2Library ChangeUserPassword() API出现异常: " + ExceptionUtil.GetDebugText(ex); - app.WriteErrorLog(strErrorText); - - result.Value = -1; - result.ErrorCode = ErrorCode.SystemError; - result.ErrorInfo = strErrorText; - return result; - } - } - - // 校验条码号 - // parameters: - // strBarcode 条码号 - // return: - // result.Value 0: 不是合法的条码号 1:合法的读者证条码号 2:合法的册条码号 - // 权限:暂时不需要任何权限 - public LibraryServerResult VerifyBarcode(string strBarcode) - { - LibraryServerResult result = this.PrepareEnvironment(false); - if (result.Value == -1) - return result; - - // 不需要登录 - try - { - // string strResultString = ""; - int nResultValue = -1; - string strError = ""; - - if (StringUtil.HasHead(strBarcode, "PQR:") == true) - { - result.ErrorInfo = "这是读者证号二维码"; - result.Value = 1; - return result; - } - - if (app.m_assemblyLibraryHost == null) - { - result.Value = -1; - result.ErrorInfo = "没有配置" + "" - + ""; + + ""; string strStyle = @""; diff --git a/dp2Circulation/MainForm/InitialExtension.cs b/dp2Circulation/MainForm/InitialExtension.cs index e879e99c6..6ca840ff6 100644 --- a/dp2Circulation/MainForm/InitialExtension.cs +++ b/dp2Circulation/MainForm/InitialExtension.cs @@ -1791,7 +1791,7 @@ bool CopyDefaultCfgFiles(out string strError) filenames.Add("objectrights.xml"); filenames.Add("inventory_item_browse.xml"); filenames.Add("inventory.css"); - filenames.Add("charginghistory.css"); + // filenames.Add("charginghistory.css"); filenames.Add("nonephoto.png"); #if NO filenames.Add("comment_change_actions.xml"); diff --git a/dp2Circulation/Reader/ReaderInfoForm.cs b/dp2Circulation/Reader/ReaderInfoForm.cs index 9150b7342..b9dc89581 100644 --- a/dp2Circulation/Reader/ReaderInfoForm.cs +++ b/dp2Circulation/Reader/ReaderInfoForm.cs @@ -5845,10 +5845,11 @@ void FillBorrowHistoryPage(List items, string strBinDir = Environment.CurrentDirectory; string strCssUrl = Path.Combine(this.MainForm.DataDir, "default\\charginghistory.css"); + string strSummaryJs = Path.Combine(this.MainForm.DataDir, "getsummary.js"); string strLink = ""; string strScriptHead = "" + "" - + ""; + + ""; string strStyle = @""; text.Append("" diff --git a/dp2Circulation/SearchForms/BiblioSearchForm.cs b/dp2Circulation/SearchForms/BiblioSearchForm.cs index 2ff49a63e..81c73b5b9 100644 --- a/dp2Circulation/SearchForms/BiblioSearchForm.cs +++ b/dp2Circulation/SearchForms/BiblioSearchForm.cs @@ -8110,8 +8110,6 @@ public ListViewItem MoveSelectedItem(string strStyle) if (this.listView_records.SelectedItems.Count > 1) ListViewUtil.SelectLine(item, true); - string strError = ""; - List indices = null; bool bRet = ListViewUtil.MoveSelectedUpDown( this.listView_records, strStyle == "prev" ? true : false); diff --git a/dp2Circulation/Statis/ReportApplyForm.cs b/dp2Circulation/Statis/ReportApplyForm.cs index f235a812f..17ffc1be0 100644 --- a/dp2Circulation/Statis/ReportApplyForm.cs +++ b/dp2Circulation/Statis/ReportApplyForm.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -7,10 +8,10 @@ using System.Text; using System.Windows.Forms; using System.IO; + using DigitalPlatform.CommonControl; using DigitalPlatform.IO; using DigitalPlatform.Text; -using System.Collections; namespace dp2Circulation { @@ -86,15 +87,14 @@ private void button_OK_Click(object sender, EventArgs e) goto ERROR1; } - if (strNumber == "102" + if ((strNumber == "102" || strNumber == "9102") && string.IsNullOrEmpty(this.textBox_nameTable_strings.Text) == true) { this.tabControl_main.SelectedTab = this.tabPage_nameTable; - strError = "类型为 102 报表必须配置名字列表内容"; + strError = "类型为 "+strNumber+" 的报表必须配置名字列表内容"; goto ERROR1; } - this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); return; @@ -318,7 +318,7 @@ private void button_nameTable_importStrings_Click(object sender, EventArgs e) string strNumber = this.GetTypeNumber(); - if (strNumber == "102") + if (strNumber == "102" || strNumber == "9102") { List results = null; // 获得一个分馆内读者记录的所有单位名称 @@ -331,8 +331,8 @@ private void button_nameTable_importStrings_Click(object sender, EventArgs e) this.textBox_nameTable_strings.Text = StringUtil.MakePathList(results, "\r\n"); } - else if (strNumber == "212" - || strNumber == "213" + else if (strNumber == "212" || strNumber == "9212" + || strNumber == "213" || strNumber == "9213" || strNumber == "301" || strNumber == "302" || strNumber == "493") @@ -347,7 +347,6 @@ private void button_nameTable_importStrings_Click(object sender, EventArgs e) this.textBox_nameTable_strings.Text = StringUtil.MakePathList(results, "\r\n"); } - return; ERROR1: MessageBox.Show(this, strError); @@ -422,8 +421,8 @@ private void comboBox_reportType_TextChanged(object sender, EventArgs e) { // string strNumber = this.GetTypeNumber(); - if (strNumber == "212" - || strNumber == "213" + if (strNumber == "212" || strNumber == "9212" + || strNumber == "213" || strNumber == "9213" || strNumber == "301" || strNumber == "302" || strNumber == "493" @@ -433,7 +432,7 @@ private void comboBox_reportType_TextChanged(object sender, EventArgs e) this.textBox_nameTable_strings.Enabled = true; this.button_nameTable_importStrings.Enabled = true; } - else if (strNumber == "102") + else if (strNumber == "102" || strNumber == "9102") { this.label_nameTable_strings.Text = "部门名称列表 [每行一个名称]"; this.textBox_nameTable_strings.Enabled = true; @@ -510,7 +509,7 @@ void AutoFillReportName() static string GetNumberPrefix(string strText) { StringBuilder result = new StringBuilder(); - foreach(char ch in strText) + foreach (char ch in strText) { if (char.IsDigit(ch) == false) return result.ToString(); @@ -533,8 +532,8 @@ void FillReportTypeList() DirectoryInfo di = new DirectoryInfo(strCfgDir); List array = new List(); - array.AddRange( di.GetFiles("???.xml")); - array.AddRange( di.GetFiles("????.xml")); + array.AddRange(di.GetFiles("???.xml")); + array.AddRange(di.GetFiles("????.xml")); FileInfo[] fis = array.ToArray(); Array.Sort(fis, new FileInfoCompare()); diff --git a/dp2Circulation/Statis/ReportForm.cs b/dp2Circulation/Statis/ReportForm.cs index 0d46b2636..b23527d06 100644 --- a/dp2Circulation/Statis/ReportForm.cs +++ b/dp2Circulation/Statis/ReportForm.cs @@ -2543,11 +2543,18 @@ int Create_102_report(string strLibraryCode, Hashtable macro_table, string strNameTable, string strOutputFileName, + string strReportType, out string strError) { strError = ""; int nRet = 0; + if (strReportType != "102" && strReportType != "9102") + { + strError = "Create_102_report() 的 strReportType 参数值必须为 102/9102 之一"; + return -1; + } + List departments = StringUtil.SplitList(strNameTable); if (departments.Count == 0) return 0; @@ -2582,7 +2589,7 @@ int Create_102_report(string strLibraryCode, nRet = CreateReaderReportCommand( strLibraryCode, strDateRange, - "102", + strReportType, // "102", department, out strCommand, out strError); @@ -2680,6 +2687,7 @@ int Create_131_report(string strLibraryCode, Hashtable macro_table, // string strNameTable, string strOutputDir, + string strReportType, out string strError) { strError = ""; @@ -2798,7 +2806,7 @@ int Create_131_report(string strLibraryCode, nRet = CreateReaderReportCommand( strLibraryCode, strDateRange, - "131", + strReportType, // "131", strReaderBarcode, out strCommand, out strError); @@ -2811,7 +2819,7 @@ int Create_131_report(string strLibraryCode, writer, strOutputFileName, macro_table, - "创建 131 表时", + "创建 "+strReportType+" 表时", out strError); if (nRet == -1) return -1; @@ -2841,6 +2849,7 @@ int Create_131_report(string strLibraryCode, strReaderBarcode, strOutputDir, strOutputFileName, + strReportType, out strError); if (nRet == -1) return -1; @@ -2972,6 +2981,7 @@ int Create_201_report(string strLibraryCode, string strCfgFile, Hashtable macro_table, string strOutputFileName, + string strReportType, out string strError) { strError = ""; @@ -2992,7 +3002,7 @@ int Create_201_report(string strLibraryCode, nRet = CreateBookReportCommand( strLibraryCode, strDateRange, - "201", + strReportType, // "201", "", null, out strCommand, @@ -3006,7 +3016,7 @@ int Create_201_report(string strLibraryCode, writer, strOutputFileName, macro_table, - "创建 201 表时", + "创建 "+strReportType+" 表时", out strError); } @@ -3019,6 +3029,7 @@ int Create_202_report(string strLibraryCode, string strCfgFile, Hashtable macro_table, string strOutputFileName, + string strReportType, out string strError) { strError = ""; @@ -3039,7 +3050,7 @@ int Create_202_report(string strLibraryCode, nRet = CreateBookReportCommand( strLibraryCode, strDateRange, - "202", + strReportType, // "202", "", null, out strCommand, @@ -3053,7 +3064,7 @@ int Create_202_report(string strLibraryCode, writer, strOutputFileName, macro_table, - "创建 202 表时", + "创建 "+strReportType+" 表时", out strError); } @@ -3941,11 +3952,11 @@ int RunQuery( // 创建读者报表,关于流通业务 // 1) 按照读者自然单位分类的借书册数表 101 9101 - // 2) 按照指定的单位分类的借书册数表 102 - // 3) 按照读者类型分类的借书册数表 111 - // 4) 按照读者姓名分类的借书册数表 121 - // 5) 没有借书的读者 122 - // 6) 每个读者的借阅清单 131 + // 2) 按照指定的单位分类的借书册数表 102 9102 + // 3) 按照读者类型分类的借书册数表 111 9111 + // 4) 按照读者姓名分类的借书册数表 121 9121 + // 5) 没有借书的读者 122 9122 + // 6) 每个读者的借阅清单 131 9131 int CreateReaderReportCommand( string strLibraryCode, string strDateRange, @@ -4032,6 +4043,18 @@ int CreateReaderReportCommand( + " ORDER BY borrow DESC, department;"; } + else if (StringUtil.IsInList("9102", strStyle) == true) + { + // 9102 表 按照 *指定的单位* 分类的阅读册数表 + // 这里每次只能获得一个单位的一行数据。需要按照不同单位 (strParameters) 多次循环调用本函数 + strCommand = "select '" + strParameters + "' as department, " + + " count(*) as count1 " + + " FROM operlogcircu JOIN reader ON operlogcircu.readerbarcode <> '' AND operlogcircu.readerbarcode = reader.readerbarcode " + + " WHERE operlogcircu.date >= '" + strStartDate + "' AND operlogcircu.date <= '" + strEndDate + "' " + + " AND operlogcircu.operation = 'return' AND operlogcircu.action = 'read' " + + " AND reader.librarycode = '" + strLibraryCode + "' AND reader.department like '" + strParameters + "' " + + " ORDER BY count1 DESC, department;"; + } else if (StringUtil.IsInList("111", strStyle) == true) { // 111 表 按照读者 *自然类型* 分类的借书册数表 @@ -4052,6 +4075,18 @@ int CreateReaderReportCommand( + " AND reader.librarycode = '" + strLibraryCode + "' " + " GROUP BY reader.readertype ORDER BY borrow DESC, reader.readertype;"; + } + else if (StringUtil.IsInList("9111", strStyle) == true) + { + // 9111 表 按照读者 *自然类型* 分类的阅读册数表 + strCommand = "select reader.readertype, " + + " count(*) as count1 " + + " FROM operlogcircu JOIN reader ON operlogcircu.readerbarcode <> '' AND operlogcircu.readerbarcode = reader.readerbarcode " + + " WHERE operlogcircu.date >= '" + strStartDate + "' AND operlogcircu.date <= '" + strEndDate + "' " + + " AND operlogcircu.operation = 'return' AND operlogcircu.action = 'read' " + + " AND reader.librarycode = '" + strLibraryCode + "' " + + " GROUP BY reader.readertype ORDER BY count1 DESC, reader.readertype;"; + } else if (StringUtil.IsInList("121", strStyle) == true) { @@ -4074,6 +4109,17 @@ int CreateReaderReportCommand( + " GROUP BY operlogcircu.readerbarcode ORDER BY borrow DESC, reader.department, operlogcircu.readerbarcode ;"; } + else if (StringUtil.IsInList("9121", strStyle) == true) + { + // 9121 表 按照读者 *姓名* 分类的阅读册数表 + strCommand = "select operlogcircu.readerbarcode, reader.name, reader.department, " + + " count(*) as count1 " + + " FROM operlogcircu JOIN reader ON operlogcircu.readerbarcode <> '' AND operlogcircu.readerbarcode = reader.readerbarcode " + + " WHERE operlogcircu.date >= '" + strStartDate + "' AND operlogcircu.date <= '" + strEndDate + "' " + + " AND operlogcircu.operation = 'return' AND operlogcircu.action = 'read' " + + " AND reader.librarycode = '" + strLibraryCode + "' " + + " GROUP BY operlogcircu.readerbarcode ORDER BY count1 DESC, reader.department, operlogcircu.readerbarcode ;"; + } else if (StringUtil.IsInList("122", strStyle) == true) { /* @@ -4096,6 +4142,22 @@ int CreateReaderReportCommand( + " ORDER BY department, readerbarcode ;"; // nNumber = 122; } + else if (StringUtil.IsInList("9122", strStyle) == true) + { + // 9122 表 按照读者 *姓名* 没有阅读的读者 + strCommand = + "create temp table tt as select operlogcircu.readerbarcode " + + " FROM operlogcircu JOIN reader ON operlogcircu.readerbarcode <> '' AND operlogcircu.readerbarcode = reader.readerbarcode " + + " WHERE operlogcircu.operation = 'return' and operlogcircu.action = 'read' " + + " AND operlogcircu.date >= '" + strStartDate + "' AND operlogcircu.date <= '" + strEndDate + "' " + + " AND reader.librarycode = '" + strLibraryCode + "';" + + " select readerbarcode, name, department from reader " + + " WHERE (select count(*) from tt) > 0 " + + " AND librarycode = '" + strLibraryCode + "' " + + " AND readerbarcode not in tt " + + " AND state = '' " // 状态值为空的读者才能参与此项统计 + + " ORDER BY department, readerbarcode ;"; + } else if (StringUtil.IsInList("131", strStyle) == true) { // 131 表 每个读者的借阅清单 @@ -4108,6 +4170,17 @@ int CreateReaderReportCommand( + " AND oper1.readerbarcode = '" + strParameters + "' " + " group by oper1.readerbarcode, oper1.itembarcode, oper1.opertime order by oper1.readerbarcode, oper1.opertime ; "; } + else if (StringUtil.IsInList("9131", strStyle) == true) + { + // 9131 表 每个读者的阅读清单 + strCommand = "select oper1.itembarcode, biblio.summary, oper1.opertime as 'readtime' from operlogcircu as oper1 " + + " left JOIN item ON oper1.itembarcode <> '' AND oper1.itembarcode = item.itembarcode " + + " left JOIN biblio ON item.bibliorecpath <> '' AND biblio.bibliorecpath = item.bibliorecpath " + + " where oper1.operation = 'return' and oper1.action = 'read' " + + " AND oper1.date >= '" + strStartDate + "' AND oper1.date <= '" + strEndDate + "' " + + " AND oper1.readerbarcode = '" + strParameters + "' " + + " group by oper1.readerbarcode, oper1.itembarcode, oper1.opertime order by oper1.readerbarcode, oper1.opertime ; "; + } else if (StringUtil.IsInList("141", strStyle) == true) { DateTime now = DateTimeUtil.Long8ToDateTime(strEndDate); @@ -4150,9 +4223,9 @@ static double GetDouble(SQLiteDataReader dr, int index) } // 创建图书报表,关于流通业务 - // 1) 201 按照图书种分类的借书册数表 - // 2) 202 从来没有借出的图书 *种* 。册数列表示种下属的册数,不是被借出的册数 - // 4) 212 表 按照图书 *分类* 分类的借书册数表 + // 1) 201 9201 按照图书种分类的借书册数表 + // 2) 202 9202 从来没有借出的图书 *种* 。册数列表示种下属的册数,不是被借出的册数 + // 4) 212 9212 按照图书 *分类* 分类的借书册数表 int CreateBookReportCommand( string strLocation, // "名称/" string strDateRange, @@ -4217,6 +4290,19 @@ int CreateBookReportCommand( + " GROUP BY item.bibliorecpath ORDER BY borrow DESC ;"; } + else if (StringUtil.IsInList("9201", strStyle) == true) + { + // 9201 表 按照图书 *种* 分类的阅读册数表 + strCommand = "select item.bibliorecpath, biblio.summary, " + + " count(*) as count1 " + + " FROM operlogcircu " + + " JOIN item ON operlogcircu.itembarcode <> '' AND operlogcircu.itembarcode = item.itembarcode " + + " JOIN biblio ON item.bibliorecpath <> '' AND biblio.bibliorecpath = item.bibliorecpath " + + " WHERE operlogcircu.date >= '" + strStartDate + "' AND operlogcircu.date <= '" + strEndDate + "' " + + " AND operlogcircu.operation = 'return' AND operlogcircu.action = 'read' " + + " AND " + strLocationLike + + " GROUP BY item.bibliorecpath ORDER BY count1 DESC ;"; + } else if (StringUtil.IsInList("202", strStyle) == true) { // 202 表 从来没有借出的图书 *种* 。册数列表示种下属的册数,不是被借出的册数 @@ -4233,6 +4319,22 @@ int CreateBookReportCommand( + " AND substr(item.createtime,1,10) <= '" + strEndDate.Insert(6, "-").Insert(4, "-") + "' " // 限定册记录创建的时间在 end 以前 + " GROUP BY item.bibliorecpath ORDER BY item.bibliorecpath;"; } + else if (StringUtil.IsInList("9202", strStyle) == true) + { + // 9202 表 从来没有阅读的图书 *种* 。册数列表示种下属的册数,不是被阅读的册数 + strCommand = "select item.bibliorecpath, biblio.summary, count(*) as count " + + " FROM item " + + " JOIN biblio ON item.bibliorecpath <> '' AND biblio.bibliorecpath = item.bibliorecpath " + + " WHERE item.bibliorecpath not in " + + " ( select item.bibliorecpath " + + " FROM operlogcircu JOIN item ON operlogcircu.itembarcode <> '' AND operlogcircu.itembarcode = item.itembarcode " + + " WHERE operlogcircu.operation = 'return' and operlogcircu.action = 'read' " + + " AND operlogcircu.date >= '" + strStartDate + "' AND operlogcircu.date <= '" + strEndDate + "' " + + " AND " + strLocationLike + " ) " + + " AND " + strLocationLike // 限定 item 表里面的记录范围为分馆的册 + + " AND substr(item.createtime,1,10) <= '" + strEndDate.Insert(6, "-").Insert(4, "-") + "' " // 限定册记录创建的时间在 end 以前 + + " GROUP BY item.bibliorecpath ORDER BY item.bibliorecpath;"; + } else if (StringUtil.IsInList("212", strStyle) == true || StringUtil.IsInList("213", strStyle) == true) { @@ -4289,6 +4391,33 @@ int CreateBookReportCommand( + " AND " + strLocationLike + " GROUP BY classhead ORDER BY classhead ;"; } + else if (StringUtil.IsInList("9212", strStyle) == true + || StringUtil.IsInList("9213", strStyle) == true) + { + string strClassTableName = "class_" + strParameters; + + int nRet = PrepareDistinctClassTable( + strClassTableName, + out strError); + if (nRet == -1) + return -1; + + string strDistinctClassTableName = "class_" + strParameters + "_d"; + string strClassColumn = BuildClassColumnFragment(strDistinctClassTableName, + filters, + "other"); + + // 9212 表 按照图书 *分类* 分类的借书册数表 + strCommand = + "select " + strClassColumn + " as classhead, " + + " count(*) as count1 " + + " FROM operlogcircu left outer JOIN item ON operlogcircu.itembarcode <> '' AND operlogcircu.itembarcode = item.itembarcode " + + " left outer JOIN " + strDistinctClassTableName + " ON item.bibliorecpath <> '' AND " + strDistinctClassTableName + ".bibliorecpath = item.bibliorecpath " + + " WHERE operlogcircu.date >= '" + strStartDate + "' AND operlogcircu.date <= '" + strEndDate + "' " + + " AND operlogcircu.operation = 'return' AND operlogcircu.action = 'read' " + + " AND " + strLocationLike + + " GROUP BY classhead ORDER BY classhead ;"; + } else { strError = "不支持的 strStyle '" + strStyle + "'"; @@ -4850,6 +4979,7 @@ int CreateWorkerReportCommand( + " count(case operlogcircu.action when 'renew' then operlogcircu.action end) as renew, " + " count(case operlogcircu.action when 'return' then operlogcircu.action end) as return, " + " count(case operlogcircu.action when 'lost' then operlogcircu.action end) as lost, " + + " count(case operlogcircu.action when 'read' then operlogcircu.action end) as read, " + " count(*) as total " + " FROM operlogcircu " + " left outer JOIN reader ON operlogcircu.readerbarcode <> '' AND operlogcircu.readerbarcode = reader.readerbarcode " @@ -4867,6 +4997,7 @@ int CreateWorkerReportCommand( + " count(case operlogcircu.action when 'renew' then operlogcircu.action end) as renew, " + " count(case operlogcircu.action when 'return' then operlogcircu.action end) as return, " + " count(case operlogcircu.action when 'lost' then operlogcircu.action end) as lost, " + + " count(case operlogcircu.action when 'read' then operlogcircu.action end) as read, " + " count(*) as total " + " FROM operlogcircu " + " left outer JOIN reader ON operlogcircu.readerbarcode <> '' AND operlogcircu.readerbarcode = reader.readerbarcode " @@ -10934,7 +11065,7 @@ int CreateOneTimeReports( #endif int nAdd = 0; // 0 表示什么也不做。 1表示要加入 -1 表示要删除 - if (strReportType == "102") + if (strReportType == "102" || strReportType == "9102") { // *** 102 // 按照指定的单位名称列表,列出借书册数 @@ -10945,6 +11076,7 @@ int CreateOneTimeReports( macro_table, strNameTable, strOutputFileName, + strReportType, out strError); if (nRet == -1) return -1; @@ -10954,9 +11086,9 @@ int CreateOneTimeReports( nAdd = 1; } else if (strReportType == "101" || strReportType == "9101" - || strReportType == "111" - || strReportType == "121" - || strReportType == "122" + || strReportType == "111" || strReportType == "9111" + || strReportType == "121" || strReportType == "9121" + || strReportType == "122" || strReportType == "9122" || strReportType == "141") { nRet = Create_1XX_report(strLibraryCode, @@ -10973,15 +11105,16 @@ int CreateOneTimeReports( else if (nRet == 1) nAdd = 1; } - else if (strReportType == "131") + else if (strReportType == "131" || strReportType == "9131") { - string str131Dir = Path.Combine(strOutputDir, "table_131"); + string str131Dir = Path.Combine(strOutputDir, "table_" + strReportType); // 这是创建到一个子目录(会在子目录中创建很多文件和下级目录),而不是输出到一个文件 nRet = Create_131_report(strLibraryCode, time.Time, strCfgFile, macro_table, str131Dir, + strReportType, out strError); if (nRet == -1) return -1; @@ -11003,12 +11136,13 @@ int CreateOneTimeReports( } } - else if (strReportType == "201" - || strReportType == "202" - || strReportType == "212" + else if (strReportType == "201" || strReportType == "9201" + || strReportType == "202" || strReportType == "9202" + || strReportType == "212" || strReportType == "9212" || strReportType == "213") // begin of 2xx { - if (strReportType == "212" && class_styles.Count == 0) + if ((strReportType == "212" || strReportType == "9212") + && class_styles.Count == 0) continue; if (strReportType == "213") continue; // 213 表已经被废止,其原有功能被合并到 212 表 @@ -11039,30 +11173,32 @@ int CreateOneTimeReports( if (string.IsNullOrEmpty(strOutputFileName) == true) strOutputFileName = Path.Combine(strOutputDir, Guid.NewGuid().ToString() + ".rml"); - if (strReportType == "201") + if (strReportType == "201" || strReportType == "9201") { nRet = Create_201_report(strLocation, - time.Time, + time.Time, strCfgFile, macro_table, strOutputFileName, + strReportType, out strError); if (nRet == -1) return -1; } - else if (strReportType == "202") + else if (strReportType == "202" || strReportType == "9202") { nRet = Create_202_report(strLocation, - time.Time, + time.Time, strCfgFile, macro_table, strOutputFileName, + strReportType, out strError); if (nRet == -1) return -1; } - else if (strReportType == "212" - || strReportType == "213") + else if (strReportType == "212" || strReportType == "9212" + || strReportType == "213" || strReportType == "9213") { // List names = StringUtil.SplitList(strNameTable); List class_table = null; @@ -11586,7 +11722,7 @@ int WriteIndexXml( // 根据时间类型创建一个 index.xml 中的 item 元素 XmlNode item = null; - if (strReportType == "131") + if (strReportType == "131" || strReportType == "9131") { item = CreateDirNode(index_dom.DocumentElement, strTableName + "-" + strReportType, @@ -11774,7 +11910,7 @@ static XmlElement NewLeafElement( string strReportType) { string strElementName = "report"; - if (strReportType == "131") + if (strReportType == "131" || strReportType == "9131") strElementName = "dir"; XmlNode item = parent.SelectSingleNode(strElementName + "[@name='" + strReportName + "']"); if (item == null) @@ -11949,6 +12085,7 @@ int Write_131_IndexXml( string strPatronBarcode, string strOutputDir, string strReportFileName, + string strReportType, out string strError) { strError = ""; @@ -11983,7 +12120,7 @@ int Write_131_IndexXml( strDepartment, strPersonName + "-" + strPatronBarcode); Debug.Assert(item != null, ""); - DomUtil.SetAttr(item, "type", "131"); + DomUtil.SetAttr(item, "type", strReportType); string strNewFileName = "." + strReportFileName.Substring(strOutputDir.Length); diff --git a/dp2Circulation/dp2Circulation.csproj b/dp2Circulation/dp2Circulation.csproj index 534ac82b6..9d47582c4 100644 --- a/dp2Circulation/dp2Circulation.csproj +++ b/dp2Circulation/dp2Circulation.csproj @@ -51,7 +51,7 @@ dp2 V2 true publish.htm - 11 + 15 2.10.0.%2a false true @@ -2420,6 +2420,30 @@ UrgentChargingForm.cs + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + PreserveNewest @@ -2939,6 +2963,26 @@ True File + + False + + + + + DataFile + True + File + + + False + + + + + DataFile + True + File + False @@ -2949,6 +2993,16 @@ True File + + False + + + + + DataFile + True + File + False diff --git a/dp2Circulation/report_def/442.xml b/dp2Circulation/report_def/442.xml index 0dcd83f17..59f1e6311 100644 --- a/dp2Circulation/report_def/442.xml +++ b/dp2Circulation/report_def/442.xml @@ -8,6 +8,7 @@ + diff --git a/dp2Circulation/report_def/443.xml b/dp2Circulation/report_def/443.xml index 8324d5a21..c8d2f01d9 100644 --- a/dp2Circulation/report_def/443.xml +++ b/dp2Circulation/report_def/443.xml @@ -8,6 +8,7 @@ + diff --git a/dp2Circulation/report_def/9102.xml b/dp2Circulation/report_def/9102.xml new file mode 100644 index 000000000..6dc10a59f --- /dev/null +++ b/dp2Circulation/report_def/9102.xml @@ -0,0 +1,14 @@ + + 阅读排行, 按选定的部门\r%library%\r%daterange% + 按册数排序 + + + + + + + 1:d,0:a + 9102 选定部门的阅读排行 + year,month,day + + \ No newline at end of file diff --git a/dp2Circulation/report_def/9111.xml b/dp2Circulation/report_def/9111.xml new file mode 100644 index 000000000..ec9e79b55 --- /dev/null +++ b/dp2Circulation/report_def/9111.xml @@ -0,0 +1,15 @@ + + 阅读排行, 按读者类型\r%library%\r%daterange% + + + + + + + + + 9111 读者类型的阅读排行 + + year,month,day + + \ No newline at end of file diff --git a/dp2Circulation/report_def/9121.xml b/dp2Circulation/report_def/9121.xml new file mode 100644 index 000000000..6396a7172 --- /dev/null +++ b/dp2Circulation/report_def/9121.xml @@ -0,0 +1,18 @@ + + 阅读排行, 按读者姓名\r%library%\r%daterange% + + + + + + + + + + + 9121 读者姓名的阅读排行 + + + year,month,day + + \ No newline at end of file diff --git a/dp2Circulation/report_def/9122.xml b/dp2Circulation/report_def/9122.xml new file mode 100644 index 000000000..eadee26b9 --- /dev/null +++ b/dp2Circulation/report_def/9122.xml @@ -0,0 +1,17 @@ + + 没有阅读的读者\r%library%\r%daterange% + + + + + + + + + + 9122 没有阅读的读者 + + + year,month + + \ No newline at end of file diff --git a/dp2Circulation/report_def/9131.xml b/dp2Circulation/report_def/9131.xml new file mode 100644 index 000000000..fd2eb1a00 --- /dev/null +++ b/dp2Circulation/report_def/9131.xml @@ -0,0 +1,17 @@ + + 阅读清单\r%name% %readerbarcode% %department%\r%daterange% + + + + + + + + + + 9131 单个读者的阅读清单 + + + month,year + + \ No newline at end of file diff --git a/dp2Circulation/report_def/9201.xml b/dp2Circulation/report_def/9201.xml new file mode 100644 index 000000000..0868900c5 --- /dev/null +++ b/dp2Circulation/report_def/9201.xml @@ -0,0 +1,17 @@ + + 阅读排行, 按图书种,馆藏地\r%location%\r%daterange% + + + + + + + + + + 9201 馆藏地点和图书种的阅读排行 + + + year,month,day + + \ No newline at end of file diff --git a/dp2Circulation/report_def/9202.xml b/dp2Circulation/report_def/9202.xml new file mode 100644 index 000000000..0f98f8301 --- /dev/null +++ b/dp2Circulation/report_def/9202.xml @@ -0,0 +1,17 @@ + + 没有被阅读过的图书, 按图书种,馆藏地\r%location%\r%daterange% + + + + + + + + + + 9202 馆藏地点的没有被阅读的图书种 + + + month + + \ No newline at end of file diff --git a/dp2Circulation/report_def/9212.xml b/dp2Circulation/report_def/9212.xml new file mode 100644 index 000000000..62a654905 --- /dev/null +++ b/dp2Circulation/report_def/9212.xml @@ -0,0 +1,16 @@ + + 阅读排行, 按分类,馆藏地\r%location%\r%class%\r%daterange% + + + + + + + + + 9212 馆藏地点和分类的阅读排行 + + + year,month,day + + \ No newline at end of file diff --git a/dp2Circulation/userrightsdef.xml b/dp2Circulation/userrightsdef.xml index 03c86f86c..ff08d4cfd 100644 --- a/dp2Circulation/userrightsdef.xml +++ b/dp2Circulation/userrightsdef.xml @@ -16,6 +16,10 @@ 丢失 lost + + 读过 + read + 预约 reservation books diff --git a/dp2Installer/Program.cs b/dp2Installer/Program.cs index 59a880146..d58237396 100644 --- a/dp2Installer/Program.cs +++ b/dp2Installer/Program.cs @@ -18,6 +18,11 @@ namespace dp2Installer { static class Program { + /// + /// 前端,也就是 dp2installer.exe 的版本号 + /// + public static string ClientVersion { get; set; } + static bool bExiting = false; static MainForm _mainForm = null; @@ -31,6 +36,8 @@ static class Program [STAThread] static void Main() { + ClientVersion = Assembly.GetAssembly(typeof(Program)).GetName().Version.ToString(); + var wi = WindowsIdentity.GetCurrent(); var wp = new WindowsPrincipal(wi); diff --git a/dp2Installer/dp2Installer.csproj b/dp2Installer/dp2Installer.csproj index 620e96c72..847c9861f 100644 --- a/dp2Installer/dp2Installer.csproj +++ b/dp2Installer/dp2Installer.csproj @@ -34,7 +34,7 @@ dp2 V2 true publish.htm - 75 + 76 1.1.0.%2a false true diff --git a/dp2LibraryXE/dp2LibraryXE.csproj b/dp2LibraryXE/dp2LibraryXE.csproj index 2a44598bd..83417d54f 100644 --- a/dp2LibraryXE/dp2LibraryXE.csproj +++ b/dp2LibraryXE/dp2LibraryXE.csproj @@ -36,7 +36,7 @@ dp2 V2 true publish.htm - 55 + 56 1.1.0.%2a false true From 78a9ffb63de886256702acdd5a6bab83f68d6d97 Mon Sep 17 00:00:00 2001 From: XieTao Date: Mon, 11 Jan 2016 20:10:32 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E5=AE=8C=E5=96=84=E2=80=9C=E8=AF=BB?= =?UTF-8?q?=E8=BF=87=E2=80=9D=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E9=92=88=E5=AF=B9=E4=B9=A6=E7=9B=AE=E8=AE=B0=E5=BD=95=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E2=80=9C=E8=AF=BB=E8=BF=87=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service References/localhost/Reference.cs | 16 ++ .../localhost/metadata5.xsd | 1 + DigitalPlatform.LibraryServer/AppBiblio.cs | 4 +- .../AppCirculation.cs | 210 ++++++++++++------ DigitalPlatform.LibraryServer/AppDatabase.cs | 72 +++++- .../MongoDb/BuildMongoOperDatabase.cs | 22 +- .../MongoDb/ChargingOperDatabase.cs | 103 ++++++--- .../LibraryService.cs | 3 + .../res/ItemControl.cs.en-US.resx | 2 +- ZipUtil.exe | Bin 9216 -> 9216 bytes dp2Circulation/ChangePasswordForm.cs | 2 +- dp2Circulation/Charging/QuickChargingForm.cs | 6 +- .../Charging/SelectItemDialog.Designer.cs | 20 +- dp2Circulation/Charging/SelectItemDialog.cs | 209 ++++++++++++++++- dp2Circulation/Charging/SelectItemDialog.resx | 2 +- dp2Circulation/Charging/SummaryList.cs | 2 +- dp2Circulation/Entity/BookItem.cs | 6 +- dp2Circulation/Entity/BookItemBase.cs | 87 +------- dp2Circulation/Issue/BindingControl.cs | 147 +----------- dp2Circulation/Issue/BindingControlItems.cs | 19 +- .../Issue/CellLineDialog.Designer.cs | 2 +- dp2Circulation/Issue/PrintBindingForm.cs | 10 +- dp2Circulation/Issue/VolumeInfo.cs | 56 ++--- dp2Circulation/MainForm/InitialExtension.cs | 6 +- dp2Circulation/ManageDatabase/ManagerForm.cs | 1 + dp2Circulation/ManageDatabase/PageCenter.cs | 2 +- dp2Circulation/Reader/ReaderInfoForm.cs | 16 +- 27 files changed, 609 insertions(+), 417 deletions(-) diff --git a/DigitalPlatform.LibraryClient/Service References/localhost/Reference.cs b/DigitalPlatform.LibraryClient/Service References/localhost/Reference.cs index 7ddc057e7..f18127631 100644 --- a/DigitalPlatform.LibraryClient/Service References/localhost/Reference.cs +++ b/DigitalPlatform.LibraryClient/Service References/localhost/Reference.cs @@ -1062,6 +1062,9 @@ public partial class ChargingItem : object, System.Runtime.Serialization.IExtens [System.Runtime.Serialization.OptionalFieldAttribute()] private string ActionField; + [System.Runtime.Serialization.OptionalFieldAttribute()] + private string BiblioRecPathField; + [System.Runtime.Serialization.OptionalFieldAttribute()] private string ClientAddressField; @@ -1115,6 +1118,19 @@ public string Action { } } + [System.Runtime.Serialization.DataMemberAttribute()] + public string BiblioRecPath { + get { + return this.BiblioRecPathField; + } + set { + if ((object.ReferenceEquals(this.BiblioRecPathField, value) != true)) { + this.BiblioRecPathField = value; + this.RaisePropertyChanged("BiblioRecPath"); + } + } + } + [System.Runtime.Serialization.DataMemberAttribute()] public string ClientAddress { get { diff --git a/DigitalPlatform.LibraryClient/Service References/localhost/metadata5.xsd b/DigitalPlatform.LibraryClient/Service References/localhost/metadata5.xsd index 625f6303d..5c68b6e9b 100644 --- a/DigitalPlatform.LibraryClient/Service References/localhost/metadata5.xsd +++ b/DigitalPlatform.LibraryClient/Service References/localhost/metadata5.xsd @@ -348,6 +348,7 @@ + diff --git a/DigitalPlatform.LibraryServer/AppBiblio.cs b/DigitalPlatform.LibraryServer/AppBiblio.cs index 710f8413c..afb4e8a30 100644 --- a/DigitalPlatform.LibraryServer/AppBiblio.cs +++ b/DigitalPlatform.LibraryServer/AppBiblio.cs @@ -1404,7 +1404,7 @@ public LibraryServerResult GetBiblioSummary( // 特殊情况,通过种路径 string strHead = "@bibliorecpath:"; if (strItemBarcode.Length > strHead.Length - && strItemBarcode.Substring(0, strHead.Length) == strHead) + && strItemBarcode.Substring(0, strHead.Length).ToLower() == strHead) { strBiblioRecPath = strItemBarcode.Substring(strHead.Length); @@ -1418,7 +1418,7 @@ public LibraryServerResult GetBiblioSummary( goto LOADBIBLIO; } - // 如果 strComfirmItemRecPath 形态为 xxx|xxx,右边部分就是书目记录路径 + // 如果 strConfirmItemRecPath 形态为 xxx|xxx,右边部分就是书目记录路径 { string strLeft = ""; string strRight = ""; diff --git a/DigitalPlatform.LibraryServer/AppCirculation.cs b/DigitalPlatform.LibraryServer/AppCirculation.cs index 6d22a2614..3fb3cdcdd 100644 --- a/DigitalPlatform.LibraryServer/AppCirculation.cs +++ b/DigitalPlatform.LibraryServer/AppCirculation.cs @@ -1585,8 +1585,11 @@ out BorrowInfo borrow_info // 2007/12/6 DateTime start_time_write_operlog = DateTime.Now; // 写入日志 - DomUtil.SetElementText(domOperLog.DocumentElement, - "confirmItemRecPath", strConfirmItemRecPath); + if (string.IsNullOrEmpty(strConfirmItemRecPath) == false) + { + DomUtil.SetElementText(domOperLog.DocumentElement, + "confirmItemRecPath", strConfirmItemRecPath); + } if (string.IsNullOrEmpty(strIdcardNumber) == false) { @@ -3618,6 +3621,12 @@ static string GetReturnActionName(string strAction) return strAction; } + static bool IsBiblioRecPath(string strText) + { + if (string.IsNullOrEmpty(strText) == true) + return false; + return strText.ToLower().StartsWith("@bibliorecpath:"); + } // API: 还书 // 权限: 工作人员需要return权限,如果是丢失处理需要lost权限;所有读者均不具备还书操作权限。盘点需要 inventory 权限 // parameters: @@ -3892,7 +3901,7 @@ public LibraryServerResult Return( goto ERROR1; } } - else + else if (IsBiblioRecPath(strItemBarcodeParam) == false) { // 从册条码号获得册记录 @@ -4126,13 +4135,16 @@ public LibraryServerResult Return( } XmlDocument itemdom = null; - nRet = LibraryApplication.LoadToDom(strItemXml, - out itemdom, - out strError); - if (nRet == -1) + if (string.IsNullOrEmpty(strItemXml) == false) { - strError = "装载册记录进入 XML DOM 时发生错误: " + strError; - goto ERROR1; + nRet = LibraryApplication.LoadToDom(strItemXml, + out itemdom, + out strError); + if (nRet == -1) + { + strError = "装载册记录进入 XML DOM 时发生错误: " + strError; + goto ERROR1; + } } WriteTimeUsed( @@ -4663,19 +4675,23 @@ public LibraryServerResult Return( else nRet = 0; - string strItemBarcode = DomUtil.GetElementText(itemdom.DocumentElement, "barcode"); - - // 创建日志记录 - DomUtil.SetElementText(domOperLog.DocumentElement, "itemBarcode", - string.IsNullOrEmpty(strItemBarcode) == false ? strItemBarcode : strItemBarcodeParam); - /* 后面会写入 - if (nRet == 1) + string strItemBarcode = ""; + if (itemdom != null) { - // 如果有超期和或丢失处理信息 - DomUtil.SetElementText(domOperLog.DocumentElement, "overdueString", - strOverdueString); + strItemBarcode = DomUtil.GetElementText(itemdom.DocumentElement, "barcode"); + + // 创建日志记录 + DomUtil.SetElementText(domOperLog.DocumentElement, "itemBarcode", + string.IsNullOrEmpty(strItemBarcode) == false ? strItemBarcode : strItemBarcodeParam); + /* 后面会写入 + if (nRet == 1) + { + // 如果有超期和或丢失处理信息 + DomUtil.SetElementText(domOperLog.DocumentElement, "overdueString", + strOverdueString); + } + * */ } - * */ bool bOverdue = false; string strOverdueInfo = ""; @@ -4717,18 +4733,66 @@ public LibraryServerResult Return( if (strAction == "read") { + string strBiblioRecPath = ""; + string strVolume = ""; + if (IsBiblioRecPath(strItemBarcodeParam) == false) + { + strBiblioRecID = DomUtil.GetElementText(itemdom.DocumentElement, "parent"); // + + string strBiblioDbName = ""; + // 根据实体库名, 找到对应的书目库名 + // return: + // -1 出错 + // 0 没有找到 + // 1 找到 + nRet = this.GetBiblioDbNameByItemDbName(strItemDbName, + out strBiblioDbName, + out strError); + if (nRet == -1) + goto ERROR1; + + if (string.IsNullOrEmpty(strBiblioDbName) == false) + { + strBiblioRecPath = strBiblioDbName + "/" + strBiblioRecID; + DomUtil.SetElementText(domOperLog.DocumentElement, "biblioRecPath", + strBiblioRecPath); + } + + strVolume = DomUtil.GetElementText(itemdom.DocumentElement, "volume"); + if (string.IsNullOrEmpty(strVolume) == false) + DomUtil.SetElementText(domOperLog.DocumentElement, "no", strVolume); + } + else + strBiblioRecPath = strItemBarcodeParam.Substring("@biblioRecPath:".Length); + // 探测 mongodb 库中是否已经存在这样的事项 - bool bRet = this.ChargingOperDatabase.Exists( + IEnumerable collection = this.ChargingOperDatabase.Exists( strReaderBarcode, - string.IsNullOrEmpty(strItemBarcode) == false ? strItemBarcode : strItemBarcodeParam, - DateTime.Now - new TimeSpan(0, 5, 0), + "", // string.IsNullOrEmpty(strItemBarcode) == false ? strItemBarcode : strItemBarcodeParam, + strBiblioRecPath, + strVolume, + new DateTime(0), // DateTime.Now - new TimeSpan(0, 5, 0), new DateTime(0), "read"); - if (bRet == true) + if (collection != null) { - strError = "读者 '"+strReaderBarcode+"' 早先(五分钟内)已经读过册 '"+strItemBarcode+"' 了,本次操作被拒绝"; - goto ERROR1; + DateTime existingOperTime = new DateTime(0); + + foreach (ChargingOperItem item in collection) + { + existingOperTime = item.OperTime; + break; + } + + if (existingOperTime != new DateTime(0)) + { + strError = "读者 '" + strReaderBarcode + "' 早先 (" + existingOperTime.ToString("G") + ") 已经读过 [" + GetReadCaption(strBiblioRecPath, strVolume) + "] 了,本次操作被拒绝"; + goto ERROR1; + } } + + DomUtil.SetElementText(domOperLog.DocumentElement, + "biblioRecPath", strBiblioRecPath); goto WRITE_OPERLOG; } @@ -4930,8 +4994,11 @@ public LibraryServerResult Return( } // 确认册路径 - DomUtil.SetElementText(domOperLog.DocumentElement, - "confirmItemRecPath", strConfirmItemRecPath); + if (string.IsNullOrEmpty(strConfirmItemRecPath) == false) + { + DomUtil.SetElementText(domOperLog.DocumentElement, + "confirmItemRecPath", strConfirmItemRecPath); + } if (string.IsNullOrEmpty(strIdcardNumber) == false) { @@ -4946,9 +5013,12 @@ public LibraryServerResult Return( DomUtil.SetAttr(node, "recPath", strOutputReaderRecPath); // 写入册记录 - node = DomUtil.SetElementText(domOperLog.DocumentElement, - "itemRecord", itemdom.OuterXml); - DomUtil.SetAttr(node, "recPath", strOutputItemRecPath); + if (itemdom != null) + { + node = DomUtil.SetElementText(domOperLog.DocumentElement, + "itemRecord", itemdom.OuterXml); + DomUtil.SetAttr(node, "recPath", strOutputItemRecPath); + } if (strLostComment != "") { @@ -5098,10 +5168,13 @@ public LibraryServerResult Return( result.Value = 1; } - strOutputItemXml = itemdom.OuterXml; + if (itemdom != null) + strOutputItemXml = itemdom.OuterXml; strOutputReaderXml = readerdom.OuterXml; - strBiblioRecID = DomUtil.GetElementText(itemdom.DocumentElement, "parent"); // - + if (itemdom != null) + { + strBiblioRecID = DomUtil.GetElementText(itemdom.DocumentElement, "parent"); // + } } // 册记录锁定范围结束 finally { @@ -5168,8 +5241,6 @@ public LibraryServerResult Return( } END3: - - // 输出数据 // 把输出数据部分放在读者锁以外范围,是为了尽量减少锁定的时间,提高并发运行效率 DateTime output_start_time = DateTime.Now; @@ -5402,35 +5473,41 @@ public LibraryServerResult Return( if (StringUtil.IsInList("biblio", strStyle) == true) { DateTime start_time_1 = DateTime.Now; + string strBiblioRecPath = ""; + if (IsBiblioRecPath(strItemBarcodeParam) == true) + strBiblioRecPath = strItemBarcodeParam.Substring("@biblioRecPath:".Length); - if (String.IsNullOrEmpty(strBiblioRecID) == true) + if (string.IsNullOrEmpty(strBiblioRecPath) == true) { - strError = "册记录XML中元素缺乏或者值为空, 因此无法定位种记录ID"; - strError = "虽然出现了下列错误,但是还书操作已经成功: " + strError; - goto ERROR1; - } + if (String.IsNullOrEmpty(strBiblioRecID) == true) + { + strError = "册记录XML中元素缺乏或者值为空, 因此无法定位种记录ID"; + strError = "虽然出现了下列错误,但是还书操作已经成功: " + strError; + goto ERROR1; + } - string strItemDbName = ResPath.GetDbName(strOutputItemRecPath); + string strItemDbName = ResPath.GetDbName(strOutputItemRecPath); - string strBiblioDbName = ""; - // 根据实体库名, 找到对应的书目库名 - // return: - // -1 出错 - // 0 没有找到 - // 1 找到 - nRet = this.GetBiblioDbNameByItemDbName(strItemDbName, - out strBiblioDbName, - out strError); - if (nRet == -1) - goto ERROR1; - if (nRet == 0) - { - strError = "实体库名 '" + strItemDbName + "' 没有找到对应的书目库名"; - strError = "虽然出现了下列错误,但是还书操作已经成功: " + strError; - goto ERROR1; - } + string strBiblioDbName = ""; + // 根据实体库名, 找到对应的书目库名 + // return: + // -1 出错 + // 0 没有找到 + // 1 找到 + nRet = this.GetBiblioDbNameByItemDbName(strItemDbName, + out strBiblioDbName, + out strError); + if (nRet == -1) + goto ERROR1; + if (nRet == 0) + { + strError = "实体库名 '" + strItemDbName + "' 没有找到对应的书目库名"; + strError = "虽然出现了下列错误,但是还书操作已经成功: " + strError; + goto ERROR1; + } - string strBiblioRecPath = strBiblioDbName + "/" + strBiblioRecID; + strBiblioRecPath = strBiblioDbName + "/" + strBiblioRecID; + } string[] biblio_formats = strBiblioFormatList.Split(new char[] { ',' }); biblio_records = new string[biblio_formats.Length]; @@ -5482,7 +5559,7 @@ public LibraryServerResult Return( // TODO: 可以cache nRet = this.MapKernelScriptFile( sessioninfo, - strBiblioDbName, + StringUtil.GetDbName(strBiblioRecPath), "./cfgs/loan_biblio.fltx", out strLocalPath, out strError); @@ -5522,7 +5599,7 @@ public LibraryServerResult Return( // TODO: 可以cache nRet = this.MapKernelScriptFile( sessioninfo, - strBiblioDbName, + StringUtil.GetDbName(strBiblioRecPath), "./cfgs/loan_biblio_text.fltx", out strLocalPath, out strError); @@ -5580,7 +5657,6 @@ public LibraryServerResult Return( "Return() 中返回书目记录(" + strBiblioFormatList + ") 耗时 "); } - this.WriteTimeUsed( time_lines, start_time, @@ -5625,6 +5701,14 @@ public LibraryServerResult Return( return result; } + // 构造用于提示“读过”卷册的文字 + static string GetReadCaption(string strBiblioRecPath, string strVolume) + { + if (string.IsNullOrEmpty(strVolume) == true) + return "书目记录 '" + strBiblioRecPath + "'"; + return "书目记录 '" + strBiblioRecPath + "' 卷 '" + strVolume + "'"; + } + // 执行盘点记载 int DoInventory( SessionInfo sessioninfo, diff --git a/DigitalPlatform.LibraryServer/AppDatabase.cs b/DigitalPlatform.LibraryServer/AppDatabase.cs index 46561776d..fde802099 100644 --- a/DigitalPlatform.LibraryServer/AppDatabase.cs +++ b/DigitalPlatform.LibraryServer/AppDatabase.cs @@ -2852,6 +2852,25 @@ int RefreshDatabaseDefs( continue; } + // 刷新出纳历史库 + if (this.IsChargingHistoryDbName(strName) == true) + { + if (SessionInfo.IsGlobalUser(strLibraryCodeList) == false) + { + strError = "当前用户不是全局用户,不允许刷新" + ChargingHistoryDbName + "库的定义"; + goto ERROR1; + } + + if (string.IsNullOrEmpty(this.MongoDbConnStr) == true) + { + strError = "当前尚未启用 MongoDB 功能"; + return -1; + } + + this.ChargingOperDatabase.CreateIndex(); + continue; + } + strError = "数据库名 '" + strName + "' 不属于 dp2library 目前管辖的范围..."; goto ERROR1; } @@ -3309,7 +3328,7 @@ int InitializeDatabase( continue; } - // 初始化预约到书库 + // 初始化访问日志库 if (this.IsAccessLogDbName(strName)) { if (SessionInfo.IsGlobalUser(strLibraryCodeList) == false) @@ -3324,7 +3343,7 @@ int InitializeDatabase( return -1; } - // 初始化预约到书库 + // 初始化访问日志库 nRet = this.AccessLogDatabase.Clear(out strError); if (nRet == -1) { @@ -3359,6 +3378,31 @@ int InitializeDatabase( continue; } + // 初始化出纳历史库 + if (this.IsChargingHistoryDbName(strName)) + { + if (SessionInfo.IsGlobalUser(strLibraryCodeList) == false) + { + strError = "当前用户不是全局用户,不允许初始化" + ChargingHistoryDbName + "库"; + return -1; + } + + if (string.IsNullOrEmpty(this.MongoDbConnStr) == true) + { + strError = "当前尚未启用 MongoDB 功能"; + return -1; + } + + // 初始化出纳历史库 + nRet = this.ChargingOperDatabase.Clear(out strError); + if (nRet == -1) + { + strError = "初始化" + ChargingHistoryDbName + "库 '" + strName + "' 时发生错误: " + strError; + return -1; + } + continue; + } + strError = "数据库名 '" + strName + "' 不属于 dp2library 目前管辖的范围..."; return -1; } @@ -3392,7 +3436,6 @@ bool IsAccessLogDbName(string strName) } const string HitCountDbName = "访问计数"; - bool IsHitCountDbName(string strName) { if (strName == HitCountDbName) @@ -3400,6 +3443,14 @@ bool IsHitCountDbName(string strName) return false; } + const string ChargingHistoryDbName = "出纳历史"; + bool IsChargingHistoryDbName(string strName) + { + if (strName == ChargingHistoryDbName) + return true; + return false; + } + // 创建数据库 // parameters: // strLibraryCodeList 当前用户的管辖分馆代码列表 @@ -5158,7 +5209,7 @@ int GetDatabaseInfo( strError = ""; if (String.IsNullOrEmpty(strDatabaseNames) == true) - strDatabaseNames = "#biblio,#reader,#arrived,#amerce,#invoice,#util,#message,#accessLog,#hitcount"; // 注: #util 相当于 #zhongcihao,#publisher,#dictionary,#inventory + strDatabaseNames = "#biblio,#reader,#arrived,#amerce,#invoice,#util,#message,#accessLog,#hitcount,#chargingOper"; // 注: #util 相当于 #zhongcihao,#publisher,#dictionary,#inventory // 用于构造返回结果字符串的DOM XmlDocument dom = new XmlDocument(); @@ -5339,6 +5390,19 @@ int GetDatabaseInfo( DomUtil.SetAttr(nodeDatabase, "name", HitCountDbName); } } + else if (strName == "#chargingOper") + { + // 2016/1/10 + if (string.IsNullOrEmpty(this.MongoDbConnStr) == false + && this.ChargingOperDatabase != null) + { + XmlNode nodeDatabase = dom.CreateElement("database"); + dom.DocumentElement.AppendChild(nodeDatabase); + + DomUtil.SetAttr(nodeDatabase, "type", "chargingOper"); + DomUtil.SetAttr(nodeDatabase, "name", ChargingHistoryDbName); + } + } else { strError = "不可识别的数据库名 '" + strName + "'"; diff --git a/DigitalPlatform.LibraryServer/MongoDb/BuildMongoOperDatabase.cs b/DigitalPlatform.LibraryServer/MongoDb/BuildMongoOperDatabase.cs index 1ba989974..7821ac0bb 100644 --- a/DigitalPlatform.LibraryServer/MongoDb/BuildMongoOperDatabase.cs +++ b/DigitalPlatform.LibraryServer/MongoDb/BuildMongoOperDatabase.cs @@ -389,16 +389,26 @@ public static int AppendOperationBorrowReturn( { strError = ""; + string strAction = DomUtil.GetElementText(domOperLog.DocumentElement, + "action"); + ChargingOperItem item = new ChargingOperItem(); item.Operation = strOperation; - item.Action = DomUtil.GetElementText(domOperLog.DocumentElement, - "action"); + item.Action = strAction; item.LibraryCode = DomUtil.GetElementText(domOperLog.DocumentElement, "libraryCode"); item.ItemBarcode = DomUtil.GetElementText(domOperLog.DocumentElement, "itemBarcode"); item.PatronBarcode = DomUtil.GetElementText(domOperLog.DocumentElement, "readerBarcode"); + + { + string strBiblioRecPath = DomUtil.GetElementText(domOperLog.DocumentElement, + "biblioRecPath"); + if (string.IsNullOrEmpty(strBiblioRecPath) == false) + item.BiblioRecPath = strBiblioRecPath; + } + if (strOperation == "borrow") { item.Period = DomUtil.GetElementText(domOperLog.DocumentElement, @@ -406,6 +416,14 @@ public static int AppendOperationBorrowReturn( item.No = DomUtil.GetElementText(domOperLog.DocumentElement, "no"); } + + if (strOperation == "return" && strAction == "read") + { + // no 用作卷册信息 + item.No = DomUtil.GetElementText(domOperLog.DocumentElement, + "no"); + } + item.ClientAddress = DomUtil.GetElementText(domOperLog.DocumentElement, "clientAddress"); item.Operator = DomUtil.GetElementText(domOperLog.DocumentElement, diff --git a/DigitalPlatform.LibraryServer/MongoDb/ChargingOperDatabase.cs b/DigitalPlatform.LibraryServer/MongoDb/ChargingOperDatabase.cs index 66b6fd23e..f56b88b2c 100644 --- a/DigitalPlatform.LibraryServer/MongoDb/ChargingOperDatabase.cs +++ b/DigitalPlatform.LibraryServer/MongoDb/ChargingOperDatabase.cs @@ -30,6 +30,10 @@ public override void CreateIndex() _collection.CreateIndex(new IndexKeysBuilder().Ascending("PatronBarcode"), IndexOptions.SetUnique(false)); + + // 2016/1/9 + _collection.CreateIndex(new IndexKeysBuilder().Ascending("BiblioRecPath"), + IndexOptions.SetUnique(false)); } // parameters: @@ -50,43 +54,75 @@ public bool Add(ChargingOperItem item) public IMongoQuery BuildQuery( string patronBarcode, string itemBarcode, + string biblioRecPath, + string volume, DateTime startTime, DateTime endTime, string operTypes) { - var time_query = Query.And(Query.GTE("OperTime", startTime), - Query.LT("OperTime", endTime)); + List and_items = new List(); - if (startTime == new DateTime(0) && endTime == new DateTime(0)) - time_query = Query.GTE("OperTime", startTime); - else if (startTime == new DateTime(0)) - time_query = Query.LT("OperTime", endTime); - else if (endTime == new DateTime(0)) - time_query = Query.GTE("OperTime", startTime); + { + var time_query = Query.And(Query.GTE("OperTime", startTime), + Query.LT("OperTime", endTime)); - IMongoQuery patron_query = Query.EQ("PatronBarcode", patronBarcode); - IMongoQuery item_query = Query.EQ("ItemBarcode", itemBarcode); + if (startTime == new DateTime(0) && endTime == new DateTime(0)) + time_query = Query.GTE("OperTime", startTime); + else if (startTime == new DateTime(0)) + time_query = Query.LT("OperTime", endTime); + else if (endTime == new DateTime(0)) + time_query = Query.GTE("OperTime", startTime); - List action_items = new List(); - string[] types = operTypes.Split(new char[] { ',' }); - foreach (string type in types) + and_items.Add(time_query); + } + + if (string.IsNullOrEmpty(patronBarcode) == false) + and_items.Add(Query.EQ("PatronBarcode", patronBarcode)); + + if (string.IsNullOrEmpty(itemBarcode) == false + && string.IsNullOrEmpty(biblioRecPath) == false) { - if (type == "borrow") - action_items.Add(Query.EQ("Action", "borrow")); - if (type == "return") - action_items.Add(Query.EQ("Action", "return")); - if (type == "renew") - action_items.Add(Query.EQ("Action", "renew")); - if (type == "lost") - action_items.Add(Query.EQ("Action", "lost")); - if (type == "read") - action_items.Add(Query.EQ("Action", "read")); + // 两个条件只要满足一个即可 + and_items.Add( + Query.Or(Query.EQ("ItemBarcode", itemBarcode), + Query.EQ("BiblioRecPath", biblioRecPath)) + ); + } + else + { + if (string.IsNullOrEmpty(itemBarcode) == false) + and_items.Add(Query.EQ("ItemBarcode", itemBarcode)); + if (string.IsNullOrEmpty(biblioRecPath) == false) + and_items.Add(Query.EQ("BiblioRecPath", biblioRecPath)); } - var type_query = Query.And(Query.Or(Query.EQ("Operation", "borrow"), Query.EQ("Operation", "return")), - Query.Or(action_items)); + if (string.IsNullOrEmpty(volume) == false + && string.IsNullOrEmpty(itemBarcode) == true) // 只有 itemBarcode 为空的时候,才匹配 volume + and_items.Add(Query.EQ("No", volume)); - return Query.And(patron_query, item_query, time_query, type_query); + { + List action_items = new List(); + string[] types = operTypes.Split(new char[] { ',' }); + foreach (string type in types) + { + if (type == "borrow") + action_items.Add(Query.EQ("Action", "borrow")); + if (type == "return") + action_items.Add(Query.EQ("Action", "return")); + if (type == "renew") + action_items.Add(Query.EQ("Action", "renew")); + if (type == "lost") + action_items.Add(Query.EQ("Action", "lost")); + if (type == "read") + action_items.Add(Query.EQ("Action", "read")); + } + + var type_query = Query.And(Query.Or(Query.EQ("Operation", "borrow"), Query.EQ("Operation", "return")), + Query.Or(action_items)); + and_items.Add(type_query); + } + + return Query.And(and_items); } // 构造 Query @@ -236,24 +272,31 @@ public int GetItemCount(IMongoQuery query) } // 探测是否存在这样的事项 - public bool Exists( + // 当 itemBarcode 不为空的时候,不使用 volume 参数的值 + // parameters: + public IEnumerable Exists( string patronBarcode, string itemBarcode, + string biblioRecPath, + string volume, DateTime startTime, DateTime endTime, string operTypes) { MongoCollection collection = this._collection; if (collection == null) - return false; + return null; var query = BuildQuery(patronBarcode, itemBarcode, + biblioRecPath, + volume, startTime, endTime, operTypes); - return collection.Find(query).Count() > 0; + return collection.Find(query); + // return collection.Find(query).Count() > 0; } } @@ -270,6 +313,8 @@ public class ChargingOperItem public string ItemBarcode { get; set; } public string PatronBarcode { get; set; } + public string BiblioRecPath { get; set; } + public string Period { get; set; } // 期限 public string No { get; set; } // 续借次,序号 diff --git a/DigitalPlatform.LibraryService/LibraryService.cs b/DigitalPlatform.LibraryService/LibraryService.cs index 59a322505..461890574 100644 --- a/DigitalPlatform.LibraryService/LibraryService.cs +++ b/DigitalPlatform.LibraryService/LibraryService.cs @@ -14340,6 +14340,8 @@ public class ChargingItem public string ItemBarcode { get; set; } [DataMember] public string PatronBarcode { get; set; } + [DataMember] + public string BiblioRecPath { get; set; } [DataMember] public string Period { get; set; } // 期限 @@ -14362,6 +14364,7 @@ public ChargingItem(ChargingOperItem item) this.Action = item.Action; this.ItemBarcode = item.ItemBarcode; this.PatronBarcode = item.PatronBarcode; + this.BiblioRecPath = item.BiblioRecPath; this.Period = item.Period; this.No = item.No; this.ClientAddress = item.ClientAddress; diff --git a/DigitalPlatform.OPAC.Web/res/ItemControl.cs.en-US.resx b/DigitalPlatform.OPAC.Web/res/ItemControl.cs.en-US.resx index bce055615..719093b1e 100644 --- a/DigitalPlatform.OPAC.Web/res/ItemControl.cs.en-US.resx +++ b/DigitalPlatform.OPAC.Web/res/ItemControl.cs.en-US.resx @@ -145,7 +145,7 @@ Publish time - Volumn + Volume Reference ID diff --git a/ZipUtil.exe b/ZipUtil.exe index 36edb9bb5cd4aecd684510429eb6d9484f540687..7053272d2e615c48f679f04cb98cd52c0f2d6e37 100644 GIT binary patch delta 66 zcmZqhXz-ZO!OWXJX=Ascn1D@0){_q|58UQ7WbPN<;q`9w8L$M`YKp W&KL7(nL2H4_u&t7H_wpF-~s@oR2-`S delta 66 zcmZqhXz-ZO!5s2)!p3exF@Xtl8W{X}Bi$E&di!_7R+ep>&xkEx0?AI!my{GpbL}xc WW6a~X;=f-*#p;E&n`cO7Z~*|&7#z$1 diff --git a/dp2Circulation/ChangePasswordForm.cs b/dp2Circulation/ChangePasswordForm.cs index 9b91590c8..f2b313211 100644 --- a/dp2Circulation/ChangePasswordForm.cs +++ b/dp2Circulation/ChangePasswordForm.cs @@ -236,7 +236,7 @@ private void button_worker_changePassword_Click(object sender, EventArgs e) // 1 登录成功 lRet = Channel.Login(this.textBox_worker_userName.Text, this.textBox_worker_oldPassword.Text, - "type=worker", + "type=worker,client=dp2circulation|" + Program.ClientVersion, out strError); if (lRet == -1) { diff --git a/dp2Circulation/Charging/QuickChargingForm.cs b/dp2Circulation/Charging/QuickChargingForm.cs index 2c77c84ce..6cac0ee04 100644 --- a/dp2Circulation/Charging/QuickChargingForm.cs +++ b/dp2Circulation/Charging/QuickChargingForm.cs @@ -1777,7 +1777,7 @@ public string PatronRenderFormat string strFormat = ""; if (_cardControl != null) { - if (this.NoBorrowHistory == true + if (this.NoBorrowHistory == true && StringUtil.CompareVersion(this.MainForm.ServerVersion, "2.25") >= 0) { styles.Add("noborrowhistory"); @@ -3210,7 +3210,11 @@ string GetUpperCase(string strText) if (string.IsNullOrEmpty(strText) == true) return strText; if (this.toolStripButton_upperInput.Checked == true) + { + if (strText.ToLower().StartsWith("@bibliorecpath:") == true) + return strText; // 特殊地,不要转为大写 return strText.ToUpper(); + } return strText; } diff --git a/dp2Circulation/Charging/SelectItemDialog.Designer.cs b/dp2Circulation/Charging/SelectItemDialog.Designer.cs index 1edc2805c..59c648980 100644 --- a/dp2Circulation/Charging/SelectItemDialog.Designer.cs +++ b/dp2Circulation/Charging/SelectItemDialog.Designer.cs @@ -37,7 +37,7 @@ private void InitializeComponent() this.dpColumn_itemBarcode = new DigitalPlatform.CommonControl.DpColumn(); this.dpColumn_borrowInfo = new DigitalPlatform.CommonControl.DpColumn(); this.dpColumn_summary = new DigitalPlatform.CommonControl.DpColumn(); - this.dpColumn_volumn = new DigitalPlatform.CommonControl.DpColumn(); + this.dpColumn_volume = new DigitalPlatform.CommonControl.DpColumn(); this.dpColumn_location = new DigitalPlatform.CommonControl.DpColumn(); this.dpColumn_price = new DigitalPlatform.CommonControl.DpColumn(); this.dpColumn_itemRecPath = new DigitalPlatform.CommonControl.DpColumn(); @@ -94,7 +94,7 @@ private void InitializeComponent() this.dpTable_items.Columns.Add(this.dpColumn_itemBarcode); this.dpTable_items.Columns.Add(this.dpColumn_borrowInfo); this.dpTable_items.Columns.Add(this.dpColumn_summary); - this.dpTable_items.Columns.Add(this.dpColumn_volumn); + this.dpTable_items.Columns.Add(this.dpColumn_volume); this.dpTable_items.Columns.Add(this.dpColumn_location); this.dpTable_items.Columns.Add(this.dpColumn_price); this.dpTable_items.Columns.Add(this.dpColumn_itemRecPath); @@ -156,14 +156,14 @@ private void InitializeComponent() this.dpColumn_summary.Text = "书目摘要"; this.dpColumn_summary.Width = 200; // - // dpColumn_volumn + // dpColumn_volume // - this.dpColumn_volumn.Alignment = System.Drawing.StringAlignment.Near; - this.dpColumn_volumn.BackColor = System.Drawing.Color.Transparent; - this.dpColumn_volumn.Font = null; - this.dpColumn_volumn.ForeColor = System.Drawing.Color.Transparent; - this.dpColumn_volumn.Text = "卷册"; - this.dpColumn_volumn.Width = 50; + this.dpColumn_volume.Alignment = System.Drawing.StringAlignment.Near; + this.dpColumn_volume.BackColor = System.Drawing.Color.Transparent; + this.dpColumn_volume.Font = null; + this.dpColumn_volume.ForeColor = System.Drawing.Color.Transparent; + this.dpColumn_volume.Text = "卷册"; + this.dpColumn_volume.Width = 50; // // dpColumn_location // @@ -292,7 +292,7 @@ private void InitializeComponent() private DigitalPlatform.CommonControl.DpColumn dpColumn_itemBarcode; private DigitalPlatform.CommonControl.DpColumn dpColumn_borrowInfo; private DigitalPlatform.CommonControl.DpColumn dpColumn_summary; - private DigitalPlatform.CommonControl.DpColumn dpColumn_volumn; + private DigitalPlatform.CommonControl.DpColumn dpColumn_volume; private DigitalPlatform.CommonControl.DpColumn dpColumn_location; private DigitalPlatform.CommonControl.DpColumn dpColumn_price; private DigitalPlatform.CommonControl.DpColumn dpColumn_itemRecPath; diff --git a/dp2Circulation/Charging/SelectItemDialog.cs b/dp2Circulation/Charging/SelectItemDialog.cs index 77cc43b41..d64fe7525 100644 --- a/dp2Circulation/Charging/SelectItemDialog.cs +++ b/dp2Circulation/Charging/SelectItemDialog.cs @@ -17,6 +17,8 @@ // using DigitalPlatform.LibraryClient.localhost; using DigitalPlatform.LibraryClient; using DigitalPlatform.LibraryClient.localhost; +using System.Collections; +using DigitalPlatform.Marc; namespace dp2Circulation { @@ -42,7 +44,7 @@ public partial class SelectItemDialog : MyForm /// 功能类型 /// 根据它决定某些事项显示为灰色文字 /// - public string FunctionType = "borrow"; // borrow/return/renew + public string FunctionType = "borrow"; // borrow/return/renew/inventory/read。在 read 状态时,除了显示册记录行,还要显示书目记录行 /// /// 验证还书时的读者证条码号 @@ -132,11 +134,24 @@ string GetBiblioDbNames() { foreach (BiblioDbProperty prop in this.MainForm.BiblioDbProperties) { - if (string.IsNullOrEmpty(prop.DbName) == false && - string.IsNullOrEmpty(prop.ItemDbName) == false) + if (string.IsNullOrEmpty(prop.DbName) == true) + continue; // 很罕见的情况下,数据库组可能不包含书目库 + +#if NO + if (this.FunctionType == "read") { + // “读过”功能要检索所有书目库 results.Add(prop.DbName); } + else +#endif + { + if (string.IsNullOrEmpty(prop.DbName) == false && + string.IsNullOrEmpty(prop.ItemDbName) == false) + { + results.Add(prop.DbName); + } + } } } @@ -144,6 +159,7 @@ string GetBiblioDbNames() } int m_nInSearching = 0; + Hashtable _biblioXmlTable = new Hashtable(); // biblioRecPath --> xml private void button_search_Click(object sender, EventArgs e) { @@ -158,6 +174,7 @@ private void button_search_Click(object sender, EventArgs e) goto ERROR1; } + this._biblioXmlTable.Clear(); this._biblioRecPaths.Clear(); this.dpTable_items.Rows.Clear(); @@ -280,7 +297,7 @@ private void button_search_Click(object sender, EventArgs e) null, // strResultSetName lStart, lPerCount, - "id", // "id,cols", + this.FunctionType == "read" ? "id,xml" : "id", // "id,cols", this.Lang, out searchresults, out strError); @@ -305,6 +322,9 @@ private void button_search_Click(object sender, EventArgs e) foreach (DigitalPlatform.LibraryClient.localhost.Record record in searchresults) { this._biblioRecPaths.Add(record.Path); + // 存储书目记录 XML + if (this.FunctionType == "read" && record.RecordBody != null) + this._biblioXmlTable[record.Path] = record.RecordBody.Xml; } lStart += searchresults.Length; @@ -428,6 +448,11 @@ int LoadBiblioSubItems( Progress.SetMessage("正在装入书目记录 '" + strBiblioRecPath + "' 下属的册记录 ..."); + if (this.FunctionType == "read") + { + AddBiblioLine(strBiblioRecPath); + } + int nCount = 0; long lPerCount = 100; // 每批获得多少个 @@ -577,9 +602,9 @@ int LoadBiblioSubItems( row.Add(cell); // 卷册 - string strVolumn = DomUtil.GetElementText(dom.DocumentElement, "volumn"); + string strVolume = DomUtil.GetElementText(dom.DocumentElement, "volume"); cell = new DpCell(); - cell.Text = strVolumn; + cell.Text = strVolume; row.Add(cell); // 地点 @@ -614,6 +639,7 @@ int LoadBiblioSubItems( lCount = lResultCount - lStart; } + // 分割行 if (lStart > 0) { DpRow row = new DpRow(); @@ -624,11 +650,165 @@ int LoadBiblioSubItems( return nCount; } + void GetVolume(string strBiblioRecPath, + out string strVolume, + out string strPrice) + { + strVolume = ""; + strPrice = ""; + + string strXml = (string)this._biblioXmlTable[strBiblioRecPath]; + if (string.IsNullOrEmpty(strXml) == true) + return; + + string strOutMarcSyntax = ""; + string strMARC = ""; + string strError = ""; + int nRet = MarcUtil.Xml2Marc(strXml, + false, + "", + out strOutMarcSyntax, + out strMARC, + out strError); + if (nRet == -1) + return; + if (string.IsNullOrEmpty(strMARC) == true) + return; + MarcRecord record = new MarcRecord(strMARC); + if (strOutMarcSyntax == "unimarc") + { + string h = record.select("field[@name='200']/subfield[@name='h']").FirstContent; + string i = record.select("field[@name='200']/subfield[@name='h']").FirstContent; + if (string.IsNullOrEmpty(h) == false && string.IsNullOrEmpty(i) == false) + strVolume = h + " . " + i; + else + { + if (h == null) + h = ""; + strVolume = h + i; + } + + strPrice = record.select("field[@name='010']/subfield[@name='d']").FirstContent; + } + else if (strOutMarcSyntax == "usmarc") + { + string n = record.select("field[@name='200']/subfield[@name='n']").FirstContent; + string p = record.select("field[@name='200']/subfield[@name='p']").FirstContent; + if (string.IsNullOrEmpty(n) == false && string.IsNullOrEmpty(p) == false) + strVolume = n + " . " + p; + else + { + if (n == null) + n = ""; + strVolume = n + p; + } + + strPrice = record.select("field[@name='020']/subfield[@name='c']").FirstContent; + } + else + { + + } + + } + + // 加入书目行 + void AddBiblioLine(string strBiblioRecPath) + { + string strError = ""; + + string strVolume = ""; + string strPrice = ""; + + GetVolume(strBiblioRecPath, + out strVolume, + out strPrice); + + Color colorBack = Color.LightGreen; + + DpRow row = new DpRow(); +#if NO + // 设为灰色行 + SetGrayText(row); +#endif + + // 状态 + DpCell cell = new DpCell(); + cell.BackColor = colorBack; + cell.Text = ""; + row.Add(cell); + + // 册条码号 + cell = new DpCell(); + cell.BackColor = colorBack; + cell.Text = "@biblioRecPath:" + strBiblioRecPath; + row.Add(cell); + + // 在借情况 + cell = new DpCell(); + cell.BackColor = colorBack; +#if NO + { + if (IsGray(row) == true) + cell.BackColor = Color.FromArgb(220, 220, 0); + else + cell.BackColor = Color.FromArgb(180, 180, 0); + + cell.ForeColor = Color.FromArgb(255, 255, 255); + cell.Alignment = DpTextAlignment.Center; + cell.Text = ""; + } +#endif + row.Add(cell); + + // 书目摘要 + string strSummary = ""; + { + int nRet = this.MainForm.GetBiblioSummary("@bibliorecpath:" + strBiblioRecPath, + "", + false, + out strSummary, + out strError); + if (nRet == -1) + strSummary = strError; + } + cell = new DpCell(); + cell.BackColor = colorBack; + cell.Text = strSummary; + row.Add(cell); + + // 卷册 + cell = new DpCell(); + cell.BackColor = colorBack; + cell.Text = strVolume; + row.Add(cell); + + // 地点 + cell = new DpCell(); + cell.BackColor = colorBack; + cell.Text = ""; + row.Add(cell); + + // 价格 + cell = new DpCell(); + cell.BackColor = colorBack; + cell.Text = strPrice; + row.Add(cell); + + // 册记录路径 + cell = new DpCell(); + cell.BackColor = colorBack; + cell.Text = strBiblioRecPath; + row.Add(cell); + + this.dpTable_items.Rows.Add(row); + } + const int COLUMN_STATE = 0; const int COLUMN_ITEMBARCODE = 1; const int COLUMN_BORROWINFO = 2; const int COLUMN_SUMMARY = 3; - const int COLUMN_VOLUMN = 4; + const int COLUMN_VOLUME = 4; const int COLUMN_LOCATION = 5; const int COLUMN_PRICE = 6; const int COLUMN_ITEMRECPATH = 7; @@ -689,7 +869,7 @@ private void dpTable_items_DoubleClick(object sender, EventArgs e) // 检查是否为灰色文字 if (Control.ModifierKeys == Keys.Control) { - // 按下 Control 键盘的时候灰色事项也可以操作 + // 按下 Control 键的时候灰色事项也可以操作 } else { @@ -1012,6 +1192,7 @@ static string GetRowText(DpRow row) return text.ToString(); } + // 打开到 册窗 void menuItem_loadToItemInfoForm_Click(object sender, EventArgs e) { @@ -1030,6 +1211,12 @@ void menuItem_loadToItemInfoForm_Click(object sender, EventArgs e) strError = "所选定的册事项不具备册条码号信息"; goto ERROR1; } + if (strItemBarcode.StartsWith("@biblioRecPath:") == true) + { + strError = "所选定的行是书目行,不具备册条码号信息"; + goto ERROR1; + } + ItemInfoForm form = this.MainForm.EnsureItemInfoForm(); Global.Activate(form); @@ -1064,7 +1251,10 @@ void menuItem_loadToEntityForm_Click(object sender, EventArgs e) EntityForm form = this.MainForm.EnsureEntityForm(); Global.Activate(form); - form.LoadItemByBarcode(strItemBarcode, false); + if (strItemBarcode.StartsWith("@biblioRecPath:") == true) + form.LoadRecordOld(strItemBarcode.Substring("@biblioRecPath:".Length), "", true); + else + form.LoadItemByBarcode(strItemBarcode, false); this.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.Close(); @@ -1072,7 +1262,6 @@ void menuItem_loadToEntityForm_Click(object sender, EventArgs e) ERROR1: MessageBox.Show(this, strError); } - } #if NO diff --git a/dp2Circulation/Charging/SelectItemDialog.resx b/dp2Circulation/Charging/SelectItemDialog.resx index 3921f011c..cbb8baf95 100644 --- a/dp2Circulation/Charging/SelectItemDialog.resx +++ b/dp2Circulation/Charging/SelectItemDialog.resx @@ -145,7 +145,7 @@ 211, 17 - + 385, 17 diff --git a/dp2Circulation/Charging/SummaryList.cs b/dp2Circulation/Charging/SummaryList.cs index 0c44397ba..7b73179bd 100644 --- a/dp2Circulation/Charging/SummaryList.cs +++ b/dp2Circulation/Charging/SummaryList.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Threading; using DigitalPlatform; -using System.Threading; using DigitalPlatform.CirculationClient; using DigitalPlatform.CommonControl; diff --git a/dp2Circulation/Entity/BookItem.cs b/dp2Circulation/Entity/BookItem.cs index f1cc197e8..729d6ee68 100644 --- a/dp2Circulation/Entity/BookItem.cs +++ b/dp2Circulation/Entity/BookItem.cs @@ -58,7 +58,7 @@ public class BookItem : BookItemBase /// /// ListView 栏目下标:卷册信息 /// - public const int COLUMN_VOLUMN = 8; + public const int COLUMN_VOLUME = 8; /// /// ListView 栏目下标:索取号 /// @@ -157,7 +157,7 @@ public void SetColumnText(int nCol, string strText) this.Source = strText; else if (nCol == COLUMN_PRICE) this.Price = strText; - else if (nCol == COLUMN_VOLUMN) + else if (nCol == COLUMN_VOLUME) this.Volume = strText; else if (nCol == COLUMN_ACCESSNO) this.AccessNo = strText; @@ -658,7 +658,7 @@ public override void SetItemColumns(ListViewItem item) this.Price); ListViewUtil.ChangeItemText(item, - COLUMN_VOLUMN, + COLUMN_VOLUME, this.Volume); ListViewUtil.ChangeItemText(item, COLUMN_ACCESSNO, diff --git a/dp2Circulation/Entity/BookItemBase.cs b/dp2Circulation/Entity/BookItemBase.cs index b417a8a3b..f11ffbb72 100644 --- a/dp2Circulation/Entity/BookItemBase.cs +++ b/dp2Circulation/Entity/BookItemBase.cs @@ -102,7 +102,7 @@ public string ErrorInfo /// public EntityInfo Error = null; - + /// /// 构造函数 /// @@ -274,91 +274,6 @@ public bool Changed /// 刚加入的 ListViewItem public ListViewItem AddToListView(ListView list) { -#if NO - ListViewItem item = new ListViewItem(this.Barcode, 0); - - // 2009/10/11 changed - ListViewUtil.ChangeItemText(item, - COLUMN_ERRORINFO, - this.ErrorInfo); - - ListViewUtil.ChangeItemText(item, - COLUMN_STATE, - this.State); - ListViewUtil.ChangeItemText(item, - COLUMN_PUBLISHTIME, - this.PublishTime); - ListViewUtil.ChangeItemText(item, - COLUMN_LOCATION, - this.Location); - - ListViewUtil.ChangeItemText(item, - COLUMN_SELLER, - this.Seller); - ListViewUtil.ChangeItemText(item, - COLUMN_SOURCE, - this.Source); - - ListViewUtil.ChangeItemText(item, - COLUMN_PRICE, - this.Price); - - ListViewUtil.ChangeItemText(item, - COLUMN_VOLUMN, - this.Volume); - ListViewUtil.ChangeItemText(item, - COLUMN_ACCESSNO, - this.AccessNo); - - ListViewUtil.ChangeItemText(item, - COLUMN_BOOKTYPE, - this.BookType); - ListViewUtil.ChangeItemText(item, - COLUMN_REGISTERNO, - this.RegisterNo); - ListViewUtil.ChangeItemText(item, - COLUMN_COMMENT, - this.Comment); - ListViewUtil.ChangeItemText(item, - COLUMN_MERGECOMMENT, - this.MergeComment); - ListViewUtil.ChangeItemText(item, - COLUMN_BATCHNO, - this.BatchNo); - - ListViewUtil.ChangeItemText(item, - COLUMN_BORROWER, - this.Borrower); - ListViewUtil.ChangeItemText(item, - COLUMN_BORROWDATE, - this.BorrowDate); - ListViewUtil.ChangeItemText(item, - COLUMN_BORROWPERIOD, - this.BorrowPeriod); - - ListViewUtil.ChangeItemText(item, - COLUMN_INTACT, - this.Intact); - ListViewUtil.ChangeItemText(item, - COLUMN_BINDINGCOST, - this.BindingCost); - ListViewUtil.ChangeItemText(item, - COLUMN_BINDING, - this.Binding); - - // 2013/1/18 增补 以前缺乏的情况是个bug - ListViewUtil.ChangeItemText(item, - COLUMN_OPERATIONS, - this.Binding); - - - ListViewUtil.ChangeItemText(item, - COLUMN_RECPATH, - this.RecPath); - ListViewUtil.ChangeItemText(item, - COLUMN_REFID, - this.RefID); -#endif ListViewItem item = new ListViewItem(); item.ImageIndex = 0; diff --git a/dp2Circulation/Issue/BindingControl.cs b/dp2Circulation/Issue/BindingControl.cs index b2f4c12c8..addd90a6f 100644 --- a/dp2Circulation/Issue/BindingControl.cs +++ b/dp2Circulation/Issue/BindingControl.cs @@ -2249,13 +2249,13 @@ int SearchIssue( } // 如果多于一个,才用卷号来过滤 - if (issues.Count > 1 && String.IsNullOrEmpty(info.Volumn) == false) + if (issues.Count > 1 && String.IsNullOrEmpty(info.Volume) == false) { List temp = new List(); for (int i = 0; i < issues.Count; i++) { IssueBindingItem issue = issues[i]; - if (issue.Volume == info.Volumn) + if (issue.Volume == info.Volume) temp.Add(issue); } @@ -15552,149 +15552,6 @@ private void timer_dragScroll_Tick(object sender, EventArgs e) // this.mouseMoveArgs this.OnMouseMove(e1); } - -#if NO - public int BuildVolumeStrings(string strText, - out string strYear, - out string strVolumn, - out string strZong, - out string strNo) - { - if (this.IsParent == false) - { - IssueBindingItem issue = this.Container; - if (issue != null - && String.IsNullOrEmpty(issue.PublishTime) == false) - { - string strVolumeString = VolumeInfo.BuildItemVolumeString( - IssueUtil.GetYearPart(issue.PublishTime), - issue.Issue, - issue.Zong, - issue.Volume); - if (this.Volume != strVolumeString) - { - this.Volume = strVolumeString; - return true; - } - } - - return false; - } - - if (this.MemberCells.Count == 0) - { - if (this.Volume == "") - return false; - this.Volume = ""; - return true; - } - - Hashtable no_list_table = new Hashtable(); - // List no_list = new List(); - List volumn_list = new List(); - List zong_list = new List(); - - for (int i = 0; i < this.MemberCells.Count; i++) - { - Cell cell = this.MemberCells[i]; - if (cell == null) - { - Debug.Assert(false, ""); - continue; - } - - if (cell.item == null) - continue; // 跳过缺期 - - IssueBindingItem issue = cell.Container; - Debug.Assert(issue != null, ""); - - string strNo = ""; - string strVolume = ""; - string strZong = ""; - - if (cell.item != null - && String.IsNullOrEmpty(cell.item.Volume) == false) - { - // 解析当年期号、总期号、卷号的字符串 - VolumeInfo.ParseItemVolumeString(cell.item.Volume, - out strNo, - out strZong, - out strVolume); - } - - // 实在不行,还是用期行的? - if (String.IsNullOrEmpty(strNo) == true) - { - strNo = issue.Issue; - Debug.Assert(String.IsNullOrEmpty(strNo) == false, ""); - - strVolume = issue.Volume; - strZong = issue.Zong; - } - - Debug.Assert(String.IsNullOrEmpty(issue.PublishTime) == false, ""); - string strYear = IssueUtil.GetYearPart(issue.PublishTime); - - List no_list = (List)no_list_table[strYear]; - if (no_list == null) - { - no_list = new List(); - no_list_table[strYear] = no_list; - } - - no_list.Add(strNo); - volumn_list.Add(strVolume); - zong_list.Add(strZong); - } - - List keys = new List(); - foreach (string key in no_list_table.Keys) - { - keys.Add(key); - } - keys.Sort(); - - string strNoString = ""; - for (int i = 0; i < keys.Count; i++) - { - string strYear = keys[i]; - List no_list = (List)no_list_table[strYear]; - Debug.Assert(no_list != null); - - if (String.IsNullOrEmpty(strNoString) == false) - strNoString += ","; // ; - strNoString += strYear + ",no." + Global.BuildNumberRangeString(no_list); // :no - } - - string strVolumnString = Global.BuildNumberRangeString(volumn_list); - string strZongString = Global.BuildNumberRangeString(zong_list); - - string strValue = strNoString; - - - if (String.IsNullOrEmpty(strZongString) == false) - { - if (String.IsNullOrEmpty(strValue) == false) - strValue += "="; - strValue += "总." + strZongString; - } - - if (String.IsNullOrEmpty(strVolumnString) == false) - { - if (String.IsNullOrEmpty(strValue) == false) - strValue += "="; - strValue += "v." + strVolumnString; - } - - if (this.Volume == strValue) - return false; - - this.Volume = strValue; - return true; - } - -#endif } // 点击检测结果 diff --git a/dp2Circulation/Issue/BindingControlItems.cs b/dp2Circulation/Issue/BindingControlItems.cs index 0133797e3..958780bb4 100644 --- a/dp2Circulation/Issue/BindingControlItems.cs +++ b/dp2Circulation/Issue/BindingControlItems.cs @@ -6442,14 +6442,14 @@ public bool RefreshVolumeString() if (issue != null && String.IsNullOrEmpty(issue.PublishTime) == false) { - string strVolumeString = VolumeInfo.BuildItemVolumeString( + string strTempVolumeString = VolumeInfo.BuildItemVolumeString( IssueUtil.GetYearPart(issue.PublishTime), issue.Issue, issue.Zong, issue.Volume); - if (this.Volume != strVolumeString) + if (this.Volume != strTempVolumeString) { - this.Volume = strVolumeString; + this.Volume = strTempVolumeString; return true; } } @@ -6467,7 +6467,7 @@ public bool RefreshVolumeString() Hashtable no_list_table = new Hashtable(); // List no_list = new List(); - List volumn_list = new List(); + List volume_list = new List(); List zong_list = new List(); for (int i = 0; i < this.MemberCells.Count; i++) @@ -6520,7 +6520,7 @@ public bool RefreshVolumeString() } no_list.Add(strNo); - volumn_list.Add(strVolume); + volume_list.Add(strVolume); zong_list.Add(strZong); } @@ -6543,7 +6543,7 @@ public bool RefreshVolumeString() strNoString += strYear + ",no." + Global.BuildNumberRangeString(no_list); // :no } - string strVolumnString = Global.BuildNumberRangeString(volumn_list); + string strVolumeListString = Global.BuildNumberRangeString(volume_list); string strZongString = Global.BuildNumberRangeString(zong_list); string strValue = strNoString; @@ -6556,11 +6556,11 @@ public bool RefreshVolumeString() strValue += "总." + strZongString; } - if (String.IsNullOrEmpty(strVolumnString) == false) + if (String.IsNullOrEmpty(strVolumeListString) == false) { if (String.IsNullOrEmpty(strValue) == false) strValue += "="; - strValue += "v." + strVolumnString; + strValue += "v." + strVolumeListString; } if (this.Volume == strValue) @@ -6818,7 +6818,8 @@ public string GetText(string strName) return this.BookType; case "price": return this.Price; - case "volumn": + case "volumn": // 兼容以前的拼写错误 + case "volume": return this.Volume; case "comment": return this.Comment; diff --git a/dp2Circulation/Issue/CellLineDialog.Designer.cs b/dp2Circulation/Issue/CellLineDialog.Designer.cs index 7f0c9c68f..cb8c2b361 100644 --- a/dp2Circulation/Issue/CellLineDialog.Designer.cs +++ b/dp2Circulation/Issue/CellLineDialog.Designer.cs @@ -96,7 +96,7 @@ private void InitializeComponent() "accessNo -- ȡ", "bookType -- ", "price -- ۸", - "volumn -- ں", + "volume -- ں", "comment -- ע", "batchNo -- κ", "binding -- ϶Ϣ", diff --git a/dp2Circulation/Issue/PrintBindingForm.cs b/dp2Circulation/Issue/PrintBindingForm.cs index 0fb3ed41d..3d184e508 100644 --- a/dp2Circulation/Issue/PrintBindingForm.cs +++ b/dp2Circulation/Issue/PrintBindingForm.cs @@ -2578,7 +2578,7 @@ int BuildPageBottom(PrintOption option, /*public*/ static string BuildVolumeRangeString(List volumes) { Hashtable no_list_table = new Hashtable(); - List volumn_list = new List(); + List volume_list = new List(); List zong_list = new List(); for(int i=0;i notdef_segments = new List(); @@ -197,7 +183,7 @@ public static int BuildVolumeInfos(string strText, else if (strSegment.IndexOf("no.") != -1) strNoString = strSegment; else if (strSegment.IndexOf("v.") != -1) - strVolumnString = strSegment; + strVolumeString = strSegment; else if (strSegment.IndexOf("总.") != -1) strZongString = strSegment; else @@ -209,7 +195,7 @@ public static int BuildVolumeInfos(string strText, // 2012/4/25 // 当年期号序列很重要,如果缺了,光有总期号和卷号是不行的 if (string.IsNullOrEmpty(strNoString) == true - && (string.IsNullOrEmpty(strZongString) == false || string.IsNullOrEmpty(strVolumnString) == false)) + && (string.IsNullOrEmpty(strZongString) == false || string.IsNullOrEmpty(strVolumeString) == false)) { strError = "当年期号序列不能省却。'" + strText + "'"; if (notdef_segments.Count > 0) @@ -268,22 +254,22 @@ public static int BuildVolumeInfos(string strText, } // 去掉"v."部分 - if (StringUtil.HasHead(strVolumnString, "v.") == true) + if (StringUtil.HasHead(strVolumeString, "v.") == true) { - strVolumnString = strVolumnString.Substring(2).Trim(); + strVolumeString = strVolumeString.Substring(2).Trim(); } - if (String.IsNullOrEmpty(strVolumnString) == false) + if (String.IsNullOrEmpty(strVolumeString) == false) { List volumes = null; try { - volumes = ExpandSequence(strVolumnString); + volumes = ExpandSequence(strVolumeString); } catch (Exception ex) { - strError = "v.序列 '" + strVolumnString + "' 格式错误:" + ex.Message; + strError = "v.序列 '" + strVolumeString + "' 格式错误:" + ex.Message; return -1; } @@ -293,11 +279,11 @@ public static int BuildVolumeInfos(string strText, VolumeInfo info = infos[i]; if (i < volumes.Count) { - info.Volumn = volumes[i]; - strLastValue = info.Volumn; // 记忆最后一个 + info.Volume = volumes[i]; + strLastValue = info.Volume; // 记忆最后一个 } else - info.Volumn = strLastValue; // 沿用最后一个 + info.Volume = strLastValue; // 沿用最后一个 } } @@ -316,7 +302,7 @@ public static int BuildVolumeInfos(string strText, public static List ExpandSequence(string strText) { List results = new List(); - string[] parts = strText.Split(new char[] { ',',',' }); + string[] parts = strText.Split(new char[] { ',', ',' }); for (int i = 0; i < parts.Length; i++) { string strPart = parts[i]; @@ -376,7 +362,7 @@ public static void ParseItemVolumeString(string strVolumeString, strZong = ""; strVolume = ""; - string[] segments = strVolumeString.Split(new char[] { ';', ',', '=',';',',','=' }); // ',','='为2010/2/24新增 + string[] segments = strVolumeString.Split(new char[] { ';', ',', '=', ';', ',', '=' }); // ',','='为2010/2/24新增 for (int i = 0; i < segments.Length; i++) { string strSegment = segments[i].Trim(); @@ -397,7 +383,7 @@ public static int CheckIssueNo( { strError = ""; - if (strIssueNo.IndexOfAny(new char[] {'-','*',',',';','=','?','-','*',',',';','=','?' }) != -1) + if (strIssueNo.IndexOfAny(new char[] { '-', '*', ',', ';', '=', '?', '-', '*', ',', ';', '=', '?' }) != -1) { strError = strName + "字符串中不能包含下列字符: '-','*',',',';','=','?'"; return -1; diff --git a/dp2Circulation/MainForm/InitialExtension.cs b/dp2Circulation/MainForm/InitialExtension.cs index 6ca840ff6..bc827701c 100644 --- a/dp2Circulation/MainForm/InitialExtension.cs +++ b/dp2Circulation/MainForm/InitialExtension.cs @@ -3338,8 +3338,10 @@ public int InitialNormalDbProperties(bool bPrepareSearch) // 为了避免因 dp2library 2.48 及以前的版本的一个 bug 引起报错 if (StringUtil.CompareVersion(this.ServerVersion, "2.48") <= 0 && prop.Type == "amerce") continue; - // 暂时不处理 accessLog 和 hitcount 类型 - if (prop.Type == "accessLog" || prop.Type == "hitcount") + // 暂时不处理 accessLog / hitcount / chargingOper 类型 + if (prop.Type == "accessLog" + || prop.Type == "hitcount" + || prop.Type == "chargingOper") continue; dbnames.Add(prop.DbName); } diff --git a/dp2Circulation/ManageDatabase/ManagerForm.cs b/dp2Circulation/ManageDatabase/ManagerForm.cs index 701f85f7c..08c0fb946 100644 --- a/dp2Circulation/ManageDatabase/ManagerForm.cs +++ b/dp2Circulation/ManageDatabase/ManagerForm.cs @@ -1968,6 +1968,7 @@ internal int ConfirmLogin(out string strError) "location", ""); string strParameters = "location=" + strLocation + ",type=worker"; + strParameters += ",client=dp2circulation|" + Program.ClientVersion; // return: // -1 error diff --git a/dp2Circulation/ManageDatabase/PageCenter.cs b/dp2Circulation/ManageDatabase/PageCenter.cs index 07a372a8f..33650bc26 100644 --- a/dp2Circulation/ManageDatabase/PageCenter.cs +++ b/dp2Circulation/ManageDatabase/PageCenter.cs @@ -127,7 +127,7 @@ internal static int GetRemoteBiblioDbNames( { long lRet = channel.Login(strUserName, strPassword, - "type=worker", + "type=worker,client=dp2circulation|" + Program.ClientVersion, out strError); if (lRet != 1) { diff --git a/dp2Circulation/Reader/ReaderInfoForm.cs b/dp2Circulation/Reader/ReaderInfoForm.cs index b9dc89581..65b515b96 100644 --- a/dp2Circulation/Reader/ReaderInfoForm.cs +++ b/dp2Circulation/Reader/ReaderInfoForm.cs @@ -5892,12 +5892,18 @@ void FillBorrowHistoryPage(List items, text.Append(""); text.Append(""); - if (string.IsNullOrEmpty(item.ItemBarcode) == false - && item.ItemBarcode.StartsWith("@refID:") == true) - text.Append(""); + string strItemBarcode = item.ItemBarcode; + if (string.IsNullOrEmpty(strItemBarcode) == true + && string.IsNullOrEmpty(item.BiblioRecPath) == false) + strItemBarcode = "@biblioRecPath:" + item.BiblioRecPath; + + if (string.IsNullOrEmpty(strItemBarcode) == false + && (strItemBarcode.StartsWith("@refID:") == true || strItemBarcode.StartsWith("@biblioRecPath:") == true)) + text.Append(""); else - text.Append(""); - text.Append(""); + text.Append(""); + + text.Append(""); string strPeriod = ""; if (wrapper.RelatedItem != null) From eeecda78ac983e640266fdd7135ab5aaf8893720 Mon Sep 17 00:00:00 2001 From: XieTao Date: Tue, 12 Jan 2016 21:18:55 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=87=BA=E7=BA=B3=E5=8E=86=E5=8F=B2=E5=BA=93=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LibraryApplication.cs | 1 - .../MongoDb/BuildMongoOperDatabase.cs | 208 +++++++++++------- ZipUtil.exe | Bin 9216 -> 9216 bytes dp2Circulation/Reader/ReaderInfoForm.cs | 3 - dp2Circulation/Statis/ReportForm.cs | 7 + dp2Circulation/dp2Circulation.csproj | 2 +- dp2Installer/dp2Installer.csproj | 2 +- dp2LibraryXE/dp2LibraryXE.csproj | 2 +- dp2LibraryXE/opac_app/Browse.aspx.cs | 4 +- dp2OPAC/Browse.aspx.cs | 4 +- 10 files changed, 143 insertions(+), 90 deletions(-) diff --git a/DigitalPlatform.LibraryServer/LibraryApplication.cs b/DigitalPlatform.LibraryServer/LibraryApplication.cs index 2fc688c0c..1a3894bbd 100644 --- a/DigitalPlatform.LibraryServer/LibraryApplication.cs +++ b/DigitalPlatform.LibraryServer/LibraryApplication.cs @@ -1283,7 +1283,6 @@ public int LoadCfg( goto ERROR1; } - #if LOG_INFO app.WriteErrorLog("INFO: ArriveMonitor"); #endif diff --git a/DigitalPlatform.LibraryServer/MongoDb/BuildMongoOperDatabase.cs b/DigitalPlatform.LibraryServer/MongoDb/BuildMongoOperDatabase.cs index 7821ac0bb..dafebcffb 100644 --- a/DigitalPlatform.LibraryServer/MongoDb/BuildMongoOperDatabase.cs +++ b/DigitalPlatform.LibraryServer/MongoDb/BuildMongoOperDatabase.cs @@ -78,7 +78,6 @@ static int ParseLogRecorverStart(string strStart, return -1; } - strFileName = strStart.Substring(nRet + 1).Trim(); // 如果文件名没有扩展名,自动加上 @@ -164,6 +163,22 @@ public override void Worker() return; } + // 开始处理时的日期 + string strEndDate = DateTimeUtil.DateTimeToString8(DateTime.Now); + + // 记忆当前最后一条操作日志记录的位置 + // return: + // -1 出错 + // 0 日志文件不存在,或者记录数为 0 + // >0 记录数 + long lRecCount = GetOperLogCount(strEndDate, + out strError); + if (lRecCount == -1) + { + this.AppendResultText("启动失败: " + strError + "\r\n"); + return; + } + this.App.WriteErrorLog(this.Name + " 任务启动。"); if (bClearFirst == true) @@ -216,8 +231,13 @@ public override void Worker() if (bStart == true) { + long lMax = -1; + if (strEndDate + ".log" == strFileName) + lMax = lRecCount; + nRet = DoOneLogFile(strFileName, lStartIndex, + lMax, out strError); if (nRet == -1) goto ERROR1; @@ -226,23 +246,63 @@ public override void Worker() } this.AppendResultText("循环结束\r\n"); - this.App.WriteErrorLog(this.Name + "恢复 任务结束。"); return; ERROR1: return; } + // 获得一个日志文件中记录的总数 + // parameters: + // strDate 日志文件的日期,8 字符 + // return: + // -1 出错 + // 0 日志文件不存在,或者记录数为 0 + // >0 记录数 + long GetOperLogCount(string strDate, + out string strError) + { + strError = ""; + + string strXml = ""; + long lRecCount = 0; + + string strStyle = "getcount"; + long lAttachmentLength = 0; + long lRet = this.App.OperLog.GetOperLog( + "*", + strDate + ".log", + -1, // lIndex, + -1, // lHint, + strStyle, + "", // strFilter + out lRecCount, + out strXml, + out lAttachmentLength, + out strError); + if (lRet == 0) + { + lRecCount = 0; + return 0; + } + if (lRet != 1) + return -1; + Debug.Assert(lRecCount >= 0, ""); + return lRecCount; + } + // 处理一个日志文件的恢复任务 // parameters: // strFileName 纯文件名 // lStartIndex 开始的记录(从0开始计数) + // lMax 最多处理多少个记录。-1 表示全部处理 // return: // -1 error // 0 file not found // 1 succeed int DoOneLogFile(string strFileName, long lStartIndex, + long lMax, out string strError) { strError = ""; @@ -250,99 +310,85 @@ int DoOneLogFile(string strFileName, this.AppendResultText("做文件 " + strFileName + "\r\n"); Debug.Assert(this.App != null, ""); - string strTempFileName = this.App.GetTempFileName("logrecover"); // Path.GetTempFileName(); - try + long lIndex = 0; + long lHint = -1; + long lHintNext = -1; + for (lIndex = lStartIndex; ; lIndex++) { + if (this.Stopped == true) + break; - long lIndex = 0; - long lHint = -1; - long lHintNext = -1; + if (lMax != -1 && lIndex >= lMax) + break; - for (lIndex = lStartIndex; ; lIndex++) + string strXml = ""; + + if (lIndex != 0) + lHint = lHintNext; + + SetProgressText(strFileName + " 记录" + (lIndex + 1).ToString()); + + long lAttachmentLength = 0; + // 获得一个日志记录 + // parameters: + // strFileName 纯文件名,不含路径部分 + // lHint 记录位置暗示性参数。这是一个只有服务器才能明白含义的值,对于前端来说是不透明的。 + // 目前的含义是记录起始位置。 + // return: + // -1 error + // 0 file not found + // 1 succeed + // 2 超过范围 + int nRet = this.App.OperLog.GetOperLog( + "*", + strFileName, + lIndex, + lHint, + "", // level-0 + "", // strFilter + out lHintNext, + out strXml, + out lAttachmentLength, // attachment, + out strError); + if (nRet == -1) + return -1; + if (nRet == 0) + return 0; + if (nRet == 2) { - if (this.Stopped == true) - break; + // 最后一条补充提示一下 + if (((lIndex - 1) % 100) != 0) + this.AppendResultText("做日志记录 " + strFileName + " " + (lIndex).ToString() + "\r\n"); + break; + } - string strXml = ""; + // 处理一个日志记录 - if (lIndex != 0) - lHint = lHintNext; + if ((lIndex % 100) == 0) + this.AppendResultText("做日志记录 " + strFileName + " " + (lIndex + 1).ToString() + "\r\n"); - SetProgressText(strFileName + " 记录" + (lIndex + 1).ToString()); + /* + // 测试时候在这里安排跳过 + if (lIndex == 1 || lIndex == 2) + continue; +* */ - using (Stream attachment = File.Create(strTempFileName)) - { - // Debug.Assert(!(lIndex == 182 && strFileName == "20071225.log"), ""); - - - long lAttachmentLength = 0; - // 获得一个日志记录 - // parameters: - // strFileName 纯文件名,不含路径部分 - // lHint 记录位置暗示性参数。这是一个只有服务器才能明白含义的值,对于前端来说是不透明的。 - // 目前的含义是记录起始位置。 - // return: - // -1 error - // 0 file not found - // 1 succeed - // 2 超过范围 - int nRet = this.App.OperLog.GetOperLog( - "*", - strFileName, - lIndex, - lHint, - "", // level-0 - "", // strFilter - out lHintNext, - out strXml, - // ref attachment, - attachment, - out strError); - if (nRet == -1) - return -1; - if (nRet == 0) - return 0; - if (nRet == 2) - { - // 最后一条补充提示一下 - if (((lIndex - 1) % 100) != 0) - this.AppendResultText("做日志记录 " + strFileName + " " + (lIndex).ToString() + "\r\n"); - break; - } - - // 处理一个日志记录 - - if ((lIndex % 100) == 0) - this.AppendResultText("做日志记录 " + strFileName + " " + (lIndex + 1).ToString() + "\r\n"); - - /* - // 测试时候在这里安排跳过 - if (lIndex == 1 || lIndex == 2) - continue; - * */ - - nRet = DoOperLogRecord(strXml, - attachment, - out strError); - if (nRet == -1) - { - this.AppendResultText("发生错误:" + strError + "\r\n"); - return -1; - } - } + nRet = DoOperLogRecord(strXml, + // attachment, + out strError); + if (nRet == -1) + { + this.AppendResultText("发生错误:" + strError + "\r\n"); + return -1; } - - return 0; - } - finally - { - File.Delete(strTempFileName); } + + return 0; } // 执行一个日志记录的动作 int DoOperLogRecord(string strXml, - Stream attachment, + // Stream attachment, out string strError) { strError = ""; diff --git a/ZipUtil.exe b/ZipUtil.exe index 7053272d2e615c48f679f04cb98cd52c0f2d6e37..4d2d24727c9fd1bf0ad01a7b2f2cac8b99760bdc 100644 GIT binary patch delta 66 zcmZqhXz-ZO!Q4G}^2TmMF@cB!eU)5KLfj^WT0eiva{tffGhz#vK(dqbB_#zG8(!*; WG<)hY<@Bpymir~YHqVgE-~s^S!5&ip delta 66 zcmZqhXz-ZO!OWXJX=Ascn1D@0){_q|58UQ7WbPN<;q`9w8L$M`YKp W&KL7(nL2H4_u&t7H_wpF-~s@oR2-`S diff --git a/dp2Circulation/Reader/ReaderInfoForm.cs b/dp2Circulation/Reader/ReaderInfoForm.cs index 65b515b96..65f50ae51 100644 --- a/dp2Circulation/Reader/ReaderInfoForm.cs +++ b/dp2Circulation/Reader/ReaderInfoForm.cs @@ -513,7 +513,6 @@ public int LoadRecord(string strBarcode, MessageBoxDefaultButton.Button2); if (result != DialogResult.Yes) return 0; // cancelled - } this.m_nChannelInUse++; @@ -525,7 +524,6 @@ public int LoadRecord(string strBarcode, } try { - stop.OnStop += new StopEventHandler(this.DoStop); stop.Initial("正在装载读者记录 ..."); stop.BeginLoop(); @@ -651,7 +649,6 @@ public int LoadRecord(string strBarcode, if (nRet == -1) goto ERROR1; - // 接着装入对象资源 { nRet = this.binaryResControl1.LoadObject( diff --git a/dp2Circulation/Statis/ReportForm.cs b/dp2Circulation/Statis/ReportForm.cs index b23527d06..8999e29bf 100644 --- a/dp2Circulation/Statis/ReportForm.cs +++ b/dp2Circulation/Statis/ReportForm.cs @@ -7909,6 +7909,11 @@ public int TraceReturn( { strError = ""; + string strAction = DomUtil.GetElementText(domLog.DocumentElement, + "action"); + if (strAction == "read") + return 0; // read 动作并不会改变任何册记录,所以这里返回了 + //long lRet = 0; int nRet = 0; @@ -7920,6 +7925,8 @@ public int TraceReturn( return -1; } + + // 读入册记录 string strConfirmItemRecPath = DomUtil.GetElementText(domLog.DocumentElement, "confirmItemRecPath"); diff --git a/dp2Circulation/dp2Circulation.csproj b/dp2Circulation/dp2Circulation.csproj index 9d47582c4..cfb3501ef 100644 --- a/dp2Circulation/dp2Circulation.csproj +++ b/dp2Circulation/dp2Circulation.csproj @@ -51,7 +51,7 @@ dp2 V2 true publish.htm - 15 + 16 2.10.0.%2a false true diff --git a/dp2Installer/dp2Installer.csproj b/dp2Installer/dp2Installer.csproj index 847c9861f..842ea364a 100644 --- a/dp2Installer/dp2Installer.csproj +++ b/dp2Installer/dp2Installer.csproj @@ -34,7 +34,7 @@ dp2 V2 true publish.htm - 76 + 77 1.1.0.%2a false true diff --git a/dp2LibraryXE/dp2LibraryXE.csproj b/dp2LibraryXE/dp2LibraryXE.csproj index 83417d54f..95d6c86fa 100644 --- a/dp2LibraryXE/dp2LibraryXE.csproj +++ b/dp2LibraryXE/dp2LibraryXE.csproj @@ -36,7 +36,7 @@ dp2 V2 true publish.htm - 56 + 57 1.1.0.%2a false true diff --git a/dp2LibraryXE/opac_app/Browse.aspx.cs b/dp2LibraryXE/opac_app/Browse.aspx.cs index 14c5fca7a..8c8c95c5b 100644 --- a/dp2LibraryXE/opac_app/Browse.aspx.cs +++ b/dp2LibraryXE/opac_app/Browse.aspx.cs @@ -191,11 +191,12 @@ public void Page_Error(object sender, EventArgs e) // http://support.microsoft.com/kb/306355 Exception objErr = Server.GetLastError().GetBaseException(); - if (objErr is ArgumentException) + if (objErr != null && objErr is ArgumentException) { Server.ClearError(); this.SetErrorInfo("请重新点击树节点"); } +#if NO else { string err = "Error Caught in Page_Error event

" + @@ -206,6 +207,7 @@ public void Page_Error(object sender, EventArgs e) Response.Write(err.ToString()); Server.ClearError(); } +#endif } // 设置出错信息 diff --git a/dp2OPAC/Browse.aspx.cs b/dp2OPAC/Browse.aspx.cs index 14c5fca7a..8c8c95c5b 100644 --- a/dp2OPAC/Browse.aspx.cs +++ b/dp2OPAC/Browse.aspx.cs @@ -191,11 +191,12 @@ public void Page_Error(object sender, EventArgs e) // http://support.microsoft.com/kb/306355 Exception objErr = Server.GetLastError().GetBaseException(); - if (objErr is ArgumentException) + if (objErr != null && objErr is ArgumentException) { Server.ClearError(); this.SetErrorInfo("请重新点击树节点"); } +#if NO else { string err = "Error Caught in Page_Error event

" + @@ -206,6 +207,7 @@ public void Page_Error(object sender, EventArgs e) Response.Write(err.ToString()); Server.ClearError(); } +#endif } // 设置出错信息
序号类型册条码号书目摘要期限
" + (nStart + 1).ToString() + "" + HttpUtility.HtmlEncode(item.Action) + "" + HttpUtility.HtmlEncode(GetOperTypeName(item.Action)) + "" + (nStart + 1).ToString() + "" + HttpUtility.HtmlEncode(GetOperTypeName(item.Action)) + "" + HttpUtility.HtmlEncode(item.ItemBarcode) + "" + HttpUtility.HtmlEncode(strItemBarcode) + "" + HttpUtility.HtmlEncode(item.ItemBarcode) + "BC:" + HttpUtility.HtmlEncode(item.ItemBarcode) + "" + HttpUtility.HtmlEncode(strItemBarcode) + "BC:" + HttpUtility.HtmlEncode(strItemBarcode) + "