Index: ssts-web/src/main/webapp/disinfectsystem/config/gdszyy/spring/disposableGoodsChas.xml =================================================================== diff -u -r41625 -r41645 --- ssts-web/src/main/webapp/disinfectsystem/config/gdszyy/spring/disposableGoodsChas.xml (.../disposableGoodsChas.xml) (revision 41625) +++ ssts-web/src/main/webapp/disinfectsystem/config/gdszyy/spring/disposableGoodsChas.xml (.../disposableGoodsChas.xml) (revision 41645) @@ -42,6 +42,8 @@ - + + + \ No newline at end of file Index: ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceOptimizeManagerImpl.java =================================================================== diff -u -r41636 -r41645 --- ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceOptimizeManagerImpl.java (.../InvoiceOptimizeManagerImpl.java) (revision 41636) +++ ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceOptimizeManagerImpl.java (.../InvoiceOptimizeManagerImpl.java) (revision 41645) @@ -5456,6 +5456,8 @@ new LinkedHashMap>>(); //申请单对应发货单的map(单次发货时,一个申请单对应一个发货单) Map invoicePlanToInvoiceMap = new LinkedHashMap(); + //查询发货单的结算科室map + Map invoiceSettleAccountsDepartMap = getInvoiceSettleAccountsDepartMap(invoiceList); for (Invoice invoice : invoiceList) { InvoicePlan invoicePlan = invoice.getInvoicePlan(); invoicePlanToInvoiceMap.put(invoicePlan, invoice); @@ -5852,7 +5854,7 @@ batchUpdateDisposableGoodsStockTableData(invoiceToInvoiceItemListMap, idToDisposableGoodsMap,idToDisposableGoodsBatchMap, tousseItemToBatchIdToEdgListMapMap,tousseItemToIdentiToAmountMapMap, - params,orgUnit,targetWarehouse, idColumnName,idColumnValue, disposableGoodsStorageAdjustVoTotalList); + params,orgUnit,targetWarehouse, idColumnName,idColumnValue, disposableGoodsStorageAdjustVoTotalList, invoiceSettleAccountsDepartMap); //批量增加收货科室(即供应室)的库存数量(如果收货科室的仓库没有相关的库存对象,则新插入相关的库存的表数据) /*batchUpdateDisposableGoodsStockTableData(true,invoiceToInvoiceItemListMap, @@ -5952,6 +5954,30 @@ } /** + * 查询发货单结算科室的map + * @param invoiceList 发货单 + * @return 发货单结算科室的map + */ + private Map getInvoiceSettleAccountsDepartMap(Collection invoiceList) { + Map invoiceSettleAccountsDepartMap = new HashMap(); + if(CollectionUtils.isEmpty(invoiceList)){ + return invoiceSettleAccountsDepartMap; + } + Set orgUnitCodeSet = new HashSet(); + for (Invoice invoice : invoiceList) { + orgUnitCodeSet.add(invoice.getSettleAccountsDepartCoding()); + } + List settleAccountsDepartList = orgUnitManager.getByCodes(orgUnitCodeSet); + if(CollectionUtils.isEmpty(settleAccountsDepartList)){ + return invoiceSettleAccountsDepartMap; + } + for (OrgUnit orgUnit : settleAccountsDepartList) { + invoiceSettleAccountsDepartMap.put(orgUnit.getOrgUnitCoding(), orgUnit); + } + return invoiceSettleAccountsDepartMap; + } + + /** * 构造高值材料的发货项map,用于高值材料发货及器械包实例发货时扣减包内的高值耗材时的两个场景调用 * @param invoice 发货单 * @param tousseItem 申请项 @@ -6140,7 +6166,7 @@ List sourceStockList,List sourceBatchStockList, List targetStockList,List targetBatchStockList, List targetIdentificationList,String idColumnName,String idColumnValue, - List disposableGoodsStorageAdjustVoTotalList){ + List disposableGoodsStorageAdjustVoTotalList, Map invoiceSettleAccountsDepartMap){ if(MapUtils.isEmpty(tousseItemToBatchIdToEdgListMapMap) && MapUtils.isEmpty(tousseItemToIdentiToAmountMapMap)){ return; @@ -6268,7 +6294,7 @@ } Map map = buildDiposableGoodsItemMapForNotExpensiveDisposableGoods(invoice, invoiceItem, null, identi, batch, sourceBatchIdToDisposableGoodsBatchStockMap, sourceDgIdToDisposableGoodsStockMap, - ancestorIdToIdentificationMap, identiToAmountEntry, InvoiceItem.TYPE_APPLICATION, disposableGoodsStorageAdjustVoTotalList); + ancestorIdToIdentificationMap, identiToAmountEntry, InvoiceItem.TYPE_APPLICATION, disposableGoodsStorageAdjustVoTotalList, invoiceSettleAccountsDepartMap); /* map.put("amount", identiToAmountEntry.getValue()); map.put("barcode", batch.getBarcode()); map.put("batch", batch.getBatchNumber()); @@ -6474,7 +6500,7 @@ private Map buildDiposableGoodsItemMapForNotExpensiveDisposableGoods(Invoice invoice, InvoiceItem invoiceItem,String invoiceItemUUID, DisposableGoodsIdentification identi,DisposableGoodsBatch batch,Map sourceBatchIdToDisposableGoodsBatchStockMap, Map sourceDgIdToDisposableGoodsStockMap,Map ancestorIdToIdentificationMap, - Entry identiToAmountEntry,String invoiceItemType,List disposableGoodsStorageAdjustVoTotalList){ + Entry identiToAmountEntry,String invoiceItemType,List disposableGoodsStorageAdjustVoTotalList, Map invoiceSettleAccountsDepartMap){ Map map = new LinkedHashMap(); Long batchId = batch.getId(); Long dgId = batch.getDiposableGoods().getId(); @@ -6504,11 +6530,13 @@ //chas管控相关字段GDSZYY-270 map.put("chasItemControlTag", batch.getDiposableGoods().getControlTagCHAS()); map.put("chasChargeItemSerialNumber", batch.getDiposableGoods().getChargeItemSerialNumber()); - OrgUnit settleAccountsDepart = orgUnitManager.getByCode(invoice.getSettleAccountsDepartCoding()); - if(settleAccountsDepart != null){ - map.put("chasOrgControlTag", settleAccountsDepart.getChasControlTag()); - map.put("chasDeptCode", settleAccountsDepart.getChasDeptCode()); - map.put("chasDeptName", settleAccountsDepart.getChasDeptName()); + if(invoiceSettleAccountsDepartMap != null){ + OrgUnit settleAccountsDepart = invoiceSettleAccountsDepartMap.get(invoice.getSettleAccountsDepartCoding()); + if(settleAccountsDepart != null){ + map.put("chasOrgControlTag", settleAccountsDepart.getChasControlTag()); + map.put("chasDeptCode", settleAccountsDepart.getChasDeptCode()); + map.put("chasDeptName", settleAccountsDepart.getChasDeptName()); + } } //构造回写的vo对象并添加至回写集合中 @@ -7196,7 +7224,7 @@ Map>> tousseItemToBatchIdToEdgListMapMap, Map> tousseItemToIdentiToAmountMapMap, JSONObject params,OrgUnit orgUnit,WareHouse targetWarehouse, - String idColumnName,String idColumnValue,List disposableGoodsStorageAdjustVoTotalList){ + String idColumnName,String idColumnValue,List disposableGoodsStorageAdjustVoTotalList, Map invoiceSettleAccountsDepartMap){ long start1 = System.currentTimeMillis(); //一次性物品定义对应的库存调整数量 Map dgIdToAmountMap = new HashMap(); @@ -7963,7 +7991,7 @@ idToDisposableGoodsBatchMap, sourceStockList,sourceBatchStockList, targetStockList,targetBatchStockList,targetIdentificationList, - idColumnName, idColumnValue, disposableGoodsStorageAdjustVoTotalList); + idColumnName, idColumnValue, disposableGoodsStorageAdjustVoTotalList, invoiceSettleAccountsDepartMap); long start15 = System.currentTimeMillis(); StringBuffer debugInfo = new StringBuffer(); debugInfo.append("【更新一次性物品库存及插入一次性物品明细数据的业务方法耗材如下:"); @@ -8270,6 +8298,8 @@ //包定义(消毒物品为包实例对应的包定义)对应的一次性物品库存扣减数量(包括所有待扣减耗材库存的包) Map> tdToDgToOutStockAmountMapMap = new HashMap>(); + //发货单结算科室的map + Map invoiceSettleAccountsDepartMap = getInvoiceSettleAccountsDepartMap(invoicePlanToInvoiceMap.values()); tousseItemToTdToTiListMapMap.entrySet().stream().forEach(entry -> { TousseItem tousseItem = entry.getKey(); Invoice invoice = invoicePlanToInvoiceMap.get(tousseItem.getInvoicePlan()); @@ -8447,7 +8477,7 @@ new AbstractMap.SimpleEntry(identification, restOutStockAmount); diposableGoodsItemMapList.add(buildDiposableGoodsItemMapForNotExpensiveDisposableGoods(invoice, null, invoiceItemUUID, identification, batch, batchIdToDisposableGoodsBatchStockMap, dgIdToDisposableGoodsStockMap, null, identificationToOutStockAmountEntryForInvoiceOutStock, - InvoiceItem.TYPE_AUTO_DEDUCTION, disposableGoodsStorageAdjustVoTotalList)); + InvoiceItem.TYPE_AUTO_DEDUCTION, disposableGoodsStorageAdjustVoTotalList, invoiceSettleAccountsDepartMap)); identificationOfBatchToOutStockAmountMapForInvoiceOutStock.put(identification, restOutStockAmount); restWaitOutStockDgIdToIdentiToAmountMapMap.put(dgId, identiToAmountMap); restOutStockAmount = 0; @@ -8464,7 +8494,7 @@ new AbstractMap.SimpleEntry(identification, amountOfIdenti); diposableGoodsItemMapList.add(buildDiposableGoodsItemMapForNotExpensiveDisposableGoods(invoice, null, invoiceItemUUID, identification, batch, batchIdToDisposableGoodsBatchStockMap, dgIdToDisposableGoodsStockMap, null, identificationToOutStockAmountEntryForInvoiceOutStock, - InvoiceItem.TYPE_AUTO_DEDUCTION, disposableGoodsStorageAdjustVoTotalList)); + InvoiceItem.TYPE_AUTO_DEDUCTION, disposableGoodsStorageAdjustVoTotalList, invoiceSettleAccountsDepartMap)); identificationOfBatchToOutStockAmountMapForInvoiceOutStock.put(identification, amountOfIdenti); restOutStockAmount = restOutStockAmount - amountOfIdenti; } Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/gdszyy/ChasDisposableGoodsPushDaoImpl.java =================================================================== diff -u -r41631 -r41645 --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/gdszyy/ChasDisposableGoodsPushDaoImpl.java (.../ChasDisposableGoodsPushDaoImpl.java) (revision 41631) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/datasynchronization/dao/gdszyy/ChasDisposableGoodsPushDaoImpl.java (.../ChasDisposableGoodsPushDaoImpl.java) (revision 41645) @@ -43,6 +43,16 @@ private Logger logger = Logger.getLogger(this.getClass()); + private String chasWebserviceEndpoint; + + public String getChasWebserviceEndpoint() { + return chasWebserviceEndpoint; + } + + public void setChasWebserviceEndpoint(String chasWebserviceEndpoint) { + this.chasWebserviceEndpoint = chasWebserviceEndpoint; + } + @Autowired private ObjectDao objectDao; @@ -67,8 +77,9 @@ String chasPushResult = diposableGoodsItem.getChasPushResult(); try { String request = buildInvoiceDiposableGoodsItemResuest(invoice, diposableGoodsItem, idDisposableGoodsMap); + logger.debug(String.format("CHAS与低值耗材的接口地址:%s", chasWebserviceEndpoint)); logger.debug(String.format("CHAS发货信息推送接口入参:%s", request)); - String responce = doPostSoap(DatasyncConstant.CHAS_WEBSERVICE_ADDRESS, request); + String responce = doPostSoap(chasWebserviceEndpoint, request); //String responce = " 1 成功 ]]>"; logger.debug(String.format("CHAS发货信息推送接口返回参数:%s", responce)); Integer retCode = getRetCode(responce); @@ -102,8 +113,9 @@ String chasPushResult = diposableGoodsItem.getChasPushResult(); try { String request = buildInvoiceDiposableGoodsItemResuest(diposableGoodsItem.getInvoice(), diposableGoodsItem, idDisposableGoodsMap); + logger.debug(String.format("CHAS与低值耗材的接口地址:%s", chasWebserviceEndpoint)); logger.debug(String.format("CHAS发货信息推送接口入参:%s", request)); - String responce = doPostSoap(DatasyncConstant.CHAS_WEBSERVICE_ADDRESS, request); + String responce = doPostSoap(chasWebserviceEndpoint, request); //String responce = " 1 成功 ]]>"; logger.debug(String.format("CHAS发货信息推送接口返回参数:%s", responce)); Integer retCode = getRetCode(responce); @@ -158,8 +170,9 @@ String chasPushResult = diposableGoodsItem.getChasPushResult(); try { String request = buildReturnGoodsRecordDiposableGoodsItemResuest(returnGoodsRecord, diposableGoodsItem, idDisposableGoodsMap); + logger.debug(String.format("CHAS与低值耗材的接口地址:%s", chasWebserviceEndpoint)); logger.debug(String.format("CHAS退货信息推送接口入参:%s", request)); - String responce = doPostSoap(DatasyncConstant.CHAS_WEBSERVICE_ADDRESS, request); + String responce = doPostSoap(chasWebserviceEndpoint, request); //String responce = " 1 成功 ]]>"; logger.debug(String.format("CHAS退货信息推送接口返回参数:%s", responce)); Integer retCode = getRetCode(responce); @@ -340,6 +353,9 @@ * @return */ public static String doPostSoap(String postUrl, String soapXml) throws Exception{ + if(StringUtils.isBlank(postUrl)){ + throw new RuntimeException("CHAS与低值耗材的接口地址不能为空!"); + } String retStr = ""; // 创建HttpClientBuilder HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();