Bläddra i källkod

螺套双枪适配

liuwei 1 vecka sedan
förälder
incheckning
1818e4dfca
1 ändrade filer med 79 tillägg och 19 borttagningar
  1. 79 19
      src/main/java/com/jeesite/modules/mes/web/MesProductRecordController.java

+ 79 - 19
src/main/java/com/jeesite/modules/mes/web/MesProductRecordController.java

@@ -3314,17 +3314,20 @@ public class MesProductRecordController extends BaseController {
 			String newRet = "UD";
 			if(CommonUitl.formatOprno(oprno).equals("OP170")){
 				String check = Global.getConfig("mes.check.op170");
-				if(check.equals("1")){
+				if("1".equals(check)){
 					MesProductOprno mesProductOprno = new MesProductOprno();
 					mesProductOprno.setSn(hmbSn);
 					mesProductOprno.setLineSn(lineSn);
 					mesProductOprno.setOprno(CommonUitl.formatOprno(oprno));
 					MesProductOprno mesProductOprno1 = mesProductOprnoService.findInfo(mesProductOprno);
 					if(ObjectUtils.isEmpty(mesProductOprno1)){
+						// 两枪:无子结果时仅允许 OP170A / OP170B
 						if(!oldOprno.equals("OP170A") && !oldOprno.equals("OP170B")){
 							newRet = "QQ"; // 本工位前工序未加工或加工NG
 						}
 					}else{
+						// [旧六枪-C~F门禁] 暂不用,现场仅两枪;恢复时取消注释
+						/*
 						if(oldOprno.equals("OP170C") || oldOprno.equals("OP170D")){
 							if(StringUtils.isEmpty(mesProductOprno1.getResult1()) || !mesProductOprno1.getResult1().equals("OK")){
 								newRet = "QQ"; // 本工位前工序未加工或加工NG
@@ -3346,6 +3349,7 @@ public class MesProductRecordController extends BaseController {
 								newRet = "QQ"; // 本工位前工序未加工或加工NG
 							}
 						}
+						*/
 					}
 				}
 			}
@@ -3478,10 +3482,10 @@ public class MesProductRecordController extends BaseController {
 		CommonResp<String> resp = new CommonResp<>();
 
 		String sn = "";
-		String oprno = "OP190";
+		String oprno = "OP170A"; // 与 ytresult3 一致;请求体有 oprno 仍以请求为准
 		String lineSn = "XT";
 
-		String result = "OK";
+		boolean allOk = false;
 
 		for (MesProductYtReq mesProductYt : mesProductYts) {
 			MesProductYt mesProductYt1 = new MesProductYt();
@@ -3517,6 +3521,12 @@ public class MesProductRecordController extends BaseController {
 			mesProductYtService.save(mesProductYt1);
 		}
 
+		if(!oprno.equals("OP170A") && !oprno.equals("OP170B")){
+			resp.setMessage("工位号错误,螺套仅支持OP170A/OP170B");
+			resp.setResult(Global.FALSE);
+			return resp;
+		}
+
 		try{
 
 			MesProductOprno mesProductOprno = new MesProductOprno();
@@ -3525,7 +3535,14 @@ public class MesProductRecordController extends BaseController {
 			mesProductOprno.setOprno(CommonUitl.formatOprno(oprno));
 			MesProductOprno mesProductOprno1 = mesProductOprnoService.findInfo(mesProductOprno);
 			if(ObjectUtils.isEmpty(mesProductOprno1)){
-				result = "NG";
+				// 两枪:OP170A→result1,OP170B→result2;未齐不写本站 NG
+				if(oprno.equals("OP170A")){
+					mesProductOprno.setResult1("OK");
+				}else if(oprno.equals("OP170B")){
+					mesProductOprno.setResult2("OK");
+				}
+				// [旧六枪-OP190] 暂不用,恢复时取消注释并隐藏上方两枪分支
+				/*
 				if(oprno.equals("OP190A")){
 					mesProductOprno.setResult1("OK");
 				}else if(oprno.equals("OP190B")){
@@ -3539,6 +3556,7 @@ public class MesProductRecordController extends BaseController {
 				}else if(oprno.equals("OP190F")){
 					mesProductOprno.setResult6("OK");
 				}
+				*/
 				mesProductOprnoService.save(mesProductOprno);
 
 				// 更新设备寿命
@@ -3569,6 +3587,14 @@ public class MesProductRecordController extends BaseController {
 				}
 
 			}else{
+				// 两枪:OP170A→result1,OP170B→result2
+				if(oprno.equals("OP170A")){
+					mesProductOprno1.setResult1("OK");
+				}else if(oprno.equals("OP170B")){
+					mesProductOprno1.setResult2("OK");
+				}
+				// [旧六枪-OP190] 暂不用,恢复时取消注释并隐藏上方两枪分支
+				/*
 				if(oprno.equals("OP190A")){
 					mesProductOprno1.setResult1("OK");
 				}else if(oprno.equals("OP190B")){
@@ -3582,7 +3608,15 @@ public class MesProductRecordController extends BaseController {
 				}else if(oprno.equals("OP190F")){
 					mesProductOprno1.setResult6("OK");
 				}
+				*/
+
+				mesProductOprnoService.save(mesProductOprno1);
 
+				// 两枪都 OK 才整站 OK(未齐不写 craft,保持 UDF)
+				allOk = !StringUtils.isEmpty(mesProductOprno1.getResult1()) && mesProductOprno1.getResult1().equals("OK")
+						&& !StringUtils.isEmpty(mesProductOprno1.getResult2()) && mesProductOprno1.getResult2().equals("OK");
+				// [旧六枪汇总] 暂不用:需 result1~6 全 OK
+				/*
 				if(StringUtils.isEmpty(mesProductOprno1.getResult1()) || !mesProductOprno1.getResult1().equals("OK")){
 					result = "NG";
 				}else if(StringUtils.isEmpty(mesProductOprno1.getResult2()) || !mesProductOprno1.getResult2().equals("OK")){
@@ -3596,15 +3630,16 @@ public class MesProductRecordController extends BaseController {
 				}else if(StringUtils.isEmpty(mesProductOprno1.getResult6()) || !mesProductOprno1.getResult6().equals("OK")){
 					result = "NG";
 				}
-
-				mesProductOprnoService.save(mesProductOprno1);
+				*/
 			}
 
-			sn = mesProductHmbService.formatHmbSn(sn);
-			List<ParamsResp> params = new ArrayList<>();
-			// 2.判断物料批次是否符合绑定
-			List<BindMaterialResp> bmlists = mesLineProcessMaterialService.getBindMaterial(oprno, lineSn);
-			mesProductRecordService.updateRecordResult(request,sn,oprno,"100000","",result,oprno,params,lineSn,true,bmlists,"0");
+			// 仅两枪齐了才回写本站 craft=100000=OK;未齐不落 NG
+			if(allOk){
+				sn = mesProductHmbService.formatHmbSn(sn);
+				List<ParamsResp> params = new ArrayList<>();
+				List<BindMaterialResp> bmlists = mesLineProcessMaterialService.getBindMaterial(oprno, lineSn);
+				mesProductRecordService.updateRecordResult(request,sn,oprno,"100000","","OK",oprno,params,lineSn,true,bmlists,"0");
+			}
 
 		}catch (Exception e){
 			logger.error("ytresult2 fail sn="+sn+" oprno="+oprno, e);
@@ -3628,10 +3663,10 @@ public class MesProductRecordController extends BaseController {
 		CommonResp<String> resp = new CommonResp<>();
 
 		String sn = "";
-		String oprno = "OP190A";
+		String oprno = "OP170A"; // 螺套两枪兜底
 		String lineSn = "XT";
 
-		String result = "OK";
+		boolean allOk = false;
 		for (MesProductYtReq mesProductYt : mesProductYts) {
 			sn = mesProductYt.getBarcode();
 			if(StringUtils.isNotEmpty(mesProductYt.getLineSn())){
@@ -3666,20 +3701,38 @@ public class MesProductRecordController extends BaseController {
 			mesProductYtService.save(mesProductYt1);
 		}
 
+		if(!oprno.equals("OP170A") && !oprno.equals("OP170B")){
+			resp.setMessage("工位号错误,螺套仅支持OP170A/OP170B");
+			resp.setResult(Global.FALSE);
+			return resp;
+		}
+
 		try{
 
 			MesProductOprno mesProductOprno = new MesProductOprno();
 			mesProductOprno.setSn(sn);
 			mesProductOprno.setLineSn(lineSn);
-			mesProductOprno.setOprno(oprno);
+			mesProductOprno.setOprno(CommonUitl.formatOprno(oprno));
 			MesProductOprno mesProductOprno1 = mesProductOprnoService.findInfo(mesProductOprno);
 			if(ObjectUtils.isEmpty(mesProductOprno1)){
-				result = "NG";
+				// 首枪按 A/B 归属,未齐不写本站 NG
 				mesProductOprno.setLineSn(lineSn);
-				mesProductOprno.setResult1("OK");
+				if(oprno.equals("OP170A")){
+					mesProductOprno.setResult1("OK");
+				}else{
+					mesProductOprno.setResult2("OK");
+				}
 				mesProductOprnoService.save(mesProductOprno);
 			}else{
 				mesProductOprno1.setLineSn(lineSn);
+				// 两枪:按枪号写对应子结果
+				if(oprno.equals("OP170A")){
+					mesProductOprno1.setResult1("OK");
+				}else if(oprno.equals("OP170B")){
+					mesProductOprno1.setResult2("OK");
+				}
+				// [旧六枪递进] 暂不用:按空位依次填 result1~6
+				/*
 				if(StringUtils.isEmpty(mesProductOprno1.getResult1())){
 					mesProductOprno1.setResult1("OK");
 					result = "NG";
@@ -3709,15 +3762,22 @@ public class MesProductRecordController extends BaseController {
 						}
 					}
 				}
+				*/
 				mesProductOprnoService.save(mesProductOprno1);
+
+				allOk = !StringUtils.isEmpty(mesProductOprno1.getResult1()) && mesProductOprno1.getResult1().equals("OK")
+						&& !StringUtils.isEmpty(mesProductOprno1.getResult2()) && mesProductOprno1.getResult2().equals("OK");
 			}
 
-			sn = mesProductHmbService.formatHmbSn(sn);
-			mesProductRecordService.updateRecord(sn,oprno,"100000","",result,oprno,lineSn);
+			// 仅两枪齐了才回写本站 OK
+			if(allOk){
+				sn = mesProductHmbService.formatHmbSn(sn);
+				mesProductRecordService.updateRecord(sn,oprno,"100000","","OK",oprno,lineSn);
+			}
 		}catch (Exception e){
 			logger.info(e.getMessage());
 			resp.setMessage("操作失败");
-			resp.setResult(Global.TRUE);
+			resp.setResult(Global.FALSE);
 			return resp;
 		}