Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/action/RecyclingApplicationAction.java =================================================================== diff -u -r15366 -r15426 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/action/RecyclingApplicationAction.java (.../RecyclingApplicationAction.java) (revision 15366) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/action/RecyclingApplicationAction.java (.../RecyclingApplicationAction.java) (revision 15426) @@ -926,25 +926,13 @@ if (InvoicePlan.TYPE_COMBO_FORM.equals(applicationFormType) || InvoicePlan.TYPE_RECYCLINGCREATE_APPLICATION.equals(applicationFormType)) { if ( TousseItem.TYPE_DIPOSABLE_GOODS.equals(tousseItem.getTousseType())){ - - - String name = key; - String specification = null; - if (name.lastIndexOf("[") != -1) { - specification = name.substring( - name.lastIndexOf("[") + 1, name.length() - 1); - name = name.substring(0, name.lastIndexOf("[")); - } - DisposableGoods disposableGoods = diposableGoodsManager - .getDisposableGoodsByName(name, specification); + // Long itemId = tousseItem.getId(); + // Integer itemAmount = tousseItem.getAmount(); + // DisposableGoods disposableGoods = diposableGoodsManager.getDisposableGoodsById(tousseItem.getTousseDefinitionId().toString()); + // JSONObject json = departmentAppTemplateManager.diposableItem2Json(itemId.toString(), itemAmount, disposableGoods, diposableFloatPercent); + // this.resetUnitAndCountAndRowPrice(tousseItem,json); + JSONObject json = this.getDiposableGoodMsg(tousseItem,diposableFloatPercent); - Long itemId = tousseItem.getId(); - Integer itemAmount = tousseItem.getAmount(); - - JSONObject json = departmentAppTemplateManager.diposableItem2Json(itemId.toString(), itemAmount, disposableGoods, diposableFloatPercent); - - this.resetUnitAndCountAndRowPrice(tousseItem,json); - // 设置是否已经终止的状态的checkbox boolean isTerminated = BooleanUtils.isTrue(tousseItem.getIsTerminated()); json.put("isTerminated", isTerminated); @@ -984,23 +972,12 @@ rightStoreJson.append(json.toString()); } else { - String name = key; - String specification = null; - if (name.lastIndexOf("[") != -1) { - specification = name.substring( - name.lastIndexOf("[") + 1, name.length() - 1); - name = name.substring(0, name.lastIndexOf("[")); - } - DisposableGoods disposableGoods = diposableGoodsManager - .getDisposableGoodsByName(name, specification); - - Long itemId = tousseItem.getId(); - Integer itemAmount = tousseItem.getAmount(); - - JSONObject json = departmentAppTemplateManager.diposableItem2Json(itemId.toString(), itemAmount, disposableGoods, diposableFloatPercent); - - this.resetUnitAndCountAndRowPrice(tousseItem,json); - + // Long itemId = tousseItem.getId(); + // Integer itemAmount = tousseItem.getAmount(); + // DisposableGoods disposableGoods = diposableGoodsManager.getDisposableGoodsById(tousseItem.getTousseDefinitionId().toString()); + // JSONObject json = departmentAppTemplateManager.diposableItem2Json(itemId.toString(), itemAmount, disposableGoods, diposableFloatPercent); + // this.resetUnitAndCountAndRowPrice(tousseItem,json); + JSONObject json = this.getDiposableGoodMsg(tousseItem,diposableFloatPercent); appendJsonString(rightStoreJson, json.toString()); } } @@ -1027,6 +1004,20 @@ setApplicationReaded(application, config); } + /** + * 获得对应的一次性物品信息 + * @param tousseItem + * @param diposableFloatPercent 浮动价格 + * @return json格式的一次性物品 + */ + private JSONObject getDiposableGoodMsg(TousseItem tousseItem,double diposableFloatPercent){ + Long itemId = tousseItem.getId(); + Integer itemAmount = tousseItem.getAmount(); + DisposableGoods disposableGoods = diposableGoodsManager.getDisposableGoodsById(tousseItem.getTousseDefinitionId().toString()); + JSONObject json = departmentAppTemplateManager.diposableItem2Json(itemId.toString(), itemAmount, disposableGoods, diposableFloatPercent); + this.resetUnitAndCountAndRowPrice(tousseItem,json); + return json; + } /** * 重新设置单位和数量和总价 Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManagerImpl.java =================================================================== diff -u -r15344 -r15426 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManagerImpl.java (.../RecyclingApplicationManagerImpl.java) (revision 15344) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManagerImpl.java (.../RecyclingApplicationManagerImpl.java) (revision 15426) @@ -2704,19 +2704,22 @@ } else { includeInvoiceItems = InvoicePlan.SIGNED_TRUE; tousseItem.setExpressRecycling(TousseDefinition.STR_NO); - JSONObject goodsNameAndSp = CssdUtils.getGoodsNameAndSp(tousseItem.getTousseName()); - String diposableName = goodsNameAndSp.optString("materialName"); - String sp = goodsNameAndSp.optString("specification");; - DisposableGoods diposableGoods = diposableGoodsManager.getDisposableGoodsByName(diposableName, sp); - Double price = diposableGoods.getReferencePrice(); - if (diposableGoods != null) { + // JSONObject goodsNameAndSp = CssdUtils.getGoodsNameAndSp(tousseItem.getTousseName()); + // String diposableName = goodsNameAndSp.optString("materialName"); + // String sp = goodsNameAndSp.optString("specification");; + // DisposableGoods diposableGoods = diposableGoodsManager.getDisposableGoodsByName(diposableName, sp); + //根据一次性物品的id来查找该一次性物品 + Long diposableGoodId = tousseItem.getTousseDefinitionId(); + DisposableGoods disposableGoods = diposableGoodsManager.getDisposableGoodsById(diposableGoodId.toString()); + if (disposableGoods != null) { + Double price = disposableGoods.getReferencePrice(); //price = MathTools.mul(price, dpf, 2); BigDecimal bg = MathTools.mul(price, dpf); price = bg == null ? 0.0 : bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); Double rowPrice = MathTools.mul(price,tousseItem.getEditAmount(),2).doubleValue(); tousseItem.setPrice(price); tousseItem.setRowPrice(rowPrice); - tousseItem.setDisposableGoodsId(diposableGoods.getId()); + tousseItem.setDisposableGoodsId(disposableGoods.getId()); } } }