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 )
{
int id = ((Integer) A_Value).intValue();
String sql ="SELECT a.\"狀態碼\",a.\"品號_id\",a.\"品名\",a.\"規格\",a.\"預計產量\",a.\"單位_id\",a.\"備註\", b.\"預計開工\", b.\"預計完工\" FROM \"製造命令\" a LEFT OUTER JOIN \"生產排程資料\" b ON a.\"製造命令_id\" =b.\"製造命令_id\" WHERE a.\"製造命令_id\"=? ";
PreparedStatement pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, id);
ResultSet rs = pstmt.executeQuery();
// 只作 1筆 while (rs.next()){
if (rs.next()) {
if (rs.getInt("品號_id") > 0) A_Tab.setValue("品號_id",new Integer(rs.getInt("品號_id")));
if (rs.getInt("單位_id") > 0) A_Tab.setValue("單位_id",new Integer(rs.getInt("單位_id")));
if (rs.getString("品名") != null) A_Tab.setValue("品名",rs. getString ("品名"));
if (rs.getString("規格") != null) A_Tab.setValue("規格",rs. getString ("規格"));
if (rs.getString("狀態碼") != null) A_Tab.setValue("狀態碼",rs. getString ("狀態碼"));
if (rs.getString("備註") != null) A_Tab.setValue("備註",rs. getString ("備註"));
if (rs.getBigDecimal ("預計產量") != null) A_Tab.setValue("預計產量",rs.getBigDecimal ("預計產量"));
if (rs.getTimestamp ("預計完工") != null) A_Tab.setValue("預計完工",rs.getTimestamp ("預計完工"));
if (rs.getTimestamp ("預計開工") != null) A_Tab.setValue("預計開工",rs.getTimestamp ("預計開工"));
}
rs.close();
pstmt.close();
}
result=""
沒有留言:
張貼留言