ZarshAddService.java
3.48 KB
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
package com.huaheng.pc.sap.service;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huaheng.common.exception.service.ServiceException;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.config.location.service.LocationService;
import com.huaheng.pc.config.station.domain.Station;
import com.huaheng.pc.config.station.service.StationService;
import com.huaheng.pc.sap.domain.Zarsh;
import com.huaheng.pc.sap.mapper.ZarshMapper;
import com.huaheng.pc.task.taskDetail.service.TaskDetailService;
import com.huaheng.pc.task.taskHeader.service.WorkTaskService;
/**
* Created by Enzo Cotter on 2022/5/11.
* @author zhouhong
*/
@Service
public class ZarshAddService extends ServiceImpl<ZarshMapper, Zarsh> {
@Resource
private StationService stationService;
@Resource
private LocationService locationService;
@Resource
private TaskDetailService taskDetailService;
@Resource
private WorkTaskService workTaskService;
// 创建站点到站点任务
public void createMoveTask(String containerCode, String zoneCode, String formPort, String toPort, String uniqueId) {
if (StringUtils.isEmpty(formPort)) {
throw new ServiceException("未找到起点站台");
}
if (StringUtils.isEmpty(toPort)) {
throw new ServiceException("未找到终点站台");
}
if (zoneCode.equals("E") || zoneCode.equals("D") || zoneCode.equals("F")) {
} else {
throw new ServiceException("不支持此任务类型");
}
LambdaQueryWrapper<Station> lambdaQuery_m_from = Wrappers.lambdaQuery();
lambdaQuery_m_from.eq(Station::getByName, formPort);
Station mfromStation = stationService.getOne(lambdaQuery_m_from);
if (mfromStation == null) {
throw new ServiceException(formPort + "站台异常,未找到站台");
}
LambdaQueryWrapper<Station> lambdaQuery_m_to = Wrappers.lambdaQuery();
lambdaQuery_m_to.eq(Station::getByName, toPort);
Station mtoStation = stationService.getOne(lambdaQuery_m_to);
if (mfromStation == null) {
throw new ServiceException(formPort + "站台异常,未找到站台");
}
String fromArea = mfromStation.getAreaByWcs();
String toArea = mtoStation.getAreaByWcs();
// 验证区域
checkAreaByWcs(fromArea, toArea);
AjaxResult stationToStaion =
workTaskService.createStationToStation(containerCode, mfromStation.getCode(), mtoStation.getCode(), zoneCode, mtoStation.getCode(), uniqueId);
}
public void createdReceiptCrossZone() {
}
// 验证区域
public void checkAreaByWcs(String fromArea, String toArea) {
if (StringUtils.isNotEmpty(fromArea) && StringUtils.isNotEmpty(toArea)) {
if (fromArea.equals("A") && toArea.equals("C")) {
throw new ServiceException(fromArea + ":" + toArea + ",起点站台或库位和终点站台或库位不能跨堆垛机区域");
} else if (fromArea.equals("C") && toArea.equals("A")) {
throw new ServiceException(fromArea + ":" + toArea + ",起点站台或库位和终点站台或库位不能跨堆垛机区域");
}
}
}
}