예제 #1
0
 public User(String userid, String username, String password) {
   super();
   this.userid = userid;
   this.username = username;
   this.password = password;
   this.updatetime = DateTool.getInstance().DateToPattern2(new Date());
   this.status = 1;
 }
예제 #2
0
 /**
  * 盘点明细 , 按日期输出
  *
  * @return
  * @throws Exception
  */
 public String listCheckingList() throws Exception {
   this.setReturnurl(request.getContextPath() + FILESEPARATOR + "warehousefunction.jsp");
   if (date == null || date.trim().equals("")) {
     date = DateTool.getInstance().DateToPattern1(new Date());
   }
   warehouses = this.warehouseService.findByKeyword("");
   if (warehouse != null && warehouse.getId() != 0) {
     warehouse = this.warehouseService.get(Warehouse.class, warehouse.getId());
     stockCheckingList =
         this.stockCheckingService.findCheckingListByDateAndWarehouse(date, warehouse.getId());
   } else {
     stockCheckingList = this.stockCheckingService.findCheckingListByDate(date);
   }
   return SUCCESS;
 }
예제 #3
0
 /**
  * 生成一张盘点表格
  *
  * @return
  * @throws Exception
  */
 public String createCheckingExcel() throws Exception {
   if (date == null || date.trim().equals("")) {
     date = DateTool.getInstance().DateToPattern1(new Date());
   }
   warehouses = this.warehouseService.findByKeyword("");
   if (warehouse != null && warehouse.getId() != 0) {
     warehouse = this.warehouseService.get(Warehouse.class, warehouse.getId());
     stockCheckingList =
         this.stockCheckingService.findCheckingListByDateAndWarehouse(date, warehouse.getId());
   } else {
     stockCheckingList = this.stockCheckingService.findCheckingListByDate(date);
   }
   ByteOutputStream outputStream = new ByteOutputStream();
   WritableWorkbook workbook = Workbook.createWorkbook(outputStream);
   WritableSheet sheet = workbook.createSheet("盘点记录表", 0);
   int row = 0;
   {
     Label label01 = new Label(0, row, "仓库");
     sheet.addCell(label01);
     if (warehouse.getId() != 0) {
       Label label02 = new Label(1, row, warehouse.getWnickname());
       sheet.addCell(label02);
     } else {
       Label label02 = new Label(1, row, "全部");
       sheet.addCell(label02);
     }
   }
   row++;
   {
     Label label01 = new Label(0, row, "行");
     Label label02 = new Label(1, row, "产品编码*");
     Label label03 = new Label(2, row, "产品型号*");
     Label label04 = new Label(3, row, "盘点前数量");
     Label label05 = new Label(4, row, "盘点数量");
     Label label06 = new Label(5, row, "差额");
     Label label07 = new Label(6, row, "盘点人");
     Label label08 = new Label(7, row, "时间");
     sheet.addCell(label01);
     sheet.addCell(label02);
     sheet.addCell(label03);
     sheet.addCell(label04);
     sheet.addCell(label05);
     sheet.addCell(label06);
     sheet.addCell(label07);
     sheet.addCell(label08);
   }
   row++;
   for (int i = 0; i < stockCheckingList.size(); i++) {
     StockChecking checking = stockCheckingList.get(i);
     Label label01 = new Label(0, row, "" + (i + 1));
     Label label02 = new Label(1, row, checking.getProductInfo().getBarcode());
     Label label03 = new Label(2, row, checking.getProductInfo().getPdesc());
     jxl.write.Number label04 = new jxl.write.Number(3, row, checking.getQuantity_before());
     jxl.write.Number label05 = new jxl.write.Number(4, row, checking.getQuantity_after());
     jxl.write.Number label06 =
         new jxl.write.Number(
             5, row, checking.getQuantity_after() - checking.getQuantity_before());
     Label label07 = new Label(6, row, checking.getOperator());
     Label label08 = new Label(7, row, checking.getUpdatetime());
     sheet.addCell(label01);
     sheet.addCell(label02);
     sheet.addCell(label03);
     sheet.addCell(label04);
     sheet.addCell(label05);
     sheet.addCell(label06);
     sheet.addCell(label07);
     sheet.addCell(label08);
     row++;
   }
   for (int i = 0; i < sheet.getColumns(); i++) {
     sheet.setColumnView(i, 30);
   }
   for (int i = 0; i < sheet.getRows(); i++) {
     sheet.setRowView(i, 300);
   }
   workbook.write();
   workbook.close();
   response.reset();
   response.setContentType("application/vn.ms-xls");
   response.setCharacterEncoding("utf-8");
   this.inputStream = new ByteArrayInputStream(outputStream.getBytes()); // 关键,以 inputstream 输出
   return SUCCESS;
 }