车车 9 ماه پیش
والد
کامیت
4ba8b8beef

+ 13 - 0
ktg-iscs/src/main/java/com/ktg/iscs/controller/IsLotoStationController.java

@@ -11,6 +11,7 @@ import com.ktg.common.pojo.CommonResult;
 import com.ktg.common.utils.SecurityUtils;
 import com.ktg.common.utils.poi.ExcelUtil;
 import com.ktg.iscs.domain.IsLotoStation;
+import com.ktg.iscs.domain.dto.point.BindingPointDTO;
 import com.ktg.iscs.domain.vo.loto.IsLotoStationVO;
 import com.ktg.iscs.domain.vo.workarea.PointsMapVO;
 import com.ktg.iscs.service.IIsLotoStationService;
@@ -138,4 +139,16 @@ public class IsLotoStationController extends BaseController
     public CommonResult<List<PointsMapVO>> selectLotoMapById(Long lotoId, Long sopId, Long ticketId) {
         return CommonResult.success(isLotoStationService.selectLotoMapById(lotoId, sopId, ticketId));
     }
+
+    @ApiOperation("隔离点绑定/解绑电柜")
+    @PreAuthorize("@ss.hasPermi('iscs:station:edit')")
+    @Log(title = "电柜", businessType = BusinessType.UPDATE)
+    @PostMapping("/updatePointsBindingLoto")
+    public CommonResult<Boolean> updatePointsBindingLoto(@RequestBody @Parameter(name = "dto", description = "修改数据类,放到body") BindingPointDTO dto)
+    {
+        return CommonResult.success(isLotoStationService.updatePointsBindingLoto(dto));
+    }
+
+
+
 }

+ 27 - 0
ktg-iscs/src/main/java/com/ktg/iscs/domain/dto/point/BindingPointDTO.java

@@ -0,0 +1,27 @@
+package com.ktg.iscs.domain.dto.point;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 隔离点对象 is_isolation_point
+ *
+ * @author cgj
+ * @date 2024-10-18
+ */
+@Data
+public class BindingPointDTO
+{
+    @ApiModelProperty(value = "电柜ID")
+    private Long lotoId;
+
+    @ApiModelProperty(value = "绑定的隔离点数据")
+    private List<Long> bindingPointIds;
+
+    @ApiModelProperty(value = "解绑的隔离点数据")
+    private List<Long> unbindPointIds;
+
+
+}

+ 3 - 0
ktg-iscs/src/main/java/com/ktg/iscs/domain/dto/point/PagePointDTO.java

@@ -43,4 +43,7 @@ public class PagePointDTO
     @ApiModelProperty(value = "工艺id")
     private Long machineryId;
 
+    @ApiModelProperty(value = "锁定站id")
+    private Long lotoId;
+
 }

+ 3 - 0
ktg-iscs/src/main/java/com/ktg/iscs/service/IIsLotoStationService.java

@@ -3,6 +3,7 @@ package com.ktg.iscs.service;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ktg.iscs.domain.IsLotoStation;
+import com.ktg.iscs.domain.dto.point.BindingPointDTO;
 import com.ktg.iscs.domain.vo.loto.IsLotoStationVO;
 import com.ktg.iscs.domain.vo.workarea.PointsMapVO;
 
@@ -20,4 +21,6 @@ public interface IIsLotoStationService extends IService<IsLotoStation> {
 
     List<PointsMapVO> selectLotoMapById(Long lotoId, Long sopId, Long ticketId);
 
+    Boolean updatePointsBindingLoto(BindingPointDTO dto);
+
 }

+ 20 - 0
ktg-iscs/src/main/java/com/ktg/iscs/service/impl/IsLotoStationServiceImpl.java

@@ -8,9 +8,11 @@ import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.ktg.common.annotation.MarsDataScope;
 import com.ktg.common.utils.StringUtils;
+import com.ktg.iscs.domain.IsIsolationPoint;
 import com.ktg.iscs.domain.IsJobTicketPoints;
 import com.ktg.iscs.domain.IsLotoStation;
 import com.ktg.iscs.domain.IsSopPoints;
+import com.ktg.iscs.domain.dto.point.BindingPointDTO;
 import com.ktg.iscs.domain.vo.loto.IsLotoStationVO;
 import com.ktg.iscs.domain.vo.points.PointDetailVO;
 import com.ktg.iscs.domain.vo.workarea.PointsMapVO;
@@ -131,4 +133,22 @@ public class IsLotoStationServiceImpl extends ServiceImpl<IsLotoStationMapper, I
         }
         return points;
     }
+
+    @Override
+    public Boolean updatePointsBindingLoto(BindingPointDTO dto) {
+        Assert.notNull(dto.getLotoId(), "电柜ID不能为空!");
+        if (!dto.getBindingPointIds().isEmpty()) {
+            // 开始绑定
+            iIsIsolationPointService.update(Wrappers.<IsIsolationPoint>lambdaUpdate()
+                    .in(IsIsolationPoint::getPointId, dto.getBindingPointIds())
+                    .set(IsIsolationPoint::getLotoId, dto.getLotoId()));
+        }
+        if (!dto.getUnbindPointIds().isEmpty()) {
+            // 开始解绑
+            iIsIsolationPointService.update(Wrappers.<IsIsolationPoint>lambdaUpdate()
+                    .in(IsIsolationPoint::getPointId, dto.getUnbindPointIds())
+                    .set(IsIsolationPoint::getLotoId, null));
+        }
+        return true;
+    }
 }

+ 6 - 0
ktg-iscs/src/main/resources/mapper/IsIsolationPointMapper.xml

@@ -215,6 +215,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="dto.machineryId != null">
                 and m.machinery_id = #{dto.machineryId}
             </if>
+            <if test="dto.lotoId != null and dto.lotoId != 0">
+                and p.loto_id = #{dto.lotoId}
+            </if>
+            <if test="dto.lotoId != null and dto.lotoId == 0">
+                and p.loto_id is null
+            </if>
         </where>
             group by p.point_id
             order by p.point_id desc

+ 1 - 1
ktg-iscs/src/main/resources/mapper/IsMaterialsMapper.xml

@@ -163,7 +163,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="dto.materialsCabinetId != null and dto.materialsCabinetId > 0">
                 and m.materials_cabinet_id = #{dto.materialsCabinetId}
             </if>
-            <if test="dto.materialsCabinetId != null and dto.materialsCabinetId = 0">
+            <if test="dto.materialsCabinetId != null and dto.materialsCabinetId == 0">
                 and m.materials_cabinet_id is null
             </if>
             <if test="dto.materialsTypeId != null">