MesErpPrdInstockLogController.java 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package com.jeesite.modules.mes.web;
  2. import com.jeesite.common.entity.Page;
  3. import com.jeesite.common.lang.StringUtils;
  4. import com.jeesite.common.mybatis.mapper.query.QueryType;
  5. import com.jeesite.common.web.BaseController;
  6. import com.jeesite.modules.mes.entity.MesBatchSn;
  7. import com.jeesite.modules.mes.entity.MesErpPrdInstockLog;
  8. import com.jeesite.modules.mes.service.MesBatchSnService;
  9. import com.jeesite.modules.mes.service.MesErpPrdInstockLogService;
  10. import org.apache.shiro.authz.annotation.RequiresPermissions;
  11. import org.springframework.stereotype.Controller;
  12. import org.springframework.ui.Model;
  13. import org.springframework.web.bind.annotation.ModelAttribute;
  14. import org.springframework.web.bind.annotation.RequestMapping;
  15. import org.springframework.web.bind.annotation.ResponseBody;
  16. import javax.servlet.http.HttpServletRequest;
  17. import javax.servlet.http.HttpServletResponse;
  18. import java.util.List;
  19. /**
  20. * MES 生产入库单与批次码绑定明细。
  21. */
  22. @Controller
  23. @RequestMapping(value = "${adminPath}/mes/mesErpPrdInstockLog")
  24. public class MesErpPrdInstockLogController extends BaseController {
  25. private final MesErpPrdInstockLogService mesErpPrdInstockLogService;
  26. private final MesBatchSnService mesBatchSnService;
  27. public MesErpPrdInstockLogController(MesErpPrdInstockLogService mesErpPrdInstockLogService,
  28. MesBatchSnService mesBatchSnService) {
  29. this.mesErpPrdInstockLogService = mesErpPrdInstockLogService;
  30. this.mesBatchSnService = mesBatchSnService;
  31. }
  32. @ModelAttribute
  33. public MesErpPrdInstockLog get(String id, boolean isNewRecord) {
  34. return mesErpPrdInstockLogService.get(id, isNewRecord);
  35. }
  36. @RequiresPermissions("mes:mesErpPrdInstockLog:view")
  37. @RequestMapping(value = {"list", ""})
  38. public String list(MesErpPrdInstockLog mesErpPrdInstockLog, Model model) {
  39. model.addAttribute("mesErpPrdInstockLog", mesErpPrdInstockLog);
  40. return "modules/mes/mesErpPrdInstockLogList";
  41. }
  42. @RequiresPermissions("mes:mesErpPrdInstockLog:view")
  43. @RequestMapping(value = "listData")
  44. @ResponseBody
  45. public Page<MesErpPrdInstockLog> listData(MesErpPrdInstockLog mesErpPrdInstockLog,
  46. HttpServletRequest request, HttpServletResponse response) {
  47. mesErpPrdInstockLog.setPage(new Page<>(request, response));
  48. String batchSnQuery = StringUtils.trim(request.getParameter("batchSnQuery"));
  49. if (StringUtils.isNotBlank(batchSnQuery)) {
  50. mesErpPrdInstockLog.getSqlMap().getWhere()
  51. .and("a.batch_sn_list", QueryType.LIKE, batchSnQuery);
  52. }
  53. return mesErpPrdInstockLogService.findPage(mesErpPrdInstockLog);
  54. }
  55. @RequiresPermissions("mes:mesErpPrdInstockLog:view")
  56. @RequestMapping(value = "detail")
  57. public String detail(MesErpPrdInstockLog mesErpPrdInstockLog, Model model) {
  58. List<MesBatchSn> batchList = mesBatchSnService.findByErpInstockBillNo(mesErpPrdInstockLog.getErpBillNo());
  59. model.addAttribute("mesErpPrdInstockLog", mesErpPrdInstockLog);
  60. model.addAttribute("batchList", batchList);
  61. return "modules/mes/mesErpPrdInstockLogDetail";
  62. }
  63. /** 从 ERP 入库单号跳转绑定明细(MES 推送才有记录) */
  64. @RequiresPermissions("mes:mesErpPrdInstockLog:view")
  65. @RequestMapping(value = "byErpBill")
  66. public String byErpBill(String erpBillNo, Model model) {
  67. String billNo = StringUtils.trim(erpBillNo);
  68. MesErpPrdInstockLog log = mesErpPrdInstockLogService.findByErpBillNo(billNo);
  69. if (log == null) {
  70. MesErpPrdInstockLog query = new MesErpPrdInstockLog();
  71. query.setErpBillNo(billNo);
  72. model.addAttribute("mesErpPrdInstockLog", query);
  73. model.addAttribute("message", "入库单 " + billNo + " 无 MES 批次绑定记录(可能非 MES 推送生成)");
  74. return "modules/mes/mesErpPrdInstockLogList";
  75. }
  76. return detail(log, model);
  77. }
  78. }