使用的是X5组件导入的 UI导入 先展现到页面 点击保存 才到数据库
public static void lhgslrBeforeSaveYT_LHGS_LRAction() {
//获得table参数
Table table = (Table) ContextHelper.getActionContext().getParameter("table");
//获得所有新增的行
Iterator<Row> rows = table.iterator(com.justep.system.data.ModifyState.NEW);
// SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy");
// String date = sDateFormat.format(new java.util.Date());
String cjms = "无该描述";
String dyms = "无该描述";
String gdms = "无该描述";
String zyzms = "无该描述";
String gwms = "无该描述";
ArrayList cjbiaoList = new ArrayList();
Row row = null;
while (rows.hasNext()){
row = rows.next();
String cjdm = (String) row.getValue("fCJ"); // String a=BizUtils.createNextSequenceString("CDRS"+date,"0000"); // row.setValue("fDX",a); //给列赋值
String dydm = (String) row.getValue("fDY");
String gddm = (String) row.getValue("fGD");
String zyzdm = (String) row.getValue("fZBZYZ");
String xfgw = (String) row.getValue("fXFGW");
System.out.print(cjdm + "execl导入的数据");
/查找车间的 上面是查车间表 下面是组织表
//String ksql = "select a.fCJMS from YT_CJGS_MANAGERWH a where a.fCJDM = '" + cjdm + "'";
String ksql = "select a.fZZJGMS from YT_ZZJG_WH a where a.fZZJGDM = '" + cjdm + "'";
System.out.print(ksql + "execl导入的数据");
Table shujutable = KSQL.select(ksql, null, "/YT_LHGS/YT_ZZJG/data", null);
Iterator<Row> shujurows = shujutable.iterator();
Row rs = null;
if (shujurows.hasNext()) {
rs = shujurows.next();
cjms = (String) rs.getValue("fZZJGMS");
}
row.setValue("fCJMIAOSHU", cjms);
//
/查找组织单元的
String ksql2 = "select a.fZZJGMS from YT_ZZJG_WH a where a.fZZJGDM = '" + dydm + "'";
System.out.print(ksql2 + "execl导入的数据");
Table shujutable2 = KSQL.select(ksql2, null, "/YT_LHGS/YT_ZZJG/data", null);
Iterator<Row> shujurows2 = shujutable2.iterator();
Row rs2 = null;
if (shujurows2.hasNext()) {
rs2 = shujurows2.next();
dyms = (String) rs2.getValue("fZZJGMS");
}
row.setValue("fDYMS", dyms);
///
/查找组织工段的
String ksql3 = "select a.fZZJGMS from YT_ZZJG_WH a where a.fZZJGDM = '" + gddm + "'";
System.out.print(ksql3 + "execl导入的数据");
Table shujutable3 = KSQL.select(ksql3, null, "/YT_LHGS/YT_ZZJG/data", null);
Iterator<Row> shujurows3 = shujutable3.iterator();
Row rs3 = null;
if (shujurows3.hasNext()) {
rs3 = shujurows3.next();
gdms = (String) rs3.getValue("fZZJGMS");
}
row.setValue("fGDMS", gdms);
///
/查找组织专业组的
String ksql4 = "select a.fZZJGMS from YT_ZZJG_WH a where a.fZZJGDM = '" + zyzdm + "'";
System.out.print(ksql4 + "execl导入的数据");
Table shujutable4 = KSQL.select(ksql4, null, "/YT_LHGS/YT_ZZJG/data", null);
Iterator<Row> shujurows4 = shujutable4.iterator();
Row rs4 = null;
if (shujurows4.hasNext()) {
rs4 = shujurows4.next();
zyzms = (String) rs4.getValue("fZZJGMS");
}
row.setValue("fZYZMS", zyzms);
///
/查找组织工细的
String ksql5 = "select a.fZZJGMS from YT_ZZJG_WH a where a.fZZJGDM = '" + xfgw + "'";
System.out.print(ksql5 + "execl导入的数据");
Table shujutable5 = KSQL.select(ksql5, null, "/YT_LHGS/YT_ZZJG/data", null);
Iterator<Row> shujurows5 = shujutable5.iterator();
Row rs5 = null;
if (shujurows5.hasNext()) {
rs5 = shujurows5.next();
gwms = (String) rs5.getValue("fZZJGMS");
}
row.setValue("fGWMS", gwms);
///
}
}
如果是DB导入的话 DB是直接插入到数据库 所以要用到 execl解析
Sheet 这种的