Index: ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recycleForTouchScreen.js =================================================================== diff -u -r31142 -r31174 --- ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recycleForTouchScreen.js (.../recycleForTouchScreen.js) (revision 31142) +++ ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recycleForTouchScreen.js (.../recycleForTouchScreen.js) (revision 31174) @@ -24,188 +24,188 @@ var canTerminateTousseItemIds = []; // 是否开启根据科室加载模板 -function openLoadTemplateByUnit(){ - if(sstsConfig.isOpenLoadTemplateByUnit){ - $("#departmentTemplate").change(function(){ +function openLoadTemplateByUnit() { + if (sstsConfig.isOpenLoadTemplateByUnit) { + $("#departmentTemplate").change(function () { var requestParms = {}; requestParms.templateId = $('#departmentTemplate').val(); requestParms.orgUnitCoding = $("#departCode").val(); $.ajax({ - type:'get', - url:WWWROOT + '/disinfectSystem/recyclingRecordAction!loadDepartmentAppTemplateForRecycle.do', - data:requestParms, - dataType:'json', - success:function(dataArray){ + type: 'get', + url: WWWROOT + '/disinfectSystem/recyclingRecordAction!loadDepartmentAppTemplateForRecycle.do', + data: requestParms, + dataType: 'json', + success: function (dataArray) { //if(dataArray.length > 0){ - //获取页面显示的每个包 - var tousseItemsTable2 = $('#tousseItemTable').children().first().children(); - var tousseItemsTable2length = tousseItemsTable2.length; - - var hasCloumns = [];//存数量大于等于1的tousseDefinitionID - var hasCloumsObjs = [];//存数量大于等于1的对象 - - for (var j = 0; j < tousseItemsTable2.length; j++) { - var recycleAmountVal = parseInt($('#recycleAmount'+j).val(), 10); - if(recycleAmountVal >= 1){ - hasCloumns.push($('#tousseDefinitionID' + j).val()); - - var obj = {}; - obj.tousseItemId = ""; - obj.tousseName = $("#tousseName" + j).val(); - obj.tousseDefinitionID = $("#tousseDefinitionID" + j).val(); - obj.applicationAmount = $("#applicationAmount" + j).val(); - obj.recycleAmount = recycleAmountVal; - obj.loadedAmount = $("#loadedAmount" + j).val(); - obj.isCleanedEntirely = $("#isCleanedEntirely" + j).val(); - obj.tousseType = $("#tousseType" + j).val(); - obj.isThereIdentificationCard = $("#isThereIdentificationCard" + j).val(); - obj.isApplyEntireTousse = $("#isApplyEntireTousse" + j).val(); - obj.urgentAmount = $("#urgentAmount" + j).val(); - obj.tousseRemark = $("#tousseRemark" + j).val(); - obj.errorDamageQmKey = $("#hiddenErrorDamageQmKey" + j).val(); - obj.spelling = $("#spelling" + j).val(); - - hasCloumsObjs.push(obj); - - } - $('#tousseItemsTr'+j).remove();//把全部都删掉,后面挨个添加,先添加数量大于等于1,再添加接口返回的 + //获取页面显示的每个包 + var tousseItemsTable2 = $('#tousseItemTable').children().first().children(); + var tousseItemsTable2length = tousseItemsTable2.length; + + var hasCloumns = [];//存数量大于等于1的tousseDefinitionID + var hasCloumsObjs = [];//存数量大于等于1的对象 + + for (var j = 0; j < tousseItemsTable2.length; j++) { + var recycleAmountVal = parseInt($('#recycleAmount' + j).val(), 10); + if (recycleAmountVal >= 1) { + hasCloumns.push($('#tousseDefinitionID' + j).val()); + + var obj = {}; + obj.tousseItemId = ""; + obj.tousseName = $("#tousseName" + j).val(); + obj.tousseDefinitionID = $("#tousseDefinitionID" + j).val(); + obj.applicationAmount = $("#applicationAmount" + j).val(); + obj.recycleAmount = recycleAmountVal; + obj.loadedAmount = $("#loadedAmount" + j).val(); + obj.isCleanedEntirely = $("#isCleanedEntirely" + j).val(); + obj.tousseType = $("#tousseType" + j).val(); + obj.isThereIdentificationCard = $("#isThereIdentificationCard" + j).val(); + obj.isApplyEntireTousse = $("#isApplyEntireTousse" + j).val(); + obj.urgentAmount = $("#urgentAmount" + j).val(); + obj.tousseRemark = $("#tousseRemark" + j).val(); + obj.errorDamageQmKey = $("#hiddenErrorDamageQmKey" + j).val(); + obj.spelling = $("#spelling" + j).val(); + + hasCloumsObjs.push(obj); + } - - - var addColumnArr = [];//用来增加的数据 - if (hasCloumns.length > 0) { - //先获取到大于等于1的包的,循环拿到row,赋值给大于等于1的对象的row,保证这个id唯一和连续 - for (var m = 0; m < hasCloumns.length; m++) { - var myObj = hasCloumsObjs[m]; - myObj.row = m; - addColumnArr.push(myObj); - } + $('#tousseItemsTr' + j).remove();//把全部都删掉,后面挨个添加,先添加数量大于等于1,再添加接口返回的 + } + + + var addColumnArr = [];//用来增加的数据 + if (hasCloumns.length > 0) { + //先获取到大于等于1的包的,循环拿到row,赋值给大于等于1的对象的row,保证这个id唯一和连续 + for (var m = 0; m < hasCloumns.length; m++) { + var myObj = hasCloumsObjs[m]; + myObj.row = m; + addColumnArr.push(myObj); } - //获取到大于等于1的数组的长度,后面每次加一下,就是新增加的包的row - var totalLength = hasCloumns.length - 1; - for(var i =0;i < dataArray.length; i++){ - //没找到,就是数量大于等于1的id,在后台返回的数据中没有,这时候就需要直接取到后台数据,增加到页面上 - if(hasCloumns.indexOf(dataArray[i].tousseDefinitionID + "") == -1){ - totalLength++; - var timeStr = new Date().getTime(); - var errorDamageQmKey = dataArray[i].tousseDefinitionID + "_" + timeStr; - var toussItem = { - row: totalLength, - tousseItemId: '', - tousseName: dataArray[i].tousseName, - tousseDefinitionID: dataArray[i].tousseDefinitionID, - applicationAmount: 0, - recycleAmount: 0, - loadedAmount: 0, - isCleanedEntirely: dataArray[i].isCleanedEntirely, - tousseType: dataArray[i].tousseType, - isThereIdentificationCard: dataArray[i].isThereIdentificationCard, - isApplyEntireTousse: dataArray[i].isApplyEntireTousse, - urgentAmount : 0, - tousseRemark : '', - errorDamageQmKey : errorDamageQmKey, - spelling : dataArray[i].spelling - }; - addColumnArr.push(toussItem); - } + } + //获取到大于等于1的数组的长度,后面每次加一下,就是新增加的包的row + var totalLength = hasCloumns.length - 1; + for (var i = 0; i < dataArray.length; i++) { + //没找到,就是数量大于等于1的id,在后台返回的数据中没有,这时候就需要直接取到后台数据,增加到页面上 + if (hasCloumns.indexOf(dataArray[i].tousseDefinitionID + "") == -1) { + totalLength++; + var timeStr = new Date().getTime(); + var errorDamageQmKey = dataArray[i].tousseDefinitionID + "_" + timeStr; + var toussItem = { + row: totalLength, + tousseItemId: '', + tousseName: dataArray[i].tousseName, + tousseDefinitionID: dataArray[i].tousseDefinitionID, + applicationAmount: 0, + recycleAmount: 0, + loadedAmount: 0, + isCleanedEntirely: dataArray[i].isCleanedEntirely, + tousseType: dataArray[i].tousseType, + isThereIdentificationCard: dataArray[i].isThereIdentificationCard, + isApplyEntireTousse: dataArray[i].isApplyEntireTousse, + urgentAmount: 0, + tousseRemark: '', + errorDamageQmKey: errorDamageQmKey, + spelling: dataArray[i].spelling + }; + addColumnArr.push(toussItem); } - - for (var i = 0; i < addColumnArr.length; i++) { - var addColumnObj = addColumnArr[i]; - //统一增加的原因,是防止下次去拿数据的时候,拿到刚增加进去的数据 - addToussItem(addColumnObj, true); - } - - //恢复点击入筐后,回收数量和装配数量背景色的控制,因为前面删掉了全部的数据 - if(hasCloumns.length > 0){ - for(var k=0;k 0) { + for (var k = 0; k < hasCloumns.length; k++) { + setTousseItemLoadedAmountCss(k); } + } //} } - }) + }) }); } } // 获取清洗装载状态的篮筐 -function getWashLoadingStatusBaskets(){ - if(sstsConfig.loadWashLoadingStatusBasketsWhenRecycling){ +function getWashLoadingStatusBaskets() { + if (sstsConfig.loadWashLoadingStatusBasketsWhenRecycling) { $.ajax({ - type : "post", - url : WWWROOT + '/disinfectSystem/recyclingRecordAction!getWashLoadingStatusBaskets.do', - dataType:'json', - async:true, - success:function(result){ - if(result.length > 0){ + type: "post", + url: WWWROOT + '/disinfectSystem/recyclingRecordAction!getWashLoadingStatusBaskets.do', + dataType: 'json', + async: true, + success: function (result) { + if (result.length > 0) { var newBasketArr = []; - $("#basketsUl li").each(function(i){ + $("#basketsUl li").each(function (i) { var basketValue = $(this).find('input').eq(0).val(); - if(basketValue){ + if (basketValue) { basketValue = JSON.parse(basketValue); newBasketArr[i] = basketValue.barcode; } }); - for(var i=0;i -1){ + if (newBasketArr.indexOf(containerBarcode) > -1) { continue; } - for(var j=0;j'; + basketElement += ''; basketElement += ''; - basketElement += '使用'; + basketElement += '使用'; basketElement += ''; basketElement += ''; - + var showBasketLoadMaterialAmount = sstsConfig.showBasketLoadMaterialAmount; var imageButton = ''; - if(showBasketLoadMaterialAmount == true){ - imageButton = ''; + if (showBasketLoadMaterialAmount == true) { + imageButton = ''; } - - if(text !== ''){ - if(text.split(',').length > 4){ - sumText = text.split(',')[0]+','+text.split(',')[1]+','+text.split(',')[2]+'......'; - }else { - if(text.split(',').length == 2){ + + if (text !== '') { + if (text.split(',').length > 4) { + sumText = text.split(',')[0] + ',' + text.split(',')[1] + ',' + text.split(',')[2] + '......'; + } else { + if (text.split(',').length == 2) { sumText = text.split(',')[0]; - }else if(text.split(',').length == 3){ - sumText = text.split(',')[0]+','+text.split(',')[1]; - }else if(text.split(',').length == 4){ - sumText = text.split(',')[0]+','+text.split(',')[1]+','+text.split(',')[2] + } else if (text.split(',').length == 3) { + sumText = text.split(',')[0] + ',' + text.split(',')[1]; + } else if (text.split(',').length == 4) { + sumText = text.split(',')[0] + ',' + text.split(',')[1] + ',' + text.split(',')[2] } } } - - var amountStyle = (result[i].percentage == 1)?'color:red':''; - - basketElement += '' + (containerName) + '' + imageButton +''; - basketElement += '' + sumAmount + ''; - basketElement += '
'+sumText+'
'; + + var amountStyle = (result[i].percentage == 1) ? 'color:red' : ''; + + basketElement += '' + (containerName) + '' + imageButton + ''; + basketElement += '' + sumAmount + ''; + basketElement += '
' + sumText + '
'; basketElement += ''; var obj = $(basketElement); $("#loadingPutBasket").prepend(obj); basketArray[i] = containerBarcode; } $("#scanContainerBarcodeTipUl").hide(); - }else { - if($("#basketsUl > li").length == 0){ + } else { + if ($("#basketsUl > li").length == 0) { $("#scanContainerBarcodeTipUl").show(); - }else{ + } else { $("#scanContainerBarcodeTipUl").hide(); } } @@ -215,61 +215,61 @@ } // 左边的器械包重新排序 -function tousseItemTableSort(name){ +function tousseItemTableSort(name) { var tousseName = name || ''; - if(sstsConfig.enableSortWaitRecyclingListByIntoBasketStatus){ + if (sstsConfig.enableSortWaitRecyclingListByIntoBasketStatus) { var tbs = document.getElementById('tousseItemTable'); var arr1 = [];//未入框的器械包数组 var arr2 = [];//已入框的器械包数组 var arr3 = [];//删除的器械包数组 var arr4 = [];//合并为总的数组 - for(var i=0,k=0,z=0;i 0){ + dataType: 'json', + success: function (result) { + if (result.success) { + if (result.data.length > 0) { var data = result.data; splitTousseArray2 = data; var table = ''; - var name = (sstsConfig.methodOfSplitRecyclingApplication == 2)?'资产归属':'所属科室'; + var name = (sstsConfig.methodOfSplitRecyclingApplication == 2) ? '资产归属' : '所属科室'; table += ''; table += ''; - table += ''; + table += ''; table += ''; table += ''; - for(var i=0;i'; + table += ''; table += ''; } table += ''; @@ -278,8 +278,8 @@ type: 1, skin: 'layui-layer-rim', //加上边框 area: ['500px', '400px'], //宽高 - shade:0, - title:'该申请单中以下物品不属于当前回收科室:', + shade: 0, + title: '该申请单中以下物品不属于当前回收科室:', content: table }); } @@ -289,17 +289,17 @@ } // 打开不同申请科室或者不同资产归属的器械包 -function openApplicationTousseSplitByOrgUnit(newTousseArray,tousseArray){ +function openApplicationTousseSplitByOrgUnit(newTousseArray, tousseArray) { var table = '
该申请单中以下物品不属于当前回收科室(回收科室名称),请确认是否拆单回收:
'; - var name = (sstsConfig.methodOfSplitRecyclingApplication == 2)?'资产归属':'所属科室'; + var name = (sstsConfig.methodOfSplitRecyclingApplication == 2) ? '资产归属' : '所属科室'; table += '
物品名称数量'+name+'
物品名称数量' + name + '
'+data[i].amount+''+data[i].depart+'' + data[i].tousseName + '' + data[i].amount + '' + data[i].depart + '
'; table += ''; - table += ''; + table += ''; table += ''; table += ''; - for(var i=0;i'; + table += ''; table += ''; } table += ''; @@ -309,56 +309,56 @@ type: 1, skin: 'layui-layer-rim', //加上边框 area: ['500px', '400px'], //宽高 - title:'拆单回收', + title: '拆单回收', content: table, - success:function(){ + success: function () { //保存不同申请科室或者不同资产归属的器械包 - document.getElementById('saveApplicationTousseSplitByOrgUnit').addEventListener('click',function(){ - var k=0; + document.getElementById('saveApplicationTousseSplitByOrgUnit').addEventListener('click', function () { + var k = 0; var splitTousseArray = []; - $('.saveTousseTable').find('.isSplit').each(function(item){ + $('.saveTousseTable').find('.isSplit').each(function (item) { var isSplit = $(this).find('input:checked').val(); var tousseName = $(this).parent().find('td').eq(0).text(); var amount = parseInt($(this).parent().find('td').eq(1).text()); var depart = $(this).parent().find('td').eq(2).text(); - if(isSplit == 'true'){ + if (isSplit == 'true') { splitTousseArray[k] = { - isSplit:isSplit, - tousseName:tousseName, - amount:amount, - depart:depart + isSplit: isSplit, + tousseName: tousseName, + amount: amount, + depart: depart } - for(var j=0;j= 1){ - if(tousseType == '外来器械包'){ + var isApplyEntireTousse = $('#isApplyEntireTousse' + row).val(); + var tousseType = $('#tousseType' + row).val(); + if (recycleAmount >= 1) { + if (tousseType == '外来器械包') { alertDiv("外来器械包回收数量不能大于1,请点击器械包名修改材料数量!"); return; } - if(tousseType == '消毒物品' && '是' != isApplyEntireTousse){ + if (tousseType == '消毒物品' && '是' != isApplyEntireTousse) { alertDiv("拆包申请的消毒物品回收数量不能大于1,请点击器械包名修改材料数量!"); return; } } increaseAmount(row); setTousseItemLoadedAmountCss(row); updateBindGoods(row); - var recycleAmountChange = recycleAmount+1; - playAudioAndTts(recycleAmountChange,'recycleAudioAmount'); + var recycleAmountChange = recycleAmount + 1; + playAudioAndTts(recycleAmountChange, 'recycleAudioAmount'); } // 验证加急数量是否大于回收数量。如果加急数量大于回收数量,返回true,否则返回false -function validateUrgentAmount(row,recycleAmount){ - var urgentAmount = $('#urgentAmount'+row).val() == ''?0:parseInt($('#urgentAmount'+row).val(),10); - if(urgentAmount > recycleAmount){ +function validateUrgentAmount(row, recycleAmount) { + var urgentAmount = $('#urgentAmount' + row).val() == '' ? 0 : parseInt($('#urgentAmount' + row).val(), 10); + if (urgentAmount > recycleAmount) { alertDiv('回收数量不能小于加急数量'); return true; } return false; } // 减少回收数量时验证丢失报损的数量是否大于回收数量 -function validateReduceAmount(recycleAmount,row){ +function validateReduceAmount(recycleAmount, row) { var recyclingError = $('#recyclingError' + row).val(); var recyclingDamage = $('#recyclingDamage' + row).val(); var materialNameArray = []; - var k=0; - if(recyclingError !== ''){ + var k = 0; + if (recyclingError !== '') { var recyclingErrorObj = JSON.parse(recyclingError); recyclingErrorObj = newArray2(recyclingErrorObj); - if(recyclingErrorObj.length > 0){ - for(var i=0;i 0) { + for (var i = 0; i < recyclingErrorObj.length; i++) { + if (recyclingErrorObj[i].amountPerTousse * recycleAmount < recyclingErrorObj[i].amount) { materialNameArray[k] = recyclingErrorObj[i].materialName; k++ } } } } - if(recyclingDamage !== ''){ + if (recyclingDamage !== '') { var recyclingDamageObj = JSON.parse(recyclingDamage); recyclingDamageObj = newArray2(recyclingDamageObj); - if(recyclingDamageObj.length > 0){ - for(var i=0;i 0) { + for (var i = 0; i < recyclingDamageObj.length; i++) { + if (recyclingDamageObj[i].amountPerTousse * recycleAmount < recyclingDamageObj[i].amount) { materialNameArray[k] = recyclingDamageObj[i].materialName; k++ } @@ -571,464 +571,464 @@ } // 减少物品(即点击左边的“-”图标) -function reduce(row){ - var recycleAmount = $('#recycleAmount'+row).val() == ''?0:parseInt($('#recycleAmount'+row).val(),10)-1; - if(validateReduceAmount(recycleAmount,row).length > 0){ - var arr = validateReduceAmount(recycleAmount,row); - alertDiv('不能减少回收数量,请先检查【'+arr.join(',')+'】的丢失报损数量'); +function reduce(row) { + var recycleAmount = $('#recycleAmount' + row).val() == '' ? 0 : parseInt($('#recycleAmount' + row).val(), 10) - 1; + if (validateReduceAmount(recycleAmount, row).length > 0) { + var arr = validateReduceAmount(recycleAmount, row); + alertDiv('不能减少回收数量,请先检查【' + arr.join(',') + '】的丢失报损数量'); return } - if(recycleAmount >= 0){ - if(validateUrgentAmount(row,recycleAmount)){ - return; - } - $('#recycleAmount'+row).val(recycleAmount); - updateBindGoods(row); - } - setTousseItemLoadedAmountCss(row); - if(recycleAmount <= 0){ - recycleAmount = "0"; - } - playAudioAndTts(recycleAmount,'recycleAudioAmount'); + if (recycleAmount >= 0) { + if (validateUrgentAmount(row, recycleAmount)) { + return; + } + $('#recycleAmount' + row).val(recycleAmount); + updateBindGoods(row); + } + setTousseItemLoadedAmountCss(row); + if (recycleAmount <= 0) { + recycleAmount = "0"; + } + playAudioAndTts(recycleAmount, 'recycleAudioAmount'); } // 扫描器械包条码和标识牌,添加丢失报损备注到已经存在的回收项 -function addErrorDamageRemark(ti,row){ - if(ti.status == used){ +function addErrorDamageRemark(ti, row) { + if (ti.status == used) { //必须是已使用。因为使用记录才会有包实例上的丢失报损 var er = $('#hiddenErrorRemark' + row).val(); var dr = $('#hiddenDamageRemark' + row).val(); var erArr = []; var drArr = []; - if(!isUndefinedOrNullOrEmpty(er)){ + if (!isUndefinedOrNullOrEmpty(er)) { erArr.push(er); } - if(!isUndefinedOrNullOrEmpty(ti.errorRemark)){ + if (!isUndefinedOrNullOrEmpty(ti.errorRemark)) { erArr.push(ti.errorRemark); } - - if(!isUndefinedOrNullOrEmpty(dr)){ + + if (!isUndefinedOrNullOrEmpty(dr)) { drArr.push(dr); } - if(!isUndefinedOrNullOrEmpty(ti.damageRemark)){ + if (!isUndefinedOrNullOrEmpty(ti.damageRemark)) { drArr.push(ti.damageRemark); } - $('#hiddenErrorRemark' + row).val(erArr.join(';')); - $('#hiddenDamageRemark' + row).val(drArr.join(';')); + $('#hiddenErrorRemark' + row).val(erArr.join(';')); + $('#hiddenDamageRemark' + row).val(drArr.join(';')); } } // 加载未补充的丢失报损 -function loadUnSupplementMaterial(msg,tmpRow,tousseBarcode){ - if(msg.unSupplementMaterials != null){ +function loadUnSupplementMaterial(msg, tmpRow, tousseBarcode) { + if (msg.unSupplementMaterials != null) { var materials = msg.unSupplementMaterials; - var errorStr = $('#recyclingError' + tmpRow).val(); + var errorStr = $('#recyclingError' + tmpRow).val(); var damageStr = $('#recyclingDamage' + tmpRow).val(); - + var recyclingErrorJsonArray = new Array(); - if(!isUndefinedOrNullOrEmpty(errorStr)){ + if (!isUndefinedOrNullOrEmpty(errorStr)) { recyclingErrorJsonArray = JSON.parse(errorStr); - for(var i = 0 ; i < recyclingErrorJsonArray.length ; i++){ - if(recyclingErrorJsonArray[i].tousseBarcode == tousseBarcode){ + for (var i = 0; i < recyclingErrorJsonArray.length; i++) { + if (recyclingErrorJsonArray[i].tousseBarcode == tousseBarcode) { return false; } } } - var recyclingDamageJsonArray = new Array(); - if(!isUndefinedOrNullOrEmpty(damageStr)){ - recyclingDamageJsonArray = JSON.parse(damageStr); - for(var i = 0 ; i < recyclingDamageJsonArray.length ; i++){ - if(recyclingDamageJsonArray[i].tousseBarcode == tousseBarcode){ + var recyclingDamageJsonArray = new Array(); + if (!isUndefinedOrNullOrEmpty(damageStr)) { + recyclingDamageJsonArray = JSON.parse(damageStr); + for (var i = 0; i < recyclingDamageJsonArray.length; i++) { + if (recyclingDamageJsonArray[i].tousseBarcode == tousseBarcode) { return false; } } } - for(var m = 0 ; m < materials.length ; m++){ - var detail = materials[m]; - if(detail.amount <= 0){ - continue; - } - if(detail.type == '回收误差'){ - var errorObj = { - detailId: detail.id, - tousseDefinitionID: detail.tousseDefinitionId, - materialDefinitionId: detail.materialDefinitionId, - materialName: detail.materialName, - amount: detail.amount, - errorType: detail.errorType, - tousseBarcode:detail.tousseBarcode, - intoBasketAmount:detail.amount, - unconfirmedAmount:detail.unconfirmedAmount, - errorDamageQmKey : detail.errorDamageQmKey, + for (var m = 0; m < materials.length; m++) { + var detail = materials[m]; + if (detail.amount <= 0) { + continue; + } + if (detail.type == '回收误差') { + var errorObj = { + detailId: detail.id, + tousseDefinitionID: detail.tousseDefinitionId, + materialDefinitionId: detail.materialDefinitionId, + materialName: detail.materialName, + amount: detail.amount, + errorType: detail.errorType, + tousseBarcode: detail.tousseBarcode, + intoBasketAmount: detail.amount, + unconfirmedAmount: detail.unconfirmedAmount, + errorDamageQmKey: detail.errorDamageQmKey, amountPerTousse: detail.amountPerTousse - }; - recyclingErrorJsonArray.push(errorObj); - }else if(detail.type == '器械报损'){ - var item = { - detailId: detail.id, - tousseDefinitionID: detail.tousseDefinitionId, - materialDefinitionId: detail.materialDefinitionId, - materialName: detail.materialName, - tousseBarcode:detail.tousseBarcode, + }; + recyclingErrorJsonArray.push(errorObj); + } else if (detail.type == '器械报损') { + var item = { + detailId: detail.id, + tousseDefinitionID: detail.tousseDefinitionId, + materialDefinitionId: detail.materialDefinitionId, + materialName: detail.materialName, + tousseBarcode: detail.tousseBarcode, amount: detail.amount, - unconfirmedAmount:detail.unconfirmedAmount, - errorDamageQmKey : detail.errorDamageQmKey, + unconfirmedAmount: detail.unconfirmedAmount, + errorDamageQmKey: detail.errorDamageQmKey, amountPerTousse: detail.amountPerTousse - }; - recyclingDamageJsonArray.push(item); - } + }; + recyclingDamageJsonArray.push(item); + } } - if(recyclingErrorJsonArray.length > 0){ - setTousseItemRecyclingError(tmpRow,JSON.stringify(recyclingErrorJsonArray)); - if(document.getElementById('recyclingErrorButton'+tmpRow)){ - document.getElementById('recyclingErrorButton'+tmpRow).className = 'btn-b-edit'; + if (recyclingErrorJsonArray.length > 0) { + setTousseItemRecyclingError(tmpRow, JSON.stringify(recyclingErrorJsonArray)); + if (document.getElementById('recyclingErrorButton' + tmpRow)) { + document.getElementById('recyclingErrorButton' + tmpRow).className = 'btn-b-edit'; } - } - if(recyclingDamageJsonArray.length > 0){ - setTousseItemRecyclingDamage(tmpRow,JSON.stringify(recyclingDamageJsonArray)); - if(document.getElementById('recyclingDamageButton'+tmpRow)){ - document.getElementById('recyclingDamageButton'+tmpRow).className = 'btn-c-edit'; + } + if (recyclingDamageJsonArray.length > 0) { + setTousseItemRecyclingDamage(tmpRow, JSON.stringify(recyclingDamageJsonArray)); + if (document.getElementById('recyclingDamageButton' + tmpRow)) { + document.getElementById('recyclingDamageButton' + tmpRow).className = 'btn-c-edit'; } } - if(recyclingErrorJsonArray.length > 0){ - if(document.getElementById('showTousseName'+tmpRow)){ - document.getElementById('showTousseName'+tmpRow).className = 'input-a-yellow'; + if (recyclingErrorJsonArray.length > 0) { + if (document.getElementById('showTousseName' + tmpRow)) { + document.getElementById('showTousseName' + tmpRow).className = 'input-a-yellow'; } } - if(recyclingDamageJsonArray.length > 0){ - if(document.getElementById('showTousseName'+tmpRow)){ - document.getElementById('showTousseName'+tmpRow).className = 'input-a-brown'; + if (recyclingDamageJsonArray.length > 0) { + if (document.getElementById('showTousseName' + tmpRow)) { + document.getElementById('showTousseName' + tmpRow).className = 'input-a-brown'; } - } - } + } + } } // 删除物品 -function deleteConfirm(confirmMsg,actionFunction,row,deleteButton,basketBarcode,basketId){ +function deleteConfirm(confirmMsg, actionFunction, row, deleteButton, basketBarcode, basketId) { $("#dialogConfirm").dialog({ - resizable: false, - height:310, - width:600, - modal: true, - open: function() { - $("#confirmMsg").text(confirmMsg); - }, - close: function() { - $("#confirmMsg").text(""); - }, - buttons: { - "是": function() { + resizable: false, + height: 310, + width: 600, + modal: true, + open: function () { + $("#confirmMsg").text(confirmMsg); + }, + close: function () { + $("#confirmMsg").text(""); + }, + buttons: { + "是": function () { var delInfo = []; - if(actionFunction == 'deleteTousse'){ - var tousseDefinitionID = parseInt($('#tousseDefinitionID'+row).val(),10); + if (actionFunction == 'deleteTousse') { + var tousseDefinitionID = parseInt($('#tousseDefinitionID' + row).val(), 10); var tdIds = tousseDefinitionID || ''; tdIds = [tdIds]; delInfo = [{ - classifyBasketId:'', - tdIds:tdIds + classifyBasketId: '', + tdIds: tdIds }]; - }else if(actionFunction == 'deleteBasketItem'){ + } else if (actionFunction == 'deleteBasketItem') { var hideElement = $(deleteButton).parent().prev().prev().prev().prev(); - + var basketElement = $(deleteButton).parent().parent().parent(); var basketJSON = basketElement.find('input').eq(0); - var basket = basketJSON.val()?JSON.parse(basketJSON.val()):{}; - var item = hideElement.val()?JSON.parse(hideElement.val()):{}; + var basket = basketJSON.val() ? JSON.parse(basketJSON.val()) : {}; + var item = hideElement.val() ? JSON.parse(hideElement.val()) : {}; var classifiedItemId = item.classifiedItemId; var classifyBasketId = basket.classifyBasketId || ''; var tdIds = item.tousseDefinitionID || ''; tdIds = [tdIds]; - if(classifiedItemId == ''){ + if (classifiedItemId == '') { delInfo = []; - }else { + } else { delInfo = [{ - classifyBasketId:classifyBasketId, - tdIds:tdIds + classifyBasketId: classifyBasketId, + tdIds: tdIds }]; } - }else { + } else { var tdIds = []; var ids = []; var key = 0; var k = 0; - $(deleteButton).parent().parent().find('dl').find('input').each(function(){ - var item = $(this).val()?JSON.parse($(this).val()):{}; - if(item.classifiedItemId !== ''){ + $(deleteButton).parent().parent().find('dl').find('input').each(function () { + var item = $(this).val() ? JSON.parse($(this).val()) : {}; + if (item.classifiedItemId !== '') { ids[k] = item.classifiedItemId; k++; } tdIds[key] = item.tousseDefinitionID; key++ }); - if(ids.length > 0){ + if (ids.length > 0) { delInfo = [{ - classifyBasketId:basketId, - tdIds:tdIds + classifyBasketId: basketId, + tdIds: tdIds }]; - }else { + } else { delInfo = []; } } var data = { - recyclingRecordId:params_id, - delInfo:JSON.stringify(delInfo) + recyclingRecordId: params_id, + delInfo: JSON.stringify(delInfo) } var that = this; - if(delInfo.length > 0){ + if (delInfo.length > 0) { $.ajax({ - type : "post", - url : WWWROOT + '/disinfectSystem/recyclingRecordAction!verifyDeleteItemsInBasket.do', - data:data, - dataType:'json', - success:function(result){ - if(result.success){ - if(!sstsConfig.allowDecreaseRecyclingAmountGreatUnPackingAmount){ - if(result.data.length > 0){ - if(actionFunction == 'deleteTousse'){//删器械包 + type: "post", + url: WWWROOT + '/disinfectSystem/recyclingRecordAction!verifyDeleteItemsInBasket.do', + data: data, + dataType: 'json', + success: function (result) { + if (result.success) { + if (!sstsConfig.allowDecreaseRecyclingAmountGreatUnPackingAmount) { + if (result.data.length > 0) { + if (actionFunction == 'deleteTousse') {//删器械包 var tousseNames = result.data[0].tousseNames[0]; - alertDiv('【'+tousseNames+'】已经进行了装配或者发货,不能删除!'); - }else if(actionFunction == 'deleteBasketItem'){//删篮筐内物品 + alertDiv('【' + tousseNames + '】已经进行了装配或者发货,不能删除!'); + } else if (actionFunction == 'deleteBasketItem') {//删篮筐内物品 var tousseNames = result.data[0].tousseNames[0]; - alertDiv('【'+tousseNames+'】已经进行了装配或者发货,不能删除!'); - }else if(actionFunction == 'deleteBasket'){//删篮筐 + alertDiv('【' + tousseNames + '】已经进行了装配或者发货,不能删除!'); + } else if (actionFunction == 'deleteBasket') {//删篮筐 var str = result.data[0].tousseNames.join(','); var containerName = result.data[0].containerName; - alertDiv('该篮筐【'+containerName+'】里的【'+str+'】已经进行了装配或者发货,不能删除!'); + alertDiv('该篮筐【' + containerName + '】里的【' + str + '】已经进行了装配或者发货,不能删除!'); } return; } } - - if(actionFunction == 'deleteTousse'){//删器械包 + + if (actionFunction == 'deleteTousse') {//删器械包 deleteTousseItem(row); - }else if(actionFunction == 'deleteBasketItem'){//删篮筐内物品 + } else if (actionFunction == 'deleteBasketItem') {//删篮筐内物品 deleteBasketItem(deleteButton); - }else if(actionFunction == 'deleteBasket'){//删篮筐 - deleteBasket(deleteButton,basketBarcode,basketId); + } else if (actionFunction == 'deleteBasket') {//删篮筐 + deleteBasket(deleteButton, basketBarcode, basketId); } refreshSplitBasketView(); refreshAllBasketTotalNum(); $(that).dialog("close"); } }, - error:function(result){ + error: function (result) { } }); - }else { - if(actionFunction == 'deleteTousse'){//删器械包 + } else { + if (actionFunction == 'deleteTousse') {//删器械包 deleteTousseItem(row); - }else if(actionFunction == 'deleteBasketItem'){//删篮筐内物品 + } else if (actionFunction == 'deleteBasketItem') {//删篮筐内物品 deleteBasketItem(deleteButton); - }else if(actionFunction == 'deleteBasket'){//删篮筐 - deleteBasket(deleteButton,basketBarcode,basketId); + } else if (actionFunction == 'deleteBasket') {//删篮筐 + deleteBasket(deleteButton, basketBarcode, basketId); } refreshSplitBasketView(); refreshAllBasketTotalNum(); $(that).dialog("close"); } - - },"否": function() { - $(this).dialog("close"); - } - } - }); + + }, "否": function () { + $(this).dialog("close"); + } + } + }); } // 检查是否有丢失报损信息,如果有,返回提示信息。否则返回空字符 -function checkHaveErrorDamage(row){ +function checkHaveErrorDamage(row) { var returnMsg = ""; - var recyclingErrorJsonArrayStr = $('#recyclingError'+row).val(); - if(!isUndefinedOrNullOrEmpty(recyclingErrorJsonArrayStr)){ - var recyclingErrorJsonArray = JSON.parse(recyclingErrorJsonArrayStr); - for(var j = 0;j < recyclingErrorJsonArray.length;j++) { + var recyclingErrorJsonArrayStr = $('#recyclingError' + row).val(); + if (!isUndefinedOrNullOrEmpty(recyclingErrorJsonArrayStr)) { + var recyclingErrorJsonArray = JSON.parse(recyclingErrorJsonArrayStr); + for (var j = 0; j < recyclingErrorJsonArray.length; j++) { var errorAmount = recyclingErrorJsonArray[j].amount; - if(errorAmount > 0){ + if (errorAmount > 0) { returnMsg = "该器械包有登记丢失信息,请先删除丢失信息后再删除!"; break; } - } - } - if(returnMsg == ""){ - var recyclingItemDamageJsonStr = $('#recyclingDamage'+row).val(); - if(!isUndefinedOrNullOrEmpty(recyclingItemDamageJsonStr)){ - var jsonArray = JSON.parse(recyclingItemDamageJsonStr); - for(var j = 0;j < jsonArray.length ; j++){ - var errorAmount = jsonArray[j].amount; - if(errorAmount > 0){ - returnMsg = "该器械包有登记报损信息,请先删除报损信息后再删除!"; - break; - } - } - } + } } + if (returnMsg == "") { + var recyclingItemDamageJsonStr = $('#recyclingDamage' + row).val(); + if (!isUndefinedOrNullOrEmpty(recyclingItemDamageJsonStr)) { + var jsonArray = JSON.parse(recyclingItemDamageJsonStr); + for (var j = 0; j < jsonArray.length; j++) { + var errorAmount = jsonArray[j].amount; + if (errorAmount > 0) { + returnMsg = "该器械包有登记报损信息,请先删除报损信息后再删除!"; + break; + } + } + } + } return returnMsg; } // 删除器械包 -function deleteTousseItem(row){ +function deleteTousseItem(row) { var returnMsg = checkHaveErrorDamage(row); - var loadedAmount = $('#loadedAmount'+row).val(); - if(!isUndefinedOrNullOrEmpty(returnMsg)){ + var loadedAmount = $('#loadedAmount' + row).val(); + if (!isUndefinedOrNullOrEmpty(returnMsg)) { alertDiv(returnMsg); return false; } - $('#tousseItemsTr'+row).hide(); - $('#tousseItemsTr'+row).addClass('tousseActive'); - $('#deleted'+row).val('1'); - var tousseName = $('#tousseName'+row).val(); - var amountLeft = parseInt($('#loadedAmount'+row).val(),10); - var tousseDefinitionID = parseInt($('#tousseDefinitionID'+row).val(),10); - var tousse = { + $('#tousseItemsTr' + row).hide(); + $('#tousseItemsTr' + row).addClass('tousseActive'); + $('#deleted' + row).val('1'); + var tousseName = $('#tousseName' + row).val(); + var amountLeft = parseInt($('#loadedAmount' + row).val(), 10); + var tousseDefinitionID = parseInt($('#tousseDefinitionID' + row).val(), 10); + var tousse = { tousseDefinitionID: tousseDefinitionID, tousseName: tousseName, amount: amountLeft } - + deleteTousseItemArray.push(tousse); //如果主绑物品被删除了,那么也删除对应的次绑物品 - if(unrecycleTousseItemArray.length > 0){ - for(var k = 0; k < unrecycleTousseItemArray.length; k++){ - if(unrecycleTousseItemArray[k].mainBindGoodId == tousseDefinitionID){ - unrecycleTousseItemArray.splice(k,1); + if (unrecycleTousseItemArray.length > 0) { + for (var k = 0; k < unrecycleTousseItemArray.length; k++) { + if (unrecycleTousseItemArray[k].mainBindGoodId == tousseDefinitionID) { + unrecycleTousseItemArray.splice(k, 1); } } } - delete(sessionTousseInstance[tousseDefinitionID]); - //移除篮筐内物品 - $("#basketsUl li").each(function(){ - var jsonObj = null; - $(this).find('dl').children().each(function(i,element){ - if($(this).attr('type') == 'hidden'){ - var obj = $(this).val(); - jsonObj = JSON.parse(obj); - }else if($(this).attr('class') == 'del'){ - if(jsonObj.tousseName == tousseName){ - var deleteButton = $(this).find('a'); - deleteBasketItem(deleteButton); - } - } - }); - }); - var depart = $('#depart').text(); - var recyclingTime = $('#recyclingTime').val(); - var applicationAmount = $('#applicationAmount'+row).val(); - var description = "ID=" + params_appId + ",科室[" + depart + "]的申请单在" + recyclingTime + "回收时删除[" + tousseName + "]" + applicationAmount + "个"; - //日志记录 - $.ajax({ - type:'get', - url : WWWROOT + '/log/saveLog.do', - data:'model=' + encodeURI("回收模块") + '&type=D&description=' + encodeURI(description), - dataType:'text', - success:function(msg){ - }, - error:function(msg){ - } + delete (sessionTousseInstance[tousseDefinitionID]); + //移除篮筐内物品 + $("#basketsUl li").each(function () { + var jsonObj = null; + $(this).find('dl').children().each(function (i, element) { + if ($(this).attr('type') == 'hidden') { + var obj = $(this).val(); + jsonObj = JSON.parse(obj); + } else if ($(this).attr('class') == 'del') { + if (jsonObj.tousseName == tousseName) { + var deleteButton = $(this).find('a'); + deleteBasketItem(deleteButton); + } + } + }); }); - if(shareDepartsMap.has(tousseName)){ + var depart = $('#depart').text(); + var recyclingTime = $('#recyclingTime').val(); + var applicationAmount = $('#applicationAmount' + row).val(); + var description = "ID=" + params_appId + ",科室[" + depart + "]的申请单在" + recyclingTime + "回收时删除[" + tousseName + "]" + applicationAmount + "个"; + //日志记录 + $.ajax({ + type: 'get', + url: WWWROOT + '/log/saveLog.do', + data: 'model=' + encodeURI("回收模块") + '&type=D&description=' + encodeURI(description), + dataType: 'text', + success: function (msg) { + }, + error: function (msg) { + } + }); + if (shareDepartsMap.has(tousseName)) { shareDepartsMap.deletes(tousseName) } - if(shareDepartsArr.length > 0){ - for(var i=0;i 0) { + for (var i = 0; i < shareDepartsArr.length; i++) { + if (shareDepartsArr[i].tousseName == tousseName) { + shareDepartsArr.splice(i, 1); } } } - return true; + return true; } // 不明白什么意思 -function unloadStaff(tousseDefinitionID,amount,idCardBarcode){ - $('#tousseItemTable').children().first().children().each(function(i,element){ - if($('#tousseDefinitionID'+i).val() == tousseDefinitionID && $('#tousseItemsTr'+i).css("display") !== 'none'){ - $('#loadedAmount'+i).val(parseInt($('#loadedAmount'+i).val(),10)-parseInt(amount,10)); - var idCard = $('#isThereIdentificationCard'+i).val(); - if(idCard == '是' && idCardBarcode == ''){ - var recyclingErrorJsonArrayStr = $('#recyclingError'+i).val(); - if(!isUndefinedOrNullOrEmpty(recyclingErrorJsonArrayStr)){ - var recyclingErrorJsonArray = JSON.parse(recyclingErrorJsonArrayStr); - for(var j = 0;j < recyclingErrorJsonArray.length;j++) { - if(recyclingErrorJsonArray[j].materialName == '器械包标识牌'){ - var intoBasketAmount = parseInt(recyclingErrorJsonArray[j].intoBasketAmount); - recyclingErrorJsonArray[j].intoBasketAmount = intoBasketAmount - parseInt(amount); - $('#recyclingError'+i).val(JSON.stringify(recyclingErrorJsonArray)); - break; - } - } - } - } - return false; - } - }); +function unloadStaff(tousseDefinitionID, amount, idCardBarcode) { + $('#tousseItemTable').children().first().children().each(function (i, element) { + if ($('#tousseDefinitionID' + i).val() == tousseDefinitionID && $('#tousseItemsTr' + i).css("display") !== 'none') { + $('#loadedAmount' + i).val(parseInt($('#loadedAmount' + i).val(), 10) - parseInt(amount, 10)); + var idCard = $('#isThereIdentificationCard' + i).val(); + if (idCard == '是' && idCardBarcode == '') { + var recyclingErrorJsonArrayStr = $('#recyclingError' + i).val(); + if (!isUndefinedOrNullOrEmpty(recyclingErrorJsonArrayStr)) { + var recyclingErrorJsonArray = JSON.parse(recyclingErrorJsonArrayStr); + for (var j = 0; j < recyclingErrorJsonArray.length; j++) { + if (recyclingErrorJsonArray[j].materialName == '器械包标识牌') { + var intoBasketAmount = parseInt(recyclingErrorJsonArray[j].intoBasketAmount); + recyclingErrorJsonArray[j].intoBasketAmount = intoBasketAmount - parseInt(amount); + $('#recyclingError' + i).val(JSON.stringify(recyclingErrorJsonArray)); + break; + } + } + } + } + return false; + } + }); } //删除整个篮筐 -function deleteBasket(deleteButton,basketBarcode,basketId){ +function deleteBasket(deleteButton, basketBarcode, basketId) { var liElement = $(deleteButton).parent().parent(); var delBasktJsonStr = liElement.find('input').val(); var basketJson = JSON.parse(delBasktJsonStr); - $("#basketsUl li").each(function(){ - var hideStr = $(this).find('input').val(); - var hiddenjson = JSON.parse(hideStr); - var actionBasketBarcode = basketJson.barcode; - if(hiddenjson.barcode == actionBasketBarcode){ - deleteAction(this); - $(this).remove(); - } - }); - + $("#basketsUl li").each(function () { + var hideStr = $(this).find('input').val(); + var hiddenjson = JSON.parse(hideStr); + var actionBasketBarcode = basketJson.barcode; + if (hiddenjson.barcode == actionBasketBarcode) { + deleteAction(this); + $(this).remove(); + } + }); + //如果篮筐全被删除完时,则提示信息放开 - if($("#basketsUl > li").length == 0 && $("#loadingPutBasket > li").length == 0){ + if ($("#basketsUl > li").length == 0 && $("#loadingPutBasket > li").length == 0) { $("#scanContainerBarcodeTipUl").show(); } - - for(var i=0;i 0){ + if ($(thiz).find('dl').children().length > 0) { deleteAction(thiz); } } //删除包内的材料 -function deleteMaterialItem(deleteButton,containerBarcode,basketId){ +function deleteMaterialItem(deleteButton, containerBarcode, basketId) { var hideElement = $(deleteButton).parent().prev().prev().prev().prev(); var nameElement = $(deleteButton).parent().prev().prev().prev(); - var barcodeElement = $(deleteButton).parent().prev().prev(); + var barcodeElement = $(deleteButton).parent().prev().prev(); var amountElement = $(deleteButton).parent().prev(); var delElement = $(deleteButton).parent(); var item = JSON.parse(hideElement.val()); var tousse = { basketBarcode: containerBarcode, basketId: basketId, - classifiedItemId:'', + classifiedItemId: '', tousseName: item.materialName, tousseDefinitionID: item.tousseDefinitionID, amount: -parseInt(item.amount), tousseAmountForMaterial: -parseInt(item.tousseAmount), itemType: item.type, tousseNameForMaterial: item.tousseName, idCardBarcode: item.idCardBarcode, - basketGroupBarcodes:item.basketGroupBarcodes, - lastTousseInstanceId:item.lastTousseInstanceId, - tousseInstanceBarcode:item.tousseInstanceBarcode + basketGroupBarcodes: item.basketGroupBarcodes, + lastTousseInstanceId: item.lastTousseInstanceId, + tousseInstanceBarcode: item.tousseInstanceBarcode } addOrDelTousse(tousse); - refreshSequence(delElement.parent().parent(),0); + refreshSequence(delElement.parent().parent(), 0); hideElement.remove(); nameElement.remove(); barcodeElement.remove(); @@ -1037,103 +1037,103 @@ } // 刷新篮筐序号 -function refreshSequence(liElement,sequence){ - if(liElement){ - if(!sequence || sequence <= 0){ +function refreshSequence(liElement, sequence) { + if (liElement) { + if (!sequence || sequence <= 0) { sequence = 0; } - var basketHidenValue = liElement.find('input:first').val(); - if(basketHidenValue){ + var basketHidenValue = liElement.find('input:first').val(); + if (basketHidenValue) { var basketInfo = JSON.parse(basketHidenValue); basketInfo.sequence = sequence; liElement.find('input:first').val(JSON.stringify(basketInfo)) - var showName = sequence > 0?(sequence + '.' + basketInfo.basketName):basketInfo.basketName; + var showName = sequence > 0 ? (sequence + '.' + basketInfo.basketName) : basketInfo.basketName; liElement.find('font:first').html(showName); } } } // 刷新对应篮筐的包与材料总数量 -function refreshBasketTotalNum(liElement){ - if(liElement){ +function refreshBasketTotalNum(liElement) { + if (liElement) { var total = 0; var sumCount = parseInt(liElement.find('span.hiddenSumCountValue').text() || 0); - liElement.find('dd.num').each(function(){ + liElement.find('dd.num').each(function () { var num = parseInt($(this).html()); - if(num){ + if (num) { total += num; } }); liElement.find('span.totalnum').html(total); - liElement.find('span.sumCount').html(sumCount+parseInt(total)); + liElement.find('span.sumCount').html(sumCount + parseInt(total)); } } // 刷新所有篮筐的包与材料总数量 -function refreshAllBasketTotalNum(){ - $("#basketsUl li").each(function(){ +function refreshAllBasketTotalNum() { + $("#basketsUl li").each(function () { refreshBasketTotalNum($(this)); }); isDelete = false; } //删除篮筐中的物品 -function deleteBasketItem(deleteButton,sum){ +function deleteBasketItem(deleteButton, sum) { var sumCount = sum || 0; var hideElement = $(deleteButton).parent().prev().prev().prev().prev(); var nameElement = $(deleteButton).parent().prev().prev().prev(); - var barcodeElement = $(deleteButton).parent().prev().prev(); + var barcodeElement = $(deleteButton).parent().prev().prev(); var amountElement = $(deleteButton).parent().prev(); var delElement = $(deleteButton).parent(); var basketElement = $(deleteButton).parent().parent(); var basketJSON = basketElement.find('input').eq(0); - var basket = basketJSON.val()?JSON.parse(basketJSON.val()):{}; - var item = hideElement.val()?JSON.parse(hideElement.val()):{}; + var basket = basketJSON.val() ? JSON.parse(basketJSON.val()) : {}; + var item = hideElement.val() ? JSON.parse(hideElement.val()) : {}; var name = ""; - if(!basket.barcode){ + if (!basket.barcode) { basketElement = $(deleteButton).parent().parent().parent(); basketJSON = basketElement.find('input').eq(0); - basket = basketJSON.val()?JSON.parse(basketJSON.val()):{}; + basket = basketJSON.val() ? JSON.parse(basketJSON.val()) : {}; } var tousseNameForMaterial = ""; var type = item.type; var idCardBarcode = item.idCardBarcode; var tousseInstanceBarcode = item.tousseInstanceBarcode; var basketGroupBarcodes = item.basketGroupBarcodes; //删除材料所在包 内的 全部删除 - if(type == "材料"){ + if (type == "材料") { name = item.materialName; tousseNameForMaterial = item.tousseName; - $('dl[class="sed clearfix"]').each(function(){ + $('dl[class="sed clearfix"]').each(function () { var basketEle = $(this).parent().find('input').eq(0).val(); - if(basketEle !== ''){ - var basketJSON = eval('('+basketEle+')'); - $(this).children().each(function(){ - if($(this).attr('type') == 'hidden'){ + if (basketEle !== '') { + var basketJSON = eval('(' + basketEle + ')'); + $(this).children().each(function () { + if ($(this).attr('type') == 'hidden') { var hideValue = $(this).val(); - if(!isUndefinedOrNullOrEmpty(hideValue)){ + if (!isUndefinedOrNullOrEmpty(hideValue)) { var obj = JSON.parse(hideValue); - if(obj.type == '材料' && obj.tousseDefinitionID == item.tousseDefinitionID && - obj.basketGroupBarcodes == basketGroupBarcodes && - obj.idCardBarcode == idCardBarcode && obj.tousseInstanceBarcode == tousseInstanceBarcode){ - + if (obj.type == '材料' && obj.tousseDefinitionID == item.tousseDefinitionID && + obj.basketGroupBarcodes == basketGroupBarcodes && + obj.idCardBarcode == idCardBarcode && obj.tousseInstanceBarcode == tousseInstanceBarcode) { + var delButton = $(this).next().next().next().next().find('a'); - deleteMaterialItem(delButton,basketJSON.barcode,basketJSON.classifyBasketId); - } + deleteMaterialItem(delButton, basketJSON.barcode, basketJSON.classifyBasketId); + } } } }); } - }); + }); } var tousseAmountForMaterial = item.tousseAmount; - if(type == '材料'){ - unloadStaff(item.tousseDefinitionID,tousseAmountForMaterial,idCardBarcode); - }else{ + if (type == '材料') { + unloadStaff(item.tousseDefinitionID, tousseAmountForMaterial, idCardBarcode); + } else { name = item.tousseName; var amount = item.amount; - unloadStaff(item.tousseDefinitionID,amount,idCardBarcode); - if(sumCount == 0){ + unloadStaff(item.tousseDefinitionID, amount, idCardBarcode); + if (sumCount == 0) { var basketId = basket.classifyBasketId; var containerBarcode = basket.barcode; var tousse = { @@ -1148,32 +1148,32 @@ tousseNameForMaterial: tousseNameForMaterial, idCardBarcode: idCardBarcode, basketGroupBarcodes: basketGroupBarcodes, - lastTousseInstanceId:item.lastTousseInstanceId, - tousseInstanceBarcode:item.tousseInstanceBarcode + lastTousseInstanceId: item.lastTousseInstanceId, + tousseInstanceBarcode: item.tousseInstanceBarcode } - for(var items in sessionTousseInstance){ - if(parseInt(items) == parseInt(tousse.tousseDefinitionID)){ - if(sessionTousseInstance[items].barcodeArray1.indexOf(tousse.tousseInstanceBarcode) >= 0){ + for (var items in sessionTousseInstance) { + if (parseInt(items) == parseInt(tousse.tousseDefinitionID)) { + if (sessionTousseInstance[items].barcodeArray1.indexOf(tousse.tousseInstanceBarcode) >= 0) { var barcodeArray1 = sessionTousseInstance[items].barcodeArray1; var idsArray1 = sessionTousseInstance[items].idsArray1; - for(var i=0;i'; - element += '
 ' + showBarcode + '
'; - element += '
' + amount + '
'; - element += '
删除
'; - var json = getBasketItemJSON(ci_id,type,orgUnitName,tousseName,materialName,amount,tousseAmount,idCardBarcode,tousseDefinitionID,basketGroupBarcodes,putBasketMaxAmount,tousseType,lastTousseInstanceId,tousseInstanceBarcode,washClassifyType); - if(type == '材料'){ - $("#basketsUl li").each(function(){ + element += '
' + showName + '
'; + element += '
 ' + showBarcode + '
'; + element += '
' + amount + '
'; + element += '
删除
'; + var json = getBasketItemJSON(ci_id, type, orgUnitName, tousseName, materialName, amount, tousseAmount, idCardBarcode, tousseDefinitionID, basketGroupBarcodes, putBasketMaxAmount, tousseType, lastTousseInstanceId, tousseInstanceBarcode, washClassifyType); + if (type == '材料') { + $("#basketsUl li").each(function () { var hideStr = $(this).find('input').val(); var jsonParent = JSON.parse(hideStr); - if(jsonParent.washClassifyType == washClassifyType && basketItem.basketBarcode == jsonParent.barcode){ + if (jsonParent.washClassifyType == washClassifyType && basketItem.basketBarcode == jsonParent.barcode) { basketElement = $(this).find("dl"); basketElement.prepend($(element)); basketElement.find("input:first").val(json); } }); - }else { + } else { basketElement.prepend($(element)); basketElement.find("input:first").val(json); } } - + var basketJson = JSON.parse(basketHidenValue); - basketBarcode = (basketBarcode)?basketBarcode:basketJson.barcode; - basketId = (basketId)?basketId:basketJson.classifyBasketId; - + basketBarcode = (basketBarcode) ? basketBarcode : basketJson.barcode; + basketId = (basketId) ? basketId : basketJson.classifyBasketId; + var goodsName = tousseName; var tousseNameForMaterial = ""; - if(type == "材料"){ + if (type == "材料") { goodsName = materialName; tousseNameForMaterial = tousseName; } @@ -1454,33 +1454,33 @@ tousseNameForMaterial: tousseNameForMaterial, idCardBarcode: idCardBarcode, tousseDefinitionID: tousseDefinitionID, - tousseInstanceBarcode:tousseInstanceBarcode, + tousseInstanceBarcode: tousseInstanceBarcode, basketGroupBarcodes: basketGroupBarcodes, - basketSequence:basketJson.sequence, - lastTousseInstanceId:lastTousseInstanceId, - washClassifyType:washClassifyType + basketSequence: basketJson.sequence, + lastTousseInstanceId: lastTousseInstanceId, + washClassifyType: washClassifyType } addOrDelTousse(tousse); } // 更新丢失报损的数量 -function setIdCardErrorIntoBasketAmount(row,amount){ - var recyclingErrorJsonArrayStr = $('#recyclingError'+row).val(); - if(!isUndefinedOrNullOrEmpty(recyclingErrorJsonArrayStr)){ - var recyclingErrorJsonArray = JSON.parse(recyclingErrorJsonArrayStr); - for(var j = 0;j < recyclingErrorJsonArray.length;j++) { - if(recyclingErrorJsonArray[j].materialName == '器械包标识牌'){ - var intoBasketAmount = recyclingErrorJsonArray[j].intoBasketAmount; - recyclingErrorJsonArray[j].intoBasketAmount = parseInt(intoBasketAmount) + parseInt(amount); - $('#recyclingError'+row).val(JSON.stringify(recyclingErrorJsonArray)); - break; - } - } - } +function setIdCardErrorIntoBasketAmount(row, amount) { + var recyclingErrorJsonArrayStr = $('#recyclingError' + row).val(); + if (!isUndefinedOrNullOrEmpty(recyclingErrorJsonArrayStr)) { + var recyclingErrorJsonArray = JSON.parse(recyclingErrorJsonArrayStr); + for (var j = 0; j < recyclingErrorJsonArray.length; j++) { + if (recyclingErrorJsonArray[j].materialName == '器械包标识牌') { + var intoBasketAmount = recyclingErrorJsonArray[j].intoBasketAmount; + recyclingErrorJsonArray[j].intoBasketAmount = parseInt(intoBasketAmount) + parseInt(amount); + $('#recyclingError' + row).val(JSON.stringify(recyclingErrorJsonArray)); + break; + } + } + } } // 是否显示篮筐装载器械总件数 -function basketLoadGoods(basketName,basketBarcode,classifyBasketId){ +function basketLoadGoods(basketName, basketBarcode, classifyBasketId) { var width = 740; var height = 400; var designedTousseWidth = 980; @@ -1491,110 +1491,110 @@ var actualHeight = window.screen.availHeight; var offsetTop = 100; var heightExtra = 10; - if(resolution == '1980'){ + if (resolution == '1980') { width = 1080; height = 800; } - var zoomRatio = calculateZoomRatio(designedWidth,designedHeight,actualWidth,actualHeight); - var size = calculateSizeAfterZoom(designedTousseWidth,designedTousseHeight,zoomRatio); + var zoomRatio = calculateZoomRatio(designedWidth, designedHeight, actualWidth, actualHeight); + var size = calculateSizeAfterZoom(designedTousseWidth, designedTousseHeight, zoomRatio); var isLessIE11 = navigator.userAgent.indexOf('compatible') > -1 && navigator.userAgent.indexOf('MSIE') > -1; - if(!isLessIE11){ - document.body.style.zoom = 1; - documentGetElementsByClassName('mbody')[0].style.zoom = zoomRatio; + if (!isLessIE11) { + document.body.style.zoom = 1; + documentGetElementsByClassName('mbody')[0].style.zoom = zoomRatio; } width = size.width; height = size.height; - offsetTop = offsetTop*zoomRatio; - layerIndex=layer.open({ - type : 2, - title : ['['+basketName + '] 已装载物品列表',true], - content : 'basketLoadGoodsView.jsp?resolution=' + resolution + '&width=' + width + '&height=' + height + '&basketBarcode=' + basketBarcode + '&classifyBasketId=' + classifyBasketId, - area : [ width + 'px' , height +heightExtra + 'px'], - border : [5, 0.3, '#fff', true], - closeBtn : [2 , true], - offset : [offsetTop+'px',''] + offsetTop = offsetTop * zoomRatio; + layerIndex = layer.open({ + type: 2, + title: ['[' + basketName + '] 已装载物品列表', true], + content: 'basketLoadGoodsView.jsp?resolution=' + resolution + '&width=' + width + '&height=' + height + '&basketBarcode=' + basketBarcode + '&classifyBasketId=' + classifyBasketId, + area: [width + 'px', height + heightExtra + 'px'], + border: [5, 0.3, '#fff', true], + closeBtn: [2, true], + offset: [offsetTop + 'px', ''] }); } // 清洗装载的篮筐点击使用按钮 -function userContainer(that,user,basketName,basketBarcode,classifyBasketId,washClassifyType){ - if ( event && event.preventDefault ){ +function userContainer(that, user, basketName, basketBarcode, classifyBasketId, washClassifyType) { + if (event && event.preventDefault) { event.preventDefault(); - }else{//IE中阻止函数器默认动作的方式 + } else {//IE中阻止函数器默认动作的方式 window.event.returnValue = false; - } - if(user == 1){ + } + if (user == 1) { var sumCount = $(that).parent().parent().find('.totalAmount').text(); - createBasketUiElement(basketBarcode,classifyBasketId,basketName,washClassifyType,undefined,false,parseInt(sumCount)); + createBasketUiElement(basketBarcode, classifyBasketId, basketName, washClassifyType, undefined, false, parseInt(sumCount)); $(that).parent().parent().remove(); - }else if(user == 2){ + } else if (user == 2) { var sumCount = $(that).find('.totalAmount').text(); - createBasketUiElement(basketBarcode,classifyBasketId,basketName,washClassifyType,undefined,false,parseInt(sumCount)); + createBasketUiElement(basketBarcode, classifyBasketId, basketName, washClassifyType, undefined, false, parseInt(sumCount)); $(that).remove(); - }else { + } else { var sumCount = $(that).parent().find('.totalAmount').text(); - createBasketUiElement(basketBarcode,classifyBasketId,basketName,washClassifyType,undefined,false,parseInt(sumCount)); + createBasketUiElement(basketBarcode, classifyBasketId, basketName, washClassifyType, undefined, false, parseInt(sumCount)); $(that).parent().remove(); } } // 创建篮筐 -function createBasketUiElement(basketBarcode,classifyBasketId,basketName,washClassifyType,sequence,isIdCard,sumCount){ +function createBasketUiElement(basketBarcode, classifyBasketId, basketName, washClassifyType, sequence, isIdCard, sumCount) { var basketElement = '
  • '; - basketElement += ''; - basketElement += ''; - basketElement += '删除'; - basketElement += ''; - basketElement += ''; - - var showBasketLoadMaterialAmount = sstsConfig.showBasketLoadMaterialAmount; + basketElement += ''; + basketElement += ''; + basketElement += '删除'; + basketElement += ''; + basketElement += ''; + + var showBasketLoadMaterialAmount = sstsConfig.showBasketLoadMaterialAmount; var imageButton = ''; - if(showBasketLoadMaterialAmount == true){ - imageButton = ''; - } - basketElement += '' + (sequence&&sequence>0?(sequence+'.' + basketName):basketName) +''+''+imageButton+''; - if(sumCount){ - basketElement += '0/'+sumCount+''; - basketElement += ''; - }else { + if (showBasketLoadMaterialAmount == true) { + imageButton = ''; + } + basketElement += '' + (sequence && sequence > 0 ? (sequence + '.' + basketName) : basketName) + '' + '' + imageButton + ''; + if (sumCount) { + basketElement += '0/' + sumCount + ''; + basketElement += ''; + } else { basketElement += '0'; } basketElement += '
    '; - basketElement += '
  • '; - var obj = $(basketElement); - $("#basketsUl").prepend(obj); - var json = getBasketJSON(classifyBasketId,basketBarcode,washClassifyType,sequence,basketName,isIdCard); + basketElement += ''; + var obj = $(basketElement); + $("#basketsUl").prepend(obj); + var json = getBasketJSON(classifyBasketId, basketBarcode, washClassifyType, sequence, basketName, isIdCard); $("#basketsUl li:first").find('input').val(json); - toggleItems(obj.find('span')[0]); + toggleItems(obj.find('span')[0]); } // 提示标识牌的使用次数 -function noticeIdCardUseAmount(useAmount){ - if(sstsConfig && sstsConfig.idCardUseAmountNoticeType){ +function noticeIdCardUseAmount(useAmount) { + if (sstsConfig && sstsConfig.idCardUseAmountNoticeType) { var msg = '此标识牌已经使用' + useAmount + '次'; - if(1 == sstsConfig.idCardUseAmountNoticeType){ + if (1 == sstsConfig.idCardUseAmountNoticeType) { jShowResult(msg); - }else if(2 == sstsConfig.idCardUseAmountNoticeType){ + } else if (2 == sstsConfig.idCardUseAmountNoticeType) { speaker.speak(msg); - }else if(3 == sstsConfig.idCardUseAmountNoticeType){ + } else if (3 == sstsConfig.idCardUseAmountNoticeType) { speaker.speak(msg); jShowResult(msg); } } } // 添加篮筐 -function addBasketElement(basketItem,isIdCard,isSave){ - if(basketArray.length > 0){ - if(basketArray.indexOf(basketItem.containerBarcode) >= 0){ - $("#loadingPutBasket li").each(function(){ +function addBasketElement(basketItem, isIdCard, isSave) { + if (basketArray.length > 0) { + if (basketArray.indexOf(basketItem.containerBarcode) >= 0) { + $("#loadingPutBasket li").each(function () { var hide = $(this).find('input'); - var item = eval('('+hide.val()+')'); - if(item.barcode == basketItem.containerBarcode){ - userContainer(this,2,basketItem.containerName,basketItem.containerBarcode,basketItem.id,basketItem.washClassifyType); + var item = eval('(' + hide.val() + ')'); + if (item.barcode == basketItem.containerBarcode) { + userContainer(this, 2, basketItem.containerName, basketItem.containerBarcode, basketItem.id, basketItem.washClassifyType); return false; } }); @@ -1604,39 +1604,39 @@ isIdCard = isIdCard || false; var currentNode; var isBasketLoaded = false; - $("#basketsUl li").each(function(){ - var hide = $(this).find('input'); - var item = JSON.parse(hide.val()); - if(item.barcode == basketItem.containerBarcode){ - isBasketLoaded = true; - currentNode = $(this); - return false; - } - }); - - if(isBasketLoaded){ - //将篮筐放置在最前面 - $("#basketsUl").prepend(currentNode); -// toggleItems(currentNode.find('span')[1]); - }else{ - createBasketUiElement(basketItem.containerBarcode,basketItem.id,basketItem.containerName,basketItem.washClassifyType,undefined,isIdCard); + $("#basketsUl li").each(function () { + var hide = $(this).find('input'); + var item = JSON.parse(hide.val()); + if (item.barcode == basketItem.containerBarcode) { + isBasketLoaded = true; + currentNode = $(this); + return false; + } + }); + + if (isBasketLoaded) { + //将篮筐放置在最前面 + $("#basketsUl").prepend(currentNode); + // toggleItems(currentNode.find('span')[1]); + } else { + createBasketUiElement(basketItem.containerBarcode, basketItem.id, basketItem.containerName, basketItem.washClassifyType, undefined, isIdCard); } - if(saveBasketsArr.indexOf(basketItem.containerBarcode) == -1 && isSave){ + if (saveBasketsArr.indexOf(basketItem.containerBarcode) == -1 && isSave) { saveBasketsArr.push(basketItem.containerBarcode); } - $("#scanContainerBarcodeTipUl").hide(); + $("#scanContainerBarcodeTipUl").hide(); } // 广州市第八人民医院 篮筐重新置顶作为优先载入篮筐 -function topScannedBasket(event,that,user){ - if ( event && event.preventDefault ){ +function topScannedBasket(event, that, user) { + if (event && event.preventDefault) { event.preventDefault(); - }else{//IE中阻止函数器默认动作的方式 + } else {//IE中阻止函数器默认动作的方式 window.event.returnValue = false; - } - if(user){ + } + if (user) { $("#basketsUl").prepend($(that).parent().parent()); - }else { + } else { $("#basketsUl").prepend($(that).parent()); } } @@ -1646,11 +1646,11 @@ *
    因为没有选择科室,就添加器械包,会导致在后面选择科室之后,添加的器械包会被清空. * 返回true,表示已经选择了科室,或者没有加载模板的功能,不选科室也没关系。返回false表示必须先选科室了才能添加器械包,并且当前还没有选择科室。 */ -function checkSelectDepartBeforeAddTousse(){ - if(sstsConfig.isLoadApplyTemplateForAddRecycleRecord == true){ +function checkSelectDepartBeforeAddTousse() { + if (sstsConfig.isLoadApplyTemplateForAddRecycleRecord == true) { var departName = document.getElementById('depart').innerText; var departCode = document.getElementById('departCode').value; - if(isUndefinedOrNullOrEmpty(departCode) || isUndefinedOrNullOrEmpty(departName)){ + if (isUndefinedOrNullOrEmpty(departCode) || isUndefinedOrNullOrEmpty(departName)) { alertDiv("请选择科室"); return false; } @@ -1672,27 +1672,27 @@ // 是否正在显示装配任务对话框,防止重复显示 var showingPackingTask = false; -function showUnfinishedPackingTask(msg){ +function showUnfinishedPackingTask(msg) { var message = null; - if(!msg.unfinishedPackingTask || msg.unfinishedPackingTask.length == 0){ + if (!msg.unfinishedPackingTask || msg.unfinishedPackingTask.length == 0) { message = msg.errorMessage; alertDiv(message); - }else{ - if(!showingPackingTask){ + } else { + if (!showingPackingTask) { var tdStyle = 'font-size:28px;text-align:center;'; - var nameWidth = '440px;',taskGroupWidth='200px;',amoutWidth='140px;'; - var table = '
    物品名称数量'+name+'是否拆单
    物品名称数量' + name + '是否拆单
    '+newTousseArray[i].amount+''+newTousseArray[i].depart+'' + newTousseArray[i].tousseName + '' + newTousseArray[i].amount + '' + newTousseArray[i].depart + '
    '; - for(var i = 0; i < msg.unfinishedPackingTask.length;++i){ + var nameWidth = '440px;', taskGroupWidth = '200px;', amoutWidth = '140px;'; + var table = '
    '+msg.errorMessage+'
    任务组器械包数量
    '; + for (var i = 0; i < msg.unfinishedPackingTask.length; ++i) { var task = msg.unfinishedPackingTask[i]; - table += ''; + table += ''; } table += '
    ' + msg.errorMessage + '
    任务组器械包数量
    '+task.taskGroup+''+task.name+''+task.unPackAmount+'
    ' + task.taskGroup + '' + task.name + '' + task.unPackAmount + '
    '; - var html = '
    '+table+'
    '; + var html = '
    ' + table + '
    '; $(html).dialog({ maxHeight: 600, width: 800, - modal:true, - close: function( event, ui ) { + modal: true, + close: function (event, ui) { showingPackingTask = false; } }); @@ -1702,52 +1702,52 @@ } // 显示申请单终止原因 -function showSelectTousseDiscardCauseWin(){ - var endCase = openModalWindowForExt(WWWROOT+"/disinfectsystem/recyclingApplication/selectTousseDiscardCause.jsp", '','请选择终止原因', "760", "400"); - - if(endCase == undefined){ - return; - }else { - var loop = setInterval(function() { - if(endCase.hidden) { +function showSelectTousseDiscardCauseWin() { + var endCase = openModalWindowForExt(WWWROOT + "/disinfectsystem/recyclingApplication/selectTousseDiscardCause.jsp", '', '请选择终止原因', "760", "400"); + + if (endCase == undefined) { + return; + } else { + var loop = setInterval(function () { + if (endCase.hidden) { clearInterval(loop); var returnValue = endCase.returnValue || ''; - if(returnValue == ''){ - return; + if (returnValue == '') { + return; } - + return returnValue; } - },500); + }, 500); } } // 清洗完成或清洗中确认是否继续使用篮筐 -function loadDialogConfirm(msg,isSave){ +function loadDialogConfirm(msg, isSave) { $("#dialogConfirm").dialog({ resizable: false, - height:325, - width:600, + height: 325, + width: 600, modal: true, - open: function() { - $("#confirmMsg").text("【"+msg.basket.containerName + "】当前状态为【" + msg.containerStatus + "】,还有物品未装配,是否继续使用该篮筐?"); + open: function () { + $("#confirmMsg").text("【" + msg.basket.containerName + "】当前状态为【" + msg.containerStatus + "】,还有物品未装配,是否继续使用该篮筐?"); }, - close: function() { + close: function () { $("#confirmMsg").text(""); }, buttons: { - "是": function() { - addBasketElement(msg.basket,false,isSave); - $( this ).dialog( "close" ); - + "是": function () { + addBasketElement(msg.basket, false, isSave); + $(this).dialog("close"); + loadNextBindingBasket(); }, - "否": function() { - $( this ).dialog( "close" ); - + "否": function () { + $(this).dialog("close"); + loadNextBindingBasket(); - + } } }); @@ -1757,43 +1757,43 @@ * 加载下一个绑定的清洗篮筐。 * 加载前,从绑定篮筐的数组中删除已经做了扫描处理的篮筐条码 */ -function loadNextBindingBasket(){ - if (departBindingBasketBarcodes.length > 0){ - // 删除数组的第1个元素,即已经做了扫描处理的篮筐条码 - departBindingBasketBarcodes.splice(0, 1); - } - if (departBindingBasketBarcodes.length > 0){ - loadBarcodeDevice(departBindingBasketBarcodes[0],false); - } +function loadNextBindingBasket() { + if (departBindingBasketBarcodes.length > 0) { + // 删除数组的第1个元素,即已经做了扫描处理的篮筐条码 + departBindingBasketBarcodes.splice(0, 1); + } + if (departBindingBasketBarcodes.length > 0) { + loadBarcodeDevice(departBindingBasketBarcodes[0], false); + } } // 扫描包实例条码 -function scanTousseInstance(msg){ - if(!msg.isIDCardInstance){//扫描器械包实例的条码 +function scanTousseInstance(msg) { + if (!msg.isIDCardInstance) {//扫描器械包实例的条码 var ti = msg.tousseInstance; var td = ti.tousseDefinition; - if(sstsConfig.enableAutoIntoWashBasketWhenScanTousseBarcode){ + if (sstsConfig.enableAutoIntoWashBasketWhenScanTousseBarcode) { var basketHideStr = $("#basketsUl li:first").find('input').val(); - if(basketHideStr == null || basketHideStr == ""){ + if (basketHideStr == null || basketHideStr == "") { newAlert("请扫描篮筐条码!"); return false; } - - if(!sstsConfig.disableIdCard && td.isDisableIDCard == "否"){//配置项开启和包定义中启用标识牌功能后,必须扫描标识牌回收 - newAlert(td.name+"启用了标识牌功能,不能扫描包实例条码,请扫描标识牌条码!"); + + if (!sstsConfig.disableIdCard && td.isDisableIDCard == "否") {//配置项开启和包定义中启用标识牌功能后,必须扫描标识牌回收 + newAlert(td.name + "启用了标识牌功能,不能扫描包实例条码,请扫描标识牌条码!"); return false; } - + var exist = tousseInstanceBarcodeIsExist(ti.barcode); - if(exist){ - alertDiv(barcode+",已入筐!"); - }else{ + if (exist) { + alertDiv(barcode + ",已入筐!"); + } else { var orgUnitName = $('#depart').text(); - var loadedAmount2 = tousseIntoBasketFunction(ti.id,td.id,td.name,1,td.isCleanedEntirely,orgUnitName,"",ti.barcode,td.tousseType,-1,'否',2,msg); - } - }else{ + var loadedAmount2 = tousseIntoBasketFunction(ti.id, td.id, td.name, 1, td.isCleanedEntirely, orgUnitName, "", ti.barcode, td.tousseType, -1, '否', 2, msg); + } + } else { var isThereIdentificationCard = '否'; - if(td.isDisableIDCard == "否"){ + if (td.isDisableIDCard == "否") { isThereIdentificationCard = '是'; } var tmpRow = $("#tousseItemTable > tbody > tr").length; //获取子元素,不包含孙子及以下的元素 @@ -1811,671 +1811,671 @@ tousseType: td.tousseType, isThereIdentificationCard: isThereIdentificationCard, isApplyEntireTousse: td.isApplyEntireTousse, - urgentAmount : 0, - tousseRemark:'', - errorDamageQmKey : errorDamageQmKey, - barcode : ti.barcode + urgentAmount: 0, + tousseRemark: '', + errorDamageQmKey: errorDamageQmKey, + barcode: ti.barcode }; - addBindGoods(toussItem,sstsConfig.addTousseAtLastForRecycle); - addErrorDamageRemark(ti,tmpRow); + addBindGoods(toussItem, sstsConfig.addTousseAtLastForRecycle); + addErrorDamageRemark(ti, tmpRow); var orgUnitName = $('#depart').text(); - addToussItem(toussItem,sstsConfig.addTousseAtLastForRecycle,true,ti.id,msg.isFixedBarcode); + addToussItem(toussItem, sstsConfig.addTousseAtLastForRecycle, true, ti.id, msg.isFixedBarcode); //未补充的丢失报损 - loadUnSupplementMaterial(msg,tmpRow,ti.barcode); + loadUnSupplementMaterial(msg, tmpRow, ti.barcode); } - }else{ //扫描标识牌实例条码 + } else { //扫描标识牌实例条码 barcode = msg.idCardInstance.barcode; var departValue = $('#depart').text(); var tousseDepart = ''; var tousseDepartCode = ''; - if(msg.tousseInstanceOrgUnit){ + if (msg.tousseInstanceOrgUnit) { tousseDepart = msg.tousseInstanceOrgUnit.depart; tousseDepartCode = msg.tousseInstanceOrgUnit.orgUnitCoding; } - if(departValue == ''){ + if (departValue == '') { $('#depart').text(tousseDepart) $('#departCode').val(tousseDepartCode) } // 对于已废弃的包,不检查其位置和所属科室的信息 var ti = msg.tousseInstance; - var td = ti.tousseDefinition; - if(sstsConfig.restrictAddOtherGoodsToApplicationFromUseRecord && $('#useRecordId').val() != ''){ - var existRow = tousseItemExists(td.id, td.name, td.tousseType); - if(existRow == -1){ - alertDiv("不能添加申请单以外的物品 "); - return false; - }else if(parseInt($('#applicationAmount'+existRow).val()) - parseInt($('#loadedAmount'+existRow).val()) < 1 ){ - alertDiv("回收数量不能超过申请数量"); - return false; - } - } - var exist = idCardIsExist(barcode); - if(exist){ - alertDiv(barcode+",已入筐!"); - scanned = true; - }else{ - if(msg.shareDeparts){ - if(msg.shareDeparts.length > 0){ - if(msg.shareDeparts.indexOf(departValue) == -1 && departValue !== ''){ - alertDiv('该器械包不属于该科室。'); - return; - } - shareDepartsMap.set(msg.idCardInstance.tousseName,msg.shareDeparts); - }else { - if(!isUndefinedOrNullOrEmpty(tousseDepart) && $('#depart').text() != tousseDepart && msg.tousseInstance.status != '已废弃'){ - alertDiv('该器械包不属于该科室。'); - return; - } - shareDepartsArr.push({ - tousseName:msg.idCardInstance.tousseName, - tousseDepart:tousseDepart - }) + var td = ti.tousseDefinition; + if (sstsConfig.restrictAddOtherGoodsToApplicationFromUseRecord && $('#useRecordId').val() != '') { + var existRow = tousseItemExists(td.id, td.name, td.tousseType); + if (existRow == -1) { + alertDiv("不能添加申请单以外的物品 "); + return false; + } else if (parseInt($('#applicationAmount' + existRow).val()) - parseInt($('#loadedAmount' + existRow).val()) < 1) { + alertDiv("回收数量不能超过申请数量"); + return false; + } + } + var exist = idCardIsExist(barcode); + if (exist) { + alertDiv(barcode + ",已入筐!"); + scanned = true; + } else { + if (msg.shareDeparts) { + if (msg.shareDeparts.length > 0) { + if (msg.shareDeparts.indexOf(departValue) == -1 && departValue !== '') { + alertDiv('该器械包不属于该科室。'); + return; } - }else { - if(!isUndefinedOrNullOrEmpty(tousseDepart) && $('#depart').text() != tousseDepart && msg.tousseInstance.status != '已废弃'){ - alertDiv('该器械包不属��该科室。'); + shareDepartsMap.set(msg.idCardInstance.tousseName, msg.shareDeparts); + } else { + if (!isUndefinedOrNullOrEmpty(tousseDepart) && $('#depart').text() != tousseDepart && msg.tousseInstance.status != '已废弃') { + alertDiv('该器械包不属于该科室。'); return; } shareDepartsArr.push({ - tousseName:msg.idCardInstance.tousseName, - tousseDepart:tousseDepart + tousseName: msg.idCardInstance.tousseName, + tousseDepart: tousseDepart }) } - var orgUnitName = $('#depart').text(); - var addSuccess = false; - var idCardClassifyBasket = msg.idCardClassifyBasket; - if(idCardClassifyBasket){ - if(idCardClassifyBasket.containerStatus == "清洗完成" || idCardClassifyBasket.containerStatus == "清洗中"){ - alertDiv("【"+idCardClassifyBasket.containerName + "】当前状态为【" + idCardClassifyBasket.containerStatus + "】,还有物品未装配"); - return false; - }else{ - addBasketElement(idCardClassifyBasket,true); - } - } - var basketHideStr = $("#basketsUl li:first").find('input').val(); - if(sstsConfig.enableAutoIntoWashBasketWhenScanTousseBarcode){ - if(basketHideStr == null || basketHideStr == ""){ - alertDiv("请扫描篮筐条码!"); - return false; - } + } else { + if (!isUndefinedOrNullOrEmpty(tousseDepart) && $('#depart').text() != tousseDepart && msg.tousseInstance.status != '已废弃') { + alertDiv('该器械包不属��该科室。'); + return; } - - var loadedAmount = tousseIntoBasketFunction("",td.id,td.name,1,td.isCleanedEntirely,orgUnitName,barcode,"",td.tousseType,-1,'否',3,msg); - - //记住扫描的标志牌 - $('#tousseItemTable').children().first().children().each(function(i,element){ - if($('#tousseName'+i).val() == td.name && $('#deleted'+i).val() == '0'){ - var barcodesStr = $('#barcodes'+i).val(); - setTousseItemLoadedAmountCss(i) - if(barcodesStr == ""){ - var idCardBarcodeArray = new Array(); - idCardBarcodeArray[0] = {}; - idCardBarcodeArray[0].barcode = barcode; - idCardBarcodeArray[0].addSuccess = addSuccess; - idCardBarcodeArray[0].containerBarcode = (idCardClassifyBasket)?idCardClassifyBasket.containerBarcode:''; - $('#barcodes'+i).val(JSON.stringify(idCardBarcodeArray)); - - }else{ - var idCardBarcodeArray = JSON.parse(barcodesStr); - var idCardIsExist = false; - var idCardLen = idCardBarcodeArray.length; - for(var n = 0;n < idCardLen;n++){ - if(idCardBarcodeArray[n].barcode == barcode){ - idCardIsExist = true; - break; - } - } - if(!idCardIsExist){ - idCardBarcodeArray[idCardLen] = {}; - idCardBarcodeArray[idCardLen].barcode = barcode; - idCardBarcodeArray[idCardLen].containerBarcode = (idCardClassifyBasket)?idCardClassifyBasket.containerBarcode:''; - idCardBarcodeArray[idCardLen].addSuccess = addSuccess; - $('#barcodes'+i).val(JSON.stringify(idCardBarcodeArray)); - } - } - } - }); + shareDepartsArr.push({ + tousseName: msg.idCardInstance.tousseName, + tousseDepart: tousseDepart + }) } + var orgUnitName = $('#depart').text(); + var addSuccess = false; + var idCardClassifyBasket = msg.idCardClassifyBasket; + if (idCardClassifyBasket) { + if (idCardClassifyBasket.containerStatus == "清洗完成" || idCardClassifyBasket.containerStatus == "清洗中") { + alertDiv("【" + idCardClassifyBasket.containerName + "】当前状态为【" + idCardClassifyBasket.containerStatus + "】,还有物品未装配"); + return false; + } else { + addBasketElement(idCardClassifyBasket, true); + } + } + var basketHideStr = $("#basketsUl li:first").find('input').val(); + if (sstsConfig.enableAutoIntoWashBasketWhenScanTousseBarcode) { + if (basketHideStr == null || basketHideStr == "") { + alertDiv("请扫描篮筐条码!"); + return false; + } + } + + var loadedAmount = tousseIntoBasketFunction("", td.id, td.name, 1, td.isCleanedEntirely, orgUnitName, barcode, "", td.tousseType, -1, '否', 3, msg); + + //记住扫描的标志牌 + $('#tousseItemTable').children().first().children().each(function (i, element) { + if ($('#tousseName' + i).val() == td.name && $('#deleted' + i).val() == '0') { + var barcodesStr = $('#barcodes' + i).val(); + setTousseItemLoadedAmountCss(i) + if (barcodesStr == "") { + var idCardBarcodeArray = new Array(); + idCardBarcodeArray[0] = {}; + idCardBarcodeArray[0].barcode = barcode; + idCardBarcodeArray[0].addSuccess = addSuccess; + idCardBarcodeArray[0].containerBarcode = (idCardClassifyBasket) ? idCardClassifyBasket.containerBarcode : ''; + $('#barcodes' + i).val(JSON.stringify(idCardBarcodeArray)); + + } else { + var idCardBarcodeArray = JSON.parse(barcodesStr); + var idCardIsExist = false; + var idCardLen = idCardBarcodeArray.length; + for (var n = 0; n < idCardLen; n++) { + if (idCardBarcodeArray[n].barcode == barcode) { + idCardIsExist = true; + break; + } + } + if (!idCardIsExist) { + idCardBarcodeArray[idCardLen] = {}; + idCardBarcodeArray[idCardLen].barcode = barcode; + idCardBarcodeArray[idCardLen].containerBarcode = (idCardClassifyBasket) ? idCardClassifyBasket.containerBarcode : ''; + idCardBarcodeArray[idCardLen].addSuccess = addSuccess; + $('#barcodes' + i).val(JSON.stringify(idCardBarcodeArray)); + } + } + } + }); + } } checkLoadedAmount(); } // 根据扫描的条码加载对应的对象. -function loadBarcodeDevice(barcodeTemp,isSave){ +function loadBarcodeDevice(barcodeTemp, isSave) { barcodeGloble = ''; - if(barcodeTemp.length >= 1){ - //var barcode = barcodeTemp.substring(barcodeTemp.length-9,barcodeTemp.length); - //由于条码可能超过9位,所以取全部 + if (barcodeTemp.length >= 1) { + //var barcode = barcodeTemp.substring(barcodeTemp.length-9,barcodeTemp.length); + //由于条码可能超过9位,所以取全部 var barcode = barcodeTemp; - $.ajax({ - type:'get', - url:encodeURI(WWWROOT + '/disinfectSystem/recyclingRecordAction!getBarcodeInfo.do?time='+new Date().getTime()+'&barcode='+barcode+''), - data:'recyclingRecordId=' + encodeURI($('#id').val()) + '&formType=' + encodeURI($('#appType').val()), - dataType:'json', - success:function(msg){ + $.ajax({ + type: 'get', + url: encodeURI(WWWROOT + '/disinfectSystem/recyclingRecordAction!getBarcodeInfo.do?time=' + new Date().getTime() + '&barcode=' + barcode + ''), + data: 'recyclingRecordId=' + encodeURI($('#id').val()) + '&formType=' + encodeURI($('#appType').val()), + dataType: 'json', + success: function (msg) { var speakBasket = new SpeakBasket(); - if(msg.errorMessage != null && msg.isFixedBarcode == false){ - if(msg.unfinishedPackingTask!=null){ - showUnfinishedPackingTask(msg); - }else{ - if(sstsConfig.isDiscardWithRecovery && sstsConfig.isDiscardWithRecovery == true){ + if (msg.errorMessage != null && msg.isFixedBarcode == false) { + if (msg.unfinishedPackingTask != null) { + showUnfinishedPackingTask(msg); + } else { + if (sstsConfig.isDiscardWithRecovery && sstsConfig.isDiscardWithRecovery == true) { var ids = msg.tousseInstance.id; - if(msg.errorType && msg.errorType != undefined && msg.errorType != null && msg.tousseInstance.status != "已废弃"){ + if (msg.errorType && msg.errorType != undefined && msg.errorType != null && msg.tousseInstance.status != "已废弃") { $("#dialogConfirm").dialog({ resizable: false, - height:310, - width:600, + height: 310, + width: 600, modal: true, - open: function() { - $("#confirmMsg").text(msg.errorMessage + " 是否重新回收并且废弃上一次记录状态?"); + open: function () { + $("#confirmMsg").text(msg.errorMessage + " 是否重新回收并且废弃上一次记录状态?"); }, - close: function() { - $("#confirmMsg").text(""); + close: function () { + $("#confirmMsg").text(""); }, buttons: { - "是": function() { - $( this ).dialog( "close" ); - var remark = showSelectTousseDiscardCauseWin(); - if(remark != undefined && remark != ""){ - $.ajax({ - url : WWWROOT + '/disinfectSystem/tousseInstanceAction!deleteTousseGood.do', - type : "post", - data : {ids : ids , reason : remark}, - async : false, - success : function(res){ - loadBarcodeDevice(barcodeTemp,false); - } - }) - } - }, - "否": function() { - $( this ).dialog( "close" ); + "是": function () { + $(this).dialog("close"); + var remark = showSelectTousseDiscardCauseWin(); + if (remark != undefined && remark != "") { + $.ajax({ + url: WWWROOT + '/disinfectSystem/tousseInstanceAction!deleteTousseGood.do', + type: "post", + data: { ids: ids, reason: remark }, + async: false, + success: function (res) { + loadBarcodeDevice(barcodeTemp, false); + } + }) } + }, + "否": function () { + $(this).dialog("close"); + } } }); } - else{ + else { alertDiv(msg.errorMessage); } - }else{ - if(msg.errorMessage == "器械包已回收!"){ + } else { + if (msg.errorMessage == "器械包已回收!") { newAlert(msg.errorMessage); - }else{ + } else { alertDiv(msg.errorMessage); } } } - }else if(msg.orgUnit!= null){ - //只更新科室名称及编码信息(since2015-12-16 SYF),添加新单时才更新部门 - if(params_appId == null || params_appId == "null" || params_appId == ""){ - selectDepart(msg.orgUnit.name,msg.orgUnit.orgUnitCoding) - }else{ - alertDiv("已有回收单不可更改科室"); - } - }else if(msg.basket != null){ - if(smartSpeaker.type == "滴声提示"){ + } else if (msg.orgUnit != null) { + //只更新科室名称及编码信息(since2015-12-16 SYF),添加新单时才更新部门 + if (params_appId == null || params_appId == "null" || params_appId == "") { + selectDepart(msg.orgUnit.name, msg.orgUnit.orgUnitCoding) + } else { + alertDiv("已有回收单不可更改科室"); + } + } else if (msg.basket != null) { + if (smartSpeaker.type == "滴声提示") { simpleTipsAudio('recycleForTouchScreenAudio'); - }else{ - if(speakBasket){ - speakBasket.addGoods(msg.basket.containerName,'',''); + } else { + if (speakBasket) { + speakBasket.addGoods(msg.basket.containerName, '', ''); speakBasket.speakContent(); - } + } } - // 没有完成装配的篮筐要确认是否用于回收 - var containerStatus = msg.containerStatus; - if(containerStatus == "清洗完成" || containerStatus == "清洗中"){ - loadDialogConfirm(msg,isSave); - }else{ - addBasketElement(msg.basket,false,isSave); - loadNextBindingBasket(); - } - }else if(msg.tousseInstance != null){ - if(!checkSelectDepartBeforeAddTousse()){ - return false; + // 没有完成装配的篮筐要确认是否用于回收 + var containerStatus = msg.containerStatus; + if (containerStatus == "清洗完成" || containerStatus == "清洗中") { + loadDialogConfirm(msg, isSave); + } else { + addBasketElement(msg.basket, false, isSave); + loadNextBindingBasket(); } + } else if (msg.tousseInstance != null) { + if (!checkSelectDepartBeforeAddTousse()) { + return false; + } - if(msg.errorMessage != null && msg.isFixedBarcode == true){ + if (msg.errorMessage != null && msg.isFixedBarcode == true) { alertDiv(msg.errorMessage); return false; } - if($('#appType').val() == "质量监测回收申请单"){ + if ($('#appType').val() == "质量监测回收申请单") { alertDiv("质量监测回收申请单不允许添加新的物品,只能回收申请单中的物品!"); return false; } - if($('#appType').val() == "申请还物单"){ + if ($('#appType').val() == "申请还物单") { alertDiv("申请还物单不允许添加新的物品,只能回收申请单中的物品!"); return false; } var alertMsg = ''; - if(msg.tousseInstance.status == '已灭菌'){ + if (msg.tousseInstance.status == '已灭菌') { alertMsg = '该包当前状态为:已灭菌,请确认是否回收?'; - }else if(msg.tousseInstance.status == '已审核'){ + } else if (msg.tousseInstance.status == '已审核') { alertMsg = '该包当前状态为:已审核,请确认是否回收?'; - }else if(msg.tousseInstance.status == '已装配'){ + } else if (msg.tousseInstance.status == '已装配') { alertMsg = '该包当前状态为:已装配,请确认是否回收?'; } - if(alertMsg !== ''){ + if (alertMsg !== '') { $("#dialogConfirm").dialog({ resizable: false, - height:310, - width:600, + height: 310, + width: 600, modal: true, - open: function() { - $("#confirmMsg").text(alertMsg); + open: function () { + $("#confirmMsg").text(alertMsg); }, - close: function() { - $("#confirmMsg").text(""); + close: function () { + $("#confirmMsg").text(""); }, buttons: { - "是": function() { - $( this ).dialog( "close" ); - scanTousseInstance(msg); - }, - "否": function() { - $( this ).dialog( "close" ); - } + "是": function () { + $(this).dialog("close"); + scanTousseInstance(msg); + }, + "否": function () { + $(this).dialog("close"); + } } }); - }else { + } else { scanTousseInstance(msg); } - - }else if(msg.user != null){ - userNameByBarcode = msg.user.fullName; + + } else if (msg.user != null) { + userNameByBarcode = msg.user.fullName; var departCode = $('#departCode').val(); - var orgUnits = msg.user.orgUnits; - if(smartSpeaker.type == "滴声提示"){ + var orgUnits = msg.user.orgUnits; + if (smartSpeaker.type == "滴声提示") { simpleTipsAudio('recycleForTouchScreenAudio'); - }else{ - if(speakBasket){ - speakBasket.addGoods(userNameByBarcode,'',''); + } else { + if (speakBasket) { + speakBasket.addGoods(userNameByBarcode, '', ''); speakBasket.speakContent(); - } + } } - //点击选中回收人员或是清点人员或者自送人 - if(currentUserType == userType_recycling){ - $('#recyclingUser').val(userNameByBarcode); - currentUserType = userType_operator; - }else if(currentUserType == userType_operator){ - $('#operator').val(userNameByBarcode); - currentUserType = userType_recycling; - }else if(currentUserType == userType_departmentSender){ - if(departCode == ""){//手工添加的回收申请单,如果先扫描科室自送人,则自动填写回收单的申请科室 - if(orgUnits){ + //点击选中回收人员或是清点人员或者自送人 + if (currentUserType == userType_recycling) { + $('#recyclingUser').val(userNameByBarcode); + currentUserType = userType_operator; + } else if (currentUserType == userType_operator) { + $('#operator').val(userNameByBarcode); + currentUserType = userType_recycling; + } else if (currentUserType == userType_departmentSender) { + if (departCode == "") {//手工添加的回收申请单,如果先扫描科室自送人,则自动填写回收单的申请科室 + if (orgUnits) { $("#departmentSender").val(userNameByBarcode); $("#departmentSenderHidden").val(JSON.stringify(orgUnits)); currentUserType = userType_recycling; } - }else{ - if(orgUnits){ + } else { + if (orgUnits) { var flag = false; for (var m in orgUnits) { - if (orgUnits[m].orgUnitNameCode == departCode) { - $("#departmentSender").val(userNameByBarcode); + if (orgUnits[m].orgUnitNameCode == departCode) { + $("#departmentSender").val(userNameByBarcode); $("#departmentSenderHidden").val(JSON.stringify(orgUnits)); currentUserType = userType_recycling; flag = true; break; - } + } } - - if(!flag){ + + if (!flag) { //清空科室 - alertDiv('科室自送人与申请科室不一致!'); + alertDiv('科室自送人与申请科室不一致!'); } - } + } } } - selectUserType(currentUserType); - }else{ - alertDiv('没有找到该条码所对应的信息。'); - } - $("#codeScan").val(""); - barcodeGloble = ""; - }, - error:function(msg){ - barcodeGloble = ""; - //提示信息输出... - } - }); - }else{ - alertDiv('条码长度不符合规范。'); - } + selectUserType(currentUserType); + } else { + alertDiv('没有找到该条码所对应的信息。'); + } + $("#codeScan").val(""); + barcodeGloble = ""; + }, + error: function (msg) { + barcodeGloble = ""; + //提示信息输出... + } + }); + } else { + alertDiv('条码长度不符合规范。'); + } } // 选择回收人员 -function selectRecyclingUser(){ +function selectRecyclingUser() { $('#recyclingUser').val(userNameByBarcode); } // 选择清点人员 -function selectOperator(){ +function selectOperator() { $('#operator').val(userNameByBarcode); } // 打开选择申请单的窗口 -function openselectRecyclingApplication(){ - var width = 740; +function openselectRecyclingApplication() { + var width = 740; var height = 400; - if(resolution == '1980'){ - width = 980; - height = 420; + if (resolution == '1980') { + width = 980; + height = 420; } - - layerIndex=layer.open({ - type : 2, - title : ['选择申请单',true], - content : 'recyclingApplications.jsp?resolution='+resolution, - area : [ width + 'px' , height + 'px'], - border : [5, 0.3, '#fff', true], - closeBtn : [2 , true], - offset : ['100px',''] - }); + + layerIndex = layer.open({ + type: 2, + title: ['选择申请单', true], + content: 'recyclingApplications.jsp?resolution=' + resolution, + area: [width + 'px', height + 'px'], + border: [5, 0.3, '#fff', true], + closeBtn: [2, true], + offset: ['100px', ''] + }); } // 打开材料丢失的窗口 -function openRecyclingErrorPage(row,errorDamageQmKey){ +function openRecyclingErrorPage(row, errorDamageQmKey) { var tousseType = $('#tousseType' + row).val(); - if(tousseType == '外来器械包'){ + if (tousseType == '外来器械包') { alertDiv("外来器械包不能添加丢失项!"); return false; } - + var isEditIDCardError = false; - if($('#id').val() == ""){ + if ($('#id').val() == "") { isEditIDCardError = true; } - var tousseName = $('#tousseName'+row).val(); - var width = 740; - var height = 400; - var designedTousseWidth = 980; + var tousseName = $('#tousseName' + row).val(); + var width = 740; + var height = 400; + var designedTousseWidth = 980; var designedTousseHeight = 700; var designedWidth = 1920; var designedHeight = 1080; var actualWidth = window.screen.availWidth; var actualHeight = window.screen.availHeight; var offsetTop = 100; var heightExtra = 10; - if(resolution == '1980'){ - width = 980; - height = 700; - } - var zoomRatio = calculateZoomRatio(designedWidth,designedHeight,actualWidth,actualHeight); - var size = calculateSizeAfterZoom(designedTousseWidth,designedTousseHeight,zoomRatio); - var errorRemark = $('#hiddenErrorRemark'+row).val(); + if (resolution == '1980') { + width = 980; + height = 700; + } + var zoomRatio = calculateZoomRatio(designedWidth, designedHeight, actualWidth, actualHeight); + var size = calculateSizeAfterZoom(designedTousseWidth, designedTousseHeight, zoomRatio); + var errorRemark = $('#hiddenErrorRemark' + row).val(); var depart = $('#depart').text(); var recyclingUser = $('#recyclingUser').val(); - var circuitNurse = $('#circuitNurse'+row).val(); - var operationRoom = $('#operationRoom'+row).val(); - var isLessIE11 = navigator.userAgent.indexOf('compatible') > -1 && navigator.userAgent.indexOf('MSIE') > -1; + var circuitNurse = $('#circuitNurse' + row).val(); + var operationRoom = $('#operationRoom' + row).val(); + var isLessIE11 = navigator.userAgent.indexOf('compatible') > -1 && navigator.userAgent.indexOf('MSIE') > -1; - if(!isLessIE11){ - document.body.style.zoom = 1; - documentGetElementsByClassName('mbody')[0].style.zoom = zoomRatio; - } - + if (!isLessIE11) { + document.body.style.zoom = 1; + documentGetElementsByClassName('mbody')[0].style.zoom = zoomRatio; + } + width = size.width; height = size.height; - - offsetTop = offsetTop*zoomRatio; - layerIndex=layer.open({ - type : 2, - title : ['材料丢失',true], - content : 'recyclingErrors.jsp?resolution='+resolution+'&isEditIDCardError='+isEditIDCardError+'&width='+width+'&height='+height - +'&row='+row+'&tousseDefinitionID='+$('#tousseDefinitionID'+row).val()+'&tousseName='+encodeAll(tousseName) - +'&recordType=' + params_recordType+'&circuitNurse=' + encodeAll(circuitNurse)+'&operationRoom=' + encodeAll(operationRoom) - +'&tousseCount='+($('#recycleAmount'+row).val()==''?0:$('#recycleAmount'+row).val()) + '&errorRemark=' + errorRemark - +'&errorDamageQmKey=' + errorDamageQmKey + '&depart='+encodeAll(depart)+'&recyclingUser='+encodeAll(recyclingUser), - area : [ width + 'px' , height +heightExtra + 'px'], - border : [5, 0.3, '#fff', true], - closeBtn : [2 , true], - offset : [offsetTop+'px',''] - }); + + offsetTop = offsetTop * zoomRatio; + layerIndex = layer.open({ + type: 2, + title: ['材料丢失', true], + content: 'recyclingErrors.jsp?resolution=' + resolution + '&isEditIDCardError=' + isEditIDCardError + '&width=' + width + '&height=' + height + + '&row=' + row + '&tousseDefinitionID=' + $('#tousseDefinitionID' + row).val() + '&tousseName=' + encodeAll(tousseName) + + '&recordType=' + params_recordType + '&circuitNurse=' + encodeAll(circuitNurse) + '&operationRoom=' + encodeAll(operationRoom) + + '&tousseCount=' + ($('#recycleAmount' + row).val() == '' ? 0 : $('#recycleAmount' + row).val()) + '&errorRemark=' + errorRemark + + '&errorDamageQmKey=' + errorDamageQmKey + '&depart=' + encodeAll(depart) + '&recyclingUser=' + encodeAll(recyclingUser), + area: [width + 'px', height + heightExtra + 'px'], + border: [5, 0.3, '#fff', true], + closeBtn: [2, true], + offset: [offsetTop + 'px', ''] + }); } // 打开材料报损的窗口 -function openRecyclingDamagePage(row,tousseName,tousseItemId,errorDamageQmKey){ +function openRecyclingDamagePage(row, tousseName, tousseItemId, errorDamageQmKey) { var tousseType = $('#tousseType' + row).val(); - if(tousseType == '外来器械包'){ + if (tousseType == '外来器械包') { alertDiv("外来器械包不能添加报损项!"); return false; } - - var width = 740; - var height = 400; - var designedTousseWidth = 980; + + var width = 740; + var height = 400; + var designedTousseWidth = 980; var designedTousseHeight = 700; var designedWidth = 1920; var designedHeight = 1080; var actualWidth = window.screen.availWidth; var actualHeight = window.screen.availHeight; var offsetTop = 100; var heightExtra = 10; - var depart = $('#depart').text(); - var departCode = $('#departCode').val(); + var depart = $('#depart').text(); + var departCode = $('#departCode').val(); var damageRemark = $('#hiddenDamageRemark' + row).val(); var recyclingUser = $('#recyclingUser').val(); - if(resolution == '1980'){ - width = 980; - height = 700; - } - var zoomRatio = calculateZoomRatio(designedWidth,designedHeight,actualWidth,actualHeight); - var size = calculateSizeAfterZoom(designedTousseWidth,designedTousseHeight,zoomRatio); - var circuitNurse = $('#circuitNurse'+row).val(); - var operationRoom = $('#operationRoom'+row).val(); + if (resolution == '1980') { + width = 980; + height = 700; + } + var zoomRatio = calculateZoomRatio(designedWidth, designedHeight, actualWidth, actualHeight); + var size = calculateSizeAfterZoom(designedTousseWidth, designedTousseHeight, zoomRatio); + var circuitNurse = $('#circuitNurse' + row).val(); + var operationRoom = $('#operationRoom' + row).val(); - var isLessIE11 = navigator.userAgent.indexOf('compatible') > -1 && navigator.userAgent.indexOf('MSIE') > -1; + var isLessIE11 = navigator.userAgent.indexOf('compatible') > -1 && navigator.userAgent.indexOf('MSIE') > -1; - if(!isLessIE11){ - document.body.style.zoom = 1; - documentGetElementsByClassName('mbody')[0].style.zoom = zoomRatio; - } - + if (!isLessIE11) { + document.body.style.zoom = 1; + documentGetElementsByClassName('mbody')[0].style.zoom = zoomRatio; + } + width = size.width; height = size.height; - offsetTop = offsetTop*zoomRatio; - layerIndex=layer.open({ - type : 2, - title : ['材料报损',true], - content : 'recyclingDamage.jsp?resolution='+resolution+'&width='+width+'&height='+height - +'&row='+row+'&tousseDefinitionID='+$('#tousseDefinitionID'+row).val()+'&tousseName='+encodeAll(tousseName) - +'&tousseItemId='+tousseItemId+'&tousseCount='+$('#recycleAmount'+row).attr('value') - +'&recordType=' + params_recordType+'&circuitNurse=' + encodeAll(circuitNurse)+'&operationRoom=' + encodeAll(operationRoom) - +'&depart='+encodeURI(depart)+'&departCode='+departCode+ '&damageRemark=' + damageRemark - +'&errorDamageQmKey=' + errorDamageQmKey+'&recyclingUser='+encodeAll(recyclingUser), - area : [ width + 'px' , height +heightExtra + 'px'], - border : [5, 0.3, '#fff', true], - closeBtn : [2 , true], - offset : [offsetTop+'px',''] - }); + offsetTop = offsetTop * zoomRatio; + layerIndex = layer.open({ + type: 2, + title: ['材料报损', true], + content: 'recyclingDamage.jsp?resolution=' + resolution + '&width=' + width + '&height=' + height + + '&row=' + row + '&tousseDefinitionID=' + $('#tousseDefinitionID' + row).val() + '&tousseName=' + encodeAll(tousseName) + + '&tousseItemId=' + tousseItemId + '&tousseCount=' + $('#recycleAmount' + row).attr('value') + + '&recordType=' + params_recordType + '&circuitNurse=' + encodeAll(circuitNurse) + '&operationRoom=' + encodeAll(operationRoom) + + '&depart=' + encodeURI(depart) + '&departCode=' + departCode + '&damageRemark=' + damageRemark + + '&errorDamageQmKey=' + errorDamageQmKey + '&recyclingUser=' + encodeAll(recyclingUser), + area: [width + 'px', height + heightExtra + 'px'], + border: [5, 0.3, '#fff', true], + closeBtn: [2, true], + offset: [offsetTop + 'px', ''] + }); } // 打开器械包加急的窗口 -function openSetUrgentAmountPage(row){ - var tousseItemId = $('#tousseItemId'+row).val(); - if(tousseItemId != ''){ +function openSetUrgentAmountPage(row) { + var tousseItemId = $('#tousseItemId' + row).val(); + if (tousseItemId != '') { return false; } - + var isEditIDCardError = false; - if($('#id').val() == ""){ + if ($('#id').val() == "") { isEditIDCardError = true; } - var tousseName = $('#tousseName'+row).val(); - var applyAmount = $('#applicationAmount'+row).val(); - var recycleAmount = $('#recycleAmount'+row).val(); - var urgentAmount = $('#urgentAmount'+row).val(); - var urgentLevel = $('#urgentLevel' + row).val(); - - var width = 740; - var height = 400; - var designedTousseWidth = 980; + var tousseName = $('#tousseName' + row).val(); + var applyAmount = $('#applicationAmount' + row).val(); + var recycleAmount = $('#recycleAmount' + row).val(); + var urgentAmount = $('#urgentAmount' + row).val(); + var urgentLevel = $('#urgentLevel' + row).val(); + + var width = 740; + var height = 400; + var designedTousseWidth = 980; var designedTousseHeight = 700; var designedWidth = 1920; var designedHeight = 1080; var actualWidth = window.screen.availWidth; var actualHeight = window.screen.availHeight; var offsetTop = 100; var heightExtra = 10; - if(resolution == '1980'){ - width = 980; - height = 700; - } - var zoomRatio = calculateZoomRatio(designedWidth,designedHeight,actualWidth,actualHeight); - var size = calculateSizeAfterZoom(designedTousseWidth,designedTousseHeight,zoomRatio); + if (resolution == '1980') { + width = 980; + height = 700; + } + var zoomRatio = calculateZoomRatio(designedWidth, designedHeight, actualWidth, actualHeight); + var size = calculateSizeAfterZoom(designedTousseWidth, designedTousseHeight, zoomRatio); - var isLessIE11 = navigator.userAgent.indexOf('compatible') > -1 && navigator.userAgent.indexOf('MSIE') > -1; + var isLessIE11 = navigator.userAgent.indexOf('compatible') > -1 && navigator.userAgent.indexOf('MSIE') > -1; - if(!isLessIE11){ - document.body.style.zoom = 1; - documentGetElementsByClassName('mbody')[0].style.zoom = zoomRatio; - } - + if (!isLessIE11) { + document.body.style.zoom = 1; + documentGetElementsByClassName('mbody')[0].style.zoom = zoomRatio; + } + width = size.width; height = size.height; - - offsetTop = offsetTop*zoomRatio; - layerIndex=layer.open({ - type : 2, - title : ['器械包加急',true], - //iframe : {src : 'setTousseUrgentAmount.jsp?resolution='+resolution+'&width='+width+'&height='+height+'&row='+row+'&tousseDefinitionID='+$('#tousseDefinitionID'+row).val()+'&tousseName='+encodeAll(tousseName)+'&applyAmount='+applyAmount+'&recycleAmount='+recycleAmount+'&urgentAmount='+urgentAmount}, - content : 'setTousseUrgentAmount.jsp?resolution='+resolution+'&width='+width - +'&height='+height+'&row='+row+'&tousseDefinitionID='+$('#tousseDefinitionID'+row).val() - +'&tousseName='+encodeAll(tousseName)+'&applyAmount='+applyAmount+'&recycleAmount=' - +recycleAmount+'&urgentAmount='+urgentAmount + '&urgentName=' + encodeAll(urgentLevel), - area : [ width + 'px' , height +heightExtra + 'px'], - border : [5, 0.3, '#fff', true], - closeBtn : [2 , true], - offset : [offsetTop+'px',''] - }); + + offsetTop = offsetTop * zoomRatio; + layerIndex = layer.open({ + type: 2, + title: ['器械包加急', true], + //iframe : {src : 'setTousseUrgentAmount.jsp?resolution='+resolution+'&width='+width+'&height='+height+'&row='+row+'&tousseDefinitionID='+$('#tousseDefinitionID'+row).val()+'&tousseName='+encodeAll(tousseName)+'&applyAmount='+applyAmount+'&recycleAmount='+recycleAmount+'&urgentAmount='+urgentAmount}, + content: 'setTousseUrgentAmount.jsp?resolution=' + resolution + '&width=' + width + + '&height=' + height + '&row=' + row + '&tousseDefinitionID=' + $('#tousseDefinitionID' + row).val() + + '&tousseName=' + encodeAll(tousseName) + '&applyAmount=' + applyAmount + '&recycleAmount=' + + recycleAmount + '&urgentAmount=' + urgentAmount + '&urgentName=' + encodeAll(urgentLevel), + area: [width + 'px', height + heightExtra + 'px'], + border: [5, 0.3, '#fff', true], + closeBtn: [2, true], + offset: [offsetTop + 'px', ''] + }); } // 丢失报损界面获取相应的数量 -function getTousseItemRecyclingError(row){ +function getTousseItemRecyclingError(row) { return $('#recyclingError' + row).val(); } -function getTousseItemRecyclingDamage(row){ +function getTousseItemRecyclingDamage(row) { return $('#recyclingDamage' + row).val(); } // 丢失报损界面保存更新最新的数量 -function setTousseItemRecyclingError(row,jsonstr,errorRemark){ +function setTousseItemRecyclingError(row, jsonstr, errorRemark) { $('#recyclingError' + row).val(jsonstr); - if(!isUndefinedOrNull(errorRemark)){ + if (!isUndefinedOrNull(errorRemark)) { $('#hiddenErrorRemark' + row).val(errorRemark); } refreshErrorRemarkView(row); refreshErrorMaterialsView(row); } -function setTousseItemRecyclingDamage(row,jsonstr,damageRemark){ +function setTousseItemRecyclingDamage(row, jsonstr, damageRemark) { $('#recyclingDamage' + row).val(jsonstr); - if(!isUndefinedOrNull(damageRemark)){ + if (!isUndefinedOrNull(damageRemark)) { $('#hiddenDamageRemark' + row).val(damageRemark); } refreshDamageRemarkView(row); refreshDamageMaterialsView(row); } // 将丢失报损的材料json字符串格式化为 名称*数量;名称*数量 的形式.如果数量为0,则排除 -function formatErrorOrDamageMaterials(materialArrayStr){ - if(!isUndefinedOrNullOrEmpty(materialArrayStr)){ +function formatErrorOrDamageMaterials(materialArrayStr) { + if (!isUndefinedOrNullOrEmpty(materialArrayStr)) { var materialArray = JSON.parse(materialArrayStr); var materials = ""; - for(var i = 0; i < materialArray.length;++i){ + for (var i = 0; i < materialArray.length; ++i) { var amount = parseInt(materialArray[i].amount); - if(amount > 0){ + if (amount > 0) { materials += materialArray[i].materialName + "*" + materialArray[i].amount + ";"; } } - return materials.length > 0?materials.substring(0,materials.length - 1):""; + return materials.length > 0 ? materials.substring(0, materials.length - 1) : ""; } return ""; } // 刷新丢失材料的显示,如果没有启用回收的丢失报损备注功能,或者没有丢失材料,那么隐藏整行 -function refreshErrorMaterialsView(row){ +function refreshErrorMaterialsView(row) { var hide = true; - if(sstsConfig.enableRecycleMaterialErrorDamageRemark){ + if (sstsConfig.enableRecycleMaterialErrorDamageRemark) { var recyclingErrorJsonArrayStr = $('#recyclingError' + row).val(); var materials = formatErrorOrDamageMaterials(recyclingErrorJsonArrayStr); - if(!isUndefinedOrNullOrEmpty(materials)){ + if (!isUndefinedOrNullOrEmpty(materials)) { $('#errorMaterials' + row).text('丢失材料:' + materials); hide = false; } } - if(hide){ + if (hide) { $('#errorMaterialsTr' + row).hide(); - }else{ + } else { $('#errorMaterialsTr' + row).show(); } } // 刷新丢失备注的显示,如果没有启用回收的丢失报损备注功能,或者没有丢失备注,那么隐藏整行 -function refreshErrorRemarkView(row){ +function refreshErrorRemarkView(row) { var hide = true; - if(sstsConfig.enableRecycleMaterialErrorDamageRemark){ + if (sstsConfig.enableRecycleMaterialErrorDamageRemark) { var errorRemark = $('#hiddenErrorRemark' + row).val(); - if(!isUndefinedOrNullOrEmpty(errorRemark)){ + if (!isUndefinedOrNullOrEmpty(errorRemark)) { $('#errorRemark' + row).text('丢失备注:' + errorRemark); hide = false; } } - if(hide){ + if (hide) { $('#errorRemarkTr' + row).hide(); - }else{ + } else { $('#errorRemarkTr' + row).show(); } } // 刷新报损备注的显示,如果没有启用回收的丢失报损备注功能,或者没有报损备注,那么隐藏整行 -function refreshDamageRemarkView(row){ +function refreshDamageRemarkView(row) { var hide = true; - if(sstsConfig.enableRecycleMaterialErrorDamageRemark){ + if (sstsConfig.enableRecycleMaterialErrorDamageRemark) { var errorRemark = $('#hiddenDamageRemark' + row).val(); - if(!isUndefinedOrNullOrEmpty(errorRemark)){ + if (!isUndefinedOrNullOrEmpty(errorRemark)) { $('#damageRemark' + row).text('报损备注:' + errorRemark); hide = false; } } - if(hide){ + if (hide) { $('#damageRemarkTr' + row).hide(); - }else{ + } else { $('#damageRemarkTr' + row).show(); } } // 刷新拆包器械拆分篮筐数量的显示界面。如果没有启用拆分篮筐显示功能,或者没有报损备注,那么隐藏整行 -function refreshSplitBasketView(){ - if(sstsConfig.enableSplitBasketCount){ +function refreshSplitBasketView() { + if (sstsConfig.enableSplitBasketCount) { //包定义id与包拆分的篮筐的映射 var tousseDefIdBasketGroupMap = {}; - $('dl[class="sed clearfix"]').each(function(){ - $(this).children().each(function(){ - if($(this).attr('type') == 'hidden'){ + $('dl[class="sed clearfix"]').each(function () { + $(this).children().each(function () { + if ($(this).attr('type') == 'hidden') { var hideValue = $(this).val(); - if(!isUndefinedOrNullOrEmpty(hideValue)){ - var obj = JSON.parse(hideValue); - if(obj.type == '材料'){ - tousseDefIdBasketGroupMap[obj.tousseDefinitionID] = obj.basketGroupBarcodes; - } - } + if (!isUndefinedOrNullOrEmpty(hideValue)) { + var obj = JSON.parse(hideValue); + if (obj.type == '材料') { + tousseDefIdBasketGroupMap[obj.tousseDefinitionID] = obj.basketGroupBarcodes; + } + } } }); - }); - $("#tousseItemTable > tbody > tr").each(function(row,element) { + }); + $("#tousseItemTable > tbody > tr").each(function (row, element) { var tousseDefinitionId = $("#tousseDefinitionID" + row).val(); var tousseType = $("#tousseType" + row).val();//省医现在希望最好是只有外来器械才显示 var basketGroupBarcodes = tousseDefIdBasketGroupMap[tousseDefinitionId]; - if((tousseType == '外来器械包'|| tousseType == '外来器械拆分小包' ) && !isUndefinedOrNull(basketGroupBarcodes)){ + if ((tousseType == '外来器械包' || tousseType == '外来器械拆分小包') && !isUndefinedOrNull(basketGroupBarcodes)) { $('#splitBasket' + row).text('拆分篮筐数:' + basketGroupBarcodes.split(";").length); $('#splitBasketTr' + row).show(); - }else{ + } else { $('#splitBasket' + row).text(''); $('#splitBasketTr' + row).hide(); } @@ -2484,65 +2484,65 @@ } // 刷新报损材料明细的显示,如果没有启用回收的丢失报损备注功能,或者没有报损材料,那么隐藏整行 -function refreshDamageMaterialsView(row){ +function refreshDamageMaterialsView(row) { var hide = true; - if(sstsConfig.enableRecycleMaterialErrorDamageRemark){ + if (sstsConfig.enableRecycleMaterialErrorDamageRemark) { var recyclingDamageArrayStr = $('#recyclingDamage' + row).val(); var materials = formatErrorOrDamageMaterials(recyclingDamageArrayStr); - if(!isUndefinedOrNullOrEmpty(materials)){ + if (!isUndefinedOrNullOrEmpty(materials)) { $('#damageMaterials' + row).text('报损材料:' + materials); hide = false; } } - if(hide){ + if (hide) { $('#damageMaterialsTr' + row).hide(); - }else{ + } else { $('#damageMaterialsTr' + row).show(); } } // 更新加急数量 -function updateUrgentAmount(row,urgentAmount,urgentLevel){ - $('#urgentAmount'+row).val(urgentAmount); - $('#urgentAmountDiv'+row).html(urgentAmount); +function updateUrgentAmount(row, urgentAmount, urgentLevel) { + $('#urgentAmount' + row).val(urgentAmount); + $('#urgentAmountDiv' + row).html(urgentAmount); $('#urgentLevel' + row).val(urgentLevel); - if(urgentAmount > 0){ - $('#urgentAmountDiv'+row).css("background-image","url(urgentBg.png)"); - if(sstsConfig.enableUrgentFunction){ - $('#urgentAmountDiv'+row).html(urgentLevel); - }else{ - $('#urgentAmountDiv'+row).html(urgentAmount); + if (urgentAmount > 0) { + $('#urgentAmountDiv' + row).css("background-image", "url(urgentBg.png)"); + if (sstsConfig.enableUrgentFunction) { + $('#urgentAmountDiv' + row).html(urgentLevel); + } else { + $('#urgentAmountDiv' + row).html(urgentAmount); } - }else{ - $('#urgentAmountDiv'+row).css("background-image","url(unUrgentBg.png)"); - $('#urgentAmountDiv'+row).html("+"); + } else { + $('#urgentAmountDiv' + row).css("background-image", "url(unUrgentBg.png)"); + $('#urgentAmountDiv' + row).html("+"); } } // 器械包信息界面保存 -function submitForeignTousseDefinition(applicationId,foreignTousseInfo){ +function submitForeignTousseDefinition(applicationId, foreignTousseInfo) { $.ajax({ - type : 'post', - url : WWWROOT + '/disinfectSystem/foreigntousseapplication/foreignTousseApplicationAction!updateForeignTousseDefiniton.do', - data : {id : applicationId,foreignTousseInfo : foreignTousseInfo}, - dataType : 'json', - success : function(msg) { + type: 'post', + url: WWWROOT + '/disinfectSystem/foreigntousseapplication/foreignTousseApplicationAction!updateForeignTousseDefiniton.do', + data: { id: applicationId, foreignTousseInfo: foreignTousseInfo }, + dataType: 'json', + success: function (msg) { alert(msg.message); }, - error: function(XMLHttpRequest, textStatus, errorThrown) { - alert(textStatus); + error: function (XMLHttpRequest, textStatus, errorThrown) { + alert(textStatus); } }); } // 点击器械包名称根据器械包类型打开不同的窗口 -function amendDisinfectionTousse(row){ - var tousseName = $('#tousseName'+row).val(); - var tousseDefinitionID = $('#tousseDefinitionID'+row).val(); - var tousseType = $('#tousseType'+row).val(); - var materials = $('#materials'+row).val(); - var isApplyEntireTousse = $('#isApplyEntireTousse'+row).val(); - if(tousseType == '消毒物品' || tousseType == '灭菌物品'){ +function amendDisinfectionTousse(row) { + var tousseName = $('#tousseName' + row).val(); + var tousseDefinitionID = $('#tousseDefinitionID' + row).val(); + var tousseType = $('#tousseType' + row).val(); + var materials = $('#materials' + row).val(); + var isApplyEntireTousse = $('#isApplyEntireTousse' + row).val(); + if (tousseType == '消毒物品' || tousseType == '灭菌物品') { var width = 740; var height = 400; var availWidth = window.screen.availWidth; @@ -2551,44 +2551,44 @@ var clientHeight = document.body.clientHeight; var offsetTop = 0; var offsetLeft = 0; - if(resolution == '1980'){ - width = 980; - height = 700; + if (resolution == '1980') { + width = 980; + height = 700; } - if(isIE()){ - var zoom = getZoom(1920,1080); - offsetTop = ((availHeight-height*zoom)/2)+'px'; - offsetLeft = ((availWidth-width*zoom)/2)+'px'; - width = width*zoom; - height = height*zoom; - }else { - offsetTop = ((clientHeight-height)/2)+'px'; - offsetLeft = ((clientWidth-width)/2)+'px'; + if (isIE()) { + var zoom = getZoom(1920, 1080); + offsetTop = ((availHeight - height * zoom) / 2) + 'px'; + offsetLeft = ((availWidth - width * zoom) / 2) + 'px'; + width = width * zoom; + height = height * zoom; + } else { + offsetTop = ((clientHeight - height) / 2) + 'px'; + offsetLeft = ((clientWidth - width) / 2) + 'px'; } - var url = 'disinfectionTousseItems.jsp?resolution='+resolution+'&row='+row+'&tousseDefinitionID='+tousseDefinitionID+'&materials='+encodeURIComponent(materials)+'&width='+width+'&height='+height+'&isApplyEntireTousse='+encodeURIComponent(isApplyEntireTousse)+'&tousseName='+encodeURIComponent(tousseName); - - if(isIE(8)){ - openNewSizeWindow(url,'消毒物品明细',width,height); - }else { - layerIndex=layer.open({ - type : 2, - title : ['消毒物品明细',true], - content : 'disinfectionTousseItems.jsp?resolution='+resolution+'&row='+row+'&tousseDefinitionID='+tousseDefinitionID+'&materials='+encodeURIComponent(materials)+'&width='+width+'&height='+height+'&isApplyEntireTousse='+encodeURIComponent(isApplyEntireTousse)+'&tousseName='+encodeURIComponent(tousseName), - area : [ width + 'px' , height + 'px'], - border : [5, 0.3, '#fff', true], - closeBtn : [2 , true], - offset : [offsetTop,offsetLeft] + var url = 'disinfectionTousseItems.jsp?resolution=' + resolution + '&row=' + row + '&tousseDefinitionID=' + tousseDefinitionID + '&materials=' + encodeURIComponent(materials) + '&width=' + width + '&height=' + height + '&isApplyEntireTousse=' + encodeURIComponent(isApplyEntireTousse) + '&tousseName=' + encodeURIComponent(tousseName); + + if (isIE(8)) { + openNewSizeWindow(url, '消毒物品明细', width, height); + } else { + layerIndex = layer.open({ + type: 2, + title: ['消毒物品明细', true], + content: 'disinfectionTousseItems.jsp?resolution=' + resolution + '&row=' + row + '&tousseDefinitionID=' + tousseDefinitionID + '&materials=' + encodeURIComponent(materials) + '&width=' + width + '&height=' + height + '&isApplyEntireTousse=' + encodeURIComponent(isApplyEntireTousse) + '&tousseName=' + encodeURIComponent(tousseName), + area: [width + 'px', height + 'px'], + border: [5, 0.3, '#fff', true], + closeBtn: [2, true], + offset: [offsetTop, offsetLeft] }); } - }else if(tousseType == '器械包'){ + } else if (tousseType == '器械包') { $.magnificPopup.open({ items: [{ - src:'tousseImage.jsp?resolution='+resolution+'&tousseDefinitionID='+tousseDefinitionID+'&tousseName='+encodeURIComponent(tousseName)+'&number='+1, - type :'iframe' - - },{ + src: 'tousseImage.jsp?resolution=' + resolution + '&tousseDefinitionID=' + tousseDefinitionID + '&tousseName=' + encodeURIComponent(tousseName) + '&number=' + 1, + type: 'iframe' + + }, { //只是为了让箭头出现,如果可以有其他办法,这里可以去掉。因为在tousseImage.jsp内部,修改了下一页和上一页的处理 src: '
    永远看不到我
    ', type: 'inline' @@ -2605,97 +2605,97 @@ type: 'image' // this is default type }); var windowScreenH = window.screen.height; - if(windowScreenH == 1080){ - $(".mfp-iframe-scaler iframe").css({"top":"10px","height":"100%"}); - $(".mfp-iframe-holder .mfp-close").css({"top":"12px"}); - }else if(windowScreenH == 1050){ - $(".mfp-iframe-scaler iframe").css({"top":"10px","height":"100%"}); - $(".mfp-iframe-holder .mfp-close").css({"top":"0px"}); - }else{ - $(".mfp-iframe-scaler iframe").css({"top":"10px","height":"100%"}); + if (windowScreenH == 1080) { + $(".mfp-iframe-scaler iframe").css({ "top": "10px", "height": "100%" }); + $(".mfp-iframe-holder .mfp-close").css({ "top": "12px" }); + } else if (windowScreenH == 1050) { + $(".mfp-iframe-scaler iframe").css({ "top": "10px", "height": "100%" }); + $(".mfp-iframe-holder .mfp-close").css({ "top": "0px" }); + } else { + $(".mfp-iframe-scaler iframe").css({ "top": "10px", "height": "100%" }); } - }else if(tousseType == '自定义器械包'){ - var width = 740; - var height = 400; - var designedTousseWidth = 980; - var designedTousseHeight = 700; - var designedWidth = 1920; - var designedHeight = 1080; - var actualWidth = window.screen.availWidth; - var actualHeight = window.screen.availHeight; - var offsetTop = 100; - var heightExtra = 10; - if(resolution == '1980'){ - width = 980; - height = 700; - } - var zoomRatio = calculateZoomRatio(designedWidth,designedHeight,actualWidth,actualHeight); - var size = calculateSizeAfterZoom(designedTousseWidth,designedTousseHeight,zoomRatio); + } else if (tousseType == '自定义器械包') { + var width = 740; + var height = 400; + var designedTousseWidth = 980; + var designedTousseHeight = 700; + var designedWidth = 1920; + var designedHeight = 1080; + var actualWidth = window.screen.availWidth; + var actualHeight = window.screen.availHeight; + var offsetTop = 100; + var heightExtra = 10; + if (resolution == '1980') { + width = 980; + height = 700; + } + var zoomRatio = calculateZoomRatio(designedWidth, designedHeight, actualWidth, actualHeight); + var size = calculateSizeAfterZoom(designedTousseWidth, designedTousseHeight, zoomRatio); - var isLessIE11 = navigator.userAgent.indexOf('compatible') > -1 && navigator.userAgent.indexOf('MSIE') > -1; + var isLessIE11 = navigator.userAgent.indexOf('compatible') > -1 && navigator.userAgent.indexOf('MSIE') > -1; - if(!isLessIE11){ - document.body.style.zoom = 1; - documentGetElementsByClassName('mbody')[0].style.zoom = zoomRatio; - } - - width = size.width; - height = size.height; - - offsetTop = offsetTop*zoomRatio; - layerIndex=layer.open({ - type : 2, - title : [tousseName + ' 材料信息',true], - content : 'setMaterialRecycleAmount.jsp?resolution='+resolution+'&width='+width+'&height='+height+'&row='+row+'&tousseDefinitionID=' + tousseDefinitionID, - area : [ width + 'px' , height +heightExtra + 'px'], - border : [5, 0.3, '#fff', true], - closeBtn : [2 , true], - offset : [offsetTop+'px',''] - }); - }else if(tousseType == '外来器械包'){ - var width = 740; - var height = 400; - var designedTousseWidth = 980; - var designedTousseHeight = 700; - var designedWidth = 1920; - var designedHeight = 1080; - var actualWidth = window.screen.availWidth; - var actualHeight = window.screen.availHeight; - var offsetTop = 100; - var heightExtra = 10; - if(resolution == '1980'){ - width = 1080; - height = 800; - } - var zoomRatio = calculateZoomRatio(designedWidth,designedHeight,actualWidth,actualHeight); - var size = calculateSizeAfterZoom(designedTousseWidth,designedTousseHeight,zoomRatio); + if (!isLessIE11) { + document.body.style.zoom = 1; + documentGetElementsByClassName('mbody')[0].style.zoom = zoomRatio; + } - var isLessIE11 = navigator.userAgent.indexOf('compatible') > -1 && navigator.userAgent.indexOf('MSIE') > -1; + width = size.width; + height = size.height; - if(!isLessIE11){ - document.body.style.zoom = 1; - documentGetElementsByClassName('mbody')[0].style.zoom = zoomRatio; - } - - width = size.width; - height = size.height; - - offsetTop = offsetTop*zoomRatio; - - layerIndex=layer.open({ - type : 2, - title : [tousseName + ' 信息',true], - content : 'setForeignTousseDefinition.jsp?resolution='+resolution+'&width='+width+'&height='+height+'&row='+row+'&tousseDefinitionID=' + tousseDefinitionID + '&applicationId=' + params_appId + '&recyclingrecordId=' + params_id, - area : [ width + 'px' , height +heightExtra + 'px'], - border : [5, 0.3, '#fff', true], - closeBtn : [2 , true], - offset : [offsetTop+'px',''] - }); + offsetTop = offsetTop * zoomRatio; + layerIndex = layer.open({ + type: 2, + title: [tousseName + ' 材料信息', true], + content: 'setMaterialRecycleAmount.jsp?resolution=' + resolution + '&width=' + width + '&height=' + height + '&row=' + row + '&tousseDefinitionID=' + tousseDefinitionID, + area: [width + 'px', height + heightExtra + 'px'], + border: [5, 0.3, '#fff', true], + closeBtn: [2, true], + offset: [offsetTop + 'px', ''] + }); + } else if (tousseType == '外来器械包') { + var width = 740; + var height = 400; + var designedTousseWidth = 980; + var designedTousseHeight = 700; + var designedWidth = 1920; + var designedHeight = 1080; + var actualWidth = window.screen.availWidth; + var actualHeight = window.screen.availHeight; + var offsetTop = 100; + var heightExtra = 10; + if (resolution == '1980') { + width = 1080; + height = 800; + } + var zoomRatio = calculateZoomRatio(designedWidth, designedHeight, actualWidth, actualHeight); + var size = calculateSizeAfterZoom(designedTousseWidth, designedTousseHeight, zoomRatio); + + var isLessIE11 = navigator.userAgent.indexOf('compatible') > -1 && navigator.userAgent.indexOf('MSIE') > -1; + + if (!isLessIE11) { + document.body.style.zoom = 1; + documentGetElementsByClassName('mbody')[0].style.zoom = zoomRatio; + } + + width = size.width; + height = size.height; + + offsetTop = offsetTop * zoomRatio; + + layerIndex = layer.open({ + type: 2, + title: [tousseName + ' 信息', true], + content: 'setForeignTousseDefinition.jsp?resolution=' + resolution + '&width=' + width + '&height=' + height + '&row=' + row + '&tousseDefinitionID=' + tousseDefinitionID + '&applicationId=' + params_appId + '&recyclingrecordId=' + params_id, + area: [width + 'px', height + heightExtra + 'px'], + border: [5, 0.3, '#fff', true], + closeBtn: [2, true], + offset: [offsetTop + 'px', ''] + }); } } // 篮筐信息包装为json字符串 -function getBasketJSON(itemId,barcode,washClassifyType,sequence,basketName,isIdCard){ +function getBasketJSON(itemId, barcode, washClassifyType, sequence, basketName, isIdCard) { var json = {}; json.classifyBasketId = itemId; json.barcode = barcode; @@ -2706,89 +2706,89 @@ return JSON.stringify(json); } -function getBasketItemJSON(ci_id,type,orgUnitName,tousseName,materialName,amount,tousseAmount,idCardBarcode, - tousseDefinitionID,basketGroupBarcodes,putBasketMaxAmount,tousseType,lastTousseInstanceId,tousseInstanceBarcode,washClassifyType){ -var json = {}; -json.classifiedItemId = ci_id; -json.type = type; -json.orgUnitName = orgUnitName; -json.tousseName = tousseName; -json.materialName = materialName; -json.amount = amount;//td显示的数量 -json.tousseAmount = tousseAmount;//材料相对的包数量 -json.idCardBarcode = idCardBarcode; -json.tousseDefinitionID = tousseDefinitionID; -json.tousseType = tousseType; -json.putBasketMaxAmount = putBasketMaxAmount; -json.useBasketBarcodes = new Array(); -json.basketGroupBarcodes = basketGroupBarcodes; -json.lastTousseInstanceId = lastTousseInstanceId; -json.tousseInstanceBarcode = tousseInstanceBarcode; -json.washClassifyType = washClassifyType || ''; -return JSON.stringify(json); +function getBasketItemJSON(ci_id, type, orgUnitName, tousseName, materialName, amount, tousseAmount, idCardBarcode, + tousseDefinitionID, basketGroupBarcodes, putBasketMaxAmount, tousseType, lastTousseInstanceId, tousseInstanceBarcode, washClassifyType) { + var json = {}; + json.classifiedItemId = ci_id; + json.type = type; + json.orgUnitName = orgUnitName; + json.tousseName = tousseName; + json.materialName = materialName; + json.amount = amount;//td显示的数量 + json.tousseAmount = tousseAmount;//材料相对的包数量 + json.idCardBarcode = idCardBarcode; + json.tousseDefinitionID = tousseDefinitionID; + json.tousseType = tousseType; + json.putBasketMaxAmount = putBasketMaxAmount; + json.useBasketBarcodes = new Array(); + json.basketGroupBarcodes = basketGroupBarcodes; + json.lastTousseInstanceId = lastTousseInstanceId; + json.tousseInstanceBarcode = tousseInstanceBarcode; + json.washClassifyType = washClassifyType || ''; + return JSON.stringify(json); } // 获取已入篮筐的数据 -function getScanedGoods(isCleanedEntirely){ +function getScanedGoods(isCleanedEntirely) { var basketJsonArray = new Array(); - $("#basketsUl li").each(function(){ - var hideStr = $(this).find('input').val(); - var hiddenjson = JSON.parse(hideStr); - - var scanedGoodsArray = new Array(); - $(this).find('dl').children().each(function(i,element){ - if($(this).attr('type') == 'hidden'){ - var itemJson = $(this).val(); - var json = JSON.parse(itemJson); - if(json.classifiedItemId == ""){ - var type = json.type; - var name = json.tousseName; - if(type == '材料'){ - name = json.materialName; - } - scanedGoodsArray.push({ - name:name, - tousseDefinitionID:json.tousseDefinitionID, - tousseName:json.tousseName, - tousseType:json.tousseType, - type:json.type, - amount:json.amount, - idCardBarcode : json.idCardBarcode, - putBasketMaxAmount:json.putBasketMaxAmount - }); - } - } - }); + $("#basketsUl li").each(function () { + var hideStr = $(this).find('input').val(); + var hiddenjson = JSON.parse(hideStr); - if(isCleanedEntirely == "是"){ - if(sstsConfig.cleanedEntirelyTousseIntoWashClassifyEmptyBasket){ - if(isUndefinedOrNullOrEmpty(hiddenjson.washClassifyType)){ - basketJsonArray.push({ - barcode : hiddenjson.barcode, - name:hiddenjson.basketName, - washClassifyType : hiddenjson.washClassifyType, - scanedGoods : scanedGoodsArray - }); - return false; - } - }else{ - basketJsonArray.push({ - barcode : hiddenjson.barcode, - name:hiddenjson.basketName, - washClassifyType : hiddenjson.washClassifyType, - scanedGoods : scanedGoodsArray - }); - return false; - } - }else{ - basketJsonArray.push({ - barcode : hiddenjson.barcode, - name:hiddenjson.basketName, - washClassifyType : hiddenjson.washClassifyType, - scanedGoods : scanedGoodsArray - }); - } - }); + var scanedGoodsArray = new Array(); + $(this).find('dl').children().each(function (i, element) { + if ($(this).attr('type') == 'hidden') { + var itemJson = $(this).val(); + var json = JSON.parse(itemJson); + if (json.classifiedItemId == "") { + var type = json.type; + var name = json.tousseName; + if (type == '材料') { + name = json.materialName; + } + scanedGoodsArray.push({ + name: name, + tousseDefinitionID: json.tousseDefinitionID, + tousseName: json.tousseName, + tousseType: json.tousseType, + type: json.type, + amount: json.amount, + idCardBarcode: json.idCardBarcode, + putBasketMaxAmount: json.putBasketMaxAmount + }); + } + } + }); + + if (isCleanedEntirely == "是") { + if (sstsConfig.cleanedEntirelyTousseIntoWashClassifyEmptyBasket) { + if (isUndefinedOrNullOrEmpty(hiddenjson.washClassifyType)) { + basketJsonArray.push({ + barcode: hiddenjson.barcode, + name: hiddenjson.basketName, + washClassifyType: hiddenjson.washClassifyType, + scanedGoods: scanedGoodsArray + }); + return false; + } + } else { + basketJsonArray.push({ + barcode: hiddenjson.barcode, + name: hiddenjson.basketName, + washClassifyType: hiddenjson.washClassifyType, + scanedGoods: scanedGoodsArray + }); + return false; + } + } else { + basketJsonArray.push({ + barcode: hiddenjson.barcode, + name: hiddenjson.basketName, + washClassifyType: hiddenjson.washClassifyType, + scanedGoods: scanedGoodsArray + }); + } + }); return basketJsonArray; } @@ -2804,323 +2804,323 @@ * @returns {Number} */ var isDelete = false; -function tousseIntoBasketFunction(tousseInstanceId,tousseDefinitionID,tousseName,recycleAmount,isCleanedEntirely,orgUnitName,idCardBarcode,tousseInstanceBarcode,tousseType,row,isIDCard,callbackType,msgObj){ +function tousseIntoBasketFunction(tousseInstanceId, tousseDefinitionID, tousseName, recycleAmount, isCleanedEntirely, orgUnitName, idCardBarcode, tousseInstanceBarcode, tousseType, row, isIDCard, callbackType, msgObj) { var params = getScanedGoods(isCleanedEntirely); newAmount = 0; - if(params.length <=0){ - if(isCleanedEntirely == "是" && sstsConfig.cleanedEntirelyTousseIntoWashClassifyEmptyBasket){ + if (params.length <= 0) { + if (isCleanedEntirely == "是" && sstsConfig.cleanedEntirelyTousseIntoWashClassifyEmptyBasket) { //因为篮筐列表不会为空(之前已经验证过了),但是整包申请的包,如果配置为必须入清洗分类类型为空的篮筐,那可能就会执行到这里 alertDiv("缺少清洗分类类型为空的篮筐,请扫描"); return 0; } } var loadedAmount = 0; var recyclingApplicationId = $('#recyclingApplicationId').val(); - var materials = $('#materials'+row).val(); + var materials = $('#materials' + row).val(); DWREngine.setAsync(false); - RecyclingRecordTableManager.getTousseIntoBasketAmount(materials,tousseDefinitionID,recycleAmount,idCardBarcode,JSON.stringify(params),JSON.stringify(getTousseIntoBasketInfo()),recyclingApplicationId,function(result){ + RecyclingRecordTableManager.getTousseIntoBasketAmount(materials, tousseDefinitionID, recycleAmount, idCardBarcode, JSON.stringify(params), JSON.stringify(getTousseIntoBasketInfo()), recyclingApplicationId, function (result) { var jsonObj = JSON.parse(result); - if(!jsonObj.success){ - alertDiv(jsonObj.message); - return; - }else{ + if (!jsonObj.success) { + alertDiv(jsonObj.message); + return; + } else { var data = jsonObj.data; var packAmount = data.packAmount; var invoiceAmount = data.invoiceAmount; - var recycleAmountNew = parseInt($('#recycleAmount'+row).val() || 0); - var loadedAmountNew = parseInt($('#loadedAmount'+row).val() || 0); - var maxCount = Math.max.call(null,packAmount,invoiceAmount); + var recycleAmountNew = parseInt($('#recycleAmount' + row).val() || 0); + var loadedAmountNew = parseInt($('#loadedAmount' + row).val() || 0); + var maxCount = Math.max.call(null, packAmount, invoiceAmount); var putBasketMaxAmount = data.putBasketMaxAmount || 0; var basketsObj = JSON.parse($("#basketsUl li").eq(0).find('input').val()); - if(!sstsConfig.allowDecreaseRecyclingAmountGreatUnPackingAmount){ - if(recycleAmountNew < maxCount){ - alertDiv(tousseName+"已装配"+packAmount+"个,已发货"+invoiceAmount+"个,修改后回收的数量为"+recycleAmountNew+",不能小于已装配或者已发货的数量!"); + if (!sstsConfig.allowDecreaseRecyclingAmountGreatUnPackingAmount) { + if (recycleAmountNew < maxCount) { + alertDiv(tousseName + "已装配" + packAmount + "个,已发货" + invoiceAmount + "个,修改后回收的数量为" + recycleAmountNew + ",不能小于已装配或者已发货的数量!"); return 0; } - }else { - if(recycleAmountNew < maxCount){ - if(!isDelete){ - dialogConfirm(tousseName+"已装配"+packAmount+"个,已发货"+invoiceAmount+"个,修改后回收的数量为"+recycleAmountNew+",要修改会导致待装配任务被删除,您确认要修改吗?",function(){ + } else { + if (recycleAmountNew < maxCount) { + if (!isDelete) { + dialogConfirm(tousseName + "已装配" + packAmount + "个,已发货" + invoiceAmount + "个,修改后回收的数量为" + recycleAmountNew + ",要修改会导致待装配任务被删除,您确认要修改吗?", function () { isDelete = true; - tousseIntoBasketFunction(tousseInstanceId,tousseDefinitionID,tousseName,recycleAmount,isCleanedEntirely,orgUnitName,idCardBarcode,tousseInstanceBarcode,tousseType,row,isIDCard,callbackType,msgObj); + tousseIntoBasketFunction(tousseInstanceId, tousseDefinitionID, tousseName, recycleAmount, isCleanedEntirely, orgUnitName, idCardBarcode, tousseInstanceBarcode, tousseType, row, isIDCard, callbackType, msgObj); refreshAllBasketTotalNum() - },function(){ + }, function () { isDelete = false; }); return; } } } - if(recycleAmount < 0){ - var loadedAmount = parseInt($('#loadedAmount'+row).val()); + if (recycleAmount < 0) { + var loadedAmount = parseInt($('#loadedAmount' + row).val()); var loadedAmountSum = 0; var tousseLenght = 0; var amountSum = 0; - if(isCleanedEntirely == '否'){ + if (isCleanedEntirely == '否') { var msg = ''; - $("#basketsUl li").each(function(){ - $(this).find('dl').children().each(function(i,element){ - if($(this).attr('type') == 'hidden'){ + $("#basketsUl li").each(function () { + $(this).find('dl').children().each(function (i, element) { + if ($(this).attr('type') == 'hidden') { var hideStr = $(this).val(); var json = JSON.parse(hideStr); - if(json.tousseName == tousseName){ - msg = tousseName+"已入筐,请从篮筐内删除后再入筐!"; + if (json.tousseName == tousseName) { + msg = tousseName + "已入筐,请从篮筐内删除后再入筐!"; return false; } } }); }); - if(!isUndefinedOrNullOrEmpty(msg)){ + if (!isUndefinedOrNullOrEmpty(msg)) { alertDiv(msg); return false; } - + var tousseAmount = 0; - $('dl[class="sed clearfix"]').eq(0).each(function(){ + $('dl[class="sed clearfix"]').eq(0).each(function () { var basketEle = $(this).prev().prev().prev().prev().prev().val(); var basketJSON = JSON.parse(basketEle); - $(this).children().each(function(){ - if($(this).attr('type') == 'hidden'){ + $(this).children().each(function () { + if ($(this).attr('type') == 'hidden') { var hideValue = $(this).val(); - if(!isUndefinedOrNullOrEmpty(hideValue)){ + if (!isUndefinedOrNullOrEmpty(hideValue)) { var obj = JSON.parse(hideValue); - if(obj.tousseName == tousseName){ + if (obj.tousseName == tousseName) { var delButton = $(this).next().next().next().next().find('a'); tousseAmount = obj.tousseAmount + recycleAmount; - if(tousseAmount < 0){ - alertDiv('【'+tousseName+'】减少的数量不能大于篮筐现有的【'+tousseName+'】数量'+obj.amount); + if (tousseAmount < 0) { + alertDiv('【' + tousseName + '】减少的数量不能大于篮筐现有的【' + tousseName + '】数量' + obj.amount); return; } deleteBasketItem(delButton); - } + } } } }); }); - if(tousseAmount > 0){ - putTousseInTheBasket(row,tousseAmount); + if (tousseAmount > 0) { + putTousseInTheBasket(row, tousseAmount); } - }else { - $("#basketsUl li").eq(0).find('dl').children().each(function(i,element){ - if($(this).attr('type') == 'hidden'){ + } else { + $("#basketsUl li").eq(0).find('dl').children().each(function (i, element) { + if ($(this).attr('type') == 'hidden') { var hideStr = $(this).val(); var json = JSON.parse(hideStr); - if(json.tousseName == tousseName){ + if (json.tousseName == tousseName) { tousseLenght++; - loadedAmountSum = parseInt(loadedAmount+recycleAmount); + loadedAmountSum = parseInt(loadedAmount + recycleAmount); amountSum = amountSum + json.amount; } } }) - - if(recycleAmount + amountSum < 0){ - alertDiv('【'+tousseName+'】减少的数量不能大于【'+basketsObj.basketName+'】现有的数量'+amountSum); + + if (recycleAmount + amountSum < 0) { + alertDiv('【' + tousseName + '】减少的数量不能大于【' + basketsObj.basketName + '】现有的数量' + amountSum); return; } var recycleCount1 = 0; - $("#basketsUl li").eq(0).find('dl').children().each(function(i,element){ - if($(this).attr('type') == 'hidden'){ + $("#basketsUl li").eq(0).find('dl').children().each(function (i, element) { + if ($(this).attr('type') == 'hidden') { var hideStr = $(this).val(); var json = JSON.parse(hideStr); - if(json.tousseName == tousseName && (json.tousseInstanceBarcode || '') == ''){ + if (json.tousseName == tousseName && (json.tousseInstanceBarcode || '') == '') { var delButton = $(this).next().next().next().next().find('a'); var count = parseInt($(this).next().next().next().text()); - var recycleCount = count+recycleAmount; - if(tousseLenght == 1){ + var recycleCount = count + recycleAmount; + if (tousseLenght == 1) { $(this).next().next().next().html(recycleCount); - if(recycleCount > 0){ + if (recycleCount > 0) { json.amount = recycleCount; $(this).val(JSON.stringify(json)); - deleteBasketItem(delButton,count); + deleteBasketItem(delButton, count); return; - }else { + } else { json.amount = recycleAmount; $(this).val(JSON.stringify(json)); - deleteBasketItem(delButton,0); + deleteBasketItem(delButton, 0); } - }else { - if(recycleCount > 0){ + } else { + if (recycleCount > 0) { $(this).next().next().next().html(recycleCount); json.amount = recycleCount; $(this).val(JSON.stringify(json)); - deleteBasketItem(delButton,count); + deleteBasketItem(delButton, count); return false; - }else { - json.amount = 0-count; + } else { + json.amount = 0 - count; $(this).val(JSON.stringify(json)); - deleteBasketItem(delButton,0); + deleteBasketItem(delButton, 0); recycleCount1 = recycleCount; return false; } } } } }); - if(recycleCount1 < 0){ - $("#basketsUl li").eq(0).find('dl').children().each(function(i,element){ - if($(this).attr('type') == 'hidden'){ + if (recycleCount1 < 0) { + $("#basketsUl li").eq(0).find('dl').children().each(function (i, element) { + if ($(this).attr('type') == 'hidden') { var hideStr = $(this).val(); var json = JSON.parse(hideStr); var delButton = $(this).next().next().next().next().find('a'); - - if(json.tousseName == tousseName){ - if(json.classifiedItemId !== ''){ + + if (json.tousseName == tousseName) { + if (json.classifiedItemId !== '') { var count = parseInt($(this).next().next().next().text()); - var recycleCount = count+recycleCount1; - if(recycleCount > 0){ + var recycleCount = count + recycleCount1; + if (recycleCount > 0) { $(this).next().next().next().html(recycleCount); json.amount = recycleCount; $(this).val(JSON.stringify(json)); - deleteBasketItem(delButton,count); + deleteBasketItem(delButton, count); return; - }else { - json.amount = 0-count; + } else { + json.amount = 0 - count; $(this).val(JSON.stringify(json)); - deleteBasketItem(delButton,0); + deleteBasketItem(delButton, 0); } } } } }); } - $('#loadedAmount'+row).val(loadedAmountSum); + $('#loadedAmount' + row).val(loadedAmountSum); } setTousseItemLoadedAmountCss(row); refreshAllBasketTotalNum(); refreshSplitBasketView(); return; - }else if(recycleAmount > 0){ + } else if (recycleAmount > 0) { var loadedAmount = data.amount; - if(row !== undefined){ - if(recycleAmount > loadedAmount && putBasketMaxAmount !== 0){ - alertDiv("【"+tousseName+"】的清洗装载数量上限为"+putBasketMaxAmount+",本次入筐数量为"+recycleAmount+",当前篮筐容量不够,请用其它篮筐装载。"); + if (row !== undefined) { + if (recycleAmount > loadedAmount && putBasketMaxAmount !== 0) { + alertDiv("【" + tousseName + "】的清洗装载数量上限为" + putBasketMaxAmount + ",本次入筐数量为" + recycleAmount + ",当前篮筐容量不够,请用其它篮筐装载。"); //return 0; } //丢失报损器械 - if(isIDCard == '是'){ - setIdCardErrorIntoBasketAmount(row,loadedAmount); - $('#loadedAmount'+row).val(parseInt(loadedAmount,10)+parseInt($('#loadedAmount'+row).val(),10)); - }else { - $('#loadedAmount'+row).val(recycleAmountNew); + if (isIDCard == '是') { + setIdCardErrorIntoBasketAmount(row, loadedAmount); + $('#loadedAmount' + row).val(parseInt(loadedAmount, 10) + parseInt($('#loadedAmount' + row).val(), 10)); + } else { + $('#loadedAmount' + row).val(recycleAmountNew); } - if(recycleAmountNew > putBasketMaxAmount && loadedAmountNew < putBasketMaxAmount){ - $('#loadedAmount'+row).val(putBasketMaxAmount); - loadedAmount = putBasketMaxAmount-loadedAmountNew; - }else if(recycleAmount > loadedAmount && putBasketMaxAmount !== 0){ - $('#loadedAmount'+row).val(loadedAmount+loadedAmountNew); + if (recycleAmountNew > putBasketMaxAmount && loadedAmountNew < putBasketMaxAmount) { + $('#loadedAmount' + row).val(putBasketMaxAmount); + loadedAmount = putBasketMaxAmount - loadedAmountNew; + } else if (recycleAmount > loadedAmount && putBasketMaxAmount !== 0) { + $('#loadedAmount' + row).val(loadedAmount + loadedAmountNew); } - - }else { + + } else { var key = -1; - $('#tousseItemTable').children().first().children().each(function(i,element){ - var showTousseName = $('#showTousseName'+i).text(); - if(showTousseName == tousseName){ + $('#tousseItemTable').children().first().children().each(function (i, element) { + var showTousseName = $('#showTousseName' + i).text(); + if (showTousseName == tousseName) { key = i; } }); - if(key >= 0){ - var recycleAmountKye = parseInt($('#recycleAmount'+key).val(),10); - var loadedAmountKey = parseInt($('#loadedAmount'+key).val(),10); - if(loadedAmountKey != 0){ - if(recycleAmountKye > loadedAmountKey){ - $('#loadedAmount'+key).val(loadedAmountKey+loadedAmount); - }else { - $('#recycleAmount'+key).val(recycleAmountKye+loadedAmount); - $('#loadedAmount'+key).val(loadedAmountKey+loadedAmount); + if (key >= 0) { + var recycleAmountKye = parseInt($('#recycleAmount' + key).val(), 10); + var loadedAmountKey = parseInt($('#loadedAmount' + key).val(), 10); + if (loadedAmountKey != 0) { + if (recycleAmountKye > loadedAmountKey) { + $('#loadedAmount' + key).val(loadedAmountKey + loadedAmount); + } else { + $('#recycleAmount' + key).val(recycleAmountKye + loadedAmount); + $('#loadedAmount' + key).val(loadedAmountKey + loadedAmount); } - }else { - $('#loadedAmount'+key).val(loadedAmount); + } else { + $('#loadedAmount' + key).val(loadedAmount); } } } } var speakBasket = new SpeakBasket(); - if(smartSpeaker.type == "滴声提示"){ + if (smartSpeaker.type == "滴声提示") { simpleTipsAudio('recycleForTouchScreenAudio'); - }else{ - if(speakBasket){ - speakBasket.addGoods('',tousseName,loadedAmount); + } else { + if (speakBasket) { + speakBasket.addGoods('', tousseName, loadedAmount); speakBasket.speakContent(); - } + } } - if(isCleanedEntirely == "否"){ - var materials = data.materials; - if(materials == null){ - alertDiv("异常数据,请联系管理员!"); - return; + if (isCleanedEntirely == "否") { + var materials = data.materials; + if (materials == null) { + alertDiv("异常数据,请联系管理员!"); + return; } - for(var i = 0;i < materials.length;i++){ - var item = materials[i]; - var basketItem = { + for (var i = 0; i < materials.length; i++) { + var item = materials[i]; + var basketItem = { ci_id: "", type: '材料', orgUnitName: orgUnitName, tousseName: tousseName, tousseDefinitionID: tousseDefinitionID, - lastTousseInstanceId:tousseInstanceId, //包实例id - tousseInstanceBarcode:tousseInstanceBarcode, - tousseType:tousseType, + lastTousseInstanceId: tousseInstanceId, //包实例id + tousseInstanceBarcode: tousseInstanceBarcode, + tousseType: tousseType, materialName: item.materialName, showName: item.materialName, amount: item.materialAmount, tousseAmount: loadedAmount, basketBarcode: item.basketBarcode, idCardBarcode: idCardBarcode, - basketGroupBarcodes:item.basketGroupBarcodes, - putBasketMaxAmount : item.putBasketMaxAmount, - washClassifyType:item.washClassifyType + basketGroupBarcodes: item.basketGroupBarcodes, + putBasketMaxAmount: item.putBasketMaxAmount, + washClassifyType: item.washClassifyType }; - addBasketItemElement(basketItem); - } - }else{ - var basketItem = { + addBasketItemElement(basketItem); + } + } else { + var basketItem = { ci_id: "", type: '器械包', orgUnitName: orgUnitName, tousseName: tousseName, tousseDefinitionID: tousseDefinitionID, - lastTousseInstanceId:tousseInstanceId, //包实例id, - tousseInstanceBarcode:tousseInstanceBarcode,//包实例条码,为了显示 - tousseType:tousseType, + lastTousseInstanceId: tousseInstanceId, //包实例id, + tousseInstanceBarcode: tousseInstanceBarcode,//包实例条码,为了显示 + tousseType: tousseType, materialName: "", showName: tousseName, amount: loadedAmount, tousseAmount: loadedAmount, basketBarcode: data.basketBarcode, idCardBarcode: idCardBarcode, basketGroupBarcodes: data.basketBarcode, - putBasketMaxAmount : data.putBasketMaxAmount + putBasketMaxAmount: data.putBasketMaxAmount }; addBasketItemElement(basketItem); } refreshAllBasketTotalNum() } - if(callbackType == 1){ + if (callbackType == 1) { refreshAllBasketTotalNum(); - }else if(callbackType == 2){ + } else if (callbackType == 2) { var ti = msgObj.tousseInstance; var td = ti.tousseDefinition; - if(loadedAmount > 0){ + if (loadedAmount > 0) { var tousseIsExist2 = false; - $('#tousseItemTable').children().first().children().each(function(i,element){ - if($('#tousseName'+i).val() == td.name && $('#deleted'+i).val() == '0'){ + $('#tousseItemTable').children().first().children().each(function (i, element) { + if ($('#tousseName' + i).val() == td.name && $('#deleted' + i).val() == '0') { tousseIsExist2 = true; - $('#loadedAmount'+i).val(loadedAmount + parseInt($('#loadedAmount'+i).val(),10)); - $('#tousseOrIDCardInstanceBarcodes'+i).val(appendBarcodes($('#tousseOrIDCardInstanceBarcodes'+i).val(), ti.barcode)); - if(parseInt($('#loadedAmount'+i).val()) > parseInt($('#recycleAmount'+i).val())){ - $('#recycleAmount'+i).val(parseInt($('#loadedAmount'+i).val())); + $('#loadedAmount' + i).val(loadedAmount + parseInt($('#loadedAmount' + i).val(), 10)); + $('#tousseOrIDCardInstanceBarcodes' + i).val(appendBarcodes($('#tousseOrIDCardInstanceBarcodes' + i).val(), ti.barcode)); + if (parseInt($('#loadedAmount' + i).val()) > parseInt($('#recycleAmount' + i).val())) { + $('#recycleAmount' + i).val(parseInt($('#loadedAmount' + i).val())); } - addErrorDamageRemark(ti,i); - loadUnSupplementMaterial(msgObj,i,ti.barcode); + addErrorDamageRemark(ti, i); + loadUnSupplementMaterial(msgObj, i, ti.barcode); } }); - if(!tousseIsExist2){ - var tmpRow = $("#tousseItemTable > tbody > tr").length; - var timeStr = new Date().getTime(); - var errorDamageQmKey = td.id + "_" + timeStr; - var toussItem = { + if (!tousseIsExist2) { + var tmpRow = $("#tousseItemTable > tbody > tr").length; + var timeStr = new Date().getTime(); + var errorDamageQmKey = td.id + "_" + timeStr; + var toussItem = { row: tmpRow, tousseItemId: '', tousseName: td.name, @@ -3132,193 +3132,193 @@ tousseType: td.type, isThereIdentificationCard: '否', isApplyEntireTousse: td.isApplyEntireTousse, - urgentAmount : 0, - tousseRemark:'', - errorDamageQmKey : errorDamageQmKey, - barcode : ti.barcode - }; - addToussItem(toussItem,sstsConfig.addTousseAtLastForRecycle); - addBindGoods(toussItem,sstsConfig.addTousseAtLastForRecycle); - addErrorDamageRemark(ti,tmpRow); - //未补充的丢失报损 - loadUnSupplementMaterial(msgObj,tmpRow,ti.barcode); - } + urgentAmount: 0, + tousseRemark: '', + errorDamageQmKey: errorDamageQmKey, + barcode: ti.barcode + }; + addToussItem(toussItem, sstsConfig.addTousseAtLastForRecycle); + addBindGoods(toussItem, sstsConfig.addTousseAtLastForRecycle); + addErrorDamageRemark(ti, tmpRow); + //未补充的丢失报损 + loadUnSupplementMaterial(msgObj, tmpRow, ti.barcode); + } refreshAllBasketTotalNum(); } - }else if(callbackType == 3){ + } else if (callbackType == 3) { var ti = msgObj.tousseInstance; var td = ti.tousseDefinition; - if(loadedAmount >= 0){ + if (loadedAmount >= 0) { var tousseIsExist = false; - $('#tousseItemTable').children().first().children().each(function(i,element){ - if($('#tousseName'+i).val() == td.name && $('#deleted'+i).val() == '0'){ + $('#tousseItemTable').children().first().children().each(function (i, element) { + if ($('#tousseName' + i).val() == td.name && $('#deleted' + i).val() == '0') { tousseIsExist = true; - $('#loadedAmount'+i).val(loadedAmount + parseInt($('#loadedAmount'+i).val(),10)); - $('#tousseOrIDCardInstanceBarcodes'+i).val(appendBarcodes($('#tousseOrIDCardInstanceBarcodes'+i).val(), ti.barcode)); - if(parseInt($('#loadedAmount'+i).val()) > parseInt($('#recycleAmount'+i).val())){ - $('#recycleAmount'+i).val(parseInt($('#loadedAmount'+i).val())); + $('#loadedAmount' + i).val(loadedAmount + parseInt($('#loadedAmount' + i).val(), 10)); + $('#tousseOrIDCardInstanceBarcodes' + i).val(appendBarcodes($('#tousseOrIDCardInstanceBarcodes' + i).val(), ti.barcode)); + if (parseInt($('#loadedAmount' + i).val()) > parseInt($('#recycleAmount' + i).val())) { + $('#recycleAmount' + i).val(parseInt($('#loadedAmount' + i).val())); } - addErrorDamageRemark(ti,i); - loadUnSupplementMaterial(msgObj,i,ti.barcode); + addErrorDamageRemark(ti, i); + loadUnSupplementMaterial(msgObj, i, ti.barcode); } }); - if(!tousseIsExist){ + if (!tousseIsExist) { var tmpRow = $("#tousseItemTable > tbody > tr").length; var timeStr = new Date().getTime(); var errorDamageQmKey = td.id + "_" + timeStr; var toussItem = { - row: tmpRow, - tousseItemId: '', - tousseName: td.name, - tousseDefinitionID: td.id, - applicationAmount: 0, - recycleAmount: 1, - loadedAmount: 1, - isCleanedEntirely: td.isCleanedEntirely, - tousseType: td.type, - isThereIdentificationCard: '是', - isApplyEntireTousse: td.isApplyEntireTousse, - urgentAmount : 0, - tousseRemark:'', - errorDamageQmKey : errorDamageQmKey, - barcode : ti.barcode + row: tmpRow, + tousseItemId: '', + tousseName: td.name, + tousseDefinitionID: td.id, + applicationAmount: 0, + recycleAmount: 1, + loadedAmount: 1, + isCleanedEntirely: td.isCleanedEntirely, + tousseType: td.type, + isThereIdentificationCard: '是', + isApplyEntireTousse: td.isApplyEntireTousse, + urgentAmount: 0, + tousseRemark: '', + errorDamageQmKey: errorDamageQmKey, + barcode: ti.barcode }; - addToussItem(toussItem,sstsConfig.addTousseAtLastForRecycle); - addBindGoods(toussItem,sstsConfig.addTousseAtLastForRecycle); - addErrorDamageRemark(ti,tmpRow); + addToussItem(toussItem, sstsConfig.addTousseAtLastForRecycle); + addBindGoods(toussItem, sstsConfig.addTousseAtLastForRecycle); + addErrorDamageRemark(ti, tmpRow); //未补充的丢失报损 - loadUnSupplementMaterial(msgObj,tmpRow,ti.barcode); + loadUnSupplementMaterial(msgObj, tmpRow, ti.barcode); } noticeIdCardUseAmount(msgObj.idCardUseAmount); - if(msgObj.isTousseNeedMaintain != null && msgObj.isTousseNeedMaintain == true){ + if (msgObj.isTousseNeedMaintain != null && msgObj.isTousseNeedMaintain == true) { alertDiv('\'' + msgObj.tousseInstance.tousseDefinition.name + '\'' + '需要保养了.'); } refreshAllBasketTotalNum(); } } }); DWREngine.setAsync(true); - return loadedAmount; + return loadedAmount; } //将器械包放入篮筐中,入筐 -function putTousseInTheBasket(row,recycleAmountNew){ +function putTousseInTheBasket(row, recycleAmountNew) { var inputSuccess = false; - if($('#basketsUl').children().length > 0){ + if ($('#basketsUl').children().length > 0) { var basketsObj = $('#basketsUl').children().eq(0).find('input[type=hidden]').val(); basketsObj = JSON.parse(basketsObj); var isFixedIdCard = basketsObj.isIdCard; var basketName = basketsObj.basketName; - var tousseName = $('#tousseName'+row).val(); - var tousseDefinitionID = $('#tousseDefinitionID'+row).val(); - var showTousseName = $('#showTousseName'+row).text(); - var tousseType = $('#tousseType'+row).val(); - var isCleanedEntirely = $('#isCleanedEntirely'+row).val(); - var recycleAmount = parseInt($('#recycleAmount'+row).val(),10); - var loadedAmount = parseInt($('#loadedAmount'+row).val(),10); - var applicationAmount = parseInt($('#applicationAmount'+row).val(),10); + var tousseName = $('#tousseName' + row).val(); + var tousseDefinitionID = $('#tousseDefinitionID' + row).val(); + var showTousseName = $('#showTousseName' + row).text(); + var tousseType = $('#tousseType' + row).val(); + var isCleanedEntirely = $('#isCleanedEntirely' + row).val(); + var recycleAmount = parseInt($('#recycleAmount' + row).val(), 10); + var loadedAmount = parseInt($('#loadedAmount' + row).val(), 10); + var applicationAmount = parseInt($('#applicationAmount' + row).val(), 10); var msg = ""; - if(isFixedIdCard == true){ - if($('#barcodes'+row).val() == ''){ + if (isFixedIdCard == true) { + if ($('#barcodes' + row).val() == '') { msg = '不允许将包放入标识牌的篮筐中,请扫描其它的清洗篮筐!'; - }else { - var barcodesObj = JSON.parse($('#barcodes'+row).val()); - if(barcodesObj[0].containerBarcode !== basketsObj.barcode){ + } else { + var barcodesObj = JSON.parse($('#barcodes' + row).val()); + if (barcodesObj[0].containerBarcode !== basketsObj.barcode) { msg = '不允许将包放入标识牌的篮筐中,请扫描其它的清洗篮筐!'; } } } - //是否开启限制使用记录转换的申请单不能添加别的物品 - if(sstsConfig.restrictAddOtherGoodsToApplicationFromUseRecord && $('#useRecordId').val() !='' && recycleAmount > applicationAmount){ - alertDiv("回收数量不能超过申请数量"); - return false; + //是否开启限制使用记录转换的申请单不能添加别的物品 + if (sstsConfig.restrictAddOtherGoodsToApplicationFromUseRecord && $('#useRecordId').val() != '' && recycleAmount > applicationAmount) { + alertDiv("回收数量不能超过申请数量"); + return false; } - var amount = recycleAmountNew || recycleAmount - parseInt($('#loadedAmount'+row).val(),10); - //回收数量扣减入筐操作 如果已经入筐就不能入筐,只能是手动从篮筐里面删除,因为程序不晓得从哪个篮筐里面扣减 - - if(amount > 9999){ - msg = "入筐数量不能大于9999!"; + var amount = recycleAmountNew || recycleAmount - parseInt($('#loadedAmount' + row).val(), 10); + //回收数量扣减入筐操作 如果已经入筐就不能入筐,只能是手动从篮筐里面删除,因为程序不晓得从哪个篮筐里面扣减 + + if (amount > 9999) { + msg = "入筐数量不能大于9999!"; } - if(recycleAmount == 0){ - msg = "入筐数量不能为0!"; + if (recycleAmount == 0) { + msg = "入筐数量不能为0!"; } - - if(!isUndefinedOrNullOrEmpty(msg)){ - alertDiv(msg); - return false; + + if (!isUndefinedOrNullOrEmpty(msg)) { + alertDiv(msg); + return false; } - - var isIDCard = $('#isThereIdentificationCard'+row).val(); - if(isIDCard == '是'){ - var showMsg = null; - var recyclingErrorJsonArrayStr = $('#recyclingError'+row).val(); - if(!isUndefinedOrNullOrEmpty(recyclingErrorJsonArrayStr)){ + + var isIDCard = $('#isThereIdentificationCard' + row).val(); + if (isIDCard == '是') { + var showMsg = null; + var recyclingErrorJsonArrayStr = $('#recyclingError' + row).val(); + if (!isUndefinedOrNullOrEmpty(recyclingErrorJsonArrayStr)) { var recyclingErrorJsonArray = JSON.parse(recyclingErrorJsonArrayStr); var isIdCardLost = false; - for(var j = 0;j < newArray(recyclingErrorJsonArray).length;j++) { - if(recyclingErrorJsonArray[j].materialName == '器械包标识牌'){ - isIdCardLost = true; - var errorAmount = parseInt(recyclingErrorJsonArray[j].amount); + for (var j = 0; j < newArray(recyclingErrorJsonArray).length; j++) { + if (recyclingErrorJsonArray[j].materialName == '器械包标识牌') { + isIdCardLost = true; + var errorAmount = parseInt(recyclingErrorJsonArray[j].amount); var intoBasketAmount = recyclingErrorJsonArray[j].intoBasketAmount; - if(errorAmount == 0 || errorAmount == intoBasketAmount){ - showMsg = $('#tousseName'+row).val()+"扫描的标识牌数量不等于回收数量,如果标识牌丢失,请在回收误差中登记丢失记录!"; - }else{ - if(errorAmount - intoBasketAmount >0){ + if (errorAmount == 0 || errorAmount == intoBasketAmount) { + showMsg = $('#tousseName' + row).val() + "扫描的标识牌数量不等于回收数量,如果标识牌丢失,请在回收误差中登记丢失记录!"; + } else { + if (errorAmount - intoBasketAmount > 0) { amount = errorAmount - intoBasketAmount; - } + } } - break; - } + break; + } } - if((!isIdCardLost && amount > 0) || amount < 0){ - showMsg = $('#tousseName'+row).val()+"扫描的标识牌数量不等于回收数量,如果标识牌丢失,请在回收误差中登记丢失记录!"; + if ((!isIdCardLost && amount > 0) || amount < 0) { + showMsg = $('#tousseName' + row).val() + "扫描的标识牌数量不等于回收数量,如果标识牌丢失,请在回收误差中登记丢失记录!"; } - }else{ - var tousseAmount = parseInt($('#recycleAmount'+row).val(),10); - var scannedAmount = parseInt($('#loadedAmount'+row).val(),10); - if(tousseAmount != scannedAmount){ - showMsg = $('#tousseName'+row).val()+"扫描的标识牌数量不等于回收数量,如果标识牌丢失,请在回收误差中登记丢失记录!"; - } + } else { + var tousseAmount = parseInt($('#recycleAmount' + row).val(), 10); + var scannedAmount = parseInt($('#loadedAmount' + row).val(), 10); + if (tousseAmount != scannedAmount) { + showMsg = $('#tousseName' + row).val() + "扫描的标识牌数量不等于回收数量,如果标识牌丢失,请在回收误差中登记丢失记录!"; + } } - - if(showMsg != null){ - alertDiv(showMsg); - return false; + + if (showMsg != null) { + alertDiv(showMsg); + return false; } - if(isFixedIdCard){ + if (isFixedIdCard) { alertDiv('不允许将丢失或报损的包放入标识牌的篮筐中,请扫描其它的清洗篮筐!'); return; } - } - var orgUnitName = $('#depart').text(); - if(amount == 0){ - alertDiv('没有可以放入篮筐的器械包。'); - }else{ + } + var orgUnitName = $('#depart').text(); + if (amount == 0) { + alertDiv('没有可以放入篮筐的器械包。'); + } else { var idsLen = 0; - for(var item in sessionTousseInstance){ - if(item == tousseDefinitionID){ + for (var item in sessionTousseInstance) { + if (item == tousseDefinitionID) { var idsArray = sessionTousseInstance[item].idsArray; var barcodeArray = sessionTousseInstance[item].barcodeArray; - if(idsArray.length > 0){ + if (idsArray.length > 0) { idsLen = idsArray.length; - if(amount >= idsArray.length){ - for(var i=0;i= idsArray.length) { + for (var i = 0; i < idsArray.length; i++) { var id = idsArray[i]; var barcode = barcodeArray[i]; - tousseIntoBasketFunction(id,tousseDefinitionID,tousseName,1,isCleanedEntirely,orgUnitName,"",barcode,tousseType,row,isIDCard,1,{}); - idsArray.splice(i,1,null); - barcodeArray.splice(i,1,null); + tousseIntoBasketFunction(id, tousseDefinitionID, tousseName, 1, isCleanedEntirely, orgUnitName, "", barcode, tousseType, row, isIDCard, 1, {}); + idsArray.splice(i, 1, null); + barcodeArray.splice(i, 1, null); sessionTousseInstance[item].idsArray1.push(id); sessionTousseInstance[item].barcodeArray1.push(barcode); } - }else { - for(var i=0;i 0 && amount - idsLen > 0){ - var resultAmount = parseInt(amount)-idsLen; - tousseIntoBasketFunction("",tousseDefinitionID,tousseName,resultAmount,isCleanedEntirely,orgUnitName,"","",tousseType,row,isIDCard,1,{}); - }else if(amount < 0){ + if (amount > 0 && amount - idsLen > 0) { + var resultAmount = parseInt(amount) - idsLen; + tousseIntoBasketFunction("", tousseDefinitionID, tousseName, resultAmount, isCleanedEntirely, orgUnitName, "", "", tousseType, row, isIDCard, 1, {}); + } else if (amount < 0) { - if(sessionTousseInstance[tousseDefinitionID]){ - if((0-amount)>(loadedAmount-sessionTousseInstance[tousseDefinitionID].idsArray1.length)){ - alertDiv('有'+sessionTousseInstance[tousseDefinitionID].idsArray1.length+'个包实例条码已入筐,最多只能减少'+(loadedAmount-sessionTousseInstance[tousseDefinitionID].idsArray1.length)+'个'); + if (sessionTousseInstance[tousseDefinitionID]) { + if ((0 - amount) > (loadedAmount - sessionTousseInstance[tousseDefinitionID].idsArray1.length)) { + alertDiv('有' + sessionTousseInstance[tousseDefinitionID].idsArray1.length + '个包实例条码已入筐,最多只能减少' + (loadedAmount - sessionTousseInstance[tousseDefinitionID].idsArray1.length) + '个'); return } } - tousseIntoBasketFunction("",tousseDefinitionID,tousseName,amount,isCleanedEntirely,orgUnitName,"","",tousseType,row,isIDCard,1,{}); + tousseIntoBasketFunction("", tousseDefinitionID, tousseName, amount, isCleanedEntirely, orgUnitName, "", "", tousseType, row, isIDCard, 1, {}); } } setTousseItemLoadedAmountCss(row); refreshAllBasketTotalNum(); refreshSplitBasketView(); tousseItemTableSort(); - }else{ - alertDiv('请先扫描篮筐条码。'); - } - updateBindGoods(row); - return inputSuccess; + } else { + alertDiv('请先扫描篮筐条码。'); + } + updateBindGoods(row); + return inputSuccess; } // 设置加载数量的背景颜色 -function setTousseItemLoadedAmountCss(row){ - var recycleAmount = parseInt($('#recycleAmount'+row).val(),10); - var loadedAmount = parseInt($('#loadedAmount'+row).val(),10); - if(loadedAmount > 0 && recycleAmount > loadedAmount){ - $("#loadedAmount" + row).css("background","#FFE66F");//黄色 - }else if(recycleAmount == loadedAmount && loadedAmount !== 0){ - $("#loadedAmount" + row).css("background","#b7d9a5");//绿色 - }else if(loadedAmount == 0 && recycleAmount > loadedAmount){ - $("#loadedAmount" + row).css("background","#ffffff");//白色 +function setTousseItemLoadedAmountCss(row) { + var recycleAmount = parseInt($('#recycleAmount' + row).val(), 10); + var loadedAmount = parseInt($('#loadedAmount' + row).val(), 10); + if (loadedAmount > 0 && recycleAmount > loadedAmount) { + $("#loadedAmount" + row).css("background", "#FFE66F");//黄色 + } else if (recycleAmount == loadedAmount && loadedAmount !== 0) { + $("#loadedAmount" + row).css("background", "#b7d9a5");//绿色 + } else if (loadedAmount == 0 && recycleAmount > loadedAmount) { + $("#loadedAmount" + row).css("background", "#ffffff");//白色 } } // 修改数量的时候,更新绑定物品.调用此方法的时候,回收数量已经更新 -function updateBindGoods(row){ +function updateBindGoods(row) { var toussItem = { - tousseDefinitionID: $('#tousseDefinitionID' + row).val(), - tousseName:$('#tousseName' + row).val(), - recycleAmount:$('#recycleAmount' + row).val(), - tousseType:$('#tousseType' + row).val() + tousseDefinitionID: $('#tousseDefinitionID' + row).val(), + tousseName: $('#tousseName' + row).val(), + recycleAmount: $('#recycleAmount' + row).val(), + tousseType: $('#tousseType' + row).val() }; - addBindGoods(toussItem,sstsConfig.addTousseAtLastForRecycle); + addBindGoods(toussItem, sstsConfig.addTousseAtLastForRecycle); } // 查找绑定的不回收的器械包。绑定中的包定义id都是祖先id -function findBindGoodsItem(ancestorTdId){ - for(var i = 0; i < unrecycleTousseItemArray.length;++i){ - if(unrecycleTousseItemArray[i].id == ancestorTdId){ +function findBindGoodsItem(ancestorTdId) { + for (var i = 0; i < unrecycleTousseItemArray.length; ++i) { + if (unrecycleTousseItemArray[i].id == ancestorTdId) { return unrecycleTousseItemArray[i]; } } @@ -3408,67 +3408,67 @@ * @param toussItem * @param appendLast */ -function addBindGoods(toussItem,appendLast){ +function addBindGoods(toussItem, appendLast) { var params = { -// settleAccountsDepartCoding: top.Ext4.getCmp('settleAccountsDepartCoding').getValue(),//只有一次性物品才用 -// handleDepartCode: top.Ext4.getCmp('handleDepartCoding').getValue(),//只有一次性物品才用 - goodName: toussItem.tousseName, - bindCount: toussItem.recycleAmount, - goodId: toussItem.tousseDefinitionID, - time: new Date().getTime(),//添加时间参数,避免缓存问题。现场反馈物品绑定偶尔带不出绑定的敷料包 - goodType: toussItem.tousseType + // settleAccountsDepartCoding: top.Ext4.getCmp('settleAccountsDepartCoding').getValue(),//只有一次性物品才用 + // handleDepartCode: top.Ext4.getCmp('handleDepartCoding').getValue(),//只有一次性物品才用 + goodName: toussItem.tousseName, + bindCount: toussItem.recycleAmount, + goodId: toussItem.tousseDefinitionID, + time: new Date().getTime(),//添加时间参数,避免缓存问题。现场反馈物品绑定偶尔带不出绑定的敷料包 + goodType: toussItem.tousseType }; $.ajax({ - type:'POST', - url:WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!getBindGoods.do', - data:params, - dataType:'json', - success:function(result){ - if(result && result.success && result.data.length > 0){ - for(var i = 0; i < result.data.length;++i){ - var record = result.data[i]; - if(record.isRecycling != '是' || (record.tousseType != PACKAGE_TYPE_INSIDE && record.tousseType != PACKAGE_TYPE_DISINFECTION)){ - //不回收的器械包、消毒物品、敷料包,放到不回收器械包集合中,传到后台再添加申请(或者修改申请数量) + type: 'POST', + url: WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!getBindGoods.do', + data: params, + dataType: 'json', + success: function (result) { + if (result && result.success && result.data.length > 0) { + for (var i = 0; i < result.data.length; ++i) { + var record = result.data[i]; + if (record.isRecycling != '是' || (record.tousseType != PACKAGE_TYPE_INSIDE && record.tousseType != PACKAGE_TYPE_DISINFECTION)) { + //不回收的器械包、消毒物品、敷料包,放到不回收器械包集合中,传到后台再添加申请(或者修改申请数量) var existItem = findBindGoodsItem(record.id); - if(existItem){ + if (existItem) { existItem.count = record.count; - }else{ + } else { record.mainBindGoodId = params.goodId; unrecycleTousseItemArray.push(record); } - - }else{ - var row = tousseItemExists(record.id,record.name,record.tousseType); - if(row == -1){ - row = document.getElementById("tousseItemTable").rows.length; - var timeStr = new Date().getTime(); - var errorDamageQmKey = record.id + "_" + timeStr; - var toussItem = { - row: row, - tousseItemId: '', - tousseName: record.name, - tousseDefinitionID: record.id, - applicationAmount: 0, - recycleAmount: 0, - loadedAmount: 0, - isCleanedEntirely: record.isCleanedEntirely, - tousseType: record.tousseType, - isThereIdentificationCard: record.isThereIdentificationCard, - isApplyEntireTousse: record.isApplyEntireTousse, - urgentAmount:0, - errorDamageQmKey:errorDamageQmKey - }; - addToussItem(toussItem,appendLast); - } - $('#recycleAmount'+row).val(record.count); - setTousseItemLoadedAmountCss(row); - } - } - } - }, - error:function(XMLHttpRequest, textStatus, errorThrown){ - alertDiv('获取绑定物品失败'); - } + + } else { + var row = tousseItemExists(record.id, record.name, record.tousseType); + if (row == -1) { + row = document.getElementById("tousseItemTable").rows.length; + var timeStr = new Date().getTime(); + var errorDamageQmKey = record.id + "_" + timeStr; + var toussItem = { + row: row, + tousseItemId: '', + tousseName: record.name, + tousseDefinitionID: record.id, + applicationAmount: 0, + recycleAmount: 0, + loadedAmount: 0, + isCleanedEntirely: record.isCleanedEntirely, + tousseType: record.tousseType, + isThereIdentificationCard: record.isThereIdentificationCard, + isApplyEntireTousse: record.isApplyEntireTousse, + urgentAmount: 0, + errorDamageQmKey: errorDamageQmKey + }; + addToussItem(toussItem, appendLast); + } + $('#recycleAmount' + row).val(record.count); + setTousseItemLoadedAmountCss(row); + } + } + } + }, + error: function (XMLHttpRequest, textStatus, errorThrown) { + alertDiv('获取绑定物品失败'); + } }); } @@ -3479,34 +3479,34 @@ * @param tousseType 器械包类型 * @returns {Number} */ -function tousseItemExists(tousseDefinitionID,tousseName,tousseType){ +function tousseItemExists(tousseDefinitionID, tousseName, tousseType) { var row = -1; - $('#tousseItemTable').children().first().children().each(function(i,element){ - if(($('#tousseDefinitionID'+i).val() == tousseDefinitionID)||(tousseType == '消毒物品' && $('#tousseName'+i).val() == tousseName)){ + $('#tousseItemTable').children().first().children().each(function (i, element) { + if (($('#tousseDefinitionID' + i).val() == tousseDefinitionID) || (tousseType == '消毒物品' && $('#tousseName' + i).val() == tousseName)) { //显示的列表中是否有该器械包 - if($('#deleted'+i).val() == '0'){ + if ($('#deleted' + i).val() == '0') { row = i; return false; } - } + } }); return row; } // 器械包高亮闪烁 -function highlightExistTousseItem(row){ +function highlightExistTousseItem(row) { //先滑动到对应的行 - var scrollTop = $("#tousseItemsTr" + row).offset().top-$('#tousseItemTable').offset().top; + var scrollTop = $("#tousseItemsTr" + row).offset().top - $('#tousseItemTable').offset().top; $('#tousseItemBox').stop(true, false).animate({ - scrollTop: scrollTop - }, 500); + scrollTop: scrollTop + }, 500); //闪烁一定的次数 - for(var i = 0; i < 5;++i){ + for (var i = 0; i < 5; ++i) { $("#tousseItemsTr" + row).animate({ backgroundColor: "#7ABD32" - }, 300 ).animate({ + }, 300).animate({ backgroundColor: "transparent" - }, 300 ) + }, 300) } } @@ -3518,7 +3518,7 @@ * @param tid 包实例条码 * @returns {Boolean} */ -function addToussItem(toussItem,appendLast,isScanAddTouss,tid,isFixedBarcode){ +function addToussItem(toussItem, appendLast, isScanAddTouss, tid, isFixedBarcode) { var row = toussItem.row; var tousseItemId = toussItem.tousseItemId; var tousseName = toussItem.tousseName; @@ -3534,530 +3534,530 @@ var tousseDefinitionID = toussItem.tousseDefinitionID; var urgentAmount = toussItem.urgentAmount; var spelling = toussItem.spelling; - var tousseRemark = isUndefinedOrNullOrEmpty(toussItem.tousseRemark)?'':toussItem.tousseRemark; - var urgentLevel = toussItem.urgentLevel?toussItem.urgentLevel:""; - var errorDamageQmKey = toussItem.errorDamageQmKey?toussItem.errorDamageQmKey:""; + var tousseRemark = isUndefinedOrNullOrEmpty(toussItem.tousseRemark) ? '' : toussItem.tousseRemark; + var urgentLevel = toussItem.urgentLevel ? toussItem.urgentLevel : ""; + var errorDamageQmKey = toussItem.errorDamageQmKey ? toussItem.errorDamageQmKey : ""; //器械包实例或者标识牌实例条码 - var barcode = toussItem.barcode?toussItem.barcode:""; + var barcode = toussItem.barcode ? toussItem.barcode : ""; var materials = ""; var b = true; - $('#tousseItemTable').children().first().children().each(function(i,element){ - if(($('#tousseDefinitionID'+i).val() == tousseDefinitionID)||(tousseType == '消毒物品' && $('#tousseName'+i).val() == tousseName)){ - //显示的列表中是否有该器械包 - if($('#deleted'+i).val() == '0' && !isFixedBarcode){ - //BJ307YY-35缓存扫描的包实例的数量 - if(barcode !== ''){ - var recycleAmount = parseInt($('#recycleAmount'+i).val()); - var loadedAmount = parseInt($('#loadedAmount'+i).val()); - if(isScanAddTouss){ - if(!sessionTousseInstance[tousseDefinitionID]){ + $('#tousseItemTable').children().first().children().each(function (i, element) { + if (($('#tousseDefinitionID' + i).val() == tousseDefinitionID) || (tousseType == '消毒物品' && $('#tousseName' + i).val() == tousseName)) { + //显示的列表中是否有该器械包 + if ($('#deleted' + i).val() == '0' && !isFixedBarcode) { + //BJ307YY-35缓存扫描的包实例的数量 + if (barcode !== '') { + var recycleAmount = parseInt($('#recycleAmount' + i).val()); + var loadedAmount = parseInt($('#loadedAmount' + i).val()); + if (isScanAddTouss) { + if (!sessionTousseInstance[tousseDefinitionID]) { var barcodeArray = []; var idsArray = []; barcodeArray.push(barcode); idsArray.push(tid); sessionTousseInstance[tousseDefinitionID] = { - name:tousseName, - amount:1,//总数量 - barcodeArray:barcodeArray,//未入筐的条码 - idsArray:idsArray,//未入筐的id - barcodeArray1:[],//已入筐的条码 - idsArray1:[]//已入筐的id + name: tousseName, + amount: 1,//总数量 + barcodeArray: barcodeArray,//未入筐的条码 + idsArray: idsArray,//未入筐的id + barcodeArray1: [],//已入筐的条码 + idsArray1: []//已入筐的id } - showResult(sessionTousseInstance[tousseDefinitionID].name+'的实例条码数量为'+sessionTousseInstance[tousseDefinitionID].amount); - if(loadedAmount == recycleAmount){ - $('#recycleAmount'+i).val(recycleAmount+1); + showResult(sessionTousseInstance[tousseDefinitionID].name + '的实例条码数量为' + sessionTousseInstance[tousseDefinitionID].amount); + if (loadedAmount == recycleAmount) { + $('#recycleAmount' + i).val(recycleAmount + 1); } - }else { - if(sessionTousseInstance[tousseDefinitionID].barcodeArray.indexOf(barcode) == -1 && sessionTousseInstance[tousseDefinitionID].barcodeArray1.indexOf(barcode) == -1){ - if(loadedAmount == 0){ - if(recycleAmount <= sessionTousseInstance[tousseDefinitionID].barcodeArray.length){ - $('#recycleAmount'+i).val(recycleAmount+1); + } else { + if (sessionTousseInstance[tousseDefinitionID].barcodeArray.indexOf(barcode) == -1 && sessionTousseInstance[tousseDefinitionID].barcodeArray1.indexOf(barcode) == -1) { + if (loadedAmount == 0) { + if (recycleAmount <= sessionTousseInstance[tousseDefinitionID].barcodeArray.length) { + $('#recycleAmount' + i).val(recycleAmount + 1); } - }else { - if(recycleAmount > loadedAmount){ - if((recycleAmount-loadedAmount) <= sessionTousseInstance[tousseDefinitionID].barcodeArray.length){ - $('#recycleAmount'+i).val(recycleAmount+1); + } else { + if (recycleAmount > loadedAmount) { + if ((recycleAmount - loadedAmount) <= sessionTousseInstance[tousseDefinitionID].barcodeArray.length) { + $('#recycleAmount' + i).val(recycleAmount + 1); } - }else if(recycleAmount == loadedAmount){ - $('#recycleAmount'+i).val(recycleAmount+1); + } else if (recycleAmount == loadedAmount) { + $('#recycleAmount' + i).val(recycleAmount + 1); } } sessionTousseInstance[tousseDefinitionID].amount += 1; sessionTousseInstance[tousseDefinitionID].idsArray.push(tid) sessionTousseInstance[tousseDefinitionID].barcodeArray.push(barcode) - showResult(sessionTousseInstance[tousseDefinitionID].name+'的实例条码数量为'+sessionTousseInstance[tousseDefinitionID].amount); - }else { + showResult(sessionTousseInstance[tousseDefinitionID].name + '的实例条码数量为' + sessionTousseInstance[tousseDefinitionID].amount); + } else { showResult('该实例条码已经在回收列表中!'); } } - }else { - $('#recycleAmount'+i).val(recycleAmount+1); + } else { + $('#recycleAmount' + i).val(recycleAmount + 1); } b = false; highlightExistTousseItem(i); - }else { + } else { var enableUserManuallyCloseAddTousseWindow = sstsConfig.enableUserManuallyCloseAddTousseWindow || false; - if(!enableUserManuallyCloseAddTousseWindow){ + if (!enableUserManuallyCloseAddTousseWindow) { alertDiv(tousseName + ",回收列表已存在!"); } b = false; highlightExistTousseItem(i); } - //删除后再添加该消毒物品,删除的项还原,原因是添加的消毒物品包定义和申请项的包定义不一样 - }else if(tousseType == '消毒物品'){ - $('#deleted'+i).val('0'); - $('#loadedAmount'+i).val(0); - $('#loadedAmount'+i).css('background','#fff'); - $('#tousseItemsTr'+i).show(); - for(var i=0;i+'; - var reduceButton = '-'; - var onclickFun = 'onclick="openUpdateAmount(this,'+ row +');"'; - - var urgentAmountElement = ""; - if(!isUndefinedOrNull(urgentAmount) && urgentAmount > 0){ - var msg = urgentAmount; - var fontSize="30px"; - if(sstsConfig.enableUrgentFunction){ - msg = urgentLevel; - fontSize = "16px"; - } - urgentAmountElement = '
    '+msg+'
    '; - }else{ - var bgMsg = "background-image:url(unUrgentBg.png);"; - var msg = "+"; - if(!isUndefinedOrNullOrEmpty(tousseItemId)){ - bgMsg = ""; - msg = ""; - } - var fontSize="30px";//如果要显示加急等级,字体就要小 - if(sstsConfig.enableUrgentFunction){ - fontSize = "16px"; - } - urgentAmountElement = '
    '+msg+'
    '; - } - var textWidth = textSize("26px","宋体",showTousseName).width || 0; + if (b) { + var showTousseName = tousseName; + var addButton = '+'; + var reduceButton = '-'; + var onclickFun = 'onclick="openUpdateAmount(this,' + row + ');"'; + + var urgentAmountElement = ""; + if (!isUndefinedOrNull(urgentAmount) && urgentAmount > 0) { + var msg = urgentAmount; + var fontSize = "30px"; + if (sstsConfig.enableUrgentFunction) { + msg = urgentLevel; + fontSize = "16px"; + } + urgentAmountElement = '
    ' + msg + '
    '; + } else { + var bgMsg = "background-image:url(unUrgentBg.png);"; + var msg = "+"; + if (!isUndefinedOrNullOrEmpty(tousseItemId)) { + bgMsg = ""; + msg = ""; + } + var fontSize = "30px";//如果要显示加急等级,字体就要小 + if (sstsConfig.enableUrgentFunction) { + fontSize = "16px"; + } + urgentAmountElement = '
    ' + msg + '
    '; + } + var textWidth = textSize("26px", "宋体", showTousseName).width || 0; var lineHeight = ''; var fontSize = ''; - if(textWidth > 335){ + if (textWidth > 335) { lineHeight = 31; fontSize = 23; - }else { + } else { lineHeight = 62; fontSize = 26; } - var errorRemark =toussItem.errorRemark; //"注备注备注"; - var damageRemark = toussItem.damageRemark;//"备注备注"; - errorRemark = isUndefinedOrNullOrEmpty(errorRemark)?'':errorRemark; - damageRemark = isUndefinedOrNullOrEmpty(damageRemark)?'':damageRemark; - var trStr = ''; - trStr += ''; - trStr += ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - '
    '+ - ''+ - addButton + - ''+ - reduceButton + - ''+ - ''+ - ''+ - ''+ - ''; - trStr += ''; - trStr += ''; - trStr += ''; - trStr += ''; - trStr += ''; - trStr += '
    ' + - urgentAmountElement + '' + - '入筐丢失报损删除
     
     
     
     
     
    '; - var trElement = $(trStr) - if(appendLast){ - trElement.appendTo("#tousseItemTable");//在表格最后一行追加 - }else{ - trElement.prependTo("#tousseItemTable");//在表格第一行追加行 - } - for(var i=0;i'; + trStr += '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
    ' + + '' + + addButton + + '' + + reduceButton + + '' + + '' + + '' + + '' + + ''; + trStr += ''; + trStr += ''; + trStr += ''; + trStr += ''; + trStr += ''; + trStr += '
    ' + + urgentAmountElement + '' + + '入筐丢失报损删除
     
     
     
     
     
    '; + var trElement = $(trStr) + if (appendLast) { + trElement.appendTo("#tousseItemTable");//在表格最后一行追加 + } else { + trElement.prependTo("#tousseItemTable");//在表格第一行追加行 + } + for (var i = 0; i < deleteTousseItemArray.length; i++) { + if (deleteTousseItemArray[i].tousseName == tousseName && deleteTousseItemArray[i].tousseDefinitionID == tousseDefinitionID) { + deleteTousseItemArray.splice(i, 1); + } + } + refreshErrorRemarkView(row); + refreshDamageRemarkView(row); + if (isScanAddTouss && !isFixedBarcode) { var barcodeArray = []; var idsArray = []; barcodeArray.push(barcode); idsArray.push(tid); sessionTousseInstance[tousseDefinitionID] = { - name:tousseName, - amount:1,//总数量 - barcodeArray:barcodeArray,//未入筐的条码 - idsArray:idsArray,//未入筐的id - barcodeArray1:[],//已入筐的条码 - idsArray1:[]//已入筐的id + name: tousseName, + amount: 1,//总数量 + barcodeArray: barcodeArray,//未入筐的条码 + idsArray: idsArray,//未入筐的id + barcodeArray1: [],//已入筐的条码 + idsArray1: []//已入筐的id } - showResult(tousseName+'的实例条码数量为1') - } - } - return b; + showResult(tousseName + '的实例条码数量为1') + } + } + return b; } // 待装载篮筐视图中的树形菜单伸缩的处理 -function toggleItems(spanElement){ - $(spanElement).toggleClass("minus"); - $(spanElement).nextAll('.sed').toggle(); +function toggleItems(spanElement) { + $(spanElement).toggleClass("minus"); + $(spanElement).nextAll('.sed').toggle(); } // 设置回收备注信息 -function setRemarkToRecycleItem(row,remark){ - remark = isUndefinedOrNullOrEmpty(remark)?"":remark; - $('#tousseRemark'+row).val(remark); +function setRemarkToRecycleItem(row, remark) { + remark = isUndefinedOrNullOrEmpty(remark) ? "" : remark; + $('#tousseRemark' + row).val(remark); $("#dialogConfirm").dialog("close"); } // 选择器械包备注信息 -function setTousseRemark(row){ +function setTousseRemark(row) { $.ajax({ - type:'get', - url:encodeURI(WWWROOT + '/disinfectSystem/core/httpOptionAction!getHttpOptionsById.do?time='+new Date().getTime()), - data:'optionId=recycleItem_remark', - dataType:'json', - success:function(result){ - if(result.success){ + type: 'get', + url: encodeURI(WWWROOT + '/disinfectSystem/core/httpOptionAction!getHttpOptionsById.do?time=' + new Date().getTime()), + data: 'optionId=recycleItem_remark', + dataType: 'json', + success: function (result) { + if (result.success) { document.onkeydown = null; var htmlCode = ""; - var oldRemark = $('#tousseRemark'+row).val(); - var remark = $('#tousseRemark'+row).val() || ''; + var oldRemark = $('#tousseRemark' + row).val(); + var remark = $('#tousseRemark' + row).val() || ''; var remarks = []; var otherIsCheck = false; - for(var i = 0 ; i < result.data.length ; i++){ + for (var i = 0; i < result.data.length; i++) { var tmpRemark = result.data[i].value; var redColor = ""; var checked = ""; - if(oldRemark == tmpRemark){ + if (oldRemark == tmpRemark) { redColor = "color:red;"; } - if(remark == tmpRemark){ + if (remark == tmpRemark) { checked = "checked"; } htmlCode += '
    '; - htmlCode += ''; - htmlCode += ''; + htmlCode += ''; + htmlCode += ''; htmlCode += ''; htmlCode += '
    '; remarks[i] = tmpRemark; otherIsCheck = false; } htmlCode += '
    '; - if(result.data.length == 0){ + if (result.data.length == 0) { otherIsCheck = true; - htmlCode += ''; - }else { - if(remark == '' || remarks.indexOf(remark) == -1){ + htmlCode += ''; + } else { + if (remark == '' || remarks.indexOf(remark) == -1) { otherIsCheck = true; checked = "checked"; - }else { + } else { checked = ""; } - htmlCode += ''; + htmlCode += ''; } - htmlCode += ''; + htmlCode += ''; htmlCode += ''; htmlCode += '
    ' - htmlCode += ''; - if(htmlCode == ""){ + htmlCode += ''; + if (htmlCode == "") { alertDiv("未设置回收物品备注信息!"); - }else{ - $("#dialogConfirm").dialog({ + } else { + $("#dialogConfirm").dialog({ resizable: false, - height:530, - width:800, - title:'选择器械包备注信息', + height: 530, + width: 800, + title: '选择器械包备注信息', modal: true, - open: function() { + open: function () { $("#confirmMsg").html(htmlCode); }, - close: function() { + close: function () { $("#confirmMsg").html(""); document.onkeydown = showKeyDown; }, buttons: { - "取消": function() { - $( this ).dialog( "close" ); + "取消": function () { + $(this).dialog("close"); }, - "确定": function() { + "确定": function () { var radios = document.getElementsByName("remarks"); var value = 0; - for(var i=0;i1270 && screenWidth<1300){ - width = width*0.8; - height = height*0.8; - offsetTop = ((boxHeight-height)/2)+'px'; - }else if(screenWidth>1350 && screenWidth<1370){ - width = width*0.8; - height = height*0.8; - offsetTop = ((boxHeight-height)/2)+'px'; - }else if(screenWidth>1390){ - width = width*0.9; - height = height*0.9; - offsetTop = ((boxHeight-height)/2)+'px'; - } - } - layerIndex = layer.open({ - type : 2, - title : ['修改数量',true], - content : 'updateAmount.jsp?resolution='+resolution+'&row='+row, - area : [width + 'px' , height + 'px'], - border : [5, 0.3, '#fff', true], - closeBtn : [2 , true], - offset : [offsetTop,''] - }); + var offsetTop = ((boxHeight - height) / 2) + 'px'; + if (isIE()) { + var screenWidth = ChangeRatio('width'); + var screenHeight = ChangeRatio('height'); + if (screenWidth < 1030) { + width = width * 0.6; + height = height * 0.6; + offsetTop = ((boxHeight - height) / 2) + 'px'; + } else if (screenWidth > 1270 && screenWidth < 1300) { + width = width * 0.8; + height = height * 0.8; + offsetTop = ((boxHeight - height) / 2) + 'px'; + } else if (screenWidth > 1350 && screenWidth < 1370) { + width = width * 0.8; + height = height * 0.8; + offsetTop = ((boxHeight - height) / 2) + 'px'; + } else if (screenWidth > 1390) { + width = width * 0.9; + height = height * 0.9; + offsetTop = ((boxHeight - height) / 2) + 'px'; + } + } + layerIndex = layer.open({ + type: 2, + title: ['修改数量', true], + content: 'updateAmount.jsp?resolution=' + resolution + '&row=' + row, + area: [width + 'px', height + 'px'], + border: [5, 0.3, '#fff', true], + closeBtn: [2, true], + offset: [offsetTop, ''] + }); } // 打开修改数量的窗口 -function openUpdateStuffInTheBasketAmount(obj,tousseName,name,type){ - obj.blur(); - var width = 550; +function openUpdateStuffInTheBasketAmount(obj, tousseName, name, type) { + obj.blur(); + var width = 550; var height = 300; var boxHeight = window.screen.height; - openElement = obj; - var offsetTop = ((boxHeight-height)/2)+'px'; - if(isIE()){ - var screenWidth = ChangeRatio('width'); - var screenHeight = ChangeRatio('height'); - if(screenWidth < 1030){ - width = width*0.6; - height = height*0.6; - offsetTop = ((boxHeight-height)/2)+'px'; - }else if(screenWidth>1270 && screenWidth<1300){ - width = width*0.8; - height = height*0.8; - offsetTop = ((boxHeight-height)/2)+'px'; - }else if(screenWidth>1350 && screenWidth<1370){ - width = width*0.8; - height = height*0.8; - offsetTop = ((boxHeight-height)/2)+'px'; - }else if(screenWidth>1390){ - width = width*0.9; - height = height*0.9; - offsetTop = ((boxHeight-height)/2)+'px'; - } - } - layerIndex=layer.open({ - type : 2, - title : ['修改数量',true], - content : 'updateAmount.jsp?resolution='+resolution+'&tousseName='+tousseName+'&name='+name+'&type='+type, - area : [width + 'px' , height + 'px'], - border : [5, 0.3, '#fff', true], - closeBtn : [2 , true], - offset : [offsetTop,''] - }); + openElement = obj; + var offsetTop = ((boxHeight - height) / 2) + 'px'; + if (isIE()) { + var screenWidth = ChangeRatio('width'); + var screenHeight = ChangeRatio('height'); + if (screenWidth < 1030) { + width = width * 0.6; + height = height * 0.6; + offsetTop = ((boxHeight - height) / 2) + 'px'; + } else if (screenWidth > 1270 && screenWidth < 1300) { + width = width * 0.8; + height = height * 0.8; + offsetTop = ((boxHeight - height) / 2) + 'px'; + } else if (screenWidth > 1350 && screenWidth < 1370) { + width = width * 0.8; + height = height * 0.8; + offsetTop = ((boxHeight - height) / 2) + 'px'; + } else if (screenWidth > 1390) { + width = width * 0.9; + height = height * 0.9; + offsetTop = ((boxHeight - height) / 2) + 'px'; + } + } + layerIndex = layer.open({ + type: 2, + title: ['修改数量', true], + content: 'updateAmount.jsp?resolution=' + resolution + '&tousseName=' + tousseName + '&name=' + name + '&type=' + type, + area: [width + 'px', height + 'px'], + border: [5, 0.3, '#fff', true], + closeBtn: [2, true], + offset: [offsetTop, ''] + }); } // 获取回收误差信息,拼成字符串传到后台 function getMaterialErrorDamageDetail() { - var errorJsonArray = new Array(); - $('#tousseItemTable').children().first().children().each(function(i,element){ - if(!isUndefinedOrNullOrEmpty($('#recyclingError'+i).val())){ - var errorRemark = $('#hiddenErrorRemark'+i).val(); - var recyclingItemErrorJsonStr = $('#recyclingError'+i).val(); - if(!isUndefinedOrNullOrEmpty(recyclingItemErrorJsonStr)){ - var jsonArray = JSON.parse(recyclingItemErrorJsonStr); - for(var j = 0;j < jsonArray.length ; j++){ - jsonArray[j].itemType = '回收误差'; - jsonArray[j].errorRemark = errorRemark; + var errorJsonArray = new Array(); + $('#tousseItemTable').children().first().children().each(function (i, element) { + if (!isUndefinedOrNullOrEmpty($('#recyclingError' + i).val())) { + var errorRemark = $('#hiddenErrorRemark' + i).val(); + var recyclingItemErrorJsonStr = $('#recyclingError' + i).val(); + if (!isUndefinedOrNullOrEmpty(recyclingItemErrorJsonStr)) { + var jsonArray = JSON.parse(recyclingItemErrorJsonStr); + for (var j = 0; j < jsonArray.length; j++) { + jsonArray[j].itemType = '回收误差'; + jsonArray[j].errorRemark = errorRemark; errorJsonArray.push(jsonArray[j]); - - } - } - } - var recyclingItemDamageJsonStr = $('#recyclingDamage'+i).val(); - if(!isUndefinedOrNullOrEmpty(recyclingItemDamageJsonStr)){ - var damageRemark = $('#hiddenDamageRemark'+i).val(); + + } + } + } + var recyclingItemDamageJsonStr = $('#recyclingDamage' + i).val(); + if (!isUndefinedOrNullOrEmpty(recyclingItemDamageJsonStr)) { + var damageRemark = $('#hiddenDamageRemark' + i).val(); var jsonArray = JSON.parse(recyclingItemDamageJsonStr); - for(var j = 0;j < jsonArray.length ; j++){ - jsonArray[j].itemType = '器械报损'; - jsonArray[j].damageRemark = damageRemark; - errorJsonArray.push(jsonArray[j]); - } - - } - }); - return errorJsonArray; + for (var j = 0; j < jsonArray.length; j++) { + jsonArray[j].itemType = '器械报损'; + jsonArray[j].damageRemark = damageRemark; + errorJsonArray.push(jsonArray[j]); + } + + } + }); + return errorJsonArray; } // 加急物品 -function getUrgentTousseItems(){ +function getUrgentTousseItems() { var urgentItemJsonArray = new Array(); - $('#tousseItemTable').children().first().children().each(function(index,element){ - if($('#deleted'+index).val() == '0'){ - var tousseName = $('#tousseName'+index).val(); - var tousseDefinitionID = $('#tousseDefinitionID'+index).val(); - var originalUrgentAmount = parseInt($('#originalUrgentAmount'+index).val(),10); - var urgentAmount = parseInt($('#urgentAmount'+index).val(),10); - var tousseItemId = $('#tousseItemId'+index).val(); - var urgentLevel = $('#urgentLevel'+index).val(); - //已保存的tousseItem(tousseItemId不为空)不能再修改; - // if(tousseItemId == ""){ - urgentItemJsonArray.push({ - tousseName:tousseName, - tousseDefinitionID:tousseDefinitionID, - urgentAmount:urgentAmount, - urgentLevel:urgentLevel - }); - //} - } + $('#tousseItemTable').children().first().children().each(function (index, element) { + if ($('#deleted' + index).val() == '0') { + var tousseName = $('#tousseName' + index).val(); + var tousseDefinitionID = $('#tousseDefinitionID' + index).val(); + var originalUrgentAmount = parseInt($('#originalUrgentAmount' + index).val(), 10); + var urgentAmount = parseInt($('#urgentAmount' + index).val(), 10); + var tousseItemId = $('#tousseItemId' + index).val(); + var urgentLevel = $('#urgentLevel' + index).val(); + //已保存的tousseItem(tousseItemId不为空)不能再修改; + // if(tousseItemId == ""){ + urgentItemJsonArray.push({ + tousseName: tousseName, + tousseDefinitionID: tousseDefinitionID, + urgentAmount: urgentAmount, + urgentLevel: urgentLevel + }); + //} + } }); return urgentItemJsonArray; } // 获取左边的回收的信息 -function getRecyclingItemInfo(){ +function getRecyclingItemInfo() { var recyclingItemJsonArray = new Array(); - $('#tousseItemTable').children().first().children().each(function(index,element){ - if($('#deleted'+index).val() == '0'){ - var tousseName = $('#tousseName'+index).val(); - var applicationAmount = $('#applicationAmount'+index).val(); - var recycleAmount = $('#recycleAmount'+index).val(); - var materialsJsonStr = $('#materials' + index).val(); - var tousseDefinitionID = $('#tousseDefinitionID'+index).val(); - if(materialsJsonStr != ''){ - addMaterialsMapForSave(tousseDefinitionID,materialsJsonStr); - } - var tousseRemark = $('#tousseRemark'+index).val(); - var errorRemark = $('#hiddenErrorRemark'+index).val(); - var damageRemark = $('#hiddenDamageRemark'+index).val(); - var urgentLevel = $('#urgentLevel'+index).val(); - var errorDamageQmKey = $('#hiddenErrorDamageQmKey'+index).val(); - var loadedAmount =$('#loadedAmount'+index).val(); - var tousseOrIDCardInstanceBarcodes = $('#tousseOrIDCardInstanceBarcodes'+index).val(); - recyclingItemJsonArray.push({ - tousseName:tousseName, - applicationAmount:applicationAmount, - recycleAmount:recycleAmount, - loadedAmount:loadedAmount,//Annie - tousseDefinitionID:tousseDefinitionID, - tousseRemark:tousseRemark, - errorRemark:errorRemark, - damageRemark:damageRemark, - urgentLevel:urgentLevel, - errorDamageQmKey:errorDamageQmKey, - tousseOrIDCardInstanceBarcodes:tousseOrIDCardInstanceBarcodes - }); - } + $('#tousseItemTable').children().first().children().each(function (index, element) { + if ($('#deleted' + index).val() == '0') { + var tousseName = $('#tousseName' + index).val(); + var applicationAmount = $('#applicationAmount' + index).val(); + var recycleAmount = $('#recycleAmount' + index).val(); + var materialsJsonStr = $('#materials' + index).val(); + var tousseDefinitionID = $('#tousseDefinitionID' + index).val(); + if (materialsJsonStr != '') { + addMaterialsMapForSave(tousseDefinitionID, materialsJsonStr); + } + var tousseRemark = $('#tousseRemark' + index).val(); + var errorRemark = $('#hiddenErrorRemark' + index).val(); + var damageRemark = $('#hiddenDamageRemark' + index).val(); + var urgentLevel = $('#urgentLevel' + index).val(); + var errorDamageQmKey = $('#hiddenErrorDamageQmKey' + index).val(); + var loadedAmount = $('#loadedAmount' + index).val(); + var tousseOrIDCardInstanceBarcodes = $('#tousseOrIDCardInstanceBarcodes' + index).val(); + recyclingItemJsonArray.push({ + tousseName: tousseName, + applicationAmount: applicationAmount, + recycleAmount: recycleAmount, + loadedAmount: loadedAmount,//Annie + tousseDefinitionID: tousseDefinitionID, + tousseRemark: tousseRemark, + errorRemark: errorRemark, + damageRemark: damageRemark, + urgentLevel: urgentLevel, + errorDamageQmKey: errorDamageQmKey, + tousseOrIDCardInstanceBarcodes: tousseOrIDCardInstanceBarcodes + }); + } }); return recyclingItemJsonArray; } @@ -4067,147 +4067,147 @@ * @param tousseDefinitionID 对应的包id * @param materialsJsonStr 材料数据(材料id,count) */ -function addMaterialsMapForSave(tousseDefinitionID,materialsJsonStr){ +function addMaterialsMapForSave(tousseDefinitionID, materialsJsonStr) { var materialsJson = JSON.parse(materialsJsonStr); var materialsArrayForSave = {}; - for(var i = 0; i < materialsJson.length; i++){ - materialsArrayForSave[materialsJson[i].materialId] = {"materialName":materialsJson[i].materialName,"count":materialsJson[i].count}; + for (var i = 0; i < materialsJson.length; i++) { + materialsArrayForSave[materialsJson[i].materialId] = { "materialName": materialsJson[i].materialName, "count": materialsJson[i].count }; } materialsMapForSave[tousseDefinitionID] = materialsArrayForSave; } /** * 判断tousseItem表是否是空的。删除的项不算在内 */ -function isTousseItemTableEmpty(){ +function isTousseItemTableEmpty() { var isEmpty = true; - $("#tousseItemTable > tbody > tr").each(function() { - var style = $(this).attr("style"); - if (style != 'display: none;'){ - isEmpty = false; - return false; - } + $("#tousseItemTable > tbody > tr").each(function () { + var style = $(this).attr("style"); + if (style != 'display: none;') { + isEmpty = false; + return false; + } }); - return isEmpty; + return isEmpty; } // 保存回收记录时验证 -function submitCheck(){ +function submitCheck() { var isThereTousseItems = false; - var isAllTousseInTheBasket = true; - var urgentAmountError = false; - if($('#depart').text()== ''){ - alertDiv('请先扫描科室条码。'); - return false; - } - var recyclingRecordId = $('#recyclingApplicationId').val(); - if (isTousseItemTableEmpty() && recyclingRecordId == ''){ - alert("空白的回收单不能保存!"); - return false; - } - var isEmptyFormSubmit = true; - $('#tousseItemTable').children().first().children().each(function(index,element){ - if($('#deleted'+index).val() == '0'){ - isThereTousseItems = true; + var isAllTousseInTheBasket = true; + var urgentAmountError = false; + if ($('#depart').text() == '') { + alertDiv('请先扫描科室条码。'); + return false; + } + var recyclingRecordId = $('#recyclingApplicationId').val(); + if (isTousseItemTableEmpty() && recyclingRecordId == '') { + alert("空白的回收单不能保存!"); + return false; + } + var isEmptyFormSubmit = true; + $('#tousseItemTable').children().first().children().each(function (index, element) { + if ($('#deleted' + index).val() == '0') { + isThereTousseItems = true; - var tousseType = $('#tousseType'+index).val(); - var recyclingAmount = parseInt($('#recycleAmount'+index).val(),10); - var loadedAmount = parseInt($('#loadedAmount'+index).val(),10); - - if(loadedAmount > 0 && recyclingAmount > loadedAmount){ - isAllTousseInTheBasket = false; - return false; - } - - if(loadedAmount > 0){ - isEmptyFormSubmit = false; - } - if(validateUrgentAmount(index,recyclingAmount)){ - highlightExistTousseItem(index); - urgentAmountError = true; - return false; - } - - //标识牌丢失验证 - var isIDCard = $('#isThereIdentificationCard'+index).val(); - if(isIDCard == '是'){ - var recyclingErrorJsonArrayStr = $('#recyclingError'+index).val(); - if(!isUndefinedOrNullOrEmpty(recyclingErrorJsonArrayStr)){ - var recyclingErrorJsonArray = JSON.parse(recyclingErrorJsonArrayStr); - for(var j = 0;j < recyclingErrorJsonArray.length;j++) { - if(recyclingErrorJsonArray[j].materialName == '器械包标识牌'){ - var errorType = recyclingErrorJsonArray[j].errorType; - var errorAmount = recyclingErrorJsonArray[j].amount; + var tousseType = $('#tousseType' + index).val(); + var recyclingAmount = parseInt($('#recycleAmount' + index).val(), 10); + var loadedAmount = parseInt($('#loadedAmount' + index).val(), 10); + + if (loadedAmount > 0 && recyclingAmount > loadedAmount) { + isAllTousseInTheBasket = false; + return false; + } + + if (loadedAmount > 0) { + isEmptyFormSubmit = false; + } + if (validateUrgentAmount(index, recyclingAmount)) { + highlightExistTousseItem(index); + urgentAmountError = true; + return false; + } + + //标识牌丢失验证 + var isIDCard = $('#isThereIdentificationCard' + index).val(); + if (isIDCard == '是') { + var recyclingErrorJsonArrayStr = $('#recyclingError' + index).val(); + if (!isUndefinedOrNullOrEmpty(recyclingErrorJsonArrayStr)) { + var recyclingErrorJsonArray = JSON.parse(recyclingErrorJsonArrayStr); + for (var j = 0; j < recyclingErrorJsonArray.length; j++) { + if (recyclingErrorJsonArray[j].materialName == '器械包标识牌') { + var errorType = recyclingErrorJsonArray[j].errorType; + var errorAmount = recyclingErrorJsonArray[j].amount; var intoBasketAmount = recyclingErrorJsonArray[j].intoBasketAmount; - if(errorType == '缺失' && errorAmount != intoBasketAmount){ - isAllTousseInTheBasket = false; - } - break; - } - } - } - } - } - }); - - if(!isAllTousseInTheBasket){ - alertDiv('部分器械包回收数量大于装载数量,不能保存。'); - return false; - } - if(urgentAmountError){ - return false; - } - if(isEmptyFormSubmit){ - alertDiv("不能保存空的回收单!"); - return false; - } - //验证清点人是否为空(前提为配置清点人强制不能为空,默认为允许为空) - if(sstsConfig.recyclePageOperatorNotNull == true && $("#operator").val() == ''){ - alertDiv('清点人不能为空,请扫描清点人条码。'); - return false; - } - - //验证清点人是否为空(前提为配置清点人强制不能为空) - if(sstsConfig.recyclePageRecyclingUserNotNull == true && $("#recyclingUser").val() == ''){ - alertDiv('回收人不能为空,请扫描回收人条码。'); - return false; - } - return true; + if (errorType == '缺失' && errorAmount != intoBasketAmount) { + isAllTousseInTheBasket = false; + } + break; + } + } + } + } + } + }); + + if (!isAllTousseInTheBasket) { + alertDiv('部分器械包回收数量大于装载数量,不能保存。'); + return false; + } + if (urgentAmountError) { + return false; + } + if (isEmptyFormSubmit) { + alertDiv("不能保存空的回收单!"); + return false; + } + //验证清点人是否为空(前提为配置清点人强制不能为空,默认为允许为空) + if (sstsConfig.recyclePageOperatorNotNull == true && $("#operator").val() == '') { + alertDiv('清点人不能为空,请扫描清点人条码。'); + return false; + } + + //验证清点人是否为空(前提为配置清点人强制不能为空) + if (sstsConfig.recyclePageRecyclingUserNotNull == true && $("#recyclingUser").val() == '') { + alertDiv('回收人不能为空,请扫描回收人条码。'); + return false; + } + return true; } // 合并丢失或报损的数量,根据是否已确定分开计算 -function newArray(arr){ +function newArray(arr) { var newArr = []; - var map = {},dest = []; + var map = {}, dest = []; var newArr2 = []; - for(var i = 0; i < arr.length; i++){ + for (var i = 0; i < arr.length; i++) { var ai = arr[i]; - if(ai.status !== 2){ + if (ai.status !== 2) { newArr.push(arr[i]) - }else { - if(!map[ai.materialDefinitionId+','+ai.itemType]){ + } else { + if (!map[ai.materialDefinitionId + ',' + ai.itemType]) { dest.push(ai); - map[ai.materialDefinitionId+','+ai.itemType] = ai; - }else { - for(var j = 0; j < dest.length; j++){ + map[ai.materialDefinitionId + ',' + ai.itemType] = ai; + } else { + for (var j = 0; j < dest.length; j++) { var dj = dest[j]; - if(dj.materialDefinitionId == ai.materialDefinitionId && dj.itemType == ai.itemType){ + if (dj.materialDefinitionId == ai.materialDefinitionId && dj.itemType == ai.itemType) { var amount = parseInt(ai.amount); dj.amount += amount; } } } } } - for(var i=0,k=0;i 0){ + for (var i = 0, k = 0; i < dest.length; i++) { + if (dest[i].amount > 0) { newArr[k] = dest[i]; k++ } @@ -4249,56 +4249,56 @@ * @param confirmation * @returns */ -function getJsonParams(confirmation,isConfirm){ +function getJsonParams(confirmation, isConfirm) { var newTousseArray = []; var length = splitTousseArray2.length; - if(length > 0){ - var k=0; - for(var j=0;j 0) { + var k = 0; + for (var j = 0; j < length; j++) { var tousseName = splitTousseArray2[j].tousseName; var amount = splitTousseArray2[j].amount; var depart = splitTousseArray2[j].depart; - for(var i=0;i 0 && isConfirm == false){ - openApplicationTousseSplitByOrgUnit(newTousseArray,tousseArray); + if (newTousseArray.length > 0 && isConfirm == false) { + openApplicationTousseSplitByOrgUnit(newTousseArray, tousseArray); return ''; } - var map = {},dest = [],arr = [],arr1 = []; - for(var i=0,k=0,z=0;i 0){ - var len = parseInt(arr[0])+parseInt(arr1[0] || 0); - for(var i=0;i 0) { + var len = parseInt(arr[0]) + parseInt(arr1[0] || 0); + for (var i = 0; i < tousseArray.length; i++) { tousseArray[i].tousseAmountForMaterial = len; } } @@ -4325,33 +4325,33 @@ * @param dialogWidth 对话框宽度 * @param dialogHeight 对话筐高度 */ -function dialogConfirm(text,yesCallback,nocallback , dialogWidth , dialogHeight){ +function dialogConfirm(text, yesCallback, nocallback, dialogWidth, dialogHeight) { $("#dialogConfirm").dialog({ - resizable: false, - height:dialogHeight ? dialogHeight : 310, - width:dialogWidth ? dialogWidth : 600, - modal: true, - open: function() { - $("#confirmMsg").html(text); - }, - close: function() { - $("#confirmMsg").html(""); - }, - buttons: { - "是": function() { - $( this ).dialog( "close" ); - if(yesCallback){ - yesCallback(); - } - - }, - "否": function() { - $( this ).dialog( "close" ); - if(nocallback){ - nocallback(); - } - } - } + resizable: false, + height: dialogHeight ? dialogHeight : 310, + width: dialogWidth ? dialogWidth : 600, + modal: true, + open: function () { + $("#confirmMsg").html(text); + }, + close: function () { + $("#confirmMsg").html(""); + }, + buttons: { + "是": function () { + $(this).dialog("close"); + if (yesCallback) { + yesCallback(); + } + + }, + "否": function () { + $(this).dialog("close"); + if (nocallback) { + nocallback(); + } + } + } }); } @@ -4361,52 +4361,52 @@ * @param saveAndNew 保存并新建回收记录操作 * @param print 保存并打印回收记录操作 */ -function checkAutoReturnBorrowing(confirmation,saveAndNew,print,recyclingAmountConfirm){ +function checkAutoReturnBorrowing(confirmation, saveAndNew, print, recyclingAmountConfirm) { //除申请还物单、自定义器械申请单、外来器械申请单、历史回收记录等可以直接提交外,其它类型的单回收都需要判断是否有物品要归还,包括手动添加回收申请单、科室申领添加的申请单、使用记录转换的申请单等都需要判断是否需要自动归还 - if(!isUndefinedOrNullOrEmpty(params_id)){ - submitFormFunction(confirmation,saveAndNew,false,print,recyclingAmountConfirm); + if (!isUndefinedOrNullOrEmpty(params_id)) { + submitFormFunction(confirmation, saveAndNew, false, print, recyclingAmountConfirm); return; } var tousseNames = []; - for(var i = 0; i < tousseArray.length;++i){ - if(parseInt(tousseArray[i].amount) > 0){ - if(tousseArray[i].itemType == '材料'){ + for (var i = 0; i < tousseArray.length; ++i) { + if (parseInt(tousseArray[i].amount) > 0) { + if (tousseArray[i].itemType == '材料') { tousseNames.push(tousseArray[i].tousseNameForMaterial); - }else{ + } else { tousseNames.push(tousseArray[i].tousseName); } } } var departCode = document.getElementById('departCode').value; var borrowApplicationInfo = null; DWREngine.setAsync(false); - RecyclingApplicationTableManager.getUnReturnBorrowApplication(params_appId , departCode,tousseNames.join(';'),function(datesOfTousseLease){ - borrowApplicationInfo = datesOfTousseLease; - }); - DWREngine.setAsync(true); - if(borrowApplicationInfo){ - var borrowApplicationInfoJson = JSON.parse(borrowApplicationInfo); - var borrowTimes = borrowApplicationInfoJson.borrowTimes; - var tousseLeaseAmount = borrowTimes.split(';').length; - - var confirmMessage = '您有'+tousseLeaseAmount+'张申请日期为'+borrowTimes+'的借物单的以下物品未归还,是否申请归还?'; - var tdStyle = 'font-size:28px;text-align:center;'; - var nameWidth = '440px;',taskGroupWidth='200px;',amoutWidth='140px;'; - var table = ''; - for(var i = 0; i < borrowApplicationInfoJson.tousseData.length;++i){ + RecyclingApplicationTableManager.getUnReturnBorrowApplication(params_appId, departCode, tousseNames.join(';'), function (datesOfTousseLease) { + borrowApplicationInfo = datesOfTousseLease; + }); + DWREngine.setAsync(true); + if (borrowApplicationInfo) { + var borrowApplicationInfoJson = JSON.parse(borrowApplicationInfo); + var borrowTimes = borrowApplicationInfoJson.borrowTimes; + var tousseLeaseAmount = borrowTimes.split(';').length; + + var confirmMessage = '您有' + tousseLeaseAmount + '张申请日期为' + borrowTimes + '的借物单的以下物品未归还,是否申请归还?'; + var tdStyle = 'font-size:28px;text-align:center;'; + var nameWidth = '440px;', taskGroupWidth = '200px;', amoutWidth = '140px;'; + var table = '
    '+ confirmMessage +'
    器械包数量
    '; + for (var i = 0; i < borrowApplicationInfoJson.tousseData.length; ++i) { var tousseData = borrowApplicationInfoJson.tousseData[i]; - table += ''; + table += ''; } table += '
    ' + confirmMessage + '
    器械包数量
    '+tousseData.tousseName+''+tousseData.amount+'
    ' + tousseData.tousseName + '' + tousseData.amount + '
    '; - var html = '
    '+table+'
    '; - dialogConfirm(html,function(){ - submitFormFunction(confirmation,saveAndNew,true,print,recyclingAmountConfirm); - },function(){ - submitFormFunction(confirmation,saveAndNew,false,print,recyclingAmountConfirm); - },800 , 500); - }else{ - submitFormFunction(confirmation,saveAndNew,false,print,recyclingAmountConfirm); - } + var html = '
    ' + table + '
    '; + dialogConfirm(html, function () { + submitFormFunction(confirmation, saveAndNew, true, print, recyclingAmountConfirm); + }, function () { + submitFormFunction(confirmation, saveAndNew, false, print, recyclingAmountConfirm); + }, 800, 500); + } else { + submitFormFunction(confirmation, saveAndNew, false, print, recyclingAmountConfirm); + } } /** @@ -4415,81 +4415,81 @@ * @param saveAndNew 保存并新建回收记录操作 * @param print 保存并打印回收记录操作 */ -function checkAutoReturnBorrowingForInventoryConfirm(confirmation,saveAndNew,print,recyclingAmountConfirm){ +function checkAutoReturnBorrowingForInventoryConfirm(confirmation, saveAndNew, print, recyclingAmountConfirm) { //除申请还物单、自定义器械申请单、外来器械申请单、历史回收记录等可以直接提交外,其它类型的单回收都需要判断是否有物品要归还,包括手动添加回收申请单、科室申领添加的申请单、使用记录转换的申请单等都需要判断是否需要自动归还 - if(!isUndefinedOrNullOrEmpty(params_id)){ - submitFormFunction(confirmation,saveAndNew,false,print,recyclingAmountConfirm); + if (!isUndefinedOrNullOrEmpty(params_id)) { + submitFormFunction(confirmation, saveAndNew, false, print, recyclingAmountConfirm); return; } var tousseNames = []; var recyclingItems = getRecyclingItemInfo(); - for(var i = 0; i < recyclingItems.length;++i){ + for (var i = 0; i < recyclingItems.length; ++i) { var itemRecycleAmount = recyclingItems[i].recycleAmount; - if(parseInt(itemRecycleAmount) > 0){ + if (parseInt(itemRecycleAmount) > 0) { tousseNames.push(recyclingItems[i].tousseName); } } var departCode = document.getElementById('departCode').value; var borrowApplicationInfo = null; DWREngine.setAsync(false); - RecyclingApplicationTableManager.getUnReturnBorrowApplication(params_appId , departCode,tousseNames.join(';'),function(datesOfTousseLease){ - borrowApplicationInfo = datesOfTousseLease; - }); - DWREngine.setAsync(true); - if(borrowApplicationInfo){ - var borrowApplicationInfoJson = JSON.parse(borrowApplicationInfo); - var borrowTimes = borrowApplicationInfoJson.borrowTimes; - var tousseLeaseAmount = borrowTimes.split(';').length; - - var confirmMessage = '您有'+tousseLeaseAmount+'张申请日期为'+borrowTimes+'的借物单的以下物品未归还,是否申请归还?'; - var tdStyle = 'font-size:28px;text-align:center;'; - var nameWidth = '440px;',taskGroupWidth='200px;',amoutWidth='140px;'; - var table = ''; - for(var i = 0; i < borrowApplicationInfoJson.tousseData.length;++i){ + RecyclingApplicationTableManager.getUnReturnBorrowApplication(params_appId, departCode, tousseNames.join(';'), function (datesOfTousseLease) { + borrowApplicationInfo = datesOfTousseLease; + }); + DWREngine.setAsync(true); + if (borrowApplicationInfo) { + var borrowApplicationInfoJson = JSON.parse(borrowApplicationInfo); + var borrowTimes = borrowApplicationInfoJson.borrowTimes; + var tousseLeaseAmount = borrowTimes.split(';').length; + + var confirmMessage = '您有' + tousseLeaseAmount + '张申请日期为' + borrowTimes + '的借物单的以下物品未归还,是否申请归还?'; + var tdStyle = 'font-size:28px;text-align:center;'; + var nameWidth = '440px;', taskGroupWidth = '200px;', amoutWidth = '140px;'; + var table = '
    '+ confirmMessage +'
    器械包数量
    '; + for (var i = 0; i < borrowApplicationInfoJson.tousseData.length; ++i) { var tousseData = borrowApplicationInfoJson.tousseData[i]; - table += ''; + table += ''; } table += '
    ' + confirmMessage + '
    器械包数量
    '+tousseData.tousseName+''+tousseData.amount+'
    ' + tousseData.tousseName + '' + tousseData.amount + '
    '; - var html = '
    '+table+'
    '; - dialogConfirm(html,function(){ - submitFormFunctionForInventoryConfirm(confirmation,saveAndNew,true,print,recyclingAmountConfirm); - },function(){ - submitFormFunctionForInventoryConfirm(confirmation,saveAndNew,false,print,recyclingAmountConfirm); - },800 , 500); - }else{ - submitFormFunctionForInventoryConfirm(confirmation,saveAndNew,false,print,recyclingAmountConfirm); - } + var html = '
    ' + table + '
    '; + dialogConfirm(html, function () { + submitFormFunctionForInventoryConfirm(confirmation, saveAndNew, true, print, recyclingAmountConfirm); + }, function () { + submitFormFunctionForInventoryConfirm(confirmation, saveAndNew, false, print, recyclingAmountConfirm); + }, 800, 500); + } else { + submitFormFunctionForInventoryConfirm(confirmation, saveAndNew, false, print, recyclingAmountConfirm); + } } // 显示回收物品清单 -function showRecyclingDetail(recyclingItems,confirmCallback){ - if(recyclingItems && recyclingItems.length > 0){ +function showRecyclingDetail(recyclingItems, confirmCallback) { + if (recyclingItems && recyclingItems.length > 0) { var tdStyle = 'font-size:28px;text-align:center;'; var tdLeftStyle = 'font-size:28px;text-align:left;'; var tdRightStyle = 'font-size:28px;text-align:right;'; - var seqWidth = '70px;', nameWidth = '570px;',amoutWidth='140px;'; - var table = ''; - for(var i = 0; i < recyclingItems.length;++i){ + var seqWidth = '70px;', nameWidth = '570px;', amoutWidth = '140px;'; + var table = '
    回收物品清单
    序号器械包回收数量
    '; + for (var i = 0; i < recyclingItems.length; ++i) { var recyclingItem = recyclingItems[i]; - table += ''; + table += ''; } table += '
    回收物品清单
    序号器械包回收数量
    '+(i+1)+''+recyclingItem.tousseName+''+recyclingItem.recyclingAmount+'
    ' + (i + 1) + '' + recyclingItem.tousseName + '' + recyclingItem.recyclingAmount + '
    '; - var html = '
    '+table+'
    '; + var html = '
    ' + table + '
    '; $(html).dialog({ maxHeight: 600, width: 800, - modal:true, + modal: true, buttons: { - '保存':function(){ - if(confirmCallback){ + '保存': function () { + if (confirmCallback) { confirmCallback(); } - $(this).dialog( "close" ); + $(this).dialog("close"); }, - '取消': function() { - $(this).dialog( "close" ); + '取消': function () { + $(this).dialog("close"); } - } + } }); } } @@ -4501,66 +4501,66 @@ * @param print 保存并打印回收记录操作 * @param recyclingAmountConfirm 是否确认回收数量 */ -function submitFunction(confirmation,saveAndNew,print,recyclingAmountConfirm){ - if(submitCheck()){ +function submitFunction(confirmation, saveAndNew, print, recyclingAmountConfirm) { + if (submitCheck()) { //回收物品清单 var recyclingTousses = []; var isPartIntheBasket = false; var tousseTypeisForeignTousseDefinition = false; var tousseTypeName = ''; var recyclingStatus = $("#recyclingStatus").val(); - $('#tousseItemTable').children().first().children().each(function(index,element){ - if($('#deleted'+index).val() == '0'){ - var tousseName = $('#tousseName'+index).val(); - var recyclingAmount = parseInt($('#recycleAmount'+index).val(),10); - var loadedAmount = parseInt($('#loadedAmount'+index).val(),10); - var tousseType = $('#tousseType'+index).val(); - if(recyclingAmount > 0){ - //有回收,那加入回收物品清单 - recyclingTousses.push({tousseName:tousseName,recyclingAmount:recyclingAmount}); + $('#tousseItemTable').children().first().children().each(function (index, element) { + if ($('#deleted' + index).val() == '0') { + var tousseName = $('#tousseName' + index).val(); + var recyclingAmount = parseInt($('#recycleAmount' + index).val(), 10); + var loadedAmount = parseInt($('#loadedAmount' + index).val(), 10); + var tousseType = $('#tousseType' + index).val(); + if (recyclingAmount > 0) { + //有回收,那加入回收物品清单 + recyclingTousses.push({ tousseName: tousseName, recyclingAmount: recyclingAmount }); } - if(recyclingAmount > loadedAmount){ + if (recyclingAmount > loadedAmount) { isPartIntheBasket = true; tousseTypeName = tousseType; - if(tousseType == '外来器械包' && sstsConfig.enableForeignToussePartRecycle){ + if (tousseType == '外来器械包' && sstsConfig.enableForeignToussePartRecycle) { tousseTypeisForeignTousseDefinition = true; } - return false; - } - } + return false; + } + } }); //部分入筐提示 - if(isPartIntheBasket){ - if(sstsConfig.enablePartRecycle == true && tousseTypeName !== "外来器械包"){ - dialogConfirm("还有部分器械包未装入篮筐,是否继续保存?",function(){ - if(sstsConfig.showRecyclingDetail && recyclingTousses.length > 0){ - showRecyclingDetail(recyclingTousses,function(){ - checkAutoReturnBorrowing(confirmation,saveAndNew,print,recyclingAmountConfirm); + if (isPartIntheBasket) { + if (sstsConfig.enablePartRecycle == true && tousseTypeName !== "外来器械包") { + dialogConfirm("还有部分器械包未装入篮筐,是否继续保存?", function () { + if (sstsConfig.showRecyclingDetail && recyclingTousses.length > 0) { + showRecyclingDetail(recyclingTousses, function () { + checkAutoReturnBorrowing(confirmation, saveAndNew, print, recyclingAmountConfirm); }); - }else{ - checkAutoReturnBorrowing(confirmation,saveAndNew,print,recyclingAmountConfirm); + } else { + checkAutoReturnBorrowing(confirmation, saveAndNew, print, recyclingAmountConfirm); } }); - }else if(tousseTypeisForeignTousseDefinition == true && (recyclingStatus == '部分接收' || recyclingStatus == '待接收')){ - dialogConfirm("还有部分器械包未装入篮筐,是否继续保存?",function(){ - if(sstsConfig.showRecyclingDetail && recyclingTousses.length > 0){ - showRecyclingDetail(recyclingTousses,function(){ - checkAutoReturnBorrowing(confirmation,saveAndNew,print,recyclingAmountConfirm); + } else if (tousseTypeisForeignTousseDefinition == true && (recyclingStatus == '部分接收' || recyclingStatus == '待接收')) { + dialogConfirm("还有部分器械包未装入篮筐,是否继续保存?", function () { + if (sstsConfig.showRecyclingDetail && recyclingTousses.length > 0) { + showRecyclingDetail(recyclingTousses, function () { + checkAutoReturnBorrowing(confirmation, saveAndNew, print, recyclingAmountConfirm); }); - }else{ - checkAutoReturnBorrowing(confirmation,saveAndNew,print,recyclingAmountConfirm); + } else { + checkAutoReturnBorrowing(confirmation, saveAndNew, print, recyclingAmountConfirm); } }); - }else{ + } else { alertDiv('还有部分器械包未装入容器,不能保存。'); } - }else{ - if(sstsConfig.showRecyclingDetail && recyclingTousses.length > 0){ - showRecyclingDetail(recyclingTousses,function(){ - checkAutoReturnBorrowing(confirmation,saveAndNew,print,recyclingAmountConfirm); + } else { + if (sstsConfig.showRecyclingDetail && recyclingTousses.length > 0) { + showRecyclingDetail(recyclingTousses, function () { + checkAutoReturnBorrowing(confirmation, saveAndNew, print, recyclingAmountConfirm); }); - }else{ - checkAutoReturnBorrowing(confirmation,saveAndNew,print,recyclingAmountConfirm); + } else { + checkAutoReturnBorrowing(confirmation, saveAndNew, print, recyclingAmountConfirm); } } return; @@ -4577,17 +4577,17 @@ */ //是否进行清点确认 false 为保存,true 为清点确认 var IntheBoxState = false; -function submitFormFunction(confirmation,saveAndNew,autoReturnTheBorrowingTousse,print,recyclingAmountConfirm,isConfirm){ +function submitFormFunction(confirmation, saveAndNew, autoReturnTheBorrowingTousse, print, recyclingAmountConfirm, isConfirm) { isConfirm = isConfirm || false; - var jsonStr = getJsonParams(confirmation,isConfirm); - if(jsonStr == '') {return;} + var jsonStr = getJsonParams(confirmation, isConfirm); + if (jsonStr == '') { return; } var jSONe = JSON.parse(jsonStr); //console.log(jSONe);return alertDiv("保存中,请稍候......", true); - if(IntheBoxState == true){ - jSONe.tally = true; - }else{ - jSONe.tally = false; + if (IntheBoxState == true) { + jSONe.tally = true; + } else { + jSONe.tally = false; } var id = document.getElementById('id').value; var app_id = document.getElementById('recyclingApplicationId').value; @@ -4598,163 +4598,163 @@ var depart = document.getElementById('depart').innerText; var recyclingTime = document.getElementById('recyclingTime').value || ''; var recyclingUserDefault = true; - if(sstsConfig.hasOwnProperty('recyclingUserDefault') && !sstsConfig.recyclingUserDefault){ + if (sstsConfig.hasOwnProperty('recyclingUserDefault') && !sstsConfig.recyclingUserDefault) { recyclingUserDefault = false; } var submitUrl = WWWROOT + "/disinfectSystem/recyclingRecordAction!saveRecyclingRecord.do"; $.ajax({ - url : submitUrl, - type : "POST", - timeout : 300000, - dataType :'json', - data : { - jsonParam : "" + JSON.stringify(jSONe) + "", - id : id, - recyclingApplicationId : app_id, - invoicePlanVersion : $("#invoicePlanVersion").val(), - departCode : departCode, - recyclingUser : recyclingUser, - departmentSender:departmentSender, - operator : operator, - depart : depart, - websocketSessionId : getWebsocketSessionId(), - recyclingTime : recyclingTime, - recyclingUserDefault : recyclingUserDefault, - autoReturnTheBorrowingTousse : autoReturnTheBorrowingTousse, - recyclingAmountConfirm:recyclingAmountConfirm, - remark:$('#remarkText').text(), - communicationUserName:$('#communicationUserName').val(), - communicationUserCode:$('#communicationUserCode').val(), - needPrint : print - }, - success : function(result) { - if(result.success){ - //如果启用了视频监控、并且申请单id为空,即为新添加回收 - if(sstsConfig.enableVideoMonitorModule && !id - && setVideoWhenAddRecyclingRecord){ - var recyclingRecordId = result.recyclingRecordId; - var recyclingRecordIdArray = []; - if(recyclingRecordId){ - recyclingRecordIdArray.push(recyclingRecordId); - try{ - setVideoWhenAddRecyclingRecord(recyclingRecordIdArray); - }catch(e){ - alert('设备回收记录对应的视频失败'); - } - } - } - if(print && result.recyclingPrintData && result.recyclingPrintData.length > 0){ - printRecyclingDetail(result.recyclingPrintData); - } - alertDiv(result.message, true); - setTimeout("closeDiv()",1200); - - var voluntarilyUrgentItems = result.voluntarilyUrgentItems; - var voluntarilyUrgentItemsString = ''; - if (sstsConfig.enableTousseVoluntarilyUrgent && - voluntarilyUrgentItems && voluntarilyUrgentItems.length > 0) { - voluntarilyUrgentItemsString = JSON.stringify(voluntarilyUrgentItems); - } - if(saveAndNew){ - if(sstsConfig.loadWashBasketsAfterSaveAndCreateNewRecyclingRecord){ - if(saveBasketsArr.length > 0){ + url: submitUrl, + type: "POST", + timeout: 300000, + dataType: 'json', + data: { + jsonParam: "" + JSON.stringify(jSONe) + "", + id: id, + recyclingApplicationId: app_id, + invoicePlanVersion: $("#invoicePlanVersion").val(), + departCode: departCode, + recyclingUser: recyclingUser, + departmentSender: departmentSender, + operator: operator, + depart: depart, + websocketSessionId: getWebsocketSessionId(), + recyclingTime: recyclingTime, + recyclingUserDefault: recyclingUserDefault, + autoReturnTheBorrowingTousse: autoReturnTheBorrowingTousse, + recyclingAmountConfirm: recyclingAmountConfirm, + remark: $('#remarkText').text(), + communicationUserName: $('#communicationUserName').val(), + communicationUserCode: $('#communicationUserCode').val(), + needPrint: print + }, + success: function (result) { + if (result.success) { + //如果启用了视频监控、并且申请单id为空,即为新添加回收 + if (sstsConfig.enableVideoMonitorModule && !id + && setVideoWhenAddRecyclingRecord) { + var recyclingRecordId = result.recyclingRecordId; + var recyclingRecordIdArray = []; + if (recyclingRecordId) { + recyclingRecordIdArray.push(recyclingRecordId); + try { + setVideoWhenAddRecyclingRecord(recyclingRecordIdArray); + } catch (e) { + alert('设备回收记录对应的视频失败'); + } + } + } + if (print && result.recyclingPrintData && result.recyclingPrintData.length > 0) { + printRecyclingDetail(result.recyclingPrintData); + } + alertDiv(result.message, true); + setTimeout("closeDiv()", 1200); + + var voluntarilyUrgentItems = result.voluntarilyUrgentItems; + var voluntarilyUrgentItemsString = ''; + if (sstsConfig.enableTousseVoluntarilyUrgent && + voluntarilyUrgentItems && voluntarilyUrgentItems.length > 0) { + voluntarilyUrgentItemsString = JSON.stringify(voluntarilyUrgentItems); + } + if (saveAndNew) { + if (sstsConfig.loadWashBasketsAfterSaveAndCreateNewRecyclingRecord) { + if (saveBasketsArr.length > 0) { var basketsStr = saveBasketsArr.join(','); - location.href = "recycleForTouchScreen.jsp?resolution=" + resolution + "&rememberRecycleUser=" + rememberRecycleUser+"&basketsStr="+basketsStr; - }else { + location.href = "recycleForTouchScreen.jsp?resolution=" + resolution + "&rememberRecycleUser=" + rememberRecycleUser + "&basketsStr=" + basketsStr; + } else { location.href = "recycleForTouchScreen.jsp?resolution=" + resolution + "&rememberRecycleUser=" + rememberRecycleUser; } - }else { + } else { location.href = "recycleForTouchScreen.jsp?resolution=" + resolution + "&rememberRecycleUser=" + rememberRecycleUser; } - }else{ - location.href = encodeURI("awaitForRecycleList.jsp?resolution=" + resolution + "&voluntarilyUrgentItems=" + voluntarilyUrgentItemsString); - } - }else{ - if(result.versionNotMatch){ - closeDiv(); - layer.open({ - type: 1, - content: '' + result.message + '', //这里content是一个普通的String - btn: ['关闭','关闭并刷新'], - area: ['600px', '400px'], - btnAlign: 'c', - btn2:function(){ - if(result.recyclingApplicationVo != null){ - $("#invoicePlanVersion").val(result.recyclingApplicationVo.version); - if(result.recyclingApplicationVo.applicationItems.length > 0 ){ - var addColumnArr = []; - var tousseItemsTable = $('#tousseItemTable').children().first().children(); - for(var m = 0; m < result.recyclingApplicationVo.applicationItems.length;m++){ - var item = result.recyclingApplicationVo.applicationItems[m]; - var isAdd = true; - for (var j = 0; j < tousseItemsTable.length; j++) { - if(item.tousseDefinitionId == $('#tousseDefinitionID' + j).val()){ - var applicationAmountVal = parseInt($('#applicationAmount'+j).val(), 10); - if(item.amount > applicationAmountVal){ - $('#applicationAmount'+j).val(item.amount); - $('#recycleAmount'+j).val(item.amount); - } - isAdd = false; - break; - } - } - - if (isAdd) { - var errorDamageQmKey = item.errorDamageQmKey; - if(isUndefinedOrNullOrEmpty(errorDamageQmKey)){ - var timeStr = new Date().getTime(); - errorDamageQmKey = item.tousseDefinitionId + "_" + timeStr; + } else { + location.href = encodeURI("awaitForRecycleList.jsp?resolution=" + resolution + "&voluntarilyUrgentItems=" + voluntarilyUrgentItemsString); + } + } else { + if (result.versionNotMatch) { + closeDiv(); + layer.open({ + type: 1, + content: '' + result.message + '', //这里content是一个普通的String + btn: ['关闭', '关闭并刷新'], + area: ['600px', '400px'], + btnAlign: 'c', + btn2: function () { + if (result.recyclingApplicationVo != null) { + $("#invoicePlanVersion").val(result.recyclingApplicationVo.version); + if (result.recyclingApplicationVo.applicationItems.length > 0) { + var addColumnArr = []; + var tousseItemsTable = $('#tousseItemTable').children().first().children(); + for (var m = 0; m < result.recyclingApplicationVo.applicationItems.length; m++) { + var item = result.recyclingApplicationVo.applicationItems[m]; + var isAdd = true; + for (var j = 0; j < tousseItemsTable.length; j++) { + if (item.tousseDefinitionId == $('#tousseDefinitionID' + j).val()) { + var applicationAmountVal = parseInt($('#applicationAmount' + j).val(), 10); + if (item.amount > applicationAmountVal) { + $('#applicationAmount' + j).val(item.amount); + $('#recycleAmount' + j).val(item.amount); } - var toussItem = { - tousseItemId: '', - tousseName: item.tousseName, - tousseDefinitionID: item.tousseDefinitionId, - applicationAmount: item.amount, - recycleAmount: item.amount, - loadedAmount: 0, - isCleanedEntirely: item.isCleanedEntirely, - tousseType: item.tousseType, - isThereIdentificationCard: item.isThereIdentificationCard, - isApplyEntireTousse: item.isApplyEntireTousse, - urgentAmount : item.urgentAmount, - errorRemark : item.errorRemark, - damageRemark : item.damageRemark, - urgentLevel : item.urgentLevel, - tousseRemark : '', - errorDamageQmKey : errorDamageQmKey, - spelling : item.spelling - }; - addColumnArr.push(toussItem); + isAdd = false; + break; } } - var initColumnLength = tousseItemsTable.length; - for (var i = 0; i < addColumnArr.length; i++) { - var addColumnObj = addColumnArr[i]; - addColumnObj.row = i + initColumnLength; - //统一增加的原因,是防止下次去拿数据的时候,拿到刚增加进去的数据 - addToussItem(addColumnObj, false); + + if (isAdd) { + var errorDamageQmKey = item.errorDamageQmKey; + if (isUndefinedOrNullOrEmpty(errorDamageQmKey)) { + var timeStr = new Date().getTime(); + errorDamageQmKey = item.tousseDefinitionId + "_" + timeStr; + } + var toussItem = { + tousseItemId: '', + tousseName: item.tousseName, + tousseDefinitionID: item.tousseDefinitionId, + applicationAmount: item.amount, + recycleAmount: item.amount, + loadedAmount: 0, + isCleanedEntirely: item.isCleanedEntirely, + tousseType: item.tousseType, + isThereIdentificationCard: item.isThereIdentificationCard, + isApplyEntireTousse: item.isApplyEntireTousse, + urgentAmount: item.urgentAmount, + errorRemark: item.errorRemark, + damageRemark: item.damageRemark, + urgentLevel: item.urgentLevel, + tousseRemark: '', + errorDamageQmKey: errorDamageQmKey, + spelling: item.spelling + }; + addColumnArr.push(toussItem); } } - - + var initColumnLength = tousseItemsTable.length; + for (var i = 0; i < addColumnArr.length; i++) { + var addColumnObj = addColumnArr[i]; + addColumnObj.row = i + initColumnLength; + //统一增加的原因,是防止下次去拿数据的时候,拿到刚增加进去的数据 + addToussItem(addColumnObj, false); + } } - } - }); - }else{ - alertDiv(result.message); - } - - } - }, - error: function(x, t, m) { - closeDiv(); - if(t == "timeout") { - alert("提交超时,请重试"); - } else { - alert(t); - } - } - }); + + + } + } + }); + } else { + alertDiv(result.message); + } + + } + }, + error: function (x, t, m) { + closeDiv(); + if (t == "timeout") { + alert("提交超时,请重试"); + } else { + alert(t); + } + } + }); } /** @@ -4765,16 +4765,16 @@ * @param print 保存并打印回收记录操作 * Annie 如果tally为true是清点确认 否则就是false */ -function submitFormFunctionForInventoryConfirm(confirmation,saveAndNew,autoReturnTheBorrowingTousse,print,recyclingAmountConfirm,isConfirm){ +function submitFormFunctionForInventoryConfirm(confirmation, saveAndNew, autoReturnTheBorrowingTousse, print, recyclingAmountConfirm, isConfirm) { isConfirm = isConfirm || false; - var jsonStr = getJsonParams(confirmation,isConfirm); - if(jsonStr == '') {return;} + var jsonStr = getJsonParams(confirmation, isConfirm); + if (jsonStr == '') { return; } alertDiv("保存中,请稍候......", true); - var jSONe = JSON.parse(jsonStr) - if(IntheBoxState == true){ - jSONe.tally = true; - }else{ - jSONe.tally = false; + var jSONe = JSON.parse(jsonStr) + if (IntheBoxState == true) { + jSONe.tally = true; + } else { + jSONe.tally = false; } var id = document.getElementById('id').value; var app_id = document.getElementById('recyclingApplicationId').value; @@ -4785,75 +4785,75 @@ var depart = document.getElementById('depart').innerText; var recyclingTime = document.getElementById('recyclingTime').value; var recyclingUserDefault = true; - if(sstsConfig.hasOwnProperty('recyclingUserDefault') && !sstsConfig.recyclingUserDefault){ + if (sstsConfig.hasOwnProperty('recyclingUserDefault') && !sstsConfig.recyclingUserDefault) { recyclingUserDefault = false; } var submitUrl = WWWROOT + "/disinfectSystem/recyclingRecordAction!inventoryConfirm.do"; $.ajax({ - url : submitUrl, - type : "POST", - timeout : 300000, - dataType :'json', - data : { - jsonParam : "" + JSON.stringify(jSONe) + "", - id : id, - recyclingApplicationId : app_id, - invoicePlanVersion : $("#invoicePlanVersion").val(), - departCode : departCode, - recyclingUser : recyclingUser, - departmentSender:departmentSender, - operator : operator, - depart : depart, - recyclingTime : recyclingTime, - recyclingUserDefault : recyclingUserDefault, - autoReturnTheBorrowingTousse : autoReturnTheBorrowingTousse, - recyclingAmountConfirm:recyclingAmountConfirm, - remark:$('#remarkText').text(), - communicationUserName:$('#communicationUserName').val(), - communicationUserCode:$('#communicationUserCode').val(), - needPrint : print - }, - success : function(result) { - if(result.success){ - //如果启用了视频监控、并且申请单id为空,即为新添加回收 - if(sstsConfig.enableVideoMonitorModule && !id - && setVideoWhenAddRecyclingRecord){ - var recyclingRecordId = result.recyclingRecordId; - var recyclingRecordIdArray = []; - if(recyclingRecordId){ - recyclingRecordIdArray.push(recyclingRecordId); - try{ - setVideoWhenAddRecyclingRecord(recyclingRecordIdArray); - }catch(e){ - alert('设备回收记录对应的视频失败'); - } - } - } - if(saveAndNew){ - location.href = "recycleForTouchScreen.jsp?resolution=" + resolution + "&rememberRecycleUser=" + rememberRecycleUser; - }else{ - location.href = "awaitForRecycleList.jsp?resolution=" + resolution; - } - }else{ - alertDiv(result.message); - } - }, - error: function(x, t, m) { - closeDiv(); - if(t == "timeout") { - alert("提交超时,请重试"); - } else { - alert(t); - } - } - }); + url: submitUrl, + type: "POST", + timeout: 300000, + dataType: 'json', + data: { + jsonParam: "" + JSON.stringify(jSONe) + "", + id: id, + recyclingApplicationId: app_id, + invoicePlanVersion: $("#invoicePlanVersion").val(), + departCode: departCode, + recyclingUser: recyclingUser, + departmentSender: departmentSender, + operator: operator, + depart: depart, + recyclingTime: recyclingTime, + recyclingUserDefault: recyclingUserDefault, + autoReturnTheBorrowingTousse: autoReturnTheBorrowingTousse, + recyclingAmountConfirm: recyclingAmountConfirm, + remark: $('#remarkText').text(), + communicationUserName: $('#communicationUserName').val(), + communicationUserCode: $('#communicationUserCode').val(), + needPrint: print + }, + success: function (result) { + if (result.success) { + //如果启用了视频监控、并且申请单id为空,即为新添加回收 + if (sstsConfig.enableVideoMonitorModule && !id + && setVideoWhenAddRecyclingRecord) { + var recyclingRecordId = result.recyclingRecordId; + var recyclingRecordIdArray = []; + if (recyclingRecordId) { + recyclingRecordIdArray.push(recyclingRecordId); + try { + setVideoWhenAddRecyclingRecord(recyclingRecordIdArray); + } catch (e) { + alert('设备回收记录对应的视频失败'); + } + } + } + if (saveAndNew) { + location.href = "recycleForTouchScreen.jsp?resolution=" + resolution + "&rememberRecycleUser=" + rememberRecycleUser; + } else { + location.href = "awaitForRecycleList.jsp?resolution=" + resolution; + } + } else { + alertDiv(result.message); + } + }, + error: function (x, t, m) { + closeDiv(); + if (t == "timeout") { + alert("提交超时,请重试"); + } else { + alert(t); + } + } + }); } /** * 保存回收记录 */ -function doSaveAction(){ - submitFunction(false,false,false,false); +function doSaveAction() { + submitFunction(false, false, false, false); } /** @@ -4863,400 +4863,400 @@ * @param print 是否打印 * @param recyclingAmountConfirm 是否 */ -function submitInventoryConfirm(confirmation,saveAndNew,print,recyclingAmountConfirm){ - if(submitChecks()){ - //回收物品清单 - var recyclingTousses = []; - var isPartIntheBasket = false; - $('#tousseItemTable').children().first().children().each(function(index,element){ - if($('#deleted'+index).val() == '0'){ - var tousseName = $('#tousseName'+index).val(); - var recyclingAmount = parseInt($('#recycleAmount'+index).val(),10); - var loadedAmount = parseInt($('#loadedAmount'+index).val(),10); - if(recyclingAmount > 0){ - //有回收,那加入回收物品清单 - recyclingTousses.push({tousseName:tousseName,recyclingAmount:recyclingAmount}); - } - } +function submitInventoryConfirm(confirmation, saveAndNew, print, recyclingAmountConfirm) { + if (submitChecks()) { + //回收物品清单 + var recyclingTousses = []; + var isPartIntheBasket = false; + $('#tousseItemTable').children().first().children().each(function (index, element) { + if ($('#deleted' + index).val() == '0') { + var tousseName = $('#tousseName' + index).val(); + var recyclingAmount = parseInt($('#recycleAmount' + index).val(), 10); + var loadedAmount = parseInt($('#loadedAmount' + index).val(), 10); + if (recyclingAmount > 0) { + //有回收,那加入回收物品清单 + recyclingTousses.push({ tousseName: tousseName, recyclingAmount: recyclingAmount }); + } + } - }); - if (recyclingTousses.length > 0){ - //调用提示筐 - showRecyclingDetail(recyclingTousses,function(){ - checkAutoReturnBorrowingForInventoryConfirm(confirmation,saveAndNew,print,recyclingAmountConfirm); - }); - } - else{ - alertDiv("所有物品的数量均为0,不能进行清点确认,可以终止本申请单。"); - } - IntheBoxState = true; - } + }); + if (recyclingTousses.length > 0) { + //调用提示筐 + showRecyclingDetail(recyclingTousses, function () { + checkAutoReturnBorrowingForInventoryConfirm(confirmation, saveAndNew, print, recyclingAmountConfirm); + }); + } + else { + alertDiv("所有物品的数量均为0,不能进行清点确认,可以终止本申请单。"); + } + IntheBoxState = true; + } } // 提交清点确认时验证 -function submitChecks() { - var isThereTousseItems = false; - var isAllTousseInTheBasket = true; - var urgentAmountError = false; - var isIdCardItme = true;//是否带有标识牌的器械包没有入筐 +function submitChecks() { + var isThereTousseItems = false; + var isAllTousseInTheBasket = true; + var urgentAmountError = false; + var isIdCardItme = true;//是否带有标识牌的器械包没有入筐 var isThereForeignTousseAndCustomTousse = false;//是否存在外来器械包和自定义器械包 var tousseTypeStr; var tousseNames; - var isCleanedEntirelys= false;//是否存在整包清洗 - var allInstrumentBasket =true;//所有的器械包是否入筐,true是,false 否 - if($('#depart').text()== ''){ - alertDiv('请先扫描科室条码。'); - return false; - } - var recyclingRecordId = $('#recyclingApplicationId').val(); - if (isTousseItemTableEmpty() && recyclingRecordId == ''){ - alert("空白的回收单不能保存!"); - return false; - } - var isEmptyFormSubmit = true; - $('#tousseItemTable').children().first().children().each(function(index,element){ - if($('#deleted'+index).val() == '0'){ - isThereTousseItems = true; - var tousseType = $('#tousseType'+index).val(); - var recyclingAmount = parseInt($('#recycleAmount'+index).val(),10); - var applicationAmount = parseInt($('#applicationAmount'+index).val(),10); - var loadedAmount = parseInt($('#loadedAmount'+index).val(),10); - if(loadedAmount > 0 && recyclingAmount > loadedAmount){ - isAllTousseInTheBasket = false; - return false; - } + var isCleanedEntirelys = false;//是否存在整包清洗 + var allInstrumentBasket = true;//所有的器械包是否入筐,true是,false 否 + if ($('#depart').text() == '') { + alertDiv('请先扫描科室条码。'); + return false; + } + var recyclingRecordId = $('#recyclingApplicationId').val(); + if (isTousseItemTableEmpty() && recyclingRecordId == '') { + alert("空白的回收单不能保存!"); + return false; + } + var isEmptyFormSubmit = true; + $('#tousseItemTable').children().first().children().each(function (index, element) { + if ($('#deleted' + index).val() == '0') { + isThereTousseItems = true; + var tousseType = $('#tousseType' + index).val(); + var recyclingAmount = parseInt($('#recycleAmount' + index).val(), 10); + var applicationAmount = parseInt($('#applicationAmount' + index).val(), 10); + var loadedAmount = parseInt($('#loadedAmount' + index).val(), 10); + if (loadedAmount > 0 && recyclingAmount > loadedAmount) { + isAllTousseInTheBasket = false; + return false; + } - if(loadedAmount > 0){ - isEmptyFormSubmit = false; - } - if(validateUrgentAmount(index,recyclingAmount)){ - highlightExistTousseItem(index); - urgentAmountError = true; - return false; - } - /* + if (loadedAmount > 0) { + isEmptyFormSubmit = false; + } + if (validateUrgentAmount(index, recyclingAmount)) { + highlightExistTousseItem(index); + urgentAmountError = true; + return false; + } + /* * Annie * 回收数量小于0 * 是否存在整包清洗 * 带有标识牌的包是否没有入筐 * 外来器械包不能清点确认 * 所有的器械包全部入筐不能保存 */ - var tousseName = $('#tousseName'+index).val(); - var isIdCard =$('#isThereIdentificationCard'+index).val(); - var isCleanedEntirely = $('#isCleanedEntirely'+index).val() - if(isIdCard == '是') { - if (loadedAmount <= 0) { - tousseNames = tousseName; - isIdCardItme = false; - return false; - } - } - if(tousseType == "外来器械包" || tousseType == "自定义器械包"){ - tousseTypeStr = tousseType; - tousseNames = tousseName; - isThereForeignTousseAndCustomTousse = true; - return false; - } - if(isCleanedEntirely == '是' ){ - if(loadedAmount < recyclingAmount){ - tousseNames = tousseName; - isCleanedEntirelys = true; - return false; + var tousseName = $('#tousseName' + index).val(); + var isIdCard = $('#isThereIdentificationCard' + index).val(); + var isCleanedEntirely = $('#isCleanedEntirely' + index).val() + if (isIdCard == '是') { + if (loadedAmount <= 0) { + tousseNames = tousseName; + isIdCardItme = false; + return false; + } + } + if (tousseType == "外来器械包" || tousseType == "自定义器械包") { + tousseTypeStr = tousseType; + tousseNames = tousseName; + isThereForeignTousseAndCustomTousse = true; + return false; + } + if (isCleanedEntirely == '是') { + if (loadedAmount < recyclingAmount) { + tousseNames = tousseName; + isCleanedEntirelys = true; + return false; } } - if(loadedAmount != recyclingAmount || loadedAmount !=applicationAmount ||loadedAmount == 0 ){ - if(loadedAmount < applicationAmount || loadedAmount < recyclingAmount){ - allInstrumentBasket = false; + if (loadedAmount != recyclingAmount || loadedAmount != applicationAmount || loadedAmount == 0) { + if (loadedAmount < applicationAmount || loadedAmount < recyclingAmount) { + allInstrumentBasket = false; } - if(loadedAmount == 0){ - allInstrumentBasket = false; + if (loadedAmount == 0) { + allInstrumentBasket = false; } } - } - }); - if (isTousseItemTableEmpty()){ - alertDiv("空白的回收单不能做清点确认!"); - return false; - } - - if(!isIdCardItme){ - alertDiv('带有标识牌的 '+tousseNames+' 器械包还没有入筐,不能做清点确认!'); + } + }); + if (isTousseItemTableEmpty()) { + alertDiv("空白的回收单不能做清点确认!"); return false; } - if(isThereForeignTousseAndCustomTousse){ - alertDiv( tousseNames+'属于'+tousseTypeStr+',不能做清点确认!'); - return false; + + if (!isIdCardItme) { + alertDiv('带有标识牌的 ' + tousseNames + ' 器械包还没有入筐,不能做清点确认!'); + return false; } - if(isCleanedEntirelys){ - alertDiv( tousseNames+'为整包清洗,必须入筐后才能清点确认!'); - return false; + if (isThereForeignTousseAndCustomTousse) { + alertDiv(tousseNames + '属于' + tousseTypeStr + ',不能做清点确认!'); + return false; } - if(!isAllTousseInTheBasket){ - alertDiv('部分器械包回收数量大于装载数量,还未入筐,不能保存。'); - return false; - } - if(allInstrumentBasket){ - alertDiv('所有包都已经入筐,不能做清点确认'); - return false; + if (isCleanedEntirelys) { + alertDiv(tousseNames + '为整包清洗,必须入筐后才能清点确认!'); + return false; } - if(urgentAmountError){ - return false; - } + if (!isAllTousseInTheBasket) { + alertDiv('部分器械包回收数量大于装载数量,还未入筐,不能保存。'); + return false; + } + if (allInstrumentBasket) { + alertDiv('所有包都已经入筐,不能做清点确认'); + return false; + } + if (urgentAmountError) { + return false; + } - //验证清点人是否为空(前提为配置清点人强制不能为空,默认为允许为空) - if(sstsConfig.recyclePageOperatorNotNull == true && $("#operator").val() == ''){ - alertDiv('清点人不能为空,请扫描清点人条码。'); - return false; - } + //验证清点人是否为空(前提为配置清点人强制不能为空,默认为允许为空) + if (sstsConfig.recyclePageOperatorNotNull == true && $("#operator").val() == '') { + alertDiv('清点人不能为空,请扫描清点人条码。'); + return false; + } - //验证清点人是否为空(前提为配置清点人强制不能为空) - if(sstsConfig.recyclePageRecyclingUserNotNull == true && $("#recyclingUser").val() == ''){ - alertDiv('回收人不能为空,请扫描回收人条码。'); - return false; - } - return true; + //验证清点人是否为空(前提为配置清点人强制不能为空) + if (sstsConfig.recyclePageRecyclingUserNotNull == true && $("#recyclingUser").val() == '') { + alertDiv('回收人不能为空,请扫描回收人条码。'); + return false; + } + return true; } // 清点确认 function inventoryConfirm() { - submitInventoryConfirm(false,false,false,false); + submitInventoryConfirm(false, false, false, false); } // 保存并新建回收记录 -function doSaveAndNewAction(){ - submitFunction(false,true,false,false); +function doSaveAndNewAction() { + submitFunction(false, true, false, false); } // 保存并打印回收记录 -function doSaveAndPrintAction(){ - submitFunction(false,false,true,false); +function doSaveAndPrintAction() { + submitFunction(false, false, true, false); } // 保存并打印并新建回收记录 -function doSaveAndPrintAndNewAction(){ - submitFunction(false,true,true,false); +function doSaveAndPrintAndNewAction() { + submitFunction(false, true, true, false); } // 确认回收记录 -function doConfirmAction(){ - submitFunction(true,false,false,false); +function doConfirmAction() { + submitFunction(true, false, false, false); } // 确认回收数量(确认沟通) -function recyclingAmountConfirm(){ - submitFunction(false,false,false,true); +function recyclingAmountConfirm() { + submitFunction(false, false, false, true); } // 终止回收记录 -function end(){ - if($("#recyclingApplicationId").val() == ''){ +function end() { + if ($("#recyclingApplicationId").val() == '') { alertDiv("没有待回收记录,不能终止."); return; } - var endCase = openModalWindowForExt(WWWROOT+"/disinfectsystem/recyclingApplication/selectEndCause.jsp", '','请选择终止原因', "760", "400"); + var endCase = openModalWindowForExt(WWWROOT + "/disinfectsystem/recyclingApplication/selectEndCause.jsp", '', '请选择终止原因', "760", "400"); var htmlHeight = $('html').height(); var htmlWidth = $('html').width(); var left = 0; var top = 0; - if(isIE()){ - left = parseInt((htmlWidth-$('#extWindow').width())/2); - top = parseInt((htmlHeight-$('#extWindow').height())/2); - }else { - var body_height = parseInt(htmlHeight/getZoom(1920,1080)); - var body_width = parseInt(htmlWidth/getZoom(1920,1080)); - left = parseInt((body_width-$('#extWindow').width())/2); - top = parseInt((body_height-$('#extWindow').height())/2); + if (isIE()) { + left = parseInt((htmlWidth - $('#extWindow').width()) / 2); + top = parseInt((htmlHeight - $('#extWindow').height()) / 2); + } else { + var body_height = parseInt(htmlHeight / getZoom(1920, 1080)); + var body_width = parseInt(htmlWidth / getZoom(1920, 1080)); + left = parseInt((body_width - $('#extWindow').width()) / 2); + top = parseInt((body_height - $('#extWindow').height()) / 2); } - - $('.ext-el-mask').css({'width':'100%','height':'100%'}); - $('#extWindow').css({'left':left+'px','top':top+'px'}); - $('.x-shadow').css({'left':left+'px','top':top+'px'}); - if(endCase == undefined){ + $('.ext-el-mask').css({ 'width': '100%', 'height': '100%' }); + $('#extWindow').css({ 'left': left + 'px', 'top': top + 'px' }); + $('.x-shadow').css({ 'left': left + 'px', 'top': top + 'px' }); + + if (endCase == undefined) { return; - }else { - var loop = setInterval(function() { - if(endCase.hidden) { - clearInterval(loop); + } else { + var loop = setInterval(function () { + if (endCase.hidden) { + clearInterval(loop); - var returnValue = endCase.returnValue || ''; + var returnValue = endCase.returnValue || ''; - if(returnValue == ''){ - return; - } + if (returnValue == '') { + return; + } - var paramStr = JSON.stringify(canTerminateTousseItemIds); - $.ajax({ - type:'get', - url:WWWROOT + '/disinfectSystem/invoicePlanAction!terminateTousseItems.do', - data:'tousseItemIds=' + encodeURI(paramStr)+'&endCase='+encodeURI(returnValue), - dataType:'text', - success:function(resultStr){ - var result = JSON.parse(resultStr); - alertDiv(result.message); - if(result.success){ - location.href = 'awaitForRecycleList.jsp?resolution=' + resolution; - } - }, - error:function(XMLHttpRequest, textStatus, errorThrown){ - } - }); - } - },500); - } + var paramStr = JSON.stringify(canTerminateTousseItemIds); + $.ajax({ + type: 'get', + url: WWWROOT + '/disinfectSystem/invoicePlanAction!terminateTousseItems.do', + data: 'tousseItemIds=' + encodeURI(paramStr) + '&endCase=' + encodeURI(returnValue), + dataType: 'text', + success: function (resultStr) { + var result = JSON.parse(resultStr); + alertDiv(result.message); + if (result.success) { + location.href = 'awaitForRecycleList.jsp?resolution=' + resolution; + } + }, + error: function (XMLHttpRequest, textStatus, errorThrown) { + } + }); + } + }, 500); + } } // 一键入筐 -function allInputBasket(){ +function allInputBasket() { // 遍历每一行 - $('#tousseItemTable').children().first().children().each(function(row,element){ + $('#tousseItemTable').children().first().children().each(function (row, element) { // 判断是否被删除,为0代表没有被删除 - if($('#deleted'+row).val() == '0'){ - var amount = parseInt($('#recycleAmount'+row).val(),10) - parseInt($('#loadedAmount'+row).val(),10); - if(amount > 0){ + if ($('#deleted' + row).val() == '0') { + var amount = parseInt($('#recycleAmount' + row).val(), 10) - parseInt($('#loadedAmount' + row).val(), 10); + if (amount > 0) { // 回收数量大于已装载(入筐)数量,则需要入筐 putTousseInTheBasket(row); } - } + } }); } // 取消按钮 -function cancel(){ +function cancel() { layer.confirm('确认取消吗?', { - btn: ['确定', '取消'] - }, function(index, layero){ - // 确定按钮的回调 - location.href = 'awaitForRecycleList.jsp?resolution=' + resolution; - }, function(index){ - //取消按钮 - }); + btn: ['确定', '取消'] + }, function (index, layero) { + // 确定按钮的回调 + location.href = 'awaitForRecycleList.jsp?resolution=' + resolution; + }, function (index) { + //取消按钮 + }); } // 自定义入筐时获取当前页面器械包的数据 -function getUnCleanedEntirelyTousseInfo(){ +function getUnCleanedEntirelyTousseInfo() { var result = new Array(); - $('#tousseItemTable').children().first().children().each(function(i,element){ - var recycleAmount = parseInt($('#recycleAmount'+i).val(),10); - var loadedAmount = parseInt($('#loadedAmount'+i).val(),10); + $('#tousseItemTable').children().first().children().each(function (i, element) { + var recycleAmount = parseInt($('#recycleAmount' + i).val(), 10); + var loadedAmount = parseInt($('#loadedAmount' + i).val(), 10); var unLoadedAmount = recycleAmount - loadedAmount; - if($('#tousseItemsTr'+i).css('display') == 'none'){ + if ($('#tousseItemsTr' + i).css('display') == 'none') { return; } - if($('#isCleanedEntirely'+i).val() == '否' && unLoadedAmount > 0){ - var isThereIdentificationCard = $('#isThereIdentificationCard'+i).val(); - var tousseId = $('#tousseDefinitionID'+i).val(); - var idCardBarcodes = $('#barcodes'+i).val(); - if(isThereIdentificationCard == '是'){ - var idCardUnLoadedAmount = 0; - if(!isUndefinedOrNullOrEmpty(idCardBarcodes)){ - var jsonArray = JSON.parse(idCardBarcodes); - for(var j = 0;j < jsonArray.length;j++){ - if(jsonArray[j].addSuccess == false){ - addJsonItem(result,tousseId,1,'是',jsonArray[j].barcode); - idCardUnLoadedAmount++; - } - } - } - var recyclingErrorJsonArrayStr = $('#recyclingError' + i).val(); - if(!isUndefinedOrNullOrEmpty(recyclingErrorJsonArrayStr)){ - var recyclingErrorJsonArray = JSON.parse(recyclingErrorJsonArrayStr); - for(var j = 0;j < recyclingErrorJsonArray.length;j++) { - if(recyclingErrorJsonArray[j].materialName == '器械包标识牌'){ - var errorAmount = parseInt(recyclingErrorJsonArray[j].amount); - var intoBasketAmount = parseInt(recyclingErrorJsonArray[j].intoBasketAmount); - if(errorAmount - intoBasketAmount > 0){ - addJsonItem(result,tousseId,errorAmount - intoBasketAmount,'是',''); - } - break; - } - } - } - }else{ - addJsonItem(result,tousseId,unLoadedAmount,'否',''); - } - } - }); + if ($('#isCleanedEntirely' + i).val() == '否' && unLoadedAmount > 0) { + var isThereIdentificationCard = $('#isThereIdentificationCard' + i).val(); + var tousseId = $('#tousseDefinitionID' + i).val(); + var idCardBarcodes = $('#barcodes' + i).val(); + if (isThereIdentificationCard == '是') { + var idCardUnLoadedAmount = 0; + if (!isUndefinedOrNullOrEmpty(idCardBarcodes)) { + var jsonArray = JSON.parse(idCardBarcodes); + for (var j = 0; j < jsonArray.length; j++) { + if (jsonArray[j].addSuccess == false) { + addJsonItem(result, tousseId, 1, '是', jsonArray[j].barcode); + idCardUnLoadedAmount++; + } + } + } + var recyclingErrorJsonArrayStr = $('#recyclingError' + i).val(); + if (!isUndefinedOrNullOrEmpty(recyclingErrorJsonArrayStr)) { + var recyclingErrorJsonArray = JSON.parse(recyclingErrorJsonArrayStr); + for (var j = 0; j < recyclingErrorJsonArray.length; j++) { + if (recyclingErrorJsonArray[j].materialName == '器械包标识牌') { + var errorAmount = parseInt(recyclingErrorJsonArray[j].amount); + var intoBasketAmount = parseInt(recyclingErrorJsonArray[j].intoBasketAmount); + if (errorAmount - intoBasketAmount > 0) { + addJsonItem(result, tousseId, errorAmount - intoBasketAmount, '是', ''); + } + break; + } + } + } + } else { + addJsonItem(result, tousseId, unLoadedAmount, '否', ''); + } + } + }); return JSON.stringify(result); } // 转换为json -function addJsonItem(result,tousseId,unLoadedAmount,isIdCard,idCardBarcode){ +function addJsonItem(result, tousseId, unLoadedAmount, isIdCard, idCardBarcode) { var obj = {}; - obj.tousseId = tousseId; - obj.recycleAmount = unLoadedAmount; - obj.isThereIdentificationCard = isIdCard; - obj.idCardBarcode = idCardBarcode; - var len = result.length; - result[len] = obj; + obj.tousseId = tousseId; + obj.recycleAmount = unLoadedAmount; + obj.isThereIdentificationCard = isIdCard; + obj.idCardBarcode = idCardBarcode; + var len = result.length; + result[len] = obj; } // 获取篮筐数据 -function getTousseIntoBasketInfo(){ +function getTousseIntoBasketInfo() { tousseIntoBasketInfo.clear(); - $("#basketsUl li").each(function(){ + $("#basketsUl li").each(function () { var hide = $(this).find('input:first'); - var basketItem = JSON.parse(hide.val()); - - $(this).find('dl').children().each(function(i,element){ - if($(this).attr('type') == 'hidden'){ - var obj = $(this).val(); - var tousseItem = JSON.parse(obj); - tousseIntoBasketInfo.addTousseBasket(tousseItem,basketItem); - } - }); + var basketItem = JSON.parse(hide.val()); + + $(this).find('dl').children().each(function (i, element) { + if ($(this).attr('type') == 'hidden') { + var obj = $(this).val(); + var tousseItem = JSON.parse(obj); + tousseIntoBasketInfo.addTousseBasket(tousseItem, basketItem); + } + }); }); return tousseIntoBasketInfo.getResult(); } // 打开自定义入筐 -function openCustomIntoBasketPage(){ +function openCustomIntoBasketPage() { var data = getUnCleanedEntirelyTousseInfo(); var tousseIntoBasketInfo = JSON.stringify(getTousseIntoBasketInfo()); - if(data != "[]"){ - var url = WWWROOT+'/disinfectsystem/touchScreen/recycle/customIntoBasket.jsp?data='+data+'&resolution=1980' - + '&tousseIntoBasketInfo=' + tousseIntoBasketInfo + '&recyclingApplicationId=' + $('#recyclingApplicationId').val() - var style='menubar=no,location=no,directories=no,toolbar=no,statusbar=no,resizable=yes,top=100,left=100,width=1400,height=800,scrollbars=null'; - var popwin=openFullSizeWindowWithName(url,true,'自定义入框'); - }else{ + if (data != "[]") { + var url = WWWROOT + '/disinfectsystem/touchScreen/recycle/customIntoBasket.jsp?data=' + data + '&resolution=1980' + + '&tousseIntoBasketInfo=' + tousseIntoBasketInfo + '&recyclingApplicationId=' + $('#recyclingApplicationId').val() + var style = 'menubar=no,location=no,directories=no,toolbar=no,statusbar=no,resizable=yes,top=100,left=100,width=1400,height=800,scrollbars=null'; + var popwin = openFullSizeWindowWithName(url, true, '自定义入框'); + } else { alertDiv("没有符合条件待装载的物品!"); } } // 打开添加器械包的窗口 -function openSelectTousse(tousseName){ +function openSelectTousse(tousseName) { var tousseType = $('#appType').val(); - if(tousseType == TYPE_FOREIGNTOUSSEAPPLIACTION){ + if (tousseType == TYPE_FOREIGNTOUSSEAPPLIACTION) { alertDiv("外来器械回收单不能添加器械包!"); return false; } - if(tousseType == "质量监测回收申请单"){ + if (tousseType == "质量监测回收申请单") { alertDiv("质量监测回收申请单不允许添加新的物品,只能回收申请单中的物品!"); return false; } - if(tousseType == "申请还物单"){ + if (tousseType == "申请还物单") { alertDiv("申请还物单不允许添加新的物品,只能回收申请单中的物品!"); return false; } //是否开启限制使用记录转换的申请单不能添加别的物品 - if(sstsConfig.restrictAddOtherGoodsToApplicationFromUseRecord && $('#useRecordId').val() != ''){ + if (sstsConfig.restrictAddOtherGoodsToApplicationFromUseRecord && $('#useRecordId').val() != '') { alertDiv("使用记录转换的申请单不能添加器械包"); return false; } - if(!checkSelectDepartBeforeAddTousse()){ + if (!checkSelectDepartBeforeAddTousse()) { return false; } - if(!tousseName){ + if (!tousseName) { tousseName = ''; } - + var width = 780; var height = 650; var designedTousseWidth = 1080; @@ -5268,39 +5268,39 @@ var offsetTop = 100; var offsetLeft = ''; var heightExtra = 10; - if(resolution == '1980'){ + if (resolution == '1980') { width = 1380; height = 830; } - var zoomRatio = calculateZoomRatio(designedWidth,designedHeight,actualWidth,actualHeight); - var size = calculateSizeAfterZoom(designedTousseWidth,designedTousseHeight,zoomRatio); + var zoomRatio = calculateZoomRatio(designedWidth, designedHeight, actualWidth, actualHeight); + var size = calculateSizeAfterZoom(designedTousseWidth, designedTousseHeight, zoomRatio); - if(isIE()){ + if (isIE()) { width = size.width; height = size.height; - offsetTop = offsetTop*zoomRatio+'px'; - }else { + offsetTop = offsetTop * zoomRatio + 'px'; + } else { width = designedTousseWidth; height = designedTousseHeight; - offsetTop = offsetTop*zoomRatio+'px'; - offsetLeft = ((parseInt(size.width/zoomRatio))/2)+'px'; + offsetTop = offsetTop * zoomRatio + 'px'; + offsetLeft = ((parseInt(size.width / zoomRatio)) / 2) + 'px'; } - + var appCode = $('#departCode').val(); - layerIndex=layer.open({ - type : 2, - title : ['添加器械包',true], - content : 'addTousse.jsp?resolution='+resolution+'&width='+width+'&height='+height+'&tousseName='+encodeURIComponent(tousseName)+'&appCode='+appCode+'&tousseType='+encodeURIComponent(tousseType), - area : [ width + 'px' , height +heightExtra+ 'px'], - border : [5, 0.3, '#fff', true], - closeBtn : [2 , true], - offset : [offsetTop,offsetLeft] - }); + layerIndex = layer.open({ + type: 2, + title: ['添加器械包', true], + content: 'addTousse.jsp?resolution=' + resolution + '&width=' + width + '&height=' + height + '&tousseName=' + encodeURIComponent(tousseName) + '&appCode=' + appCode + '&tousseType=' + encodeURIComponent(tousseType), + area: [width + 'px', height + heightExtra + 'px'], + border: [5, 0.3, '#fff', true], + closeBtn: [2, true], + offset: [offsetTop, offsetLeft] + }); } // 打开输入备注的窗口 -function openInputRemark(){ - if(!sstsConfig.modifyRemarkInRecycling){ +function openInputRemark() { + if (!sstsConfig.modifyRemarkInRecycling) { return; } var width = 980; @@ -5313,44 +5313,44 @@ var offsetLeft = ''; var htmlHeight = $('html').height(); var htmlWidth = $('html').width(); - var body_height = parseInt(htmlHeight/getZoom(1920,1080)); - var body_width = parseInt(htmlWidth/getZoom(1920,1080)); + var body_height = parseInt(htmlHeight / getZoom(1920, 1080)); + var body_width = parseInt(htmlWidth / getZoom(1920, 1080)); - var zoomRatio = calculateZoomRatio(designedWidth,designedHeight,actualWidth,actualHeight); - var size = calculateSizeAfterZoom(width,height,zoomRatio); + var zoomRatio = calculateZoomRatio(designedWidth, designedHeight, actualWidth, actualHeight); + var size = calculateSizeAfterZoom(width, height, zoomRatio); - if(isIE()){ + if (isIE()) { width = size.width; height = size.height; - offsetTop = offsetTop*zoomRatio+'px'; - }else { - offsetTop = ((body_height-height)/2)+'px'; - offsetLeft = ((body_width-width)/2)+'px'; + offsetTop = offsetTop * zoomRatio + 'px'; + } else { + offsetTop = ((body_height - height) / 2) + 'px'; + offsetLeft = ((body_width - width) / 2) + 'px'; } var heightExtra = 10; - - layerIndex=layer.open({ - type : 2, - title : ['输入备注',true], - content : 'inputRemark.jsp?resolution='+resolution+'&remark=' + encodeURIComponent($('#remarkText').text()), - area : [ width + 'px' , height +heightExtra+ 'px'], - border : [5, 0.3, '#fff', true], - closeBtn : [2 , true], - offset : [offsetTop,offsetLeft] - }); + + layerIndex = layer.open({ + type: 2, + title: ['输入备注', true], + content: 'inputRemark.jsp?resolution=' + resolution + '&remark=' + encodeURIComponent($('#remarkText').text()), + area: [width + 'px', height + heightExtra + 'px'], + border: [5, 0.3, '#fff', true], + closeBtn: [2, true], + offset: [offsetTop, offsetLeft] + }); } // 设置申请单备注 -function setRemark(remark){ - if(isUndefinedOrNullOrEmpty(remark)){ +function setRemark(remark) { + if (isUndefinedOrNullOrEmpty(remark)) { remark = ""; } $('#remarkText').text(remark); } // 打开添加质量监测记录的窗口 -function addQM(){ +function addQM() { var width = 780; var height = 650; var designedTousseWidth = 1080; @@ -5362,114 +5362,114 @@ var offsetTop = 100; var offsetLeft = ''; var heightExtra = 10; - if(resolution == '1980'){ + if (resolution == '1980') { width = 1380; height = 830; } - var zoomRatio = calculateZoomRatio(designedWidth,designedHeight,actualWidth,actualHeight); - var size = calculateSizeAfterZoom(designedTousseWidth,designedTousseHeight,zoomRatio); + var zoomRatio = calculateZoomRatio(designedWidth, designedHeight, actualWidth, actualHeight); + var size = calculateSizeAfterZoom(designedTousseWidth, designedTousseHeight, zoomRatio); - if(isIE()){ + if (isIE()) { width = size.width; height = size.height; - offsetTop = offsetTop*zoomRatio+'px'; - }else { + offsetTop = offsetTop * zoomRatio + 'px'; + } else { width = designedTousseWidth; height = designedTousseHeight; - offsetTop = offsetTop*zoomRatio+'px'; - offsetLeft = ((parseInt(size.width/zoomRatio))/2)+'px'; + offsetTop = offsetTop * zoomRatio + 'px'; + offsetLeft = ((parseInt(size.width / zoomRatio)) / 2) + 'px'; } - - qmLayerIndex=layer.open({ - type : 2, - title : ['添加质量监测记录',true], - content : 'addQualityMonitoring.jsp?resolution='+resolution+'&width='+width+'&height='+height, - area : [ width + 'px' , height +heightExtra+ 'px'], - border : [5, 0.3, '#fff', true], - closeBtn : [2 , true], - offset : [offsetTop,offsetLeft] - }); + + qmLayerIndex = layer.open({ + type: 2, + title: ['添加质量监测记录', true], + content: 'addQualityMonitoring.jsp?resolution=' + resolution + '&width=' + width + '&height=' + height, + area: [width + 'px', height + heightExtra + 'px'], + border: [5, 0.3, '#fff', true], + closeBtn: [2, true], + offset: [offsetTop, offsetLeft] + }); } // 自定义入筐保存 -function customIntoBasketFun(data){ - if(data != null){ - for(var j = 0;j < data.length;j++){ +function customIntoBasketFun(data) { + if (data != null) { + for (var j = 0; j < data.length; j++) { var materials = data[j].materials; var tousseName = data[j].tousseName; var recycleAmount = data[j].recycleAmount; var tousseDefinitionID = data[j].tousseDefinitionID; var tousseType = data[j].tousseType; var tousseIdCardBarcode = data[j].idCardBarcode; var basketGroupBarcodeArray = new Array(); - for(var i = 0;i < materials.length;i++){ - var item = materials[i]; - var sigle = true; - var b_len = basketGroupBarcodeArray.length; - for(var n = 0;n < b_len;n++){ - if(basketGroupBarcodeArray[n] == item.basketBarcode){ - sigle = false; - } - } - if(sigle){ - basketGroupBarcodeArray[b_len] = item.basketBarcode; - //添加篮筐 + for (var i = 0; i < materials.length; i++) { + var item = materials[i]; + var sigle = true; + var b_len = basketGroupBarcodeArray.length; + for (var n = 0; n < b_len; n++) { + if (basketGroupBarcodeArray[n] == item.basketBarcode) { + sigle = false; + } + } + if (sigle) { + basketGroupBarcodeArray[b_len] = item.basketBarcode; + //添加篮筐 var isBasketLoaded = false; - $("#basketsUl li").each(function(){ - var hide = $(this).find('input'); - var oldItem = JSON.parse(hide.val()); - if(oldItem.barcode == item.basketBarcode){ - refreshSequence($(this),item.sequence); - isBasketLoaded = true; - return false; - } - }); - - if(!isBasketLoaded){ - createBasketUiElement(item.basketBarcode,item.basketId,item.containerName,item.washClassifyType,item.sequence,false,item.sumCount); - $("#scanContainerBarcodeTipUl").hide(); - } - } - } - basketGroupBarcodeArray.sort(); - var orgUnitName = $('#depart').text(); - for(var i = 0;i < materials.length;i++){ + $("#basketsUl li").each(function () { + var hide = $(this).find('input'); + var oldItem = JSON.parse(hide.val()); + if (oldItem.barcode == item.basketBarcode) { + refreshSequence($(this), item.sequence); + isBasketLoaded = true; + return false; + } + }); + + if (!isBasketLoaded) { + createBasketUiElement(item.basketBarcode, item.basketId, item.containerName, item.washClassifyType, item.sequence, false, item.sumCount); + $("#scanContainerBarcodeTipUl").hide(); + } + } + } + basketGroupBarcodeArray.sort(); + var orgUnitName = $('#depart').text(); + for (var i = 0; i < materials.length; i++) { var item = materials[i]; var basketItem = { - ci_id: "", - type: '材料', - orgUnitName: orgUnitName, - tousseName: tousseName, - tousseDefinitionID: tousseDefinitionID, - lastTousseInstanceId:"", //包实例id - tousseInstanceBarcode:"", - tousseType: tousseType, - materialName: item.materialName, - showName: item.materialName, - amount: item.materialAmount, - tousseAmount: item.tousseAmountForMaterial, - basketBarcode: item.basketBarcode, - basketId:item.basketId, - idCardBarcode: item.idCardBarcode, - washClassifyType:item.washClassifyType, - putBasketMaxAmount:item.putBasketMaxAmount, - basketGroupBarcodes:basketGroupBarcodeArray.join(";") - }; + ci_id: "", + type: '材料', + orgUnitName: orgUnitName, + tousseName: tousseName, + tousseDefinitionID: tousseDefinitionID, + lastTousseInstanceId: "", //包实例id + tousseInstanceBarcode: "", + tousseType: tousseType, + materialName: item.materialName, + showName: item.materialName, + amount: item.materialAmount, + tousseAmount: item.tousseAmountForMaterial, + basketBarcode: item.basketBarcode, + basketId: item.basketId, + idCardBarcode: item.idCardBarcode, + washClassifyType: item.washClassifyType, + putBasketMaxAmount: item.putBasketMaxAmount, + basketGroupBarcodes: basketGroupBarcodeArray.join(";") + }; addBasketItemElement(basketItem); } - - $('#tousseItemTable').children().first().children().each(function(i,element){ - if($('#tousseDefinitionID'+i).val() == tousseDefinitionID){ - $('#loadedAmount'+i).val(parseInt(recycleAmount,10)+parseInt($('#loadedAmount'+i).val(),10)); - - var idCard = $('#isThereIdentificationCard'+i).val(); - if(idCard == '是' && tousseIdCardBarcode == ''){ - setIdCardErrorIntoBasketAmount(i,recycleAmount); - } - setTousseItemLoadedAmountCss(i); - return false; - } - }); + + $('#tousseItemTable').children().first().children().each(function (i, element) { + if ($('#tousseDefinitionID' + i).val() == tousseDefinitionID) { + $('#loadedAmount' + i).val(parseInt(recycleAmount, 10) + parseInt($('#loadedAmount' + i).val(), 10)); + + var idCard = $('#isThereIdentificationCard' + i).val(); + if (idCard == '是' && tousseIdCardBarcode == '') { + setIdCardErrorIntoBasketAmount(i, recycleAmount); + } + setTousseItemLoadedAmountCss(i); + return false; + } + }); } refreshAllBasketTotalNum(); refreshSplitBasketView(); @@ -5480,26 +5480,26 @@ * 点击选中回收人员或是清点人员 * @param currentElementId 当前被点中的元素的id */ -function selectUserType(currentElementId){ +function selectUserType(currentElementId) { currentUserType = currentElementId; - $("#" + currentElementId).css("background","#DDDDDD"); - if(currentElementId == userType_recycling){ - $("#operator").css("background","white"); - $("#departmentSender").css("background","white"); - }else if(currentElementId == userType_operator){ - $("#recyclingUser").css("background","white"); - $("#departmentSender").css("background","white"); - }else if(currentElementId == userType_departmentSender){ - $("#recyclingUser").css("background","white"); - $("#operator").css("background","white"); + $("#" + currentElementId).css("background", "#DDDDDD"); + if (currentElementId == userType_recycling) { + $("#operator").css("background", "white"); + $("#departmentSender").css("background", "white"); + } else if (currentElementId == userType_operator) { + $("#recyclingUser").css("background", "white"); + $("#departmentSender").css("background", "white"); + } else if (currentElementId == userType_departmentSender) { + $("#recyclingUser").css("background", "white"); + $("#operator").css("background", "white"); } } // 打开选择沟通人的窗口 -function selectCommunicationUser(currentElementId){ - var width = 780; - var height = 650; - var designedTousseWidth = 1080; +function selectCommunicationUser(currentElementId) { + var width = 780; + var height = 650; + var designedTousseWidth = 1080; var designedTousseHeight = 830; var designedWidth = 1920; var designedHeight = 1080; @@ -5508,42 +5508,42 @@ var offsetTop = 100; var offsetLeft = ''; var heightExtra = 10; - if(resolution == '1980'){ - width = 1100; - height = 860; - } - var zoomRatio = calculateZoomRatio(designedWidth,designedHeight,actualWidth,actualHeight); - var size = calculateSizeAfterZoom(designedTousseWidth,designedTousseHeight,zoomRatio); + if (resolution == '1980') { + width = 1100; + height = 860; + } + var zoomRatio = calculateZoomRatio(designedWidth, designedHeight, actualWidth, actualHeight); + var size = calculateSizeAfterZoom(designedTousseWidth, designedTousseHeight, zoomRatio); - if(isIE()){ + if (isIE()) { width = size.width; height = size.height; - offsetTop = offsetTop*zoomRatio+'px'; - }else { + offsetTop = offsetTop * zoomRatio + 'px'; + } else { width = designedTousseWidth; height = designedTousseHeight; - offsetTop = offsetTop*zoomRatio+'px'; - offsetLeft = ((parseInt(size.width/zoomRatio))/2)+'px'; + offsetTop = offsetTop * zoomRatio + 'px'; + offsetLeft = ((parseInt(size.width / zoomRatio)) / 2) + 'px'; } - layerIndex=layer.open({ - type : 2, - title : ['选择沟通人',true], - content : 'selectUser.jsp?p=p&searchLoginUserDepart=false&resolution='+resolution+'&width='+width+'&height='+height, - area : [ width + 'px' , height +heightExtra+ 'px'], - border : [5, 0.3, '#fff', true], - closeBtn : [2 , true], - offset : [offsetTop,offsetLeft] - }); + layerIndex = layer.open({ + type: 2, + title: ['选择沟通人', true], + content: 'selectUser.jsp?p=p&searchLoginUserDepart=false&resolution=' + resolution + '&width=' + width + '&height=' + height, + area: [width + 'px', height + heightExtra + 'px'], + border: [5, 0.3, '#fff', true], + closeBtn: [2, true], + offset: [offsetTop, offsetLeft] + }); } // 选择沟通人 -function selectUser(userName,userFullName){ - if(isUndefinedOrNullOrEmpty(userName)){ +function selectUser(userName, userFullName) { + if (isUndefinedOrNullOrEmpty(userName)) { alertDiv('请选择沟通人'); return; } - if(isUndefinedOrNullOrEmpty(userFullName)){ + if (isUndefinedOrNullOrEmpty(userFullName)) { alertDiv('所选用户名不能为空'); return; } @@ -5554,59 +5554,59 @@ // 打开选择科室的窗口 var isSwitchingDepartments = true;//如果当前科室状态为 部分回收/待回收时,isSwitchingDepartments为false,不清空已经扫描过的篮筐和已经入筐的物品 var dialogWidth = dialogWidth; -var dialogHeight= dialogHeight; -function openSelectDepart(){ +var dialogHeight = dialogHeight; +function openSelectDepart() { var canChangeDepart = false; - if(isUndefinedOrNullOrEmpty(params_appId)){ + if (isUndefinedOrNullOrEmpty(params_appId)) { //添加的回收申请单,可以修改科室 canChangeDepart = true; - }else if(sstsConfig.canChangeDepartInRecyclingForwaitRecycleInvoicePlan){ + } else if (sstsConfig.canChangeDepartInRecyclingForwaitRecycleInvoicePlan) { canChangeDepart = true; } //如果是历史回收记录,不能修改科室 - if('history' == params_recordType){ + if ('history' == params_recordType) { canChangeDepart = false; - } - if(!canChangeDepart){ - //Annie - //如果是待回收单,并且状态为待回收或者部分回收,点击科室可加载整个科室已经绑定好的篮筐,并且点击科室之前扫描或已经入筐的物品不变 + } + if (!canChangeDepart) { + //Annie + //如果是待回收单,并且状态为待回收或者部分回收,点击科室可加载整个科室已经绑定好的篮筐,并且点击科室之前扫描或已经入筐的物品不变 var RecyclingStatus = $('#recyclingStatus').val(); - if(RecyclingStatus =="待回收"|| RecyclingStatus == "部分回收"){ - isSwitchingDepartments = false; - var department = $('#departCode').val(); - $("#dialogConfirm").dialog({ - resizable: false, - height:dialogHeight ? dialogHeight : 310, - width:dialogWidth ? dialogWidth : 600, - modal: true, - open: function() { - $("#confirmMsg").html('是否加载该科室绑定的清洗篮筐?'); - }, - close: function() { - $("#confirmMsg").html(""); - }, - buttons: { - "是": function() { - $( this ).dialog( "close" ); - loadWashBasketsByDepartCode(department); - return; - }, - "否": function() { - $( this ).dialog( "close" ); - return; + if (RecyclingStatus == "待回收" || RecyclingStatus == "部分回收") { + isSwitchingDepartments = false; + var department = $('#departCode').val(); + $("#dialogConfirm").dialog({ + resizable: false, + height: dialogHeight ? dialogHeight : 310, + width: dialogWidth ? dialogWidth : 600, + modal: true, + open: function () { + $("#confirmMsg").html('是否加载该科室绑定的清洗篮筐?'); + }, + close: function () { + $("#confirmMsg").html(""); + }, + buttons: { + "是": function () { + $(this).dialog("close"); + loadWashBasketsByDepartCode(department); + return; + }, + "否": function () { + $(this).dialog("close"); + return; - } - } - }); - return; - }else{ - //不可以修改科室,那就返回喽 - return; + } + } + }); + return; + } else { + //不可以修改科室,那就返回喽 + return; } } - var width = 780; - var height = 650; - var designedTousseWidth = 1080; + var width = 780; + var height = 650; + var designedTousseWidth = 1080; var designedTousseHeight = 830; var designedWidth = 1920; var designedHeight = 1080; @@ -5615,87 +5615,87 @@ var offsetTop = 100; var offsetLeft = ''; var heightExtra = 10; - if(resolution == '1980'){ - width = 1100; - height = 860; - } - var zoomRatio = calculateZoomRatio(designedWidth,designedHeight,actualWidth,actualHeight); - var size = calculateSizeAfterZoom(designedTousseWidth,designedTousseHeight,zoomRatio); + if (resolution == '1980') { + width = 1100; + height = 860; + } + var zoomRatio = calculateZoomRatio(designedWidth, designedHeight, actualWidth, actualHeight); + var size = calculateSizeAfterZoom(designedTousseWidth, designedTousseHeight, zoomRatio); - if(isIE()){ + if (isIE()) { width = size.width; height = size.height; - offsetTop = offsetTop*zoomRatio+'px'; - }else { + offsetTop = offsetTop * zoomRatio + 'px'; + } else { width = designedTousseWidth; height = designedTousseHeight; - offsetTop = offsetTop*zoomRatio+'px'; - offsetLeft = ((parseInt(size.width/zoomRatio))/2)+'px'; + offsetTop = offsetTop * zoomRatio + 'px'; + offsetLeft = ((parseInt(size.width / zoomRatio)) / 2) + 'px'; } - layerIndex=layer.open({ - type : 2, - title : ['选择科室',true], - content : 'addDepart.jsp?resolution='+resolution+'&width='+width+'&height='+height+"&showDisableOrgUnit=false", - area : [ width + 'px' , height +heightExtra+ 'px'], - border : [5, 0.3, '#fff', true], - closeBtn : [2 , true], - offset : [offsetTop,offsetLeft] - }); + layerIndex = layer.open({ + type: 2, + title: ['选择科室', true], + content: 'addDepart.jsp?resolution=' + resolution + '&width=' + width + '&height=' + height + "&showDisableOrgUnit=false", + area: [width + 'px', height + heightExtra + 'px'], + border: [5, 0.3, '#fff', true], + closeBtn: [2, true], + offset: [offsetTop, offsetLeft] + }); } // 在清空器械包之前,要选删除篮筐 -function emptyTousseItemTable(){ +function emptyTousseItemTable() { $("#tousseItemTable").empty(); $("#basketsUl").empty(); tousseArray = []; } // 判断是否可以清空器械包列表。如果有丢失报损,需要先删除才能清空。需要先提醒用户做删除操作 -function canEmptyTousseItemTable(){ +function canEmptyTousseItemTable() { var canEmpty = true; - $("#tousseItemTable > tbody > tr").each(function(row) { - var style = $(this).attr("style"); - if (style != 'display: none;'){ - var message = checkHaveErrorDamage(row); - if(!isUndefinedOrNullOrEmpty(message)){ - canEmpty = false; - return false; - } - } + $("#tousseItemTable > tbody > tr").each(function (row) { + var style = $(this).attr("style"); + if (style != 'display: none;') { + var message = checkHaveErrorDamage(row); + if (!isUndefinedOrNullOrEmpty(message)) { + canEmpty = false; + return false; + } + } }); return canEmpty; } // 加载选择模板下拉框的数据 -function loadTemplateSelectData(){ - if(sstsConfig.isOpenLoadTemplateByUnit){ +function loadTemplateSelectData() { + if (sstsConfig.isOpenLoadTemplateByUnit) { var appType = $("#appType").val(); - if(appType == ""){//为空代表是回收申请单 + if (appType == "") {//为空代表是回收申请单 $('.departmentTemplate').show(); var departCode2 = $("#departCode").val(); var depart2 = $("#depart").text(); - if(depart2 !="" ){ + if (depart2 != "") { $.ajax({ - type:'get', - url : WWWROOT + '/disinfectSystem/baseData/departmentAppTemplateAction!loadDepartmentTemplateTitle.do', - data:{ - departmentCode:departCode2, - type:"回收申请单" + type: 'get', + url: WWWROOT + '/disinfectSystem/baseData/departmentAppTemplateAction!loadDepartmentTemplateTitle.do', + data: { + departmentCode: departCode2, + type: "回收申请单" }, - success:function(result){ + success: function (result) { var result = JSON.parse(result); - if(result.success){ + if (result.success) { $('#departmentTemplate').html(""); - for(var i = 0;i < result.data.length;i++){ + for (var i = 0; i < result.data.length; i++) { var str = ""; - str += ""; + str += ""; $('#departmentTemplate').append(str); } - + } }, - error:function(msg){ + error: function (msg) { } }); } @@ -5704,196 +5704,196 @@ } // 根据科室编码加载该科室绑定的清洗篮筐 -function loadWashBasketsByDepartCode(departCode){ - $.ajax({ - type:'get', - url: WWWROOT + '/disinfectSystem/baseData/containerAction!getWashContainerByBindDepartCode.do', - data:'bindDepartCode=' +departCode, - dataType:'json', - success:function(result){ - if(result != ''){ - $('#scanContainerBarcodeTipUl').hide(); - if(isSwitchingDepartments){ - $("#basketsUl").empty(); +function loadWashBasketsByDepartCode(departCode) { + $.ajax({ + type: 'get', + url: WWWROOT + '/disinfectSystem/baseData/containerAction!getWashContainerByBindDepartCode.do', + data: 'bindDepartCode=' + departCode, + dataType: 'json', + success: function (result) { + if (result != '') { + $('#scanContainerBarcodeTipUl').hide(); + if (isSwitchingDepartments) { + $("#basketsUl").empty(); } - - for (var i =0 ;i < result.length; i++){ - departBindingBasketBarcodes.push(result[i].barcode); - } - - if (departBindingBasketBarcodes.length > 0){ - loadBarcodeDevice(departBindingBasketBarcodes[0],false); - } - - }else{ - if(isSwitchingDepartments && $("#loadingPutBasket > li").length == 0){ - $("#basketsUl").empty(); - $('#scanContainerBarcodeTipUl').show(); - } - } - } - }) + for (var i = 0; i < result.length; i++) { + departBindingBasketBarcodes.push(result[i].barcode); + } + + if (departBindingBasketBarcodes.length > 0) { + loadBarcodeDevice(departBindingBasketBarcodes[0], false); + } + + } else { + if (isSwitchingDepartments && $("#loadingPutBasket > li").length == 0) { + $("#basketsUl").empty(); + $('#scanContainerBarcodeTipUl').show(); + } + + } + } + }) } // 切换科室 -function selectDepart(departName,departCode){ +function selectDepart(departName, departCode) { var tousseNameArr = []; - - if(shareDepartsMap.size() > 0){ + + if (shareDepartsMap.size() > 0) { var k = 0; - shareDepartsMap.forEach(function(arr,item){ - if(arr.indexOf(departName) == -1){ + shareDepartsMap.forEach(function (arr, item) { + if (arr.indexOf(departName) == -1) { tousseNameArr[k] = item; k++; } }) } - if(shareDepartsArr.length > 0) { + if (shareDepartsArr.length > 0) { var k = 0; - for(var i=0;i 0){ - var msg = '以下物品不属于【'+departName+'】,不允许进行科室切换:
    '; + if (tousseNameArr.length > 0) { + var msg = '以下物品不属于【' + departName + '】,不允许进行科室切换:
    '; msg += '【' + tousseNameArr.join(',') + '】'; alertDiv(msg); return; } var oldValue = document.getElementById('departCode').value; - //加载科室申领模板 - if(params_id == '' && params_appId == '' && sstsConfig.isLoadApplyTemplateForAddRecycleRecord == true){ - if(oldValue != departCode){ - if(!canEmptyTousseItemTable()){ - alertDiv('器械包有登记丢失报损信息,请先删除后再操作!'); - return false; - } - var processFun = function(){ - $.ajax({ - type:'get', - url:WWWROOT + '/disinfectSystem/recyclingRecordAction!loadDepartmentAppTemplateForRecycle.do', - data:'orgUnitCoding=' + encodeURI(departCode), - dataType:'json', - success:function(dataArray){ + //加载科室申领模板 + if (params_id == '' && params_appId == '' && sstsConfig.isLoadApplyTemplateForAddRecycleRecord == true) { + if (oldValue != departCode) { + if (!canEmptyTousseItemTable()) { + alertDiv('器械包有登记丢失报损信息,请先删除后再操作!'); + return false; + } + var processFun = function () { + $.ajax({ + type: 'get', + url: WWWROOT + '/disinfectSystem/recyclingRecordAction!loadDepartmentAppTemplateForRecycle.do', + data: 'orgUnitCoding=' + encodeURI(departCode), + dataType: 'json', + success: function (dataArray) { var departmentSenderHidden = $("#departmentSenderHidden").val(); - if(sstsConfig.showSelfTransportorInRecycleForm && departmentSenderHidden != ""){ + if (sstsConfig.showSelfTransportorInRecycleForm && departmentSenderHidden != "") { var departmentSenderHiddendData = JSON.parse(departmentSenderHidden); var flag = false; for (var m in departmentSenderHiddendData) { - if (departmentSenderHiddendData[m].orgUnitNameCode == departCode) { + if (departmentSenderHiddendData[m].orgUnitNameCode == departCode) { document.getElementById('depart').innerText = departmentSenderHiddendData[m].orgUnitName; document.getElementById('departCode').value = departmentSenderHiddendData[m].orgUnitNameCode; flag = true; break; - } + } } - - if(!flag){ + + if (!flag) { //清空科室 - alertDiv('科室自送人与申请科室不一致!'); + alertDiv('科室自送人与申请科室不一致!'); document.getElementById('depart').innerText = ""; document.getElementById('departCode').value = ""; } - - }else{ + + } else { document.getElementById('depart').innerText = departName; document.getElementById('departCode').value = departCode; - } - + } + loadTemplateSelectData(); - emptyTousseItemTable(); -// $("#tousseItemTable").empty(); - if(dataArray.length > 0){ - for(var i = (dataArray.length -1) ; i >= 0; i--){ - var timeStr = new Date().getTime(); - var errorDamageQmKey = dataArray[i].tousseDefinitionID + "_" + timeStr; - var toussItem = { - row: i, - tousseItemId: '', - tousseName: dataArray[i].tousseName, - tousseDefinitionID: dataArray[i].tousseDefinitionID, - applicationAmount: 0, - recycleAmount: 0, - loadedAmount: 0, - isCleanedEntirely: dataArray[i].isCleanedEntirely, - tousseType: dataArray[i].tousseType, - isThereIdentificationCard: dataArray[i].isThereIdentificationCard, - isApplyEntireTousse: dataArray[i].isApplyEntireTousse, - urgentAmount : 0, - tousseRemark : '', - errorDamageQmKey : errorDamageQmKey, - spelling : dataArray[i].spelling - }; - addToussItem(toussItem,false); - } - } + emptyTousseItemTable(); + // $("#tousseItemTable").empty(); + if (dataArray.length > 0) { + for (var i = (dataArray.length - 1); i >= 0; i--) { + var timeStr = new Date().getTime(); + var errorDamageQmKey = dataArray[i].tousseDefinitionID + "_" + timeStr; + var toussItem = { + row: i, + tousseItemId: '', + tousseName: dataArray[i].tousseName, + tousseDefinitionID: dataArray[i].tousseDefinitionID, + applicationAmount: 0, + recycleAmount: 0, + loadedAmount: 0, + isCleanedEntirely: dataArray[i].isCleanedEntirely, + tousseType: dataArray[i].tousseType, + isThereIdentificationCard: dataArray[i].isThereIdentificationCard, + isApplyEntireTousse: dataArray[i].isApplyEntireTousse, + urgentAmount: 0, + tousseRemark: '', + errorDamageQmKey: errorDamageQmKey, + spelling: dataArray[i].spelling + }; + addToussItem(toussItem, false); + } + } loadWashBasketsByDepartCode(departCode); - if(basketsStr !== ''){ + if (basketsStr !== '') { getBasketsCode(true); } - } - }); - } - if(isTousseItemTableEmpty()){ - processFun(); - }else{ - dialogConfirm('切换科室将删除所有器械包,是否继续',processFun); - closeLayer(); - } - } - }else{ - document.getElementById('depart').innerText = departName; - document.getElementById('departCode').value = departCode; - } + } + }); + } + if (isTousseItemTableEmpty()) { + processFun(); + } else { + dialogConfirm('切换科室将删除所有器械包,是否继续', processFun); + closeLayer(); + } + } + } else { + document.getElementById('depart').innerText = departName; + document.getElementById('departCode').value = departCode; + } } //按字母过滤 -function btnBoxKey(boxkey){ - var patt1=new RegExp(boxkey,'gi'); - $('#tousseItemTable').children().first().children().each(function(i,element){ - var spelling = $('#spelling'+i).val(); - if(!(patt1.test(spelling) || spelling.indexOf(boxkey) >= 0) ){ - $('#tousseItemsTr'+i).addClass('tousseActive'); - }else{ - $('#tousseItemsTr'+i).removeClass('tousseActive'); +function btnBoxKey(boxkey) { + var patt1 = new RegExp(boxkey, 'gi'); + $('#tousseItemTable').children().first().children().each(function (i, element) { + var spelling = $('#spelling' + i).val(); + if (!(patt1.test(spelling) || spelling.indexOf(boxkey) >= 0)) { + $('#tousseItemsTr' + i).addClass('tousseActive'); + } else { + $('#tousseItemsTr' + i).removeClass('tousseActive'); } - if(boxkey == '全部'){ - $('#tousseItemsTr'+i).removeClass('tousseActive'); + if (boxkey == '全部') { + $('#tousseItemsTr' + i).removeClass('tousseActive'); } }) } //获取丢失报损的记录 -function findMaterialErrorDamageByTousseBarcode(tousseBarcodes,recyclingRecordId){ +function findMaterialErrorDamageByTousseBarcode(tousseBarcodes, recyclingRecordId) { var data = {}; - if(!isUndefinedOrNullOrEmpty(tousseBarcodes)){ + if (!isUndefinedOrNullOrEmpty(tousseBarcodes)) { data = { - tousseBarcodes:tousseBarcodes + tousseBarcodes: tousseBarcodes } - }else if(!isUndefinedOrNullOrEmpty(recyclingRecordId)){ + } else if (!isUndefinedOrNullOrEmpty(recyclingRecordId)) { data = { - recyclingRecordId:recyclingRecordId + recyclingRecordId: recyclingRecordId } - }else { + } else { return } $.ajax({ - type:'post', - url:WWWROOT + '/disinfectSystem/recyclingRecordAction!findMaterialErrorDamageByTousseBarcode.do', - data:data, - dataType:'json', - success:function(result){ - for(var i = 0 ; i < result.length ; i++){ + type: 'post', + url: WWWROOT + '/disinfectSystem/recyclingRecordAction!findMaterialErrorDamageByTousseBarcode.do', + data: data, + dataType: 'json', + success: function (result) { + for (var i = 0; i < result.length; i++) { var item = result[i]; - $('#tousseItemTable').children().first().children().each(function(j,element){ - if($('#tousseDefinitionID' + j).val() == item.tousseDefinitionId){ - loadUnSupplementMaterial(item,j,item.tousseBarcode); + $('#tousseItemTable').children().first().children().each(function (j, element) { + if ($('#tousseDefinitionID' + j).val() == item.tousseDefinitionId) { + loadUnSupplementMaterial(item, j, item.tousseBarcode); } }); } @@ -5902,116 +5902,116 @@ } // 页面初始加载 -function loadItem(){ +function loadItem() { //是否开启“一键入筐”的功能 - if(sstsConfig.recycleAllTousseIntoBasket){ + if (sstsConfig.recycleAllTousseIntoBasket) { var divElement = document.getElementById('divElement'); divElement.innerHTML = ''; } - + selectUserType(currentUserType); document.onkeydown = showKeyDown; - var recyclingApplicationId = params_appId; - var barcode = params_barcode; + var recyclingApplicationId = params_appId; + var barcode = params_barcode; var recyclingStatus = null; - if(!isUndefinedOrNullOrEmpty(recyclingApplicationId)){ - DWREngine.setAsync(false); - RecyclingApplicationTableManager.getRecyclingApplicationForRecycle(recyclingApplicationId,function(application){ - if(application == null) - return; - recyclingStatus = application.recyclingStatus; - if(application.useRecordId != null){ - $("#useRecordId").val(application.useRecordId); + if (!isUndefinedOrNullOrEmpty(recyclingApplicationId)) { + DWREngine.setAsync(false); + RecyclingApplicationTableManager.getRecyclingApplicationForRecycle(recyclingApplicationId, function (application) { + if (application == null) + return; + recyclingStatus = application.recyclingStatus; + if (application.useRecordId != null) { + $("#useRecordId").val(application.useRecordId); } - if(application.recyclingRecordId != null && application.type !== TYPE_FOREIGNTOUSSEAPPLIACTION){ + if (application.recyclingRecordId != null && application.type !== TYPE_FOREIGNTOUSSEAPPLIACTION) { loadRecyclingRecordById(application.recyclingRecordId); findMaterialErrorDamageByTousseBarcode(application.tousseBarcodes); $("#recyclingStatus").val(application.recyclingStatus); //如果回收数量为0不显示 - if(sstsConfig.hideZeroPrerecycleAmountTousseItem && application.isPrepareRecycled === 1){ + if (sstsConfig.hideZeroPrerecycleAmountTousseItem && application.isPrepareRecycled === 1) { //配置为预回收为0的物品不显示,相当于删除,但是需要是没有丢失报损的 var rows = $("#tousseItemTable > tbody > tr").length; - for(var index = 0; index < rows;++index){ + for (var index = 0; index < rows; ++index) { var message = checkHaveErrorDamage(index); - if(isUndefinedOrNullOrEmpty(message)){ + if (isUndefinedOrNullOrEmpty(message)) { var recycleAmountStr = $("#recycleAmount" + index).val(); var recycleAmount = parseInt(recycleAmountStr); - if(recycleAmount==0){ + if (recycleAmount == 0) { deleteTousseItem(index); } } } } - }else if(application.recyclingRecordId != null && application.type == TYPE_FOREIGNTOUSSEAPPLIACTION && application.recyclingStatus == "部分接收"){ + } else if (application.recyclingRecordId != null && application.type == TYPE_FOREIGNTOUSSEAPPLIACTION && application.recyclingStatus == "部分接收") { loadRecyclingRecordById(application.recyclingRecordId); findMaterialErrorDamageByTousseBarcode(application.tousseBarcodes); $("#recyclingStatus").val(application.recyclingStatus); //如果回收数量为0不显示 - if(sstsConfig.hideZeroPrerecycleAmountTousseItem && application.isPrepareRecycled === 1){ + if (sstsConfig.hideZeroPrerecycleAmountTousseItem && application.isPrepareRecycled === 1) { //配置为预回收为0的物品不显示,相当于删除,但是需要是没有丢失报损的 var rows = $("#tousseItemTable > tbody > tr").length; - for(var index = 0; index < rows;++index){ + for (var index = 0; index < rows; ++index) { var message = checkHaveErrorDamage(index); - if(isUndefinedOrNullOrEmpty(message)){ + if (isUndefinedOrNullOrEmpty(message)) { var recycleAmountStr = $("#recycleAmount" + index).val(); var recycleAmount = parseInt(recycleAmountStr); - if(recycleAmount==0){ + if (recycleAmount == 0) { deleteTousseItem(index); } } } } - }else{ - if (sstsConfig.showSettleAccountsDepartInRecycling){ - $("#depart").text(application.settleAccountsDepart); - $("#departCode").val(application.settleAccountsDepartCoding); - $("#recyclingStatus").val(application.recyclingStatus); - }else{ - $("#depart").text(application.depart); - $("#departCode").val(application.departCoding); - $("#recyclingStatus").val(application.recyclingStatus); - } - $("#invoicePlanVersion").val(application.version); - $("#appType").val(application.type); - $("#applyTime").val(application.submitTime); - $("#remarkText").text($("#remarkText").html() + (application.remark == null ? "" : application.remark)); - //备注添加申请人 - addApplicantToRemark(application); - - $("#recyclingApplicationId").val(application.id); - $("#tousseItemTable").empty(); - $("#basketsUl").empty(); - if(application.type == '自定义器械包申请单'){ - $('#add-bao').hide(); - applicationType = application.type; - } - if(application.applicationItems != null){ - var row = 0; - canTerminateTousseItemIds = []; - for(var i = 0 ; i< application.applicationItems.length ; ++i){ - //申请项 - var item = application.applicationItems[i]; - if(item.diposable == '否' && item.isRecycling != '否' && item.tousseType != '敷料包' && item.tousseType != '自制物品'){ - var recycleAmount = item.prepareRecycleAmount; - if(recycleAmount == null){ - recycleAmount = item.amount; - } - var appType = $("#appType").val(); - if(appType == "通用申请单" && sstsConfig.defaultRecycleAmountOfComboFormIsZero){//通用申请单并且配置为true,回收数量默认为0 + } else { + if (sstsConfig.showSettleAccountsDepartInRecycling) { + $("#depart").text(application.settleAccountsDepart); + $("#departCode").val(application.settleAccountsDepartCoding); + $("#recyclingStatus").val(application.recyclingStatus); + } else { + $("#depart").text(application.depart); + $("#departCode").val(application.departCoding); + $("#recyclingStatus").val(application.recyclingStatus); + } + $("#invoicePlanVersion").val(application.version); + $("#appType").val(application.type); + $("#applyTime").val(application.submitTime); + $("#remarkText").text($("#remarkText").html() + (application.remark == null ? "" : application.remark)); + //备注添加申请人 + addApplicantToRemark(application); + + $("#recyclingApplicationId").val(application.id); + $("#tousseItemTable").empty(); + $("#basketsUl").empty(); + if (application.type == '自定义器械包申请单') { + $('#add-bao').hide(); + applicationType = application.type; + } + if (application.applicationItems != null) { + var row = 0; + canTerminateTousseItemIds = []; + for (var i = 0; i < application.applicationItems.length; ++i) { + //申请项 + var item = application.applicationItems[i]; + if (item.diposable == '否' && item.isRecycling != '否' && item.tousseType != '敷料包' && item.tousseType != '自制物品') { + var recycleAmount = item.prepareRecycleAmount; + if (recycleAmount == null) { + recycleAmount = item.amount; + } + var appType = $("#appType").val(); + if (appType == "通用申请单" && sstsConfig.defaultRecycleAmountOfComboFormIsZero) {//通用申请单并且配置为true,回收数量默认为0 recycleAmount = 0; - }else if(appType == "器械包申请单" && sstsConfig.defaultRecycleAmountOfTousseFormIsZero){//器械包申请单并且配置为true,回收数量默认为0 + } else if (appType == "器械包申请单" && sstsConfig.defaultRecycleAmountOfTousseFormIsZero) {//器械包申请单并且配置为true,回收数量默认为0 recycleAmount = 0; } - - var errorDamageQmKey = item.errorDamageQmKey; - if(isUndefinedOrNullOrEmpty(errorDamageQmKey)){ - var timeStr = new Date().getTime(); - errorDamageQmKey = item.tousseDefinitionId + "_" + timeStr; + + var errorDamageQmKey = item.errorDamageQmKey; + if (isUndefinedOrNullOrEmpty(errorDamageQmKey)) { + var timeStr = new Date().getTime(); + errorDamageQmKey = item.tousseDefinitionId + "_" + timeStr; } - + var circuitNurse = item.circuitNurse || ''; var operationRoom = item.operationRoom || ''; - var toussItem = { + var toussItem = { row: row, tousseItemId: '', tousseName: item.tousseName, @@ -6023,563 +6023,563 @@ tousseType: item.tousseType, isThereIdentificationCard: item.isThereIdentificationCard, isApplyEntireTousse: item.isApplyEntireTousse, - urgentAmount : item.urgentAmount, - errorRemark : item.errorRemark, - damageRemark : item.damageRemark, - urgentLevel : item.urgentLevel, - tousseRemark : '', - errorDamageQmKey : errorDamageQmKey, - spelling : item.spelling, - circuitNurse:circuitNurse, - operationRoom:operationRoom - }; - addToussItem(toussItem,false); - canTerminateTousseItemIds.push(item.id); - ++row; - } - } - //是否有丢失报损 - var tousseBarcodes = application.tousseBarcodes; - if(!isUndefinedOrNullOrEmpty(tousseBarcodes)){ - $.ajax({ - type:'get', - url:WWWROOT + '/disinfectSystem/recyclingRecordAction!findMaterialErrorDamageByTousseBarcode.do', - data:'tousseBarcodes=' + encodeURI(tousseBarcodes), - dataType:'json', - success:function(result){ - //result的格式为:[{tousseBarcode:"包条码1",tousseDefinitionId:"包定义1",unSupplementMaterials:[{MaterialErrorDamageDetail对象1},{MaterialErrorDamageDetail对象2}]} - //,{tousseBarcode:"包条码2",tousseDefinitionId:"包定义2",unSupplementMaterials:[{MaterialErrorDamageDetail对象1},{MaterialErrorDamageDetail对象2}]}...{}] - for(var i = 0 ; i < result.length ; i++){ - var item = result[i]; - $('#tousseItemTable').children().first().children().each(function(j,element){ - if($('#tousseDefinitionID' + j).val() == item.tousseDefinitionId){ - loadUnSupplementMaterial(item,j,item.tousseBarcode); - } - }); - } - }, - error:function(msg){ + urgentAmount: item.urgentAmount, + errorRemark: item.errorRemark, + damageRemark: item.damageRemark, + urgentLevel: item.urgentLevel, + tousseRemark: '', + errorDamageQmKey: errorDamageQmKey, + spelling: item.spelling, + circuitNurse: circuitNurse, + operationRoom: operationRoom + }; + addToussItem(toussItem, false); + canTerminateTousseItemIds.push(item.id); + ++row; + } + } + //是否有丢失报损 + var tousseBarcodes = application.tousseBarcodes; + if (!isUndefinedOrNullOrEmpty(tousseBarcodes)) { + $.ajax({ + type: 'get', + url: WWWROOT + '/disinfectSystem/recyclingRecordAction!findMaterialErrorDamageByTousseBarcode.do', + data: 'tousseBarcodes=' + encodeURI(tousseBarcodes), + dataType: 'json', + success: function (result) { + //result的格式为:[{tousseBarcode:"包条码1",tousseDefinitionId:"包定义1",unSupplementMaterials:[{MaterialErrorDamageDetail对象1},{MaterialErrorDamageDetail对象2}]} + //,{tousseBarcode:"包条码2",tousseDefinitionId:"包定义2",unSupplementMaterials:[{MaterialErrorDamageDetail对象1},{MaterialErrorDamageDetail对象2}]}...{}] + for (var i = 0; i < result.length; i++) { + var item = result[i]; + $('#tousseItemTable').children().first().children().each(function (j, element) { + if ($('#tousseDefinitionID' + j).val() == item.tousseDefinitionId) { + loadUnSupplementMaterial(item, j, item.tousseBarcode); + } + }); + } + }, + error: function (msg) { - } - }); - } - //如果回收数量为0不显示 - if(sstsConfig.hideZeroPrerecycleAmountTousseItem && application.isPrepareRecycled === 1){ - //配置为预回收为0的物品不显示,相当于删除,但是需要是没有丢失报损的 - var rows = $("#tousseItemTable > tbody > tr").length; - for(var index = 0; index < rows;++index){ - var message = checkHaveErrorDamage(index); - if(isUndefinedOrNullOrEmpty(message)){ - var recycleAmountStr = $("#recycleAmount" + index).val(); - var recycleAmount = parseInt(recycleAmountStr); - if(recycleAmount==0){ - deleteTousseItem(index); - } - } - } - } - } - } - }); - DWREngine.setAsync(true); - } + } + }); + } + //如果回收数量为0不显示 + if (sstsConfig.hideZeroPrerecycleAmountTousseItem && application.isPrepareRecycled === 1) { + //配置为预回收为0的物品不显示,相当于删除,但是需要是没有丢失报损的 + var rows = $("#tousseItemTable > tbody > tr").length; + for (var index = 0; index < rows; ++index) { + var message = checkHaveErrorDamage(index); + if (isUndefinedOrNullOrEmpty(message)) { + var recycleAmountStr = $("#recycleAmount" + index).val(); + var recycleAmount = parseInt(recycleAmountStr); + if (recycleAmount == 0) { + deleteTousseItem(index); + } + } + } + } + } + } + }); + DWREngine.setAsync(true); + } var id = params_id; - if(!isUndefinedOrNullOrEmpty(id)){ + if (!isUndefinedOrNullOrEmpty(id)) { loadRecyclingRecordById(id); - findMaterialErrorDamageByTousseBarcode('',id); - }else{ - var recyclePageCheckUserDefaultCurrentUser = true; - if(sstsConfig.recyclePageCheckUserDefaultCurrentUser == false){ - recyclePageCheckUserDefaultCurrentUser = false; - } - //如果配置为默认当前登录人为清点人,则赋值 - if(recyclePageCheckUserDefaultCurrentUser != false){ - $("#operator").val(userName); - } - //触摸屏回收回收人设置默认值 (默认值取当前登录用户) - if(sstsConfig.isRecycleUserSetDefaultValue == true){ - $("#recyclingUser").val(userName); - } - - if(rememberRecycleUser == 'true'){ - $("#recyclingUser").val(sessionRecyclingUser); - $("#operator").val(sessionOperator); - }else{ - //回收人使用上一次回收时选的回收人 - if(sstsConfig.recyclePageRecyclingUserDefaultLastRecyclingUser == true){ - $("#recyclingUser").val(sessionRecyclingUser); - } - //清点人使用上一次回收时选的清点人 - if(sstsConfig.recyclePageOperatorDefaultLastOperator == true){ - $("#operator").val(sessionOperator); - } - } - //如果有传递科室参数,那设置回收科室,并加载模板 - if(!isUndefinedOrNullOrEmpty(params_departCoding)){ - selectDepart(params_departName,params_departCoding); - } - } - + findMaterialErrorDamageByTousseBarcode('', id); + } else { + var recyclePageCheckUserDefaultCurrentUser = true; + if (sstsConfig.recyclePageCheckUserDefaultCurrentUser == false) { + recyclePageCheckUserDefaultCurrentUser = false; + } + //如果配置为默认当前登录人为清点人,则赋值 + if (recyclePageCheckUserDefaultCurrentUser != false) { + $("#operator").val(userName); + } + //触摸屏回收回收人设置默认值 (默认值取当前登录用户) + if (sstsConfig.isRecycleUserSetDefaultValue == true) { + $("#recyclingUser").val(userName); + } + + if (rememberRecycleUser == 'true') { + $("#recyclingUser").val(sessionRecyclingUser); + $("#operator").val(sessionOperator); + } else { + //回收人使用上一次回收时选的回收人 + if (sstsConfig.recyclePageRecyclingUserDefaultLastRecyclingUser == true) { + $("#recyclingUser").val(sessionRecyclingUser); + } + //清点人使用上一次回收时选的清点人 + if (sstsConfig.recyclePageOperatorDefaultLastOperator == true) { + $("#operator").val(sessionOperator); + } + } + //如果有传递科室参数,那设置回收科室,并加载模板 + if (!isUndefinedOrNullOrEmpty(params_departCoding)) { + selectDepart(params_departName, params_departCoding); + } + } + //如果篮筐为空,隐藏扫描篮筐提示 - if(!sstsConfig.loadWashLoadingStatusBasketsWhenRecycling){ - if($("#basketsUl > li").length == 0){ + if (!sstsConfig.loadWashLoadingStatusBasketsWhenRecycling) { + if ($("#basketsUl > li").length == 0) { $("#scanContainerBarcodeTipUl").show(); - }else{ + } else { $("#scanContainerBarcodeTipUl").hide(); } } - - checkLoadedAmount(); - //如果是历史回收记录界面进入,则不显示终止按钮 - if(canTerminateTousseItemIds.length == 0){ - //没有可以终止的申请项,那就把终止按钮隐藏 - $('#btn-terminate').hide(); - } - //是否显示保存并打印按钮 - if(sstsConfig.showRecyclingPrintDetail && $("#appType").val() == TYPE_FOREIGNTOUSSEAPPLIACTION){ - $('#saveAndPrintBtnTd').show(); - }else{ - $('#saveAndPrintBtnTd').hide(); - } - //是否显示保存打印并新建按钮 - if(sstsConfig.showRecyclingSaveAndPrintAndNewActionButton){ - $('#saveAndPrintAndNewBtnTd').show(); - }else{ - $('#saveAndPrintAndNewBtnTd').hide(); - } - if(recyclingStatus == '部分回收'){ + + checkLoadedAmount(); + //如果是历史回收记录界面进入,则不显示终止按钮 + if (canTerminateTousseItemIds.length == 0) { + //没有可以终止的申请项,那就把终止按钮隐藏 + $('#btn-terminate').hide(); + } + //是否显示保存并打印按钮 + if (sstsConfig.showRecyclingPrintDetail && $("#appType").val() == TYPE_FOREIGNTOUSSEAPPLIACTION) { + $('#saveAndPrintBtnTd').show(); + } else { + $('#saveAndPrintBtnTd').hide(); + } + //是否显示保存打印并新建按钮 + if (sstsConfig.showRecyclingSaveAndPrintAndNewActionButton) { + $('#saveAndPrintAndNewBtnTd').show(); + } else { + $('#saveAndPrintAndNewBtnTd').hide(); + } + if (recyclingStatus == '部分回收') { $('#saveBtnTd').show(); } //选择模板按钮显示,isOpenLoadTemplateByUnit为true - if(sstsConfig.isOpenLoadTemplateByUnit){ + if (sstsConfig.isOpenLoadTemplateByUnit) { var appType = $("#appType").val(); - if(appType == ""){//为空代表是回收申请单 + if (appType == "") {//为空代表是回收申请单 $('.departmentTemplate').show(); - if(sstsConfig.recycleAddQualityMonitoring){ - $('.departmentTemplate').css('right','540px'); + if (sstsConfig.recycleAddQualityMonitoring) { + $('.departmentTemplate').css('right', '540px'); } } } - $('.btn-box').css('display','block'); - refreshSplitBasketView(); - refreshAllBasketTotalNum(); - if('history' != params_recordType || !getSystemSetConfig('confirmRecyclingAmount',false)){ + $('.btn-box').css('display', 'block'); + refreshSplitBasketView(); + refreshAllBasketTotalNum(); + if ('history' != params_recordType || !getSystemSetConfig('confirmRecyclingAmount', false)) { $('div.communicationUserName').hide(); $('#recyclingAmountConfirm').hide(); - }else{ - $("#remark").css('max-width','582px'); + } else { + $("#remark").css('max-width', '582px'); } - if(ENABLE_SPEECH_RECOGNITION){ + if (ENABLE_SPEECH_RECOGNITION) { setTousseGrammer(); } } // 装载数量根据其值更新背景色 -function checkLoadedAmount(){ - $('#tousseItemTable').children().first().children().each(function(i,element){ - var recycleAmount = parseInt($('#recycleAmount' + i).val(),10); - var loadedAmount = parseInt($('#loadedAmount' + i).val(),10); - if(loadedAmount > 0 && recycleAmount > loadedAmount){ - $("#loadedAmount" + i).css("background","#FFE66F");//黄色 - }else if(recycleAmount == loadedAmount && loadedAmount !== 0){ - $("#loadedAmount" + i).css("background","#b7d9a5");//绿色 - }else{ - $("#loadedAmount" + i).css("background","#FFFFFF");//默认白色 - } - }); +function checkLoadedAmount() { + $('#tousseItemTable').children().first().children().each(function (i, element) { + var recycleAmount = parseInt($('#recycleAmount' + i).val(), 10); + var loadedAmount = parseInt($('#loadedAmount' + i).val(), 10); + if (loadedAmount > 0 && recycleAmount > loadedAmount) { + $("#loadedAmount" + i).css("background", "#FFE66F");//黄色 + } else if (recycleAmount == loadedAmount && loadedAmount !== 0) { + $("#loadedAmount" + i).css("background", "#b7d9a5");//绿色 + } else { + $("#loadedAmount" + i).css("background", "#FFFFFF");//默认白色 + } + }); } // 备注添加申请人 -function addApplicantToRemark(application){ - var confirmRecyclingAmount = getSystemSetConfig('confirmRecyclingAmount',false); - if(confirmRecyclingAmount){ - var rmk = $("#remarkText").text(); - if(!isUndefinedOrNullOrEmpty(rmk)){ - rmk += ";"; - } - if(!isUndefinedOrNullOrEmpty(application.applicant)){ - rmk += '申请人:' + application.applicant; - } - $("#remarkText").text(rmk); +function addApplicantToRemark(application) { + var confirmRecyclingAmount = getSystemSetConfig('confirmRecyclingAmount', false); + if (confirmRecyclingAmount) { + var rmk = $("#remarkText").text(); + if (!isUndefinedOrNullOrEmpty(rmk)) { + rmk += ";"; } + if (!isUndefinedOrNullOrEmpty(application.applicant)) { + rmk += '申请人:' + application.applicant; + } + $("#remarkText").text(rmk); + } } // 根据回收记录id加载回收记录的数据 -function loadRecyclingRecordById(id){ - DWREngine.setAsync(false); - RecyclingRecordTableManager.getRecyclingRecordById(id,function(record){ - record = eval("("+record+")"); - if(record != null){ - $("#id").val(record.id); - $("#depart").text(record.depart); - $("#recyclingUser").val(record.recyclingUser); +function loadRecyclingRecordById(id) { + DWREngine.setAsync(false); + RecyclingRecordTableManager.getRecyclingRecordById(id, function (record) { + record = eval("(" + record + ")"); + if (record != null) { + $("#id").val(record.id); + $("#depart").text(record.depart); + $("#recyclingUser").val(record.recyclingUser); $("#departmentSender").val(record.departmentSender); - $("#operator").val(record.operator); - $("#departCode").val(record.departCode); - $("#recyclingTime").val(dateObjFormat(record.recyclingTime)); - $("#communicationUserName").val(record.communicationUserName); - $("#communicationUserCode").val(record.communicationUserCode); - var application = record.recyclingApplication; - if(application != null){ - $("#recyclingApplicationId").val(application.id); + $("#operator").val(record.operator); + $("#departCode").val(record.departCode); + $("#recyclingTime").val(dateObjFormat(record.recyclingTime)); + $("#communicationUserName").val(record.communicationUserName); + $("#communicationUserCode").val(record.communicationUserCode); + var application = record.recyclingApplication; + if (application != null) { + $("#recyclingApplicationId").val(application.id); $("#invoicePlanVersion").val(application.version); $("#recyclingStatus").val(application.packageStatus); - var recordType = application.type; - if(recordType == '自定义器械包申请单'){ - $('#add-bao').hide(); - applicationType = application.type; - } - - $("#appType").val(application.type); - $("#applyTime").val(dateObjFormat(application.submitTime)); - $("#remarkText").text($("#remarkText").text() + (application.remark == null ? "" : application.remark)); - addApplicantToRemark(application); - } - userName = record.operator; - $("#tousseItemTable").empty(); - $("#basketsUl").empty(); - - // 根据申请单的状态,控制按钮的显示与隐藏 - if(record.status == '未确认'){ - $('#confirmBtnTd').show(); - }else if(record.status == '已确认'){ - $('#saveBtnTd').hide(); - $('#saveAndNewBtnTd').hide(); - $('#recyclingAmountConfirm').hide(); - } - if(application != null){ - //部分回收需要能够再次保存 - if(application.recyclingStatus == '部分回收'){ - $('#saveBtnTd').show(); - } - if(application.recyclingStatus == '已回收'){ - $('#isCheckIntoTheBox').hide(); + var recordType = application.type; + if (recordType == '自定义器械包申请单') { + $('#add-bao').hide(); + applicationType = application.type; } + + $("#appType").val(application.type); + $("#applyTime").val(dateObjFormat(application.submitTime)); + $("#remarkText").text($("#remarkText").text() + (application.remark == null ? "" : application.remark)); + addApplicantToRemark(application); } - var row = 0; - //快速回收后未回收的包 - if(record.items != null && record.items.length > 0){ - canTerminateTousseItemIds = []; - for(var i = 0 ; i< record.items.length ; i++){ - var tousseItem = record.items[i]; - - var applyAmount = tousseItem.amount; - if(application != null && application.applicationItems != null){ - var applyItems = application.applicationItems; - for(var n = 0;n < applyItems.length;n++){ - if(applyItems[n].tousseDefinitionId == tousseItem.tousseDefinitionId){ - applyAmount = applyItems[n].amount; - break; - } - } - } - var errorDamageQmKey = tousseItem.errorDamageQmKey; - if(isUndefinedOrNullOrEmpty(errorDamageQmKey)){ - var timeStr = new Date().getTime(); - errorDamageQmKey = tousseItem.tousseDefinitionId + "_" + timeStr; - } - - var toussItem = { - row: row, - tousseItemId: tousseItem.id, - tousseName: tousseItem.tousseName, - tousseDefinitionID: tousseItem.tousseDefinitionId, - applicationAmount: applyAmount, - recycleAmount: tousseItem.amount, - loadedAmount: tousseItem.amount, - isCleanedEntirely: tousseItem.isCleanedEntirely, - tousseType: tousseItem.tousseType, - isThereIdentificationCard: tousseItem.isThereIdentificationCard, - isApplyEntireTousse: tousseItem.isApplyEntireTousse, - urgentAmount : tousseItem.urgentAmount, - errorRemark : tousseItem.errorRemark, - damageRemark : tousseItem.damageRemark, - urgentLevel : tousseItem.urgentLevel, - tousseRemark : tousseItem.remark, - errorDamageQmKey : errorDamageQmKey, - spelling:tousseItem.spelling - }; - var successAdd = addToussItem(toussItem,false); - if(!successAdd){ - continue; - } - var recyclingErrors = tousseItem.recyclingErrors; - var errorLen = recyclingErrors.length; - if(errorLen > 0){ - var recyclingErrorJsonArray = new Array(); - for(var j = 0;j < errorLen;j++){ - var error = recyclingErrors[j]; - if(error.amount < 0){ - continue; - } - var errorObj = { - detailId: error.id, - tousseDefinitionID: error.tousseDefinitionId, - materialDefinitionId: error.materialDefinitionId, - materialName: error.materialName, - amount: error.amount, - errorType: error.errorType, - tousseBarcode:error.tousseBarcode, - intoBasketAmount:error.amount, - errorDamageQmKey : error.errorDamageQmKey, - status:error.status, - unconfirmedAmount:error.unconfirmedAmount || 0, - amountPerTousse:error.amountPerTousse - }; - recyclingErrorJsonArray.push(errorObj); - } - setTousseItemRecyclingError(row,JSON.stringify(recyclingErrorJsonArray)); - if(recyclingErrorJsonArray.length > 0){ - document.getElementById('showTousseName'+row).className = 'input-a-yellow'; - document.getElementById('recyclingErrorButton'+row).className = 'btn-b-edit'; - } + userName = record.operator; + $("#tousseItemTable").empty(); + $("#basketsUl").empty(); + + // 根据申请单的状态,控制按钮的显示与隐藏 + if (record.status == '未确认') { + $('#confirmBtnTd').show(); + } else if (record.status == '已确认') { + $('#saveBtnTd').hide(); + $('#saveAndNewBtnTd').hide(); + $('#recyclingAmountConfirm').hide(); + } + if (application != null) { + //部分回收需要能够再次保存 + if (application.recyclingStatus == '部分回收') { + $('#saveBtnTd').show(); + } + if (application.recyclingStatus == '已回收') { + $('#isCheckIntoTheBox').hide(); + } + } + var row = 0; + //快速回收后未回收的包 + if (record.items != null && record.items.length > 0) { + canTerminateTousseItemIds = []; + for (var i = 0; i < record.items.length; i++) { + var tousseItem = record.items[i]; + + var applyAmount = tousseItem.amount; + if (application != null && application.applicationItems != null) { + var applyItems = application.applicationItems; + for (var n = 0; n < applyItems.length; n++) { + if (applyItems[n].tousseDefinitionId == tousseItem.tousseDefinitionId) { + applyAmount = applyItems[n].amount; + break; + } + } } + var errorDamageQmKey = tousseItem.errorDamageQmKey; + if (isUndefinedOrNullOrEmpty(errorDamageQmKey)) { + var timeStr = new Date().getTime(); + errorDamageQmKey = tousseItem.tousseDefinitionId + "_" + timeStr; + } + + var toussItem = { + row: row, + tousseItemId: tousseItem.id, + tousseName: tousseItem.tousseName, + tousseDefinitionID: tousseItem.tousseDefinitionId, + applicationAmount: applyAmount, + recycleAmount: tousseItem.amount, + loadedAmount: tousseItem.amount, + isCleanedEntirely: tousseItem.isCleanedEntirely, + tousseType: tousseItem.tousseType, + isThereIdentificationCard: tousseItem.isThereIdentificationCard, + isApplyEntireTousse: tousseItem.isApplyEntireTousse, + urgentAmount: tousseItem.urgentAmount, + errorRemark: tousseItem.errorRemark, + damageRemark: tousseItem.damageRemark, + urgentLevel: tousseItem.urgentLevel, + tousseRemark: tousseItem.remark, + errorDamageQmKey: errorDamageQmKey, + spelling: tousseItem.spelling + }; + var successAdd = addToussItem(toussItem, false); + if (!successAdd) { + continue; + } + var recyclingErrors = tousseItem.recyclingErrors; + var errorLen = recyclingErrors.length; + if (errorLen > 0) { + var recyclingErrorJsonArray = new Array(); + for (var j = 0; j < errorLen; j++) { + var error = recyclingErrors[j]; + if (error.amount < 0) { + continue; + } + var errorObj = { + detailId: error.id, + tousseDefinitionID: error.tousseDefinitionId, + materialDefinitionId: error.materialDefinitionId, + materialName: error.materialName, + amount: error.amount, + errorType: error.errorType, + tousseBarcode: error.tousseBarcode, + intoBasketAmount: error.amount, + errorDamageQmKey: error.errorDamageQmKey, + status: error.status, + unconfirmedAmount: error.unconfirmedAmount || 0, + amountPerTousse: error.amountPerTousse + }; + recyclingErrorJsonArray.push(errorObj); + } + setTousseItemRecyclingError(row, JSON.stringify(recyclingErrorJsonArray)); + if (recyclingErrorJsonArray.length > 0) { + document.getElementById('showTousseName' + row).className = 'input-a-yellow'; + document.getElementById('recyclingErrorButton' + row).className = 'btn-b-edit'; + } + } var recyclingDamages = tousseItem.recyclingDamages; var damageLen = recyclingDamages.length; - if(damageLen > 0){ - var recyclingDamageJsonArray = new Array(); - for(var j = 0;j < damageLen ; j++){ - var damage = recyclingDamages[j]; - if(damage.amount < 0){ - continue; - } - var item = { - detailId: damage.id, - tousseDefinitionID: damage.tousseDefinitionId, - materialDefinitionId: damage.materialDefinitionId, - materialName: damage.materialName, - tousseBarcode:damage.tousseBarcode, + if (damageLen > 0) { + var recyclingDamageJsonArray = new Array(); + for (var j = 0; j < damageLen; j++) { + var damage = recyclingDamages[j]; + if (damage.amount < 0) { + continue; + } + var item = { + detailId: damage.id, + tousseDefinitionID: damage.tousseDefinitionId, + materialDefinitionId: damage.materialDefinitionId, + materialName: damage.materialName, + tousseBarcode: damage.tousseBarcode, amount: damage.amount, - status:damage.status, - errorDamageQmKey : damage.errorDamageQmKey, - unconfirmedAmount:damage.unconfirmedAmount || 0, - amountPerTousse:damage.amountPerTousse - }; - recyclingDamageJsonArray.push(item); + status: damage.status, + errorDamageQmKey: damage.errorDamageQmKey, + unconfirmedAmount: damage.unconfirmedAmount || 0, + amountPerTousse: damage.amountPerTousse + }; + recyclingDamageJsonArray.push(item); } - setTousseItemRecyclingDamage(row,JSON.stringify(recyclingDamageJsonArray)); - if(recyclingDamageJsonArray.length > 0){ - document.getElementById('showTousseName'+row).className = 'input-a-brown'; - document.getElementById('recyclingDamageButton'+row).className = 'btn-c-edit'; - } - } - row++; - } - } - - var applicationitems = null; - var recyclingStatus = null; - var deliverStatus = null; - var endStatus = null; - - if (application != null) { - recyclingStatus = application.recyclingStatus; - applicationitems = application.applicationItems; - deliverStatus = application.deliverStatus; - endStatus = application.endStatus; - } - - if(applicationitems != null){ - for(var i = 0; i < applicationitems.length;i++){ - var tousseDefinitionId = applicationitems[i].tousseDefinitionId; - var recycled = false; - if(record.items != null){ - for(var j = 0 ; j< record.items.length ; j++){ - var tousseDefinitionId2 = record.items[j].tousseDefinitionId; - if(tousseDefinitionId == tousseDefinitionId2){ - recycled = true; - } - } - } - if(!recycled && recyclingStatus != "已回收" && recyclingStatus != '已接收'){ - if(applicationitems[i].diposable == '否' && applicationitems[i].isRecycling == '是' && applicationitems[i].tousseType != '敷料包' && applicationitems[i].tousseType != '自制物品'){ - var errorDamageQmKey = applicationitems[i].errorDamageQmKey; - if(isUndefinedOrNullOrEmpty(errorDamageQmKey)){ - var timeStr = new Date().getTime(); - errorDamageQmKey = applicationitems[i].tousseDefinitionId + "_" + timeStr; - } + setTousseItemRecyclingDamage(row, JSON.stringify(recyclingDamageJsonArray)); + if (recyclingDamageJsonArray.length > 0) { + document.getElementById('showTousseName' + row).className = 'input-a-brown'; + document.getElementById('recyclingDamageButton' + row).className = 'btn-c-edit'; + } + } + row++; + } + } + + var applicationitems = null; + var recyclingStatus = null; + var deliverStatus = null; + var endStatus = null; + + if (application != null) { + recyclingStatus = application.recyclingStatus; + applicationitems = application.applicationItems; + deliverStatus = application.deliverStatus; + endStatus = application.endStatus; + } + + if (applicationitems != null) { + for (var i = 0; i < applicationitems.length; i++) { + var tousseDefinitionId = applicationitems[i].tousseDefinitionId; + var recycled = false; + if (record.items != null) { + for (var j = 0; j < record.items.length; j++) { + var tousseDefinitionId2 = record.items[j].tousseDefinitionId; + if (tousseDefinitionId == tousseDefinitionId2) { + recycled = true; + } + } + } + if (!recycled && recyclingStatus != "已回收" && recyclingStatus != '已接收') { + if (applicationitems[i].diposable == '否' && applicationitems[i].isRecycling == '是' && applicationitems[i].tousseType != '敷料包' && applicationitems[i].tousseType != '自制物品') { + var errorDamageQmKey = applicationitems[i].errorDamageQmKey; + if (isUndefinedOrNullOrEmpty(errorDamageQmKey)) { + var timeStr = new Date().getTime(); + errorDamageQmKey = applicationitems[i].tousseDefinitionId + "_" + timeStr; + } var recyclingAmount = applicationitems[i].recyclingTempAmout || 0; - if(recyclingAmount == -999999){//ZSYY-286:快速回收 + if (recyclingAmount == -999999) {//ZSYY-286:快速回收 recyclingAmount = applicationitems[i].amount; } - // 如果状态为已清点,则将回收数量改为已清点的数量,显示在界面上 - if (recyclingStatus == '已清点'){ - recyclingAmount = applicationitems[i].tallyAmount; - } - if(sstsConfig.defaultRecycleAmountOfComboFormIsZero || sstsConfig.defaultRecycleAmountOfTousseFormIsZero){ - recyclingAmount = 0; - } - var toussItem = { - row: row, - tousseItemId: '', - tousseName: applicationitems[i].tousseName, - tousseDefinitionID: applicationitems[i].tousseDefinitionId, - applicationAmount: applicationitems[i].amount, - recycleAmount: recyclingAmount, - loadedAmount: 0, - isCleanedEntirely: applicationitems[i].isCleanedEntirely, - tousseType: applicationitems[i].tousseType, - isThereIdentificationCard: applicationitems[i].isThereIdentificationCard, - isApplyEntireTousse: applicationitems[i].isApplyEntireTousse, - urgentAmount : applicationitems[i].urgentAmount, - urgentLevel : applicationitems[i].urgentLevel, - tousseRemark : '', - errorDamageQmKey : errorDamageQmKey, - spelling:applicationitems[i].spelling - }; - addToussItem(toussItem,false); - canTerminateTousseItemIds.push(applicationitems[i].id); - row++; - } - }else if(deliverStatus != '已发货' && deliverStatus != '部分发货' && endStatus != '已终止'){ - //单没有发货,也没有终止那已经回收的物品也是可以终止的 - //如果recycled为true,说明回收项中包含对应的申请项,也就是在界面上是可以看到的 - if(recycled && applicationitems[i].diposable == '否' && applicationitems[i].tousseType != '敷料包' && applicationitems[i].tousseType != '自制物品'){ - if('是' == applicationitems[i].isInvoice){ - canTerminateTousseItemIds.push(applicationitems[i].id); - } - } - } - } + // 如果状态为已清点,则将回收数量改为已清点的数量,显示在界面上 + if (recyclingStatus == '已清点') { + recyclingAmount = applicationitems[i].tallyAmount; + } + if (sstsConfig.defaultRecycleAmountOfComboFormIsZero || sstsConfig.defaultRecycleAmountOfTousseFormIsZero) { + recyclingAmount = 0; + } + var toussItem = { + row: row, + tousseItemId: '', + tousseName: applicationitems[i].tousseName, + tousseDefinitionID: applicationitems[i].tousseDefinitionId, + applicationAmount: applicationitems[i].amount, + recycleAmount: recyclingAmount, + loadedAmount: 0, + isCleanedEntirely: applicationitems[i].isCleanedEntirely, + tousseType: applicationitems[i].tousseType, + isThereIdentificationCard: applicationitems[i].isThereIdentificationCard, + isApplyEntireTousse: applicationitems[i].isApplyEntireTousse, + urgentAmount: applicationitems[i].urgentAmount, + urgentLevel: applicationitems[i].urgentLevel, + tousseRemark: '', + errorDamageQmKey: errorDamageQmKey, + spelling: applicationitems[i].spelling + }; + addToussItem(toussItem, false); + canTerminateTousseItemIds.push(applicationitems[i].id); + row++; + } + } else if (deliverStatus != '已发货' && deliverStatus != '部分发货' && endStatus != '已终止') { + //单没有发货,也没有终止那已经回收的物品也是可以终止的 + //如果recycled为true,说明回收项中包含对应的申请项,也就是在界面上是可以看到的 + if (recycled && applicationitems[i].diposable == '否' && applicationitems[i].tousseType != '敷料包' && applicationitems[i].tousseType != '自制物品') { + if ('是' == applicationitems[i].isInvoice) { + canTerminateTousseItemIds.push(applicationitems[i].id); + } + } + } + } } - if(record.classifyBaskets != null){ - for(var i = 0 ; i< record.classifyBaskets.length ; i++){ + if (record.classifyBaskets != null) { + for (var i = 0; i < record.classifyBaskets.length; i++) { var basket = record.classifyBaskets[i]; var washClassifyType = basket.washClassifyType; var isIdCard = false; - if(basket.containerName.indexOf('(标识牌') == -1){ + if (basket.containerName.indexOf('(标识牌') == -1) { isIdCard = false; - }else { + } else { isIdCard = true; } - createBasketUiElement(basket.containerBarcode,basket.id,basket.containerName,washClassifyType,basket.sequence,isIdCard) - - for(var j = 0 ; j < basket.classfiedItems.length ; j++){ + createBasketUiElement(basket.containerBarcode, basket.id, basket.containerName, washClassifyType, basket.sequence, isIdCard) + + for (var j = 0; j < basket.classfiedItems.length; j++) { var ci = record.classifyBaskets[i].classfiedItems[j]; var containerBarcode = record.classifyBaskets[i].containerBarcode; - if(record.id != ci.recyclingRecordId){ - continue; + if (record.id != ci.recyclingRecordId) { + continue; } - var tousseType = ci.tousseDefinition?ci.tousseDefinition.tousseType:''; - if(ci.itemType == '材料'){ - var materialName = ci.materialDefinition.name; - var putBasketMaxAmount = ci.materialDefinition.intoBasketMaxAmount; - if(putBasketMaxAmount == null){ - putBasketMaxAmount = 0; - } - if(!isUndefinedOrNullOrEmpty(ci.materialDefinition.specification)){ - materialName += '['+ci.materialDefinition.specification+']'; - } - var tousseNameForMaterial = ci.tousseNameForMaterial; - - var showBarcode = ci.idCardBarcode; - if(ci.idCardBarcode == ""){ - showBarcode = tousseNameForMaterial; - } - - if(ci.tousseInstanceBarcode != undefined){ + var tousseType = ci.tousseDefinition ? ci.tousseDefinition.tousseType : ''; + if (ci.itemType == '材料') { + var materialName = ci.materialDefinition.name; + var putBasketMaxAmount = ci.materialDefinition.intoBasketMaxAmount; + if (putBasketMaxAmount == null) { + putBasketMaxAmount = 0; + } + if (!isUndefinedOrNullOrEmpty(ci.materialDefinition.specification)) { + materialName += '[' + ci.materialDefinition.specification + ']'; + } + var tousseNameForMaterial = ci.tousseNameForMaterial; + + var showBarcode = ci.idCardBarcode; + if (ci.idCardBarcode == "") { + showBarcode = tousseNameForMaterial; + } + + if (ci.tousseInstanceBarcode != undefined) { showBarcode = ci.tousseInstanceBarcode; } - - var aa = aa + materialName; - var element = ''; - element += '
    '+materialName+'
    '; - element += '
     '+showBarcode+'
    '; - element += '
    '+ci.amount+'
    '; - element += '
    删除
    '; - - $('dl[class="sed clearfix"]:eq(0)').prepend(element); - var json = getBasketItemJSON(ci.id,'材料',ci.orgUnitName,tousseNameForMaterial,materialName,ci.amount,ci.tousseAmountForMaterial,ci.idCardBarcode,ci.tousseDefinitionID,ci.basketGroupBarcodes,putBasketMaxAmount,tousseType,ci.lastTousseInstanceId,ci.tousseInstanceBarcode,washClassifyType); - $('dl[class="sed clearfix"]:eq(0)').find("input:first").val(json); - $('td[axis="materialName"]').each(function(){ - if($(this).text() == materialName){ - $(this).parent().remove(); - return false; - } - }); - }else{ - var putBasketMaxAmount = ci.tousseDefinition.intoBasketMaxAmount; - if(putBasketMaxAmount == null){ - putBasketMaxAmount = 0; - } - + + var aa = aa + materialName; + var element = ''; + element += '
    ' + materialName + '
    '; + element += '
     ' + showBarcode + '
    '; + element += '
    ' + ci.amount + '
    '; + element += '
    删除
    '; + + $('dl[class="sed clearfix"]:eq(0)').prepend(element); + var json = getBasketItemJSON(ci.id, '材料', ci.orgUnitName, tousseNameForMaterial, materialName, ci.amount, ci.tousseAmountForMaterial, ci.idCardBarcode, ci.tousseDefinitionID, ci.basketGroupBarcodes, putBasketMaxAmount, tousseType, ci.lastTousseInstanceId, ci.tousseInstanceBarcode, washClassifyType); + $('dl[class="sed clearfix"]:eq(0)').find("input:first").val(json); + $('td[axis="materialName"]').each(function () { + if ($(this).text() == materialName) { + $(this).parent().remove(); + return false; + } + }); + } else { + var putBasketMaxAmount = ci.tousseDefinition.intoBasketMaxAmount; + if (putBasketMaxAmount == null) { + putBasketMaxAmount = 0; + } + var barcode = ci.idCardBarcode; - if(ci.tousseInstanceBarcode != undefined){ + if (ci.tousseInstanceBarcode != undefined) { barcode = ci.tousseInstanceBarcode; } - var element = ''; - element += '
    '+ci.tousseDefinition.name+'
    '; - element += '
     '+barcode+'
    '; - element += '
    '+ci.amount+'
    '; - element += '
    删除
    '; - $('dl[class="sed clearfix"]:eq(0)').prepend(element); - - var json = getBasketItemJSON(ci.id,"器械包",ci.orgUnitName,ci.tousseDefinition.name,"",ci.amount,ci.tousseAmountForMaterial,ci.idCardBarcode,ci.tousseDefinitionID,ci.basketGroupBarcodes,putBasketMaxAmount,tousseType,ci.lastTousseInstanceId,ci.tousseInstanceBarcode,washClassifyType); - $('dl[class="sed clearfix"]:eq(0)').find("input:first").val(json); + var element = ''; + element += '
    ' + ci.tousseDefinition.name + '
    '; + element += '
     ' + barcode + '
    '; + element += '
    ' + ci.amount + '
    '; + element += '
    删除
    '; + $('dl[class="sed clearfix"]:eq(0)').prepend(element); + + var json = getBasketItemJSON(ci.id, "器械包", ci.orgUnitName, ci.tousseDefinition.name, "", ci.amount, ci.tousseAmountForMaterial, ci.idCardBarcode, ci.tousseDefinitionID, ci.basketGroupBarcodes, putBasketMaxAmount, tousseType, ci.lastTousseInstanceId, ci.tousseInstanceBarcode, washClassifyType); + $('dl[class="sed clearfix"]:eq(0)').find("input:first").val(json); } - if((ci.tousseInstanceBarcode || '') !== ''){ - if(sessionTousseInstance.hasOwnProperty(ci.tousseDefinitionID)){ + if ((ci.tousseInstanceBarcode || '') !== '') { + if (sessionTousseInstance.hasOwnProperty(ci.tousseDefinitionID)) { sessionTousseInstance[ci.tousseDefinitionID].amount++; var barcodeArray = sessionTousseInstance[ci.tousseDefinitionID].barcodeArray1; barcodeArray.push(ci.tousseInstanceBarcode); sessionTousseInstance[ci.tousseDefinitionID].barcodeArray1 = barcodeArray; var idsArray = sessionTousseInstance[ci.tousseDefinitionID].idsArray1; idsArray.push(ci.lastTousseInstanceId); sessionTousseInstance[ci.tousseDefinitionID].idsArray1 = idsArray; - }else { + } else { sessionTousseInstance[ci.tousseDefinitionID] = { - name:ci.name, - amount:1,//总数量 - barcodeArray:[],//未入筐的条码 - idsArray:[],//未入筐的id - barcodeArray1:[ci.tousseInstanceBarcode],//已入筐的条码 - idsArray1:[ci.lastTousseInstanceId]//已入筐的id + name: ci.name, + amount: 1,//总数量 + barcodeArray: [],//未入筐的条码 + idsArray: [],//未入筐的id + barcodeArray1: [ci.tousseInstanceBarcode],//已入筐的条码 + idsArray1: [ci.lastTousseInstanceId]//已入筐的id } } } } - } + } } - $('.btn-box').css('display','block'); + $('.btn-box').css('display', 'block'); } - }); - DWREngine.setAsync(true); + }); + DWREngine.setAsync(true); } // 转码 function encodeAll(text) { var encoded = encodeURI(text); - encoded = encoded.replace('#','%23');// 对#号进行转码 - encoded = encoded.replace('+','%2B');// 对+号进行转码 + encoded = encoded.replace('#', '%23');// 对#号进行转码 + encoded = encoded.replace('+', '%2B');// 对+号进行转码 return encoded; } // 语音识别的处理 -function setTousseGrammer(){ +function setTousseGrammer() { DWREngine.setAsync(false); var tousseType = $('#appType').val(); - var newTousseType = (tousseType == '消毒物品申请单')?'消毒物品':''; - TousseDefinitionTableManager.getInsideTousseAndDiposableGoods('',1,0,'',newTousseType,function(result){ - if(result != null && result.length > 0){ + var newTousseType = (tousseType == '消毒物品申请单') ? '消毒物品' : ''; + TousseDefinitionTableManager.getInsideTousseAndDiposableGoods('', 1, 0, '', newTousseType, function (result) { + if (result != null && result.length > 0) { var tousseArray = JSON.parse(result); - if(tousseArray.length > 0){ + if (tousseArray.length > 0) { var tousses = []; - for(var i=0;i