var _myInitCombox=function(){};var _myOrderCheck=function(){};var initJson;var _autoStatus=true;$(function(){_myInitCombox.prototype.batchno();if($("#orderbatchno").length>0){$("#libcodeSelect").combobox({onChange:function(b,a){_myInitCombox.prototype.batchno(b)}})}_myInitCombox.prototype.bibindex();_myInitCombox.prototype.autobar();initJson=[{code:"page_sysid",key:"sysid",condition:"type",value:"0"},{code:"page_finsources",key:"finsources"},{code:"page_mediatype",key:"mediatype"},{code:"page_binding",key:"binding"},{code:"page_docsources",key:"docsources"},{code:"page_bookseller",key:"bookseller",condition:"libcode",value:vLibcode},{code:"page_location",key:"location",condition:"libcode",value:vLibcode},{code:"page_doctype",key:"doctype",condition:"libcode",value:vLibcode},{code:"libcodeSelect,page_libcode",key:"libcode",condition:"code",value:vLibcode},{code:"operid",key:"operid"}];_myPage.prototype.initData(initJson);enterEvent("keyword",_myOrderCheck.prototype.serach);_myOrderCheck.prototype.events()});_myPage.prototype.onLoadSuccess=function(a,b){_fmtGridDataRows=a;getPageConfig("page_type",_setConfig.prototype.callSet)};var _setConfig=function(){};_setConfig.prototype.callSet=function(c){if(c.status=="0"){var b=c.rows[0];var a=JSON.parse(b.paramjson);setJsonData("page_",a);setValue("libcodeSelect",vLibcode)}else{openMessageDlg("请您先点点击设置按钮,设置相关参数!")}};_setConfig.prototype.check=function(){if(getValue("page_sysid").length==0){openMessageDlg("请您先点点击设置按钮,设置分系统!");return false}if(getValue("page_check_batchno").length==0){openMessageDlg("请您先点点击设置按钮,设置验收批号!");return false}if(getValue("page_autobar").length==0){openMessageDlg("请您先点点击设置按钮,设置条码自动区间!");return false}return true};_myOrderCheck.prototype.serach=function(){if(!_setConfig.prototype.check()){return}_myOrderCheck.prototype.clear();var d={};var c=base_path+"lib/biblios/page.do";if(getValue("keyword").length==0){return openMessageDlg("检索值不能为空")}d.rows=10;d.page=1;d.orderBy=" id desc ";var b=0;d.condition=getValue("bibindex");d.value=getValue("keyword");d["limit["+b+"].condition"]="sysid";d["limit["+b+"].value"]=getValue("page_sysid");b++;var e=$("#libcodeSelect");if(e.length>0&&getValue("libcodeSelect").length>0){d["limit["+b+"].condition"]="libcode";d["limit["+b+"].value"]=getValue("libcodeSelect");b++}var a=$("#orderbatchno");if(a.length>0&&getValue("orderbatchno").length>0){d["limit["+b+"].condition"]="ORDBATCHNO";d["limit["+b+"].value"]=getValue("orderbatchno");b++}$("#acqDataGridList").datagrid({url:c,queryParams:d,onLoadSuccess:function(f){if(f.total>1){$("#acqDataGridList").datagrid("getPanel").panel("setTitle","书目列表(提示:请选择一条书目信息,双击进行快速订购验收操作!)")}else{$("#acqDataGridList").datagrid("getPanel").panel("setTitle","书目列表")}$("#acqDataGridList").datagrid("selectRow",0)},method:"post"})};_myOrderCheck.prototype.clear=function(){clearGridData("acqDataGridList,orderDataGridList,checkDataGridList,holdDataGridList")};_myOrderCheck.prototype.events=function(){$("#acqDataGridList").datagrid({onSelect:_myOrderCheck.prototype.acqSelect,onDblClickRow:_myOrderCheck.prototype.acqDblClick});$("#orderDataGridList").datagrid({onSelect:_myOrderCheck.prototype.orderSelect,onDblClickRow:_myOrderCheck.prototype.check});$("#checkDataGridList").datagrid({onSelect:_myOrderCheck.prototype.checkSelect})};_myOrderCheck.prototype.acqSelect=function(a,c){_bibPVG.prototype.getCallno(c,"callno");_myOrderCheck.prototype.loadData(c.id,"order","bibid");var b=$("#acqDataGridList").datagrid("getRows");if(b.length>1){_autoStatus=false}else{if(b.length==1){_autoStatus=true}}};_myOrderCheck.prototype.acqDblClick=function(a,b){_autoStatus=true};_myOrderCheck.prototype.orderSelect=function(a,c){clearGridData("holdDataGridList");_myOrderCheck.prototype.loadData(c.id,"check","orderid");var b=$("#orderDataGridList").datagrid("getRows");if(b.length==1&&_autoStatus){_myOrderCheck.prototype.check(a,c)}};_myOrderCheck.prototype.checkSelect=function(a,b){_myOrderCheck.prototype.loadData(b.id,"hold","checkid")};_myOrderCheck.prototype.check=function(b,a){_myOrderCheck.prototype.autobar(a)};_myOrderCheck.prototype.autobar=function(c){var a=getValue("page_autobar");if(a&&c.copies){var b=base_path+"hld/holding/getNextBarno.do";var d={};d.code=a;d.count=1;$.post(b,d,function(f){if(f.status=="0"){var e=f.rows;_myOrderCheck.prototype.saveToVal(e,c)}else{openMessageDlg(f.message)}},"json")}};_myOrderCheck.prototype.saveToVal=function(b,c){var a={};a.orderid=c.id;a.bibid=c.bibid;a.ncy=c.ncy;a.price=c.price;a.totalprice=c.totalprice;a.orderncy=c.orderncy;a.orderprice=c.orderprice;a.ordertotalprice=c.ordertotalprice;a.volumes=c.volumes;a.operid=c.operid;a.checkdate=getCurDateYMD();a.batchno=getValue("page_check_batchno");a.bookseller=getValue("page_bookseller");a.finsources=getValue("page_finsources");a.docsources=getValue("page_docsources");a.mediatype=getValue("page_mediatype");a.binding=getValue("page_binding");a.sysid=getValue("page_sysid");a.auto_callno=getValue("callno");a.callno=getValue("callno");_myOrderCheck.prototype.saveCheckRecord(b,c,a)};_myOrderCheck.prototype.saveCheckRecord=function(b,e,a){var d=getValue("libcodeSelect");if(d.length==0){d=vLibcode}a.libcode=d;var f="0:"+d+":"+getValue("page_location")+":"+getValue("page_doctype")+":"+b[0]+":,";a.allocation=f;var c=base_path+"acq/check/list.do";var g={};g["limit[0].condition"]="orderid";g["limit[0].value"]=a.orderid;$.post(c,g,function(i){if(i.status=="0"){var h=i.rows;if(h.length>0){if(parseInt(h[0].copies)>=e.copies){$.messager.confirm("提示消息","验收册数已经大于等于订购数量,是否继续进行快速订购验收操作?",function(j){if(j){_myOrderCheck.prototype.updateCheckRecord(b,e,a,h)}})}else{_myOrderCheck.prototype.updateCheckRecord(b,e,a,h)}}else{a.id=0;a.copies=1;_myOrderCheck.prototype.save(b,a)}}else{openMessageDlg(i.message)}},"json")};_myOrderCheck.prototype.updateCheckRecord=function(b,e,a,d){a.copies=parseInt(d[0].copies)+1;a.id=d[0].id;var c=base_path+"hld/holding/page.do";var f={};f.checkid=a.id;f.rows=100;f.page=1;$.post(c,f,function(i){if(i.status=="0"){var h=i.rows;var g=_myOrderCheck.prototype.allocation(h);a.allocation=g+a.allocation;_myOrderCheck.prototype.save(b,a)}else{openMessageDlg(i.message)}},"json")};_myOrderCheck.prototype.allocation=function(d){var a=d;var c="";for(var b=0;b0){var d=0;var g=$("#"+e+"DataGridList").datagrid("getSelected");if(g){d=$("#"+e+"DataGridList").datagrid("getRowIndex",g)}var c=base_path+"acq/"+e+"/list.do";if(e=="hold"){c=base_path+"hld/holding/list.do"}var f={};f.rows=10;f.page=1;f.orderBy=" id desc ";var b=0;f["limit["+b+"].condition"]=a;f["limit["+b+"].value"]=h;b++;if(e=="order"){f["limit["+b+"].condition"]="ordstatus";f["limit["+b+"].value"]="0"}$("#"+e+"DataGridList").datagrid({url:c,queryParams:f,onLoadSuccess:function(j){if(j.total>0&&j.total>d){$("#"+e+"DataGridList").datagrid("selectRow",d)}else{if(j.total>0){$("#"+e+"DataGridList").datagrid("selectRow",0)}}if(e=="order"){var i=$("#orderDataGridList").datagrid("getRows");if(i.length>1){$("#orderDataGridList").datagrid("getPanel").panel("setTitle","订购列表(提示:请选择一条订购信息,双击进行快速订购验收!)")}else{if(i.length>0){$("#orderDataGridList").datagrid("getPanel").panel("setTitle","订购列表")}else{if(i.length==0){$("#orderDataGridList").datagrid("getPanel").panel("setTitle","订购列表(提示:没有订购信息,无法进行快速订购验收操作!!)")}}}}},method:"post"})}else{deleteGridData(""+e+"DataGridList")}};_myInitCombox.prototype.bibindex=function(){var b={key:"bibindex"};var a=base_path+"par/common/getInitData.do";$.post(a,b,function(f){var e=f.rows;var d=[];for(var c=0;c0){var b={};b.libcode=vLibcode;var a=base_path+"par/autobar/page.do";$.post(a,b,function(c){var d="auto";if(c.rows.length>10){d="200px"}$("#page_autobar").combobox({data:c.rows,valueField:"code",textField:"name",panelHeight:d,loadFilter:function(e){var f={};f.code="";f.name="不限";e.splice(0,0,f);return e},onLoadSuccess:function(){$(this).combobox("select","")}})},"json")}};_myInitCombox.prototype.batchno=function(b){if($("#orderbatchno").length>0){var c={type:"0",page:"1",rows:"500"};if(b){c.libcode=b}var a=base_path+"par/batchno/page.do";$.post(a,c,function(g){var f=[];for(var e=0;e10){h="200px"}$("#orderbatchno").combobox({data:f,valueField:"code",textField:"name",panelHeight:h,onLoadSuccess:function(){$(this).combobox("select",f[0].code)}})},"json")}};