Jelajahi Sumber

[行之成EIS] 接口判定不良如果经过转号取消转号结果,SN复原

caosy 2 bulan lalu
induk
melakukan
31de5a9103

+ 17 - 1
src/main/java/com/uas/eis/serviceImpl/MESHelperServiceImpl.java

@@ -1640,6 +1640,7 @@ public class MESHelperServiceImpl implements MESHelperService {
 		Object StepCode = baseDao.getFieldDataByCondition("Makeserial", "ms_stepcode", "ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'");
 		String CurrentStep = GetStepCodeBySource(iSourceCode);
 		Object BgCode = baseDao.getFieldDataByCondition("step", "nvl(st_badgroupcode,' ')", "st_code='" + CurrentStep + "'");
+		String mscode = baseDao.getFieldDataByCondition("Makeserial", "ms_code", "ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'").toString();
 		Map<Object, Object> rmap = new HashMap<>();
 		switch (iResult)
 		{
@@ -1654,8 +1655,23 @@ public class MESHelperServiceImpl implements MESHelperService {
 				}
 				else
 				{
-					baseDao.updateByCondition("makebad", "mb_status=-1", "mb_sncode='" + iSN + "' and mb_makecode='" + iMakeCode + "' and mb_stepcode='" + CurrentStep + "' and mb_status=0");
+
 					String[] BadCode = iErrCode.split(",");
+
+					if (!mscode.equals(iSN))
+					{
+						List<String> sqls = new ArrayList<>();
+						sqls.add("update makeserial set ms_sncode = '"+mscode+"',ms_beforesn = '' where ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'");
+						sqls.add(" update makesnlist set msl_status = '' where msl_sncode = '"+iSN+"' and msl_makecode = '"+iMakeCode+"' ");
+						sqls.add("delete makesnrelation where sn = '"+iSN+"'");
+						if (sqls!=null&&sqls.size()>0){
+							baseDao.execute(sqls);
+						}
+						iSN = mscode;
+					}
+
+					baseDao.updateByCondition("makebad", "mb_status=-1", "mb_sncode='" + iSN + "' and mb_makecode='" + iMakeCode + "' and mb_stepcode='" + CurrentStep + "' and mb_status=0");
+
 					StringBuffer sql=new StringBuffer();
 					for (int i = 0; i < BadCode.length; i++)
 					{