Sfoglia il codice sorgente

Merge branch 'master' of http://121.36.46.135:3000/mes-x13/mescloud

hzd 5 giorni fa
parent
commit
00fd6b0c0f

+ 7 - 0
src/main/java/com/jeesite/modules/mes/service/MesProductRecordService.java

@@ -1195,4 +1195,11 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 	public void updateResultByCheckFirst(MesProductRecord mesProductRecord){
 		mesProductRecordDao.updateResultByCheckFirst(mesProductRecord);
 	}
+	public List<MesProductRecord> findBySnAndOprnoLike(String sn, String fOprno) {
+		MesProductRecord query = new MesProductRecord();
+		query.setSn(sn);
+		query.setOprno(fOprno);
+		query.getSqlMap().getWhere().and("oprno", QueryType.LIKE, fOprno);
+		return findList(query);
+	}
 }

+ 12 - 7
src/main/java/com/jeesite/modules/mes/service/MesProductService.java

@@ -46,7 +46,7 @@ public class MesProductService extends CrudService<MesProductDao, MesProduct> {
 	public List<MesProduct> findByCount(MesProduct mesProduct) {
 		return  dao.findByCount(mesProduct);
 	}
-	
+
 	/**
 	 * 查询分页数据
 	 * @param mesProduct 查询条件
@@ -57,7 +57,7 @@ public class MesProductService extends CrudService<MesProductDao, MesProduct> {
 	public Page<MesProduct> findPage(MesProduct mesProduct) {
 		return super.findPage(mesProduct);
 	}
-	
+
 	/**
 	 * 查询列表数据
 	 * @param mesProduct
@@ -67,7 +67,7 @@ public class MesProductService extends CrudService<MesProductDao, MesProduct> {
 	public List<MesProduct> findList(MesProduct mesProduct) {
 		return super.findList(mesProduct);
 	}
-	
+
 	/**
 	 * 保存数据(插入或更新)
 	 * @param mesProduct
@@ -77,7 +77,7 @@ public class MesProductService extends CrudService<MesProductDao, MesProduct> {
 	public void save(MesProduct mesProduct) {
 		super.save(mesProduct);
 	}
-	
+
 	/**
 	 * 更新状态
 	 * @param mesProduct
@@ -87,7 +87,7 @@ public class MesProductService extends CrudService<MesProductDao, MesProduct> {
 	public void updateStatus(MesProduct mesProduct) {
 		super.updateStatus(mesProduct);
 	}
-	
+
 	/**
 	 * 删除数据
 	 * @param mesProduct
@@ -99,6 +99,11 @@ public class MesProductService extends CrudService<MesProductDao, MesProduct> {
 	}
 
 
+	// 根据sn查询
+	public MesProduct findBySn(String sn){
+		MesProduct m1 = new MesProduct();
+		m1.setSn(sn);
+		return dao.findInfo(m1);
+	}
 
-	
-}
+}

+ 15 - 5
src/main/java/com/jeesite/modules/mes/service/MesTemplateItemsService.java

@@ -51,7 +51,7 @@ public class MesTemplateItemsService extends CrudService<MesTemplateItemsDao, Me
 	public Page<MesTemplateItems> findPage(MesTemplateItems mesTemplateItems) {
 		return super.findPage(mesTemplateItems);
 	}
-	
+
 	/**
 	 * 查询列表数据
 	 * @param mesTemplateItems
@@ -132,7 +132,7 @@ public class MesTemplateItemsService extends CrudService<MesTemplateItemsDao, Me
 		CacheUtils.put("product","templateId"+mesTemplateItems.getTemplateId(),"");
 		super.save(mesTemplateItems);
 	}
-	
+
 	/**
 	 * 更新状态
 	 * @param mesTemplateItems
@@ -142,7 +142,7 @@ public class MesTemplateItemsService extends CrudService<MesTemplateItemsDao, Me
 	public void updateStatus(MesTemplateItems mesTemplateItems) {
 		super.updateStatus(mesTemplateItems);
 	}
-	
+
 	/**
 	 * 删除数据
 	 * @param mesTemplateItems
@@ -152,5 +152,15 @@ public class MesTemplateItemsService extends CrudService<MesTemplateItemsDao, Me
 	public void delete(MesTemplateItems mesTemplateItems) {
 		super.delete(mesTemplateItems);
 	}
-	
-}
+
+
+	// 根据工位号查询相关工位模板清单
+	public List<MesTemplateItems> findListByOprno(String oprno){
+		MesTemplateItems m1 = new MesTemplateItems();
+		m1.setStatus("0");
+		m1.setOprno(oprno);
+		String orderBy = "a.rank asc, a.craft asc";
+		m1.getSqlMap().getOrder().setOrderBy(orderBy);
+		return findList(m1);
+	}
+}

+ 48 - 4
src/main/java/com/jeesite/modules/mes/web/MesElectricTorqueController.java

@@ -9,13 +9,16 @@ import javax.servlet.http.HttpServletResponse;
 import com.jeesite.common.lang.StringUtils;
 import com.jeesite.modules.mes.entity.*;
 import com.jeesite.modules.mes.resp.BindMaterialResp;
+import com.jeesite.modules.mes.resp.ParamsResp;
 import com.jeesite.modules.mes.service.*;
+import com.jeesite.modules.mes.util.CommonUitl;
 import com.jeesite.modules.utils.DateLocalUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.ui.Model;
+import org.springframework.util.ObjectUtils;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
@@ -53,6 +56,9 @@ public class MesElectricTorqueController extends BaseController {
 	@Autowired
 	private MesToolLifeService mesToolLifeService;
 
+	@Autowired
+	private MesProductOprnoService mesProductOprnoService;
+
 
 
 	/**
@@ -62,7 +68,7 @@ public class MesElectricTorqueController extends BaseController {
 	public MesElectricTorque get(String id, boolean isNewRecord) {
 		return mesElectricTorqueService.get(id, isNewRecord);
 	}
-	
+
 	/**
 	 * 查询列表
 	 */
@@ -76,7 +82,7 @@ public class MesElectricTorqueController extends BaseController {
 //		model.addAttribute("mlInfo", mlInfo);
 		return "modules/mes/mesElectricTorqueList";
 	}
-	
+
 	/**
 	 * 查询列表数据
 	 */
@@ -145,7 +151,7 @@ public class MesElectricTorqueController extends BaseController {
 			return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
 		}
 	}
-	
+
 	/**
 	 * 删除数据
 	 */
@@ -236,6 +242,44 @@ public class MesElectricTorqueController extends BaseController {
 				}
 			}
 		}
+		String newOprno = CommonUitl.formatOprno(mesElectricTorque.getOprno());
+		// 如果其他电批枪的结果都不为UDF,则更新总结果
+		if("OP310".equals(newOprno)) {
+			List<ParamsResp> params = new ArrayList<>();
+			ParamsResp paramsResp1 = new ParamsResp();
+			paramsResp1.setCraft("400001");
+			paramsResp1.setResult("OK");
+			paramsResp1.setVal("");
+			params.add(paramsResp1);
+
+			MesProductOprno mesProductOprno = new MesProductOprno();
+			mesProductOprno.setSn(mesElectricTorque.getSn());
+			mesProductOprno.setOprno(newOprno);
+			mesProductOprno.setLineSn("XT");
+			MesProductOprno mesProductOprno1 = mesProductOprnoService.findInfo(mesProductOprno);
+			System.out.println(mesProductOprno1);
+			if(ObjectUtils.isEmpty(mesProductOprno1)){
+				//添加子工位表
+				mesProductOprnoService.save(mesProductOprno);
+				mesProductOprno1 = mesProductOprnoService.findInfo(mesProductOprno);
+			}
+
+				mesProductOprno1.setResult2("OK");
+
+			mesProductOprnoService.save(mesProductOprno1);
+
+			// 全有结果
+			if(mesProductOprno1.getResult1()!=null && !StringUtils.isEmpty(mesProductOprno1.getResult1()) && mesProductOprno1.getResult2()!=null && !StringUtils.isEmpty(mesProductOprno1.getResult2())) {
+				String lastRet = "NG";
+				if (mesProductOprno1.getResult1().equals("OK") && mesProductOprno1.getResult2().equals("OK")) {
+					lastRet = "OK";
+				}
+				// 2.判断物料批次是否符合绑定
+				List<BindMaterialResp> bmlists = mesLineProcessMaterialService.getBindMaterial(mesElectricTorque.getOprno(), "XT");
+				// 总结果产线要求写死“OK”
+				mesProductRecordService.updateRecordResult(mesElectricTorque.getSn(), "OP310", "100000", "", lastRet, "System", params, "XT", true, bmlists);
+			}
+		}
 
 		return renderResult(Global.TRUE, text("操作成功!"));
 	}
@@ -258,4 +302,4 @@ public class MesElectricTorqueController extends BaseController {
 	}
 
 
-}
+}

+ 306 - 52
src/main/java/com/jeesite/modules/mes/web/MesProductRecordController.java

@@ -55,6 +55,7 @@ import com.jeesite.modules.mes.req.MesProductQmReq;
 import com.jeesite.modules.mes.req.MesSearchDateReq;
 import com.jeesite.modules.mes.resp.BindMaterialResp;
 import com.jeesite.modules.mes.resp.CommonResp;
+import com.jeesite.modules.mes.resp.MesShiftDataResp;
 import com.jeesite.modules.mes.resp.ParamsResp;
 import com.jeesite.modules.mes.service.*;
 import com.jeesite.modules.mes.util.CommonUitl;
@@ -1380,20 +1381,150 @@ public class MesProductRecordController extends BaseController {
 		if(mesLineProcess1.getRepeat().equals("1") && (ret.equals(bs+"OK") || ret.equals(bs+"NG"))){ // 可重复工作
 			ret = "RSUD";
 		}
-		//判断是否属于可做三次气密检测的工位    mes_qm_maxNumber次数    	mes_qm_oprnos工位
-	   String qmOprnos = Global.getConfig("mes_qm_oprnos");
-		if(!StringUtils.isEmpty(qmOprnos) && qmOprnos.contains(CommonUitl.formatOprno(oldOprno))){
-			int qmMaxNumber =new Integer(Global.getConfig("mes_qm_maxNumber")) ;
-			if(qmMaxNumber > 0){
-				MesProductQm mesProductQm = new MesProductQm();
-				mesProductQm.setComponentNum(sn);
-				mesProductQm.setOprno(oldOprno);
-
-				mesProductQm.setProductCate(lineSn);
-				List<MesProductQm> list = mesProductQmService.findList(mesProductQm);//----
-//判断列表长度
-				if(list.size() >= qmMaxNumber){
-					ret = bs+lxres;
+//		//判断是否属于可做三次气密检测的工位    mes_qm_maxNumber次数    	mes_qm_oprnos工位
+//	   String qmOprnos = Global.getConfig("mes_qm_oprnos");
+//		if(!StringUtils.isEmpty(qmOprnos) && qmOprnos.contains(CommonUitl.formatOprno(oldOprno))){
+//			int qmMaxNumber =new Integer(Global.getConfig("mes_qm_maxNumber")) ;
+//			if(qmMaxNumber > 0){
+//				MesProductQm mesProductQm = new MesProductQm();
+//				mesProductQm.setComponentNum(sn);
+//				mesProductQm.setOprno(oldOprno);
+//
+//				mesProductQm.setProductCate(lineSn);
+//				List<MesProductQm> list = mesProductQmService.findList(mesProductQm);//----
+//				//判断列表长度
+//				if(list.size() >= qmMaxNumber){
+//					ret = bs+lxres;
+//				}
+//
+//			}
+//
+//		}
+
+		String oprno1 = CommonUitl.formatOprno(oprno);
+		MesShiftDataResp mesShiftDataResp = mesShiftService.getCurShift();
+
+		// 气密工位
+		String qmoprnos = Global.getConfig("mes.qm.oprnos");
+		if(!StringUtils.isEmpty(qmoprnos) && qmoprnos.contains(oprno1)){
+			String Fchech = Global.getConfig("mes.qm.check");
+			if (Fchech.equals("1")){
+				// 首件点检
+				String NpqmOprnos = Global.getConfig("mes.qm.nocheck");
+				if(!StringUtils.isEmpty(NpqmOprnos) && NpqmOprnos.contains(oprno)){
+
+				}else{
+
+					String oks = "";
+					String ngs = "";
+					if(oprno1.equals("OP350") && lineSn.equals("XT")){ // 半成品气密
+						oks = Global.getConfig("mes.xt.OP350.ok");
+						ngs = Global.getConfig("mes.xt.OP350.ng");
+					}else if(oprno1.equals("OP450") && lineSn.equals("XT")){ //总成
+						oks = Global.getConfig("mes.xt.OP450.ok");
+						ngs = Global.getConfig("mes.xt.OP450.ng");
+					}
+					logger.info("qmok:"+oks);
+					logger.info("qmng:"+ngs);
+					if(StringUtils.isEmpty(oks) && StringUtils.isEmpty(ngs)){
+
+					}
+					Boolean oksret = true;
+					Boolean ngsret = true;
+
+					DateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+					Date stdate =null;
+					Date etdate =null;
+					try {
+						stdate = dateFormat2.parse(mesShiftDataResp.getStart());
+						etdate = dateFormat2.parse(mesShiftDataResp.getEnd());
+					}catch (Exception e){
+						e.printStackTrace();
+					}
+
+
+					if(!StringUtils.isEmpty(oks)){
+						String[] oksarr = oks.split(",",-1);
+						for(String ok : oksarr){
+							if(StringUtils.isEmpty(ok)){
+								continue;
+							}
+							if(sn.equals(ok)){
+								return "RSUD";
+							}
+							MesProductQm mesProductQm = new MesProductQm();
+							mesProductQm.setOprno(oprno);
+							mesProductQm.setComponentNum(ok);
+							mesProductQm.setProductCate(lineSn);
+							mesProductQm.setTestTime_gte(stdate);
+							mesProductQm.setTestTime_lte(etdate);
+							mesProductQm.setTestResult("OK");
+							mesProductQm.getSqlMap().getOrder().setOrderBy("a.test_date desc");
+							MesProductQm mesProductQm1 = mesProductQmService.findInfo(mesProductQm);
+							if(com.jeesite.common.lang.ObjectUtils.isEmpty(mesProductQm1)){
+								oksret = false;
+								break;
+							}
+						}
+					}
+					logger.info("qmok2:"+oks);
+					if(!StringUtils.isEmpty(ngs)){
+						String[] ngsarr = ngs.split(",",-1);
+						for(String ng : ngsarr){
+							if(StringUtils.isEmpty(ng)){
+								continue;
+							}
+							if(sn.equals(ng)){
+								return "RSUD";
+							}
+							MesProductQm mesProductQm = new MesProductQm();
+							mesProductQm.setOprno(oprno);
+							mesProductQm.setComponentNum(ng);
+							mesProductQm.setProductCate(lineSn);
+							mesProductQm.setTestTime_gte(stdate);
+							mesProductQm.setTestTime_lte(etdate);
+							mesProductQm.getSqlMap().getWhere().and("a.oprno",QueryType.NE,"OK");
+							mesProductQm.getSqlMap().getOrder().setOrderBy("a.test_date desc");
+							MesProductQm mesProductQm1 = mesProductQmService.findInfo(mesProductQm);
+							if(com.jeesite.common.lang.ObjectUtils.isEmpty(mesProductQm1)){
+								ngsret = false;
+								break;
+							}
+						}
+					}
+					if(!oksret || !ngsret){
+						return "RSDJ";
+					}else{
+						ret= "RSUD";
+					}
+
+
+				}
+			}
+
+
+			String check = Global.getConfig("mes.qm.ng.time");
+			if(check.equals("1")){
+				// 检查是否超过15分钟
+				String checkret = Global.getConfig("mes.qm.nong.time");
+				if (!StringUtils.isEmpty(checkret) && qmoprnos.contains(checkret)){
+
+				}else {
+					MesProductQm mpr2 = new MesProductQm();
+					mpr2.setComponentNum(sn);
+					mpr2.getSqlMap().getWhere().and("a.oprno",QueryType.RIGHT_LIKE,oprno);
+					mpr2.getSqlMap().getOrder().setOrderBy("a.test_time desc");
+					MesProductQm mprinfo = mesProductQmService.findInfo(mpr2);
+					if(!ObjectUtils.isEmpty(mprinfo)){
+						// 计算两个日期之间相差的分钟数
+						Date curDate = new Date();
+						Date date2 = mprinfo.getTestTime();
+						long minutesBetween = Math.abs(ChronoUnit.MINUTES.between(curDate.toInstant(), date2.toInstant()));
+						logger.info("minutesBetween:"+ minutesBetween);
+						if(minutesBetween < 15){ // 未超过15分钟
+							return "RSQM";
+						}
+					}
 				}
 
 			}
@@ -1490,45 +1621,44 @@ public class MesProductRecordController extends BaseController {
 						}
 					}
 
-//					MesProductOprno mesProductOprno = new MesProductOprno();
-//					mesProductOprno.setSn(sn);
-//					mesProductOprno.setOprno(oprnoOld);
-//					mesProductOprno.setLineSn(lineSn);
-//					MesProductOprno mesProductOprno1 = mesProductOprnoService.findInfo(mesProductOprno);
-//					System.out.println(mesProductOprno1);
-//					if(ObjectUtils.isEmpty(mesProductOprno1)){
-//						//添加子工位表
-//						mesProductOprnoService.save(mesProductOprno);
-//						mesProductOprno1 = mesProductOprnoService.findInfo(mesProductOprno);
-//					}
-//					//添加子工位
-//					if (!StringUtils.isEmpty(oprno) &&"OP220".equals(oprnoOld)){
-//
-//						if("OP220A".equals(oprno) ){
-//							mesProductOprno1.setResult1(content);
-//						}else if("OP220B".equals(oprno)){
-//							mesProductOprno1.setResult2(content);
-//						}
-//						mesProductOprnoService.save(mesProductOprno1);
-//
-//						// 全有结果
-//						if(mesProductOprno1.getResult1()!=null && !StringUtils.isEmpty(mesProductOprno1.getResult1()) && mesProductOprno1.getResult2()!=null && !StringUtils.isEmpty(mesProductOprno1.getResult2())){
-//							String lastRet = "NG";
-//							if(mesProductOprno1.getResult1().equals("OK") && mesProductOprno1.getResult2().equals("OK")){
-//								lastRet = "OK";
-//							}
-//							// 2.判断物料批次是否符合绑定
-//							List<BindMaterialResp> bmlists = mesLineProcessMaterialService.getBindMaterial(oprnoOld, lineSn);
-//							// 总结果产线要求写死“OK”
-//							mesProductRecordService.updateRecordResult(sn,oprnoOld,"100000","",lastRet,userCode,params,lineSn,true,bmlists);
-//						}else {
-//							ret = "RSOK";
-//							return ret;
-//						}
-//
-//					}
 
+					//310添加子工位
+					if (!StringUtils.isEmpty(oprno) &&"OP310".equals(oprnoOld)){
+						MesProductOprno mesProductOprno = new MesProductOprno();
+						mesProductOprno.setSn(sn);
+						mesProductOprno.setOprno(oprnoOld);
+						mesProductOprno.setLineSn(lineSn);
+						MesProductOprno mesProductOprno1 = mesProductOprnoService.findInfo(mesProductOprno);
+						System.out.println(mesProductOprno1);
+						if(ObjectUtils.isEmpty(mesProductOprno1)){
+							//添加子工位表
+							mesProductOprnoService.save(mesProductOprno);
+							mesProductOprno1 = mesProductOprnoService.findInfo(mesProductOprno);
+						}
+
+						if("OP310A".equals(oprno) ){
+							mesProductOprno1.setResult1(content);
+						}else if("OP310B".equals(oprno)){
+							mesProductOprno1.setResult2(content);
+						}
+						mesProductOprnoService.save(mesProductOprno1);
 
+						// 全有结果
+						if(mesProductOprno1.getResult1()!=null && !StringUtils.isEmpty(mesProductOprno1.getResult1()) && mesProductOprno1.getResult2()!=null && !StringUtils.isEmpty(mesProductOprno1.getResult2())){
+							String lastRet = "NG";
+							if(mesProductOprno1.getResult1().equals("OK") && mesProductOprno1.getResult2().equals("OK")){
+								lastRet = "OK";
+							}
+							// 2.判断物料批次是否符合绑定
+							List<BindMaterialResp> bmlists = mesLineProcessMaterialService.getBindMaterial(oprnoOld, lineSn);
+							// 总结果产线要求写死“OK”
+							mesProductRecordService.updateRecordResult(sn,oprnoOld,"100000","",lastRet,userCode,params,lineSn,true,bmlists);
+						}else {
+							ret = "RSOK";
+							return ret;
+						}
+
+					}
 
 
 
@@ -1642,6 +1772,91 @@ public class MesProductRecordController extends BaseController {
 //			}
 //		}
 
+		String fOprno = CommonUitl.formatOprno(oprno);
+		// 判断当前模板是否和当前模板清单一致
+		// 查询当前工位的相关模板
+		List<MesTemplateItems> mesTemplateItemsList = mesTemplateItemsService.findListByOprno(fOprno);
+		// 查询已经有的Record
+		List<MesProductRecord> mesProductRecordList = mesProductRecordService.findBySnAndOprnoLike(sn,fOprno);
+		//根据craft对比,找出没加入的模板项
+		if(!ListUtils.isEmpty(mesTemplateItemsList)){
+			// 提取已存在的工艺号集合
+			Set<String> existCrafts = new HashSet<>();
+			if(!ListUtils.isEmpty(mesProductRecordList)){
+				for(MesProductRecord record : mesProductRecordList){
+					existCrafts.add(record.getCraft());
+				}
+			}
+
+			// 找出模板中存在但记录中不存在的工艺项
+			List<MesTemplateItems> missingItems = new ArrayList<>();
+			for(MesTemplateItems templateItem : mesTemplateItemsList){
+				if(!existCrafts.contains(templateItem.getCraft())){
+					missingItems.add(templateItem);
+				}
+			}
+
+			// 如果有缺失的模板项,需要补充创建
+			if(!ListUtils.isEmpty(missingItems)){
+				logger.warn("产品SN:{}, 工位:{}, 缺失模板项数量:{}", sn, fOprno, missingItems.size());
+
+				// 获取产品信息
+//					MesProduct mesProduct1 = new MesProduct();
+//					mesProduct1.setSn(sn);
+				MesProduct mesProduct = mesProductService.findBySn(sn);
+				if(ObjectUtils.isEmpty(mesProduct)){
+					throw new ServiceException(text("产品不存在!"));
+				}
+
+//					// 获取模板信息
+//					MesProductCate mesProductCate = mesProductCateService.findBySn(mesProduct.getCate());
+//					if(ObjectUtils.isEmpty(mesProductCate)){
+//						throw new ServiceException(text("产品类型不正确!"));
+//					}
+
+				Long cdate = Long.valueOf(CommonUitl.Date2TimeStamp(new Date()));
+				List<MesProductRecord> recordsToAdd = new ArrayList<>();
+
+				// 获取当前最大序号
+				int maxSerial = 0;
+				if(!ListUtils.isEmpty(mesProductRecordList)){
+					for(MesProductRecord record : mesProductRecordList){
+						if(record.getSerial() != null && record.getSerial() > maxSerial){
+							maxSerial = record.getSerial();
+						}
+					}
+				}
+
+				// 创建缺失的记录
+				for(MesTemplateItems missingItem : missingItems){
+					MesProductRecord newRecord = new MesProductRecord();
+					newRecord.setSn(sn);
+					newRecord.setPid("0");
+					newRecord.setCateSn(mesProduct.getCate());
+					newRecord.setLineSn(lineSn);
+					newRecord.setCraft(missingItem.getCraft());
+					newRecord.setOprno(missingItem.getOprno());
+					newRecord.setSerial(maxSerial);
+					newRecord.setTid(missingItem.getId());
+					newRecord.setTreeLevel(0);
+					newRecord.setCdate(cdate);
+					newRecord.setContent("UDF"); // 默认未定义状态
+					newRecord.setSource("0");
+					newRecord.setCreateDate(new Date());
+					newRecord.setUpdateDate(new Date());
+
+					recordsToAdd.add(newRecord);
+				}
+
+				// 批量插入缺失的记录
+				if(!ListUtils.isEmpty(recordsToAdd)){
+					mesProductRecordService.insertBatch(recordsToAdd, recordsToAdd.size());
+					logger.info("产品SN:{}, 补充创建记录数量:{}", sn, recordsToAdd.size());
+				}
+			}
+
+		}
+
 		try{
 			mesProductRecordService.updateRecord(sn,oprno,craft,materielSn,"OK",userCode,lineSn);
 		}catch (Exception e){
@@ -3042,7 +3257,7 @@ public class MesProductRecordController extends BaseController {
 				mesProductRecord.setOprno(oprno);
 				mesProductRecord.setSn(sn);
 				mesProductRecord.setLineSn(lineSn);
-				mesProductRecord.setCraft("400004");
+				mesProductRecord.setCraft("400002");
 				mesProductRecord.setContent("OK");
 				MesProductRecord mesProductRecord1 = mesProductRecordService.findInfo(mesProductRecord);
 				if(ObjectUtils.isEmpty(mesProductRecord1)||StringUtils.isEmpty(mesProductRecord1.getMaterielSn())){
@@ -3865,6 +4080,45 @@ public class MesProductRecordController extends BaseController {
 						}
 					}
 
+
+					//310添加子工位
+					if (!StringUtils.isEmpty(oprno) &&"OP310".equals(oprnoOld)){
+						MesProductOprno mesProductOprno = new MesProductOprno();
+						mesProductOprno.setSn(sn);
+						mesProductOprno.setOprno(oprnoOld);
+						mesProductOprno.setLineSn(lineSn);
+						MesProductOprno mesProductOprno1 = mesProductOprnoService.findInfo(mesProductOprno);
+						System.out.println(mesProductOprno1);
+						if(ObjectUtils.isEmpty(mesProductOprno1)){
+							//添加子工位表
+							mesProductOprnoService.save(mesProductOprno);
+							mesProductOprno1 = mesProductOprnoService.findInfo(mesProductOprno);
+						}
+
+						if("OP310A".equals(oprno) ){
+							mesProductOprno1.setResult1(result);
+						}else if("OP310B".equals(oprno)){
+							mesProductOprno1.setResult2(result);
+						}
+						mesProductOprnoService.save(mesProductOprno1);
+
+						// 全有结果
+						if(mesProductOprno1.getResult1()!=null && !StringUtils.isEmpty(mesProductOprno1.getResult1()) && mesProductOprno1.getResult2()!=null && !StringUtils.isEmpty(mesProductOprno1.getResult2())){
+							String lastRet = "NG";
+							if(mesProductOprno1.getResult1().equals("OK") && mesProductOprno1.getResult2().equals("OK")){
+								lastRet = "OK";
+							}
+							// 2.判断物料批次是否符合绑定
+							List<BindMaterialResp> bmlists = mesLineProcessMaterialService.getBindMaterial(oprnoOld, lineSn);
+							// 总结果产线要求写死“OK”
+							mesProductRecordService.updateRecordResult(sn,oprnoOld,"100000","",lastRet,userCode,params,lineSn,true,bmlists);
+						}else {
+							ret = "RSOK";
+							return ret;
+						}
+
+					}
+
 					if (oprnoOld.equals("OP380")){
 						// 查询开始时间
 						MesDeviceTime mesDeviceTime = mesDeviceTimeService.getInfoByOprnoAndSnAndCate(oprno,sn,lineSn);

+ 1 - 1
src/main/java/com/jeesite/modules/mes/web/MesProductRepairQualityController.java

@@ -269,4 +269,4 @@ public class MesProductRepairQualityController extends BaseController {
 		return resp;
 	}
 	
-}
+}

+ 7 - 0
src/main/java/com/jeesite/modules/mes/web/MesRepairController.java

@@ -633,6 +633,13 @@ public class MesRepairController extends BaseController {
 			return resp;
 		}
 
+		MesRepairItems mesRepairItems1 = mesRepairItemsService.get(itemId);
+		if(ObjectUtils.isEmpty(mesRepairItems1)){
+			resp.setMessage("参数错误");
+			return resp;
+		}
+		oprno = mesRepairItems1.getOprno();
+
 		MesProductRecord mesProductRecord = new MesProductRecord();
 		mesProductRecord.setSn(sn);
 		mesProductRecord.setOprno(oprno);

+ 4 - 47
src/main/java/com/jeesite/modules/mes/web/MesRepairQualityController.java

@@ -149,15 +149,10 @@ public class MesRepairQualityController extends BaseController {
 		String sn = req.getParameter("sn");
 		String remark = req.getParameter("remark");
 		String result = req.getParameter("result");
-		String returnOprno = req.getParameter("returnOprno");
 		if(StringUtils.isEmpty(sn)){
 			resp.setMessage("参数错误");
 			return resp;
 		}
-		if(StringUtils.isEmpty(returnOprno)){
-			resp.setMessage("参数错误");
-			return resp;
-		}
 		if(!result.equals("1") && !result.equals("2")){
 			resp.setMessage("参数错误");
 			return resp;
@@ -181,18 +176,10 @@ public class MesRepairQualityController extends BaseController {
 			resp.setMessage("返修记录不存在");
 			return resp;
 		}
-		if(mesRepair.getState().equals("1")){
-			resp.setMessage("当前工件未返修!");
-			return resp;
-		}
-		if(mesRepair.getState().equals("3")){
+		if(!mesRepair.getState().equals("2")){
 			resp.setMessage("当前工件已检查!");
 			return resp;
 		}
-		if(mesRepair.getState().equals("4")){
-			resp.setMessage("当前工件返修NG待处理!");
-			return resp;
-		}
 
 		MesRepairQuality mesRepairQuality = new MesRepairQuality();
 		mesRepairQuality.setRepairId(mesRepair.getId());
@@ -207,7 +194,6 @@ public class MesRepairQualityController extends BaseController {
 		mesRepair.setCheckDate(new Date());
 		mesRepair.setState("3");
 		mesRepair.setResult(result);
-		mesRepair.setReturnOprno(returnOprno);
 		mesRepairService.save(mesRepair);
 
 		MesProductRecord mesProductRecord = new MesProductRecord();
@@ -223,9 +209,9 @@ public class MesRepairQualityController extends BaseController {
 			pp.setContent("OK");
 			mesProductRecordService.save(pp);
 
-			String repairItemId = "18565249649801748481111-111";
+			String repairItemId = "18565249649801748481111";
 			if(mesRepair.getItemId().equals(repairItemId)){ // 底护板更换
-				String[] qmoprnos = new String[]{"OP430", "OP440", "OP450", "OP460", "OP470", "OP480", "OP490", "OP500", "OP510", "OP520", "OP550"};
+				String[] qmoprnos = new String[]{"OP330","OP360","OP370","OP380","OP390","OP400","OP410"};
 				for (String op:qmoprnos){
 					// 返回工位改成UDF
 					MesProductRecord mesProductRecord2 = new MesProductRecord();
@@ -248,35 +234,6 @@ public class MesRepairQualityController extends BaseController {
 				pp2.setContent("UDF");
 				mesProductRecordService.save(pp2);
 			}
-
-			// 气密是否需要重新做
-			MesRepairItems mesRepairItems = mesRepairItemsService.get(mesRepair.getItemId());
-			if(!ObjectUtils.isEmpty(mesRepairItems)){
-				if("1".equals(mesRepairItems.getIsCp())){
-					String cpoprno = "OP450";
-					MesProductRecord mesProductRecord2 = new MesProductRecord();
-					mesProductRecord2.setSn(mesRepair.getSn());
-					mesProductRecord2.setOprno(cpoprno);
-					mesProductRecord2.setCraft("100000");
-					MesProductRecord pp2 = mesProductRecordService.findInfo(mesProductRecord2);
-					if(!ObjectUtils.isEmpty(pp2)){
-						pp2.setContent("UDF");
-						mesProductRecordService.save(pp2);
-					}
-				}
-				if("1".equals(mesRepairItems.getIsYl())){
-					String yloprno = "OP460";
-					MesProductRecord mesProductRecord2 = new MesProductRecord();
-					mesProductRecord2.setSn(mesRepair.getSn());
-					mesProductRecord2.setOprno(yloprno);
-					mesProductRecord2.setCraft("100000");
-					MesProductRecord pp2 = mesProductRecordService.findInfo(mesProductRecord2);
-					if(!ObjectUtils.isEmpty(pp2)){
-						pp2.setContent("UDF");
-						mesProductRecordService.save(pp2);
-					}
-				}
-			}
 		}
 
 		if(result.equals("1")){ // 返修OK
@@ -323,4 +280,4 @@ public class MesRepairQualityController extends BaseController {
 		resp.setResult(Global.TRUE);
 		return resp;
 	}
-}
+}

+ 2 - 0
src/main/resources/config/application.yml

@@ -673,6 +673,8 @@ shiro:
     ${adminPath}/mes/mesProductRecord/select = anon
     ${adminPath}/mes/mesProductRecord/submit = anon
     ${adminPath}/mes/mesRepairItems/submit = anon
+    ${adminPath}/mes/mesProductQm/addItem = anon
+    ${adminPath}/mes/mesProductRecord/dp350 = anon
     ${adminPath}/** = user
 
 

+ 26 - 26
src/main/resources/views/modules/mes/mesProductList.html

@@ -23,12 +23,12 @@
 						<#form:input path="sn" maxlength="100" class="form-control width-260"/>
 					</div>
 				</div>
-<!--				<div class="form-group">-->
-<!--					<label class="control-label">${text('生产批号')}:</label>-->
-<!--					<div class="control-inline">-->
-<!--						<#form:input path="psn" maxlength="200" class="form-control width-120"/>-->
-<!--					</div>-->
-<!--				</div>-->
+			<!--	<div class="form-group">
+					<label class="control-label">${text('生产批号')}:</label>
+					<div class="control-inline">
+						<#form:input path="psn" maxlength="200" class="form-control width-120"/>
+					</div>
+				</div>-->
 <!--				<div class="form-group">-->
 <!--					<label class="control-label">${text('产品名称')}:</label>-->
 <!--					<div class="control-inline">-->
@@ -47,18 +47,18 @@
 						<#form:input path="cate" maxlength="255" class="form-control width-120"/>
 					</div>
 				</div>
-<!--				<div class="form-group">-->
-<!--					<label class="control-label">${text('打包批号')}:</label>-->
-<!--					<div class="control-inline">-->
-<!--						<#form:input path="batchSn" maxlength="100" class="form-control width-120"/>-->
-<!--					</div>-->
-<!--				</div>-->
-<!--				<div class="form-group">-->
-<!--					<label class="control-label">${text('重量')}:</label>-->
-<!--					<div class="control-inline">-->
-<!--						<#form:input path="weight" maxlength="10" class="form-control width-120"/>-->
-<!--					</div>-->
-<!--				</div>-->
+				<div class="form-group">
+					<label class="control-label">${text('打包批号')}:</label>
+					<div class="control-inline">
+						<#form:input path="batchSn" maxlength="100" class="form-control width-120"/>
+					</div>
+				</div>
+				<div class="form-group">
+					<label class="control-label">${text('重量')}:</label>
+					<div class="control-inline">
+						<#form:input path="weight" maxlength="10" class="form-control width-120"/>
+					</div>
+				</div>
 			<div class="form-group">
 				<label class="control-label">${text('创建日期')}:</label>
 				<div class="control-inline">
@@ -108,14 +108,14 @@ $('#dataGrid').dataGrid({
 				return js.getDictLabel(${@DictUtils.getDictListJson('mes_product_status')}, val, '${text("未知")}', true);
 			}},
 		// {header:'${text("备注")}', name:'remark', index:'a.remark', width:150, align:"center"},
-		//  {header:'${text("打包批号")}', name:'batchSn', index:'a.batch_sn', width:150, align:"center"},
-		// {header:'${text("重量(kg)")}', name:'weight', index:'a.weight', width:150, align:"center", formatter: function(val, obj, row, act){
-		// 		if(val){
-		// 			return parseFloat(val);
-		// 		}else{
-		// 			return "";
-		// 		}
-		// 	}},
+		  {header:'${text("打包批号")}', name:'batchSn', index:'a.batch_sn', width:150, align:"center"},
+		  {header:'${text("重量(kg)")}', name:'weight', index:'a.weight', width:150, align:"center", formatter: function(val, obj, row, act){
+		  		if(val){
+		  			return parseFloat(val);
+		  		}else{
+		  			return "";
+		  		}
+		  	}},
 		// {header:'${text("重量(kg)")}', name:'weight', index:'a.weight', width:150, align:"center"},
 		// {header:'${text("包装时间")}', name:'bindDate', index:'a.bind_date', width:150, align:"center"},
 		// {header:'${text("包装人")}', name:'bindBy', index:'a.bind_by', width:150, align:"center"},

+ 1 - 1
src/main/resources/views/modules/mes/mesProductQmList.html

@@ -71,7 +71,7 @@ $('#dataGrid').dataGrid({
 		{header:'${text("工件号")}', name:'componentNum', index:'a.component_num', width:280, align:"center", frozen:true},
 		{header:'${text("产线编号")}', name:'productCate', index:'a.product_cate', width:100, align:"center"},
 		{header:'${text("工位号")}', name:'oprno', index:'a.oprno', width:100, align:"center"},
-		{header:'${text("名称")}', name:'title', index:'a.title', width:100, align:"center"},
+		// {header:'${text("名称")}', name:'title', index:'a.title', width:100, align:"center"},
 		{header:'${text("测试人员")}', name:'workNum', index:'a.work_num', width:150, align:"center"},
 		{header:'${text("测试时间")}', name:'testTime', index:'a.test_time', width:150, align:"center"},
 		{header:'${text("测试压")}', name:'testPressure', index:'a.test_pressure', width:150, align:"center"},