Skip to content

Commit

Permalink
增加显示当前位置,绑定根据状态限制等
Browse files Browse the repository at this point in the history
  • Loading branch information
renyh committed Nov 5, 2020
1 parent 250ef31 commit 8726d38
Show file tree
Hide file tree
Showing 10 changed files with 275 additions and 211 deletions.
2 changes: 2 additions & 0 deletions dp2weixin.service/AreaLib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ public void SaveLib(LibEntity entity)
lib.name = entity.libName;
area.libs.Add(lib);

// todo,这里有bug,会把原来配置的信息清掉

this.Save2Xml();
}
}
Expand Down
4 changes: 4 additions & 0 deletions dp2weixin.service/ChargeCommandContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public string getItemHtml(BiblioItem record)
+ "<td class='value' " + addStyle + ">" + record.location + "</td>"
+ "</tr>"
+ "<tr>"
+ "<td class='label'>当前位置</td>" //2020/11/5加
+ "<td class='value' " + addStyle + ">" + record.currentLocation + "</td>"
+ "</tr>"
+ "<tr>"
+ "<td class='label'>索取号</td>"
+ "<td class='value' " + addStyle + ">" + record.accessNo + "</td>"
+ "</tr>"
Expand Down
34 changes: 22 additions & 12 deletions dp2weixin.service/SearchBiblioResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,17 @@ public class BiblioItem

public string state { get; set; }
public string volume { get; set; }

// 馆藏地
public string location { get; set; }

// 当前位置
public string currentLocation { get; set; }

//shelfNo 法定架号
public string shelfNo { get; set; }


public string price { get; set; }

// 索引号
Expand All @@ -74,26 +84,26 @@ public class BiblioItem

//2016-6-17 jane 加借阅信息
public string borrower { get; set; }
public string borrowDate { get; set; }
public string borrowPeriod { get; set; }
public string borrowDate { get; set; }
public string borrowPeriod { get; set; }

public string reservationInfo { get; set; }
public string reservationInfo { get; set; }

public string imgHtml { get; set; }
public string imgHtml { get; set; }

public bool disable { get; set; }
public bool disable { get; set; }

public string refID { get; set; }
public string parentInfo { get; set; } //从属于,一般成员册会有该信息
public string refID { get; set; }
public string parentInfo { get; set; } //从属于,一般成员册会有该信息

public string recPath { get; set; }
public string recPath { get; set; }


public bool isGray = false;
public bool isNotCareLoc = false;
public bool isGray = false;
public bool isNotCareLoc = false;

// 2020/4/4,注意如果调api的前端传上此参数,则一定要做成属性。
public string batchNo { get; set; }
public string bookType { get; set; }
public string batchNo { get; set; }
public string bookType { get; set; }
}
}
54 changes: 53 additions & 1 deletion dp2weixin.service/dp2WeiXinService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5541,8 +5541,55 @@ public int Bind(string libId,
return -1;
}

// 把帐户信息保存到本地




// 返回的读者xml
string partonXml = result.Results[0];

// 2020//11/5 针对工行的临时方案,如果设置了状态,则不允许绑定。将来用读者库的角色来代替
{
XmlDocument dom = new XmlDocument();
dom.LoadXml(partonXml);
XmlNode root = dom.DocumentElement;

//<state>注销</state>
string strState = DomUtil.GetElementText(dom.DocumentElement, "state");
if (string.IsNullOrEmpty(strState) == false)
{
string barcode = DomUtil.GetElementText(dom.DocumentElement, "barcode");
// 调解绑
id = Guid.NewGuid().ToString();
request = new BindPatronRequest(id,
loginInfo,
"unbind",
barcode,//userItem.readerBarcode,
"",//password todo
fullWeixinId,
"multiple,null_password",
"xml");

result = connection.BindPatronTaskAsync(
lib.capoUserName,
request,
new TimeSpan(0, 1, 0),
cancel_token).Result;
if (result.Value == -1)
{
strError = result.ErrorInfo;
//return -1;
}

strError = "用户状态值不支持绑定,请联系管理员。";
return -1;
}
}




// 把帐户信息保存到本地
string recPath = result.RecPath;
nRet = this.SaveUserToLocal1(weixinId,
libId,
Expand Down Expand Up @@ -8043,6 +8090,11 @@ public long GetItemInfo(string weixinId, //为了获取libraryCode
}
}

// 当前位置
item.currentLocation = DomUtil.GetElementText(dom.DocumentElement, "currentLocation");
// 架号
item.shelfNo = DomUtil.GetElementText(dom.DocumentElement, "shelfNo");

// 索引号
item.accessNo = DomUtil.GetElementText(dom.DocumentElement, "accessNo");
// 出版日期
Expand Down
12 changes: 6 additions & 6 deletions dp2weixinP2P/Controllers/MenuController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using Senparc.Weixin.MP.Entities.Menu;
using dp2weixinWeb.Controllers;
using dp2weixin.service;
using Senparc.Weixin.MP.Containers;

namespace Senparc.Weixin.MP.Sample.Controllers
{
Expand Down Expand Up @@ -56,20 +57,19 @@ public ActionResult GetToken(string appId, string appSecret)
{
try
{
//if (!AccessTokenContainer.CheckRegistered(appId))
//{
// AccessTokenContainer.Register(appId, appSecret);
//}
//全局只需注册一次 在公众号初始化时已经注册过了
//AccessTokenContainer.RegisterAsync(appId, appSecret);

var result = Senparc.Weixin.MP.CommonAPIs.CommonApi.GetToken(appId, appSecret);//AccessTokenContainer.GetTokenResult(appId);

//也可以直接一步到位:
//var result = AccessTokenContainer.TryGetAccessToken(appId, appSecret);
return Json(result, JsonRequestBehavior.AllowGet);
}
catch (Exception)
catch (Exception ex)
{
//TODO:为简化代码,这里不处理异常(如Token过期)
return Json(new { error = "执行过程发生错误!" }, JsonRequestBehavior.AllowGet);
return Json(new { error = "执行过程发生错误!"+ex.Message }, JsonRequestBehavior.AllowGet);
}
}

Expand Down
4 changes: 4 additions & 0 deletions dp2weixinP2P/Scripts/weixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,10 @@ function getDetail(libId, recPath, obj, from,biblioName) {
+ "<td class='value' " + addStyle + ">" + record.location + "</td>"
+ "</tr>"
+ "<tr>"
+ "<td class='label'>当前位置</td>"
+ "<td class='value' " + addStyle + ">" + record.currentLocation + "</td>"
+ "</tr>"
+ "<tr>"
+ "<td class='label'>索取号</td>"
+ "<td class='value' " + addStyle + ">" + record.accessNo + "</td>"
+ "</tr>"
Expand Down
8 changes: 0 additions & 8 deletions dp2weixinP2P/Views/Biblio/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,7 @@ function loadJs(sid, jsurl, callback) {
alert("抱歉,您扫描的不是合法的ISBN条码。\n扫描返回字符串为[" + code + "],");
return;
}
//alert("扫到的isbn=" + isbn);
if (isbn != null && isbn != "") {
if (bSimple == true) {
$("#txtWordSimple").val(isbn);
Expand Down Expand Up @@ -518,10 +514,6 @@ function loadJs(sid, jsurl, callback) {
expand(expandId);
}
}, function (xhq, textStatus, errorThrown) {
// 关闭等待层
Expand Down
2 changes: 1 addition & 1 deletion dp2weixinP2P/Views/Menu/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
</div>
<div class="clear"></div>
<script src="@Url.Content("~/Scripts/jquery.form.js")"></script>
<script src="@Url.Content("~/Scripts/senparc.menu.js?a=3")"></script>
<script src="@Url.Content("~/Scripts/senparc.menu.js?a=1")"></script>
<script>
$(function () {
senparc.menu.init();
Expand Down
2 changes: 1 addition & 1 deletion dp2weixinP2P/Views/Patron/PatronRegister.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ else
<td style="width:100%">
<div class="mui-input-group" style="background-color:white">
<div class="mui-input-row">
<label style="color:#cccccc;">图书馆</label>
<label style="font-size:large">图书馆</label>
<input type="text" class="mui-input mui-input-clear" id="txtLib" readonly value="@ViewBag.PureLibName">
</div>
</div>
Expand Down
Loading

0 comments on commit 8726d38

Please sign in to comment.