package com.northglass.web.shelf;
|
|
import java.util.Map;
|
|
import javax.servlet.ServletRequest;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.data.domain.Page;
|
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.springside.modules.web.Servlets;
|
|
import com.google.common.collect.Maps;
|
import com.northglass.entity.ShelfMessage;
|
import com.northglass.service.loadmachinerack.LoadMachineRackService;
|
import com.northglass.service.shelf.ShelfMessageService;
|
import com.northglass.service.shelf.ShelfService;
|
import com.northglass.service.shelfmanager.ShelfManagerService;
|
import com.northglass.service.shelfrank.ShelfRankService;
|
import com.northglass.service.shelftask.ShelfTaskService;
|
|
@Controller
|
@RequestMapping(value="/shelf")
|
public class ShelfController {
|
|
@Autowired
|
private ShelfService shelfService;
|
|
@Autowired
|
private ShelfMessageService shelfMessageService;
|
|
@Autowired
|
private ShelfManagerService shelfManagerService;
|
|
@Autowired
|
private ShelfRankService shelfRankService;
|
|
@Autowired
|
private LoadMachineRackService loadMachineRackService;
|
|
@Autowired
|
private ShelfTaskService shelfTaskService;
|
|
@RequestMapping(method=RequestMethod.GET, value="/message/{id}")
|
public String message(
|
@RequestParam(value="page", defaultValue="1") int pageNumber,
|
@RequestParam(value="page.size", defaultValue="15") int pageSize,
|
@RequestParam(value="softType", defaultValue="auto") String sortType,
|
Model model,
|
ServletRequest request,
|
@PathVariable("id") Long id) {
|
|
Map<String, Object> searchParams = Servlets.getParametersStartingWith(request, "search_");
|
Page<ShelfMessage> shelfMessages = shelfMessageService.get(searchParams, pageNumber, pageSize, sortType);
|
Map<String, String> sortTypes = Maps.newLinkedHashMap();
|
sortTypes.put("auto", "自动");
|
|
model.addAttribute("shelfMessages", shelfMessages);
|
model.addAttribute("sortType", sortType);
|
model.addAttribute("sortTypes", sortTypes);
|
model.addAttribute("searchParams", Servlets.encodeParameterStringWithPrefix(searchParams, "search_"));
|
|
return "shelf/message";
|
}
|
|
@RequestMapping(method=RequestMethod.GET, value="/editRankAndHoist")
|
public String editRankAndHoist(Model model) {
|
model.addAttribute("editShelfRankHtml", shelfService.getEditShelfRankHtml());
|
model.addAttribute("editShelfHoistHtml", shelfService.getEditShelfHoistHtml());
|
model.addAttribute("ShelfRankNumberList", shelfService.getShelfRankNumber());
|
model.addAttribute("shelfRankInfo", shelfManagerService.getNewShelfRankInfo());
|
model.addAttribute("loadAndShelfHoistInfo", shelfManagerService.getNewLoadAndShelfHoistInfo());
|
return "shelf/editRankAndHoist";
|
}
|
|
@RequestMapping(method=RequestMethod.GET, value="/findRank/{id}")
|
public String findRank(Model model,@ PathVariable("id") String id) {
|
model.addAttribute("editShelfRankHtml", shelfService.getEditShelfRankHtml());
|
model.addAttribute("editShelfHoistHtml", shelfService.getEditShelfHoistHtml());
|
model.addAttribute("ShelfRankNumberList", shelfService.getShelfRankNumber());
|
model.addAttribute("findShelfRankInfo", shelfService.getShelfRankInfo(id));
|
model.addAttribute("rankUserInfo", shelfService.rankUserInfo(id));
|
model.addAttribute("shelfRankInfo", shelfManagerService.getNewShelfRankInfo());
|
model.addAttribute("loadAndShelfHoistInfo", shelfManagerService.getNewLoadAndShelfHoistInfo());
|
return "shelf/editRankAndHoist";
|
}
|
|
//禁用料架
|
@RequestMapping(method=RequestMethod.GET, value="/taboo/{id}")
|
public String taboo(Model model,@ PathVariable("id") String id) {
|
shelfService.taboo(id);
|
return "redirect:/shelf/editRankAndHoist";
|
}
|
|
//解除禁用
|
@RequestMapping(method=RequestMethod.GET, value="/noTaboo/{id}")
|
public String noTaboo(Model model,@ PathVariable("id") String id) {
|
shelfService.notaboo(id);
|
return "redirect:/shelf/editRankAndHoist";
|
}
|
}
|