Index: ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recyclingErrors.js
===================================================================
diff -u
--- ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recyclingErrors.js (revision 0)
+++ ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recyclingErrors.js (revision 31023)
@@ -0,0 +1,460 @@
+//增加数量
+function add(row) {
+ var materialName = $('#materialName' + row).val();
+ var errorAmount = parseInt($('#errorAmount' + row).html(), 10)
+ var errorCount = parseInt($('#errorCount' + row).val());
+ //编辑回收记录时不允许修改标志牌丢失数量
+ if (materialName == '器械包标识牌' && isEditIDCardError == 'false') {
+ return;
+ } else {
+ //应该回收的数量
+ var totalCount = parseInt($('#totalCount' + row).html(), 10);
+ if (errorAmount < totalCount) {
+ if (errorCount == 0) {
+ $('#trIndex_' + row).addClass(color);
+ }
+ var resultAmount = parseInt($('#errorAmount' + row).html(), 10) + 1;
+ $('#errorAmount' + row).html(resultAmount);
+ $('#unconfirmedAmount' + row).val(errorAmount - errorCount);
+ //添加一个备注记录
+ addRemark(row, resultAmount);
+ }
+ }
+}
+
+//减少数量
+function reduce(row) {
+ var materialName = $('#materialName' + row).val();
+ var unconfirmedAmount = parseInt($('#unconfirmedAmount' + row).val(), 10);
+ var errorAmount = parseInt($('#errorAmount' + row).html(), 10);
+ if (materialName == '器械包标识牌' && !isEditIDCardError == 'false') {
+ return;
+ } else {
+ if (errorAmount > 0) {
+ if (errorAmount == 1) {
+ $('#trIndex_' + row).removeClass(color);
+ }
+ deleteRemark(row, errorAmount, unconfirmedAmount);
+ }
+ }
+}
+
+//关闭窗口
+function closeLayer() {
+ if (typeof (LAYER) != 'undefined') {
+ var layerIndex = LAYER.getFrameIndex();
+ if (layerIndex) {
+ LAYER.close(layerIndex);
+ return;
+ }
+ }
+
+ if (typeof parent.closeLayer == 'function') {
+ //统一到父窗口
+ parent.closeLayer();
+ } else if (parent.LAYER) {
+ //layer库1.4版本的
+ var index = parent.LAYER.getFrameIndex();
+ parent.LAYER.close(index);
+ } else if (parent.layer) {
+ //新版本的layer库
+ var index = parent.layer.getFrameIndex(window.name);
+ parent.layer.close(index);
+ }
+}
+
+//获取备注信息
+function getRemarkInfos(row, errorAmount) {
+ var result = [];
+ if ($('#errorRemark_' + row).val() !== '' || $('#id' + row).val() !== '') {
+ result = [{
+ materialDefinitionId: $('#materialDefinitionId' + row).val(),
+ tousseDefinitionId: tousseDefinitionID,
+ serialNumber: 1,
+ recyclingItemId: $('#recyclingItemId' + row).val(),
+ id: $('#id' + row).val(),
+ materialErrorDamageDetailId: $('#materialErrorDamageDetailId' + row).val(),
+ remarkInfo: $('#errorRemark_' + row).val()
+ }]
+ }
+ if (errorAmount > 1) {
+ for (var i = 2; i <= errorAmount; i++) {
+ if ($('#errorRemark_' + row + '_' + i).val() !== '' || $('#id' + row + '_' + i).val() !== '') {
+ result.push({
+ materialDefinitionId: $('#materialDefinitionId' + row + '_' + i).val(),
+ tousseDefinitionId: tousseDefinitionID,
+ serialNumber: i,
+ recyclingItemId: $('#recyclingItemId' + row + '_' + i).val(),
+ id: $('#id' + row + '_' + i).val(),
+ materialErrorDamageDetailId: $('#materialErrorDamageDetailId' + row + '_' + i).val(),
+ remarkInfo: $('#errorRemark_' + row + '_' + i).val()
+ })
+ }
+ }
+ }
+ return result
+}
+
+//保存
+function submit() {
+ var length = $("#recyclingErrorTable tbody tr").length;
+ var newJsonArray = [];
+ var amountSum = 0;
+ for (var i = 0; i < length; i++) {
+ var id = $("#recyclingErrorTable tbody tr").eq(i).attr('id');
+ if (id.split('_').length == 2) {
+ var serialNumber = 0;
+ if (row.split('_').length == 1) {
+ serialNumber = parseInt(row);
+ } else {
+ serialNumber = parseInt(row.split('_')[1]);
+ }
+ var indexs = id.split('_');
+ var errorAmount = $('#errorAmount' + indexs[1]).html();
+ var materialDefinitionId = $('#materialDefinitionId' + indexs[1]).val();
+ var tousseBarcode = $('#tousseBarcode' + indexs[1]).val();
+ var materialName = $('#materialName' + indexs[1]).val();
+ var detailId = $('#detailId' + indexs[1]).val();
+ var item = {
+ detailId: detailId,
+ tousseDefinitionID: tousseDefinitionID,
+ materialDefinitionId: materialDefinitionId,
+ lastTousseInstanceId: '',
+ itemType: itemType,
+ errorType: '缺失',
+ materialName: materialName,
+ tousseBarcode: tousseBarcode,
+ errorDamageQmKey: newErrorDamageQmKey,
+ amount: parseInt(errorAmount),
+ serialNumber: serialNumber,
+ materialRemark: getRemarkInfos(indexs[1], parseInt(errorAmount))
+ };
+
+ if (parseInt(errorAmount) > 0) {
+ amountSum++;
+ }
+
+ newJsonArray.push(item);
+ }
+ }
+ if (windowType == 'recyclingError') {
+ window.parent.setTousseItemRecyclingError(row, JSON.stringify(newJsonArray), amountSum);
+ } else {
+ window.parent.setTousseItemRecyclingDamage(row, JSON.stringify(newJsonArray), amountSum);
+ }
+ closeLayer();
+}
+
+// 获取丢失的材料信息,添加质量监测用
+function getMaterialMsg() {
+ var retArray = new Array();
+ var length = $("#recyclingErrorTable tbody tr").length;
+ for (var i = 0; i < length; i++) {
+ var amount = parseInt($('#errorAmount' + i).html());
+ var materialName = $('#sourceMaterialName' + i).val();
+ var errorType = $('#errorType' + i).val();
+ if (amount > 0) {
+ var item = {
+ materialName: materialName,
+ amount: amount,
+ errorType: errorType
+ };
+ retArray.push(item);
+ }
+ }
+ return retArray;
+}
+
+// 添加质量监测记录
+function addQM() {
+ var width = 780;
+ var height = 650;
+ var designedTousseWidth = 1080;
+ var designedTousseHeight = 770;
+ 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 = 1380;
+ height = 830;
+ }
+ var zoomRatio = calculateZoomRatio(designedWidth, designedHeight, actualWidth, actualHeight);
+ var size = calculateSizeAfterZoom(designedTousseWidth, designedTousseHeight, zoomRatio);
+
+ width = size.width;
+ height = size.height;
+ offsetTop = offsetTop * zoomRatio;
+ var mMsg = getMaterialMsg();
+ parent.setMaterialMsg(mMsg);
+ var url = 'addQualityMonitoring.jsp?resolution=' + resolution + '&width=' + width + '&height=' + height + '&errorDamageQmKey=' + newErrorDamageQmKey + '&tousseName=' + tousseName + '&depart=' + depart + '&recyclingUser=' + recyclingUser + '&circuitNurse=' + circuitNurse + '&operationRoom=' + operationRoom
+ var index = parent.layer.open({
+ type: 2,
+ title: ['添加质量监测记录', true],
+ content: encodeURI(url),
+ area: [width + 'px', height + heightExtra + 'px'],
+ border: [5, 0.3, '#fff', true],
+ closeBtn: [2, true],
+ offset: [offsetTop + 'px', '']
+ });
+ parent.setQmLayerIndex(index);
+}
+
+//打开材料图片
+function openMaterialImage(materialName, materialDefinitionId) {
+ $.ajax({
+ type: 'get',
+ url: WWWROOT + '/disinfectSystem/baseData/materialDefinitionAction!getMaterialPictureAmount.do',
+ data: 'name=' + encodeURIComponent(materialName),
+ dataType: 'text',
+ success: function (msg) {
+ var amount = parseInt(msg, 10);
+ var items = new Array();
+ if (amount <= 0) {
+ items.push({
+ src: 'tousseImage.jsp?materialName=' + encodeURIComponent(materialName) + '&materialDefinitionId=' + materialDefinitionId + "&number=" + 1,
+ type: 'iframe'
+ });
+ } else {
+ for (var i = 0; i < amount; i++) {
+ items.push({
+ src: 'tousseImage.jsp?materialName=' + encodeURIComponent(materialName) + '&materialDefinitionId=' + materialDefinitionId + "&number=" + (i + 1),
+ type: 'iframe'
+ });
+ }
+ }
+
+ window.parent.$.magnificPopup.open({
+ items: items,
+ mainClass: 'materialPicClass',
+ tClose: '关闭(Esc)',
+ gallery: {
+ enabled: true,
+ tPrev: '上一页 (左箭头)', // Alt text on left arrow
+ tNext: '下一页 (右箭头)'
+ },
+ image: {
+ verticalFit: true
+ },
+ type: 'image' // this is default type
+ });
+ }
+ });
+}
+
+//创建节点
+function buildTableTR(item) {
+ var amontPerTousse = item.amontPerTousse;
+ var materialDefinitionId = item.materialDefinitionId;
+ var materialName = item.materialName;
+ var totalCount = item.totalCount;
+ var errorCount = parseInt(item.errorCount || 0);
+ var tousseBarcode = item.tousseBarcode;
+ var unconfirmedAmount = parseInt(item.unconfirmedAmount || 0);
+ var detailId = item.detailId;
+ var materialRemarks = item.materialRemarks;
+
+ var i = $("#recyclingErrorTable tbody tr").length;
+ var sourceMaterialName = materialName;
+ if (tousseBarcode != "") {
+ materialName += "
" + tousseBarcode;
+ }
+
+ var resultAmount = errorCount + unconfirmedAmount;
+ var trColor = (resultAmount == 0) ? '' : color;
+ var html = '