王佳豪
2021-06-26 718f604deb342b0bee6c588bb44e22ced3371fb8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package com.slcf.dao;
 
import java.util.List;
 
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
 
import com.slcf.bean.LocDetailCondition;
import com.slcf.pojo.LocDetailBean;
 
@Repository
public interface LocDetail5Dao {
 
    /**
     * 添加
     * @param locDetail
     * @return
     */
    @Insert("insert into asr_loc_detl(loc_no,memo,modi_user,modi_time, "
            + " matnr,lgnum,tbnum,tbpos,maktx,werks,anfme,altme,bname) "
            + " values(#{loc_no},#{memo},#{modi_user},getdate(), "
            + " #{matnr},#{lgnum},#{tbnum},#{tbpos},#{maktx},"
            + " #{werks},#{anfme},#{altme},#{bname})")
    public int insertLocDetail5(LocDetailBean locDetail);
    
    //分页查询所有信息
//    @Select("select top (#{epage}) * from asr_loc_detl where loc_no not in "
//    @Select("select top (#{epage}) a.*,b.loc_desc loc_sts_name from asr_loc_detl a,asr_bas_loc_type b where a.loc_sts=b.loc_sts and loc_no not in "
//            + " (select top (#{spage}) loc_no from asr_loc_detl order by loc_no asc) order by loc_no asc")
//    public List<LocDetailBean> queryLocationList(@Param("spage")int spage,@Param("epage")int epage);
    public List<LocDetailBean> queryLocDetail5List(LocDetailCondition locationCon);
    
    //统计统计库存总数量
    @Select("select sum(qty) from asr_loc_detl where mat_no=#{mat_no}")
    public int getLocStockCount5(String mat_no);
    
    /**
     * 不分页查询所有信息,用于excel导出 
     * @param sysLogCon
     * @return
     */
    public List<LocDetailBean> getLocDetail5All(LocDetailCondition locationCon);
    
    //根据过滤条件统计总数量
    public int getLocDetail5Count(LocDetailCondition locationCon);
    
    /**
     * 查询所有
     * @return
     */
    @Select("select * from asr_loc_detl order by loc_no asc")
    public List<LocDetailBean> getLocDetail5List();
    
    /**
     * 根据id查询信息
     * @param id
     * @return
     */
    @Select("select * from asr_loc_detl where loc_no=#{loc_no} and matnr=#{matnr}")
    public LocDetailBean getLocDetail5ById(@Param("loc_no")String loc_no,@Param("matnr")String matnr);
    
    //更新
    @Update("update asr_loc_detl set anfme=#{anfme},modi_time=getdate() "
            + " where loc_no=#{loc_no} and matnr=#{matnr}")
    public int upLocDetail5(LocDetailBean location);
    
    //根据id删除工作信息
    @Delete("delete from asr_loc_detl where loc_no=#{loc_no} and mat_no=#{mat_no}")
    public int delLocDetail5ById(@Param("loc_no")String loc_no,@Param("mat_no")String mat_no);
    
    //统计统计库存总数量
    @Select("select sum(qty) from asr_loc_detl where loc_no=#{loc_no}")
    public int getStockQtyByLoc5(@Param("loc_no")String loc_no);
    
    //根据库位号获取库存明细
//    @Select("select a.*,b.barcode,c.mat_name from asr_loc_detl a,asr_loc_mast b,bas_mat_code c "
//            + " where a.mat_no=c.mat_no and a.loc_no=b.loc_no and a.loc_no=#{loc_no} and b.loc_sts='F'")
    @Select("select a.loc_no,c.* from asr_loc_detl a,asr_loc_mast b,bas_mat_code c "
            + " where a.mat_no=c.mat_no and a.loc_no=b.loc_no and a.loc_no=#{loc_no} and b.loc_sts='F'")
    public List<LocDetailBean> getLocDetl5ByLoc(@Param("loc_no")String loc_no);
    
    //根据条码获取库存明细
//    @Select("select a.*,c.mat_name from asr_loc_detl a,asr_loc_mast b,bas_mat_code c "
//            + " where a.mat_no=c.mat_no and a.loc_no=b.loc_no and barcode=#{barcode} and b.loc_sts='F'")
    @Select("select a.loc_no,c.* from asr_loc_detl a,asr_loc_mast b,bas_mat_code c "
            + " where a.mat_no=c.mat_no and a.loc_no=b.loc_no and b.barcode=#{barcode} and b.loc_sts='F'")
    public List<LocDetailBean> getLocDetl5ByBarcode(@Param("barcode")String barcode);
}