var jsonFormatDesign={code:"I_HLDIMPORTDATA"};var holdId=0;var holdrow=undefined;var datafilename;var vType=5;$(function(){autoPanle();setInitPageElementData();$("#barcode").textbox("textbox").focus();$(".easyui-panel-resize").panel("resize");enterEvent("barcode",onHandlerRecord);getLayWHByResize("hldTreansLayOut");enterEvent("checkPrintBarcode",searchHoldRecord)});function autoPanle(){var a=$(window).height();var b=a-170;$(".datagrid-div").css("height",b+"px");$("#hldTreansLayOut").layout("resize")}function onMoreBarHandler(){$("#checkPrintDlg").window("open")}function searchHoldRecord(){var a=base_path+"hld/holding/getHoldingWithBib.do";var b={};if(getValue("checkPrintBarcode").length==0){getFocusHoldins();return openMessageDlg("条码号不能为空")}b.barcode=getValue("checkPrintBarcode");$.post(a,b,function(e){if(e.status=="0"){var f=e.rows[0];var c=$("#checkPrintGridList").datagrid("getRows");for(var d in c){if(c[d].barcode==f.barcode){getFocusHoldins();return openMessageDlg("条码号["+b.barcode+"]已在数据列表中,无需重复添加")}}$("#checkPrintGridList").datagrid("insertRow",{index:0,row:f});$("#checkPrintGridList").datagrid("checkRow",0);getFocusHoldins()}else{openMessageDlg(e.message);getFocusHoldins()}},"json")}function onUnCheckList(){var c=$("#checkPrintGridList").datagrid("getRows");var h=$("#checkPrintGridList").datagrid("getChecked");$("#checkPrintGridList").datagrid("uncheckAll");var f=c.length;var b=h.length;var a=new Array();for(var e=0;e=0){$(".bib-html-data").html("");deleteGridData("holdDataGridList");var b=base_path+"hld/holding/getCheckHoldBarcode.do";var c={};c.barcode=a;$.post(b,c,function(d){if(d.status=="0"){if(d.total>0){holdId=d.rows[0].id;holdrow=d.rows[0];bindDataGridListByBibId(d.rows[0].bibid,"hold");bindDataToBiBByBibId(d.rows[0].bibid);var e=["","","借出","预约/预借"];if(holdrow.status=="2"||holdrow.status=="3"){return openMessageDlg("条码处于["+e[parseInt(holdrow.status)]+"]状态,不能进行当前操作")}onHandlerMian(holdId)}else{return openMessageDlg("未找到合适的条码号")}}else{openMessageDlg(d.message)}},"json")}}function onMoreBarChangeData(){var a=$("#checkPrintGridList").datagrid("getChecked");if(a.length==0){return openMessageDlg("请选择你要调拨的数据!")}startBarChange(a,0)}function startBarChange(b,a){if(a>(b.length-1)){return}holdrow=b[a];onHandlerMian(b[a].id,b,a)}function onHandlerMian(e,d,c){if(e>0){var a={};a.id=e;a.handletype="5";if(getValue("taglibcode").length>0){a.curlibcode=getValue("taglibcode")}if(getValue("taglocation").length>0){a.curlocation=getValue("taglocation")}if(getValue("tagdoctype").length>0){a.doctype=getValue("tagdoctype")}if(getValue("changelibcode")=="1"){a.libcode=getValue("taglibcode");a.location=getValue("taglocation")}var b=base_path+"hld/holding/handleHolding.do";$.post(b,a,function(f){if(f.status=="0"){if(c!=undefined){updateMoreBarGrid(f,a,d,c,"成功");c++;startBarChange(d,c)}else{showHoldHandlerResult(f,a)}}else{if(c!=undefined){updateMoreBarGrid(f,a,d,c,addStyleHtmlNoSplit(f.message));c++;startBarChange(d,c)}else{openMessageDlg(f.message)}}},"json")}else{openMessageDlg("未找到馆藏记录号")}}function updateMoreBarGrid(b,e,h,a,i){var c="";var d="";var k=b.rows[0];c="馆际调拨";var g="";if(k){d=c+i;g=k.curlocation}else{d=addStyleHtmlNoSplit(c+"失败,"+i)}var f=h[a];var j=$("#checkPrintGridList").datagrid("getRowIndex",f);$("#checkPrintGridList").datagrid("updateRow",{index:j,row:{result:d,inlocation:g}})}function showHoldHandlerResult(d,a){var c="";var b="";var e=d.rows[0];c="馆际调拨";b=c+"成功"+getHoldOtherInfo(e,a);$("#barcode").textbox("textbox").focus().select();$(".hold-result-data").append("
"+b+"
")}function getHoldOtherInfo(d,a,c){var b="";if(a.curlibcode){b+=",文献馆由["+addStyleHtmlNoSplit(getCurLibcodeNameByCode(holdrow.curlibcode),c)+"]改为["+addStyleHtmlNoSplitGreen(getCurLibcodeNameByCode(d.curlibcode),c)+"]"}if(a.curlocation){b+=",馆藏地点由["+addStyleHtmlNoSplit(getCurLocationNameByCode(holdrow.curlocation),c)+"]改为["+addStyleHtmlNoSplitGreen(getCurLocationNameByCode(d.curlocation),c)+"]"}if(a.doctype){b+=",文献类型由["+addStyleHtmlNoSplit(getDocTypeNameByCode(holdrow.doctype),c)+"]改为["+addStyleHtmlNoSplitGreen(getDocTypeNameByCode(d.doctype),c)+"]"}return b}function getCurLibcodeNameByCode(a){return onGridShowNameBycode("orglibcode",a)}function getCurLocationNameByCode(a){return onGridShowNameBycode("taglocation",a)}function getDocTypeNameByCode(a){return onGridShowNameBycode("tagdoctype",a)}function bindDataToBiBByBibId(c){var a=base_path+"lib/biblios/get.do";var b={};b.id=c;$.post(a,b,function(d){if(d.status=="0"){setBibHtmlShow(d)}else{$(".bib-html-data").html(d.message)}},"json")}function setBibHtmlShow(d){var e=d.rows[0];var c="";var b=[{code:"title",name:"题名"},{code:"author",name:"作者"},{code:"isbn",name:"ISBN"},{code:"price",name:"价格"},{code:"classno",name:"分类号"},{code:"subject",name:"主题词"},{code:"publish",name:"出版社"},{code:"publishaddress",name:"出版地"},{code:"publishdate",name:"出版年"},{code:"callno",name:"索书号"},{code:"content",name:"内容简介"}];for(var a=0;a"+b[a].name+":"+(e[b[a].code]==null?"":e[b[a].code])+""}$(".bib-html-data").html(c)}function bindDataGridListByBibId(a,c){if(a>0){var b=base_path+"hld/holding/page.do";var d={};d.bibid=a;d.rows=10;d.page=1;$("#"+c+"DataGridList").datagrid({url:b,queryParams:d,onLoadSuccess:function(e){},method:"post"})}else{deleteGridData(""+c+"DataGridList")}}function onHldBacthHandler(){$(".acceptTextTip").show();$(".acceptTextTip").html("请选择要进行批处理的txt文件,一行一个条码");$("#hldBatchDlg").window("open")}function onPerviewData(c){$("#showPerviewOrgMarcData").html("");if(datafilename){var a=getJsonData("batch_","record");a.filename=datafilename.filelist[0];var b=base_path+"com/webuploader/perviewTextData.do";$.post(b,a,function(d){if(d.status=="0"){setDataToPageShowPerview(d)}else{if(d.status=="9003"){openMessageDlg(d.message)}else{openMessageDlg(d.message)}}},"json")}else{openMessageDlg("请检查您是否已上传文件")}}function setDataToPageShowPerview(d){var c=d.rows;if(c.length>0){var b="";for(var a=0;a"+(a+1)+","+c[a]+""}$("#showPerviewOrgMarcData").html(b)}}function onStartHldBatch(a){$(".error-msg-result").html("");if(datafilename){if(!a){$.messager.progress({title:"数据批处理",msg:"正在处理数据,请稍等..."})}var c=getJsonData("","record");if(a){c=a}else{errorcount=0;handlecount=0;successcount=0;c.opertype=vType;c.filename=datafilename.filelist[0];c.page=1;c.rows=500}c.curlibcode=c.taglibcode;c.curlocation=c.taglocation;c.doctype=c.tagdoctype;if(c.changelibcode=="1"){c.libcode=c.taglibcode;c.location=c.taglocation}var b=base_path+"hld/holding/handleHoldingByFile.do";$.post(b,c,function(d){$.messager.progress("close");if(d.status=="0"){var e=d.rows[0];if(e){errorfile=e.errorfile;errorcount+=e.errorcount;successcount+=e.successcount;handlecount+=parseInt(e.handlecount);if(e.nextfile){$.messager.progress({title:"数据批处理",msg:"已处理["+handlecount+"]条数据,请等待处理完成 ..."});c.errorfile=e.errorfile;c.filename=e.nextfile;onStartHldBatch(c)}else{$(".handlecount").html("已处理["+handlecount+"]条数据");$(".successcount").html("成功["+successcount+"]条");$(".errorcount").html("失败["+errorcount+"]条");$("#checkerrorfile").show();$("#acceptFileResultDlg").dialog("open")}}}else{openMessageDlg(d.message)}},"json").error(function(){$(".error-msg-result").html("处理数据中途错误,请查看错误文件!");$(".handlecount").html("已处理["+handlecount+"]条数据");$(".successcount").html("成功["+successcount+"]条");$(".errorcount").html("失败["+errorcount+"]条");$("#checkerrorfile").show();$("#acceptFileResultDlg").dialog("open");$.messager.progress("close")})}else{openMessageDlg("请检查您是否已上传文件")}}function onResetAcceptFormatDesignPage(){$(".acceptTextTip").show();$(".acceptTextTip").html("请选择要进行批处理的txt文件,一行一个条码");$("#showPerviewOrgMarcData").html("")}function uploadSuccessHandler(a,b){if(b.status==0){datafilename=b.rows[0]}else{openMessageDlg(b.message)}}function onResizeByNorth(b,a){if(a!=66){setLayWHByResize("hldTreansLayOut","north",b,a)}};