cy
2022-06-21 129904537f66509f97b285e7eb4f42b3dc349dd0
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
package cn.ksource.web.controller.business.pages.bpbj;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
import cn.ksource.core.util.DateUtil;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
 
import cn.ksource.core.page.PageInfo;
import cn.ksource.core.util.ConvertUtil;
import cn.ksource.core.util.ParamsMapUtil;
import cn.ksource.core.util.StringUtil;
import cn.ksource.core.web.SysInfo;
import cn.ksource.core.web.WebUtil;
import cn.ksource.web.Constants;
import cn.ksource.web.facade.bpbj.StockAuditingFacade;
import cn.ksource.web.facade.bpbj.StockTakingFacade;
 
/**
 * 库存盘点控制器
 *
 * @author zf
 * @version 1.0
 * @date 2017-5-31下午2:57:57
 */
@Controller
@RequestMapping("/business/pages/stockTaking")
public class StockTakingController {
    @Resource
    private StockAuditingFacade stockAuditingFacade;
 
    @Resource
    private StockTakingFacade stockTakingFacade;
    
    /**
       * 进入库存盘点页面
       * @return
       */
    @RequestMapping("stockTakingList.html")
    public String stockTakingList() {
        return "/business/pages/bpbj/stockTaking/stockTakingList";
    }
 
    /**
     * 库存盘点 列表数据
     * @param pageInfo
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("stockTakingListData.html")
    public String stockTakingListData(PageInfo pageInfo, HttpServletRequest request, Model model) {
        Map<String, String> params = ParamsMapUtil.getParameterMap(request);
        PageInfo info = stockTakingFacade.getStockTakingListData(pageInfo, params);
        model.addAttribute("info", info);
        return "/business/pages/bpbj/stockTaking/stockTakingListData";
    }
 
    /**
     * 库存盘点 总条数
     * @param request
     * @param response
     */
    @RequestMapping("stockTakingListCount.html")
    public void stockTakingListCount(HttpServletRequest request, HttpServletResponse response) {
        Map<String, String> params = ParamsMapUtil.getParameterMap(request);
        Integer count = stockTakingFacade.getStockTakingListCount(params);
        WebUtil.write(response, String.valueOf(count));
    }
 
    /**
     * 库存盘点新增/编辑 页面
     * @param request
     * @param model
     * @return
     */
    @RequestMapping(value = "stockTakingEdit.html", method = RequestMethod.GET)
    public String stockTakingEdit(HttpServletRequest request, Model model) {
        Map info = new HashMap();
        String id = request.getParameter("id");
        if (StringUtil.isNotBlank(id)) {
            info = stockTakingFacade.getStockTakingInfo(id);
        }
        model.addAttribute("info", info);
        return "/business/pages/bpbj/stockTaking/stockTakingEdit";
 
    }
 
    /**
     * ajax  提交盘点功能
     * @param request
     * @return
     */
    @RequestMapping(value = "stockTakingEditSubmit.html",method = RequestMethod.POST)
    public ModelAndView editSupplier(HttpServletRequest request) {
        Map<String, String> params = ParamsMapUtil.getParameterMap(request);
        Map user = WebUtil.getLoginUser(request).getLoginUser();
        params.put("create_id", ConvertUtil.obj2StrBlank(user.get("ID")));
        params.put("create_name", ConvertUtil.obj2StrBlank(user.get("ZSXM")));
        stockTakingFacade.editStockTaking(params);
        return WebUtil.sysInfoPage(request, "操作成功!",
                "window.top.query();window.top.hideDialog('0');",
                SysInfo.Success,"");
    }
    
    /**
     * 提交审核
     * @return
     */
    @RequestMapping(value = "approve.html",method = RequestMethod.GET)
    public String approve(){
        return "/business/pages/bpbj/stockTaking/approve";
    }
 
    @RequestMapping(value = "approve.html",method = RequestMethod.POST)
    public ModelAndView approveSub(HttpServletRequest request){
        Map<String, String> param = ParamsMapUtil.getParameterMap(request);
        Map loginUser = WebUtil.getLoginUser(request).getLoginUser();
        param.put("userId", ConvertUtil.obj2StrBlank(loginUser.get("ID")));
        param.put("userName", ConvertUtil.obj2StrBlank(loginUser.get("ZSXM")));
        stockTakingFacade.sendToApprove(param);
        String execJs = "window.top.query();window.top.hideDialog('insideAllot');";
        return WebUtil.sysInfoPage(request, "操作成功!",execJs, SysInfo.Success,"");
    }
 
 
    /**
     * 盘点审核列表
     * @return
     */
    @RequestMapping("inventoryApproveList.html")
    public String inventoryApproveList() {
        return "/business/pages/bpbj/stockTaking/inventoryApproveList";
    }
 
    @RequestMapping("inventoryApproveListData.html")
    public String inventoryApproveListData(PageInfo pageInfo, HttpServletRequest request, Model model) {
        Map<String, String> params = ParamsMapUtil.getParameterMap(request);
        params.put("userId", WebUtil.getLoginedUserId(request));
        PageInfo info = stockTakingFacade.inventoryApproveListData(pageInfo, params);
        model.addAttribute("info", info);
        return "/business/pages/bpbj/stockTaking/inventoryApproveListData";
    }
 
    @RequestMapping("inventoryApproveListCount.html")
    public void inventoryApproveListCount(HttpServletRequest request, HttpServletResponse response) {
        Map<String, String> params = ParamsMapUtil.getParameterMap(request);
        params.put("userId", WebUtil.getLoginedUserId(request));
        Integer count = stockTakingFacade.inventoryApproveListCount(params);
        WebUtil.write(response, String.valueOf(count));
    }
 
 
    /**
     * 盘点审核
     * @return
     */
    @RequestMapping(value = "inventoryDetail.html",method = RequestMethod.GET)
    public String inventoryDetail(HttpServletRequest request,Model model){
        List noteKeyList = stockAuditingFacade.getNoteKeyList(Constants.KCPD_APPROVE_RESULT);
           model.addAttribute("noteKeyList",noteKeyList);
        String orderId = request.getParameter("orderId");
        Map detail = stockTakingFacade.getDetail(orderId);
        model.addAttribute("detail", detail);
        return "/business/pages/bpbj/stockTaking/inventoryDetail";
    }
 
    @RequestMapping(value = "doApprove.html",method = RequestMethod.POST)
    public ModelAndView doApproveSub(HttpServletRequest request){
        Map<String, String> param = ParamsMapUtil.getParameterMap(request);
        Map loginUser = WebUtil.getLoginUser(request).getLoginUser();
        param.put("userId", ConvertUtil.obj2StrBlank(loginUser.get("ID")));
        param.put("userName", ConvertUtil.obj2StrBlank(loginUser.get("ZSXM")));
        stockTakingFacade.doApprove(param);
        String execJs = "window.top.query();window.top.hideDialog('0');";
        return WebUtil.sysInfoPage(request, "操作成功!",execJs, SysInfo.Success,"");
    }
 
 
    /**
     * 盘点查询列表
     * @return
     */
    @RequestMapping("inventoryQueryList.html")
    public String inventoryQueryList() {
        return "/business/pages/bpbj/stockTaking/inventoryQueryList";
    }
 
    @RequestMapping("inventoryQueryListData.html")
    public String inventoryQueryListData(PageInfo pageInfo, HttpServletRequest request, Model model) {
        Map<String, String> params = ParamsMapUtil.getParameterMap(request);
        PageInfo info = stockTakingFacade.inventoryApproveListData(pageInfo, params);
        model.addAttribute("info", info);
        return "/business/pages/bpbj/stockTaking/inventoryQueryListData";
    }
 
    @RequestMapping("inventoryQueryListCount.html")
    public void inventoryQueryListCount(HttpServletRequest request, HttpServletResponse response) {
        Map<String, String> params = ParamsMapUtil.getParameterMap(request);
        Integer count = stockTakingFacade.inventoryApproveListCount(params);
        WebUtil.write(response, String.valueOf(count));
    }
    
    /**
     * 删除报损报溢备件信息
     */
    @RequestMapping("editStockStatus.html")
    public void editStockStatus(HttpServletRequest request,HttpServletResponse response){
        Map<String, String> params = ParamsMapUtil.getParameterMap(request);
        String id = request.getParameter("id");
        stockTakingFacade.editStockStatus(id);
        WebUtil.write(response, "1");
    }
 
    /**
     * 两个日期时间差
     * @param request
     * @param response
     */
    @RequestMapping("getDayTime.html")
    public void stockTime(HttpServletRequest request,HttpServletResponse response){
        String start = request.getParameter("start");
        String end = request.getParameter("end");
        Long last1MonthTime= DateUtil.getFromTime2TimeByDay(Long.valueOf(start),Long.valueOf(end));
        WebUtil.write(response, String.valueOf(last1MonthTime));
    }
    
}