Explorar o código

完善opc展示

hfxc226 hai 1 ano
pai
achega
cf0a1320a1

+ 3 - 0
platform-dao/src/main/resources/mapper/remote/RemotePositionMapper.xml

@@ -34,6 +34,9 @@
         <if test="opcFlag != null">
             and position.opc_flag = #{opcFlag}
         </if>
+        <if test="delFlag != null">
+            and position.del_flag = #{delFlag}
+        </if>
         <if test="lightFlag != null">
             and position.light_flag = #{lightFlag}
         </if>

+ 0 - 12
platform-rest/src/main/java/com/platform/rest/controller/remote/RemotePositionController.java

@@ -159,16 +159,4 @@ public class RemotePositionController {
         return new R<>(TreeUtil.buildRemotePositionTreeWithNoParentWithSort(sbPositionService.selectVOList(sbPositionDTO), ""));
     }
 
-    /**
-     * 获取设备树
-     *
-     * @param sbPositionDTO 设备位置DTO
-     * @return R
-     */
-    @GetMapping("/sb/tree")
-    public R queryTreeAll(RemotePositionDTO sbPositionDTO) {
-        return new R<>(sbPositionService.getSbTreeVOList(sbPositionDTO));
-    }
-    
-
 }

+ 0 - 6
platform-service/src/main/java/com/platform/service/remote/RemotePositionService.java

@@ -25,12 +25,6 @@ public interface RemotePositionService extends IBaseService<RemotePosition, Remo
      */
     int batchDelete(List<String> ids);
 
-    /**
-     * @param model :
-     * @return :
-     */
-    List<MyCommonTree> getSbTreeVOList(RemotePositionDTO model);
-
     /**
      * 分页查询
      *

+ 9 - 108
platform-service/src/main/java/com/platform/service/remote/impl/RemotePositionServiceImpl.java

@@ -9,6 +9,7 @@ import com.platform.dao.bean.MyVOPage;
 import com.platform.dao.dto.remote.RemotePositionDTO;
 import com.platform.dao.dto.sqarepartmanage.SparePartUsedDTO;
 import com.platform.dao.entity.part.PartInfo;
+import com.platform.dao.entity.remote.RemoteOpc;
 import com.platform.dao.entity.remote.RemotePosition;
 import com.platform.dao.entity.sb.SbInfo;
 import com.platform.dao.enums.DelFlagEnum;
@@ -16,6 +17,7 @@ import com.platform.dao.enums.IconEnum;
 import com.platform.dao.enums.SbTreeTypeEnum;
 import com.platform.dao.enums.YesNoEnum;
 import com.platform.dao.mapper.part.PartInfoMapper;
+import com.platform.dao.mapper.remote.RemoteOpcMapper;
 import com.platform.dao.mapper.remote.RemotePositionMapper;
 import com.platform.dao.mapper.sb.SbInfoMapper;
 import com.platform.dao.mapper.sqarepartmanage.SparePartUsedMapper;
@@ -53,7 +55,7 @@ public class RemotePositionServiceImpl extends BaseServiceImpl<RemotePositionMap
 
     private final SparePartUsedMapper sparePartUsedMapper;
 
-    private final SbInfoMapper sbInfoMapper;
+    private final RemoteOpcMapper remoteOpcMapper;
 
     @Override
     public void deleteByPrimaryKey(String id) {
@@ -63,12 +65,12 @@ public class RemotePositionServiceImpl extends BaseServiceImpl<RemotePositionMap
             throw new BusinessException("该车间是有工艺流程画面,无法删除");
         }
 
-        Weekend<SbInfo> weekend2 = new Weekend<>(SbInfo.class);
-        WeekendCriteria<SbInfo, Object> weekendCriteria2 = weekend2.weekendCriteria();
-        weekendCriteria2.andEqualTo(SbInfo::getPositionId, id);
-        List<SbInfo> sbInfoList = sbInfoMapper.selectByExample(weekend2);
-        if(!CollectionUtils.isEmpty(sbInfoList)){
-            throw new BusinessException("该车间下面有设备,无法删除,请先转移设备到其他车间");
+        Weekend<RemoteOpc> weekend2 = new Weekend<>(RemoteOpc.class);
+        WeekendCriteria<RemoteOpc, Object> weekendCriteria2 = weekend2.weekendCriteria();
+        weekendCriteria2.andEqualTo(RemoteOpc::getLine, id);
+        List<RemoteOpc> list = remoteOpcMapper.selectByExample(weekend2);
+        if(!CollectionUtils.isEmpty(list)){
+            throw new BusinessException("该车间下面有点位,无法删除,请先转移list到其他工艺流程");
         }
         sbPosition.setDelFlag(DelFlagEnum.DELETED.getValue());
         mapper.updateByPrimaryKeySelective(sbPosition);
@@ -84,7 +86,6 @@ public class RemotePositionServiceImpl extends BaseServiceImpl<RemotePositionMap
 
     @Override
     public RemotePosition saveModelByDTO(RemotePositionDTO model) {
-        model.setOpcFlag(YesNoEnum.YES.getValue());
         model.setLightFlag(YesNoEnum.NO.getValue());
         // 获取父级
         String parentId = model.getParentId();
@@ -122,7 +123,6 @@ public class RemotePositionServiceImpl extends BaseServiceImpl<RemotePositionMap
 
     @Override
     public void modModelByDTO(RemotePositionDTO model) {
-        model.setOpcFlag(YesNoEnum.YES.getValue());
         model.setLightFlag(YesNoEnum.NO.getValue());
         Weekend<RemotePosition> weekend = new Weekend<>(RemotePosition.class);
         WeekendCriteria<RemotePosition, Object> weekendCriteria = weekend.weekendCriteria();
@@ -178,105 +178,6 @@ public class RemotePositionServiceImpl extends BaseServiceImpl<RemotePositionMap
         ExecuteSql.executeNotNull(model.getId(), () -> weekendCriteria.andNotEqualTo(RemotePosition::getId, model.getId()));
     }
 
-    @Override
-    public List<MyCommonTree> getSbTreeVOList(RemotePositionDTO model) {
-        List<SbInfo> sbInfoList = sbInfoMapper.selectAll();
-        // 查询所有的部位
-        List<PartInfo> partInfoList = partInfoMapper.selectAll();
-        // 查询所有使用备件
-        List<SparePartUsedVO> sparePartUsedList = sparePartUsedMapper.selectVOList(new SparePartUsedDTO());
-        // 查询所有设备位置
-        List<RemotePosition> sbPositions = mapper.selectAll();
-        // 处理设备类型
-        List<MyCommonTree> result = ListUtils.newArrayList();
-        Map<String, MyCommonTree> sbPositionTreeMap = MapUtils.newHashMap();
-        sbPositions.forEach(item -> {
-            MyCommonTree vo = new MyCommonTree();
-            vo.setId(item.getId());
-            vo.setKey(SbTreeTypeEnum.POSITION.getValue() + item.getId());
-            vo.setTitle(item.getName());
-            vo.setParentId(item.getParentId());
-            vo.setScopedSlots(new CommonTreeScopedSlots(IconEnum.POSITION.getValue()));
-            sbPositionTreeMap.put(vo.getId(), vo);
-        });
-        sbPositionTreeMap.forEach((key, item) -> {
-            String parentId = item.getParentId();
-            if (StringUtils.isBlank(parentId)) {
-                result.add(item);
-            } else {
-                MyCommonTree vo = sbPositionTreeMap.get(parentId);
-                if (vo != null) {
-                    vo.add(item);
-                }
-            }
-        });
-        // 处理设备
-        Map<String, MyCommonTree> sbInfoTreeMap = MapUtils.newHashMap();
-        sbInfoList.forEach(item -> {
-            MyCommonTree vo = new MyCommonTree();
-            vo.setId(item.getId());
-            vo.setKey(SbTreeTypeEnum.SB_INFO.getValue() + item.getId());
-            vo.setTitle(item.getName());
-            vo.setParentId(item.getParentId());
-            vo.setScopedSlots(new CommonTreeScopedSlots(IconEnum.SB_INFO.getValue()));
-            sbInfoTreeMap.put(vo.getId(), vo);
-        });
-        sbInfoList.forEach(item -> {
-            MyCommonTree vo = sbInfoTreeMap.get(item.getId());
-            if (StringUtils.isNotBlank(item.getParentId())) {
-                MyCommonTree sbInfoTreeVO = sbInfoTreeMap.get(item.getParentId());
-                sbInfoTreeVO.add(vo);
-            } else {
-                MyCommonTree sbPositionTreeVO = sbPositionTreeMap.get(item.getPositionId());
-                if (sbPositionTreeVO == null) {
-                    result.add(vo);
-                } else {
-                    sbPositionTreeVO.add(vo);
-                }
-            }
-        });
-
-        // 处理所有部位
-        Map<String, MyCommonTree> sbPartTreeMap = MapUtils.newHashMap();
-        partInfoList.forEach(item -> {
-            MyCommonTree vo = new MyCommonTree();
-            vo.setId(item.getId());
-            vo.setKey(SbTreeTypeEnum.PART_INFO.getValue() + item.getId());
-            vo.setTitle(item.getName());
-            vo.setParentId(item.getSbId());
-            vo.setScopedSlots(new CommonTreeScopedSlots(IconEnum.PART_INFO.getValue()));
-            sbPartTreeMap.put(vo.getId(), vo);
-        });
-        partInfoList.forEach(item -> {
-            MyCommonTree sbInfoTreeVO = sbInfoTreeMap.get(item.getSbId());
-            if (sbInfoTreeVO != null) {
-                sbInfoTreeVO.add(sbPartTreeMap.get(item.getId()));
-            }
-        });
-        // 处理所有备件
-        Map<String, MyCommonTree> sparePartUsedTreeMap = MapUtils.newHashMap();
-        sparePartUsedList.forEach(item -> {
-            MyCommonTree vo = new MyCommonTree();
-            vo.setId(item.getId());
-            vo.setKey(SbTreeTypeEnum.SPARE_PART_USED.getValue() + item.getId());
-            vo.setTitle(item.getSpareName());
-            vo.setParentId(item.getSbId());
-            vo.setScopedSlots(new CommonTreeScopedSlots(IconEnum.SPARE_PART_USED.getValue()));
-            sparePartUsedTreeMap.put(vo.getId(), vo);
-        });
-        sparePartUsedList.forEach(item -> {
-            MyCommonTree sbInfoTreeVO = sbPartTreeMap.get(item.getPartId());
-            MyCommonTree vo = sparePartUsedTreeMap.get(item.getId());
-            if (sbInfoTreeVO == null) {
-                sbInfoTreeMap.get(item.getSbId()).getChildren().add(vo);
-            } else {
-                sbInfoTreeVO.add(vo);
-            }
-        });
-
-        return result;
-    }
-
     @Override
     public List<RemotePositionVO> selectVOList(RemotePositionDTO model) {
         List<RemotePositionVO> list = mapper.selectVOList(model);