var eidtorGridObject=undefined;var eidtorGridIndex=undefined;var callNoItemList;var barcodeItemList;var autoBarRows;var autoAssetnoRows;var autoSelect=true;var holdToolbar=[{text:"删除",iconCls:"e-icon fa fa-remove",handler:function(){removeitEidtorGridRow()}},"-",{text:"清空",iconCls:"e-icon fa fa-repeat",handler:function(){$("#checkhold_eidtorgrid").datagrid("loadData",[])}},"-",{text:"按复本数自动生成条码号",iconCls:"e-icon fa fa-th-list",handler:function(){$("#checkhold_eidtorgrid").datagrid("loadData",[]);autoBarcodeByCopies()}},"-",{text:"按复本数规则自动分配馆藏地点",iconCls:"e-icon fa fa-bars",plain:false,handler:function(){$("#checkhold_eidtorgrid").datagrid("loadData",[]);autoBarcodeByCopiesGridList()}},"-",{text:"从marc数据中提取条码号进行分配",iconCls:"e-icon fa fa-bars",plain:false,handler:function(){$("#checkhold_eidtorgrid").datagrid("loadData",[]);autoBarcodeByMarcFld()}}];var _checkBibObj=function(){};var _configData;var initJson;var auto_callno=null;var _initdata;var ncyAutoSelect=false;$(function(){getMyStorageItemData();_bibPVG.prototype.batchnoComBox("batchno",1,"bookseller",null,vLibcode);initJson=[{code:"finsources",key:"finsources"},{code:"mediatype",key:"mediatype"},{code:"binding",key:"binding"},{code:"docsources",key:"docsources"},{code:"ncy,orderncy",key:"ncy"},{code:"operid",key:"operid"},{code:"bookseller",key:"bookseller",condition:"libcode",value:vLibcode},{code:"libcode",key:"libcode",condition:"code",value:vLibcode},{code:"location",key:"location",condition:"libcode",value:vLibcode},{code:"doctype",key:"doctype",condition:"libcode",value:vLibcode}];initJson.forEach(function(f,g,h){if(_initdata.rows[0][f.key]){_myPage.prototype.setData(_initdata.rows[0][f.key],f)}});$(".easyui-panel").panel("resize");_checkBibObj.prototype.search();$("#barcode").textbox("textbox").keydown(function(f){if(f.keyCode==13){_checkBibObj.prototype.addHoldRecord()}}).bind("keyup",function(g){var f=JSON.parse(_configData.rows[0].paramjson);if(f.barcoderule&&f.barcoderule=="0"){$("#barcode").textbox("setValue",$(this).val().replace(/[^\d-]/g,""))}else{if(f.barcoderule&&f.barcoderule=="1"){$("#barcode").textbox("setValue",$(this).val().replace(/[^\dA-Za-z0-9-]/g,""))}}});enterEvent("callno",_checkBibObj.prototype.updataCallno);for(var e in tooltipJson){var c=tooltipJson[e];var d="";d+="";d+="";d+="";for(var b in c.tipList){d+="";d+="";d+=""}d+="
";d+=c.name+"回车生成:";d+="
";d+=c.tipList[b].data;d+="
";$("#"+c.code+"Tooltip").tooltip({content:d});_bibPVG.prototype.enterEvent(c.code,_bibPVG.prototype.setPriceApp)}$("#ncy,#orderncy").combobox({onChange:function(g,f){if(ncyAutoSelect){_bibPVG.prototype.getDataForPrice("");ncyAutoSelect=false}else{_bibPVG.prototype.getRateApp("")}},onClick:function(g,f){ncyAutoSelect=true}});var a={code:"location",unionlist:[{code:"defdoctype",orgcode:"doctype"}]};_myPage.prototype.initUnionShowByLocation(a);_myPage.prototype.initUnionLocationByLibcode()});function onOrderTotalPriceEnterFun(){var a=getValue("volumes");if(a>0){setValue("orderprice",parseFloat(getValue("ordertotalprice")/a).toFixed(2))}else{setValue("orderprice",getValue("ordertotalprice"))}}function onTotalPriceEnterFun(){var a=getValue("volumes");if(a>0){setValue("price",parseFloat(getValue("totalprice")/a).toFixed(2))}else{setValue("price",getValue("totalprice"))}_bibPVG.prototype.rate("")}function onPriceEnterFun(){var a=getValue("volumes");if(a>0){setValue("totalprice",getValue("price")*a)}else{setValue("totalprice",getValue("price"))}_bibPVG.prototype.rate("")}function onVolumesPriceEnterFun(){var a=getValue("volumes");if(a>0){setValue("price",parseFloat(getValue("totalprice")/a).toFixed(2))}else{setValue("price",getValue("totalprice"))}_bibPVG.prototype.rate("")}function onOrderPriceEnterFun(){var a=getValue("volumes");if(a>0){setValue("ordertotalprice",parseFloat(getValue("orderprice")*a).toFixed(2))}else{setValue("ordertotalprice",getValue("orderprice"))}}_checkBibObj.prototype.batchno=function(){if($("#batchno").length>0){var b={type:"1",page:"1",rows:"500",status:"0"};b.orderBy=" CREATEDATE desc ,CODE desc";var a=base_path+"par/batchno/page.do";$.post(a,b,function(h){var g=[];for(var e=0;e-1){f.push(c[d])}}$("#location").combobox("loadData",f);var h={};h["limit[0].condition"]="code";h["limit[0].typeHandler"]="3";h["limit[0].value"]=getSqlConditionLimitIn(g.showacqloccode);var b=base_path+"par/location/list.do";$.post(b,h,function(o){var n=o.rows;_myLocationData=n;var p=_initdata.rows[0].libcode;var l=[];for(var m=0;m0){a=base_path+"acq/check/get.do";b.pk=_id}if(parseInt(_orderid)>0){a=base_path+"acq/order/get.do";b.pk=_orderid}$.post(a,b,function(c){if(c.status=="0"){_checkBibObj.prototype.set(c)}else{openMessageDlg(c.message)}},"json")};_checkBibObj.prototype.setDataToHoldGrid=function(c){eidtorGridObject=$("#checkhold_eidtorgrid");if(_id>0){var a=base_path+"hld/holding/page.do";var b={};b.checkid=c;b.rows=10000;b.page=1;eidtorGridObject.datagrid({url:a,queryParams:b,onLoadSuccess:function(d){},method:"post"})}else{eidtorGridObject.datagrid("loadData",[])}};_checkBibObj.prototype.set=function(f){var l=JSON.parse(_configData.rows[0].paramjson);if(l.discount){setValue("discount",l.discount)}eidtorGridObject.datagrid("loadData",[]);var k=f.rows[0];if(parseInt(_id)>0){setJsonData(null,k);_checkBibObj.prototype.setDataToHoldGrid(k.id);$(".checkbib_tip").html("提示:请您确认当前验收记录号【"+_id+"】")}else{if(parseInt(_orderid)>0){k.id=0;k.orderid=_orderid;setJsonData(null,k);k.classno=mystorage.get("cat_classno");_bibPVG.prototype.getCallno(f.rows[0],"callno");if(l.check_batchno){setValue("batchno",l.check_batchno);_bibPVG.prototype.getDataByBatchno(l.check_batchno)}if(l.location){setValue("location",l.location)}if(l.doctype){setValue("doctype",l.doctype)}setValue("libcode",vLibcode);$(".checkbib_tip").html("提示:请您确认当前订购记录号【"+_orderid+"】")}else{var b=parent.getCallnoByClassnoForCallno();if(b){if(l.useoldcallno=="1"){setValue("callno",b)}else{$.messager.confirm("提示消息","检测到分类号已被修改,是否沿用旧号?",function(i){if(i){setValue("callno",b)}else{_bibPVG.prototype.getCallno(f.rows[0],"callno")}})}}else{_bibPVG.prototype.getCallno(f.rows[0],"callno")}for(var g=0;g0){var h=c.code.split(",");for(var e=0;e1){c=copies*d}if(a.length!=c||a.length==0){$.messager.confirm("提示消息","分配数量与复本数不符,确定要更新数量?",function(e){if(e){setValue("copies",a.length);_checkBibObj.prototype.save()}})}else{_checkBibObj.prototype.save()}}else{if(b.checkcopies=="0"){_checkBibObj.prototype.save()}}};_checkBibObj.prototype.allocation=function(){var a=eidtorGridObject.datagrid("getRows");var c="";var e=[];for(var b=0;b-1){l.push(m[f])}}if(h&&$(h.target)){if(l.length>0){$(h.target).combobox("loadData",l);$(h.target).combobox("setValue",l[0].code)}}}}}}}}},{field:"curlocation",title:"馆藏地点",width:"18%",formatter:onShowLocationName,editor:{type:"combobox",options:{valueField:"code",textField:"name",panelHeight:"200px",groupField:"group",required:true,editable:false,data:$("#location").combobox("getData"),onChange:function(f,d){if(f!=undefined&&f!=d){if(eidtorGridIndex!=undefined){if(a){var b=eidtorGridObject.datagrid("getEditor",{index:eidtorGridIndex,field:"doctype"});for(var c=0;c<_myLocationData.length;c++){if(_myLocationData[c].code==f){var e=_myLocationData[c].defdoctype;$(b.target).combobox("setValue",e);break}}}}}}}}},{field:"doctype",title:"文献类型",width:"16%",formatter:onShowDocTypeName,editor:{type:"combobox",options:{valueField:"code",textField:"name",panelHeight:"200px",groupField:"group",required:true,editable:false,data:$("#doctype").combobox("getData")}}},{field:"barcode",title:"条码号",width:"16%",editor:{type:"text",options:{required:true}}},{field:"assetno",title:"资产号",width:"16%",editor:{type:"text"}},{field:"callno",title:"索书号",width:"16%",editor:{type:"text"}}]]})}_checkBibObj.prototype.searchResult()};_checkBibObj.prototype.updataCallno=function(){var a=eidtorGridObject.datagrid("getRows");for(var b=0;b1){a=copies*f}if(j.length>=a){$("#barcode").textbox("textbox").focus().select();return openMessageDlg("已经达到分配复本数上限,无法继续分配!")}if(g.barcode.indexOf("-")>-1){var e=g.barcode.split("-");var c=parseInt(e[1]);var d=e[0];_checkBibObj.prototype.setHoldRecord(g,c,d,0)}else{_checkBibObj.prototype.setHoldRecordIsExit(g)}$("#barcode").textbox("textbox").focus().select()};_checkBibObj.prototype.setHoldRecordIsExit=function(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")};_checkBibObj.prototype.setHoldRecord=function(h,d,e,g){var i=JSON.parse(_configData.rows[0].paramjson);if(parseInt(g)>=parseInt(d)){appendRestulFun();return}var f=parseInt(getValue("volumes"));var b=parseInt(getValue("copies"));if(f>1){b=copies*f}if(parseInt(d)>0){var a=base_path+"hld/holding/getCheckHoldBarcode.do";var c={};c.barcode=e;c.loantime="999";$.post(a,c,function(k){if(k.status=="0"){if(k.total>0){return openMessageDlg("条码【"+e+"】重复,不能继续分配!")}if(k.total==0){var j={};j.libcode=h.libcode;j.curlocation=h.curlocation;j.doctype=h.doctype;j.barcode=e;if(i.autobartoassetno=="1"){j.assetno=_bibPVG.prototype.getAssetnoBySubstr(i,j.barcode)}j.callno=getCurCallno(g);appendEidtorGridRow(j);g=g+1}e=addOne(e);_checkBibObj.prototype.setHoldRecord(h,d,e,g)}else{}},"json")}};function getCurCallno(c){var b=getValue("callno");var d=parseInt(getValue("volumes"));var e=parseInt(getValue("copies"));if(d>1&&b.indexOf(":")<0){for(var a=1;a<=d;a++){if((a*e)>c){b=b+":"+a;break}}}return b}function appendRestulFun(){var c=eidtorGridObject.datagrid("getRows");var a=JSON.parse(_configData.rows[0].paramjson);if(a.assetno&&a.autobartoassetno=="0"){autoAssetnoRows=undefined;var b=base_path+"hld/holding/getNextAssetno.do";var d={};d.code=a.assetno;d.count=c.length;$.post(b,d,function(f){if(f.status=="0"){eidtorGridObject.datagrid("loadData",[]);autoAssetnoRows=f.rows;for(var e=0;e1){for(var f=0;f1){d=d*l}var o={};o.libcode=getValue("libcode");o.location=getValue("location");o.doctype=getValue("doctype");for(var f=0;f1){c=c*f}if(a){autoBarRows=undefined;var h={};h.libcode=getValue("libcode");h.curlocation=getValue("location");h.doctype=getValue("doctype");h.barcode=getValue("barcode");var b=base_path+"hld/holding/getNextBarno.do";var d={};d.code=a;d.count=c;$.post(b,d,function(k){if(k.status=="0"){var j=k.rows;autoBarRows=j;if(e){addHoldGridDataBycopiesDataGridList(i,j,e)}else{addHoldGridDataByCatHoldList(h,i,j)}appendRestulFun()}else{openMessageDlg(k.message)}},"json")}else{var g=getValue("autoCreateGrid");if(g=="1"&&parseInt(_id)==0){autoBarcodeByCopiesGridList()}}};function addHoldGridDataBycopiesDataGridList(m,l,d){$("#checkhold_eidtorgrid").datagrid("loadData",[]);var a=0;var k=JSON.parse(d.rule);var f=[];var g=parseInt(getValue("volumes"));if(g>1){for(var b=0;b0){var d=JSON.parse(f);var b=[];var a=0;for(var e=0;e-1){var b=base_path+"lib/biblios/getMarcRecordForEdit.do";var c={};c.id=_bibId;$.post(b,c,function(j){if(j.status=="0"){var h=j.rows;var g=[];for(var f=0;f-1){var e=getDataDirect(h[f].data,a.marcfldbarcode.split("$")[1]);g.push(e)}}for(var f=0;f