Skip to content

Commit

Permalink
dp2circulation 增加全局选择当前操作馆代码的列表。修改多处验证条码号的代码,使用这个当前馆代码来作为验证函数的第一参数
Browse files Browse the repository at this point in the history
  • Loading branch information
DigitalPlatform committed Apr 18, 2016
1 parent ffc3c35 commit a8046f3
Show file tree
Hide file tree
Showing 17 changed files with 183 additions and 32 deletions.
4 changes: 2 additions & 2 deletions dp2Circulation/Charging/ChargingForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,7 @@ public void DoLoadReader()
// 1 是合法的读者证条码号
// 2 是合法的册条码号
nRet = VerifyBarcode(
this.Channel.LibraryCodeList,
this.MainForm.FocusLibraryCode, // this.Channel.LibraryCodeList,
this.textBox_readerBarcode.Text,
out strError);
if (nRet == -1)
Expand Down Expand Up @@ -1988,7 +1988,7 @@ public int DoItemAction()
// 1 是合法的读者证条码号
// 2 是合法的册条码号
nRet = VerifyBarcode(
this.Channel.LibraryCodeList,
this.MainForm.FocusLibraryCode, // this.Channel.LibraryCodeList,
this.textBox_itemBarcode.Text,
out strError);
if (nRet == -1)
Expand Down
1 change: 1 addition & 0 deletions dp2Circulation/Charging/QuickChargingForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions dp2Circulation/Charging/QuickChargingForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,10 @@ private void QuickChargingForm_Load(object sender, EventArgs e)
SetReaderHtmlString("(空)");
}

this.BeginInvoke(new Action(FillLibraryCodeListMenu));
// this.BeginInvoke(new Action(FillLibraryCodeListMenu));
}

#if NO
string _focusLibraryCode = "";

// 当前操作所针对的分馆 代码
Expand Down Expand Up @@ -225,6 +226,8 @@ void item_Click(object sender, EventArgs e)
FocusLibraryCode = item.Tag as string;
}

#endif

void m_webExternalHost_readerInfo_OutputDebugInfo(object sender, OutputDebugInfoEventArgs e)
{
if (_floatingMessage != null)
Expand Down Expand Up @@ -1555,7 +1558,7 @@ void _doAction(FuncState func,
// 1 是合法的读者证条码号
// 2 是合法的册条码号
int nRet = VerifyBarcode(
this.FocusLibraryCode, // this.Channel.LibraryCodeList,
this.MainForm.FocusLibraryCode, // this.Channel.LibraryCodeList,
strText,
out strError);
if (nRet == -2)
Expand Down
6 changes: 3 additions & 3 deletions dp2Circulation/Charging/QuickChargingForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAC4
CQAAAk1TRnQBSQFMAgEBAgEAAWQBAAFkAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CQAAAk1TRnQBSQFMAgEBAgEAAWwBAAFsAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
Expand Down Expand Up @@ -189,7 +189,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy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AQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
Expand Down
10 changes: 9 additions & 1 deletion dp2Circulation/Entity/EntityControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public bool NeedVerifyItemBarcode
/// <summary>
/// 形式校验条码号
/// </summary>
/// <param name="strLibraryCode">册所在的图书馆代码</param>
/// <param name="strBarcode">册条码号</param>
/// <param name="strError">返回出错信息</param>
/// <returns>
Expand All @@ -82,7 +83,9 @@ public bool NeedVerifyItemBarcode
/// <para> 1 是合法的读者证条码号</para>
/// <para> 2 是合法的册条码号</para>
/// </returns>
public int DoVerifyBarcode(string strBarcode,
public int DoVerifyBarcode(
string strLibraryCode,
string strBarcode,
out string strError)
{
if (this.VerifyBarcode == null)
Expand All @@ -93,6 +96,7 @@ public int DoVerifyBarcode(string strBarcode,

VerifyBarcodeEventArgs e = new VerifyBarcodeEventArgs();
e.Barcode = strBarcode;
e.LibraryCode = strLibraryCode;
this.VerifyBarcode(this, e);
strError = e.ErrorInfo;
return e.Result;
Expand Down Expand Up @@ -3618,6 +3622,10 @@ public delegate void VerifyBarcodeHandler(object sender,
/// </summary>
public class VerifyBarcodeEventArgs : EventArgs
{
/// <summary>
/// 馆代码
/// </summary>
public string LibraryCode = "";
/// <summary>
/// 条码号
/// </summary>
Expand Down
8 changes: 6 additions & 2 deletions dp2Circulation/Entity/EntityEditForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ internal override int FinishVerify(out string strError)
strError = "";
int nRet = 0;

// TODO: 将来这里要允许使用整个 location 字符串,而不仅仅是馆代码,来发起条码号校验
string strLocation = this.entityEditControl_editing.LocationString;
string strLibraryCode = Global.GetLibraryCode(StringUtil.GetPureLocation(strLocation));

string strBarcode = this.entityEditControl_editing.Barcode;

// 检查册条码号形式是否合法
Expand All @@ -236,6 +240,7 @@ internal override int FinishVerify(out string strError)
// 1 是合法的读者证条码号
// 2 是合法的册条码号
nRet = this.EntityControl.DoVerifyBarcode(
strLibraryCode,
strBarcode,
out strError);
if (nRet == -1)
Expand All @@ -261,14 +266,13 @@ internal override int FinishVerify(out string strError)
}

// 馆藏地点字符串里面不能有星号
string strLocation = this.entityEditControl_editing.LocationString;
// string strLocation = this.entityEditControl_editing.LocationString;
if (strLocation.IndexOf("*") != -1)
{
strError = "馆藏地点字符串中不允许出现字符 '*'";
goto ERROR1;
}


// 价格字符串中不允许出现 @
string strPrice = this.entityEditControl_editing.Price;
if (strPrice.IndexOf("@") != -1)
Expand Down
6 changes: 3 additions & 3 deletions dp2Circulation/EntityForm/EntityForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1993,7 +1993,7 @@ void item_barcode_dlg_VerifyBarcode(object sender, VerifyBarcodeEventArgs e)
{
string strError = "";
e.Result = this.VerifyBarcode(
this.CurrentLibraryCodeList,
e.LibraryCode, // this.CurrentLibraryCodeList,
e.Barcode,
out strError);
e.ErrorInfo = strError;
Expand Down Expand Up @@ -2202,7 +2202,7 @@ void entityControl1_VerifyBarcode(object sender, VerifyBarcodeEventArgs e)
{
string strError = "";
e.Result = this.VerifyBarcode(
this.CurrentLibraryCodeList,
e.LibraryCode, // this.CurrentLibraryCodeList,
e.Barcode,
out strError);
e.ErrorInfo = strError;
Expand Down Expand Up @@ -9767,7 +9767,7 @@ public void DoRegisterEntity()
// 1 是合法的读者证条码号
// 2 是合法的册条码号
nRet = VerifyBarcode(
this.CurrentLibraryCodeList,
this.MainForm.FocusLibraryCode, // this.CurrentLibraryCodeList,
this.textBox_itemBarcode.Text,
out strError);
if (nRet == -1)
Expand Down
7 changes: 6 additions & 1 deletion dp2Circulation/EntityRegister/BiblioAndEntities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1825,6 +1825,7 @@ public int VerifyEntities(
// 1 是合法的读者证条码号
// 2 是合法的册条码号
nRet = this.DoVerifyBarcode(
Global.GetLibraryCode(StringUtil.GetPureLocation(edit.LocationString)),
edit.Barcode,
out strError);
if (nRet == -1)
Expand Down Expand Up @@ -1873,6 +1874,7 @@ public int VerifyEntities(
/// <summary>
/// 形式校验条码号
/// </summary>
/// <param name="strLibraryCode">馆代码</param>
/// <param name="strBarcode">册条码号</param>
/// <param name="strError">返回出错信息</param>
/// <returns>
Expand All @@ -1882,7 +1884,9 @@ public int VerifyEntities(
/// <para> 1 是合法的读者证条码号</para>
/// <para> 2 是合法的册条码号</para>
/// </returns>
public int DoVerifyBarcode(string strBarcode,
public int DoVerifyBarcode(
string strLibraryCode,
string strBarcode,
out string strError)
{
if (this.VerifyBarcode == null)
Expand All @@ -1893,6 +1897,7 @@ public int DoVerifyBarcode(string strBarcode,

VerifyBarcodeEventArgs e = new VerifyBarcodeEventArgs();
e.Barcode = strBarcode;
e.LibraryCode = strLibraryCode;
this.VerifyBarcode(this, e);
strError = e.ErrorInfo;
return e.Result;
Expand Down
2 changes: 1 addition & 1 deletion dp2Circulation/EntityRegister/EntityRegisterWizard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void _biblio_VerifyBarcode(object sender, VerifyBarcodeEventArgs e)
{
string strError = "";
e.Result = this.VerifyBarcode(
this.Channel.LibraryCodeList,
e.LibraryCode, //this.Channel.LibraryCodeList,
e.Barcode,
out strError);
e.ErrorInfo = strError;
Expand Down
3 changes: 3 additions & 0 deletions dp2Circulation/FontSetting/MyForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ public string CurrentUserName
}
}

// 当前用户能管辖的一个或者多个馆代码
public string CurrentLibraryCodeList
{
get
Expand Down Expand Up @@ -425,6 +426,7 @@ public virtual void Channel_AfterLogin(object sender, AfterLoginEventArgs e)
this.MainForm.Channel_AfterLogin(sender, e); // 2015/11/4 原来是 this
}

#if NO
// 获得全部可用的图书馆代码。注意,并不包含 "" (全局)
public int GetAllLibraryCodes(out List<string> library_codes,
out string strError)
Expand All @@ -444,6 +446,7 @@ public int GetAllLibraryCodes(out List<string> library_codes,

return 0;
}
#endif

#endregion

Expand Down
99 changes: 98 additions & 1 deletion dp2Circulation/MainForm/InitialExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2158,7 +2158,7 @@ bool InitialProperties(bool bFullInitial, bool bRestoreLastOpenedWindow)
if (nRet == -1)
goto END1;

// 只有在前一步没有错出的情况下才探测版本号
// 只有在前一步没有出错的情况下才探测版本号
if (nRet == 0)
{
// 检查dp2Library版本号
Expand Down Expand Up @@ -2268,6 +2268,8 @@ bool InitialProperties(bool bFullInitial, bool bRestoreLastOpenedWindow)
nRet = CheckServerClock(false, out strError);
if (nRet != 0)
MessageBox.Show(this, strError);

this.BeginInvoke(new Action(FillLibraryCodeListMenu));
}
finally
{
Expand Down Expand Up @@ -4895,5 +4897,100 @@ int CheckServerClock(bool bPrepareSearch,
return 0;
}

string _focusLibraryCode = "";

// 当前操作所针对的分馆 代码
// 注: 全局用户可以操作任何分管,和总馆,通过此成员,可以明确它当前正在操作哪个分馆,这样可以明确 VerifyBarcode() 的 strLibraryCodeList 参数值
public string FocusLibraryCode
{
get
{
return _focusLibraryCode;
}
set
{
this._focusLibraryCode = value;
string strName = string.IsNullOrEmpty(value) == true ? "[总馆]" : value;
this.toolStripDropDownButton_selectLibraryCode.Text = "选择分馆 " + strName;
}
}

void FillLibraryCodeListMenu()
{
string strError = "";
List<string> all_library_codes = null;
int nRet = this.GetAllLibraryCodes(out all_library_codes, out strError);

List<string> library_codes = new List<string>();
if (Global.IsGlobalUser(_currentLibraryCodeList) == true)
{
library_codes = all_library_codes;
library_codes.Insert(0, "");
}
else
library_codes = StringUtil.SplitList(_currentLibraryCodeList);

this.toolStripDropDownButton_selectLibraryCode.DropDownItems.Clear();
foreach (string library_code in library_codes)
{
string strName = library_code;
if (string.IsNullOrEmpty(strName) == true)
strName = "[总馆]";
ToolStripItem item = new ToolStripMenuItem(strName);
item.Tag = library_code;
item.Click += item_Click;
this.toolStripDropDownButton_selectLibraryCode.DropDownItems.Add(item);
}

// 默认选定第一项
if (this.toolStripDropDownButton_selectLibraryCode.DropDownItems.Count > 0)
item_Click(this.toolStripDropDownButton_selectLibraryCode.DropDownItems[0], new EventArgs());
}

void item_Click(object sender, EventArgs e)
{
ToolStripMenuItem item = (ToolStripMenuItem)sender;
foreach (ToolStripMenuItem current in this.toolStripDropDownButton_selectLibraryCode.DropDownItems)
{
if (current != item && current.Checked == true)
current.Checked = false;
}
item.Checked = true;
FocusLibraryCode = item.Tag as string;
}

// 获得全部可用的图书馆代码。注意,并不包含 "" (全局)
public int GetAllLibraryCodes(out List<string> library_codes,
out string strError)
{
strError = "";
library_codes = new List<string>();

LibraryChannel channel = this.GetChannel();
Stop.OnStop += new StopEventHandler(this.DoStop);
Stop.Initial("正在获得全部馆代码 ...");
Stop.BeginLoop();
try
{
string strValue = "";
long lRet = channel.GetSystemParameter(Stop,
"system",
"libraryCodes",
out strValue,
out strError);
if (lRet == -1)
return -1;
library_codes = StringUtil.SplitList(strValue);
return 0;
}
finally
{
Stop.EndLoop();
Stop.OnStop -= new StopEventHandler(this.DoStop);
Stop.Initial("");
this.ReturnChannel(channel);
}
}

}
}
Loading

0 comments on commit a8046f3

Please sign in to comment.