package com.sw.mes.yb.seed.api.controller;

import com.sw.mes.core.dto.WMSToSeedDto;
import com.sw.mes.core.response.Result;
import com.sw.mes.core.response.ResultGenerator;
import com.sw.mes.yb.seed.api.service.consumer.SeedConsumerService;
import com.sw.mes.yb.seed.api.service.supplier.SeedSupplierService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/seed/foreign")
@Api(description = "籽晶外部对接接口")
@Transactional
public class SeedForeignController {
    @Autowired
    private SeedSupplierService seedSupplierService;
    @Autowired
    private SeedConsumerService seedConsumerService;
    @ApiOperation(value = "籽晶发起入库-wms")
    @GetMapping("/wmsInitiate")
    public Result wmsInitiate(@RequestParam @ApiParam(value = "组托id") Long id){
        return seedConsumerService.wmsInitiate(id);
    }

    @ApiOperation(value = "接收wms审核结果")
    @GetMapping("/wmsReceive")
    public Result wmsReceive(@RequestBody @ApiParam(value = "WMS审核对象") WMSToSeedDto wmsToSeedDtos){
        return seedSupplierService.wmsReceive(wmsToSeedDtos);
    }

    @ApiOperation(value = "籽晶发起入库-线边仓")
    @GetMapping("/storeInitiate")
    public Result storeInitiate(@RequestParam @ApiParam(value = "组托id") Long id){
        return seedConsumerService.storeInitiate(id);
    }
}
