廖井涛
2025-11-28 67f0be5a1d634ba3274fa9366ceacc3580f056b7
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
package com.northglass.web.shelfmanager;
 
import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
 
import com.northglass.constants.StateConstants.ShelfRankState;
import com.northglass.entity.MachineDispose;
import com.northglass.entity.MachineMessage;
import com.northglass.entity.RawPackage;
import com.northglass.entity.ShelfRack;
import com.northglass.service.cutmanage.CutManageService;
import com.northglass.service.shelfmanager.ShelfManagerService;
 
import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
 
/**
 * @author northglass
 *
 */
@Controller
@RequestMapping(value="/shelfmanager")
public class ShelfManagerController {
    
    @Autowired
    private ShelfManagerService shelfManagerService;
    //仓储任务显示
    @RequestMapping(method=RequestMethod.GET, value="/shelftask")
    public String shelftask(Model model){
        model.addAttribute("shelftasks", shelfManagerService.findShelfTask());
   //     model.addAttribute("shelftaskHtml", shelfManagerService.findShelfTaskHtml());
        model.addAttribute("workingtask", shelfManagerService.findWorkingShelfTask());
        model.addAttribute("status", shelfManagerService.getstatus());
        /*model.addAttribute("lackGlassHtml", shelfManagerService.lackGlassHtml());*/
        /* Map<String, Object> param1 = shelfManagerService.showMachineState();
             model.addAttribute("allstatu", param1.get("allstatu"));
          model.addAttribute("info", param1.get("info"));*/
        return "shelfmanager/shelftask";
    }
    
    //料架管理
      @RequestMapping(method=RequestMethod.GET,value="/rankmanager")
      public String rank(Model model) {
          model.addAttribute("working", ShelfRankState.IN_WORK);
          model.addAttribute("free", ShelfRankState.FREE);
          model.addAttribute("rawPackage", new RawPackage());
          model.addAttribute("addrawPackage", new RawPackage());
          model.addAttribute("shelfRankInfo", shelfManagerService.getShelfRankInfo());
          model.addAttribute("shelfRankInfohmtl", shelfManagerService.getShelfRankInfohmtl());
          model.addAttribute("action", "createAction");
         model.addAttribute("addaction", "addcreateAction");
          model.addAttribute("shelfRankNumberList", shelfManagerService.getFreeShelfRankNumberList());
          model.addAttribute("shelfRankNumberList2", shelfManagerService.getFreeShelfRankNumberList2());
          model.addAttribute("getColorList", shelfManagerService.getColorList());
          /*model.addAttribute("getGlassCommerList", shelfManagerService.getGlassNameList());
          model.addAttribute("optionHtml",shelfManagerService.getcolorHtml());
          Map<String, Object> param1 = manageService.showMachineState();
        model.addAttribute("allstatu", param1.get("allstatu"));
         model.addAttribute("info", param1.get("info"));*/
          return "shelfmanager/rankmanager";
      }
      
  //料架信息
      @RequestMapping(method=RequestMethod.GET, value="/rawpackagelist")
      public String  rawpackagelist(Model model,ShelfRack v,HttpServletRequest request,
              @RequestParam("start") Integer start,@RequestParam("length") Integer length,
              @RequestParam("glassThickness") String glassThickness,@RequestParam("glassId") String glassId) {
        Map<String, Object> map = new HashMap<String, Object>();
        int count = 0;
        List<ShelfRack> list=null;
        if((glassThickness==null||glassThickness=="")&&(glassId==null||glassId=="")){
              count = shelfManagerService.selectCount();
            list=shelfManagerService.selectAll(start,length);
        }/*else if((glassThickness!=null&&glassThickness!="")&&(glassId==null||glassId=="")){
            count = shelfManagerService.selectCount1(glassThickness);
            list=shelfManagerService.selectAll1(start,length,glassThickness);
        }else if((glassThickness==null||glassThickness=="")&&(glassId!=null&&glassId!="")){
//            count = shelfManagerService.selectCount();
//            list=shelfManagerService.selectAll(start,length);
            count = shelfManagerService.selectCount2(glassId);
            list=shelfManagerService.selectAll2(start,length,glassId);
        }else if((glassThickness!=null&&glassThickness!="")&&(glassId!=null&&glassId!="")){
            count = shelfManagerService.selectCount3(glassThickness,glassId);
            list=shelfManagerService.selectAll3(start,length,glassThickness,glassId);
        }*/
        for(ShelfRack ShelfRank:list){
            if(ShelfRank.getRawPackage()!=null){
                ShelfRank.setCount(ShelfRank.getRawPackage().getLeftPieces());
                System.out.println(ShelfRank.getCount());
            }else{
                ShelfRank.setCount(0);
            }            
        }
        map.put("recordsTotal", count);
        map.put("recordsFiltered", count);
          map.put("aaData", list);
          System.out.println(list);
          JsonConfig config = new JsonConfig();
          config.setExcludes(new String[]{"rawPackage", "shelfTaskes"});
          
        model.addAttribute("result", JSONObject.fromObject(map, config));
      return "ajax/ajax";
      }
    
    //删除上片任务
    @RequestMapping(method=RequestMethod.GET, value="/deletetloadask")
    public String deletetloadask(Model model) {
        shelfManagerService.deletetloadask();
        return "redirect:/shelfmanager/shelftask";
    }
    
    //删除吊装任务
    @RequestMapping(method=RequestMethod.GET, value="/deletetask")
      public String deletetask(Model model) {
          shelfManagerService.deletetask();
          return "redirect:/shelfmanager/shelftask";
      }
    
    //手动任务完成
    @RequestMapping(method=RequestMethod.GET, value="/finishshelftask")
    public String finishshelftask(){
         //shelfManagerService.finishWorkingShelfTask();
        return "redirect:/shelfmanager/shelftask";
    }
    
    //手动重新开始完成
    @RequestMapping(method=RequestMethod.GET, value="/againshelftask")
    public String againshelftask(){
         shelfManagerService.againshelftask();
        return "redirect:/shelfmanager/shelftask";
    }
    //删除料架信息
    @RequestMapping(method=RequestMethod.POST, value="/rackdelete")
    @ResponseBody
    public boolean rackdelete(HttpServletRequest request, Model model) {
        shelfManagerService.rackdelete(Long.valueOf(request.getParameter("MachineId")));
        return true;
    }
    
    @RequestMapping(method=RequestMethod.POST, value="/EnableDisablesReset")
    @ResponseBody
    public boolean enableDisablesReset(HttpServletRequest request, Model model) {
        shelfManagerService.enableDisablesReset(request.getParameter("type"),Long.valueOf(request.getParameter("MachineId")));
        return true;
    }
    //添加料架信息
    @RequestMapping(method = RequestMethod.POST, value = "/addshelfrack")
    @ResponseBody
    public boolean addshelfrack(HttpServletRequest request, Model model) {
        shelfManagerService.addshelfrack(request);
        return true;
    }
    
    //添加仓储任务信息
    @RequestMapping(method = RequestMethod.POST, value = "/addshelftask")
    @ResponseBody
    public boolean addshelftask( Model model) {
        shelfManagerService.addshelftask();
        return true;
    }
    
  //添加料架信息
    @RequestMapping(method = RequestMethod.POST, value = "/addtask")
    @ResponseBody
    public boolean addtask(HttpServletRequest request, Model model) {
        shelfManagerService.addtask(request);
        return true;
    }
    
  //修改数量
    @RequestMapping(method = RequestMethod.POST, value = "/updatecount")
    @ResponseBody
    public boolean updatecount(HttpServletRequest request, Model model) {
        shelfManagerService.updatecount(request);
        return true;
    }
    
  //修改批次号
    @RequestMapping(method = RequestMethod.POST, value = "/updatepicihao")
    @ResponseBody
    public boolean updatepicihao(HttpServletRequest request, Model model) {
        shelfManagerService.updatepicihao(request);
        return true;
    }
    //入库
    @RequestMapping(method = RequestMethod.POST, value = "/addshelfracks")
    @ResponseBody
    public boolean addshelfracks(HttpServletRequest request, Model model) {
        shelfManagerService.addshelfracks(request);
        return true;
    }
    
    //手动入库
    @RequestMapping(method = RequestMethod.POST, value = "/addshelfracks2")
    @ResponseBody
    public boolean addshelfracks2(HttpServletRequest request, Model model) {
        shelfManagerService.addshelfracks2(request);
        return true;
    }
    
    //修改料架
    @RequestMapping(method = RequestMethod.POST, value = "/updateshelfrank")
    @ResponseBody
    public boolean updateshelfrank(HttpServletRequest request, Model model) {
        shelfManagerService.updateshelfrank(request);
        return true;
    }
    
  //入库
    @RequestMapping(method = RequestMethod.POST, value = "/addshelfracks1")
    @ResponseBody
    public boolean addshelfracks1(HttpServletRequest request, Model model) {
        shelfManagerService.addshelfracks1(request);
        return true;
    }
    //出库
    @RequestMapping(method = RequestMethod.POST, value = "/deleteAll")
    @ResponseBody
    public boolean deleteAll(HttpServletRequest request, Model model) {
        shelfManagerService.exitSeparate(request.getParameter("rackid"));
        return true;
    }
  //fanpian
    @RequestMapping(method = RequestMethod.POST, value = "/fanpian")
    @ResponseBody
    public boolean fanpian(HttpServletRequest request, Model model) {
        shelfManagerService.fanpian(request.getParameter("rackid"));
        return true;
    }
    //进退库显示
    @RequestMapping(method=RequestMethod.GET, value="/enterandexitrack")
        public String enterandexitrack(Model model,HttpServletRequest request){
         model.addAttribute("rankList", shelfManagerService.getrankList());
         return "shelfmanager/eAndExitrack";
     } 
    
  //手动添加上片位信息
      @RequestMapping(method=RequestMethod.POST, value="/addAction")
      public String addAction(@Valid RawPackage rawPackage, HttpServletRequest request,@RequestParam(value="shelfRankNumber") String shelfRankNumber,@RequestParam("Ids") String Ids) {
          shelfManagerService.addAction(request, shelfRankNumber,Ids);
          return "redirect:/standalonemanage/intopage";
      }
      
  //手动添加上片位信息
      @RequestMapping(method=RequestMethod.POST, value="/modifyAction")
      public String modifyAction(HttpServletRequest request,@RequestParam(value="pieces") String pieces,@RequestParam("Ids") String Ids) {
          shelfManagerService.modifyAction(pieces,Ids);
          return "redirect:/standalonemanage/intopage";
      }
      //单机退库
      /*@RequestMapping(method=RequestMethod.GET, value="/exitload/{id}")
    public String exitload(Model model, @PathVariable("id") String id){
        shelfManagerService.exitload(id);
//        model.addAttribute("loadMachineHtml", shelfManagerService.getLoadMachineRankHtml(1L));
//        model.addAttribute("shelftasks", shelfManagerService.findShelfTask());
         Map<String, Object> param1 = manageService.showMachineState();
             model.addAttribute("allstatu", param1.get("allstatu"));
         model.addAttribute("info", param1.get("info"));
         if(id.equals("1")){
             return "redirect:/standalonemanage/intopage";
         }else {
             return "redirect:/standalonemanage/intopage2";
        }
        
    }*/
      //手动退库
       @RequestMapping(method=RequestMethod.GET,value="/tuikuinfo/{loadMachineId}")
     public String tuikuinfo(Model model,@PathVariable("loadMachineId") String loadMachineId){
         return shelfManagerService.tuikuinfo(loadMachineId);
     }
       
       //残片详情
      @RequestMapping(method=RequestMethod.GET,value="/fragmentsrank")
    public String slicecagerank(Model model){
        model.addAttribute("fragmentsRankInfohmtl", shelfManagerService.getfragmentsRankInfohmt());
        //model.addAttribute("galsstaskInfohmtl", shelfManagerService.galsstaskInfohmtl());
         return "shelfmanager/fragmentsrank";
    }
      
      @RequestMapping(method=RequestMethod.POST, value="/fragmentsrankdelete")
    @ResponseBody
    public boolean fragmentsrankdelete(HttpServletRequest request, Model model) {
          shelfManagerService.fragmentsrankdelete(Long.valueOf(request.getParameter("rankid")),request.getParameter("type"));
        return true;
    }
      
      
      @RequestMapping(method=RequestMethod.POST, value="/updateshelftask")
    @ResponseBody
    public boolean updateshelftask(HttpServletRequest request, Model model) {
          shelfManagerService.updateshelftask(Long.valueOf(request.getParameter("taskid")),request.getParameter("type"));
        return true;
    }
    
    
    
}