package com.hys.app.controller.erp.use;

import com.hys.app.framework.database.WebPage;
import com.hys.app.model.erp.dto.EnterpriseDTO;
import com.hys.app.model.erp.dto.EnterpriseQueryParams;
import com.hys.app.model.erp.vo.EnterpriseVO;
import com.hys.app.model.erp.vo.GoodsSnVO;
import com.hys.app.model.erp.vo.ProductStockVO;
import com.hys.app.model.erp.vo.ProductVO;
import com.hys.app.service.erp.EnterpriseManager;
import com.hys.app.service.erp.ScanCodeManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;
import java.util.Map;

/**
 * 企业 API
 *
 * @author 张崧
 * 2024-03-25 15:44:10
 */
@RestController
@RequestMapping("/admin/erp/scancode")
@Api(tags = "扫条形码")
@Validated
public class ScanCodeController {

    @Autowired
    private ScanCodeManager scanCodeManager;

    @ApiOperation(value = "扫描订单")
    @GetMapping("/{orderCode}")
    public Map<String, Object> getListByScan(@PathVariable(value = "orderCode") String orderCode) {
        return scanCodeManager.getListByScan(orderCode);
    }

    @ApiOperation(value = "扫描sku")
    @GetMapping("getProduct/{warehouseId}/{productCode}")
    public ProductStockVO getProduct(@PathVariable(value = "productCode") String productCode, @PathVariable(value = "warehouseId") Long warehouseId) {
        return scanCodeManager.getProduct( productCode, warehouseId);
    }

    @ApiOperation(value = "扫描序列号")
    @GetMapping("getsnCode/{type}/{sku}/{snCode}")
    public GoodsSnVO getSnCode(@PathVariable(value = "sku") String sku, @PathVariable(value = "snCode") String snCode, @PathVariable(value = "type") String type) {
        return scanCodeManager.getSnCode( sku, snCode, type);
    }
}

