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("条码为空"); } Container container = containerService.getContainerByCode(wcsscanbarcode.getBarcode()); if (container == null) { return AjaxResult.error("该容器不存在"); } wcsscanbarcode.setCreated(new Date()); wcsscanbarcodeService.save(wcsscanbarcode); return AjaxResult.success("成功"); } }