#
18516761980
2022-07-28 65fa066e222f6472badf7323c3b301417b674fdb
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
package com.slcf.dao;
 
import java.util.List;
 
import com.slcf.bean.WaitPakOutLogCondition;
import com.slcf.pojo.WaitPakOutLogBean;
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.WaitPakOutCondition;
import com.slcf.pojo.WaitPakOutBean;
 
@Repository
public interface WaitPakOutDao {
 
    /**
     * 添加
     * @param waitPakOut
     * @return
     */
    @Insert("insert into cust_wait_pakout(lgnum,tanum,tapos,matnr,maktx,werks,memo,modi_user,modi_time, "
            + " vsolm,meins,vltyp,vlpla,nltyp,nlpla,bname) "
            + " values(#{lgnum},#{tanum},#{tapos},#{matnr},#{maktx},#{werks},#{memo},#{modi_user},getdate(), "
            + " #{vsolm},#{meins},#{vltyp},#{vlpla},#{nltyp},#{nlpla},#{bname})")
    public int insertWaitPakOut(WaitPakOutBean waitPakOut);
    
    //分页查询所有信息
//    @Select("select top (#{epage}) * from cust_wait_pakout where loc_no not in "
//    @Select("select top (#{epage}) a.*,b.loc_desc loc_sts_name from cust_wait_pakout a,asr_bas_loc_type b where a.loc_sts=b.loc_sts and loc_no not in "
//            + " (select top (#{spage}) loc_no from cust_wait_pakout order by loc_no asc) order by loc_no asc")
    public List<WaitPakOutBean> queryWaitPakOutList(WaitPakOutCondition waitPakOutCon);
 
    public Integer waitPakOutSetEms(@Param("lgnum") String lgnum, @Param("tanum") int tanum, @Param("tapos") int tapos);
 
    public Integer countEmsNum();
 
    public List<WaitPakOutBean> queryWaitOutPak(@Param("vlpla") String vlpla, @Param("matnr") String matnr);
    
//    //统计所有数据总数量
//    @Select("select count(*) from cust_wait_pakout")
//    public int getLocationCount();
    
    //根据过滤条件统计总数量
    public int getWaitPakOutCount(WaitPakOutCondition waitPakOutCon);
    
    /**
     * 查询所有
     * @return
     */
    @Select("select * from cust_wait_pakout order by sheet_no,mat_no desc")
    public List<WaitPakOutBean> getWaitPakOutList();
    
    /**
     * 查询信息
     * @param id
     * @return
     */
    @Select("select * from cust_wait_pakout a left join bas_mat_code b on a.mat_no=b.mat_no where sheet_no=#{sheet_no} and a.mat_no=#{mat_no}")
    public WaitPakOutBean getWaitPakOutById(@Param("sheet_no")String sheet_no,@Param("mat_no")String mat_no);
    
    /**
     * 根据物料号查询信息
     * @param mat_no
     * @return
     */
    @Select("select * from cust_wait_pakout a left join bas_mat_code b on a.mat_no=b.mat_no where a.mat_no=#{mat_no}")
    public WaitPakOutBean getWaitPakOutByMatNo(@Param("mat_no")String mat_no);
    
    
    /**
     * 根据库位号查询信息
     * @param loc_no
     * @return
     */
    @Select("select * from cust_wait_pakout a left join bas_mat_code b on a.mat_no=b.mat_no where loc_no=#{loc_no}")
    public WaitPakOutBean getWaitPakOutByLocNo(@Param("loc_no")String loc_no);
    
    //更新
    @Update("update cust_wait_pakout set io_status=#{io_status},memo=#{memo},nista=#{nista},action=#{action},prnstatus=#{prnstatus},modi_time=getdate() "
            + " where lgnum=#{lgnum} and tanum=#{tanum} and tapos=#{tapos}")
    public int upWaitPakOut(WaitPakOutBean WaitPakOut);
    
    //根据库位信息更新
    @Update("update cust_wait_pakout set io_status=#{io_status},memo=#{memo},modi_user=#{modi_user},modi_time=getdate() "
            + " where lgnum=#{lgnum} and tanum=#{tanum} and tapos=#{tapos} and matnr=#{matnr}")
    public int upWaitPakOutByLocNo(WaitPakOutBean WaitPakOut);
    
    //根据id删除工作信息
    @Delete("delete from cust_wait_pakout where lgnum=#{lgnum} and tanum=#{tanum} and tapos=#{tapos}")
    public int delWaitPakOutById(WaitPakOutBean WaitPakOut);
    
    //待删除资料,先插入日志档
    @Insert("insert into cust_wait_pakout_log select * from cust_wait_pakout where lgnum=#{lgnum} and tanum=#{tanum} and tapos=#{tapos} and matnr=#{matnr}")
    public int insertLog(WaitPakOutBean WaitPakOut);
    
    /**
     * 查询所有单号
     * @return
     */
    @Select("select distinct sheet_no from cust_wait_pakout group by sheet_no")
    public List<WaitPakOutBean> getSheetNoList();
    
    //根据库位号删除通知档信息
    @Delete("delete from cust_wait_pakout where loc_no=#{loc_no}")
    public int delWaitPakOutByLocNo(@Param("loc_no")String loc_no);
    
    /**
     * 查询信息
     * @param id
     * @return
     */
    @Select("select * from cust_wait_pakout where lgnum=#{lgnum} and tanum=#{tanum} and tapos=#{tapos}")
    public WaitPakOutBean getWaitPakOutByNum(WaitPakOutBean waitPakOut);
    
    /**
     * 查询最早一笔待反馈SAP数据
     * @return
     */
    @Select("select top 1 * from cust_wait_pakout where io_status='Y' or io_status='X' order by io_status desc,modi_time asc")
    public WaitPakOutBean getWaitPakOutFnh();
    
    /**
     * 查询最早一笔待打印标签数据,action=2单独打印模式,prnstatus=1需求打印状态
     * @return
     */
    @Select("select top 1 * from cust_wait_pakout where status='Y' and io_status='N' and action=2 and (prnstatus=1 or prnstatus=3) order by io_status desc,modi_time asc")
    public WaitPakOutBean getWaitPakOutPrint();
 
    /**
     * 不分页查询所有信息,用于excel导出
     * @return
     */
    public List<WaitPakOutBean> getWaitPakOutAll(WaitPakOutCondition condition);
}