Commit f6a3966b8376cb60c5fd18377b7e84a8b287d5cc

Authored by 李泰瑜
1 parent efa0cdae

改掉盘点主表能直接删除无视下面的明细,盘点明细删除不改变锁定状态

src/main/java/com/huaheng/pc/config/location/service/LocationService.java
... ... @@ -114,4 +114,6 @@ public interface LocationService extends IService<Location>{
114 114 int getLastRowOfZone(String warehouseCode, String zoneCode);
115 115  
116 116 public List<Location> remoteList(String type);
  117 +
  118 + void upstatus(String code);
117 119 }
... ...
src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java
... ... @@ -2,6 +2,7 @@ package com.huaheng.pc.config.location.service;
2 2  
3 3 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  5 +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
5 6 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
6 7 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 8 import com.huaheng.common.constant.QuantityConstant;
... ... @@ -24,7 +25,7 @@ import java.text.MessageFormat;
24 25 import java.util.*;
25 26  
26 27 @Service("LocationService")
27   -public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> implements LocationService{
  28 +public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> implements LocationService {
28 29  
29 30 @Resource
30 31 private LocationService locationService;
... ... @@ -41,17 +42,18 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
41 42 * //新增库位,需要建立code,并判断是否重复
42 43 * 1. 库区和库位没有绝对关系。 先建立库区,然后在库区的位置进行建立库位类型。
43 44 * TODO:胡海--在判断库位类型和库区是否匹配,应该用库位类型表进行判断。库位类型在库区存在即可
  45 + *
44 46 * @param location
45 47 * @return
46 48 */
47 49 @Override
48   - public AjaxResult addsave(Location location){
  50 + public AjaxResult addsave(Location location) {
49 51  
50 52 //库区与库位类型的匹配判断
51   - if(!location.getZoneCode().equals(location.getLocationType())){
52   - throw new ServiceException(location.getLocationType()+"的库位类型与"+location.getZoneCode()+"库区不匹配");
  53 + if (!location.getZoneCode().equals(location.getLocationType())) {
  54 + throw new ServiceException(location.getLocationType() + "的库位类型与" + location.getZoneCode() + "库区不匹配");
53 55 }
54   - //TODO:胡海-- 库位编码长度应该是弹性的,即我们的库位是由4个维度组成的,正常情况下 平库(行列) 立体仓库(行列层) AGV料架库(行列层格)
  56 + //TODO:胡海-- 库位编码长度应该是弹性的,即我们的库位是由4个维度组成的,正常情况下 平库(行列) 立体仓库(行列层) AGV料架库(行列层格)
55 57 // 这里可以判断下 然后决定库位编码长度。
56 58 //创建库位编码code
57 59 String prefix = location.getLocationType();
... ... @@ -63,9 +65,9 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
63 65  
64 66 //判断code是否重复
65 67 LambdaQueryWrapper<Location> lam = Wrappers.lambdaQuery();
66   - lam.eq(Location::getWarehouseCode,ShiroUtils.getWarehouseCode())
67   - .eq(Location::getCode,code);
68   - if(this.getOne(lam)!=null){
  68 + lam.eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode())
  69 + .eq(Location::getCode, code);
  70 + if (this.getOne(lam) != null) {
69 71 return AjaxResult.error("该位置已有库位生成,请重新输入位置");
70 72 }
71 73  
... ... @@ -73,8 +75,8 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
73 75 location.setCode(code);
74 76 location.setWarehouseCode(ShiroUtils.getWarehouseCode());
75 77 location.setCreatedBy(ShiroUtils.getLoginName());
76   - Boolean flag=this.save(location);
77   - if(flag == false){
  78 + Boolean flag = this.save(location);
  79 + if (flag == false) {
78 80 return AjaxResult.error("新增库位失败,插入数据库时失败");
79 81 }
80 82 return AjaxResult.success("新增库位成功");
... ... @@ -82,6 +84,7 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
82 84  
83 85 /**
84 86 * 批量新增库位
  87 + *
85 88 * @param location
86 89 * @return boolean
87 90 */
... ... @@ -89,32 +92,32 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
89 92 public boolean insertLocation(Location location) {
90 93 /* 判断库位类型编码是否存在*/
91 94 LambdaQueryWrapper<LocationType> typeLambda = Wrappers.lambdaQuery();
92   - typeLambda.eq(LocationType::getCode,location.getLocationType())
93   - .select(LocationType::getCode);
  95 + typeLambda.eq(LocationType::getCode, location.getLocationType())
  96 + .select(LocationType::getCode);
94 97 List<Map<String, Object>> list = locationTypeService.listMaps(typeLambda);
95   - if (list.size() < 1){
  98 + if (list.size() < 1) {
96 99 throw new ServiceException("库位类型编码不存在");
97 100 }
98 101  
99 102 /* 判断库区编码是否存在*/
100   - LambdaQueryWrapper<Zone> zoneLambda= Wrappers.lambdaQuery();
  103 + LambdaQueryWrapper<Zone> zoneLambda = Wrappers.lambdaQuery();
101 104 zoneLambda.eq(Zone::getCode, location.getZoneCode())
102 105 .select(Zone::getCode);
103 106  
104 107 list = zoneService.listMaps(zoneLambda);
105   - if (list.size() < 1){
  108 + if (list.size() < 1) {
106 109 throw new ServiceException("库区编码不存在");
107 110 }
108 111 //TODO:胡海--在判断库位类型和库区是否匹配,应该用库位类型表进行判断。库位类型在库区存在即可
109   - if(!location.getZoneCode().equals(location.getLocationType())){
110   - throw new ServiceException(location.getLocationType()+"的库位类型与"+location.getZoneCode()+"库区不匹配");
  112 + if (!location.getZoneCode().equals(location.getLocationType())) {
  113 + throw new ServiceException(location.getLocationType() + "的库位类型与" + location.getZoneCode() + "库区不匹配");
111 114 }
112 115  
113 116 List<Location> locations = new ArrayList<>();
114   - for (int i=1; i<=location.getIRow().intValue(); i++) {
115   - for (int j=1; j<=location.getIColumn().intValue(); j++) {
116   - for (int k=1; k<=location.getILayer().intValue(); k++) {
117   - for (int m=1; m<=location.getIGrid().intValue(); m++) {
  117 + for (int i = 1; i <= location.getIRow().intValue(); i++) {
  118 + for (int j = 1; j <= location.getIColumn().intValue(); j++) {
  119 + for (int k = 1; k <= location.getILayer().intValue(); k++) {
  120 + for (int m = 1; m <= location.getIGrid().intValue(); m++) {
118 121 //Integer roadway = (j / 2) + 1;
119 122 Location param = new Location();
120 123 param.setIRow(i);
... ... @@ -135,8 +138,8 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
135 138 String.format("%02d", k));
136 139 //查询该库位编码是否存在
137 140 LambdaQueryWrapper<Location> queryWrapper = Wrappers.lambdaQuery();
138   - queryWrapper.eq(Location::getCode,code)
139   - .eq(Location::getWarehouseCode,ShiroUtils.getWarehouseCode());
  141 + queryWrapper.eq(Location::getCode, code)
  142 + .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode());
140 143 List<Location> locationList = locationService.list(queryWrapper);
141 144 if (locationList.size() == 0) {
142 145 param.setCode(code);
... ... @@ -146,38 +149,38 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
146 149 }
147 150 }
148 151 }
149   - int num =0;
  152 + int num = 0;
150 153 List<Location> locations1 = new ArrayList<>();
151   - if(locations.size() >1000 ){
152   - for(Location item : locations){
  154 + if (locations.size() > 1000) {
  155 + for (Location item : locations) {
153 156 num++;
154 157 locations1.add(item);
155   - if(num % 1000 ==0 || num == locations.size()){
  158 + if (num % 1000 == 0 || num == locations.size()) {
156 159 locationMapper.addList(locations1);
157   - locations1=new ArrayList<>();
  160 + locations1 = new ArrayList<>();
158 161 }
159 162 }
160   - }else {
  163 + } else {
161 164 locationMapper.addList(locations);
162 165 }
163 166  
164 167 List<Integer> integerList = new ArrayList<>();
165   - for(Location location2 : locations) {
166   - if(integerList.size() == 0) {
  168 + for (Location location2 : locations) {
  169 + if (integerList.size() == 0) {
167 170 integerList.add(location2.getIRow());
168 171 } else {
169   - for(int i = 0; i< integerList.size(); i++) {
170   - if(integerList.get(i).intValue() == location2.getIRow().intValue()) {
  172 + for (int i = 0; i < integerList.size(); i++) {
  173 + if (integerList.get(i).intValue() == location2.getIRow().intValue()) {
171 174 break;
172 175 } else {
173   - if(i == (integerList.size() - 1)) {
  176 + if (i == (integerList.size() - 1)) {
174 177 integerList.add(location2.getIRow());
175 178 }
176 179 }
177 180 }
178 181 }
179 182 }
180   - if(integerList.size() == 4) {
  183 + if (integerList.size() == 4) {
181 184 for (Location location3 : locations) {
182 185 for (int i = 0; i < integerList.size(); i++) {
183 186 if (location3.getIRow().intValue() == integerList.get(i).intValue()) {
... ... @@ -201,32 +204,32 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
201 204 typeLambda.eq(LocationType::getCode, locationType)
202 205 .select(LocationType::getCode);
203 206 List<Map<String, Object>> list = locationTypeService.listMaps(typeLambda);
204   - if (list.size() < 1){
  207 + if (list.size() < 1) {
205 208 throw new ServiceException("库位类型编码不存在");
206 209 }
207 210  
208 211 /* 判断库区编码是否存在*/
209   - LambdaQueryWrapper<Zone> zoneLambda= Wrappers.lambdaQuery();
  212 + LambdaQueryWrapper<Zone> zoneLambda = Wrappers.lambdaQuery();
210 213 zoneLambda.eq(Zone::getCode, zoneCode)
211 214 .select(Zone::getCode);
212 215  
213 216 list = zoneService.listMaps(zoneLambda);
214   - if (list.size() < 1){
  217 + if (list.size() < 1) {
215 218 throw new ServiceException("库区编码不存在");
216 219 }
217 220 //TODO:胡海--在判断库位类型和库区是否匹配,应该用库位类型表进行判断。库位类型在库区存在即可
218 221 /* if(!zoneCode.equals(locationType)){
219 222 throw new ServiceException(locationType+"的库位类型与"+ zoneCode +"库区不匹配");
220 223 }*/
221   - LambdaQueryWrapper<Zone> zoneLambdaQueryWrapper = Wrappers.lambdaQuery();
222   - zoneLambdaQueryWrapper.eq(Zone::getCode, zoneCode);
223   - Zone zone = zoneService.getOne(zoneLambdaQueryWrapper);
224   - String area = zone.getArea();
225   - List<Location> locations = new ArrayList<>(); // 为零?
226   - for (int i=firstRow.intValue(); i<=lastRow.intValue(); i++) {
227   - for (int j=firstColumn.intValue(); j<=lastColumn.intValue(); j++) {
228   - for (int k=firstLayer.intValue(); k<=lastLayer.intValue(); k++) {
229   - for (int m=firstGrid.intValue(); m<=lastGrid.intValue(); m++) {
  224 + LambdaQueryWrapper<Zone> zoneLambdaQueryWrapper = Wrappers.lambdaQuery();
  225 + zoneLambdaQueryWrapper.eq(Zone::getCode, zoneCode);
  226 + Zone zone = zoneService.getOne(zoneLambdaQueryWrapper);
  227 + String area = zone.getArea();
  228 + List<Location> locations = new ArrayList<>(); // 为零?
  229 + for (int i = firstRow.intValue(); i <= lastRow.intValue(); i++) {
  230 + for (int j = firstColumn.intValue(); j <= lastColumn.intValue(); j++) {
  231 + for (int k = firstLayer.intValue(); k <= lastLayer.intValue(); k++) {
  232 + for (int m = firstGrid.intValue(); m <= lastGrid.intValue(); m++) {
230 233 //Integer roadway = (j / 2) + 1;
231 234 Location param = new Location();
232 235 param.setIRow(i);
... ... @@ -249,8 +252,8 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
249 252 String.format("%02d", k));
250 253 //查询该库位编码是否存在
251 254 LambdaQueryWrapper<Location> queryWrapper = Wrappers.lambdaQuery();
252   - queryWrapper.eq(Location::getCode,code)
253   - .eq(Location::getWarehouseCode,ShiroUtils.getWarehouseCode());
  255 + queryWrapper.eq(Location::getCode, code)
  256 + .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode());
254 257 List<Location> locationList = locationService.list(queryWrapper);
255 258 if (locationList.size() == 0) {
256 259 param.setCode(code);
... ... @@ -261,38 +264,38 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
261 264 }
262 265 }
263 266  
264   - int num =0;
  267 + int num = 0;
265 268 List<Location> locations1 = new ArrayList<>();
266   - if(locations.size() >1000 ){
267   - for(Location item : locations){
  269 + if (locations.size() > 1000) {
  270 + for (Location item : locations) {
268 271 num++;
269 272 locations1.add(item);
270   - if(num % 1000 ==0 || num == locations.size()){
  273 + if (num % 1000 == 0 || num == locations.size()) {
271 274 locationMapper.addList(locations1);
272   - locations1=new ArrayList<>();
  275 + locations1 = new ArrayList<>();
273 276 }
274 277 }
275   - }else {
  278 + } else {
276 279 locationMapper.addList(locations);
277 280 }
278 281  
279 282 List<Integer> integerList = new ArrayList<>();
280   - for(Location location2 : locations) {
281   - if(integerList.size() == 0) {
  283 + for (Location location2 : locations) {
  284 + if (integerList.size() == 0) {
282 285 integerList.add(location2.getIRow());
283 286 } else {
284   - for(int i = 0; i< integerList.size(); i++) {
285   - if(integerList.get(i).intValue() == location2.getIRow().intValue()) {
  287 + for (int i = 0; i < integerList.size(); i++) {
  288 + if (integerList.get(i).intValue() == location2.getIRow().intValue()) {
286 289 break;
287 290 } else {
288   - if(i == (integerList.size() - 1)) {
  291 + if (i == (integerList.size() - 1)) {
289 292 integerList.add(location2.getIRow());
290 293 }
291 294 }
292 295 }
293 296 }
294 297 }
295   - if(integerList.size() == 4) {
  298 + if (integerList.size() == 4) {
296 299 for (Location location3 : locations) {
297 300 for (int i = 0; i < integerList.size(); i++) {
298 301 if (location3.getIRow().intValue() == integerList.get(i).intValue()) {
... ... @@ -312,6 +315,7 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
312 315  
313 316 /**
314 317 * 根据库位编码对库位表格的状态进行更新
  318 + *
315 319 * @param locationCode
316 320 * @param status
317 321 */
... ... @@ -331,17 +335,18 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
331 335  
332 336 /**
333 337 * 通过定位规则查找库位
  338 + *
334 339 * @param locatingRule
335 340 * @return
336 341 */
337 342 @Override
338   - public String position(String locatingRule){
  343 + public String position(String locatingRule) {
339 344 return locationMapper.position(locatingRule).getCode();
340 345 }
341 346  
342 347 /**
343 348 * 修改容器和库位状态
344   - * */
  349 + */
345 350 @Override
346 351 public void updateContainerCodeAndStatus(String locationCode, String containerCode, String status) {
347 352 if (StringUtils.isNotEmpty(locationCode) || StringUtils.isNotEmpty(containerCode)) {
... ... @@ -392,17 +397,17 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
392 397 public boolean checkLocation(String code) {
393 398 LambdaQueryWrapper<Location> queryWrapper = Wrappers.lambdaQuery();
394 399 queryWrapper.eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode())
395   - .eq(Location::getDeleted,false)
  400 + .eq(Location::getDeleted, false)
396 401 .eq(Location::getCode, code);
397 402 List<Location> locations = list(queryWrapper);
398   - if (locations.size() >= 1){
  403 + if (locations.size() >= 1) {
399 404 Location location = locations.get(0);
400   - String containerCode =location.getContainerCode();
  405 + String containerCode = location.getContainerCode();
401 406 if (containerCode != null && containerCode.length() > 0) {
402 407 throw new ServiceException("货架上已有容器");
403 408 }
404 409 String status = location.getStatus();
405   - if(!QuantityConstant.STATUS_LOCATION_EMPTY.equals(status)) {
  410 + if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(status)) {
406 411 throw new ServiceException("库位状态不为空");
407 412 }
408 413 return true;
... ... @@ -419,7 +424,7 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
419 424 .eq(Location::getDeleted, false)
420 425 .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY);
421 426 List<Location> locations = locationService.list(lambdaQueryWrapper);
422   - if(locations != null && locations.size() > 0) {
  427 + if (locations != null && locations.size() > 0) {
423 428 return true;
424 429 }
425 430 return false;
... ... @@ -427,6 +432,7 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
427 432  
428 433 /**
429 434 * 查询库位利用率
  435 + *
430 436 * @return
431 437 */
432 438 @Override
... ... @@ -436,6 +442,7 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
436 442  
437 443 /**
438 444 * 根据库位编码查询库位信息
  445 + *
439 446 * @param code
440 447 * @return
441 448 */
... ... @@ -475,11 +482,11 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
475 482 queryWrapper.eq(Location::getLocationType, location.getLocationType());
476 483 queryWrapper.eq(Location::getRowFlag, QuantityConstant.ROW_IN);
477 484 List<Location> locationList = list(queryWrapper);
478   - for(Location location1 : locationList) {
479   - int diff = Math.abs(location1.getIRow().intValue() - location.getIRow().intValue());
480   - if(diff == 1) {
481   - return location1;
482   - }
  485 + for (Location location1 : locationList) {
  486 + int diff = Math.abs(location1.getIRow().intValue() - location.getIRow().intValue());
  487 + if (diff == 1) {
  488 + return location1;
  489 + }
483 490 }
484 491 return null;
485 492 }
... ... @@ -495,9 +502,9 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
495 502 queryWrapper.eq(Location::getLocationType, location.getLocationType());
496 503 queryWrapper.eq(Location::getRowFlag, QuantityConstant.ROW_OUT);
497 504 List<Location> locationList = list(queryWrapper);
498   - for(Location location1 : locationList) {
  505 + for (Location location1 : locationList) {
499 506 int diff = Math.abs(location1.getIRow().intValue() - location.getIRow().intValue());
500   - if(diff == 1) {
  507 + if (diff == 1) {
501 508 return location1;
502 509 }
503 510 }
... ... @@ -508,7 +515,7 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
508 515 public Location getNear(Location location) {
509 516 int rowFlag = location.getRowFlag().intValue();
510 517 Location locaiton2 = null;
511   - if(rowFlag == 1) {
  518 + if (rowFlag == 1) {
512 519 locaiton2 = getInsideNear(location);
513 520 } else {
514 521 locaiton2 = getOutSideNear(location);
... ... @@ -518,13 +525,13 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
518 525  
519 526 private boolean getOutSideCanMove(Location location) {
520 527 Location locaiton2 = getInsideNear(location);
521   - if(!locaiton2.getStatus().equals(QuantityConstant.STATUS_LOCATION_EMPTY)) {
522   - return false;
  528 + if (!locaiton2.getStatus().equals(QuantityConstant.STATUS_LOCATION_EMPTY)) {
  529 + return false;
523 530 }
524   - if(!locaiton2.getContainerCode().equals("")) {
  531 + if (!locaiton2.getContainerCode().equals("")) {
525 532 return false;
526 533 }
527   - return true;
  534 + return true;
528 535 }
529 536  
530 537 @Override
... ... @@ -540,16 +547,18 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
540 547 List<Location> locationList = list(queryWrapper);
541 548 List<Location> removeLocationList = new ArrayList<>();
542 549 int column = location.getIColumn();
543   - Collections.sort(locationList, new Comparator<Location>(){
  550 + Collections.sort(locationList, new Comparator<Location>() {
544 551 @Override
545 552 public int compare(Location o1, Location o2) {
546 553 int dvalue1 = Math.abs(o1.getIColumn() - column);
547 554 int dvalue2 = Math.abs(o2.getIColumn() - column);
548 555 return dvalue1 - dvalue2;
549 556 }
550   - ; });
  557 +
  558 + ;
  559 + });
551 560 int removeSize = 0;
552   - for(int i=0; i < locationList.size(); i++) {
  561 + for (int i = 0; i < locationList.size(); i++) {
553 562 Location location1 = locationList.get(i);
554 563 if (taskHeaderService.getUncompleteTaskInNear(location1) > 0) {
555 564 removeLocationList.add(location1);
... ... @@ -563,7 +572,7 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
563 572 }
564 573 }
565 574 locationList.removeAll(removeLocationList);
566   - if(locationList == null || locationList.size() <= 0) {
  575 + if (locationList == null || locationList.size() <= 0) {
567 576 return null;
568 577 }
569 578 Location location1 = locationList.get(0);
... ... @@ -584,7 +593,7 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
584 593 List<Location> locationList = list(queryWrapper);
585 594 List<Location> removeLocaationList = new ArrayList<>();
586 595 int column = location.getIColumn();
587   - Collections.sort(locationList, new Comparator<Location>(){
  596 + Collections.sort(locationList, new Comparator<Location>() {
588 597 @Override
589 598 public int compare(Location o1, Location o2) {
590 599 int dvalue1 = Math.abs(o1.getIColumn() - column);
... ... @@ -593,7 +602,7 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
593 602 }
594 603 });
595 604 int removeSize = 0;
596   - for(int i=0; i < locationList.size(); i++) {
  605 + for (int i = 0; i < locationList.size(); i++) {
597 606 Location location1 = locationList.get(i);
598 607 if (taskHeaderService.getUncompleteTaskInNear(location1) > 0) {
599 608 removeLocaationList.add(location1);
... ... @@ -604,7 +613,7 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
604 613 }
605 614 }
606 615 locationList.removeAll(removeLocaationList);
607   - if(locationList == null || locationList.size() <= 0) {
  616 + if (locationList == null || locationList.size() <= 0) {
608 617 return null;
609 618 }
610 619 Location location1 = locationList.get(0);
... ... @@ -635,10 +644,21 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
635 644 LambdaQueryWrapper<Location> wrapper = Wrappers.lambdaQuery();
636 645 if ("status".equals(type)) {
637 646 wrapper.eq(Location::getStatus, "lock");
638   - }else if ("container".equals(type)){
  647 + } else if ("container".equals(type)) {
639 648 wrapper.isNotNull(Location::getContainerCode)
640   - .ne(Location::getContainerCode,"");
  649 + .ne(Location::getContainerCode, "");
641 650 }
642 651 return list(wrapper);
643 652 }
  653 +
  654 + @Override
  655 + public void upstatus(String code) {
  656 + Location user = new Location();
  657 + user.setStatus("empty");
  658 + //修改条件s
  659 + UpdateWrapper<Location> userUpdateWrapper = new UpdateWrapper<>();
  660 + userUpdateWrapper.eq("containerCode", code);
  661 + int update = locationMapper.update(user, userUpdateWrapper);
  662 + System.out.println(update);
  663 + }
644 664 }
... ...
src/main/java/com/huaheng/pc/inventory/cycleCountDetail/controller/CycleCountDetailController.java
... ... @@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
6 6 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7   -import com.huaheng.common.constant.QuantityConstant;
8 7 import com.huaheng.common.support.Convert;
9 8 import com.huaheng.common.utils.StringUtils;
10 9 import com.huaheng.common.utils.security.ShiroUtils;
... ... @@ -20,7 +19,6 @@ import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail;
20 19 import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetailChild;
21 20 import com.huaheng.pc.inventory.cycleCountDetail.service.CycleCountDetailChildService;
22 21 import com.huaheng.pc.inventory.cycleCountDetail.service.CycleCountDetailService;
23   -import com.huaheng.pc.inventory.inventoryHeader.domain.InventoryHeader;
24 22 import com.huaheng.pc.task.taskHeader.service.CycleCountTaskService;
25 23 import org.apache.shiro.authz.annotation.RequiresPermissions;
26 24 import org.springframework.stereotype.Controller;
... ... @@ -43,6 +41,7 @@ import java.util.List;
43 41 @RequestMapping("/inventory/cycleCountDetail")
44 42 public class CycleCountDetailController extends BaseController {
45 43  
  44 +
46 45 @Resource
47 46 private LocationService locationService;
48 47 @Resource
... ... @@ -197,18 +196,16 @@ public class CycleCountDetailController extends BaseController {
197 196 return AjaxResult.error("删除的明细id不能为空");
198 197 }
199 198 Integer[] detailsIds = Convert.toIntArray(ids);
  199 +
200 200 for(int i = 0; i < detailsIds.length; i++){
201 201 Integer id = detailsIds[i];
  202 + String code = cycleCountDetailService.getById(detailsIds[i]).getContainerCode();
202 203 AjaxResult ajaxResult = cycleCountDetailService.removeDetail(id);
  204 + locationService.upstatus(code);
203 205 if(ajaxResult.getCode() != 200){
204 206 return ajaxResult;
205 207 }
206   - CycleCountDetail aa = cycleCountDetailService.getcode(id);
207   -
208   - locationService.updateStatus(aa.getLocationCode(), QuantityConstant.STATUS_LOCATION_EMPTY);
209   -
210 208 }
211   -
212 209 return AjaxResult.success("删除成功!");
213 210 }
214 211  
... ...
src/main/java/com/huaheng/pc/inventory/cycleCountHeader/controller/CycleCountHeaderController.java
... ... @@ -14,6 +14,7 @@ import com.huaheng.framework.web.domain.AjaxResult;
14 14 import com.huaheng.framework.web.page.PageDomain;
15 15 import com.huaheng.framework.web.page.TableDataInfo;
16 16 import com.huaheng.framework.web.page.TableSupport;
  17 +import com.huaheng.pc.inventory.cycleCountDetail.controller.CycleCountDetailController;
17 18 import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail;
18 19 import com.huaheng.pc.inventory.cycleCountDetail.service.CycleCountDetailService;
19 20 import com.huaheng.pc.inventory.cycleCountHeader.domain.CycleCountHeader;
... ... @@ -41,7 +42,6 @@ public class CycleCountHeaderController extends BaseController {
41 42 private CycleCountDetailService cycleCountDetailService;
42 43  
43 44  
44   -
45 45 private String prefix = "inventory/cycleCountHeader";
46 46  
47 47  
... ... @@ -159,11 +159,21 @@ public class CycleCountHeaderController extends BaseController {
159 159 }
160 160 for (Integer id : Convert.toIntArray(ids))
161 161 {
  162 + String code = cycleCountHeaderService.getById(id).getCode();
  163 + LambdaQueryWrapper<CycleCountDetail> lambdaQueryWrapper = Wrappers.lambdaQuery();
  164 + lambdaQueryWrapper.eq(CycleCountDetail::getCycleCountHeadCode,code);
  165 + List<CycleCountDetail> list = cycleCountDetailService.list(lambdaQueryWrapper);
  166 + if (list.size()>0)
  167 + {
  168 + return AjaxResult.error("盘点下有明细,删除失败!");
  169 + }
  170 +
162 171 AjaxResult result = cycleCountHeaderService.delete(id);
163 172  
164 173 if(result.code!=200){
165 174 return result;
166 175 }
  176 +
167 177 }
168 178 return AjaxResult.success("删除成功!");
169 179 }
... ...