Commit bf18d9cdc651411bb479ab01c3bf18d1f9a273df
Merge branch 'develop' of http://172.16.29.40:8010/wms/wms2 into develop
Showing
32 changed files
with
1308 additions
and
19 deletions
src/main/java/com/huaheng/api/wcs/controller/EmptyOutHandle.java
0 → 100644
1 | +package com.huaheng.api.wcs.controller; | ||
2 | + | ||
3 | +import com.huaheng.api.wcs.domain.WcsTask; | ||
4 | +import com.huaheng.api.wcs.service.emptyOutHandle.EmptyOutHandleService; | ||
5 | +import com.huaheng.api.wcs.service.overrideHandle.OverrideHandleService; | ||
6 | +import com.huaheng.framework.aspectj.lang.annotation.Log; | ||
7 | +import com.huaheng.framework.aspectj.lang.constant.BusinessType; | ||
8 | +import com.huaheng.framework.web.controller.BaseController; | ||
9 | +import com.huaheng.framework.web.domain.AjaxResult; | ||
10 | +import io.swagger.annotations.Api; | ||
11 | +import io.swagger.annotations.ApiOperation; | ||
12 | +import org.springframework.web.bind.annotation.*; | ||
13 | + | ||
14 | +import javax.annotation.Resource; | ||
15 | + | ||
16 | +/**空出处理接口 | ||
17 | + * wcs向wms传递数据 | ||
18 | + * @author ricard | ||
19 | + * @date 2019/10/11 | ||
20 | + * | ||
21 | + */ | ||
22 | + | ||
23 | +@RestController | ||
24 | +@RequestMapping("/WCS/v1") | ||
25 | +@Api(tags = {"OverrideHandle"}, description = "wcs空出处理接口") | ||
26 | +public class EmptyOutHandle extends BaseController { | ||
27 | + | ||
28 | + @Resource | ||
29 | + private EmptyOutHandleService emptyOutHandleService; | ||
30 | + | ||
31 | + @Log(title = "wcs空出处理", action = BusinessType.INSERT) | ||
32 | + @PostMapping("/EmptyOutHandle") | ||
33 | + @ApiOperation("wcs空出处理") | ||
34 | + @ResponseBody | ||
35 | + public AjaxResult EmptyOutHandle(@RequestBody WcsTask wcsTask) | ||
36 | + { | ||
37 | + AjaxResult ajaxResult =emptyOutHandleService.EmptyOutHandle(wcsTask) ; | ||
38 | + return ajaxResult; | ||
39 | + } | ||
40 | + | ||
41 | + | ||
42 | +} |
src/main/java/com/huaheng/api/wcs/controller/OverrideHandle.java
0 → 100644
1 | +package com.huaheng.api.wcs.controller; | ||
2 | + | ||
3 | +import com.huaheng.api.wcs.domain.WcsTask; | ||
4 | +import com.huaheng.api.wcs.service.overrideHandle.OverrideHandleService; | ||
5 | +import com.huaheng.api.wcs.service.taskFinish.TaskFinishService; | ||
6 | +import com.huaheng.framework.aspectj.lang.annotation.Log; | ||
7 | +import com.huaheng.framework.aspectj.lang.constant.BusinessType; | ||
8 | +import com.huaheng.framework.web.controller.BaseController; | ||
9 | +import com.huaheng.framework.web.domain.AjaxResult; | ||
10 | +import io.swagger.annotations.Api; | ||
11 | +import io.swagger.annotations.ApiOperation; | ||
12 | +import org.springframework.web.bind.annotation.*; | ||
13 | + | ||
14 | +import javax.annotation.Resource; | ||
15 | + | ||
16 | +/**重入处理接口 | ||
17 | + * wcs向wms传递数据 | ||
18 | + * @author ricard | ||
19 | + * @date 2019/10/11 | ||
20 | + * | ||
21 | + */ | ||
22 | + | ||
23 | +@RestController | ||
24 | +@RequestMapping("/WCS/v1") | ||
25 | +@Api(tags = {"OverrideHandle"}, description = "wcs重入处理接口") | ||
26 | +public class OverrideHandle extends BaseController { | ||
27 | + | ||
28 | + @Resource | ||
29 | + private OverrideHandleService overrideHandleService; | ||
30 | + | ||
31 | + @Log(title = "wcs重入处理", action = BusinessType.INSERT) | ||
32 | + @PostMapping("/OverrideHandle") | ||
33 | + @ApiOperation("wcs重入处理") | ||
34 | + @ResponseBody | ||
35 | + public AjaxResult OverrideHandle(@RequestBody WcsTask wcsTask) | ||
36 | + { | ||
37 | + AjaxResult ajaxResult =overrideHandleService.OverrideHandle(wcsTask) ; | ||
38 | + return ajaxResult; | ||
39 | + } | ||
40 | + | ||
41 | + | ||
42 | +} |
src/main/java/com/huaheng/api/wcs/controller/TaskFinish.java
0 → 100644
1 | +package com.huaheng.api.wcs.controller; | ||
2 | + | ||
3 | +import com.huaheng.api.wcs.domain.WcsTask; | ||
4 | +import com.huaheng.api.wcs.service.taskFinish.TaskFinishService; | ||
5 | +import com.huaheng.framework.aspectj.lang.annotation.Log; | ||
6 | +import com.huaheng.framework.aspectj.lang.constant.BusinessType; | ||
7 | +import com.huaheng.framework.web.controller.BaseController; | ||
8 | +import com.huaheng.framework.web.domain.AjaxResult; | ||
9 | +import io.swagger.annotations.Api; | ||
10 | +import io.swagger.annotations.ApiOperation; | ||
11 | +import org.springframework.web.bind.annotation.*; | ||
12 | + | ||
13 | +import javax.annotation.Resource; | ||
14 | + | ||
15 | +/**任务完成 | ||
16 | + * wcs向wms传递数据 | ||
17 | + * @author ricard | ||
18 | + * @date 2019/10/11 | ||
19 | + * | ||
20 | + */ | ||
21 | + | ||
22 | +@RestController | ||
23 | +@RequestMapping("/WCS/v1") | ||
24 | +@Api(tags = {"TaskFinish"}, description = "wcs任务完成数据接口") | ||
25 | +public class TaskFinish extends BaseController { | ||
26 | + | ||
27 | + @Resource | ||
28 | + private TaskFinishService taskFinishService; | ||
29 | + | ||
30 | + @Log(title = "wcs任务完成", action = BusinessType.INSERT) | ||
31 | + @PostMapping("/TaskFinish") | ||
32 | + @ApiOperation("wcs任务完成") | ||
33 | + @ResponseBody | ||
34 | + public AjaxResult TaskFinish(@RequestBody WcsTask wcsTask) | ||
35 | + { | ||
36 | + AjaxResult ajaxResult =taskFinishService.completeTaskByWCS(wcsTask) ; | ||
37 | + return ajaxResult; | ||
38 | + } | ||
39 | + | ||
40 | + | ||
41 | +} |
src/main/java/com/huaheng/api/wcs/controller/WarecellAllocation.java
0 → 100644
1 | +package com.huaheng.api.wcs.controller; | ||
2 | + | ||
3 | +import com.huaheng.api.wcs.domain.WcsTask; | ||
4 | +import com.huaheng.api.wcs.service.emptyOutHandle.EmptyOutHandleService; | ||
5 | +import com.huaheng.api.wcs.service.warecellAllocation.WarecellAllocationService; | ||
6 | +import com.huaheng.framework.aspectj.lang.annotation.Log; | ||
7 | +import com.huaheng.framework.aspectj.lang.constant.BusinessType; | ||
8 | +import com.huaheng.framework.web.controller.BaseController; | ||
9 | +import com.huaheng.framework.web.domain.AjaxResult; | ||
10 | +import io.swagger.annotations.Api; | ||
11 | +import io.swagger.annotations.ApiOperation; | ||
12 | +import org.springframework.web.bind.annotation.*; | ||
13 | + | ||
14 | +import javax.annotation.Resource; | ||
15 | + | ||
16 | +/**仓位分配 接口 | ||
17 | + * wcs向wms传递数据 | ||
18 | + * @author ricard | ||
19 | + * @date 2019/10/11 | ||
20 | + * | ||
21 | + */ | ||
22 | + | ||
23 | +@RestController | ||
24 | +@RequestMapping("/WCS/v1") | ||
25 | +@Api(tags = {"WarecellAllocation"}, description = "wcs仓位分配接口") | ||
26 | +public class WarecellAllocation extends BaseController { | ||
27 | + | ||
28 | + @Resource | ||
29 | + private WarecellAllocationService warecellAllocationService; | ||
30 | + | ||
31 | + @Log(title = "wcs仓位分配", action = BusinessType.INSERT) | ||
32 | + @PostMapping("/WarecellAllocation") | ||
33 | + @ApiOperation("wcs仓位分配") | ||
34 | + @ResponseBody | ||
35 | + public AjaxResult WarecellAllocation(@RequestBody WcsTask wcsTask) | ||
36 | + { | ||
37 | + AjaxResult ajaxResult =warecellAllocationService.WarecellAllocation(wcsTask) ; | ||
38 | + return ajaxResult; | ||
39 | + } | ||
40 | + | ||
41 | + | ||
42 | +} |
src/main/java/com/huaheng/api/wcs/domain/WcsTask.java
0 → 100644
1 | +package com.huaheng.api.wcs.domain; | ||
2 | + | ||
3 | +import java.io.Serializable; | ||
4 | + | ||
5 | +/** | ||
6 | + * wcs任务接口实体层 | ||
7 | + * @author ricard | ||
8 | + * @date 2019/10/11 | ||
9 | + */ | ||
10 | +public class WcsTask implements Serializable { | ||
11 | + private static final long serialVersionUID = -8855840499538794854L; | ||
12 | + | ||
13 | + //任务号 | ||
14 | + private String taskNo; | ||
15 | + | ||
16 | + //任务类型 | ||
17 | + private String taskType; | ||
18 | + | ||
19 | + //出库站台编码.默认‘0’ | ||
20 | + private String station; | ||
21 | + | ||
22 | + //平台 | ||
23 | + private String platform; | ||
24 | + | ||
25 | + //容器编码 | ||
26 | + private String palletNo; | ||
27 | + | ||
28 | + //源位置库位编码 | ||
29 | + private String fromLocationCode; | ||
30 | + | ||
31 | + //目的位置库位编码 | ||
32 | + private String toLocationCode; | ||
33 | + | ||
34 | + //重入后再次分配的位置编码 | ||
35 | + private String locationCode; | ||
36 | + | ||
37 | + //取消任务 | ||
38 | + private String reason; | ||
39 | + | ||
40 | + //长 | ||
41 | + private Float length; | ||
42 | + | ||
43 | + //宽 | ||
44 | + private Float width; | ||
45 | + | ||
46 | + //高 | ||
47 | + private Float height; | ||
48 | + | ||
49 | + //重 | ||
50 | + private Float weight; | ||
51 | + | ||
52 | + public String getTaskNo() { | ||
53 | + return taskNo; | ||
54 | + } | ||
55 | + | ||
56 | + public void setTaskNo(String taskNo) { | ||
57 | + this.taskNo = taskNo; | ||
58 | + } | ||
59 | + | ||
60 | + public String getTaskType() { | ||
61 | + return taskType; | ||
62 | + } | ||
63 | + | ||
64 | + public void setTaskType(String taskType) { | ||
65 | + this.taskType = taskType; | ||
66 | + } | ||
67 | + | ||
68 | + public String getStation() { | ||
69 | + return station; | ||
70 | + } | ||
71 | + | ||
72 | + public void setStation(String station) { | ||
73 | + this.station = station; | ||
74 | + } | ||
75 | + | ||
76 | + public String getPlatform() { | ||
77 | + return platform; | ||
78 | + } | ||
79 | + | ||
80 | + public void setPlatform(String platform) { | ||
81 | + this.platform = platform; | ||
82 | + } | ||
83 | + | ||
84 | + public String getPalletNo() { | ||
85 | + return palletNo; | ||
86 | + } | ||
87 | + | ||
88 | + public void setPalletNo(String palletNo) { | ||
89 | + this.palletNo = palletNo; | ||
90 | + } | ||
91 | + | ||
92 | + public String getFromLocationCode() { | ||
93 | + return fromLocationCode; | ||
94 | + } | ||
95 | + | ||
96 | + public void setFromLocationCode(String fromLocationCode) { | ||
97 | + this.fromLocationCode = fromLocationCode; | ||
98 | + } | ||
99 | + | ||
100 | + public String getToLocationCode() { | ||
101 | + return toLocationCode; | ||
102 | + } | ||
103 | + | ||
104 | + public void setToLocationCode(String toLocationCode) { | ||
105 | + this.toLocationCode = toLocationCode; | ||
106 | + } | ||
107 | + | ||
108 | + public String getReason() { | ||
109 | + return reason; | ||
110 | + } | ||
111 | + | ||
112 | + public void setReason(String reason) { | ||
113 | + this.reason = reason; | ||
114 | + } | ||
115 | + | ||
116 | + public float getLength() { | ||
117 | + return length; | ||
118 | + } | ||
119 | + | ||
120 | + public void setLength(float length) { | ||
121 | + this.length = length; | ||
122 | + } | ||
123 | + | ||
124 | + public float getWidth() { | ||
125 | + return width; | ||
126 | + } | ||
127 | + | ||
128 | + public void setWidth(float width) { | ||
129 | + this.width = width; | ||
130 | + } | ||
131 | + | ||
132 | + public float getHeight() { | ||
133 | + return height; | ||
134 | + } | ||
135 | + | ||
136 | + public void setHeight(float height) { | ||
137 | + this.height = height; | ||
138 | + } | ||
139 | + | ||
140 | + public float getWeight() { | ||
141 | + return weight; | ||
142 | + } | ||
143 | + | ||
144 | + public void setWeight(float weight) { | ||
145 | + this.weight = weight; | ||
146 | + } | ||
147 | + | ||
148 | + public String getLocationCode() { | ||
149 | + return locationCode; | ||
150 | + } | ||
151 | + | ||
152 | + public void setLocationCode(String locationCode) { | ||
153 | + this.locationCode = locationCode; | ||
154 | + } | ||
155 | + | ||
156 | + public void setLength(Float length) { | ||
157 | + this.length = length; | ||
158 | + } | ||
159 | + | ||
160 | + public void setWidth(Float width) { | ||
161 | + this.width = width; | ||
162 | + } | ||
163 | + | ||
164 | + public void setHeight(Float height) { | ||
165 | + this.height = height; | ||
166 | + } | ||
167 | + | ||
168 | + public void setWeight(Float weight) { | ||
169 | + this.weight = weight; | ||
170 | + } | ||
171 | +} |
src/main/java/com/huaheng/api/wcs/service/emptyOutHandle/EmptyOutHandleService.java
0 → 100644
src/main/java/com/huaheng/api/wcs/service/emptyOutHandle/EmptyOutHandleServiceImpl.java
0 → 100644
1 | +package com.huaheng.api.wcs.service.emptyOutHandle; | ||
2 | + | ||
3 | +import com.huaheng.api.wcs.domain.WcsTask; | ||
4 | +import com.huaheng.common.utils.StringUtils; | ||
5 | +import com.huaheng.framework.web.domain.AjaxResult; | ||
6 | +import com.huaheng.pc.task.taskHeader.domain.TaskHeader; | ||
7 | +import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; | ||
8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
9 | +import org.springframework.stereotype.Service; | ||
10 | +import org.springframework.transaction.annotation.Transactional; | ||
11 | + | ||
12 | +@Service | ||
13 | +public class EmptyOutHandleServiceImpl implements EmptyOutHandleService { | ||
14 | + | ||
15 | + | ||
16 | + @Autowired | ||
17 | + private TaskHeaderService taskHeaderService; | ||
18 | + | ||
19 | + /** | ||
20 | + * 空出处理 | ||
21 | + * 1、判断非空字段 | ||
22 | + * 2、根据任务号查找任务 | ||
23 | + * 3、修改该任务为空出,过后处理 | ||
24 | + * @param wcsTask | ||
25 | + * @return | ||
26 | + */ | ||
27 | + @Override | ||
28 | + @Transactional | ||
29 | + public AjaxResult EmptyOutHandle(WcsTask wcsTask) { | ||
30 | + | ||
31 | + //1、判断非空字段 | ||
32 | + if(StringUtils.isEmpty(wcsTask.getTaskNo())){ | ||
33 | + return AjaxResult.error("任务号为空"); | ||
34 | + } | ||
35 | + | ||
36 | + //2、根据任务号查找任务 | ||
37 | + TaskHeader taskHeader = taskHeaderService.getById(Integer.valueOf(wcsTask.getTaskNo())); | ||
38 | + if(taskHeader == null){ | ||
39 | + return AjaxResult.error("任务号错误,没有找到该任务"); | ||
40 | + } | ||
41 | + | ||
42 | + //3、修改该任务为空出,过后处理 | ||
43 | + taskHeader.setUserDef1("空托出库"); | ||
44 | + Boolean flag = taskHeaderService.updateById(taskHeader); | ||
45 | + if(flag == false){ | ||
46 | + return AjaxResult.error("修改任务失败,空出处理失败"); | ||
47 | + } | ||
48 | + return AjaxResult.success("空出处理成功"); | ||
49 | + } | ||
50 | +} |
src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleService.java
0 → 100644
src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleServiceImpl.java
0 → 100644
1 | +package com.huaheng.api.wcs.service.overrideHandle; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
4 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
5 | +import com.huaheng.api.wcs.domain.WcsTask; | ||
6 | +import com.huaheng.common.exception.service.ServiceException; | ||
7 | +import com.huaheng.common.utils.StringUtils; | ||
8 | +import com.huaheng.common.utils.security.ShiroUtils; | ||
9 | +import com.huaheng.framework.web.domain.AjaxResult; | ||
10 | +import com.huaheng.pc.config.location.domain.Location; | ||
11 | +import com.huaheng.pc.config.location.service.LocationService; | ||
12 | +import com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail; | ||
13 | +import com.huaheng.pc.receipt.receiptContainerDetail.service.ReceiptContainerDetailService; | ||
14 | +import com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader; | ||
15 | +import com.huaheng.pc.receipt.receiptContainerHeader.service.ReceiptContainerHeaderService; | ||
16 | +import com.huaheng.pc.task.taskDetail.domain.TaskDetail; | ||
17 | +import com.huaheng.pc.task.taskDetail.service.TaskDetailService; | ||
18 | +import com.huaheng.pc.task.taskHeader.domain.TaskHeader; | ||
19 | +import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; | ||
20 | +import org.springframework.beans.factory.annotation.Autowired; | ||
21 | +import org.springframework.stereotype.Service; | ||
22 | +import org.springframework.transaction.annotation.Transactional; | ||
23 | + | ||
24 | +import java.util.ArrayList; | ||
25 | +import java.util.List; | ||
26 | + | ||
27 | +@Service | ||
28 | +public class OverrideHandleServiceImpl implements OverrideHandleService { | ||
29 | + | ||
30 | + | ||
31 | + @Autowired | ||
32 | + private TaskHeaderService taskHeaderService; | ||
33 | + @Autowired | ||
34 | + private TaskDetailService taskDetailService; | ||
35 | + @Autowired | ||
36 | + private LocationService locationService; | ||
37 | + @Autowired | ||
38 | + private ReceiptContainerHeaderService receiptContainerHeaderService; | ||
39 | + @Autowired | ||
40 | + private ReceiptContainerDetailService receiptContainerDetailService; | ||
41 | + | ||
42 | + /** | ||
43 | + * 重入处理 | ||
44 | + * 1、判断非空字段 | ||
45 | + * 2、根据任务号查找任务 | ||
46 | + * 3、修改任务目的库位,修改入库组盘的库位,修改库位状态 | ||
47 | + */ | ||
48 | + | ||
49 | + @Override | ||
50 | + @Transactional | ||
51 | + public AjaxResult OverrideHandle(WcsTask wcsTask) { | ||
52 | + Boolean flag = true; | ||
53 | + | ||
54 | + //1、判断非空字段 | ||
55 | + if(StringUtils.isEmpty(wcsTask.getTaskNo())){ | ||
56 | + return AjaxResult.error("任务号为空"); | ||
57 | + } | ||
58 | + if(StringUtils.isEmpty(wcsTask.getToLocationCode())){ | ||
59 | + return AjaxResult.error("目的库位为空"); | ||
60 | + } | ||
61 | + | ||
62 | + //2、根据任务号查找任务 | ||
63 | + TaskHeader taskHeader = taskHeaderService.getById(Integer.valueOf(wcsTask.getTaskNo())); | ||
64 | + if(taskHeader == null){ | ||
65 | + return AjaxResult.error("任务号错误,没有找到该任务"); | ||
66 | + } | ||
67 | + | ||
68 | + //3、修改任务目的库位,修改入库组盘的库位,修改库位状态 | ||
69 | + //修改原来目的库位的状态 | ||
70 | + LambdaQueryWrapper<Location> locationLam = Wrappers.lambdaQuery(); | ||
71 | + locationLam.eq(Location::getCode,taskHeader.getToLocation()) | ||
72 | + .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode()); | ||
73 | + Location location = locationService.getOne(locationLam); | ||
74 | + if(location == null){ | ||
75 | + return AjaxResult.error("此任务的原目的库位在系统中不存在"); | ||
76 | + } | ||
77 | + location.setStatus("empty"); | ||
78 | + flag = locationService.updateById(location); | ||
79 | + if(flag == false){ | ||
80 | + return AjaxResult.error("修改此任务的原目的库位错误"); | ||
81 | + } | ||
82 | + | ||
83 | + //查看新库位 | ||
84 | + locationLam.eq(Location::getCode,wcsTask.getToLocationCode()) | ||
85 | + .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode()); | ||
86 | + Location newlocation = locationService.getOne(locationLam); | ||
87 | + if(newlocation == null){ | ||
88 | + throw new ServiceException("新目的库位在系统中不存在"); | ||
89 | + } | ||
90 | + //修改任务 | ||
91 | + taskHeader.setToLocation(wcsTask.getToLocationCode()); | ||
92 | + taskHeader.setUserDef1("重入处理"); | ||
93 | + flag = taskHeaderService.updateById(taskHeader); | ||
94 | + if(flag == false){ | ||
95 | + throw new ServiceException("修改此任务错误"); | ||
96 | + } | ||
97 | + | ||
98 | + //修改子任务 | ||
99 | + LambdaQueryWrapper<TaskDetail> taskDetailLam = Wrappers.lambdaQuery(); | ||
100 | + taskDetailLam.eq(TaskDetail::getWarehouseCode,ShiroUtils.getWarehouseCode()) | ||
101 | + .eq(TaskDetail::getTaskId,taskHeader.getId()); | ||
102 | + List<TaskDetail> taskDetails = taskDetailService.list(taskDetailLam); | ||
103 | + List<TaskDetail> taskDetailList = new ArrayList<>(); | ||
104 | + if(taskDetails != null && taskDetails.size()> 0){ | ||
105 | + for(TaskDetail taskDetail : taskDetails){ | ||
106 | + taskDetail.setToLocation(wcsTask.getToLocationCode()); | ||
107 | + taskDetailList.add(taskDetail); | ||
108 | + } | ||
109 | + flag = taskDetailService.updateBatchById(taskDetailList); | ||
110 | + if(flag == false){ | ||
111 | + throw new ServiceException("修改此任务的明细错误"); | ||
112 | + } | ||
113 | + } | ||
114 | + | ||
115 | + //修改入库组盘 | ||
116 | + if(taskHeader.getAllocationHeadId() == null){ | ||
117 | + throw new ServiceException("找不到此任务的组盘头id"); | ||
118 | + } | ||
119 | + ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getById(taskHeader.getAllocationHeadId()); | ||
120 | + if(receiptContainerHeader == null){ | ||
121 | + throw new ServiceException("找不到此任务的组盘头"); | ||
122 | + } | ||
123 | + receiptContainerHeader.setToLocation(wcsTask.getToLocationCode()); | ||
124 | + flag = receiptContainerHeaderService.updateById(receiptContainerHeader); | ||
125 | + if(flag == false){ | ||
126 | + throw new ServiceException("修改此任务对应的组盘头错误"); | ||
127 | + } | ||
128 | + | ||
129 | + //修改入库组盘明细 | ||
130 | + LambdaQueryWrapper<ReceiptContainerDetail> lam = Wrappers.lambdaQuery(); | ||
131 | + lam.eq(ReceiptContainerDetail::getReceiptContainerId,receiptContainerHeader.getId()) | ||
132 | + .eq(ReceiptContainerDetail::getWarehouseCode,ShiroUtils.getWarehouseCode()); | ||
133 | + List<ReceiptContainerDetail> receiptContainerDetails = receiptContainerDetailService.list(lam); | ||
134 | + List<ReceiptContainerDetail> receiptContainerDetailList = new ArrayList<>(); | ||
135 | + if(receiptContainerDetails != null && receiptContainerDetails.size()> 0){ | ||
136 | + for(ReceiptContainerDetail receiptContainerDetail : receiptContainerDetails){ | ||
137 | + receiptContainerDetail.setLocationCode(wcsTask.getToLocationCode()); | ||
138 | + receiptContainerDetailList.add(receiptContainerDetail); | ||
139 | + } | ||
140 | + flag = receiptContainerDetailService.updateBatchById(receiptContainerDetailList); | ||
141 | + if(flag == false){ | ||
142 | + throw new ServiceException("修改此任务的组盘明细错误"); | ||
143 | + } | ||
144 | + } | ||
145 | + return AjaxResult.success("重入处理成功"); | ||
146 | + } | ||
147 | +} |
src/main/java/com/huaheng/api/wcs/service/stationInfo/StationInfoService.java
0 → 100644
src/main/java/com/huaheng/api/wcs/service/stationInfo/StationInfoServiceImpl.java
0 → 100644
1 | +package com.huaheng.api.wcs.service.stationInfo; | ||
2 | + | ||
3 | + | ||
4 | +import com.alibaba.fastjson.JSON; | ||
5 | +import com.huaheng.api.wcs.domain.WcsTask; | ||
6 | +import com.huaheng.common.exception.service.ServiceException; | ||
7 | +import com.huaheng.common.utils.StringUtils; | ||
8 | +import com.huaheng.common.utils.http.HttpUtils; | ||
9 | +import com.huaheng.framework.web.domain.AjaxResult; | ||
10 | +import com.huaheng.pc.config.address.service.AddressService; | ||
11 | +import org.springframework.beans.factory.annotation.Autowired; | ||
12 | +import org.springframework.stereotype.Service; | ||
13 | + | ||
14 | +@Service | ||
15 | +public class StationInfoServiceImpl implements StationInfoService { | ||
16 | + | ||
17 | + @Autowired | ||
18 | + private AddressService addressService; | ||
19 | + | ||
20 | + /** | ||
21 | + * 站台信息查询 | ||
22 | + * 1、判断非空字段 | ||
23 | + * 2、实体转换 | ||
24 | + * 3、发送数据 | ||
25 | + * @param station | ||
26 | + * @return | ||
27 | + */ | ||
28 | + @Override | ||
29 | + public AjaxResult StationInfo(String station) { | ||
30 | + | ||
31 | + //1、判断非空字段 | ||
32 | + if(StringUtils.isEmpty(station)){ | ||
33 | + return AjaxResult.error("站台为空"); | ||
34 | + } | ||
35 | + | ||
36 | + //2、实体转换 | ||
37 | + WcsTask wcsTask =new WcsTask(); | ||
38 | + wcsTask.setStation(station); | ||
39 | + | ||
40 | + //3、发送数据 | ||
41 | + String param="wcs"; | ||
42 | + String url=addressService.selectAddress(param)+"StationInfo"; | ||
43 | + String JsonParam = JSON.toJSONString(wcsTask); | ||
44 | + String result = HttpUtils.bodypost(url, JsonParam); | ||
45 | + if(StringUtils.isEmpty(result)){ | ||
46 | + throw new ServiceException("接口地址错误"); | ||
47 | + } | ||
48 | + AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class); | ||
49 | + return ajaxResult; | ||
50 | + | ||
51 | + } | ||
52 | +} |
src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignService.java
0 → 100644
1 | +package com.huaheng.api.wcs.service.taskAssignService; | ||
2 | + | ||
3 | +import com.huaheng.framework.web.domain.AjaxResult; | ||
4 | +import com.huaheng.pc.task.taskHeader.domain.TaskHeader; | ||
5 | + | ||
6 | +/** | ||
7 | + * 任务下发接口Service层 | ||
8 | + * @author ricard | ||
9 | + * @date 2019/10/11 | ||
10 | + * | ||
11 | + */ | ||
12 | +public interface TaskAssignService { | ||
13 | + | ||
14 | + //wms下发任务给wcs | ||
15 | + AjaxResult wcsTaskAssign(TaskHeader taskHeader); | ||
16 | +} |
src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignServiceImpl.java
0 → 100644
1 | +package com.huaheng.api.wcs.service.taskAssignService; | ||
2 | + | ||
3 | + | ||
4 | +import com.alibaba.fastjson.JSON; | ||
5 | +import com.huaheng.api.wcs.domain.WcsTask; | ||
6 | +import com.huaheng.common.exception.service.ServiceException; | ||
7 | +import com.huaheng.common.utils.StringUtils; | ||
8 | +import com.huaheng.common.utils.http.HttpUtils; | ||
9 | +import com.huaheng.framework.web.domain.AjaxResult; | ||
10 | +import com.huaheng.pc.config.address.service.AddressService; | ||
11 | +import com.huaheng.pc.task.taskHeader.domain.TaskHeader; | ||
12 | +import org.springframework.beans.factory.annotation.Autowired; | ||
13 | +import org.springframework.stereotype.Service; | ||
14 | +import org.springframework.transaction.annotation.Transactional; | ||
15 | + | ||
16 | +/** | ||
17 | + * 任务下发接口ServiceImpl层 | ||
18 | + * @author ricard | ||
19 | + * @date 2019/10/11 | ||
20 | + * | ||
21 | + */ | ||
22 | + | ||
23 | +@Service | ||
24 | +public class TaskAssignServiceImpl implements TaskAssignService { | ||
25 | + | ||
26 | + @Autowired | ||
27 | + private AddressService addressService; | ||
28 | + | ||
29 | + | ||
30 | + public static String platform = "wms"; | ||
31 | + | ||
32 | + //wms下发任务给wcs | ||
33 | + /** | ||
34 | + * 1、判断taskHeader是否为空 | ||
35 | + * 2、判断必填字段是否满足 | ||
36 | + * 3、转换实体 | ||
37 | + * 4、发送数据 | ||
38 | + * | ||
39 | + * @param taskHeader | ||
40 | + * @return | ||
41 | + */ | ||
42 | + @Override | ||
43 | + @Transactional | ||
44 | + public AjaxResult wcsTaskAssign(TaskHeader taskHeader) { | ||
45 | + //1、判断taskHeader是否为空 | ||
46 | + if(taskHeader == null){ | ||
47 | + throw new ServiceException("wms任务为空"); | ||
48 | + } | ||
49 | + | ||
50 | + //2、判断必填字段是否满足 | ||
51 | + if(taskHeader.getId() == null){ | ||
52 | + throw new ServiceException("wms任务号Id为空"); | ||
53 | + } | ||
54 | + if(taskHeader.getTaskType() == null){ | ||
55 | + throw new ServiceException("wms任务类型为空"); | ||
56 | + } | ||
57 | + if(StringUtils.isEmpty(taskHeader.getContainerCode())){ | ||
58 | + throw new ServiceException("wms任务中容器为空"); | ||
59 | + } | ||
60 | +// if(StringUtils.isEmpty(taskHeader.getStation())){ | ||
61 | +// throw new ServiceException("wms站台为空"); | ||
62 | +// } | ||
63 | + | ||
64 | + //入库性质的任务源库位不能为空 | ||
65 | + if(taskHeader.getTaskType()==100 || taskHeader.getTaskType()==200 | ||
66 | + || taskHeader.getTaskType()==500 || taskHeader.getTaskType()==800) { | ||
67 | + if (taskHeader.getFromLocation() == null) { | ||
68 | + throw new ServiceException("源库位为空"); | ||
69 | + } | ||
70 | + } | ||
71 | + | ||
72 | + // 出库性质的任务目的库位不能为空 | ||
73 | + if(taskHeader.getTaskType()==300 || taskHeader.getTaskType()==400 | ||
74 | + || taskHeader.getTaskType()==600 || taskHeader.getTaskType()==700 | ||
75 | + || taskHeader.getTaskType()==800 || taskHeader.getTaskType()==900) | ||
76 | + { | ||
77 | + if (taskHeader.getToLocation() == null) { | ||
78 | + throw new ServiceException("目的库位为空"); | ||
79 | + } | ||
80 | + } | ||
81 | + | ||
82 | + //3、转换实体,初始化wcs任务实体 | ||
83 | + WcsTask wcsTask = new WcsTask(); | ||
84 | + wcsTask.setTaskNo(taskHeader.getId().toString()); | ||
85 | + wcsTask.setTaskType(taskHeader.getTaskType().toString()); | ||
86 | +// wcsTask.setStation(taskHeader.getStation); | ||
87 | + wcsTask.setPalletNo(taskHeader.getContainerCode()); | ||
88 | + wcsTask.setFromLocationCode(taskHeader.getFromLocation()); | ||
89 | + wcsTask.setToLocationCode(taskHeader.getToLocation()); | ||
90 | + wcsTask.setPlatform(platform); | ||
91 | + | ||
92 | + //4、发送数据 | ||
93 | + String param="wcs"; | ||
94 | + String url=addressService.selectAddress(param)+"TaskAssign"; | ||
95 | + String JsonParam = JSON.toJSONString(wcsTask); | ||
96 | + String result = HttpUtils.bodypost(url, JsonParam); | ||
97 | + if(StringUtils.isEmpty(result)){ | ||
98 | + throw new ServiceException("接口地址错误"); | ||
99 | + } | ||
100 | + AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class); | ||
101 | + return ajaxResult; | ||
102 | + } | ||
103 | +} |
src/main/java/com/huaheng/api/wcs/service/taskCancel/TaskCancelService.java
0 → 100644
src/main/java/com/huaheng/api/wcs/service/taskCancel/TaskCancelServiceImpl.java
0 → 100644
1 | +package com.huaheng.api.wcs.service.taskCancel; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSON; | ||
4 | +import com.huaheng.api.wcs.domain.WcsTask; | ||
5 | +import com.huaheng.common.exception.service.ServiceException; | ||
6 | +import com.huaheng.common.utils.StringUtils; | ||
7 | +import com.huaheng.common.utils.http.HttpUtils; | ||
8 | +import com.huaheng.framework.web.domain.AjaxResult; | ||
9 | +import com.huaheng.pc.config.address.service.AddressService; | ||
10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
11 | +import org.springframework.stereotype.Service; | ||
12 | + | ||
13 | +@Service | ||
14 | +public class TaskCancelServiceImpl implements TaskCancelService { | ||
15 | + | ||
16 | + | ||
17 | + @Autowired | ||
18 | + private AddressService addressService; | ||
19 | + | ||
20 | + /**取消任务 | ||
21 | + * 1、判断参数是否为空 | ||
22 | + * 2、转换实体 | ||
23 | + * 3、发送数据 | ||
24 | + * @param id | ||
25 | + * @param reason | ||
26 | + * @return | ||
27 | + */ | ||
28 | + @Override | ||
29 | + public AjaxResult TaskCance(Integer id, String reason) { | ||
30 | + | ||
31 | + //1、判断参数是否为空 | ||
32 | + if(id == null){ | ||
33 | + throw new ServiceException("任务号为空"); | ||
34 | + } | ||
35 | + if(StringUtils.isEmpty(reason)){ | ||
36 | + throw new ServiceException("取消原因"); | ||
37 | + } | ||
38 | + | ||
39 | + //2、转换实体 | ||
40 | + WcsTask wcsTask = new WcsTask(); | ||
41 | + wcsTask.setTaskNo(id.toString()); | ||
42 | + wcsTask.setReason(reason); | ||
43 | + | ||
44 | + //3、发送数据 | ||
45 | + String param="wcs"; | ||
46 | + String url=addressService.selectAddress(param)+"TaskCance"; | ||
47 | + String JsonParam = JSON.toJSONString(wcsTask); | ||
48 | + String result = HttpUtils.bodypost(url, JsonParam); | ||
49 | + if(StringUtils.isEmpty(result)){ | ||
50 | + throw new ServiceException("接口地址错误"); | ||
51 | + } | ||
52 | + AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class); | ||
53 | + return ajaxResult; | ||
54 | + } | ||
55 | +} |
src/main/java/com/huaheng/api/wcs/service/taskFinish/TaskFinishService.java
0 → 100644
src/main/java/com/huaheng/api/wcs/service/taskFinish/TaskFinishServiceImpl.java
0 → 100644
1 | +package com.huaheng.api.wcs.service.taskFinish; | ||
2 | + | ||
3 | +import com.huaheng.api.wcs.domain.WcsTask; | ||
4 | +import com.huaheng.common.support.Convert; | ||
5 | +import com.huaheng.common.utils.StringUtils; | ||
6 | +import com.huaheng.framework.web.domain.AjaxResult; | ||
7 | +import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; | ||
8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
9 | +import org.springframework.stereotype.Service; | ||
10 | + | ||
11 | +@Service | ||
12 | +public class TaskFinishServiceImpl implements TaskFinishService { | ||
13 | + | ||
14 | + @Autowired | ||
15 | + private TaskHeaderService taskHeaderService; | ||
16 | + | ||
17 | + //任务完成 | ||
18 | + @Override | ||
19 | + public AjaxResult completeTaskByWCS(WcsTask wcsTask) { | ||
20 | + AjaxResult ajaxResult=new AjaxResult(); | ||
21 | + if(StringUtils.isEmpty(wcsTask.getTaskNo())){ | ||
22 | + return AjaxResult.error("任务号为空"); | ||
23 | + } | ||
24 | + try{ | ||
25 | + ajaxResult=taskHeaderService.completeTaskByWMS(Convert.toIntArray(wcsTask.getTaskNo())); | ||
26 | + } catch (Exception e) { | ||
27 | + e.printStackTrace(); | ||
28 | + } | ||
29 | + return ajaxResult; | ||
30 | + } | ||
31 | +} |
src/main/java/com/huaheng/api/wcs/service/taskInfo/TaskInfoService.java
0 → 100644
src/main/java/com/huaheng/api/wcs/service/taskInfo/TaskInfoServiceImpl.java
0 → 100644
1 | +package com.huaheng.api.wcs.service.taskInfo; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSON; | ||
4 | +import com.huaheng.api.wcs.domain.WcsTask; | ||
5 | +import com.huaheng.common.exception.service.ServiceException; | ||
6 | +import com.huaheng.common.utils.StringUtils; | ||
7 | +import com.huaheng.common.utils.http.HttpUtils; | ||
8 | +import com.huaheng.framework.web.domain.AjaxResult; | ||
9 | +import com.huaheng.pc.config.address.service.AddressService; | ||
10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
11 | +import org.springframework.stereotype.Service; | ||
12 | + | ||
13 | +@Service | ||
14 | +public class TaskInfoServiceImpl implements TaskInfoService { | ||
15 | + | ||
16 | + | ||
17 | + @Autowired | ||
18 | + private AddressService addressService; | ||
19 | + /** | ||
20 | + * 任务信息查询 | ||
21 | + * 1、判断非空字段 | ||
22 | + * 2、实体转换 | ||
23 | + * 3、发送数据 | ||
24 | + * | ||
25 | + * @param id | ||
26 | + * @return | ||
27 | + */ | ||
28 | + @Override | ||
29 | + public AjaxResult TaskInfo(Integer id) { | ||
30 | + | ||
31 | + //1、判断非空字段 | ||
32 | + if(id == null){ | ||
33 | + return AjaxResult.error("任务号为空"); | ||
34 | + } | ||
35 | + | ||
36 | + | ||
37 | + //2、实体转换 | ||
38 | + WcsTask wcsTask =new WcsTask(); | ||
39 | + wcsTask.setTaskNo(id.toString()); | ||
40 | + | ||
41 | + //3、发送数据 | ||
42 | + String param="wcs"; | ||
43 | + String url=addressService.selectAddress(param)+"TaskInfo"; | ||
44 | + String JsonParam = JSON.toJSONString(wcsTask); | ||
45 | + String result = HttpUtils.bodypost(url, JsonParam); | ||
46 | + if(StringUtils.isEmpty(result)){ | ||
47 | + throw new ServiceException("接口地址错误"); | ||
48 | + } | ||
49 | + AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class); | ||
50 | + return ajaxResult; | ||
51 | + } | ||
52 | +} |
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationService.java
0 → 100644
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java
0 → 100644
1 | +package com.huaheng.api.wcs.service.warecellAllocation; | ||
2 | + | ||
3 | +import com.huaheng.api.wcs.domain.WcsTask; | ||
4 | +import com.huaheng.common.utils.StringUtils; | ||
5 | +import com.huaheng.framework.web.domain.AjaxResult; | ||
6 | +import org.springframework.stereotype.Service; | ||
7 | + | ||
8 | +@Service | ||
9 | +public class WarecellAllocationServiceImpl implements WarecellAllocationService { | ||
10 | + | ||
11 | + /** | ||
12 | + * 仓位分配 | ||
13 | + * 1、判断非空字段 | ||
14 | + * 2、实体转换 | ||
15 | + * | ||
16 | + * @param wcsTask | ||
17 | + * @return | ||
18 | + */ | ||
19 | + @Override | ||
20 | + public AjaxResult WarecellAllocation(WcsTask wcsTask) { | ||
21 | + | ||
22 | + //1、判断非空字段 | ||
23 | + if(StringUtils.isEmpty(wcsTask.getTaskNo())){ | ||
24 | + return AjaxResult.error("任务号为空"); | ||
25 | + } | ||
26 | + if(StringUtils.isEmpty(wcsTask.getPalletNo())){ | ||
27 | + return AjaxResult.error("托盘编号为空"); | ||
28 | + } | ||
29 | + if(StringUtils.isEmpty(wcsTask.getStation())){ | ||
30 | + return AjaxResult.error("站台编码为空"); | ||
31 | + } | ||
32 | + if(StringUtils.isNull(wcsTask.getLength())){ | ||
33 | + return AjaxResult.error("长为空"); | ||
34 | + } | ||
35 | + if(StringUtils.isNull(wcsTask.getWidth())){ | ||
36 | + return AjaxResult.error("宽为空"); | ||
37 | + } | ||
38 | + if(StringUtils.isNull(wcsTask.getHeight())){ | ||
39 | + return AjaxResult.error("高为空"); | ||
40 | + } | ||
41 | + if(StringUtils.isNull(wcsTask.getWeight())){ | ||
42 | + return AjaxResult.error("重为空"); | ||
43 | + } | ||
44 | + | ||
45 | + | ||
46 | + return null; | ||
47 | + } | ||
48 | +} |
src/main/java/com/huaheng/pc/config/address/controller/AddressController.java
0 → 100644
1 | +package com.huaheng.pc.config.address.controller; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
4 | +import com.baomidou.mybatisplus.core.metadata.IPage; | ||
5 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
6 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
7 | +import com.huaheng.common.support.Convert; | ||
8 | +import com.huaheng.common.utils.StringUtils; | ||
9 | +import com.huaheng.common.utils.security.ShiroUtils; | ||
10 | +import com.huaheng.framework.aspectj.lang.annotation.Log; | ||
11 | +import com.huaheng.framework.aspectj.lang.constant.BusinessType; | ||
12 | +import com.huaheng.framework.web.controller.BaseController; | ||
13 | +import com.huaheng.framework.web.domain.AjaxResult; | ||
14 | +import com.huaheng.framework.web.page.PageDomain; | ||
15 | +import com.huaheng.framework.web.page.TableDataInfo; | ||
16 | +import com.huaheng.framework.web.page.TableSupport; | ||
17 | +import com.huaheng.pc.config.address.domain.Address; | ||
18 | +import com.huaheng.pc.config.address.service.AddressService; | ||
19 | +import com.huaheng.pc.config.carrier.domain.Carrier; | ||
20 | +import com.huaheng.pc.config.carrier.service.CarrierService; | ||
21 | +import io.swagger.annotations.ApiOperation; | ||
22 | +import io.swagger.annotations.ApiParam; | ||
23 | +import org.apache.shiro.authz.annotation.RequiresPermissions; | ||
24 | +import org.springframework.stereotype.Controller; | ||
25 | +import org.springframework.ui.ModelMap; | ||
26 | +import org.springframework.web.bind.annotation.*; | ||
27 | + | ||
28 | +import javax.annotation.Resource; | ||
29 | +import java.util.ArrayList; | ||
30 | +import java.util.List; | ||
31 | + | ||
32 | +/** | ||
33 | + * 接口地址 | ||
34 | + */ | ||
35 | +@Controller | ||
36 | +@RequestMapping("/config/address") | ||
37 | +public class AddressController extends BaseController { | ||
38 | + | ||
39 | + private String prefix = "config/address"; | ||
40 | + | ||
41 | + @Resource | ||
42 | + private AddressService addressService; | ||
43 | + | ||
44 | + @RequiresPermissions("config:address:view") | ||
45 | + @GetMapping() | ||
46 | + public String address() { | ||
47 | + return prefix + "/address"; | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * 查询接口地址 | ||
52 | + */ | ||
53 | + @RequiresPermissions("config:address:list") | ||
54 | + @Log(title = "配置-接口地址", operating = "查看接口地址", action = BusinessType.GRANT) | ||
55 | + @PostMapping("/list") | ||
56 | + @ResponseBody | ||
57 | + public TableDataInfo list(Address address) { | ||
58 | + LambdaQueryWrapper<Address> lambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
59 | + PageDomain pageDomain = TableSupport.buildPageRequest(); | ||
60 | + Integer pageNum = pageDomain.getPageNum(); | ||
61 | + Integer pageSize = pageDomain.getPageSize(); | ||
62 | + lambdaQueryWrapper | ||
63 | + .eq(StringUtils.isNotEmpty(address.getParam()), Address::getParam, address.getParam()) | ||
64 | + .eq(Address::getWarehouseCode, ShiroUtils.getWarehouseCode()); | ||
65 | + | ||
66 | + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){ | ||
67 | + /*使用分页查询*/ | ||
68 | + Page<Address> page = new Page<>(pageNum, pageSize); | ||
69 | + IPage<Address> iPage = addressService.page(page, lambdaQueryWrapper); | ||
70 | + return getMpDataTable(iPage.getRecords(), iPage.getTotal()); | ||
71 | + } else { | ||
72 | + List<Address> list = addressService.list(lambdaQueryWrapper); | ||
73 | + return getDataTable(list); | ||
74 | + } | ||
75 | + } | ||
76 | + | ||
77 | + /** | ||
78 | + * 新增接口地址 | ||
79 | + */ | ||
80 | + @GetMapping("/add") | ||
81 | + public String add() { | ||
82 | + return prefix + "/add"; | ||
83 | + } | ||
84 | + | ||
85 | + /** | ||
86 | + * 新增保存接口地址 | ||
87 | + */ | ||
88 | + @RequiresPermissions("config:address:add") | ||
89 | + @Log(title = "通用-接口地址", operating = "新增接口地址", action = BusinessType.INSERT) | ||
90 | + @PostMapping("/add") | ||
91 | + @ResponseBody | ||
92 | + public AjaxResult addSave(Address address) { | ||
93 | + address.setWarehouseCode(ShiroUtils.getWarehouseCode()); | ||
94 | + return toAjax(addressService.save(address)); | ||
95 | + } | ||
96 | + | ||
97 | + /** | ||
98 | + * 修改接口地址 | ||
99 | + */ | ||
100 | + @GetMapping("/edit/{id}") | ||
101 | + public String edit(@PathVariable("id") Integer id, ModelMap mmap) { | ||
102 | + mmap.put("address", addressService.getById(id)); | ||
103 | + return prefix + "/edit"; | ||
104 | + } | ||
105 | + | ||
106 | + /** | ||
107 | + * 修改保存接口地址 | ||
108 | + */ | ||
109 | + @RequiresPermissions("config:address:edit") | ||
110 | + @Log(title = "配置-接口地址", operating = "修改接口地址", action = BusinessType.UPDATE) | ||
111 | + @PostMapping("/edit") | ||
112 | + @ResponseBody | ||
113 | + public AjaxResult editSave(Address address) { | ||
114 | + return toAjax(addressService.updateById(address)); | ||
115 | + } | ||
116 | + | ||
117 | + /** | ||
118 | + * 删除接口地址 | ||
119 | + */ | ||
120 | + @RequiresPermissions("config:address:remove") | ||
121 | + @Log(title = "配置-接口地址", operating = "删除接口地址", action = BusinessType.DELETE) | ||
122 | + @PostMapping( "/remove") | ||
123 | + @ResponseBody | ||
124 | + public AjaxResult remove(String ids) { | ||
125 | + if (StringUtils.isEmpty(ids)){ | ||
126 | + return AjaxResult.error("id不能为空"); | ||
127 | + } | ||
128 | + List<Integer> list = new ArrayList<>(); | ||
129 | + for (Integer id : Convert.toIntArray(ids)) { | ||
130 | + list.add(id); | ||
131 | + } | ||
132 | + return toAjax(addressService.removeByIds(list)); | ||
133 | + } | ||
134 | +} |
src/main/java/com/huaheng/pc/config/address/domain/Address.java
0 → 100644
1 | +package com.huaheng.pc.config.address.domain; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.annotation.IdType; | ||
4 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
5 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
6 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
7 | +import io.swagger.annotations.ApiModel; | ||
8 | +import io.swagger.annotations.ApiModelProperty; | ||
9 | +import lombok.Data; | ||
10 | + | ||
11 | +import java.io.Serializable; | ||
12 | + | ||
13 | +/** | ||
14 | + * 接口地址 | ||
15 | + */ | ||
16 | +@ApiModel(value="com.huaheng.pc.config.address.domain.Address") | ||
17 | +@Data | ||
18 | +@TableName(value = "address") | ||
19 | +public class Address implements Serializable { | ||
20 | + /** | ||
21 | + * 内部号 | ||
22 | + */ | ||
23 | + @TableId(value = "id", type = IdType.AUTO) | ||
24 | + @ApiModelProperty(value="内部号") | ||
25 | + private Integer id; | ||
26 | + | ||
27 | + | ||
28 | + /** | ||
29 | + * 仓库代码 | ||
30 | + */ | ||
31 | + @TableField(value = "warehouseCode") | ||
32 | + @ApiModelProperty(value="仓库代码") | ||
33 | + private String warehouseCode; | ||
34 | + | ||
35 | + /** | ||
36 | + * 参数 | ||
37 | + */ | ||
38 | + @TableField(value = "param") | ||
39 | + @ApiModelProperty(value="参数") | ||
40 | + private String param; | ||
41 | + | ||
42 | + /** | ||
43 | + * 接口地址 | ||
44 | + */ | ||
45 | + @TableField(value = "url") | ||
46 | + @ApiModelProperty(value="接口地址") | ||
47 | + private String url; | ||
48 | + | ||
49 | + public Integer getId() { | ||
50 | + return id; | ||
51 | + } | ||
52 | + | ||
53 | + public void setId(Integer id) { | ||
54 | + this.id = id; | ||
55 | + } | ||
56 | + | ||
57 | + public String getWarehouseCode() { | ||
58 | + return warehouseCode; | ||
59 | + } | ||
60 | + | ||
61 | + public void setWarehouseCode(String warehouseCode) { | ||
62 | + this.warehouseCode = warehouseCode; | ||
63 | + } | ||
64 | + | ||
65 | + public String getParam() { | ||
66 | + return param; | ||
67 | + } | ||
68 | + | ||
69 | + public void setParam(String param) { | ||
70 | + this.param = param; | ||
71 | + } | ||
72 | + | ||
73 | + public String getUrl() { | ||
74 | + return url; | ||
75 | + } | ||
76 | + | ||
77 | + public void setUrl(String url) { | ||
78 | + this.url = url; | ||
79 | + } | ||
80 | +} | ||
0 | \ No newline at end of file | 81 | \ No newline at end of file |
src/main/java/com/huaheng/pc/config/address/mapper/AddressMapper.java
0 → 100644
1 | +package com.huaheng.pc.config.address.mapper; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
4 | +import com.huaheng.pc.config.address.domain.Address; | ||
5 | + | ||
6 | +public interface AddressMapper extends BaseMapper<Address> { | ||
7 | +} | ||
0 | \ No newline at end of file | 8 | \ No newline at end of file |
src/main/java/com/huaheng/pc/config/address/service/AddressService.java
0 → 100644
src/main/java/com/huaheng/pc/config/address/service/AddressServiceImpl.java
0 → 100644
1 | +package com.huaheng.pc.config.address.service; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
4 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
5 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
6 | +import com.huaheng.common.exception.service.ServiceException; | ||
7 | +import com.huaheng.common.utils.StringUtils; | ||
8 | +import com.huaheng.common.utils.security.ShiroUtils; | ||
9 | +import com.huaheng.pc.config.address.domain.Address; | ||
10 | +import com.huaheng.pc.config.address.mapper.AddressMapper; | ||
11 | +import org.springframework.stereotype.Service; | ||
12 | + | ||
13 | +@Service | ||
14 | +public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements AddressService { | ||
15 | + | ||
16 | + @Override | ||
17 | + public String selectAddress(String param) { | ||
18 | + if(StringUtils.isEmpty(param)){ | ||
19 | + throw new ServiceException("参数为空"); | ||
20 | + } | ||
21 | + | ||
22 | + LambdaQueryWrapper<Address> addressLam = Wrappers.lambdaQuery(); | ||
23 | + addressLam.eq(Address::getParam,param) | ||
24 | + .eq(Address::getWarehouseCode, ShiroUtils.getWarehouseCode()); | ||
25 | + Address address=this.getOne(addressLam); | ||
26 | + if(address == null){ | ||
27 | + throw new ServiceException("参数错误,系统没有此参数对应的地址"); | ||
28 | + } | ||
29 | + if(StringUtils.isEmpty(address.getUrl())){ | ||
30 | + throw new ServiceException("地址为空"); | ||
31 | + } | ||
32 | + return address.getUrl(); | ||
33 | + } | ||
34 | +} |
src/main/java/com/huaheng/pc/shipment/shipmentDetail/mapper/ShipmentDetailMapper.java
@@ -16,5 +16,7 @@ public interface ShipmentDetailMapper extends BaseMapper<ShipmentDetail> { | @@ -16,5 +16,7 @@ public interface ShipmentDetailMapper extends BaseMapper<ShipmentDetail> { | ||
16 | 16 | ||
17 | Integer countUnCompleted(Integer shipmentId); | 17 | Integer countUnCompleted(Integer shipmentId); |
18 | 18 | ||
19 | + Map<String,Integer> selectStatus(Integer id); | ||
20 | + | ||
19 | 21 | ||
20 | } | 22 | } |
21 | \ No newline at end of file | 23 | \ No newline at end of file |
src/main/java/com/huaheng/pc/shipment/shipmentDetail/service/ShipmentDetailService.java
@@ -3,6 +3,10 @@ package com.huaheng.pc.shipment.shipmentDetail.service; | @@ -3,6 +3,10 @@ package com.huaheng.pc.shipment.shipmentDetail.service; | ||
3 | import com.huaheng.framework.web.domain.AjaxResult; | 3 | import com.huaheng.framework.web.domain.AjaxResult; |
4 | import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; | 4 | import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; |
5 | import com.baomidou.mybatisplus.extension.service.IService; | 5 | import com.baomidou.mybatisplus.extension.service.IService; |
6 | + | ||
7 | +import java.util.List; | ||
8 | +import java.util.Map; | ||
9 | + | ||
6 | public interface ShipmentDetailService extends IService<ShipmentDetail>{ | 10 | public interface ShipmentDetailService extends IService<ShipmentDetail>{ |
7 | 11 | ||
8 | /** | 12 | /** |
@@ -20,5 +24,7 @@ public interface ShipmentDetailService extends IService<ShipmentDetail>{ | @@ -20,5 +24,7 @@ public interface ShipmentDetailService extends IService<ShipmentDetail>{ | ||
20 | //选中的单据加入波次 | 24 | //选中的单据加入波次 |
21 | void saveWave(String ids,String code); | 25 | void saveWave(String ids,String code); |
22 | 26 | ||
27 | + Map<String,Integer> selectStatus(Integer id); | ||
28 | + | ||
23 | 29 | ||
24 | } | 30 | } |
src/main/java/com/huaheng/pc/shipment/shipmentDetail/service/ShipmentDetailServiceImpl.java
@@ -236,6 +236,7 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | @@ -236,6 +236,7 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | ||
236 | 236 | ||
237 | }else { | 237 | }else { |
238 | //创建波次 | 238 | //创建波次 |
239 | + wave=new Wave(); | ||
239 | wave.setWarehouseCode(ShiroUtils.getWarehouseCode()); | 240 | wave.setWarehouseCode(ShiroUtils.getWarehouseCode()); |
240 | wave.setMasterCode(code); | 241 | wave.setMasterCode(code); |
241 | wave.setWaveName(waveMaster.getName()); | 242 | wave.setWaveName(waveMaster.getName()); |
@@ -273,4 +274,11 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | @@ -273,4 +274,11 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | ||
273 | } | 274 | } |
274 | 275 | ||
275 | } | 276 | } |
277 | + | ||
278 | + | ||
279 | + //查看最高状态和最低状态 | ||
280 | + @Override | ||
281 | + public Map<String,Integer> selectStatus(Integer id) { | ||
282 | + return shipmentDetailMapper.selectStatus(id); | ||
283 | + } | ||
276 | } | 284 | } |
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
4 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | 4 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
5 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 5 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
6 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 6 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
7 | +import com.huaheng.api.wcs.service.taskAssignService.TaskAssignService; | ||
7 | import com.huaheng.common.exception.service.ServiceException; | 8 | import com.huaheng.common.exception.service.ServiceException; |
8 | import com.huaheng.common.utils.DataUtils; | 9 | import com.huaheng.common.utils.DataUtils; |
9 | import com.huaheng.common.utils.StringUtils; | 10 | import com.huaheng.common.utils.StringUtils; |
@@ -44,6 +45,7 @@ import com.huaheng.pc.task.taskDetail.service.TaskDetailService; | @@ -44,6 +45,7 @@ import com.huaheng.pc.task.taskDetail.service.TaskDetailService; | ||
44 | import com.huaheng.pc.task.taskHeader.domain.ShipmentTaskCreateModel; | 45 | import com.huaheng.pc.task.taskHeader.domain.ShipmentTaskCreateModel; |
45 | import org.apache.poi.ss.formula.functions.T; | 46 | import org.apache.poi.ss.formula.functions.T; |
46 | import org.jsoup.helper.DataUtil; | 47 | import org.jsoup.helper.DataUtil; |
48 | +import org.springframework.beans.factory.annotation.Autowired; | ||
47 | import org.springframework.stereotype.Service; | 49 | import org.springframework.stereotype.Service; |
48 | import java.math.BigDecimal; | 50 | import java.math.BigDecimal; |
49 | import java.text.SimpleDateFormat; | 51 | import java.text.SimpleDateFormat; |
@@ -100,6 +102,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -100,6 +102,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
100 | private ReceiptContainerHeaderService receiptContainerHeaderService; | 102 | private ReceiptContainerHeaderService receiptContainerHeaderService; |
101 | @Resource | 103 | @Resource |
102 | private TaskHeaderMapper taskHeaderMapper; | 104 | private TaskHeaderMapper taskHeaderMapper; |
105 | + @Autowired | ||
106 | + private TaskAssignService taskAssignService; | ||
103 | 107 | ||
104 | 108 | ||
105 | 109 | ||
@@ -403,7 +407,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -403,7 +407,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
403 | // } | 407 | // } |
404 | // } | 408 | // } |
405 | 409 | ||
406 | - | 410 | + //给wcs传递任务 |
411 | +// taskAssignService.wcsTaskAssign(task); | ||
407 | } | 412 | } |
408 | return AjaxResult.success("执行下发任务成功", task); | 413 | return AjaxResult.success("执行下发任务成功", task); |
409 | } | 414 | } |
@@ -1337,25 +1342,47 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1337,25 +1342,47 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1337 | shipmentContainerHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); | 1342 | shipmentContainerHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); |
1338 | LambdaUpdateWrapper<ShipmentContainerHeader> shipmentContainerHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); | 1343 | LambdaUpdateWrapper<ShipmentContainerHeader> shipmentContainerHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); |
1339 | shipmentContainerHeaderLambdaUpdateWrapper.eq(ShipmentContainerHeader::getId,task.getAllocationHeadId()); | 1344 | shipmentContainerHeaderLambdaUpdateWrapper.eq(ShipmentContainerHeader::getId,task.getAllocationHeadId()); |
1340 | - if (! shipmentContainerHeaderService.update(shipmentContainerHeader, shipmentContainerHeaderLambdaUpdateWrapper)) | 1345 | + if (! shipmentContainerHeaderService.update(shipmentContainerHeader, shipmentContainerHeaderLambdaUpdateWrapper)) { |
1341 | throw new ServiceException("更新组盘头状态失败"); | 1346 | throw new ServiceException("更新组盘头状态失败"); |
1342 | - //修改出库单状态 | ||
1343 | - LambdaQueryWrapper<TaskDetail> taskDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
1344 | - taskDetailLambdaQueryWrapper.eq(TaskDetail::getTaskId,task.getId()); | ||
1345 | - List<TaskDetail> taskDetailList = taskDetailService.list(taskDetailLambdaQueryWrapper); | ||
1346 | - | ||
1347 | - for (TaskDetail taskDeatails: taskDetailList) { | ||
1348 | - LambdaQueryWrapper<ShipmentDetail> shipmentDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
1349 | - shipmentDetailLambdaQueryWrapper.eq(ShipmentDetail::getId,taskDeatails.getBillDetailId()); | ||
1350 | - | ||
1351 | - ShipmentHeader shipmentHeader =new ShipmentHeader(); | ||
1352 | - shipmentHeader.setId(shipmentDetailService.getOne(shipmentDetailLambdaQueryWrapper).getShipmentId()); | ||
1353 | - shipmentHeader.setFirstStatus(300); | ||
1354 | - shipmentHeader.setLastStatus(300); | ||
1355 | - shipmentHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); | ||
1356 | - shipmentHeader.setLastUpdated(new Date()); | ||
1357 | - shipmentHeaderService.updateById(shipmentHeader); | ||
1358 | - } | 1347 | + } |
1348 | + //修改出库单状态 | ||
1349 | + LambdaQueryWrapper<TaskDetail> taskDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
1350 | + taskDetailLambdaQueryWrapper.eq(TaskDetail::getTaskId,task.getId()); | ||
1351 | + List<TaskDetail> taskDetailList = taskDetailService.list(taskDetailLambdaQueryWrapper); | ||
1352 | + | ||
1353 | + HashSet<Integer> ids = new HashSet<>(); | ||
1354 | + for (TaskDetail taskDeatails: taskDetailList) { | ||
1355 | + LambdaQueryWrapper<ShipmentDetail> shipmentDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
1356 | + shipmentDetailLambdaQueryWrapper.eq(ShipmentDetail::getId, taskDeatails.getBillDetailId()); | ||
1357 | + ShipmentDetail shipmentDetail = shipmentDetailService.getOne(shipmentDetailLambdaQueryWrapper); | ||
1358 | + if (shipmentDetail == null) { | ||
1359 | + throw new ServiceException("查找出库单明细失败"); | ||
1360 | + } | ||
1361 | + if (shipmentDetail.getShipQty().compareTo(shipmentDetail.getRequestQty()) == 0) { | ||
1362 | + shipmentDetail.setStatus(500); | ||
1363 | + shipmentDetailService.updateById(shipmentDetail); | ||
1364 | + } | ||
1365 | + ids.add(shipmentDetail.getShipmentId()); | ||
1366 | + } | ||
1367 | + | ||
1368 | + for(Integer id : ids) { | ||
1369 | + ShipmentHeader shipmentHeader = shipmentHeaderService.getById(id); | ||
1370 | + if(shipmentHeader != null) { | ||
1371 | + Map<String,Integer> status = shipmentDetailService.selectStatus(shipmentHeader.getId()); | ||
1372 | + Integer maxStatus = status.get("maxStatus"); | ||
1373 | + Integer minStatus = status.get("minStatus"); | ||
1374 | + if(maxStatus == 500){ | ||
1375 | + shipmentHeader.setFirstStatus(500); | ||
1376 | + } | ||
1377 | + if(minStatus == 500) { | ||
1378 | + shipmentHeader.setLastStatus(500); | ||
1379 | + } | ||
1380 | + shipmentHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); | ||
1381 | + shipmentHeader.setLastUpdated(new Date()); | ||
1382 | + shipmentHeaderService.updateById(shipmentHeader); | ||
1383 | + } | ||
1384 | + } | ||
1385 | + | ||
1359 | 1386 | ||
1360 | } | 1387 | } |
1361 | 1388 |
src/main/resources/mybatis/config/AddressMapper.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | +<mapper namespace="com.huaheng.pc.config.address.mapper.AddressMapper"> | ||
4 | + <resultMap id="BaseResultMap" type="com.huaheng.pc.config.address.domain.Address"> | ||
5 | + <!--@mbg.generated--> | ||
6 | + <id column="id" jdbcType="INTEGER" property="id" /> | ||
7 | + <result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode" /> | ||
8 | + <result column="param" jdbcType="VARCHAR" property="param" /> | ||
9 | + <result column="url" jdbcType="VARCHAR" property="url" /> | ||
10 | + </resultMap> | ||
11 | + <sql id="Base_Column_List"> | ||
12 | + <!--@mbg.generated--> | ||
13 | + id, warehouseCode, param,url | ||
14 | + </sql> | ||
15 | +</mapper> | ||
0 | \ No newline at end of file | 16 | \ No newline at end of file |
src/main/resources/mybatis/shipment/ShipmentDetailMapper.xml
@@ -80,4 +80,9 @@ | @@ -80,4 +80,9 @@ | ||
80 | SELECT COUNT(*) FROM shipment_detail WHERE shipmentId=#{shipmentId} AND shipQty>requestQty | 80 | SELECT COUNT(*) FROM shipment_detail WHERE shipmentId=#{shipmentId} AND shipQty>requestQty |
81 | </select> | 81 | </select> |
82 | 82 | ||
83 | + <select id="selectStatus" resultType="java.util.Map"> | ||
84 | + SELECT max(status) maxStatus,min(status) minStatus | ||
85 | + FROM shipment_detail | ||
86 | + WHERE shipmentId=#{id} | ||
87 | + </select> | ||
83 | </mapper> | 88 | </mapper> |
84 | \ No newline at end of file | 89 | \ No newline at end of file |