WcsScanBarcodeController.java
2.13 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
package com.huaheng.mobile.wcsScanBarcode;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.framework.aspectj.lang.annotation.Log;
import com.huaheng.framework.aspectj.lang.constant.BusinessType;
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.wcsscanbarcode.domain.Wcsscanbarcode;
import com.huaheng.pc.config.wcsscanbarcode.service.WcsscanbarcodeService;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.Date;
/**
*
* @author Enzo Cotter
* @date 2019/12/30
*/
@Controller
@RequestMapping("/mobile/wcs/scanBarcode")
public class WcsScanBarcodeController extends BaseController {
@Resource
private WcsscanbarcodeService wcsscanbarcodeService;
@Resource
private ContainerService containerService;
@Log(title = "wcs任务完成", action = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult add(@RequestBody Wcsscanbarcode wcsscanbarcode){
if (StringUtils.isNull(wcsscanbarcode)) {
return AjaxResult.error("barcode为空");
} else if (StringUtils.isNull(wcsscanbarcode.getArea())){
return AjaxResult.error("区域为空");
} else if (StringUtils.isEmpty(wcsscanbarcode.getBarcode())) {
return AjaxResult.error("条码为空");
}
if (containerService.findAllByCode(wcsscanbarcode.getBarcode()) == null) {
return AjaxResult.error("该容器不存在");
}
wcsscanbarcode.setCreated(new Date());
wcsscanbarcodeService.save(wcsscanbarcode);
return AjaxResult.success("成功");
}
}