if (progressiveHIE02!=null) {
sql_3 += " AND ITM01_ITEMS.PROGRESSIVE_HIE02=? ";
params.add(progressiveHIE02);
}
if (progressiveHIE01!=null) {
VOListResponse res = bean.getLeaves(
vo.getCompanyCodeSys01WAR06(),
progressiveHIE02,
progressiveHIE01,
serverLanguageId,
username
);
sql_3 += " AND ITM01_ITEMS.PROGRESSIVE_HIE01 IN (";
for(int i=0;i<res.getRows().size();i++)
sql_3 += ((CompanyHierarchyLevelVO)res.getRows().get(i)).getProgressiveHIE01()+",";
sql_3 += progressiveHIE01;
sql_3 += ") ";
}
pstmt = conn.prepareStatement(sql_1+sql_2+sql_3);
for(int i=0;i<params.size();i++) {
pstmt.setObject(i+1,params.get(i));
}
rows = pstmt.executeUpdate();
pstmt.close();
sql_1 =
"insert into WAR08_INVENTORY_S_N("+
"SERIAL_NUMBER,"+
"COMPANY_CODE_SYS01," +
"PROGRESSIVE_WAR06," +
"ITEM_CODE_ITM01," +
"VARIANT_TYPE_ITM06," +
"VARIANT_TYPE_ITM07," +
"VARIANT_TYPE_ITM08," +
"VARIANT_TYPE_ITM09," +
"VARIANT_TYPE_ITM10," +
"VARIANT_CODE_ITM11," +
"VARIANT_CODE_ITM12," +
"VARIANT_CODE_ITM13," +
"VARIANT_CODE_ITM14," +
"VARIANT_CODE_ITM15," +
"PROGRESSIVE_HIE01,CREATE_USER,CREATE_DATE) "+
"select " +
"WAR05_STORED_SERIAL_NUMBERS.SERIAL_NUMBER,"+
"WAR05_STORED_SERIAL_NUMBERS.COMPANY_CODE_SYS01," +
"?," +
"WAR05_STORED_SERIAL_NUMBERS.ITEM_CODE_ITM01," +
"WAR05_STORED_SERIAL_NUMBERS.VARIANT_TYPE_ITM06," +
"WAR05_STORED_SERIAL_NUMBERS.VARIANT_TYPE_ITM07," +
"WAR05_STORED_SERIAL_NUMBERS.VARIANT_TYPE_ITM08," +
"WAR05_STORED_SERIAL_NUMBERS.VARIANT_TYPE_ITM09," +
"WAR05_STORED_SERIAL_NUMBERS.VARIANT_TYPE_ITM10," +
"WAR05_STORED_SERIAL_NUMBERS.VARIANT_CODE_ITM11," +
"WAR05_STORED_SERIAL_NUMBERS.VARIANT_CODE_ITM12," +
"WAR05_STORED_SERIAL_NUMBERS.VARIANT_CODE_ITM13," +
"WAR05_STORED_SERIAL_NUMBERS.VARIANT_CODE_ITM14," +
"WAR05_STORED_SERIAL_NUMBERS.VARIANT_CODE_ITM15," +
"WAR05_STORED_SERIAL_NUMBERS.PROGRESSIVE_HIE01,?,? ";
sql_2 =
"from WAR05_STORED_SERIAL_NUMBERS,WAR01_WAREHOUSES ";
sql_3 =
"WHERE "+
"WAR05_STORED_SERIAL_NUMBERS.COMPANY_CODE_SYS01=? AND " +
"WAR05_STORED_SERIAL_NUMBERS.COMPANY_CODE_SYS01=WAR01_WAREHOUSES.COMPANY_CODE_SYS01 AND "+
"WAR01_WAREHOUSES.WAREHOUSE_CODE=? AND "+
"WAR05_STORED_SERIAL_NUMBERS.PROGRESSIVE_HIE01 in (select PROGRESSIVE from HIE01_COMPANY_LEVELS where COMPANY_CODE_SYS01='"+vo.getCompanyCodeSys01WAR06()+"' and PROGRESSIVE_HIE02=WAR01_WAREHOUSES.PROGRESSIVE_HIE02)";
params = new ArrayList();
params.add(vo.getProgressiveWAR06());
params.add(username);
params.add(new java.sql.Timestamp(System.currentTimeMillis()));
params.add(vo.getCompanyCodeSys01WAR06());
params.add(vo.getWarehouseCodeWar01WAR06());
if (progressiveHIE02!=null || progressiveHIE01!=null) {
sql_2 += ",ITM01_ITEMS ";
sql_3 +=
" AND ITM01_ITEMS.COMPANY_CODE_SYS01=WAR05_STORED_SERIAL_NUMBERS.COMPANY_CODE_SYS01 "+
" AND ITM01_ITEMS.ITEM_CODE=WAR05_STORED_SERIAL_NUMBERS.ITEM_CODE_ITM01 ";
}
if (progressiveHIE02!=null) {
sql_3 += " AND ITM01_ITEMS.PROGRESSIVE_HIE02=? ";
params.add(progressiveHIE02);
}
if (progressiveHIE01!=null) {
VOListResponse res = bean.getLeaves(
vo.getCompanyCodeSys01WAR06(),
progressiveHIE02,
progressiveHIE01,
serverLanguageId,
username
);
sql_3 += " AND ITM01_ITEMS.PROGRESSIVE_HIE01 IN (";
for(int i=0;i<res.getRows().size();i++)
sql_3 += ((CompanyHierarchyLevelVO)res.getRows().get(i)).getProgressiveHIE01()+",";
sql_3 += progressiveHIE01;
sql_3 += ") ";
}