Commit 924561fc606579454d2bb3046fc0c9ef232623ad
Merge branch 'develop' of http://172.16.29.40:8010/wms/wms2 into develop
Showing
17 changed files
with
127 additions
and
81 deletions
src/main/java/com/huaheng/api/wcs/controller/EmptyOutHandle.java
... | ... | @@ -32,7 +32,7 @@ public class EmptyOutHandle extends BaseController { |
32 | 32 | @ResponseBody |
33 | 33 | public AjaxResult EmptyOutHandle(@RequestBody Map<String,String> map) { |
34 | 34 | String taskNo = map.get("taskNo"); |
35 | - AjaxResult ajaxResult =emptyOutHandleService.EmptyOutHandle(taskNo); | |
35 | + AjaxResult ajaxResult = emptyOutHandleService.EmptyOutHandle(taskNo); | |
36 | 36 | return ajaxResult; |
37 | 37 | } |
38 | 38 | |
... | ... |
src/main/java/com/huaheng/api/wcs/controller/OverrideHandle.java
... | ... | @@ -7,8 +7,10 @@ import com.huaheng.framework.aspectj.lang.annotation.Log; |
7 | 7 | import com.huaheng.framework.aspectj.lang.constant.BusinessType; |
8 | 8 | import com.huaheng.framework.web.controller.BaseController; |
9 | 9 | import com.huaheng.framework.web.domain.AjaxResult; |
10 | +import com.huaheng.pc.receipt.reservation.domain.Reservation; | |
10 | 11 | import io.swagger.annotations.Api; |
11 | 12 | import io.swagger.annotations.ApiOperation; |
13 | +import io.swagger.annotations.ApiParam; | |
12 | 14 | import org.springframework.web.bind.annotation.*; |
13 | 15 | |
14 | 16 | import javax.annotation.Resource; |
... | ... | @@ -28,12 +30,11 @@ public class OverrideHandle extends BaseController { |
28 | 30 | private OverrideHandleService overrideHandleService; |
29 | 31 | |
30 | 32 | @Log(title = "wcs重入处理", action = BusinessType.INSERT) |
31 | - @PostMapping("/ReenterHandle") | |
33 | + @PostMapping("/reenterHandle") | |
32 | 34 | @ApiOperation("wcs重入处理") |
33 | 35 | @ResponseBody |
34 | - public AjaxResult ReenterHandle(@RequestBody TaskFinishDomain taskFinishDomain) { | |
36 | + public AjaxResult reenterHandle(@RequestBody TaskFinishDomain taskFinishDomain) { | |
35 | 37 | return overrideHandleService.OverrideHandle(taskFinishDomain); |
36 | 38 | } |
37 | 39 | |
38 | - | |
39 | 40 | } |
... | ... |
src/main/java/com/huaheng/api/wcs/controller/TaskFinish.java
... | ... | @@ -32,9 +32,9 @@ public class TaskFinish extends BaseController { |
32 | 32 | @PostMapping("/complete") |
33 | 33 | @ApiOperation("wcs任务完成") |
34 | 34 | @ResponseBody |
35 | - public AjaxResult TaskFinish(@RequestBody TaskFinishDomain taskFinishDomain) | |
35 | + public AjaxResult complete(@RequestBody TaskFinishDomain taskFinishDomain) | |
36 | 36 | { |
37 | - AjaxResult ajaxResult =taskFinishService.completeTaskByWCS(taskFinishDomain) ; | |
37 | + AjaxResult ajaxResult = taskFinishService.completeTaskByWCS(taskFinishDomain); | |
38 | 38 | return ajaxResult; |
39 | 39 | } |
40 | 40 | |
... | ... |
src/main/java/com/huaheng/api/wcs/domain/TaskFinishDomain.java
src/main/java/com/huaheng/api/wcs/service/emptyOutHandle/EmptyOutHandleServiceImpl.java
1 | 1 | package com.huaheng.api.wcs.service.emptyOutHandle; |
2 | 2 | |
3 | 3 | import com.huaheng.api.wcs.domain.WcsTask; |
4 | +import com.huaheng.common.constant.QuantityConstant; | |
4 | 5 | import com.huaheng.common.utils.StringUtils; |
5 | 6 | import com.huaheng.framework.web.domain.AjaxResult; |
6 | 7 | import com.huaheng.pc.task.taskHeader.domain.TaskHeader; |
... | ... | @@ -35,17 +36,19 @@ public class EmptyOutHandleServiceImpl implements EmptyOutHandleService { |
35 | 36 | |
36 | 37 | //2、根据任务号查找任务 |
37 | 38 | TaskHeader taskHeader = taskHeaderService.getById(Integer.valueOf(taskNo)); |
38 | - if(taskHeader == null){ | |
39 | + if(taskHeader == null) { | |
39 | 40 | return AjaxResult.error("任务号错误,没有找到该任务"); |
40 | 41 | } |
41 | - if(taskHeader.getStatus() == 100){ | |
42 | + | |
43 | + if(taskHeader.getStatus().intValue() == QuantityConstant.TASK_STATUS_COMPLETED){ | |
42 | 44 | return AjaxResult.error("任务已完成"); |
43 | 45 | } |
44 | 46 | |
45 | 47 | //3、修改该任务为空出,过后处理 |
46 | 48 | taskHeader.setExceptionCode("空出处理"); |
49 | + taskHeader.setIsEmptyOut(QuantityConstant.EMPTY_OUT); | |
47 | 50 | Boolean flag = taskHeaderService.updateById(taskHeader); |
48 | - if(flag == false){ | |
51 | + if(flag == false) { | |
49 | 52 | return AjaxResult.error("修改任务失败,空出处理失败"); |
50 | 53 | } |
51 | 54 | return AjaxResult.success("空出处理成功"); |
... | ... |
src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleServiceImpl.java
... | ... | @@ -5,12 +5,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
5 | 5 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
6 | 6 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
7 | 7 | import com.huaheng.api.wcs.domain.TaskFinishDomain; |
8 | +import com.huaheng.api.wcs.service.warecellAllocation.LocationAllocationService; | |
8 | 9 | import com.huaheng.api.wcs.service.warecellAllocation.WarecellAllocationService; |
9 | 10 | import com.huaheng.common.constant.QuantityConstant; |
10 | 11 | import com.huaheng.common.exception.service.ServiceException; |
11 | 12 | import com.huaheng.common.utils.StringUtils; |
12 | 13 | import com.huaheng.common.utils.security.ShiroUtils; |
13 | 14 | import com.huaheng.framework.web.domain.AjaxResult; |
15 | +import com.huaheng.framework.web.service.ConfigService; | |
14 | 16 | import com.huaheng.pc.config.FilterConfigDetail.domain.FilterConfigDetail; |
15 | 17 | import com.huaheng.pc.config.FilterConfigDetail.service.FilterConfigDetailService; |
16 | 18 | import com.huaheng.pc.config.container.domain.Container; |
... | ... | @@ -19,6 +21,8 @@ import com.huaheng.pc.config.location.domain.Location; |
19 | 21 | import com.huaheng.pc.config.location.service.LocationService; |
20 | 22 | import com.huaheng.pc.config.locationType.domain.LocationType; |
21 | 23 | import com.huaheng.pc.config.locationType.service.LocationTypeService; |
24 | +import com.huaheng.pc.config.material.domain.Material; | |
25 | +import com.huaheng.pc.config.material.service.MaterialService; | |
22 | 26 | import com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail; |
23 | 27 | import com.huaheng.pc.receipt.receiptContainerDetail.service.ReceiptContainerDetailService; |
24 | 28 | import com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader; |
... | ... | @@ -63,6 +67,12 @@ public class OverrideHandleServiceImpl implements OverrideHandleService { |
63 | 67 | private ReceivingService receivingService; |
64 | 68 | @Resource |
65 | 69 | private ContainerService containerService; |
70 | + @Resource | |
71 | + private LocationAllocationService locationAllocationService; | |
72 | + @Resource | |
73 | + private ConfigService configService; | |
74 | + @Resource | |
75 | + private MaterialService materialService; | |
66 | 76 | /** |
67 | 77 | * 重入处理 |
68 | 78 | * 1、判断非空字段 |
... | ... | @@ -77,7 +87,7 @@ public class OverrideHandleServiceImpl implements OverrideHandleService { |
77 | 87 | String taskNo = taskFinishDomain.getTaskNo(); |
78 | 88 | |
79 | 89 | //1、判断非空字段 |
80 | - if(StringUtils.isEmpty(taskNo)){ | |
90 | + if(StringUtils.isEmpty(taskNo)) { | |
81 | 91 | return AjaxResult.error("任务号为空"); |
82 | 92 | } |
83 | 93 | |
... | ... | @@ -86,9 +96,9 @@ public class OverrideHandleServiceImpl implements OverrideHandleService { |
86 | 96 | if(taskHeader == null){ |
87 | 97 | return AjaxResult.error("任务号错误,没有找到该任务"); |
88 | 98 | } |
89 | - | |
99 | + String warehouseCode = taskHeader.getWarehouseCode(); | |
90 | 100 | int status = taskHeader.getStatus(); |
91 | - if(status == QuantityConstant.TASK_STATUS_COMPLETED){ | |
101 | + if(status == QuantityConstant.TASK_STATUS_COMPLETED) { | |
92 | 102 | return AjaxResult.error("任务已完成"); |
93 | 103 | } |
94 | 104 | |
... | ... | @@ -96,7 +106,7 @@ public class OverrideHandleServiceImpl implements OverrideHandleService { |
96 | 106 | //修改原来目的库位的状态 |
97 | 107 | LambdaQueryWrapper<Location> locationLam = Wrappers.lambdaQuery(); |
98 | 108 | locationLam.eq(Location::getCode,taskHeader.getToLocation()) |
99 | - .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode()); | |
109 | + .eq(Location::getWarehouseCode, warehouseCode); | |
100 | 110 | Location location = locationService.getOne(locationLam); |
101 | 111 | if(location == null) { |
102 | 112 | return AjaxResult.error("此任务的原目的库位在系统中不存在"); |
... | ... | @@ -104,26 +114,23 @@ public class OverrideHandleServiceImpl implements OverrideHandleService { |
104 | 114 | location.setStatus(QuantityConstant.STATUS_LOCATION_EMPTY); |
105 | 115 | location.setContainerCode(""); |
106 | 116 | Boolean flag = locationService.updateById(location); |
107 | - if(flag == false){ | |
117 | + if(flag == false) { | |
108 | 118 | return AjaxResult.error("修改此任务的原目的库位错误"); |
109 | 119 | } |
110 | - | |
111 | - | |
112 | 120 | /** |
113 | 121 | * 查看新库位有两种情况 |
114 | 122 | * 1、重入的库位由wcs提供 |
115 | 123 | * 2、重入的库位由wms提供 |
116 | 124 | */ |
117 | - | |
118 | 125 | Location newlocation = new Location(); |
119 | 126 | String newLocationCode = null; |
120 | 127 | String redirectionLocation = taskFinishDomain.getRedirectionLocationCode(); |
121 | 128 | //重入的库位由wcs提供 |
122 | - if(!"0".equals(redirectionLocation)) { | |
129 | + if(redirectionLocation != null && !"0".equals(redirectionLocation)) { | |
123 | 130 | LambdaQueryWrapper<Location> locationLa = Wrappers.lambdaQuery(); |
124 | 131 | locationLa.eq(Location::getCode, redirectionLocation) |
125 | 132 | .eq(Location::getStatus,QuantityConstant.STATUS_LOCATION_EMPTY) |
126 | - .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode()); | |
133 | + .eq(Location::getWarehouseCode, warehouseCode); | |
127 | 134 | newlocation = locationService.getOne(locationLa); |
128 | 135 | if (newlocation == null) { |
129 | 136 | throw new ServiceException("新目的库位在系统中不存在或非空闲"); |
... | ... | @@ -131,55 +138,39 @@ public class OverrideHandleServiceImpl implements OverrideHandleService { |
131 | 138 | if(StringUtils.isNotEmpty(newlocation.getContainerCode())){ |
132 | 139 | throw new ServiceException("新目的库位在系统中已经有容器"); |
133 | 140 | } |
134 | - }else { | |
141 | + } else { | |
135 | 142 | //重入的库位由wms提供 |
136 | 143 | //查询任务明细 |
137 | - LambdaQueryWrapper<TaskDetail> taskDetailLambda = Wrappers.lambdaQuery(); | |
138 | - taskDetailLambda.eq(TaskDetail::getTaskId, taskFinishDomain.getTaskNo()); | |
139 | - List<TaskDetail> taskDetailList = taskDetailService.list(taskDetailLambda); | |
140 | - String locatingRule = warecellAllocationService.taskPositioning(); | |
141 | - String[] locatingRules = locatingRule.split("cut"); | |
142 | - LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery(); | |
143 | - locationLambda.last(locatingRules[0]); | |
144 | - locationLambda.eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode()); | |
145 | - List<Location> locationList = locationService.list(locationLambda); | |
146 | - List<Location> removeLocaationList = new ArrayList<>(); | |
147 | - for(Location location1 : locationList) { | |
148 | - if (taskHeaderService.getUncompleteTaskInNear(location1) > 0) { | |
149 | - removeLocaationList.add(location1); | |
150 | - } else { | |
151 | - break; | |
152 | - } | |
144 | + String value = configService.getKey(QuantityConstant.RULE_ALLOCATION); | |
145 | + if (StringUtils.isEmpty(value)) { | |
146 | + return AjaxResult.error("未绑定定位规则"); | |
153 | 147 | } |
154 | - locationList.removeAll(removeLocaationList); | |
155 | - if (locationList == null || locationList.size() == 0) { | |
156 | - locationLambda.last(locatingRules[1]); | |
157 | - locationList = locationService.list(locationLambda); | |
158 | - removeLocaationList = new ArrayList<>(); | |
159 | - for(Location location1 : locationList) { | |
160 | - if (taskHeaderService.getUncompleteTaskInNear(location1) > 0) { | |
161 | - removeLocaationList.add(location1); | |
162 | - } else { | |
163 | - break; | |
164 | - } | |
165 | - } | |
166 | - locationList.removeAll(removeLocaationList); | |
148 | + int allocationRule = Integer.parseInt(value); | |
149 | + List<String> locationTypeCodeList = new ArrayList<>(); | |
150 | + String locationType = location.getLocationType(); | |
151 | + if(StringUtils.isNotEmpty(locationType)) { | |
152 | + locationTypeCodeList.add(locationType); | |
153 | + } | |
154 | + int high = location.getHigh(); | |
155 | + String destination = location.getArea(); | |
156 | + String containerCode = taskHeader.getContainerCode(); | |
157 | + List<TaskDetail> taskDetailList = taskDetailService.findByTaskId(taskHeader.getId()); | |
158 | + String materialCode = taskDetailList.get(0).getMaterialCode(); | |
159 | + Material material = materialService.findAllByCode(materialCode, warehouseCode); | |
160 | + String materialAreaCode = material.getMaterialAreaCode(); | |
161 | + String locationCode = locationAllocationService.allocation(allocationRule, | |
162 | + locationTypeCodeList, high, destination, warehouseCode, containerCode, materialAreaCode); | |
163 | + if (StringUtils.isEmpty(locationCode)) { | |
164 | + return AjaxResult.error("没有库位可分配"); | |
167 | 165 | } |
168 | - | |
169 | - LambdaQueryWrapper<LocationType> lambdaQueryWrapper2 = Wrappers.lambdaQuery(); | |
170 | - List<LocationType> locationTypeList = locationTypeService.list(lambdaQueryWrapper2); | |
171 | - //根据定位规则查询库位编码 | |
172 | - QueryWrapper<Location> locationLambdaQueryWrapper = new QueryWrapper<>(); | |
173 | - locationLambdaQueryWrapper.eq("1", 1).last(locatingRules[0]); | |
174 | - newlocation = locationService.getOne(locationLambdaQueryWrapper); | |
175 | - Container container = containerService.getContainerByCode(taskHeader.getContainerCode()); | |
176 | - String locationCode = receivingService.filter(locationList, locationTypeList, container); | |
177 | - newLocationCode = locationCode; | |
178 | 166 | if (taskHeader.getInternalTaskType().equals(QuantityConstant.TASK_INTENERTYPE_RECEIPT)) { |
179 | 167 | //查询入库组盘明细 |
180 | 168 | List<ReceiptContainerDetail> receiptContainerDetailList = new ArrayList<>(); |
181 | - for (TaskDetail taskDetail : taskDetailList) { | |
182 | - receiptContainerDetailList.add(receiptContainerDetailService.getById(taskDetail.getAllocationId())); | |
169 | + if(taskDetailList != null) { | |
170 | + for (TaskDetail taskDetail : taskDetailList) { | |
171 | + receiptContainerDetailList.add(receiptContainerDetailService. | |
172 | + getById(taskDetail.getAllocationId())); | |
173 | + } | |
183 | 174 | } |
184 | 175 | ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getById(receiptContainerDetailList.get(0).getReceiptContainerId()); |
185 | 176 | LambdaUpdateWrapper<ReceiptContainerDetail> wrapper = Wrappers.lambdaUpdate(); |
... | ... | @@ -189,27 +180,35 @@ public class OverrideHandleServiceImpl implements OverrideHandleService { |
189 | 180 | receiptContainerHeader.setToLocation(locationCode); |
190 | 181 | receiptContainerHeaderService.updateById(receiptContainerHeader); |
191 | 182 | } |
183 | + newLocationCode = locationCode; | |
184 | + } | |
185 | + if (StringUtils.isEmpty(newLocationCode)) { | |
186 | + return AjaxResult.error("没有库位可以分配"); | |
192 | 187 | } |
188 | + locationService.updateStatus(newLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); | |
189 | + String toLocationCode = taskHeader.getToLocation(); | |
193 | 190 | |
194 | 191 | //修改任务 |
195 | 192 | taskHeader.setToLocation(newLocationCode); |
196 | 193 | taskHeader.setExceptionCode("重入处理"); |
194 | + taskHeader.setIsDoubleIn(QuantityConstant.DOUBLE_IN); | |
195 | + taskHeader.setOriginLocation(toLocationCode); | |
197 | 196 | if(!taskHeaderService.updateById(taskHeader)){ |
198 | 197 | throw new ServiceException("修改此任务错误"); |
199 | 198 | } |
200 | 199 | |
201 | 200 | //修改子任务 |
202 | 201 | LambdaQueryWrapper<TaskDetail> taskDetailLam = Wrappers.lambdaQuery(); |
203 | - taskDetailLam.eq(TaskDetail::getWarehouseCode,ShiroUtils.getWarehouseCode()) | |
202 | + taskDetailLam.eq(TaskDetail::getWarehouseCode, warehouseCode) | |
204 | 203 | .eq(TaskDetail::getTaskId,taskHeader.getId()); |
205 | 204 | List<TaskDetail> taskDetails = taskDetailService.list(taskDetailLam); |
206 | 205 | List<TaskDetail> taskDetailList = new ArrayList<>(); |
207 | - if(taskDetails != null && taskDetails.size()> 0){ | |
206 | + if(taskDetails != null && taskDetails.size()> 0) { | |
208 | 207 | for(TaskDetail taskDetail : taskDetails){ |
209 | 208 | taskDetail.setToLocation(newLocationCode); |
210 | 209 | taskDetailList.add(taskDetail); |
211 | 210 | } |
212 | - if(!taskDetailService.updateBatchById(taskDetailList)){ | |
211 | + if(!taskDetailService.updateBatchById(taskDetailList)) { | |
213 | 212 | throw new ServiceException("修改此任务的明细错误"); |
214 | 213 | } |
215 | 214 | } |
... | ... |
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationService.java
... | ... | @@ -6,7 +6,7 @@ import java.util.List; |
6 | 6 | |
7 | 7 | public interface LocationAllocationService { |
8 | 8 | |
9 | - String allocation(int locationRule, List<String> locationTypeCodeList, int high, String destination, String warehouseCode, String containerCode, String materialAreaCode); | |
9 | + String allocation(int locationRule, List<String> locationTypeCodeList, int high, String area, String warehouseCode, String containerCode, String materialAreaCode); | |
10 | 10 | |
11 | 11 | |
12 | 12 | } |
... | ... |
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java
... | ... | @@ -39,7 +39,8 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
39 | 39 | private TaskHeaderService taskHeaderService; |
40 | 40 | |
41 | 41 | @Override |
42 | - public String allocation(int locationRule, List<String> locationTypeCodeList, int high, String area, String warehouseCode, String containerCode, String materialAreaCode) { | |
42 | + public String allocation(int locationRule, List<String> locationTypeCodeList, | |
43 | + int high, String area, String warehouseCode, String containerCode, String materialAreaCode) { | |
43 | 44 | LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); |
44 | 45 | containerLambdaQueryWrapper.eq(Container::getCode, containerCode) |
45 | 46 | .eq(Container::getWarehouseCode, warehouseCode); |
... | ... |
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java
... | ... | @@ -146,7 +146,7 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
146 | 146 | return AjaxResult.error("任务已经完成,不能再分库位"); |
147 | 147 | } |
148 | 148 | String containerCode = taskHeader.getContainerCode(); |
149 | - Container container = containerService.getContainerByCode(containerCode); | |
149 | + Container container = containerService.getContainerByCode(containerCode, warehouseCode); | |
150 | 150 | if(container == null) { |
151 | 151 | return AjaxResult.error("分配库位时,任务托盘为空"); |
152 | 152 | } |
... | ... | @@ -197,14 +197,13 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
197 | 197 | return AjaxResult.error("没有库位可分配"); |
198 | 198 | } |
199 | 199 | |
200 | - if (StringUtils.isNotEmpty(locationCode)) { | |
201 | - locationService.updateStatus(locationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); | |
202 | - if (StringUtils.isNotEmpty(taskHeader.getToLocation()) && !locationCode.equals(taskHeader.getToLocation())) { | |
203 | - locationService.updateStatus(taskHeader.getToLocation(), QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
204 | - } | |
205 | - } else { | |
206 | - throw new ServiceException("定位失败,请检查定位规则是否正确"); | |
200 | + locationService.updateStatus(locationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); | |
201 | + if (StringUtils.isNotEmpty(taskHeader.getToLocation()) && | |
202 | + !locationCode.equals(taskHeader.getToLocation())) { | |
203 | + locationService.updateStatus(taskHeader.getToLocation(), | |
204 | + QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
207 | 205 | } |
206 | + | |
208 | 207 | if (receiptContainerDetailList != null && receiptContainerDetailList.size() > 0) { |
209 | 208 | //更新库位编码到组盘头表 |
210 | 209 | ReceiptContainerDetail receiptContainerDetail = receiptContainerDetailList.get(0); |
... | ... |
src/main/java/com/huaheng/common/constant/QuantityConstant.java
... | ... | @@ -410,5 +410,12 @@ public class QuantityConstant { |
410 | 410 | public static final int RYTASK_STATUS_RUN = 0; |
411 | 411 | public static final int RYTASK_STATUS_STOP = 1; |
412 | 412 | |
413 | + public static final int DOUBLE_IN = 1; | |
414 | + public static final int NORMAL_IN = 0; | |
415 | + | |
416 | + public static final int EMPTY_OUT = 1; | |
417 | + public static final int NORMAL_OUT = 0; | |
418 | + | |
419 | + | |
413 | 420 | public static String ryTask_warehouse_code; |
414 | 421 | } |
... | ... |
src/main/java/com/huaheng/pc/config/container/service/ContainerService.java
... | ... | @@ -29,6 +29,7 @@ public interface ContainerService extends IService<Container>{ |
29 | 29 | |
30 | 30 | Container getContainerByCode(String containCode); |
31 | 31 | |
32 | + Container getContainerByCode(String containCode, String warehouseCode); | |
32 | 33 | |
33 | 34 | //获得空货架编号 |
34 | 35 | List<Container> selectListShelf(); |
... | ... |
src/main/java/com/huaheng/pc/config/container/service/ContainerServiceImpl.java
... | ... | @@ -177,6 +177,11 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container |
177 | 177 | return containerMapper.findAllByCode(code, ShiroUtils.getWarehouseCode()); |
178 | 178 | } |
179 | 179 | |
180 | + @Override | |
181 | + public Container getContainerByCode(String containCode, String warehouseCode) { | |
182 | + return containerMapper.findAllByCode(containCode, warehouseCode); | |
183 | + } | |
184 | + | |
180 | 185 | |
181 | 186 | @Override |
182 | 187 | public List<Container> selectListShelf() { |
... | ... |
src/main/java/com/huaheng/pc/inventory/adjustDetail/controller/adjustDetailController.java
... | ... | @@ -4,6 +4,7 @@ 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; | |
7 | 8 | import com.huaheng.common.exception.service.ServiceException; |
8 | 9 | import com.huaheng.common.support.Convert; |
9 | 10 | import com.huaheng.common.utils.StringUtils; |
... | ... | @@ -19,12 +20,17 @@ import com.huaheng.pc.inventory.adjustDetail.domain.AdjustDetail; |
19 | 20 | import com.huaheng.pc.inventory.adjustDetail.service.AdjustDetailService; |
20 | 21 | import com.huaheng.pc.inventory.adjustHeader.domain.AdjustHeader; |
21 | 22 | import com.huaheng.pc.inventory.adjustHeader.mapper.AdjustHeaderMapper; |
23 | +import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; | |
24 | +import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService; | |
25 | +import com.huaheng.pc.inventory.inventoryHeader.domain.InventoryHeader; | |
26 | +import com.huaheng.pc.inventory.inventoryHeader.service.InventoryHeaderService; | |
22 | 27 | import org.apache.shiro.authz.annotation.RequiresPermissions; |
23 | 28 | import org.springframework.stereotype.Controller; |
24 | 29 | import org.springframework.ui.ModelMap; |
25 | 30 | import org.springframework.web.bind.annotation.*; |
26 | 31 | |
27 | 32 | import javax.annotation.Resource; |
33 | +import java.math.BigDecimal; | |
28 | 34 | import java.util.List; |
29 | 35 | |
30 | 36 | |
... | ... | @@ -37,6 +43,10 @@ public class adjustDetailController extends BaseController { |
37 | 43 | private AdjustHeaderMapper adjustHeaderMapper; |
38 | 44 | @Resource |
39 | 45 | private AdjustDetailService adjustDetailService; |
46 | + @Resource | |
47 | + private InventoryDetailService inventoryDetailService; | |
48 | + @Resource | |
49 | + private InventoryHeaderService inventoryHeaderService; | |
40 | 50 | |
41 | 51 | |
42 | 52 | |
... | ... | @@ -168,6 +178,25 @@ public class adjustDetailController extends BaseController { |
168 | 178 | return AjaxResult.error("不能重复调整!"); |
169 | 179 | } |
170 | 180 | ajaxResult1 = adjustDetailService.updateAdjustDetail(adjustDetailEdit); |
181 | + InventoryDetail inventoryDetail = inventoryDetailService.getById(adjustDetailEdit.getInventoryDetailId()); | |
182 | + if(inventoryDetail != null) { | |
183 | + InventoryHeader header = inventoryHeaderService.getById(inventoryDetail.getInventoryHeaderId()); | |
184 | + LambdaQueryWrapper<InventoryDetail> inventory = Wrappers.lambdaQuery(); | |
185 | + inventory.eq(InventoryDetail::getInventoryHeaderId, header.getId()); | |
186 | + List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventory); | |
187 | + BigDecimal totalQty = new BigDecimal(0); | |
188 | + int totalLines = 0; | |
189 | + for (InventoryDetail inventoryDetail3 : inventoryDetailList) { | |
190 | + totalQty = totalQty.add(inventoryDetail3.getQty()); | |
191 | + totalLines++; | |
192 | + } | |
193 | + header.setTotalQty(totalQty); | |
194 | + header.setTotalLines(totalLines); | |
195 | + header.setContainerStatus(QuantityConstant.STATUS_CONTAINER_SOME); | |
196 | + LambdaQueryWrapper<InventoryHeader> wrapper = Wrappers.lambdaQuery(); | |
197 | + wrapper.eq(InventoryHeader::getId, header.getId()); | |
198 | + inventoryHeaderService.update(header, wrapper); | |
199 | + } | |
171 | 200 | } |
172 | 201 | return ajaxResult1; |
173 | 202 | } |
... | ... |
src/main/java/com/huaheng/pc/inventory/adjustDetail/service/AdjustDetailServiceImpl.java
... | ... | @@ -183,11 +183,9 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj |
183 | 183 | if(adjustDetail.getStatus() == 1){ |
184 | 184 | AjaxResult.error("该单据已调整,不允许再次调整!" ); |
185 | 185 | } |
186 | - //查询调整的库存明细 | |
187 | - InventoryDetail inventoryDetail; | |
188 | 186 | //调整单中不带库存明细时不查询 |
189 | 187 | if(adjustDetail.getInventoryDetailId() != null) { |
190 | - inventoryDetail = inventoryDetailService.getById(adjustDetail.getInventoryDetailId()); | |
188 | + InventoryDetail inventoryDetail = inventoryDetailService.getById(adjustDetail.getInventoryDetailId()); | |
191 | 189 | if (!adjustDetail.getLocationCode().equals(inventoryDetail.getLocationCode()) || |
192 | 190 | !adjustDetail.getContainerCode().equals(inventoryDetail.getContainerCode())) { |
193 | 191 | return AjaxResult.error("调整单和所调整库存的库位容器不符,前检查数据"); |
... | ... | @@ -318,6 +316,7 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj |
318 | 316 | inventoryDetail.setLastUpdated(new Date()); |
319 | 317 | inventoryDetailService.saveOrUpdate(inventoryDetail); |
320 | 318 | |
319 | + | |
321 | 320 | //写入库存交易,2条一条出,一条入 |
322 | 321 | //调整出 |
323 | 322 | InventoryTransaction inventoryTransaction = new InventoryTransaction(); |
... | ... |
src/main/java/com/huaheng/pc/shipment/shippingCombination/service/ShippingCombinationService.java
... | ... | @@ -62,7 +62,7 @@ public class ShippingCombinationService { |
62 | 62 | slam.eq(ShipmentPreference::getCode,configValue.getIdentifier()) |
63 | 63 | .eq(ShipmentPreference::getWarehouseCode,configValue.getWarehouseCode()); |
64 | 64 | ShipmentPreference shipmentPreference = shipmentPreferenceService.getOne(slam); |
65 | - if(shipmentPreference == null){ | |
65 | + if(shipmentPreference == null) { | |
66 | 66 | throw new ServiceException("仓库的出库配置中出库首选项不存在"); |
67 | 67 | } |
68 | 68 | |
... | ... |
src/main/resources/templates/config/container/container.html
... | ... | @@ -58,7 +58,7 @@ |
58 | 58 | <i class="fa fa-trash-o"></i> 删除 |
59 | 59 | </a> |
60 | 60 | |
61 | - <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.batPrint()" shiro:hasPermission="config:container:print"> | |
61 | + <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.batPrint()" shiro:hasPermission="config:container:print"> | |
62 | 62 | <i class="fa fa-plus"></i> 打印 |
63 | 63 | </a> |
64 | 64 | </div> |
... | ... |
src/main/resources/templates/config/location/location.html
... | ... | @@ -72,10 +72,10 @@ |
72 | 72 | <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="config:location:add"> |
73 | 73 | <i class="fa fa-plus"></i> 新增 |
74 | 74 | </a> |
75 | - <a class="btn btn-outline btn-primary btn-rounded" onclick="addBatch()" shiro:hasPermission="config:location:addBatch"> | |
75 | + <a class="btn btn-outline btn-primary btn-rounded" onclick="addBatch()" shiro:hasPermission="config:location:add"> | |
76 | 76 | <i class="fa fa-plus-square-o"></i> 批量新增 |
77 | 77 | </a> |
78 | - <a class="btn btn-outline btn-primary btn-rounded" onclick="editBatch()" shiro:hasPermission="config:location:addBatch"> | |
78 | + <a class="btn btn-outline btn-primary btn-rounded" onclick="editBatch()" shiro:hasPermission="config:location:edit"> | |
79 | 79 | <i class="fa fa-edit"></i> 批量修改 |
80 | 80 | </a> |
81 | 81 | <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.batPrint()" shiro:hasPermission="inventory:inventoryTransaction:report"> |
... | ... |