廖井涛
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
package com.northglass.web.shelfmanager2;
 
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.shelfmanager2.ShelfManagerService2;
 
import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
 
/**
 * @author northglass
 *
 */
@Controller
@RequestMapping(value="/shelfmanager2")
public class ShelfManagerController2 {
    
    @Autowired
    private ShelfManagerService2 shelfManagerService2;
    //仓储任务显示
    @RequestMapping(method=RequestMethod.GET, value="/shelftask/{line}")
    public String shelftask(Model model, @PathVariable("line") Long line){
        model.addAttribute("shelftasks", shelfManagerService2.findShelfTask(line));
   //     model.addAttribute("shelftaskHtml", shelfManagerService2.findShelfTaskHtml());
        model.addAttribute("workingtask", shelfManagerService2.findWorkingShelfTask());
        model.addAttribute("status", shelfManagerService2.getstatus());
        model.addAttribute("groups",line);
        /*model.addAttribute("lackGlassHtml", shelfManagerService2.lackGlassHtml());*/
        /* Map<String, Object> param1 = shelfManagerService2.showMachineState();
             model.addAttribute("allstatu", param1.get("allstatu"));
          model.addAttribute("info", param1.get("info"));*/
        return "shelfmanager2/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("shelfRankInfohmtl", shelfManagerService2.getShelfRankInfohmtl());
          model.addAttribute("action", "createAction");
         model.addAttribute("addaction", "addcreateAction");
          model.addAttribute("shelfRankNumberList", shelfManagerService2.getFreeShelfRankNumberList());
          model.addAttribute("shelfRankNumberList1", shelfManagerService2.getdropRankNumberList());
          model.addAttribute("getColorList", shelfManagerService2.getColorList());
          return "shelfmanager2/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 = shelfManagerService2.selectCount();
            list=shelfManagerService2.selectAll(start,length);
        }
        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="/finishshelftask")
    public String finishshelftask(){
        //shelfManagerService2.finishWorkingShelfTask();
        return "redirect:/shelfmanager2/shelftask";
    }   
 
    //删除料架信息
    @RequestMapping(method=RequestMethod.POST, value="/rackdelete")
    @ResponseBody
    public boolean rackdelete(HttpServletRequest request, Model model) {
        shelfManagerService2.rackdelete(Long.valueOf(request.getParameter("MachineId")));
        return true;
    }
    
    @RequestMapping(method=RequestMethod.POST, value="/EnableDisablesReset")
    @ResponseBody
    public boolean enableDisablesReset(HttpServletRequest request, Model model) {
        shelfManagerService2.enableDisablesReset(request.getParameter("type"),Long.valueOf(request.getParameter("MachineId")));
        return true;
    }
    
    @RequestMapping(method=RequestMethod.POST, value="/EnableDisablesReset1")
    @ResponseBody
    public boolean enableDisablesReset1(HttpServletRequest request, Model model) {
        shelfManagerService2.enableDisablesReset1(request.getParameter("type"),Long.valueOf(request.getParameter("MachineId")));
        return true;
    }
    //添加料架信息
    @RequestMapping(method = RequestMethod.POST, value = "/addshelfrack")
    @ResponseBody
    public boolean addshelfrack(HttpServletRequest request, Model model) {
        shelfManagerService2.addshelfrack(request);
        return true;
    }
    
  //添加料架信息
    @RequestMapping(method = RequestMethod.POST, value = "/addtask")
    @ResponseBody
    public boolean addtask(HttpServletRequest request, Model model) {
        shelfManagerService2.addtask(request);
        return true;
    }
    
    //修改数量
    @RequestMapping(method = RequestMethod.POST, value = "/updatecount")
    @ResponseBody
    public boolean updatecount(HttpServletRequest request, Model model) {
        shelfManagerService2.updatecount(request);
        return true;
    }
    //入库
    @RequestMapping(method = RequestMethod.POST, value = "/addshelfracks")
    @ResponseBody
    public boolean addshelfracks(HttpServletRequest request, Model model) {
        shelfManagerService2.addshelfracks(request);
        return true;
    }
    
    //入库
    @RequestMapping(method = RequestMethod.POST, value = "/addshelfracks1")
    @ResponseBody
    public boolean addshelfracks1(HttpServletRequest request, Model model) {
        shelfManagerService2.addshelfracks1(request);
        return true;
    }
    //退库
    @RequestMapping(method = RequestMethod.POST, value = "/deleteAll")
    @ResponseBody
    public boolean deleteAll(HttpServletRequest request, Model model) {
        shelfManagerService2.exitSeparate(request.getParameter("rackid"));
        return true;
    }
  
    //进退库显示
    @RequestMapping(method=RequestMethod.GET, value="/enterandexitrack")
        public String enterandexitrack(Model model,HttpServletRequest request){
         model.addAttribute("rankList", shelfManagerService2.getrankList());
         return "shelfmanager2/eAndExitrack";
     } 
    
    //手动添加上片位信息
      @RequestMapping(method=RequestMethod.POST, value="/addAction")
      public String addAction(@Valid RawPackage rawPackage, HttpServletRequest request,@RequestParam(value="shelfRankNumber") String shelfRankNumber,@RequestParam("Ids") String Ids) {
          shelfManagerService2.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) {
          shelfManagerService2.modifyAction(pieces,Ids);
          return "redirect:/standalonemanage/intopage";
      }
      //单机退库
      @RequestMapping(method=RequestMethod.GET, value="/exitload/{id}")
    public String exitload(Model model, @PathVariable("id") String id){
        shelfManagerService2.exitload(id);
//        model.addAttribute("loadMachineHtml", shelfManagerService2.getLoadMachineRankHtml(1L));
//        model.addAttribute("shelftasks", shelfManagerService2.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 shelfManagerService2.tuikuinfo(loadMachineId);
     }
       
       //残片详情
      @RequestMapping(method=RequestMethod.GET,value="/fragmentsrank")
    public String slicecagerank(Model model){
        model.addAttribute("fragmentsRankInfohmtl", shelfManagerService2.getfragmentsRankInfohmt());
        //model.addAttribute("galsstaskInfohmtl", shelfManagerService2.galsstaskInfohmtl());
         return "shelfmanager2/fragmentsrank";
    }
      
      @RequestMapping(method=RequestMethod.POST, value="/fragmentsrankdelete")
    @ResponseBody
    public boolean fragmentsrankdelete(HttpServletRequest request, Model model) {
          shelfManagerService2.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) {
          shelfManagerService2.updateshelftask(Long.valueOf(request.getParameter("taskid")),request.getParameter("type"));
        return true;
    }
      
      @RequestMapping(method=RequestMethod.GET, value="/gettask")
    public String getTask(Model model){
        return shelfManagerService2.getTask(model);
    }
      
      @RequestMapping(method=RequestMethod.POST, value="/gottask")
      @ResponseBody
    public boolean gotTask(HttpServletRequest request,Model model){        
          shelfManagerService2.getTaskInterface(Long.valueOf(request.getParameter("id")), model);
        return true;
    }
      
      @RequestMapping(method=RequestMethod.GET,value="/loadmachinerack/{groups}")
    public String loadMachine(Model model,@PathVariable("groups") long groups){
          model.addAttribute("loadMachineHtml", shelfManagerService2.getLoadMachineHtml(groups));
          return "shelfmanager2/loadmachinerack"; 
    }
      
      @RequestMapping(method=RequestMethod.POST, value="/updatefalg")
      @ResponseBody
      public boolean updatefalg(HttpServletRequest request, Model model) {
          shelfManagerService2.updatefalg(request.getParameter("dropFrameid"));
          return true;
      }
    
    
    
}