var selectEditBibId=0;var selectCenterBibId=0;var eidtorGridObject=undefined;var eidtorGridIndex=undefined;var libComBoxData;var locationComBoxData;var docTypeComBoxData;var initflag;var initJson;var auto_callno=null;var holdToolbar=[{text:"新增",iconCls:"e-icon fa fa-plus",handler:function(){addCheckHoldRecord()}},"-",{text:"删除",iconCls:"e-icon fa fa-remove",handler:function(){removeitEidtorGridRow()}}];var myComBib=function(){};$(function(){initJson=[{code:"page_sysid",key:"sysid",condition:"type",value:"0"},{code:"page_ctrlno",key:"ctrlno",condition:"libcode",value:vLibcode},{code:"page_z3950",key:"z3950",condition:"libcode",value:vLibcode},{code:"page_editmodel",key:"editmodel"},{code:"page_finsources,orderbib_finsources,checkbib_finsources",key:"finsources"},{code:"page_mediatype,orderbib_mediatype,checkbib_mediatype",key:"mediatype"},{code:"page_binding,orderbib_binding,checkbib_binding",key:"binding"},{code:"page_docsources,orderbib_docsources,checkbib_docsources",key:"docsources"},{code:"page_ncy,orderbib_ncy,orderbib_orderncy,checkbib_ncy,checkbib_orderncy",key:"ncy"},{code:"page_bookseller,orderbib_bookseller,checkbib_bookseller",key:"bookseller",condition:"libcode",value:vLibcode},{code:"page_location,checkhold_location",key:"location",condition:"libcode",value:vLibcode},{code:"page_doctype,checkhold_doctype",key:"doctype",condition:"libcode",value:vLibcode},{code:"orderbib_libcode,checkbib_libcode,libcodeSelect",key:"libcode",condition:"code",value:vLibcode}];var a=[{id:"checkhold_location",key:"location",condition:"libcode",value:vLibcode},{id:"bindper_doctype",key:"doctype",condition:"libcode",value:vLibcode}];initNextSelectCombobox("bindper_libcode",a);enterEvent("checkholdbarcode",addCheckHoldRecord);$("#acqDataGridList").datagrid({onSelect:onSelectAcqDataGridList});$("#centerDataGridList").datagrid({rowStyler:rowStylerIsUpdateByLibcode,onSelect:onSelectCenterDataGridList});$("#checkDataGridList").datagrid({onDblClickRow:updateCheckBib});$("#rfidDataGridList").datagrid({onSelect:onSelectRfidDataGridList})});function initCheckHold(){if(eidtorGridObject){eidtorGridObject.datagrid("loadData",[])}else{eidtorGridObject=$("#checkhold_eidtorgrid");libComBoxData=$("#checkbib_libcode").combobox("getData");locationComBoxData=$("#checkhold_location").combobox("getData");docTypeComBoxData=$("#checkhold_doctype").combobox("getData");eidtorGridObject.datagrid({iconCls:"e-icon fa fa-table",title:"验收分配列表",toolbar:holdToolbar,fit:true,fitColumns:true,singleSelect:true,border:true,nowrap:false,striped:true,onClickRow:onClickEditorRow,columns:[[{field:"id",title:"记录号",hidden:true},{field:"libcode",title:"分馆名称",width:"25%",formatter:onShowLibName,editor:{type:"combobox",options:{valueField:"code",textField:"name",panelHeight:"auto",required:true,data:libComBoxData,onChange:function(e,d){if(e!=undefined&&e!=d){if(eidtorGridIndex!=undefined){var f=eidtorGridObject.datagrid("getEditor",{index:eidtorGridIndex,field:"location"});var b={key:"location",condition:"libcode",value:e};var c=base_path+"par/common/getInitData.do";$.post(c,b,function(g){$(f.target).combobox("loadData",g.rows)},"json");var a=eidtorGridObject.datagrid("getEditor",{index:eidtorGridIndex,field:"doctype"});b={key:"doctype",condition:"libcode",value:e};var c=base_path+"par/common/getInitData.do";$.post(c,b,function(g){$(a.target).combobox("loadData",g.rows)},"json")}}}}}},{field:"location",title:"馆藏地点",width:"25%",formatter:onShowLocationName,editor:{type:"combobox",options:{valueField:"code",textField:"name",panelHeight:"auto",groupField:"group",required:true,data:locationComBoxData}}},{field:"doctype",title:"文献类型",width:"25%",formatter:onShowDocTypeName,editor:{type:"combobox",options:{valueField:"code",textField:"name",panelHeight:"auto",groupField:"group",required:true,data:docTypeComBoxData}}},{field:"barcode",title:"条码号",width:"25%",editor:{type:"text",options:{required:true}}}]]})}}function updateOrderBib(e,b){var d=$("#tabsGrid").tabs("getSelected");var c=d.panel("options").title;var a=0;if(c.indexOf("审校")>-1){a=1}orderBibRecord(b,a)}function updateCheckBib(e,b){var d=$("#tabsGrid").tabs("getSelected");var c=d.panel("options").title;var a=0;if(c.indexOf("审校")>-1){a=1}checkBibRecord(b,a)}function onSelectCenterDataGridList(b,a){if(!isUpdateByLibcode(a.libcode)){$("#centerOrderBibRecord").linkbutton({disabled:true});$("#centerOrderCheckBibRecord").linkbutton({disabled:true});$("#centerCheckBibRecord").linkbutton({disabled:true})}else{$("#centerOrderBibRecord").linkbutton({disabled:false});$("#centerOrderCheckBibRecord").linkbutton({disabled:false});$("#centerCheckBibRecord").linkbutton({disabled:false})}$("#centerOrderBibRecord").show();$("#centerOrderCheckBibRecord").show();$("#centerCheckBibRecord").show();$("#searchZ3950MarcGird").hide();$("#z3950DownLoadToAddEditGrid").hide();selectCenterBibId=a.id;$(".showBibGrid-tip").html("书目记录号【"+a.id+"】");showDataGridDetailById(a.id,"centerDataGridDetail");$("#centerDataGridDetail").datagrid("getPanel").panel("setTitle","已审校书目数据");onSelectGridDataChangeTabsTitle()}function onSelectAcqDataGridList(b,a){if(!isUpdateByLibcode(a.libcode)){setBntIsShowByLibcode(true)}else{setBntIsShowByLibcode(false)}bindAcqDataGridDetailById(a.id);onSelectGridDataChangeTabsTitle()}function onSelectGridDataChangeTabsTitle(b){var c=$("#tabsGrid").tabs("getSelected");var a=$("#tabsGrid").tabs("getTabIndex",c);setSelectTabsGridTitle(a,b)}function clearComBibGridData(){selectEditBibId=0;selectCenterBibId=0;clearGridData("editBibGrid,centerDataGridDetail,acqDataGridList,centerDataGridList,orderDataGridList,checkDataGridList,holdDataGridList");$("#tabsGrid").tabs("select",0)}function onSelectTabsGrid(b,a){onSelectGridDataChangeTabsTitle("deleteGridData");if(a==2){$("#cancelOrderBibRecord").show();$("#deleteOrderBib").show();$("#deleteCheckBib").hide()}else{if(a==3){$("#cancelOrderBibRecord").hide();$("#deleteOrderBib").hide();$("#deleteCheckBib").show()}else{$("#cancelOrderBibRecord").hide();$("#deleteOrderBib").hide();$("#deleteCheckBib").hide()}}}function setSelectTabsGridTitle(a,i){var m=$("#orderbib_type").val();var f="(采编)";var b=$("#tabsGrid").tabs("getSelected");var c=$("#tabsGrid").tabs("getTabIndex",b);var g=b.panel("options").title;if(a==2||a==3||a==4){var j="order";if(a==3){j="check"}if(a==4){j="hold"}if(i){if(g.indexOf(f)>-1){bindDataGridListByBibId(selectEditBibId,j)}else{bindDataGridListByBibId(selectCenterBibId,j)}}}if(c==0||c==1){for(var h=2;h<=4;h++){if(c==1){f="(审校)"}var l="";if(h==2){l="订购"}else{if(h==3){l="验收"}else{if(h==4){l="馆藏"}}}var e=f+l+"列表";var d=$("#tabsGrid").tabs("getTab",h);$("#tabsGrid").tabs("update",{tab:d,options:{title:e}})}}$("#orderbib_type").val("")}function bindDataGridListByBibId(a,c){if(a>0){var b=base_path+"acq/"+c+"/page.do";if(c=="hold"){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 searchCenterDataGridList(e,b){var d=0;var g=$("#centerDataGridList").datagrid("getSelected");if(g){d=$("#centerDataGridList").datagrid("getRowIndex",g)}var c=base_path+"lib/biblios/page.do";var f={};f.rows=10;f.page=1;f.condition=getValue("bibindex");f.value=getValue("keyword");f["limit[0].condition"]="status";f["limit[0].value"]="1";f["limit[1].condition"]="sysid";f["limit[1].value"]=getValue("page_sysid");var h=$("#libcodeSelect");if(h.length>0&&getValue("libcodeSelect").length>0){f["limit[2].condition"]="libcode";f["limit[2].value"]=getValue("libcodeSelect")}var a=$("#orderbatchno");if(a.length>0&&getValue("orderbatchno").length>0){f["limit[3].condition"]="ORDBATCHNO";f["limit[3].value"]=getValue("orderbatchno")}if(e){f.condition=e;f.value=b}$("#centerDataGridList").datagrid({url:c,queryParams:f,onLoadSuccess:function(i){if(i.total>0){$("#centerDataGridList").datagrid("selectRow",d)}else{$("#tabsGrid").tabs("select",0)}},method:"post"})}function addBibRecord(){selectEditBibId=0;if(pageConfigIsNull()){clearComBibGridData();var b=getValue("page_template");if(b){var a=base_path+"par/template/getTemplate.do?pk="+b;var c={};$.post(a,c,function(f){if(f.status=="0"){if(f.total>0){var d=jQuery.parseJSON(f.rows[0].paramjson);var e=d.rows;$("#editBibGrid").datagrid("loadData",e);insertCtrlNo()}}else{openMessageDlg(f.message)}},"json")}}}function deleteBibRecord(){var a=$("#acqDataGridList").datagrid("getSelected");if(!a){return openMessageDlg("请先选择一条书目信息,进行删除")}openConfirmDlg("您确定要删除记录号为["+selectEditBibId+"]的书目数据吗?",null,deleteBibRecordResult,null)}function deleteBibRecordResult(){var a=base_path+"lib/biblios/delete.do";var b={};b.id=selectEditBibId;$.post(a,b,function(c){if(c.status=="0"){repeatSerachBib("delete");openMessageDlg(c.message)}else{openMessageDlg(c.message)}},"json")}function acceptBibRecord(){if(selectEditBibId>0){var c=$("#acqDataGridList").datagrid("getSelected");if(!c.classno){return openMessageDlg("你要进行审校操作书目信息没有分类号,请完善书目信息才能进行审校操作!")}var a=base_path+"lib/biblios/update.do";var b={};b.id=selectEditBibId;b.status="1";$.post(a,b,function(d){if(d.status=="0"){$("#editBibGrid").datagrid("loadData",[]);$(".showBibGrid-tip").html("书目记录号【"+selectEditBibId+"】");showDataGridDetailById(selectEditBibId,"centerDataGridDetail");serachBib();openMessageDlg(d.message)}else{openMessageDlg(d.message)}},"json")}}function copyFLdToLeftScreen(e){var d=$("#centerDataGridDetail").datagrid("getSelections");if(d.length>0){for(var c=0;c0){$("#editBibGrid").datagrid("loadData",[]);for(var b=0;b0){c=base_path+"acq/order/update.do"}$.post(c,b,function(d){if(d.status=="0"){openMessageDlg(d.message,5000);bindDataGridListByBibId(b.bibid,"hold");$("#orderbib_dlg").dialog("close");$("#tabsGrid").tabs("select",2)}else{openMessageDlg(d.message)}},"json")}function deleteOrderBib(){var a=$("#orderDataGridList").datagrid("getSelected");if(!a){return openMessageDlg("请先选择一条订购信息,进行删除")}openConfirmDlg("您确定要删除记录号为["+a.id+"]的订购数据吗?",null,deleteOrderBibResult,null)}function deleteOrderBibResult(){var c=$("#orderDataGridList").datagrid("getSelected");var b={};b.pk=c.id;var a=base_path+"acq/order/delete.do";$.post(a,b,function(d){if(d.status=="0"){openMessageDlg(d.message,5000);bindDataGridListByBibId(c.bibid,"order")}else{openMessageDlg(d.message)}},"json")}function checkBibRecord(f,e,d){initCheckHold();var b="(采编)";if(e==1){b="(审校)"}if(!f){cleanJsonData("checkbib_record");if(getValue("page_check_batchno").length==0){return openMessageDlg("请点击页面设置,在采访参数页面中设置验收批号")}var a=$("#acqDataGridList").datagrid("getSelected");if(e==1){a=$("#centerDataGridList").datagrid("getSelected")}if(!a&&e==0){return checkBibRecord(f,"1",d)}var c=getCurDateYMD();setValue("checkbib_checkdate",c);if(d==0){b=b+"订购验收";var g=$("#orderDataGridList").datagrid("getSelected");if(!g){return openMessageDlg("请先选择一条订购信息,进行订购验收")}g.classno=a.classno;getCallnoToCheckCallno(g,e,b,d)}else{if(d==1){b=b+"到书验收";if(!a){if(e==0){return openMessageDlg("请先选择一条采编书目,进行到书验收")}else{return openMessageDlg("请先选择一条审校书目,进行到书验收")}}if(!a.classno){return openMessageDlg("你要进行到书验收的书目信息没有分类号,请完善书目信息才能进行到书验收!")}getCallnoToCheckCallno(a,e,b,d)}}}else{if(f.orderid>0){b=b+"订购验收"}else{b=b+"到书验收"}setHoldToLoc(f.id);gridDataToDlgData(f,"checkbib_",b)}}function setHoldToLoc(c){var a=base_path+"hld/holding/page.do";var b={};b.checkid=c;b.rows=100;b.page=1;eidtorGridObject.datagrid({url:a,queryParams:b,onLoadSuccess:function(d){},method:"post"})}function getCallnoToCheckCallno(b,d,a,c){var e=base_path+"cat/titlenum/getCurCallno.do";var f={};f.classno=b.classno;f.bibid=!b.bibid?b.id:b.bibid;$.post(e,f,function(h){if(h.status=="0"){var g=h.rows[0];auto_callno=g.auto_callno;if(h.total==0){setValue("checkbib_callno",b.classno+"/1")}else{setValue("checkbib_callno",g.classno+"/"+g.titnum)}if(c==1){bibDataToDlgData(b,d,"checkbib_",a);setValue("checkbib_orderid",0)}else{if(c==0){b.orderid=b.id;b.id=0;b.batchno=getValue("page_check_batchno");gridDataToDlgData(b,"checkbib_",a)}}}else{openMessageDlg(h.message)}},"json")}function saveCheckBib(){acceptEidtorGrid();var a=eidtorGridObject.datagrid("getRows");var c="";for(var b=0;b0&&a.substr(a.length-1,1)=="/"){var b=$("#checkbib_dlg").panel("options").title;if(b.includes("(采编)")){c=$("#acqDataGridList").datagrid("getSelected")}else{c=$("#centerDataGridList").datagrid("getSelected")}a=a.substr(0,a.length-1);c.classno=a;getCallnoToCheckCallno(c)}else{openMessageDlg("格式为[分类号/]的才能分配索书号,例:A1/")}}function setCheckHold(){if(getValue("checkbib_copies")>0){initCheckHold();var f=[];var c=getValue("checkbib_hold");if(c.length>0){var b=c.split(",");for(var d=0;d10){var e=b[d].split(":");var a={};a.id=e[0];a.libcode=e[1];a.location=e[2];a.doctype=e[3];a.barcode=e[4];f.push(a)}}}eidtorGridObject.datagrid("loadData",f);setValue("checkbib_libcode",getValue("checkbib_libcode"));setValue("checkhold_location",getValue("page_location"));setValue("checkhold_doctype",getValue("page_doctype"));$("#check_hold_dlg").dialog("open")}else{return openMessageDlg("请输入验收副本数!")}}function onLoadSuccessByHold(b){var a=[];if(b.total==0){eidtorGridObject.datagrid("loadData",a)}}function onOpenCheckHoldDlg(){$("#checkholdbarcode").textbox("textbox").focus()}function addCheckHoldRecord(){var f={};f.libcode=getValue("checkbib_libcode");f.location=getValue("checkhold_location");f.doctype=getValue("checkhold_doctype");f.barcode=getValue("checkholdbarcode");if(f.barcode.length==0){return openMessageDlg("条码号不能为空!")}var a=eidtorGridObject.datagrid("getRows");for(var e=0;e-1){var d=f.barcode.split("-");var c=d[1];var b=d[0];setHoldAutoBarcode(f,c,b,0)}else{setHoldbySearchBarcode(f)}$("#checkholdbarcode").textbox("textbox").focus().select()}function setHoldAutoBarcode(f,d,b,a){if(parseInt(a)>=parseInt(d)){return}if(parseInt(d)>getValue("checkbib_copies")){return openMessageDlg("分配的条码不能大于验收的副本数!")}if(parseInt(d)>0){var c=base_path+"hld/holding/getCheckHoldBarcode.do";var e={};e.barcode=b;e.loantime="999";$.post(c,e,function(h){if(h.status=="0"){if(h.total==0){var g={};g.libcode=f.libcode;g.location=f.location;g.doctype=f.doctype;g.barcode=b;appendEidtorGridRow(g);a=a+1}b=addOne(b);setHoldAutoBarcode(f,d,b,a)}else{openMessageDlg(h.message)}},"json")}}function setHoldbySearchBarcode(c){var b={};b.barcode=c.barcode;b.loantime="999";var a=base_path+"hld/holding/getCheckHoldBarcode.do";$.post(a,b,function(d){if(d.status=="0"){if(d.total>0){openMessageDlg("此条码号已存在!")}else{appendEidtorGridRow(c)}}else{openMessageDlg(d.message)}},"json")}function saveCheckHoldRecord(){acceptEidtorGrid();var a=eidtorGridObject.datagrid("getRows");var c="";for(var b=0;b0){$("#tabsGrid").tabs("select",6)}},method:"post"})}function onSelectRfidDataGridList(a,b){$("#centerDataGridDetail").datagrid("getPanel").panel("setTitle","阿法迪资源详细书目信息");$("#centerDataGridDetail").datagrid("loadData",b.marcrows)};