zhuguifei
2026-03-10 58402bd5e762361363a0f7d7907153c77dbb819f
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
package com.shlanbao.tzsc.pms.sch.shiftexchg.controller;
 
import javax.servlet.http.HttpServletRequest;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
 
import com.alibaba.fastjson.JSON;
import com.shlanbao.tzsc.base.controller.BaseController;
import com.shlanbao.tzsc.base.model.DataGrid;
import com.shlanbao.tzsc.base.model.Json;
import com.shlanbao.tzsc.base.model.PageParams;
import com.shlanbao.tzsc.pms.sch.shiftexchg.beans.ShiftExchgBean;
import com.shlanbao.tzsc.pms.sch.shiftexchg.beans.ShiftExchgDetBean;
import com.shlanbao.tzsc.pms.sch.shiftexchg.service.ShiftExchgServiceI;
/**
 * 换班换牌控制器
 * @author Leejean
 * @create 2014年11月18日下午2:23:51
 */
@Controller
@RequestMapping("/pms/shiftexchg")
public class ShiftExchgController extends BaseController {
    @Autowired
    private ShiftExchgServiceI shiftExchgService;
    /**
     * 查询所有换班换牌
     */
    @RequestMapping("/getExchgs")
    @ResponseBody
    public DataGrid getExchgs(ShiftExchgBean shiftExchgBean,PageParams pageParams){
        return shiftExchgService.getExchgs(shiftExchgBean, pageParams);
    }
    /**
     * 获得明细集合
     */
    @RequestMapping("/getExchgDetsByExchgId")
    @ResponseBody
    public DataGrid getExchgDetsByExchgId(String id){
        try {
            return shiftExchgService.getExchgDetsByExchgId(id);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    /**
     * 删除换班
     */
    @ResponseBody
    @RequestMapping("/deleteExchg")
    public Json deleteExchg(String id){
        Json json=new Json();
        try {
            shiftExchgService.deleteExchg(id);
            json.setMsg("删除成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("删除失败!");
            json.setSuccess(false);
        }
        return json;
    }
    /**
     * 编辑换班
     */
    @ResponseBody
    @RequestMapping("/editExchg")
    public Json editExchg(ShiftExchgBean shiftExchgBean){
        Json json=new Json();
        try {
            shiftExchgService.editExchg(shiftExchgBean);
            json.setMsg("修改成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("修改失败!");
            json.setSuccess(false);
        }
        return json;
    }
    /**
     * 跳转到新增换班页面
     */
    @RequestMapping("/goToExchgAddJsp")
    public String goToExchgAddJsp(HttpServletRequest request,String workshop,String type){
        request.setAttribute("workshop", workshop);
        request.setAttribute("type", type);
        return "/pms/sch/shiftexchg/exchgAdd";
    }
    /**
     * 跳转到编辑换班页面
     */
    @RequestMapping("/goToExchgEditJsp")
    public String goToExchgEditJsp(HttpServletRequest request,String id,String type) throws Exception{
        request.setAttribute("exchg", shiftExchgService.getExchgById(id));
        request.setAttribute("type", type);
        return "/pms/sch/shiftexchg/exchgEdit";
    }
    /**
     * 跳转到换班明细新增页面
     */
    @RequestMapping("/goToDetAddJsp")
    public String goToDetAddJsp(HttpServletRequest request,String hoOrder,String id) throws Exception{
        request.setAttribute("workorder", hoOrder);
        request.setAttribute("exchg", id);
        request.setAttribute("boms",JSON.toJSONString(shiftExchgService.getBomsWorkorderId(hoOrder,id)));
        return "/pms/sch/shiftexchg/detAdd";
    }
    /**
     * 跳转到换班明细编辑页面
     */
    @RequestMapping("/goToDetEditJsp")
    public String goToDetEditJsp(HttpServletRequest request,String id) throws Exception{
        request.setAttribute("det", shiftExchgService.getExchgDetById(id));
        return "/pms/sch/shiftexchg/detEdit";
    }
    /**
     * 新增换班
     */
    @ResponseBody
    @RequestMapping("/addExchg")
    public Json addExchg(ShiftExchgBean shiftExchgBean){
        Json json=new Json();
        try {
            shiftExchgService.addExchg(shiftExchgBean);
            json.setMsg("新增成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("新增失败!");
            json.setSuccess(false);
        }
        return json;
    }
    /**
     * 编辑换班明细
     */
    @ResponseBody
    @RequestMapping("/editExchgDet")
    public Json editExchgDet(ShiftExchgDetBean shiftExchgDetBean){
        Json json=new Json();
        try {
            shiftExchgService.editExchgDet(shiftExchgDetBean);
            json.setMsg("修改成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("修改失败!");
            json.setSuccess(false);
        }
        return json;
    }
    /**
     * 新增换班明细
     */
    @ResponseBody
    @RequestMapping("/addExchgDet")
    public Json addExchgDet(ShiftExchgDetBean shiftExchgDetBean){
        Json json=new Json();
        try {
            shiftExchgService.addExchgDet(shiftExchgDetBean);
            json.setMsg("新增成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("新增失败!");
            json.setSuccess(false);
        }
        return json;
    }
    /**
     *删除换班明细
     */ 
    @ResponseBody
    @RequestMapping("/deleteExchgDet")
    public Json deleteExchgDet(String id){
        Json json=new Json();
        try {
            shiftExchgService.deleteExchgDet(id);
            json.setMsg("删除成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("删除失败!");
            json.setSuccess(false);
        }
        return json;
    }
 
    /**
     *批量删除删除换班明细
     */
    @ResponseBody
    @RequestMapping("/batchDeleteExchgDet")
    public Json batchDeleteExchgDet(String ids){
        Json json=new Json();
        try {
            shiftExchgService.batchDeleteExchgDet(ids);
            json.setMsg("删除成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("删除失败!");
            json.setSuccess(false);
        }
        return json;
    }
}