package com.jwipc.sys.controller;

import com.jwipc.api.dto.ApiResult;
import com.jwipc.log.annotation.ApiOperateLog;
import com.jwipc.log.constant.ApiDirection;
import com.jwipc.log.constant.ThirdSysType;
import com.jwipc.sys.dto.ProductItemDTO;
import com.jwipc.sys.dto.ProductStockItemDTO;
import com.jwipc.sys.logic.ProductApiLogic;
import lombok.RequiredArgsConstructor;
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;


/**
 * @author shenyang.ou
 * @date 2024/3/18 10:02
 * @desc 物料同步接口
 */
@RestController
@RequestMapping( "/sap/api/product")
@RequiredArgsConstructor
public class ProductApiController {
    private final ProductApiLogic productApiLogic;
    /**
     * 保存更新
     * @param param 参数
     */
    @PostMapping("/saveOrUpdate")
    @ApiOperateLog(code = "productSaveOrUpdate",name = "物料同步", direction = ApiDirection.OTHER_TO_SRM, thirdSysType = ThirdSysType.SAP)
    public ApiResult saveOrUpdate(@RequestBody ProductItemDTO param){
        return productApiLogic.saveOrUpdate(param);
    }

    /**
     * MES储位
     * @param param 参数
     */
    @PostMapping("/mesSaveOrUpdate")
    @ApiOperateLog(code = "mesSaveOrUpdate",name = "MES物料储位变更时数据推送SRM", direction = ApiDirection.OTHER_TO_SRM, thirdSysType = ThirdSysType.MES)
    public ApiResult mesSaveOrUpdate(@RequestBody ProductStockItemDTO param){
        return productApiLogic.mesSaveOrUpdate(param);
    }

}
