ソースを参照

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/resources/config/application.yml
dkk 5 ヶ月 前
親
コミット
3c858b1569

+ 1 - 1
pom.xml

@@ -11,7 +11,7 @@
 	</parent>
 
 
-	<artifactId>jee-mes-x04c</artifactId>
+	<artifactId>jee-mes-ahdy</artifactId>
 	<packaging>jar</packaging>
 	
 	<description>Web 服务,也可为分离端提供接口服务</description>

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

@@ -1071,6 +1071,26 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
 		super.delete(mesProductRecord);
 	}
 
+	public List<ParamsResp> getQualityParam(String oprno,String lineSn,String result){
+		oprno = CommonUitl.formatOprno(oprno);
+		List<ParamsResp> params = new ArrayList<>();
+
+		if(lineSn.contains("XT")){
+			switch (oprno){
+				case "OP060":
+                case "OP130":
+                case "OP100":
+                    ParamsResp paramsResp = new ParamsResp();
+					paramsResp.setCraft("300001");
+					paramsResp.setResult(result);
+					paramsResp.setVal("");
+					params.add(paramsResp);
+					break;
+            }
+		}
+
+		return params;
+	}
 	// 获取质量参数数组
 	public List<ParamsResp> getQualityParams(String oprno,String msg){
 		String oldOprno = oprno;

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

@@ -685,9 +685,504 @@ public class MesProductRecordController extends BaseController {
 		return ret;
 	}
 
+	// 独立接口:创建订单报文
+	@PostMapping(value = "createOrder")
+	@ResponseBody
+	public CommonResp createOrderApi(HttpServletRequest request) {
+		CommonResp<Object> resp = new CommonResp<>();
+
+		mesLogService.apisave(request);
+		String ret = "";
+		String sn = request.getParameter("sn");
+		String oprno = request.getParameter("oprno");
+		String lineSn = request.getParameter("lineSn");
+		String userCode = request.getParameter("ucode");
+		String result = request.getParameter("result");
+		String oldOprno = oprno;
+		if (oldOprno.length() == 5) {
+			oprno += "A";
+		}
+
+		if (StringUtils.isEmpty(sn)) {
+			resp.setMessage(ErrorMsg.getErrorMsg("PE", "RS"));
+			resp.setResult(Global.FALSE);
+			return resp;
+		}
+
+		MesLineProcess mesLineProcess1 = mesLineProcessService.getOnLineOprno(lineSn);
+		if (ObjectUtils.isEmpty(mesLineProcess1)) {
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("OL", "RS"));
+			return resp;
+		}
+		if (!CommonUitl.formatOprno(oprno).equals(mesLineProcess1.getOprno())) {
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("OM", "RS"));
+			return resp;
+		}
+		if (!result.equals("OK") && !result.equals("NG")) {
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("RM", "RS"));
+			return resp;
+		}
+
+		String cateSn = mesLineService.findInfoCate(lineSn);
+		if (StringUtils.isEmpty(cateSn)) {
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("CM", "RS"));
+			return resp;
+		}
+		if (!mesProductCateService.checkSn(sn)) {
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("GS", "RS"));
+			return resp;
+		}
+		if (!mesProcessCheckRecordService.checkRecord(oprno, lineSn)) {
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("DJ", "RS"));
+			return resp;
+		}
+
+		MesProductRecord mpr = mesProductRecordService.findBySnCate(sn, cateSn);
+		if (!ObjectUtils.isEmpty(mpr)) {
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("CF", "RS"));
+			return resp;
+		}
+
+		MesProductRecord mesProductRecord = new MesProductRecord();
+		mesProductRecord.setSn(sn);
+		mesProductRecord.setOprno(oprno);
+		mesProductRecord.setLineSn(lineSn);
+		mesProductRecord.setContent(result);
+		mesProductRecord.setCreateBy(userCode);
+		mesProductRecord.setCateSn(cateSn);
+
+		List<ParamsResp> params = mesProductRecordService.getQualityParam(oprno, lineSn,result);
+		ParamsResp paramsResp2 = new ParamsResp();
+		paramsResp2.setCraft("100000");
+		paramsResp2.setResult("OK");
+		params.add(paramsResp2);
+		try {
+			List<BindMaterialResp> bmlists = mesLineProcessMaterialService.getBindMaterial(oprno, lineSn);
+			if (!ListUtils.isEmpty(bmlists)) {
+				for (BindMaterialResp bindMaterialResp : bmlists) {
+					if (StringUtils.isEmpty(bindMaterialResp.getBatchSn())) {
+						resp.setResult(Global.FALSE);
+						resp.setMessage(ErrorMsg.getErrorMsg("BM", "RS"));
+						return resp;
+
+					}
+					Integer lastTimes = Integer.valueOf(bindMaterialResp.getLastTimes());
+					if (lastTimes < 1) {
+						resp.setResult(Global.FALSE);
+						resp.setMessage(ErrorMsg.getErrorMsg("BM", "RS"));
+						return resp;
+					}
+					ParamsResp paramsRespm = new ParamsResp();
+					paramsRespm.setCraft(bindMaterialResp.getCraft());
+					paramsRespm.setResult("OK");
+					paramsRespm.setVal(bindMaterialResp.getBatchSn());
+					params.add(paramsRespm);
+				}
+			}
+			ret = mesProductRecordService.add(mesProductRecord, params, bmlists);
+
+		} catch (Exception e) {
+			e.printStackTrace();//RSNS
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("FL", "RS"));
+			resp.setData("RSNS");
+			return resp;
+
+
+		}
+
+		resp.setResult(Global.TRUE);
+		resp.setData(ret);
+		return resp;
+	}
+
+	// 独立接口:工位开始工作报文
+	@PostMapping(value = "startWork")
+	@ResponseBody
+	public CommonResp startWorkApi(HttpServletRequest request) {
+		CommonResp resp = new CommonResp();
+
+		String sn = request.getParameter("sn");
+		String oprno = request.getParameter("oprno");
+		String productCate = request.getParameter("lineSn");
+		String ucode = request.getParameter("ucode");
+		if (StringUtils.isEmpty(sn) || StringUtils.isEmpty(oprno) || StringUtils.isEmpty(productCate)) {
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("PE", "RS"));
+			return resp;
+		}
+		MesDeviceTime mesDeviceTime = new MesDeviceTime();
+		mesDeviceTime.setOprno(oprno);
+		mesDeviceTime.setSn(sn);
+		mesDeviceTime.setStartDate(new Date());
+		mesDeviceTime.setProductCate(productCate);
+		mesDeviceTime.setCreateBy(ucode);
+		mesDeviceTime.setUpdateBy(ucode);
+		String ret = "RSNS";
+		try {
+			ret = mesDeviceTimeService.add(mesDeviceTime);
+		} catch (Exception e) {
+			ret = "RSNS";
+		}
+		resp.setResult(Global.TRUE);
+		resp.setData(ret);
+		return resp;
+	}
+
+	// 独立接口:绑定报文
+	@PostMapping(value = "bindRecord")
+	@ResponseBody
+	public CommonResp bindRecordApi(HttpServletRequest request) {
+		CommonResp<Object> resp = new CommonResp<>();
+
+		String ret = "RSNS";
+
+		String oprno = request.getParameter("oprno");
+		String craft = request.getParameter("craft").trim();
+		String sn = request.getParameter("sn").trim();
+		String materielSn = request.getParameter("materielSn").trim();
+		String userCode = request.getParameter("userCode").trim();
+		String lineSn = request.getParameter("lineSn").trim();
+		if (StringUtils.isEmpty(craft) || StringUtils.isEmpty(oprno) || StringUtils.isEmpty(sn)
+				|| StringUtils.isEmpty(lineSn) || StringUtils.isEmpty(materielSn)) {
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("PE", "RS"));
+			return resp;
+		}
+		try {
+			String fOprno = CommonUitl.formatOprno(oprno);
+			List<MesTemplateItems> mesTemplateItemsList = mesTemplateItemsService.findListByOprno(fOprno);
+			List<MesProductRecord> mesProductRecordList = mesProductRecordService.findBySnAndOprnoLike(sn, fOprno);
+			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 mesProduct = mesProductService.findBySn(sn);
+					if (ObjectUtils.isEmpty(mesProduct)) {
+						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());
+					}
+				}
+			}
+			mesProductRecordService.updateRecord(sn, oprno, craft, materielSn, "OK", userCode, lineSn);
+		} catch (Exception e) {
+			e.printStackTrace();
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("FL", "RS"));
+			return resp;
+		}
+		resp.setResult(Global.TRUE);
+		resp.setData(ret);
+		return resp;
+	}
+
+	// 独立接口:解绑报文
+	@PostMapping(value = "unbindRecord")
+	@ResponseBody
+	public CommonResp unbindRecordApi(HttpServletRequest request) {
+		CommonResp resp = new CommonResp();
+
+		String oprno = request.getParameter("oprno");
+		String craft = request.getParameter("craft");
+		String sn = request.getParameter("sn");
+		String materielSn = request.getParameter("materielSn");
+		String userCode = request.getParameter("userCode");
+		String cateSn = request.getParameter("lineSn");
+		if (StringUtils.isEmpty(craft) || StringUtils.isEmpty(oprno) || StringUtils.isEmpty(sn)
+				|| StringUtils.isEmpty(cateSn) || StringUtils.isEmpty(materielSn)) {
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("PE", "RS"));
+			return resp;
+		}
+		try {
+			mesProductRecordService.updateRecord(sn, oprno, craft, materielSn, "UDF", userCode, cateSn);
+		} catch (Exception e) {
+			e.printStackTrace();
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("FL", "RS"));
+			return resp;
+		}
+		resp.setResult(Global.TRUE);
+		resp.setData("RSOK");
+		return resp;
+	}
+
+	// 独立接口:查询质量报文
+	@PostMapping(value = "checkQualityMsg")
+	@ResponseBody
+	public CommonResp checkQualityMsgApi(HttpServletRequest request) {
+		CommonResp resp = new CommonResp();
+
+		String oprno = request.getParameter("oprno");
+		String sn = request.getParameter("sn");
+		String oldOprno = oprno;
+		if (oldOprno.length() == 5) {
+			oldOprno += "A";
+		}
+		oprno = CommonUitl.formatOprno(oprno);
+		String lineSn = request.getParameter("lineSn");
+		if (StringUtils.isEmpty(sn) || StringUtils.isEmpty(lineSn) || StringUtils.isEmpty(oprno)) {
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("PE", "RS"));
+			return resp;
+		}
+		String userCode = request.getParameter("userCode");
+		String ret = checkQualityCommon(oldOprno, sn, lineSn, userCode);
+
+		resp.setResult(Global.TRUE);
+		resp.setData("RS" + ret.substring(3, 5));
+		return resp;
+	}
+
+	// 独立接口:上传质量结果报文
+	@PostMapping(value = "updateQualityMsg")
+	@ResponseBody
+	public CommonResp updateQualityMsgApi(HttpServletRequest request) {
+		CommonResp resp = new CommonResp();
+
+		String oprno = request.getParameter("oprno");
+
+		String craft = request.getParameter("craft");
+		String sn = request.getParameter("sn");
+		String result = request.getParameter("result");
+		String userCode = request.getParameter("userCode");
+		String lineSn = request.getParameter("lineSn");
+		if (StringUtils.isEmpty(craft) || StringUtils.isEmpty(oprno) || StringUtils.isEmpty(lineSn)) {
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("PE", "RS"));
+			return resp;
+		}
+		if (oprno.length() == 5) {
+			oprno = oprno + "A";
+		}
+		MesLineProcess mesLineProcess1 = mesLineProcessService.findInfoByOprnoLineSn(oprno, lineSn);
+		if (ObjectUtils.isEmpty(mesLineProcess1)) {
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("OI", "RS"));
+			return resp;
+		}
+		if (!mesLineProcess1.getType().equals("3") && StringUtils.isEmpty(sn)) {
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("SN", "RS"));
+			return resp;
+		}
+		if (!result.equals("OK") && !result.equals("NG")) {
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("RO", "RS"));
+			return resp;
+		}
+		try {
+			if (!craft.equals("100000")) {
+				mesProductRecordService.updateRecord(sn, oprno, craft, "", result, userCode, lineSn);
+			} else {
+				List<ParamsResp> params = mesProductRecordService.getQualityParam(oprno, lineSn,result);
+				logger.info("params:" + JSON.toJSONString(params));
+
+				String ret = updateQualityCommon(mesLineProcess1, oprno, lineSn, sn, craft, result, userCode, params);
+				resp.setData(ret);
+				return resp;
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("FL", "RS"));
+			return resp;
+		}
+		resp.setResult(Global.TRUE);
+		resp.setData("RSOK");
+		return resp;
+	}
+
+	// 独立接口:上传设备状态报文
+	@PostMapping(value = "deviceState")
+	@ResponseBody
+	public CommonResp deviceStateApi(HttpServletRequest request) {
+		CommonResp resp = new CommonResp();
+
+		String ret = "";
+		String oprno = request.getParameter("oprno");
+		String state = request.getParameter("state").trim();
+		String deviceContent = request.getParameter("deviceContent");
+		String productCate = request.getParameter("productCate");
+		Integer paramsNums = Integer.parseInt(request.getParameter("paramsNums"));
+		String errorCode = request.getParameter("errorCode").trim();
+		try {
+			if (paramsNums > 0) {
+				for (int j = 1; j <= paramsNums; j++) {
+					//String params = ProtocolParam.getParam(msg, j);
+					// 不再使用报文解析,直接接收故障代码参数
+					MesDeviceState mesDeviceState = new MesDeviceState();
+					mesDeviceState.setDeviceSn(oprno);
+					mesDeviceState.setCode(errorCode);
+					mesDeviceState.setState(String.valueOf(Integer.parseInt(state)));
+					mesDeviceState.setContent(deviceContent);
+					mesDeviceState.setStartDate(new Date());
+					mesDeviceState.setProductCate(productCate);
+					mesDeviceStateService.updateState(mesDeviceState);
+				}
+			} else {
+				MesDeviceState mesDeviceState = new MesDeviceState();
+				mesDeviceState.setDeviceSn(oprno);
+				mesDeviceState.setCode("");
+				mesDeviceState.setState(state);
+				mesDeviceState.setContent(deviceContent);
+				mesDeviceState.setStartDate(new Date());
+				mesDeviceState.setProductCate(productCate);
+				mesDeviceStateService.updateState(mesDeviceState);
+			}
+			MesDevice mesDevice = mesDeviceService.findInfoBySnCate(oprno, productCate);
+			if (!ObjectUtils.isEmpty(mesDevice)) {
+				mesDevice.setWorkStatus(String.valueOf(Integer.parseInt(state)));
+				Date date = new Date();
+				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+				String dateString = sdf.format(date);
+				mesDevice.setWorkTime(dateString);
+				mesDeviceService.update(mesDevice);
+			}
+		} catch (Exception e) {
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("FL", "RS"));
+			return resp;
+		}
+		if (StringUtils.isEmpty(state)) {
+			state = "RS";
+		}
+		ret = state + "OK";
+		resp.setResult(Global.TRUE);
+		resp.setData(ret);
+		return resp;
+	}
+
+	// 独立接口:上传参数报文
+	@PostMapping(value = "updateParams")
+	@ResponseBody
+	public CommonResp updateParamsApi(HttpServletRequest request) {
+		CommonResp resp = new CommonResp();
+		String msg = request.getParameter("msg");
+
+		String result;
+		String oprno = request.getParameter("oprno");
+		String craft = request.getParameter("craft");
+		String sn = request.getParameter("sn");
+		String userCode = request.getParameter("userCode");
+		String lineSn = request.getParameter("lineSn");
+		Integer nums = Integer.parseInt(request.getParameter("paramsNums"));
+		String params = "";
+		if (lineSn.equals("LB")) {
+			MesProductRecord mpr = mesProductRecordService.findSnByMsn(sn);
+			if (!ObjectUtils.isEmpty(mpr)) {
+				sn = mpr.getSn();
+			}
+		}
+		if (nums > 0) {
+			result = "OK";
+			for (int i = 0; i < nums; i++) {
+				String sparam = ProtocolParam.getParam(msg, i + 1);
+				params += sparam;
+				if (ProtocolParam.getParamResult(sparam).equals("NG")) {
+					result = "NG";
+				}
+			}
+		} else {
+			result = "OK";
+		}
+		try {
+			mesProductRecordService.updateRecord(sn, oprno, craft, params, result, userCode, lineSn);
+		} catch (Exception e) {
+			e.printStackTrace();
+			resp.setResult(Global.FALSE);
+			resp.setMessage(ErrorMsg.getErrorMsg("FL", "RS"));
+			return resp;
+		}
+		resp.setResult(Global.TRUE);
+		resp.setData("RSOK");
+		return resp;
+	}
+
+	// 独立接口:查询确认报文
+	@PostMapping(value = "recordConfirm")
+	@ResponseBody
+	public CommonResp recordConfirmApi(HttpServletRequest request) {
+		CommonResp resp = new CommonResp();
+		String msg = request.getParameter("msg");
+
+		String sn = request.getParameter("sn");
+		String oprno = request.getParameter("oprno");
+		String lx = request.getParameter("lx").trim();
+		String lineSn = request.getParameter("lineSn").trim();
+		if (lineSn.equals("LB")) {
+			MesProductRecord mpr = mesProductRecordService.findSnByMsn(sn);
+			if (!ObjectUtils.isEmpty(mpr)) {
+				sn = mpr.getSn();
+			}
+		}
+		if (lx.equals("JG")) {
+			// 与原逻辑保持一致,当前未处理
+		} else if (lx.equals("SM")) {
+			// 与原逻辑保持一致,当前未处理
+		} else if (lx.equals("BD")) {
+			// 与原逻辑保持一致,当前未处理
+		}
+		resp.setData(lx + "NG");
+		resp.setResult(Global.TRUE);
+		return resp;
+	}
+
+
+
+
 	//创建订单报文
 	//msg=aaaabbbbbABWMCJWGWOP040 ID151245P00000106200123062900001      DA2023-07-01ZT10:01:25
-	private String createOrder(String msg){
+	private String createOrder( String msg){
 		String ret = "RSNS";
 		String sn = ProtocolParam.getSn(msg).trim();
 		String oprno = ProtocolParam.getOprno(msg).trim();

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

@@ -40,7 +40,7 @@ public class ProductGh {
     @Autowired
     private MesProductModifyRecordService mesProductModifyRecordService;
 
-    @Scheduled(fixedRate=30000)
+//    @Scheduled(fixedRate=30000)
     private void configureTasks() { //OP310
         try{
             MesLineProcess mesLineProcess = new MesLineProcess();

+ 20 - 0
src/main/java/com/jeesite/modules/utils/ErrorMsg.java

@@ -56,6 +56,26 @@ public class ErrorMsg {
                 lmsg = "请先上传照片";
             } else if (processMsgRet.equalsIgnoreCase("SJ")) {
                 lmsg = "OKNG样件未进行开班点检";
+            } else if (processMsgRet.equalsIgnoreCase("PN")) {
+                lmsg = "参数不能为空";
+            } else if (processMsgRet.equalsIgnoreCase("PE")) {
+                lmsg = "参数错误";
+            } else if (processMsgRet.equalsIgnoreCase("OL")) {
+                lmsg = "工位不在线";
+            } else if (processMsgRet.equalsIgnoreCase("OM")) {
+                lmsg = "工位不匹配";
+            } else if (processMsgRet.equalsIgnoreCase("RM")) {
+                lmsg = "结果不匹配";
+            } else if (processMsgRet.equalsIgnoreCase("CM")) {
+                lmsg = "产品编号不匹配";
+            } else if (processMsgRet.equalsIgnoreCase("OI")) {
+                lmsg = "工位不存在";
+            } else if (processMsgRet.equalsIgnoreCase("SN")) {
+                lmsg = "工件码不能为空";
+            } else if (processMsgRet.equalsIgnoreCase("RO")) {
+                lmsg = "结果只能是OK或NG";
+            } else if (processMsgRet.equalsIgnoreCase("FL")) {
+                lmsg = "操作失败";
             }
         }catch (Exception e){ }
         return lmsg;

+ 24 - 23
src/main/java/com/jeesite/modules/utils/ProtocolParam.java

@@ -18,83 +18,83 @@ public class ProtocolParam {
 
     // 获取工位号
     public static String getOprno(String msg){
-        if(msg.length() < 24){
+        if(msg.length() < 23){
             return "";
         }
-        return msg.substring(18,24);
+        return msg.substring(18,23);
     }
 
     // 获取工艺号
     public static String getCraft(String msg){
-        if(msg.length() < 32){
+        if(msg.length() < 31){
             return "";
         }
-        return msg.substring(26,32);
+        return msg.substring(26,31);
     }
 
     // 获取类型
     public static String getLx(String msg){
-        if(msg.length() < 36){
+        if(msg.length() < 73){
             return "";
         }
-        return msg.substring(34,36);
+        return msg.substring(71,73);
     }
 
     // 获取返回类型
     public static String getReturnLx(String msg){
-        if(msg.length() < 36){
+        if(msg.length() < 73){
             return "RS";
         }
-        String lx = msg.substring(34,36);
+        String lx = msg.substring(71,73);
         return StringUtils.isEmpty(lx.trim())?"RS":lx;
     }
 
     // 获取产线编号
     public static String getLineSn(String msg){
-        if(msg.length() < 38){
+        if(msg.length() < 39){
             return "";
         }
-        return msg.substring(36,38);
+        return msg.substring(34,39);
     }
 
     // 获取镭雕码或设备报警故障代码
     public static String getSn(String msg){
-        if(msg.length() < 74){
+        if(msg.length() < 68){
             return "";
         }
-        return msg.substring(38,74);
+        return msg.substring(39,68);
     }
 
     // 获取结果
     public static String getResult(String msg){
-        if(msg.length() < 78){
+        if(msg.length() < 70){
             return "";
         }
-        return msg.substring(76,78);
+        return msg.substring(68,70);
     }
 
     // 获取日期
     public static String getDay(String msg){
-        if(msg.length() < 90){
+        if(msg.length() < 87){
             return "";
         }
-        return msg.substring(80,90);
+        return msg.substring(77,87);
     }
 
     // 获取时间
     public static String getTime(String msg){
-        if(msg.length() < 100){
+        if(msg.length() < 97){
             return "";
         }
-        return msg.substring(92,100);
+        return msg.substring(89,97);
     }
 
     // 获取用户
     public static String getUserCode(String msg){
-        if(msg.length() < 122){
+        if(msg.length() < 105){
             return "";
         }
-        return msg.substring(102,122).trim();
+        return msg.substring(98,105).trim();
     }
 
     // 获取参数个数
@@ -103,6 +103,7 @@ public class ProtocolParam {
             return 0;
         }
         String nn = msg.substring(122,fixedLength).trim();
+
         if(StringUtils.isEmpty(nn)){
             return 0;
         }
@@ -158,7 +159,7 @@ public class ProtocolParam {
             }
         }else if(msgType.equals("MSBW")){ // 设备状态,9*26=234
             if(msg.length() >= fixedLength + length*4){
-               // res = msg.substring(fixedLength,fixedLength + 234);
+                // res = msg.substring(fixedLength,fixedLength + 234);
                 res = msg.substring(fixedLength+(num-1)*4,fixedLength + num*4);
             }
         }else{
@@ -184,9 +185,9 @@ public class ProtocolParam {
     // 获取参数结果值
     public static String getParamVal(String param){
         if(param.length() > 1){
-            return param.substring(1,param.length()).trim();
+            return param.substring(1).trim();
         }
         return "";
     }
 
-}
+}

+ 15 - 6
src/main/resources/config/application.yml

@@ -54,13 +54,13 @@ jdbc:
   # Mysql 数据库配置
   type: mysql
   driver: com.mysql.cj.jdbc.Driver
-  url: jdbc:mysql://127.0.0.1:3306/mes_ahdy?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
+#  url: jdbc:mysql://127.0.0.1:3306/mes_cloud?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
 #  url: jdbc:mysql://127.0.0.1:3306/mes_cloud_x04c?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
-#  url: jdbc:mysql://192.168.22.99:3306/mes_cloud?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
-#  username: mes_cloud
-#  password: YD57bSRabiyWBwkZ
-  username: root
-  password: 123456
+  url: jdbc:mysql://192.168.9.181:3306/mes_cloud?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
+  username: mes_cloud
+  password: s2ENj7KaEySTC7dW
+#  username: root
+#  password: root
 
   testSql: SELECT 1
 
@@ -652,6 +652,15 @@ shiro:
     ${adminPath}/mes/mesProductRecord/pcresult = anon
     ${adminPath}/mes/mesProductRecord/pccreate = anon
     ${adminPath}/mes/mesProductRecord/getConfig = anon
+    ${adminPath}/mes/mesProductRecord/createOrder = anon
+    ${adminPath}/mes/mesProductRecord/startWork = anon
+    ${adminPath}/mes/mesProductRecord/bindRecord = anon
+    ${adminPath}/mes/mesProductRecord/unbindRecord = anon
+    ${adminPath}/mes/mesProductRecord/checkQualityMsg = anon
+    ${adminPath}/mes/mesProductRecord/updateQualityMsg = anon
+    ${adminPath}/mes/mesProductRecord/deviceState = anon
+    ${adminPath}/mes/mesProductRecord/updateParams = anon
+    ${adminPath}/mes/mesProductRecord/recordConfirm = anon
     ${adminPath}/mes/mesElectricTorque/batchSave = anon
     ${adminPath}/mes/mesProductYgsl/batchsave = anon
     ${adminPath}/mes/mesProductHb/upload = anon