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=""
沒有留言:
張貼留言