Commit 72db299cfc2f7b81a406663d2a29c1f3f46a4b02

Authored by 肖超群
2 parents 86391dfa 38dc728e

Merge branch 'develop' of http://172.16.29.40:8010/wms/wms4 into develop

ant-design-vue-jeecg/src/components/tools/HeaderNotice.vue
... ... @@ -228,6 +228,7 @@ export default {
228 228 websocketOnmessage: function (e) {
229 229 console.log("-----接收消息-------", e.data);
230 230 var data = eval("(" + e.data + ")"); //解析对象
  231 + this.openNotification(data)
231 232 if (data.cmd == "topic") {
232 233 //系统通知
233 234 this.loadData();
... ...
ant-design-vue-jeecg/src/views/system/compare/CompareWcsLocation.vue
... ... @@ -5,15 +5,29 @@
5 5 <a-form layout="inline" @keyup.enter.native="searchQuery">
6 6 <a-row :gutter="24">
7 7 <a-col :xl="6" :lg="7" :md="8" :sm="24">
  8 + <a-form-item label="库区">
  9 + <a-select
  10 + show-search
  11 + placeholder="请选择库区"
  12 + option-filter-prop="children"
  13 + v-model="queryParam.zoneCode"
  14 + >
  15 + <a-select-option v-for="item in zoneList" :key="item.name" :value="item.code">
  16 + {{ item.name }}
  17 + </a-select-option>
  18 + </a-select>
  19 + </a-form-item>
  20 + </a-col>
  21 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
8 22 <a-form-item label="库位编码">
9 23 <a-input placeholder="请输入库位编码" v-model="queryParam.locationCode"></a-input>
10 24 </a-form-item>
11 25 </a-col>
12   - <a-col :xl="6" :lg="7" :md="8" :sm="24">
  26 + <!-- <a-col :xl="6" :lg="7" :md="8" :sm="24">
13 27 <a-form-item label="库位表容器编码">
14 28 <a-input placeholder="请输入库位表容器编码" v-model="queryParam.containerCode"></a-input>
15 29 </a-form-item>
16   - </a-col>
  30 + </a-col> -->
17 31 <a-col :xl="6" :lg="7" :md="8" :sm="24">
18 32 <a-form-item label="数据状态">
19 33 <j-dict-select-tag
... ... @@ -90,7 +104,7 @@ import { JeecgListMixin } from &#39;@/mixins/JeecgListMixin&#39;
90 104 import { getAction } from '@/api/manage'
91 105 import CompareWcsLocationTask from './CompareWcsLocationTask'
92 106 import { initDictOptions, filterMultiDictText } from '@/components/dict/JDictSelectUtil'
93   -import { ajaxGetDictItems, getDictItemsFromCache } from '@/api/api'
  107 +import { getZoneList, ajaxGetDictItems, getDictItemsFromCache } from '@/api/api'
94 108  
95 109 export default {
96 110 name: 'CompareWcsLocation',
... ... @@ -106,6 +120,7 @@ export default {
106 120 containerStatusList: [],
107 121 wcsLocationStatusList: [],
108 122 consistencyStatusList: [],
  123 + zoneList:[],
109 124 // 表头
110 125 columns: [
111 126 {
... ... @@ -114,6 +129,20 @@ export default {
114 129 dataIndex: 'locationCode'
115 130 },
116 131 {
  132 + title: '库位表状态',
  133 + align: 'center',
  134 + dataIndex: 'locationStatus',
  135 + key: 'locationStatus',
  136 + scopedSlots: { customRender: 'locationStatus' }
  137 + },
  138 + {
  139 + title: 'WCS库位表状态',
  140 + align: 'center',
  141 + dataIndex: 'wcsLocationStatus',
  142 + key: 'wcsLocationStatus',
  143 + scopedSlots: { customRender: 'wcsLocationStatus' }
  144 + },
  145 + {
117 146 title: '库位表容器编码',
118 147 align: 'center',
119 148 dataIndex: 'locationContainerCode'
... ... @@ -134,13 +163,6 @@ export default {
134 163 dataIndex: 'wcsContainerCode'
135 164 },
136 165 {
137   - title: '库位表状态',
138   - align: 'center',
139   - dataIndex: 'locationStatus',
140   - key: 'locationStatus',
141   - scopedSlots: { customRender: 'locationStatus' }
142   - },
143   - {
144 166 title: '托盘表状态',
145 167 align: 'center',
146 168 dataIndex: 'containerStatus',
... ... @@ -148,13 +170,6 @@ export default {
148 170 scopedSlots: { customRender: 'containerStatus' }
149 171 },
150 172 {
151   - title: 'WCS库位表状态',
152   - align: 'center',
153   - dataIndex: 'wcsLocationStatus',
154   - key: 'wcsLocationStatus',
155   - scopedSlots: { customRender: 'wcsLocationStatus' }
156   - },
157   - {
158 173 title: '数据状态',
159 174 align: 'center',
160 175 dataIndex: 'consistencyStatus',
... ... @@ -182,6 +197,7 @@ export default {
182 197 }
183 198 },
184 199 created() {
  200 + this.loadFrom()
185 201 this.initDictData()
186 202 },
187 203 methods: {
... ... @@ -280,6 +296,13 @@ export default {
280 296 return color
281 297 },
282 298 initDictConfig() {},
  299 + loadFrom() {
  300 + getZoneList().then(res => {
  301 + if (res.success) {
  302 + this.zoneList = res.result
  303 + }
  304 + })
  305 + },
283 306 clickThenSelect(record) {
284 307 return {
285 308 on: {
... ...
ant-design-vue-jeecg/src/views/system/config/ContainerList.vue
... ... @@ -14,22 +14,22 @@
14 14 <a-input placeholder="请输入库位编码" v-model="queryParam.locationCode"></a-input>
15 15 </a-form-item>
16 16 </a-col>
  17 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  18 + <a-form-item label="容器类型">
  19 + <a-select
  20 + show-search
  21 + placeholder="请选择容器类型"
  22 + option-filter-prop="children"
  23 + v-model="queryParam.containerTypeCode"
  24 + >
  25 + <a-select-option v-for="item in containerTypeList" :key="item.name" :value="item.code"
  26 + >{{ item.name }}
  27 + </a-select-option>
  28 + </a-select>
  29 + </a-form-item>
  30 + </a-col>
17 31 <template v-if="toggleSearchStatus">
18 32 <a-col :xl="6" :lg="7" :md="8" :sm="24">
19   - <a-form-item label="容器类型">
20   - <a-select
21   - show-search
22   - placeholder="请选择容器类型"
23   - option-filter-prop="children"
24   - v-model="queryParam.containerTypeCode"
25   - >
26   - <a-select-option v-for="item in containerTypeList" :key="item.name" :value="item.code"
27   - >{{ item.name }}
28   - </a-select-option>
29   - </a-select>
30   - </a-form-item>
31   - </a-col>
32   - <a-col :xl="6" :lg="7" :md="8" :sm="24">
33 33 <a-form-item label="容器状态">
34 34 <j-dict-select-tag
35 35 placeholder="请选择容器状态"
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java
... ... @@ -262,7 +262,7 @@ public class WcsServiceImpl implements WcsService {
262 262 if (!taskHeaderService.updateById(taskHeader)) {
263 263 throw new JeecgBootException("更新任务头表目标库位失败");
264 264 }
265   -
  265 +
266 266 WcsTask wcsTask = new WcsTask();
267 267 wcsTask.setToLocationCode(locationCode);
268 268 wcsTask.setPreTaskNo(String.valueOf(preTaskNo));
... ... @@ -350,7 +350,7 @@ public class WcsServiceImpl implements WcsService {
350 350 }
351 351 Result<TaskHeader> result = taskHeaderService.createTransferTask(insideLocation.getCode(), destinationLocation.getCode(), warehouseCode);
352 352 if (!result.isSuccess()) {
353   - throw new JeecgBootException("创建移库任务失败");
  353 + throw new JeecgBootException(result.getMessage());
354 354 }
355 355 preTaskNo = result.getResult().getId();
356 356 taskHeader.setPreTaskNo(preTaskNo);
... ... @@ -634,6 +634,8 @@ public class WcsServiceImpl implements WcsService {
634 634 originLocationCode = originLocationCode + "," + taskLocationCode;
635 635 }
636 636  
  637 + taskHeader = new TaskHeader();
  638 + taskHeader.setId(Integer.parseInt(taskNo));
637 639 taskHeader.setToLocationCode(locationCode);
638 640 taskHeader.setExceptionName("重入处理");
639 641 taskHeader.setIsDoubleIn(QuantityConstant.DOUBLE_IN);
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/address/service/impl/AddressServiceImpl.java
1 1 package org.jeecg.modules.wms.config.address.service.impl;
2 2  
3   -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4   -import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5   -import org.apache.commons.math3.analysis.function.Add;
6 3 import org.jeecg.modules.wms.config.address.entity.Address;
7 4 import org.jeecg.modules.wms.config.address.mapper.AddressMapper;
8 5 import org.jeecg.modules.wms.config.address.service.IAddressService;
9 6 import org.springframework.cache.annotation.Cacheable;
10 7 import org.springframework.stereotype.Service;
11 8  
  9 +import com.aliyuncs.utils.StringUtils;
  10 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  11 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
12 12 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
13 13  
14 14 /**
... ... @@ -21,30 +21,28 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
21 21 public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements IAddressService {
22 22  
23 23 @Override
24   - @Cacheable(cacheNames = "getAddressByUrl#300", key = "#root.methodName")
  24 + @Cacheable(cacheNames = "getAddressByUrl#1", key = "#root.methodName + '_' + #url", unless = "#result == null ")
25 25 public Address getAddressByUrl(String url) {
26 26 LambdaQueryWrapper<Address> addressLambdaQueryWrapper = Wrappers.lambdaQuery();
27   - addressLambdaQueryWrapper.eq(Address::getUrl, url).last(" limit 1");
28   - Address address = getOne(addressLambdaQueryWrapper);
29   - return address;
  27 + addressLambdaQueryWrapper.eq(Address::getUrl, url);
  28 + return getOne(addressLambdaQueryWrapper);
30 29 }
31 30  
32 31 @Override
33   - @Cacheable(cacheNames = "getUrlByParam#300", key = "#root.methodName + '_' + #param + '_' + #warehouseCode + '_' + #zoneCode")
  32 + @Cacheable(cacheNames = "getUrlByParam#1", key = "#root.methodName + '_' + #param + '_' + #warehouseCode + '_' + #zoneCode", unless = "#result == null ")
34 33 public String getUrlByParam(String param, String warehouseCode, String zoneCode) {
35 34 LambdaQueryWrapper<Address> addressLambdaQueryWrapper = Wrappers.lambdaQuery();
36   - addressLambdaQueryWrapper.eq(Address::getParam, param).eq(Address::getWarehouseCode, warehouseCode).eq(Address::getZoneCode, zoneCode);
  35 + addressLambdaQueryWrapper.eq(Address::getParam, param).eq(!StringUtils.isEmpty(warehouseCode), Address::getWarehouseCode, warehouseCode)
  36 + .eq(!StringUtils.isEmpty(zoneCode), Address::getZoneCode, zoneCode);
37 37 Address address = getOne(addressLambdaQueryWrapper);
38 38 if (address == null) {
39 39 return null;
40 40 }
41   - String url = address.getUrl();
42   - return url;
  41 + return address.getUrl();
43 42 }
44 43  
45   - /** #300 缓存300秒 */
46 44 @Override
47   - @Cacheable(cacheNames = "getUrlByParam#300", key = "#root.methodName + '_' + #param")
  45 + @Cacheable(cacheNames = "getUrlByParam#1", key = "#root.methodName + '_' + #param", unless = "#result == null ")
48 46 public String getUrlByParam(String param) {
49 47 LambdaQueryWrapper<Address> addressLambdaQueryWrapper = Wrappers.lambdaQuery();
50 48 addressLambdaQueryWrapper.eq(Address::getParam, param);
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/CompareLocationDto.java
... ... @@ -17,28 +17,28 @@ public class CompareLocationDto {
17 17 private String locationCode;
18 18  
19 19 /** 库位表容器编码 */
20   - private String locationContainerCode;
  20 + private String locationContainerCode = "";
21 21  
22 22 /** 库位表状态 */
23   - private String locationStatus;
  23 + private String locationStatus = "";
24 24  
25 25 /** 托盘表容器编码 */
26   - private String containerContainerCode;
  26 + private String containerContainerCode = "";
27 27  
28 28 /** 托盘表状态 */
29   - private String containerStatus;
  29 + private String containerStatus = "";
30 30  
31 31 /** 库存表容器编码 */
32   - private String inventoryContainerCode;
  32 + private String inventoryContainerCode = "";
33 33  
34 34 /** 库存表状态 */
35   - private String inventoryStatus;
  35 + private String inventoryStatus = "";
36 36  
37 37 /** WCS库位容器编码 */
38   - private String wcsContainerCode;
  38 + private String wcsContainerCode = "";
39 39  
40 40 /** WCS库位表状态 */
41   - private String wcsLocationStatus;
  41 + private String wcsLocationStatus = "";
42 42  
43 43 /** 数据状态 */
44 44 private Integer consistencyStatus = 1;
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/QueryCompareLocationDto.java
... ... @@ -5,6 +5,9 @@ import lombok.Data;
5 5 @Data
6 6 public class QueryCompareLocationDto {
7 7  
  8 + /** 库区编码 */
  9 + private String zoneCode;
  10 +
8 11 /** 仓库编码 */
9 12 private String warehouseCode;
10 13  
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java
... ... @@ -4,8 +4,8 @@ import java.text.MessageFormat;
4 4 import java.util.ArrayList;
5 5 import java.util.Collections;
6 6 import java.util.Comparator;
  7 +import java.util.Date;
7 8 import java.util.HashMap;
8   -import java.util.HashSet;
9 9 import java.util.List;
10 10 import java.util.Map;
11 11 import java.util.Set;
... ... @@ -14,6 +14,7 @@ import java.util.stream.Collectors;
14 14  
15 15 import javax.annotation.Resource;
16 16  
  17 +import org.apache.commons.collections4.ListUtils;
17 18 import org.apache.shiro.util.CollectionUtils;
18 19 import org.jeecg.common.api.vo.Result;
19 20 import org.jeecg.common.exception.JeecgBootException;
... ... @@ -92,7 +93,7 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
92 93  
93 94 @Resource
94 95 private IInventoryDetailService inventoryDetailService;
95   -
  96 +
96 97 @Autowired
97 98 private ILocationService locationService;
98 99  
... ... @@ -446,47 +447,52 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
446 447  
447 448 @Override
448 449 public PageUtil<CompareLocationDto> compareWcsLocation(QueryCompareLocationDto queryCompareLocationDto) {
  450 + List<CompareLocationDto> compareLocationDtoList = new ArrayList<CompareLocationDto>();
  451 + if (StringUtils.isEmpty(queryCompareLocationDto.getZoneCode())) {
  452 + return PageUtil.create(compareLocationDtoList, queryCompareLocationDto.getPageNo(), queryCompareLocationDto.getPageSize());
  453 + }
449 454 // 初始化数据
450   - Set<String> locationCodes = new HashSet<String>();
  455 + List<String> locationCodes = new ArrayList<String>();
451 456 Map<String, Location> locationMap = new HashMap<String, Location>();
452 457 Map<String, List<Container>> containerMap = new HashMap<String, List<Container>>();
453 458 Map<String, List<InventoryDetail>> inventoryDetailMap = new HashMap<String, List<InventoryDetail>>();
454 459 Map<String, List<WcsLocationDto>> wcsLocationMap = new HashMap<String, List<WcsLocationDto>>();
455   -
456 460 // 1.获取WMS库位表库位信息
457 461 LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
458 462 locationLambdaQueryWrapper.select(Location::getWarehouseCode, Location::getCode, Location::getContainerCode, Location::getStatus)
459 463 .eq(Location::getWarehouseCode, queryCompareLocationDto.getWarehouseCode())
  464 + .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getZoneCode()), Location::getZoneCode, queryCompareLocationDto.getZoneCode())
460 465 .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getLocationCode()), Location::getCode, queryCompareLocationDto.getLocationCode())
461 466 .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getContainerCode()), Location::getContainerCode, queryCompareLocationDto.getContainerCode());
462 467 List<Location> locationList = list(locationLambdaQueryWrapper);
463 468 if (!CollectionUtils.isEmpty(locationList)) {
464 469 locationMap.putAll(locationList.stream().collect(Collectors.toMap(Location::getCode, Function.identity(), (key1, key2) -> key2)));
465   - locationCodes.addAll(locationList.stream().map(t -> t.getCode()).collect(Collectors.toSet()));
  470 + locationCodes.addAll(locationList.stream().map(t -> t.getCode()).distinct().collect(Collectors.toSet()));
466 471 }
467   -
468 472 if (!CollectionUtils.isEmpty(locationCodes)) {
469   - // 2.获取WMS托盘表库位信息
470   - LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery();
471   - containerLambdaQueryWrapper.select(Container::getWarehouseCode, Container::getLocationCode, Container::getCode, Container::getStatus)
472   - .eq(Container::getWarehouseCode, queryCompareLocationDto.getWarehouseCode()).in(Container::getLocationCode, locationCodes);
473   - List<Container> containerList = containerService.list(containerLambdaQueryWrapper);
474   - if (!CollectionUtils.isEmpty(containerList)) {
475   - containerMap.putAll(containerList.stream().collect(Collectors.groupingBy(Container::getLocationCode)));
476   - }
477   -
478   - // 3.获取WMS库存表库位信息
479   - LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery();
480   - inventoryDetailLambdaQueryWrapper
481   - .select(InventoryDetail::getWarehouseCode, InventoryDetail::getLocationCode, InventoryDetail::getContainerCode, InventoryDetail::getInventoryStatus)
482   - .eq(InventoryDetail::getWarehouseCode, queryCompareLocationDto.getWarehouseCode()).in(InventoryDetail::getLocationCode, locationCodes);
483   - List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper);
484   - if (!CollectionUtils.isEmpty(inventoryDetailList)) {
485   - inventoryDetailMap.putAll(inventoryDetailList.stream().collect(Collectors.groupingBy(InventoryDetail::getLocationCode)));
  473 + List<List<String>> partitionList = ListUtils.partition(locationCodes, 1000);
  474 + for (List<String> list : partitionList) {
  475 + // 2.获取WMS托盘表库位信息
  476 + LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery();
  477 + containerLambdaQueryWrapper.select(Container::getWarehouseCode, Container::getLocationCode, Container::getCode, Container::getStatus)
  478 + .eq(Container::getWarehouseCode, queryCompareLocationDto.getWarehouseCode()).in(Container::getLocationCode, list);
  479 + List<Container> containerList = containerService.list(containerLambdaQueryWrapper);
  480 + if (!CollectionUtils.isEmpty(containerList)) {
  481 + containerMap.putAll(containerList.stream().collect(Collectors.groupingBy(Container::getLocationCode)));
  482 + }
  483 + // 3.获取WMS库存表库位信息
  484 + LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery();
  485 + inventoryDetailLambdaQueryWrapper
  486 + .select(InventoryDetail::getWarehouseCode, InventoryDetail::getLocationCode, InventoryDetail::getContainerCode)
  487 + .eq(InventoryDetail::getWarehouseCode, queryCompareLocationDto.getWarehouseCode()).in(InventoryDetail::getLocationCode, list);
  488 + List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper);
  489 + if (!CollectionUtils.isEmpty(inventoryDetailList)) {
  490 + inventoryDetailMap.putAll(inventoryDetailList.stream().collect(Collectors.groupingBy(InventoryDetail::getLocationCode)));
  491 + }
486 492 }
487   -
488 493 // 4.获取WCS库位信息
489   - String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_WCS_LOCATION_INFO);
  494 + String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_WCS_LOCATION_INFO, queryCompareLocationDto.getWarehouseCode(),
  495 + queryCompareLocationDto.getZoneCode());
490 496 Map<String, Object> queryParamMap = new HashMap<String, Object>();
491 497 if (StringUtils.isNotEmpty(queryCompareLocationDto.getWarehouseCode())) {
492 498 queryParamMap.put("warehouseCode", queryCompareLocationDto.getWarehouseCode());
... ... @@ -504,9 +510,7 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
504 510 }
505 511 }
506 512 }
507   -
508 513 // 对返回数据进行组装
509   - List<CompareLocationDto> compareLocationDtoList = new ArrayList<CompareLocationDto>();
510 514 if (!CollectionUtils.isEmpty(locationCodes)) {
511 515 for (String locationCode : locationCodes) {
512 516 if (StringUtils.isEmpty(locationCode)) {
... ... @@ -524,16 +528,13 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
524 528 if (!CollectionUtils.isEmpty(containerGroupList)) {
525 529 Set<String> containerCodes = containerGroupList.stream().map(t -> t.getCode()).collect(Collectors.toSet());
526 530 Set<String> containerStatus = containerGroupList.stream().map(t -> t.getStatus()).collect(Collectors.toSet());
527   -
528 531 compareLocationDto.setContainerContainerCode(StringUtils.join(containerCodes, ","));
529 532 compareLocationDto.setContainerStatus(StringUtils.join(containerStatus, ","));
530 533 }
531 534 List<InventoryDetail> inventoryGroupList = inventoryDetailMap.get(locationCode);
532 535 if (!CollectionUtils.isEmpty(inventoryGroupList)) {
533 536 Set<String> inventoryContainerCodes = inventoryGroupList.stream().map(t -> t.getContainerCode()).collect(Collectors.toSet());
534   - Set<String> inventoryStatus = inventoryGroupList.stream().map(t -> t.getInventoryStatus()).collect(Collectors.toSet());
535 537 compareLocationDto.setInventoryContainerCode(StringUtils.join(inventoryContainerCodes, ","));
536   - compareLocationDto.setInventoryStatus(StringUtils.join(inventoryStatus, ","));
537 538 }
538 539 List<WcsLocationDto> wcsLocationGroupList = wcsLocationMap.get(locationCode);
539 540 if (!CollectionUtils.isEmpty(wcsLocationGroupList)) {
... ... @@ -542,12 +543,32 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
542 543 compareLocationDto.setWcsContainerCode(StringUtils.join(wcsContainerCodes, ","));
543 544 compareLocationDto.setWcsLocationStatus(StringUtils.join(wcsContainerStatus, ","));
544 545 }
545   - if (ObjectUtil.compare(compareLocationDto.getLocationContainerCode(), compareLocationDto.getContainerContainerCode()) != 0
546   - || ObjectUtil.compare(compareLocationDto.getLocationContainerCode(), compareLocationDto.getInventoryContainerCode()) != 0
547   - || ObjectUtil.compare(compareLocationDto.getLocationContainerCode(), compareLocationDto.getWcsContainerCode()) != 0
548   - || ObjectUtil.compare(compareLocationDto.getLocationStatus(), compareLocationDto.getContainerStatus()) != 0
549   - || ObjectUtil.compare(compareLocationDto.getLocationStatus(), compareLocationDto.getWcsLocationStatus()) != 0) {
550   - compareLocationDto.setConsistencyStatus(0);
  546 + // 值不为null时 ,才比较数据是否匹配
  547 + if (!StringUtils.isEmpty(compareLocationDto.getLocationContainerCode()) || !StringUtils.isEmpty(compareLocationDto.getContainerContainerCode())) {
  548 + if (ObjectUtil.compare(compareLocationDto.getLocationContainerCode(), compareLocationDto.getContainerContainerCode()) != 0) {
  549 + compareLocationDto.setConsistencyStatus(0);
  550 + }
  551 + }
  552 + // 库存表有库存信息时才比较库存表容器信息
  553 + if (!StringUtils.isEmpty(compareLocationDto.getLocationContainerCode()) && !StringUtils.isEmpty(compareLocationDto.getInventoryContainerCode())) {
  554 + if (ObjectUtil.compare(compareLocationDto.getLocationContainerCode(), compareLocationDto.getInventoryContainerCode()) != 0) {
  555 + compareLocationDto.setConsistencyStatus(0);
  556 + }
  557 + }
  558 + if (!StringUtils.isEmpty(compareLocationDto.getLocationContainerCode()) || !StringUtils.isEmpty(compareLocationDto.getWcsContainerCode())) {
  559 + if (ObjectUtil.compare(compareLocationDto.getLocationContainerCode(), compareLocationDto.getWcsContainerCode()) != 0) {
  560 + compareLocationDto.setConsistencyStatus(0);
  561 + }
  562 + }
  563 + if (!StringUtils.isEmpty(compareLocationDto.getLocationStatus()) || !StringUtils.isEmpty(compareLocationDto.getWcsLocationStatus())) {
  564 + if (ObjectUtil.compare(compareLocationDto.getLocationStatus(), compareLocationDto.getWcsLocationStatus()) != 0) {
  565 + compareLocationDto.setConsistencyStatus(0);
  566 + }
  567 + }
  568 + if (!StringUtils.isEmpty(location.getContainerCode())) {
  569 + if (ObjectUtil.compare(compareLocationDto.getLocationStatus(), compareLocationDto.getContainerStatus()) != 0) {
  570 + compareLocationDto.setConsistencyStatus(0);
  571 + }
551 572 }
552 573 compareLocationDtoList.add(compareLocationDto);
553 574 }
... ... @@ -563,11 +584,11 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
563 584 @Override
564 585 public PageUtil<CompareLocationTaskDto> compareWcsLocationTask(QueryCompareLocationTaskDto queryCompareLocationTaskDto) {
565 586 List<CompareLocationTaskDto> finalCompareLocationTaskList = new ArrayList<CompareLocationTaskDto>();
566   -// if (queryCompareLocationTaskDto.getLocationCode() == null) {
567   -// return PageUtil.create(finalCompareLocationTaskList, queryCompareLocationTaskDto.getPageNo(), queryCompareLocationTaskDto.getPageSize());
568   -// }
569   - // 只查询近90天的数据
570   -// String queryCreateTime = DateUtil.format(DateUtil.offsetDay(new Date(), -90), DatePattern.NORM_DATE_PATTERN);
  587 + if (queryCompareLocationTaskDto.getLocationCode() == null) {
  588 + return PageUtil.create(finalCompareLocationTaskList, queryCompareLocationTaskDto.getPageNo(), queryCompareLocationTaskDto.getPageSize());
  589 + }
  590 + // 只查询近180天的数据
  591 + String queryCreateTime = DateUtil.format(DateUtil.offsetDay(new Date(), -180), DatePattern.NORM_DATE_PATTERN);
571 592 // 1.获取WMS任务信息
572 593 LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery();
573 594 taskHeaderLambdaQueryWrapper
... ... @@ -577,15 +598,25 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
577 598 .gt(StringUtils.isNotEmpty(queryCompareLocationTaskDto.getTaskCreateTimeBegin()), TaskHeader::getCreateTime,
578 599 queryCompareLocationTaskDto.getTaskCreateTimeBegin())
579 600 .lt(StringUtils.isNotEmpty(queryCompareLocationTaskDto.getTaskCreateTimeEnd()), TaskHeader::getCreateTime,
580   - queryCompareLocationTaskDto.getTaskCreateTimeEnd());
581   -// .ge(TaskHeader::getCreateTime, queryCreateTime)
  601 + queryCompareLocationTaskDto.getTaskCreateTimeEnd())
  602 + .ge(TaskHeader::getCreateTime, queryCreateTime);
582 603 if (StringUtils.isNotEmpty(queryCompareLocationTaskDto.getLocationCode())) {
583 604 taskHeaderLambdaQueryWrapper.and(t -> t.eq(TaskHeader::getFromLocationCode, queryCompareLocationTaskDto.getLocationCode()).or()
584 605 .eq(TaskHeader::getToLocationCode, queryCompareLocationTaskDto.getLocationCode()));
585 606 }
  607 + LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
  608 + locationLambdaQueryWrapper.eq(Location::getCode, queryCompareLocationTaskDto.getLocationCode());
  609 + Location location = locationService.getOne(locationLambdaQueryWrapper);
  610 + if (location == null) {
  611 + return PageUtil.create(finalCompareLocationTaskList, queryCompareLocationTaskDto.getPageNo(), queryCompareLocationTaskDto.getPageSize());
  612 + }
586 613 List<TaskHeader> taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper);
  614 + if (CollectionUtils.isEmpty(taskHeaderList)) {
  615 + return PageUtil.create(finalCompareLocationTaskList, queryCompareLocationTaskDto.getPageNo(), queryCompareLocationTaskDto.getPageSize());
  616 + }
587 617 // 2.获取WCS任务信息
588   - String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_WCS_TAKS_INFOS);
  618 + Map<Integer, List<WcsTaskDto>> wcsTaskMap = new HashMap<Integer, List<WcsTaskDto>>();
  619 + String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_WCS_TAKS_INFOS, queryCompareLocationTaskDto.getWarehouseCode(), location.getZoneCode());
589 620 Map<String, Object> queryParamMap = new HashMap<String, Object>();
590 621 if (StringUtils.isNotEmpty(queryCompareLocationTaskDto.getWarehouseCode())) {
591 622 queryParamMap.put("warehouseCode", queryCompareLocationTaskDto.getWarehouseCode());
... ... @@ -599,18 +630,15 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
599 630 if (StringUtils.isNotEmpty(queryCompareLocationTaskDto.getTaskCreateTimeEnd())) {
600 631 queryParamMap.put("end", queryCompareLocationTaskDto.getTaskCreateTimeEnd());
601 632 }
602   -// queryParamMap.put("begin", queryCreateTime);
  633 + queryParamMap.put("begin", queryCreateTime);
603 634 String jsonStringResult = OkHttpUtils.sendPostByJsonStr(url, JSON.toJSONString(queryParamMap));
604 635 WcsResultDto<List<WcsTaskDto>> wcsResult = JSON.parseObject(jsonStringResult, new TypeReference<WcsResultDto<List<WcsTaskDto>>>() {});
605   -
606   - Map<Integer, List<WcsTaskDto>> wcsTaskMap = new HashMap<Integer, List<WcsTaskDto>>();
607 636 if (wcsResult.getCode() != null && wcsResult.getCode().equals(200)) {
608 637 List<WcsTaskDto> wcsTaskList = wcsResult.getData();
609 638 if (wcsTaskList != null && wcsTaskList.size() > 0) {
610 639 wcsTaskMap.putAll(wcsTaskList.stream().collect(Collectors.groupingBy(WcsTaskDto::getTaskNo)));
611 640 }
612 641 }
613   -
614 642 // 对返回数据进行组装
615 643 List<CompareLocationTaskDto> wcsCompareLocationTaskList = new ArrayList<CompareLocationTaskDto>();
616 644 if (!CollectionUtils.isEmpty(taskHeaderList)) {
... ... @@ -635,11 +663,29 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
635 663 compareLocationTaskDto.setWcsContainerCode(wcsTaskDto.getContainerCode());
636 664 compareLocationTaskDto.setWcsTaskStatus(wcsTaskDto.getTaskStatus());
637 665 compareLocationTaskDto.setWcsTaskCreateTime(wcsTaskDto.getCreated());
638   - if (ObjectUtil.compare(compareLocationTaskDto.getFromLocationCode(), compareLocationTaskDto.getWcsFromLocationCode()) != 0
639   - || ObjectUtil.compare(compareLocationTaskDto.getToLocationCode(), compareLocationTaskDto.getWcsToLocationCode()) != 0
640   - || ObjectUtil.compare(compareLocationTaskDto.getContainerCode(), compareLocationTaskDto.getWcsContainerCode()) != 0
641   - || ObjectUtil.compare(compareLocationTaskDto.getTaskStatus(), compareLocationTaskDto.getWcsTaskStatus()) != 0) {
642   - compareLocationTaskDto.setConsistencyStatus(0);
  666 + // 值不为null时 ,才比较数据是否匹配
  667 + if (!StringUtils.isEmpty(compareLocationTaskDto.getFromLocationCode())
  668 + || !StringUtils.isEmpty(compareLocationTaskDto.getWcsFromLocationCode())) {
  669 + if (ObjectUtil.compare(compareLocationTaskDto.getFromLocationCode(), compareLocationTaskDto.getWcsFromLocationCode()) != 0) {
  670 + compareLocationTaskDto.setConsistencyStatus(0);
  671 + }
  672 + }
  673 + if (!StringUtils.isEmpty(compareLocationTaskDto.getToLocationCode())
  674 + || !StringUtils.isEmpty(compareLocationTaskDto.getWcsToLocationCode())) {
  675 + if (ObjectUtil.compare(compareLocationTaskDto.getToLocationCode(), compareLocationTaskDto.getWcsToLocationCode()) != 0) {
  676 + compareLocationTaskDto.setConsistencyStatus(0);
  677 + }
  678 + }
  679 + if (!StringUtils.isEmpty(compareLocationTaskDto.getContainerCode()) || !StringUtils.isEmpty(compareLocationTaskDto.getWcsContainerCode())) {
  680 + if (ObjectUtil.compare(compareLocationTaskDto.getContainerCode(), compareLocationTaskDto.getWcsContainerCode()) != 0) {
  681 + compareLocationTaskDto.setConsistencyStatus(0);
  682 + }
  683 + }
  684 + if (!StringUtils.isEmpty(compareLocationTaskDto.getTaskStatus() + "")
  685 + || !StringUtils.isEmpty(compareLocationTaskDto.getWcsTaskStatus() + "")) {
  686 + if (ObjectUtil.compare(compareLocationTaskDto.getTaskStatus(), compareLocationTaskDto.getWcsTaskStatus()) != 0) {
  687 + compareLocationTaskDto.setConsistencyStatus(0);
  688 + }
643 689 }
644 690 wcsCompareLocationTaskList.add(compareLocationTaskDto);
645 691 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java
... ... @@ -365,7 +365,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi
365 365 shipmentContainerHeader = new ShipmentContainerHeader();
366 366 shipmentContainerHeader.setContainerCode(containerCode);
367 367 shipmentContainerHeader.setFromLocationCode(locationCode);
368   - if (taskLocationRule == QuantityConstant.RULE_TASK_SET_LOCATION) {
  368 + if (taskLocationRule == QuantityConstant.RULE_TASK_SET_LOCATION && taskType == QuantityConstant.TASK_TYPE_SORTINGSHIPMENT) {
369 369 shipmentContainerHeader.setToLocationCode(locationCode);
370 370 }
371 371 shipmentContainerHeader.setWarehouseCode(warehouseCode);
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java
... ... @@ -305,6 +305,14 @@ public interface ITaskHeaderService extends IService&lt;TaskHeader&gt; {
305 305 boolean updateStatusById(int status, int id);
306 306  
307 307 /**
  308 + * 更新
  309 + * @param status
  310 + * @param id
  311 + * @return
  312 + */
  313 + boolean updateExceptionStateById(int status, int id);
  314 +
  315 + /**
308 316 * 更新状态
309 317 * @param preTaskNo
310 318 * @param id
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... ... @@ -550,6 +550,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
550 550 @Override
551 551 @Transactional(rollbackFor = Exception.class)
552 552 public Result handleEmptyOut(String taskNo) {
  553 + log.info("开始处理空出任务" + taskNo);
553 554 // 1、判断非空字段
554 555 if (StringUtils.isEmpty(taskNo)) {
555 556 return Result.error("处理空出失败,任务号为空");
... ... @@ -615,15 +616,18 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
615 616 }
616 617 // 9 更新单据
617 618 taskHeader.setExceptionState(QuantityConstant.EXCEPTION_TASK_HANDLE);
618   - success = taskHeaderService.updateById(taskHeader);
  619 + success = taskHeaderService.updateExceptionStateById(QuantityConstant.EXCEPTION_TASK_HANDLE, taskHeader.getId());
619 620 if (!success) {
620 621 throw new JeecgBootException("处理空出失败,更新任务失败");
621 622 }
  623 + log.info("完成处理空出任务" + taskNo);
622 624 return Result.ok("处理空出成功");
623 625 }
624 626  
625 627 @Override
  628 + @Transactional(rollbackFor = Exception.class)
626 629 public Result handleDoubleIn(String taskNo) {
  630 + log.info("开始处理重入任务" + taskNo);
627 631 // 1、判断非空字段
628 632 if (StringUtils.isEmpty(taskNo)) {
629 633 return Result.error("处理重入失败,任务号为空");
... ... @@ -661,22 +665,24 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
661 665 if (toLocation == null) {
662 666 return Result.error("处理重入失败,没有找到库位");
663 667 }
664   - toLocation.setStatus(QuantityConstant.STATUS_LOCATION_EMPTY);
665   - boolean success = locationService.updateById(toLocation);
  668 + boolean success = locationService.updateStatus(locationCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
666 669 if (!success) {
667 670 throw new JeecgBootException("处理重入失败,更新库位失败");
668 671 }
669 672 }
670 673 taskHeader.setExceptionState(QuantityConstant.EXCEPTION_TASK_HANDLE);
671   - boolean success = taskHeaderService.updateById(taskHeader);
  674 + boolean success = taskHeaderService.updateExceptionStateById(QuantityConstant.EXCEPTION_TASK_HANDLE, taskHeader.getId());
672 675 if (!success) {
673 676 throw new JeecgBootException("处理重入失败,更新任务失败");
674 677 }
  678 + log.info("完成处理重入任务" + taskNo);
675 679 return Result.ok("处理重入成功");
676 680 }
677 681  
678 682 @Override
  683 + @Transactional(rollbackFor = Exception.class)
679 684 public Result handlePickupError(String taskNo) {
  685 + log.info("开始处理取货错任务" + taskNo);
680 686 // 1、判断非空字段
681 687 if (StringUtils.isEmpty(taskNo)) {
682 688 return Result.error("处理取货错失败,任务号为空");
... ... @@ -691,12 +697,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
691 697 return Result.OK("处理取货错失败, 任务已经完成");
692 698 }
693 699  
  700 + taskHeader = new TaskHeader();
  701 + taskHeader.setId(Integer.parseInt(taskNo));
694 702 taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD);
695 703 taskHeader.setExceptionState(QuantityConstant.EXCEPTION_TASK_HANDLE);
696 704 boolean success = taskHeaderService.updateById(taskHeader);
697 705 if (!success) {
698 706 throw new JeecgBootException("处理取货错失败,更新任务失败");
699 707 }
  708 + log.info("完成处理取货错任务" + taskNo);
700 709 return Result.ok("处理取货错成功");
701 710 }
702 711  
... ... @@ -1121,27 +1130,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1121 1130 throw new JeecgBootException("完成入库任务时,保存库存交易失败");
1122 1131 }
1123 1132  
1124   - if (StringUtils.isNotEmpty(fromLocationCode) && !fromLocationCode.equals(toLocationCode)) {
1125   - success =
1126   - locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
1127   - if (!success) {
1128   - throw new JeecgBootException("完成入库任务时,更新源库位失败");
1129   - }
1130   - }
1131   -
1132   - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
1133   - if (!success) {
1134   - throw new JeecgBootException("完成入库任务时,更新库位失败");
1135   - }
1136   -
1137   - success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId());
1138   - if (!success) {
1139   - throw new JeecgBootException("完成入库任务时,更新任务失败");
1140   - }
1141   - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY,
1142   - taskHeader.getContainerFillStatus(), warehouseCode);
1143   - if (!success) {
1144   - throw new JeecgBootException("完成入库任务时,更新容器失败");
  1133 + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), taskType, containerCode, fromLocationCode,
  1134 + toLocationCode, warehouseCode);
  1135 + if (!result.isSuccess()) {
  1136 + throw new JeecgBootException(result.getMessage());
1145 1137 }
1146 1138 if (!taskHeaderService.combineInventoryDetail(taskHeader)) {
1147 1139 throw new JeecgBootException("合并入库库存失败");
... ... @@ -1159,6 +1151,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1159 1151 if (!inventoryHeaderService.updateInventoryContainerStatusByContainerCode(containerCode, warehouseCode)) {
1160 1152 throw new JeecgBootException("完成入库任务时,更新托盘状态失败");
1161 1153 }
  1154 + success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId());
  1155 + if (!success) {
  1156 + throw new JeecgBootException("完成出库任务,保存任务头失败");
  1157 + }
1162 1158 receiptDetaiList = receiptDetaiList.stream().filter(t -> t.getStatus().equals(QuantityConstant.RECEIPT_HEADER_COMPLETED)).collect(Collectors.toList());
1163 1159 LogRecordContext.putVariable("taskHeader", taskHeader);
1164 1160 LogRecordContext.putVariable("extraJsonString1", JSON.toJSONString(taskDetailList));
... ... @@ -1309,44 +1305,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1309 1305 if (!success) {
1310 1306 throw new JeecgBootException("完成出库任务,保存库存详情失败");
1311 1307 }
1312   - taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED);
1313   - success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId());
1314   - if (!success) {
1315   - throw new JeecgBootException("完成出库任务,保存任务头失败");
1316   - }
1317   - if (taskType == QuantityConstant.TASK_TYPE_WHOLESHIPMENT) {
1318   - success =
1319   - locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
1320   - if (!success) {
1321   - throw new JeecgBootException("完成整盘出库任务,更新源库位失败");
1322   - }
1323   - success = containerService.updateLocationCodeAndStatus(containerCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_CONTAINER_EMPTY,
1324   - QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode);
1325   - if (!success) {
1326   - throw new JeecgBootException("完成整盘出库任务,更新容器失败");
1327   - }
1328   - } else if (taskType == QuantityConstant.TASK_TYPE_SORTINGSHIPMENT) {
1329   - if (!fromLocationCode.equals(toLocationCode)) {
1330   - success = locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY,
1331   - warehouseCode);
1332   - if (!success) {
1333   - throw new JeecgBootException("完成分拣出库任务,更新源库位失败");
1334   - }
1335   - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
1336   - if (!success) {
1337   - throw new JeecgBootException("完成分拣出库任务,更新目标库位失败");
1338   - }
1339   - } else {
1340   - success = locationService.updateStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
1341   - if (!success) {
1342   - throw new JeecgBootException("完成分拣出库任务,更新源库位失败");
1343   - }
1344   - }
1345   - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY,
1346   - inventoryDetailList.size() == 0 ? QuantityConstant.STATUS_CONTAINER_FILL_EMPTY : QuantityConstant.STATUS_CONTAINER_FILL_SOME, warehouseCode);
1347   - if (!success) {
1348   - throw new JeecgBootException("完成分拣出库任务,更新容器失败");
1349   - }
  1308 + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), taskType, containerCode, fromLocationCode,
  1309 + toLocationCode, warehouseCode);
  1310 + if (!result.isSuccess()) {
  1311 + throw new JeecgBootException(result.getMessage());
1350 1312 }
1351 1313 ShipmentContainerHeader shipmentContainerHeader = shipmentContainerHeaderService.getById(taskHeader.getShipmentContainerHeaderId());
1352 1314 if (shipmentContainerHeader == null) {
... ... @@ -1378,6 +1340,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1378 1340 throw new JeecgBootException("完成出库任务,更新库存状态失败");
1379 1341 }
1380 1342 }
  1343 + success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId());
  1344 + if (!success) {
  1345 + throw new JeecgBootException("完成出库任务,保存任务头失败");
  1346 + }
1381 1347 // 操作记录添加
1382 1348 shipmentDetailList = shipmentDetailList.stream().filter(t -> t.getStatus().equals(QuantityConstant.SHIPMENT_HEADER_COMPLETED)).collect(Collectors.toList());
1383 1349 LogRecordContext.putVariable("taskHeader", taskHeader);
... ... @@ -1599,7 +1565,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1599 1565 }
1600 1566 zoneCode = fromLocation.getZoneCode();
1601 1567 taskLockEntity.setZoneCode(zoneCode);
1602   - if (StringUtils.isNotEmpty(toLocationCode)) {
  1568 + if (StringUtils.isNotEmpty(toLocationCode) && !fromLocationCode.equals(toLocationCode)) {
1603 1569 Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode);
1604 1570 if (toLocation == null) {
1605 1571 return Result.error("创建分拣任务时," + toLocationCode + "目标库位不存在");
... ... @@ -1620,9 +1586,11 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1620 1586 throw new JeecgBootException("创建分拣任务时,更新库位状态失败");
1621 1587 }
1622 1588 if (StringUtils.isNotEmpty(toLocationCode)) {
1623   - success = locationService.updateStatus(toLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode);
1624   - if (!success) {
1625   - throw new JeecgBootException("创建分拣任务时,更新库位状态失败");
  1589 + if (!fromLocationCode.equals(toLocationCode)) {
  1590 + success = locationService.updateStatus(toLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode);
  1591 + if (!success) {
  1592 + throw new JeecgBootException("创建分拣任务时,更新库位状态失败");
  1593 + }
1626 1594 }
1627 1595 }
1628 1596 return Result.OK("创建分拣任务成功", taskLockEntity);
... ... @@ -1654,26 +1622,42 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1654 1622 String toLocationCode, String warehouseCode) {
1655 1623 Result result = null;
1656 1624 boolean success = false;
1657   - if (StringUtils.isEmpty(toLocationCode) && taskType == QuantityConstant.TASK_TYPE_OVER_STATION) {
1658   - return Result.error("完成任务时, 目标库位号为空");
  1625 + if (StringUtils.isEmpty(containerCode)) {
  1626 + return Result.error("任务类型" + taskType + "完成任务时, 容器号为空");
  1627 + }
  1628 + Container container = containerService.getContainerByCode(containerCode, warehouseCode);
  1629 + if (container == null) {
  1630 + return Result.error("任务类型" + taskType + "完成任务时, 没有找到托盘" + containerCode);
1659 1631 }
1660 1632 switch (taskType) {
1661 1633 case QuantityConstant.TASK_TYPE_WHOLERECEIPT:
1662 1634 case QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT:
  1635 + if (StringUtils.isEmpty(toLocationCode)) {
  1636 + return Result.error("任务类型" + taskType + "完成任务时, 目标库位号为空");
  1637 + }
1663 1638 success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, containerFillStatus,
1664 1639 warehouseCode);
1665 1640 break;
1666 1641 case QuantityConstant.TASK_TYPE_EMPTYRECEIPT:
  1642 + if (StringUtils.isEmpty(toLocationCode)) {
  1643 + return Result.error("任务类型" + taskType + "完成任务时, 目标库位号为空");
  1644 + }
1667 1645 success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY,
1668 1646 QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode);
1669 1647 break;
1670 1648 case QuantityConstant.TASK_TYPE_MANY_EMPTYRECEIPT:
  1649 + if (StringUtils.isEmpty(toLocationCode)) {
  1650 + return Result.error("任务类型" + taskType + "完成任务时, 目标库位号为空");
  1651 + }
1671 1652 success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY,
1672 1653 QuantityConstant.STATUS_CONTAINER_FILL_MANY, warehouseCode);
1673 1654 break;
1674 1655 case QuantityConstant.TASK_TYPE_WHOLESHIPMENT:
1675 1656 case QuantityConstant.TASK_TYPE_EMPTYSHIPMENT:
1676 1657 case QuantityConstant.TASK_TYPE_MANY_EMPTYSHIPMENT:
  1658 + if (StringUtils.isEmpty(fromLocationCode)) {
  1659 + return Result.error("任务类型" + taskType + "完成任务时, 起始库位号为空");
  1660 + }
1677 1661 success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY,
1678 1662 QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode);
1679 1663 break;
... ... @@ -1681,13 +1665,27 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1681 1665 case QuantityConstant.TASK_TYPE_CYCLECOUNT:
1682 1666 case QuantityConstant.TASK_TYPE_TRANSFER:
1683 1667 case QuantityConstant.TASK_TYPE_CHECK_OUT:
  1668 + if (StringUtils.isEmpty(fromLocationCode)) {
  1669 + return Result.error("任务类型" + taskType + "完成任务时, 起始库位号为空");
  1670 + }
  1671 + if (StringUtils.isEmpty(toLocationCode)) {
  1672 + return Result.error("任务类型" + taskType + "完成任务时, 目标库位号为空");
  1673 + }
1684 1674 InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode);
1685 1675 if (inventoryHeader != null) {
1686   - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY,
1687   - QuantityConstant.STATUS_CONTAINER_FILL_SOME, warehouseCode);
  1676 + if (fromLocationCode.equals(toLocationCode)) {
  1677 + success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode);
  1678 + } else {
  1679 + success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY,
  1680 + QuantityConstant.STATUS_CONTAINER_FILL_SOME, warehouseCode);
  1681 + }
1688 1682 } else {
1689   - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY,
1690   - QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode);
  1683 + if (fromLocationCode.equals(toLocationCode)) {
  1684 + success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode);
  1685 + } else {
  1686 + success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY,
  1687 + QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode);
  1688 + }
1691 1689 }
1692 1690 break;
1693 1691 case QuantityConstant.TASK_TYPE_OVER_STATION:
... ... @@ -1696,20 +1694,30 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1696 1694 break;
1697 1695 }
1698 1696 if (!success) {
1699   - throw new JeecgBootException("完成任务时,更新容器失败");
  1697 + throw new JeecgBootException("任务类型" + taskType + "完成任务时, 更新容器失败");
1700 1698 }
1701 1699 if (StringUtils.isNotEmpty(fromLocationCode) && !fromLocationCode.equals(toLocationCode)) {
  1700 + Location toLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode);
  1701 + if (toLocation == null) {
  1702 + return Result.error("任务类型" + taskType + "完成任务时," + toLocationCode + "目标库位不存在");
  1703 + }
1702 1704 success =
1703 1705 locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
1704 1706 if (!success) {
1705   - throw new JeecgBootException("完成任务时,更新源库位失败");
  1707 + throw new JeecgBootException("任务类型" + taskType + "完成任务时,更新源库位失败");
1706 1708 }
1707 1709 }
1708   - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
1709   - if (!success) {
1710   - throw new JeecgBootException("完成任务时,更新库位失败");
  1710 + if (StringUtils.isNotEmpty(toLocationCode)) {
  1711 + Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode);
  1712 + if (toLocation == null) {
  1713 + return Result.error("任务类型" + taskType + "完成任务时, " + toLocationCode + "目标库位不存在");
  1714 + }
  1715 + success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
  1716 + if (!success) {
  1717 + throw new JeecgBootException("任务类型" + taskType + "完成任务时,更新库位失败");
  1718 + }
1711 1719 }
1712   - return Result.OK("完成任务成功");
  1720 + return Result.OK("任务类型" + taskType + "完成任务成功");
1713 1721 }
1714 1722  
1715 1723 /**
... ... @@ -1733,27 +1741,16 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1733 1741 if (StringUtils.isEmpty(toLocationCode)) {
1734 1742 return Result.error("完成空托盘入库任务时, 目标库位号为空");
1735 1743 }
1736   - Container container = containerService.getContainerByCode(containerCode, warehouseCode);
1737   - if (container == null) {
1738   - return Result.error("完成空托盘入库任务时, 没有找到托盘" + containerCode);
1739   - }
1740   - Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode);
1741   - if (toLocation == null) {
1742   - return Result.error("完成空托盘入库任务时," + toLocationCode + "目标库位不存在");
1743   - }
1744   - boolean success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode);
1745   - if (!success) {
1746   - throw new JeecgBootException("完成空托盘入库任务时, 更新容器的库位号和状态失败");
  1744 + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_EMPTYRECEIPT,
  1745 + containerCode, QuantityConstant.EMPTY_STRING, toLocationCode, warehouseCode);
  1746 + if (!result.isSuccess()) {
  1747 + throw new JeecgBootException(result.getMessage());
1747 1748 }
1748   - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
  1749 + boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId());
1749 1750 if (!success) {
1750   - throw new JeecgBootException("完成空托盘入库任务时, 更新库位的容器编码和状态失败");
  1751 + throw new JeecgBootException("完成空托盘出库任务时, 更新任务失败");
1751 1752 }
1752   - success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId());
1753 1753 log.info("完成空托入库任务");
1754   - if (!success) {
1755   - throw new JeecgBootException("完成空托盘入库任务时, 更新任务失败");
1756   - }
1757 1754 return Result.OK("完成空托盘入库成功");
1758 1755 }
1759 1756  
... ... @@ -1787,7 +1784,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1787 1784 // 1.先拿到盘点单主单据
1788 1785 CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(taskHeader.getShipmentContainerHeaderId());
1789 1786  
1790   - if ((cycleCountDetail.getCountedQty().add(cycleCountDetail.getGapQty())).compareTo(BigDecimal.ZERO) == 0) {
  1787 + if (cycleCountDetail.getGapQty().compareTo(BigDecimal.ZERO) == 0) {
1791 1788 return Result.error("盘点单据系统实盘数量跟差异数量0,不能完成 单据号" + cycleCountDetail.getCycleCountHeadCode());
1792 1789 }
1793 1790  
... ... @@ -2042,17 +2039,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
2042 2039 if (port == null) {
2043 2040 return Result.error("完成空托盘出库任务时," + toPortCode + "目标出库口不存在");
2044 2041 }
2045   - boolean success =
2046   - containerService.updateLocationCodeAndStatus(containerCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode);
2047   - if (!success) {
2048   - throw new JeecgBootException("完成空托盘出库任务时, 更新容器的库位号和状态失败");
2049   - }
2050   - success =
2051   - locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
2052   - if (!success) {
2053   - throw new JeecgBootException("完成空托盘出库任务时, 更新库位的容器编码和状态失败");
  2042 + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_EMPTYSHIPMENT,
  2043 + containerCode, fromLocationCode, QuantityConstant.EMPTY_STRING, warehouseCode);
  2044 + if (!result.isSuccess()) {
  2045 + throw new JeecgBootException(result.getMessage());
2054 2046 }
2055   - success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId());
  2047 + boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId());
2056 2048 log.info("完成空托盘出库任务" + taskHeader.getId());
2057 2049 if (!success) {
2058 2050 throw new JeecgBootException("完成空托盘出库任务时, 更新任务失败");
... ... @@ -2119,24 +2111,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
2119 2111 throw new JeecgBootException("完成移库任务时,保存库存交易失败");
2120 2112 }
2121 2113 }
2122   - taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED);
2123   - success = taskHeaderService.updateById(taskHeader);
2124   - if (!success) {
2125   - throw new JeecgBootException("完成移库任务时, 更新任务失败");
2126   - }
2127   - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode);
2128   - if (!success) {
2129   - throw new JeecgBootException("完成移库任务时, 更新容器状态失败");
2130   - }
2131   - success =
2132   - locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
2133   - if (!success) {
2134   - throw new JeecgBootException("完成移库任务时, 更新起始库位状态失败");
2135   - }
2136   - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
2137   - if (!success) {
2138   - throw new JeecgBootException("完成移库任务时, 更新目标库位状态失败");
2139   - }
2140 2114 LambdaUpdateWrapper<InventoryHeader> inventoryHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate();
2141 2115 inventoryHeaderLambdaUpdateWrapper.eq(InventoryHeader::getWarehouseCode, warehouseCode).eq(InventoryHeader::getContainerCode, containerCode)
2142 2116 .eq(InventoryHeader::getLocationCode, fromLocationCode);
... ... @@ -2154,6 +2128,16 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
2154 2128 throw new JeecgBootException("完成移库任务时, 更新库存详情失败");
2155 2129 }
2156 2130 }
  2131 + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_TRANSFER,
  2132 + containerCode, fromLocationCode, toLocationCode, warehouseCode);
  2133 + if (!result.isSuccess()) {
  2134 + throw new JeecgBootException(result.getMessage());
  2135 + }
  2136 + taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED);
  2137 + success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId());
  2138 + if (!success) {
  2139 + throw new JeecgBootException("完成移库任务时, 更新任务失败");
  2140 + }
2157 2141 log.info("完成移库任务" + taskHeader.getId());
2158 2142 return Result.OK("完成移库任务成功");
2159 2143 }
... ... @@ -2218,42 +2202,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
2218 2202 if (!success) {
2219 2203 throw new JeecgBootException("完成出库查看任务时,更新库存头失败");
2220 2204 }
2221   - if (fromLocationCode.equals(toLocationCode)) {
2222   - success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode);
2223   - } else {
2224   - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode);
2225   - }
2226   - if (!success) {
2227   - throw new JeecgBootException("完成出库查看任务时,更新容器状态失败");
2228   - }
2229   - } else {
2230   - if (fromLocationCode.equals(toLocationCode)) {
2231   - success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode);
2232   - } else {
2233   - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode);
2234   - }
2235   - if (!success) {
2236   - throw new JeecgBootException("完成出库查看任务时,更新容器状态失败");
2237   - }
2238 2205 }
2239 2206  
2240   - if (!fromLocationCode.equals(toLocationCode)) {
2241   - success =
2242   - locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
2243   - if (!success) {
2244   - throw new JeecgBootException("完成出库查看任务时,更新源库位失败");
2245   - }
2246   - } else {
2247   - success = locationService.updateStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
2248   - if (!success) {
2249   - throw new JeecgBootException("完成出库查看任务时,更新源库位失败");
2250   - }
2251   - }
2252   - if (StringUtils.isNotEmpty(fromLocationCode) && !fromLocationCode.equals(toLocationCode)) {
2253   - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
2254   - if (!success) {
2255   - throw new JeecgBootException("完成出库查看任务时,更新目标库位失败");
2256   - }
  2207 + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_CHECK_OUT,
  2208 + containerCode, fromLocationCode, toLocationCode, warehouseCode);
  2209 + if (!result.isSuccess()) {
  2210 + throw new JeecgBootException(result.getMessage());
2257 2211 }
2258 2212 taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED);
2259 2213 success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId());
... ... @@ -2301,16 +2255,21 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
2301 2255 if (toPort == null) {
2302 2256 return Result.error("创建跨站任务时,目标站台为空");
2303 2257 }
  2258 + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_OVER_STATION,
  2259 + containerCode, QuantityConstant.EMPTY_STRING, QuantityConstant.EMPTY_STRING, warehouseCode);
  2260 + if (!result.isSuccess()) {
  2261 + throw new JeecgBootException(result.getMessage());
  2262 + }
2304 2263 taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED);
2305 2264 boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId());
2306 2265 if (!success) {
2307 2266 throw new JeecgBootException("创建跨站任务时, 更新任务失败");
2308 2267 }
2309   - success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode);
  2268 +// success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode);
  2269 +// if (!success) {
  2270 +// throw new JeecgBootException("创建跨站任务时, 更新容器状态失败");
  2271 +// }
2310 2272 log.info("完成跨站任务" + taskHeader.getId());
2311   - if (!success) {
2312   - throw new JeecgBootException("创建跨站任务时, 更新容器状态失败");
2313   - }
2314 2273 return Result.OK("完成跨站任务成功");
2315 2274 }
2316 2275  
... ... @@ -2343,21 +2302,17 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
2343 2302 if (toLocation == null) {
2344 2303 return Result.error("完成空托盘组入库任务时,没有找到库位" + toLocationCode);
2345 2304 }
  2305 + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_MANY_EMPTYRECEIPT,
  2306 + containerCode, QuantityConstant.EMPTY_STRING, toLocationCode, warehouseCode);
  2307 + if (!result.isSuccess()) {
  2308 + throw new JeecgBootException(result.getMessage());
  2309 + }
2346 2310 taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED);
2347 2311 boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId());
2348 2312 if (!success) {
2349 2313 throw new JeecgBootException("完成空托盘组入库任务时, 更新任务失败");
2350 2314 }
2351   - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_LOCATION_EMPTY,
2352   - QuantityConstant.STATUS_CONTAINER_FILL_MANY, warehouseCode);
2353   - if (!success) {
2354   - throw new JeecgBootException("完成空托盘组入库任务时, 更新容器失败");
2355   - }
2356   - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
2357 2315 log.info("完成空托盘组入库任务" + taskHeader.getId());
2358   - if (!success) {
2359   - throw new JeecgBootException("完成空托盘组入库任务时, 更新库位失败");
2360   - }
2361 2316 return Result.ok("完成空托盘组入库任务成功");
2362 2317 }
2363 2318  
... ... @@ -2372,6 +2327,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
2372 2327 String warehouseCode = taskHeader.getWarehouseCode();
2373 2328 String containerCode = taskHeader.getContainerCode();
2374 2329 String toPortCode = taskHeader.getToPortCode();
  2330 + String fromLocationCode = taskHeader.getFromLocationCode();
2375 2331 log.info("开始完成空托盘组出库任务" + taskHeader.getId());
2376 2332 if (StringUtils.isEmpty(containerCode)) {
2377 2333 return Result.error("完成空托盘组出库任务时, 托盘号为空");
... ... @@ -2382,12 +2338,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
2382 2338 if (StringUtils.isEmpty(toPortCode)) {
2383 2339 return Result.error("完成空托盘组出库任务时, 目标出入口为空");
2384 2340 }
  2341 + if (StringUtils.isEmpty(fromLocationCode)) {
  2342 + return Result.error("完成空托盘组出库任务时, 起始库位为空");
  2343 + }
2385 2344 Container container = containerService.getContainerByCode(containerCode, warehouseCode);
2386 2345 if (container == null) {
2387 2346 return Result.error("完成空托盘组出库任务时,没有找到容器" + containerCode);
2388 2347 }
2389   - String toLocationCode = container.getLocationCode();
2390   - if (StringUtils.isEmpty(toLocationCode)) {
  2348 + String locationCode = container.getLocationCode();
  2349 + if (StringUtils.isEmpty(locationCode)) {
2391 2350 return Result.error("完成空托盘组出库任务时, 容器不在库位上");
2392 2351 }
2393 2352 Port port = portService.getPortByCode(toPortCode, warehouseCode);
... ... @@ -2399,16 +2358,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
2399 2358 if (!success) {
2400 2359 throw new JeecgBootException("完成空托盘组出库任务时, 更新任务失败");
2401 2360 }
2402   - success = containerService.updateLocationCodeAndStatus(containerCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_CONTAINER_EMPTY,
2403   - QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode);
2404   - if (!success) {
2405   - throw new JeecgBootException("完成空托盘组出库任务时, 更新容器失败");
2406   - }
2407   - success = locationService.updateContainerCodeAndStatus(toLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
2408   - log.info("开始完成空托盘组出库任务" + taskHeader.getId());
2409   - if (!success) {
2410   - throw new JeecgBootException("完成空托盘组出库任务时, 更新库位失败");
  2361 + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_MANY_EMPTYSHIPMENT,
  2362 + containerCode, fromLocationCode, QuantityConstant.EMPTY_STRING, warehouseCode);
  2363 + if (!result.isSuccess()) {
  2364 + throw new JeecgBootException(result.getMessage());
2411 2365 }
  2366 + log.info("完成空托盘组出库任务" + taskHeader.getId());
2412 2367 return Result.ok("完成空托盘组出库任务成功");
2413 2368 }
2414 2369  
... ... @@ -2454,6 +2409,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
2454 2409 }
2455 2410  
2456 2411 @Override
  2412 + public boolean updateExceptionStateById(int exceptionState, int id) {
  2413 + TaskHeader taskHeader = new TaskHeader();
  2414 + taskHeader.setExceptionState(exceptionState);
  2415 + taskHeader.setId(id);
  2416 + boolean success = taskHeaderService.updateById(taskHeader);
  2417 + return success;
  2418 + }
  2419 +
  2420 + @Override
2457 2421 public boolean updatePreTaskNoById(int preTaskNo, int id) {
2458 2422 TaskHeader taskHeader = new TaskHeader();
2459 2423 taskHeader.setId(id);
... ...