package com.wms_main.controller.wms;

import com.wms_main.model.dto.query.OrderInQuery;
import com.wms_main.model.dto.request.wms.OrderInRequest;
import com.wms_main.model.dto.request.wms.OrderOutRequest;
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
import com.wms_main.model.po.TAppOrderIn;
import com.wms_main.service.controller.IOrderControllerService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@ResponseBody
@CrossOrigin
@RequiredArgsConstructor
@RequestMapping("/wms/order")
public class OrderController {

    final IOrderControllerService orderControllerService;

    @PostMapping("/orderIn")
    public BaseWmsApiResponse orderIn(@RequestBody OrderInRequest request) {
        return orderControllerService.addOrderIn(request);
    }

    @PostMapping("/orderOut")
    public BaseWmsApiResponse orderOut(@RequestBody OrderOutRequest request) {
        return orderControllerService.addOrderOut(request);
    }

    @PostMapping("/getOrderIns")
    public List<TAppOrderIn> getOrderIns(@RequestBody OrderInQuery query) {
        return orderControllerService.getOrderIns(query);
    }

    @PostMapping("/updateOrderIn")
    public BaseWmsApiResponse updateOrderIn(@RequestParam String recordId, @RequestParam String orderStatus) {
        return orderControllerService.updateOrderIn(recordId, orderStatus);
    }
}
