功能注册增加一个功能,组织类型和当前模块其他节点保持一致。功能类名为自定义界面的全路径类名
新增一个菜单项,编码自定义,关联功能编码和上面的功能注册的功能节点关联
package nc.ui.arap.hx;
import java.awt.Component;
import nc.funcnode.ui.FuncletContext;
import nc.funcnode.ui.FuncletInitData;
import nc.funcnode.ui.IFunclet;
import nc.sfbase.client.ClientToolKit;
import nc.vo.sm.funcreg.FuncRegisterVO;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
@SuppressWarnings("restriction")
public class CostCalculation implements IFunclet{
@Override
public String getTitle() {
return "应收核销";
}
@Override
public void init(FuncletContext paramFuncletContext) {
try {
// 弹出对话框
CostClientUI dialog = new CostClientUI(ClientToolKit.getApplet());
dialog.setVisible(true);
} catch (Exception e) {
ExceptionUtils.wrappException(e);
}
}
@Override
public FuncletContext getFuncletContext() {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean funcletCloseing() {
// TODO Auto-generated method stub
return false;
}
@Override
public String preOpenCheck(FuncRegisterVO paramFuncRegisterVO) {
// TODO Auto-generated method stub
return null;
}
@Override
public String afterIntiedOpenCheck(FuncRegisterVO paramFuncRegisterVO) {
// TODO Auto-generated method stub
return null;
}
@Override
public Component getControl() {
// TODO Auto-generated method stub
return null;
}
@Override
public void initData(FuncletInitData paramFuncletInitData) {
// TODO Auto-generated method stub
}
}
package nc.ui.ia.chhs;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import nc.bs.framework.common.NCLocator;
import nc.itf.uap.IUAPQueryBS;
import nc.jdbc.framework.processor.ColumnProcessor;
import nc.ui.pub.beans.MessageDialog;
import nc.ui.pub.beans.UIButton;
import nc.ui.pub.beans.UIDialog;
import nc.ui.pub.beans.UILabel;
import nc.ui.pub.beans.UIPanel;
import nc.ui.pub.beans.UIRefPane;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
@SuppressWarnings("restriction")
public class CostClientUI extends UIDialog implements ActionListener {
/**
*
*/
private static final long serialVersionUID = 1L;
@SuppressWarnings("unused")
private String m_userid;
// 年
private UILabel yearLabel;
private UIRefPane yeaRefPane;
// 月
private UILabel monthLabel;
private UIRefPane monthRefPane;
private UILabel orgLabel;
private UIRefPane orgRefPane;
// 确定按钮
private UIButton qdBtn;
// 取消
private UIButton qxBtn;
@SuppressWarnings("deprecation")
public CostClientUI() {
}
public CostClientUI(Container parent) {
super(parent);
initialize();
btnInit();
// 按钮添加监听事件
qdBtn.addActionListener(this);
qxBtn.addActionListener(this);
}
/**
* 初始化类。
*/
private void initialize() {
setSize(350, 180); // 设置对话框大小为500x300像素
setLocationRelativeTo(null); // 将对话框居中显示
setDefaultCloseOperation(DISPOSE_ON_CLOSE); // 设置关闭操作为释放资源
setTitle("成本计算");
setModal(true); // 设置为模态对话框(阻塞其他窗口)
setLayout(new BorderLayout());
setResizable(false);
setDefaultCloseOperation(DISPOSE_ON_CLOSE); // 设置关闭操作为释放资源
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == qdBtn) {
try {
if (yeaRefPane.getText() != null
&& monthRefPane.getText() != null
&& orgRefPane.getValueObj() != null) {
IUAPQueryBS queryBS = NCLocator.getInstance().lookup(
IUAPQueryBS.class);
String[] year = (String[]) yeaRefPane.getValueObj();
String[] month = (String[]) monthRefPane.getValueObj();
String[] orgid = (String[]) orgRefPane.getValueObj();
String befCurString = year[0] + "-" + month[0];
SimpleDateFormat inputFormatter = new SimpleDateFormat(
"yyyy-M");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
// 解析字符串为 Date 对象
Date date = inputFormatter.parse(befCurString);
// 将 Date 对象格式化为 yyyy-MM 格式的字符串
String curString = formatter.format(date);
Date curDate = formatter.parse(curString + "-01");
String selCaccountperiod = "select max(caccountperiod) kjrq from ia_account acc inner join org_costregion org ON org.pk_costregion = acc.pk_org where acc.dr=0 and org.pk_org='"
+ orgid[0] + "'";
String selCost = "select max(iyear ||'-'||imonth) rq from lcwy_cbjcb where pk_org='"
+ orgid[0] + "' ";
String maxCac = "";
String maxCost = "";
maxCac = (String) queryBS.executeQuery(selCaccountperiod,
new ColumnProcessor());
maxCost = (String) queryBS.executeQuery(selCost,
new ColumnProcessor());
// if(maxCac==null||maxCost==null){
// MessageDialog.showWarningDlg(this, "错误", "该组织最新期间或则结算单为空不能进行成本计算");
// return;
//
// }
// Date maxCacDate = formatter.parse(maxCac + "-01");
// if (curDate.after(maxCacDate)) {
// MessageDialog.showWarningDlg(this, "错误", "最新期间为"
// + maxCac + "不能进行成本计算");
// return;
// }
// Date maxCostDate = formatter.parse(maxCost + "-01");
// Calendar cal = Calendar.getInstance();
// cal.setTime(maxCostDate);
// // 增加一个月
// cal.add(Calendar.MONTH, 1);
// // 获取调整后的日期
// Date nextMonthDate = cal.getTime();
// if (curDate.after(nextMonthDate)) {
// MessageDialog.showWarningDlg(this, "错误", "最新结算单为"
// + maxCost + "请先计算下一个月的数据");
// return;
// }
//
// if (maxCost!=null&&!maxCost.isEmpty()&&curDate.before(nextMonthDate)) {
// int ok = MessageDialog.showOkCancelDlg(this, "提示",
// "\n最新结算单时间为:" + maxCost
// + ",如果继续此操作将会清空该组织,当前及之后日期数据,进行重新计算,是否继续次操作?");
// if (ok == 2) {
// return;
// }
//
// }
String monthString=month[0];
int monthInt = Integer.parseInt(month[0]);
if(monthInt<10){
monthString="0"+month[0];
}
// if(Integer.parseInt(month[0])){
//
// }
String callProcedureSQL = "{call YL_COST_PROCESS('"
+ orgid[0] + "','" + year[0] + "','" + monthString
+ "')}";
queryBS.executeQuery(callProcedureSQL,
new ColumnProcessor());
closeCancel();
} else {
MessageDialog.showWarningDlg(this, "错误", "有空值不能点确定!");
}
} catch (Exception ex) {
ExceptionUtils.wrappException(ex);
closeCancel();
}
} else {
closeCancel();
}
}
// 初始化按钮和文本框
public void btnInit() {
qdBtn = new UIButton("确定");
qxBtn = new UIButton("取消");
qdBtn.setBorderPainted(false);
qdBtn.setFocusPainted(false);
qxBtn.setBorderPainted(false);
qxBtn.setFocusPainted(false);
// 年
yearLabel = new UILabel(" 年:");
yeaRefPane = new UIRefPane();
yeaRefPane.setRefNodeName("年");
// 月
monthLabel = new UILabel(" 月:");
monthRefPane = new UIRefPane();
monthRefPane.setRefNodeName("月");
orgLabel = new UILabel(" 组 织:");
orgRefPane = new UIRefPane();
orgRefPane.setRefNodeName("财务组织");
UIPanel panel = new UIPanel(new FlowLayout(FlowLayout.LEFT));
panel.add(new UILabel(
" "));
panel.add(yearLabel);
panel.add(yeaRefPane);
panel.add(monthLabel);
panel.add(monthRefPane);
panel.add(new UILabel(
" "));
panel.add(orgLabel);
panel.add(orgRefPane);
UIPanel panel2 = new UIPanel();
panel2.add(qdBtn);
panel2.add(qxBtn);
this.add(panel, BorderLayout.CENTER);
this.add(panel2, BorderLayout.SOUTH);
}
}