|
|
@@ -4160,6 +4160,13 @@ public class MesProductRecordController extends BaseController {
|
|
|
String lineSn = request.getParameter("lineSn");
|
|
|
String userCode = request.getParameter("ucode");
|
|
|
|
|
|
+ // 当为空时返回失败
|
|
|
+ if(StringUtils.isEmpty(sn) || StringUtils.isEmpty(oprno) || StringUtils.isEmpty(lineSn)){
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage("参数错误");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
// 格式化工件码(带子工位)
|
|
|
String oldOprno = oprno;
|
|
|
if(oldOprno.length()==5){
|
|
|
@@ -4168,12 +4175,7 @@ public class MesProductRecordController extends BaseController {
|
|
|
// 格式化工件码
|
|
|
oprno = CommonUitl.formatOprno(oprno);
|
|
|
resp.setResult(Global.FALSE);
|
|
|
- // 当为空时返回失败
|
|
|
- if(StringUtils.isEmpty(sn) || StringUtils.isEmpty(oprno) || StringUtils.isEmpty(lineSn)){
|
|
|
- resp.setResult(Global.FALSE);
|
|
|
- resp.setMessage("参数错误");
|
|
|
- return resp;
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
// 1.检查是否存在工件码 2.检查是否存在工位 3.判断是否为万能码 4.检查是否开启防呆和重复检测
|
|
|
// 5.开启防呆后判断状态(开班点检、判断物料批次是否符合绑定、检查配件寿命是否到期、当前工位结果、上面工位结果)
|
|
|
@@ -4472,4 +4474,82 @@ public class MesProductRecordController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ //pda查询工位是否有工件
|
|
|
+ @PostMapping(value = "pdaQueryIsSn")
|
|
|
+ @ResponseBody
|
|
|
+ public CommonResp pdaQueryIsSn(HttpServletRequest request) {
|
|
|
+ CommonResp resp = new CommonResp<>();
|
|
|
+ mesLogService.apisave(request);
|
|
|
+ // 获取产线
|
|
|
+ String lineSn = request.getParameter("lineSn");
|
|
|
+ // 获取工位号
|
|
|
+ String oprno = request.getParameter("oprno");
|
|
|
+ if (StringUtils.isEmpty(lineSn) || StringUtils.isEmpty(oprno)){
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage("参数错误");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ MesProcessProduct mesProcessProduct = mesProcessProductService.findByCateAndOprno(lineSn, oprno);
|
|
|
+ // 如果没有就创建数据
|
|
|
+ if (ObjectUtils.isEmpty(mesProcessProduct)) {
|
|
|
+ mesProcessProduct = new MesProcessProduct();
|
|
|
+ mesProcessProduct.setProductCate(lineSn);
|
|
|
+ mesProcessProduct.setOprno(oprno);
|
|
|
+ mesProcessProductService.insert(mesProcessProduct);
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
+ resp.setMessage("可以扫码");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(mesProcessProduct.getSn())) {
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
+ resp.setMessage("可以扫码");
|
|
|
+ return resp;
|
|
|
+ }else {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage("当前工位有工件");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(e.getMessage());
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //pda查询工件质量
|
|
|
+ @PostMapping(value = "pdaQueryQuality")
|
|
|
+ @ResponseBody
|
|
|
+ public CommonResp pdaQueryQuality(HttpServletRequest request) {
|
|
|
+ CommonResp resp = pccheck(request);
|
|
|
+ String sn = request.getParameter("sn");
|
|
|
+ String oprno = request.getParameter("oprno");
|
|
|
+ String lineSn = request.getParameter("lineSn");
|
|
|
+ if ("true".equals(resp.getResult())){
|
|
|
+ try {
|
|
|
+ // 将二维码放置在工位
|
|
|
+ MesProductRecord mesProductRecord = new MesProductRecord();
|
|
|
+ mesProductRecord.setSn(sn);
|
|
|
+ mesProductRecord.setOprno(oprno);
|
|
|
+ mesProductRecord.setLineSn(lineSn);
|
|
|
+ mesProductRecordService.update(mesProductRecord);
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
+ resp.setMessage("扫码成功");
|
|
|
+ return resp;
|
|
|
+ }catch (Exception e){
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ logger.info("扫码异常:"+e.getMessage());
|
|
|
+ resp.setMessage("扫码失败");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ }else if ("false".equals(resp.getResult())){
|
|
|
+ return resp;
|
|
|
+ }else {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage("扫码异常");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|