Pārlūkot izejas kodu

涂胶固化等时长管控功能

jingbo 1 nedēļu atpakaļ
vecāks
revīzija
a732fc2fe7

+ 101 - 9
src/main/java/com/jeesite/modules/mes/web/MesProductRecordController.java

@@ -970,6 +970,47 @@ public class MesProductRecordController extends BaseController {
 					mesDeviceTime.setProductCate(lineSn);
 					mesDeviceTimeService.add2(mesDeviceTime);
 				}
+				if (CommonUitl.formatOprno(oprno).equals("OP400")){
+					MesDeviceTime mesDeviceTime = new MesDeviceTime();
+					mesDeviceTime.setSn(sn);
+					mesDeviceTime.setProductCate(lineSn);
+					mesDeviceTime.setOprno("OP390");
+					MesDeviceTime mesDeviceTime1 = mesDeviceTimeService.findInfo(mesDeviceTime);
+					// 不为空的时候
+					if (!ObjectUtils.isEmpty(mesDeviceTime1)){
+						// 获取上一工位的结束时间,在结束三分钟后才可以做件,否则返回不可以
+						if(mesDeviceTime1.getEndDate() != null){
+							Date endDate = mesDeviceTime1.getEndDate();
+							long differenceInMillis = System.currentTimeMillis() - endDate.getTime();
+							long twoHoursInMillis = 3 * 60 * 1000;
+							if (differenceInMillis >= twoHoursInMillis) {
+								ret = "RSUD";
+							} else {
+								ret = "RSJZ";
+							}
+						}
+					}
+				}
+				// OP420工位检查OP400结束15分钟后才可以做件
+				if (CommonUitl.formatOprno(oprno).equals("OP420")){
+					MesDeviceTime mesDeviceTime = new MesDeviceTime();
+					mesDeviceTime.setSn(sn);
+					mesDeviceTime.setProductCate(lineSn);
+					mesDeviceTime.setOprno("OP400");
+					MesDeviceTime mesDeviceTime1 = mesDeviceTimeService.findInfo(mesDeviceTime);
+					if (!ObjectUtils.isEmpty(mesDeviceTime1)){
+						if(mesDeviceTime1.getEndDate() != null){
+							Date endDate = mesDeviceTime1.getEndDate();
+							long differenceInMillis = System.currentTimeMillis() - endDate.getTime();
+							long twoHoursInMillis = 15 * 60 * 1000;
+							if (differenceInMillis >= twoHoursInMillis) {
+								ret = "RSUD";
+							} else {
+								ret = "RSJZ";
+							}
+						}
+					}
+				}
 
 			}catch(Exception e){
 
@@ -1387,18 +1428,58 @@ public class MesProductRecordController extends BaseController {
 					paramsResp1.setVal(userCode);
 					params.add(paramsResp1); // 绑定用户
 
-					if(oprno.equals("OP400")){ // GP12下线,需要先拍照,拍照后才能提交
-						String checkPhoto = Global.getConfig("mes.gp12.photograph");
-						if(checkPhoto.equals("1")){
-							MesProductGp12 mesProductGp12 = new MesProductGp12();
-							mesProductGp12.setOprno(oprno);
-							mesProductGp12.setSn(sn);
-							MesProductGp12 mesProductGp121 = mesProductGp12Service.findInfo(mesProductGp12);
-							if(ObjectUtils.isEmpty(mesProductGp121)){
-								return "RSPZ"; // 未拍照不能提交
+					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 "RSPZ";
+						}
+					}
+
+					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 "RSPZ";
 							}
 						}
 					}
+					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 "RSPZ";
+							}
+						}
+					}
+
+
+//					if(oprno.equals("OP400")){ // GP12下线,需要先拍照,拍照后才能提交
+//						String checkPhoto = Global.getConfig("mes.gp12.photograph");
+//						if(checkPhoto.equals("1")){
+//							MesProductGp12 mesProductGp12 = new MesProductGp12();
+//							mesProductGp12.setOprno(oprno);
+//							mesProductGp12.setSn(sn);
+//							MesProductGp12 mesProductGp121 = mesProductGp12Service.findInfo(mesProductGp12);
+//							if(ObjectUtils.isEmpty(mesProductGp121)){
+//								return "RSPZ"; // 未拍照不能提交
+//							}
+//						}
+//					}
 
 					// 2.判断物料批次是否符合绑定
 					List<BindMaterialResp> bmlists = mesLineProcessMaterialService.getBindMaterial(oprno, lineSn);
@@ -3472,6 +3553,17 @@ public class MesProductRecordController extends BaseController {
 			resp.setMessage("参数错误");
 			return resp;
 		}
+///
+
+
+
+
+
+
+
+
+///
+
 
 		// 1.检查是否存在工件码  2.检查是否存在工位  3.判断是否为万能码 4.检查是否开启防呆和重复检测
 		// 5.开启防呆后判断状态(开班点检、判断物料批次是否符合绑定、检查配件寿命是否到期、当前工位结果、上面工位结果)

+ 1 - 1
src/main/java/com/jeesite/modules/scheduling/ProductGh.java

@@ -36,7 +36,7 @@ public class ProductGh {
             MesDeviceTime mesDeviceTime = new MesDeviceTime();
             mesDeviceTime.setProductCate("XT");
 
-            String[] states = new String[4];
+            String[] states = new String[6];
             states[0] = "OP340"; // 恒温静置
             states[1] = "OP340A";
             states[2] = "OP370";