From e8ed1a91c77ab62a924f12acd55777f227bacd7e Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期五, 21 十一月 2025 17:15:17 +0800
Subject: [PATCH] 工位组删除后,其下工位移动到默认组

---
 smart-man-boot/src/main/java/com/qianwen/smartman/modules/smis/service/impl/WorkstationServiceImpl.java |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/smis/service/impl/WorkstationServiceImpl.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/smis/service/impl/WorkstationServiceImpl.java
index 6ad77b4..1519765 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/smis/service/impl/WorkstationServiceImpl.java
+++ b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/smis/service/impl/WorkstationServiceImpl.java
@@ -152,6 +152,8 @@
     private WorkstationDatapointsService wsDpService;
     @Autowired
     private LicenseWrapper licenseWrapper;
+    @Autowired
+    private WorkstationDatapointsService dataPointService;
     
     private final String NAME = "榛樿宸ヤ綔鍙�";
     private final Integer SORT = 1;
@@ -237,9 +239,12 @@
         }
         return workstationVO;
     }
+    
+    /**
+     * 楠岃瘉璁稿彲涓厤缃殑璁惧鏁伴噺
+     */
     void checkLicenseCount() {
     	
-    
     	Wrapper<Workstation> wrapper = Wrappers.lambdaQuery(Workstation.class).eq(Workstation::getIsDeleted, 0);
     	Long count = workstationMapper.selectCount(wrapper);
     	
@@ -376,6 +381,9 @@
             this.workstationWcsService.deleteByWorkstationIdList(workstationIds);
             this.workstationOfMachineService.remove(Wrappers.<WorkstationOfMachine>lambdaQuery().in(WorkstationOfMachine::getWorkstationId, workstationIds));
             this.commonGroupOfItemService.remove(Wrappers.<CommonGroupOfItem>lambdaQuery().in(CommonGroupOfItem::getItemId, workstationIds));
+            
+            //20250324鏂板锛屽垹闄ゅ伐浣嶅搴旂殑鏁版嵁鐐逛綅閰嶇疆銆�
+            dataPointService.removeByWorkstation(workstationIds);
             /*
             this.workstationOfMachineService.remove((Wrapper) Wrappers.lambdaQuery().in((v0) -> {
                 return v0.getWorkstationId();
@@ -407,7 +415,7 @@
                 return String.valueOf(item.getId());
             }).collect(Collectors.toList()));
         }
-        List<WorkstationVO> workstationVOS = this.workstationMapper.listPage(workStationGroupIdList, workstationVOIPage, keyWord, groupId, CommonGroupConstant.ALL_WORKSTATION_ID, status == null ? CommonConstant.ENABLE : status, type, Integer.valueOf(LocalDate.now().getYear()));
+        List<WorkstationVO> workstationVOS = this.workstationMapper.listPage(workStationGroupIdList, workstationVOIPage, keyWord, groupId, CommonGroupConstant.ALL_WORKSTATION_ID, status, type, LocalDate.now().getYear());
         workstationVOS.forEach(workstationVO -> {
             String calendarName = workstationVO.getCalendarName();
             if (Func.isBlank(calendarName)) {
@@ -524,6 +532,9 @@
     @Override 
     @Transactional(rollbackFor = {Exception.class})
     public Boolean deleteGroup(Long groupId) {
+        commonGroupOfItemService.lambdaUpdate().set(CommonGroupOfItem::getGroupId,CommonGroupConstant.DEFAULT_GROUP_ID)
+                .eq(CommonGroupOfItem::getGroupId, groupId).update();
+
         if (this.commonGroupOfItemService.count(Lambda.eq(CommonGroupOfItem::getGroupId, groupId)) > 0) {
             throw new ServiceException(MessageUtils.message("cps.common.group.production.line.delete.fail", new Object[0]));
         }
@@ -597,7 +608,7 @@
     @Override 
     public IPage<WorkstationRealTimeStatusVO> getRealTimeStatus(WorkstationRealTimeStatusDTO dto, Query query) {
         List<String> workStationGroupIdList = dto.getWorkStationGroupIdList();
-        if (workStationGroupIdList.size() == 1) {
+        if (workStationGroupIdList !=null && workStationGroupIdList.size() == 1) {
             List<String> workStationGroupIdByParentList = getCommonGroupIds(workStationGroupIdList, new ArrayList<>()).stream().map(item -> {
                 return String.valueOf(item.getId());
             }).collect(Collectors.toList());
@@ -665,7 +676,7 @@
 
     @Override 
     public IPage<Workstation> listWorkStationOnShiftIndex(List<String> ids, LocalDate localDate, Query query, Integer shift, Integer type) {
-        return ((WorkstationMapper) this.baseMapper).listWorkStationOnShiftIndex(Condition.getPage(query), Integer.valueOf(localDate.getYear()), DateUtil.formatDate(localDate), shift, type, ids);
+        return this.baseMapper.listWorkStationOnShiftIndex(Condition.getPage(query), localDate.getYear(), DateUtil.formatDate(localDate), shift, type, ids);
     }
 
     @Override 
@@ -1190,6 +1201,7 @@
         
         return list.stream().filter(i -> {
             boolean filter = true;
+
             if (Func.isEmpty(i.getMachineId())) {
                 filter = false;
             }

--
Gitblit v1.9.3