|
|
@@ -0,0 +1,145 @@
|
|
|
+package com.jeesite.modules.mes.web;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
+import com.jeesite.common.config.Global;
|
|
|
+import com.jeesite.common.entity.Page;
|
|
|
+import com.jeesite.common.lang.ObjectUtils;
|
|
|
+import com.jeesite.common.lang.StringUtils;
|
|
|
+import com.jeesite.common.web.BaseController;
|
|
|
+import com.jeesite.modules.mes.entity.MesProductDhbKc;
|
|
|
+import com.jeesite.modules.mes.resp.CommonResp;
|
|
|
+import com.jeesite.modules.mes.service.MesProductDhbKcService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.ui.Model;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 底护板入库 Controller(清洗工位)
|
|
|
+ * 520: OP285 / 610: OP290
|
|
|
+ */
|
|
|
+@Controller
|
|
|
+@RequestMapping(value = "${adminPath}/mes/mesProductDhbKc")
|
|
|
+public class MesProductDhbKcController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MesProductDhbKcService mesProductDhbKcService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 后台列表页
|
|
|
+ */
|
|
|
+ @RequestMapping(value = {"list", ""})
|
|
|
+ public String list(MesProductDhbKc mesProductDhbKc, Model model) {
|
|
|
+ model.addAttribute("mesProductDhbKc", mesProductDhbKc);
|
|
|
+ return "modules/mes/mesProductDhbKcList";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 后台列表数据
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "listData")
|
|
|
+ @ResponseBody
|
|
|
+ public Page<MesProductDhbKc> listData(MesProductDhbKc mesProductDhbKc, HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ mesProductDhbKc.setPage(new Page<>(request, response));
|
|
|
+ return mesProductDhbKcService.findPage(mesProductDhbKc);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 入库(客户端 op290-dh 调用)
|
|
|
+ * params: batchSn 底护板码 / oprno 工位号 / lineSn 产线 / userCode 操作员
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "in")
|
|
|
+ @ResponseBody
|
|
|
+ public CommonResp<MesProductDhbKc> in(HttpServletRequest request) {
|
|
|
+ CommonResp<MesProductDhbKc> resp = new CommonResp<>();
|
|
|
+ String batchSn = StringUtils.trim(request.getParameter("batchSn"));
|
|
|
+ String oprno = StringUtils.trim(request.getParameter("oprno"));
|
|
|
+ String lineSn = StringUtils.trim(request.getParameter("lineSn"));
|
|
|
+ String userCode = StringUtils.trim(request.getParameter("userCode"));
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(batchSn)) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage("底护板码不能为空");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 已存在 → 直接返回(保证幂等:重复扫不报错)
|
|
|
+ MesProductDhbKc q = new MesProductDhbKc();
|
|
|
+ q.setBatchSn(batchSn);
|
|
|
+ MesProductDhbKc exist = mesProductDhbKcService.findInfo(q);
|
|
|
+ if (!ObjectUtils.isEmpty(exist)) {
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
+ if ("1".equals(exist.getState())) {
|
|
|
+ resp.setMessage("该底护板已绑定工件: " + exist.getBindSn());
|
|
|
+ } else {
|
|
|
+ resp.setMessage("该底护板已入库");
|
|
|
+ }
|
|
|
+ resp.setData(exist);
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 新增
|
|
|
+ MesProductDhbKc kc = new MesProductDhbKc();
|
|
|
+ kc.setBatchSn(batchSn);
|
|
|
+ kc.setState("0");
|
|
|
+ kc.setOprno(oprno);
|
|
|
+ kc.setLineSn(lineSn);
|
|
|
+ if (StringUtils.isNotEmpty(userCode)) {
|
|
|
+ kc.setCreateBy(userCode);
|
|
|
+ kc.setUpdateBy(userCode);
|
|
|
+ }
|
|
|
+ mesProductDhbKcService.save(kc);
|
|
|
+
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
+ resp.setMessage("入库成功");
|
|
|
+ resp.setData(kc);
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 校验是否已入库(压合工位绑定时调用)
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "check")
|
|
|
+ @ResponseBody
|
|
|
+ public CommonResp<MesProductDhbKc> check(HttpServletRequest request) {
|
|
|
+ CommonResp<MesProductDhbKc> resp = new CommonResp<>();
|
|
|
+ String batchSn = StringUtils.trim(request.getParameter("batchSn"));
|
|
|
+ if (StringUtils.isEmpty(batchSn)) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage("底护板码不能为空");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ MesProductDhbKc q = new MesProductDhbKc();
|
|
|
+ q.setBatchSn(batchSn);
|
|
|
+ MesProductDhbKc exist = mesProductDhbKcService.findInfo(q);
|
|
|
+ if (ObjectUtils.isEmpty(exist)) {
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage("该底护板未入库");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
+ resp.setData(exist);
|
|
|
+ if ("1".equals(exist.getState())) {
|
|
|
+ resp.setMessage("已绑定工件: " + exist.getBindSn());
|
|
|
+ } else {
|
|
|
+ resp.setMessage("已入库, 未绑工件");
|
|
|
+ }
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 服务器健康检查(客户端启动时探测)
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "ping")
|
|
|
+ @ResponseBody
|
|
|
+ public CommonResp<String> ping() {
|
|
|
+ CommonResp<String> resp = new CommonResp<>();
|
|
|
+ resp.setResult(Global.TRUE);
|
|
|
+ resp.setMessage("ok");
|
|
|
+ resp.setData("ok");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+}
|