Ver código fonte

fix:代办日志接口

wang.sq@aliyun.com 2 meses atrás
pai
commit
8b7050360f

+ 1 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/OrderServiceImpl.java

@@ -416,7 +416,7 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
                     Map<Long, List<BomProcedure>> bomProcedureMap = bomProcedureService.getBomProcedureMap(bomIdList);
                     List<BBom> bboms = bBomMapper.selectList(Wraps.<BBom>lbQ().in(BBom::getId,bomIdList).eq(BBom::getAuditStatus,"2"));
                     if(bboms==null || bboms.isEmpty()){
-                        throw new BizException("没有查询到可用的零件信息!");
+                        throw new BizException("没有查询到可用的零件信息!请确认零件信息是否存在并已为审核通过状态");
                     }
                     Map<Long,BBom> bbomsMap = bboms.stream().collect(Collectors.toMap(BBom::getId, t->t));
 

+ 44 - 13
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/util/MsgUtil.java

@@ -316,7 +316,8 @@ public class MsgUtil implements ApplicationContextAware {
                         }
                     }
                 }
-            }else if (zoneType.equals(ParameterKey.ZONE_YJ)){
+            }
+            else if (zoneType.equals(ParameterKey.ZONE_YJ)){
 
                 Order order = orderMapper.selectById(task.getOrderId());
                 Plan plan = planMapper.selectById(task.getPlanId());
@@ -326,7 +327,7 @@ public class MsgUtil implements ApplicationContextAware {
                 logger.warn("【进入YJ_MQ队列判断】,节点对象:{}",JSONObject.toJSONString(taskNode));
                 //如果是三坐标检测
                 if("3".equals(taskNode.getNodeType())){
-                    // TODO 后续改成动态拼接
+/*                    // TODO 后续改成动态拼接
                     //组装接口参数
                     JSONObject jsonParam = new JSONObject();
                     jsonParam.put("tagname","DB200.20");
@@ -340,17 +341,43 @@ public class MsgUtil implements ApplicationContextAware {
                     //String measuringResultFile = SmbShareFileUtil.findNewMeasuringFiles(fileIp,userName,password,filePath + date + "/");
                     String measuringResultFile = "";
                     //List<String> fileContents = new ArrayList<>();
-                    logger.warn("获取检测结果文件路径{}", measuringResultFile);
+                    logger.warn("获取检测结果文件路径{}", measuringResultFile);*/
+
+                    log.info("======三坐标测量结果======");
+
                     OrderQuality orderQuality = new OrderQuality();
                     TTaskTestUnqualifiedBom taskTestUnqualifiedBom =  new TTaskTestUnqualifiedBom();
 
                     TWorkpiece workpiece = workpieceMapper.selectOne(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getCompleteBatchNo,task.getCompleteBatchNo()));
-                    logger.warn("三坐标测量结果{}", measuringResult);
-                    if(measuringResult == 0){
+                    // 根据库位id查询存储在此库位的信息工装夹具信息,查询工装所需要的检测程序名
+                    List<StockInfo> list = stockInfoService.list(Wraps.<StockInfo>lbQ().eq(StockInfo::getStorgeId, workpiece.getStorgeId()));
+                    List<Long> getGoodsIds = list.stream().map(StockInfo::getGoodsId).collect(Collectors.toList());
+
+                    List<MToolClamp> mToolClamps = mToolClampService.listByIds(getGoodsIds);
+                    // 拼接上传给plc的参数, 图号-零件号-源工序号-是否毛坯件-使用的检测程序
+                    String toPlcPar = bom.getDrawingNo()+"&"
+                            +workpiece.getUniqueCode()+"&"
+                            +bom.getNo()+"&1&"
+                            +mToolClamps.get(0).getDetectionProgram()+"&"
+                            +task.getTaskNo()+"&"
+                            +task.getExecutorId()+"&"
+                            +task.getOrderNo()+"&"
+                            +task.getBomBatchNo();
+
+                    orderQuality = orderQualityMapper.selectOne(Wraps.<OrderQuality>lbQ().eq(OrderQuality::getDetectionCommand, toPlcPar ));
+
+                    int measuringResult = 1;
+                    if(orderQuality !=null ){
                         //fileContents.add("OK");
-                        orderQuality.setOkFlag("OK");
-                        workpiece.setTestResult("1");
-                        taskTestUnqualifiedBom.setTestResult("1");
+                        if(orderQuality.getOkFlag().equals("OK")){
+                            measuringResult = 0;
+                            workpiece.setTestResult("1");
+                            taskTestUnqualifiedBom.setTestResult("1");
+                        }else {
+                            orderQuality.setOkFlag("NG");
+                            workpiece.setTestResult("0");
+                            taskTestUnqualifiedBom.setTestResult("0");
+                        }
                     }else{
                         //fileContents.add("NG");
                         orderQuality.setOkFlag("NG");
@@ -361,9 +388,13 @@ public class MsgUtil implements ApplicationContextAware {
 
                     orderQuality.setOrderNo(order.getOrderNo()).setOrderId(order.getId()).setTaskId(task.getId())
                     .setWorkpieceId(task.getCompleteBatchNo()).setWorkpieceName(bom.getName()).setProcedureId(task.getProcedureId())
-                    .setProcedureName(task.getProcedureName()).setMeasuringType(1).setMeasuringReport(measuringResultFile);
+                    .setProcedureName(task.getProcedureName()).setMeasuringType(1);
 
-                    orderQualityMapper.insert(orderQuality);
+                    if(orderQuality.getId()!=null){
+                        orderQualityMapper.updateById(orderQuality);
+                    }else {
+                        orderQualityMapper.insert(orderQuality);
+                    }
 
                     taskTestUnqualifiedBom.setTaskId(task.getId()).setTaskNo(task.getTaskNo()).setOrderId(order.getId()).setOrderNo(order.getOrderNo())
                     .setPlanId(plan.getId()).setPlanNo(plan.getPlanNo()).setProcedureId(task.getProcedureId()).setBomId(task.getBomId())
@@ -407,9 +438,9 @@ public class MsgUtil implements ApplicationContextAware {
                             }
                         }
                     }
-                }else if ("5".equals(taskNode.getNodeType())){
-                    logger.info("======三坐标检测===={}",JSONObject.toJSONString(taskNode));
-                    log.info("======三坐标检测===={}",JSONObject.toJSONString(taskNode));
+                }
+                else if ("5".equals(taskNode.getNodeType())){
+                    log.info("=========三坐标检测-工件坐标系========{}",JSONObject.toJSONString(taskNode));
 
                     // 工件坐标系检测 三坐标测量偏移量数据添加
                     BomProcedure procedure = bomProcedureService.getById(task.getProcedureId());

+ 5 - 3
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/externalApi/MesController.java

@@ -841,11 +841,12 @@ public class MesController extends SuperController<MesNoticeService, Long, MesNo
             mMeterial = materialService.getById(1L);
             //MMeterialReceiveLog mMeterialReceiveLog = meterialReceiveLogService.getById(1L);
             materialCode = StringUtil.isNotEmpty(idnr) ? idnr : mMeterial.getMeterialCode();
-            BBom bom = bBomService.getOne(new LambdaQueryWrapper<BBom>().eq(BBom::getDrawingNo, drawingNo).eq(BBom::getSynFlag, "1"));
+            BBom bom = bBomService.getOne(new LambdaQueryWrapper<BBom>().eq(BBom::getPartsNo, drawingNo + "_" + processNo).eq(BBom::getDrawingNo, drawingNo).eq(BBom::getSynFlag, "1"));
             if (bom == null) {
                 materialName = mMeterial.getTradeMark();
                 bom = BBom.builder().synFlag("1").name(materialName + "V" + processNo).batchNo(batchNo).partsNo(drawingNo + "_" + processNo).partsAlias(materialCode).no(processNo).brand(workOrderNo).status("1").importantFlag("1").keyFlag("1").zoneId(zone.getId()).drawingNo(drawingNo).build();
                 bom.setMeterialId(1L);
+                bom.setBomAlias(drawingNo + "_" + processNo);
                 bBomService.save(bom);
             } else {
                 materialName = bom.getName();
@@ -989,7 +990,8 @@ public class MesController extends SuperController<MesNoticeService, Long, MesNo
         }
 
         String bomName = materialName.contains("V") ? materialName : materialName + "V" + processNo;
-        BBom bom = bBomService.getOne(new LambdaQueryWrapper<BBom>().eq(BBom::getMeterialId, mMeterial.getId()).eq(BBom::getPartsAlias, mMeterial.getMeterialCode()).eq(BBom::getName, bomName).eq(BBom::getSynFlag, "1"));
+
+        BBom bom = bBomService.getOne(new LambdaQueryWrapper<BBom>().eq(BBom::getPartsAlias, mMeterial.getMeterialCode()).eq(BBom::getSynFlag, "1"));
         if (bom == null) {
             bom = BBom.builder().build();
             bom.setPartsNo(mMeterial.getMeterialCode()).setBomAlias(mMeterial.getMeterialCode()).setPartsAlias(mMeterial.getMeterialCode()).setBatchNo(mMeterial.getMeterialCode()).setName(bomName).setStatus("1").setSynFlag("1").setImportantFlag("1").setKeyFlag("1").setNo(processNo);
@@ -1048,7 +1050,7 @@ public class MesController extends SuperController<MesNoticeService, Long, MesNo
                 .setStatus("1").setSingleTaskFlag(0).setOrderStatus("1").setBatchNo(workOrder.getString("batchNo"));
         //产品编码+ 密级编码 + 批次号 + 工艺版本
         String orderName = "MES_" + workOrder.getString("materialCode") + "_" + workOrder.getString("planSecretLevel").toUpperCase() + "_" + workOrder.getString("batchNo") + "_" + workOrder.getString("processRouteVersion");
-        order.setCustId(0L).setOrderName(orderName).setZoneId(zone.getId());
+        order.setCustId(0L).setOrderName(orderName).setZoneId(zone.getId()).setAuditStatus("0");
         orderService.save(order);
 
         OrderProduct orderProduct = OrderProduct.builder().build();

+ 29 - 1
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/externalApi/ThreeDimensionalControl.java

@@ -1,5 +1,6 @@
 package com.github.zuihou.business.controller.externalApi;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.zuihou.base.R;
@@ -10,7 +11,10 @@ import com.github.zuihou.business.cutterdata.cuttercategories.service.CutterCate
 import com.github.zuihou.business.externalApi.entity.ThreeCoordinateEntity;
 import com.github.zuihou.business.externalApi.service.PlcService;
 import com.github.zuihou.business.externalApi.service.ThreeCoordinateService;
+import com.github.zuihou.business.operationManagementCenter.dao.OrderQualityMapper;
+import com.github.zuihou.business.operationManagementCenter.entity.OrderQuality;
 import com.github.zuihou.business.util.FileUtil;
+import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
 import com.github.zuihou.log.annotation.SysLog;
@@ -19,7 +23,9 @@ import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
@@ -44,6 +50,9 @@ public class ThreeDimensionalControl  extends SuperController<ThreeCoordinateSer
     @Autowired
     private ThreeCoordinateService threeCoordinateService;
 
+    @Autowired
+    private OrderQualityMapper orderQualityMapper;
+
     @ApiOperation(value = "分页查询线外质检任务", notes = "分页查询线外质检任务")
     @PostMapping("/pageList")
     public R<IPage<ThreeCoordinateEntity>> getCutterPage(@RequestBody @Validated PageParams<ThreeCoordinateEntity> params) {
@@ -67,9 +76,28 @@ public class ThreeDimensionalControl  extends SuperController<ThreeCoordinateSer
 
     @PostMapping(value = "/three-coordinate-test-results")
     @SysLog("接受三坐标检测数据")
-    public R threeCoordinateTestResults(@RequestBody String json) throws Exception{
+    public R threeCoordinateTestResults(@RequestBody JSONObject json) throws Exception{
         log.info("====================接受三坐标数据===================={}",json);
 
+        OrderQuality orderQuality = new OrderQuality();
+        if(json.containsKey("PLCCODE")){
+            orderQuality.setDetectionCommand(json.getString("PLCCODE"));
+        }
+        if(json.containsKey("总OKNG")){
+            orderQuality.setOkFlag(json.getString("总OKNG"));
+        }
+        if(json.containsKey("MeasurementDatas")){
+            orderQuality.setMeasuringReport(JSONArray.toJSONString(json.getJSONArray("MeasurementDatas")));
+        }
+        OrderQuality quality = orderQualityMapper.selectOne(Wraps.<OrderQuality>lbQ().eq(OrderQuality::getDetectionCommand, orderQuality.getDetectionCommand()));
+
+        if(quality!=null){
+            BeanUtils.copyProperties(orderQuality, quality);
+            orderQualityMapper.updateById(quality);
+        }else {
+            orderQualityMapper.insert(quality);
+        }
+
         return R.success();
     }
 

+ 1 - 1
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/entity/TaskNode.java

@@ -77,7 +77,7 @@ public class TaskNode extends Entity<Long> {
      * 编号
      */
     @ApiModelProperty(value = "节点类型")
-    @Length(max = 32, message = "节点类型(1-普通节点2-上下料节点3-质检节点4-翻面5-工件坐标测量)")
+    @Length(max = 32, message = "节点类型(1-普通节点2-上下料节点3-质检节点4-翻面5-工件坐标测量)")
     @TableField(value = "node_type", condition = LIKE)
     @Excel(name = "节点类型")
     private String nodeType;