Index: ssts-web/src/main/webapp/disinfectsystem/packing/packingView.js =================================================================== diff -u -r36727 -r36902 --- ssts-web/src/main/webapp/disinfectsystem/packing/packingView.js (.../packingView.js) (revision 36727) +++ ssts-web/src/main/webapp/disinfectsystem/packing/packingView.js (.../packingView.js) (revision 36902) @@ -211,6 +211,256 @@ var barcodeTemp = ''; +//DGSFYBJY-65:批量打印 +function batchPrint(records){ + var printFullName = true; + DWREngine.setAsync(false); + PackingTableManager.isPrintUserFullName(function(print){ + if(!print){ + printFullName = false; + } + }); + DWREngine.setAsync(true); + var description = ""; + for ( var i = 0; i < records.length; i++) { + var tousseObj = {}; + ids = records[i].id; + var barcodeArray = new Array(); + var barcode = records[i].tousseBarcode; + var tousseNameAlias = records[i].tousseNameAlias || ''; + barcodeArray.push(barcode); + tousseObj.barcodes = barcodeArray; + + if(description != ""){ + description += ","; + } + description += barcode; + + var virtualSeqNums = new Array(); + var virtualBasketSeqNum = records[i].virtualBasketSeqNum; + virtualSeqNums.push(virtualBasketSeqNum); + tousseObj.virtualSeqNums = virtualSeqNums; + if(records[i].barcodePaperType == '小标签2'){ + var columnAmount = 1; + if(records[i].tousseType == '消毒物品'){ + var smallLabel2 = printConfig.smallLabel2_disinfect; + if(smallLabel2 && smallLabel2.columnAmount){ + columnAmount = smallLabel2.columnAmount; + }else { + showResult('未找到smallLabel2_disinfect打印配置'); + break; + } + }else { + var smallLabel2 = printConfig.smallLabel2; + if(smallLabel2 && smallLabel2.columnAmount){ + columnAmount = smallLabel2.columnAmount; + }else { + showResult('未找到smallLabel2打印配置'); + break; + } + } + tousseObj.indexInColumn = i%columnAmount; + if(i == 0){ + tousseObj.noInitPrinting = null; + }else{ + tousseObj.noInitPrinting = true; + } + if(i%columnAmount == 1 || i == records.length-1){ + tousseObj.noPrinting = null; + }else{ + tousseObj.noPrinting = true; + } + } + tousseObj.fixedBarcode = records[i].fixedBarcode; + tousseObj.materialsJsonArray = records[i].materialsJsonArray; + tousseObj.tousseName = records[i].tousseName; + if(tousseNameAlias !== ''){ + tousseObj.tousseName = tousseNameAlias; + } + tousseObj.tousseType = records[i].tousseType; + + var isDisinfection = false; + + if (tousseObj.tousseType == '消毒物品'){ + isDisinfection = true; + } + tousseObj.isDisinfection = isDisinfection; + tousseObj.isSterile = records[i].isSterile; + + tousseObj.packageType = records[i].packType; + tousseObj.pageType = records[i].barcodePaperType; + // 获取包装方式的简称 + var packageTypeAbbreviation = ''; + DWREngine.setAsync(false); + TousseInstanceTableManager.getPackageTypeAbbreviation(tousseObj.packageType,function(_packageTypeAbbreviation){ + packageTypeAbbreviation = _packageTypeAbbreviation; + }); + DWREngine.setAsync(true); + + tousseObj.packageTypeAbbreviation = packageTypeAbbreviation; + tousseObj.sterilingType = records[i].sterilization; + tousseObj.supplierName = records[i].supplierName; + //灭菌日期、失效日期 + var sterileStartTime = records[i].sterileStartTime; + tousseObj.sterilizationDate = sterileStartTime; + tousseObj.validDate = records[i].validUntilStr; + tousseObj.toolAmount = records[i].toolAmount; + tousseObj.implantAmount = records[i].implantAmount; + + if (sterileStartTime.length > 10){ + tousseObj.sterilizationDate = sterileStartTime.substring(0,10); + } + + var operator = records[i].packer; + var wrapperForPrint = records[i].wrapper; + var washOperator = records[i].washOperator; + var reviewer = records[i].reviewer; + var sterilizationUser = records[i].sterilizationUser; + var inspector = records[i].inspector; + if(!printFullName){ + operator = records[i].packerCode; + wrapperForPrint = records[i].wrapperCode; + reviewer = records[i].reviewerCode; + sterilizationUser = records[i].sterilizationUserCode; + washOperator = records[i].washOperatorCode; + inspector = records[i].inspectorCode; + } + tousseObj.washOperator = washOperator; + tousseObj.operatorToPrint = operator; + tousseObj.wrapperForPrint = wrapperForPrint; + tousseObj.reviewerToPrint = reviewer; + tousseObj.sterilizationUserToPrint = sterilizationUser; + tousseObj.inspectorToPrint = inspector; + tousseObj.sterilizerName = records[i].sterilizer; + tousseObj.sterileFrequency = records[i].frequency; + if(tousseObj.packTime && tousseObj.packTime !== ''){ + tousseObj.operationDate = tousseObj.packTime.split(' ')[0]; + } + + var foreignTousseAppInfo = null; + var tousseAppID = 0; + if(tousseObj.tousseType == '外来器械包' || tousseObj.tousseType == '外来器械拆分小包'){ + DWREngine.setAsync(false); + ForeignTousseApplicationTableManager.findForeignTousseApplicationByBarcode(barcode,function(result){ + if(result != null && result.length > 0){ + foreignTousseAppInfo = JSON.parse(result); + foreignTousseAppInfo.supplierName = records[i].supplierName; + tousseAppID = foreignTousseAppInfo.tousseAppID; + } + }); + DWREngine.setAsync(true); + } + tousseObj.foreignTousseApp_id = tousseAppID; + tousseObj.printOrgSource = records[i].printOrgSource; + tousseObj.department = records[i].department; + tousseObj.depart = tousseObj.department; + tousseObj.applicant = (getPrintUserFullName == true)?records[i].applicant:records[i].applicantCode; + tousseObj.maker = (getPrintUserFullName == true)?records[i].maker:records[i].makerCode; + tousseObj.assistant = (getPrintUserFullName == true)?records[i].assistant:records[i].assistantCode; + tousseObj.applicantDepart = records[i].applicantDepart; + tousseObj.remark = records[i].remark; + tousseObj.tousseDefinitionId = records[i].tousseDefinitionId; + tousseObj.idCardDefinitionUseAmount = records[i].idCardDefinitionUseAmount; + //打印 + // 必须先调用此代码,然后才能调用Ext.MessageBox.updateProgress + Ext.MessageBox.progress('【' + tousseObj.tousseName + '】打印中', '请稍候...'); + Ext.MessageBox.updateProgress((i + 1)/records.length,'第' + (i + 1) + '个,共' + records.length + '个'); + + var print = true; + + if(print){ + // 是否打印表格线 + DWREngine.setAsync(false); + ExpirationDateInfoTableManager.getExpirationDateByPackageTypeAndDateFormat(sterileStartTime,'yyyy-MM-dd HH:mm:ss',tousseObj.packageType,function(result){ + var expirationDateObj = JSON.parse(result); + tousseObj.markTousse = expirationDateObj.markTousse; + }); + DWREngine.setAsync(true); + + tousseObj.isPrint = records[i].isPrint; + tousseObj.isTraceable = records[i].isTraceable; + tousseObj.printCause = '历史装配记录重新打印'; + tousseObj.logPrintTousse = true; + //获取标识牌编号 + Ext4.Ajax.request({ + url : WWWROOT + '/disinfectSystem/tousseInstanceAction!findIdNumberByTousseInstanceId.do', + async:false, + params : {tousseInstanceId : ids}, + success : function(response, options) { + var result = JSON.parse(response.responseText); + if(result.success){ + var idNumber = result.data.idNumber || ''; + tousseObj.idCardDefinitionIdNumber = idNumber; + }else{ + showResult(result.message); + } + }, + failure : function(response, options) { + var result = JSON.parse(response.responseText); + showResult(result.message); + } + }); + Ext4.applyIf(tousseObj,records[i].data); + // 外部代理灭菌单上的器械包的打印 + if('外部代理灭菌' == tousseObj.tousseType){ + var hospitalName = ""; + var sterilizer = tousseObj.sterilizerName; + var frequency = tousseObj.sterileFrequency; + var applicant = tousseObj.applicant; + var depart = tousseObj.applicantDepart; + var material = ''; + var printBarcode = barcode; + if(!tousseObj.isTraceable){//不追溯打固定条码 + printBarcode = tousseObj.fixedBarcode; + } + tousseObj.tousseNameWithoutDepart = tousseObj.tousseName; + tousseObj.sterilizationUser = sterilizationUser; + var printSummaryObj = {'barcode':printBarcode, 'name':tousseObj.tousseName,'tousseNameWithoutDepart':tousseObj.tousseNameWithoutDepart, 'applicant':applicant, 'depart': depart, 'sterilizationDate':tousseObj.sterilizationDate, 'validDate':tousseObj.validDate, + 'hospitalName':hospitalName, 'sterilizer':sterilizer, 'frequency':frequency, 'material':material, 'sterilingType':tousseObj.sterilingType, + 'maker':tousseObj.maker,'assistant':tousseObj.assistant}; + Ext4.applyIf(printSummaryObj,tousseObj); + + setMaterialsForPrint(printSummaryObj,barcode); + setSterilisationAbbreviationForPrint(printSummaryObj,barcode); + defaultForeignPrintPackage(printSummaryObj); + + } + else{ + + //先将名称存到另一个未含科室名的名称属性里(针对东莞中医院的打印调整) + tousseObj.tousseNameWithoutDepart = tousseObj.tousseName; + var haveUnSupplementMaterials = records[i].haveUnSupplementMaterials; + if(haveUnSupplementMaterials == true){ + tousseObj.tousseNameWithoutDepart = "◆ " + tousseObj.tousseNameWithoutDepart; + tousseObj.tousseName = "◆ " + tousseObj.tousseName; + } + //打印消毒物品 + if(tousseObj.isDisinfection){ + printLabelOfDisinfection(tousseObj); + } + // 打印器械包 + else{ + addDepartPrefixForTousseName(tousseObj); + printLabel(tousseObj); + } + } + tousseObj.noInitPrinting = null; + tousseObj.noPrinting = null; + } + } + //重新打印加日志记录 + Ext4.Ajax.request({ + url : WWWROOT + '/log/saveLog.do', + params : {model : '装配模块',type : 'A',description : "批量打印标签条码:" + description}, + success : function(response, options) { + setTimeout(function(){ + Ext.MessageBox.updateProgress(1,' '); // 清除进度条的提示文字 + Ext.MessageBox.hide(); + }, 2000); + } + }); +} + //修改灭菌程序 function updateSterilisation(){ var newSterilizerTypeStore = new Ext.data.SimpleStore({ @@ -6876,6 +7126,40 @@ } }, { xtype: 'button', + text: '批量打印', + hidden:!SSTS_HistoryPacking_Update, + handler: function () { + var selectedRecords = listGrid.getSelectionModel().getSelection(); + if(selectedRecords.length == 0){ + showMultipleResult('请先勾选装配记录后再进行打印', null, sstsConfig.messagePauseTimeOnPackingPage); + return + } + top.Ext4.MessageBox.confirm("请确认", "确定要重新打印标签吗?",function (button, text) { + if ("yes" == button) { + var myMask = new Ext.LoadMask(Ext.getBody(), { + msg: "正在打印,请稍候..." + }); + myMask.show(); + for(var i=0;i