groovy:單據日期帶編號-訂單
Callout
=====================
import java.sql.Timestamp
import java.math.BigDecimal
import java.sql.PreparedStatement
import java.sql.ResultSet
import org.compiere.util.DB
import org.compiere.model.MUser
//@script:groovy:getQuotationForOrder
if (A_Value != null )
{
Timestamp dt = (Timestamp ) A_Value;
String sql ="SELECT max(\"訂單單號\") as 訂單單號 FROM \"訂單\" WHERE \"單據日期\"=? ";
PreparedStatement pstmt = DB.prepareStatement(sql, null);
pstmt.setTimestamp (1, dt);
ResultSet rs = pstmt.executeQuery();
// 只作 1筆 while (rs.next()){
if (rs.next())
{
if (rs.getString("訂單單號") != null)
{
String no1=rs.getString("訂單單號")
int no2=Integer.parseInt(no1,10)
int no3 = no2+1
String no4 = ""+no3
A_Tab.setValue("訂單單號",no4)
}
}
rs.close();
pstmt.close();
}
result=""
沒有留言:
張貼留言