| | |
| | | if(code.equals("success")){ |
| | | logger.info("请求工厂MES工单:入参pack{}出参pack:{}",paramProductNum,dataObject.getStr("productNum")); |
| | | List<OmProductionOrdeInfo> check = omProductionOrdeInfoService.list(new LambdaQueryWrapper<OmProductionOrdeInfo>().eq(OmProductionOrdeInfo::getProductNum,dataObject.getStr("productNum"))); |
| | | if(check.size() == 0){ |
| | | if(check.isEmpty()){ |
| | | try { |
| | | log.info("请求工厂MES工单:入参pack{}出参pack:{}", paramProductNum, dataObject.getStr("productNum")); |
| | | OmProductionOrdeInfo omProductionOrdeInfo = new OmProductionOrdeInfo(); |
| | |
| | | omProductionOrdeInfo.setCreateTime(new Date()); |
| | | omProductionOrdeInfo.setCreateUser("工厂MES"); |
| | | omProductionOrdeInfoService.save(omProductionOrdeInfo); |
| | | |
| | | //写PLC |
| | | miloService.writeToOpcUa(ReadWriteEntity.builder().identifier("MOZU1." + paramOrder.getLineCode() + ".MES_WorkOrderNumber").value(dataObject.getStr("productionOrderNum")).build()); |
| | | miloService.writeToOpcUa(ReadWriteEntity.builder().identifier("MOZU1." + paramOrder.getLineCode() + ".MES_ModuleCode").value(dataObject.getStr("productNum")).build()); |
| | | miloService.writeToOpcUa(ReadWriteEntity.builder().identifier("MOZU1." + paramOrder.getLineCode() + ".WorkOrderNumber").value(dataObject.getStr("productionOrderNum")).build()); |
| | | miloService.writeToOpcUa(ReadWriteEntity.builder().identifier("MOZU1." + paramOrder.getLineCode() + ".ModuleCode").value(dataObject.getStr("productNum")).build()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }else{ |
| | | return AjaxResult.error("工单重复,请重新接收"); |
| | | } |
| | | }else { |
| | | return AjaxResult.error("接单失败,请联系管理员"); |