王佳豪
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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
package com.slcf.service.impl;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import com.slcf.bean.WaitPakOutCondition;
import com.slcf.dao.WaitPakOutDao;
import com.slcf.dao.WorkFileDao;
import com.slcf.pojo.WaitPakOutBean;
import com.slcf.pojo.WorkDetailBean;
import com.slcf.pojo.WorkMastBean;
import com.slcf.service.WaitPakOutService;
 
/**
 * 入库通知档接口实现
 * @author admin
 * @date 2018年11月17日
 */
@Service
public class WaitPakOutServiceImpl implements WaitPakOutService {
 
    @Autowired
    WaitPakOutDao WaitPakOutDao;
    
    @Autowired
    WorkFileDao workFileDao;
    /**
     * 添加
     */
    public int insertWaitPakOut(WaitPakOutBean waitPakOut) {
        int result=0;
        try {
            result=WaitPakOutDao.insertWaitPakOut(waitPakOut);
        }catch(Exception e) {
            System.out.println(e.getMessage());
        }
        return result;
    }
 
//    /**
//     * 统计数量
//     */
//    public int queryWaitPakOutCount(){
//        int result = 0;
//        try {
//            result = WaitPakOutDao.getWaitPakOutCount();
//        }catch(Exception e) {
//            System.out.println(e.getMessage());
//        }
//        return result;
//    }
 
    /**
     * 分页查询所有
     */
    public Map<String,Object> queryWaitPakOutList(WaitPakOutCondition waitPakOutCon) {
        try {
            Map<String,Object> map=new HashMap<String, Object>();
            List<WaitPakOutBean> list=WaitPakOutDao.queryWaitPakOutList(waitPakOutCon);
            int count =WaitPakOutDao.getWaitPakOutCount(waitPakOutCon);
            map.put("rows", list);
            map.put("total", count);
            return map;
        }catch(Exception e) {
            System.out.println(e.getMessage());
            return null;
        }
    }
//    public List<WaitPakOutBean> queryWaitPakOutList(int spage, int epage) {
//        try {
//            return WaitPakOutDao.queryWaitPakOutList(spage, epage);
//        }catch(Exception e) {
//            System.out.println(e.getMessage());
//            return null;
//        }
//    }
 
    /**
     * 根据id查找
     */
    public WaitPakOutBean queryWaitPakOutById(String sheet_no,String mat_no) {
        try {
            return WaitPakOutDao.getWaitPakOutById(sheet_no,mat_no);
        }catch(Exception e) {
            System.out.println(e.getMessage());
            return null;
        }
    }
    
    /**
     * 根据库位号查找
     */
    public WaitPakOutBean queryWaitPakOutByLocNo(String loc_no) {
        try {
            return WaitPakOutDao.getWaitPakOutByLocNo(loc_no);
        }catch(Exception e) {
            System.out.println(e.getMessage());
            return null;
        }
    }
    
    /**
     * 根据物料号号查找
     */
    public WaitPakOutBean queryWaitPakOutByMatNo(String mat_no) {
        try {
            return WaitPakOutDao.getWaitPakOutByMatNo(mat_no);
        }catch(Exception e) {
            System.out.println(e.getMessage());
            return null;
        }
    }
    
    //更新
    public int upWaitPakOut(WaitPakOutBean WaitPakOut, int type) {
        int result=0;
        try {
            result=WaitPakOutDao.upWaitPakOut(WaitPakOut);
//            if(type==2) {
//                //如果工作档有数据,调整工作档优先级
//                WorkDetailBean workDetail = workFileDao.getWorkDetlByMatNo(WaitPakOut.getMat_no());
//                if(workDetail!=null) {
//                    WorkMastBean workMast = workFileDao.getWorkMastById(workDetail.getWrk_no());
//                    if(workMast!=null) {
//                        workMast.setIo_pri(WaitPakOut.getCtns());
//                        workFileDao.upWorkMast(workMast);
//                    }
//                }
//                
//            }
        }catch(Exception e) {
//            System.out.println("TQSTQS---" + e.getMessage());
            System.out.println(e.getMessage());
        }
        return result;
    }
 
    //更新
    public int upWaitPakOutByLocNo(WaitPakOutBean WaitPakOut) {
        int result=0;
        try {
            result=WaitPakOutDao.upWaitPakOutByLocNo(WaitPakOut);
        }catch(Exception e) {
            System.out.println(e.getMessage());
        }
        return result;
    }
        
    /**
     * 根据id删除
     */
    public int delWaitPakOut(WaitPakOutBean WaitPakOut) {
        int result=0;
        try {
            result=WaitPakOutDao.delWaitPakOutById(WaitPakOut);
        }catch(Exception e) {
            System.out.println(e.getMessage());
        }
        return result;
    }
 
    /**
     * 查询所有
     * @return
     */
    public List<WaitPakOutBean> getWaitPakOutList() {
        try {
            return WaitPakOutDao.getWaitPakOutList();
        }catch(Exception e) {
            System.out.println(e.getMessage());
            return null;
        }
    }
    
    /**
     * 转历史档
     */    
//    @Transactional(propagation=Propagation.REQUIRED)
    @Transactional
    public int moveToLog(WaitPakOutBean WaitPakOut) {
        int result=0;
        try {
            result=WaitPakOutDao.insertLog(WaitPakOut);
            result=WaitPakOutDao.delWaitPakOutById(WaitPakOut);
        }catch(Exception e) {
            System.out.println(e.getMessage());
        }
        return result;
    }
    
    /**
     * 查询所有单号
     * @return
     */
    public List<WaitPakOutBean> getSheetNoList() {
        try {
            return WaitPakOutDao.getSheetNoList();
        }catch(Exception e) {
            System.out.println(e.getMessage());
            return null;
        }
    }
    
    /**
     * 根据编号、行号查
     */
    public WaitPakOutBean queryWaitPakOutByNum(WaitPakOutBean waitPakOutBean) {
        try {
            return WaitPakOutDao.getWaitPakOutByNum(waitPakOutBean);
        }catch(Exception e) {
            System.out.println(e.getMessage());
            return null;
        }
    }
    
    /**
     * 查询最早一笔待反馈SAP数据
     */
    public WaitPakOutBean queryWaitPakOutFnh() {
        try {
            return WaitPakOutDao.getWaitPakOutFnh();
        }catch(Exception e) {
            System.out.println(e.getMessage());
            return null;
        }
    }
    
    /**
     * 查询最早一笔待打印标签数据
     */
    public WaitPakOutBean getWaitPakOutPrint() {
        try {
            return WaitPakOutDao.getWaitPakOutPrint();
        }catch(Exception e) {
            System.out.println(e.getMessage());
            return null;
        }
    }
}