|
|
@@ -163,8 +163,8 @@ public class ScheduleTaskServiceImpl implements ScheduleTaskService {
|
|
|
try {
|
|
|
SqlRowList rs = baseDao.queryForRowSet("select id,mm_code,mm_detno from mes_makematerial where status='W' order by id");
|
|
|
while (rs.next()) {
|
|
|
- /*int count = baseDao.getCount("select count(1) from mes_make where status='D' and ma_code='" + rs.getGeneralString("mm_code") + "'");
|
|
|
- if (count > 0) {*/
|
|
|
+ int count = baseDao.getCount("select count(1) from mes_make where status='D' and ma_code='" + rs.getGeneralString("mm_code") + "'");
|
|
|
+ if (count > 0) {
|
|
|
MakeMaterial makeMaterial = baseDao.getJdbcTemplate().queryForObject("select mm_code,erpid,mm_prodcode,pr_detail,replace(PR_SPEC,'''','''''') pr_spec,pr_unit,mm_oneuseqty qty,mm_qty,mm_oneuseqty,'main' type,bo_recorder,to_char(bo_date,'yyyy-MM-dd HH24:mi:ss') bo_date,0 bo_version,nvl(bo_cop,'BYT') bo_cop,mm_prodcode mm_repprodcode,mm_balance,(select nvl(cu_mescode,'BYT') from Product left join customer on pr_kh_user=cu_shortname where pr_code=ma_prodcode) ma_custcode,to_char(mc_indate,'yyyy-MM-dd HH24:mi:ss') mc_indate,mc_recorder,flag,0 rpid from mes_makematerial left join make on ma_id=mm_maid left join Product on mm_prodcode=pr_code left join bom on bo_id=mm_bomid left join (select max(mc_indate) mc_indate,max(mc_recorder) mc_recorder,max(md_mmdetno) md_mmdetno,max(md_makecode) md_makecode from MakeMaterialChangeDet left join MakeMaterialChange on mc_id=md_mcid) on md_makecode=ma_code and md_mmdetno=mm_detno where id=? order by mm_detno", new BeanPropertyRowMapper<MakeMaterial>(MakeMaterial.class), rs.getInt("id"));
|
|
|
makeMaterial.setMesUser(tokenConfig.get("mesUser"));
|
|
|
makeMaterial.setMesPwd(MD5Util.encodeByMD5(tokenConfig.get("mesPwd")));
|
|
|
@@ -194,9 +194,9 @@ public class ScheduleTaskServiceImpl implements ScheduleTaskService {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- /*}else{
|
|
|
+ }else{
|
|
|
baseDao.updateByCondition("mes_makematerial", "status='E'", "status='W' and id=" + rs.getInt("id"));
|
|
|
- }*/
|
|
|
+ }
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
logger.info("同步工单BOM异常信息:"+e.getMessage());
|
|
|
@@ -209,8 +209,8 @@ public class ScheduleTaskServiceImpl implements ScheduleTaskService {
|
|
|
try {
|
|
|
SqlRowList rs = baseDao.queryForRowSet("select id,mp_mmcode, mp_mmdetno,mp_mmid from mes_makematerialreplace where status='W' order by id");
|
|
|
while (rs.next()) {
|
|
|
- /*int count = baseDao.getCount("select count(1) from mes_makematerial where status='D' and " + "erpid=" + rs.getInt("mp_mmid"));
|
|
|
- if (count > 0) {*/
|
|
|
+ int count = baseDao.getCount("select count(1) from mes_makematerial where status='D' and " + "erpid=" + rs.getInt("mp_mmid"));
|
|
|
+ if (count > 0) {
|
|
|
MakeMaterial makeMaterial = baseDao.getJdbcTemplate().queryForObject("select mm.mm_code,mm.erpid,mr.mp_prodcode mm_prodcode,pr_detail,replace(PR_SPEC,'''','''''') pr_spec,pr_unit,mm.mm_oneuseqty qty,mr.mp_canuseqty mm_qty,mm.mm_oneuseqty,'alternative' type,bo_recorder,to_char(bo_date,'yyyy-MM-dd HH24:mi:ss') bo_date,0 bo_version,nvl(bo_cop,'BYT') bo_cop,mm.mm_prodcode mm_repprodcode,mm.mm_balance,(select nvl(cu_mescode,'BYT') from Product left join customer on pr_kh_user=cu_shortname where pr_code=ma_prodcode) ma_custcode,to_char(mc_indate,'yyyy-MM-dd HH24:mi:ss') mc_indate,mc_recorder,mr.flag,mr.erpid rpid from mes_makematerialreplace mr left join mes_makematerial mm on mr.mp_mmid=mm.erpid left join make on mm.mm_maid=ma_id left join Product on mr.mp_prodcode=pr_code left join bom on bo_id=mm.mm_bomid left join (select max(mc_indate) mc_indate,max(mc_recorder) mc_recorder,max(md_mmdetno) md_mmdetno,max(md_makecode) md_makecode from MakeMaterialChangeDet left join MakeMaterialChange on mc_id=md_mcid) on md_makecode=ma_code and md_mmdetno=mm.mm_detno where mr.id=?",
|
|
|
new BeanPropertyRowMapper<MakeMaterial>(MakeMaterial.class), rs.getInt("id"));
|
|
|
makeMaterial.setMesUser(tokenConfig.get("mesUser"));
|
|
|
@@ -241,9 +241,9 @@ public class ScheduleTaskServiceImpl implements ScheduleTaskService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- /*}else {
|
|
|
+ }else {
|
|
|
baseDao.updateByCondition("mes_makematerialreplace", "status='E'", "status='W' and id=" + rs.getInt("id"));
|
|
|
- }*/
|
|
|
+ }
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
logger.info("同步替代料异常信息:"+e.getMessage());
|