Commit 72db299cfc2f7b81a406663d2a29c1f3f46a4b02
Merge branch 'develop' of http://172.16.29.40:8010/wms/wms4 into develop
Showing
11 changed files
with
336 additions
and
291 deletions
ant-design-vue-jeecg/src/components/tools/HeaderNotice.vue
@@ -228,6 +228,7 @@ export default { | @@ -228,6 +228,7 @@ export default { | ||
228 | websocketOnmessage: function (e) { | 228 | websocketOnmessage: function (e) { |
229 | console.log("-----接收消息-------", e.data); | 229 | console.log("-----接收消息-------", e.data); |
230 | var data = eval("(" + e.data + ")"); //解析对象 | 230 | var data = eval("(" + e.data + ")"); //解析对象 |
231 | + this.openNotification(data) | ||
231 | if (data.cmd == "topic") { | 232 | if (data.cmd == "topic") { |
232 | //系统通知 | 233 | //系统通知 |
233 | this.loadData(); | 234 | this.loadData(); |
ant-design-vue-jeecg/src/views/system/compare/CompareWcsLocation.vue
@@ -5,15 +5,29 @@ | @@ -5,15 +5,29 @@ | ||
5 | <a-form layout="inline" @keyup.enter.native="searchQuery"> | 5 | <a-form layout="inline" @keyup.enter.native="searchQuery"> |
6 | <a-row :gutter="24"> | 6 | <a-row :gutter="24"> |
7 | <a-col :xl="6" :lg="7" :md="8" :sm="24"> | 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 | <a-form-item label="库位编码"> | 22 | <a-form-item label="库位编码"> |
9 | <a-input placeholder="请输入库位编码" v-model="queryParam.locationCode"></a-input> | 23 | <a-input placeholder="请输入库位编码" v-model="queryParam.locationCode"></a-input> |
10 | </a-form-item> | 24 | </a-form-item> |
11 | </a-col> | 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 | <a-form-item label="库位表容器编码"> | 27 | <a-form-item label="库位表容器编码"> |
14 | <a-input placeholder="请输入库位表容器编码" v-model="queryParam.containerCode"></a-input> | 28 | <a-input placeholder="请输入库位表容器编码" v-model="queryParam.containerCode"></a-input> |
15 | </a-form-item> | 29 | </a-form-item> |
16 | - </a-col> | 30 | + </a-col> --> |
17 | <a-col :xl="6" :lg="7" :md="8" :sm="24"> | 31 | <a-col :xl="6" :lg="7" :md="8" :sm="24"> |
18 | <a-form-item label="数据状态"> | 32 | <a-form-item label="数据状态"> |
19 | <j-dict-select-tag | 33 | <j-dict-select-tag |
@@ -90,7 +104,7 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin' | @@ -90,7 +104,7 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin' | ||
90 | import { getAction } from '@/api/manage' | 104 | import { getAction } from '@/api/manage' |
91 | import CompareWcsLocationTask from './CompareWcsLocationTask' | 105 | import CompareWcsLocationTask from './CompareWcsLocationTask' |
92 | import { initDictOptions, filterMultiDictText } from '@/components/dict/JDictSelectUtil' | 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 | export default { | 109 | export default { |
96 | name: 'CompareWcsLocation', | 110 | name: 'CompareWcsLocation', |
@@ -106,6 +120,7 @@ export default { | @@ -106,6 +120,7 @@ export default { | ||
106 | containerStatusList: [], | 120 | containerStatusList: [], |
107 | wcsLocationStatusList: [], | 121 | wcsLocationStatusList: [], |
108 | consistencyStatusList: [], | 122 | consistencyStatusList: [], |
123 | + zoneList:[], | ||
109 | // 表头 | 124 | // 表头 |
110 | columns: [ | 125 | columns: [ |
111 | { | 126 | { |
@@ -114,6 +129,20 @@ export default { | @@ -114,6 +129,20 @@ export default { | ||
114 | dataIndex: 'locationCode' | 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 | title: '库位表容器编码', | 146 | title: '库位表容器编码', |
118 | align: 'center', | 147 | align: 'center', |
119 | dataIndex: 'locationContainerCode' | 148 | dataIndex: 'locationContainerCode' |
@@ -134,13 +163,6 @@ export default { | @@ -134,13 +163,6 @@ export default { | ||
134 | dataIndex: 'wcsContainerCode' | 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 | title: '托盘表状态', | 166 | title: '托盘表状态', |
145 | align: 'center', | 167 | align: 'center', |
146 | dataIndex: 'containerStatus', | 168 | dataIndex: 'containerStatus', |
@@ -148,13 +170,6 @@ export default { | @@ -148,13 +170,6 @@ export default { | ||
148 | scopedSlots: { customRender: 'containerStatus' } | 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 | title: '数据状态', | 173 | title: '数据状态', |
159 | align: 'center', | 174 | align: 'center', |
160 | dataIndex: 'consistencyStatus', | 175 | dataIndex: 'consistencyStatus', |
@@ -182,6 +197,7 @@ export default { | @@ -182,6 +197,7 @@ export default { | ||
182 | } | 197 | } |
183 | }, | 198 | }, |
184 | created() { | 199 | created() { |
200 | + this.loadFrom() | ||
185 | this.initDictData() | 201 | this.initDictData() |
186 | }, | 202 | }, |
187 | methods: { | 203 | methods: { |
@@ -280,6 +296,13 @@ export default { | @@ -280,6 +296,13 @@ export default { | ||
280 | return color | 296 | return color |
281 | }, | 297 | }, |
282 | initDictConfig() {}, | 298 | initDictConfig() {}, |
299 | + loadFrom() { | ||
300 | + getZoneList().then(res => { | ||
301 | + if (res.success) { | ||
302 | + this.zoneList = res.result | ||
303 | + } | ||
304 | + }) | ||
305 | + }, | ||
283 | clickThenSelect(record) { | 306 | clickThenSelect(record) { |
284 | return { | 307 | return { |
285 | on: { | 308 | on: { |
ant-design-vue-jeecg/src/views/system/config/ContainerList.vue
@@ -14,22 +14,22 @@ | @@ -14,22 +14,22 @@ | ||
14 | <a-input placeholder="请输入库位编码" v-model="queryParam.locationCode"></a-input> | 14 | <a-input placeholder="请输入库位编码" v-model="queryParam.locationCode"></a-input> |
15 | </a-form-item> | 15 | </a-form-item> |
16 | </a-col> | 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 | <template v-if="toggleSearchStatus"> | 31 | <template v-if="toggleSearchStatus"> |
18 | <a-col :xl="6" :lg="7" :md="8" :sm="24"> | 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 | <a-form-item label="容器状态"> | 33 | <a-form-item label="容器状态"> |
34 | <j-dict-select-tag | 34 | <j-dict-select-tag |
35 | placeholder="请选择容器状态" | 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,7 +262,7 @@ public class WcsServiceImpl implements WcsService { | ||
262 | if (!taskHeaderService.updateById(taskHeader)) { | 262 | if (!taskHeaderService.updateById(taskHeader)) { |
263 | throw new JeecgBootException("更新任务头表目标库位失败"); | 263 | throw new JeecgBootException("更新任务头表目标库位失败"); |
264 | } | 264 | } |
265 | - | 265 | + |
266 | WcsTask wcsTask = new WcsTask(); | 266 | WcsTask wcsTask = new WcsTask(); |
267 | wcsTask.setToLocationCode(locationCode); | 267 | wcsTask.setToLocationCode(locationCode); |
268 | wcsTask.setPreTaskNo(String.valueOf(preTaskNo)); | 268 | wcsTask.setPreTaskNo(String.valueOf(preTaskNo)); |
@@ -350,7 +350,7 @@ public class WcsServiceImpl implements WcsService { | @@ -350,7 +350,7 @@ public class WcsServiceImpl implements WcsService { | ||
350 | } | 350 | } |
351 | Result<TaskHeader> result = taskHeaderService.createTransferTask(insideLocation.getCode(), destinationLocation.getCode(), warehouseCode); | 351 | Result<TaskHeader> result = taskHeaderService.createTransferTask(insideLocation.getCode(), destinationLocation.getCode(), warehouseCode); |
352 | if (!result.isSuccess()) { | 352 | if (!result.isSuccess()) { |
353 | - throw new JeecgBootException("创建移库任务失败"); | 353 | + throw new JeecgBootException(result.getMessage()); |
354 | } | 354 | } |
355 | preTaskNo = result.getResult().getId(); | 355 | preTaskNo = result.getResult().getId(); |
356 | taskHeader.setPreTaskNo(preTaskNo); | 356 | taskHeader.setPreTaskNo(preTaskNo); |
@@ -634,6 +634,8 @@ public class WcsServiceImpl implements WcsService { | @@ -634,6 +634,8 @@ public class WcsServiceImpl implements WcsService { | ||
634 | originLocationCode = originLocationCode + "," + taskLocationCode; | 634 | originLocationCode = originLocationCode + "," + taskLocationCode; |
635 | } | 635 | } |
636 | 636 | ||
637 | + taskHeader = new TaskHeader(); | ||
638 | + taskHeader.setId(Integer.parseInt(taskNo)); | ||
637 | taskHeader.setToLocationCode(locationCode); | 639 | taskHeader.setToLocationCode(locationCode); |
638 | taskHeader.setExceptionName("重入处理"); | 640 | taskHeader.setExceptionName("重入处理"); |
639 | taskHeader.setIsDoubleIn(QuantityConstant.DOUBLE_IN); | 641 | taskHeader.setIsDoubleIn(QuantityConstant.DOUBLE_IN); |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/address/service/impl/AddressServiceImpl.java
1 | package org.jeecg.modules.wms.config.address.service.impl; | 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 | import org.jeecg.modules.wms.config.address.entity.Address; | 3 | import org.jeecg.modules.wms.config.address.entity.Address; |
7 | import org.jeecg.modules.wms.config.address.mapper.AddressMapper; | 4 | import org.jeecg.modules.wms.config.address.mapper.AddressMapper; |
8 | import org.jeecg.modules.wms.config.address.service.IAddressService; | 5 | import org.jeecg.modules.wms.config.address.service.IAddressService; |
9 | import org.springframework.cache.annotation.Cacheable; | 6 | import org.springframework.cache.annotation.Cacheable; |
10 | import org.springframework.stereotype.Service; | 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 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 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,30 +21,28 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
21 | public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements IAddressService { | 21 | public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements IAddressService { |
22 | 22 | ||
23 | @Override | 23 | @Override |
24 | - @Cacheable(cacheNames = "getAddressByUrl#300", key = "#root.methodName") | 24 | + @Cacheable(cacheNames = "getAddressByUrl#1", key = "#root.methodName + '_' + #url", unless = "#result == null ") |
25 | public Address getAddressByUrl(String url) { | 25 | public Address getAddressByUrl(String url) { |
26 | LambdaQueryWrapper<Address> addressLambdaQueryWrapper = Wrappers.lambdaQuery(); | 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 | @Override | 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 | public String getUrlByParam(String param, String warehouseCode, String zoneCode) { | 33 | public String getUrlByParam(String param, String warehouseCode, String zoneCode) { |
35 | LambdaQueryWrapper<Address> addressLambdaQueryWrapper = Wrappers.lambdaQuery(); | 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 | Address address = getOne(addressLambdaQueryWrapper); | 37 | Address address = getOne(addressLambdaQueryWrapper); |
38 | if (address == null) { | 38 | if (address == null) { |
39 | return null; | 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 | @Override | 44 | @Override |
47 | - @Cacheable(cacheNames = "getUrlByParam#300", key = "#root.methodName + '_' + #param") | 45 | + @Cacheable(cacheNames = "getUrlByParam#1", key = "#root.methodName + '_' + #param", unless = "#result == null ") |
48 | public String getUrlByParam(String param) { | 46 | public String getUrlByParam(String param) { |
49 | LambdaQueryWrapper<Address> addressLambdaQueryWrapper = Wrappers.lambdaQuery(); | 47 | LambdaQueryWrapper<Address> addressLambdaQueryWrapper = Wrappers.lambdaQuery(); |
50 | addressLambdaQueryWrapper.eq(Address::getParam, param); | 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,28 +17,28 @@ public class CompareLocationDto { | ||
17 | private String locationCode; | 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 | /** WCS库位容器编码 */ | 37 | /** WCS库位容器编码 */ |
38 | - private String wcsContainerCode; | 38 | + private String wcsContainerCode = ""; |
39 | 39 | ||
40 | /** WCS库位表状态 */ | 40 | /** WCS库位表状态 */ |
41 | - private String wcsLocationStatus; | 41 | + private String wcsLocationStatus = ""; |
42 | 42 | ||
43 | /** 数据状态 */ | 43 | /** 数据状态 */ |
44 | private Integer consistencyStatus = 1; | 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,6 +5,9 @@ import lombok.Data; | ||
5 | @Data | 5 | @Data |
6 | public class QueryCompareLocationDto { | 6 | public class QueryCompareLocationDto { |
7 | 7 | ||
8 | + /** 库区编码 */ | ||
9 | + private String zoneCode; | ||
10 | + | ||
8 | /** 仓库编码 */ | 11 | /** 仓库编码 */ |
9 | private String warehouseCode; | 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,8 +4,8 @@ import java.text.MessageFormat; | ||
4 | import java.util.ArrayList; | 4 | import java.util.ArrayList; |
5 | import java.util.Collections; | 5 | import java.util.Collections; |
6 | import java.util.Comparator; | 6 | import java.util.Comparator; |
7 | +import java.util.Date; | ||
7 | import java.util.HashMap; | 8 | import java.util.HashMap; |
8 | -import java.util.HashSet; | ||
9 | import java.util.List; | 9 | import java.util.List; |
10 | import java.util.Map; | 10 | import java.util.Map; |
11 | import java.util.Set; | 11 | import java.util.Set; |
@@ -14,6 +14,7 @@ import java.util.stream.Collectors; | @@ -14,6 +14,7 @@ import java.util.stream.Collectors; | ||
14 | 14 | ||
15 | import javax.annotation.Resource; | 15 | import javax.annotation.Resource; |
16 | 16 | ||
17 | +import org.apache.commons.collections4.ListUtils; | ||
17 | import org.apache.shiro.util.CollectionUtils; | 18 | import org.apache.shiro.util.CollectionUtils; |
18 | import org.jeecg.common.api.vo.Result; | 19 | import org.jeecg.common.api.vo.Result; |
19 | import org.jeecg.common.exception.JeecgBootException; | 20 | import org.jeecg.common.exception.JeecgBootException; |
@@ -92,7 +93,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -92,7 +93,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
92 | 93 | ||
93 | @Resource | 94 | @Resource |
94 | private IInventoryDetailService inventoryDetailService; | 95 | private IInventoryDetailService inventoryDetailService; |
95 | - | 96 | + |
96 | @Autowired | 97 | @Autowired |
97 | private ILocationService locationService; | 98 | private ILocationService locationService; |
98 | 99 | ||
@@ -446,47 +447,52 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -446,47 +447,52 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
446 | 447 | ||
447 | @Override | 448 | @Override |
448 | public PageUtil<CompareLocationDto> compareWcsLocation(QueryCompareLocationDto queryCompareLocationDto) { | 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 | Map<String, Location> locationMap = new HashMap<String, Location>(); | 456 | Map<String, Location> locationMap = new HashMap<String, Location>(); |
452 | Map<String, List<Container>> containerMap = new HashMap<String, List<Container>>(); | 457 | Map<String, List<Container>> containerMap = new HashMap<String, List<Container>>(); |
453 | Map<String, List<InventoryDetail>> inventoryDetailMap = new HashMap<String, List<InventoryDetail>>(); | 458 | Map<String, List<InventoryDetail>> inventoryDetailMap = new HashMap<String, List<InventoryDetail>>(); |
454 | Map<String, List<WcsLocationDto>> wcsLocationMap = new HashMap<String, List<WcsLocationDto>>(); | 459 | Map<String, List<WcsLocationDto>> wcsLocationMap = new HashMap<String, List<WcsLocationDto>>(); |
455 | - | ||
456 | // 1.获取WMS库位表库位信息 | 460 | // 1.获取WMS库位表库位信息 |
457 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | 461 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); |
458 | locationLambdaQueryWrapper.select(Location::getWarehouseCode, Location::getCode, Location::getContainerCode, Location::getStatus) | 462 | locationLambdaQueryWrapper.select(Location::getWarehouseCode, Location::getCode, Location::getContainerCode, Location::getStatus) |
459 | .eq(Location::getWarehouseCode, queryCompareLocationDto.getWarehouseCode()) | 463 | .eq(Location::getWarehouseCode, queryCompareLocationDto.getWarehouseCode()) |
464 | + .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getZoneCode()), Location::getZoneCode, queryCompareLocationDto.getZoneCode()) | ||
460 | .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getLocationCode()), Location::getCode, queryCompareLocationDto.getLocationCode()) | 465 | .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getLocationCode()), Location::getCode, queryCompareLocationDto.getLocationCode()) |
461 | .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getContainerCode()), Location::getContainerCode, queryCompareLocationDto.getContainerCode()); | 466 | .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getContainerCode()), Location::getContainerCode, queryCompareLocationDto.getContainerCode()); |
462 | List<Location> locationList = list(locationLambdaQueryWrapper); | 467 | List<Location> locationList = list(locationLambdaQueryWrapper); |
463 | if (!CollectionUtils.isEmpty(locationList)) { | 468 | if (!CollectionUtils.isEmpty(locationList)) { |
464 | locationMap.putAll(locationList.stream().collect(Collectors.toMap(Location::getCode, Function.identity(), (key1, key2) -> key2))); | 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 | if (!CollectionUtils.isEmpty(locationCodes)) { | 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 | // 4.获取WCS库位信息 | 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 | Map<String, Object> queryParamMap = new HashMap<String, Object>(); | 496 | Map<String, Object> queryParamMap = new HashMap<String, Object>(); |
491 | if (StringUtils.isNotEmpty(queryCompareLocationDto.getWarehouseCode())) { | 497 | if (StringUtils.isNotEmpty(queryCompareLocationDto.getWarehouseCode())) { |
492 | queryParamMap.put("warehouseCode", queryCompareLocationDto.getWarehouseCode()); | 498 | queryParamMap.put("warehouseCode", queryCompareLocationDto.getWarehouseCode()); |
@@ -504,9 +510,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -504,9 +510,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
504 | } | 510 | } |
505 | } | 511 | } |
506 | } | 512 | } |
507 | - | ||
508 | // 对返回数据进行组装 | 513 | // 对返回数据进行组装 |
509 | - List<CompareLocationDto> compareLocationDtoList = new ArrayList<CompareLocationDto>(); | ||
510 | if (!CollectionUtils.isEmpty(locationCodes)) { | 514 | if (!CollectionUtils.isEmpty(locationCodes)) { |
511 | for (String locationCode : locationCodes) { | 515 | for (String locationCode : locationCodes) { |
512 | if (StringUtils.isEmpty(locationCode)) { | 516 | if (StringUtils.isEmpty(locationCode)) { |
@@ -524,16 +528,13 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -524,16 +528,13 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
524 | if (!CollectionUtils.isEmpty(containerGroupList)) { | 528 | if (!CollectionUtils.isEmpty(containerGroupList)) { |
525 | Set<String> containerCodes = containerGroupList.stream().map(t -> t.getCode()).collect(Collectors.toSet()); | 529 | Set<String> containerCodes = containerGroupList.stream().map(t -> t.getCode()).collect(Collectors.toSet()); |
526 | Set<String> containerStatus = containerGroupList.stream().map(t -> t.getStatus()).collect(Collectors.toSet()); | 530 | Set<String> containerStatus = containerGroupList.stream().map(t -> t.getStatus()).collect(Collectors.toSet()); |
527 | - | ||
528 | compareLocationDto.setContainerContainerCode(StringUtils.join(containerCodes, ",")); | 531 | compareLocationDto.setContainerContainerCode(StringUtils.join(containerCodes, ",")); |
529 | compareLocationDto.setContainerStatus(StringUtils.join(containerStatus, ",")); | 532 | compareLocationDto.setContainerStatus(StringUtils.join(containerStatus, ",")); |
530 | } | 533 | } |
531 | List<InventoryDetail> inventoryGroupList = inventoryDetailMap.get(locationCode); | 534 | List<InventoryDetail> inventoryGroupList = inventoryDetailMap.get(locationCode); |
532 | if (!CollectionUtils.isEmpty(inventoryGroupList)) { | 535 | if (!CollectionUtils.isEmpty(inventoryGroupList)) { |
533 | Set<String> inventoryContainerCodes = inventoryGroupList.stream().map(t -> t.getContainerCode()).collect(Collectors.toSet()); | 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 | compareLocationDto.setInventoryContainerCode(StringUtils.join(inventoryContainerCodes, ",")); | 537 | compareLocationDto.setInventoryContainerCode(StringUtils.join(inventoryContainerCodes, ",")); |
536 | - compareLocationDto.setInventoryStatus(StringUtils.join(inventoryStatus, ",")); | ||
537 | } | 538 | } |
538 | List<WcsLocationDto> wcsLocationGroupList = wcsLocationMap.get(locationCode); | 539 | List<WcsLocationDto> wcsLocationGroupList = wcsLocationMap.get(locationCode); |
539 | if (!CollectionUtils.isEmpty(wcsLocationGroupList)) { | 540 | if (!CollectionUtils.isEmpty(wcsLocationGroupList)) { |
@@ -542,12 +543,32 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -542,12 +543,32 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
542 | compareLocationDto.setWcsContainerCode(StringUtils.join(wcsContainerCodes, ",")); | 543 | compareLocationDto.setWcsContainerCode(StringUtils.join(wcsContainerCodes, ",")); |
543 | compareLocationDto.setWcsLocationStatus(StringUtils.join(wcsContainerStatus, ",")); | 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 | compareLocationDtoList.add(compareLocationDto); | 573 | compareLocationDtoList.add(compareLocationDto); |
553 | } | 574 | } |
@@ -563,11 +584,11 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -563,11 +584,11 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
563 | @Override | 584 | @Override |
564 | public PageUtil<CompareLocationTaskDto> compareWcsLocationTask(QueryCompareLocationTaskDto queryCompareLocationTaskDto) { | 585 | public PageUtil<CompareLocationTaskDto> compareWcsLocationTask(QueryCompareLocationTaskDto queryCompareLocationTaskDto) { |
565 | List<CompareLocationTaskDto> finalCompareLocationTaskList = new ArrayList<CompareLocationTaskDto>(); | 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 | // 1.获取WMS任务信息 | 592 | // 1.获取WMS任务信息 |
572 | LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | 593 | LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); |
573 | taskHeaderLambdaQueryWrapper | 594 | taskHeaderLambdaQueryWrapper |
@@ -577,15 +598,25 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -577,15 +598,25 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
577 | .gt(StringUtils.isNotEmpty(queryCompareLocationTaskDto.getTaskCreateTimeBegin()), TaskHeader::getCreateTime, | 598 | .gt(StringUtils.isNotEmpty(queryCompareLocationTaskDto.getTaskCreateTimeBegin()), TaskHeader::getCreateTime, |
578 | queryCompareLocationTaskDto.getTaskCreateTimeBegin()) | 599 | queryCompareLocationTaskDto.getTaskCreateTimeBegin()) |
579 | .lt(StringUtils.isNotEmpty(queryCompareLocationTaskDto.getTaskCreateTimeEnd()), TaskHeader::getCreateTime, | 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 | if (StringUtils.isNotEmpty(queryCompareLocationTaskDto.getLocationCode())) { | 603 | if (StringUtils.isNotEmpty(queryCompareLocationTaskDto.getLocationCode())) { |
583 | taskHeaderLambdaQueryWrapper.and(t -> t.eq(TaskHeader::getFromLocationCode, queryCompareLocationTaskDto.getLocationCode()).or() | 604 | taskHeaderLambdaQueryWrapper.and(t -> t.eq(TaskHeader::getFromLocationCode, queryCompareLocationTaskDto.getLocationCode()).or() |
584 | .eq(TaskHeader::getToLocationCode, queryCompareLocationTaskDto.getLocationCode())); | 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 | List<TaskHeader> taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper); | 613 | List<TaskHeader> taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper); |
614 | + if (CollectionUtils.isEmpty(taskHeaderList)) { | ||
615 | + return PageUtil.create(finalCompareLocationTaskList, queryCompareLocationTaskDto.getPageNo(), queryCompareLocationTaskDto.getPageSize()); | ||
616 | + } | ||
587 | // 2.获取WCS任务信息 | 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 | Map<String, Object> queryParamMap = new HashMap<String, Object>(); | 620 | Map<String, Object> queryParamMap = new HashMap<String, Object>(); |
590 | if (StringUtils.isNotEmpty(queryCompareLocationTaskDto.getWarehouseCode())) { | 621 | if (StringUtils.isNotEmpty(queryCompareLocationTaskDto.getWarehouseCode())) { |
591 | queryParamMap.put("warehouseCode", queryCompareLocationTaskDto.getWarehouseCode()); | 622 | queryParamMap.put("warehouseCode", queryCompareLocationTaskDto.getWarehouseCode()); |
@@ -599,18 +630,15 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -599,18 +630,15 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
599 | if (StringUtils.isNotEmpty(queryCompareLocationTaskDto.getTaskCreateTimeEnd())) { | 630 | if (StringUtils.isNotEmpty(queryCompareLocationTaskDto.getTaskCreateTimeEnd())) { |
600 | queryParamMap.put("end", queryCompareLocationTaskDto.getTaskCreateTimeEnd()); | 631 | queryParamMap.put("end", queryCompareLocationTaskDto.getTaskCreateTimeEnd()); |
601 | } | 632 | } |
602 | -// queryParamMap.put("begin", queryCreateTime); | 633 | + queryParamMap.put("begin", queryCreateTime); |
603 | String jsonStringResult = OkHttpUtils.sendPostByJsonStr(url, JSON.toJSONString(queryParamMap)); | 634 | String jsonStringResult = OkHttpUtils.sendPostByJsonStr(url, JSON.toJSONString(queryParamMap)); |
604 | WcsResultDto<List<WcsTaskDto>> wcsResult = JSON.parseObject(jsonStringResult, new TypeReference<WcsResultDto<List<WcsTaskDto>>>() {}); | 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 | if (wcsResult.getCode() != null && wcsResult.getCode().equals(200)) { | 636 | if (wcsResult.getCode() != null && wcsResult.getCode().equals(200)) { |
608 | List<WcsTaskDto> wcsTaskList = wcsResult.getData(); | 637 | List<WcsTaskDto> wcsTaskList = wcsResult.getData(); |
609 | if (wcsTaskList != null && wcsTaskList.size() > 0) { | 638 | if (wcsTaskList != null && wcsTaskList.size() > 0) { |
610 | wcsTaskMap.putAll(wcsTaskList.stream().collect(Collectors.groupingBy(WcsTaskDto::getTaskNo))); | 639 | wcsTaskMap.putAll(wcsTaskList.stream().collect(Collectors.groupingBy(WcsTaskDto::getTaskNo))); |
611 | } | 640 | } |
612 | } | 641 | } |
613 | - | ||
614 | // 对返回数据进行组装 | 642 | // 对返回数据进行组装 |
615 | List<CompareLocationTaskDto> wcsCompareLocationTaskList = new ArrayList<CompareLocationTaskDto>(); | 643 | List<CompareLocationTaskDto> wcsCompareLocationTaskList = new ArrayList<CompareLocationTaskDto>(); |
616 | if (!CollectionUtils.isEmpty(taskHeaderList)) { | 644 | if (!CollectionUtils.isEmpty(taskHeaderList)) { |
@@ -635,11 +663,29 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -635,11 +663,29 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
635 | compareLocationTaskDto.setWcsContainerCode(wcsTaskDto.getContainerCode()); | 663 | compareLocationTaskDto.setWcsContainerCode(wcsTaskDto.getContainerCode()); |
636 | compareLocationTaskDto.setWcsTaskStatus(wcsTaskDto.getTaskStatus()); | 664 | compareLocationTaskDto.setWcsTaskStatus(wcsTaskDto.getTaskStatus()); |
637 | compareLocationTaskDto.setWcsTaskCreateTime(wcsTaskDto.getCreated()); | 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 | wcsCompareLocationTaskList.add(compareLocationTaskDto); | 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,7 +365,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi | ||
365 | shipmentContainerHeader = new ShipmentContainerHeader(); | 365 | shipmentContainerHeader = new ShipmentContainerHeader(); |
366 | shipmentContainerHeader.setContainerCode(containerCode); | 366 | shipmentContainerHeader.setContainerCode(containerCode); |
367 | shipmentContainerHeader.setFromLocationCode(locationCode); | 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 | shipmentContainerHeader.setToLocationCode(locationCode); | 369 | shipmentContainerHeader.setToLocationCode(locationCode); |
370 | } | 370 | } |
371 | shipmentContainerHeader.setWarehouseCode(warehouseCode); | 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<TaskHeader> { | @@ -305,6 +305,14 @@ public interface ITaskHeaderService extends IService<TaskHeader> { | ||
305 | boolean updateStatusById(int status, int id); | 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 | * @param preTaskNo | 317 | * @param preTaskNo |
310 | * @param id | 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<TaskHeaderMapper, TaskHea | @@ -550,6 +550,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
550 | @Override | 550 | @Override |
551 | @Transactional(rollbackFor = Exception.class) | 551 | @Transactional(rollbackFor = Exception.class) |
552 | public Result handleEmptyOut(String taskNo) { | 552 | public Result handleEmptyOut(String taskNo) { |
553 | + log.info("开始处理空出任务" + taskNo); | ||
553 | // 1、判断非空字段 | 554 | // 1、判断非空字段 |
554 | if (StringUtils.isEmpty(taskNo)) { | 555 | if (StringUtils.isEmpty(taskNo)) { |
555 | return Result.error("处理空出失败,任务号为空"); | 556 | return Result.error("处理空出失败,任务号为空"); |
@@ -615,15 +616,18 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -615,15 +616,18 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
615 | } | 616 | } |
616 | // 9 更新单据 | 617 | // 9 更新单据 |
617 | taskHeader.setExceptionState(QuantityConstant.EXCEPTION_TASK_HANDLE); | 618 | taskHeader.setExceptionState(QuantityConstant.EXCEPTION_TASK_HANDLE); |
618 | - success = taskHeaderService.updateById(taskHeader); | 619 | + success = taskHeaderService.updateExceptionStateById(QuantityConstant.EXCEPTION_TASK_HANDLE, taskHeader.getId()); |
619 | if (!success) { | 620 | if (!success) { |
620 | throw new JeecgBootException("处理空出失败,更新任务失败"); | 621 | throw new JeecgBootException("处理空出失败,更新任务失败"); |
621 | } | 622 | } |
623 | + log.info("完成处理空出任务" + taskNo); | ||
622 | return Result.ok("处理空出成功"); | 624 | return Result.ok("处理空出成功"); |
623 | } | 625 | } |
624 | 626 | ||
625 | @Override | 627 | @Override |
628 | + @Transactional(rollbackFor = Exception.class) | ||
626 | public Result handleDoubleIn(String taskNo) { | 629 | public Result handleDoubleIn(String taskNo) { |
630 | + log.info("开始处理重入任务" + taskNo); | ||
627 | // 1、判断非空字段 | 631 | // 1、判断非空字段 |
628 | if (StringUtils.isEmpty(taskNo)) { | 632 | if (StringUtils.isEmpty(taskNo)) { |
629 | return Result.error("处理重入失败,任务号为空"); | 633 | return Result.error("处理重入失败,任务号为空"); |
@@ -661,22 +665,24 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -661,22 +665,24 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
661 | if (toLocation == null) { | 665 | if (toLocation == null) { |
662 | return Result.error("处理重入失败,没有找到库位"); | 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 | if (!success) { | 669 | if (!success) { |
667 | throw new JeecgBootException("处理重入失败,更新库位失败"); | 670 | throw new JeecgBootException("处理重入失败,更新库位失败"); |
668 | } | 671 | } |
669 | } | 672 | } |
670 | taskHeader.setExceptionState(QuantityConstant.EXCEPTION_TASK_HANDLE); | 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 | if (!success) { | 675 | if (!success) { |
673 | throw new JeecgBootException("处理重入失败,更新任务失败"); | 676 | throw new JeecgBootException("处理重入失败,更新任务失败"); |
674 | } | 677 | } |
678 | + log.info("完成处理重入任务" + taskNo); | ||
675 | return Result.ok("处理重入成功"); | 679 | return Result.ok("处理重入成功"); |
676 | } | 680 | } |
677 | 681 | ||
678 | @Override | 682 | @Override |
683 | + @Transactional(rollbackFor = Exception.class) | ||
679 | public Result handlePickupError(String taskNo) { | 684 | public Result handlePickupError(String taskNo) { |
685 | + log.info("开始处理取货错任务" + taskNo); | ||
680 | // 1、判断非空字段 | 686 | // 1、判断非空字段 |
681 | if (StringUtils.isEmpty(taskNo)) { | 687 | if (StringUtils.isEmpty(taskNo)) { |
682 | return Result.error("处理取货错失败,任务号为空"); | 688 | return Result.error("处理取货错失败,任务号为空"); |
@@ -691,12 +697,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -691,12 +697,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
691 | return Result.OK("处理取货错失败, 任务已经完成"); | 697 | return Result.OK("处理取货错失败, 任务已经完成"); |
692 | } | 698 | } |
693 | 699 | ||
700 | + taskHeader = new TaskHeader(); | ||
701 | + taskHeader.setId(Integer.parseInt(taskNo)); | ||
694 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); | 702 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); |
695 | taskHeader.setExceptionState(QuantityConstant.EXCEPTION_TASK_HANDLE); | 703 | taskHeader.setExceptionState(QuantityConstant.EXCEPTION_TASK_HANDLE); |
696 | boolean success = taskHeaderService.updateById(taskHeader); | 704 | boolean success = taskHeaderService.updateById(taskHeader); |
697 | if (!success) { | 705 | if (!success) { |
698 | throw new JeecgBootException("处理取货错失败,更新任务失败"); | 706 | throw new JeecgBootException("处理取货错失败,更新任务失败"); |
699 | } | 707 | } |
708 | + log.info("完成处理取货错任务" + taskNo); | ||
700 | return Result.ok("处理取货错成功"); | 709 | return Result.ok("处理取货错成功"); |
701 | } | 710 | } |
702 | 711 | ||
@@ -1121,27 +1130,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1121,27 +1130,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1121 | throw new JeecgBootException("完成入库任务时,保存库存交易失败"); | 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 | if (!taskHeaderService.combineInventoryDetail(taskHeader)) { | 1138 | if (!taskHeaderService.combineInventoryDetail(taskHeader)) { |
1147 | throw new JeecgBootException("合并入库库存失败"); | 1139 | throw new JeecgBootException("合并入库库存失败"); |
@@ -1159,6 +1151,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1159,6 +1151,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1159 | if (!inventoryHeaderService.updateInventoryContainerStatusByContainerCode(containerCode, warehouseCode)) { | 1151 | if (!inventoryHeaderService.updateInventoryContainerStatusByContainerCode(containerCode, warehouseCode)) { |
1160 | throw new JeecgBootException("完成入库任务时,更新托盘状态失败"); | 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 | receiptDetaiList = receiptDetaiList.stream().filter(t -> t.getStatus().equals(QuantityConstant.RECEIPT_HEADER_COMPLETED)).collect(Collectors.toList()); | 1158 | receiptDetaiList = receiptDetaiList.stream().filter(t -> t.getStatus().equals(QuantityConstant.RECEIPT_HEADER_COMPLETED)).collect(Collectors.toList()); |
1163 | LogRecordContext.putVariable("taskHeader", taskHeader); | 1159 | LogRecordContext.putVariable("taskHeader", taskHeader); |
1164 | LogRecordContext.putVariable("extraJsonString1", JSON.toJSONString(taskDetailList)); | 1160 | LogRecordContext.putVariable("extraJsonString1", JSON.toJSONString(taskDetailList)); |
@@ -1309,44 +1305,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1309,44 +1305,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1309 | if (!success) { | 1305 | if (!success) { |
1310 | throw new JeecgBootException("完成出库任务,保存库存详情失败"); | 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 | ShipmentContainerHeader shipmentContainerHeader = shipmentContainerHeaderService.getById(taskHeader.getShipmentContainerHeaderId()); | 1313 | ShipmentContainerHeader shipmentContainerHeader = shipmentContainerHeaderService.getById(taskHeader.getShipmentContainerHeaderId()); |
1352 | if (shipmentContainerHeader == null) { | 1314 | if (shipmentContainerHeader == null) { |
@@ -1378,6 +1340,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1378,6 +1340,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1378 | throw new JeecgBootException("完成出库任务,更新库存状态失败"); | 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 | shipmentDetailList = shipmentDetailList.stream().filter(t -> t.getStatus().equals(QuantityConstant.SHIPMENT_HEADER_COMPLETED)).collect(Collectors.toList()); | 1348 | shipmentDetailList = shipmentDetailList.stream().filter(t -> t.getStatus().equals(QuantityConstant.SHIPMENT_HEADER_COMPLETED)).collect(Collectors.toList()); |
1383 | LogRecordContext.putVariable("taskHeader", taskHeader); | 1349 | LogRecordContext.putVariable("taskHeader", taskHeader); |
@@ -1599,7 +1565,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1599,7 +1565,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1599 | } | 1565 | } |
1600 | zoneCode = fromLocation.getZoneCode(); | 1566 | zoneCode = fromLocation.getZoneCode(); |
1601 | taskLockEntity.setZoneCode(zoneCode); | 1567 | taskLockEntity.setZoneCode(zoneCode); |
1602 | - if (StringUtils.isNotEmpty(toLocationCode)) { | 1568 | + if (StringUtils.isNotEmpty(toLocationCode) && !fromLocationCode.equals(toLocationCode)) { |
1603 | Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); | 1569 | Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); |
1604 | if (toLocation == null) { | 1570 | if (toLocation == null) { |
1605 | return Result.error("创建分拣任务时," + toLocationCode + "目标库位不存在"); | 1571 | return Result.error("创建分拣任务时," + toLocationCode + "目标库位不存在"); |
@@ -1620,9 +1586,11 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1620,9 +1586,11 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1620 | throw new JeecgBootException("创建分拣任务时,更新库位状态失败"); | 1586 | throw new JeecgBootException("创建分拣任务时,更新库位状态失败"); |
1621 | } | 1587 | } |
1622 | if (StringUtils.isNotEmpty(toLocationCode)) { | 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 | return Result.OK("创建分拣任务成功", taskLockEntity); | 1596 | return Result.OK("创建分拣任务成功", taskLockEntity); |
@@ -1654,26 +1622,42 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1654,26 +1622,42 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1654 | String toLocationCode, String warehouseCode) { | 1622 | String toLocationCode, String warehouseCode) { |
1655 | Result result = null; | 1623 | Result result = null; |
1656 | boolean success = false; | 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 | switch (taskType) { | 1632 | switch (taskType) { |
1661 | case QuantityConstant.TASK_TYPE_WHOLERECEIPT: | 1633 | case QuantityConstant.TASK_TYPE_WHOLERECEIPT: |
1662 | case QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT: | 1634 | case QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT: |
1635 | + if (StringUtils.isEmpty(toLocationCode)) { | ||
1636 | + return Result.error("任务类型" + taskType + "完成任务时, 目标库位号为空"); | ||
1637 | + } | ||
1663 | success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, containerFillStatus, | 1638 | success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, containerFillStatus, |
1664 | warehouseCode); | 1639 | warehouseCode); |
1665 | break; | 1640 | break; |
1666 | case QuantityConstant.TASK_TYPE_EMPTYRECEIPT: | 1641 | case QuantityConstant.TASK_TYPE_EMPTYRECEIPT: |
1642 | + if (StringUtils.isEmpty(toLocationCode)) { | ||
1643 | + return Result.error("任务类型" + taskType + "完成任务时, 目标库位号为空"); | ||
1644 | + } | ||
1667 | success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, | 1645 | success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, |
1668 | QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode); | 1646 | QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode); |
1669 | break; | 1647 | break; |
1670 | case QuantityConstant.TASK_TYPE_MANY_EMPTYRECEIPT: | 1648 | case QuantityConstant.TASK_TYPE_MANY_EMPTYRECEIPT: |
1649 | + if (StringUtils.isEmpty(toLocationCode)) { | ||
1650 | + return Result.error("任务类型" + taskType + "完成任务时, 目标库位号为空"); | ||
1651 | + } | ||
1671 | success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, | 1652 | success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, |
1672 | QuantityConstant.STATUS_CONTAINER_FILL_MANY, warehouseCode); | 1653 | QuantityConstant.STATUS_CONTAINER_FILL_MANY, warehouseCode); |
1673 | break; | 1654 | break; |
1674 | case QuantityConstant.TASK_TYPE_WHOLESHIPMENT: | 1655 | case QuantityConstant.TASK_TYPE_WHOLESHIPMENT: |
1675 | case QuantityConstant.TASK_TYPE_EMPTYSHIPMENT: | 1656 | case QuantityConstant.TASK_TYPE_EMPTYSHIPMENT: |
1676 | case QuantityConstant.TASK_TYPE_MANY_EMPTYSHIPMENT: | 1657 | case QuantityConstant.TASK_TYPE_MANY_EMPTYSHIPMENT: |
1658 | + if (StringUtils.isEmpty(fromLocationCode)) { | ||
1659 | + return Result.error("任务类型" + taskType + "完成任务时, 起始库位号为空"); | ||
1660 | + } | ||
1677 | success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, | 1661 | success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, |
1678 | QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode); | 1662 | QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode); |
1679 | break; | 1663 | break; |
@@ -1681,13 +1665,27 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1681,13 +1665,27 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1681 | case QuantityConstant.TASK_TYPE_CYCLECOUNT: | 1665 | case QuantityConstant.TASK_TYPE_CYCLECOUNT: |
1682 | case QuantityConstant.TASK_TYPE_TRANSFER: | 1666 | case QuantityConstant.TASK_TYPE_TRANSFER: |
1683 | case QuantityConstant.TASK_TYPE_CHECK_OUT: | 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 | InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); | 1674 | InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); |
1685 | if (inventoryHeader != null) { | 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 | } else { | 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 | break; | 1690 | break; |
1693 | case QuantityConstant.TASK_TYPE_OVER_STATION: | 1691 | case QuantityConstant.TASK_TYPE_OVER_STATION: |
@@ -1696,20 +1694,30 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1696,20 +1694,30 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1696 | break; | 1694 | break; |
1697 | } | 1695 | } |
1698 | if (!success) { | 1696 | if (!success) { |
1699 | - throw new JeecgBootException("完成任务时,更新容器失败"); | 1697 | + throw new JeecgBootException("任务类型" + taskType + "完成任务时, 更新容器失败"); |
1700 | } | 1698 | } |
1701 | if (StringUtils.isNotEmpty(fromLocationCode) && !fromLocationCode.equals(toLocationCode)) { | 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 | success = | 1704 | success = |
1703 | locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | 1705 | locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); |
1704 | if (!success) { | 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<TaskHeaderMapper, TaskHea | @@ -1733,27 +1741,16 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1733 | if (StringUtils.isEmpty(toLocationCode)) { | 1741 | if (StringUtils.isEmpty(toLocationCode)) { |
1734 | return Result.error("完成空托盘入库任务时, 目标库位号为空"); | 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 | if (!success) { | 1750 | if (!success) { |
1750 | - throw new JeecgBootException("完成空托盘入库任务时, 更新库位的容器编码和状态失败"); | 1751 | + throw new JeecgBootException("完成空托盘出库任务时, 更新任务失败"); |
1751 | } | 1752 | } |
1752 | - success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | ||
1753 | log.info("完成空托入库任务"); | 1753 | log.info("完成空托入库任务"); |
1754 | - if (!success) { | ||
1755 | - throw new JeecgBootException("完成空托盘入库任务时, 更新任务失败"); | ||
1756 | - } | ||
1757 | return Result.OK("完成空托盘入库成功"); | 1754 | return Result.OK("完成空托盘入库成功"); |
1758 | } | 1755 | } |
1759 | 1756 | ||
@@ -1787,7 +1784,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1787,7 +1784,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1787 | // 1.先拿到盘点单主单据 | 1784 | // 1.先拿到盘点单主单据 |
1788 | CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(taskHeader.getShipmentContainerHeaderId()); | 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 | return Result.error("盘点单据系统实盘数量跟差异数量0,不能完成 单据号" + cycleCountDetail.getCycleCountHeadCode()); | 1788 | return Result.error("盘点单据系统实盘数量跟差异数量0,不能完成 单据号" + cycleCountDetail.getCycleCountHeadCode()); |
1792 | } | 1789 | } |
1793 | 1790 | ||
@@ -2042,17 +2039,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -2042,17 +2039,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
2042 | if (port == null) { | 2039 | if (port == null) { |
2043 | return Result.error("完成空托盘出库任务时," + toPortCode + "目标出库口不存在"); | 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 | log.info("完成空托盘出库任务" + taskHeader.getId()); | 2048 | log.info("完成空托盘出库任务" + taskHeader.getId()); |
2057 | if (!success) { | 2049 | if (!success) { |
2058 | throw new JeecgBootException("完成空托盘出库任务时, 更新任务失败"); | 2050 | throw new JeecgBootException("完成空托盘出库任务时, 更新任务失败"); |
@@ -2119,24 +2111,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -2119,24 +2111,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
2119 | throw new JeecgBootException("完成移库任务时,保存库存交易失败"); | 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 | LambdaUpdateWrapper<InventoryHeader> inventoryHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); | 2114 | LambdaUpdateWrapper<InventoryHeader> inventoryHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); |
2141 | inventoryHeaderLambdaUpdateWrapper.eq(InventoryHeader::getWarehouseCode, warehouseCode).eq(InventoryHeader::getContainerCode, containerCode) | 2115 | inventoryHeaderLambdaUpdateWrapper.eq(InventoryHeader::getWarehouseCode, warehouseCode).eq(InventoryHeader::getContainerCode, containerCode) |
2142 | .eq(InventoryHeader::getLocationCode, fromLocationCode); | 2116 | .eq(InventoryHeader::getLocationCode, fromLocationCode); |
@@ -2154,6 +2128,16 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -2154,6 +2128,16 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
2154 | throw new JeecgBootException("完成移库任务时, 更新库存详情失败"); | 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 | log.info("完成移库任务" + taskHeader.getId()); | 2141 | log.info("完成移库任务" + taskHeader.getId()); |
2158 | return Result.OK("完成移库任务成功"); | 2142 | return Result.OK("完成移库任务成功"); |
2159 | } | 2143 | } |
@@ -2218,42 +2202,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -2218,42 +2202,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
2218 | if (!success) { | 2202 | if (!success) { |
2219 | throw new JeecgBootException("完成出库查看任务时,更新库存头失败"); | 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 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | 2212 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
2259 | success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | 2213 | success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); |
@@ -2301,16 +2255,21 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -2301,16 +2255,21 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
2301 | if (toPort == null) { | 2255 | if (toPort == null) { |
2302 | return Result.error("创建跨站任务时,目标站台为空"); | 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 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | 2263 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
2305 | boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | 2264 | boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); |
2306 | if (!success) { | 2265 | if (!success) { |
2307 | throw new JeecgBootException("创建跨站任务时, 更新任务失败"); | 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 | log.info("完成跨站任务" + taskHeader.getId()); | 2272 | log.info("完成跨站任务" + taskHeader.getId()); |
2311 | - if (!success) { | ||
2312 | - throw new JeecgBootException("创建跨站任务时, 更新容器状态失败"); | ||
2313 | - } | ||
2314 | return Result.OK("完成跨站任务成功"); | 2273 | return Result.OK("完成跨站任务成功"); |
2315 | } | 2274 | } |
2316 | 2275 | ||
@@ -2343,21 +2302,17 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -2343,21 +2302,17 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
2343 | if (toLocation == null) { | 2302 | if (toLocation == null) { |
2344 | return Result.error("完成空托盘组入库任务时,没有找到库位" + toLocationCode); | 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 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | 2310 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
2347 | boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | 2311 | boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); |
2348 | if (!success) { | 2312 | if (!success) { |
2349 | throw new JeecgBootException("完成空托盘组入库任务时, 更新任务失败"); | 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 | log.info("完成空托盘组入库任务" + taskHeader.getId()); | 2315 | log.info("完成空托盘组入库任务" + taskHeader.getId()); |
2358 | - if (!success) { | ||
2359 | - throw new JeecgBootException("完成空托盘组入库任务时, 更新库位失败"); | ||
2360 | - } | ||
2361 | return Result.ok("完成空托盘组入库任务成功"); | 2316 | return Result.ok("完成空托盘组入库任务成功"); |
2362 | } | 2317 | } |
2363 | 2318 | ||
@@ -2372,6 +2327,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -2372,6 +2327,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
2372 | String warehouseCode = taskHeader.getWarehouseCode(); | 2327 | String warehouseCode = taskHeader.getWarehouseCode(); |
2373 | String containerCode = taskHeader.getContainerCode(); | 2328 | String containerCode = taskHeader.getContainerCode(); |
2374 | String toPortCode = taskHeader.getToPortCode(); | 2329 | String toPortCode = taskHeader.getToPortCode(); |
2330 | + String fromLocationCode = taskHeader.getFromLocationCode(); | ||
2375 | log.info("开始完成空托盘组出库任务" + taskHeader.getId()); | 2331 | log.info("开始完成空托盘组出库任务" + taskHeader.getId()); |
2376 | if (StringUtils.isEmpty(containerCode)) { | 2332 | if (StringUtils.isEmpty(containerCode)) { |
2377 | return Result.error("完成空托盘组出库任务时, 托盘号为空"); | 2333 | return Result.error("完成空托盘组出库任务时, 托盘号为空"); |
@@ -2382,12 +2338,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -2382,12 +2338,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
2382 | if (StringUtils.isEmpty(toPortCode)) { | 2338 | if (StringUtils.isEmpty(toPortCode)) { |
2383 | return Result.error("完成空托盘组出库任务时, 目标出入口为空"); | 2339 | return Result.error("完成空托盘组出库任务时, 目标出入口为空"); |
2384 | } | 2340 | } |
2341 | + if (StringUtils.isEmpty(fromLocationCode)) { | ||
2342 | + return Result.error("完成空托盘组出库任务时, 起始库位为空"); | ||
2343 | + } | ||
2385 | Container container = containerService.getContainerByCode(containerCode, warehouseCode); | 2344 | Container container = containerService.getContainerByCode(containerCode, warehouseCode); |
2386 | if (container == null) { | 2345 | if (container == null) { |
2387 | return Result.error("完成空托盘组出库任务时,没有找到容器" + containerCode); | 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 | return Result.error("完成空托盘组出库任务时, 容器不在库位上"); | 2350 | return Result.error("完成空托盘组出库任务时, 容器不在库位上"); |
2392 | } | 2351 | } |
2393 | Port port = portService.getPortByCode(toPortCode, warehouseCode); | 2352 | Port port = portService.getPortByCode(toPortCode, warehouseCode); |
@@ -2399,16 +2358,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -2399,16 +2358,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
2399 | if (!success) { | 2358 | if (!success) { |
2400 | throw new JeecgBootException("完成空托盘组出库任务时, 更新任务失败"); | 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 | return Result.ok("完成空托盘组出库任务成功"); | 2367 | return Result.ok("完成空托盘组出库任务成功"); |
2413 | } | 2368 | } |
2414 | 2369 | ||
@@ -2454,6 +2409,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -2454,6 +2409,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
2454 | } | 2409 | } |
2455 | 2410 | ||
2456 | @Override | 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 | public boolean updatePreTaskNoById(int preTaskNo, int id) { | 2421 | public boolean updatePreTaskNoById(int preTaskNo, int id) { |
2458 | TaskHeader taskHeader = new TaskHeader(); | 2422 | TaskHeader taskHeader = new TaskHeader(); |
2459 | taskHeader.setId(id); | 2423 | taskHeader.setId(id); |