/**
   * 更新餐桌
   *
   * @return
   */
  @Action(
      value = "updateTableT",
      results = {@Result(name = "json", type = "json")})
  public String updateTableT() {
    if (Validate.StrisNull(this.getTableid())
        && Validate.StrisNull(this.getTableNumber())
        && Validate.StrisNull(this.getRoomName())) {
      this.setSucflag(false);
      return "json";
    }
    if (this.getTableTService().findTableBytableid(this.getTableid()) != null) {
      TableT tt = new TableT();
      tt.setTableid(this.getTableid());
      tt.setTableNumber(this.getTableNumber());
      tt.setRoomName(this.getRoomName());
      tt.setFloor(this.getFloor());
      tt.setNop(this.getNop());
      tt.setNote(this.getNote());
      tt.setCreatetime(BaseTools.systemtime());
      tt.setCreatorid(BaseTools.adminCreateId());
      tt.setTablestate(this.getTablestate());

      this.getTableTService().updateTableT(tt);
      this.setSucflag(true);
      return "json";
    } else {
      this.setSucflag(false);
      return "json";
    }
  }
  /** 增加餐桌 */
  @Action(
      value = "addTableT",
      results = {@Result(name = "json", type = "json")})
  public String addTableT() {

    if (Validate.StrisNull(this.getTableNumber()) && Validate.StrisNull(this.getRoomName())) {
      this.setSucflag(false);
      return "json";
    }
    TableT tt = new TableT();
    tt.setTableid(this.getSerial().Serialid(Serial.ELECTABLE));
    tt.setTableNumber(this.getTableNumber().trim());
    tt.setRoomName(this.getRoomName().trim());
    tt.setFloor(this.getFloor());
    tt.setNop(this.getNop());
    tt.setCreatetime(BaseTools.systemtime());
    tt.setCreatorid(BaseTools.adminCreateId());
    tt.setTablestate("0");

    if (this.getTableTService().addTableT(tt) > 0) {
      this.setSucflag(true);
      return "json";
    } else {
      this.setSucflag(false);
      return "json";
    }
  }
 /** 获取所有餐桌信息 */
 @Action(
     value = "getAllTableT",
     results = {@Result(name = "json", type = "json")})
 public String getAllTableT() {
   List<TableT> list = this.getTableTService().findAllTableT();
   if (list != null) {
     this.setTabletstrs("");
     this.setTabletstrs("<option value='-1'>---请选择---</option>");
     for (Iterator it = list.iterator(); it.hasNext(); ) {
       TableT tt = (TableT) it.next();
       this.tabletstrs +=
           "<input id='" + tt.getTableid() + "' value='" + tt.getTableNumber() + "' />";
     }
     this.setSucflag(true);
     return "json";
   }
   this.setSucflag(false);
   return "json";
 }
 public void ProcessTableTList(List<TableT> list) {
   rows.clear();
   for (Iterator it = list.iterator(); it.hasNext(); ) {
     TableT tt = (TableT) it.next();
     // if("0".equals(tt.get))
     if ("0".equals(tt.getTablestate())) {
       tt.setTablestate("<div style='background:green;height:10px'>空</div>");
     } else {
       tt.setTablestate("<div style='background:red;height:10px'>使用中</div>");
     }
     Map<String, Object> cellMap = new HashMap<String, Object>();
     cellMap.put("id", tt.getTableid());
     cellMap.put(
         "cell",
         new Object[] {
           tt.getTableNumber(),
           tt.getRoomName(),
           tt.getFloor(),
           tt.getTablestate(),
           BaseTools.formateDbDate(tt.getCreatetime()),
           tt.getCreatorid(),
           tt.getNop(),
           tt.getRnop(),
           tt.getNote(),
           tt.getAndroidDevicesCount()
         });
     rows.add(cellMap);
   }
 }
 /**
  * 查询餐桌信息反馈给手机端
  *
  * @throws IOException
  */
 @Action(value = "findAllTableTforAndroid")
 public void findAllTableTforAndroid() throws IOException {
   int currentPage = page;
   int lineSize = 20;
   List<TableT> list = this.getTableTService().findAllTableT(currentPage, lineSize);
   StringBuilder json = new StringBuilder();
   for (Iterator it = list.iterator(); it.hasNext(); ) {
     TableT t = (TableT) it.next();
     json.append("{");
     json.append("\"tableid\":\"").append(t.getTableid()).append("\",");
     json.append("\"tableNumber\":\"").append(t.getTableNumber()).append("\",");
     json.append("\"roomName\":\"").append(t.getRoomName()).append("\",");
     json.append("\"androidDevicesCount\":\"").append(t.getAndroidDevicesCount()).append("\",");
     json.append("\"note\":\"").append(t.getNote()).append("\",");
     json.append("\"createtime\":\"")
         .append(BaseTools.formateDbDate(t.getCreatetime()))
         .append("\",");
     json.append("\"nop\":\"").append(t.getNop()).append("\",");
     json.append("\"tablestate\":\"").append(t.getTablestate()).append("\",");
     json.append("\"floor\":\"").append(t.getFloor()).append("\",");
     json.append("\"rnop\":\"").append(t.getRnop()).append("\"");
     json.append("}").append("--");
   }
   json.deleteCharAt(json.length() - 1);
   this.setResponsejsonstr(json.toString());
   response.setContentType("text/html");
   response.setCharacterEncoding("utf-8");
   PrintWriter out = response.getWriter();
   out.write(this.getResponsejsonstr());
   out.flush();
   out.close();
 }