pjb
2025-03-08 83b51a5a0774ea8ecb9a06304af3b956a21307c8
zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/controller/OutStockController.java
@@ -2,24 +2,33 @@
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.param.BindPlatformParam;
import com.zy.asrs.wms.asrs.service.PlatformService;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
import java.util.Objects;
@Slf4j
@RestController
@RequestMapping("/out/stock/")
public class OutStockController {
public class OutStockController extends BaseController {
    @Autowired
    private WcsApiService wcsApiService;
    @Autowired
    private PlatformService platformService;
    /**
     * 出库任务-接收回调状态接口
@@ -35,7 +44,7 @@
            if (StringUtil.isNullOrEmpty(callbackParam.getTaskCode())) {
                return R.error("任务编码不能为空!!");
            }
            wcsApiService.receiveTaskStatus(callbackParam, "outStock");
            wcsApiService.receiveTaskStatus(callbackParam, "outStock", getHostId());
        } else {
            return R.error("上报事件类型不能为空!!");
        }
@@ -58,9 +67,90 @@
            return R.error("输送线节点编码不能为空!!");
        }
        return wcsApiService.containerArrivedNotify(arrivedParam, "outStock");
        return wcsApiService.containerArrivedNotify(arrivedParam, "outStock", getHostId());
    }
    /**
     * 容器流动通知(当前物料播种完成)
     * //fixme 此接口将不再单独调用
     * 1. 更新当前任务物料信息
     * 2.
     * @param code 容器编码
     * @return
     */
    @GetMapping("/container/converyor/{code}")
    public R containerConveyor(@PathVariable String code) {
        if (StringUtil.isNullOrEmpty(code)) {
            return R.error("容器编码不能为空!!!");
        }
        return wcsApiService.containerConveryor(code);
    }
    /**
     * 发送命令给电子标签,可以控制电子标签亮灯颜色及灭灯等。
     *
     * 1. 判断当前容器是否还有物料未拣,未拣完闪灯,拣完通知容器流动,并灭灯
     * 2. 容器流动判断,如果料箱没有物料 code传200, 有物料传100 执行回库任务, IOTYP = 4
     *
     * @param request
     * @return
     */
    @PostMapping("/slap/light")
    public R slapLightLogic(@RequestBody Map<String, Object> request) {
        if (Objects.isNull(request)) {
            throw new CoolException("参数不能为空!!");
        }
        if (Objects.isNull(request.get("taskNo"))) {
            throw new CoolException("任务号不能为空!!");
        }
        if (Objects.isNull(request.get("orderNo"))){
            throw new CoolException("当前任务订单号不能为空!!");
        }
         wcsApiService.slapLightLogic(request);
        return R.ok();
    }
    /**
     * 信号回传接口,回传电子标签状态变化内容给上游系统。
     * 当人为操作(比如拍灯,更改数字,放箱等)导致电子标签的状态和信号等发生变化、或设备本身发生异常时,ESS接收到信号后,通过该接口将信号回传给上游系统。
     * RFID回调接口
     * @param request
     * @return
     */
    @PostMapping("/")
    public R rfidCallback(@RequestBody RfidSingalRequest request) {
        if (Objects.isNull(request)) {
            throw new CoolException("参数不能为空!!");
        }
        return wcsApiService.rfidCallback(request);
    }
    /**
     * 获取所有集货区
     * @return
     */
    @GetMapping("/all/platforms")
    public R getPlatforms() {
        return  wcsApiService.getPlatforms();
    }
//    /**
//     * 绑定订单与集货区关系
//     * @param platform
//     * @return
//     */
//    @PostMapping("/bind/shipping/platform")
//    public R bindShippingAndPlatform(@RequestBody BindPlatformParam platform) {
//        return platformService.bindShippingPlatform(platform);
//    }
//
}