|
@@ -444,46 +444,52 @@ public class ReportController {
|
|
|
accMap.put("rollAmount", account.getRollAmount());//力工金额
|
|
|
accMap.put("totalAmount", account.getTotalAmount());//总金额
|
|
|
}
|
|
|
+ else{
|
|
|
+ accMap.put("actualAmount", "未出账单");
|
|
|
+ accMap.put("clothAmount", "未出账单");
|
|
|
+ accMap.put("rollAmount", "未出账单");
|
|
|
+ accMap.put("totalAmount", "未出账单");
|
|
|
+ }
|
|
|
|
|
|
//打卷
|
|
|
- BigDecimal estimateQuantityM = new BigDecimal(0);
|
|
|
+ BigDecimal actualQuantityM = new BigDecimal(0);
|
|
|
List<String> lengthList = new ArrayList<>();
|
|
|
List<String> shipmentList = new ArrayList<>();
|
|
|
List<Stock> stockList = stockService.findList(work.getId());
|
|
|
for(Stock stock : stockList){
|
|
|
lengthList.add(stock.getLength() + "m");
|
|
|
- estimateQuantityM = estimateQuantityM.add(stock.getLength());
|
|
|
+ actualQuantityM = actualQuantityM.add(stock.getLength());
|
|
|
if(stock.getUpdateTime() != null && !shipmentList.contains(sdf.format(stock.getUpdateTime()))) {
|
|
|
shipmentList.add(sdf.format(stock.getUpdateTime()));
|
|
|
}
|
|
|
}
|
|
|
- BigDecimal estimateQuantityY = estimateQuantityM.divide(new BigDecimal("0.9144"), 0, RoundingMode.HALF_UP);
|
|
|
+ BigDecimal actualQuantityY = actualQuantityM.divide(new BigDecimal("0.9144"), 0, RoundingMode.HALF_UP);
|
|
|
|
|
|
accMap.put("name", work.getName());//品种及规格
|
|
|
accMap.put("width", work.getWidth());//幅宽
|
|
|
accMap.put("number", work.getNumber());//编号
|
|
|
accMap.put("processDate", sdf.format(work.getProcessDate()));//投坯日
|
|
|
accMap.put("processVolume", work.getProcessVolume());//投坯数(米)
|
|
|
- accMap.put("processRemark", work.getProcessRemark());//投坯卷数
|
|
|
- accMap.put("processNumber", work.getProcessNumber());//投坯备注
|
|
|
+ accMap.put("processRemark", work.getProcessRemark());//投坯备注
|
|
|
+ accMap.put("processNumber", work.getProcessNumber());//投坯卷数
|
|
|
accMap.put("ratio", work.getRatio());//伸长率
|
|
|
accMap.put("colour", work.getColour());//色泽
|
|
|
accMap.put("estimateQuantity", work.getEstimateQuantity());//应交成品数(米)
|
|
|
accMap.put("estimateRemark", work.getEstimateRemark());//应交成品数备注
|
|
|
accMap.put("shipment", String.join(",", shipmentList));//发货日
|
|
|
accMap.put("actualRemark", String.join("+", lengthList));//实交成品数-详情
|
|
|
- accMap.put("estimateQuantityY", estimateQuantityY);//应交成品数(码)
|
|
|
- accMap.put("estimateQuantityM", estimateQuantityM);//应交成品数(米)
|
|
|
+ accMap.put("actualQuantityY", actualQuantityY);//实交成品数(码)
|
|
|
+ accMap.put("actualQuantityM", actualQuantityM);//实交成品数(米)
|
|
|
accMap.put("unitPrice", work.getUnitPrice());//单价(元/米)
|
|
|
- accMap.put("clothQuantity", estimateQuantityM.subtract(work.getEstimateQuantity()));//坯布数(米)
|
|
|
+ accMap.put("clothQuantity", actualQuantityM.subtract(work.getEstimateQuantity()));//坯布数(米)
|
|
|
accMap.put("clothPrice", work.getClothPrice());//坯布单价(元/米)
|
|
|
accMap.put("remark", work.getRemark());//备注
|
|
|
mapList.add(accMap);
|
|
|
}
|
|
|
|
|
|
- map.put("name", customer.getCompany());
|
|
|
+ map.put("name", "客户:" + customer.getCompany());
|
|
|
map.put("date", dateStart.substring(0,4) + "年" + dateStart.substring(5,7) + "月");
|
|
|
- map.put("list", customer.getCompany());
|
|
|
+ map.put("list", mapList);
|
|
|
|
|
|
return map;
|
|
|
}
|
|
@@ -500,4 +506,71 @@ public class ReportController {
|
|
|
|
|
|
return msgResult;
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value="年度对账单报表")
|
|
|
+ @RequestMapping(value = "monthFHJSBXls",method = RequestMethod.POST)
|
|
|
+ public MessageResult monthFHJSBXls(String customerId, Date selectDate) throws Exception {
|
|
|
+ MessageResult msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ Map<String, Object> map = (Map<String, Object>)dataFHJSB(customerId, selectDate);
|
|
|
+
|
|
|
+ String xlsPath = "static/fhjsb.xls";
|
|
|
+ ClassPathResource resource = new ClassPathResource(xlsPath);
|
|
|
+ Workbook wb = WorkbookFactory.create(resource.getInputStream());
|
|
|
+
|
|
|
+ //写入数据
|
|
|
+ Sheet sheet = wb.getSheetAt(0);
|
|
|
+ Row rowTitle = sheet.getRow(1);
|
|
|
+ rowTitle.getCell(0).setCellValue(map.get("name").toString());
|
|
|
+ rowTitle.getCell(20).setCellValue(map.get("date").toString());
|
|
|
+ int rowNum = 4;
|
|
|
+
|
|
|
+ List<Map> list = (List<Map>)map.get("list");
|
|
|
+ for(Map item : list) {
|
|
|
+ Row row = sheet.createRow(rowNum);
|
|
|
+ row.createCell(0).setCellValue(item.get("name").toString());
|
|
|
+ row.createCell(1).setCellValue(item.get("width").toString());
|
|
|
+ row.createCell(2).setCellValue(item.get("number").toString());
|
|
|
+ row.createCell(3).setCellValue(item.get("processDate").toString());
|
|
|
+ row.createCell(4).setCellValue(item.get("processVolume").toString());
|
|
|
+ row.createCell(5).setCellValue(item.get("processNumber").toString());
|
|
|
+ row.createCell(6).setCellValue(item.get("processRemark").toString());
|
|
|
+ row.createCell(7).setCellValue(item.get("ratio").toString());
|
|
|
+ row.createCell(8).setCellValue(item.get("colour").toString());
|
|
|
+ row.createCell(9).setCellValue(item.get("estimateQuantity").toString());
|
|
|
+ row.createCell(10).setCellValue(item.get("shipment").toString());
|
|
|
+ row.createCell(11).setCellValue(item.get("actualRemark").toString());
|
|
|
+ row.createCell(12).setCellValue(item.get("actualQuantityY").toString());
|
|
|
+ row.createCell(13).setCellValue(item.get("actualQuantityM").toString());
|
|
|
+ row.createCell(14).setCellValue(item.get("unitPrice").toString());
|
|
|
+ row.createCell(15).setCellValue(item.get("actualAmount").toString());
|
|
|
+ row.createCell(16).setCellValue(item.get("clothQuantity").toString());
|
|
|
+ row.createCell(17).setCellValue(item.get("clothPrice").toString());
|
|
|
+ row.createCell(18).setCellValue(item.get("clothAmount").toString());
|
|
|
+ row.createCell(19).setCellValue(item.get("rollAmount").toString());
|
|
|
+ row.createCell(20).setCellValue(item.get("totalAmount").toString());
|
|
|
+ row.createCell(21).setCellValue(item.get("remark").toString());
|
|
|
+
|
|
|
+ rowNum++;
|
|
|
+ }
|
|
|
+
|
|
|
+ //保存到服务器,返回文件名
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
+ wb.write(output);
|
|
|
+ String fileName = "发货结算表(" + sdf.format(new Date()) + ").xls";
|
|
|
+ String name = "D:\\JpSoft\\Tomcat 8.5\\webapps\\printing-portal\\xls\\" + fileName;
|
|
|
+ File file = new File(name);
|
|
|
+ FileOutputStream file1 = new FileOutputStream(file);
|
|
|
+ wb.write(file1);
|
|
|
+ file1.close();
|
|
|
+ wb.close();
|
|
|
+ output.close();
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setMessage("报表生成完成。");
|
|
|
+ msgResult.setData("/printing-portal/xls/" + fileName);
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
}
|