|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.wms.apis.wcs.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.R; | 
|---|
|  |  |  | import com.zy.asrs.framework.exception.CoolException; | 
|---|
|  |  |  | import com.zy.asrs.wms.apis.wcs.entity.request.ContainerArrivedParam; | 
|---|
|  |  |  | import com.zy.asrs.wms.apis.wcs.entity.request.RfidSingalRequest; | 
|---|
|  |  |  | import com.zy.asrs.wms.apis.wcs.entity.request.TasksStatusCallbackParam; | 
|---|
|  |  |  | import com.zy.asrs.wms.apis.wcs.services.WcsApiService; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.CacheSite; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.Task; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.param.BindPlatformParam; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.service.CacheSiteService; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.service.PlatformService; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.service.TaskService; | 
|---|
|  |  |  | import com.zy.asrs.wms.system.controller.BaseController; | 
|---|
|  |  |  | import io.netty.util.internal.StringUtil; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  | import java.util.HashMap; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  | import java.util.Objects; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private PlatformService platformService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private CacheSiteService cacheSiteService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private TaskService taskService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * ESS 播种墙拍灯回调 | 
|---|
|  |  |  | * 播种墙拍灯,ESS调用 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @PostMapping("/light/off") | 
|---|
|  |  |  | public R lightOff(@RequestBody Map<String, Object> request) { | 
|---|
|  |  |  | if (Objects.isNull(request)) { | 
|---|
|  |  |  | throw new CoolException("参数不能为空!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (Objects.isNull(request.get("tagCode"))) { | 
|---|
|  |  |  | throw new CoolException("电子标签编号不能为空!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (Objects.isNull(request.get("eventCode"))){ | 
|---|
|  |  |  | throw new CoolException("事件名称不能为空!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | log.info("播种墙拍灯,请求参数:{}", JSONObject.toJSONString(request)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 根据站点编码查播种站点信息 | 
|---|
|  |  |  | CacheSite cacheSite = cacheSiteService.getOne(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getSiteNo, request.get("tagCode"))); | 
|---|
|  |  |  | if (Objects.isNull(cacheSite)) { | 
|---|
|  |  |  | throw new CoolException("当前站点不存在!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 根据播种站点信息条码,查任务 | 
|---|
|  |  |  | Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, cacheSite.getBarcode())); | 
|---|
|  |  |  | if (Objects.isNull(task)) { | 
|---|
|  |  |  | throw new CoolException("当前站点任务不存在!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> param = new HashMap<>(); | 
|---|
|  |  |  | param.put("taskNo", task.getTaskNo()); | 
|---|
|  |  |  | param.put("siteNo", cacheSite.getSiteNo()); | 
|---|
|  |  |  | param.put("orderNo",cacheSite.getOrderNo()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return wcsApiService.slapLightLogic(param); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 容器流动通知(当前物料播种完成) | 
|---|
|  |  |  | * //fixme 此接口将不再单独调用 | 
|---|
|  |  |  | * 1. 更新当前任务物料信息 | 
|---|
|  |  |  | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping("/container/converyor/{code}") | 
|---|
|  |  |  | public R containerConveyor(@PathVariable String code) { | 
|---|
|  |  |  | public R containerConveyor(@PathVariable String code) throws Exception { | 
|---|
|  |  |  | if (StringUtil.isNullOrEmpty(code)) { | 
|---|
|  |  |  | return R.error("容器编码不能为空!!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | throw new CoolException("当前任务订单号不能为空!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | wcsApiService.slapLightLogic(request); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | return wcsApiService.slapLightLogic(request); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|