Index: ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/action/RecyclingRecordAction.java =================================================================== diff -u -r13549 -r13553 --- ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/action/RecyclingRecordAction.java (.../RecyclingRecordAction.java) (revision 13549) +++ ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/action/RecyclingRecordAction.java (.../RecyclingRecordAction.java) (revision 13553) @@ -17,7 +17,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; import net.sf.json.JSONArray; import net.sf.json.JSONObject; @@ -28,7 +27,6 @@ import org.apache.commons.collections4.map.HashedMap; import org.apache.commons.collections4.map.MultiValueMap; import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.math.NumberUtils; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Namespace; import org.apache.struts2.convention.annotation.ParentPackage; @@ -62,7 +60,6 @@ import com.forgon.disinfectsystem.entity.recyclingerror.RecyclingError; import com.forgon.disinfectsystem.entity.recyclingrecord.RecyclingRecord; import com.forgon.disinfectsystem.entity.tousseitem.TousseItem; -import com.forgon.disinfectsystem.exception.RecyclingRecordException; import com.forgon.disinfectsystem.idcarddefinition.service.IDCardDefinitionManager; import com.forgon.disinfectsystem.idcardinstance.util.IDCardInstanceUtils; import com.forgon.disinfectsystem.recyclingapplication.service.InvoicePlanManager; @@ -75,9 +72,7 @@ import com.forgon.disinfectsystem.recyclingrecord.vo.RecyclingDetailItemVo; import com.forgon.disinfectsystem.recyclingrecord.vo.RecyclingDetailVo; import com.forgon.disinfectsystem.tousse.toussedefinition.service.TousseDefinitionManager; -import com.forgon.disinfectsystem.tousseitem.service.TousseItemManager; import com.forgon.security.model.User; -import com.forgon.tools.AppKeys; import com.forgon.tools.MathTools; import com.forgon.tools.SqlBuilder; import com.forgon.tools.StrutsParamUtils; @@ -120,8 +115,6 @@ private TousseDefinitionManager tousseDefinitionManager; - private TousseItemManager tousseItemManager; - private OrgUnitManager orgUnitManager; private SupplyRoomConfigManager supplyRoomConfigManager; @@ -171,10 +164,6 @@ this.tousseDefinitionManager = tousseDefinitionManager; } - public void setTousseItemManager(TousseItemManager tousseItemManager) { - this.tousseItemManager = tousseItemManager; - } - public void setOrgUnitManager(OrgUnitManager orgUnitManager) { this.orgUnitManager = orgUnitManager; } @@ -375,87 +364,61 @@ } - public String saveRecyclingRecord() { - HttpServletResponse response = StrutsParamUtils.getResponse(); - response.setCharacterEncoding("UTF-8"); - PrintWriter out = null; - try { - out = response.getWriter(); - } catch (IOException e2) {} + public void saveRecyclingRecord() { HttpServletRequest request = StrutsParamUtils.getRequest(); + String paramStr = StrutsParamUtils.getPraramValue("jsonParam", ""); + JSONObject params = JSONObject.fromObject(paramStr); + boolean confirmRecord = params.optBoolean("confirmation") ? true : false; - boolean isThisConfirmationForTheRecord = "true".equals(request - .getParameter("isThisConfirmationForTheRecord")) ? true : false; - - String message = isThisConfirmationForTheRecord ? "确认成功" : "保存成功"; -// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + boolean success = true; + String message = confirmRecord ? "确认成功" : "保存成功"; try { // 设置回收时间 - recyclingRecord.setRecyclingTime(Constants.SIMPLEDATEFORMAT_YYYYMMDDHHMM.parse(StrutsParamUtils - .getPraramValue("recyclingTime", - Constants.SIMPLEDATEFORMAT_YYYYMMDDHHMM.format(new Date())))); + String recyclingTime = StrutsParamUtils.getPraramValue("recyclingTime",null); + if(StringUtils.isBlank(recyclingTime)){ + recyclingRecord.setRecyclingTime(new Date()); + }else{ + recyclingRecord.setRecyclingTime(Constants.SIMPLEDATEFORMAT_YYYYMMDDHHMM.parse(recyclingTime)); + } } catch (ParseException e1) { e1.printStackTrace(); } recyclingRecord.setOrgUnitCoding(AcegiHelper.getLoginUser() .getOrgUnitCodingFromSupplyRoomConfig()); - RecyclingApplication recyclingApplication = recyclingRecord.getRecyclingApplication(); - if(recyclingApplication == null){ - String recyclingApplicationId = request - .getParameter("recyclingApplicationId"); - recyclingApplication = recyclingApplicationManager - .getRecyclingApplicationById(recyclingApplicationId); - recyclingRecord.setRecyclingApplication(recyclingApplication); + RecyclingApplication application = recyclingRecord + .getRecyclingApplication(); + if (application == null) { + String app_id = request.getParameter("recyclingApplicationId"); + application = recyclingApplicationManager + .getRecyclingApplicationById(app_id); + recyclingRecord.setRecyclingApplication(application); } - // 一条回收记录只能有一个对应的回收申请单/器械包申请单 - if (recyclingRecord.getId() == null && recyclingApplication != null - && recyclingApplication.getRecyclingRecord(objectDao) != null) { - message = "当前申请单已回收,不能重复回收!"; - setRedirectMsg(request, message); - return "success"; - } - if (StringUtils.isBlank(recyclingRecord.getRecyclingUser())) { - // 如果回收人员为空,则把操作人员设置到回收人员里面 recyclingRecord.setRecyclingUser(recyclingRecord .getOperator()); } - - recyclingRecord.setStatus(RecyclingRecord.STATUS_SAVED); - String paramStr = StrutsParamUtils.getPraramValue("jsonParam", ""); -// System.out.println("---------》" + paramStr); - JSONObject params = JSONObject.fromObject(paramStr); + // 一条回收记录只能有一个对应的回收申请单/器械包申请单 + if (recyclingRecord.getId() == null && application != null + && application.getRecyclingRecord(objectDao) != null) { + message = "当前申请单已回收,不能重复回收!"; + }else{ + try { + recyclingRecordManager.saveOrUpdate(recyclingRecord,params); + } catch (Exception e) { + success = false; + message = e.getMessage(); + } + } + HttpServletResponse response = StrutsParamUtils.getResponse(); + response.setCharacterEncoding("UTF-8"); try { - recyclingRecordManager.saveOrUpdate(recyclingRecord,params); - } catch (Exception e) { - message = e.getMessage(); + PrintWriter out = response.getWriter();; + out.print("{\"success\":" + success + ",\"message\":\"" + message + "\"}"); + } catch (IOException e2) { } - - if (StringUtils.equals("true", - request.getParameter("isThisTouchScreen"))) { - setRedirectMsg(request, message); - return "success"; - } else { - out.print("{success:true,message:'" + message + "'}"); - out.close(); - } - return null; } - private void setRedirectMsg(HttpServletRequest request, String message) { - HttpSession session = request.getSession(); - session.setAttribute("recyclingUser", - recyclingRecord.getRecyclingUser()); - - request.setAttribute(AppKeys.TipMsgKey, message); - request.setAttribute( - AppKeys.RedirectTo, - request.getContextPath() - + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=" - + request.getParameter("resolution")+"&msg="+message); - } - /** * 加载未清洗的篮筐内容 */ @@ -1277,102 +1240,6 @@ return null; } - /** - * 根据器械包实例Id找出该器械包定义里的再生材料和已经回收的材料数量 - * - * @return - */ - public String getRecyclingErrorByTousseInstanceId() { - String tousseItemId = StrutsParamUtils.getPraramValue("tousseItemId", - ""); - if (StringUtils.isNotBlank(tousseItemId) - || StringUtils.isBlank(StrutsParamUtils.getPraramValue( - "tousseCount", ""))) { - TousseItem tousseItem = tousseItemManager - .getTousseItemById(tousseItemId); - List recyclingErrors = tousseItem - .getRecyclingErrors(); - String name = tousseItem.getTousseName(); - Integer tousseCount = Integer.parseInt(StrutsParamUtils - .getPraramValue("tousseCount", "")); - String jsonStr = ""; - HttpServletResponse response = StrutsParamUtils.getResponse(); - TousseDefinition tousseDefinition = tousseDefinitionManager - .getTousseDefinitionByName(name); - List materialInstances = tousseDefinition - .getMaterialInstances(); - List idCardDefinitions = tousseDefinition.getIDCardDefinitions(objectDao); - if (idCardDefinitions != null - && idCardDefinitions.size() > 0) { - for (IDCardDefinition idCardDefinition : idCardDefinitions) { - if (NumberUtils.INTEGER_ZERO.equals(idCardDefinition - .getDeleted())) { - MaterialInstance instance = new MaterialInstance(); - instance.setMaterialName(MaterialInstance.MATERIAL_NAME_IDCARD); - instance.setCount(1); - materialInstances.add(instance); - break; - } - } - } - List recyclingErrorVos = new ArrayList(); - for (MaterialInstance materialInstance : materialInstances) { - /* - * materialInstance.getMaterialDefinition().getName() - * 修改为materialInstance.getMaterialName() - */ - // 名称后面加规格 - String materialName = materialInstance.getMaterialName(); - if (materialInstance.getMaterialDefinition() != null) { - String specification = materialInstance - .getMaterialDefinition().getSpecification(); - if (StringUtils.isNotBlank(specification)) { - materialName += "[" + specification + "]"; - } - } - RecyclingError recyclingError = getFormListByName( - recyclingErrors, materialName); - if (recyclingError != null) { - RecyclingErrorVo recyclingErrorVo = new RecyclingErrorVo(); - recyclingErrorVo.setId(recyclingError.getId()); - recyclingErrorVo.setErrorCount(recyclingError.getAmount()); - recyclingErrorVo - .setErrorType(recyclingError.getErrorType()); - recyclingErrorVo.setName(recyclingError.getMaterialName()); - recyclingErrorVo.setTotalCount(tousseCount - * materialInstance.getCount()); - recyclingErrorVo.setAmontPerTousse(materialInstance - .getCount()); - recyclingErrorVo.setTousseName(name); - recyclingErrorVos.add(recyclingErrorVo); - } else { - RecyclingErrorVo recyclingErrorVo = new RecyclingErrorVo(); - recyclingErrorVo.setErrorCount(0); - recyclingErrorVo - .setErrorType(RecyclingError.ERRORTYPE_REDUCE); - recyclingErrorVo - .setName(materialInstance.getMaterialName()); - recyclingErrorVo.setTotalCount(tousseCount - * materialInstance.getCount()); - recyclingErrorVo.setAmontPerTousse(materialInstance - .getCount()); - recyclingErrorVo.setTousseName(name); - recyclingErrorVos.add(recyclingErrorVo); - } - } - JSONArray jsonArray = JSONArray.fromObject(recyclingErrorVos); - jsonStr = jsonArray.toString(); - try { - response.setCharacterEncoding("UTF-8"); - response.getWriter().print(jsonStr); - response.getWriter().close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - return null; - } - public void loadTousseInstanceInfo() { String barcode = StrutsParamUtils.getPraramValue("barcode", ""); String message = null; @@ -1563,17 +1430,6 @@ } } - private RecyclingError getFormListByName( - List recyclingErrors, String name) { - RecyclingError retRecyclingError = null; - for (RecyclingError recyclingError : recyclingErrors) { - if (name.equals(recyclingError.getMaterialName())) { - retRecyclingError = recyclingError; - } - } - return retRecyclingError; - } - @Override public void prepare() { String id = StrutsParamUtils.getPraramValue("id", ""); Index: ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recycleForTouchScreen.js =================================================================== diff -u -r13549 -r13553 --- ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recycleForTouchScreen.js (.../recycleForTouchScreen.js) (revision 13549) +++ ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recycleForTouchScreen.js (.../recycleForTouchScreen.js) (revision 13553) @@ -1519,9 +1519,6 @@ var isThereTousseItems = false; var isAllTousseInTheBasket = true; var isThereRecycleAmountEmpty = false; - var isIdentificationCardErrorMissingMsg = null; - var tousseItemsInfo = null; - if($('#depart').val()== ''){ alertDiv('请先扫描科室条码。'); return false; @@ -1542,14 +1539,6 @@ $('#tousseItemTable').children().first().children().each(function(index,element){ if($('#deleted'+index).val() == '0'){ isThereTousseItems = true; - if(tousseItemsInfo == null){ - tousseItemsInfo = $('#tousseItemId'+index).val(); - }else{ - tousseItemsInfo += ';' + $('#tousseItemId'+index).val(); - } - tousseItemsInfo += ',' + $('#tousseName'+index).val(); - tousseItemsInfo += ',' + $('#recycleAmount'+index).val(); - tousseItemsInfo += ',' + $('#barcodes'+index).val(); var tousseType = $('#tousseType'+index).val(); if($('#recycleAmount'+index).val() == '' || parseInt($('#recycleAmount'+index).val(),10) == 0){ isThereRecycleAmountEmpty = true; @@ -1562,7 +1551,6 @@ } } }); - $('#tousseInstanceIds').val(tousseItemsInfo); if(isThereRecycleAmountEmpty){ alertDiv('回收数量不能为空。'); @@ -1573,97 +1561,82 @@ alertDiv('还有部分器械包未装入容器,不能保存。'); return false; } - - if(isIdentificationCardErrorMissingMsg != null){ - alertDiv(isIdentificationCardErrorMissingMsg); - return false; - } - - - /**/ - //验证是否所有材料放入篮筐 - var isAllMaterialInBasket = true; - $('td[axis="materialName"]').each(function(){ - if(parseInt($(this).next().next().text(),10) > 0){ - isAllMaterialInBasket = false; - return false; - } - }); - if(!isAllMaterialInBasket){ - alertDiv('还有部分材料未装入容器,不能保存。'); - return false; - } return true; } +function getJsonParams(confirmation){ + var paramJson = {}; + paramJson.tousseJson = tousseArray; + paramJson.delToussItems = deleteTousseItemArray; + paramJson.errors = getRecyclingErrors(); + paramJson.damages = getRecyclingDamages(); + paramJson.confirmation = confirmation; + return JSON.stringify(paramJson); +} -var btSave=false; -function doSaveAction(){ +function submitFunction(confirmation,saveAndNew){ if(submitCheck()){ alertDiv("保存中,请稍候......", true); - setJsonParams(false); - - if (btSave){ - return false; - } else { - btSave=true; - var formObj = document.getElementById('recyclingRecordForm'); - if(formObj != null){ - formObj.submit(); - } else { - btSave=false; - } - } - } -} -function doSaveAndNewAction(){ - if(submitCheck()){ + var jsonStr = getJsonParams(confirmation); + var id = document.getElementById('id').value; + var app_id = document.getElementById('recyclingApplicationId').value; + var departCode = document.getElementById('departCode').value; + var recyclingUser = document.getElementById('recyclingUser').value; + var operator = document.getElementById('operator').value; + var depart = document.getElementById('depart').value; + var recyclingTime = document.getElementById('recyclingTime').value; - setJsonParams(false); - - if (btSave){ - return false; - } else { - btSave=true; - var formObj = document.getElementById('recyclingRecordForm'); - if(formObj != null){ - formObj.submit(); - } else { - btSave=false; + $.ajax({ + url : WWWROOT + "/disinfectSystem/recyclingRecordAction!saveRecyclingRecord.do", + type : "POST", + timeout : 300000, + dataType :'json', + data : { + jsonParam : "" + jsonStr + "", + id : id, + recyclingApplicationId : app_id, + departCode : departCode, + recyclingUser : recyclingUser, + operator : operator, + depart : depart, + recyclingTime : recyclingTime + }, + success : function(result) { + if(result.success){ + alertDiv(result.message, true); + setTimeout("closeDiv()",1200); + + if(saveAndNew){ + location.href = "recycleForTouchScreen.jsp?resolution=" + resolution; + }else{ + location.href = "awaitForRecycleList.jsp?resolution=" + resolution; + } + }else{ + alertDiv(result.message); + } + }, + error: function(x, t, m) { + if(t == "timeout") { + alert("提交超时,请重试"); + } else { + alert(t); + } } - } + }); } } -function setJsonParams(confirmation){ - var paramJson = {}; - paramJson.tousseJson = tousseArray; - paramJson.delToussItems = deleteTousseItemArray; - paramJson.errors = getRecyclingErrors(); - paramJson.damages = getRecyclingDamages(); - paramJson.confirmation = confirmation; - var paramStr = JSON.stringify(paramJson); - $('#jsonParam').val(paramStr); +function doSaveAction(){ + submitFunction(false,false); } +function doSaveAndNewAction(){ + submitFunction(false,true); +} + function doConfirmAction(){ - if(submitCheck()){ - - setJsonParams(true); - - if (btSave){ - return false; - } else { - btSave=true; - var formObj = document.getElementById('recyclingRecordForm'); - if(formObj != null){ - formObj.submit(); - } else { - btSave=false; - } - } - } + submitFunction(true,false); } function end(){ Index: ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp =================================================================== diff -u -r13508 -r13553 --- ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp (.../awaitForRecycleList.jsp) (revision 13508) +++ ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp (.../awaitForRecycleList.jsp) (revision 13553) @@ -991,16 +991,5 @@
- - Index: ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recycleForTouchScreen.jsp =================================================================== diff -u -r13317 -r13553 --- ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recycleForTouchScreen.jsp (.../recycleForTouchScreen.jsp) (revision 13317) +++ ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recycleForTouchScreen.jsp (.../recycleForTouchScreen.jsp) (revision 13553) @@ -122,14 +122,9 @@
- - - - -
onclick='openSelectDepart();' />