Sfoglia il codice sorgente

绑定内容接口优化

jingbo 3 settimane fa
parent
commit
97263c089b

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

@@ -3514,7 +3514,7 @@ public class MesProductRecordController extends BaseController {
 
 
 		if(StringUtils.isEmpty(craft)||StringUtils.isEmpty(oprno)||StringUtils.isEmpty(lineSn)){
-			return "RSNS";
+			return renderResult(Global.FALSE, text("参数错误!"));
 		}
 
 		if(oprno.length() == 5){
@@ -3624,4 +3624,55 @@ public class MesProductRecordController extends BaseController {
 		return resp;
 	}
 
+	@PostMapping(value = "pcbindRecord")
+	@ResponseBody
+	public String pcbindRecord(HttpServletRequest request) {
+		String ret = "";
+		mesLogService.apisave(request);
+		String sn = request.getParameter("sn");
+		String oprno = request.getParameter("oprno");
+		String lineSn = request.getParameter("lineSn");
+		String result = request.getParameter("result");
+		String userCode = request.getParameter("ucode");
+		String materielSn = request.getParameter("materielSn");
+		String craft = request.getParameter("craft");
+		if (StringUtils.isEmpty(craft)){
+			craft = "100000";
+		}
+		String remark = request.getParameter("remark");
+		String ps = request.getParameter("ps"); // 参数,多个以"|"分割
+
+		String oldOprno = oprno;
+		if(oldOprno.length()==5){
+			oldOprno += "A";
+		}
+
+
+		if(StringUtils.isEmpty(craft)||StringUtils.isEmpty(oprno)||StringUtils.isEmpty(lineSn)){
+			return renderResult(Global.FALSE, text("参数错误!"));
+		}
+
+		if(oprno.length() == 5){
+			oprno = oprno+"A";
+		}
+
+		if(!CommonUitl.checkDbjOprno(oprno,lineSn) && StringUtils.isEmpty(sn)){
+			return renderResult(Global.FALSE, text("参数错误!"));
+		}
+
+		if(!result.equals("OK") && !result.equals("NG")){
+			return renderResult(Global.FALSE, text("参数错误!"));
+		}
+		try {
+			mesProductRecordService.updateRecord(sn,oprno,craft,materielSn,"OK",userCode,lineSn);
+		}catch (Exception e){
+			// 手动设置回滚,防止@Transactional失效
+			TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+			logger.info(e.getMessage());
+			return renderResult(Global.FALSE, text("操作失败!"));
+		}
+
+		return renderResult(Global.TRUE, text("操作成功!"));
+	}
+
 }