zhanghe vor 5 Monaten
Ursprung
Commit
7cb72279fd

+ 2 - 2
src/main/java/com/jeesite/modules/mes/service/MesProductCcdService.java

@@ -279,7 +279,7 @@ public class MesProductCcdService extends CrudService<MesProductCcdDao, MesProdu
 		try{
 			// 2.判断物料批次是否符合绑定
 			List<BindMaterialResp> bmlists = new ArrayList<>();
-			mesProductRecordService.updateRecordResult(sn,oprno,craft,"",result,userCode,params,lineSn,true,bmlists);
+			mesProductRecordService.updateRecordResult(sn,oprno,craft,"",result,userCode,params,lineSn,true,bmlists,null);
 		}catch (Exception e){
 			e.printStackTrace();
 			return CommonUitl.getXml("NG;操作失败;");
@@ -288,4 +288,4 @@ public class MesProductCcdService extends CrudService<MesProductCcdDao, MesProdu
 		return CommonUitl.getXml("OK;");
 	}
 
-}
+}

+ 13 - 6
src/main/java/com/jeesite/modules/mes/service/MesProductRecordService.java

@@ -178,12 +178,13 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 	}
 
     // 更新时获取记录详情
-	public MesProductRecord findByUpdate(String sn,String oprno,String craft){
+	public MesProductRecord findByUpdate(String sn,String oprno,String craft,String lineSn){
 		oprno = CommonUitl.formatOprno(oprno);
 		MesProductRecord mesProductRecord = new MesProductRecord();
 		mesProductRecord.setSn(sn);
 		mesProductRecord.setOprno(oprno);
 		mesProductRecord.setCraft(craft);
+		mesProductRecord.setLineSn(lineSn);
 		return mesProductRecordDao.findInfo(mesProductRecord);
 	}
 
@@ -326,14 +327,19 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 				mpr1.setCateSn(cateSn);//工件类型
 				mpr1.setLineSn(mesProductRecord.getLineSn());//产线编号
 				mpr1.setCraft(mesTemplateItems.getCraft());//工艺号
-				mpr1.setOprno(mesTemplateItems.getOprno());//
+				mpr1.setOprno(mesTemplateItems.getOprno());
 				mpr1.setSerial(i);
 				mpr1.setTid(mesTemplateItems.getId());
 				mpr1.setTreeLevel(0);
 				mpr1.setCdate(cdate);//排序字段
 				mpr1.setContent("UDF");
 				if(mesTemplateItems.getOprno().equals(oprno)){
-					mpr1.setOprno(mesProductRecord.getOprno());
+					if(mesProductRecord.getOprno().length()==5){
+						oprno += "A";
+						mpr1.setOprno(mesProductRecord.getOprno()+"A");
+					}else {
+						mpr1.setOprno(mesProductRecord.getOprno());
+					}
 					mpr1.setContent(mesProductRecord.getContent());
 
 					for(ParamsResp paramsResp:params){
@@ -530,7 +536,7 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 		}
 		String[] sns = mesDeviceTime.getSn().split(",",-1);
 		for (String ss:sns){
-			updateRecordResult(ss,oprno,craft,"",content,userCode,paramsResps,lineSn,false,bmlists);
+			updateRecordResult(ss,oprno,craft,"",content,userCode,paramsResps,lineSn,false,bmlists,null);
 		}
 
 		mesDeviceTime.setEndDate(new Date());
@@ -550,7 +556,7 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 	 * 质量上传(总结果) 100000
 	 */
 	@Transactional
-	public void updateRecordResult(String sn, String oprno, String craft, String materielSn, String content, String userCode, List<ParamsResp> paramsResps,String lineSn,Boolean optime,List<BindMaterialResp> bmlists) {
+	public void updateRecordResult(String sn, String oprno, String craft, String materielSn, String content, String userCode, List<ParamsResp> paramsResps,String lineSn,Boolean optime,List<BindMaterialResp> bmlists,String remark) {
 		String oldOprno = oprno;
 		oprno = CommonUitl.formatOprno(oprno);
 		sn = sn.trim();
@@ -692,6 +698,7 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 
 					mesProductRecord.setMaterielSn(materielSn);
 					mesProductRecord.setContent(content);
+					mesProductRecord.setRemark(remark);
 					super.update(mesProductRecord);
 
 					FileUploadUtils.saveFileUpload(mesProductRecord, mesProductRecord.getId(), "mesProductRecord_image");
@@ -915,7 +922,7 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 //		paramsResp1.setVal(userCode);
 //		paramsResps.add(paramsResp1); // 绑定用户
 		List<BindMaterialResp> bmlists = new ArrayList<>();
-		updateRecordResult(sn, oprno, craft, materielSn, content, userCode, paramsResps,lineSn,true,bmlists);
+		updateRecordResult(sn, oprno, craft, materielSn, content, userCode, paramsResps,lineSn,true,bmlists,null);
 
 		List<OpParamsResp> list1 = null;
 		list1 = JSON.parseArray(params,OpParamsResp.class);

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

@@ -1521,7 +1521,7 @@ public class MesProductRecordController extends BaseController {
 				// 质量上传,解析参数
 				List<ParamsResp> params = mesProductRecordService.getQualityParams(oprno,msg);
 				logger.info("params:"+JSON.toJSONString(params));
-				String res = updateQualityCommon(mesLineProcess1,oprno,lineSn,sn,craft,content,userCode,params);
+				String res = updateQualityCommon(mesLineProcess1,oprno,lineSn,sn,craft,content,userCode,params,null);
 				return res;
 			}
 		}catch (Exception e){
@@ -1533,10 +1533,10 @@ public class MesProductRecordController extends BaseController {
 		return ret;
 	}
 
-	private String updateQualityCommon(MesLineProcess mesLineProcess1,String oprno,String lineSn,String sn,String craft,String content,String userCode,List<ParamsResp> params){
+	private String updateQualityCommon(MesLineProcess mesLineProcess1,String oprno,String lineSn,String sn,String craft,String content,String userCode,List<ParamsResp> params,String remark){
 		if(mesLineProcess1.getType().equals("3")){ // 单部件
 			List<BindMaterialResp> bmlists = mesLineProcessMaterialService.getBindMaterial(oprno, lineSn);
-			mesProductRecordService.updateRecordResult(sn,oprno,craft,"",content,userCode,params,lineSn,true,bmlists);
+			mesProductRecordService.updateRecordResult(sn,oprno,craft,"",content,userCode,params,lineSn,true,bmlists,null);
 		}else{
 			if(mesLineProcess1.getIsPz().equals("1")){ // 需要先拍照,拍照后才能提交
 				MesProductGp12 mesProductGp12 = new MesProductGp12();
@@ -1610,7 +1610,10 @@ public class MesProductRecordController extends BaseController {
 			if(isFlag){
 				// 2.判断物料批次是否符合绑定
 				List<BindMaterialResp> bmlists = mesLineProcessMaterialService.getBindMaterial(oprno, lineSn);
-				mesProductRecordService.updateRecordResult(sn,oprno,craft,"",content,userCode,params,lineSn,true,bmlists);
+				if(oprno.length()==5){
+					oprno += "A";
+				}
+				mesProductRecordService.updateRecordResult(sn,oprno,craft,"",content,userCode,params,lineSn,true,bmlists,remark);
 			}
 
 		}
@@ -2334,6 +2337,9 @@ public String check(@RequestBody MesElectricTorque mesElectricTorque,HttpServlet
 			fileList.add(map1);
 		}
 		mesProductRecord.setFileList(fileList);
+		if(mesProductRecord.getRemark() == null || mesProductRecord.getRemark().isEmpty()){
+			mesProductRecord.setRemark("");
+		}
 
 		resp.setData(mesProductRecord);
 		resp.setResult(Global.TRUE);
@@ -2419,7 +2425,7 @@ public String check(@RequestBody MesElectricTorque mesElectricTorque,HttpServlet
 
 		try{
 
-			String res = updateQualityCommon(mesLineProcess1,oprno,lineSn,sn,craft,result,userCode,params);
+			String res = updateQualityCommon(mesLineProcess1,oprno,lineSn,sn,craft,result,userCode,params,remark);
 			String checkret = res.substring(2,4);
 			if(!checkret.equals("OK")){
 				String lx = res.substring(0,2)+" ";
@@ -2662,7 +2668,7 @@ public String check(@RequestBody MesElectricTorque mesElectricTorque,HttpServlet
 
 		try{
 
-			String res = updateQualityCommon(mesLineProcess1,oprno,lineSn,sn,craft,result,userCode,params);
+			String res = updateQualityCommon(mesLineProcess1,oprno,lineSn,sn,craft,result,userCode,params,null);
 			String checkret = res.substring(2,4);
 			if(!checkret.equals("OK")){
 				String lx = res.substring(0,2)+" ";
@@ -2842,7 +2848,7 @@ public String check(@RequestBody MesElectricTorque mesElectricTorque,HttpServlet
 
 			try{
 
-				String res = updateQualityCommon(mesLineProcess1,oprno,lineSn,sn,craft,content,userCode,params);
+				String res = updateQualityCommon(mesLineProcess1,oprno,lineSn,sn,craft,content,userCode,params,null);
 				String checkret = res.substring(2,4);
 				if(!checkret.equals("OK")){
 					String lx = res.substring(0,2)+" ";
@@ -3209,7 +3215,7 @@ public String check(@RequestBody MesElectricTorque mesElectricTorque,HttpServlet
 			// 2.判断物料批次是否符合绑定
 			List<BindMaterialResp> bmlists = mesLineProcessMaterialService.getBindMaterial(oprno, lineSn);
 
-			mesProductRecordService.updateRecordResult(sn,oprno,"100000","",result,userCode,params,lineSn,true,bmlists);
+			mesProductRecordService.updateRecordResult(sn,oprno,"100000","",result,userCode,params,lineSn,true,bmlists,null);
 		}catch (Exception e){
 			hashMap.put("Message", "参数为null");
 			hashMap.put("Result", "Fail");
@@ -3323,6 +3329,10 @@ public String check(@RequestBody MesElectricTorque mesElectricTorque,HttpServlet
 		mesProductRecord.setLineSn(lineSn);
 		MesProductRecord mesProductRecord1 =  mesProductRecordService.findInfo(mesProductRecord);
 		String contentOld = mesProductRecord1.getContent();
+		if(oprno.length()<=5){
+			String	newOprno = oprno+"A";
+			mesProductRecord1.setOprno(newOprno);
+		}
 		mesProductRecord1.setContent(content);
 		mesProductRecord1.setSource("2");
 		mesProductRecordService.save(mesProductRecord1);
@@ -3791,7 +3801,7 @@ public String check(@RequestBody MesElectricTorque mesElectricTorque,HttpServlet
 			}else {
 
 				List<ParamsResp> params = mesProductRecordService.getQualityParams(oldOprno,lineSn,ps);
-				String res = updateQualityCommon(mesLineProcess1,oprno,lineSn,sn,craft,result,userCode,params);
+				String res = updateQualityCommon(mesLineProcess1,oprno,lineSn,sn,craft,result,userCode,params,null);
 				logger.info("res:"+res);
 				if(!res.equals("RSOK")){
 					String lx = ret.substring(0,2);

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

@@ -171,8 +171,9 @@ public class MesQualityController extends BaseController {
 		CommonResp<String> resp1 = new CommonResp<>();
 		String oprno = request.getParameter("oprno");
 		String sn = request.getParameter("sn");
+		String lineSn = request.getParameter("lineSn");
 
-		MesProductRecord mesProductRecord = mesProductRecordService.findByUpdate(sn,oprno,"100000");
+		MesProductRecord mesProductRecord = mesProductRecordService.findByUpdate(sn,oprno,"100000",lineSn);
 		if(ObjectUtils.isEmpty(mesProductRecord)){
 			resp1.setResult(Global.FALSE);
 			resp1.setMessage("工件不存在");
@@ -322,7 +323,7 @@ public class MesQualityController extends BaseController {
 			return renderResult(Global.FALSE, text("请选择检查结果!"));
 		}
 
-		MesProductRecord mesProductRecord = mesProductRecordService.findByUpdate(sn,oprno,"100000");
+		MesProductRecord mesProductRecord = mesProductRecordService.findByUpdate(sn,oprno,"100000",lineSn);
 		if(ObjectUtils.isEmpty(mesProductRecord)){
 			return renderResult(Global.FALSE, text("工件不存在!"));
 		}