Просмотр исходного кода

工单BOM替代料上传异常单据处理

koul 1 год назад
Родитель
Сommit
253ac25f71
1 измененных файлов с 23 добавлено и 22 удалено
  1. 23 22
      src/main/java/com/uas/eis/service/Impl/ScheduleTaskServiceImpl.java

+ 23 - 22
src/main/java/com/uas/eis/service/Impl/ScheduleTaskServiceImpl.java

@@ -173,28 +173,28 @@ public class ScheduleTaskServiceImpl implements ScheduleTaskService {
                         int code = Integer.parseInt(StringUtil.nvl(map.get("code"), "-1"));
                         if (code == 0) {
                             baseDao.updateByCondition("mes_makematerial", "status='D'", "status='W' and id=" + rs.getInt("id"));
-                            } else {
-                                int flag = makeMaterial.getFlag();
-                                if (flag==1) {
-                                    makeMaterial.setFlag(0);
-                                }else if (flag==0) {
-                                    makeMaterial.setFlag(1);
-                                }
-                                Map<String, Object> map1 = syncMES(JSON.toJSONString(makeMaterial,
-                                        SerializerFeature.WriteMapNullValue).replace("null", "\"\""), tokenConfig.get("syncMakeBaseDetail"));
-                                if (map1 != null) {
-                                    int code1 = Integer.parseInt(StringUtil.nvl(map1.get("code"), "-1"));
-                                    if (code1 == 0) {
-                                        baseDao.updateByCondition("mes_makematerial", "status='D'", "status='W' and id=" + rs.getInt("id"));
-                                    }else {
-                                        baseDao.updateByCondition("mes_makematerial", "status='F'", "status='W' and id=" + rs.getInt("id"));
-                                        baseDao.execute("insert into meserrorlog (mel_id,mel_url,mel_error,mel_indate,mel_djcode,mel_djdetno,mel_type) values(MESERRORLOG_SEQ.NEXTVAL,'" + tokenConfig.get("syncMakeBaseDetail") + "','" + StringUtil.nvl(map.get("msg"), "") + "',sysdate,'" + rs.getGeneralString("mm_code") + "'," + rs.getInt("mm_detno") + ",'工单BOM')");
-                                    }
+                        } else {
+                            int flag = makeMaterial.getFlag();
+                            if (flag==1) {
+                                makeMaterial.setFlag(0);
+                            }else if (flag==0) {
+                                makeMaterial.setFlag(1);
+                            }
+                            Map<String, Object> map1 = syncMES(JSON.toJSONString(makeMaterial,
+                                    SerializerFeature.WriteMapNullValue).replace("null", "\"\""), tokenConfig.get("syncMakeBaseDetail"));
+                            if (map1 != null) {
+                                int code1 = Integer.parseInt(StringUtil.nvl(map1.get("code"), "-1"));
+                                if (code1 == 0) {
+                                    baseDao.updateByCondition("mes_makematerial", "status='D'", "status='W' and id=" + rs.getInt("id"));
+                                }else {
+                                    baseDao.updateByCondition("mes_makematerial", "status='F'", "status='W' and id=" + rs.getInt("id"));
+                                    baseDao.execute("insert into meserrorlog (mel_id,mel_url,mel_error,mel_indate,mel_djcode,mel_djdetno,mel_type) values(MESERRORLOG_SEQ.NEXTVAL,'" + tokenConfig.get("syncMakeBaseDetail") + "','" + StringUtil.nvl(map.get("msg"), "") + "',sysdate,'" + rs.getGeneralString("mm_code") + "'," + rs.getInt("mm_detno") + ",'工单BOM')");
                                 }
-
                             }
+
                         }
-                    }else{
+                    }
+                }else{
                     baseDao.updateByCondition("mes_makematerial", "status='E'", "status='W' and id=" + rs.getInt("id"));
                 }
             }
@@ -209,9 +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"));
@@ -242,6 +241,8 @@ public class ScheduleTaskServiceImpl implements ScheduleTaskService {
                             }
                         }
                     }
+                }else {
+                    baseDao.updateByCondition("mes_makematerialreplace", "status='E'", "status='W' and id=" + rs.getInt("id"));
                 }
             }
         }catch (Exception e){