Exemplo n.º 1
0
  public int update(int oid, String quantity, String memo) { // 更新揀貨單的揀貨數量
    logger.debug(
        "OrderPlaceDDAO.update: "
            + "pickId: "
            + oid
            + ", quantity: "
            + quantity
            + ", memo: "
            + memo);

    EntityManager em = XPersistence.getManager();
    OrderPlaceD bean = em.find(OrderPlaceD.class, oid);
    logger.debug("OrderPlaceD.update: orderPlaceD: " + bean);
    if (bean != null) {
      //			bean.setQuantity(quantity);
      bean.setRemark(memo);
      try {
        em.merge(bean);
        XPersistence.commit();
      } catch (Exception e) {
        logger.error("OrderPlaceD.update: " + e);
      }
      return 1; // 1:成功
    }
    return 0; // 0:失敗
  }
Exemplo n.º 2
0
  public Map<String, String> getCatchSizeList(Long channelId) {
    Map<String, String> map = null;
    Connection conn = null;
    PreparedStatement pst = null;
    ResultSet rs = null;

    try {
      List<Channel> list = new ChannelDao().getChannels(channelId);
      if (list != null && !list.isEmpty()) {
        conn = OracleUtil.getConnection();
        map = new HashMap<String, String>();
        String sql =
            "select nvl(sum(a.log_catch_count),0) from twap_app_log_webcrawler a where exists(select 1 from twap_public_channel b where a.log_channel_id = b.channel_id start with b.channel_id=? connect by prior b.channel_id=b.channel_pid) and (to_char(a.create_time,'yyyy-mm-dd')=to_char(sysdate,'yyyy-mm-dd') )";
        for (Channel channel : list) {
          pst = conn.prepareStatement(sql);
          pst.setLong(1, channel.getChannelId());
          log.debug(sql.replaceAll("\\?", channel.getChannelId().toString()));
          rs = pst.executeQuery();
          if (rs.next()) {
            map.put(channel.getChannelName(), String.valueOf(rs.getLong(1)));
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
      log.error(e);
    } finally {
      close(conn, pst, rs);
    }

    return map;
  }
Exemplo n.º 3
0
 /**
  * 删除 应用系统权限分配记录
  *
  * @param mapping
  * @param form
  * @param request
  * @param response
  * @return
  * @throws IOException
  */
 public ActionForward delRARInfo(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws IOException {
   String rarid = request.getParameter("rarid");
   if (HtmlFactory.isNotEmpty(rarid)) {
     String falg = "成功!";
     try {
       RoleAssignRecords rar = roleAssignRecordsService.findById(Integer.valueOf(rarid));
       roleAssignRecordsService.delete(rar);
     } catch (Exception e) {
       falg = "失败!";
     } finally {
       try {
         systemlogservice.saveSystemLog(
             LogUtil.userName,
             LogUtil.roleName,
             SystemModelInfo.MOD_SYSM_user_other,
             "删除应用系统权限分配记录",
             new Timestamp(System.currentTimeMillis()),
             falg);
       } catch (Exception e) {
         logger.debug("连接日志出错", e);
       }
     }
   }
   return null;
 }
Exemplo n.º 4
0
  public Stock getStockByItem(int itemid) { // 用 商品編號 查出 該商品所在的某一貨架
    Query query =
        XPersistence.getManager()
            .createQuery(
                "FROM Stock o WHERE o.item.oid = :itemid order by o.volume desc"); // JPQL query
    query.setParameter("itemid", itemid);

    List<Stock> beans = query.getResultList();
    logger.debug("OrderPlaceDDAO.getStockByItem beans: " + beans);

    return beans.get(0);
  }
Exemplo n.º 5
0
  public Collection<Stock> getStocksByPlaceId(int placeid) { // 用上架單編號(單頭)查出明細檔
    Query query =
        XPersistence.getManager()
            .createQuery(
                "FROM Stock o WHERE o.item.oid IN (SELECT p.item.oid FROM OrderPlaceD p WHERE p.orderPlace.oid = :placeid ORDER BY p.oid DESC) )"); // JPQL query
    query.setParameter("placeid", placeid);
    // select * FROM Stock o WHERE o.itemid IN (SELECT p.itemid FROM OrderPlaceD p WHERE
    // p.orderPlace_oid = '1' ORDER BY p.oid DESC)
    Collection stocks = query.getResultList();

    logger.debug("OrderPlaceDDAO.getStocksByPlaceId stocks: " + stocks);

    return stocks;
  }
Exemplo n.º 6
0
 /**
  * 添加 应用系统权限分配记录
  *
  * @param mapping
  * @param form
  * @param request
  * @param response
  * @return
  * @throws IOException
  */
 public ActionForward addRARInfo(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws IOException {
   String asrid = request.getParameter("asrid");
   String asiid = request.getParameter("asid");
   String name = request.getParameter("name");
   String operator = request.getParameter("operator");
   if (HtmlFactory.isNotEmpty(asiid)) {
     AppSysRole asr = new AppSysRole();
     AppSysInfo asi = new AppSysInfo();
     asi.setId(Integer.valueOf(asiid));
     if (HtmlFactory.isNotEmpty(asrid)) {
       asr.setId(Integer.valueOf(asrid));
     }
     if (HtmlFactory.isNotEmpty(name)) {
       name = HtmlFactory.conversionCoding(name, "GBK");
     }
     if (HtmlFactory.isNotEmpty(operator)) {
       operator = HtmlFactory.conversionCoding(operator, "GBK");
     }
     String falg = "成功!";
     try {
       RoleAssignRecords rar = new RoleAssignRecords();
       rar.setRole(asr);
       rar.setUser(name);
       rar.setOperator(operator);
       rar.setAppSys(asi);
       rar.setCreateTime(new Timestamp(new Date().getTime()));
       roleAssignRecordsService.add(rar);
     } catch (Exception e) {
       falg = "失败!";
     } finally {
       try {
         systemlogservice.saveSystemLog(
             LogUtil.userName,
             LogUtil.roleName,
             SystemModelInfo.MOD_SYSM_user_other,
             "添加应用系统权限分配记录",
             new Timestamp(System.currentTimeMillis()),
             falg);
       } catch (Exception e) {
         logger.debug("连接日志出错", e);
       }
     }
   }
   return null;
 }