Commit 63c7fdb64c8fcb99b12224e445e94e01df33f86f
1 parent
279a7c36
1.库位分配兼容空托盘入库
2.出库加上出库站台字段
Showing
7 changed files
with
104 additions
and
84 deletions
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java
@@ -146,55 +146,76 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService | @@ -146,55 +146,76 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService | ||
146 | //去重 | 146 | //去重 |
147 | receiptContainerDetailList = receiptContainerDetailList.stream().distinct().collect(Collectors.toList()); | 147 | receiptContainerDetailList = receiptContainerDetailList.stream().distinct().collect(Collectors.toList()); |
148 | 148 | ||
149 | - /* 循环入库组盘明细,重新分配库位*/ | ||
150 | - for (ReceiptContainerDetail receiptContainerDetail : receiptContainerDetailList) { | ||
151 | - ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getById(receiptContainerDetail.getReceiptContainerId()); | ||
152 | - | ||
153 | - String locatingRule = this.taskPositioning(receiptContainerDetail); | ||
154 | - | ||
155 | - LambdaQueryWrapper<FilterConfigDetail> filterConfigDetailLambda = Wrappers.lambdaQuery(); | ||
156 | - filterConfigDetailLambda.eq(FilterConfigDetail::getCode, locatingRule) | ||
157 | - .eq(FilterConfigDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()); | ||
158 | - FilterConfigDetail filterConfigDetail = filterConfigDetailService.getOne(filterConfigDetailLambda); | ||
159 | - String[] locatingRules = filterConfigDetail.getStatement().split("cut"); | ||
160 | - | ||
161 | - //根据定位规则查询库位编码 | ||
162 | - LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery(); | ||
163 | - locationLambda.last(locatingRules[0]); | ||
164 | - locationLambda.eq(Location::getRoadway, wcsTask.getDestination()); | ||
165 | - List<Location> locationList = locationService.list(locationLambda); | ||
166 | - if(locationList == null || locationList.size() == 0) { | ||
167 | - locationLambda.last(locatingRules[1]); | ||
168 | - locationList = locationService.list(locationLambda); | ||
169 | - }; | ||
170 | - locationCode = filter(locationList, locationTypeList, wcsTask.getDestination()); | ||
171 | - if (StringUtils.isEmpty(locationCode)){ | ||
172 | - throw new ServiceException("没有库位可分配"); | ||
173 | - } | ||
174 | - | ||
175 | - if (StringUtils.isNotEmpty(locationCode)){ | ||
176 | - locationService.updateStatus(locationCode, "lock"); | ||
177 | - if (StringUtils.isNotEmpty(taskHeader.getToLocation()) && !locationCode.equals(taskHeader.getToLocation())){ | ||
178 | - locationService.updateStatus(taskHeader.getToLocation(), "empty"); | 149 | + if(receiptContainerDetailList != null && receiptContainerDetailList.size() > 0) { |
150 | + /* 循环入库组盘明细,重新分配库位*/ | ||
151 | + for (ReceiptContainerDetail receiptContainerDetail : receiptContainerDetailList) { | ||
152 | + String locatingRule = null; | ||
153 | + ReceiptContainerHeader receiptContainerHeader= null; | ||
154 | + if(receiptContainerDetail != null) { | ||
155 | + receiptContainerHeader = receiptContainerHeaderService.getById(receiptContainerDetail.getReceiptContainerId()); | ||
156 | + locatingRule = this.taskPositioning(receiptContainerDetail); | ||
157 | + } | ||
158 | + if (StringUtils.isEmpty(locatingRule)){ | ||
159 | + //物料类别中定位规则为空时,查询入库首选项 | ||
160 | + LambdaQueryWrapper<ConfigValue> configValueLambda = Wrappers.lambdaQuery(); | ||
161 | + configValueLambda.eq(ConfigValue::getWarehouseCode, ShiroUtils.getWarehouseCode()) | ||
162 | + .eq(ConfigValue::getModuleType, "receipt") | ||
163 | + .eq(ConfigValue::getRecordType, "入库首选项"); | ||
164 | + ConfigValue configValue = configValueService.getOne(configValueLambda); | ||
165 | + LambdaQueryWrapper<ReceiptPreference> receiptPreferenceLambda = Wrappers.lambdaQuery(); | ||
166 | + receiptPreferenceLambda.eq(ReceiptPreference::getCode, configValue.getValue()) | ||
167 | + .eq(ReceiptPreference::getWarehouseCode, ShiroUtils.getWarehouseCode()); | ||
168 | + ReceiptPreference receiptPreference = receiptPreferenceService.getOne(receiptPreferenceLambda); | ||
169 | + locatingRule = receiptPreferenceService.getOne(receiptPreferenceLambda).getLocationRule(); | ||
170 | + } | ||
171 | + LambdaQueryWrapper<FilterConfigDetail> filterConfigDetailLambda = Wrappers.lambdaQuery(); | ||
172 | + filterConfigDetailLambda.eq(FilterConfigDetail::getCode, locatingRule) | ||
173 | + .eq(FilterConfigDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()); | ||
174 | + FilterConfigDetail filterConfigDetail = filterConfigDetailService.getOne(filterConfigDetailLambda); | ||
175 | + String[] locatingRules = filterConfigDetail.getStatement().split("cut"); | ||
176 | + | ||
177 | + //根据定位规则查询库位编码 | ||
178 | + LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery(); | ||
179 | + locationLambda.last(locatingRules[0]); | ||
180 | + locationLambda.eq(Location::getRoadway, wcsTask.getDestination()); | ||
181 | + List<Location> locationList = locationService.list(locationLambda); | ||
182 | + if (locationList == null || locationList.size() == 0) { | ||
183 | + locationLambda.last(locatingRules[1]); | ||
184 | + locationList = locationService.list(locationLambda); | ||
185 | + } | ||
186 | + ; | ||
187 | + locationCode = filter(locationList, locationTypeList, wcsTask.getDestination()); | ||
188 | + if (StringUtils.isEmpty(locationCode)) { | ||
189 | + throw new ServiceException("没有库位可分配"); | ||
179 | } | 190 | } |
180 | - } else { | ||
181 | - throw new ServiceException("定位失败,请检查定位规则是否正确"); | ||
182 | - } | ||
183 | 191 | ||
184 | - //更新库位编码到组盘头表 | ||
185 | - receiptContainerHeader.setToLocation(locationCode); | ||
186 | - if (!receiptContainerHeaderService.updateById(receiptContainerHeader)){ | ||
187 | - throw new ServiceException("更新库位失败"); | ||
188 | - } | 192 | + if (StringUtils.isNotEmpty(locationCode)) { |
193 | + locationService.updateStatus(locationCode, "lock"); | ||
194 | + if (StringUtils.isNotEmpty(taskHeader.getToLocation()) && !locationCode.equals(taskHeader.getToLocation())) { | ||
195 | + locationService.updateStatus(taskHeader.getToLocation(), "empty"); | ||
196 | + } | ||
197 | + } else { | ||
198 | + throw new ServiceException("定位失败,请检查定位规则是否正确"); | ||
199 | + } | ||
200 | + if(receiptContainerDetail != null) { | ||
201 | + //更新库位编码到组盘头表 | ||
202 | + receiptContainerHeader.setToLocation(locationCode); | ||
203 | + if (!receiptContainerHeaderService.updateById(receiptContainerHeader)) { | ||
204 | + throw new ServiceException("更新库位失败"); | ||
205 | + } | ||
189 | 206 | ||
190 | - //把库位编码赋到该入库组盘头表下的所有明细 | ||
191 | - LambdaQueryWrapper<ReceiptContainerDetail> lambda = Wrappers.lambdaQuery(); | ||
192 | - lambda.eq(ReceiptContainerDetail::getReceiptContainerId, receiptContainerHeader.getId()) | ||
193 | - .eq(ReceiptContainerDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()); | ||
194 | - List<ReceiptContainerDetail> receiptContainerDetails = receiptContainerDetailService.list(lambda); | ||
195 | - for (ReceiptContainerDetail receiptContainerDetail2: receiptContainerDetails) { | ||
196 | - receiptContainerDetail2.setLocationCode(locationCode); | ||
197 | - if (!receiptContainerDetailService.updateById(receiptContainerDetail2)){throw new ServiceException("更新库位编码到入库组盘明细");} | 207 | + //把库位编码赋到该入库组盘头表下的所有明细 |
208 | + LambdaQueryWrapper<ReceiptContainerDetail> lambda = Wrappers.lambdaQuery(); | ||
209 | + lambda.eq(ReceiptContainerDetail::getReceiptContainerId, receiptContainerHeader.getId()) | ||
210 | + .eq(ReceiptContainerDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()); | ||
211 | + List<ReceiptContainerDetail> receiptContainerDetails = receiptContainerDetailService.list(lambda); | ||
212 | + for (ReceiptContainerDetail receiptContainerDetail2 : receiptContainerDetails) { | ||
213 | + receiptContainerDetail2.setLocationCode(locationCode); | ||
214 | + if (!receiptContainerDetailService.updateById(receiptContainerDetail2)) { | ||
215 | + throw new ServiceException("更新库位编码到入库组盘明细"); | ||
216 | + } | ||
217 | + } | ||
218 | + } | ||
198 | } | 219 | } |
199 | } | 220 | } |
200 | 221 |
src/main/java/com/huaheng/pc/config/locationType/controller/LocationTypeController.java
@@ -104,15 +104,15 @@ public class LocationTypeController extends BaseController | @@ -104,15 +104,15 @@ public class LocationTypeController extends BaseController | ||
104 | if(StringUtils.isEmpty(locationType.getCode())){ | 104 | if(StringUtils.isEmpty(locationType.getCode())){ |
105 | return AjaxResult.error("库位类型为空"); | 105 | return AjaxResult.error("库位类型为空"); |
106 | } | 106 | } |
107 | - if(StringUtils.isEmpty(locationType.getZoneCode())){ | ||
108 | - return AjaxResult.error("库位类型对应的区域为空"); | ||
109 | - } | ||
110 | - //查找location,是否存在 | ||
111 | - | ||
112 | - if(!zoneService.exists(locationType.getZoneCode(),ShiroUtils.getWarehouseCode())) | ||
113 | - { | ||
114 | - return AjaxResult.error("库位类型对应的区域:"+locationType.getZoneCode()+" 不在系统管制范围,请核对"); | ||
115 | - } | 107 | +// if(StringUtils.isEmpty(locationType.getZoneCode())){ |
108 | +// return AjaxResult.error("库位类型对应的区域为空"); | ||
109 | +// } | ||
110 | +// //查找location,是否存在 | ||
111 | +// | ||
112 | +// if(!zoneService.exists(locationType.getZoneCode(),ShiroUtils.getWarehouseCode())) | ||
113 | +// { | ||
114 | +// return AjaxResult.error("库位类型对应的区域:"+locationType.getZoneCode()+" 不在系统管制范围,请核对"); | ||
115 | +// } | ||
116 | 116 | ||
117 | locationType.setWarehouseCode(ShiroUtils.getWarehouseCode()); | 117 | locationType.setWarehouseCode(ShiroUtils.getWarehouseCode()); |
118 | locationType.setCreatedBy(ShiroUtils.getLoginName()); | 118 | locationType.setCreatedBy(ShiroUtils.getLoginName()); |
src/main/java/com/huaheng/pc/config/locationType/domain/LocationType.java
@@ -30,11 +30,6 @@ public class LocationType implements Serializable { | @@ -30,11 +30,6 @@ public class LocationType implements Serializable { | ||
30 | @TableField(value = "warehouseCode") | 30 | @TableField(value = "warehouseCode") |
31 | private String warehouseCode; | 31 | private String warehouseCode; |
32 | /** | 32 | /** |
33 | - * 区域编码 | ||
34 | - */ | ||
35 | - @TableField(value = "zoneCode") | ||
36 | - private String zoneCode; | ||
37 | - /** | ||
38 | * 描述 | 33 | * 描述 |
39 | */ | 34 | */ |
40 | @TableField(value = "name") | 35 | @TableField(value = "name") |
src/main/java/com/huaheng/pc/task/taskHeader/domain/TaskHeader.java
@@ -110,6 +110,14 @@ public class TaskHeader implements Serializable { | @@ -110,6 +110,14 @@ public class TaskHeader implements Serializable { | ||
110 | private Integer status; | 110 | private Integer status; |
111 | 111 | ||
112 | /** | 112 | /** |
113 | + * 出库站台 | ||
114 | + */ | ||
115 | + @TableField(value = "stationCode") | ||
116 | + @ApiModelProperty(value="出库站台") | ||
117 | + private String stationCode; | ||
118 | + | ||
119 | + | ||
120 | + /** | ||
113 | * 波次号 | 121 | * 波次号 |
114 | */ | 122 | */ |
115 | @TableField(value = "waveId") | 123 | @TableField(value = "waveId") |
@@ -309,4 +317,6 @@ public class TaskHeader implements Serializable { | @@ -309,4 +317,6 @@ public class TaskHeader implements Serializable { | ||
309 | @TableField(value = "weight") | 317 | @TableField(value = "weight") |
310 | private String weight; | 318 | private String weight; |
311 | private static final long serialVersionUID = 1L; | 319 | private static final long serialVersionUID = 1L; |
320 | + | ||
321 | + | ||
312 | } | 322 | } |
313 | \ No newline at end of file | 323 | \ No newline at end of file |
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
@@ -444,8 +444,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -444,8 +444,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
444 | if(task.getTaskType().equals(QuantityConstant.TASK_TYPE_WHOLERECEIPT) || task.getTaskType().equals(QuantityConstant.TASK_TYPE_EMPTYRECEIPT)){ | 444 | if(task.getTaskType().equals(QuantityConstant.TASK_TYPE_WHOLERECEIPT) || task.getTaskType().equals(QuantityConstant.TASK_TYPE_EMPTYRECEIPT)){ |
445 | if(StringUtils.isEmpty(task.getToLocation())){ | 445 | if(StringUtils.isEmpty(task.getToLocation())){ |
446 | //自动分配库位 | 446 | //自动分配库位 |
447 | - AjaxResult ajaxResult = this.setLocationCode(task.getId(),0 ); | ||
448 | - task.setToLocation((String)ajaxResult.getData()); | 447 | + // AjaxResult ajaxResult = this.setLocationCode(task.getId(),0 ); |
448 | + // task.setToLocation((String)ajaxResult.getData()); | ||
449 | } | 449 | } |
450 | } | 450 | } |
451 | //如果没有库位不能完成 | 451 | //如果没有库位不能完成 |
src/main/java/com/huaheng/pc/task/taskHeader/service/WorkTaskService.java
@@ -91,24 +91,22 @@ public class WorkTaskService { | @@ -91,24 +91,22 @@ public class WorkTaskService { | ||
91 | if (receiptPreferences.isEmpty()) { | 91 | if (receiptPreferences.isEmpty()) { |
92 | return AjaxResult.error("入库首选项不存在"); | 92 | return AjaxResult.error("入库首选项不存在"); |
93 | } | 93 | } |
94 | - if (StringUtils.isEmpty(receiptPreferences.get(0).getEmptyLocRule())) { | ||
95 | - return AjaxResult.error("入库首选项为绑定空库位规则,目标库位不允许为空"); | ||
96 | - } | ||
97 | - | ||
98 | - LambdaQueryWrapper<FilterConfigDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
99 | - lambdaQueryWrapper.eq(FilterConfigDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()) | ||
100 | - .eq(FilterConfigDetail::getCode, receiptPreferences.get(0).getEmptyLocRule()); | ||
101 | - FilterConfigDetail filterConfigDetail = filterConfigDetailService.getOne(lambdaQueryWrapper); | ||
102 | - if (StringUtils.isNull(filterConfigDetail)) { | ||
103 | - return AjaxResult.error("首选项绑定的空库位规则不存在"); | ||
104 | - } | ||
105 | - QueryWrapper<Location> queryWrapper = new QueryWrapper<>(); | ||
106 | - queryWrapper.eq("1",1).last(filterConfigDetail.getStatement()); | ||
107 | - Location location = locationService.getOne(queryWrapper); | ||
108 | - if (StringUtils.isNull(location)) { | ||
109 | - return AjaxResult.error("没有库位可分配"); | 94 | + if (StringUtils.isNotEmpty(receiptPreferences.get(0).getEmptyLocRule())) { |
95 | + LambdaQueryWrapper<FilterConfigDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
96 | + lambdaQueryWrapper.eq(FilterConfigDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()) | ||
97 | + .eq(FilterConfigDetail::getCode, receiptPreferences.get(0).getEmptyLocRule()); | ||
98 | + FilterConfigDetail filterConfigDetail = filterConfigDetailService.getOne(lambdaQueryWrapper); | ||
99 | + if (StringUtils.isNull(filterConfigDetail)) { | ||
100 | + return AjaxResult.error("首选项绑定的空库位规则不存在"); | ||
101 | + } | ||
102 | + QueryWrapper<Location> queryWrapper = new QueryWrapper<>(); | ||
103 | + queryWrapper.eq("1",1).last(filterConfigDetail.getStatement()); | ||
104 | + Location location = locationService.getOne(queryWrapper); | ||
105 | + if (StringUtils.isNull(location)) { | ||
106 | + return AjaxResult.error("没有库位可分配"); | ||
107 | + } | ||
108 | + destinationLocation = location.getCode(); | ||
110 | } | 109 | } |
111 | - destinationLocation = location.getCode(); | ||
112 | } | 110 | } |
113 | 111 | ||
114 | //判断托盘是否已经存在任务 | 112 | //判断托盘是否已经存在任务 |
@@ -430,7 +428,7 @@ public class WorkTaskService { | @@ -430,7 +428,7 @@ public class WorkTaskService { | ||
430 | * @param sourceLocation 库位 | 428 | * @param sourceLocation 库位 |
431 | * @return | 429 | * @return |
432 | */ | 430 | */ |
433 | - @Transactional(rollbackFor = Exception.class) | 431 | + @Transactional |
434 | public AjaxResult createEmptyCheckOut(String containerCode, String sourceLocation) { | 432 | public AjaxResult createEmptyCheckOut(String containerCode, String sourceLocation) { |
435 | /* 容器编码*/ | 433 | /* 容器编码*/ |
436 | String conCode = null; | 434 | String conCode = null; |
src/main/resources/templates/inventory/inventoryHeader/inventoryHeader.html
@@ -66,10 +66,6 @@ | @@ -66,10 +66,6 @@ | ||
66 | shiro:hasPermission="inventory:inventoryHeader:emptyIn"> | 66 | shiro:hasPermission="inventory:inventoryHeader:emptyIn"> |
67 | <i class="fa fa-level-down"></i> 空托入库 | 67 | <i class="fa fa-level-down"></i> 空托入库 |
68 | </a> | 68 | </a> |
69 | - <a class="btn btn-outline btn-default btn-rounded" onclick="emptyCheckOut()" | ||
70 | - shiro:hasPermission="inventory:inventoryHeader:emptyCheckOut"> | ||
71 | - <i class="fa fa fa-eye"></i> 空托出库查看 | ||
72 | - </a> | ||
73 | <a class="btn btn-outline btn-info btn-rounded" onclick="emptyOut()" | 69 | <a class="btn btn-outline btn-info btn-rounded" onclick="emptyOut()" |
74 | shiro:hasPermission="inventory:inventoryHeader:emptyOut"> | 70 | shiro:hasPermission="inventory:inventoryHeader:emptyOut"> |
75 | <i class="fa fa-level-up"></i> 空托出库 | 71 | <i class="fa fa-level-up"></i> 空托出库 |