package com.northglass.web.cutmanage;
|
|
import java.io.IOException;
|
import java.io.UnsupportedEncodingException;
|
import java.sql.Date;
|
import java.util.ArrayList;
|
import java.util.List;
|
import java.util.Map;
|
|
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletResponse;
|
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.ResponseBody;
|
|
import com.northglass.entity.OptPattern;
|
import com.northglass.entity.RawPackageTxt;
|
import com.northglass.entity.ReportTask;
|
import com.northglass.entity.SingalGlass;
|
import com.northglass.repository.LoadMachineDao;
|
import com.northglass.repository.LoadMachineTaskDao;
|
import com.northglass.repository.OptPatternDao;
|
import com.northglass.repository.ProdLineStateDao;
|
import com.northglass.repository.RawPackageTxtDao;
|
import com.northglass.service.cutmachinemanage.GetTaskService;
|
import com.northglass.service.cutmanage.CutManageService;
|
import com.northglass.service.device.DeviceService;
|
import com.northglass.service.manage.ManageService;
|
import com.northglass.service.orderglassinfo.OrderGlassInfoService;
|
|
@Controller
|
@RequestMapping(value="/cutmanage")
|
public class CutManageController {
|
|
@Autowired
|
GetTaskService getTaskService;
|
|
@Autowired
|
RawPackageTxtDao rawPackageTxtDao;
|
|
@Autowired
|
ProdLineStateDao prodLineStateDao;
|
|
@Autowired
|
OptPatternDao optPatternDao;
|
|
@Autowired
|
LoadMachineDao loadMachineDao;
|
|
@Autowired
|
LoadMachineTaskDao loadMachineTaskDao;
|
|
@Autowired
|
CutManageService cutManageService;
|
|
@Autowired
|
ManageService manageService;
|
|
//待领取任务界面(1号切割机)
|
@RequestMapping(method=RequestMethod.GET, value="/gettask/{line}")
|
public String getTask(Model model,@PathVariable("line") String line){
|
return cutManageService.getTask(line, model);
|
}
|
/**
|
* 领取任务前校验数据库中是否还有可以领取的任务,是否已进入单机模式,是否该任务已被领取,该任务库存是否满足生产
|
* @param request
|
* @param response
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET, value="/checktask")
|
@ResponseBody
|
public String checkTask(HttpServletRequest request,HttpServletResponse response){
|
return cutManageService.checktask(request);
|
}
|
|
/**
|
* 删除当前的任务(默认完成)
|
* @param request
|
* @param response
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET, value="/deletetask")
|
@ResponseBody
|
public String deletetask(HttpServletRequest request,HttpServletResponse response){
|
return cutManageService.deletetask(request);
|
}
|
|
/**
|
* 领取任务,生成单片任务表,放到loadmachinetask中,一条记录默认片数是1
|
* @param request
|
* @param response
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET, value="/gottask/{id}")
|
public String gotTask(@PathVariable("id") String id,HttpServletRequest request,HttpServletResponse response,Model model){
|
return cutManageService.getTaskInterface(request, response, Long.valueOf(id), model);
|
}
|
|
@Autowired
|
private OrderGlassInfoService orderGlassInfoService;
|
/**
|
* 任务下发
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET, value="/renwuxiafa")
|
public String renwuxiafa(Model model){
|
model.addAttribute("allGlasseshtmls", orderGlassInfoService.getAllGlassHtmls());
|
model.addAttribute("groupshtmls", orderGlassInfoService.groupshtmls());
|
return "cutmanage/renwuxiafa";
|
|
}
|
|
@RequestMapping(method=RequestMethod.POST, value="/renwuxiafaa")
|
public String renwuxiafaa(Model model,HttpServletRequest request){
|
cutManageService.renwuxiafaas(request);
|
|
model.addAttribute("allGlasseshtmls", orderGlassInfoService.getAllGlassHtmls());
|
return "cutmanage/renwuxiafa";
|
|
}
|
|
/**
|
* 机器管理
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET, value="/shelfguanli")
|
public String shelfguanli(Model model){
|
model.addAttribute("shelfhtmls", orderGlassInfoService.shelfhtmls());
|
return "cutmanage/shelfguanli";
|
|
}
|
|
/**
|
* 修改任务状态
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET, value="/updateshelfguanli/{id}")
|
public String updateshelfguanli(Model model,@PathVariable("id") String id){
|
orderGlassInfoService.updateshelf(id);
|
return "redirect:/cutmanage/shelfguanli";
|
|
}
|
|
/**
|
* 修改任务状态
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET, value="/updateshelfguanli1/{id}")
|
public String updateshelfguanli1(Model model,@PathVariable("id") String id){
|
orderGlassInfoService.updateshelf1(id);
|
return "redirect:/cutmanage/shelfguanli";
|
|
}
|
|
/**
|
* 领取任务,生成单片任务表,放到loadmachinetask中,一条记录默认片数是1(2号线)
|
* @param request
|
* @param response
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET, value="/gottask2")
|
public String gotTask2(HttpServletRequest request,HttpServletResponse response,Model model){
|
return cutManageService.getTaskInterface(request, response, (long) 2, model);
|
}
|
|
|
/**
|
* 显示任务列表界面
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET, value="/tasklist/{id}")
|
public String getTaskList(@PathVariable("id") String id,Model model){
|
model.addAttribute("patterns", cutManageService.getTaskList(Long.valueOf(id)));
|
model.addAttribute("sumPiece", cutManageService.countPiece(cutManageService.getTaskList(Long.valueOf(id))).get(0));
|
model.addAttribute("comPiece", cutManageService.countPiece(cutManageService.getTaskList(Long.valueOf(id))).get(1));
|
model.addAttribute("line", id);
|
model.addAttribute("taskhtml", cutManageService.getTasks(Long.parseLong(id)));
|
return "cutmanage/gottask";
|
|
}
|
|
/**
|
* 显示任务列表界面(2号)
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET, value="/tasklist2")
|
public String getTaskList2(Model model){
|
model.addAttribute("patterns", cutManageService.getTaskList(2L));
|
model.addAttribute("sumPiece", cutManageService.countPiece(cutManageService.getTaskList(2L)).get(0));
|
model.addAttribute("comPiece", cutManageService.countPiece(cutManageService.getTaskList(2L)).get(1));
|
return "cutmanage/gottask2";
|
|
}
|
|
|
/**
|
* 结束任务前校验任务完成情况
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET, value="/checkdata/{id}")
|
@ResponseBody
|
public String checkData(@PathVariable("id") String id){
|
//根据ID判断当前生产线状态 为有任务时返回: 否则返回:
|
return cutManageService.checkEnd(id);
|
}
|
|
|
/**
|
* 结束任务前校验任务完成情况(2号)
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET, value="/checkdata2")
|
@ResponseBody
|
public String checkData2(){
|
return cutManageService.checkEnd2();
|
}
|
|
|
/**
|
* 切割机结束任务
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET, value="/completetask/{id}")
|
public String completeTask(Model model,HttpServletResponse response,@PathVariable("id") String id){
|
// cutManageService.print(id);
|
return cutManageService.endTask(id,model);
|
}
|
|
|
//exitTask
|
@RequestMapping(method=RequestMethod.GET, value="/exitTask/{id}")
|
public String exitTask(Model model,@PathVariable("id") String id){
|
return cutManageService.exitTask(id);
|
}
|
/**
|
* 填写原因后结束任务(异常结束)
|
* @return
|
* @throws UnsupportedEncodingException
|
*/
|
@RequestMapping(method=RequestMethod.GET, value="/exceptionendtask")
|
public String exceptionEndTask(HttpServletRequest request) throws UnsupportedEncodingException{
|
String prodLine = request.getParameter("prodLine");// 获取产线
|
cutManageService.exceptionEndTask(request,prodLine);
|
return "redirect:/cutmanage/gettask/"+prodLine;
|
|
}
|
|
|
/**
|
* 查看当前正在切割的玻璃信息
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET, value="/lookworkingglass")
|
@ResponseBody
|
public String lookGlass(HttpServletRequest request){
|
return cutManageService.workingGlass(request);
|
}
|
|
/**
|
* 下载opt文件
|
* @param request
|
* @param model
|
* @return
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET,value="/downopt1")
|
public String downOptOne(HttpServletRequest request,Model model,HttpServletResponse response){
|
return cutManageService.downModelLoad(request,response, (long) 1);
|
}
|
|
/**
|
* 下载opt文件(2)
|
* @param request
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET,value="/downopt2")
|
public void downOptTwo(HttpServletRequest request,Model model,HttpServletResponse response){
|
//下载服务器上的opt文件到本地
|
cutManageService.downModelLoad(request,response, (long) 2);
|
}
|
|
|
/**
|
* 手动完成任务
|
* @param request
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET,value="/manual")
|
public String manual(Model model){
|
//下载服务器上的opt文件到本地
|
cutManageService.manual();
|
return "redirect:/cutmanage/gottask";
|
}
|
|
|
/**
|
* 暂停/开启任务
|
* @param request
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET,value="/stoptask/{id}")
|
public String stoptask(Model model,@PathVariable("id") String id){
|
cutManageService.stoptask(id);
|
return "redirect:/cutmanage/gottask/"+id;
|
}
|
|
/**
|
* 打印所有的标签
|
* @param request
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET,value="/jbarprint/{id}")
|
public String jbarprint(Model model,@PathVariable("id") String id){
|
cutManageService.jbarprint(id);
|
return "redirect:/cutmanage/gottask";
|
}
|
|
/**
|
* 任务修改界面
|
* @param request
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET,value="/errordeal/{id}")
|
public String errordeal(Model model,@PathVariable("id") String id){
|
model.addAttribute("erroedealhtml", cutManageService.errordeal(id));
|
model.addAttribute("id", id);
|
return "cutmanage/errordeal";
|
}
|
|
|
/**
|
* 下发单个小片
|
* @param request
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET,value="/getoneglass/{id}/{line}")
|
public String getoneglass(Model model,@PathVariable("id") String id,@PathVariable("line") String line){
|
cutManageService.getoneglass(id);
|
return "redirect:/cutmanage/errordeal/"+line;
|
}
|
|
/**
|
* 下发所以小片
|
* @param request
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET,value="/getglass/{id}")
|
public String getglass(Model model,@PathVariable("id") String id){
|
cutManageService.getglass(id);
|
return "redirect:/cutmanage/errordeal/"+id;
|
}
|
|
|
/**
|
* 任务设置已完成
|
* @param request
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET,value="/finishtask/{id}/{line}")
|
public String finishtask(Model model,@PathVariable("id") String id,@PathVariable("line") String line){
|
cutManageService.finishtask(id);
|
return "redirect:/cutmanage/errordeal/"+line;
|
}
|
|
|
/**
|
* 当前小片信息
|
* @param request
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET,value="/getsingalglass/{id}/{line}")
|
public String getsingalglass(Model model,@PathVariable("id") String id,@PathVariable("line") String line){
|
model.addAttribute("erroedealhtml", cutManageService.getsingalglass(id));
|
model.addAttribute("id", line);
|
return "cutmanage/getsingalglass";
|
}
|
|
/**
|
* 任务设置等待中
|
* @param request
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET,value="/againtask/{id}/{line}")
|
public String againtask(Model model,@PathVariable("id") String id,@PathVariable("line") String line){
|
cutManageService.againtask(id);
|
return "redirect:/cutmanage/errordeal/"+line;
|
}
|
|
|
/**
|
* 切割TV
|
* @param request
|
* @param model
|
* @return
|
*/
|
@RequestMapping(method=RequestMethod.GET,value="/getview/{id}")
|
public String getview(Model model,@PathVariable("id") String id) throws IOException{
|
model.addAttribute("getviewhtml", cutManageService.getview(id));
|
model.addAttribute("id", id);
|
return "cutmanage/getview";
|
}
|
|
//上片机显示
|
@RequestMapping(method=RequestMethod.GET,value="/loadmachinemanager")
|
public String loadmachinemanager(Model model) {
|
model.addAttribute("LoadMachineOne", manageService.getLoadMachineHtml((long)1));
|
return "cutmanage/loadmachinemanager";
|
}
|
|
@RequestMapping(method=RequestMethod.GET, value="/qaz")
|
public String qaz(Model model){
|
return cutManageService.getShelfRankInfos(model);
|
|
}
|
|
@RequestMapping(method=RequestMethod.POST, value="/selectreport")
|
public String selectreport(HttpServletRequest request,Model model){
|
List<OptPattern> reportTasks = cutManageService.selectReport(request);
|
model.addAttribute("rawPackageTxts", reportTasks);
|
return "cutmanage/qaz";
|
}
|
|
}
|
|