廖井涛
2025-05-26 3a975df5b368bc68ee7a81d34920b209f2ff607b
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
package com.northglass.web.cutmanage;
 
 
 
import java.text.ParseException;
import java.util.List;
import java.util.Map;
 
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
 
import org.apache.commons.lang.StringUtils;
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.entity.GalssTaskDetails;
import com.northglass.entity.RawPackage;
import com.northglass.repository.GalssTaskDetailsDao;
import com.northglass.service.cutmanage.CutManageService;
import com.northglass.service.shelfmanager.ShelfManagerService;
 
 
@Controller
@RequestMapping(value="/cutmanage")
public class CutManageController {
    @Autowired
    private CutManageService cutManageService;
    @Autowired
    ShelfManagerService shelfManagerService;
    
    @Autowired
    GalssTaskDetailsDao galssTaskDetailsDao;
    
    //待领取任务界面(1号切割机)
    @RequestMapping(method=RequestMethod.GET, value="/gettask/{line}")
    public String getTask(HttpServletRequest request,Model model,@PathVariable("line") String line){
        /*String strs[]=request.getSession().getValueNames();
        for(String s: strs){
            System.out.println(s);
        }*/
        /*String itCode = "";
        Cookie[] cookies = request.getCookies();
        if(cookies != null){
            //循环对比cookie中的值找到"账号"字段并赋值
            for(Cookie item : cookies){
                System.out.println(item.getName());
                System.out.println(item.getValue());
                if(item.getName().equalsIgnoreCase("admin")
                        && StringUtils.isNotEmpty(item.getValue())){
                    System.out.println(item.getValue());
                    itCode = item.getValue();
                }
            }
            System.out.println(itCode);
        }*/
        
        return cutManageService.getTask(line, model);
    }
    
    
    @RequestMapping(method=RequestMethod.GET, value="/gettasks/{line}")
    public String getTasks(Model model,@PathVariable("line") String line){
        
        return cutManageService.getTasks(line, model);
    }
    
    @RequestMapping(method=RequestMethod.GET, value="/gottask/{id}/{line}")
    public String gotTask(@PathVariable("id") String id,@PathVariable("line") String line,HttpServletRequest request,HttpServletResponse response,Model model) {
        
        return cutManageService.getTaskInterface(request, response, Long.valueOf(id),Long.valueOf(line), model);
    }
    
    @RequestMapping(method=RequestMethod.GET, value="/gottasks/{line}")
    public String gottasks(@PathVariable("line") String line,HttpServletRequest request,HttpServletResponse response,Model model){
        model.addAttribute("pattertaskHtml", cutManageService.getpattertaskHtml(Long.valueOf(line)));
        model.addAttribute("pattertaskHtml2", cutManageService.getpattertaskHtml2(Long.valueOf(line)));
        //model.addAttribute("rawPackageslistname", cutManageService.getrawPackageslistname(line));
        model.addAttribute("groups", line);
        //System.out.println(line);
        return "cutmanage/gotasks"; 
    }
      
    @RequestMapping(method=RequestMethod.GET,value="/loadmachinerack")
    public String loadMachine(Model model){
        model.addAttribute("shelfRankNumberList", cutManageService.getFreeShelfRankNumberList1());
        model.addAttribute("getColorList", cutManageService.getColorList());
          model.addAttribute("loadMachineHtml", cutManageService.getLoadMachineHtml());
          /*model.addAttribute("loadMachineFixHtml", cutManageService.getLoadMachineFixHtml());*/
          return "cutmanage/loadmachinerack"; 
    }
    
    @RequestMapping(method=RequestMethod.GET,value="/deleteinfo/{loadMachineId}")
    public String deleteinfo(Model model,@PathVariable("loadMachineId") String loadMachineId){
        return cutManageService.deleteinfo(loadMachineId);
    }
    
    //结束任务
    @RequestMapping(method=RequestMethod.GET,value="/delecttask/{id}/{line}")
    public String delecttask(Model model,@PathVariable("id") Long id,@PathVariable("line") Long line){
        return cutManageService.delecttask(id,line);
    }
    
    @RequestMapping(method=RequestMethod.POST, value="/updatedengluname")
    @ResponseBody
    public boolean updatedengluname(HttpServletRequest request, Model model) {
         cutManageService.updatedengluname(request.getParameter("groups"),request.getParameter("username"));
        return true;
    }
    
    //中断任务
    @RequestMapping(method=RequestMethod.GET,value="/delecttask1/{id}/{line}")
    public String delecttask1(Model model,@PathVariable("id") Long id,@PathVariable("line") Long line){
        return cutManageService.delecttask1(id,line);
    }    
 
    
   /* @RequestMapping(method=RequestMethod.GET,value="/tuikuinfo/{loadMachineId}")
    public String tuikuinfo(Model model,@PathVariable("loadMachineId") String loadMachineId){
        return cutManageService.tuikuinfo(loadMachineId);
    }*/
    //手动添加上片位信息
      @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:/cutmanage/loadmachinerack";
      }
    
    //手动修改上片位信息
      @RequestMapping(method=RequestMethod.POST, value="/modifyAction")
      public String modifyAction(HttpServletRequest request,@RequestParam(value="pieces") String pieces,@RequestParam("Ids") String Ids) {
          cutManageService.modifyAction(pieces,Ids);
          return "redirect:/cutmanage/loadmachinerack";
      }
      
      @RequestMapping(method=RequestMethod.GET, value="/taskreport")
    public String getTaskReportPage(Model model){
        //处理1号线的统计任务
        List<GalssTaskDetails> galssTaskDetails = galssTaskDetailsDao.findGalssTaskDetails();
        model.addAttribute("reportTasks", galssTaskDetails);
        /*Map<String, Object> param1 = manageService.showMachineState();
          model.addAttribute("allstatu", param1.get("allstatu"));
         model.addAttribute("info", param1.get("info"));*/
        return "cutmanage/reportTask";
    }
      
       
     @RequestMapping(method=RequestMethod.POST, value="/selectreport")
     public String selectReport(HttpServletRequest request,Model model) throws ParseException{
         //获取点击的optname
         List<GalssTaskDetails> galssTaskDetails = cutManageService.selectgalssTaskDetails(request);
         model.addAttribute("reportTasks", galssTaskDetails);
         return "reporttask/reportTask";
     }
     
     @RequestMapping(method=RequestMethod.POST, value="/updatepieces")
    @ResponseBody
    public boolean updatepieces(HttpServletRequest request, Model model) {
         cutManageService.updatepieces(Long.valueOf(request.getParameter("rankid")),request.getParameter("pieces"));
        return true;
    }
     
     @RequestMapping(method=RequestMethod.POST, value="/updatetask")
    @ResponseBody
    public boolean updatetask(HttpServletRequest request, Model model) {
         cutManageService.updatetask(Long.valueOf(request.getParameter("id")));
        return true;
    }
     
     @RequestMapping(method=RequestMethod.POST, value="/updatetask1")
    @ResponseBody
    public boolean updatetask1(HttpServletRequest request, Model model) {
         cutManageService.updatetask1(Long.valueOf(request.getParameter("id")));
        return true;
    }
     //打标动作选择
     @RequestMapping(method=RequestMethod.GET, value="/task")
    public String task(Model model){
         model.addAttribute("numberlisthtml", cutManageService.getnumberlist());
        return "cutmanage/task"; 
    } 
      //手动任务添加
     @RequestMapping(method=RequestMethod.GET,value="/taskadd")
      public String taskadd(Model model,HttpServletRequest request) {
         cutManageService.taskadd(request);
          return "redirect:/cutmanage/task";
      }
     
     
       
       //TODO 标记任务完成
       @RequestMapping(method=RequestMethod.GET,value="/markover/{fileName}/{line}")
       public String markover(@PathVariable("fileName") String fileName,@PathVariable("line") String line,Model model){
        
        return cutManageService.markover(fileName,line,model);
        //return cutManageService.getTask(line, model);
       }
       
       //TODO 查看其他工程的任务
       @RequestMapping(method=RequestMethod.GET,value="lookOverStateTsaks/{line}")
       public String allOthersStateTsaks(Model model,@PathVariable("line") String line){
        return cutManageService.lookOverStateTsaks(model,line);   
       }
       
       //TODO 重新下发
       @RequestMapping(method=RequestMethod.GET,value="againXiaFaTast/{fileName}/{line}")
       public String againXiaFaTast(@PathVariable("fileName") String fileName,@PathVariable("line") String line,Model model){
        return cutManageService.againXiaFaTast(fileName,line,model);
       }
     
      
}