|
|
@@ -78,4 +78,50 @@ public class SyncProductWIPTask {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Scheduled(cron = "0 0/5 * * * ?")
|
|
|
+ public void SyncProductWIP_BACKLOG() {
|
|
|
+ SqlRowList rs2 = baseDao.queryForRowSet("select TO_CHAR(SYSDATE,'HH24') v_hour,TO_CHAR(SYSDATE,'MI') v_mi from dual");
|
|
|
+ while(rs2.next()){
|
|
|
+ String V_HOUR = rs2.getGeneralString("v_hour");
|
|
|
+ String V_MI = rs2.getGeneralString("v_mi");
|
|
|
+ if(("02".equals(V_HOUR) || "08".equals(V_HOUR) || "14".equals(V_HOUR) || "20".equals(V_HOUR) || "15".equals(V_HOUR) || "16".equals(V_HOUR) )
|
|
|
+ //&& ("00".equals(V_MI) || "04".equals(V_MI) || "06".equals(V_MI))
|
|
|
+ ){
|
|
|
+ X5JsonHttpClient x5JsonHttpClient = new X5JsonHttpClient(configuration.getX5appid(),configuration.getX5appkey(),configuration.getX5ProductWIPUrl());
|
|
|
+ Map<String,Object> data = new HashMap<>();
|
|
|
+ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String format = sf.format(new Date());
|
|
|
+ data.put("request_time",format);
|
|
|
+ List<Map<String,Object>> list = new ArrayList<>();
|
|
|
+ String Sql="select * from (select rownum rn,to_char(nvl(cd_date_1,to_date('1970-01-01','yyyy-mm-dd')),'yyyy-mm-dd hh24:mi:ss') cd_date_ywfs, A.* from " +
|
|
|
+ " (select ct_id,ct_code,CUSTOMTABLEDETAIL.* from CUSTOMTABLE left join CUSTOMTABLEDETAIL on ct_id=cd_ctid " +
|
|
|
+ " where ct_caller='XiaoMiProductWIP_BACKLOG' and ct_id= " +
|
|
|
+ " (select ct_id from (select ct_id from CUSTOMTABLE where ct_caller='XiaoMiProductWIP_BACKLOG' " +
|
|
|
+ " " +
|
|
|
+ " and ct_statuscode='AUDITED' order by ct_id desc) where rownum=1) " +
|
|
|
+ " order by cd_detno) A) where rn<=1000";
|
|
|
+ SqlRowList rs = baseDao.queryForRowSet(Sql);
|
|
|
+
|
|
|
+ while (rs.next()){
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ map.put("factory_code",configuration.getX5vendercode());
|
|
|
+ map.put("component_code",rs.getGeneralString("cd_varchar50_1"));
|
|
|
+ map.put("process",rs.getGeneralString("cd_varchar50_2"));
|
|
|
+ map.put("line_id",rs.getGeneralString("cd_varchar50_3"));
|
|
|
+ map.put("site_name",rs.getGeneralString("cd_varchar50_4"));
|
|
|
+ map.put("wip_num",rs.getInt("cd_number_1"));
|
|
|
+ map.put("project_name",rs.getGeneralString("cd_varchar50_5"));
|
|
|
+ map.put("product_code",rs.getGeneralString("cd_varchar50_6"));
|
|
|
+ map.put("fact_date",rs.getGeneralString("cd_date_ywfs"));
|
|
|
+ map.put("ct_id",rs.getGeneralInt("ct_id"));
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+ data.put("data",list);
|
|
|
+ if(list.size()>0){
|
|
|
+ x5JsonHttpClient.post(data, configuration, baseDao, "ProductWIP");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|