PalletInfoController.java
3.64 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
84
85
86
87
88
89
90
91
92
93
94
95
96
package com.huaheng.api.wcs.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.huaheng.common.exception.service.ServiceException;
import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;
import com.huaheng.framework.web.controller.BaseController;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.config.container.domain.Container;
import com.huaheng.pc.config.container.service.ContainerService;
import com.huaheng.pc.config.station.domain.ShipmentPoint;
import com.huaheng.pc.config.station.service.ShipmentPointService;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/***
* @author tongzonghao
*
*/
@RestController
@RequestMapping("/API/WMS/v2")
public class PalletInfoController extends BaseController {
@Resource
private ContainerService containerService;
@Resource
private ShipmentPointService shipmentPointService;
@PostMapping("/palletHeight")
@ApiOperation("商片出库设置木托盘高度")
@ApiLogger(apiName = "商片出库设置木托盘高度", from = "ROBOT")
@Transactional(rollbackFor = Exception.class)
@ResponseBody
public AjaxResult arrivedNotice(@RequestBody Map<String, String> map) {
String height = map.get("height");
if(StringUtils.isEmpty(height)){
return AjaxResult.error("高度不能为空");
}
List<ShipmentPoint> shipmentPoints = shipmentPointService.list();
Integer palletHeight = Integer.valueOf(height);
Integer woodenPalletHeight = 0;
switch (palletHeight){
case 0:
throw new ServiceException("托盘高度不能为0");
case 1:
woodenPalletHeight = 125;
break;
case 2:
woodenPalletHeight = 135;
break;
case 3:
woodenPalletHeight = 145;
break;
case 4:
woodenPalletHeight = 170;
break;
case 5:
// 托盘上有货
if(shipmentPoints.isEmpty()){
// 1. 当托盘不存在物料 高度超过4 异常提示有料
return AjaxResult.success("木托盘上显示没货但高度为!"+palletHeight);
}else{
return AjaxResult.success("更新到达站台成功!");
}
default:
}
LambdaQueryWrapper<Container> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(Container::getCode, "SHIPMENT_CONTAINER0001");
Container container = containerService.getOne(queryWrapper);
if(container == null){
return AjaxResult.error("出库托盘容器被删除,请从新配置!");
}
boolean aNull = container.getWoodenPalletHeight() != null ? container.getWoodenPalletHeight() > 0 : false;
if(aNull){
return AjaxResult.success("出库托盘容器高度已经设置!");
}
Container updateContainer = new Container();
updateContainer.setId(container.getId());
updateContainer.setWoodenPalletHeight(woodenPalletHeight);
if(!containerService.updateById(updateContainer)){
throw new ServiceException("出库托盘木托高度更新失败!");
}
return AjaxResult.success("更新到达站台成功!");
}
}