Index: ssts-web/src/main/webapp/disinfectsystem/reportforms/demo1.xls =================================================================== diff -u -r12331 -r31588 Binary files differ Index: ssts-web/src/main/webapp/disinfectsystem/reportforms/demo2.xls =================================================================== diff -u -r12331 -r31588 Binary files differ Index: ssts-web/src/main/java/com/forgon/disinfectsystem/stocktakerecordmanager/service/StockTakeRecordManagerImpl.java =================================================================== diff -u -r31555 -r31588 --- ssts-web/src/main/java/com/forgon/disinfectsystem/stocktakerecordmanager/service/StockTakeRecordManagerImpl.java (.../StockTakeRecordManagerImpl.java) (revision 31555) +++ ssts-web/src/main/java/com/forgon/disinfectsystem/stocktakerecordmanager/service/StockTakeRecordManagerImpl.java (.../StockTakeRecordManagerImpl.java) (revision 31588) @@ -19,6 +19,7 @@ import javax.servlet.http.HttpServletRequest; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFCellStyle; @@ -38,6 +39,7 @@ import com.forgon.disinfectsystem.basedatamanager.warehouse.service.WareHouseManager; import com.forgon.disinfectsystem.diposablegoods.service.DiposableGoodsManager; import com.forgon.disinfectsystem.entity.assestmanagement.DisposableGoods; +import com.forgon.disinfectsystem.entity.assestmanagement.DisposableGoodsBatch; import com.forgon.disinfectsystem.entity.assestmanagement.DisposableGoodsBatchStock; import com.forgon.disinfectsystem.entity.assestmanagement.DisposableGoodsIdentification; import com.forgon.disinfectsystem.entity.assestmanagement.DisposableGoodsStock; @@ -643,6 +645,7 @@ record.setAmount(Long.valueOf(totalAmount)); record.setTotalPrice(totalPrice); record.setDiposableGoods(list); + record.setOrgUnitCoding(orgUnitCoding); record.setWarehouseId(warehouse.getId()); objectDao.saveOrUpdate(record); @@ -677,7 +680,7 @@ } @SuppressWarnings("deprecation") - public void createExcelFile(OutputStream ops,List list){ + public void createExcelFile(OutputStream ops, Listlist){ FileInputStream fos = null; try{ String inputFile = Path.getWebAppRoot() + "/disinfectsystem/reportforms/demo1.xls"; @@ -706,6 +709,13 @@ int totalAmount = 0; double totalPrice = 0.00; for (StockDiposableGoods diposableGoods : list) { + + Long disposableGoodsId = diposableGoods.getDisposableGoodsId(); + DisposableGoods disposableGoods = null; + if(DatabaseUtil.isPoIdValid(disposableGoodsId)){ + disposableGoods = (DisposableGoods) objectDao.getById(DisposableGoods.class.getSimpleName(), disposableGoodsId); + } + //入库记 for (StockDiposableGoodBatch goodsBatch : diposableGoods.getGoodsBatchs()) { //设置标识号 @@ -717,20 +727,28 @@ double price = identification.getPrice();//单价 double goodsTotalPrice = price*amount;//总价 totalPrice = new BigDecimal(totalPrice).add(new BigDecimal(goodsTotalPrice)).doubleValue(); - String manufacturer = goodsBatch.getManufacturer(); + String manufacturer = goodsBatch.getSupplierName(); HSSFRow operatingRow = sheet.createRow(row); createStringCell(operatingRow, cellStyle, 0, diposableGoods.getType()); createStringCell(operatingRow, cellStyle, 1, diposableGoods.getExternalCode()); createStringCell(operatingRow, cellStyle, 2, diposableGoods.getName()); createStringCell(operatingRow, cellStyle, 3, diposableGoods.getSpecification()); - createStringCell(operatingRow, cellStyle, 4, identification.getIdentification()); - createStringCell(operatingRow, cellStyle, 5, diposableGoods.getUnit()); - createIntCell(operatingRow, cellStyle, 6, Integer.parseInt(""+amount)); - createDoubleCell(operatingRow, cellStyle, 7, price); - createDoubleCell(operatingRow, cellStyle, 8, goodsTotalPrice); - createStringCell(operatingRow, cellStyle, 9, ""); - createStringCell(operatingRow, cellStyle, 10, manufacturer); + + createStringCell(operatingRow, cellStyle, 4, goodsBatch.getBatchNumber()); + if(disposableGoods != null){ + createStringCell(operatingRow, cellStyle, 5, disposableGoods.getInventorySerialNumber()); + }else{ + createStringCell(operatingRow, cellStyle, 5, ""); + } + + createStringCell(operatingRow, cellStyle, 6, identification.getIdentification()); + createStringCell(operatingRow, cellStyle, 7, diposableGoods.getUnit()); + createIntCell(operatingRow, cellStyle, 8, Integer.parseInt(""+amount)); + createDoubleCell(operatingRow, cellStyle, 9, price); + createDoubleCell(operatingRow, cellStyle, 10, goodsTotalPrice); + createStringCell(operatingRow, cellStyle, 11, ""); + createStringCell(operatingRow, cellStyle, 12, manufacturer); row++; } @@ -745,11 +763,13 @@ createStringCell(operatingRow, cellStyle, 3, ""); createStringCell(operatingRow, cellStyle, 4, ""); createStringCell(operatingRow, cellStyle, 5, ""); - createIntCell(operatingRow, cellStyle, 6, totalAmount); + createStringCell(operatingRow, cellStyle, 6, ""); createStringCell(operatingRow, cellStyle, 7, ""); - createDoubleCell(operatingRow, cellStyle, 8, totalPrice); + createIntCell(operatingRow, cellStyle, 8, totalAmount); createStringCell(operatingRow, cellStyle, 9, ""); - createStringCell(operatingRow, cellStyle, 10, ""); + createDoubleCell(operatingRow, cellStyle, 10, totalPrice); + createStringCell(operatingRow, cellStyle, 11, ""); + createStringCell(operatingRow, cellStyle, 12, ""); wb.write(ops); }catch (Exception e) { e.printStackTrace(); @@ -976,36 +996,38 @@ createStringCell(operatingRow, cellStyle, 2, vo.getName()); createStringCell(operatingRow, cellStyle, 3, vo.getSpecification()); createStringCell(operatingRow, cellStyle, 4, vo.getUnit()); - createDoubleCell(operatingRow, cellStyle, 5, Double.parseDouble(""+vo.getStartStockAmount())); + createStringCell(operatingRow, cellStyle, 5, ""); + createStringCell(operatingRow, cellStyle, 6, ""); + createDoubleCell(operatingRow, cellStyle, 7, Double.parseDouble(""+vo.getStartStockAmount())); totalStartStockAmount = new BigDecimal(totalStartStockAmount).add(new BigDecimal(vo.getStartStockAmount())).doubleValue(); - createDoubleCell(operatingRow, cellStyle, 6, vo.getStartStockPrice()); + createDoubleCell(operatingRow, cellStyle, 8, vo.getStartStockPrice()); totalStartStockPrice = new BigDecimal(totalStartStockPrice).add(new BigDecimal(vo.getStartStockPrice())).doubleValue(); - createDoubleCell(operatingRow, cellStyle, 7, Double.parseDouble(""+vo.getInStorageAmount())); + createDoubleCell(operatingRow, cellStyle, 9, Double.parseDouble(""+vo.getInStorageAmount())); totalInStorageAmount = new BigDecimal(totalInStorageAmount).add(new BigDecimal(vo.getInStorageAmount())).doubleValue(); - createDoubleCell(operatingRow, cellStyle, 8, vo.getInStoragePrice()); + createDoubleCell(operatingRow, cellStyle, 10, vo.getInStoragePrice()); totalInStoragePrice = new BigDecimal(totalInStoragePrice).add(new BigDecimal(vo.getInStoragePrice())).doubleValue(); - createDoubleCell(operatingRow, cellStyle, 9, Double.parseDouble(""+vo.getOutStorageAmount())); + createDoubleCell(operatingRow, cellStyle, 11, Double.parseDouble(""+vo.getOutStorageAmount())); totalOutStorageAmount = new BigDecimal(totalOutStorageAmount).add(new BigDecimal(vo.getOutStorageAmount())).doubleValue(); - createDoubleCell(operatingRow, cellStyle, 10, vo.getOutStoragePrice()); + createDoubleCell(operatingRow, cellStyle, 12, vo.getOutStoragePrice()); totalOutStoragePrice = new BigDecimal(totalOutStoragePrice).add(new BigDecimal(vo.getOutStoragePrice())).doubleValue(); - createDoubleCell(operatingRow, cellStyle, 11, Double.parseDouble(""+vo.getEndStockAmount())); + createDoubleCell(operatingRow, cellStyle, 13, Double.parseDouble(""+vo.getEndStockAmount())); totalEndStockAmount = new BigDecimal(totalEndStockAmount).add(new BigDecimal(vo.getEndStockAmount())).doubleValue(); - createDoubleCell(operatingRow, cellStyle, 12, vo.getEndStockPrice()); + createDoubleCell(operatingRow, cellStyle, 14, vo.getEndStockPrice()); totalEndStockPrice = new BigDecimal(totalEndStockPrice).add(new BigDecimal(vo.getEndStockPrice())).doubleValue(); row++; } HSSFRow operatingRow = sheet.createRow(row); - createDoubleCell(operatingRow, cellStyle, 5, totalStartStockAmount); - createDoubleCell(operatingRow, cellStyle, 6, totalStartStockPrice); - createDoubleCell(operatingRow, cellStyle, 7, totalInStorageAmount); - createDoubleCell(operatingRow, cellStyle, 8, totalInStoragePrice); - createDoubleCell(operatingRow, cellStyle, 9, totalOutStorageAmount); - createDoubleCell(operatingRow, cellStyle, 10,totalOutStoragePrice); - createDoubleCell(operatingRow, cellStyle, 11, totalEndStockAmount); - createDoubleCell(operatingRow, cellStyle, 12,totalEndStockPrice); + createDoubleCell(operatingRow, cellStyle, 7, totalStartStockAmount); + createDoubleCell(operatingRow, cellStyle, 8, totalStartStockPrice); + createDoubleCell(operatingRow, cellStyle, 9, totalInStorageAmount); + createDoubleCell(operatingRow, cellStyle, 10, totalInStoragePrice); + createDoubleCell(operatingRow, cellStyle, 11, totalOutStorageAmount); + createDoubleCell(operatingRow, cellStyle, 12,totalOutStoragePrice); + createDoubleCell(operatingRow, cellStyle, 13, totalEndStockAmount); + createDoubleCell(operatingRow, cellStyle, 14,totalEndStockPrice); wb.write(ops); }catch (Exception e) {