package com.shkj.wms.controller.third;

import com.shkj.common.annotation.Log;
import com.shkj.common.annotation.RepeatSubmit;
import com.shkj.common.core.controller.BaseController;
import com.shkj.common.enums.BusinessType;
import com.shkj.wms.bo.BaseBarcodesInThirdRepairBo;
import com.shkj.wms.bo.BaseBarcodesInThirdSyncBo;
import com.shkj.wms.bo.BaseBarcodesOutThirdPointBo;
import com.shkj.wms.bo.BaseBarcodesOutThirdSyncBo;
import com.shkj.wms.service.IBaseBarcodesInService;
import com.shkj.wms.service.IBaseBarcodesOutService;
import com.shkj.wms.third.ykl.ThirdYklResult;
import lombok.RequiredArgsConstructor;
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 javax.validation.Valid;
import java.util.List;

/**
 *  依柯力同步条码接口
 */
@RequiredArgsConstructor(onConstructor_ =@Autowired)
@RestController
@RequestMapping("/wms/third/barcodes")
public class BarcodeThirdController extends BaseController {

    private final IBaseBarcodesInService iBaseBarcodesInService;

    private  final IBaseBarcodesOutService iBaseBarcodesOutService;


    @Log(title = "同步依柯力系统入库条码信息",businessType = BusinessType.UPDATE)
    @PostMapping("/syncPutinBarcodes")
    @RepeatSubmit
    public ThirdYklResult thirdSyncPutinBarcodeIn(@Valid @RequestBody List<BaseBarcodesInThirdSyncBo> bos){
        return iBaseBarcodesInService.thirdSyncBaseBarcodesIn(bos);
    }


    @Log(title = "同步依柯力系统-返修条码信息",businessType = BusinessType.UPDATE)
    @PostMapping("/syncRepairBarcodes")
    @RepeatSubmit
    public ThirdYklResult thirdSyncOutBarcodes(@Valid @RequestBody List<BaseBarcodesInThirdRepairBo> bos){
        return iBaseBarcodesInService.thirdSyncRepairBarcodes(bos);
    }

    @Log(title = "同步依柯力系统-出库接口数据",businessType = BusinessType.UPDATE)
    @PostMapping("/syncOutBarcodes")
    @RepeatSubmit
    public ThirdYklResult syncOutBarcodes(@Valid @RequestBody List<BaseBarcodesOutThirdSyncBo> bo){
        return iBaseBarcodesOutService.thirdSyncBaseBarcodesOut(bo);
    }

    @Log(title = "同步依柯力系统-过点时间",businessType = BusinessType.UPDATE)
    @PostMapping("/syncOutBarcodesPointDate")
    @RepeatSubmit
    public ThirdYklResult thirdSyncOutBarcodesPoint(@Valid @RequestBody List<BaseBarcodesOutThirdPointBo> bo){
        return iBaseBarcodesOutService.thirdSyncBaseBarcodesOutPoint(bo);
    }


}
