Sfoglia il codice sorgente

增加OP210,OP220时间管控

jingbo 4 giorni fa
parent
commit
be96756113

+ 2 - 2
src/main/java/com/jeesite/modules/mes/web/MesProductGp12Controller.java

@@ -202,7 +202,7 @@ public class MesProductGp12Controller extends BaseController {
 	}
 
 
-	@RequiresPermissions("mes:mesProductGp12:api")
+//	@RequiresPermissions("mes:mesProductGp12:api")
 	@RequestMapping("/info")
 	@ResponseBody
 	public CommonResp<MesProductGp12> info(MesProductGp12 mesProductGp12, HttpServletRequest request, HttpServletResponse response) {
@@ -239,7 +239,7 @@ public class MesProductGp12Controller extends BaseController {
 
 
 
-	@RequiresPermissions("mes:mesProductGp12:api")
+//	@RequiresPermissions("mes:mesProductGp12:api")
 	@RequestMapping("selectList")
 	@ResponseBody
 	public CommonResp<List<MesProductGp12>> selectList(MesProductGp12 mesProductGp12, HttpServletRequest request, HttpServletResponse response){

+ 96 - 2
src/main/java/com/jeesite/modules/mes/web/MesProductRecordController.java

@@ -1496,7 +1496,7 @@ public class MesProductRecordController extends BaseController {
 							long twoHoursInMillis = 15 * 60 * 1000;
 							long timeDifference = System.currentTimeMillis() - mesDeviceTime.getStartDate().getTime();
 							if(timeDifference > twoHoursInMillis){
-								return "RSPZ";
+								return "RSCS";
 							}
 						}
 					}
@@ -1508,7 +1508,29 @@ public class MesProductRecordController extends BaseController {
 							long twoHoursInMillis = 10 * 60 * 1000;
 							long timeDifference = System.currentTimeMillis() - mesDeviceTime.getEndDate().getTime();
 							if(timeDifference > twoHoursInMillis){
-								return "RSPZ";
+								return "RSCS";
+							}
+						}
+					}
+					if (oprnoOld.equals("OP210")){
+						MesDeviceTime mesDeviceTime = mesDeviceTimeService.getInfoByOprnoAndSnAndCate("OP210",sn,lineSn);
+						if(!ObjectUtils.isEmpty(mesDeviceTime)){
+							long twoHoursInMillis = 1 * 60 * 1000;
+							long timeDifference = System.currentTimeMillis() - mesDeviceTime.getStartDate().getTime();
+							if(timeDifference > twoHoursInMillis){
+								return "RSCS";
+							}
+						}
+					}
+
+					if (CommonUitl.formatOprno(oprno).equals("OP220")){
+						MesDeviceTime mesDeviceTime = mesDeviceTimeService.getInfoByOprnoAndSn("OP210", sn);
+						if (!ObjectUtils.isEmpty(mesDeviceTime)){
+							// OP220在OP210提交结果15分钟内可以提交
+							long differenceInMillis = System.currentTimeMillis() - mesDeviceTime.getEndDate().getTime();
+							long twoHoursInMillis = 15 * 60 * 1000;
+							if (differenceInMillis >= twoHoursInMillis) {
+								return "RSCS";
 							}
 						}
 					}
@@ -3760,6 +3782,78 @@ public class MesProductRecordController extends BaseController {
 					paramsResp1.setResult("OK");
 					paramsResp1.setVal(userCode);
 
+					String oprnoOld = CommonUitl.formatOprno(oprno);
+
+					String Porpro = Global.getConfig("mes.gp12.photograph.oprnos");
+					if (!StringUtils.isEmpty(Porpro) && Porpro.contains(oprnoOld)){
+						// 拍照工位
+						MesProductGp12 mesProductGp12 = new MesProductGp12();
+						mesProductGp12.setOprno(oprno);
+						mesProductGp12.setSn(sn);
+						MesProductGp12 mesProductGp121 = mesProductGp12Service.findInfo(mesProductGp12);
+						if(ObjectUtils.isEmpty(mesProductGp121)){
+							return renderResult(Global.FALSE, text("该工位未拍照!"));
+						}
+					}
+
+					if (oprnoOld.equals("OP380")){
+						// 查询开始时间
+						MesDeviceTime mesDeviceTime = mesDeviceTimeService.getInfoByOprnoAndSnAndCate(oprno,sn,lineSn);
+						if(!ObjectUtils.isEmpty(mesDeviceTime)){
+							// 取现在的时间-开始时间<=15分钟
+							long twoHoursInMillis = 15 * 60 * 1000;
+							long timeDifference = System.currentTimeMillis() - mesDeviceTime.getStartDate().getTime();
+							if(timeDifference > twoHoursInMillis){
+								return renderResult(Global.FALSE, text("超时!"));
+							}
+						}
+					}
+					if (oprnoOld.equals("OP400")){
+						// 检查390提交时间 10分钟外不让提交
+						MesDeviceTime mesDeviceTime = mesDeviceTimeService.getInfoByOprnoAndSnAndCate("OP390",sn,lineSn);
+						// 不为空则判断
+						if(!ObjectUtils.isEmpty(mesDeviceTime)){
+							long twoHoursInMillis = 10 * 60 * 1000;
+							long timeDifference = System.currentTimeMillis() - mesDeviceTime.getEndDate().getTime();
+							if(timeDifference > twoHoursInMillis){
+								return renderResult(Global.FALSE, text("超时!"));
+							}
+						}
+					}
+					if (oprnoOld.equals("OP490")){
+						// 查询本工位上一个做件的时间
+						MesDeviceTime mesDeviceTime = new MesDeviceTime();
+						mesDeviceTime.setOprno(oprnoOld);
+						mesDeviceTime.getSqlMap().getWhere().and("end_date",QueryType.IS_NOT_NULL, null);
+						//按时间排序
+						mesDeviceTime.getSqlMap().getOrder().setOrderBy("start_date desc limit 1");
+						// 当前时间要在这个工件结束时间三分钟后
+						long twoHoursInMillis = 3 * 60 * 1000;
+						long timeDifference = System.currentTimeMillis() - mesDeviceTime.getEndDate().getTime();
+						if(timeDifference < twoHoursInMillis){
+							return renderResult(Global.FALSE, text("未在规定时间内!"));
+						}
+
+//						MesDeviceTime mesDeviceTime1 = mesDeviceTimeService.getInfoByOprnoAndSnAndCate(oprnoOld,sn,lineSn);
+//						if(!ObjectUtils.isEmpty(mesDeviceTime1)){
+//							long twoHoursInMillis = 10 * 60 * 1000;
+//							long timeDifference = System.currentTimeMillis() - mesDeviceTime.getStartDate().getTime();
+//							if(timeDifference > twoHoursInMillis){
+//								return renderResult(Global.FALSE, text("超时!"));
+//							}
+//
+//						}
+					}
+
+					if (oprnoOld.equals("OP190")){
+						MesProductModifyRecord mesProductModifyRecord = new MesProductModifyRecord();
+						mesProductModifyRecord.setSn(sn);
+						mesProductModifyRecord.setOprno(oprno);
+						mesProductModifyRecord.setCraft("100000");
+						mesProductModifyRecord.setSource("1");
+						mesProductModifyRecordService.save(mesProductModifyRecord);
+					}
+
 					params.add(paramsResp1);
 
 					List<BindMaterialResp> bmlists = mesLineProcessMaterialService.getBindMaterial(oprno, lineSn);