Browse Source

[微浦eis]参照行之成修改提交

caosy 3 months ago
parent
commit
cf2ac9a5a7
1 changed files with 23 additions and 6 deletions
  1. 23 6
      src/main/java/com/uas/eis/serviceImpl/MESHelperServiceImpl.java

+ 23 - 6
src/main/java/com/uas/eis/serviceImpl/MESHelperServiceImpl.java

@@ -696,7 +696,7 @@ public class MESHelperServiceImpl implements MESHelperService {
 		if(rs.next()){
 			lotSN=rs.getString("ms_sncode");
 		}else{
-			 rs=baseDao.queryForRowSet("select mil_sncode from  makeimeilist where mil_imei1='"+lotSN+"' or mil_imei2='"+lotSN+"' or mil_imei3='"+lotSN+"'");
+			rs=baseDao.queryForRowSet("select mil_sncode from  makeimeilist where mil_imei1='"+lotSN+"' or mil_imei2='"+lotSN+"' or mil_imei3='"+lotSN+"'");
 			if(rs.next()){
 				lotSN=rs.getString("mil_sncode");
 			}
@@ -975,7 +975,7 @@ public class MESHelperServiceImpl implements MESHelperService {
 			ms_nextstepcode=rs.getString("ms_nextstepcode");
 		}
 		String stepcode = GetStepCodeBySource(iResCode);
-		if (ms_nextstepcode != "" && !ms_nextstepcode.equals(stepcode))
+		if (ms_nextstepcode != "" && !ms_nextstepcode.equals(stepcode)&& !ms_stepcode.equals(stepcode))
 		{
 			oErrMessage = "当前序列号下一工序" + ms_nextstepcode;
 		}
@@ -1012,7 +1012,7 @@ public class MESHelperServiceImpl implements MESHelperService {
 			ms_nextstepcode=rs.getString("ms_nextstepcode");
 		}
 		String stepcode = GetStepCodeBySource(iResCode);
-		if (ms_nextstepcode != "" && !ms_nextstepcode.equals(stepcode))
+		if (ms_nextstepcode != "" && !ms_nextstepcode.equals(stepcode)&& !ms_stepcode.equals(stepcode))
 		{
 			oErrMessage = "当前序列号"+iSN+"下一工序" + ms_nextstepcode;
 		}
@@ -1516,11 +1516,16 @@ public class MESHelperServiceImpl implements MESHelperService {
 		//实际业务数据
 		Map<Object, Object> rmap = new HashMap<>();
 		String oErrMessage = null;
-		if(map.get("iSN")==null){
+		if(map.get("iSN")==null||map.get("iSN").toString().equals("")){
 			oErrMessage = "SN不能为空";
 			rmap.put("oErrMessage",oErrMessage);
 			return rmap;
 		}
+		if(map.get("iResCode")==null||map.get("iResCode").toString().equals("")){
+			oErrMessage = "岗位资源不能为空";
+			rmap.put("oErrMessage",oErrMessage);
+			return rmap;
+		}
 		String iSN=map.get("iSN").toString();
 		String iResCode = null;
 		String iOperator = null;
@@ -1657,7 +1662,11 @@ public class MESHelperServiceImpl implements MESHelperService {
 				{
 
 					String[] BadCode = iErrCode.split(",");
-
+					Set<String> uniqueStrings = new HashSet<>();
+					for (String str : BadCode) {
+						uniqueStrings.add(str);
+					}
+					BadCode = uniqueStrings.toArray(new String[0]);
 					if (!mscode.equals(iSN))
 					{
 						List<String> sqls = new ArrayList<>();
@@ -1681,10 +1690,18 @@ public class MESHelperServiceImpl implements MESHelperService {
 							return rmap;
 						}
 						int mb_id = baseDao.getSeqId("makebad_seq");
+						String badlocation = null;
+						try {
+							badlocation = BadCode[i].split(";")[1];
+						}catch (Exception ex)
+						{
+							badlocation = "";
+						}
+						BgCode = baseDao.getFieldDataByCondition("badcode","bc_groupcode","bc_code = '"+BadCode[i].split(";")[0]+"'").toString();
 						sql.setLength(0);
 						sql.append("insert into makebad(mb_id,mb_makecode,mb_mscode,mb_sncode,mb_inman,mb_indate,mb_stepcode");
 						sql.append(",mb_sourcecode,mb_badremark,mb_badcode,mb_badtable,mb_bgcode,mb_soncode,mb_status) select '" + mb_id + "'");
-						sql.append(",ma_code,ms_code,ms_sncode,'" + iUserCode + "',sysdate,'" + CurrentStep + "','" + iSourceCode + "','"+BadCode[i].split(";")[1]+"','" + BadCode[i].split(";")[0] + "','',");
+						sql.append(",ma_code,ms_code,ms_sncode,'" + iUserCode + "',sysdate,'" + CurrentStep + "','" + iSourceCode + "','"+badlocation+"','" + BadCode[i].split(";")[0] + "','',");
 						sql.append("'" + BgCode + "',sp_soncode,'0' from make left join makeSerial on ms_makecode=ma_code left join stepProduct on ");
 						sql.append("sp_mothercode=ma_prodcode and sp_stepcode=ms_nextstepcode where ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'");
 						baseDao.execute(sql.toString());