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