Bladeren bron

作废、sop编辑修改

wangliang 1 jaar geleden
bovenliggende
commit
bda82c915c

+ 13 - 11
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDeviceDeliveryServiceImpl.java

@@ -538,19 +538,21 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
                             DeviceInOutForm.class);
                     deviceSerialNoList.add(deviceInOutForm.getSerialNo());
 
-                    TBDeviceInOut tbDeviceInOut = tbDeviceInOutService.getOne(
+                    List<TBDeviceInOut> tbDeviceInOutList = tbDeviceInOutService.list(
                             new QueryWrapper<TBDeviceInOut>().lambda().eq(TBDeviceInOut::getSopNo, sopNo)
                                     .eq(TBDeviceInOut::getType, InOutTypeEnum.OUT)
-                                    .eq(TBDeviceInOut::getSerialNo, deviceInOutForm.getSerialNo()));
-                    if (Objects.nonNull(tbDeviceInOut)) {
-                        SysDevice sysDevice = sysDeviceService.getOne(new QueryWrapper<SysDevice>().lambda()
-                                .eq(SysDevice::getSerialNo, deviceInOutForm.getSerialNo()));
-                        sysDevice.setLocation(tbDeviceInOut.getLocation());
-                        sysDevice.setLocationArr(tbDeviceInOut.getAddressArr());
-                        sysDevice.updateInfo(userId);
-
-                        tbDeviceInOutService.removeById(tbDeviceInOut.getId());
-                        sysDeviceService.updateById(sysDevice);
+                                    .eq(TBDeviceInOut::getDeviceSerialNo, deviceInOutForm.getSerialNo()));
+                    if (!org.springframework.util.CollectionUtils.isEmpty(tbDeviceInOutList)) {
+                        for (TBDeviceInOut tbDeviceInOut : tbDeviceInOutList) {
+                            SysDevice sysDevice = sysDeviceService.getOne(new QueryWrapper<SysDevice>().lambda()
+                                    .eq(SysDevice::getSerialNo, deviceInOutForm.getSerialNo()));
+                            sysDevice.setLocation(tbDeviceInOut.getLocation());
+                            sysDevice.setLocationArr(tbDeviceInOut.getAddressArr());
+                            sysDevice.updateInfo(userId);
+                            sysDeviceService.updateById(sysDevice);
+                        }
+                        tbDeviceInOutService.removeByIds(
+                                tbDeviceInOutList.stream().map(s -> s.getId()).collect(Collectors.toList()));
                     }
                 }
             }