Ejemplo n.º 1
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    ServletContext application;
    HttpSession session = request.getSession();
    nseer_db_backup1 finance_db = new nseer_db_backup1(dbApplication);

    try {

      if (finance_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        String finance_cheque_id = request.getParameter("finance_cheque_id");
        String sql = "delete from finance_bill where id='" + finance_cheque_id + "'";
        finance_db.executeUpdate(sql);
        finance_db.commit();
        finance_db.close();

      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Ejemplo n.º 2
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    nseer_db_backup1 stock_db = new nseer_db_backup1(dbApplication);

    try {
      if (stock_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        int i;
        int intRowCount;
        String sqll =
            "select * from stock_config_public_char where describe1='\u51fa\u5165\u5e93\u7406\u7531'";
        ResultSet rs = stock_db.executeQuery(sqll);
        rs.next();
        rs.last();
        intRowCount = rs.getRow();
        String[] del = new String[intRowCount];
        del = (String[]) dbSession.getAttribute("del");
        if (del != null) {
          for (i = 1; i <= intRowCount; i++) {
            String sql = "delete from stock_config_public_char where id='" + del[i - 1] + "'";
            stock_db.executeUpdate(sql);
          }
        }
        stock_db.commit();
        stock_db.close();
        response.sendRedirect("stock/config/apply_gather_pay/reason.jsp");
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Ejemplo n.º 3
0
  public synchronized void doPost(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    try {
      PrintWriter out = response.getWriter();

      nseer_db_backup1 stock_db = new nseer_db_backup1(dbApplication);
      nseer_db_backup1 crm_db = new nseer_db_backup1(dbApplication);
      if (stock_db.conn((String) dbSession.getAttribute("unit_db_name"))
          && crm_db.conn((String) dbSession.getAttribute("unit_db_name"))) {

        FileKind FileKind = new FileKind();
        ValidataNumber validata = new ValidataNumber();
        ValidataRecord vr = new ValidataRecord();

        counter count = new counter(dbApplication);
        ValidataTag vt = new ValidataTag();
        String register_ID = (String) dbSession.getAttribute("human_IDD");
        String config_id = request.getParameter("config_id");
        String pay_ID = request.getParameter("pay_ID");
        String product_amount = request.getParameter("product_amount");
        int num = Integer.parseInt(product_amount);
        String payer_name = request.getParameter("payer_name");
        String payer_ID = request.getParameter("payer_ID");
        String reason = request.getParameter("reason");
        String not_return_tag = request.getParameter("not_return_tag");
        String register = request.getParameter("register");
        String register_time = request.getParameter("register_time");
        String demand_return_time = request.getParameter("demand_return_time");
        String sales_name = request.getParameter("sales_name");
        String sales_ID = request.getParameter("sales_ID");
        String bodyc = new String(request.getParameter("remark").getBytes("UTF-8"), "UTF-8");
        String remark = exchange.toHtml(bodyc);
        String time = "";
        java.util.Date now = new java.util.Date();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
        time = formatter.format(now);
        String[] product_IDn = request.getParameterValues("product_ID");
        String[] amountn = request.getParameterValues("amount");
        if (num == 0 && product_IDn.length == 1) {
          response.sendRedirect("draft/crm/credit_ok_a.jsp?pay_ID=" + pay_ID);
        } else {
          int p = 0;
          for (int i = 1; i <= num; i++) {
            String tem_amount = "amount" + i;
            String amount = request.getParameter(tem_amount);
            if (amount.equals("")) amount = "0";
            if (!validata.validata(amount)) {
              p++;
            }
          }
          int n = 0;
          String product_ID_group = "";
          for (int j = 1; j < product_IDn.length; j++) {
            product_ID_group += product_IDn[j] + ",";
            if (amountn[j].equals("")) amountn[j] = "0";
            if (!validata.validata(amountn[j])) {
              p++;
            }
          }
          for (int i = 1; i <= num; i++) {
            String tem_product_ID = "product_ID" + i;
            String product_ID = request.getParameter(tem_product_ID);
            if (product_ID_group.indexOf(product_ID) != -1) n++;
          }
          if (vt.validata(
                      (String) dbSession.getAttribute("unit_db_name"),
                      "stock_apply_pay",
                      "pay_ID",
                      pay_ID,
                      "check_tag")
                  .equals("9")
              || vt.validata(
                      (String) dbSession.getAttribute("unit_db_name"),
                      "stock_apply_pay",
                      "pay_ID",
                      pay_ID,
                      "check_tag")
                  .equals("5")) {

            if (p == 0) {
              try {
                if (n == 0) {
                  boolean flag = false;
                  List rsList = GetWorkflow.getList(crm_db, "crm_config_workflow", "05");
                  String[] elem = new String[3];
                  if (rsList.size() == 0) {
                    flag = true;
                  }
                  String sqll = "";
                  String[] aaa1 =
                      FileKind.getKind(
                          (String) dbSession.getAttribute("unit_db_name"),
                          "crm_file",
                          "customer_ID",
                          payer_ID);

                  String stock_pay_ID =
                      NseerId.getId("stock/pay", (String) dbSession.getAttribute("unit_db_name"));
                  double demand_amount = 0.0d;
                  double list_price_sum = 0.0d;
                  double cost_price_sum = 0.0d;

                  for (int i = 1; i <= num; i++) {
                    String tem_product_name = "product_name" + i;
                    String tem_product_ID = "product_ID" + i;
                    String tem_available_amount = "available_amount" + i;
                    String tem_amount = "amount" + i;
                    String tem_list_price = "list_price" + i;
                    String tem_cost_price = "cost_price" + i;
                    String tem_type = "type" + i;
                    String tem_amount_unit = "amount_unit" + i;
                    String product_name = request.getParameter(tem_product_name);
                    String product_ID = request.getParameter(tem_product_ID);
                    String available_amount = request.getParameter(tem_available_amount);
                    String amount = request.getParameter(tem_amount);
                    if (amount.equals("")) amount = "0";
                    String list_price2 = request.getParameter(tem_list_price);
                    String cost_price = request.getParameter(tem_cost_price);
                    String type = request.getParameter(tem_type);
                    StringTokenizer tokenTO3 = new StringTokenizer(list_price2, ",");
                    String list_price = "";
                    while (tokenTO3.hasMoreTokens()) {
                      String list_price1 = tokenTO3.nextToken();
                      list_price += list_price1;
                    }
                    String amount_unit = request.getParameter(tem_amount_unit);
                    double list_price_subtotal =
                        Double.parseDouble(list_price) * Double.parseDouble(amount);
                    list_price_sum += list_price_subtotal;
                    double cost_price_subtotal =
                        Double.parseDouble(cost_price) * Double.parseDouble(amount);
                    cost_price_sum += cost_price_subtotal;
                    demand_amount += Double.parseDouble(amount);
                    String sql1 =
                        "update stock_apply_pay_details set amount='"
                            + amount
                            + "',list_price='"
                            + list_price
                            + "',list_price_subtotal='"
                            + list_price_subtotal
                            + "',cost_price='"
                            + cost_price
                            + "',subtotal='"
                            + cost_price_subtotal
                            + "' where pay_ID='"
                            + pay_ID
                            + "' and details_number='"
                            + i
                            + "'";
                    stock_db.executeUpdate(sql1);
                    if (flag) {
                      if (type.equals("物料") || type.equals("外购商品")) {
                        String sql2 =
                            "insert into stock_pay_details(pay_ID,details_number,product_ID,product_name,type,list_price,list_price_subtotal,cost_price,subtotal,amount,unpay_amount,apply_manufacture_amount,apply_purchase_amount) values('"
                                + stock_pay_ID
                                + "','"
                                + i
                                + "','"
                                + product_ID
                                + "','"
                                + product_name
                                + "','"
                                + type
                                + "','"
                                + list_price
                                + "','"
                                + list_price_subtotal
                                + "','"
                                + cost_price
                                + "','"
                                + cost_price_subtotal
                                + "','"
                                + amount
                                + "','"
                                + amount
                                + "','0','"
                                + amount
                                + "')";
                        stock_db.executeUpdate(sql2);
                      } else if (type.equals("商品") || type.equals("部件") || type.equals("委外部件")) {
                        String sql2 =
                            "insert into stock_pay_details(pay_ID,details_number,product_ID,product_name,type,list_price,list_price_subtotal,cost_price,subtotal,amount,unpay_amount,apply_manufacture_amount,apply_purchase_amount) values('"
                                + stock_pay_ID
                                + "','"
                                + i
                                + "','"
                                + product_ID
                                + "','"
                                + product_name
                                + "','"
                                + type
                                + "','"
                                + list_price
                                + "','"
                                + list_price_subtotal
                                + "','"
                                + cost_price
                                + "','"
                                + cost_price_subtotal
                                + "','"
                                + amount
                                + "','"
                                + amount
                                + "','"
                                + amount
                                + "','0')";
                        stock_db.executeUpdate(sql2);
                      }

                      String sql97 =
                          "select * from crm_salecredit_balance_details where crediter_ID='"
                              + payer_ID
                              + "' and product_ID='"
                              + product_ID
                              + "'";
                      ResultSet rs97 = crm_db.executeQuery(sql97);
                      if (rs97.next()) {
                        double balance_amount =
                            rs97.getDouble("amount") + Double.parseDouble(amount);
                        double balance_cost_price_subtotal =
                            rs97.getDouble("subtotal") + cost_price_subtotal;
                        double balance_list_price_subtotal =
                            rs97.getDouble("list_price_subtotal") + list_price_subtotal;

                        String sql96 =
                            "update crm_salecredit_balance_details set amount='"
                                + balance_amount
                                + "',check_tag='1',subtotal='"
                                + balance_cost_price_subtotal
                                + "',list_price_subtotal='"
                                + balance_list_price_subtotal
                                + "' where crediter_ID='"
                                + payer_ID
                                + "' and product_ID='"
                                + product_ID
                                + "'";
                        crm_db.executeUpdate(sql96);
                      } else {
                        String[] aaa =
                            FileKind.getKind(
                                (String) dbSession.getAttribute("unit_db_name"),
                                "design_file",
                                "product_ID",
                                product_ID);
                        String sql95 =
                            "insert into crm_salecredit_balance_details(chain_ID,chain_name,crediter_chain_ID,crediter_chain_name,product_ID,product_name,list_price,list_price_subtotal,cost_price,subtotal,amount,crediter_ID,crediter_name) values('"
                                + aaa[0]
                                + "','"
                                + aaa[1]
                                + "','"
                                + aaa1[0]
                                + "','"
                                + aaa1[1]
                                + "','"
                                + product_ID
                                + "','"
                                + product_name
                                + "','"
                                + list_price
                                + "','"
                                + list_price_subtotal
                                + "','"
                                + cost_price
                                + "','"
                                + cost_price_subtotal
                                + "','"
                                + amount
                                + "','"
                                + payer_ID
                                + "','"
                                + payer_name
                                + "')";
                        crm_db.executeUpdate(sql95);
                      }
                    }
                  }
                  String[] cost_pricen = request.getParameterValues("cost_price");
                  String[] list_pricen = request.getParameterValues("list_price");
                  String[] product_namen = request.getParameterValues("product_name");
                  String[] product_describen = request.getParameterValues("product_describe");
                  String[] amount_unitn = request.getParameterValues("amount_unit");
                  String[] typen = request.getParameterValues("type");
                  for (int i = 1; i < product_IDn.length; i++) {
                    StringTokenizer tokenTO3 = new StringTokenizer(list_pricen[i], ",");
                    String list_price = "";
                    while (tokenTO3.hasMoreTokens()) {
                      String list_price1 = tokenTO3.nextToken();
                      list_price += list_price1;
                    }
                    if (!amountn[i].equals("") && Double.parseDouble(amountn[i]) != 0) {
                      double list_price_subtotal =
                          Double.parseDouble(list_price) * Double.parseDouble(amountn[i]);
                      list_price_sum += list_price_subtotal;
                      double subtotal =
                          Double.parseDouble(cost_pricen[i]) * Double.parseDouble(amountn[i]);
                      cost_price_sum += subtotal;
                      demand_amount += Double.parseDouble(amountn[i]);
                      num++;
                      String sql1 =
                          "insert into stock_apply_pay_details(payer_chain_ID,payer_chain_name,sales_ID,sales_name,payer_ID,payer_name,payer_type,pay_ID,details_number,product_ID,product_name,product_describe,amount,amount_unit,list_price,list_price_subtotal,cost_price,subtotal,type) values ('"
                              + aaa1[0]
                              + "','"
                              + aaa1[1]
                              + "','"
                              + sales_ID
                              + "','"
                              + sales_name
                              + "','"
                              + payer_ID
                              + "','"
                              + payer_name
                              + "','销售赊货','"
                              + pay_ID
                              + "','"
                              + num
                              + "','"
                              + product_IDn[i]
                              + "','"
                              + product_namen[i]
                              + "','"
                              + product_describen[i]
                              + "','"
                              + amountn[i]
                              + "','"
                              + amount_unitn[i]
                              + "','"
                              + list_price
                              + "','"
                              + list_price_subtotal
                              + "','"
                              + cost_pricen[i]
                              + "','"
                              + subtotal
                              + "','"
                              + typen[i]
                              + "')";
                      stock_db.executeUpdate(sql1);
                      // **********************
                      if (rsList.size() == 0) {
                        if (typen[i].equals("物料") || typen[i].equals("外购商品")) {
                          String sql2 =
                              "insert into stock_pay_details(pay_ID,details_number,product_ID,product_name,type,list_price,list_price_subtotal,cost_price,subtotal,amount,unpay_amount,apply_manufacture_amount,apply_purchase_amount) values('"
                                  + stock_pay_ID
                                  + "','"
                                  + num
                                  + "','"
                                  + product_IDn[i]
                                  + "','"
                                  + product_namen[i]
                                  + "','"
                                  + typen[i]
                                  + "','"
                                  + list_price
                                  + "','"
                                  + list_price_subtotal
                                  + "','"
                                  + cost_pricen[i]
                                  + "','"
                                  + subtotal
                                  + "','"
                                  + amountn[i]
                                  + "','"
                                  + amountn[i]
                                  + "','0','"
                                  + amountn[i]
                                  + "')";
                          stock_db.executeUpdate(sql2);
                        } else if (typen[i].equals("商品")
                            || typen[i].equals("部件")
                            || typen[i].equals("委外部件")) {
                          String sql2 =
                              "insert into stock_pay_details(pay_ID,details_number,product_ID,product_name,type,list_price,list_price_subtotal,cost_price,subtotal,amount,unpay_amount,apply_manufacture_amount,apply_purchase_amount) values('"
                                  + stock_pay_ID
                                  + "','"
                                  + num
                                  + "','"
                                  + product_IDn[i]
                                  + "','"
                                  + product_namen[i]
                                  + "','"
                                  + typen[i]
                                  + "','"
                                  + list_price
                                  + "','"
                                  + list_price_subtotal
                                  + "','"
                                  + cost_pricen[i]
                                  + "','"
                                  + subtotal
                                  + "','"
                                  + amountn[i]
                                  + "','"
                                  + amountn[i]
                                  + "','"
                                  + amountn[i]
                                  + "','0')";
                          stock_db.executeUpdate(sql2);
                        }

                        String sql97 =
                            "select * from crm_salecredit_balance_details where crediter_ID='"
                                + payer_ID
                                + "' and product_ID='"
                                + product_IDn[i]
                                + "'";
                        ResultSet rs97 = crm_db.executeQuery(sql97);
                        if (rs97.next()) {
                          double balance_amount =
                              rs97.getDouble("amount") + Double.parseDouble(amountn[i]);
                          double balance_cost_price_subtotal =
                              rs97.getDouble("subtotal") + subtotal;
                          double balance_list_price_subtotal =
                              rs97.getDouble("list_price_subtotal") + list_price_subtotal;

                          String sql96 =
                              "update crm_salecredit_balance_details set amount='"
                                  + balance_amount
                                  + "',check_tag='1',subtotal='"
                                  + balance_cost_price_subtotal
                                  + "',list_price_subtotal='"
                                  + balance_list_price_subtotal
                                  + "' where crediter_ID='"
                                  + payer_ID
                                  + "' and product_ID='"
                                  + product_IDn[i]
                                  + "'";
                          crm_db.executeUpdate(sql96);
                        } else {
                          String[] aaa =
                              FileKind.getKind(
                                  (String) dbSession.getAttribute("unit_db_name"),
                                  "design_file",
                                  "product_ID",
                                  product_IDn[i]);
                          String sql95 =
                              "insert into crm_salecredit_balance_details(chain_ID,chain_name,crediter_chain_ID,crediter_chain_name,product_ID,product_name,list_price,list_price_subtotal,cost_price,subtotal,amount,crediter_ID,crediter_name) values('"
                                  + aaa[0]
                                  + "','"
                                  + aaa[1]
                                  + "','"
                                  + aaa1[0]
                                  + "','"
                                  + aaa1[1]
                                  + "','"
                                  + product_IDn[i]
                                  + "','"
                                  + product_namen[i]
                                  + "','"
                                  + list_price
                                  + "','"
                                  + list_price_subtotal
                                  + "','"
                                  + cost_pricen[i]
                                  + "','"
                                  + subtotal
                                  + "','"
                                  + amountn[i]
                                  + "','"
                                  + payer_ID
                                  + "','"
                                  + payer_name
                                  + "')";
                          crm_db.executeUpdate(sql95);
                        }
                      }
                      // ***************************
                    }
                  }
                  String sql =
                      "update stock_apply_pay set reason='"
                          + reason
                          + "',register='"
                          + register
                          + "',register_time='"
                          + register_time
                          + "',demand_return_time='"
                          + demand_return_time
                          + "',register_time='"
                          + register_time
                          + "',register='"
                          + register
                          + "',remark='"
                          + remark
                          + "',demand_amount='"
                          + demand_amount
                          + "',list_price_sum='"
                          + list_price_sum
                          + "',cost_price_sum='"
                          + cost_price_sum
                          + "',not_return_tag='"
                          + not_return_tag
                          + "' where pay_ID='"
                          + pay_ID
                          + "'";
                  stock_db.executeUpdate(sql);
                  if (flag) {
                    sql = "update stock_apply_pay set check_tag='1' where pay_ID='" + pay_ID + "'";
                    stock_db.executeUpdate(sql);
                    if (!vr.validata(
                        (String) dbSession.getAttribute("unit_db_name"),
                        "stock_pay",
                        "reasonexact",
                        pay_ID)) {
                      String sql4 =
                          "insert into stock_pay(pay_ID,reason,reasonexact,reasonexact_details,demand_amount,list_price_sum,cost_price_sum,register,register_time) values('"
                              + stock_pay_ID
                              + "','"
                              + reason
                              + "','"
                              + pay_ID
                              + "','"
                              + payer_name
                              + "','"
                              + demand_amount
                              + "','"
                              + list_price_sum
                              + "','"
                              + cost_price_sum
                              + "','"
                              + register
                              + "','"
                              + register_time
                              + "')";
                      stock_db.executeUpdate(sql4);
                    }

                    String sql98 = "select * from crm_file where customer_ID='" + payer_ID + "'";
                    ResultSet rs98 = crm_db.executeQuery(sql98);
                    if (rs98.next()) {
                      double salecredit_list_price_sum =
                          rs98.getDouble("salecredit_list_price_sum") + list_price_sum;
                      double salecredit_cost_price_sum =
                          rs98.getDouble("salecredit_cost_price_sum") + cost_price_sum;

                      String sql99 =
                          "update crm_file set credit_yes_or_not_tag='1',salecredit_list_price_sum='"
                              + salecredit_list_price_sum
                              + "',salecredit_cost_price_sum='"
                              + salecredit_cost_price_sum
                              + "' where customer_ID='"
                              + payer_ID
                              + "' ";
                      crm_db.executeUpdate(sql99);
                    }
                  } else {
                    sql = "update stock_apply_pay set check_tag='0' where pay_ID='" + pay_ID + "'";
                    stock_db.executeUpdate(sql);
                    Iterator ite = rsList.iterator();
                    while (ite.hasNext()) {
                      elem = (String[]) ite.next();
                      sql =
                          "insert into crm_workflow(config_id,object_ID,describe1,describe2) values ('"
                              + elem[0]
                              + "','"
                              + pay_ID
                              + "','"
                              + elem[1]
                              + "','"
                              + elem[2]
                              + "')";
                      crm_db.executeUpdate(sql);
                    }
                  }

                  response.sendRedirect("draft/crm/credit_ok.jsp?finished_tag=8");
                } else {

                  response.sendRedirect(
                      "draft/crm/credit_ok.jsp?finished_tag=7&pay_ID=" + pay_ID + "");
                }
              } catch (Exception ex) {
                ex.printStackTrace();
              }
            } else {

              response.sendRedirect("draft/crm/credit_ok.jsp?finished_tag=6&pay_ID=" + pay_ID + "");
            }
          } else {

            response.sendRedirect("draft/crm/credit_ok.jsp?finished_tag=9");
          }
        }
        stock_db.commit();
        crm_db.commit();
        stock_db.close();
        crm_db.close();
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();
    try {
      HttpSession session = request.getSession();
      PrintWriter out = response.getWriter();
      nseer_db_backup1 fund_db = new nseer_db_backup1(dbApplication);
      nseer_db_backup1 fund_db1 = new nseer_db_backup1(dbApplication);
      if (fund_db.conn((String) dbSession.getAttribute("unit_db_name"))
          && fund_db1.conn((String) dbSession.getAttribute("unit_db_name"))) {
        counter count = new counter(dbApplication);
        ValidataRecordNumber vrn = new ValidataRecordNumber();
        ValidataTag vt = new ValidataTag();
        ValidataNumber validata = new ValidataNumber();
        try {
          String time = "";
          java.util.Date now = new java.util.Date();
          SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
          time = formatter.format(now);

          String apply_pay_ID = request.getParameter("apply_pay_ID");
          String register_time = request.getParameter("register_time");
          String register = request.getParameter("register");
          String register_ID = request.getParameter("register_ID");
          String bodyc = new String(request.getParameter("remark").getBytes("UTF-8"), "UTF-8");
          String remark = exchange.toHtml(bodyc);
          String amount = request.getParameter("amount");
          String[] file_kind = request.getParameterValues("file_kind");
          String[] cost_price_subtotal = request.getParameterValues("cost_price_subtotal");
          int p = 0;
          String file_kinda = ",";
          for (int j = 1; j < file_kind.length; j++) {
            file_kinda += file_kind[j] + ",";
            if (cost_price_subtotal[j].equals("")) cost_price_subtotal[j] = "0";
            StringTokenizer tokenTO4 = new StringTokenizer(cost_price_subtotal[j], ",");
            String cost_price_subtotal1 = "";
            while (tokenTO4.hasMoreTokens()) {
              cost_price_subtotal1 += tokenTO4.nextToken();
            }
            if (!validata.validata(cost_price_subtotal1)) {
              p++;
            }
          }
          int n = 0;
          for (int i = 1; i <= Integer.parseInt(amount); i++) {
            String tem_file_kind = "file_kind" + i;
            String file_kind2 = request.getParameter(tem_file_kind);
            if (file_kinda.indexOf(file_kind2) != -1) n++;
          }
          if (n == 0) {
            if (p == 0) {
              if (vt.validata(
                          (String) dbSession.getAttribute("unit_db_name"),
                          "fund_apply_pay",
                          "apply_pay_ID",
                          apply_pay_ID,
                          "check_tag")
                      .equals("5")
                  || vt.validata(
                          (String) dbSession.getAttribute("unit_db_name"),
                          "fund_apply_pay",
                          "apply_pay_ID",
                          apply_pay_ID,
                          "check_tag")
                      .equals("9")) {
                String currency_name = "";
                String personal_unit = "";
                String chain_ID = "";
                String chain_name = "";
                String funder = "";
                String funder_ID = "";
                String sql11 =
                    "select * from fund_apply_pay where apply_pay_ID='" + apply_pay_ID + "'";
                ResultSet rs11 = fund_db.executeQuery(sql11);
                while (rs11.next()) {
                  chain_ID = rs11.getString("chain_ID");
                  chain_name = rs11.getString("chain_name");
                  funder = rs11.getString("human_name");
                  funder_ID = rs11.getString("human_ID");
                  currency_name = rs11.getString("currency_name");
                  personal_unit = rs11.getString("personal_unit");
                }
                int expenses_amount = 0;
                String sql6 =
                    "select count(*) from fund_apply_pay_details where apply_pay_ID='"
                        + apply_pay_ID
                        + "'";
                ResultSet rs6 = fund_db.executeQuery(sql6);
                if (rs6.next()) {
                  expenses_amount = rs6.getInt("count(*)");
                }
                double demand_cost_price_sum = 0.0d;
                for (int i = 1; i <= expenses_amount; i++) {
                  String tem_cost_price_subtotal = "cost_price_subtotal" + i;
                  String cost_price_subtotal2 = request.getParameter(tem_cost_price_subtotal);
                  demand_cost_price_sum += Double.parseDouble(cost_price_subtotal2);
                  sql6 =
                      "update fund_apply_pay_details set cost_price_subtotal='"
                          + cost_price_subtotal2
                          + "' where apply_pay_ID='"
                          + apply_pay_ID
                          + "' and details_number='"
                          + i
                          + "'";
                  fund_db.executeUpdate(sql6);
                }
                for (int i = 1; i < file_kind.length; i++) {
                  StringTokenizer tokenTO1 = new StringTokenizer(file_kind[i], "/");
                  String file_chain_ID = "";
                  String file_chain_name = "";
                  while (tokenTO1.hasMoreTokens()) {
                    file_chain_ID = tokenTO1.nextToken();
                    file_chain_name = tokenTO1.nextToken();
                  }
                  StringTokenizer tokenTO4 = new StringTokenizer(cost_price_subtotal[i], ",");
                  String cost_price_subtotal1 = "";
                  while (tokenTO4.hasMoreTokens()) {
                    cost_price_subtotal1 += tokenTO4.nextToken();
                  }
                  demand_cost_price_sum += Double.parseDouble(cost_price_subtotal1);
                  expenses_amount++;
                  String sql1 =
                      "insert into fund_apply_pay_details(apply_pay_ID,details_number,file_chain_ID,file_chain_name,cost_price_subtotal) values ('"
                          + apply_pay_ID
                          + "','"
                          + expenses_amount
                          + "','"
                          + file_chain_ID
                          + "','"
                          + file_chain_name
                          + "','"
                          + cost_price_subtotal1
                          + "')";
                  fund_db.executeUpdate(sql1);
                }

                String sql =
                    "update fund_apply_pay set demand_cost_price_sum='"
                        + demand_cost_price_sum
                        + "',check_tag='2',register_time='"
                        + register_time
                        + "',register='"
                        + register
                        + "',remark='"
                        + remark
                        + "' where apply_pay_ID='"
                        + apply_pay_ID
                        + "'";
                fund_db.executeUpdate(sql);

                response.sendRedirect("draft/fund/applyPayExpenses_ok.jsp?finished_tag=2");
              } else {
                response.sendRedirect("draft/fund/applyPayExpenses_ok.jsp?finished_tag=3");
              }
            } else {
              response.sendRedirect("draft/fund/applyPayExpenses_ok.jsp?finished_tag=6");
            }
          } else {
            response.sendRedirect("draft/fund/applyPayExpenses_ok.jsp?finished_tag=7");
          }
        } catch (Exception ex) {
          ex.printStackTrace();
        }
        fund_db.commit();
        fund_db1.commit();
        fund_db.close();
        fund_db1.close();
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Ejemplo n.º 5
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    try {
      // 实例化

      HttpSession session = request.getSession();
      ServletContext context = session.getServletContext();
      String path = context.getRealPath("/");
      counter count = new counter(dbApplication);
      SmartUpload mySmartUpload = new SmartUpload();
      mySmartUpload.setCharset("UTF-8");
      nseer_db_backup1 qcs_db = new nseer_db_backup1(dbApplication);

      if (qcs_db.conn((String) dbSession.getAttribute("unit_db_name"))) {

        mySmartUpload.initialize(pageContext);
        String file_type = getFileLength.getFileType((String) session.getAttribute("unit_db_name"));
        long d = getFileLength.getFileLength((String) session.getAttribute("unit_db_name"));
        mySmartUpload.setMaxFileSize(d);
        mySmartUpload.setAllowedFilesList(file_type);

        try {
          mySmartUpload.upload();
          String qcs_id = mySmartUpload.getRequest().getParameter("qcs_id");
          String config_id = mySmartUpload.getRequest().getParameter("config_id");

          String[] item = mySmartUpload.getRequest().getParameterValues("item");
          if (item != null) {
            String[] file_name = new String[mySmartUpload.getFiles().getCount()];
            String[] not_change = new String[mySmartUpload.getFiles().getCount()];
            java.util.Date now = new java.util.Date();
            SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
            String time = formatter.format(now);
            String standard_id = mySmartUpload.getRequest().getParameter("standard_id");
            String sqla =
                "select attachment1 from qcs_intrmanufacture where qcs_id='"
                    + qcs_id
                    + "' and (check_tag='5' or check_tag='9')";
            ResultSet rs = qcs_db.executeQuery(sqla);
            if (!rs.next()) {
              response.sendRedirect("draft/qcs/intrmanufacture_ok.jsp?finished_tag=1");
            } else {
              String[] attachment = mySmartUpload.getRequest().getParameterValues("attachment");
              String[] delete_file_name = new String[0];
              if (attachment != null) {
                delete_file_name = new String[attachment.length];
                for (int i = 0; i < attachment.length; i++) {
                  delete_file_name[i] = rs.getString(attachment[i]);
                }
              }
              for (int i = 0; i < mySmartUpload.getFiles().getCount(); i++) {
                com.jspsmart.upload.SmartFile file = mySmartUpload.getFiles().getFile(i);
                if (file.isMissing()) {
                  file_name[i] = "";
                  int q = i + 1;
                  String field_name = "attachment" + q;
                  if (!rs.getString(field_name).equals("")) not_change[i] = "yes";
                  continue;
                }
                int filenum =
                    count.read(
                        (String) dbSession.getAttribute("unit_db_name"), "qcsAttachmentcount");
                count.write(
                    (String) dbSession.getAttribute("unit_db_name"), "qcsAttachmentcount", filenum);
                file_name[i] = filenum + file.getFileName();
                file.saveAs(path + "qcs/file_attachments/" + filenum + file.getFileName());
              }
              String apply_id = mySmartUpload.getRequest().getParameter("apply_id");
              String product_id = mySmartUpload.getRequest().getParameter("product_id");
              String product_name = mySmartUpload.getRequest().getParameter("product_name");
              String qcs_amount = mySmartUpload.getRequest().getParameter("qcs_amount");
              String qcs_time = mySmartUpload.getRequest().getParameter("qcs_time");
              String quality_way = mySmartUpload.getRequest().getParameter("quality_way");
              String quality_solution = mySmartUpload.getRequest().getParameter("quality_solution");
              String sampling_standard =
                  mySmartUpload.getRequest().getParameter("sampling_standard");
              String sampling_amount = mySmartUpload.getRequest().getParameter("sampling_amount");
              String accept = mySmartUpload.getRequest().getParameter("accept");
              String reject = mySmartUpload.getRequest().getParameter("reject");
              String qualified = mySmartUpload.getRequest().getParameter("qualified");
              String unqualified = mySmartUpload.getRequest().getParameter("unqualified");
              String qcs_result = mySmartUpload.getRequest().getParameter("qcs_result");
              String checker = mySmartUpload.getRequest().getParameter("checker");
              String checker_id = mySmartUpload.getRequest().getParameter("checker_id");
              String check_time = mySmartUpload.getRequest().getParameter("check_time");
              String changer = mySmartUpload.getRequest().getParameter("changer");
              String changer_id = mySmartUpload.getRequest().getParameter("changer_id");
              String change_time = mySmartUpload.getRequest().getParameter("change_time");
              String bodyab =
                  new String(
                      mySmartUpload.getRequest().getParameter("remark").getBytes("UTF-8"), "UTF-8");
              String remark = exchange.toHtml(bodyab);

              sqla =
                  "update qcs_intrmanufacture set apply_id='"
                      + apply_id
                      + "',product_id='"
                      + product_id
                      + "',product_name='"
                      + product_name
                      + "',qcs_amount='"
                      + qcs_amount
                      + "',qcs_time='"
                      + qcs_time
                      + "',quality_way='"
                      + quality_way
                      + "',quality_solution='"
                      + quality_solution
                      + "',sampling_standard='"
                      + sampling_standard
                      + "',sampling_amount='"
                      + sampling_amount
                      + "',accept='"
                      + accept
                      + "',reject='"
                      + reject
                      + "',qualified='"
                      + qualified
                      + "',unqualified='"
                      + unqualified
                      + "',changer_id='"
                      + changer_id
                      + "',qcs_result='"
                      + qcs_result
                      + "',changer='"
                      + changer
                      + "',change_time='"
                      + change_time
                      + "',remark='"
                      + remark
                      + "',check_tag='5'";
              String sqlb = " where qcs_id='" + qcs_id + "'";
              if (attachment != null) {
                for (int i = 0; i < attachment.length; i++) {
                  sqla = sqla + "," + attachment[i] + "=''";
                  java.io.File file =
                      new java.io.File(path + "qcs/file_attachments/" + delete_file_name[i]);
                  file.delete();
                }
              }
              for (int i = 0; i < mySmartUpload.getFiles().getCount(); i++) {
                if (not_change[i] != null && not_change[i].equals("yes")) continue;
                int p = i + 1;
                sqla = sqla + ",attachment" + p + "='" + file_name[i] + "'";
              }
              String sql = sqla + sqlb;
              qcs_db.executeUpdate(sql);

              sql = "delete from qcs_intrmanufacture_details where qcs_id='" + qcs_id + "'";
              qcs_db.executeUpdate(sql);

              String[] default_basis =
                  mySmartUpload.getRequest().getParameterValues("default_basis");
              String[] ready_basis = mySmartUpload.getRequest().getParameterValues("ready_basis");
              String[] quality_method =
                  mySmartUpload.getRequest().getParameterValues("quality_method");
              String[] analyse_method =
                  mySmartUpload.getRequest().getParameterValues("analyse_method");
              String[] standard_value =
                  mySmartUpload.getRequest().getParameterValues("standard_value");
              String[] standard_max = mySmartUpload.getRequest().getParameterValues("standard_max");
              String[] standard_min = mySmartUpload.getRequest().getParameterValues("standard_min");
              String[] quality_value =
                  mySmartUpload.getRequest().getParameterValues("quality_value");
              String[] sampling_amount_d =
                  mySmartUpload.getRequest().getParameterValues("sampling_amount_d");
              String[] qualified_d = mySmartUpload.getRequest().getParameterValues("qualified_d");
              String[] unqualified_d =
                  mySmartUpload.getRequest().getParameterValues("unqualified_d");
              String[] quality_result =
                  mySmartUpload.getRequest().getParameterValues("quality_result");
              String[] unqualified_reason =
                  mySmartUpload.getRequest().getParameterValues("unqualified_reason");
              for (int i = 0; i < item.length; i++) {
                if (!item[i].equals("")) {
                  sql =
                      "insert into qcs_intrmanufacture_details(qcs_id,item,default_basis,ready_basis,quality_method,analyse_method,standard_value,standard_max,standard_min,quality_value,sampling_amount_d,qualified_d,unqualified_d,quality_result,unqualified_reason,details_number) values('"
                          + qcs_id
                          + "','"
                          + item[i]
                          + "','"
                          + default_basis[i]
                          + "','"
                          + ready_basis[i]
                          + "','"
                          + quality_method[i]
                          + "','"
                          + analyse_method[i]
                          + "','"
                          + standard_value[i]
                          + "','"
                          + standard_max[i]
                          + "','"
                          + standard_min[i]
                          + "','"
                          + quality_value[i]
                          + "','"
                          + sampling_amount_d[i]
                          + "','"
                          + qualified_d[i]
                          + "','"
                          + unqualified_d[i]
                          + "','"
                          + quality_result[i]
                          + "','"
                          + unqualified_reason[i]
                          + "','"
                          + i
                          + "')";
                  qcs_db.executeUpdate(sql);
                }
              }
              response.sendRedirect("draft/qcs/intrmanufacture_ok.jsp?finished_tag=0");
            }
            qcs_db.commit();
            qcs_db.close();
          } else {
            response.sendRedirect("draft/qcs/intrmanufacture_ok.jsp?finished_tag=7");
          }

        } catch (Exception ex) {
          response.sendRedirect("draft/qcs/intrmanufacture_ok.jsp?finished_tag=6");
        }

      } else {
        response.sendRedirect("error_conn.htm");
      }

    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Ejemplo n.º 6
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    try {
      HttpSession dbSession = request.getSession();
      ServletContext dbApplication = dbSession.getServletContext();
      nseer_db_backup1 manufacture_db = new nseer_db_backup1(dbApplication);
      nseer_db_backup1 manufacture_db1 = new nseer_db_backup1(dbApplication);
      nseer_db_backup1 stock_db = new nseer_db_backup1(dbApplication);
      ValidataNumber validata = new ValidataNumber();
      ValidataTag vt = new ValidataTag();
      counter count = new counter(dbApplication);

      if (manufacture_db.conn((String) dbSession.getAttribute("unit_db_name"))
          && manufacture_db1.conn((String) dbSession.getAttribute("unit_db_name"))
          && stock_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        String checker_ID = request.getParameter("checker_ID");
        String config_id = request.getParameter("config_id");
        String manufacture_ID = request.getParameter("manufacture_ID");
        String module_time = request.getParameter("module_time");
        String choice = request.getParameter("choice");
        String procedure_ID = request.getParameter("procedure_ID");
        String procedure_name = request.getParameter("procedure_name");
        String register_time = request.getParameter("register_time");
        String procedure_responsible_person = request.getParameter("procedure_responsible_person");
        String checker = request.getParameter("checker");
        String check_time = request.getParameter("check_time");
        String bodyc = new String(request.getParameter("reason").getBytes("UTF-8"), "UTF-8");
        String reason = exchange.toHtml(bodyc);

        String sql6 =
            "select id from manufacture_workflow where object_ID='"
                + manufacture_ID
                + "' and module_time='"
                + module_time
                + "' and procedure_ID='"
                + procedure_ID
                + "' and ((check_tag='0' and config_id<'"
                + config_id
                + "') or (check_tag='1' and config_id='"
                + config_id
                + "'))";
        ResultSet rs6 = manufacture_db.executeQuery(sql6);
        if (!rs6.next()) {
          String sql88 =
              "select * from manufacture_module_balance where manufacture_ID='"
                  + manufacture_ID
                  + "' and module_time='"
                  + module_time
                  + "' and procedure_ID='"
                  + procedure_ID
                  + "' and check_tag='0'";
          ResultSet rs88 = manufacture_db.executeQuery(sql88);
          if (rs88.next()) {
            if (choice != null) {
              if (choice.equals("")) {
                String sql =
                    "update manufacture_module_balance set procedure_responsible_person='"
                        + procedure_responsible_person
                        + "',checker='"
                        + checker
                        + "',check_time='"
                        + check_time
                        + "',reason='"
                        + reason
                        + "',check_tag='9' where manufacture_ID='"
                        + manufacture_ID
                        + "' and register_time='"
                        + register_time
                        + "' and procedure_ID='"
                        + procedure_ID
                        + "' and module_time='"
                        + module_time
                        + "'";
                manufacture_db.executeUpdate(sql);
                sql =
                    "delete from manufacture_workflow where object_ID='"
                        + manufacture_ID
                        + "' and procedure_ID='"
                        + procedure_ID
                        + "' and module_time='"
                        + module_time
                        + "'";
                manufacture_db.executeUpdate(sql);

              } else {

                sql6 =
                    "select id from manufacture_workflow where object_ID='"
                        + manufacture_ID
                        + "' and module_time='"
                        + module_time
                        + "' and procedure_ID='"
                        + procedure_ID
                        + "' and config_id<'"
                        + config_id
                        + "' and config_id>='"
                        + choice
                        + "'";
                rs6 = manufacture_db.executeQuery(sql6);
                while (rs6.next()) {
                  String sql =
                      "update manufacture_workflow set check_tag='0' where id='"
                          + rs6.getString("id")
                          + "'";
                  manufacture_db1.executeUpdate(sql);
                }
              }
              response.sendRedirect(
                  "manufacture/module_balance/check_delete_ok.jsp?finished_tag=0");
            } else {
              response.sendRedirect(
                  "manufacture/module_balance/check_delete_ok.jsp?finished_tag=1");
            }
          } else {
            response.sendRedirect("manufacture/module_balance/check_delete_ok.jsp?finished_tag=3");
          }
        } else {
          response.sendRedirect("manufacture/module_balance/check_delete_ok.jsp?finished_tag=2");
        }
        manufacture_db.commit();
        manufacture_db1.commit();
        manufacture_db.close();
        manufacture_db1.close();
        stock_db.close();
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Ejemplo n.º 7
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    try {
      HttpSession session = request.getSession();
      PrintWriter out = response.getWriter();
      businessComment demo = new businessComment();
      demo.setPath(request);
      Email mail = new Email();
      nseer_db_backup1 design_db = new nseer_db_backup1(dbApplication);
      nseer_db_backup1 intrmanufacture_db = new nseer_db_backup1(dbApplication);
      if (design_db.conn((String) dbSession.getAttribute("unit_db_name"))
          && intrmanufacture_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        String kind_chain = request.getParameter("kind_chain");
        String chain_id = Divide1.getId(kind_chain);
        String chain_name = Divide1.getName(kind_chain);
        String provider_ID =
            NseerId.getId("intrmanufacture/file", (String) dbSession.getAttribute("unit_db_name"));
        String intrmanufacturer = request.getParameter("intrmanufacturer");
        String intrmanufacturer_ID = request.getParameter("intrmanufacturer_ID");
        String provider_name = request.getParameter("provider_name");
        String provider_address = request.getParameter("provider_address");
        String type = request.getParameter("type");
        String provider_class = request.getParameter("class1");
        String used_provider_name = request.getParameter("used_provider_name");
        String provider_bank = request.getParameter("provider_bank");
        String provider_account = request.getParameter("provider_account");
        String provider_web = request.getParameter("provider_web");
        String provider_tel1 = request.getParameter("provider_tel1");
        String provider_fax = request.getParameter("provider_fax");
        String provider_postcode = request.getParameter("provider_postcode");
        String contact_person1 = request.getParameter("contact_person1");
        String contact_person1_department = request.getParameter("contact_person1_department");
        String contact_person1_duty = request.getParameter("contact_person1_duty");
        String contact_person1_sex = request.getParameter("contact_person1_sex");
        String contact_person1_office_tel = request.getParameter("contact_person1_office_tel");
        String contact_person1_home_tel = request.getParameter("contact_person1_home_tel");
        String contact_person1_mobile = request.getParameter("contact_person1_mobile");
        String contact_person1_email = request.getParameter("contact_person1_email");
        String contact_person2 = request.getParameter("contact_person2");
        String contact_person2_department = request.getParameter("contact_person2_department");
        String contact_person2_duty = request.getParameter("contact_person2_duty");
        String contact_person2_sex = request.getParameter("contact_person2_sex");
        String contact_person2_office_tel = request.getParameter("contact_person2_office_tel");
        String contact_person2_home_tel = request.getParameter("contact_person2_home_tel");
        String contact_person2_mobile = request.getParameter("contact_person2_mobile");
        String contact_person2_email = request.getParameter("contact_person2_email");
        String register = request.getParameter("register");
        String register_time = request.getParameter("register_time");
        String bodyc = new String(request.getParameter("invoice_info").getBytes("UTF-8"), "UTF-8");
        String invoice_info = exchange.toHtml(bodyc);
        String bodya =
            new String(request.getParameter("demand_products").getBytes("UTF-8"), "UTF-8");
        String demand_products = exchange.toHtml(bodya);
        try {
          if (!chain_id.equals("")) {
            String sqll =
                "select * from intrmanufacture_file where provider_ID='"
                    + provider_ID
                    + "' and provider_name='"
                    + provider_name
                    + "'";
            ResultSet rset = intrmanufacture_db.executeQuery(sqll);
            if (rset.next()) {
              response.sendRedirect("portal/oem/register1_ok_a.jsp");
            } else {
              String sql =
                  "insert into intrmanufacture_file(chain_id,chain_name,provider_ID,provider_name,provider_address,provider_class,type,provider_bank,provider_account,provider_web,provider_tel1,provider_fax,provider_postcode,used_provider_name,contact_person1,contact_person1_department,contact_person1_duty,contact_person1_sex,contact_person1_office_tel,contact_person1_home_tel,contact_person1_mobile,contact_person1_email,contact_person2,contact_person2_department,contact_person2_duty,contact_person2_sex,contact_person2_office_tel,contact_person2_home_tel,contact_person2_mobile,contact_person2_email,register,register_time,invoice_info,demand_products,check_tag,modify_tag,excel_tag,intrmanufacturer,intrmanufacturer_ID) values ('"
                      + chain_id
                      + "','"
                      + chain_name
                      + "','"
                      + provider_ID
                      + "','"
                      + provider_name
                      + "','"
                      + provider_address
                      + "','"
                      + provider_class
                      + "','"
                      + type
                      + "','"
                      + provider_bank
                      + "','"
                      + provider_account
                      + "','"
                      + provider_web
                      + "','"
                      + provider_tel1
                      + "','"
                      + provider_fax
                      + "','"
                      + provider_postcode
                      + "','"
                      + used_provider_name
                      + "','"
                      + contact_person1
                      + "','"
                      + contact_person1_department
                      + "','"
                      + contact_person1_duty
                      + "','"
                      + contact_person1_sex
                      + "','"
                      + contact_person1_office_tel
                      + "','"
                      + contact_person1_home_tel
                      + "','"
                      + contact_person1_mobile
                      + "','"
                      + contact_person1_email
                      + "','"
                      + contact_person2
                      + "','"
                      + contact_person2_department
                      + "','"
                      + contact_person2_duty
                      + "','"
                      + contact_person2_sex
                      + "','"
                      + contact_person2_office_tel
                      + "','"
                      + contact_person2_home_tel
                      + "','"
                      + contact_person2_mobile
                      + "','"
                      + contact_person2_email
                      + "','"
                      + register
                      + "','"
                      + register_time
                      + "','"
                      + invoice_info
                      + "','"
                      + demand_products
                      + "','0','0','1','"
                      + intrmanufacturer
                      + "','"
                      + intrmanufacturer_ID
                      + "')";
              intrmanufacture_db.executeUpdate(sql);
              String[] email_box = {contact_person1_email};
              mail.send(
                  email_box,
                  "smtp.sina.com.cn",
                  "*****@*****.**",
                  "123456",
                  demo.getLang("erp", "注册信息"),
                  "欢迎您注册成为我们的委外厂商,您的档案编号是:" + provider_ID);

              CdefineUpdate CdefineUpdate = new CdefineUpdate();
              sql =
                  CdefineUpdate.update("intrmanufacture_file", "provider_ID", provider_ID, request);
              intrmanufacture_db.executeUpdate(sql);
              /** ************************************************** */
              List rsList = (List) new java.util.ArrayList();
              String[] elem = new String[3];
              sql =
                  "select id,describe1,describe2 from intrmanufacture_config_workflow where type_id='01'";
              rset = intrmanufacture_db.executeQuery(sql);
              while (rset.next()) {
                elem = new String[3];
                elem[0] = rset.getString("id");
                elem[1] = rset.getString("describe1");
                elem[2] = rset.getString("describe2");
                rsList.add(elem);
              }
              if (rsList.size() == 0) {
                sql =
                    "update intrmanufacture_file set check_tag='1' where provider_ID='"
                        + provider_ID
                        + "'";
                intrmanufacture_db.executeUpdate(sql);
              } else {
                Iterator ite = rsList.iterator();
                while (ite.hasNext()) {
                  elem = (String[]) ite.next();
                  sql =
                      "insert into intrmanufacture_workflow(config_id,object_ID,describe1,describe2) values ('"
                          + elem[0]
                          + "','"
                          + provider_ID
                          + "','"
                          + elem[1]
                          + "','"
                          + elem[2]
                          + "')";
                  intrmanufacture_db.executeUpdate(sql);
                }
              }
              response.sendRedirect(
                  "portal/oem/register1_choose_attachment.jsp?provider_ID=" + provider_ID + "");
            }
          } else {
            response.sendRedirect("portal/oem/register1_ok_b.jsp");
          }
        } catch (Exception ex) {
          out.println("error" + ex);
        }
        intrmanufacture_db.commit();
        design_db.commit();
        intrmanufacture_db.close();
        design_db.close();
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Ejemplo n.º 8
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    ServletContext application;
    HttpSession session = request.getSession();
    nseer_db_backup1 stock_db = new nseer_db_backup1(dbApplication);
    ValidataNumber validata = new ValidataNumber();
    counter count = new counter(dbApplication);
    ValidataTag vt = new ValidataTag();

    try {
      if (stock_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        String checker_ID = (String) session.getAttribute("human_IDD"); // **************
        String config_id = request.getParameter("config_id"); // ****************
        String min_amount = request.getParameter("min_amount");
        String max_amount = request.getParameter("max_amount");
        String stock_amount = request.getParameter("stock_amount");
        String design_ID = request.getParameter("design_ID");
        String product_ID = request.getParameter("product_ID");
        int num = Integer.parseInt(stock_amount);
        String designer = request.getParameter("designer");
        String bodyc = new String(request.getParameter("cell_describe").getBytes("UTF-8"), "UTF-8");
        String cell_describe = exchange.toHtml(bodyc);
        String check_time = request.getParameter("check_time");
        String checker = request.getParameter("checker");
        String serial_number_tag = request.getParameter("serial_number_tag");
        int p = 0;
        int q = 0;

        for (int i = 1; i < num; i++) {
          String tem_max_capacity_amount = "max_capacity_amount" + i;
          String tem_nick_name = "nick_name" + i;
          String tem_amount_unit = "amount_unit" + i;
          String tem_stock_ID = "stock_ID" + i;
          String stock_ID = request.getParameter(tem_stock_ID);
          String max_capacity_amount = request.getParameter(tem_max_capacity_amount);
          String nick_name = request.getParameter(tem_nick_name);
          String amount_unit = request.getParameter(tem_amount_unit);
          if (max_capacity_amount.equals("")) max_capacity_amount = "0";
          if (!validata.validata(max_capacity_amount)) {
            p++;
          } else if (Double.parseDouble(max_capacity_amount) == 0) {
            q++;
            String sql5 =
                "select * from stock_balance_details where stock_ID='"
                    + stock_ID
                    + "' and product_ID='"
                    + product_ID
                    + "'";
            ResultSet rs5 = stock_db.executeQuery(sql5);
            if (rs5.next()) {
              p++;
            }
          } else if (Double.parseDouble(max_capacity_amount) < 0) {
            p++;
          }
          if (nick_name.indexOf("'") != -1
              || nick_name.indexOf("\"") != -1
              || nick_name.indexOf(",") != -1
              || amount_unit.indexOf("'") != -1
              || amount_unit.indexOf("\"") != -1
              || amount_unit.indexOf(",") != -1) {
            p++;
          }
        }
        if (!validata.validata(min_amount) || !validata.validata(max_amount)) {
          p++;
        }
        if (vt.validata(
                    (String) dbSession.getAttribute("unit_db_name"),
                    "stock_cell",
                    "design_ID",
                    design_ID,
                    "check_tag")
                .equals("5")
            || vt.validata(
                    (String) dbSession.getAttribute("unit_db_name"),
                    "stock_cell",
                    "design_ID",
                    design_ID,
                    "check_tag")
                .equals("9")) {

          if (p == 0 && q < num - 1) {

            try {

              String sql =
                  "update stock_cell set checker='"
                      + checker
                      + "',designer='"
                      + designer
                      + "',cell_describe='"
                      + cell_describe
                      + "',min_amount='"
                      + min_amount
                      + "',max_amount='"
                      + max_amount
                      + "',check_tag='5',serial_number_tag='"
                      + serial_number_tag
                      + "' where design_ID='"
                      + design_ID
                      + "'";
              stock_db.executeUpdate(sql);

              String sql4 = "select * from stock_cell where design_ID='" + design_ID + "'";
              ResultSet rs4 = stock_db.executeQuery(sql4);
              if (rs4.next()) {
                product_ID = rs4.getString("product_ID");
              }
              for (int i = 1; i < num; i++) {
                String tem_nick_name = "nick_name" + i;
                String tem_max_capacity_amount = "max_capacity_amount" + i;
                String tem_amount_unit = "amount_unit" + i;
                String nick_name = request.getParameter(tem_nick_name);
                String max_capacity_amount = request.getParameter(tem_max_capacity_amount);
                String amount_unit = request.getParameter(tem_amount_unit);
                if (max_capacity_amount.equals("")) max_capacity_amount = "0";
                String sql1 =
                    "update stock_cell_details set nick_name='"
                        + nick_name
                        + "',max_capacity_amount='"
                        + max_capacity_amount
                        + "',amount_unit='"
                        + amount_unit
                        + "' where design_ID='"
                        + design_ID
                        + "' and details_number='"
                        + i
                        + "'";
                stock_db.executeUpdate(sql1);
              }

              for (int i = 1; i < num; i++) {
                String tem_stock_name = "stock_name" + i;
                String tem_stock_ID = "stock_ID" + i;
                String tem_nick_name = "nick_name" + i;
                String tem_max_capacity_amount = "max_capacity_amount" + i;
                String tem_amount_unit = "amount_unit" + i;
                String stock_name = request.getParameter(tem_stock_name);
                String stock_ID = request.getParameter(tem_stock_ID);
                String nick_name = request.getParameter(tem_nick_name);
                String max_capacity_amount = request.getParameter(tem_max_capacity_amount);
                String amount_unit = request.getParameter(tem_amount_unit);
                if (!max_capacity_amount.equals("")
                    && Double.parseDouble(max_capacity_amount) != 0) {
                  String sql3 =
                      "select * from stock_cell_details where design_ID='"
                          + design_ID
                          + "' and stock_name='"
                          + stock_name
                          + "'";
                  ResultSet rs3 = stock_db.executeQuery(sql3);
                  if (rs3.next()) {
                    String sql1 =
                        "update stock_cell_details set details_number='"
                            + i
                            + "',nick_name='"
                            + nick_name
                            + "',max_capacity_amount='"
                            + max_capacity_amount
                            + "',amount_unit='"
                            + amount_unit
                            + "' where design_ID='"
                            + design_ID
                            + "' and stock_name='"
                            + stock_name
                            + "'";
                    stock_db.executeUpdate(sql1);
                  } else {
                    String sql2 =
                        "insert into stock_cell_details(design_ID,details_number,stock_ID,stock_name,nick_name,max_capacity_amount,amount_unit) values ('"
                            + design_ID
                            + "','"
                            + i
                            + "','"
                            + stock_ID
                            + "','"
                            + stock_name
                            + "','"
                            + nick_name
                            + "','"
                            + max_capacity_amount
                            + "','"
                            + amount_unit
                            + "')";
                    stock_db.executeUpdate(sql2);
                  }

                } else if (max_capacity_amount.equals("")
                    || Double.parseDouble(max_capacity_amount) == 0) {
                  sql4 =
                      "delete from stock_cell_details where design_ID='"
                          + design_ID
                          + "' and stock_ID='"
                          + stock_ID
                          + "'";
                  stock_db.executeUpdate(sql4);
                }
              }

            } catch (Exception ex) {
              ex.printStackTrace();
            }
            response.sendRedirect("draft/stock/cell_ok.jsp?finished_tag=0");
          } else {
            response.sendRedirect("draft/stock/cell_ok.jsp?finished_tag=1");
          }
        } else {
          response.sendRedirect("draft/stock/cell_ok.jsp?finished_tag=2");
        }

        stock_db.commit();
        stock_db.close();
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Ejemplo n.º 9
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    try {

      HttpSession session = request.getSession();
      PrintWriter out = response.getWriter();

      nseer_db_backup1 security_db = new nseer_db_backup1(dbApplication);
      if (security_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        getRecordCount query = new getRecordCount();

        String tablename = request.getParameter("tablename");
        String[] cols = request.getParameterValues("col");

        if (cols == null) {

          response.sendRedirect("hr/config/key/key_register_ok_a.jsp");

        } else {
          String column_group = "";
          for (int i = 0; i < cols.length; i++) {
            column_group += cols[i] + ",";
          }
          column_group = column_group.substring(0, column_group.length() - 1);
          String sql1 =
              "select * from security_publicconfig_key where tablename='" + tablename + "'";
          ResultSet rs = security_db.executeQuery(sql1);
          if (rs.next()) {
            String sql =
                "update security_publicconfig_key set column_group='"
                    + column_group
                    + "' where tablename='"
                    + tablename
                    + "'";
            security_db.executeUpdate(sql);
          } else {
            String sql =
                "insert into security_publicconfig_key(tablename,column_group) values('"
                    + tablename
                    + "','"
                    + column_group
                    + "')";
            security_db.executeUpdate(sql);
          }

          response.sendRedirect("hr/config/key/key_register_ok_b.jsp");
        }
        security_db.commit();
        security_db.close();

      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
    }
  }
Ejemplo n.º 10
0
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    try {
      PrintWriter out = response.getWriter();
      session = request.getSession();
      counter count = new counter(dbApplication);
      ValidataNumber validata = new ValidataNumber();
      ValidataRecord vr = new ValidataRecord();
      ValidataTag vt = new ValidataTag();
      getNameFromID getNameFromID = new getNameFromID();
      getRateFromID getRateFromID = new getRateFromID();

      nseer_db_backup1 purchase_db = new nseer_db_backup1(dbApplication);

      if (purchase_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        String register_ID = (String) session.getAttribute("human_IDD");
        String config_id = request.getParameter("config_id");
        String discussion_ID = request.getParameter("discussion_ID");
        String provider_ID = request.getParameter("provider_ID");
        String provider_name = request.getParameter("provider_name");
        String demand_contact_person = request.getParameter("demand_contact_person");
        String demand_contact_person_tel = request.getParameter("demand_contact_person_tel");
        String demand_contact_person_fax = request.getParameter("demand_contact_person_fax");
        String demand_pay_time = request.getParameter("demand_pay_time");
        String check_time = request.getParameter("check_time");
        String checker = request.getParameter("checker");
        String checker_ID = request.getParameter("checker_ID");
        String bodyc = new String(request.getParameter("remark").getBytes("UTF-8"), "UTF-8");
        String remark = exchange.toHtml(bodyc);
        String modify_tag = request.getParameter("modify_tag");
        String product_amount = request.getParameter("product_amount");
        int num = Integer.parseInt(product_amount);

        int n = 0;
        for (int i = 1; i <= num; i++) {
          String tem_amount = "amount" + i;
          String tem_off_discount = "off_discount" + i;
          String tem_list_price = "list_price" + i;
          String amount = request.getParameter(tem_amount);
          String off_discount = request.getParameter(tem_off_discount);
          String list_price2 = request.getParameter(tem_list_price);
          StringTokenizer tokenTO2 = new StringTokenizer(list_price2, ",");

          String list_price = "";
          while (tokenTO2.hasMoreTokens()) {
            String list_price1 = tokenTO2.nextToken();
            list_price += list_price1;
          }
          if (!validata.validata(amount)
              || !validata.validata(off_discount)
              || !validata.validata(list_price)) {
            n++;
          }
        }

        String sql6 =
            "select id from purchase_workflow where object_ID='"
                + discussion_ID
                + "' and ((check_tag='0' and config_id<'"
                + config_id
                + "') or (check_tag='1' and config_id='"
                + config_id
                + "'))";
        ResultSet rs6 = purchase_db.executeQuery(sql6);
        if (!rs6.next()) {
          if (vt.validata(
                  (String) dbSession.getAttribute("unit_db_name"),
                  "purchase_discussion",
                  "discussion_ID",
                  discussion_ID,
                  "check_tag")
              .equals("0")) {
            if (n == 0) {
              String time = "";
              java.util.Date now = new java.util.Date();
              SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
              time = formatter.format(now);

              String sql =
                  "update purchase_discussion set discussion_ID='"
                      + discussion_ID
                      + "',provider_ID='"
                      + provider_ID
                      + "',provider_name='"
                      + provider_name
                      + "',demand_contact_person='"
                      + demand_contact_person
                      + "',demand_contact_person_tel='"
                      + demand_contact_person_tel
                      + "',demand_contact_person_fax='"
                      + demand_contact_person_fax
                      + "',check_time='"
                      + check_time
                      + "',checker='"
                      + checker
                      + "',checker_ID='"
                      + checker_ID
                      + "',remark='"
                      + remark
                      + "' where discussion_ID='"
                      + discussion_ID
                      + "'";
              purchase_db.executeUpdate(sql);

              try {

                int service_count = 0;
                int stock_number = 0;
                int pay_amount_sum = 0;
                double sale_price_sum = 0.0d;
                double cost_price_sum = 0.0d;
                double real_cost_price_sum = 0.0d;
                for (int i = 1; i <= num; i++) {
                  String tem_product_name = "product_name" + i;
                  String tem_product_ID = "product_ID" + i;
                  String tem_product_describe = "product_describe" + i;
                  String tem_amount = "amount" + i;
                  String tem_off_discount = "off_discount" + i;
                  String tem_list_price = "list_price" + i;
                  String tem_cost_price = "cost_price" + i;
                  String tem_real_cost_price = "real_cost_price" + i;
                  String tem_amount_unit = "amount_unit" + i;
                  String product_name = request.getParameter(tem_product_name);
                  String product_ID = request.getParameter(tem_product_ID);
                  String product_describe = request.getParameter(tem_product_describe);
                  String amount1 = request.getParameter(tem_amount);
                  String off_discount = request.getParameter(tem_off_discount);
                  String list_price2 = request.getParameter(tem_list_price);
                  StringTokenizer tokenTO2 = new StringTokenizer(list_price2, ",");
                  String list_price = "";
                  while (tokenTO2.hasMoreTokens()) {
                    String list_price1 = tokenTO2.nextToken();
                    list_price += list_price1;
                  }
                  String cost_price2 = request.getParameter(tem_cost_price);
                  StringTokenizer tokenTO3 = new StringTokenizer(cost_price2, ",");
                  String cost_price = "";
                  while (tokenTO3.hasMoreTokens()) {
                    String cost_price1 = tokenTO3.nextToken();
                    cost_price += cost_price1;
                  }
                  String real_cost_price2 = request.getParameter(tem_real_cost_price);
                  StringTokenizer tokenTO4 = new StringTokenizer(real_cost_price2, ",");
                  String real_cost_price = "";
                  while (tokenTO4.hasMoreTokens()) {
                    String real_cost_price1 = tokenTO4.nextToken();
                    real_cost_price += real_cost_price1;
                  }
                  String amount_unit = request.getParameter(tem_amount_unit);
                  double amount = 0.0d;
                  double subtotal =
                      Double.parseDouble(list_price)
                          * (1 - Double.parseDouble(off_discount) / 100)
                          * Double.parseDouble(amount1);
                  double cost_price_after_discount_sum =
                      Double.parseDouble(cost_price) * Double.parseDouble(amount1);
                  double real_cost_price_after_discount_sum =
                      Double.parseDouble(real_cost_price) * Double.parseDouble(amount1);
                  sale_price_sum += subtotal;
                  cost_price_sum += cost_price_after_discount_sum;
                  real_cost_price_sum += real_cost_price_after_discount_sum;

                  double order_sale_bonus_subtotal =
                      getRateFromID.getRateFromID(
                              (String) dbSession.getAttribute("unit_db_name"),
                              "design_file",
                              "product_ID",
                              product_ID,
                              "order_sale_bonus_rate")
                          * subtotal
                          / 100;
                  double order_profit_bonus_subtotal = 0.0d;

                  String sql1 =
                      "update purchase_discussion_details set product_ID='"
                          + product_ID
                          + "',product_name='"
                          + product_name
                          + "',product_describe='"
                          + product_describe
                          + "',list_price='"
                          + list_price
                          + "',amount='"
                          + amount1
                          + "',cost_price='"
                          + cost_price
                          + "',off_discount='"
                          + off_discount
                          + "',subtotal='"
                          + subtotal
                          + "' where discussion_ID='"
                          + discussion_ID
                          + "' and details_number='"
                          + i
                          + "'";
                  purchase_db.executeUpdate(sql1);

                  String product_type = "";
                  String sql16 = "select * from design_file where product_ID='" + product_ID + "'";
                  ResultSet rs16 = purchase_db.executeQuery(sql16);
                  if (rs16.next()) {
                    product_type = rs16.getString("type");
                  }
                  if (product_type.equals("物料") || product_type.equals("外购商品")) {
                    stock_number += 1;
                  } else if (product_type.equals("商品")
                      || product_type.equals("部件")
                      || product_type.equals("委外部件")) {
                    stock_number += 1;
                  } else if (product_type.equals("服务型产品")) {
                    service_count++;
                  }
                }
                String sql2 =
                    "update purchase_workflow set checker='"
                        + checker
                        + "',checker_ID='"
                        + checker_ID
                        + "',check_time='"
                        + check_time
                        + "',check_tag='1' where object_ID='"
                        + discussion_ID
                        + "' and config_id='"
                        + config_id
                        + "'";
                purchase_db.executeUpdate(sql2);
                sql2 =
                    "select id from purchase_workflow where object_ID='"
                        + discussion_ID
                        + "' and check_tag='0'";
                ResultSet rset = purchase_db.executeQuery(sql2);
                if (!rset.next()) {
                  sql2 =
                      "update purchase_discussion set sale_price_sum='"
                          + sale_price_sum
                          + "',cost_price_sum='"
                          + cost_price_sum
                          + "',modify_tag='0',discussion_tag='1',discussion_status='等待',check_tag='1' where discussion_ID='"
                          + discussion_ID
                          + "'";
                  purchase_db.executeUpdate(sql2);
                } else {
                  sql2 =
                      "update purchase_discussion set sale_price_sum='"
                          + sale_price_sum
                          + "',cost_price_sum='"
                          + cost_price_sum
                          + "',modify_tag='0' where discussion_ID='"
                          + discussion_ID
                          + "'";
                  purchase_db.executeUpdate(sql2);
                }
              } catch (Exception ex) {
                ex.printStackTrace();
              }
              response.sendRedirect(
                  "purchase/discussion/check_choose_attachment.jsp?discussion_ID="
                      + discussion_ID
                      + "");
            } else {
              response.sendRedirect("purchase/discussion/check_ok.jsp?finished_tag=0");
            }
          } else {
            response.sendRedirect("purchase/discussion/check_ok.jsp?finished_tag=1");
          }
        } else {
          response.sendRedirect("purchase/discussion/check_ok.jsp?finished_tag=2");
        }
        purchase_db.commit();
        purchase_db.close();
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Ejemplo n.º 11
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    try {
      HttpSession dbSession = request.getSession();
      ServletContext dbApplication = dbSession.getServletContext();
      nseer_db_backup1 design_db = new nseer_db_backup1(dbApplication);
      nseer_db_backup1 design_db1 = new nseer_db_backup1(dbApplication);
      ValidataNumber validata = new ValidataNumber();
      ValidataTag vt = new ValidataTag();
      counter count = new counter(dbApplication);

      if (design_db.conn((String) dbSession.getAttribute("unit_db_name"))
          && design_db1.conn((String) dbSession.getAttribute("unit_db_name"))) {
        String config_id = request.getParameter("config_id");
        String product_ID = request.getParameter("product_ID");
        String choice = request.getParameter("choice");
        String checker_ID = request.getParameter("checker_ID");
        String checker = request.getParameter("checker");
        String check_time = request.getParameter("check_time");
        String sql6 =
            "select id from design_workflow where type_id='02' and object_ID='"
                + product_ID
                + "' and ((check_tag='0' and config_id<'"
                + config_id
                + "') or (check_tag='1' and config_id='"
                + config_id
                + "'))";
        ResultSet rs6 = design_db.executeQuery(sql6);
        if (!rs6.next()
            && vt.validata(
                    (String) dbSession.getAttribute("unit_db_name"),
                    "design_file",
                    "product_ID",
                    product_ID,
                    "excel_tag")
                .equals("1")) {
          if (choice != null) {
            if (choice.equals("")) {
              String sql =
                  "update design_file set price_change_tag='9' where product_ID='"
                      + product_ID
                      + "'";
              design_db.executeUpdate(sql);

              sql =
                  "delete from design_workflow where type_id='02' and object_ID='"
                      + product_ID
                      + "'";
              design_db.executeUpdate(sql);

            } else {

              sql6 =
                  "select id from design_workflow where type_id='02' and object_ID='"
                      + product_ID
                      + "' and config_id<'"
                      + config_id
                      + "' and config_id>='"
                      + choice
                      + "'";
              rs6 = design_db.executeQuery(sql6);
              while (rs6.next()) {
                String sql =
                    "update design_workflow set check_tag='0' where type_id='02' and id='"
                        + rs6.getString("id")
                        + "'";
                design_db1.executeUpdate(sql);
              }
            }
            response.sendRedirect("design/price_change/check_delete_ok.jsp?finished_tag=0");
          } else {
            response.sendRedirect("design/price_change/check_delete_ok.jsp?finished_tag=1");
          }
        } else {
          response.sendRedirect("design/price_change/check_delete_ok.jsp?finished_tag=2");
        }
        design_db.commit();
        design_db1.commit();
        design_db.close();
        design_db1.close();
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Ejemplo n.º 12
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    nseer_db_backup1 finance_db = new nseer_db_backup1(dbApplication);
    getNameFromID getNameFromID = new getNameFromID();
    PrintWriter out = response.getWriter();
    try {
      if (finance_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        counter count = new counter(dbApplication);
        ValidataNumber validata = new ValidataNumber();

        String file_id = request.getParameter("file_id");
        String file_name = request.getParameter("file_name");
        String start_time = request.getParameter("start_time");
        String specification = request.getParameter("specification");
        String cb_status = request.getParameter("cb_status");
        String ca_status = request.getParameter("ca_status");
        String change_reason = request.getParameter("change_reason");
        String change_time = request.getParameter("change_date");
        String changer = request.getParameter("changer");
        String sql = "";
        ResultSet rs = null;

        String changebill_id =
            NseerId.getId(
                getClass().getResource("").toString(),
                (String) dbSession.getAttribute("unit_db_name"));
        sql =
            "insert into finance_fa_change(changebill_id,file_id,file_name,start_time,specification,cb_status_id,ca_status_id,change_reason,change_time,changer,change_kind) values('"
                + changebill_id
                + "','"
                + file_id
                + "','"
                + file_name
                + "','"
                + start_time
                + "','"
                + specification
                + "','"
                + cb_status
                + "','"
                + ca_status
                + "','"
                + change_reason
                + "','"
                + change_time
                + "','"
                + changer
                + "','使用状态变动')";
        finance_db.executeUpdate(sql);

        sql = "select * from finance_fa_file where file_id='" + file_id + "'";
        rs = finance_db.executeQuery(sql);
        if (rs.next()) {
          sql =
              "insert into finance_fa_file_dig(card_id,type_id,type_name,file_id,file_name,addway_id,addway_name,department_id,department_name,specification,deposit_place,status_id,calway_id,start_time,lifecycle,currency,original_value,remnant_value,remnant_value_rate,caled_month,caled_sum,cal_subtotal,cal_subtotal_rate,net_value,cal_file_name,work_total,work_sum,work_unit,unit_cal,project,sum_presub,sum_re_presub,caled_time,change_time,exchange_rate,reduceway_id,reduceway_name,reduce_time,clear_income,clear_expense,clear_reason,lately_change_time) values('"
                  + rs.getString("card_id")
                  + "','"
                  + rs.getString("type_id")
                  + "','"
                  + rs.getString("type_name")
                  + "','"
                  + rs.getString("file_id")
                  + "','"
                  + rs.getString("file_name")
                  + "','"
                  + rs.getString("addway_id")
                  + "','"
                  + rs.getString("addway_name")
                  + "','"
                  + rs.getString("department_id")
                  + "','"
                  + rs.getString("department_name")
                  + "','"
                  + rs.getString("specification")
                  + "','"
                  + rs.getString("deposit_place")
                  + "','"
                  + rs.getString("status_id")
                  + "','"
                  + rs.getString("calway_id")
                  + "','"
                  + rs.getString("start_time")
                  + "','"
                  + rs.getString("lifecycle")
                  + "','"
                  + rs.getString("currency")
                  + "','"
                  + rs.getString("original_value")
                  + "','"
                  + rs.getString("remnant_value")
                  + "','"
                  + rs.getString("remnant_value_rate")
                  + "','"
                  + rs.getString("caled_month")
                  + "','"
                  + rs.getString("caled_sum")
                  + "','"
                  + rs.getString("cal_subtotal")
                  + "','"
                  + rs.getString("cal_subtotal_rate")
                  + "','"
                  + rs.getString("net_value")
                  + "','"
                  + rs.getString("cal_file_name")
                  + "','"
                  + rs.getString("work_total")
                  + "','"
                  + rs.getString("work_sum")
                  + "','"
                  + rs.getString("work_unit")
                  + "','"
                  + rs.getString("unit_cal")
                  + "','"
                  + rs.getString("project")
                  + "','"
                  + rs.getString("sum_presub")
                  + "','"
                  + rs.getString("sum_re_presub")
                  + "','"
                  + rs.getString("caled_time")
                  + "','"
                  + rs.getString("change_time")
                  + "','"
                  + rs.getString("exchange_rate")
                  + "','"
                  + rs.getString("reduceway_id")
                  + "','"
                  + rs.getString("reduceway_name")
                  + "','"
                  + rs.getString("reduce_time")
                  + "','"
                  + rs.getString("clear_income")
                  + "','"
                  + rs.getString("clear_expense")
                  + "','"
                  + rs.getString("clear_reason")
                  + "','"
                  + change_time
                  + "')";
          finance_db.executeUpdate(sql);

          sql =
              "update finance_fa_file set status_id='"
                  + ca_status
                  + "',change_time='"
                  + change_time
                  + "' where file_id='"
                  + file_id
                  + "'";
          finance_db.executeUpdate(sql);
        }
        finance_db.commit();
        finance_db.close();
        out.println("提交成功");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Ejemplo n.º 13
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();
    try {

      ServletContext application;
      HttpSession session = request.getSession();
      nseer_db_backup1 oa_db = new nseer_db_backup1(dbApplication);
      if (oa_db.conn((String) dbSession.getAttribute("unit_db_name"))) {

        Note note = new Note();
        Email mail = new Email();

        String meeting_ID = request.getParameter("meeting_ID");
        String checker = request.getParameter("checker");
        String checker_ID = request.getParameter("checker_ID");
        String check_time = request.getParameter("check_time");
        String cols_number = request.getParameter("cols_number");
        String[] check_type = request.getParameterValues("check_type");
        String[] chain_id = request.getParameterValues("chain_id");
        String send_type = "";
        if (check_type != null) {
          if (chain_id != null) {
            for (int i = 0; i < check_type.length; i++) {
              send_type += check_type[i] + ",";
            }
            send_type = send_type.substring(0, send_type.length() - 1);

            int n = 0;

            String[] email_box = new String[chain_id.length];
            n = 0;
            int p = 0;
            String subject = "";
            String content = "";
            String sql2 =
                "select * from oa_meeting where meeting_ID='" + meeting_ID + "' and check_tag='0'";
            ResultSet rs2 = oa_db.executeQuery(sql2);
            if (rs2.next()) {
              subject = rs2.getString("subject");
              content =
                  subject
                      + "时间:"
                      + rs2.getString("begin_time")
                      + "至"
                      + rs2.getString("end_time")
                      + "会议日程:"
                      + rs2.getString("schedule");
              for (int j = 0; j < chain_id.length; j++) {
                //	String checkbox_name="col"+j;
                //	String[] cols=request.getParameterValues(checkbox_name);
                if (!chain_id[j].equals("")) {
                  n++;
                  if (chain_id[j].indexOf("//") != -1) {
                    StringTokenizer token =
                        new StringTokenizer(
                            chain_id[j].substring(0, chain_id[j].length() - 2), "/");
                    while (token.hasMoreTokens()) {
                      String human_ID = token.nextToken();
                      String human_name = token.nextToken();
                      String sql =
                          "insert into oa_meeting_attend_details(meeting_ID,human_ID,human_name,human_major_first_kind_name,human_major_second_kind_name) values('"
                              + meeting_ID
                              + "','"
                              + human_ID
                              + "','"
                              + human_name
                              + "','','')";
                      oa_db.executeUpdate(sql);
                      String sql3 = "select * from hr_file where human_ID='" + human_ID + "'";
                      ResultSet rs3 = oa_db.executeQuery(sql3);
                      if (rs3.next()) {
                        email_box[p] = rs3.getString("human_email");
                        p++;
                        if (send_type.indexOf("发短信") != -1) {
                          note.send("bjnseer", "8888", rs3.getString("human_cellphone"), content);
                        }
                      }
                    }
                  } else if (chain_id[j].substring(chain_id[j].length() - 1).equals("/")) {
                    StringTokenizer token = new StringTokenizer(chain_id[j], "/");
                    while (token.hasMoreTokens()) {
                      String human_ID = token.nextToken();
                      String human_name = token.nextToken();
                      String human_major_first_kind_name = token.nextToken();
                      String sql =
                          "insert into oa_meeting_attend_details(meeting_ID,human_ID,human_name,human_major_first_kind_name,human_major_second_kind_name) values('"
                              + meeting_ID
                              + "','"
                              + human_ID
                              + "','"
                              + human_name
                              + "','"
                              + human_major_first_kind_name
                              + "','')";
                      oa_db.executeUpdate(sql);
                      String sql3 = "select * from hr_file where human_ID='" + human_ID + "'";
                      ResultSet rs3 = oa_db.executeQuery(sql3);
                      if (rs3.next()) {
                        email_box[p] = rs3.getString("human_email");
                        p++;
                        if (send_type.indexOf("发短信") != -1) {
                          note.send("bjnseer", "8888", rs3.getString("human_cellphone"), content);
                        }
                      }
                    }
                  } else {
                    StringTokenizer token = new StringTokenizer(chain_id[j], "/");
                    while (token.hasMoreTokens()) {
                      String human_ID = token.nextToken();
                      String human_name = token.nextToken();
                      String human_major_first_kind_name = token.nextToken();
                      String human_major_second_kind_name = token.nextToken();
                      String sql =
                          "insert into oa_meeting_attend_details(meeting_ID,human_ID,human_name,human_major_first_kind_name,human_major_second_kind_name) values('"
                              + meeting_ID
                              + "','"
                              + human_ID
                              + "','"
                              + human_name
                              + "','"
                              + human_major_first_kind_name
                              + "','"
                              + human_major_second_kind_name
                              + "')";
                      oa_db.executeUpdate(sql);
                      String sql3 = "select * from hr_file where human_ID='" + human_ID + "'";
                      ResultSet rs3 = oa_db.executeQuery(sql3);
                      if (rs3.next()) {
                        email_box[p] = rs3.getString("human_email");
                        p++;
                        if (send_type.indexOf("发短信") != -1) {
                          note.send("bjnseer", "8888", rs3.getString("human_cellphone"), content);
                        }
                      }
                    }
                  }
                }
              }
              if (send_type.indexOf("发邮件") != -1) {
                mail.send(
                    email_box, "smtp.sina.com.cn", "*****@*****.**", "123456", subject, content);
              }
              if (n == 0) {

                response.sendRedirect("oa/meeting/inform_ok_a.jsp");
              } else {
                String sql1 =
                    "update oa_meeting set checker='"
                        + checker
                        + "',checker_ID='"
                        + checker_ID
                        + "',check_time='"
                        + check_time
                        + "',check_tag='1' where meeting_ID='"
                        + meeting_ID
                        + "'";
                oa_db.executeUpdate(sql1);

                response.sendRedirect("oa/meeting/inform_ok_b.jsp");
              }
            } else {

              response.sendRedirect("oa/meeting/inform_ok_c.jsp");
            }
          } else {

            response.sendRedirect("oa/meeting/inform_ok_e.jsp");
          }
        } else {

          response.sendRedirect("oa/meeting/inform_ok_d.jsp");
        }
        oa_db.commit();
        oa_db.close();
      } else {
        response.sendRedirect("error_conn.htm");
      }

    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Ejemplo n.º 14
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();
    PrintWriter out = response.getWriter();
    ServletContext application;
    HttpSession session = request.getSession();
    nseer_db_backup1 finance_db = new nseer_db_backup1(dbApplication);
    ValidataNumber validata = new ValidataNumber();
    try {

      if (finance_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        String file_id = request.getParameter("file_id");
        String balance_sum = request.getParameter("balance_sum");
        String balance_sum1 = request.getParameter("balance_sum1");
        if (validata.validata(balance_sum) && validata.validata(balance_sum1)) {
          String sql2 = "select id from finance_bill where tag='1' and file_id='" + file_id + "'";
          ResultSet rs2 = finance_db.executeQuery(sql2);
          String sql = "";
          if (rs2.next()) {
            sql =
                "update finance_bill set debit_subtotal='"
                    + balance_sum1
                    + "' where tag='1' and file_id='"
                    + file_id
                    + "'";
          } else {

            sql =
                "insert into finance_bill(debit_subtotal,file_id,tag) values('"
                    + balance_sum1
                    + "','"
                    + file_id
                    + "','1')";
          }
          finance_db.executeUpdate(sql);

          sql2 =
              "select id from finance_voucher where account_period='18' and chain_id='"
                  + file_id
                  + "'";
          rs2 = finance_db.executeQuery(sql2);
          if (rs2.next()) {
            sql =
                "update finance_voucher set debit_subtotal='"
                    + balance_sum
                    + "' where account_period='18' and chain_id='"
                    + file_id
                    + "'";
          } else {

            sql =
                "insert into finance_voucher(debit_subtotal,chain_id,account_period) values('"
                    + balance_sum
                    + "','"
                    + file_id
                    + "','18')";
          }
          finance_db.executeUpdate(sql);

          finance_db.commit();
          finance_db.close();
        } else {
          out.println("1");
        }
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Ejemplo n.º 15
0
  public synchronized void doPost(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    try {
      ValidataNumber validata = new ValidataNumber();
      nseer_db_backup1 crm_db = new nseer_db_backup1(dbApplication);
      if (crm_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        counter count = new counter(dbApplication);
        PrintWriter out = response.getWriter();
        String product_amount = request.getParameter("product_amount");
        String reasonexact = request.getParameter("reasonexact");
        String which_time = request.getParameter("which_time");
        int num = Integer.parseInt(product_amount);
        String reason = request.getParameter("reason");
        String customer_ID = request.getParameter("customer_ID");
        String customer_name = request.getParameter("customer_name");
        String real_customer_mailing_address =
            request.getParameter("real_customer_mailing_address");
        String real_contact_person = request.getParameter("real_contact_person");
        String real_contact_person_tel = request.getParameter("real_contact_person_tel");
        String real_contact_person_fax = request.getParameter("real_contact_person_fax");
        String real_invoice_time = request.getParameter("real_invoice_time");
        String real_invoice_type = request.getParameter("real_invoice_type");
        String register = request.getParameter("register");
        String register_ID = request.getParameter("register_ID");
        String invoice_group = request.getParameter("invoice_group");
        String register_time = request.getParameter("register_time");
        double invoiced_subtotal_sum = 0.0d;
        double invoiced_subtotal_sum_all = 0.0d;
        int p = 0;
        for (int i = 1; i <= num; i++) {
          String tem_invoice_sum = "invoice_sum" + i;
          String invoice_sum2 = request.getParameter(tem_invoice_sum);
          if (invoice_sum2.equals("")) invoice_sum2 = "0";
          StringTokenizer tokenTO2 = new StringTokenizer(invoice_sum2, ",");
          String invoice_sum = "";
          while (tokenTO2.hasMoreTokens()) {
            String invoice_sum1 = tokenTO2.nextToken();
            invoice_sum += invoice_sum1;
          }
          if (!validata.validata(invoice_sum)) {
            p++;
          }
        }
        if (p == 0) {
          int n = 0;

          if (n == 0) {
            String sql8 =
                "select * from crm_order where order_id='"
                    + reasonexact
                    + "' and (invoice_check_tag='9' or invoice_check_tag='5') and which_time='"
                    + which_time
                    + "'";
            ResultSet rs8 = crm_db.executeQuery(sql8);
            if (rs8.next()) {

              for (int j = 1; j <= num; j++) {
                String tem_details_number = "details_number" + j;
                String tem_id = "id" + j;
                String id = request.getParameter(tem_id);
                String details_number = request.getParameter(tem_details_number);
              }
              String product_ID_control1 = request.getParameter("product_ID1");
              String subtotal_control1 = request.getParameter("invoiced_subtotal1");
              double subtotal_control = Double.parseDouble(subtotal_control1);
              for (int j = 1; j <= num; j++) {
                invoiced_subtotal_sum = 0;
                String tem_details_number = "details_number" + j;
                String tem_product_name = "product_name" + j;
                String tem_product_ID = "product_ID" + j;
                String tem_subtotal = "subtotal" + j;
                String tem_invoice_sum = "invoice_sum" + j;
                String tem_invoiced_subtotal = "invoiced_subtotal" + j;
                String tem_remark = "remark" + j;
                String tem_id = "id" + j;
                String id = request.getParameter(tem_id);
                String product_name = request.getParameter(tem_product_name);
                String product_ID = request.getParameter(tem_product_ID);
                String details_number = request.getParameter(tem_details_number);
                String subtotal = request.getParameter(tem_subtotal);
                String invoiced_subtotal = request.getParameter(tem_invoiced_subtotal);
                String invoice_sum2 = request.getParameter(tem_invoice_sum);
                if (invoice_sum2.equals("")) invoice_sum2 = "0";
                StringTokenizer tokenTO1 = new StringTokenizer(invoice_sum2, ",");
                String invoice_sum = "";
                while (tokenTO1.hasMoreTokens()) {
                  String invoice_sum1 = tokenTO1.nextToken();
                  invoice_sum += invoice_sum1;
                }
                String remark = request.getParameter(tem_remark);
                if (product_ID.equals(product_ID_control1)) {
                  if (invoice_sum != null && Double.parseDouble(invoice_sum) != 0) {
                    subtotal_control += Double.parseDouble(invoice_sum);
                    invoiced_subtotal_sum_all += Double.parseDouble(invoice_sum);
                    String sql1 =
                        "update crm_ordering set reason='"
                            + reason
                            + "',customer_ID='"
                            + customer_ID
                            + "',customer_name='"
                            + customer_name
                            + "',real_customer_mailing_address='"
                            + real_customer_mailing_address
                            + "',real_contact_person='"
                            + real_contact_person
                            + "',real_contact_person_tel='"
                            + real_contact_person_tel
                            + "',real_contact_person_fax='"
                            + real_contact_person_fax
                            + "',real_invoice_time='"
                            + real_invoice_time
                            + "',real_invoice_type='"
                            + real_invoice_type
                            + "',register='"
                            + register
                            + "',register_ID='"
                            + register_ID
                            + "',register_time='"
                            + register_time
                            + "',product_ID='"
                            + product_ID
                            + "',product_name='"
                            + product_name
                            + "',invoice_sum='"
                            + invoice_sum
                            + "',remark='"
                            + remark
                            + "',invoice_group='"
                            + invoice_group
                            + "' where id='"
                            + id
                            + "'";
                    crm_db.executeUpdate(sql1);
                    if (subtotal_control == Double.parseDouble(subtotal)) {
                      String sql2 =
                          "update crm_order_details set invoiced_subtotal='"
                              + subtotal_control
                              + "',invoice_tag='1' where order_ID='"
                              + reasonexact
                              + "' and details_number='"
                              + details_number
                              + "'";
                      crm_db.executeUpdate(sql2);
                    } else {
                      String sql3 =
                          "update crm_order_details set invoiced_subtotal='"
                              + subtotal_control
                              + "' where order_ID='"
                              + reasonexact
                              + "' and details_number='"
                              + details_number
                              + "'";
                      crm_db.executeUpdate(sql3);
                    }

                  } else if (Double.parseDouble(invoice_sum) == 0) {
                    String sql7 = "delete from crm_ordering where id='" + id + "'";
                    crm_db.executeUpdate(sql7);
                  }
                } else {
                  if (invoice_sum != null && Double.parseDouble(invoice_sum) != 0) {
                    product_ID_control1 = product_ID;
                    subtotal_control =
                        Double.parseDouble(invoiced_subtotal) + Double.parseDouble(invoice_sum);
                    invoiced_subtotal_sum_all += Double.parseDouble(invoice_sum);
                    String sql1 =
                        "update crm_ordering set reason='"
                            + reason
                            + "',customer_ID='"
                            + customer_ID
                            + "',customer_name='"
                            + customer_name
                            + "',real_customer_mailing_address='"
                            + real_customer_mailing_address
                            + "',real_contact_person='"
                            + real_contact_person
                            + "',real_contact_person_tel='"
                            + real_contact_person_tel
                            + "',real_contact_person_fax='"
                            + real_contact_person_fax
                            + "',real_invoice_time='"
                            + real_invoice_time
                            + "',real_invoice_type='"
                            + real_invoice_type
                            + "',register='"
                            + register
                            + "',register_ID='"
                            + register_ID
                            + "',register_time='"
                            + register_time
                            + "',product_ID='"
                            + product_ID
                            + "',product_name='"
                            + product_name
                            + "',invoice_sum='"
                            + invoice_sum
                            + "',remark='"
                            + remark
                            + "',invoice_group='"
                            + invoice_group
                            + "' where id='"
                            + id
                            + "'";
                    crm_db.executeUpdate(sql1);
                    if (subtotal_control == Double.parseDouble(subtotal)) {
                      String sql2 =
                          "update crm_order_details set invoiced_subtotal='"
                              + subtotal_control
                              + "',invoice_tag='1' where order_ID='"
                              + reasonexact
                              + "' and details_number='"
                              + details_number
                              + "'";
                      crm_db.executeUpdate(sql2);
                    } else {
                      String sql3 =
                          "update crm_order_details set invoiced_subtotal='"
                              + subtotal_control
                              + "' where order_ID='"
                              + reasonexact
                              + "' and details_number='"
                              + details_number
                              + "'";
                      crm_db.executeUpdate(sql3);
                    }

                  } else if (Double.parseDouble(invoice_sum) == 0) {
                    String sql7 = "delete from crm_ordering where id='" + id + "'";
                    crm_db.executeUpdate(sql7);
                  }
                }
              }
              String sql2 =
                  "update crm_order set invoice_check_tag='2' where order_ID='" + reasonexact + "'";
              crm_db.executeUpdate(sql2);
              response.sendRedirect("draft/crm/invoice_ok.jsp?finished_tag=2");
            } else {
              response.sendRedirect("draft/crm/invoice_ok.jsp?finished_tag=1");
            }
          } else {
            response.sendRedirect("draft/crm/invoice_ok_a.jsp?order_ID=" + reasonexact + "");
          }
        } else {
          response.sendRedirect("draft/crm/invoice_ok_b.jsp?order_ID=" + reasonexact + "");
        }
        crm_db.commit();
        crm_db.close();

      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
    }
  }
Ejemplo n.º 16
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    try {
      HttpSession session = request.getSession();
      PrintWriter out = response.getWriter();
      counter count = new counter(dbApplication);
      nseer_db_backup1 hr_db = new nseer_db_backup1(dbApplication);
      nseer_db_backup1 hr_db1 = new nseer_db_backup1(dbApplication);
      if (hr_db.conn((String) dbSession.getAttribute("unit_db_name"))
          && hr_db1.conn((String) dbSession.getAttribute("unit_db_name"))) {
        String major_first_kind_ID = "";
        String major_first_kind_name = "";
        String major_second_kind_ID = "";
        String major_second_kind_name = "";
        String fileKind_chain = request.getParameter("kind_chain");
        String chain_id = Divide1.getId(fileKind_chain);
        String chain_name = Divide1.getName(fileKind_chain);
        String major_first_kind = request.getParameter("select4");
        StringTokenizer tokenTO4 = new StringTokenizer(major_first_kind, "/");
        while (tokenTO4.hasMoreTokens()) {
          major_first_kind_ID = tokenTO4.nextToken();
          major_first_kind_name = tokenTO4.nextToken();
        }
        String major_second_kind = request.getParameter("select5");
        StringTokenizer tokenTO5 = new StringTokenizer(major_second_kind, "/");
        while (tokenTO5.hasMoreTokens()) {
          major_second_kind_ID = tokenTO5.nextToken();
          major_second_kind_name = tokenTO5.nextToken();
        }
        String register = request.getParameter("register");
        String register_time = request.getParameter("register_time");
        String engage_type = request.getParameter("engage_type");
        String human_amount = request.getParameter("human_amount");
        String deadline = request.getParameter("deadline");
        String bodyc = new String(request.getParameter("remark1").getBytes("UTF-8"), "UTF-8");
        String remark1 = exchange.toHtml(bodyc);
        String bodyb = new String(request.getParameter("remark2").getBytes("UTF-8"), "UTF-8");
        String remark2 = exchange.toHtml(bodyb);
        try {
          int filenum1 = count.read((String) dbSession.getAttribute("unit_db_name"), "hrReleaseID");
          count.write((String) dbSession.getAttribute("unit_db_name"), "hrReleaseID", filenum1);
          String sql =
              "insert into hr_major_release(chain_id,chain_name,release_id,human_major_first_kind_ID,human_major_first_kind_name,human_major_second_kind_ID,human_major_second_kind_name,register,register_time,human_amount,deadline,remark1,remark2,engage_type,check_tag) values ('"
                  + chain_id
                  + "','"
                  + chain_name
                  + "','"
                  + filenum1
                  + "','"
                  + major_first_kind_ID
                  + "','"
                  + major_first_kind_name
                  + "','"
                  + major_second_kind_ID
                  + "','"
                  + major_second_kind_name
                  + "','"
                  + register
                  + "','"
                  + register_time
                  + "','"
                  + human_amount
                  + "','"
                  + deadline
                  + "','"
                  + remark1
                  + "','"
                  + remark2
                  + "','"
                  + engage_type
                  + "','0')";

          hr_db.executeUpdate(sql);

          List rsList1 = GetWorkflow.getList(hr_db, "ecommerce_config_workflow", "06");
          String[] elem1 = new String[3];
          if (rsList1.size() == 0) {
            String sql1 =
                "update hr_major_release set check_tag='1' where chain_id='"
                    + chain_id
                    + "' and chain_name='"
                    + chain_name
                    + "'";
            hr_db.executeUpdate(sql1);
          } else {
            Iterator ite1 = rsList1.iterator();
            while (ite1.hasNext()) {
              elem1 = (String[]) ite1.next();
              sql =
                  "insert into ecommerce_workflow(config_id,object_ID,describe1,describe2,type_id) values ('"
                      + elem1[0]
                      + "','"
                      + filenum1
                      + "','"
                      + elem1[1]
                      + "','"
                      + elem1[2]
                      + "','06')";
              hr_db.executeUpdate(sql);
            }
          }
          hr_db.commit();
          hr_db1.commit();
          hr_db.close();
          hr_db1.close();
          response.sendRedirect("hr/engage/major_release/register_ok_a.jsp");
        } catch (Exception ex) {
          out.println("error" + ex);
        }

      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
    }
  }
Ejemplo n.º 17
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    try {
      // 实例化

      HttpSession session = request.getSession();
      ServletContext context = session.getServletContext();
      String path = context.getRealPath("/");
      counter count = new counter(dbApplication);
      SmartUpload mySmartUpload = new SmartUpload();
      mySmartUpload.setCharset("UTF-8");
      nseer_db_backup1 oa_db = new nseer_db_backup1(dbApplication);
      if (oa_db.conn((String) dbSession.getAttribute("unit_db_name"))) {

        getAttachmentLength getAttachmentLength = new getAttachmentLength();
        getAttachmentType getAttachmentType = new getAttachmentType();
        double d =
            getAttachmentLength.getAttachmentLength(
                (String) dbSession.getAttribute("unit_db_name"), "document_config_public_char");
        String ee =
            getAttachmentType.getAttachmentType(
                (String) dbSession.getAttribute("unit_db_name"), "document_config_public_char");
        mySmartUpload.initialize(pageContext);
        mySmartUpload.upload();
        String[] file_name = new String[mySmartUpload.getFiles().getCount()];
        int j = 0;

        int filenum1 =
            count.read((String) dbSession.getAttribute("unit_db_name"), "oaMessagecount");
        String message_ID = filenum1 + "";
        count.write((String) dbSession.getAttribute("unit_db_name"), "oaMessagecount", filenum1);
        String sql1 = "select * from oa_message where message_ID='" + message_ID + "'";
        ResultSet rs = oa_db.executeQuery(sql1);
        if (j != 0 || rs.next()) {

          response.sendRedirect("oa/message/register_ok_a.jsp");
        } else {

          String subject = mySmartUpload.getRequest().getParameter("subject");
          String message_type = mySmartUpload.getRequest().getParameter("message_type");
          String register = mySmartUpload.getRequest().getParameter("register");
          String register_ID = mySmartUpload.getRequest().getParameter("register_ID");
          String register_time = mySmartUpload.getRequest().getParameter("register_time");
          String bulletin = mySmartUpload.getRequest().getParameter("bulletin");

          String content = exchange.toHtmlFCK(mySmartUpload.getRequest().getParameter("content"));

          String bodyab =
              new String(
                  mySmartUpload.getRequest().getParameter("remark").getBytes("UTF-8"), "UTF-8");
          String remark = exchange.toHtml(bodyab);
          if (j != 0) {

            response.sendRedirect("oa/message/register_ok_c.jsp");
          } else {
            String sqla = "";
            String sqlb = "";
            if (bulletin == null) {
              sqla =
                  "insert into oa_message(register,register_ID,register_time,message_ID,subject,type,content,remark";
              sqlb =
                  ") values ('"
                      + register
                      + "','"
                      + register_ID
                      + "','"
                      + register_time
                      + "','"
                      + message_ID
                      + "','"
                      + subject
                      + "','"
                      + message_type
                      + "','"
                      + content
                      + "','"
                      + remark
                      + "'";
            } else {
              sqla =
                  "insert into oa_message(register,register_ID,register_time,message_ID,subject,type,content,remark,check_tag";
              sqlb =
                  ") values ('"
                      + register
                      + "','"
                      + register_ID
                      + "','"
                      + register_time
                      + "','"
                      + message_ID
                      + "','"
                      + subject
                      + "','"
                      + message_type
                      + "','"
                      + content
                      + "','"
                      + remark
                      + "','2'";
            }

            String sql = sqla + sqlb + ")";
            oa_db.executeUpdate(sql);

            response.sendRedirect("oa/message/register_ok_b.jsp");
          }
        }
        oa_db.commit();
        oa_db.close();
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }