1
15 小时以前 e711c834aec2293c53b07efe53e81e3573c289b6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
package com.vincent.rsf.server.manager.utils;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.vincent.rsf.framework.common.Cools;
import com.vincent.rsf.framework.common.SpringUtils;
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.server.manager.entity.*;
import com.vincent.rsf.server.manager.service.*;
import com.vincent.rsf.server.system.entity.TaskPathTemplateMerge;
import com.vincent.rsf.server.system.service.TaskPathTemplateMergeService;
import lombok.extern.slf4j.Slf4j;
import routeR.calculationR.RouteWmsStepFlow;
 
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
 
@Slf4j
public class WarehouseLocationRetrievalUtil {
 
    private BasStationService basStationService;
    private WarehouseAreasService warehouseAreasService;
 
    public WarehouseLocationRetrievalUtil() {
         basStationService = SpringUtils.getBean(BasStationService.class);
         warehouseAreasService = SpringUtils.getBean(WarehouseAreasService.class);
    }
 
    //判断目标是否是库区
    public boolean retrieveMissionmMergeReservoirAreaIsItAvailable(String missionArea) {
        boolean matches = missionArea.matches("\\d+");
        if (!matches) {
            return false;
        }
        WarehouseAreas warehouseAreas = warehouseAreasService.getById(Long.parseLong(missionArea));
        if (Cools.isEmpty(warehouseAreas)){
            return false;
        }
        return true;
    }
 
    //判断目标是否是站点
    public BasStation retrieveMissionmMergeSizeIsItAvailable(String missionSize) {
        BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, missionSize).last("limit 1"));
        if (Cools.isEmpty(basStation)){
            basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
                    .apply("station_alias != '[]'")  // 不是空数组
                    .apply("JSON_CONTAINS(station_alias, '\"{0}\"') = 1", missionSize)
                    .eq(BasStation::getDeleted, 0)  // 通常需要加上未删除条件
                    .last("LIMIT 1"));
        }
        if (Cools.isEmpty(basStation)){
            return null;
        }
        return basStation;
    }
 
    //根据条码获取规则
    public BasContainer getContainerByBarcode(String barcode) {
        if (Cools.isEmpty(barcode)) {
            throw new CoolException("容器码不能为空");
        }
        BasContainerService basContainerService = SpringUtils.getBean(BasContainerService.class);
        List<BasContainer> containers = basContainerService.list(new LambdaQueryWrapper<>());
        for (BasContainer container : containers) {
            String codeType = container.getCodeType();  // 获取正则表达式
            if (barcode.matches(codeType)) {  // 判断条码是否符合这个正则
                return container;
            }
        }
        throw new CoolException("容器码:"+barcode+"异常==>未找到匹配的规则");
    }
 
    //根据物料ID获取物料
    public Matnr getMatnrByMatnrId(Long matnrId) {
        if (Cools.isEmpty(matnrId)) {
            throw new CoolException("物料ID不能为空");
        }
        MatnrService matnrService = SpringUtils.getBean(MatnrService.class);
        Matnr matnr = matnrService.selectMatnrById(matnrId);
        if (matnr == null) {
            throw new CoolException("物料ID:"+matnrId+"异常==>未找到对应物料");
        }
        return matnr;
    }
 
    //判断物料是否可用此仓库
    public boolean retrieveMatnrIsItAvailable(String areaId, Long matnrId) {
        return retrieveMatnrIsItAvailable(Long.parseLong(areaId),matnrId);
    }
    public boolean retrieveMatnrIsItAvailable(Long areaId, Long matnrId) {
        Matnr matnrByMatnrId = getMatnrByMatnrId(matnrId);
        if (matnrByMatnrId.getWarehouseRestrictionCode() == null ||  matnrByMatnrId.getWarehouseRestrictionCode().equals("") || matnrByMatnrId.getWarehouseRestrictionCode().equals("all")) {
            return true;
        }
        //判断是否兼容
        String warehouseRestrictionCode = matnrByMatnrId.getWarehouseRestrictionCode();
        //根据code获取
        MatnrRestrictionWarehouseService matnrRestrictionWarehouseService = SpringUtils.getBean(MatnrRestrictionWarehouseService.class);
        MatnrRestrictionWarehouse serviceOne = matnrRestrictionWarehouseService.getOne(new LambdaQueryWrapper<MatnrRestrictionWarehouse>().eq(MatnrRestrictionWarehouse::getMatnrRestrictionCode, warehouseRestrictionCode).last("limit 1"));
        if (Objects.isNull(serviceOne)) {
            return false;
        }
        //查询area是否在
        return serviceOne.getProductionLineCode().contains(areaId.intValue());
    }
 
 
    // 根据库区、容器检索符合条件移库库区
    public List<String> getOutWarehouseAreasByReservoirAreaAndContainer(Long sourceCode, String barcode,Integer type) {
        return getOutWarehouseAreasByReservoirAreaAndContainer(sourceCode,barcode,type.toString());
    }
    public List<String> getOutWarehouseAreasByReservoirAreaAndContainer(Long sourceCode, String barcode,String type) {
        List<String> outboundSite = new ArrayList<>();
        List<String> outboundSiteByReservoirAreaAndContainer = getOutWarehouseAreasByReservoirAreaAndContainer(sourceCode, barcode);
        for (String areaId : outboundSiteByReservoirAreaAndContainer) {
            WarehouseAreas warehouseAreas = warehouseAreasService.getById(Long.parseLong(areaId));
            if (!Cools.isEmpty(warehouseAreas)){
                outboundSite.add(areaId);
            }
        }
        return outboundSite;
    }
 
    // 根据库区、容器检索符合条件出库站点
    private List<String> getOutWarehouseAreasByReservoirAreaAndContainer(Long sourceCode, String barcode) {
        return getTargetTypeByReservoirAreaAndContainer(String.valueOf(sourceCode), barcode,1,false);
    }
 
    // 根据库区、容器检索符合条件出库站点
    public List<String> getOutboundSiteByReservoirAreaAndContainer(Long sourceCode, String barcode,Integer type) {
        return getOutboundSiteByReservoirAreaAndContainer(sourceCode,barcode,type.toString());
    }
    public List<String> getOutboundSiteByReservoirAreaAndContainer(Long sourceCode, String barcode,String type) {
        List<String> outboundSite = new ArrayList<>();
        List<String> outboundSiteByReservoirAreaAndContainer = getOutboundSiteByReservoirAreaAndContainer(sourceCode, barcode);
        for (String site : outboundSiteByReservoirAreaAndContainer) {
            BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
                    .eq(BasStation::getStationName, site).last("limit 1"));
            if (!Cools.isEmpty(basStation)){
                BasStationTypeService basStationTypeService = SpringUtils.getBean(BasStationTypeService.class);
                BasStationType one = basStationTypeService.getOne(new LambdaQueryWrapper<BasStationType>().eq(BasStationType::getStationTypeCode, basStation.getContainerType()).last("limit 1"));
                if (!Cools.isEmpty(one)) {
                    if (one.getTaskType().contains(type)){
                        outboundSite.add(site);
                    }
                }
            }
        }
        return outboundSite;
    }
 
    // 根据库区、容器检索符合条件出库站点
    private List<String> getOutboundSiteByReservoirAreaAndContainer(Long sourceCode, String barcode) {
        return getTargetTypeByReservoirAreaAndContainer(String.valueOf(sourceCode), barcode,1,true);
    }
 
    // 根据库区、容器检索符合条件站点或库区
    private List<String> getTargetTypeByReservoirAreaAndContainer(String code, String barcode,int type,boolean isInOrOut) {
        List<String> obtainOutboundStations = new ArrayList<>();
        BasContainer containerByBarcode = getContainerByBarcode(barcode);
        if (containerByBarcode == null) {
            log.error("容器码:"+barcode+"异常==>未找到匹配的规则");
            return obtainOutboundStations;
        }
        Long containerType = containerByBarcode.getContainerType();
        TaskPathTemplateMergeService taskPathTemplateMergeService = SpringUtils.getBean(TaskPathTemplateMergeService.class);
        if (isInOrOut) {//根据起点检索终点
            List<TaskPathTemplateMerge> taskPathTemplateMergeList = taskPathTemplateMergeService.list(new LambdaQueryWrapper<TaskPathTemplateMerge>()
                    .eq(TaskPathTemplateMerge::getSourceType, code)
                    .eq(TaskPathTemplateMerge::getContainerType, containerType)
            );
            if (taskPathTemplateMergeList.isEmpty()) {
                return obtainOutboundStations;
            }
            for (TaskPathTemplateMerge taskPathTemplateMerge : taskPathTemplateMergeList) {
                switch (type){
                    case 1://站点
                        if (retrieveBarcodeIsItAvailableBySite(containerByBarcode,taskPathTemplateMerge.getTargetType())){
                            obtainOutboundStations.add(taskPathTemplateMerge.getTargetType());
                        }
                        break;
                    case 2://库区
                        if (retrieveMissionmMergeReservoirAreaIsItAvailable(taskPathTemplateMerge.getTargetType())){
                            obtainOutboundStations.add(taskPathTemplateMerge.getTargetType());
                        }
                        break;
                }
            }
        } else {//根据终点检索起点
            List<TaskPathTemplateMerge> taskPathTemplateMergeList = taskPathTemplateMergeService.list(new LambdaQueryWrapper<TaskPathTemplateMerge>()
                    .eq(TaskPathTemplateMerge::getTargetType, code)
                    .eq(TaskPathTemplateMerge::getContainerType, containerType)
            );
            if (taskPathTemplateMergeList.isEmpty()) {
                return obtainOutboundStations;
            }
            for (TaskPathTemplateMerge taskPathTemplateMerge : taskPathTemplateMergeList) {
                switch (type){
                    case 1://站点
                        if (retrieveBarcodeIsItAvailableBySite(containerByBarcode,taskPathTemplateMerge.getSourceType())){
                            obtainOutboundStations.add(taskPathTemplateMerge.getSourceType());
                        }
                        break;
                    case 2://库区
                        if (retrieveMissionmMergeReservoirAreaIsItAvailable(taskPathTemplateMerge.getSourceType())){
                            obtainOutboundStations.add(taskPathTemplateMerge.getSourceType());
                        }
                        break;
                }
            }
        }
 
        return obtainOutboundStations;
    }
 
    // 根据站点检索容器是否可行至此站点
    public boolean retrieveBarcodeIsItAvailableBySite(BasContainer containerByBarcode,BasStation basStation) {
        if (basStation.getContainerType().contains(containerByBarcode.getContainerType())) {
            return true;
        }
        return false;
    }
 
    // 根据站点检索容器是否可行至此站点
    public boolean retrieveBarcodeIsItAvailableBySite(String barcode,BasStation basStation) {
        BasContainer containerByBarcode = getContainerByBarcode(barcode);
        if (basStation.getContainerType().contains(containerByBarcode.getContainerType())) {
            return true;
        }
        return false;
    }
 
 
    // 根据站点检索容器是否可行至此站点
    public boolean retrieveBarcodeIsItAvailableBySite(BasContainer containerByBarcode,String siteCode) {
        BasStation basStation = retrieveMissionmMergeSizeIsItAvailable(siteCode);
        if (Cools.isEmpty(basStation)){
            return false;
        }
        if (basStation.getContainerType().contains(containerByBarcode.getContainerType())) {
            return true;
        }
        return false;
    }
 
    // 根据站点检索容器是否可行至此站点
    public boolean retrieveBarcodeIsItAvailableBySite(String barcode,String siteCode) {
        BasStation basStation = retrieveMissionmMergeSizeIsItAvailable(siteCode);
        if (Cools.isEmpty(basStation)){
            return false;
        }
        BasContainer containerByBarcode = getContainerByBarcode(barcode);
        if (basStation.getContainerType().contains(containerByBarcode.getContainerType())) {
            return true;
        }
 
        return false;
    }
 
    // 根据站点检索库区是否可入至此站点
    public boolean retrieveWarehouseAreasIsItAvailableInBySite(String warehouseCode,BasStation basStation) {
        // TODO: 实现逻辑
 
        return false;
    }
 
    // 根据站点检索库区是否可入至此站点
    public boolean retrieveWarehouseAreasIsItAvailableInBySite(String warehouseCode,String siteCode) {
        // TODO: 实现逻辑
        return false;
    }
 
    // 根据站点检索库区是否可出至此站点
    public boolean retrieveWarehouseAreasIsItAvailableOutBySite(String warehouseCode,BasStation basStation) {
        // TODO: 实现逻辑
        return false;
    }
 
    // 根据站点检索库区是否可出至此站点
    public boolean retrieveWarehouseAreasIsItAvailableOutBySite(String warehouseCode,String siteCode) {
        // TODO: 实现逻辑
        return false;
    }
 
    // 根据站点检索符合条件库区
    public List<String> getWarehouseAreasBySite(String siteCode) {
        // TODO: 实现逻辑
        return null;
    }
 
    // 根据站点检索符合条件容器
    public List<BasContainer> getContainersBySite(String siteCode) {
        // TODO: 实现逻辑
        return null;
    }
 
    // 根据站点检索符合条件任务类型
    public List<String> getTaskTypesBySite(String siteCode) {
        // TODO: 实现逻辑
        return null;
    }
 
    // 根据物料检索符合条件库区
    public List<String> getWarehouseAreasByMaterial(String materialCode) {
        // TODO: 实现逻辑
        return null;
    }
 
    // 根据物料检索符合条件容器
    public List<BasContainer> getContainersByMaterial(String materialCode) {
        // TODO: 实现逻辑
        return null;
    }
 
    // 根据物料检索符合条件站点
    public List<String> getSitesByMaterial(String materialCode) {
        // TODO: 实现逻辑
        return null;
    }
 
    // 根据库区检索符合条件站点
    public List<String> getSitesByWarehouseArea(String warehouseAreaCode) {
        // TODO: 实现逻辑
        return null;
    }
 
    // 根据站点\物料检索符合条件容器
    public List<BasContainer> getContainersBySiteAndMaterial(String siteCode, String materialCode) {
        // TODO: 实现逻辑
        return null;
    }
 
    // 根据站点\物料检索符合条件库区
    public List<String> getWarehouseAreasBySiteAndMaterial(String siteCode, String materialCode) {
        // TODO: 实现逻辑
        return null;
    }
 
    // 根据站点\物料检索符合条件路径
    public List<String> getPathsBySiteAndMaterial(String siteCode, String materialCode) {
        // TODO: 实现逻辑
        return null;
    }
 
    // 根据站点\物料检索符合条件任务类型
    public List<String> getTaskTypesBySiteAndMaterial(String siteCode, String materialCode) {
        // TODO: 实现逻辑
        return null;
    }
 
    // 根据站点\物料\容器检索符合条件库区
    public List<String> getWarehouseAreasBySiteMaterialContainer(String siteCode, String materialCode, String containerType) {
        // TODO: 实现逻辑
        return null;
    }
 
    // 根据站点\物料\容器检索符合条件任务类型
    public List<String> getTaskTypesBySiteMaterialContainer(String siteCode, String materialCode, String containerType) {
        // TODO: 实现逻辑
        return null;
    }
 
    // 根据站点\容器检索符合条件容器
    public List<BasContainer> getContainersBySiteAndContainerType(String siteCode, String containerType) {
        // TODO: 实现逻辑
        return null;
    }
 
    // 根据站点\容器检索符合条件库区
    public List<String> getWarehouseAreasBySiteAndContainer(String siteCode, String containerType) {
        // TODO: 实现逻辑
        return null;
    }
 
    // 根据站点\容器检索符合条件路径
    public List<String> getPathsBySiteAndContainer(String siteCode, String containerType) {
        // TODO: 实现逻辑
        return null;
    }
 
    // 根据站点\容器检索符合条件任务类型
    public List<String> getTaskTypesBySiteAndContainer(String siteCode, String containerType) {
        // TODO: 实现逻辑
        return null;
    }
 
    // 出库校验:根据源库区\目标站点\容器判断是否存在路径
    public boolean queryPathIsItAvailableOutArea(Long sourceCode, String targetCode, String barcode,Integer type) {
        return queryPathIsItAvailableOutArea(sourceCode.toString(),targetCode,barcode,type.toString());
    }
    public boolean queryPathIsItAvailableOutArea(String sourceCode, String targetCode, String barcode,Integer type) {
        return queryPathIsItAvailableOutArea(sourceCode,targetCode,barcode,type.toString());
    }
    public boolean queryPathIsItAvailableOutArea(String sourceCode, String targetCode, String barcode,String type) {
        if (queryPathIsItAvailable(sourceCode, targetCode, barcode)){
            BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
                    .eq(BasStation::getStationName, targetCode).last("limit 1"));
            if (!Cools.isEmpty(basStation)){
                if (type.equals("in")){
                    if (basStation.getInAble()==1){
                        return true;
                    }
                } else if (type.equals("out")){
                    if (basStation.getOutAble()==1){
                        return true;
                    }
                }
                BasStationTypeService basStationTypeService = SpringUtils.getBean(BasStationTypeService.class);
                BasStationType one = basStationTypeService.getOne(new LambdaQueryWrapper<BasStationType>().eq(BasStationType::getStationTypeCode, basStation.getContainerType()).last("limit 1"));
                if (!Cools.isEmpty(one)) {
                    if (one.getTaskType().contains(type)){
                        return true;
                    }
                    log.error("目标站点:" + targetCode+" 不支持作业此任务类型:"+type);
                }
                log.error("目标站点:" + targetCode+" 不支持作业此任务类型:"+type);
            }
            log.error("queryPathIsItAvailableInArea: error");
        }
        return false;
    }
 
    // 出库校验:根据源站点\目标库区\容器判断是否存在路径
    public boolean queryPathIsItAvailableInArea(String sourceCode, Long targetCode, String barcode,String type) {
        return queryPathIsItAvailableInArea(sourceCode,targetCode.toString(),barcode,type);
    }
    public boolean queryPathIsItAvailableInArea(String sourceCode, Long targetCode, String barcode,Integer type) {
        return queryPathIsItAvailableInArea(sourceCode,targetCode.toString(),barcode,type.toString());
    }
    public boolean queryPathIsItAvailableInArea(String sourceCode, String targetCode, String barcode,Integer type) {
        return queryPathIsItAvailableInArea(sourceCode,targetCode,barcode,type.toString());
    }
    public boolean queryPathIsItAvailableInArea(String sourceCode, String targetCode, String barcode,String type) {
        if (queryPathIsItAvailable(sourceCode, targetCode, barcode)){
            BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
                    .eq(BasStation::getStationName, sourceCode).last("limit 1"));
            if (!Cools.isEmpty(basStation)){
                if (type.equals("in")){
                    if (basStation.getInAble()==1){
                        return true;
                    }
                } else if (type.equals("out")){
                    if (basStation.getOutAble()==1){
                        return true;
                    }
                }
                BasStationTypeService basStationTypeService = SpringUtils.getBean(BasStationTypeService.class);
                BasStationType one = basStationTypeService.getOne(new LambdaQueryWrapper<BasStationType>().eq(BasStationType::getStationTypeCode, basStation.getContainerType()).last("limit 1"));
                if (!Cools.isEmpty(one)) {
                    if (one.getTaskType().contains(type)){
                        return true;
                    }
                    log.error("当前站点:" + sourceCode+" 不支持作业此任务类型:"+type);
                }
                log.error("当前站点:" + sourceCode+" 不支持作业此任务类型:"+type);
            }
            log.error("queryPathIsItAvailableInArea: error");
        }
        return false;
    }
 
    // 校验:根据起点\目标点\容器判断是否存在路径
    private boolean queryPathIsItAvailable(String sourceCode, String targetCode, String barcode) {
        BasContainer containerByBarcode = getContainerByBarcode(barcode);
        if (containerByBarcode == null) {
            return false;
        }
        if (retrieveMissionmMergeReservoirAreaIsItAvailable(sourceCode)){
            BasStation basStation = retrieveMissionmMergeSizeIsItAvailable(targetCode);
            if (!Cools.isEmpty(basStation)){
                return queryPathIsItAvailable(sourceCode, targetCode, containerByBarcode);
            } else {
                if (retrieveMissionmMergeReservoirAreaIsItAvailable(targetCode)){
                    return queryPathIsItAvailable(sourceCode, targetCode, containerByBarcode);
                }
                log.error("路径校验:根据起点:"+sourceCode+"、目标点:"+targetCode+"、容器规则:" +containerByBarcode.getCodeType()+ "判断是否存在路径==>终点类型未知!!!");
            }
        } else if (retrieveMissionmMergeReservoirAreaIsItAvailable(targetCode)){
            BasStation basStation = retrieveMissionmMergeSizeIsItAvailable(sourceCode);
            if (!Cools.isEmpty(basStation)){
                return queryPathIsItAvailable(sourceCode, targetCode, containerByBarcode);
            }
            log.error("路径校验:根据起点:"+sourceCode+"、目标点:"+targetCode+"、容器规则:" +containerByBarcode.getCodeType()+ "判断是否存在路径==>起点类型未知!!!");
        } else {
            BasStation basStationS = retrieveMissionmMergeSizeIsItAvailable(sourceCode);
            BasStation basStationT = retrieveMissionmMergeSizeIsItAvailable(targetCode);
            if (!Cools.isEmpty(basStationS) &&  !Cools.isEmpty(basStationT)){
                return queryPathIsItAvailable(sourceCode, targetCode, containerByBarcode);
            }
            log.error("路径校验:根据起点:"+sourceCode+"、目标点:"+targetCode+"、容器规则:" +containerByBarcode.getCodeType()+ "判断是否存在路径==>起点与终点类型未知!!!");
        }
        return false;
    }
 
 
    // 校验:根据起点\目标点\容器判断是否存在路径
    private boolean queryPathIsItAvailable(String sourceCode, String targetCode, BasContainer containerByBarcode) {
        try{
            TaskPathTemplateMergeService taskPathTemplateMergeService = SpringUtils.getBean(TaskPathTemplateMergeService.class);
            List<TaskPathTemplateMerge> taskPathTemplateMergeList = taskPathTemplateMergeService.list(new LambdaQueryWrapper<TaskPathTemplateMerge>()
                    .eq(TaskPathTemplateMerge::getSourceType, sourceCode)
                    .eq(TaskPathTemplateMerge::getTargetType, targetCode)
                    .apply("container_type != '[]'")  // 不是空数组
                    .apply("JSON_CONTAINS(container_type, {0}) = 1", containerByBarcode.getContainerType().toString())
            );
            if (Objects.isNull(taskPathTemplateMergeList) || taskPathTemplateMergeList.isEmpty()) {
                List<TaskPathTemplateMerge> list = taskPathTemplateMergeService.list(new LambdaQueryWrapper<TaskPathTemplateMerge>()
                        .eq(TaskPathTemplateMerge::getStepSize, 1)
                        .apply("container_type != '[]'")  // 不是空数组
                        .apply("JSON_CONTAINS(container_type, {0}) = 1", containerByBarcode.getContainerType().toString())
                );
                if (!Cools.isEmpty(list)) {
                    List<String[]> stationList = new ArrayList<>();
                    list.forEach(taskPathTemplate -> {
                        stationList.add(taskPathTemplate.route());
                    });
                    List<Long> longs = RouteWmsStepFlow.routeGet(stationList, targetCode, sourceCode);
                    if (longs != null && !longs.isEmpty()) {
                        return true;
                    }
                }
                log.error("路径校验:根据起点:"+sourceCode+"、目标点:"+targetCode+"、容器规则:" +containerByBarcode.getCodeType()+ "判断是否存在路径==>未找到路径!!!");
            } else {
                return true;
            }
        } catch (Exception e) {
            log.error("路径校验:根据起点:"+sourceCode+"、目标点:"+targetCode+"、容器规则:" +containerByBarcode.getCodeType()+ "判断是否存在路径==>异常:"+e.getMessage());
        }
        return false;
    }
 
 
}