public void init() { JPanel main_jp = new BorderJPanel(); BoxLayout boxLayout = new BoxLayout(main_jp, BoxLayout.Y_AXIS); main_jp.setLayout(boxLayout); main_jp.setBackground(Util.PANEL_COLOR); number = new JLabelJTextFieldComponent(" *", "仓库编号:", 30); name = new JLabelJTextFieldComponent(" *", "仓库名称:", 30); location = new JLabelJTextFieldComponent(" *", "仓库地址:", 30); manager = new JLabelJComboBoxComponent("*", "仓库管理员:", new String[] {}, 188); manager.addElement(new IDNameBean("0", "请选择")); priority = new JLabelJTextFieldComponent("*", "仓库优先级:", "(数字越大,越在前面)", 15); note = new JLabelJTextAreaComponent(" 备 注:", 23, 3); number.getText().setText(UUID.GenUUID15()); number.getText().setEditable(false); priority.getText().setText("0"); main_jp.add(number); main_jp.add(name); main_jp.add(location); main_jp.add(manager); main_jp.add(priority); main_jp.add(note); JPanel p1 = new JPanel(); sureButton = new RPJButtonWhite("保存(Ctrl+S)"); cancelButton = new RPJButtonWhite("取消(Ctrl+Q)"); p1.add(sureButton); p1.add(cancelButton); p1.setOpaque(false); main_jp.add(p1); this.add(main_jp); main_jp.setCursor(Util.CURSOR_DEFAULT); }
// 条件查询 private void termQuery(int currentPage) { TOrder torder = new TOrder(); torder.setOrderID(orderNum.getText().getText().trim()); TUser tuser = new TUser(); tuser.setUserID(userNum.getText().getText().trim()); torder.setTUser(tuser); torder.setOperator(seller.getText().getText().trim()); torder.setHappenTime(startTime.getDate()); torder.setEndTime(endTime.getDate()); tableJsp.getViewport().remove(table); tableJsp.getViewport().add(waitComponent); try { pageView.setCurrentPage(currentPage); PageModel<TOrder> pageModel = orderService.getScrollService(pageView.getFirstResult(), pageView.getMaxResult(), torder); pageView.setPageModel(pageModel); pageView.setPageIndex( PageIndex.getPageIndex( pageView.getPageCode(), pageView.getCurrentPage(), pageView.getTotalPage())); if (pageModel != null) { tableJsp.getViewport().remove(waitComponent); tableJsp.getViewport().add(table); orderOnlineModel.setRowData(pageModel.getResultList()); table.updateUI(); pagingComponent.show(); } else { // 没有订单数据 waitComponent.setText("不存在数据"); } } catch (Exception e) { e.printStackTrace(); } }
@Override public void clear() { articlesUsingModel.clear(); orderID.getText().setText(""); employee.getText().setText(""); startTime.setDate(null); endTime.setDate(null); }
@Override public void keyPressed(KeyEvent e) { if (e.getSource() == orderNum.getText() || e.getSource() == userNum.getText() || e.getSource() == seller.getText()) { // 查询 if (e.getKeyCode() == KeyEvent.VK_ENTER) { queryButton.doClick(); } } }
public void showDialog(TStore tStore) { this.isSuccess = false; SwingUtilities.invokeLater(queryEmp); if (tStore != null) { this.tStore = tStore; number.getText().setText(tStore.getStoreID()); name.getText().setText(tStore.getName()); location.getText().setText(tStore.getLocation()); // manager.getText().setText(tStore.getManager()); priority.getText().setText(tStore.getPriority() + ""); note.getArea().setText(tStore.getNote()); } this.setVisible(true); }
// 条件查询 @Override protected void termQuery(final int currentPage) { final TUser user = new TUser(); user.setCardNum(cardNumTF.getText().getText().trim()); user.setRealName(nameTF.getText().getText().trim()); user.setSendCardTime(startTimeTF.getDate()); user.setMobile(tel.getText().getText()); user.setEndTime(timeTF.getDate()); new Thread() { public void run() { tableJsp.getViewport().remove(table); tableJsp.getViewport().add(waitComponent); try { pageView.setCurrentPage(currentPage); PageModel<TUser> pageModel = tUserService.getScrollService( pageView.getFirstResult(), pageView.getMaxResult(), user); pageView.setPageModel(pageModel); pageView.setPageIndex( PageIndex.getPageIndex( pageView.getPageCode(), pageView.getCurrentPage(), pageView.getTotalPage())); if (pageModel != null) { memberQueryCardModel.setRowData(pageModel.getResultList()); SwingUtilities.invokeLater( new Runnable() { @Override public void run() { tableJsp.getViewport().remove(waitComponent); tableJsp.getViewport().add(table); Util.setJTabelAutoClumnWidth(table); pagingComponent.show(); } }); } else { // 没有订单数据 tableJsp.getViewport().remove(waitComponent); tableJsp.getViewport().add(table); memberQueryCardModel.clear(); } } catch (Exception e) { e.printStackTrace(); } } }.start(); }
private void initListener() { sureButton.addActionListener(this); sureButton.registerKeyboardAction( this, KeyStroke.getKeyStroke(KeyEvent.VK_Y, KeyEvent.CTRL_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW); cancelButton.addActionListener(this); fillMoneyTF.getText().addKeyListener(this); }
// 条件查询 @Override protected void termQuery(final int currentPage) { final TOutBill TOutBill = new TOutBill(); TOutBill.setBillID(orderID.getText().getText().trim()); // TOutBill.setAUser(employee.getText().getText().trim()); TOutBill.setReasonType(ApplicationContext.OUTBILL_REASONTYPE2); TOutBill.setHappenTime(startTime.getDate()); TOutBill.setEndTime(endTime.getDate()); new Thread() { public void run() { tableJsp.getViewport().remove(table); tableJsp.getViewport().add(waitComponent); try { List<TEmployee> tEmployeeList = null; if (employee.getText().getText().trim() != null && !employee.getText().getText().trim().equals("")) { TEmployee tEmployee = new TEmployee(); // 根据名字查出领用人ID, tEmployee.setName(employee.getText().getText().trim()); try { tEmployeeList = tEmployeeService.findService(tEmployee); } catch (Exception e1) { e1.printStackTrace(); } } pageView.setCurrentPage(currentPage); PageModel<TOutBill> pageModel = tOutBillService.getScrollService( pageView.getFirstResult(), pageView.getMaxResult(), TOutBill, tEmployeeList); pageView.setPageModel(pageModel); pageView.setPageIndex( PageIndex.getPageIndex( pageView.getPageCode(), pageView.getCurrentPage(), pageView.getTotalPage())); if (pageModel != null) { articlesUsingModel.setRowData(pageModel.getResultList()); SwingUtilities.invokeLater( new Runnable() { @Override public void run() { tableJsp.getViewport().remove(waitComponent); tableJsp.getViewport().add(table); TabelUtil.setJTabelAutoClumnWidth(table); pagingComponent.show(); } }); } else { // 没有订单数据 tableJsp.getViewport().remove(waitComponent); tableJsp.getViewport().add(table); articlesUsingModel.clear(); } } catch (Exception e) { e.printStackTrace(); } } }.start(); }
@Override public void keyReleased(KeyEvent e) { if (e.getSource() == fillMoneyTF.getText()) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { TShopCharge tShopCharge = new TShopCharge(); tShopCharge.setAMount(Double.parseDouble(fillMoneyTF.getText().getText())); try { PageModel<TShopCharge> pageModel = tShopChargeService.getTShopChargeService(0, 2, tShopCharge); if (pageModel != null) { giftMoneyTF.getText().setText(pageModel.getResultList().get(0).getGiftAmount() + ""); } else { giftMoneyTF.getText().setText(0 + ""); } } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } } }
private void initViews() { JPanel main_jp = new JPanel(); BoxLayout boxLayout = new BoxLayout(main_jp, BoxLayout.Y_AXIS); main_jp.setLayout(boxLayout); main_jp.setBackground(Util.PANEL_COLOR); fillMoneyTF = new JLabelJTextFieldComponent("充值金额:", 30); giftMoneyTF = new JLabelJTextFieldComponent("赠送金额:", 30); giftMoneyTF.getText().setEditable(false); JPanel jp1 = new JPanel(); sureButton = new RPJButtonBlue("确定"); cancelButton = new RPJButtonGray("取消"); jp1.add(sureButton); jp1.add(cancelButton); jp1.setOpaque(false); main_jp.add(fillMoneyTF); main_jp.add(giftMoneyTF); main_jp.add(jp1); this.add(main_jp); }
@Override public void clear() { // TODO Auto-generated method stub ApplicationContext.listenCard(cardNumTF.getText(), ApplicationContext.CardType.CT_DLSended); ApplicationContext.query_member = this; }
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == queryButton) { // 查询 this.termQuery(1); } else if (e.getSource() == showButton) { // 查看详细 if (table.getSelectedRow() != -1) { String userID = (String) table.getValueAt(table.getSelectedRow(), -1); try { TUser tUser = tUserService.getByIdService(userID); menberDetailDialog = new MenberDetailDialog(null, "会员详细信息", true); menberDetailDialog.showDialog(tUser); } catch (Exception e1) { e1.printStackTrace(); } } else { JOptionPane.showMessageDialog(null, "请先选择行数据"); } } else if (e.getSource() == dGiftButton) { // 兑换礼品 if (table.getSelectedRow() != -1) { String userID = (String) table.getValueAt(table.getSelectedRow(), -1); try { TUser tUser = tUserService.getByIdService(userID); tUser.setUserID(userID); memberDGiftDialog = new MemberDGiftDialog(null, "兑换礼品", true); memberDGiftDialog.showDialog(tUser); } catch (Exception e1) { e1.printStackTrace(); } } else { JOptionPane.showMessageDialog(null, "请先选择行数据"); } } else if (e.getSource() == levelButton) { // 设置会员级别 if (table.getSelectedRow() != -1) { boolean[] bools = memberQueryCardModel.getBools(); boolean select = false; // 检查是否有选中的商品 如果没选中false 否则true for (int i = bools.length - 1; i >= 0; --i) { if (bools[i]) { select = true; break; } } if (!select) { JOptionPane.showMessageDialog(null, "请先选择用户!"); return; } else { try { // TUser tUser = tUserService.getByIdService(userID); List<TUser> tUserList = memberQueryCardModel.getTCommodityList(); List<TUser> tUserListOn = new ArrayList(); for (int i = 0; i < tUserList.size(); i++) { if (bools[i]) { tUserListOn.add(tUserList.get(i)); } } memberLevelPanel = new MemberLevelPanel(null, "设置会员级别", true); memberLevelPanel.showDialog(tUserListOn); table.updateUI(); } catch (Exception e1) { e1.printStackTrace(); } } } else { JOptionPane.showMessageDialog(null, "请先选择行数据"); } } else if (e.getSource() == giftButton) { // 送礼品 if (table.getSelectedRow() != -1) { boolean[] bools = memberQueryCardModel.getBools(); boolean select = false; // 检查是否有选中的商品 如果没选中false 否则true for (int i = bools.length - 1; i >= 0; --i) { if (bools[i]) { select = true; break; } } if (!select) { JOptionPane.showMessageDialog(null, "请先选择用户!"); return; } else { try { // TUser tUser = tUserService.getByIdService(userID); List<TUser> tUserList = memberQueryCardModel.getTCommodityList(); List<TUser> tUserListOn = new ArrayList(); for (int i = 0; i < tUserList.size(); i++) { if (bools[i]) { tUserListOn.add(tUserList.get(i)); } } memberGiftSend = new MemberGiftSend(null, "会员赠送礼品", true); memberGiftSend.showDialog(tUserListOn); table.updateUI(); } catch (Exception e1) { e1.printStackTrace(); } } } else { JOptionPane.showMessageDialog(null, "请先选择行数据"); } } else if (e.getSource() == pointButton) { // 送积分 if (table.getSelectedRow() != -1) { boolean[] bools = memberQueryCardModel.getBools(); boolean select = false; // 检查是否有选中的商品 如果没选中false 否则true for (int i = bools.length - 1; i >= 0; --i) { if (bools[i]) { select = true; break; } } if (!select) { JOptionPane.showMessageDialog(null, "请先选择用户!"); return; } else { try { // TUser tUser = tUserService.getByIdService(userID); List<TUser> tUserList = memberQueryCardModel.getTCommodityList(); List<TUser> tUserListOn = new ArrayList(); for (int i = 0; i < tUserList.size(); i++) { if (bools[i]) { // Object obj1=tUserList.get(i); tUserListOn.add(tUserList.get(i)); // TRoleRight roleRight=new TRoleRight(); // roleRight.setTRight((TRight)obj1); } } memberPointSend = new MemberPointSend(null, "会员赠送积分", true); memberPointSend.showDialog(tUserListOn); table.updateUI(); } catch (Exception e1) { e1.printStackTrace(); } } } else { JOptionPane.showMessageDialog(null, "请先选择行数据"); } } else if (e.getSource() == cashButton) { // 送优惠 if (table.getSelectedRow() != -1) { boolean[] bools = memberQueryCardModel.getBools(); boolean select = false; // 检查是否有选中的商品 如果没选中false 否则true for (int i = bools.length - 1; i >= 0; --i) { if (bools[i]) { select = true; break; } } if (!select) { JOptionPane.showMessageDialog(null, "请先选择用户!"); return; } else { try { // TUser tUser = tUserService.getByIdService(userID); List<TUser> tUserList = memberQueryCardModel.getTCommodityList(); List<TUser> tUserListOn = new ArrayList(); for (int i = 0; i < tUserList.size(); i++) { if (bools[i]) { // Object obj1=tUserList.get(i); tUserListOn.add(tUserList.get(i)); // TRoleRight roleRight=new TRoleRight(); // roleRight.setTRight((TRight)obj1); } } memberCashSend = new MemberCashSend(null, "会员赠送优惠卷", true); memberCashSend.showDialog(tUserListOn); table.updateUI(); } catch (Exception e1) { e1.printStackTrace(); } } } else { JOptionPane.showMessageDialog(null, "请先选择行数据"); } } else if (e.getSource() == chargeButton) { // 充值 if (table.getSelectedRow() != -1) { // String userID = (String)table.getValueAt(table.getSelectedRow(), 0); boolean[] bools = memberQueryCardModel.getBools(); boolean select = false; // 检查是否有选中的商品 如果没选中false 否则true for (int i = bools.length - 1; i >= 0; --i) { if (bools[i]) { select = true; break; } } if (!select) { JOptionPane.showMessageDialog(null, "请先选择用户!"); return; } else { try { // TUser tUser = tUserService.getByIdService(userID); List<TUser> tUserList = memberQueryCardModel.getTCommodityList(); List<TUser> tUserListOn = new ArrayList(); for (int i = 0; i < tUserList.size(); i++) { if (bools[i]) { // Object obj1=tUserList.get(i); tUserListOn.add(tUserList.get(i)); // TRoleRight roleRight=new TRoleRight(); // roleRight.setTRight((TRight)obj1); } } memberChargeDetailDialog = new MemberChargeDetailDialog(null, "会员充值", true); memberChargeDetailDialog.showDialog(tUserListOn); table.updateUI(); } catch (Exception e1) { e1.printStackTrace(); } } } else { JOptionPane.showMessageDialog(null, "请先选择行数据"); } } else if (e.getSource() == memberDetailButton) { // 查看会员行为 if (table.getSelectedRow() != -1) { String userID = (String) table.getValueAt(table.getSelectedRow(), -1); try { TUser tUser = tUserService.getByIdService(userID); tUser.setUserID(userID); memberBehaviorDialog = new MemberBehaviorDialog(null, "会员行为", true); memberBehaviorDialog.showDialog(tUser); } catch (Exception e1) { e1.printStackTrace(); } } else { JOptionPane.showMessageDialog(null, "请先选择行数据"); } } else if (e.getSource() == noticeButton) { // 通知 if (table.getSelectedRow() != -1) { boolean[] bools = memberQueryCardModel.getBools(); boolean select = false; // 检查是否有选中的商品 如果没选中false 否则true for (int i = bools.length - 1; i >= 0; --i) { if (bools[i]) { select = true; break; } } if (!select) { JOptionPane.showMessageDialog(null, "请先选择用户!"); return; } else { try { List<TUser> tUserList = memberQueryCardModel.getTCommodityList(); List<TUser> tUserListOn = new ArrayList(); for (int i = 0; i < tUserList.size(); i++) { if (bools[i]) { tUserListOn.add(tUserList.get(i)); } } memberNoticeDetailDialog = new MemberNoticeDetailDialog(null, "通知会员", true); memberNoticeDetailDialog.showDialog(tUserListOn); table.updateUI(); } catch (Exception e1) { e1.printStackTrace(); } } } else { JOptionPane.showMessageDialog(null, "请先选择行数据"); } } else if (e.getSource() == clearButton) { // 清空 cardNumTF.getText().setText(""); nameTF.getText().setText(""); tel.getText().setText(""); startTimeTF.setDate(null); timeTF.setDate(null); } }
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == sureButton) { String storeIDStr = number.getText().getText().trim(); String nameStr = name.getText().getText().trim(); String locationStr = location.getText().getText().trim(); Object managerObj = manager.getBox().getSelectedItem(); String priorityStr = priority.getText().getText().trim(); String noteStr = note.getArea().getText().trim(); if (nameStr.equals("") || nameStr.length() > 128) { JOptionPane.showMessageDialog(null, "仓库名称不能为空,且不能大于128个字"); name.getText().requestFocus(); return; } if (locationStr.equals("") || locationStr.length() > 100) { JOptionPane.showMessageDialog(null, "仓库地址不能为空,且不能大于100个字"); location.getText().requestFocus(); return; } if (noteStr.length() > 100) { JOptionPane.showMessageDialog(null, "备注不能大于100个字"); note.getArea().requestFocus(); return; } if (priorityStr.equals("") || !MatcherFormatUtil.MatcherNumberScheme(priorityStr) || priorityStr.length() > 10) { JOptionPane.showMessageDialog(null, "优先级只能输入数字,且不能大于10位"); priority.getText().requestFocus(); return; } IDNameBean bean = (IDNameBean) managerObj; if (bean.getStrId().equals("0")) { JOptionPane.showMessageDialog(null, "请先选择仓库管理员"); manager.getBox().requestFocus(); return; } boolean isOpLog = false; if (tStore == null) { tStore = new TStore(); isOpLog = true; } tStore.setStoreID(storeIDStr); tStore.setName(nameStr); tStore.setLocation(locationStr); tStore.setManager(bean.getStrId()); tStore.setPriority(Integer.parseInt(priorityStr)); tStore.setNote(noteStr); try { if (isOpLog) { List<TStore> list = storeService.findByNameService(nameStr); if (list != null && list.size() != 0) { if (Util.showConfirmDialog("存在相同名字的仓库,确定添加吗?") != 0) return; } } this.storeService.saveOrUpdateService(tStore); this.isSuccess = true; if (isOpLog) { BuildSpringApplication.getInstance().getTOpLogServiceImpl().addOpLogService("添加仓库信息"); } else { BuildSpringApplication.getInstance().getTOpLogServiceImpl().addOpLogService("修改仓库信息"); } JOptionPane.showMessageDialog(null, "操作成功"); } catch (Exception e1) { e1.printStackTrace(); this.isSuccess = false; JOptionPane.showMessageDialog(null, "操作失败"); } this.dispose(); } else if (e.getSource() == cancelButton) { this.isSuccess = false; this.dispose(); } super.actionPerformed(e); }
private void initListener() { queryButton.addActionListener(this); orderNum.getText().addKeyListener(this); userNum.getText().addKeyListener(this); seller.getText().addKeyListener(this); }
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == sureButton) { Boolean isShow = false; // 确定 String fillMoneyT = fillMoneyTF.getText().getText().trim(); // 充值金额 String giftMoneyT = giftMoneyTF.getText().getText().trim(); // 赠送金额 if (!MatcherFormatUtil.MatcherPriceScheme(fillMoneyT)) { JOptionPane.showMessageDialog(null, "充值金额 不能为空,且小数点左边最多10位数字,右边最多2位数字"); fillMoneyTF.getText().setText(""); fillMoneyTF.getText().requestFocus(); return; } if (!MatcherFormatUtil.MatcherPriceScheme(giftMoneyT)) { JOptionPane.showMessageDialog(null, "请在充值金额栏点击回车获取赠送金额!"); giftMoneyTF.getText().setText(""); giftMoneyTF.getText().requestFocus(); return; } for (int i = 0; i < tUser.size(); i++) { if (giftMoneyTF.getText().getText().trim() != "") { Double totalMoney = Double.parseDouble(giftMoneyTF.getText().getText().trim()) + Double.parseDouble(fillMoneyT); tUser.get(i).setMoney(totalMoney + tUser.get(i).getMoney()); } else { tUser.get(i).setMoney(Double.parseDouble(fillMoneyT)); } try { Date date = new Date(); if (tUserService.modifyRechargeService(tUser.get(i))) { BuildSpringApplication.getInstance() .getTOpLogServiceImpl() .addOpLogService("会员充值,卡号为:+" + tUser.get(i).getCardNum() + ",充值金额:" + fillMoneyT); TShopRecharge tShopRecharge = new TShopRecharge(); // 添加明细 tShopRecharge.setRechargeID(UUID.GenUUID15()); tShopRecharge.setUserID(userID); // 单据编号CHAR(15) tShopRecharge.setChargeRuleID(""); tShopRecharge.setHappenTime(date); tShopRecharge.setMoney(Double.parseDouble(fillMoneyT)); tShopRecharge.setGiftMoney(Double.parseDouble(giftMoneyTF.getText().getText().trim())); tShopRechargeService.saveService(tShopRecharge); // 添加资金出入 ApplicationContext.addMondyInOut( ApplicationContext.MONEYINOUT_TYPE_IN, ApplicationContext.OPERATOR_ID, ApplicationContext.MONEYINOUT_SOURCE_TYPE5, tShopRecharge.getRechargeID()); isShow = true; } } catch (Exception e1) { isShow = false; e1.printStackTrace(); } } if (isShow) { JOptionPane.showMessageDialog(null, "充值成功!"); this.dispose(); } else { JOptionPane.showMessageDialog(null, "数据异常。"); } } else if (e.getSource() == cancelButton) { this.dispose(); } }