Index: ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceManagerImpl.java =================================================================== diff -u -r41630 -r41636 --- ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceManagerImpl.java (.../InvoiceManagerImpl.java) (revision 41630) +++ ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceManagerImpl.java (.../InvoiceManagerImpl.java) (revision 41636) @@ -5646,12 +5646,19 @@ }else{ ps.setNull(18, Types.BIGINT); } - ps.setString(19, (String)map.get("chasItemControlTag")); + String chasItemControlTag = (String)map.get("chasItemControlTag"); + String chasOrgControlTag = (String)map.get("chasOrgControlTag"); + String chasPushResult = null; + if(StringUtils.equals(chasItemControlTag, Constants.STR_YES) + && StringUtils.equals(chasOrgControlTag, Constants.STR_YES)){ + chasPushResult = DiposableGoodsItem.CHAS_PUSH_RESULT_WAITE_PUSH; + } + ps.setString(19, chasItemControlTag); ps.setString(20, (String)map.get("chasChargeItemSerialNumber")); - ps.setString(21, (String)map.get("chasOrgControlTag")); + ps.setString(21, chasOrgControlTag); ps.setString(22, (String)map.get("chasDeptCode")); ps.setString(23, (String)map.get("chasDeptName")); - ps.setString(24, DiposableGoodsItem.CHAS_PUSH_RESULT_WAITE_PUSH); + ps.setString(24, chasPushResult); } @Override @@ -7173,6 +7180,10 @@ diposableGoodsItem.setChasDeptCode(departObj.getChasDeptCode()); diposableGoodsItem.setChasDeptName(departObj.getChasDeptName()); } + if(StringUtils.equals(diposableGoodsItem.getChasItemControlTag(), Constants.STR_YES) + && StringUtils.equals(diposableGoodsItem.getChasOrgControlTag(), Constants.STR_YES)){ + diposableGoodsItem.setChasPushResult(DiposableGoodsItem.CHAS_PUSH_RESULT_WAITE_PUSH); + } diposableGoodsItem.setInvoice(invoice);// 和发货单关联 diposableGoodsItem .setInvoiceItemID(invoiceItem.getId());// 明细汇总关联 Index: ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/service/DiposableGoodsManagerImpl.java =================================================================== diff -u -r41630 -r41636 --- ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/service/DiposableGoodsManagerImpl.java (.../DiposableGoodsManagerImpl.java) (revision 41630) +++ ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/service/DiposableGoodsManagerImpl.java (.../DiposableGoodsManagerImpl.java) (revision 41636) @@ -4180,20 +4180,32 @@ throw new RuntimeException("chasDisposableGoodsPushDao为null,无法推送chas管控的一次性物品发货信息"); } if(chasDisposableGoodsDtos == null || chasDisposableGoodsDtos.length == 0){ - return; + throw new RuntimeException("请选择需要推送的信息!"); } + + List invoiceChasDisposableGoodsDtoList = new ArrayList(); + List returnChasDisposableGoodsDtoList = new ArrayList(); + for (ChasDisposableGoodsDto chasDisposableGoodsDto : chasDisposableGoodsDtos) { + if(StringUtils.equals(chasDisposableGoodsDto.getType(), ChasDisposableGoodsDto.TYPE_INVOICE)){ + invoiceChasDisposableGoodsDtoList.add(chasDisposableGoodsDto); + }else if(StringUtils.equals(chasDisposableGoodsDto.getType(), ChasDisposableGoodsDto.TYPE_RETURN)){ + returnChasDisposableGoodsDtoList.add(chasDisposableGoodsDto); + }else{ + throw new RuntimeException("只支持推送发货单及退货单!"); + } + } //推送chas一次性物品发货信息 - pushInvoiceChasDisposableGoodsInfo(chasDisposableGoodsDtos); + pushInvoiceChasDisposableGoodsInfo(invoiceChasDisposableGoodsDtoList); //推送chas一次性物品退货信息 - pushReturnChasDisposableGoodsInfo(chasDisposableGoodsDtos); + pushReturnChasDisposableGoodsInfo(returnChasDisposableGoodsDtoList); } /** * 推送chas一次性物品退货信息 * @param chasDisposableGoodsDtos */ - private void pushReturnChasDisposableGoodsInfo(ChasDisposableGoodsDto[] chasDisposableGoodsDtos) { - if(chasDisposableGoodsDtos == null || chasDisposableGoodsDtos.length == 0){ + private void pushReturnChasDisposableGoodsInfo(List chasDisposableGoodsDtos) { + if(CollectionUtils.isEmpty(chasDisposableGoodsDtos)){ return; } List invoiceDiposableGoodsItemList = new ArrayList(); @@ -4210,22 +4222,18 @@ List diposableGoodsItemList = objectDao.findByHql(hql); if(CollectionUtils.isNotEmpty(diposableGoodsItemList)){ for (DiposableGoodsItem diposableGoodsItem : diposableGoodsItemList) { - if(StringUtils.equals(diposableGoodsItem.getChasPushResult(), DiposableGoodsItem.CHAS_PUSH_RESULT_PUSH_FAIL) - || StringUtils.equals(diposableGoodsItem.getChasPushResult(), DiposableGoodsItem.CHAS_PUSH_RESULT_WAITE_PUSH)){ - if(StringUtils.isBlank(chasDisposableGoodsDto.getBatchNumber()) && StringUtils.isBlank(diposableGoodsItem.getBatch())){ - invoiceDiposableGoodsItemList.add(diposableGoodsItem); - }else if(StringUtils.equals(chasDisposableGoodsDto.getBatchNumber(), diposableGoodsItem.getBatch())){ - invoiceDiposableGoodsItemList.add(diposableGoodsItem); - } + if(StringUtils.isBlank(chasDisposableGoodsDto.getBatchNumber()) && StringUtils.isBlank(diposableGoodsItem.getBatch())){ + invoiceDiposableGoodsItemList.add(diposableGoodsItem); + }else if(StringUtils.equals(chasDisposableGoodsDto.getBatchNumber(), diposableGoodsItem.getBatch())){ + invoiceDiposableGoodsItemList.add(diposableGoodsItem); } } } } } - if(CollectionUtils.isEmpty(invoiceDiposableGoodsItemList)){ - return; - } + //校验一次性物品明细是否允许推送 + validateDiposableGoodsItem(invoiceDiposableGoodsItemList); chasDisposableGoodsPushDao.pushDiposableGoodsItemReturnInfo(invoiceDiposableGoodsItemList); } @@ -4234,8 +4242,8 @@ * 推送chas一次性物品发货信息 * @param chasDisposableGoodsDtos */ - private void pushInvoiceChasDisposableGoodsInfo(ChasDisposableGoodsDto[] chasDisposableGoodsDtos) { - if(chasDisposableGoodsDtos == null || chasDisposableGoodsDtos.length == 0){ + private void pushInvoiceChasDisposableGoodsInfo(List chasDisposableGoodsDtos) { + if(CollectionUtils.isEmpty(chasDisposableGoodsDtos)){ return; } List invoiceDiposableGoodsItemList = new ArrayList(); @@ -4252,19 +4260,40 @@ List diposableGoodsItemList = objectDao.findByHql(hql); if(CollectionUtils.isNotEmpty(diposableGoodsItemList)){ for (DiposableGoodsItem diposableGoodsItem : diposableGoodsItemList) { - if(StringUtils.equals(diposableGoodsItem.getChasPushResult(), DiposableGoodsItem.CHAS_PUSH_RESULT_PUSH_FAIL) - || StringUtils.equals(diposableGoodsItem.getChasPushResult(), DiposableGoodsItem.CHAS_PUSH_RESULT_WAITE_PUSH)){ - if(StringUtils.isBlank(chasDisposableGoodsDto.getBatchNumber()) && StringUtils.isBlank(diposableGoodsItem.getBatch())){ - invoiceDiposableGoodsItemList.add(diposableGoodsItem); - }else if(StringUtils.equals(chasDisposableGoodsDto.getBatchNumber(), diposableGoodsItem.getBatch())){ - invoiceDiposableGoodsItemList.add(diposableGoodsItem); - } + if(StringUtils.isBlank(chasDisposableGoodsDto.getBatchNumber()) && StringUtils.isBlank(diposableGoodsItem.getBatch())){ + invoiceDiposableGoodsItemList.add(diposableGoodsItem); + }else if(StringUtils.equals(chasDisposableGoodsDto.getBatchNumber(), diposableGoodsItem.getBatch())){ + invoiceDiposableGoodsItemList.add(diposableGoodsItem); } } } } } + //校验一次性物品明细是否允许推送 + validateDiposableGoodsItem(invoiceDiposableGoodsItemList); chasDisposableGoodsPushDao.pushDiposableGoodsItemInvoiceInfo(invoiceDiposableGoodsItemList); } + /** + * 校验一次性物品明细是否允许推送: + * 推送结果为:失败或者待推送; + * CHAS标记物品为是,CHAS标记科室为是; + * @param invoiceDiposableGoodsItemList 一次性物品明细 + */ + private void validateDiposableGoodsItem(List invoiceDiposableGoodsItemList) { + if(CollectionUtils.isEmpty(invoiceDiposableGoodsItemList)){ + throw new RuntimeException("请选择待推送物品"); + } + for (DiposableGoodsItem diposableGoodsItem : invoiceDiposableGoodsItemList) { + if(!StringUtils.equals(diposableGoodsItem.getChasPushResult(), DiposableGoodsItem.CHAS_PUSH_RESULT_PUSH_FAIL) + && !StringUtils.equals(diposableGoodsItem.getChasPushResult(), DiposableGoodsItem.CHAS_PUSH_RESULT_WAITE_PUSH)){ + throw new RuntimeException("请选择推送失败或者未推送的记录!"); + } + if(!StringUtils.equals(diposableGoodsItem.getChasItemControlTag(), Constants.STR_YES) + || !StringUtils.equals(diposableGoodsItem.getChasItemControlTag(), Constants.STR_YES)){ + throw new RuntimeException("请选择CHAS标记物品为是,并且CHAS标记科室为是的记录!"); + } + } + } + } Index: ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceOptimizeManagerImpl.java =================================================================== diff -u -r41630 -r41636 --- ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceOptimizeManagerImpl.java (.../InvoiceOptimizeManagerImpl.java) (revision 41630) +++ ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceOptimizeManagerImpl.java (.../InvoiceOptimizeManagerImpl.java) (revision 41636) @@ -6385,12 +6385,19 @@ }else{ ps.setNull(18, Types.BIGINT); } - ps.setString(19, (String)map.get("chasItemControlTag")); + String chasItemControlTag = (String)map.get("chasItemControlTag"); + String chasOrgControlTag = (String)map.get("chasOrgControlTag"); + String chasPushResult = null; + if(StringUtils.equals(chasItemControlTag, Constants.STR_YES) + && StringUtils.equals(chasOrgControlTag, Constants.STR_YES)){ + chasPushResult = DiposableGoodsItem.CHAS_PUSH_RESULT_WAITE_PUSH; + } + ps.setString(19, chasItemControlTag); ps.setString(20, (String)map.get("chasChargeItemSerialNumber")); - ps.setString(21, (String)map.get("chasOrgControlTag")); + ps.setString(21, chasOrgControlTag); ps.setString(22, (String)map.get("chasDeptCode")); ps.setString(23, (String)map.get("chasDeptName")); - ps.setString(24, DiposableGoodsItem.CHAS_PUSH_RESULT_WAITE_PUSH); + ps.setString(24, chasPushResult); } @Override @@ -8725,12 +8732,19 @@ }else{ ps.setNull(18, Types.BIGINT); } - ps.setString(19, (String)map.get("chasItemControlTag")); + String chasItemControlTag = (String)map.get("chasItemControlTag"); + String chasOrgControlTag = (String)map.get("chasOrgControlTag"); + String chasPushResult = null; + if(StringUtils.equals(chasItemControlTag, Constants.STR_YES) + && StringUtils.equals(chasOrgControlTag, Constants.STR_YES)){ + chasPushResult = DiposableGoodsItem.CHAS_PUSH_RESULT_WAITE_PUSH; + } + ps.setString(19, chasItemControlTag); ps.setString(20, (String)map.get("chasChargeItemSerialNumber")); - ps.setString(21, (String)map.get("chasOrgControlTag")); + ps.setString(21, chasOrgControlTag); ps.setString(22, (String)map.get("chasDeptCode")); ps.setString(23, (String)map.get("chasDeptName")); - ps.setString(24, DiposableGoodsItem.CHAS_PUSH_RESULT_WAITE_PUSH); + ps.setString(24, chasPushResult); } @Override