public void actionCreatePayment_actionPerformed(ActionEvent e) throws Exception
{
super.actionCreatePayment_actionPerformed(e);
String sql = "select * from t_bill_importhold where fbillbizname='合同生成付款单'";
IRowSet rs = SQLExecutorFactory.getRemoteInstance(sql).executeSQL();
if(rs.next())
{
if(!"1".equals(rs.getString("fisimport")))
{
MsgBox.showInfo("正在执行中,请等待执行完成后再操作……");
return;
}
}else
{
sql = "INSERT INTO t_bill_importhold(fbillbizname,fisimport) values('合同生成付款单','1')";
BaiQianImportFacadeFactory.getRemoteInstance().executeSQL(sql);
}
final Set<String> contractNumSet = new HashSet<String>();
for(int i=0;i<tblMain.getRowCount();i++)
{
Object contractNumO = tblMain.getCell(i, "contractNum").getValue();
if(contractNumO!=null)
{
contractNumSet.add(contractNumO.toString());
}
}
int i = MsgBox.showConfirm2(this, "确定要把以下查询结果的合同生成付款单吗?");
if(MsgBox.YES!=i)
{
return;
}
//后台执行
final LongTimeDialog dialog = new LongTimeDialog((Frame) SwingUtilities.getWindowAncestor(this));
dialog.setLongTimeTask(new ILongTimeTask()
{
public Object exec() throws Exception
{
int j = MsgBox.showConfirm2(conListUI, "转入后台执行?");
if(MsgBox.YES==j)
{
dialog.dispose();
}
String sql="update t_bill_importhold set fisimport=0 where fbillbizname='合同生成付款单';";
BaiQianImportFacadeFactory.getRemoteInstance().executeSQL(sql);
BaiQianImportFacadeFactory.getRemoteInstance().createPaymentByContract(contractNumSet);
return "SUCCESS";//返回执行成功标示
}
public void afterExec(Object arg0) throws Exception
{
MsgBox.showInfo(conListUI, "生成付款单完成");
String sql="update t_bill_importhold set fisimport=1 where fbillbizname='合同生成付款单';";
BaiQianImportFacadeFactory.getRemoteInstance().executeSQL(sql);
btnCreatePayment.setEnabled(true);
}
});
dialog.show();
}
执行转为后台执行任务
最新推荐文章于 2024-04-07 17:38:11 发布