package cn.estsh.i3plus.pojo.wms.repository;

import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
import cn.estsh.i3plus.pojo.wms.bean.WmsMoveDetails;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @Description : 库存移动单明细信息
 * @Reference :
 * @Author : amy
 * @CreateDate : 2018-11-18 13:59
 * @Modify:
 **/
public interface WmsMoveDetailsRepository extends BaseRepository<WmsMoveDetails, Long> {

    /**
     * 根据工厂代码和单据编号查询库存移动单明细表
     * @param organizeCode 工厂代码
     * @param orderNo 单据编号
     * @return 库存移动单明细表
     */
    List<WmsMoveDetails> findByOrganizeCodeAndOrderNo(String organizeCode, String orderNo);

    /**
     * 获取item最大值
     * @param organizeCode
     * @param isValid
     * @param isDeleted
     * @return
     *//*
    @Query("select max(item) from WmsMoveDetails where organizeCode = :organizeCode and isValid = :isValid and isDeleted = :isDeleted")
    int getMaxItem(@Param("organizeCode")String organizeCode, @Param("isValid")int isValid, @Param("isDeleted")int isDeleted);

    *//**
     * 获取不是指定状态的记录数
     * @param organizeCode
     * @param isValid
     * @param isDeleted
     * @param status
     * @return
     *//*
    @Query("select count(id) from WmsMoveDetails where organizeCode = :organizeCode and isValid = :isValid and isDeleted = :isDeleted and status <> :status")
    int getCountNotInStatus(@Param("organizeCode")String organizeCode, @Param("isValid")int isValid, @Param("isDeleted")int isDeleted,@Param("status")int status);
*/
}
